Send compact tool payloads to the UI; fetch full output on demand - #222
Merged
Merged
Conversation
Rows render the backend's compact projection of each call. Expanding a row fetches the full result for the Output tab and, when the call's input was projected, the full input for the Input tab and for Output views that draw from it (bash command, ask_user question, fs_write content).
The chart is the result, so like a task card it takes the call's place in the message flow: no tool row, no Output/Input tabs, no result fetch. Running and failed chart calls still render as a normal tool row, and a failed one stays expandable to show its error.
The reply's markdown embed is now the only place a chart is drawn in chat, so the create_vega_chart call no longer renders a chart card. A successful call is a compact row (Chart <title> ... <path>) whose click hands the saved path to the page's onOpenArtifact; no Output/Input tabs, no result fetch. Running and failed calls stay normal rows, and without an onOpenArtifact (read-only views) the row expands as usual. The path comes from the result, falling back to params; a legacy `display` field in old results is ignored.
Workspace passes onOpenArtifact to the chat: it opens the artifacts drawer with the file previewed, reusing the synthesized entry that in-preview link navigation already builds.
…_chart Drop the display parameter and result field; the tool description and system prompt now tell the model to embed the returned markdown to show the chart.
The backend compacts create_vega_chart params to {title} and the result
always carries the saved path, so the params fallback and slash strip
were unreachable.
A chart row opened every path as an artifact, so a chart under .clai/memory/ got the artifact-only delete button.
A chart under .clai/memory/ opens in the memories drawer, so the row no longer claims it opens in artifacts.
onOpenArtifact/openArtifactPath now open memories too; rename them to onOpenFile/openWorkspaceFile, fix the comments that still said "artifacts panel", and cover a preview link to an unlisted memory file.
The backend rejects on a missing file rather than resolving null, so the default mock now rejects and fixtures return a WorkspaceFileContent. Fixes the CI typecheck of Workspace.test.tsx.
A create_vega_chart call is now a plain expandable tool row again; the special saved-chart row, its "Open chart" action and chartArtifactPath are gone. The file opener moves from the task-card context to WorkspaceFileContext, where an embedded .vl.json chart reads it: every file chart gets a slim header with its title (alt text, else the file name) and an "Open ↗" button that opens the resolved workspace path in the memories or artifacts drawer. Views without an opener (task transcripts, the file preview drawer) show the title only. The chat passes the opener through a ref so a page handler that changes identity on a memory refresh does not re-read every embedded chart.
Embedded .vl.json charts render as they did before 593f5ec: no title header and no "Open ↗" button. The create_vega_chart call stays a plain expandable tool row. With nothing left to call it, the chat's file opener goes too: the onOpenFile field on WorkspaceFileContext, the ChatMessageList prop and ref, and openWorkspaceFile in the Workspace page. previewEntryForPath stays for link navigation inside a previewed file; its unlisted-memory test now opens the preview from the memories panel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every tool event sent the whole tool output twice: once in
ToolCallCompleted.resultand again in the payload of the tool-role message, which nothing reads. It also sent the full input twice, inparamsand intool_use.arguments, and resent it on every message update. Cold page loads carried the same duplicates, even though tool cards start collapsed.Change
src-tauri/src/assistant/display.rs): UI events (emit_event) and the load and list commands now send compact tool data: name, compact input, aresultSummary, and the flagshasFullResultandhasFullInput. Tool-role message payloads are sent as null. Chart and workspace-task cards keep the metadata they need, so they still render right away.assistant_get_tool_call_resultandassistant_get_tool_call_inputlook up a call within its own session only.src/assistant/toolCallResult.tshook fetches output and input when a row is expanded and keeps a small cache (about 30 entries). A row shows loading, a retry on error, or "no longer available". The old frontendsummarizeToolResultis removed; summaries now come from the backend.Testing
cargo fmt --checkandcargo clippy --all-targets -D warningspass. The focused display, tool, repository and run_lifecycle tests pass.toolCallResultand AssistantChat (80 tests), eslint andtscpass.Known limitations
tool_usewith no matching tool-call row, such as during a brief stream race, shows only the compact input.Chart display (added)
displayalmost every time, so the option didn't prevent the duplicate. The embed is now the only way a chart shows in chat.create_vega_chartno longer has adisplayparameter. The tool description and the system prompt now tell the model to embed the returnedmarkdownonce, where the chart belongs.{ok, path}.