Expose native chat compaction activity and retained replay
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user