From 6d5de9a5742d5f7b30fc3e5c2bab34b03d343cec Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Tue, 17 Nov 2026 23:37:27 +0100 Subject: [PATCH] feat(web/claw): render the reply, not the tool calls or the thinking The web transcript was built to mirror the TUI: every tool call as a shell line or a glyph row, the thinking trace between them, each at the position the stream delivered it. That is the right shape for a terminal session you sit and watch. On the web it reads as machinery in front of the answer, and the answer is what the page is for. `TurnEntries` now keeps only the two entries the reader must handle: a consent card (the agent is waiting on an answer, so hiding it would stall the turn) and an attachment card (the file it handed over). Everything else in the turn renders as the reply, through `AppMarkdown`. The mirror in `useTranscript` still folds tool and thinking events; only the render ignores them. Replay, the pending-echo dedupe and consent placement keep working unchanged, and the bottom-pin watch loses the thinking-length term it only needed while that block took height. `TurnToolRow` had no other caller and goes with it. --- web/claw/README.md | 13 ++- web/claw/app/components/ChatPanel.vue | 19 ++--- web/claw/app/components/TurnEntries.vue | 55 ++++--------- web/claw/app/components/TurnToolRow.vue | 102 ------------------------ 4 files changed, 30 insertions(+), 159 deletions(-) delete mode 100644 web/claw/app/components/TurnToolRow.vue diff --git a/web/claw/README.md b/web/claw/README.md index f29eb09..6c13ed1 100644 --- a/web/claw/README.md +++ b/web/claw/README.md @@ -90,6 +90,11 @@ Two consequences worth knowing before changing this code: ## What the transcript does with the stream +- **Replies, asks and files only.** The stream carries tool calls and + the model's thinking trace; this surface drops both and renders the + reply. A consent card and an attachment card still appear inline, + because the reader has to answer or open them. The mirror still + folds those other events; only the render ignores them. - **Long pastes travel as chips.** A paste over three lines (the TUI's `PASTE_INLINE_LINES`) never lands in the composer; it stages as a droppable chip (`▣1 42L`) and embeds into the sent text as @@ -175,10 +180,10 @@ app/ raw HTML escaped, styles in main.css .md) ClawBanner.vue the one error/notice banner surface ChatPanel.vue transcript: sent lines (paste chips), - streamed turns as bash shell lines and - glyph rows, consent + attachment - cards; the growing composer; agent - replies render through AppMarkdown + streamed turns as reply text plus + consent + attachment cards; the growing + composer; agent replies render through + AppMarkdown SessionsSidebar.vue conversable dispatch keys (phone status keys hidden), interactive first; the + form creates a session diff --git a/web/claw/app/components/ChatPanel.vue b/web/claw/app/components/ChatPanel.vue index 924ff0b..88abfd6 100644 --- a/web/claw/app/components/ChatPanel.vue +++ b/web/claw/app/components/ChatPanel.vue @@ -136,20 +136,12 @@ watch( }, ) -// Thinking grows inside the trailing entry without changing the -// entries length, so its total length joins the watch to keep the -// stream pinned at the bottom. -function liveThinkingLength(): number { - return ( - props.live?.entries.reduce( - (count, entry) => (entry.kind === 'thinking' ? count + entry.text.length : count), - 0, - ) ?? 0 - ) -} - +// A consent or attachment card opening inside the trailing turn +// changes the rendered height, so the reply length and the entries +// length both join the watch that keeps the stream pinned at the +// bottom. watch( - () => [props.items.length, props.live?.reply.length, liveThinkingLength(), props.live?.entries.length], + () => [props.items.length, props.live?.reply.length, props.live?.entries.length], async () => { if (!pinned.value) return await nextTick() @@ -498,7 +490,6 @@ function streamTone(status: StreamStatus): 'ok' | 'warn' | 'error' {
{{ agentName }}
-// A turn's stream-ordered middle: tool rows, pieces of the thinking -// trace, the agent's asks, its handovers — each at the position the -// stream delivered it, so an ask sits at the tool call that raised it -// and thinking sits between the calls it precedes. +// The turn's middle, as the web surface shows it: the agent's asks +// (consent cards) and its handovers (attachment cards), each at the +// position the stream delivered it. Tool calls and the thinking trace +// stay off this surface; the reply is what it shows, and these two +// cards are the only things the reader must act on or can open. +import { computed } from 'vue' import type { TurnEntry } from '~/composables/useTranscript' import type { ConsentAnswer } from '~/composables/useClaw' -defineProps<{ +const props = defineProps<{ entries: TurnEntry[] - /** A live turn's thinking blocks start expanded; finished ones collapse. */ - openThinking?: boolean }>() +/** Cards only: a turn's tool rows and thinking blocks never render. */ +const cards = computed(() => + props.entries.filter((entry) => entry.kind === 'consent' || entry.kind === 'attachment'), +) + const emit = defineEmits<{ consentAnswer: [id: string, answer: ConsentAnswer] consentDeny: [id: string] @@ -20,21 +25,16 @@ const emit = defineEmits<{