fix(story-mode): draw what real sessions did, from review round 1

Three review agents watched real Claude Code workers build small programs
and compared every panel with the transcript. Replaying their transcripts
through the core found, and now fixes:

- A Bash call was classified from its 400-character display clip, so a
  commit or a test run late in a long one-liner vanished (a failing pytest
  run drew as "saves the work"). The intent, the printed files and whether
  a save ships are now read from the whole command.
- A test run that reports failures failed, even when `| tail` hid the exit
  code. With that, the real fix-test-fix-test sequence folds into one loop:
  "Fix and test, 2 rounds. It passes in the end."
- node:test (`# pass 7`), all-failing pytest (`3 failed in 0.1s`) and
  pytest errors are counted.
- A helper started in the background was drawn as finished, with Claude
  Code's internal launch notes as its answer. It now stays running until its
  task notification arrives; the answer, tool count and duration are joined
  back onto it, and the final panel says when helpers are still out.
- The notification turn reported Claude Code's own duration, counted from
  the first prompt (2 min 38 s for a 21 s turn); a turn is capped at its span.
- Logging into scratch (`| tee "$S/dry.txt"`, `> /tmp/x`) counted as an edit;
  redirect targets are read quote-aware, and a here-document's body is data.
- A probe (`pytest --version`) reads as looking around, not running a tool.
- A plan Claude writes as a numbered list (no plan tool, as in current
  Claude Code builds) is drawn as a plan panel; files it cats are file cards.
- A balloon: code spans stay whole, an ellipsis or e.g. does not end the
  sentence, a remark about the check that just ran stays on that check, and
  a loop shows the last word of its rounds.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-18 10:11:47 +02:00
1 parent 13964e35db
commit 38585a806b
5 files changed
+539 -70

No files matched your search

+10
View File
@@ -84,6 +84,10 @@ export interface StoryHelper {
durationMs?: number;
/** Claude Code's id for the helper; its own steps are at `GET /api/sessions/:id/story/helpers/<agentId>`. */
agentId?: string;
/** Started in the background: Claude went on working, and the answer comes later in a notification. */
background?: boolean;
/** A background helper that has not reported back yet. */
running?: boolean;
}
export interface StoryTests {
@@ -109,9 +113,13 @@ export interface StoryEvent {
pending?: boolean;
/** The one file this event concerns (Read, Edit, Write), as the transcript gave it. */
file?: string;
/** Files a Bash call printed (`cat a b`, `head -n 20 c`), as the command named them (maybe relative). */
files?: string[];
line?: number;
/** Claude's own short description of a Bash call ("Run the test suite"). */
description?: string;
/** A save that ships the work: `gh pr create` (`pr`) or `git push` (`push`). */
ships?: 'pr' | 'push';
output?: string;
outputTruncated?: boolean;
edit?: StoryEdit;
@@ -164,6 +172,8 @@ export interface StoryPage extends StoryTurnSummary {
added: number;
removed: number;
helpers: number;
/** Background helpers that had not reported back when this page was drawn. */
helpersRunning: number;
}
/** `GET /api/sessions/:id/story/helpers/:agentId`: one helper's own steps, as one page. */