Repository navigation
Conversation
There was a problem hiding this comment.
Looks good. I reproduced #48783 on dev with the issue's script: the collapsed summary is 5,429 characters and holds the whole document. With this change it is 66 characters and ends in …]. I also ran your new generic-tool-summary.test.tsx against the base: it fails, and the captured screen shows the content= row wrapping across the whole viewport. With the PR it passes 5 runs out of 5. The unit tests and tsc -b in packages/tui pass.
Public API: unchanged (TUI rendering only).
The new caps also apply to mini mode's rows, since they use primitiveInputSummary too. That seems fine. I couldn't get a plugin tool call to show up in opencode-drive here, so I have no screenshots. Could you attach the before/after captures you mention in the description?
Related: #54703
Issue for this PR
Fixes #48783
Note: #48783 is assigned to @simonklee.
Type of change
What does this PR do?
Root cause:
GenericToolrenders its collapsed summary throughgenericToolSummaryandprimitiveInputSummary, which concatenated every primitive argument askey=${String(value)}without eliding long values or bounding the total display width. Calling any plugin or MCP tool with a multi-kilobyte string argument dumped the entire string into the collapsed transcript row, soft-wrapped across dozens of lines, even thoughGenericToolalready renders the full arguments behind its click-to-expand toggle.Fix:
Locale.truncateWidthinprimitiveInputSummary, so a large payload argument no longer hides trailing short arguments (such asformat=markdown).Locale.truncateWidth(defaulting to 120 columns, and sized to the available session row widthctx.width - 3 - INLINE_TOOL_ICON_WIDTHinGenericToolandExecuteCallView) while keeping the closing].truncatefromGenericToolthroughInlineTool/InlineToolRow/Spinner(wrapMode="none" truncate) so the collapsed row never soft-wraps onto a second line during resize or when a scrollbar narrows the viewport.How did you verify your code works?
packages/tui/test/util/tool-display.test.tscovering multi-kilobyte multi-line values alongside short arguments, many-argument width bounds, and CJK / ZWJ emoji grapheme boundaries.packages/tui/test/generic-tool-summary.test.tsx(--rerun-each 10) verifying single-line collapsed rendering at both 100 and 44 columns and full untruncated input/output expansion on click.bun typecheckandbun run typecheck:tscinpackages/tuiandbun run checkfrom the repo root.opencode-driveagainstorigin/devand this branch.Visual
Screenshots / recordings
Before / After (
opencode-drive):origin/dev): Calling a dynamicingest_documentplugin tool with a ~7.5 KB multi-linecontentstring andformat: "markdown"floods the entire 100×30 TUI viewport with soft-wrappedcontent=...lines in the collapsed state, pushing both the user prompt and the✓ ingest_documentheader off screen.✓ ingest_document [content=# Hallazgos del 2026-09-13 — Architectu…, format=markdown]) directly between the user prompt and assistant response, and clicking the row expands the full multi-kilobytecontent,format, andoutputin place.Checklist
Added by the opencode bot (AI-generated).
Related: #54703