Agent chat: a long tool output that wraps past eight rows collapses with Show more
Leo's words (2026-10-22 21:28Z): "also the tool calling i think there should be more of like a "show more" type thing for long outputs or whatnot..."
Leo-ask: ask-c57e055a4e
What base already does
#23413 (merged 2026-10-21 15:59Z, after the 03960f5 nightly Leo's app runs) already collapses a tool block longer than eight lines:
- its first eight lines show under a 28px bottom fade;
- "Show all N lines" opens it in place, and "Show less" closes it;
- the button is keyboard reachable, and Find in Chat opens the block.
That covers a call's output, a command's Shell block and an edit's diff.
The gap this fixes
The cap counted newlines only. Output wraps by default, so a result with a few long lines (a one-line JSON result, a minified log line) wrapped to dozens of rows with no cap and no toggle.
Change
- A call's output and a Shell block whose few lines wrap past eight rows are now cut at eight rows the same way, with "Show more"; "Show less" closes them. Blocks cut by line count keep "Show all N lines".
- The shipped look is #23413's, unchanged: same max-height, fade, button and strings.
- "Show more" reuses the existing
message.morestring (21 locales, from #23431's long prompts). No new strings. - The new hook (
useWrapsPast) lives in BlockParts.tsx. In ToolRow.tsx and ShellBlock.tsx only theusePreviewinputs and the card's root attributes change; the<pre>lines that #23967 and #24030 edit are untouched.
Before / after (synthetic gallery fixtures, agent-pane.tool-output-collapse, Linux Chromium)
| Before (base 4c3b775) | After, collapsed | After, Show more clicked |
|---|---|---|
![]() | ![]() | ![]() |
Light:
. The line-cut case is unchanged: 
Live before/after: scripts/gallery-compare.sh ā /compare/tp-tool-output-showmore/ on the gallery host (tailnet).
Versions tried (gallery experiment tool-output-collapse, Compare arms)
| fade-link (shipped): 8 rows, bottom fade, text link | six-bar: 6 rows, fade, full-width quiet bar | ten-chip: 10 rows, hard cut, corner chip | fifteen-link: 15 rows, fade, link |
|---|---|---|---|
![]() | ![]() | ![]() | ![]() |
I picked fade-link because it is closest to Claude Code and the Codex app, which show a few lines and then a quiet "Show more" under the block. It is also the look #23413's line-cut blocks and #23431's long prompts already use, so the transcript keeps one collapse.
- The chip covers the last visible line.
- The bar is heavier than the row it serves.
- Fifteen rows is a tall preview in a narrow pane.
The other arms stay in the gallery for comparison. Nothing changes for anyone by default beyond the wrapped-rows cut.
Performance
- The collapse itself is CSS (the existing
[data-preview="cut"]max-height, nowvar(--cv-preview-rows, 8)). - Rows are read only for a block that is drawn (an opened call), whose output has 8 or fewer lines, wraps, and has a line of 24 or more characters. A read is one
scrollHeightplus one computed style, in a layout effect, when that block's own text, wrap or line count changes. No per-frame loop, and nothing per token for any other row. - Observer: one
ResizeObserveron that block's own body, so a narrower or wider chat re-reads it. Stop condition and cleanup: it is disconnected when the block's text changes, when it stops wrapping or fits by line count, and when it unmounts. - No hot path changed for closed rows, so there is no before/after number.
Find
The text is drawn whole and only clipped, so Find counts it. A Find reveal bumps reveal, which opens the block, as for line-cut blocks (tested).
Tests
webviews/test/transcript-wrapped-output-preview.test.tsx covers:
- cut with Show more, then Show less, with the control a real button that Find skips;
- no toggle at 8 rows or fewer;
- narrowing and widening re-read the block;
- Wrap lines off is not cut;
- the Shell block;
- a Find reveal opens the block;
- a
wholeblock is never cut; - the experiment arm sets the rows;
- the shipped arm still cuts at 8.
Observed / Not run
- Ran on huge-blue at f3474b1:
- the new file plus transcript-block-overflow, transcript-output-copy, permission-edit-diff, agent-pane-edited-card-expand and the shell tests: 57 pass, 0 fail;
- gallery agent-pane-entries, manifest, play and play-names tests: pass;
vp fmt --checkandvp linton the changed files: clean;- type check: no errors in changed files;
- acpmux-protocol check: pass.
- Base findings, not from this PR:
- Not run: no Swift change, so no app compile is needed.
Changelog
Fixed: A long tool output whose lines wrap past eight rows now collapses with Show more in agent chats.
Agent session: cosmic-gray
š¤ Generated with Claude Code





