PWA chat: summarise a finished turn's work in one line above its expanded log #602

Open
toasterson wants to merge 1 commit from claude/wi-019ff174-pwa-chat-summarise-a-finished-turn-s-wor into main
Owner

Anima work item 019ff174-7e99-7012-a29b-a2e2a853b2c9.

A turn that touches thirty files produces thirty ToolCallCards. Each is individually correct and individually collapsed, but the turn as a whole has no shape — you cannot tell at a glance whether the agent read around for ten minutes or actually changed something.

REFERENCE PATTERN: shadcn-ui/chatbot-template renders its citation aggregate ONLY after streaming stops (components/chat-message.tsx gates <SourcesPart> on !isStreaming), dedupes it, and collapses it to a count — "Searched 5 websites" — that opens on demand. The two properties worth copying are: aggregate only once the turn is CLOSED (a running count that ticks upward is noise), and summarise without hiding.

WHAT TO BUILD

  • A one-line summary rendered at the top of a COMPLETED turn's working log: counts by ToolCall.kind and the net diff, e.g. "Read 14 · edited 3 (+120 −18) · ran 2 commands · 1 failed".
  • Derive it from data already in the timeline (src/lib/acp.ts SessionTimeline / TimelineItem / ToolCall). Add no new server call and no new proto field.
  • Failures are never folded into a bland count — if any call failed, the summary says so and stays visually distinct.
  • The individual cards remain, unchanged, below it. This ADDS a summary; it does not replace or hide the log.
  • Do not render it for a live turn. While the turn is in flight the working log is the point.

CONSTRAINTS

  • Reuse diffLines from src/lib/linediff for the +/− totals and memoize the aggregate — ToolCallCard already learned the hard way that recomputing the LCS on every render is expensive.
  • Static Tailwind class literals.

VERIFY: unit tests for the aggregation (counts by kind, net diff, failure present/absent, live turn renders nothing). npm run build + full npm test green. Smoke on /prototype/chat.

Anima work item `019ff174-7e99-7012-a29b-a2e2a853b2c9`. A turn that touches thirty files produces thirty `ToolCallCard`s. Each is individually correct and individually collapsed, but the turn as a whole has no shape — you cannot tell at a glance whether the agent read around for ten minutes or actually changed something. REFERENCE PATTERN: `shadcn-ui/chatbot-template` renders its citation aggregate ONLY after streaming stops (`components/chat-message.tsx` gates `<SourcesPart>` on `!isStreaming`), dedupes it, and collapses it to a count — "Searched 5 websites" — that opens on demand. The two properties worth copying are: aggregate only once the turn is CLOSED (a running count that ticks upward is noise), and summarise without hiding. WHAT TO BUILD - A one-line summary rendered at the top of a COMPLETED turn's working log: counts by `ToolCall.kind` and the net diff, e.g. "Read 14 · edited 3 (+120 −18) · ran 2 commands · 1 failed". - Derive it from data already in the timeline (`src/lib/acp.ts` `SessionTimeline` / `TimelineItem` / `ToolCall`). Add no new server call and no new proto field. - Failures are never folded into a bland count — if any call failed, the summary says so and stays visually distinct. - The individual cards remain, unchanged, below it. This ADDS a summary; it does not replace or hide the log. - Do not render it for a live turn. While the turn is in flight the working log is the point. CONSTRAINTS - Reuse `diffLines` from `src/lib/linediff` for the +/− totals and memoize the aggregate — `ToolCallCard` already learned the hard way that recomputing the LCS on every render is expensive. - Static Tailwind class literals. VERIFY: unit tests for the aggregation (counts by kind, net diff, failure present/absent, live turn renders nothing). `npm run build` + full `npm test` green. Smoke on `/prototype/chat`.
toasterson changed title from WIP: PWA chat: summarise a finished turn's work in one line above its expanded log to PWA chat: summarise a finished turn's work in one line above its expanded log 2026-08-18 15:03:39 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin claude/wi-019ff174-pwa-chat-summarise-a-finished-turn-s-wor:claude/wi-019ff174-pwa-chat-summarise-a-finished-turn-s-wor
git switch claude/wi-019ff174-pwa-chat-summarise-a-finished-turn-s-wor

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff claude/wi-019ff174-pwa-chat-summarise-a-finished-turn-s-wor
git switch claude/wi-019ff174-pwa-chat-summarise-a-finished-turn-s-wor
git rebase main
git switch main
git merge --ff-only claude/wi-019ff174-pwa-chat-summarise-a-finished-turn-s-wor
git switch claude/wi-019ff174-pwa-chat-summarise-a-finished-turn-s-wor
git rebase main
git switch main
git merge --no-ff claude/wi-019ff174-pwa-chat-summarise-a-finished-turn-s-wor
git switch main
git merge --squash claude/wi-019ff174-pwa-chat-summarise-a-finished-turn-s-wor
git switch main
git merge --ff-only claude/wi-019ff174-pwa-chat-summarise-a-finished-turn-s-wor
git switch main
git merge claude/wi-019ff174-pwa-chat-summarise-a-finished-turn-s-wor
git push origin main
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
toasterson/Anima!602
No description provided.