Record each chat turn's workspace changes for every harness

Snapshot the chat directory with internal/filediff when a turn starts and
compare it when the turn ends; store changed turns (newest 100 per chat),
push chat_turn_diffs summaries, attach them to chat_messages replies and
serve one turn's patches through chat_turn_diff.
This commit is contained in:
2026-11-09 16:08:35 +00:00
parent 57679d9591
commit 0696ab849a
12 changed files with 798 additions and 2 deletions
+9
View File
@@ -74,6 +74,15 @@ type chatHub struct {
// and its sequence source (chat_activity.go).
activity map[string]protocol.ChatActivity
activitySeq int64
// turnDiffStore records per-turn workspace changes (chat_turn_diff.go);
// nil captures nothing. turnCaptures holds each session's pending
// baseline and finishingTurns the turn whose end snapshot is still being
// taken. turnDiffDirectory overrides the registry's directory in tests.
turnDiffStore chatTurnDiffStore
turnCaptures map[string]*chatTurnCapture
finishingTurns map[string]*chatTurnCapture
turnDiffWG sync.WaitGroup
turnDiffDirectory func(context.Context, string) string
}
// chatPart is the retained form of one part. Text and reasoning deltas append to