Skip to content

feat: add copy and truncation controls to tool call cards - #38

Open
johnnyhuy wants to merge 1 commit into
mainfrom
agent/issue-37-tool-card-copy-truncate
Open

johnnyhuy wants to merge 1 commit into
mainfrom
agent/issue-37-tool-card-copy-truncate

Conversation

@johnnyhuy

Copy link
Copy Markdown
Contributor

Tool call cards now have a Copy button on each expanded section and truncate long text behind a Show more toggle. Previously the full text always rendered in place and there was no quick way to reuse it.

Part of #2
Closes #37

What changed:

  • Each Input and Output section in WorkbenchControls.tsx gets a Copy button that writes the exact section text to the clipboard and shows Copied for a short confirmation. The copied text is the same text the card displays, including the No input, No output, and Waiting for output fallbacks.
  • Section text over 2000 characters (TOOL_TEXT_PREVIEW_LIMIT) renders only the first 2000 characters with a Show more button. Show more reveals the full text and switches to Show less, which truncates again. Header summary, Running, Done, and Failed states, and collapsed-by-default behaviour are unchanged.

Verified:

  • bun install --frozen-lockfile passed
  • bun run lint passed, 0 warnings and 0 errors
  • bun run typecheck passed across renderer, main, and preload configs
  • bun run test:unit passed, 71 tests
  • bun run test:integration - the new ToolCard tests pass and the suite shows 37 passed with 6 failures in SettingsView.test.tsx. Those 6 failures reproduce on clean origin/main in this environment (localStorage is undefined under the local Node 26 runtime, Cannot read properties of undefined (reading 'getItem')), so they are pre-existing here and not caused by this change. CI runs the same suite green.
  • mise run build passed
  • bun run test:e2e blocked in this environment. Electron fails to launch with Library not loaded: @rpath/Electron Framework.framework, and all 43 e2e tests skip. Noted once here per the fall-through rule and not retried.

Proof:

  • Capture method (b) succeeded through the renderer. A temporary Vite proof page rendered an expanded bash tool card with long output, and a scripted Chrome capture saved .tmp/proof/tool-card-truncated.png and .tmp/proof/tool-card-expanded.png. The capture log recorded has Show more: true, truncated (no END-MARKER): true, has Copy buttons: true, then after clicking Show more, expanded (has END-MARKER): true. The expanded screenshot shows the Input and Output headings, both Copy buttons, the full log text, and the Show less toggle. The PNGs are kept under .tmp/proof/ locally and are not committed, matching the scratch-capture rule for this repo. The temporary proof page was removed before committing.
  • Capture method (a) was blocked by the Electron launch failure above, so method (c) carries the logic proof. New integration tests in ToolCard.test.tsx: copies the exact output text and shows Copied and truncates long output and expands on Show more. Both failed before the change (2 failed, 2 passed) and pass after (4 passed).

Known gaps and follow-ups:

Co-authored-by: Muse Code <muse-code@meta.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add copy button and long-text truncation to tool call cards

1 participant