feat: rich tool views — ToolInfo view union, server-computed diffs, panel renderers #146
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab#146
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Blocked by #145 — do not start until the tool call panel is merged. This slice fills the panel's detail page with per-tool-kind rendering. Grilled 2026-07-12; decisions below are settled.
Seam: server-side view union
ToolInfogains an optional provider-neutral discriminated union, produced by each provider's chat mapper (which already owns per-provider tool knowledge —toolTitle/toolInputTextin claudecode, payload mappers in codex). The web client renders byview.kindand stays provider-blind; no tool-name knowledge leaks into TS.input/outputstring fields stay populated regardless (raw fallback + older clients).Diffs are computed server-side
The mapper runs a small pure-Go line diff (Edit's old/new are exact strings, so this is cheap) and ships one unified-diff text string. The client colors lines by
+/-/@@prefix — no diff library in the web bundle, and truncating the tail of a long diff still leaves a valid renderable head.Provider mapping
Edit/NotebookEdit→diff;Write→write;Bash→command(command string from input). Everything else → no view.apply_patch→diff(input is already patch-shaped text with*** Update File:envelopes — normalize to unified-diff text);exec_command/shell→command(cmd from arguments JSON). Everything else → no view.Truncation
detailTruncateLimit ≈ 20000forview.textandoutput— sized for a panel, not a chip. Chip-facingtitleand the legacyinputkeep the existing 2000.Panel renderers (web)
diff: path header, line-colored unified diff (+ green / − red / @@ dim).command:$-prefixed command block, output as terminal text below.write: path header + content (rendered like an all-added diff). No syntax highlighting — the app has no highlighter; separate concern if ever.view→ today's raw input/output<pre>blocks.Out of scope
Copy-to-clipboard buttons, wrap toggles, word-level diff highlighting, a fetch-full-I/O endpoint for payloads beyond the 20KB cap (revisit only if the cap proves tight in practice).
Landing audit — PR #148: PASS
ci / nativesuccess (run #161, 4m54s) — relied on, not re-run.origin/main; #147 already landed so the diff reduced to exactly the two #146 commits (4779374+1eb4e66), as the PR body predicted.feat:). AFK contract: headafk/146, body carries workingCloses #146.ToolViewunion +internal/unidiff+ provider mappers (claudecode/codex) + redact sweep + web render-by-kind + tests.Correctness spot-checks (all hold): provider-neutrality preserved (SPA switches on
view.kindonly; unmapped/partial inputs → nil view → raw fallback, no panic); diff prefix precedence correct (+++/---/@@before+/-);.tool-diff span { display:block }backs the per-line spans inside<pre>;TruncateDetail(20KB, rune-boundary, explicit marker); redact masks the newView.Path/Text/Command;unidiffLCS has size guards.Verdict: PASS — awaiting free-text merge go-ahead.