Skip to content

Commit fe81d57

Browse files
committed
feat(webapp): completed tool calls leave no row in the chat
The answer is the prose and the cards, never the input/output plumbing: a landed call disappears (the pill was its only trace), and only a FAILED call keeps its error row. Gallery example reworked accordingly.
1 parent 1d15fe3 commit fe81d57

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

apps/webapp/app/components/dashboard-agent/DashboardAgentMessages.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,11 @@ function blocksFor(part: UIMessage["parts"][number]): unknown[] | null {
106106
* Everything the panel styles itself is handled here; the rest falls through to
107107
* the shared `renderPart` so agent output still looks the same across the app.
108108
* The differences: text is always the rendered markdown (no raw toggle) at the
109-
* dashboard's default size, and an in-flight tool call is a pending pill rather
110-
* than a tool row streaming its input JSON — the input is the agent's business,
111-
* and watching it arrive character by character only to have it replaced by a
112-
* card is noise. Once the call lands, the part renders exactly as it always did.
109+
* dashboard's default size, and tool calls never show their mechanics — while
110+
* running they are a pending pill ("Reading the queue…"), and once they land
111+
* they leave NO row at all: the answer is the prose and the cards, not the
112+
* input/output plumbing. The one exception is a FAILED call, which keeps its
113+
* error row — a silent failure would read as the agent ignoring the question.
113114
* Citations are handled a level up, where a run of them can be grouped into one
114115
* row.
115116
*/
@@ -127,8 +128,12 @@ function renderDashboardPart(part: UIMessage["parts"][number], i: number) {
127128
return p.text ? <ChatText key={i} text={p.text} /> : null;
128129
}
129130

130-
if (type.startsWith("tool-") && IN_FLIGHT_TOOL_STATES.has(p.state ?? "")) {
131-
return <ChatPendingTool key={i} label={`${toolPendingLabel(type.slice(5))}…`} />;
131+
if (type.startsWith("tool-")) {
132+
if (IN_FLIGHT_TOOL_STATES.has(p.state ?? "")) {
133+
return <ChatPendingTool key={i} label={`${toolPendingLabel(type.slice(5))}…`} />;
134+
}
135+
if (p.state === "output-error") return renderPart(part, i);
136+
return null;
132137
}
133138

134139
return renderPart(part, i);

apps/webapp/app/routes/storybook.agent-ui/manifest.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,9 @@ export const MANIFEST: GallerySection[] = [
284284
group: "messages",
285285
},
286286
{
287-
sectionId: "messages-tool-expanded",
288-
title: "Tool call expanded on its output",
287+
sectionId: "messages-tool-completed",
288+
title: "Completed tool call — no row, just the answer",
289289
group: "messages",
290-
expandText: "output",
291290
},
292291
{
293292
sectionId: "messages-error-retry",

apps/webapp/app/routes/storybook.agent-ui/route.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,9 @@ const STATES: Record<string, React.ReactNode> = {
736736
"messages-reasoning": <MessageHarness chatId={demoId("investigate-streaming")} />,
737737
"messages-tool-in-flight": <MessageHarness chatId={demoId("base-tool-in-flight")} />,
738738
"messages-tool-pending-pills": <PendingPillsHarness />,
739-
"messages-tool-expanded": <MessageHarness chatId={demoId("base-tool-in-flight")} />,
739+
// The same chat whose pending pill is shown above, but with the call landed:
740+
// the tool row is gone entirely — only the prose (and any cards) remain.
741+
"messages-tool-completed": <MessageHarness chatId={demoId("docs-answer")} />,
740742
"messages-error-retry": <MessageHarness chatId={demoId("base-error-retry")} withError />,
741743
// Two turns only: the resumed chat's third turn is a live `chart` block, and
742744
// the real AgentChart has no environment to query outside a project route.

0 commit comments

Comments
 (0)