Expose recorded background task timing and progress metadata

This commit is contained in:
2026-11-06 15:08:34 +00:00
parent c9a4cd0bf6
commit 6421554bfe
16 changed files with 688 additions and 31 deletions
+4 -2
View File
@@ -26,7 +26,9 @@ func (s *ShellSnapshot) Record(shell *protocol.ChatShell) {
s.changes = make(map[string]protocol.ChatShell)
}
old := s.changes[shell.ID]
n := s.bytes - len(old.ID) - len(old.Command) + len(shell.ID) + len(shell.Command)
merged := protocol.PreserveChatShellMetadata(*shell, old)
shell = &merged
n := s.bytes - len(old.ID) - protocol.ChatShellRetainedBytes(old) + len(shell.ID) + protocol.ChatShellRetainedBytes(*shell)
if n > MaxResponse || (old.ID == "" && len(s.changes) >= chatShellIdentityLimit) {
s.overflow = true
return
@@ -51,7 +53,7 @@ func (s *ShellSnapshot) Merge(shells []protocol.ChatShell) ([]protocol.ChatShell
}
for id, shell := range s.changes {
if shell.Status == protocol.ChatShellRunning {
byID[id] = shell
byID[id] = protocol.PreserveChatShellMetadata(shell, byID[id])
} else {
delete(byID, id)
}