Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(trace): keep a turn's work in view, exactly like the Codex app
rubenluetke10-beep9ce0912d2379
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.test.tsxindex beda261a2f..0b8c71df04 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.test.tsx@@ -14,9 +14,7 @@ afterEach(() => { cleanup(); seq = 0; });it("replays persisted events through the new shared trace", () => {draw([ev("turn_started", { turn_id: "t1" }), ev("tool_call", { turn_id: "t1", call_id: "c1", name: "list_dir", input: { path: "src" } }), ev("tool_result", { turn_id: "t1", call_id: "c1", output: "index.ts", duration_ms: 800 }), ev("turn_finished", { turn_id: "t1", status: "done" })]);expect(screen.getByTestId("work-trace")).toBeTruthy();- // A finished turn writes its work as a report; with no answer to read,- // the report stands open.- expect(screen.getByRole("button", { name: /^Worked/ }).getAttribute("aria-expanded")).toBe("true");+ // The work stays in view, one quiet line per call.expect(screen.getByRole("button", { name: /^Listed src/ })).toBeTruthy();});describe("the person's turn with files", () => {diff --git a/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.test.tsxindex 9d0cf4da49..848fd325a5 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.test.tsx@@ -17,11 +17,9 @@ it("reopens a stored voice turn as a Claude/Codex-style timeline", () => {step({ id: "x", detail: "run-app-action", status: "error", denied: true, error: "blacklist: <tool-declared-block>" }),];render(<VoiceWorkTrace steps={steps} durationMs={2400} />);- // Folded to one line that says what happened.- const toggle = screen.getByRole("button", { name: /^Worked for 2\.4s.*1 failed/ });- // The turn is not called failed because one call was refused.+ // Nothing folds; the turn is not called failed because one call was refused.+ expect(screen.queryByTestId("conversation-work-fold")).toBeNull();expect(screen.getByRole("status").textContent).toContain("Done");- fireEvent.click(toggle);// The model's own words read as prose, Markdown and all.const words = document.querySelector<HTMLElement>("[data-trace-entry='reasoning']")!;@@ -29,7 +27,7 @@ it("reopens a stored voice turn as a Claude/Codex-style timeline", () => {// No bullets, threads or rings — just the lines.expect(document.querySelector(".trace-dot, .trace-report-num")).toBeNull();// The stretch is one quiet line; it opens to its calls.- fireEvent.click(screen.getByRole("button", { name: /^Searched the wiki, used Run app action.*1 failed/ }));+ fireEvent.click(screen.getByRole("button", { name: /^Searched the wiki, used Run app action$/ }));const [wiki, refused] = Array.from(document.querySelectorAll<HTMLElement>("[data-trace-entry='call']"));expect(wiki.textContent).toContain("Searched the wikiUrlaub 2026");expect(refused.textContent).toContain("Run app action");@@ -40,7 +38,6 @@ it("reopens a stored voice turn as a Claude/Codex-style timeline", () => {expect(within(wiki).getByText("Input")).toBeTruthy();fireEvent.click(within(refused).getByRole("button"));expect(refused.textContent).toContain("Blocked: a safety rule blocks this action");- expect(screen.getByRole("button", { name: "Copy" })).toBeTruthy();});it("draws nothing for a turn whose only step is the brain call", () => {diff --git a/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.tsx b/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.tsxindex 6cdfdc601e..464503a2e1 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.tsx+++ b/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.tsx@@ -1,9 +1,8 @@import { useLayoutEffect, useMemo, useRef, useState, type ReactNode } from "react";-import { Check, ChevronRight, Copy, FilePlus2, FileText, FolderOpen, Globe, Image, Pencil, Search, SquareTerminal, Wrench } from "lucide-react";+import { ChevronRight, FilePlus2, FileText, FolderOpen, Globe, Image, Pencil, Search, SquareTerminal, Wrench } from "lucide-react";import ReactMarkdown from "react-markdown";import remarkGfm from "remark-gfm";import { useT } from "@/i18n";-import { robustCopy } from "@/lib/clipboard";import { cn } from "@/lib/utils";import type { ToolBlock, TurnBlock, TurnStatus } from "./reduce";import { ToolChoiceIcon } from "./ToolChoiceChips";@@ -11,7 +10,7 @@ import type { ToolChoice } from "./toolChoices";import { toolIdentity, toolIdentityStyle } from "./toolIdentity";import { traceToolIdentity } from "./traceActivity";import {- buildTimeline, plural, readableOutput, summarize, traceDuration, tr,+ buildTimeline, readableOutput, summarize, traceDuration, tr,type ActivityEntry, type Call, type ProseEntry, type Timeline,} from "./traceEntries";@@ -55,7 +54,7 @@ export function timelineItems(timeline: Timeline, renderers: TimelineRenderers):// ── Marks ────────────────────────────────────────────────────────────────-const glyph = "h-[15px] w-[15px] shrink-0";+const glyph = "h-4 w-4 shrink-0";const GLYPHS = { command: SquareTerminal, read: FileText, list: FolderOpen, search: Search, edit: Pencil, write: FilePlus2, image: Image, web: Globe } as const;function cliRow(binary: string): ToolChoice {@@ -68,7 +67,7 @@ function cliRow(binary: string): ToolChoice {/** A brand drawn the way the composer draws it: the real logo, themed. */function BrandMark({ row }: { row: ToolChoice }) {return <span className="tool-identity inline-flex shrink-0" style={toolIdentityStyle(row)} data-trace-brand={row.id}>- <ToolChoiceIcon row={row} size={15} />+ <ToolChoiceIcon row={row} size={16} /></span>;}@@ -119,7 +118,7 @@ function StretchMark({ calls }: { calls: Call[] }) {function ProseView({ entry, renderers }: { entry: ProseEntry; renderers: TimelineRenderers }) {// Media in narration stays a thumbnail: the trace is the story, not the gallery.- if (entry.tone === "narration") return <div className="trace-narration min-w-0 py-1.5" data-trace-entry="narration">{renderers.renderNarration(entry.text, entry.id)}</div>;+ if (entry.tone === "narration") return <div className="trace-narration min-w-0 py-2" data-trace-entry="narration">{renderers.renderNarration(entry.text, entry.id)}</div>;return <Reasoning text={entry.text} />;}@@ -133,9 +132,9 @@ function Reasoning({ text }: { text: string }) {const el = ref.current;if (el && !open) setOverflows(el.scrollHeight > el.clientHeight + 1);}, [text, open]);- return <div className="min-w-0 py-1.5" data-trace-entry="reasoning">+ return <div className="min-w-0 py-2" data-trace-entry="reasoning"><div ref={ref} className={cn(- "prose prose-sm max-w-none text-sm leading-6 text-muted-foreground dark:prose-invert [overflow-wrap:anywhere]",+ "prose max-w-none trace-text text-muted-foreground dark:prose-invert [overflow-wrap:anywhere]","prose-p:my-1 prose-p:text-muted-foreground prose-li:text-muted-foreground prose-strong:text-foreground-secondary prose-pre:overflow-auto","[&>:first-child]:mt-0 [&>:last-child]:mb-0",!open && "max-h-36 overflow-hidden",@@ -152,7 +151,7 @@ function Reasoning({ text }: { text: string }) {// ── Activity ─────────────────────────────────────────────────────────────-const lineButton = "group/line flex w-full min-w-0 items-center gap-2 rounded-md py-1 text-left text-sm leading-6 text-muted-foreground transition-colors enabled:hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-default";+const lineButton = "group/line flex w-full min-w-0 items-center gap-2.5 rounded-md py-1.5 text-left trace-text text-muted-foreground transition-colors enabled:hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-default";function Chevron({ open }: { open: boolean }) {return <ChevronRight aria-hidden className={cn("h-3.5 w-3.5 shrink-0 opacity-0 transition group-hover/line:opacity-70 group-focus-visible/line:opacity-70", open && "rotate-90 opacity-70")} />;@@ -164,13 +163,11 @@ function ActivityView({ entry, renderers }: { entry: ActivityEntry; renderers: Tconst running = entry.calls.filter((call) => call.status === "running");const settled = entry.calls.filter((call) => call.status !== "running");if (entry.calls.length === 1) return <CallLine call={entry.calls[0]} renderers={renderers} />;- const problems = settled.filter((call) => call.status !== "done").length;const lang = t("trace_report.locale");return <div className="min-w-0" data-trace-entry="activity">{settled.length ? <button type="button" className={lineButton} aria-expanded={open} onClick={() => setOpen(!open)}><StretchMark calls={settled} /><span className="min-w-0 truncate">{settled.length === entry.calls.length ? entry.summary : summarize(settled, t, lang)}</span>- {problems ? <span className="shrink-0 text-destructive">{tr(t, `failed_count_${plural(lang, problems)}`, { count: problems })}</span> : null}<Chevron open={open} /></button> : null}{open ? <div className="mb-1 ml-[7px] min-w-0 border-l border-border pl-4">@@ -190,7 +187,8 @@ function CallLine({ call, renderers }: { call: Call; renderers: TimelineRenderer<button type="button" className={lineButton} aria-expanded={running ? undefined : open} disabled={running} onClick={() => setOpen(!open)}><CallMark call={call} /><span className={cn("min-w-0 truncate", running && "trace-shimmer")} title={call.text}>{call.text}</span>- {call.detail ? <span className="min-w-0 truncate text-muted-foreground/70" title={call.detail}>{call.detail}</span> : null}+ {/* The detail takes only the room the words leave. */}+ {call.detail ? <span className="min-w-0 flex-1 basis-0 truncate text-muted-foreground/70" title={call.detail}>{call.detail}</span> : null}{call.added || call.removed ? <span className="shrink-0 font-mono text-xs tabular-nums"><span className="diff-count-add">+{call.added}</span>{" "}<span className="diff-count-del">−{call.removed}</span></span> : null}@@ -198,7 +196,7 @@ function CallLine({ call, renderers }: { call: Call; renderers: TimelineRenderer{!running ? <Chevron open={open} /> : null}</button>{/* Why a call failed reads without opening anything. */}- {problem && call.reason && !open ? <p data-trace-reason className="-mt-0.5 mb-1 truncate pl-[23px] text-xs leading-5 text-destructive" title={call.reason}>{call.reason}</p> : null}+ {problem && call.reason && !open ? <p data-trace-reason className="-mt-1 mb-1 truncate pl-[26px] text-[13px] leading-5 text-destructive" title={call.reason}>{call.reason}</p> : null}{open ? <div className="mb-2 ml-[7px] min-w-0 border-l border-border pl-4 pt-0.5"><CallDetails call={call} renderers={renderers} /></div> : null}</div>;}@@ -230,21 +228,3 @@ function CallDetails({ call, renderers }: { call: Call; renderers: TimelineRende{took}</div>;}--/** "Copy" — the timeline as Markdown on the clipboard; shown when the fold is hovered. */-export function CopyTimeline({ text }: { text: () => string }) {- const t = useT();- const [state, setState] = useState<"idle" | "copied" | "failed">("idle");- const copy = async () => {- const ok = await robustCopy(text());- setState(ok ? "copied" : "failed");- window.setTimeout(() => setState("idle"), 2000);- };- const Icon = state === "copied" ? Check : Copy;- return <button type="button" onClick={() => void copy()}- className={cn("mt-1 inline-flex items-center gap-1.5 rounded-md px-1.5 py-0.5 text-xs text-muted-foreground transition-opacity hover:bg-secondary hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",- state === "idle" ? "opacity-0 group-hover/fold-body:opacity-100" : "opacity-100")}>- <Icon aria-hidden className="h-3.5 w-3.5" />- <span aria-live="polite">{t(state === "copied" ? "trace_report.copied" : state === "failed" ? "trace_report.copy_failed" : "trace_report.copy")}</span>- </button>;-}diff --git a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.css b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.cssindex 574617968e..cfc375add8 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.css+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.css@@ -169,3 +169,14 @@max-width: 100%;border-radius: 0.5rem;}+/* Work lines and reasoning are set in the size of the surface's own text,+ as in the Codex app: 15/25 on the front page, 13/21 in agent chats. */+/* !important: the typography plugin's .prose sets its own size. */+.trace-text {+ font-size: var(--trace-text-size, 15px) !important;+ line-height: var(--trace-text-leading, 25px) !important;+}+[data-testid="work-trace"][data-conversation] {+ --trace-text-size: 13px;+ --trace-text-leading: 21px;+}diff --git a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsxindex 2ba949c748..d48e07cf1f 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx@@ -59,7 +59,6 @@ describe("work trace", () => {it("preserves reasoning, call, next step and final answer order", () => {const blocks = [thought, tool("a"), { kind: "text" as const, id: "next", text: "Next, check the tests." }, tool("b"), { kind: "text" as const, id: "final", text: "Everything is ready." }];render(<WorkTrace {...props} blocks={blocks} />);- fireEvent.click(screen.getByRole("button", { name: /^Worked for 12s/ }));const text = screen.getByTestId("work-trace").textContent!;expect(text.indexOf("Check the input")).toBeLessThan(text.indexOf("a.ts"));expect(text.indexOf("a.ts")).toBeLessThan(text.indexOf("Next, check"));@@ -98,13 +97,11 @@ describe("work trace", () => {it("keeps errors and pending approval visible beside folded success", () => {render(<WorkTrace {...props} blocks={[tool("a"),tool("b"),tool("err",{isError:true,output:"Permission denied"}),tool("approval",{output:null,approval:{approvalId:"ap",summary:"Delete generated files?",decision:null}})]} onDecide={() => undefined} />);- // The approval stays actionable beside the folded report; the toggle- // already says that a step went wrong.+ // Nothing folds: the approval stays actionable in place.expect(screen.getByText("Delete generated files?")).toBeTruthy();expect(screen.getByRole("button", { name: "Approve" })).toBeTruthy();- fireEvent.click(screen.getByRole("button", { name: /^Worked for 12s.*1 failed/ }));// One quiet line for the stretch; the failure opens with it.- fireEvent.click(screen.getByRole("button", { name: /^Read files.*1 failed/ }));+ fireEvent.click(screen.getByRole("button", { name: /^Read files/ }));fireEvent.click(screen.getByRole("button", { name: /^Read err\.ts.*Failed/ }));expect(screen.getByText("Failed: Permission denied")).toBeTruthy();expect(screen.getByRole("button", { name: "Approve" })).toBeTruthy();@@ -133,7 +130,6 @@ describe("work trace", () => {it("renders edit input, a diff and output on demand", () => {render(<WorkTrace {...props} blocks={[tool("edit",{name:"Edit",input:{file_path:"app.ts",old_string:"oldValue",new_string:"newValue"},output:"File updated"})]} />);- fireEvent.click(screen.getByRole("button", { name: /^Worked for 12s/ }));// Codex-style: the edit is one line with its size; the diff is one tap away.const edit = screen.getByRole("button", { name: /^Edited app\.ts \+1 −1/ });fireEvent.click(edit);@@ -147,7 +143,6 @@ describe("work trace", () => {expect(container.querySelector('[data-state="interrupted"]')).toBeTruthy();expect(container.querySelector('[data-trace-tool][data-state="running"]')).toBeNull();rerender(<WorkTrace {...props} status={status} blocks={[tool("a",{output:null})]} />);- fireEvent.click(screen.getByRole("button", { name: /^Worked for 12s/ }));expect(screen.getByRole("button", { name: /^Read a\.ts.*Stopped/ })).toBeTruthy();});@@ -162,7 +157,6 @@ describe("work trace", () => {it("does not interpret tool output as HTML", () => {const {container} = render(<WorkTrace {...props} blocks={[tool("a",{name:"run_shell",input:{command:"<b>echo</b>"},output:'<img src=x onerror=alert(1)>'})]} />);- fireEvent.click(screen.getByRole("button", { name: /^Worked for 12s/ }));// Neither the command line nor its printed output turns into markup.expect(container.querySelector('img, b')).toBeNull();fireEvent.click(screen.getByRole("button", { name: /^<b>echo<\/b>/ }));@@ -184,7 +178,6 @@ describe("work trace", () => {expect(screen.getByRole("button", { name: /Run command.*49ms/ })).toBeTruthy();expect(screen.queryByText("0.0s")).toBeNull();rerender(<WorkTrace {...props} blocks={[tool("shell", { name, input: { command: "read skill instructions" }, durationMs: 49 })]} />);- fireEvent.click(screen.getByRole("button", { name: /^Worked for 12s/ }));// Codex keeps the line clean; the measured time is in the call's details.fireEvent.click(screen.getByRole("button", { name: /^read skill instructions/ }));expect(screen.getByText("Took 49ms")).toBeTruthy();@@ -267,10 +260,12 @@ describe("rail look", () => {expect(screen.getByRole("status").className).toMatch(/border-t/);});- it("shows the services a folded conversation turn used on its toggle", () => {+ it("shows a plugin call by its own logo, with nothing folded", () => {const blocks = [tool("linear", { name: "mcp__codex_apps__linear_list_issues" }), reply("done", "Three issues are open.")];render(<WorkTrace {...props} conversation blocks={blocks} />);- const toggle = screen.getByRole("button", { name: /^Worked for 12s/ });- expect(toggle.querySelector("img, [data-logo]")).toBeTruthy();+ expect(screen.queryByTestId("conversation-work-fold")).toBeNull();+ const line = screen.getByRole("button", { name: /^Linear/ });+ expect(line.querySelector("img, [data-logo]")).toBeTruthy();+ expect(screen.getByText("Three issues are open.")).toBeTruthy();});});diff --git a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsxindex 62834d6683..7789cb2acb 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx@@ -14,10 +14,9 @@ import { toolDiff } from "./toolDiff";import { formatTokens, outputTokens } from "./toolView";import { activityParts, traceToolIdentity, traceToolName } from "./traceActivity";import { ToolChoiceIcon } from "./ToolChoiceChips";-import type { ToolChoice } from "./toolChoices";import { toolIdentityStyle } from "./toolIdentity";-import { CopyTimeline, timelineItems, useTimeline, type TimelineRenderers } from "./TraceTimeline";-import { headerLabel, timelineMarkdown, traceDuration, type Timeline } from "./traceEntries";+import { timelineItems, useTimeline, type TimelineRenderers } from "./TraceTimeline";+import { traceDuration } from "./traceEntries";import "./WorkTrace.css";export type Decide = (id: string, decision: ApprovalDecision) => void | Promise<void>;@@ -503,65 +502,31 @@ function ActivityIcon({ blocks, live }: { blocks: TurnBlock[]; live: boolean })return <Icon aria-hidden className={rail ? nodeIcon : cn(iconClass, "mt-1", live && "motion-safe:animate-spin")} />;}-/** Up to three brand marks of the services a stretch of work touched. */-function traceLogos(blocks: TurnBlock[]): ToolChoice[] {- const rows: ToolChoice[] = [];- const seen = new Set<string>();- for (const block of blocks) {- if (block.kind !== "tool") continue;- const view = traceToolIdentity(block);- const key = view.identity.logo || view.identity.key || view.service || block.name;- if (!view.identity.logo || seen.has(key)) continue;- seen.add(key);- rows.push(view.row);- if (rows.length === 3) break;- }- return rows;-}-/** Small chevron that hides finished work so the reply can stand alone. */-function ConversationWorkFold({ durationMs, attention, blocks, children, timeline, initiallyOpen = false }: {- durationMs: number | null; attention?: ReactNode; blocks: TurnBlock[]; children: ReactNode;- /** Start open — the work is the turn's only outcome (it answered nothing). */- initiallyOpen?: boolean;- /** Rail look: the timeline behind the fold, for its "Worked for …" line. */- timeline?: Timeline;+function ConversationWorkFold({ durationMs, attention, children }: {+ durationMs: number | null; attention?: ReactNode; children: ReactNode;}) {const t = useT();- const rail = useRail();const id = useId();- const [open, setOpen] = useState(initiallyOpen);+ const [open, setOpen] = useState(false);// Counts openings so inner disclosures expand all at once, every time.- const [seq, setSeq] = useState(initiallyOpen ? 1 : 0);- const logos = useMemo(() => rail ? traceLogos(blocks) : [], [rail, blocks]);- const label = timeline ? headerLabel(timeline, durationMs, t)- : durationMs !== null && durationMs > 0- ? t("work_trace.thought_for").replace("{duration}", traceDuration(durationMs))- : t("work_trace.thought");+ const [seq, setSeq] = useState(0);+ const label = durationMs !== null && durationMs > 0+ ? t("work_trace.thought_for").replace("{duration}", traceDuration(durationMs))+ : t("work_trace.thought");const toggle = () => {if (!open) setSeq((s) => s + 1);setOpen(!open);};return (<div className="min-w-0" data-testid="conversation-work-fold" data-open={open ? "true" : "false"}>- {rail ? <button type="button" aria-expanded={open} aria-controls={id} onClick={toggle}- className="group/fold flex max-w-full min-w-0 items-center gap-2 rounded-md py-1 text-left text-sm leading-6 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">- {logos.length ? <span aria-hidden className="flex shrink-0 items-center">- {logos.map((row, i) => <span key={i} className={cn("tool-identity inline-flex rounded-full bg-background ring-2 ring-background", i > 0 && "-ml-1")} style={toolIdentityStyle(row)}><ToolChoiceIcon row={row} size={14} /></span>)}- </span> : null}- <span className="shrink-0">{label}</span>- {timeline && timeline.problemCount > 0 ? <span className="shrink-0 text-destructive">- <span aria-hidden className="mr-1.5 text-muted-foreground/50">·</span>- {t(`trace_report.failed_count_${timeline.problemCount === 1 ? "one" : "other"}`).replace("{count}", String(timeline.problemCount))}- </span> : null}- <ChevronRight aria-hidden className={cn("h-3.5 w-3.5 shrink-0 opacity-50 transition-transform group-hover/fold:opacity-100", open && "rotate-90")} />- </button> : <button type="button" aria-expanded={open} aria-controls={id}+ <button type="button" aria-expanded={open} aria-controls={id}className="group/fold mb-1 inline-flex max-w-full items-center gap-1 rounded-md px-1.5 py-1 text-left text-xs leading-5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"onClick={toggle}><ChevronRight aria-hidden className={cn("h-3 w-3 shrink-0 opacity-70 transition-transform group-hover/fold:opacity-100", open && "rotate-90")} /><span className="truncate">{label}</span>- </button>}- {open ? <div id={id} className={rail ? "group/fold-body pb-1 pt-0.5" : undefined}><FoldExpandContext.Provider value={seq}>{children}</FoldExpandContext.Provider></div> : attention}+ </button>+ {open ? <div id={id}><FoldExpandContext.Provider value={seq}>{children}</FoldExpandContext.Provider></div> : attention}</div>);}@@ -659,10 +624,10 @@ function WorkTraceBody({ blocks: rawBlocks, status, startedMs, durationMs, errorconst blocks = useMemo(() => withoutQuestionPolls(rawBlocks), [rawBlocks]);const live = status === "running";const elapsed = useClock(startedMs, live);- // The rail look folds every finished turn, conversation or not, the way- // Claude and Codex do: "Worked for …" opens the turn's timeline- // (TraceTimeline), the reply stands alone. The classic look folds- // conversation turns only, as before.+ // A finished turn is split into its work and its answer. The classic look+ // folds conversation work behind "Thought for …"; the rail look never folds+ // — like the Codex app, the narration and one quiet line per stretch of+ // calls stay in view above the answer (TraceTimeline).const split = useMemo(() => (conversation || rail) && !live ? splitConversationTurn(blocks) : null, [blocks, conversation, rail, live]);// A finished conversation turn shows the reply and nothing else. All work// — tools, thoughts, intermediate replies, failures, interruptions, and@@ -670,7 +635,7 @@ function WorkTraceBody({ blocks: rawBlocks, status, startedMs, durationMs, error// approvals stay visible both ways: beside the toggle while it is closed// (they need a tap) and inside the open chain.const fold = useMemo(() => {- if (!split) return null;+ if (!split || rail) return null;const workAll = [...split.work, ...split.after];if (!hasFoldableWork(workAll.filter((block) => !isPendingApproval(block)))) return null;return {@@ -678,12 +643,15 @@ function WorkTraceBody({ blocks: rawBlocks, status, startedMs, durationMs, errorworkAll,approvals: workAll.filter(isPendingApproval),};- }, [split]);+ }, [split, rail]);const groups = useMemo(() => conversation ? groupConversationTrace(fold ? fold.workAll : blocks) : groupActivityTrace(blocks), [blocks, conversation, fold]);const restGroups = useMemo(() => fold ? groupConversationTrace(fold.answer) : null, [fold]);- // A live turn keeps its replies and streaming pieces in place; a folded- // one tells its narration as the timeline's prose.- const timeline = useTimeline(rail ? (fold ? fold.workAll : blocks) : NO_BLOCKS, status, !fold);+ // While a turn runs, its replies and streaming pieces stay live rows; once+ // it is done, text before the answer reads as the timeline's narration and+ // anything after the answer follows it.+ const timeline = useTimeline(rail ? (split ? split.work : blocks) : NO_BLOCKS, status, live);+ const afterAnswer = useTimeline(rail && split ? split.after : NO_BLOCKS, status, live);+ const answerGroups = useMemo(() => rail && split ? groupConversationTrace(split.answer) : null, [rail, split]);const asking = blocks.some(isOpenQuestion);const pending = asking || blocks.some(block => block.kind === "tool" && block.approval?.decision === null);const outcome = asking ? "question" : pending ? "approval" : live ? "working" : status === "error" ? "failed" : status === "cancelled" ? "stopped" : "done";@@ -720,7 +688,7 @@ function WorkTraceBody({ blocks: rawBlocks, status, startedMs, durationMs, error</div>;const statusItem: RailItem = { key: "trace:status", node: statusLine, rail: statusOnRail };const errorItem = (text: string, key: string): RailItem => ({ key, rail: false,- node: <p role="alert" className="py-1.5 pl-7 text-sm text-destructive [overflow-wrap:anywhere]">{text}</p> });+ node: <p role="alert" className="py-1.5 text-sm text-destructive [overflow-wrap:anywhere]">{text}</p> });const renderers: TimelineRenderers = {renderLive: (block) => block.kind === "tool" ? <TraceTool block={block} status={status} onDecide={onDecide} />: block.kind === "reasoning" ? <ReasoningTrace block={block} turnLive={live} compact={conversation} />@@ -730,18 +698,11 @@ function WorkTraceBody({ blocks: rawBlocks, status, startedMs, durationMs, error: <div className="prose prose-sm max-w-none text-foreground dark:prose-invert [overflow-wrap:anywhere]"><ChatMarkdown text={text} /></div>,renderDetails: (block) => <ToolDetails block={block} />,};- const steps = timelineItems(timeline, renderers);- const rest = restGroups ? traceGroupItems({ groups: restGroups, ...groupProps }) : [];- const items: RailItem[] = fold- ? [{ key: "trace:fold", rail: false, node: <ConversationWorkFold durationMs={durationMs} blocks={fold.workAll} timeline={timeline}- // A turn that ended without an answer (TurnTrace names it so) has- // nothing to read but its work: the timeline stands open.- initiallyOpen={!answered && Boolean(completionLabel)}- attention={<div className="trace-fold-open"><Rail items={fold.approvals.map(block => ({ key: block.callId, rail: !block.question, node: <TraceTool block={block} status={status} onDecide={onDecide} /> }))} /></div>}>- <Rail items={[...steps, ...(foldedError ? [errorItem(foldedError, "trace:folded-error")] : [])]} />- <CopyTimeline text={() => timelineMarkdown(timeline, headerLabel(timeline, durationMs, t), t)} />- </ConversationWorkFold> }, ...rest]- : steps;+ const items: RailItem[] = [+ ...timelineItems(timeline, renderers),+ ...(answerGroups ? traceGroupItems({ groups: answerGroups, ...groupProps }) : []),+ ...timelineItems(afterAnswer, renderers),+ ];if (visibleError) items.push(errorItem(visibleError, "trace:error"));items.push(statusItem);return <div className={cn("min-w-0", conversation && "w-full max-w-[44rem] self-start", className)} data-testid="work-trace" data-look="rail" data-state={status} {...(conversation ? { "data-conversation": "" } : {})}>@@ -751,7 +712,7 @@ function WorkTraceBody({ blocks: rawBlocks, status, startedMs, durationMs, errorconst classicGroups = (list: Group[]) => <>{traceGroupItems({ groups: list, ...groupProps }).map(item => <Fragment key={item.key}>{item.node}</Fragment>)}</>;return <div className={cn("min-w-0 space-y-0.5", conversation && "w-full max-w-[44rem] self-start", className)} data-testid="work-trace" data-state={status} {...(conversation ? { "data-conversation": "" } : {})}>- {fold ? <ConversationWorkFold durationMs={durationMs} blocks={fold.workAll} attention={fold.approvals.map(block =>+ {fold ? <ConversationWorkFold durationMs={durationMs} attention={fold.approvals.map(block =><div key={block.callId} className="w-full py-1 text-xs [&_button]:text-xs"><TraceTool block={block} status={status} onDecide={onDecide} /></div>)}>diff --git a/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.test.ts b/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.test.tsindex da8ecfce6f..094b916d26 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.test.ts+++ b/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.test.ts@@ -5,7 +5,7 @@ import es from "@/i18n/locales/es.json";import { reduceThinkingSteps, type ThinkingStep } from "@/lib/thinkingSteps";import type { ToolBlock, TurnBlock } from "./reduce";import {- buildTimeline, commandBinary, headerLabel, shortPath, timelineMarkdown, traceDuration, withoutCd,+ buildTimeline, commandBinary, shortPath, traceDuration, withoutCd,type ActivityEntry, type Call, type TimelineOptions,} from "./traceEntries";import { stepsToBlocks } from "./VoiceWorkTrace";@@ -62,7 +62,7 @@ describe("trace timeline (Codex-style)", () => {it("names each call in its own words", () => {expect(only(tool("r", { name: "Read", input: { file_path: "C:/repo/src/app/main.ts" }, output: "x" })).text).toBe("Read …/src/app/main.ts");- expect(only(tool("i", { name: "Read", input: { file_path: "shots/hero.png" }, output: "" }))).toMatchObject({ kind: "image", text: "Viewed shots/hero.png" });+ expect(only(tool("i", { name: "Read", input: { file_path: "shots/hero.png" }, output: "" }))).toMatchObject({ kind: "image", text: "Viewed an image", detail: "shots/hero.png" });expect(only(tool("g", { name: "Grep", input: { pattern: "TODO", path: "src/lib" }, output: "" })).text).toBe("Searched for TODO in src/lib");expect(only(tool("l", { name: "LS", input: { path: "src" }, output: "" })).text).toBe("Listed src");expect(only(tool("w", { name: "Write", input: { file_path: "new.ts", content: "a\nb" }, output: "ok" }))).toMatchObject({ kind: "write", text: "Created new.ts" });@@ -148,30 +148,6 @@ describe("trace timeline (Codex-style)", () => {expect((line.entries[0] as ActivityEntry).calls[0]).toMatchObject({ text: "Find app action", detail: "computers" });expect((line.entries[2] as ActivityEntry).calls[0]).toMatchObject({ text: "Run app action", status: "blocked" });expect(line.problemCount).toBe(1);- expect(headerLabel(line, 2400, t)).toBe("Worked for 2.4s");- });-- it("says Thought for … when the turn only thought", () => {- const line = buildTimeline([thinking("r", "Plan the answer.")], opts());- expect(headerLabel(line, 3000, t)).toBe("Thought for 3.0s");- expect(headerLabel(line, null, t)).toBe("Thought");- });-- it("copies as Markdown in the timeline's own order", () => {- const line = buildTimeline([- text("n", "First the port."),- tool("c", { output: "8080" }),- tool("f", { name: "Edit", input: { file_path: "b.ts", old_string: "a", new_string: "b" }, output: "boom", isError: true }),- ], opts());- expect(timelineMarkdown(line, headerLabel(line, 4200, t), t)).toBe([- "**Worked for 4.2s**",- "",- "First the port.",- "",- "*Ran a command, edited a file*",- "- `ls`",- "- Edited b.ts (+1 −1) — Failed: boom",- ].join("\n"));});it("formats durations and paths the way a line shows them", () => {@@ -190,7 +166,8 @@ describe("trace timeline (Codex-style)", () => {tool("d", { name: "Read", input: { file_path: "a.png" }, output: "" }),tool("e", { name: "mcp__linear__list_issues", input: {}, output: "[]" }),], { t: tl, lang, status: "done", live: false });- const all = timelineMarkdown(line, headerLabel(line, 9000, tl), tl);+ const all = line.entries.flatMap((e) => e.kind === "activity"+ ? [e.summary, ...e.calls.map((c) => `${c.text} ${c.detail} ${c.result} ${c.reason}`)] : []).join(" | ");expect(all).not.toMatch(/\{\w+\}|trace_report\./);});});diff --git a/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.ts b/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.tsindex f8230929f1..68d0508be0 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.ts+++ b/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.ts@@ -326,7 +326,8 @@ function callOf(block: ToolBlock, turn: TurnStatus, t: Translate, lang: string):}if (action === "read") {const path = firstString(record, ACTION_KEYS.read) || description.detail;- if (IMAGE_FILE.test(path)) return { ...base, kind: "image", text: tr(t, "call.image", { target: shortPath(path) }), bucket: "image" };+ // Codex says "Viewed an image"; the file name follows quieter.+ if (IMAGE_FILE.test(path)) return { ...base, kind: "image", text: capitalize(tr(t, "act.image_one")), detail: shortPath(path), bucket: "image" };return { ...base, kind: "read", text: tr(t, "call.read", { target: shortPath(path) }), bucket: "read" };}if (action === "list") {@@ -432,40 +433,3 @@ export function buildTimeline(blocks: TurnBlock[], options: TimelineOptions): Tiflush();return { entries, callCount, problemCount };}--/** The folded line: "Worked for 4m 07s" when calls ran, "Thought for 3.0s" otherwise. */-export function headerLabel(timeline: Timeline, durationMs: number | null, t: Translate): string {- const worked = timeline.callCount > 0;- if (durationMs === null || durationMs <= 0) return tr(t, worked ? "worked" : "thought");- return tr(t, worked ? "worked_for" : "thought_for", { duration: traceDuration(durationMs) });-}--function codeSpan(text: string): string {- const fence = text.includes("`") ? "``" : "`";- const pad = fence === "``" ? " " : "";- return `${fence}${pad}${text}${pad}${fence}`;-}--/** The timeline as Markdown — what "Copy" puts on the clipboard. */-export function timelineMarkdown(timeline: Timeline, header: string, t: Translate): string {- const out: string[] = [`**${header}**`];- for (const entry of timeline.entries) {- if (entry.kind === "live") continue;- out.push("");- if (entry.kind === "prose") {- out.push(entry.text);- continue;- }- if (entry.calls.length > 1) out.push(`*${entry.summary}*`);- for (const call of entry.calls) {- const words = call.kind === "command" ? codeSpan(call.text) : call.text;- const size = call.added || call.removed ? ` (+${call.added} −${call.removed})` : "";- const tail = call.detail ? ` — ${call.detail}` : "";- const result = call.result ? `: ${call.result}` : "";- const state = call.status === "done" || call.status === "running" ? ""- : ` — ${tr(t, `state.${call.status}`)}${call.reason ? `: ${call.reason}` : ""}`;- out.push(`- ${words}${size}${tail}${result}${state}`);- }- }- return out.join("\n").replace(/\n{3,}/g, "\n\n").trim();-}diff --git a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsxindex 112e300f18..c71606867f 100644--- a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx+++ b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx@@ -764,8 +764,7 @@ describe("ChatStage (agent chat)", () => {render(<ChatStage />);const trace = screen.getByTestId("work-trace");- // The finished turn folds behind "Worked for …"; one tap opens its timeline.- fireEvent.click(within(trace).getByRole("button", { name: /^Worked for 6\.0s/ }));+ // Like the Codex app, the finished turn keeps its work in view.const text = trace.textContent!;expect(text.indexOf("First the port.")).toBeLessThan(text.indexOf("Get-NetTCPConnection"));expect(text.indexOf("Get-NetTCPConnection")).toBeLessThan(text.indexOf("It is listening."));@@ -837,10 +836,9 @@ describe("ChatStage (agent chat)", () => {]);useAgentChatStore.setState({ activeSessionId: "s9", timeline });render(<ChatStage />);- const toggle = screen.getByRole("button", { name: /^Worked for 12s/ });- // The plugin the turn used shows on the folded line by its own logo.- expect(toggle.querySelector("img, [data-logo]")).toBeTruthy();- fireEvent.click(toggle);+ // The plugin the turn used shows on its line by its own logo.+ const stretch = screen.getByRole("button", { name: /^Ran a command, used GitHub/ });+ expect(stretch.querySelector("img, [data-logo]")).toBeTruthy();fireEvent.click(screen.getByRole("button", { name: /^Ran a command, used GitHub/ }));const [shell, github] = Array.from(document.querySelectorAll<HTMLElement>("[data-trace-entry='call']"));expect(shell.textContent).toContain("Get-ChildItem -Path 'C:\\Users'");diff --git a/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx b/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsxindex f3e9515255..eaf9c6e7c2 100644--- a/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx+++ b/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx@@ -1,4 +1,4 @@-import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { cleanup, render, screen } from "@testing-library/react";import { afterEach, expect, it } from "vitest";import { TurnSteps, formatThoughtDuration, traceWorthShowing } from "./TurnSteps";import type { ThinkingStep } from "@/lib/thinkingSteps";@@ -7,9 +7,6 @@ it("keeps brief voice errors visible", () => {const steps: ThinkingStep[] = [{ id: "s", kind: "note", status: "error", labelKey: "thinking.step_update", error: "Connection lost", startedTs: 0 }];expect(traceWorthShowing(steps, 20, false)).toBe(true);render(<TurnSteps steps={steps} durationMs={20} />);- // The finished trace folds into its report; the toggle says a step failed.- const toggle = screen.getByRole("button", { name: /1 failed/ });- fireEvent.click(toggle);// A failed step says why under its own line.expect(screen.getByText("Connection lost")).toBeTruthy();});diff --git a/jarvis/ui/web/frontend/src/components/society/chat/ChatActivity.test.tsx b/jarvis/ui/web/frontend/src/components/society/chat/ChatActivity.test.tsxindex 7661b5125e..3db7d5baa4 100644--- a/jarvis/ui/web/frontend/src/components/society/chat/ChatActivity.test.tsx+++ b/jarvis/ui/web/frontend/src/components/society/chat/ChatActivity.test.tsx@@ -61,35 +61,28 @@ it("keeps live and interrupted conversation tools in the left lane", () => {{ kind: "text", id: "reply", text: "I will send the mail next." },live,]} />);- // The finished turn shows the reply; the interruption folds behind the toggle.- expect(screen.getByText("I will send the mail next.")).toBeTruthy();- expect(screen.queryByText("Interrupted without a result")).toBeNull();- expect(screen.queryByText("Inspect archive.")).toBeNull();- fireEvent.click(screen.getByRole("button", { name: /^Worked for 4\.1s.*1 failed/ }));- // Opening the fold shows the whole timeline in one tap: the model's words,- // the call, and that it never returned.- const lane2 = screen.getByTestId("work-trace").textContent!;- expect(lane2).toContain("Inspect archive.");- expect(lane2).toContain("Searched for archive");- expect(lane2).toContain("Stopped");+ // Like the Codex app, nothing folds: the model's words, the reply and the+ // call that never returned all stay in view, in order.+ const text = screen.getByTestId("work-trace").textContent!;+ expect(text.indexOf("Inspect archive.")).toBeLessThan(text.indexOf("I will send the mail next."));+ expect(text.indexOf("I will send the mail next.")).toBeLessThan(text.indexOf("Searched for archive"));+ expect(text).toContain("Stopped");expect(container.querySelectorAll(".mx-auto")).toHaveLength(0);expect(screen.getByTestId("work-trace").className).toMatch(/self-start/);});-it("folds a failure with the surrounding work, keeping only the reply out", () => {+it("keeps a failure in view beside the reply, its reason under its line", () => {const tool: ToolBlock = { kind: "tool", callId: "a", name: "read_file", input: { path: "report.csv" }, output: "Report contents", isError: false, durationMs: 100, approval: null, startedMs: 0 };render(<WorkTrace conversation status="done" startedMs={0} durationMs={2000} blocks={[tool,{ ...tool, callId: "error", isError: true, output: "Upload failed" },{ kind: "text", id: "reply", text: "I could not finish." },]} />);- expect(screen.queryByText("Upload failed")).toBeNull();+ expect(screen.queryByTestId("conversation-work-fold")).toBeNull();expect(screen.getByText("I could not finish.")).toBeTruthy();- expect(screen.queryByText("Report contents")).toBeNull();- fireEvent.click(screen.getByRole("button", { name: /^Worked for 2\.0s.*1 failed/ }));// One quiet line for the stretch; it opens to the calls, and the failed// one says why under its own line.- fireEvent.click(screen.getByRole("button", { name: /^Read files.*1 failed/ }));+ fireEvent.click(screen.getByRole("button", { name: /^Read files$/ }));expect(screen.getByText("Upload failed")).toBeTruthy();// The raw output stays one tap further, under the call.expect(screen.queryByText("Report contents")).toBeNull();@@ -97,18 +90,15 @@ it("folds a failure with the surrounding work, keeping only the reply out", () =expect(screen.getByText("Report contents")).toBeTruthy();});-it("folds failures but keeps pending approvals visible in the conversation style", () => {+it("keeps a pending approval actionable in the conversation style", () => {const base: ToolBlock = { kind: "tool", callId: "failure", name: "send_message", input: {}, output: "Delivery failed", isError: true, durationMs: 100, approval: null, startedMs: 0 };render(<WorkTrace conversation status="done" startedMs={0} durationMs={1000} blocks={[base,{ ...base, callId: "approval", isError: false, output: null, approval: { approvalId: "ap", summary: "Send this message?", decision: null } },]} onDecide={() => undefined} />);- expect(screen.queryByText("Delivery failed")).toBeNull();- expect(screen.getByText("Send this message?")).toBeTruthy();- expect(screen.getByRole("button", { name: "Approve" })).toBeTruthy();- fireEvent.click(screen.getByRole("button", { name: /^Worked for 1\.0s/ }));+ // The failed call says why on its own line; the approval needs a tap.expect(screen.getByText("Delivery failed")).toBeTruthy();- // The approval card survives opening the fold — it still needs a tap.+ expect(screen.getByText("Send this message?")).toBeTruthy();expect(screen.getByRole("button", { name: "Approve" })).toBeTruthy();});@@ -124,34 +114,25 @@ it("shows agent message direction and truthful delivery state without preview clexpect(screen.getByRole("alert").textContent).toBe("Connection closed");});-it("folds successful work and post-reply errors behind one toggle without reordering the conversation", () => {+it("keeps work after the reply after it, without reordering the conversation", () => {const tool: ToolBlock = { kind: "tool", callId: "a", name: "read_file", input: { path: "report.csv" }, output: "Report contents", isError: false, durationMs: 100, approval: null, startedMs: 0 };const blocks = [tool, { ...tool, callId: "b", name: "write_file" }, { kind: "text" as const, id: "reply", text: "Your report is ready." }, { ...tool, callId: "error", isError: true, output: "Upload failed" }];const { rerender } = render(<WorkTrace conversation status="running" startedMs={0} durationMs={null} blocks={blocks} />);- // While it runs, finished calls already read as their timeline line.+ // While it runs, finished calls already read as their line.expect(screen.getByRole("button", { name: /^Read a file, created a file/ })).toBeTruthy();rerender(<WorkTrace conversation status="done" startedMs={0} durationMs={1000} blocks={blocks} />);- expect(screen.queryByRole("button", { name: /^Read a file, created a file/ })).toBeNull();- expect(screen.getByText("Your report is ready.")).toBeTruthy();- expect(screen.queryByText("Upload failed")).toBeNull();- expect(screen.queryByText("Report contents")).toBeNull();- const toggle = screen.getByRole("button", { name: /^Worked for 1\.0s.*1 failed/ });- fireEvent.click(toggle);- // One tap opens the timeline: the post-reply error joins the stretch, the- // reply stays where it was.- const stretch = screen.getByRole("button", { name: /^Read files, created a file.*1 failed/ });+ const text = screen.getByTestId("work-trace").textContent ?? "";+ expect(text.indexOf("Read a file, created a file")).toBeLessThan(text.indexOf("Your report is ready."));+ expect(text.indexOf("Your report is ready.")).toBeLessThan(text.indexOf("Read report.csv"));expect(screen.getAllByText("Your report is ready.")).toHaveLength(1);+ // The call after the reply failed and says why without opening anything.+ expect(screen.getByText("Upload failed")).toBeTruthy();+ // Each stretch opens to its calls, and closes again.+ const stretch = screen.getByRole("button", { name: /^Read a file, created a file/ });+ fireEvent.click(stretch);+ expect(screen.getByRole("button", { name: /^Created report\.csv/ })).toBeTruthy();fireEvent.click(stretch);- const calls = Array.from(document.querySelectorAll<HTMLElement>("[data-trace-entry='call']")).map((c) => c.textContent);- expect(calls[0]).toContain("Read report.csv");- expect(calls[1]).toContain("Created report.csv");- expect(calls[2]).toContain("Upload failed");- // Each call's raw output stays tappable on its own.- const first = screen.getAllByRole("button", { name: /^Read report\.csv/ })[0];- fireEvent.click(first);- expect(screen.getAllByText("Report contents").length).toBeGreaterThan(0);- fireEvent.click(first);- expect(screen.queryAllByText("Report contents")).toHaveLength(0);+ expect(screen.queryByRole("button", { name: /^Created report\.csv/ })).toBeNull();});it("does not offer a thought toggle when the turn is only a reply", () => {@@ -160,7 +141,7 @@ it("does not offer a thought toggle when the turn is only a reply", () => {expect(screen.getByText("Hello.")).toBeTruthy();});-it("hides intermediate replies behind one thought toggle once the turn completes", () => {+it("tells intermediate replies as narration once the turn completes", () => {const tool: ToolBlock = { kind: "tool", callId: "a", name: "read_file", input: { path: "report.csv" }, output: "Report contents", isError: false, durationMs: 100, approval: null, startedMs: 0 };const blocks = [tool,@@ -168,18 +149,12 @@ it("hides intermediate replies behind one thought toggle once the turn completes{ ...tool, callId: "b", name: "list_dir" },{ kind: "text" as const, id: "final", text: "The report is ready." },];- const { rerender } = render(<WorkTrace conversation status="running" startedMs={0} durationMs={null} blocks={blocks} />);+ const { container, rerender } = render(<WorkTrace conversation status="running" startedMs={0} durationMs={null} blocks={blocks} />);expect(screen.getByText("I will inspect the files first.")).toBeTruthy();- expect(screen.getByText("The report is ready.")).toBeTruthy();rerender(<WorkTrace conversation status="done" startedMs={0} durationMs={4000} blocks={blocks} />);- expect(screen.queryByText("I will inspect the files first.")).toBeNull();- expect(screen.queryByText("Used tools")).toBeNull();+ // The words between calls read as narration, not as a second answer.+ const narration = container.querySelector("[data-trace-entry='narration']");+ expect(narration?.textContent).toContain("I will inspect the files first.");expect(screen.getByText("The report is ready.")).toBeTruthy();- const toggle = screen.getByRole("button", { name: /^Worked for 4\.0s/ });- expect(toggle.getAttribute("aria-expanded")).toBe("false");- fireEvent.click(toggle);- expect(toggle.getAttribute("aria-expanded")).toBe("true");- expect(screen.getByText("I will inspect the files first.")).toBeTruthy();- fireEvent.click(toggle);- expect(screen.queryByText("I will inspect the files first.")).toBeNull();+ expect(screen.queryByTestId("conversation-work-fold")).toBeNull();});diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 1304c98e80..0916bc66b7 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -5663,21 +5663,12 @@},"trace_report": {"locale": "de",- "copy": "Kopieren",- "copied": "Kopiert",- "copy_failed": "Kopieren fehlgeschlagen","show_more": "Mehr anzeigen","show_less": "Weniger anzeigen",- "worked_for": "{duration} gearbeitet",- "worked": "Gearbeitet",- "thought_for": "{duration} nachgedacht",- "thought": "Nachgedacht","took": "Dauer: {duration}",- "failed_count_one": "{count} fehlgeschlagen",- "failed_count_other": "{count} fehlgeschlagen","act": {- "command_one": "einen Befehl ausgeführt",- "command_other": "Befehle ausgeführt",+ "command_one": "hat einen Befehl ausgeführt",+ "command_other": "hat Befehle ausgeführt","read_one": "eine Datei gelesen","read_other": "Dateien gelesen","list_one": "einen Ordner aufgelistet",@@ -5698,8 +5689,7 @@"search": "Nach {pattern} gesucht","search_in": "In {path} nach {pattern} gesucht","edit": "{target} bearbeitet",- "write": "{target} erstellt",- "image": "{target} angesehen"+ "write": "{target} erstellt"},"state": {"running": "Läuft",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 69806c7dd3..222b78f723 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -5696,18 +5696,9 @@},"trace_report": {"locale": "en",- "copy": "Copy",- "copied": "Copied",- "copy_failed": "Could not copy","show_more": "Show more","show_less": "Show less",- "worked_for": "Worked for {duration}",- "worked": "Worked",- "thought_for": "Thought for {duration}",- "thought": "Thought","took": "Took {duration}",- "failed_count_one": "{count} failed",- "failed_count_other": "{count} failed","act": {"command_one": "ran a command","command_other": "ran commands",@@ -5731,8 +5722,7 @@"search": "Searched for {pattern}","search_in": "Searched for {pattern} in {path}","edit": "Edited {target}",- "write": "Created {target}",- "image": "Viewed {target}"+ "write": "Created {target}"},"state": {"running": "Running",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 1feb95956f..d92df8856a 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -5663,18 +5663,9 @@},"trace_report": {"locale": "es",- "copy": "Copiar",- "copied": "Copiado",- "copy_failed": "No se pudo copiar","show_more": "Mostrar más","show_less": "Mostrar menos",- "worked_for": "Trabajó durante {duration}",- "worked": "Trabajó",- "thought_for": "Pensó durante {duration}",- "thought": "Pensó","took": "Tardó {duration}",- "failed_count_one": "{count} falló",- "failed_count_other": "{count} fallaron","act": {"command_one": "ejecutó un comando","command_other": "ejecutó comandos",@@ -5698,8 +5689,7 @@"search": "Buscó {pattern}","search_in": "Buscó {pattern} en {path}","edit": "Editó {target}",- "write": "Creó {target}",- "image": "Vio {target}"+ "write": "Creó {target}"},"state": {"running": "En curso",