Repository navigation
feat(response-viewer): add a Copy Markdown button - #810
Conversation
The viewer renders the agent's answer, so selecting it loses the source: headings, list markers and code fences do not survive. The only source copy was the per-code-block button. Copy Markdown copies the raw source of the newest answer the viewer holds: every row of its turn, or the last response block when the reader emits no turns. Tool and status blocks share the assistant role and are left out. The copied text is recorded where the views render, so a reopened viewer never copies an earlier answer, and an empty viewer warns instead of copying. The feedback helper replaces the inline copy of the same logic in the code-block button. On phones the header title now truncates so the longer action row stays on screen.
|
Thanks @aakhter for this. It adds a Copy Markdown button to the response viewer that copies the raw source of the newest answer, so headings, lists and code fences survive a paste. The selection logic matches what each view renders, the Two small things:
You asked three questions under For review: whether the button needs a setting, whether the full view should copy the last answered turn rather than the whole conversation, and whether to keep the brief answer when the full view has none. Those are design decisions and they are still open. Neither point above depends on them. Both points are small enough to apply on top when this lands, so you don't need to push anything for them. |
…on it, and the full view's fallback has a test (#810) The button's aria-label replaced its visible text as the accessible name with a sentence that does not contain "Copy Markdown" (WCAG 2.5.3, Label in Name), so a voice-control user could not say what they see. The label is gone and the sentence stays as the title. No test reached the line that keeps the brief view's answer when the full view holds no answer of its own: the existing case returns earlier, on an empty list. A full view that holds only a prompt reaches it. The PR's own changeset is folded into the 1.51.0 one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Merged, and it shipped today in Codeman 1.51.0, with you in the release's Thanks. Thank you, @aakhter. The two items from the review went in at merge time: the button no longer carries an Your three questions: it ships as you built it. No setting (the viewer is already opt-in), the full view copies the last answered turn, and the brief answer is kept when the full view holds none. |
Problem
The response viewer renders an agent's answer, so selecting it loses the source: headings, list markers and code fences do not survive a paste. The only source copy today is the per-code-block button.
Change
Adds a Copy Markdown button to the viewer's action row. It copies the raw source of the newest answer:
The copied text is recorded where the views render, so a reopened viewer never copies an earlier answer. An empty viewer warns and copies nothing. A refused clipboard goes through the existing
_copyTextfallback and reports failure only if that fails too._setCopyControlStatereplaces the inline feedback logic in the code-block button rather than duplicating it. Feedback colors use the same--green/--redtokens as that button. On phones the header title now truncates so the longer action row stays on screen.No server change, no new route, setting, flag or SSE event.
For review
showResponseViewer). Tell me if you would rather gate it.Verification
/api/v1route, CLI verb, flag, skill description or default changes.text/messages.Checking now.\n\n### Result\n\n**Done**, while the viewer shows them renderedConversation (5 messages, 2 turns)): same text, from the last turn onlyconst a = 1;\nwriteTextrejectsNotAllowedError, the realexecCommandfallback succeeds, so the button reports success, which is accurateexecCommandstubbed to false:rv-copy-failedandFailed to copy response as Markdowntest/response-viewer-copy-markdown.test.ts, all failing before the change except the code-block one, which guards the refactor and is killed by its own mutation. 22 mutations, 22 killed. Two survived the first pass: one had hit a different rule (retargeted, killed), and one showed a genericFailed to ...i18n rule hid a missing entry, so the test now asserts exact strings (killed)._copyText,showToast,.response-viewer-more, the existing color tokens.docs/wiki/Watching-Agents-Work.md,docs/wiki/Mobile-Guide.md, zh-CN strings, changeset. API reference, Settings-Reference, READMEs,skills/codemanandAGENTS.mdhave nothing that describes the viewer's actions.Gates on this head (rebased onto 8bedbbe, 1.50.1): typecheck, lint, format:check, check:frontend-syntax, check:public-assets and check:browser-excludes pass. The new test file plus nine response-viewer, i18n, header-policy and skin suites: 128 of 128 pass. A build of this head loaded in Chromium on an isolated 127.0.0.1 instance renders the button inside the viewer with no page errors.
npm run test:ci(run before the rebase, on f1f7eec): branch 6 failed, 13513 passed; plain master 7 failed, 13497 passed. The same 6 fail on both, all intest/tmux-prefix-table.test.tson this machine's tmux next-3.7; the 7th on master wastest/frontend-public-tooling.test.ts, from a baseline checkout with no spreadsheet assets prepared. No failure was new on the branch. The live checks in item 6 were also run on that base.