fix(chat): count a subagent's edits in the turn's Edited N files card (#86)

A skill that hands its work to subagents (vp-auto) showed "Edited 1 file"
for a turn that changed 4: a subagent's Write/Edit calls are in its own
agent-<id>.jsonl, so the card only saw the parent's.

- server/lib/agent-edits.js reads a subagent's transcript (readLines, a
  member's only as theirs) for the files it wrote or edited with their +/-
  lines, nested subagents folded in (3 levels), cached by size + mtime.
- The transcript route puts them on each Claude Agent/Task result as
  `edits`; the card adds them to the turn's own edits. A file only a
  subagent wrote is listed, never an artifact card (its versions are
  rebuilt from this transcript's inputs, which a subagent's are not).
This commit is contained in:
2026-10-23 14:26:29 +07:00
parent c8bc4a95a9
commit 5ccbaf5c23
7 changed files with 330 additions and 4 deletions
+6
View File
@@ -1290,6 +1290,12 @@ router.get("/:id/transcript", async (req, res) => {
hasMore = total > limit;
}
// A Claude subagent's own Write/Edit calls are in ITS transcript: put the
// files on its Agent result, so the turn's "Edited N files" counts them.
if (!isCodex && !isOmp && !isCursor && !isAgy) {
await require("../lib/agent-edits").attachAgentEdits(messages, req.params.id, session.cwd);
}
const lastLine = messages.length > 0 ? messages[messages.length - 1].line : 0;
const firstLine = messages.length > 0 ? messages[0].line : 0;