Expose native chat compaction activity and retained replay

This commit is contained in:
2026-10-20 22:17:13 +01:00
parent d8b111913e
commit 4969d667b3
17 changed files with 666 additions and 26 deletions
+14
View File
@@ -59,6 +59,20 @@ func (c *Chat) streamWithReadback(ctx context.Context, id string, ready func(),
c.mu.Unlock()
c.emit(stepFrame(id, protocol.ChatStepStarted, last.turn.ID))
}
// ThreadItem.contextCompaction has no running/completed field in history;
// never infer running from its presence. A terminal turn can, however,
// authoritatively settle a retained live compaction after a stream reattach.
if terminalTurn(last.turn) {
c.mu.Lock()
matching := c.turns[id] == last.turn.ID
if matching {
delete(c.turns, id)
}
c.mu.Unlock()
if matching {
c.emit(stepFrame(id, protocol.ChatStepEnded, last.turn.ID))
}
}
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
for {