Skip to content

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.

feat(trace): draw traces the way the Codex app does

rubenluetke10-beep4306c3ce76e2
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.test.tsx
index 14cc72c813..beda261a2f 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentTimeline.test.tsx
@@ -17,8 +17,7 @@ it("replays persisted events through the new shared trace", () => {
// 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");
- expect(screen.getByTestId("work-trace").textContent).toContain("Worked·Listed a folder");
- expect(screen.getByRole("button", { name: /^Explored/ }).parentElement?.textContent).toContain("Listsrc");
+ expect(screen.getByRole("button", { name: /^Listed src/ })).toBeTruthy();
});
describe("the person's turn with files", () => {
const SHOT = {
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.test.tsx
index af9b46cbd0..9d0cf4da49 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.test.tsx
@@ -18,23 +18,28 @@ it("reopens a stored voice turn as a Claude/Codex-style timeline", () => {
];
render(<VoiceWorkTrace steps={steps} durationMs={2400} />);
// Folded to one line that says what happened.
- const toggle = screen.getByRole("button", { name: /^Worked for 2\.4s.*Used the wiki.*1 failed/ });
+ const toggle = screen.getByRole("button", { name: /^Worked for 2\.4s.*1 failed/ });
// The turn is not called failed because one call was refused.
expect(screen.getByRole("status").textContent).toContain("Done");
fireEvent.click(toggle);
// The model's own words read as prose, Markdown and all.
- const thought = document.querySelector<HTMLElement>("[data-trace-entry='thought']")!;
- expect(within(thought).getByText("wiki").tagName).toBe("STRONG");
- // Each call is one line, with what came of it underneath.
- const [wiki, refused] = Array.from(document.querySelectorAll<HTMLElement>("[data-trace-entry='tool']"));
+ const words = document.querySelector<HTMLElement>("[data-trace-entry='reasoning']")!;
+ expect(within(words).getByText("wiki").tagName).toBe("STRONG");
+ // 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/ }));
+ const [wiki, refused] = Array.from(document.querySelectorAll<HTMLElement>("[data-trace-entry='call']"));
expect(wiki.textContent).toContain("Searched the wikiUrlaub 2026");
- expect(wiki.textContent).toContain("49ms");
- expect(wiki.textContent).toContain("1 result");
- expect(refused.textContent).toContain("Blocked: a safety rule blocks this action");
- // The raw call is one tap away.
+ expect(refused.textContent).toContain("Run app action");
+ expect(refused.textContent).toContain("Blocked");
+ // A call opens to what came back and why it did not run.
fireEvent.click(within(wiki).getByRole("button"));
+ expect(wiki.textContent).toContain("1 result");
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();
});
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.tsx b/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.tsx
index 2b32dbecf4..6cdfdc601e 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.tsx
@@ -1,5 +1,5 @@
import { useLayoutEffect, useMemo, useRef, useState, type ReactNode } from "react";
-import { Check, ChevronRight, CircleAlert, Copy, FilePenLine, FilePlus2, FolderSearch, ShieldX, Terminal } from "lucide-react";
+import { Check, ChevronRight, Copy, 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";
@@ -7,111 +7,124 @@ import { robustCopy } from "@/lib/clipboard";
import { cn } from "@/lib/utils";
import type { ToolBlock, TurnBlock, TurnStatus } from "./reduce";
import { ToolChoiceIcon } from "./ToolChoiceChips";
-import { toolIdentityStyle } from "./toolIdentity";
+import type { ToolChoice } from "./toolChoices";
+import { toolIdentity, toolIdentityStyle } from "./toolIdentity";
import { traceToolIdentity } from "./traceActivity";
import {
- buildTimeline, plural, tr, traceDuration,
- type CommandEntry, type EditEntry, type EntryStatus, type ExploreEntry, type ThoughtEntry, type Timeline, type TimelineEntry, type ToolEntry,
+ buildTimeline, plural, readableOutput, summarize, traceDuration, tr,
+ type ActivityEntry, type Call, type ProseEntry, type Timeline,
} from "./traceEntries";
/**
- * The renderer of a turn's timeline (model: traceEntries.ts), drawn the
- * way Claude and Codex draw their traces: the model's words as prose, each
- * call one quiet line on the rail with what came of it underneath — the
- * first lines a command printed, the files an exploration read, the size of
- * an edit — and the raw call one tap away. Live pieces (a running call, an
- * approval, a question card, a streaming thought, a reply) are drawn by the
- * caller, so the live turn and its finished record read as one timeline.
+ * The renderer of a turn's timeline (model: traceEntries.ts), drawn the way
+ * the Codex app draws its work: no thread, no bullets, no numbered rings.
+ * The model's words are prose; each stretch of calls is one quiet line with
+ * the stretch's real mark — a plugin's logo, a CLI vendor's logo, else one
+ * plain glyph — that opens to the single calls, and a call opens to what it
+ * ran and what came back.
*/
-/** One item on a rail; `rail: false` breaks the thread (replies, question cards). */
+/** One item in the trace; `rail` is kept for the live rows that still hang on one. */
export type RailItem = { key: string; node: ReactNode; rail: boolean };
export interface TimelineRenderers {
- /** A live piece: running call, approval, question card, streaming thought, reply. */
+ /** Approvals, question cards, a streaming thought, a live reply. */
renderLive: (block: TurnBlock) => ReactNode;
- /** Whether a live piece hangs on the thread (replies and question cards do not). */
liveOnRail: (block: TurnBlock) => boolean;
- /** The raw call — input, diff, output — under a line's disclosure. */
+ /** Narration the model wrote between calls, in the reply's own type. */
+ renderNarration: (text: string, id: string) => ReactNode;
+ /** A non-command call's raw input, diff and output. */
renderDetails: (block: ToolBlock) => ReactNode;
}
-/** The timeline of a turn, recomputed when its blocks, state or language change. */
export function useTimeline(blocks: TurnBlock[], status: TurnStatus, live: boolean): Timeline {
const t = useT();
- // The locale's own tag, read through the dictionary: plurals and lists
- // follow the language the lines are written in.
+ // The locale's own tag, read through the dictionary, so plurals follow
+ // the language the lines are written in.
const lang = t("trace_report.locale");
return useMemo(() => buildTimeline(blocks, { t, lang, status, live }), [blocks, t, lang, status, live]);
}
export function timelineItems(timeline: Timeline, renderers: TimelineRenderers): RailItem[] {
return timeline.entries.map((entry): RailItem => {
- if (entry.kind === "live") {
- return { key: entry.id, rail: renderers.liveOnRail(entry.block), node: renderers.renderLive(entry.block) };
- }
- return { key: entry.id, rail: true, node: <EntryView entry={entry} renderDetails={renderers.renderDetails} /> };
+ if (entry.kind === "live") return { key: entry.id, rail: renderers.liveOnRail(entry.block), node: renderers.renderLive(entry.block) };
+ if (entry.kind === "prose") return { key: entry.id, rail: false, node: <ProseView entry={entry} renderers={renderers} /> };
+ return { key: entry.id, rail: false, node: <ActivityView entry={entry} renderers={renderers} /> };
});
}
-function EntryView({ entry, renderDetails }: { entry: Exclude<TimelineEntry, { kind: "live" }>; renderDetails: (block: ToolBlock) => ReactNode }) {
- switch (entry.kind) {
- case "thought": return <ThoughtView entry={entry} />;
- case "explore": return <ExploreView entry={entry} renderDetails={renderDetails} />;
- case "command": return <CommandView entry={entry} renderDetails={renderDetails} />;
- case "edit": return <EditView entry={entry} renderDetails={renderDetails} />;
- case "tool": return <ToolView entry={entry} renderDetails={renderDetails} />;
- }
-}
+// ── Marks ────────────────────────────────────────────────────────────────
-const rowButton = "group/trace flex w-full min-w-0 items-start gap-3 rounded-md py-1 text-left text-sm leading-6 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring enabled:hover:text-foreground disabled:cursor-default";
-const glyph = "h-3.5 w-3.5 shrink-0";
+const glyph = "h-[15px] w-[15px] shrink-0";
+const GLYPHS = { command: SquareTerminal, read: FileText, list: FolderOpen, search: Search, edit: Pencil, write: FilePlus2, image: Image, web: Globe } as const;
-/** One line on the rail: glyph, words, time; what came of it underneath; the raw call on tap. */
-function Line({ icon, label, trailing, below, details, problem = false, testId }: {
- icon: ReactNode; label: ReactNode; trailing?: ReactNode; below?: ReactNode; details?: ReactNode; problem?: boolean; testId: string;
-}) {
- const [open, setOpen] = useState(false);
- return <div className={cn("min-w-0", problem ? "text-destructive" : "text-muted-foreground")} data-trace-entry={testId}>
- <button type="button" className={rowButton} disabled={!details} aria-expanded={details ? open : undefined} onClick={() => setOpen(!open)}>
- <span aria-hidden className="trace-node">{icon}</span>
- <span className="flex min-w-0 flex-1 items-baseline gap-2">{label}</span>
- {trailing ? <span className="shrink-0 text-xs leading-6 tabular-nums text-muted-foreground">{trailing}</span> : null}
- {details ? <ChevronRight aria-hidden className={cn("mt-[5px] h-3.5 w-3.5 shrink-0 opacity-0 transition group-hover/trace:opacity-70 group-focus-visible/trace:opacity-70", open && "rotate-90 opacity-70")} /> : null}
- </button>
- {below ? <div className="min-w-0 pb-1 pl-7">{below}</div> : null}
- {details && open ? <div className="min-w-0 pb-1.5 pl-7">{details}</div> : null}
- </div>;
+function cliRow(binary: string): ToolChoice {
+ return {
+ id: `cli:${binary}`, label: binary, brand: "", group: "", skill: "", category: "cli",
+ description: "", available: true, tool_names: [],
+ };
}
-/** The verb of a line, then its object in the mono face. */
-function Words({ verb, object, problem = false }: { verb: string; object?: string; problem?: boolean }) {
- return <>
- <span className={cn("shrink-0", problem ? "text-destructive" : "text-foreground-secondary")}>{verb}</span>
- {object ? <span className="min-w-0 truncate font-mono text-[12.5px] text-muted-foreground" title={object}>{object}</span> : null}
- </>;
+/** 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} />
+ </span>;
}
-function problemGlyph(status: EntryStatus): ReactNode | null {
- if (status === "blocked" || status === "declined") return <ShieldX className={glyph} />;
- if (status === "failed" || status === "interrupted") return <CircleAlert className={glyph} />;
+/** The row a call's brand comes from, when it has one. */
+function brandRow(call: Call): ToolChoice | null {
+ if (call.kind === "command") return call.brand ? cliRow(call.brand) : null;
+ if (call.kind === "service" && call.brand) return traceToolIdentity(call.block).row;
return null;
}
-/** "Failed: …", "Blocked: a safety rule …" — said once, under the line. */
-function Problem({ status, reason }: { status: EntryStatus; reason: string }) {
- const t = useT();
- if (status === "done") return null;
- return <p className={cn("text-xs leading-5 [overflow-wrap:anywhere]", status === "failed" || status === "blocked" ? "text-destructive" : "text-muted-foreground")}>
- {tr(t, `status.${status}`)}{reason ? `: ${reason}` : ""}
- </p>;
+function CallMark({ call }: { call: Call }) {
+ const row = brandRow(call);
+ if (row) return <BrandMark row={row} />;
+ if (call.kind in GLYPHS) {
+ const Glyph = GLYPHS[call.kind as keyof typeof GLYPHS];
+ return <Glyph aria-hidden className={glyph} strokeWidth={1.75} />;
+ }
+ // Jarvis's own families wear the composer's mark for them; a tool nobody
+ // described gets a plain wrench, never a plug that suggests an integration.
+ if (call.kind === "family") {
+ const Glyph = traceToolIdentity(call.block).identity.Glyph;
+ return <Glyph aria-hidden className={glyph} strokeWidth={1.75} />;
+ }
+ return <Wrench aria-hidden className={glyph} strokeWidth={1.75} />;
+}
+
+/** A stretch's mark: up to three brand logos it touched, else its first call's glyph. */
+function StretchMark({ calls }: { calls: Call[] }) {
+ const rows: ToolChoice[] = [];
+ const seen = new Set<string>();
+ for (const call of calls) {
+ const row = brandRow(call);
+ // One mark per brand, however many tools of it the stretch used.
+ const key = row ? toolIdentity(row).logo ?? row.id : "";
+ if (!row || seen.has(key)) continue;
+ seen.add(key);
+ rows.push(row);
+ if (rows.length === 3) break;
+ }
+ // No brand: the stretch's most telling call speaks for it.
+ if (!rows.length) return <CallMark call={calls.find((call) => call.kind !== "tool") ?? calls[0]} />;
+ return <span aria-hidden className="flex shrink-0 items-center">
+ {rows.map((row, i) => <span key={row.id} className={cn("inline-flex rounded-full bg-background ring-2 ring-background", i > 0 && "-ml-1")}><BrandMark row={row} /></span>)}
+ </span>;
}
-function duration(ms: number | null | undefined): string | undefined {
- return ms !== null && ms !== undefined && ms > 0 ? traceDuration(ms) : undefined;
+// ── Prose ────────────────────────────────────────────────────────────────
+
+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>;
+ return <Reasoning text={entry.text} />;
}
-function ThoughtView({ entry }: { entry: ThoughtEntry }) {
+/** Reasoning text reads quieter than narration and folds when long. */
+function Reasoning({ text }: { text: string }) {
const t = useT();
const ref = useRef<HTMLDivElement>(null);
const [open, setOpen] = useState(false);
@@ -119,92 +132,106 @@ function ThoughtView({ entry }: { entry: ThoughtEntry }) {
useLayoutEffect(() => {
const el = ref.current;
if (el && !open) setOverflows(el.scrollHeight > el.clientHeight + 1);
- }, [entry.text, open]);
- return <div className="flex min-w-0 gap-3 py-1" data-trace-entry="thought">
- <span aria-hidden className="trace-node"><span className="trace-dot" /></span>
- <div className="min-w-0 flex-1">
- <div ref={ref} className={cn(
- "prose prose-sm max-w-none text-sm leading-6 text-foreground-secondary dark:prose-invert [overflow-wrap:anywhere]",
- "prose-p:my-1 prose-p:text-foreground-secondary prose-li:text-foreground-secondary prose-strong:text-foreground prose-pre:overflow-auto",
- "[&>:first-child]:mt-0 [&>:last-child]:mb-0",
- !open && "max-h-36 overflow-hidden",
- !open && overflows && "trace-thought-fade",
- )}>
- <ReactMarkdown remarkPlugins={[remarkGfm]}>{entry.text}</ReactMarkdown>
- </div>
- {overflows || open ? <button type="button" onClick={() => setOpen(!open)}
- className="mt-0.5 rounded-sm text-xs text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
- {t(open ? "trace_report.show_less" : "trace_report.show_more")}
- </button> : null}
+ }, [text, open]);
+ return <div className="min-w-0 py-1.5" 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-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",
+ !open && overflows && "trace-thought-fade",
+ )}>
+ <ReactMarkdown remarkPlugins={[remarkGfm]}>{text}</ReactMarkdown>
</div>
+ {overflows || open ? <button type="button" onClick={() => setOpen(!open)}
+ className="mt-0.5 rounded-sm text-xs text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
+ {t(open ? "trace_report.show_less" : "trace_report.show_more")}
+ </button> : null}
</div>;
}
-function ExploreView({ entry, renderDetails }: { entry: ExploreEntry; renderDetails: (block: ToolBlock) => ReactNode }) {
- const t = useT();
- return <Line testId="explore" icon={<FolderSearch className={glyph} />}
- label={<Words verb={tr(t, "entry.explored")} />}
- trailing={duration(entry.durationMs)}
- below={<ul className="space-y-0.5 text-xs leading-5">
- {entry.lines.map((line, i) => <li key={i} className="flex min-w-0 gap-2">
- <span className="shrink-0 text-muted-foreground">{tr(t, `entry.${line.verb}`)}</span>
- <span className="min-w-0 truncate font-mono text-foreground-secondary" title={line.targets.join(", ")}>{line.targets.join(", ")}</span>
- </li>)}
- </ul>}
- details={<div className="space-y-3">{entry.blocks.map((block) => <div key={block.callId}>{renderDetails(block)}</div>)}</div>} />;
+// ── 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";
+
+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")} />;
}
-function CommandView({ entry, renderDetails }: { entry: CommandEntry; renderDetails: (block: ToolBlock) => ReactNode }) {
+function ActivityView({ entry, renderers }: { entry: ActivityEntry; renderers: TimelineRenderers }) {
const t = useT();
- const problem = entry.status === "failed" || entry.status === "blocked";
- return <Line testId="command" problem={problem}
- icon={problemGlyph(entry.status) ?? <Terminal className={glyph} />}
- label={<Words verb={tr(t, "entry.ran")} object={entry.command} problem={problem} />}
- trailing={duration(entry.block.durationMs)}
- below={entry.output || entry.status !== "done" ? <>
- {entry.output ? <div data-trace-output className="min-w-0 font-mono text-xs leading-5 text-muted-foreground">
- {entry.output.lines.map((line, i) => <div key={i} className="truncate whitespace-pre" title={line}>{line}</div>)}
- {entry.output.more ? <div className="text-muted-foreground/70">{tr(t, `entry.more_${plural("en", entry.output.more)}`, { count: entry.output.more })}</div> : null}
- </div> : null}
- <Problem status={entry.status} reason={entry.reason} />
- </> : undefined}
- details={renderDetails(entry.block)} />;
+ const [open, setOpen] = useState(false);
+ const 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">
+ {settled.map((call) => <CallLine key={call.id} call={call} renderers={renderers} />)}
+ </div> : null}
+ {running.map((call) => <CallLine key={call.id} call={call} renderers={renderers} />)}
+ </div>;
}
-function EditView({ entry, renderDetails }: { entry: EditEntry; renderDetails: (block: ToolBlock) => ReactNode }) {
+function CallLine({ call, renderers }: { call: Call; renderers: TimelineRenderers }) {
const t = useT();
- const problem = entry.status === "failed" || entry.status === "blocked";
- return <Line testId="edit" problem={problem}
- icon={problemGlyph(entry.status) ?? (entry.verb === "write" ? <FilePlus2 className={glyph} /> : <FilePenLine className={glyph} />)}
- label={<>
- <Words verb={tr(t, entry.verb === "edit" ? "entry.edited" : "entry.created")} object={entry.path} problem={problem} />
- {entry.added || entry.removed ? <span className="shrink-0 font-mono text-xs tabular-nums">
- <span className="diff-count-add">+{entry.added}</span>{" "}<span className="diff-count-del">−{entry.removed}</span>
+ const [open, setOpen] = useState(false);
+ const running = call.status === "running";
+ const problem = call.status === "failed" || call.status === "blocked";
+ const quiet = call.status === "declined" || call.status === "interrupted";
+ return <div className="min-w-0" data-trace-entry="call" data-kind={call.kind} data-status={call.status}>
+ <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}
+ {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}
- </>}
- trailing={duration(entry.block.durationMs)}
- below={entry.status !== "done" ? <Problem status={entry.status} reason={entry.reason} /> : undefined}
- details={renderDetails(entry.block)} />;
+ {problem || quiet ? <span className={cn("shrink-0", problem ? "text-destructive" : "text-muted-foreground")}>{tr(t, `state.${call.status}`)}</span> : null}
+ {!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}
+ {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>;
}
-function ToolView({ entry, renderDetails }: { entry: ToolEntry; renderDetails: (block: ToolBlock) => ReactNode }) {
- const view = traceToolIdentity(entry.block);
- const problem = entry.status === "failed" || entry.status === "blocked";
- const Glyph = view.identity.Glyph;
- const icon = problemGlyph(entry.status) ?? (view.identity.logo
- ? <span className="tool-identity inline-flex" style={toolIdentityStyle(view.row)} data-trace-brand={view.identity.key}><ToolChoiceIcon row={view.row} size={14} /></span>
- : <Glyph className={glyph} />);
- return <Line testId="tool" problem={problem} icon={icon}
- label={<Words verb={entry.label} object={entry.detail} problem={problem} />}
- trailing={duration(entry.block.durationMs)}
- below={entry.result || entry.status !== "done" ? <>
- {entry.result ? <p data-trace-result className="truncate text-xs leading-5 text-muted-foreground" title={entry.result}>{entry.result}</p> : null}
- <Problem status={entry.status} reason={entry.reason} />
- </> : undefined}
- details={renderDetails(entry.block)} />;
+/** What a call ran and what came back. */
+function CallDetails({ call, renderers }: { call: Call; renderers: TimelineRenderers }) {
+ const t = useT();
+ // The measured time lives here, not on the line: the line stays clean.
+ const took = call.block.durationMs ? <p className="text-xs leading-5 tabular-nums text-muted-foreground">{tr(t, "took", { duration: traceDuration(call.block.durationMs) })}</p> : null;
+ const why = call.reason ? <p className={cn("text-xs leading-5 [overflow-wrap:anywhere]", call.status === "failed" || call.status === "blocked" ? "text-destructive" : "text-muted-foreground")}>
+ {tr(t, `state.${call.status}`)}: {call.reason}
+ </p> : null;
+ if (call.kind === "command") {
+ const input = call.block.input && typeof call.block.input === "object" ? call.block.input as Record<string, unknown> : {};
+ const full = typeof input.command === "string" ? input.command : typeof input.cmd === "string" ? input.cmd : call.text;
+ const output = readableOutput(call.block);
+ return <div className="space-y-1.5">
+ <pre tabIndex={0} data-trace-output className="max-h-72 overflow-auto whitespace-pre-wrap rounded-md bg-muted/60 px-3 py-2 font-mono text-xs leading-5 text-foreground-secondary [overflow-wrap:anywhere] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring">
+ <span className="text-muted-foreground">$ </span>{full}{output ? `\n\n${output}` : ""}
+ </pre>
+ {why}
+ {took}
+ </div>;
+ }
+ return <div className="space-y-1.5">
+ {call.result ? <p className="text-xs leading-5 text-muted-foreground [overflow-wrap:anywhere]">{call.result}</p> : null}
+ {why}
+ {renderers.renderDetails(call.block)}
+ {took}
+ </div>;
}
-/** "Copy" — the timeline as Markdown on the clipboard. */
+/** "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");
@@ -215,7 +242,8 @@ export function CopyTimeline({ text }: { text: () => string }) {
};
const Icon = state === "copied" ? Check : Copy;
return <button type="button" onClick={() => void copy()}
- className="ml-7 mt-1 inline-flex items-center gap-1.5 rounded-md px-1.5 py-0.5 text-xs text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
+ 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.css
index 9f18477fc9..574617968e 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.css
+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.css
@@ -31,8 +31,11 @@
position: relative;
min-width: 0;
}
+/* Since 2026-10-02 the rail draws no thread: traces read like the Codex app,
+ prose and quiet lines with nothing joining them. */
.trace-rail > .trace-step::before,
.trace-rail > .trace-step::after {
+ display: none;
content: "";
position: absolute;
left: 7.5px;
@@ -158,3 +161,11 @@
-webkit-mask-image: linear-gradient(to bottom, black calc(100% - 2.5rem), transparent 100%);
mask-image: linear-gradient(to bottom, black calc(100% - 2.5rem), transparent 100%);
}
+/* Media the model put in its narration stays small inside a trace. */
+.trace-narration img,
+.trace-narration video {
+ max-height: 10rem;
+ width: auto;
+ max-width: 100%;
+ border-radius: 0.5rem;
+}
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx
index 918f7a774c..2ba949c748 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.test.tsx
@@ -103,6 +103,9 @@ describe("work trace", () => {
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 err\.ts.*Failed/ }));
expect(screen.getByText("Failed: Permission denied")).toBeTruthy();
expect(screen.getByRole("button", { name: "Approve" })).toBeTruthy();
});
@@ -123,7 +126,7 @@ describe("work trace", () => {
it("shows a denied action without a running indicator", () => {
const {container} = render(<WorkTrace {...props} status="running" blocks={[tool("a",{output:null,approval:{approvalId:"ap",summary:"Delete?",decision:"deny"}})]} />);
- expect(screen.getByText("You declined it")).toBeTruthy();
+ expect(screen.getByRole("button", { name: /^Read a\.ts.*Declined/ })).toBeTruthy();
expect(container.querySelector('[data-trace-tool][data-state="running"]')).toBeNull();
expect(screen.queryByRole("button", {name:"Approve"})).toBeNull();
});
@@ -145,7 +148,7 @@ describe("work trace", () => {
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.getByText("Stopped before it finished")).toBeTruthy();
+ expect(screen.getByRole("button", { name: /^Read a\.ts.*Stopped/ })).toBeTruthy();
});
it("updates the live clock and releases timers at completion", () => {
@@ -162,10 +165,9 @@ describe("work trace", () => {
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();
- expect(container.querySelector("[data-trace-output]")?.textContent).toBe("<img src=x onerror=alert(1)>");
- fireEvent.click(screen.getByRole("button", { name: /^Ran <b>echo<\/b>/ }));
- expect(container.querySelector('img')).toBeNull();
- expect(screen.getAllByText('<img src=x onerror=alert(1)>').length).toBeGreaterThan(0);
+ fireEvent.click(screen.getByRole("button", { name: /^<b>echo<\/b>/ }));
+ expect(container.querySelector('img, b')).toBeNull();
+ expect(container.querySelector("[data-trace-output]")?.textContent).toContain("<img src=x onerror=alert(1)>");
});
it("formats durations without a 60-second remainder", () => {
@@ -183,7 +185,9 @@ describe("work trace", () => {
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/ }));
- expect(screen.getByRole("button", { name: /^Ran read skill instructions 49ms/ })).toBeTruthy();
+ // 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();
});
it("keeps the last reply visible and treats earlier text as foldable work", () => {
@@ -206,28 +210,28 @@ describe("work trace", () => {
});
describe("rail look", () => {
- it("threads thoughts, tools and the state line on one rail by default", () => {
- const { container } = render(<WorkTrace {...props} status="running" blocks={[thought, tool("a", { name: "exec_command" })]} />);
+ it("reads like the Codex app: prose, quiet lines, no thread, no bullets", () => {
+ const { container } = render(<WorkTrace {...props} status="running" blocks={[thought, tool("a", { name: "exec_command", input: { command: "npm test" } })]} />);
expect(screen.getByTestId("work-trace").getAttribute("data-look")).toBe("rail");
- const rails = container.querySelectorAll(".trace-rail");
- expect(rails).toHaveLength(1);
- const steps = rails[0].querySelectorAll(":scope > .trace-step");
- expect(steps).toHaveLength(3);
- expect(steps[2].querySelector("[role='status']")?.textContent).toContain("Working");
+ expect(container.querySelector(".trace-dot, .trace-node-live")).toBeNull();
+ const call = container.querySelector("[data-trace-entry='call']")!;
+ expect(call.textContent).toContain("npm test");
+ expect(call.querySelector("svg")).toBeTruthy();
+ expect(screen.getByRole("status").textContent).toContain("Working");
});
- it("breaks the rail around a reply so narration stands on its own", () => {
+ it("keeps a live reply between the stretches it separates", () => {
const { container } = render(<WorkTrace {...props} status="running" blocks={[tool("a", { name: "exec_command" }), reply("mid", "Halfway there."), tool("b", { name: "exec_command", output: null })]} />);
- const rails = container.querySelectorAll(".trace-rail");
- expect(rails).toHaveLength(2);
- expect(rails[0].textContent).not.toContain("Halfway there.");
+ const text = screen.getByTestId("work-trace").textContent!;
+ const calls = container.querySelectorAll("[data-trace-entry='call']");
+ expect(calls).toHaveLength(2);
+ expect(text.indexOf("Halfway there.")).toBeGreaterThan(text.indexOf(calls[0].textContent!));
});
- it("marks the working step and the live state line with the shimmer", () => {
- const { container } = render(<WorkTrace {...props} status="running" durationMs={null} blocks={[tool("a", { name: "exec_command", output: null })]} />);
- const running = container.querySelector('[data-state="running"]')!;
- expect(running.querySelector(".trace-shimmer")?.textContent).toBe("Run command");
- expect(running.querySelector(".trace-node-live")).toBeTruthy();
+ it("shimmers the call that is running and the live state line", () => {
+ const { container } = render(<WorkTrace {...props} status="running" durationMs={null} blocks={[tool("a", { name: "exec_command", input: { command: "npm test" }, output: null })]} />);
+ const running = container.querySelector('[data-trace-entry="call"][data-status="running"]')!;
+ expect(running.querySelector(".trace-shimmer")?.textContent).toBe("npm test");
expect(screen.getByRole("status").querySelector(".trace-shimmer")?.textContent).toBe("Working");
});
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx
index 67c5cea727..62834d6683 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx
@@ -223,7 +223,7 @@ const FoldExpandContext = createContext(0);
function Disclosure({ label, children, forced = false, initiallyOpen = false, icon, trailing, tone, summary, resetKey = "", live = false }: {
label: ReactNode; children?: ReactNode; forced?: boolean; initiallyOpen?: boolean;
- icon: ReactNode; trailing?: ReactNode; tone?: string; summary?: ReactNode; resetKey?: string;
+ icon?: ReactNode; trailing?: ReactNode; tone?: string; summary?: ReactNode; resetKey?: string;
/** Rail look only: the node glows while this step is the one working. */
live?: boolean;
}) {
@@ -239,13 +239,13 @@ function Disclosure({ label, children, forced = false, initiallyOpen = false, ic
<button type="button" className={railRowButton} aria-expanded={children ? open : undefined}
aria-controls={children ? id : undefined} disabled={!children || forced}
onClick={() => setChoice({ phase, open: !open })}>
- <Node live={live}>{icon}</Node>
+ {icon ? <Node live={live}>{icon}</Node> : null}
<span className="min-w-0 flex-1 [overflow-wrap:anywhere]">{label}</span>
{trailing ? <span className="shrink-0 text-xs leading-6 tabular-nums text-muted-foreground">{trailing}</span> : null}
{children && !forced ? <ChevronRight aria-hidden className={cn("mt-[5px] h-3.5 w-3.5 shrink-0 opacity-40 transition group-hover/trace:opacity-90", open && "rotate-90")} /> : null}
</button>
{summary}
- {children && open ? <div id={id} className="min-w-0 pb-1.5 pl-7">{children}</div> : null}
+ {children && open ? <div id={id} className={cn("min-w-0 pb-1.5", icon ? "pl-7" : "pl-0")}>{children}</div> : null}
</div>
);
return (
@@ -300,10 +300,10 @@ export function ReasoningTrace({ block, turnLive, compact = false }: { block: Re
: t(live ? "work_trace.thinking_for" : "work_trace.thought_for").replace("{duration}", traceDuration(duration));
const gist = text.replace(/```[\s\S]*?```/g, " ").replace(/[`*_#>~]/g, "").replace(/\s+/g, " ").trim();
const showGist = !compact && !turnLive && gist;
- if (rail) return <Disclosure label={<Live on={live}>{label}</Live>} icon={<span className="trace-dot" />}
+ if (rail) return <Disclosure label={<Live on={live}>{label}</Live>}
live={live} forced={live} initiallyOpen={compact ? live : turnLive}
resetKey={compact ? String(turnLive) : ""}
- summary={showGist ? <p className="mb-1.5 pl-7 line-clamp-2 text-sm leading-6 text-foreground-secondary">{gist.slice(0, 280)}</p> : undefined}>
+ summary={showGist ? <p className="mb-1.5 line-clamp-2 text-sm leading-6 text-muted-foreground">{gist.slice(0, 280)}</p> : undefined}>
{text ? <ReasoningBody text={text} live={live} /> : undefined}
</Disclosure>;
return <Disclosure label={label} icon={<Brain aria-hidden className={cn(iconClass, live && "motion-safe:animate-pulse")} />}
@@ -510,7 +510,7 @@ function traceLogos(blocks: TurnBlock[]): ToolChoice[] {
for (const block of blocks) {
if (block.kind !== "tool") continue;
const view = traceToolIdentity(block);
- const key = view.identity.key || view.service || block.name;
+ 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);
@@ -545,24 +545,23 @@ function ConversationWorkFold({ durationMs, attention, blocks, children, timelin
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 mb-0.5 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">
+ 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 text-foreground-secondary group-hover/fold:text-foreground">{label}</span>
- {timeline?.summary ? <span className="min-w-0 truncate"><span aria-hidden className="mr-2 text-muted-foreground/50">·</span>{timeline.summary}</span> : null}
+ <span className="shrink-0">{label}</span>
{timeline && timeline.problemCount > 0 ? <span className="shrink-0 text-destructive">
- <span aria-hidden className="mr-2 text-muted-foreground/50">·</span>
- {t("trace_report.failed_count").replace("{count}", String(timeline.problemCount))}
+ <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-60 transition-transform group-hover/fold:opacity-100", open && "rotate-90")} />
+ <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}
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 ? "trace-fold-open pb-1" : undefined}><FoldExpandContext.Provider value={seq}>{children}</FoldExpandContext.Provider></div> : attention}
+ {open ? <div id={id} className={rail ? "group/fold-body pb-1 pt-0.5" : undefined}><FoldExpandContext.Provider value={seq}>{children}</FoldExpandContext.Provider></div> : attention}
</div>
);
}
@@ -711,7 +710,7 @@ function WorkTraceBody({ blocks: rawBlocks, status, startedMs, durationMs, error
statusOnRail ? "py-1" : "pb-2 pt-1", status === "error" && "text-destructive", pending && "text-foreground")}>
{petState
? <span aria-hidden className="trace-node trace-node-pet" data-trace-pet={petState}><PetMark size={32} state={petState} /></span>
- : <Node live={working}><Icon className={cn(nodeIcon, working && "motion-safe:animate-spin")} /></Node>}
+ : null}
<span className="inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2">
<span><Live on={working}>{outcomeLabel}</Live></span>
{(live || durationMs !== null) ? <span aria-live="off" className="tabular-nums">{traceDuration(live ? elapsed : durationMs ?? 0)}</span> : null}
@@ -727,6 +726,8 @@ function WorkTraceBody({ blocks: rawBlocks, status, startedMs, durationMs, error
: block.kind === "reasoning" ? <ReasoningTrace block={block} turnLive={live} compact={conversation} />
: replyNode(block, conversation, renderText),
liveOnRail: (block) => block.kind === "reasoning" || (block.kind === "tool" && !block.question),
+ renderNarration: (text, id) => renderText ? renderText(text, id)
+ : <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);
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/traceActivity.ts b/jarvis/ui/web/frontend/src/components/agentchat/traceActivity.ts
index deed22c486..64b682b55e 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/traceActivity.ts
+++ b/jarvis/ui/web/frontend/src/components/agentchat/traceActivity.ts
@@ -8,6 +8,9 @@ import { toolIdentity } from "./toolIdentity";
export function traceToolName(name: string): string {
return name.replace(/^(?:functions\.|tools\.)/, "")
.replace(/^mcp__codex_apps__/, "")
+ // Claude's hosted connectors ("mcp__claude_ai_Gmail__…") are named after
+ // the service, not the road to it.
+ .replace(/^mcp__claude_ai_/, "mcp__")
.replace(/^mcp__([^_]+)__/, "$1/")
.replace(/^mcp__/, "").replace(/__/g, "/");
}
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.test.ts b/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.test.ts
index 1c886c2d25..da8ecfce6f 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.test.ts
@@ -4,7 +4,10 @@ import de from "@/i18n/locales/de.json";
import es from "@/i18n/locales/es.json";
import { reduceThinkingSteps, type ThinkingStep } from "@/lib/thinkingSteps";
import type { ToolBlock, TurnBlock } from "./reduce";
-import { buildTimeline, headerLabel, previewOutput, shortPath, timelineMarkdown, traceDuration, type TimelineOptions } from "./traceEntries";
+import {
+ buildTimeline, commandBinary, headerLabel, shortPath, timelineMarkdown, traceDuration, withoutCd,
+ type ActivityEntry, type Call, type TimelineOptions,
+} from "./traceEntries";
import { stepsToBlocks } from "./VoiceWorkTrace";
type Dict = Record<string, unknown>;
@@ -25,6 +28,13 @@ const tool = (id: string, over: Partial<ToolBlock> = {}): ToolBlock => ({
const text = (id: string, body: string): TurnBlock => ({ kind: "text", id, text: body });
const thinking = (id: string, body: string, durationMs = 1000): TurnBlock => ({ kind: "reasoning", id, text: body, durationMs, live: false, startedMs: 0 });
+const activity = (blocks: TurnBlock[], over: Partial<TimelineOptions> = {}): ActivityEntry => {
+ const entry = buildTimeline(blocks, opts(over)).entries.find((e) => e.kind === "activity");
+ if (!entry || entry.kind !== "activity") throw new Error("no activity");
+ return entry;
+};
+const only = (block: ToolBlock, over: Partial<TimelineOptions> = {}): Call => activity([block], over).calls[0];
+
function replay(events: Array<[string, Record<string, unknown>]>): ThinkingStep[] {
let steps: ThinkingStep[] = [];
events.forEach(([name, payload], i) => {
@@ -33,101 +43,98 @@ function replay(events: Array<[string, Record<string, unknown>]>): ThinkingStep[
return steps.map((s) => (s.status === "active" ? { ...s, status: "done" } : s));
}
-describe("trace timeline", () => {
- it("merges reads, listings and searches into one Codex-style Explored entry", () => {
+describe("trace timeline (Codex-style)", () => {
+ it("alternates the model's words with one line per stretch of calls", () => {
const line = buildTimeline([
- tool("r1", { name: "Read", input: { file_path: "C:/repo/src/app/main.ts" }, output: "1→a" }),
- tool("r2", { name: "Read", input: { file_path: "README.md" }, output: "x" }),
- tool("l", { name: "LS", input: { path: "src" }, output: "a\nb" }),
- tool("g", { name: "Grep", input: { pattern: "TODO", path: "src/lib" }, output: "src/lib/a.ts:3" }),
- tool("r3", { name: "Read", input: { file_path: "package.json" }, output: "{}" }),
+ text("n1", "I'll look at the blog first."),
+ tool("c1"),
+ tool("w1", { name: "search_web", input: { query: "openai docs" }, output: '{"results": [1,2,3]}' }),
+ text("n2", "The blog lives in its own repo."),
+ tool("e1", { name: "Edit", input: { file_path: "post.md", old_string: "a", new_string: "b" }, output: "ok" }),
+ tool("c2", { input: { command: "npm run build" }, output: "built" }),
], opts());
- expect(line.entries).toHaveLength(1);
- const explore = line.entries[0];
- expect(explore.kind).toBe("explore");
- if (explore.kind !== "explore") return;
- expect(explore.lines).toEqual([
- { verb: "read", targets: ["…/src/app/main.ts", "README.md"] },
- { verb: "list", targets: ["src"] },
- { verb: "search", targets: ["TODO in src/lib"] },
- { verb: "read", targets: ["package.json"] },
- ]);
- expect(explore.durationMs).toBe(1500);
- expect(line.summary).toBe("Read 3 files, listed a folder, and ran a search");
+ expect(line.entries.map((e) => e.kind)).toEqual(["prose", "activity", "prose", "activity"]);
+ const [, first, , second] = line.entries as [unknown, ActivityEntry, unknown, ActivityEntry];
+ expect(first.summary).toBe("Ran a command, searched the web");
+ expect(second.summary).toBe("Edited a file, ran a command");
+ expect(line.callCount).toBe(4);
});
- it("shows a command with the first lines it printed", () => {
- const line = buildTimeline([
- tool("c", { input: { command: "npm test\n--watch=false" }, output: "PASS a\nPASS b\n\nPASS c\nPASS d\nPASS e" }),
- ], opts());
- expect(line.entries[0]).toMatchObject({
- kind: "command", command: "npm test", status: "done",
- output: { lines: ["PASS a", "PASS b", "PASS c"], more: 2 },
- });
- expect(previewOutput("")).toBeNull();
+ 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("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" });
+ expect(only(tool("e", { name: "Edit", input: { file_path: "app.ts", old_string: "a\nb", new_string: "c" }, output: "ok" }))).toMatchObject({ text: "Edited app.ts", added: 1, removed: 2 });
});
- it("tells a wrapped command by what it printed", () => {
- const line = buildTimeline([
- tool("j", { name: "mcp__jarvis__cli_jarvisctl", input: { command: "jarvisctl outputs list" },
- output: JSON.stringify({ exit_code: 0, stdout: "a.md\nb.md\n", stderr: "", duration_ms: 12 }) }),
- ], opts());
- expect(line.entries[0]).toMatchObject({ kind: "tool", result: "a.md" });
+ it("shows what a command ran, not where, and wears the CLI vendor's logo", () => {
+ const call = only(tool("c", { input: { command: 'cd "C:/Users/me/repo" && gh api repos/x --jq .stars' }, output: "85" }));
+ expect(call).toMatchObject({ kind: "command", text: "gh api repos/x --jq .stars", brand: "gh" });
+ expect(only(tool("p", { input: { command: "npm test" }, output: "" })).brand).toBeNull();
+ expect(withoutCd("Set-Location C:\\x; git status")).toBe("git status");
+ expect(commandBinary("FOO=1 npx vercel deploy")).toBe("vercel");
});
- it("sizes an edit and names a created file", () => {
- const line = buildTimeline([
- tool("e", { name: "Edit", input: { file_path: "src/app.ts", old_string: "a\nb", new_string: "c" }, output: "ok" }),
- tool("w", { name: "Write", input: { file_path: "src/new.ts", content: "x\ny" }, output: "ok" }),
- ], opts());
- expect(line.entries[0]).toMatchObject({ kind: "edit", verb: "edit", path: "src/app.ts", added: 1, removed: 2 });
- expect(line.entries[1]).toMatchObject({ kind: "edit", verb: "write", path: "src/new.ts" });
- expect(line.summary).toBe("Edited a file and created a file");
+ it("tells a plugin by its brand, however the call reached it", () => {
+ const viaJarvis = only(tool("g", { name: "mcp__jarvis__gmail", input: { query: "is:unread" }, output: "[]" }));
+ expect(viaJarvis).toMatchObject({ kind: "service", text: "Gmail" });
+ expect(viaJarvis.brand).toBeTruthy();
+ const viaClaude = only(tool("h", { name: "mcp__claude_ai_Gmail__search_threads", input: { query: "newer_than:2d" }, output: "[]" }));
+ expect(viaClaude.kind).toBe("service");
+ expect(viaClaude.text).not.toMatch(/claude/i);
+ const own = only(tool("r", { name: "mcp__jarvis__society_routines", input: {}, output: "{}" }));
+ expect(own).toMatchObject({ kind: "tool", text: "Society routines" });
+ const cli = only(tool("j", { name: "mcp__jarvis__cli_jarvisctl", input: { command: "jarvisctl outputs list" }, output: "" }));
+ expect(cli).toMatchObject({ kind: "command", text: "jarvisctl outputs list" });
+ });
+
+ it("keeps Jarvis's own tools in their words and a terse result", () => {
+ const call = only(tool("a", { name: "mcp__jarvis__create_artifact", input: { title: "GitHub Stars" }, output: "The artifact is being built." }));
+ expect(call).toMatchObject({ kind: "family", text: "Created an artifact", detail: "GitHub Stars", result: "The artifact is being built." });
+ const web = only(tool("w", { name: "search_web", input: { query: "x" }, output: '{"results": [1,2]}' }));
+ expect(web).toMatchObject({ kind: "web", result: "2 results" });
});
- it("keeps the model's words as prose and drops wordless thinking and plumbing", () => {
+ it("drops wordless thinking and plumbing; keeps reasoning text as quiet prose", () => {
const line = buildTimeline([
thinking("r1", "", 820),
- text("n", "The repo has 85 stars. I'll fetch the timestamps."),
tool("s", { name: "ToolSearch", input: { query: "select:mcp__jarvis__create_artifact" }, output: "[]" }),
- tool("a", { name: "mcp__jarvis__create_artifact", input: { title: "GitHub Stars" }, output: "The artifact is being built." }),
thinking("r2", "**Checking** the result."),
], opts());
- expect(line.entries.map((e) => e.kind)).toEqual(["thought", "tool", "thought"]);
- expect(line.entries[1]).toMatchObject({ label: "Created an artifact", detail: "GitHub Stars", result: "The artifact is being built." });
- expect(line.thinkingMs).toBe(820);
- expect(line.actionCount).toBe(1);
+ expect(line.entries).toEqual([expect.objectContaining({ kind: "prose", tone: "reasoning", text: "**Checking** the result." })]);
+ expect(line.callCount).toBe(0);
});
- it("names refusals, declines, failures and interruptions in plain words", () => {
- const line = buildTimeline([
+ it("names refusals, declines, failures and cut-offs in plain words", () => {
+ const calls = activity([
tool("b", { output: "blacklist: <tool-declared-block>", isError: true }),
tool("d", { output: null, approval: { approvalId: "x", summary: "", decision: "deny" } }),
tool("f", { output: "Error: 2 tests failed\n at run", isError: true }),
tool("i", { output: null }),
- ], opts({ status: "cancelled" }));
- expect(line.entries.map((e) => e.kind === "command" ? [e.status, e.reason] : null)).toEqual([
+ ], { status: "cancelled" }).calls;
+ expect(calls.map((c) => [c.status, c.reason])).toEqual([
["blocked", "a safety rule blocks this action"],
["declined", ""],
["failed", "Error: 2 tests failed"],
["interrupted", ""],
]);
- expect(line.problemCount).toBe(4);
});
- it("leaves running calls, approvals and replies to the live rows while a turn runs", () => {
- const blocks: TurnBlock[] = [
+ it("keeps a running call in its stretch and hands approvals, questions and replies to the live rows", () => {
+ const line = buildTimeline([
tool("done"),
tool("running", { output: null }),
tool("approve", { output: null, approval: { approvalId: "a", summary: "Delete?", decision: null } }),
text("reply", "Halfway there."),
{ kind: "reasoning", id: "live", text: "thinking…", durationMs: null, live: true, startedMs: 0 },
- ];
- const line = buildTimeline(blocks, opts({ status: "running", live: true }));
- expect(line.entries.map((e) => e.kind)).toEqual(["command", "live", "live", "live", "live"]);
+ ], opts({ status: "running", live: true }));
+ expect(line.entries.map((e) => e.kind)).toEqual(["activity", "live", "live", "live"]);
+ expect((line.entries[0] as ActivityEntry).calls.map((c) => c.status)).toEqual(["done", "running"]);
});
- it("tells a stored Jarvis voice turn with registry names, a cut result and a refusal", () => {
+ it("tells a stored Jarvis voice turn: registry names, a preamble, a refusal", () => {
const steps = replay([
["ActionProposed", { tool_name: "find-app-action", args: { query: "computers" } }],
["ActionExecuted", { tool_name: "find-app-action", success: true, duration_ms: 4, output_preview: '{"actions": [{"action_id": "add_computer"' }],
@@ -137,10 +144,10 @@ describe("trace timeline", () => {
["BrainTurnCompleted", { provider: "grok", model: "grok-4.3" }],
]);
const line = buildTimeline(stepsToBlocks(steps, false, t), opts());
- expect(line.entries.map((e) => e.kind)).toEqual(["tool", "thought", "tool"]);
- expect(line.entries[0]).toMatchObject({ label: "Find App Action", detail: "computers" });
- expect(line.entries[1]).toMatchObject({ text: "I'll check the computers you set up." });
- expect(line.entries[2]).toMatchObject({ label: "Run App Action", status: "blocked", reason: "a safety rule blocks this action" });
+ expect(line.entries.map((e) => e.kind)).toEqual(["activity", "prose", "activity"]);
+ 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");
});
@@ -153,31 +160,22 @@ describe("trace timeline", () => {
it("copies as Markdown in the timeline's own order", () => {
const line = buildTimeline([
text("n", "First the port."),
- tool("c", { durationMs: 1200, output: "8080" }),
- tool("r", { name: "Read", input: { file_path: "a.ts" }, output: "x" }),
+ 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** — Read a file, ran a command, and edited a file",
+ "**Worked for 4.2s**",
"",
"First the port.",
"",
- "- Ran `ls` (1.2s)",
- " ```",
- " 8080",
- " ```",
- "",
- "- Explored",
- " - Read a.ts",
- "",
- "- Edited `b.ts` (+1 −1) (0.3s)",
- " Failed: boom",
+ "*Ran a command, edited a file*",
+ "- `ls`",
+ "- Edited b.ts (+1 −1) — Failed: boom",
].join("\n"));
});
- it("formats durations and paths the way a trace line shows them", () => {
+ it("formats durations and paths the way a line shows them", () => {
expect(traceDuration(49)).toBe("49ms");
- expect(traceDuration(4200)).toBe("4.2s");
expect(traceDuration(125_000)).toBe("2m 05s");
expect(shortPath("C:\\Users\\me\\repo\\src\\a.ts")).toBe("…/repo/src/a.ts");
});
@@ -189,9 +187,10 @@ describe("trace timeline", () => {
tool("a", { name: "search_web", input: { query: "Wetter" }, output: '{"results": []}' }),
tool("b", { isError: true, output: "boom" }),
tool("c", { name: "Grep", input: { pattern: "x", path: "src" }, output: "y" }),
- tool("d", { output: "1\n2\n3\n4\n5" }),
+ 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 = [line.summary, headerLabel(line, 9000, tl), timelineMarkdown(line, headerLabel(line, 9000, tl), tl)].join("\n");
+ const all = timelineMarkdown(line, headerLabel(line, 9000, tl), tl);
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.ts
index f7b03eb84c..f8230929f1 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.ts
+++ b/jarvis/ui/web/frontend/src/components/agentchat/traceEntries.ts
@@ -1,26 +1,29 @@
/**
- * A turn's work as a timeline, in the shape Claude and Codex draw it.
+ * A turn's work in the shape the Codex app draws it.
*
- * Both tools read the same way: the model's own words carry the story (its
- * narration between calls, its reasoning summaries) as plain prose, and the
- * calls between them are terse single lines — "Explored" with the files it
- * read and the patterns it searched, "Ran `npm test`" with the first lines
- * the command printed, "Edited src/app.ts +3 −1". A finished turn folds to
- * one line, "Worked for 4m 07s", and opens to exactly that timeline.
+ * Codex reads like a conversation, not a log: what the model says between
+ * its calls is ordinary prose at full contrast, and each stretch of calls in
+ * between collapses to ONE quiet line that says what was done — "Ran
+ * commands, searched the web" — with the stretch's real mark in front (the
+ * plugin's logo, the CLI vendor's logo, else a plain terminal or pencil).
+ * The line opens to the single calls; a call opens to its raw input and
+ * output. A finished turn folds to "Worked for 4m 07s".
*
- * This module is the pure model behind it: blocks → entries, the header's
- * one-line summary, and the same timeline as Markdown for copying. The
- * renderer is TraceTimeline.tsx.
+ * This module is the pure model behind that: blocks → prose and activity
+ * stretches, the wording of every line, the fold's label, and the same
+ * timeline as Markdown for copying. The renderer is TraceTimeline.tsx.
*
- * What it never does: invent a reason the model did not give, draw a row for
- * wordless (redacted) thinking — its time goes to the header — or draw
- * plumbing (loading a tool's schema, polling a question card).
+ * It never invents a reason the model did not give, never draws wordless
+ * (redacted) thinking, and never draws plumbing (loading a tool's schema,
+ * polling a question card).
*
* Placeholders never use `{name}`: the i18n layer fills that token with the
* assistant's name before any string reaches this module.
*/
import { fill } from "@/i18n";
+import { cliVendor } from "@/lib/cliVendors";
+import { resolveToolBrand } from "@/lib/toolBrand";
import { describeToolStep } from "@/lib/toolStepLabel";
import { isQuestionTool, type ReasoningBlock, type TextBlock, type ToolBlock, type TurnBlock, type TurnStatus } from "./reduce";
import { toolDiff } from "./toolDiff";
@@ -28,58 +31,61 @@ import { traceToolIdentity, traceToolName } from "./traceActivity";
export type Translate = (key: string) => string;
-/** How a finished call ended. */
-export type EntryStatus = "done" | "failed" | "blocked" | "declined" | "interrupted";
+/** How a call stands. */
+export type CallStatus = "running" | "done" | "failed" | "blocked" | "declined" | "interrupted";
+
+/** What a call is, for its icon and its words. */
+export type CallKind = "command" | "read" | "list" | "search" | "edit" | "write" | "image" | "web" | "family" | "service" | "tool";
-/** What the model said: its reasoning text, or narration between calls. */
-export interface ThoughtEntry { kind: "thought"; id: string; text: string; block: ReasoningBlock | TextBlock }
-/** Live work the classic row draws (running call, approval, question card, streaming thought, reply). */
-export interface LiveEntry { kind: "live"; id: string; block: TurnBlock }
-/** Consecutive reads, listings and searches, merged Codex-style. */
-export interface ExploreEntry { kind: "explore"; id: string; lines: ExploreLine[]; blocks: ToolBlock[]; durationMs: number }
-export interface ExploreLine { verb: "read" | "list" | "search"; targets: string[] }
-export interface CommandEntry {
- kind: "command"; id: string; block: ToolBlock; command: string; status: EntryStatus;
- /** The first lines it printed (or the error), and how many more there were. */
- output: OutputPreview | null; reason: string;
-}
-export interface EditEntry {
- kind: "edit"; id: string; block: ToolBlock; verb: "edit" | "write"; path: string;
- added: number; removed: number; status: EntryStatus; reason: string;
-}
-export interface ToolEntry {
- kind: "tool"; id: string; block: ToolBlock; label: string; detail: string;
- /** A terse result ("3 results", the first line it said); "" when none. */
- result: string; status: EntryStatus; reason: string;
- /** A failed read, listing or search: counted as that, not as a tool used. */
- explore?: "read" | "list" | "search";
- /** How the header's "used …" names it: "the wiki", "GitHub · Create Issue". */
- subject: string;
-}
export interface OutputPreview { lines: string[]; more: number }
-export type TimelineEntry = ThoughtEntry | LiveEntry | ExploreEntry | CommandEntry | EditEntry | ToolEntry;
+export interface Call {
+ id: string;
+ block: ToolBlock;
+ kind: CallKind;
+ /** The line's words: the command itself, "Read src/app.ts", "Searched the wiki". */
+ text: string;
+ /** A quieter tail: a query, a title, an operation's argument. */
+ detail: string;
+ status: CallStatus;
+ /** Why it did not succeed, in plain words; "" otherwise. */
+ reason: string;
+ /** Edit size, when it is an edit. */
+ added: number;
+ removed: number;
+ /** A terse result for tools that are not commands ("3 results", a message). */
+ result: string;
+ /** The stretch summary's bucket ("command", "family:wiki", "used:Linear"). */
+ bucket: string;
+ /** A brand to draw instead of a plain glyph: a plugin, an MCP server, a CLI vendor. */
+ brand: string | null;
+}
+
+/** What the model said — narration between calls, or its reasoning text. */
+export interface ProseEntry { kind: "prose"; id: string; text: string; tone: "narration" | "reasoning"; block: TextBlock | ReasoningBlock }
+/** A stretch of calls between two pieces of prose. */
+export interface ActivityEntry { kind: "activity"; id: string; calls: Call[]; summary: string }
+/** Work the caller draws itself: approvals, question cards, a streaming thought, a live reply. */
+export interface LiveEntry { kind: "live"; id: string; block: TurnBlock }
+
+export type TimelineEntry = ProseEntry | ActivityEntry | LiveEntry;
export interface Timeline {
entries: TimelineEntry[];
/** Calls told (live ones included). */
- actionCount: number;
+ callCount: number;
/** Calls that failed, were blocked, declined or cut off. */
problemCount: number;
- /** Wordless thinking, summed. */
- thinkingMs: number;
- /** "Explored 3 files, ran 2 commands" — the folded header's tail. */
- summary: string;
}
export interface TimelineOptions {
t: Translate;
- /** UI language tag, for plurals and lists. */
+ /** UI language tag, for plurals. */
lang: string;
status: TurnStatus;
/**
- * Live turns keep their replies and streaming pieces as live entries;
- * a finished turn's fold tells narration as thoughts.
+ * Live turns keep replies and streaming thoughts for the caller; a folded
+ * finished turn tells its narration as prose.
*/
live: boolean;
}
@@ -87,7 +93,7 @@ export interface TimelineOptions {
const KEY = "trace_report";
export const tr = (t: Translate, key: string, vars: Record<string, string | number> = {}) => fill(t(`${KEY}.${key}`), vars);
-/** "49ms", "0.4s", "12s", "4m 07s" — the duration on a trace line. */
+/** "49ms", "0.4s", "12s", "4m 07s". */
export function traceDuration(ms: number): string {
// Keep short, measured calls visible instead of rounding 49 ms to "0.0s".
if (ms > 0 && ms < 100) return `${Math.ceil(ms)}ms`;
@@ -105,13 +111,13 @@ export function plural(lang: string, count: number): "one" | "other" {
}
}
-export function joinList(lang: string, items: string[]): string {
- if (items.length <= 1) return items[0] ?? "";
- try {
- return new Intl.ListFormat(lang, { style: "long", type: "conjunction" }).format(items);
- } catch {
- return items.join(", ");
- }
+export function capitalize(text: string): string {
+ return text ? text.charAt(0).toUpperCase() + text.slice(1) : text;
+}
+
+/** A registry name as words, sentence case: "society_routines" → "Society routines". */
+function humanize(name: string): string {
+ return capitalize(name.split(/[-_\s.]+/).filter(Boolean).join(" ").toLowerCase());
}
function oneLine(text: string, max: number): string {
@@ -132,7 +138,7 @@ function firstString(record: Record<string, unknown>, keys: string[]): string {
return "";
}
-/** The last two or three segments of a path — what a person recognises. */
+/** The last three segments of a path — what a person recognises. */
export function shortPath(path: string): string {
const parts = path.replace(/\\/g, "/").split("/").filter(Boolean);
return parts.length > 3 ? `…/${parts.slice(-3).join("/")}` : path;
@@ -147,14 +153,11 @@ function isPlumbing(block: ToolBlock): boolean {
return false;
}
-/** Still asks for something or still running: the live row draws it. */
-function isLiveBlock(block: ToolBlock, status: TurnStatus): boolean {
- if (block.question) return true;
- if (block.approval && block.approval.decision === null) return true;
- return block.output === null && status === "running" && block.approval?.decision !== "deny";
+/** Asks the person for something: drawn by the caller as its card. */
+function needsPerson(block: ToolBlock): boolean {
+ return Boolean(block.question) || Boolean(block.approval && block.approval.decision === null);
}
-/** Drop the "… (+N more chars)" cap marker the backend appends. */
function stripCapMarker(text: string): string {
return text.replace(/…\s*\(\+\d+ more chars\)\s*$/, "").trimEnd();
}
@@ -171,10 +174,14 @@ function printedOutput(output: string): string | null {
}
}
-const PREVIEW_LINES = 3;
+/** The output a person reads: unwrapped, cap marker gone. */
+export function readableOutput(block: ToolBlock): string {
+ const raw = stripCapMarker(block.output ?? "");
+ return printedOutput(raw) ?? raw;
+}
-/** The first lines of an output, the way Codex and Claude Code show them. */
-export function previewOutput(output: string, max = PREVIEW_LINES): OutputPreview | null {
+/** The first lines of an output and how many more there were. */
+export function previewOutput(output: string, max = 3): OutputPreview | null {
const lines = output.split(/\r?\n/).map((line) => line.replace(/\s+$/, "")).filter((line) => line.trim());
if (!lines.length) return null;
return { lines: lines.slice(0, max).map((line) => (line.length > 160 ? `${line.slice(0, 159)}…` : line)), more: Math.max(0, lines.length - max) };
@@ -191,24 +198,21 @@ function refusalReason(reason: string, t: Translate): string | null {
return null;
}
-/** How a finished call ended, and why when it did not succeed. */
-function outcome(block: ToolBlock, t: Translate): { status: EntryStatus; reason: string } {
+function statusOf(block: ToolBlock, turn: TurnStatus, t: Translate): { status: CallStatus; reason: string } {
if (block.approval?.decision === "deny") {
const rule = refusalReason(block.approval.summary || block.output || "", t);
return rule ? { status: "blocked", reason: rule } : { status: "declined", reason: "" };
}
- if (block.output === null) return { status: "interrupted", reason: "" };
+ if (block.output === null) return turn === "running" ? { status: "running", reason: "" } : { status: "interrupted", reason: "" };
if (block.isError) {
const raw = stripCapMarker(block.output);
const rule = refusalReason(raw, t);
if (rule) return { status: "blocked", reason: rule };
- const first = raw.split(/\r?\n/).find((line) => line.trim()) ?? "";
- return { status: "failed", reason: oneLine(first, 200) };
+ return { status: "failed", reason: oneLine(raw.split(/\r?\n/).find((line) => line.trim()) ?? "", 200) };
}
return { status: "done", reason: "" };
}
-/** Argument keys that name what a coding action touched. */
const ACTION_KEYS: Record<string, string[]> = {
command: ["command", "cmd", "CommandLine", "commandLine", "script"],
read: ["file_path", "path", "notebook_path", "filename"],
@@ -218,22 +222,21 @@ const ACTION_KEYS: Record<string, string[]> = {
search: ["pattern", "query", "regex", "q"],
};
-/** Families of Jarvis's own tools that have a past-tense label. */
-const FAMILY_LABELS = new Set([
+/** Families of Jarvis's own tools that have their own words. */
+const FAMILIES = new Set([
"wiki", "wiki_write", "artifact", "skill", "skill_create", "web", "screen", "screen_recall",
"control", "navigate", "app", "memory", "memory_update", "profile", "contact", "call",
"worker", "model", "mcp_admin", "settings", "verify",
]);
+const IMAGE_FILE = /\.(png|jpe?g|gif|webp|bmp|svg|heic|avif)$/i;
+
/** Keys whose string value says what a structured result was about. */
const GIST_KEYS = ["summary", "message", "result", "status", "title", "answer", "text", "detail", "description"];
-/** A terse result for a generic tool: a count, its message, or its first line. */
+/** A terse result: a count, the tool's own message, or its first line. */
function terseResult(block: ToolBlock, t: Translate, lang: string): string {
- let output = stripCapMarker(block.output ?? "");
- const printed = printedOutput(output);
- if (printed !== null) output = printed;
- const text = output.trim();
+ const text = readableOutput(block).trim();
if (!text) return "";
if (text.startsWith("{") || text.startsWith("[")) {
let parsed: unknown;
@@ -245,7 +248,7 @@ function terseResult(block: ToolBlock, t: Translate, lang: string): string {
const record = parsed as Record<string, unknown>;
for (const key of GIST_KEYS) {
const value = record[key];
- if (typeof value === "string" && value.trim()) return oneLine(value, 140);
+ if (typeof value === "string" && value.trim()) return oneLine(value, 120);
}
for (const value of Object.values(record)) {
if (Array.isArray(value)) {
@@ -254,14 +257,13 @@ function terseResult(block: ToolBlock, t: Translate, lang: string): string {
}
return "";
}
- // Cut by the preview cap: the top level still says a little.
if (/^\{\s*["'][\w-]+["']\s*:\s*\[\s*\]/.test(text)) return tr(t, "result.none");
const nested = text.slice(1).search(/[[{]/);
const top = nested < 0 ? text : text.slice(0, nested + 1);
const gist = new RegExp(`["'](?:${GIST_KEYS.join("|")})["']\\s*:\\s*["']([^"']{2,})["']`).exec(top);
- return gist ? oneLine(gist[1], 140) : "";
+ return gist ? oneLine(gist[1], 120) : "";
}
- return oneLine(text.split(/\r?\n/).find((line) => line.trim()) ?? "", 140);
+ return oneLine(text.split(/\r?\n/).find((line) => line.trim()) ?? "", 120);
}
function diffSize(block: ToolBlock): { added: number; removed: number } {
@@ -276,146 +278,168 @@ function diffSize(block: ToolBlock): { added: number; removed: number } {
return { added, removed };
}
-/** One finished call as its entry (explore calls come back as a line to merge). */
-function entryOf(block: ToolBlock, t: Translate, lang: string): ExploreLine | CommandEntry | EditEntry | ToolEntry {
+/**
+ * A command line without the directory change in front of it: agents start
+ * most commands with `cd "C:/long/path" && …`, and the line should show what
+ * ran, not where. The full command stays in the call's details.
+ */
+export function withoutCd(command: string): string {
+ let text = command.trim();
+ for (let i = 0; i < 3; i++) {
+ const next = text.replace(/^(?:cd|Set-Location|pushd)\s+(?:"[^"]*"|'[^']*'|\S+)\s*(?:&&|;|\|\|)\s*/i, "");
+ if (next === text) break;
+ text = next;
+ }
+ return text || command.trim();
+}
+
+/** The program a command runs, past env assignments and wrappers ("gh" in "FOO=1 npx gh …"). */
+export function commandBinary(command: string): string {
+ const words = command.trim().split(/\s+/);
+ for (const word of words) {
+ if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(word)) continue;
+ if (/^(sudo|npx|pnpm|bunx|uvx|time|env|&|cmd|\/c|powershell|pwsh|-Command|-NoProfile)$/i.test(word)) continue;
+ return word.replace(/^["'&]+|["']+$/g, "").split(/[\\/]/).pop()?.replace(/\.(exe|cmd|bat)$/i, "") ?? "";
+ }
+ return "";
+}
+
+/** One finished or running call as its line. */
+function callOf(block: ToolBlock, turn: TurnStatus, t: Translate, lang: string): Call {
const view = traceToolIdentity(block);
const record = inputRecord(block);
- const { status, reason } = outcome(block, t);
- const action = view.action === "memory" ? null : view.action;
+ const { status, reason } = statusOf(block, turn, t);
const name = traceToolName(block.name);
const own = /^jarvis\//i.test(name) ? describeToolStep(name.slice("jarvis/".length), block.input) : null;
- const description = own && (FAMILY_LABELS.has(own.family) || own.family === "shell") ? own : view.description;
-
- if (action === "read" || action === "list" || action === "search") {
- if (status === "done") {
- const target = firstString(record, ACTION_KEYS[action]) || description.detail;
- const where = action === "search" ? firstString(record, ["path", "glob", "include"]) : "";
- const text = action === "search" && where
- ? tr(t, "entry.search_in", { pattern: oneLine(target, 60), path: shortPath(where) })
- : oneLine(action === "search" ? target : shortPath(target), 80);
- return { verb: action, targets: text ? [text] : [] };
- }
+ const description = own && (FAMILIES.has(own.family) || own.family === "shell") ? own : view.description;
+ const action = view.action === "memory" ? null : view.action;
+ const base = { id: block.callId, block, status, reason, added: 0, removed: 0, result: "", detail: "", brand: null as string | null };
+
+ // Jarvis's CLI wrappers ("mcp__jarvis__cli_jarvisctl") run a command line.
+ const wrapper = /^jarvis\/cli_/i.test(name) && firstString(record, ACTION_KEYS.command);
+ if (action === "command" || description.family === "shell" || wrapper) {
+ const raw = firstString(record, ACTION_KEYS.command) || (typeof block.input === "string" ? block.input : "") || description.detail;
+ const command = oneLine(withoutCd(raw.split(/\r?\n/).find((line) => line.trim()) ?? ""), 200);
+ // A vendor CLI ("gh", "vercel", "docker") wears its vendor's logo.
+ const binary = commandBinary(command);
+ return { ...base, kind: "command", text: command || capitalize(tr(t, "act.command_one")), bucket: "command", brand: cliVendor(binary) ? binary : null };
+ }
+ 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" };
+ return { ...base, kind: "read", text: tr(t, "call.read", { target: shortPath(path) }), bucket: "read" };
}
- if (action === "command" || description.family === "shell") {
- let command = firstString(record, ACTION_KEYS.command) || (typeof block.input === "string" ? block.input : "") || description.detail;
- command = (command.split(/\r?\n/).find((line) => line.trim()) ?? "").trim();
- const raw = stripCapMarker(block.output ?? "");
- const printed = printedOutput(raw);
- return {
- kind: "command", id: block.callId, block, command: oneLine(command, 160), status, reason,
- output: status === "done" ? previewOutput(printed ?? raw) : null,
- };
+ if (action === "list") {
+ const path = firstString(record, ACTION_KEYS.list) || description.detail || ".";
+ return { ...base, kind: "list", text: tr(t, "call.list", { target: shortPath(path) }), bucket: "list" };
+ }
+ if (action === "search") {
+ const pattern = oneLine(firstString(record, ACTION_KEYS.search) || description.detail, 60);
+ const where = firstString(record, ["path", "glob", "include"]);
+ const text = where ? tr(t, "call.search_in", { pattern, path: shortPath(where) }) : tr(t, "call.search", { pattern });
+ return { ...base, kind: "search", text, bucket: "search" };
}
if (action === "edit" || action === "write") {
const path = shortPath(firstString(record, ACTION_KEYS[action]) || description.detail);
- return { kind: "edit", id: block.callId, block, verb: action, path, ...diffSize(block), status, reason };
+ return { ...base, ...diffSize(block), kind: action, text: tr(t, `call.${action}`, { target: path }), bucket: action };
}
const family = description.family;
- const label = FAMILY_LABELS.has(family) ? tr(t, `family.${family}`)
- : (() => {
- const raw = description.label || view.service || block.name;
- return /[A-Z]/.test(raw) ? raw : raw.split(/[-_\s.]+/).filter(Boolean).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
- })();
- if (action === "read" || action === "list" || action === "search") {
- // A failed read is told like any failed call.
- return { kind: "tool", id: block.callId, block, label: tr(t, `entry.${action}`), detail: oneLine(description.detail, 100), result: "", status, reason, explore: action, subject: "" };
+ const result = status === "done" ? terseResult(block, t, lang) : "";
+ if (FAMILIES.has(family)) {
+ const kind: CallKind = family === "web" ? "web" : "family";
+ return { ...base, kind, text: capitalize(tr(t, `family.${family}`)), detail: oneLine(description.detail, 100), result, bucket: `family:${family}` };
}
- return {
- kind: "tool", id: block.callId, block, label, detail: oneLine(description.detail, 100),
- result: status === "done" ? terseResult(block, t, lang) : "", status, reason,
- subject: FAMILY_LABELS.has(family) ? tr(t, `subject.${family}`) : label,
- };
+ if (own) {
+ // Jarvis's own server is the road, not the destination: "jarvis/gmail"
+ // is the Gmail plugin, "jarvis/society_routines" is that tool by name.
+ const rest = name.slice("jarvis/".length);
+ const brand = resolveToolBrand(rest);
+ if (brand.logoUrl) {
+ return { ...base, kind: "service", text: brand.label, detail: oneLine(own.detail, 100), result, bucket: `used:${brand.label}`, brand: brand.brandId ?? brand.label };
+ }
+ const label = humanize(rest);
+ return { ...base, kind: "tool", text: label, detail: oneLine(own.detail, 100), result, bucket: `used:${label}` };
+ }
+ const raw = description.label || view.service || block.name;
+ const label = /[A-Z]/.test(raw) ? raw : humanize(raw);
+ if (view.integration || family === "mcp" || family === "service") {
+ const service = view.service || label;
+ return { ...base, kind: "service", text: label, detail: oneLine(description.detail, 100), result, bucket: `used:${service}`, brand: view.identity.logo ? view.identity.key ?? service : null };
+ }
+ return { ...base, kind: "tool", text: label, detail: oneLine(description.detail, 100), result, bucket: `used:${label}` };
+}
+
+/** "Ran commands, searched the web, used Linear" — a stretch in one line. */
+export function summarize(calls: Call[], t: Translate, lang: string): string {
+ if (calls.length === 1) return calls[0].text;
+ const counts = new Map<string, number>();
+ for (const call of calls) counts.set(call.bucket, (counts.get(call.bucket) ?? 0) + 1);
+ const used: string[] = [];
+ const parts: string[] = [];
+ for (const [bucket, n] of counts) {
+ if (bucket.startsWith("used:")) used.push(bucket.slice(5));
+ else if (bucket.startsWith("family:")) parts.push(tr(t, `family.${bucket.slice(7)}`));
+ else parts.push(tr(t, `act.${bucket}_${plural(lang, n)}`));
+ }
+ if (used.length) parts.push(tr(t, "act.used", { what: used.slice(0, 3).join(", ") }));
+ return capitalize(parts.join(", "));
}
/** Lay out a turn's blocks as its timeline. */
export function buildTimeline(blocks: TurnBlock[], options: TimelineOptions): Timeline {
const { t, lang, status, live } = options;
const entries: TimelineEntry[] = [];
- let thinkingMs = 0;
- const tally = { read: 0, list: 0, search: 0, command: 0, edit: 0, write: 0 };
- const used: string[] = [];
- let actionCount = 0;
+ let stretch: Call[] = [];
+ let callCount = 0;
let problemCount = 0;
+ const flush = () => {
+ if (!stretch.length) return;
+ entries.push({ kind: "activity", id: `act:${stretch[0].id}`, calls: stretch, summary: summarize(stretch, t, lang) });
+ stretch = [];
+ };
for (const block of blocks) {
if (block.kind === "reasoning") {
if (live && status === "running" && block.live) {
+ flush();
entries.push({ kind: "live", id: block.id, block });
continue;
}
const text = block.text.trim();
- if (text) entries.push({ kind: "thought", id: block.id, text, block });
- else thinkingMs += block.durationMs ?? 0;
+ if (!text) continue;
+ flush();
+ entries.push({ kind: "prose", id: block.id, text, tone: "reasoning", block });
continue;
}
if (block.kind === "text") {
if (!block.text.trim()) continue;
+ flush();
if (live) entries.push({ kind: "live", id: block.id, block });
- else entries.push({ kind: "thought", id: block.id, text: block.text.trim(), block });
+ else entries.push({ kind: "prose", id: block.id, text: block.text.trim(), tone: "narration", block });
continue;
}
if (isPlumbing(block)) continue;
- actionCount += 1;
- if (isLiveBlock(block, status)) {
+ callCount += 1;
+ if (needsPerson(block)) {
+ flush();
entries.push({ kind: "live", id: block.callId, block });
continue;
}
- const entry = entryOf(block, t, lang);
- if ("verb" in entry && !("kind" in entry)) {
- tally[entry.verb] += 1;
- const previous = entries[entries.length - 1];
- if (previous?.kind === "explore") {
- const last = previous.lines[previous.lines.length - 1];
- if (last && last.verb === entry.verb && entry.verb === "read") last.targets.push(...entry.targets);
- else previous.lines.push(entry);
- previous.blocks.push(block);
- previous.durationMs += block.durationMs ?? 0;
- } else {
- entries.push({ kind: "explore", id: block.callId, lines: [entry], blocks: [block], durationMs: block.durationMs ?? 0 });
- }
- continue;
- }
- const full = entry as CommandEntry | EditEntry | ToolEntry;
- if (full.status !== "done") problemCount += 1;
- if (full.kind === "command") tally.command += 1;
- else if (full.kind === "edit") tally[full.verb] += 1;
- else if (full.explore) tally[full.explore] += 1;
- else if (full.status === "done" && !used.includes(full.subject)) used.push(full.subject);
- entries.push(full);
+ const call = callOf(block, status, t, lang);
+ if (call.status !== "done" && call.status !== "running") problemCount += 1;
+ stretch.push(call);
}
-
- const parts: string[] = [];
- const count = (key: string, n: number) => { if (n) parts.push(tr(t, `sum.${key}_${plural(lang, n)}`, { count: n })); };
- count("read", tally.read);
- count("list", tally.list);
- count("search", tally.search);
- count("command", tally.command);
- count("edit", tally.edit);
- count("write", tally.write);
- if (used.length) parts.push(tr(t, "sum.used", { list: joinList(lang, used.slice(0, 3)) }));
- const joined = joinList(lang, parts);
- return {
- entries,
- actionCount,
- problemCount,
- thinkingMs,
- summary: joined ? joined.charAt(0).toUpperCase() + joined.slice(1) : "",
- };
+ flush();
+ return { entries, callCount, problemCount };
}
-/** The folded header: "Worked for 4m 07s" when calls ran, "Thought for 3.0s" otherwise. */
+/** 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.actionCount > 0;
+ 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 statusLine(entry: CommandEntry | EditEntry | ToolEntry, t: Translate): string {
- if (entry.status === "done") return "";
- const label = tr(t, `status.${entry.status}`);
- return entry.reason ? `${label}: ${entry.reason}` : label;
-}
-
function codeSpan(text: string): string {
const fence = text.includes("`") ? "``" : "`";
const pad = fence === "``" ? " " : "";
@@ -424,35 +448,24 @@ function codeSpan(text: string): string {
/** The timeline as Markdown — what "Copy" puts on the clipboard. */
export function timelineMarkdown(timeline: Timeline, header: string, t: Translate): string {
- const out: string[] = [`**${header}**${timeline.summary ? ` — ${timeline.summary}` : ""}`];
+ const out: string[] = [`**${header}**`];
for (const entry of timeline.entries) {
+ if (entry.kind === "live") continue;
out.push("");
- if (entry.kind === "thought") {
+ if (entry.kind === "prose") {
out.push(entry.text);
continue;
}
- if (entry.kind === "live") continue;
- if (entry.kind === "explore") {
- out.push(`- ${tr(t, "entry.explored")}`);
- for (const line of entry.lines) out.push(` - ${tr(t, `entry.${line.verb}`)} ${line.targets.join(", ")}`);
- continue;
- }
- const time = entry.block.durationMs ? ` (${traceDuration(entry.block.durationMs)})` : "";
- const problem = statusLine(entry, t);
- if (entry.kind === "command") {
- out.push(`- ${tr(t, "entry.ran")} ${codeSpan(entry.command)}${time}`);
- if (entry.output) {
- out.push(" ```", ...entry.output.lines.map((line) => ` ${line}`));
- if (entry.output.more) out.push(` ${tr(t, `entry.more_${plural("en", entry.output.more)}`, { count: entry.output.more })}`);
- out.push(" ```");
- }
- } else if (entry.kind === "edit") {
- const size = entry.added || entry.removed ? ` (+${entry.added} −${entry.removed})` : "";
- out.push(`- ${tr(t, entry.verb === "edit" ? "entry.edited" : "entry.created")} ${codeSpan(entry.path)}${size}${time}`);
- } else {
- out.push(`- ${entry.label}${entry.detail ? ` — ${entry.detail}` : ""}${time}${entry.result ? `: ${entry.result}` : ""}`);
+ 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}`);
}
- if (problem) out.push(` ${problem}`);
}
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.tsx
index 9ebfc68628..112e300f18 100644
--- a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
@@ -792,7 +792,8 @@ describe("ChatStage (agent chat)", () => {
expect(outcome.textContent).not.toContain("35.4k");
// With no answer the report IS the outcome: it stands open and the
// failure reads without opening anything.
- expect(screen.getByText(/permission check failed for command/).textContent).toContain("Failed");
+ expect(screen.getByText(/permission check failed for command/)).toBeTruthy();
+ expect(document.querySelector("[data-trace-entry='call']")?.textContent).toContain("Failed");
// Nothing claims to still be working.
expect(screen.queryByTestId("agent-turn-live")).toBeNull();
});
@@ -808,19 +809,18 @@ describe("ChatStage (agent chat)", () => {
]);
useAgentChatStore.setState({ activeSessionId: "s5", timeline });
render(<ChatStage />);
- // With no answer the timeline stands open: the command with what it
- // printed, the search folded into an "Explored" line.
- const shell = document.querySelector<HTMLElement>("[data-trace-entry='command']")!;
- const explore = document.querySelector<HTMLElement>("[data-trace-entry='explore']")!;
- expect(shell.textContent).toContain("Ranls -la");
- expect(shell.textContent).toContain("a.py");
- expect(explore.textContent).toContain("SearchTODO in src");
- // The full receipt is available on demand.
- fireEvent.click(within(shell).getByRole("button", { name: /^Ran ls -la/ }));
- expect(within(shell).getByText("Input")).toBeTruthy();
+ // With no answer the timeline stands open: one quiet line for the stretch.
+ const stretch = screen.getByRole("button", { name: /^Ran a command, searched the files/ });
+ fireEvent.click(stretch);
+ const [shell, grep] = Array.from(document.querySelectorAll<HTMLElement>("[data-trace-entry='call']"));
+ expect(shell.textContent).toContain("ls -la");
+ expect(grep.textContent).toContain("Searched for TODO in src");
+ // The full receipt is available on demand: what ran, and what it printed.
+ fireEvent.click(within(shell).getByRole("button", { name: /^ls -la/ }));
+ expect(shell.querySelector("[data-trace-output]")?.textContent).toContain("a.py");
// More than the line could say, so the whole input is worth printing.
- fireEvent.click(within(explore).getByRole("button", { name: /^Explored/ }));
- expect(within(explore).getByText("Input")).toBeTruthy();
+ fireEvent.click(within(grep).getByRole("button", { name: /^Searched for TODO/ }));
+ expect(within(grep).getByText("Input")).toBeTruthy();
});
it("uses readable tool names, preserves canonical detail, and closes with usage", () => {
@@ -838,20 +838,20 @@ describe("ChatStage (agent chat)", () => {
useAgentChatStore.setState({ activeSessionId: "s9", timeline });
render(<ChatStage />);
const toggle = screen.getByRole("button", { name: /^Worked for 12s/ });
- // The folded line says what the turn did.
- expect(toggle.textContent).toContain("Ran a command and used GitHub · Create Issue");
+ // The plugin the turn used shows on the folded line by its own logo.
+ expect(toggle.querySelector("img, [data-logo]")).toBeTruthy();
fireEvent.click(toggle);
- const shell = document.querySelector<HTMLElement>("[data-trace-entry='command']")!;
+ 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'");
- fireEvent.click(within(shell).getByRole("button", { name: /^Ran/ }));
- expect(shell.textContent).toContain("PowerShell");
- // An MCP call is named after its server, and wears its mark.
- const github = document.querySelector<HTMLElement>("[data-trace-entry='tool']")!;
+ fireEvent.click(within(shell).getByRole("button"));
+ expect(shell.querySelector("[data-trace-output]")?.textContent).toContain("ok");
+ // An MCP call is named after its service, and wears its mark.
expect(github.textContent).toContain("GitHub");
- expect(github.textContent).toContain("#12");
+ expect(github.querySelector("img, [data-logo]")).toBeTruthy();
// Thinking with no readable text draws no line of its own.
- expect(document.querySelectorAll("[data-trace-entry='thought']")).toHaveLength(0);
+ expect(document.querySelectorAll("[data-trace-entry='reasoning']")).toHaveLength(0);
const footer = within(screen.getByTestId("work-trace")).getByRole("status");
expect(footer.textContent).toContain("12s");
diff --git a/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx b/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx
index 9c5166db17..f3e9515255 100644
--- a/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/TurnSteps.test.tsx
@@ -10,7 +10,8 @@ it("keeps brief voice errors visible", () => {
// The finished trace folds into its report; the toggle says a step failed.
const toggle = screen.getByRole("button", { name: /1 failed/ });
fireEvent.click(toggle);
- expect(screen.getByText(/Connection lost/)).toBeTruthy();
+ // A failed step says why under its own line.
+ expect(screen.getByText("Connection lost")).toBeTruthy();
});
it("does not hide live work with no events", () => {
const { rerender, container } = render(<TurnSteps steps={[]} />);
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.tsx
index 0b824b917a..7661b5125e 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
@@ -55,7 +55,7 @@ it("keeps live and interrupted conversation tools in the left lane", () => {
expect(lane.className).toMatch(/max-w-\[44rem\]/);
expect(lane.className).toMatch(/self-start/);
expect(container.querySelectorAll(".mx-auto")).toHaveLength(0);
- expect(container.querySelector("[data-trace-tool]")?.closest("[data-testid='work-trace']")).toBe(lane);
+ expect(container.querySelector("[data-trace-entry='call']")?.closest("[data-testid='work-trace']")).toBe(lane);
rerender(<WorkTrace conversation status="cancelled" startedMs={0} durationMs={4100} blocks={[
thought,
{ kind: "text", id: "reply", text: "I will send the mail next." },
@@ -70,8 +70,8 @@ it("keeps live and interrupted conversation tools in the left lane", () => {
// the call, and that it never returned.
const lane2 = screen.getByTestId("work-trace").textContent!;
expect(lane2).toContain("Inspect archive.");
- expect(lane2).toContain("Searcharchive");
- expect(lane2).toContain("Stopped before it finished");
+ expect(lane2).toContain("Searched for archive");
+ expect(lane2).toContain("Stopped");
expect(container.querySelectorAll(".mx-auto")).toHaveLength(0);
expect(screen.getByTestId("work-trace").className).toMatch(/self-start/);
});
@@ -87,11 +87,13 @@ it("folds a failure with the surrounding work, keeping only the reply out", () =
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/ }));
- // The failure reads under its line with the tool's own reason.
- expect(screen.getByText("Failed: Upload failed")).toBeTruthy();
- // The raw output stays one tap further, under the line.
+ // 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/ }));
+ expect(screen.getByText("Upload failed")).toBeTruthy();
+ // The raw output stays one tap further, under the call.
expect(screen.queryByText("Report contents")).toBeNull();
- fireEvent.click(screen.getByRole("button", { name: /^Explored/ }));
+ fireEvent.click(screen.getAllByRole("button", { name: /^Read report\.csv/ })[0]);
expect(screen.getByText("Report contents")).toBeTruthy();
});
@@ -105,7 +107,7 @@ it("folds failures but keeps pending approvals visible in the conversation style
expect(screen.getByText("Send this message?")).toBeTruthy();
expect(screen.getByRole("button", { name: "Approve" })).toBeTruthy();
fireEvent.click(screen.getByRole("button", { name: /^Worked for 1\.0s/ }));
- expect(screen.getByText("Failed: Delivery failed")).toBeTruthy();
+ expect(screen.getByText("Delivery failed")).toBeTruthy();
// The approval card survives opening the fold — it still needs a tap.
expect(screen.getByRole("button", { name: "Approve" })).toBeTruthy();
});
@@ -126,29 +128,29 @@ it("folds successful work and post-reply errors behind one toggle without reorde
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 lines.
- expect(screen.getByRole("button", { name: /^Explored/ })).toBeTruthy();
- expect(screen.getByRole("button", { name: /^Created report\.csv/ })).toBeTruthy();
+ // While it runs, finished calls already read as their timeline 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: /^Explored/ })).toBeNull();
+ 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/ });
- expect(toggle.textContent).toContain("Read 2 files and created a file");
+ const toggle = screen.getByRole("button", { name: /^Worked for 1\.0s.*1 failed/ });
fireEvent.click(toggle);
- // One tap opens the whole timeline: every call in order, the post-reply
- // error included, with the reply kept where it was.
- const text = screen.getByTestId("work-trace").textContent ?? "";
- expect(text.indexOf("Readreport.csv")).toBeGreaterThanOrEqual(0);
- expect(text.indexOf("Readreport.csv")).toBeLessThan(text.indexOf("Createdreport.csv"));
- expect(text).toContain("Failed: Upload failed");
+ // 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/ });
expect(screen.getAllByText("Your report is ready.")).toHaveLength(1);
- // Each line's raw call stays tappable on its own.
- const explored = screen.getByRole("button", { name: /^Explored/ });
- fireEvent.click(explored);
+ 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(explored);
+ fireEvent.click(first);
expect(screen.queryAllByText("Report contents")).toHaveLength(0);
});
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 6a01a5620a..655f738bb9 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -5672,39 +5672,41 @@
"worked": "Gearbeitet",
"thought_for": "{duration} nachgedacht",
"thought": "Nachgedacht",
- "failed_count": "{count} fehlgeschlagen",
- "sum": {
+ "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",
"read_one": "eine Datei gelesen",
- "read_other": "{count} Dateien gelesen",
+ "read_other": "Dateien gelesen",
"list_one": "einen Ordner aufgelistet",
- "list_other": "{count} Ordner aufgelistet",
- "search_one": "eine Suche ausgeführt",
- "search_other": "{count} Suchen ausgeführt",
- "command_one": "einen Befehl ausgeführt",
- "command_other": "{count} Befehle ausgeführt",
+ "list_other": "Ordner aufgelistet",
+ "search_one": "Dateien durchsucht",
+ "search_other": "Dateien durchsucht",
"edit_one": "eine Datei bearbeitet",
- "edit_other": "{count} Änderungen gemacht",
+ "edit_other": "Dateien bearbeitet",
"write_one": "eine Datei erstellt",
- "write_other": "{count} Dateien erstellt",
- "used": "{list} verwendet"
+ "write_other": "Dateien erstellt",
+ "image_one": "ein Bild angesehen",
+ "image_other": "Bilder angesehen",
+ "used": "{what} verwendet"
+ },
+ "call": {
+ "read": "{target} gelesen",
+ "list": "{target} aufgelistet",
+ "search": "Nach {pattern} gesucht",
+ "search_in": "In {path} nach {pattern} gesucht",
+ "edit": "{target} bearbeitet",
+ "write": "{target} erstellt",
+ "image": "{target} angesehen"
},
- "entry": {
- "explored": "Erkundet",
- "read": "Gelesen",
- "list": "Aufgelistet",
- "search": "Gesucht",
- "search_in": "{pattern} in {path}",
- "ran": "Ausgeführt",
- "edited": "Bearbeitet",
- "created": "Erstellt",
- "more_one": "… +1 Zeile",
- "more_other": "… +{count} Zeilen"
- },
- "status": {
+ "state": {
+ "running": "Läuft",
"failed": "Fehlgeschlagen",
"blocked": "Blockiert",
- "declined": "Von dir abgelehnt",
- "interrupted": "Abgebrochen, bevor es fertig war"
+ "declined": "Abgelehnt",
+ "interrupted": "Abgebrochen"
},
"result": {
"items_one": "1 Ergebnis",
@@ -5718,51 +5720,28 @@
"timeout": "niemand hat es rechtzeitig freigegeben",
"no_approver": "es brauchte eine Freigabe und niemand war da, um sie zu geben"
},
- "subject": {
- "wiki": "das Wiki",
- "wiki_write": "das Wiki",
- "artifact": "Artefakte",
- "skill": "Skills",
- "skill_create": "Skills",
- "web": "die Websuche",
- "screen": "den Bildschirm",
- "screen_recall": "den Bildschirmverlauf",
- "control": "die Bildschirmsteuerung",
- "navigate": "den Browser",
- "app": "Apps",
- "memory": "das Gedächtnis",
- "memory_update": "das Gedächtnis",
- "profile": "dein Profil",
- "contact": "Kontakte",
- "call": "Anrufe",
- "worker": "einen Worker",
- "model": "die Modelleinstellungen",
- "mcp_admin": "MCP-Server",
- "settings": "die Einstellungen",
- "verify": "Prüfungen"
- },
"family": {
- "wiki": "Im Wiki gesucht",
- "wiki_write": "Ins Wiki geschrieben",
- "artifact": "Artefakt erstellt",
- "skill": "Skill ausgeführt",
- "skill_create": "Skill erstellt",
- "web": "Im Web gesucht",
- "screen": "Bildschirm angesehen",
- "screen_recall": "Bildschirmverlauf abgerufen",
- "control": "Bildschirm gesteuert",
- "navigate": "Geöffnet",
- "app": "App geöffnet",
- "memory": "Gedächtnis abgefragt",
- "memory_update": "Gedächtnis aktualisiert",
- "profile": "Profil aktualisiert",
- "contact": "Kontakt nachgeschlagen",
- "call": "Angerufen",
- "worker": "An einen Worker übergeben",
- "model": "Modell gewechselt",
- "mcp_admin": "MCP-Server verwaltet",
- "settings": "Einstellungen gelesen",
- "verify": "Geprüft"
+ "wiki": "im Wiki gesucht",
+ "wiki_write": "ins Wiki geschrieben",
+ "artifact": "ein Artefakt erstellt",
+ "skill": "einen Skill ausgeführt",
+ "skill_create": "einen Skill erstellt",
+ "web": "im Web gesucht",
+ "screen": "den Bildschirm angesehen",
+ "screen_recall": "den Bildschirmverlauf abgerufen",
+ "control": "den Bildschirm gesteuert",
+ "navigate": "eine Seite geöffnet",
+ "app": "eine App geöffnet",
+ "memory": "das Gedächtnis abgefragt",
+ "memory_update": "das Gedächtnis aktualisiert",
+ "profile": "das Profil aktualisiert",
+ "contact": "einen Kontakt nachgeschlagen",
+ "call": "einen Anruf gestartet",
+ "worker": "an einen Worker übergeben",
+ "model": "das Modell gewechselt",
+ "mcp_admin": "einen MCP-Server verwaltet",
+ "settings": "die Einstellungen gelesen",
+ "verify": "eine Prüfung ausgeführt"
}
},
"chat_media": {
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 9125056315..6c0ae2837d 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -5705,39 +5705,41 @@
"worked": "Worked",
"thought_for": "Thought for {duration}",
"thought": "Thought",
- "failed_count": "{count} failed",
- "sum": {
+ "took": "Took {duration}",
+ "failed_count_one": "{count} failed",
+ "failed_count_other": "{count} failed",
+ "act": {
+ "command_one": "ran a command",
+ "command_other": "ran commands",
"read_one": "read a file",
- "read_other": "read {count} files",
+ "read_other": "read files",
"list_one": "listed a folder",
- "list_other": "listed {count} folders",
- "search_one": "ran a search",
- "search_other": "ran {count} searches",
- "command_one": "ran a command",
- "command_other": "ran {count} commands",
+ "list_other": "listed folders",
+ "search_one": "searched the files",
+ "search_other": "searched the files",
"edit_one": "edited a file",
- "edit_other": "made {count} edits",
+ "edit_other": "edited files",
"write_one": "created a file",
- "write_other": "created {count} files",
- "used": "used {list}"
- },
- "entry": {
- "explored": "Explored",
- "read": "Read",
- "list": "List",
- "search": "Search",
- "search_in": "{pattern} in {path}",
- "ran": "Ran",
- "edited": "Edited",
- "created": "Created",
- "more_one": "… +1 line",
- "more_other": "… +{count} lines"
+ "write_other": "created files",
+ "image_one": "viewed an image",
+ "image_other": "viewed images",
+ "used": "used {what}"
+ },
+ "call": {
+ "read": "Read {target}",
+ "list": "Listed {target}",
+ "search": "Searched for {pattern}",
+ "search_in": "Searched for {pattern} in {path}",
+ "edit": "Edited {target}",
+ "write": "Created {target}",
+ "image": "Viewed {target}"
},
- "status": {
+ "state": {
+ "running": "Running",
"failed": "Failed",
"blocked": "Blocked",
- "declined": "You declined it",
- "interrupted": "Stopped before it finished"
+ "declined": "Declined",
+ "interrupted": "Stopped"
},
"result": {
"items_one": "1 result",
@@ -5751,51 +5753,28 @@
"timeout": "nobody approved it in time",
"no_approver": "it needed an approval and nobody was there to give it"
},
- "subject": {
- "wiki": "the wiki",
- "wiki_write": "the wiki",
- "artifact": "artifacts",
- "skill": "skills",
- "skill_create": "skills",
- "web": "web search",
- "screen": "the screen",
- "screen_recall": "screen history",
- "control": "screen control",
- "navigate": "the browser",
- "app": "apps",
- "memory": "memory",
- "memory_update": "memory",
- "profile": "your profile",
- "contact": "contacts",
- "call": "calls",
- "worker": "a worker",
- "model": "model settings",
- "mcp_admin": "MCP servers",
- "settings": "the settings",
- "verify": "checks"
- },
"family": {
- "wiki": "Searched the wiki",
- "wiki_write": "Wrote to the wiki",
- "artifact": "Created an artifact",
- "skill": "Ran a skill",
- "skill_create": "Created a skill",
- "web": "Searched the web",
- "screen": "Looked at the screen",
- "screen_recall": "Recalled the screen",
- "control": "Controlled the screen",
- "navigate": "Opened",
- "app": "Opened an app",
- "memory": "Checked memory",
- "memory_update": "Updated memory",
- "profile": "Updated the profile",
- "contact": "Looked up a contact",
- "call": "Called",
- "worker": "Handed off to a worker",
- "model": "Switched the model",
- "mcp_admin": "Managed an MCP server",
- "settings": "Read the settings",
- "verify": "Checked"
+ "wiki": "searched the wiki",
+ "wiki_write": "wrote to the wiki",
+ "artifact": "created an artifact",
+ "skill": "ran a skill",
+ "skill_create": "created a skill",
+ "web": "searched the web",
+ "screen": "looked at the screen",
+ "screen_recall": "recalled the screen",
+ "control": "controlled the screen",
+ "navigate": "opened a page",
+ "app": "opened an app",
+ "memory": "checked memory",
+ "memory_update": "updated memory",
+ "profile": "updated the profile",
+ "contact": "looked up a contact",
+ "call": "placed a call",
+ "worker": "handed off to a worker",
+ "model": "switched the model",
+ "mcp_admin": "managed an MCP server",
+ "settings": "read the settings",
+ "verify": "ran a check"
}
},
"chat_media": {
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 6487a764fb..63a48eb1f1 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -5672,39 +5672,41 @@
"worked": "Trabajó",
"thought_for": "Pensó durante {duration}",
"thought": "Pensó",
- "failed_count": "{count} fallaron",
- "sum": {
+ "took": "Tardó {duration}",
+ "failed_count_one": "{count} falló",
+ "failed_count_other": "{count} fallaron",
+ "act": {
+ "command_one": "ejecutó un comando",
+ "command_other": "ejecutó comandos",
"read_one": "leyó un archivo",
- "read_other": "leyó {count} archivos",
+ "read_other": "leyó archivos",
"list_one": "listó una carpeta",
- "list_other": "listó {count} carpetas",
- "search_one": "hizo una búsqueda",
- "search_other": "hizo {count} búsquedas",
- "command_one": "ejecutó un comando",
- "command_other": "ejecutó {count} comandos",
+ "list_other": "listó carpetas",
+ "search_one": "buscó en los archivos",
+ "search_other": "buscó en los archivos",
"edit_one": "editó un archivo",
- "edit_other": "hizo {count} ediciones",
+ "edit_other": "editó archivos",
"write_one": "creó un archivo",
- "write_other": "creó {count} archivos",
- "used": "usó {list}"
- },
- "entry": {
- "explored": "Exploró",
- "read": "Leyó",
- "list": "Listó",
- "search": "Buscó",
- "search_in": "{pattern} en {path}",
- "ran": "Ejecutó",
- "edited": "Editó",
- "created": "Creó",
- "more_one": "… +1 línea",
- "more_other": "… +{count} líneas"
+ "write_other": "creó archivos",
+ "image_one": "vio una imagen",
+ "image_other": "vio imágenes",
+ "used": "usó {what}"
+ },
+ "call": {
+ "read": "Leyó {target}",
+ "list": "Listó {target}",
+ "search": "Buscó {pattern}",
+ "search_in": "Buscó {pattern} en {path}",
+ "edit": "Editó {target}",
+ "write": "Creó {target}",
+ "image": "Vio {target}"
},
- "status": {
+ "state": {
+ "running": "En curso",
"failed": "Falló",
"blocked": "Bloqueado",
- "declined": "Lo rechazaste",
- "interrupted": "Se detuvo antes de terminar"
+ "declined": "Rechazado",
+ "interrupted": "Detenido"
},
"result": {
"items_one": "1 resultado",
@@ -5718,51 +5720,28 @@
"timeout": "nadie lo aprobó a tiempo",
"no_approver": "necesitaba una aprobación y no había nadie para darla"
},
- "subject": {
- "wiki": "la wiki",
- "wiki_write": "la wiki",
- "artifact": "artefactos",
- "skill": "habilidades",
- "skill_create": "habilidades",
- "web": "la búsqueda web",
- "screen": "la pantalla",
- "screen_recall": "el historial de pantalla",
- "control": "el control de pantalla",
- "navigate": "el navegador",
- "app": "apps",
- "memory": "la memoria",
- "memory_update": "la memoria",
- "profile": "tu perfil",
- "contact": "contactos",
- "call": "llamadas",
- "worker": "un worker",
- "model": "la configuración del modelo",
- "mcp_admin": "servidores MCP",
- "settings": "la configuración",
- "verify": "comprobaciones"
- },
"family": {
- "wiki": "Buscó en la wiki",
- "wiki_write": "Escribió en la wiki",
- "artifact": "Creó un artefacto",
- "skill": "Ejecutó una habilidad",
- "skill_create": "Creó una habilidad",
- "web": "Buscó en la web",
- "screen": "Miró la pantalla",
- "screen_recall": "Recordó la pantalla",
- "control": "Controló la pantalla",
- "navigate": "Abrió",
- "app": "Abrió una app",
- "memory": "Consultó la memoria",
- "memory_update": "Actualizó la memoria",
- "profile": "Actualizó el perfil",
- "contact": "Buscó un contacto",
- "call": "Llamó",
- "worker": "Lo pasó a un worker",
- "model": "Cambió el modelo",
- "mcp_admin": "Gestionó un servidor MCP",
- "settings": "Leyó la configuración",
- "verify": "Comprobó"
+ "wiki": "buscó en la wiki",
+ "wiki_write": "escribió en la wiki",
+ "artifact": "creó un artefacto",
+ "skill": "ejecutó una habilidad",
+ "skill_create": "creó una habilidad",
+ "web": "buscó en la web",
+ "screen": "miró la pantalla",
+ "screen_recall": "recordó la pantalla",
+ "control": "controló la pantalla",
+ "navigate": "abrió una página",
+ "app": "abrió una app",
+ "memory": "consultó la memoria",
+ "memory_update": "actualizó la memoria",
+ "profile": "actualizó el perfil",
+ "contact": "buscó un contacto",
+ "call": "hizo una llamada",
+ "worker": "lo pasó a un worker",
+ "model": "cambió el modelo",
+ "mcp_admin": "gestionó un servidor MCP",
+ "settings": "leyó la configuración",
+ "verify": "hizo una comprobación"
}
},
"chat_media": {