Transcript: copy every code card and tool output, strip colour codes, cap long output and tall images
In the agent chat transcript, a code card that was still streaming, too large to highlight or slow to highlight had no copy button. The copy on highlighted cards said "Copied" even when the clipboard refused, and it never went back to Copy. Opening a tool call printed its whole output as one text node: terminal colour codes showed up as [32m junk, and a megabyte of output was drawn all at once. Plain (non-shell) tool output couldn't be copied at all.
Now:
- Every code card has Copy, including streaming, oversized and slow-to-highlight ones.
- Copy shows a check and "Copied" only when the clipboard took the text, then resets after 1.2 s.
- An opened call's output (the Shell block, or plain output) has its colour codes removed. It shows only its last 400 lines (40k characters at most) under a … mark, with Show all output / Show less, and Copy copies all of it.
- A reply image is no taller than 360px; the viewer still shows it full size.
The colour-code stripping now lives in one place (toolOutput.tsx), and the localhost-preview detector uses it. There are no new strings: this reuses code.copy, code.copied, turn.copy and shell.showAll/shell.showLess.
Verification
bun test test/transcript-output-copy.test.tsx: 5 fail on the test commit 50524c734fd8, and 5 pass on the fix 29ef1bf1e4c3.- Review follow-ups:
bun test test/transcript-output-copy.test.tsxfails 1 of 7 on cea95e38fc22 (charset and keypad codes still showed) and passes 7 of 7 on dd88e338a425. A call that Find in Chat reveals now shows its whole output; that path has no automated test. bun run checkis clean.- Full
bun test: the same 88 failures on base 247a075c9344 and on this head, with no new ones and none fixed. They come from tests sharing one process. - Gallery: new
agent-pane.transcriptvariantshell-long-colored-output; gallery coverage passes. - Not done: no capture on a native build.
User-sent images not showing in the transcript need data plumbing (direct.ts keeps only the prompt's text), so they get a separate PR.
Changelog
Fixed: Chat transcripts can copy every code block and tool output, hide terminal colour codes, show the end of long outputs with Show all, and keep tall images to a sensible height.
🤖 Generated with Claude Code