feat(web): add a raw view to tool call cards #227
No reviewers
Labels
No labels
Agent
Ignore
Agent
In Progress
Agent
Planned
Agent
Planning
Agent
Ready
Agent
Triage
Compat
Breaking
Kind
Bug
Kind
Documentation
Kind
Enhancement
Kind
Feature
Kind
Security
Kind
Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lucas/omp-deck!227
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/issue-226-raw-tool-view"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes: #226
A braces button in every tool call card header swaps the per-tool renderer for the raw arguments and raw result.
What's in it
apps/web/src/lib/raw-json.ts—formatRawJson(value):JSON.stringify(v, null, 2)with two deviations.\nis converted —\t,\r,\",\\and control characters keep their JSON escapes, so payload text can't be confused with surrounding punctuation.type: "image"objects with a stringdataget the data replaced by‹image data elided: N chars›; siblings (mimeType, …) are untouched. Longbash/readtext is rendered in full.RawToolView: two labelled sections,argsandresult(orpartialwhile only a partial result exists; a plain "no result yet" / "no stream data" line when neither). Mounted outsideToolRenderBoundary, so raw still works when a renderer throws, and fed the outerargs/streamsowrite→xd://…dispatches show the call that actually happened rather than the inner reconstruction.ToolCallCard: the header row became a wrapperdivholding the existing expand button (unchanged children; hover highlight moved to the wrapper so it still covers the row) plus the toggle button — a nested<button>would be invalid HTML. The toggle is rendered on collapsed cards too and opens the card, so one press goes from collapsed to raw. State is a localuseState, per card, ephemeral.CodeBlockgained an optionalcopyText?: string | (() => string), passed to theCopyButtonon both branches. The raw view uses it so the screen shows the readable, elided render while the clipboard gets complete, valid, unelided JSON — full base64 included. All existing callers omit it and are unaffected.Verification
bun run typecheck(all workspaces) andbun --cwd apps/web run build: clean.bun test(full suite): 1537 pass, 0 fail — including the newapps/web/src/lib/raw-json.test.ts(byte-identical output toJSON.stringifyfor newline-free values, the worked 15-space continuation example, array-element indentation, escape preservation, image elision and its non-elision ontype: "text",undefined→"",null→"null").hljs.highlight(code, { language: "json", ignoreIllegals: true })over the formatter's output for a multi-line payload. The broken string is highlighted as a singlehljs-stringspan across the line breaks and the rest of the document keeps its normal token classes, solanguage="json"is kept.bash/forgejo_*/xd:/// screenshot calls, clipboard paste). This session has no browser; the behaviour above is argued from the code and the unit tests, and the visual check is worth a minute during review.Notes
No server or protocol change — the data was already complete client-side.
70037548dctoc1c287d773