Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(agentic-ide): rebuild the thread work log as grouped steps with live shine
rubenluetke10-beepe5e42dff010f
diff --git a/NOTICE b/NOTICEindex cfb9bfae64..1f87db3a09 100644--- a/NOTICE+++ b/NOTICE@@ -11,3 +11,9 @@ License, Version 2.0.Bundled third-party components keep their own licenses and notices - seedocs/licensing.md and the license files shipped beside them, for examplejarvis/assets/vad/LICENSE for the Silero VAD model.++The Agentic IDE thread work log (jarvis/ui/web/frontend/src/components/agentic/threads/+threadWork.ts, ThreadTimeline.tsx and the live-tool-shine rule in src/index.css)+contains portions adapted from T3 Code (https://github.com/pingdotgg/t3code),+Copyright (c) 2026 T3 Tools Inc., used under the MIT License - see+third_party/t3code/LICENSE.diff --git a/docs/licensing.md b/docs/licensing.mdindex 4f8f546882..5d81382b08 100644--- a/docs/licensing.md+++ b/docs/licensing.md@@ -69,6 +69,12 @@ The bundled Silero VAD model (`jarvis/assets/vad/`) carries its own MIT licensefrom its own authors and keeps it — the switch does not touch it, and nodependency's terms change either. Nothing is relicensed by being included here.+The Agentic IDE thread work log contains portions adapted from+[T3 Code](https://github.com/pingdotgg/t3code) @ `e22c880`, MIT License,+Copyright (c) 2026 T3 Tools Inc. The full text ships in+[`third_party/t3code/LICENSE`](../third_party/t3code/LICENSE), and every adapted+file names its source in a header comment.+## Still to do at the 2.0 release- [ ] `homebrew-tap/Formula/personal-jarvis-installer.rb` anddiff --git a/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.tsx b/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.tsxindex ca55576aed..5a69e6efae 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.tsx+++ b/jarvis/ui/web/frontend/src/components/agentchat/TraceTimeline.tsx@@ -79,7 +79,7 @@ function brandRow(call: Call): ToolChoice | null {return null;}-function CallMark({ call }: { call: Call }) {+export function CallMark({ call }: { call: Call }) {const row = brandRow(call);if (row) return <BrandMark row={row} />;if (call.kind in GLYPHS) {@@ -96,7 +96,7 @@ function CallMark({ call }: { call: Call }) {}/** A stretch's mark: up to three brand logos it touched, else its first call's glyph. */-function StretchMark({ calls }: { calls: Call[] }) {+export function StretchMark({ calls }: { calls: Call[] }) {const rows: ToolChoice[] = [];const seen = new Set<string>();for (const call of calls) {diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTimeline.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTimeline.test.tsxnew file mode 100644index 0000000000..552bc339d8--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTimeline.test.tsx@@ -0,0 +1,53 @@+import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it } from "vitest";+import type { ToolBlock, TurnBlock, TurnItem, TurnStatus } from "@/components/agentchat/reduce";+import { ThreadTimeline } from "./ThreadTimeline";++const tool = (id: string, command: string, over: Partial<ToolBlock> = {}): ToolBlock => ({+ kind: "tool", callId: id, name: "Bash", input: { command }, output: "ok", isError: false,+ durationMs: 300, approval: null, startedMs: 1, ...over,+});+const thought = (id: string, text: string, live = false): TurnBlock => ({ kind: "reasoning", id, text, durationMs: live ? null : 4200, live, startedMs: 1 });++function turn(blocks: TurnBlock[], status: TurnStatus = "done"): TurnItem {+ return {+ type: "turn", id: "t1", provider: "claude-api", model: "", effort: "", runner: "", status, blocks,+ startedMs: Date.now(), durationMs: status === "running" ? null : 5000, usage: null, liveUsage: null, costUsd: null, error: null,+ };+}++const show = (item: TurnItem) => render(<ThreadTimeline items={[item]} sessionId="s1" bottomInset={0} />);++afterEach(cleanup);++describe("thread work log", () => {+ it("folds a finished stretch to one counted line that opens to its steps", () => {+ show(turn([thought("r1", "**Checking the build**"), tool("c1", "npm run build"), tool("c2", "npm test"), { kind: "text", id: "n1", text: "All green." }]));+ const header = screen.getByRole("button", { name: /Ran 2 commands/ });+ expect(screen.queryByText("npm test")).toBeNull();+ fireEvent.click(header);+ expect(screen.getByText("npm test")).toBeTruthy();+ // The thought reads as its own words, without the Markdown marks.+ expect(screen.getByText("Checking the build")).toBeTruthy();+ expect(screen.getByText("All green.")).toBeTruthy();+ });++ it("opens a thought to its full text under a timed heading", () => {+ show(turn([thought("r1", "First idea.\n\nSecond idea.")]));+ fireEvent.click(screen.getByRole("button", { name: /First idea\. Second idea\./ }));+ expect(screen.getByText("Thought for 4.2s")).toBeTruthy();+ expect(screen.getByText("Second idea.")).toBeTruthy();+ });++ it("names the newest step of the running stretch and keeps the turn clock", () => {+ show(turn([tool("c1", "npm run build"), tool("c2", "npm test", { output: null, durationMs: null })], "running"));+ expect(screen.getByText("npm test")).toBeTruthy();+ expect(screen.queryByText("npm run build")).toBeNull();+ expect(screen.getByTestId("thread-working").textContent).toMatch(/^Working for /);+ });++ it("follows a live thought by its newest paragraph", () => {+ show(turn([thought("r1", "Reading the config.\n\nNow the router.", true)], "running"));+ expect(screen.getByText("Now the router.")).toBeTruthy();+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTimeline.tsx b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTimeline.tsxindex f42ca2b31f..e8c112cef6 100644--- a/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTimeline.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/ThreadTimeline.tsx@@ -1,24 +1,29 @@-import { memo, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from "react";-import {- ArrowDown, Brain, Check, ChevronRight, Copy, Eye, FilePlus2, FileText, FolderOpen, Globe, Image as ImageIcon,- MessageCircleQuestion, Search, ShieldAlert, SquarePen, SquareTerminal, Wrench, X,-} from "lucide-react";+import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from "react";+import { ArrowDown, Brain, Check, ChevronRight, Copy, FileText, Hammer, MessageCircleQuestion, ShieldAlert, X } from "lucide-react";import { ChatMarkdown } from "@/components/agentchat/ChatMarkdown";import type { ReasoningBlock, TextBlock, TimelineItem, ToolBlock, TurnItem, UserItem } from "@/components/agentchat/reduce";import { toolDiff, type DiffFile } from "@/components/agentchat/toolDiff";-import { buildTimeline, readableOutput, traceDuration, type ActivityEntry, type Call } from "@/components/agentchat/traceEntries";+import { CallMark, StretchMark } from "@/components/agentchat/TraceTimeline";+import { readableOutput, traceDuration, type Call } from "@/components/agentchat/traceEntries";import { useT } from "@/i18n";import { robustCopy } from "@/lib/clipboard";import { cn } from "@/lib/utils";+import { buildThreadRows, isFailed, liveItem, thoughtPreview, type WorkGroup, type WorkItem } from "./threadWork";/*** A thread's conversation: the person's messages on the right, the agent's- * answer as plain reading text on the left, and the work in between as quiet- * rows — one line per stretch of tool calls ("Ran 3 commands, read 2 files")- * that opens to the single calls, and a call that opens to what it ran, the- * diff it made or what came back. A running turn always ends in a live- * "Working for 12s" line; a finished one says how long it worked and which- * files it changed.+ * answer as plain reading text on the left, and the work in between as a+ * quiet log. Each stretch of thinking and tool calls is one line — "Ran 3+ * commands and read 2 files" once it is done, the newest step with a moving+ * shine while it runs — that opens to the single steps. A thought shows as+ * one line of its own words and opens to all of them; a call opens to what+ * it ran, the diff it made or what came back. A running turn ends in+ * "Working for 12s"; a finished one says how long it worked and which files+ * it changed.+ *+ * The work-log geometry and the live shine are adapted from pingdotgg/t3code+ * @ e22c880 (apps/web/src/components/chat/WorkLog.tsx, MessagesTimeline.tsx),+ * MIT License, Copyright (c) 2026 T3 Tools Inc. — third_party/t3code/LICENSE.*/const PROSE = cn(@@ -34,51 +39,54 @@ const PROSE = cn("prose-table:my-3 prose-table:text-sm prose-th:text-foreground-strong prose-td:text-foreground",);-const KIND_ICONS: Record<Call["kind"], typeof SquareTerminal> = {- command: SquareTerminal,- read: Eye,- list: FolderOpen,- search: Search,- edit: SquarePen,- write: FilePlus2,- image: ImageIcon,- web: Globe,- family: Wrench,- service: Wrench,- tool: Wrench,-};--/** One row of the work log: a 24 px line with an icon, words and a trailing note. */+/**+ * One row of the work log: a 24 px line — a 16 px mark centred in a 24 px+ * box, the words, then a trailing note. Rows inside an opened group sit+ * tight; a row on its own gets a little air. The words of a live row carry+ * the shine; a row that opens shows its chevron.+ */function WorkRow({icon,label,+ labelTone = "muted",trailing,expanded,onToggle,+ grouped = false,live = false,- failed = false,+ stamp,+ ariaLabel,children,}: {icon: ReactNode;label: ReactNode;+ /** Thoughts read a step brighter than tool calls. */+ labelTone?: "muted" | "thought";trailing?: ReactNode;expanded?: boolean;onToggle?: () => void;+ grouped?: boolean;live?: boolean;- failed?: boolean;+ /** When the step began; shown while the row is hovered. */+ stamp?: number;+ ariaLabel?: string;children?: ReactNode;}) {- const line = <span className="flex min-h-6 min-w-0 items-center gap-2 text-sm">- <span className={cn("flex h-5 w-5 shrink-0 items-center justify-center", failed ? "text-destructive" : "text-muted-foreground")}>{icon}</span>- <span className={cn("min-w-0 flex-1 truncate", failed ? "text-destructive" : "text-muted-foreground", live && "thinking-shimmer")}>{label}</span>+ const line = <span className="flex min-h-6 min-w-0 items-center gap-1.5 text-sm leading-relaxed">+ <span aria-hidden className="flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground [&_svg]:h-4 [&_svg]:w-4">{icon}</span>+ <span className={cn("min-w-0 flex-1 truncate", labelTone === "thought" ? "text-foreground-secondary" : "text-muted-foreground", live && "live-tool-shine")}>{label}</span>{trailing}- {onToggle && <ChevronRight aria-hidden className={cn("h-3.5 w-3.5 shrink-0 text-muted-foreground opacity-0 transition group-hover/row:opacity-100", expanded && "rotate-90 opacity-100")} />}+ {stamp ? <span className="shrink-0 text-xs tabular-nums text-muted-foreground opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-visible/row:opacity-100">{clock(stamp)}</span> : null}+ {onToggle && <span aria-hidden className="flex h-4 w-4 shrink-0 items-center justify-center">+ <ChevronRight className={cn("h-3 w-3 text-muted-foreground opacity-70 transition-transform duration-200", expanded && "rotate-90")} />+ </span>}</span>;+ const row = cn("group/row relative block w-full min-w-0 rounded-md px-0.5 text-left", grouped ? "py-0" : "py-0.5");return <div className="min-w-0">{onToggle- ? <button type="button" aria-expanded={expanded} onClick={onToggle}- className="group/row w-full rounded-md px-0.5 py-px text-left hover:bg-secondary/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring">{line}</button>- : <div className="px-0.5 py-px">{line}</div>}+ ? <button type="button" aria-expanded={expanded} aria-label={ariaLabel} onClick={onToggle}+ className={cn(row, "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring")}>{line}</button>+ : <div className={row}>{line}</div>}{expanded && children}</div>;}@@ -121,9 +129,9 @@ function CallDetails({ call }: { call: Call }) {const block = call.block;const diff = useMemo(() => toolDiff(block.name, block.input, block.output), [block.name, block.input, block.output]);const output = readableOutput(block).trim();- if (diff && diff.length > 0 && !block.isError) return <div className="mb-2 ml-7 mt-1"><DiffView files={diff} /></div>;+ if (diff && diff.length > 0 && !block.isError) return <div className="mb-1.5 ml-7 mt-0.5"><DiffView files={diff} /></div>;const input = call.kind === "command" ? "" : inputText(block.input);- return <div className="mb-2 ml-7 mt-1 space-y-1.5">+ return <div className="mb-1.5 ml-7 mt-0.5 space-y-1.5 select-text">{call.kind === "command" && <pre className="m-0 overflow-x-auto rounded-lg bg-secondary px-3 py-2 font-mono text-xs leading-5 text-foreground scrollbar-jarvis">$ {inputText((block.input as Record<string, unknown> | null)?.command ?? call.text)}</pre>}{input && input !== "{}" && <pre className="m-0 max-h-48 overflow-auto rounded-lg bg-secondary px-3 py-2 font-mono text-xs leading-5 text-muted-foreground scrollbar-jarvis">{input}</pre>}{output@@ -132,77 +140,203 @@ function CallDetails({ call }: { call: Call }) {</div>;}-function CallRow({ call, nested }: { call: Call; nested: boolean }) {+/** Opening a step inside a group lifts the group's height cap. */+type OpenChange = (open: boolean) => void;++function useDisclosure(onOpenChange?: OpenChange): [boolean, () => void] {const [open, setOpen] = useState(false);- const Icon = KIND_ICONS[call.kind] ?? Wrench;- const failed = call.status === "failed" || call.status === "blocked" || call.status === "declined";+ const toggle = useCallback(() => {+ setOpen(!open);+ onOpenChange?.(!open);+ }, [open, onOpenChange]);+ return [open, toggle];+}++function CallRow({ call, stamp, grouped = false, onOpenChange }: { call: Call; stamp?: number; grouped?: boolean; onOpenChange?: OpenChange }) {+ const [open, toggle] = useDisclosure(onOpenChange);+ const failed = isFailed(call);const running = call.status === "running";const detail = call.detail || call.result;+ const tail = failed && call.reason ? call.reason : call.status === "interrupted" ? "interrupted" : "";+ // The shine paints the label's own text, so a running row is one run of words.+ const label = running+ ? [call.text, detail].filter(Boolean).join(" ")+ : <>+ <span className={cn(call.kind === "command" && "font-mono text-[0.8125rem]")}>{call.text}</span>+ {detail && <span className="ml-1.5 text-muted-foreground/70">{detail}</span>}+ {tail && <span className="ml-1.5 text-muted-foreground/70">— {tail}</span>}+ </>;return <WorkRow- icon={running ? <span className="h-1.5 w-1.5 rounded-full bg-muted-foreground animate-jarvis-pulse" /> : failed ? <X className="h-3.5 w-3.5" /> : <Icon className="h-3.5 w-3.5" />}- label={<>- <span className={cn(call.kind === "command" && "font-mono text-xs", !nested && call.kind !== "command" && "text-muted-foreground")}>{call.text}</span>- {detail && <span className="ml-2 text-faint-foreground">{detail}</span>}- {failed && call.reason && <span className="ml-2">— {call.reason}</span>}- {call.status === "interrupted" && <span className="ml-2 text-faint-foreground">interrupted</span>}+ icon={<span className={cn("flex items-center justify-center", failed && "text-destructive/70")}><CallMark call={call} /></span>}+ label={label}+ ariaLabel={failed ? `${call.text}, failed` : undefined}+ trailing={<>+ <DiffStat added={call.added} removed={call.removed} />+ {failed && <X aria-hidden className="h-3 w-3 shrink-0 text-destructive/70" />}</>}- trailing={<DiffStat added={call.added} removed={call.removed} />}+ stamp={stamp}+ grouped={grouped}live={running}- failed={failed}expanded={open}- onToggle={() => setOpen((value) => !value)}>+ onToggle={toggle}><CallDetails call={call} /></WorkRow>;}-function ActivityGroup({ entry, live }: { entry: ActivityEntry; live: boolean }) {- const [open, setOpen] = useState<boolean | null>(null);- const failed = entry.calls.some((call) => call.status === "failed" || call.status === "blocked" || call.status === "declined");- if (entry.calls.length === 1) return <CallRow call={entry.calls[0]} nested={false} />;- // A stretch the turn is still in stays open; a finished one folds to its line.- const expanded = open ?? live;- const added = entry.calls.reduce((sum, call) => sum + call.added, 0);- const removed = entry.calls.reduce((sum, call) => sum + call.removed, 0);- const running = entry.calls.some((call) => call.status === "running");+/** The newest paragraph of a thought, for a live line that follows the thinking. */+function latestThought(text: string): string {+ const paragraphs = text.split(/\n\s*\n/).map((part) => thoughtPreview(part)).filter(Boolean);+ return paragraphs[paragraphs.length - 1] ?? "";+}++const THOUGHT_PROSE = cn(PROSE, "text-sm leading-6 text-foreground-secondary prose-p:my-1.5 prose-p:text-foreground-secondary prose-li:text-foreground-secondary");++/**+ * A thought folded to one line of its own words; opened, the line names it+ * ("Thought for 4.2s") and the whole text reads below.+ */+function ThoughtRow({ block, live, stamp, grouped = false, onOpenChange }: {+ block: ReasoningBlock; live: boolean; stamp?: number; grouped?: boolean; onOpenChange?: OpenChange;+}) {+ const [open, toggle] = useDisclosure(onOpenChange);+ const text = block.text.trim();+ const heading = live ? "Thinking" : block.durationMs ? `Thought for ${traceDuration(block.durationMs)}` : "Thought";+ const preview = useMemo(() => thoughtPreview(text), [text]);return <WorkRow- icon={<Wrench className="h-3.5 w-3.5" />}- label={entry.summary}- trailing={<DiffStat added={added} removed={removed} />}- live={running}- failed={failed && !expanded}- expanded={expanded}- onToggle={() => setOpen(!expanded)}>- <div className="ml-2.5 border-l border-border pl-3">- {entry.calls.map((call) => <CallRow key={call.id} call={call} nested />)}+ icon={<Brain strokeWidth={1.75} />}+ label={open ? heading : preview || heading}+ labelTone="thought"+ stamp={stamp}+ grouped={grouped}+ live={live}+ expanded={open}+ onToggle={text ? toggle : undefined}>+ <div className="ml-7 flex max-h-96 flex-col overflow-auto px-0.5 py-1 select-text scrollbar-jarvis">+ <div className={THOUGHT_PROSE}><ChatMarkdown text={text} /></div></div></WorkRow>;}-function ThoughtRow({ block }: { block: ReasoningBlock }) {- const [open, setOpen] = useState(false);- const seconds = block.durationMs ? traceDuration(block.durationMs) : "";- return <WorkRow icon={<Brain className="h-3.5 w-3.5" />} label={seconds ? `Thought for ${seconds}` : "Thought"}- expanded={open} onToggle={() => setOpen((value) => !value)}>- <div className="mb-2 ml-7 mt-1 whitespace-pre-wrap text-sm leading-6 text-muted-foreground">{block.text}</div>- </WorkRow>;+function StepRow({ item, running, grouped, onOpenChange }: { item: WorkItem; running: boolean; grouped?: boolean; onOpenChange?: OpenChange }) {+ if (item.kind === "call") return <CallRow call={item.call} stamp={item.startedMs} grouped={grouped} onOpenChange={onOpenChange} />;+ return <ThoughtRow block={item.block} live={running && item.block.live} stamp={item.startedMs} grouped={grouped} onOpenChange={onOpenChange} />;}-function LiveThinking({ block }: { block: ReasoningBlock }) {- const tail = block.text.trim().split(/\r?\n/).filter((line) => line.trim()).slice(-3).join("\n");- return <div>- <WorkRow icon={<Brain className="h-3.5 w-3.5" />} label="Thinking" live />- {tail && <div className="ml-7 line-clamp-3 whitespace-pre-wrap text-sm leading-6 text-faint-foreground">{tail}</div>}+const FADE = "1.5rem";++/**+ * An opened group's steps: a short scrolling list that fades at an edge with+ * more behind it. A live list follows its newest step while the reader is at+ * its end; opening a step lifts the height cap so its detail reads in full.+ */+function StepList({ items, running, follow }: { items: WorkItem[]; running: boolean; follow: boolean }) {+ const box = useRef<HTMLDivElement | null>(null);+ const atEnd = useRef(true);+ const [edges, setEdges] = useState({ top: false, bottom: false });+ const [openSteps, setOpenSteps] = useState(0);+ const onOpenChange = useCallback((open: boolean) => setOpenSteps((count) => Math.max(0, count + (open ? 1 : -1))), []);++ const measure = useCallback(() => {+ const el = box.current;+ if (!el) return;+ const rest = el.scrollHeight - el.clientHeight - el.scrollTop;+ atEnd.current = rest <= 1;+ const next = { top: el.scrollTop > 1, bottom: rest > 1 };+ setEdges((prev) => prev.top === next.top && prev.bottom === next.bottom ? prev : next);+ }, []);++ useLayoutEffect(() => {+ const el = box.current;+ if (el && follow && atEnd.current) el.scrollTop = el.scrollHeight;+ measure();+ }, [items.length, follow, measure]);++ useEffect(() => {+ const el = box.current;+ if (!el || typeof ResizeObserver === "undefined") return;+ const observer = new ResizeObserver(measure);+ observer.observe(el);+ if (el.firstElementChild) observer.observe(el.firstElementChild);+ return () => observer.disconnect();+ }, [measure]);++ const mask = edges.top || edges.bottom+ ? `linear-gradient(to bottom, ${edges.top ? "transparent" : "black"} 0, black ${FADE}, black calc(100% - ${FADE}), ${edges.bottom ? "transparent" : "black"} 100%)`+ : undefined;+ return <div ref={box} role="region" aria-label="Steps" tabIndex={-1} onScroll={measure}+ className="overflow-y-auto overflow-x-hidden rounded-md scrollbar-jarvis"+ style={{ maxHeight: openSteps > 0 ? undefined : "min(18rem, 50dvh)", maskImage: mask, WebkitMaskImage: mask }}>+ <div className="flex min-w-0 flex-col">+ {items.map((item) => <StepRow key={item.id} item={item} running={running} grouped onOpenChange={onOpenChange} />)}+ </div></div>;}-/** Ticks once a second while a turn runs; the text alone changes, nothing re-lays out. */+function hasBrand(call: Call): boolean {+ return Boolean(call.brand) && (call.kind === "command" || call.kind === "service");+}++/** A group's mark: the logos it touched, else its one kind of work, else a hammer for mixed work. */+function GroupMark({ group }: { group: WorkGroup }) {+ if (group.sole === "thought") return <Brain strokeWidth={1.75} />;+ const calls = group.items.flatMap((item) => item.kind === "call" ? [item.call] : []);+ if (calls.some(hasBrand)) return <StretchMark calls={calls} />;+ if (group.sole) return <CallMark call={calls[0]} />;+ return <Hammer strokeWidth={1.75} />;+}++/**+ * The stretch the running turn is in: one line naming its newest step with+ * the shine — the command it runs, the thought it is having — that opens to+ * every step so far.+ */+function LiveGroup({ group }: { group: WorkGroup }) {+ const [open, toggle] = useDisclosure();+ const item = liveItem(group);+ const label = item.kind === "call"+ ? [item.call.text, item.call.detail].filter(Boolean).join(" ")+ : latestThought(item.block.text) || "Thinking";+ return <WorkRow+ icon={item.kind === "call" ? <CallMark call={item.call} /> : <Brain strokeWidth={1.75} />}+ label={label}+ labelTone={item.kind === "thought" ? "thought" : "muted"}+ ariaLabel={group.items.length > 1 ? `${label}, ${group.items.length} steps so far` : undefined}+ live+ expanded={open}+ onToggle={toggle}>+ <StepList items={group.items} running follow />+ </WorkRow>;+}++/** A finished stretch: its one step on its own, or one counted line that opens to them. */+function WorkGroupView({ group, running }: { group: WorkGroup; running: boolean }) {+ const [open, toggle] = useDisclosure();+ if (group.live) return <LiveGroup group={group} />;+ if (group.items.length === 1) return <StepRow item={group.items[0]} running={running} />;+ return <WorkRow+ icon={<GroupMark group={group} />}+ label={group.summary}+ trailing={<DiffStat added={group.added} removed={group.removed} />}+ stamp={group.startedMs}+ expanded={open}+ onToggle={toggle}>+ <StepList items={group.items} running={running} follow={false} />+ </WorkRow>;+}++/**+ * The running turn's clock. It writes its own text once a second, so the+ * timeline never re-renders to tick.+ */function Elapsed({ since }: { since: number }) {- const [now, setNow] = useState(() => Date.now());+ const ref = useRef<HTMLSpanElement | null>(null);useEffect(() => {- const timer = window.setInterval(() => setNow(Date.now()), 1000);+ const tick = () => { if (ref.current) ref.current.textContent = traceDuration(Math.max(0, Date.now() - since)); };+ tick();+ const timer = window.setInterval(tick, 1000);return () => window.clearInterval(timer);- }, []);- return <span className="tabular-nums">{traceDuration(Math.max(0, now - since))}</span>;+ }, [since]);+ return <span ref={ref} className="tabular-nums">{traceDuration(Math.max(0, Date.now() - since))}</span>;}function CopyButton({ text, label }: { text: string; label: string }) {@@ -300,26 +434,19 @@ const TurnView = memo(function TurnView({ turn }: { turn: TurnItem }) {const t = useT();const lang = t("trace_report.locale");const running = turn.status === "running";- const timeline = useMemo(() => buildTimeline(turn.blocks, { t, lang, status: turn.status, live: true }), [turn.blocks, t, lang, turn.status]);- const lastActivity = [...timeline.entries].reverse().find((entry) => entry.kind === "activity")?.id;+ const rows = useMemo(() => buildThreadRows(turn.blocks, { t, lang, status: turn.status }), [turn.blocks, t, lang, turn.status]);const answer = answerText(turn);return <div className="space-y-1.5" data-testid="thread-turn" data-status={turn.status}>- {timeline.entries.map((entry) => {- if (entry.kind === "activity") return <ActivityGroup key={entry.id} entry={entry} live={running && entry.id === lastActivity} />;- if (entry.kind === "prose") {- if (entry.tone === "reasoning") return <ThoughtRow key={entry.id} block={entry.block as ReasoningBlock} />;- return <div key={entry.id} className={PROSE}><ChatMarkdown text={entry.text} /></div>;- }- const block = entry.block;- if (block.kind === "text") return <div key={entry.id} className={PROSE}><ChatMarkdown text={block.text} /></div>;- if (block.kind === "reasoning") {- return block.live && running ? <LiveThinking key={entry.id} block={block} /> : block.text.trim() ? <ThoughtRow key={entry.id} block={block} /> : null;- }- const pending = pendingLabel(block);- return pending ? <WorkRow key={entry.id} icon={pending.icon} label={pending.text} live /> : null;+ {rows.map((row) => {+ if (row.kind === "work") return <WorkGroupView key={row.id} group={row} running={running} />;+ if (row.kind === "text") return <div key={row.id} className={PROSE}><ChatMarkdown text={row.text} /></div>;+ const pending = pendingLabel(row.block);+ return pending ? <WorkRow key={row.id} icon={pending.icon} label={pending.text} live /> : null;})}{running- ? <WorkRow icon={<span className="h-1.5 w-1.5 rounded-full bg-accent animate-jarvis-pulse" />} label={<>Working for <Elapsed since={turn.startedMs} /></>} live />+ ? <div className="flex h-6 min-w-0 items-center px-1 text-sm leading-relaxed text-muted-foreground" data-testid="thread-working">+ <span className="whitespace-nowrap">Working for <Elapsed since={turn.startedMs} /></span>+ </div>: <>{turn.status === "error" && turn.error && <p role="alert" className="rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive">{turn.error}</p>}<ChangedFiles turn={turn} />diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/threadWork.test.ts b/jarvis/ui/web/frontend/src/components/agentic/threads/threadWork.test.tsnew file mode 100644index 0000000000..3125ac0774--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/threadWork.test.ts@@ -0,0 +1,92 @@+import { describe, expect, it } from "vitest";+import en from "@/i18n/locales/en.json";+import type { ToolBlock, TurnBlock, TurnStatus } from "@/components/agentchat/reduce";+import { buildThreadRows, liveItem, thoughtPreview, type ThreadRow, type WorkGroup } from "./threadWork";++type Dict = Record<string, unknown>;+const t = (key: string): string => {+ let cur: unknown = en as Dict;+ for (const part of key.split(".")) cur = cur && typeof cur === "object" ? (cur as Dict)[part] : undefined;+ return typeof cur === "string" ? cur : key;+};++const tool = (id: string, over: Partial<ToolBlock> = {}): ToolBlock => ({+ kind: "tool", callId: id, name: "Bash", input: { command: "ls" }, output: "a.ts", isError: false,+ durationMs: 300, approval: null, startedMs: 0, ...over,+});+const read = (id: string, path: string) => tool(id, { name: "Read", input: { file_path: path }, output: "x" });+const text = (id: string, body: string): TurnBlock => ({ kind: "text", id, text: body });+const thought = (id: string, body: string, live = false): TurnBlock => ({ kind: "reasoning", id, text: body, durationMs: live ? null : 1200, live, startedMs: 0 });++const rows = (blocks: TurnBlock[], status: TurnStatus = "done"): ThreadRow[] => buildThreadRows(blocks, { t, lang: "en", status });+const groups = (list: ThreadRow[]) => list.filter((row): row is WorkGroup => row.kind === "work");++describe("thread work groups", () => {+ it("folds thinking and calls up to the next prose into one group", () => {+ const list = rows([+ thought("r1", "Looking at the repo"),+ tool("c1"),+ thought("r2", "Now the tests"),+ tool("c2", { input: { command: "npm test" } }),+ read("f1", "src/a.ts"),+ text("n1", "Tests pass."),+ ]);+ expect(list.map((row) => row.kind)).toEqual(["work", "text"]);+ const [group] = groups(list);+ expect(group.items.map((item) => item.kind)).toEqual(["thought", "call", "thought", "call", "call"]);+ expect(group.summary).toBe("Ran 2 commands and read 1 file");+ expect(group.live).toBe(false);+ });++ it("counts what it leaves out instead of dropping it", () => {+ const [group] = groups(rows([+ tool("c1"),+ read("f1", "a.ts"),+ tool("l1", { name: "LS", input: { path: "src" }, output: "x" }),+ tool("e1", { name: "Edit", input: { file_path: "b.ts", old_string: "a", new_string: "b" }, output: "ok" }),+ ]));+ expect(group.summary).toBe("Ran 1 command, edited 1 file, and performed 2 other actions");+ });++ it("names a lone call by itself and a lone thought as a thought", () => {+ expect(groups(rows([tool("c1", { input: { command: "npm run build" } })]))[0].summary).toBe("npm run build");+ const [solo] = groups(rows([thought("r1", "Plan the change")]));+ expect(solo.summary).toBe("Thought");+ expect(solo.sole).toBe("thought");+ });++ it("keeps the running turn's newest group live and points at its running call", () => {+ const list = rows([text("n1", "Starting."), tool("c1"), tool("c2", { input: { command: "npm test" }, output: null, durationMs: null })], "running");+ const [group] = groups(list);+ expect(group.live).toBe(true);+ const item = liveItem(group);+ expect(item.kind === "call" && item.call.text).toBe("npm test");+ });++ it("is not live once prose follows the group", () => {+ const [group] = groups(rows([tool("c1"), text("n1", "Done looking.")], "running"));+ expect(group.live).toBe(false);+ });++ it("drops wordless thinking unless it is the turn's live thought", () => {+ expect(rows([thought("r1", "")])).toEqual([]);+ const [group] = groups(rows([thought("r1", "", true)], "running"));+ expect(group.items).toHaveLength(1);+ });++ it("breaks a group at a card that waits for the person", () => {+ const list = rows([+ tool("c1"),+ tool("q1", { name: "AskUserQuestion", input: { questions: [] }, output: null, question: { closed: false } as ToolBlock["question"] }),+ tool("c2"),+ ]);+ expect(list.map((row) => row.kind)).toEqual(["work", "pending", "work"]);+ });+});++describe("thought preview", () => {+ it("reads a Markdown thought as one plain line", () => {+ expect(thoughtPreview("**Inspecting the repo**\n\nI need to read `src/app.ts` and [the docs](https://x.y).\n- one\n- two"))+ .toBe("Inspecting the repo I need to read src/app.ts and the docs. one two");+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/threads/threadWork.ts b/jarvis/ui/web/frontend/src/components/agentic/threads/threadWork.tsnew file mode 100644index 0000000000..b78a13365d--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/threads/threadWork.ts@@ -0,0 +1,201 @@+/**+ * Portions adapted from pingdotgg/t3code @ e22c880 (apps/web MessagesTimeline,+ * packages/client-runtime work-log presentation), MIT License,+ * Copyright (c) 2026 T3 Tools Inc. Full text: third_party/t3code/LICENSE.+ *+ * The pure model behind a thread turn's work log. A turn reads as the+ * agent's answer with its work folded in between: every stretch of thinking+ * and tool calls up to the next piece of prose becomes ONE group. A finished+ * group is one line that counts what happened ("Ran 3 commands and read 2+ * files"); the group the running turn is still in is one live line that+ * names the newest step ("Thinking", the command it runs). Both open to the+ * single steps, and a step opens to its thought, diff or output.+ */++import type { ReasoningBlock, TextBlock, ToolBlock, TurnBlock, TurnStatus } from "@/components/agentchat/reduce";+import { buildTimeline, type Call, type CallKind, type Translate } from "@/components/agentchat/traceEntries";++/** One step of a group: a tool call or a stretch of thinking. */+export type WorkItem =+ | { kind: "call"; id: string; call: Call; startedMs: number }+ | { kind: "thought"; id: string; block: ReasoningBlock; startedMs: number };++export interface WorkGroup {+ kind: "work";+ id: string;+ items: WorkItem[];+ /** "Ran 3 commands and read 2 files", "Thought". */+ summary: string;+ /** The single kind of call the group made, "thought" when it only thought, else null. */+ sole: CallKind | "thought" | null;+ added: number;+ removed: number;+ startedMs: number;+ /** The running turn's newest group: drawn as one live line. */+ live: boolean;+}++export type ThreadRow =+ | WorkGroup+ | { kind: "text"; id: string; text: string; block: TextBlock }+ /** A call that waits for the person: an approval or a question card. */+ | { kind: "pending"; id: string; block: ToolBlock };++export function isFailed(call: Call): boolean {+ return call.status === "failed" || call.status === "blocked" || call.status === "declined";+}++/** A thought's text as one plain line: no Markdown marks, no line breaks. */+export function thoughtPreview(text: string): string {+ return text+ .replace(/```[^\n]*\n?/g, " ")+ .replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1")+ .replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")+ .replace(/^\s{0,3}(#{1,6}|>|[-*+]|\d+[.)])\s+/gm, "")+ .replace(/(\*\*|__|~~|`)/g, "")+ .replace(/(^|\s)[*_](\S[^*_]*\S|\S)[*_](?=\s|[.,;:!?]|$)/g, "$1$2")+ .replace(/\s+/g, " ")+ .trim();+}++function plural(count: number, one: string, other: string): string {+ return `${count} ${count === 1 ? one : other}`;+}++/** What a set of calls of one bucket did, counted. */+function bucketLabel(bucket: string, calls: Call[]): string {+ const n = calls.length;+ switch (bucket) {+ case "command": return `Ran ${plural(n, "command", "commands")}`;+ case "read": return `Read ${plural(new Set(calls.map((call) => call.text)).size, "file", "files")}`;+ case "list": return `Listed ${plural(n, "folder", "folders")}`;+ case "search": return n === 1 ? "Searched the code" : `Searched the code ${n} times`;+ case "edit": return `Edited ${plural(new Set(calls.map((call) => call.text)).size, "file", "files")}`;+ case "write": return `Created ${plural(n, "file", "files")}`;+ case "image": return `Viewed ${plural(n, "image", "images")}`;+ case "family:web": return n === 1 ? "Searched the web" : `Searched the web ${n} times`;+ default: return n === 1 ? calls[0].text : `${calls[0].text} ${n} times`;+ }+}++/** Commands and file changes say the most about a stretch; they lead. */+function priority(bucket: string): number {+ if (bucket === "command" || bucket === "edit" || bucket === "write") return 0;+ return 1;+}++function sentence(parts: string[]): string {+ const lowered = parts.map((part, index) => index === 0 ? part : part.charAt(0).toLowerCase() + part.slice(1));+ if (lowered.length < 3) return lowered.join(" and ");+ return `${lowered.slice(0, -1).join(", ")}, and ${lowered.at(-1)}`;+}++function names(list: string[]): string {+ if (list.length < 3) return list.join(" and ");+ return `${list.slice(0, -1).join(", ")}, and ${list.at(-1)}`;+}++/**+ * A group in one line: the services it used, then at most two kinds of+ * work, and every call left over still counted.+ */+export function summarizeWork(items: WorkItem[]): string {+ const calls = items.flatMap((item) => item.kind === "call" ? [item.call] : []);+ if (calls.length === 0) {+ const thoughts = items.length;+ return thoughts <= 1 ? "Thought" : `Thought ${thoughts} times`;+ }+ if (calls.length === 1 && calls[0].bucket !== "edit") return calls[0].text;+ const services: string[] = [];+ const buckets = new Map<string, Call[]>();+ for (const call of calls) {+ if (call.bucket.startsWith("used:")) {+ const name = call.bucket.slice(5);+ if (!services.includes(name)) services.push(name);+ continue;+ }+ const list = buckets.get(call.bucket);+ if (list) list.push(call);+ else buckets.set(call.bucket, [call]);+ }+ const ranked = [...buckets].map(([bucket, list], index) => ({ bucket, list, index }));+ const chosen = [...ranked]+ .sort((a, b) => priority(a.bucket) - priority(b.bucket) || a.index - b.index)+ .slice(0, 2)+ .sort((a, b) => a.index - b.index);+ const parts = chosen.map(({ bucket, list }) => bucketLabel(bucket, list));+ if (services.length) parts.unshift(`Used ${names(services.slice(0, 3))}${services.length > 3 ? ` and ${services.length - 3} more` : ""}`);+ const told = chosen.reduce((sum, { list }) => sum + list.length, 0);+ const serviceCalls = calls.filter((call) => call.bucket.startsWith("used:")).length;+ const rest = calls.length - told - serviceCalls;+ if (rest > 0) parts.push(`Performed ${plural(rest, "other action", "other actions")}`);+ return sentence(parts);+}++function soleKind(items: WorkItem[]): WorkGroup["sole"] {+ const calls = items.flatMap((item) => item.kind === "call" ? [item.call] : []);+ if (calls.length === 0) return "thought";+ const kinds = new Set(calls.map((call) => call.kind));+ return kinds.size === 1 ? calls[0].kind : null;+}++/** The step the live line names: the newest running call, else the newest step. */+export function liveItem(group: WorkGroup): WorkItem {+ for (let i = group.items.length - 1; i >= 0; i -= 1) {+ const item = group.items[i];+ if (item.kind === "call" && item.call.status === "running") return item;+ }+ return group.items[group.items.length - 1];+}++/** Lay out a turn's blocks as text, waiting cards and work groups. */+export function buildThreadRows(blocks: TurnBlock[], options: { t: Translate; lang: string; status: TurnStatus }): ThreadRow[] {+ const timeline = buildTimeline(blocks, { ...options, live: true });+ const started = new Map<string, number>();+ for (const block of blocks) {+ if (block.kind === "tool") started.set(block.callId, block.startedMs);+ else if (block.kind === "reasoning") started.set(block.id, block.startedMs);+ }+ const rows: ThreadRow[] = [];+ let items: WorkItem[] = [];+ const flush = () => {+ if (!items.length) return;+ const calls = items.flatMap((item) => item.kind === "call" ? [item.call] : []);+ rows.push({+ kind: "work",+ id: `work:${items[0].id}`,+ items,+ summary: summarizeWork(items),+ sole: soleKind(items),+ added: calls.reduce((sum, call) => sum + call.added, 0),+ removed: calls.reduce((sum, call) => sum + call.removed, 0),+ startedMs: items[0].startedMs,+ live: false,+ });+ items = [];+ };+ const thought = (block: ReasoningBlock) => {+ // Wordless (redacted) thinking is no step; a live one still shows the turn thinks.+ if (!block.text.trim() && !(block.live && options.status === "running")) return;+ items.push({ kind: "thought", id: block.id, block, startedMs: started.get(block.id) ?? 0 });+ };++ for (const entry of timeline.entries) {+ if (entry.kind === "activity") {+ for (const call of entry.calls) items.push({ kind: "call", id: call.id, call, startedMs: started.get(call.id) ?? 0 });+ continue;+ }+ const block = entry.block;+ if (block.kind === "reasoning") {+ thought(block);+ continue;+ }+ flush();+ if (block.kind === "text") rows.push({ kind: "text", id: entry.id, text: block.text, block });+ else rows.push({ kind: "pending", id: entry.id, block });+ }+ flush();+ const last = rows[rows.length - 1];+ if (options.status === "running" && last?.kind === "work") last.live = true;+ return rows;+}diff --git a/jarvis/ui/web/frontend/src/index.css b/jarvis/ui/web/frontend/src/index.cssindex e7cf7a4b0e..5e198bc7b0 100644--- a/jarvis/ui/web/frontend/src/index.css+++ b/jarvis/ui/web/frontend/src/index.css@@ -1242,6 +1242,31 @@ body {color: transparent;animation: thinking-shimmer 2.4s linear infinite;}+ /* A live work-log line: a narrow band of full-contrast text slides across+ the muted label in steps. Portions adapted from pingdotgg/t3code+ @ e22c880 (apps/web/src/index.css), MIT License, Copyright (c) 2026+ T3 Tools Inc. — third_party/t3code/LICENSE. */+ @keyframes live-tool-shine {+ from {+ background-position: -4.5rem 0, 0 0;+ }+ to {+ background-position: calc(100% + 4.5rem) 0, 0 0;+ }+ }+ @media (prefers-reduced-motion: no-preference) and (forced-colors: none) {+ .live-tool-shine {+ color: transparent;+ background-image:+ linear-gradient(to right, transparent, hsl(var(--foreground)), transparent),+ linear-gradient(hsl(var(--muted-foreground)), hsl(var(--muted-foreground)));+ background-size: 4.5rem 100%, 100% 100%;+ background-repeat: no-repeat;+ -webkit-background-clip: text;+ background-clip: text;+ animation: live-tool-shine 2.2s steps(30) infinite;+ }+ }@keyframes thinking-ring {0% {transform: scale(0.6);diff --git a/third_party/t3code/LICENSE b/third_party/t3code/LICENSEnew file mode 100644index 0000000000..55ee675bb1--- /dev/null+++ b/third_party/t3code/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2026 T3 Tools Inc.++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.