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(visualization): draw runs as n8n-style workflows with reasoning, spawns and lanes
rubenluetke10-beep14897ab963a2
diff --git a/jarvis/ui/web/frontend/src/hooks/useOutputs.ts b/jarvis/ui/web/frontend/src/hooks/useOutputs.tsindex 551e2de3cc..9e51f1f4c5 100644--- a/jarvis/ui/web/frontend/src/hooks/useOutputs.ts+++ b/jarvis/ui/web/frontend/src/hooks/useOutputs.ts@@ -14,10 +14,17 @@ export type PlanStepStatus =| "failed"| "skipped";+/** What a reconstructed step IS — an action, a sub-agent launch, or the+ * worker's own thinking between actions. Absent on old payloads = "tool". */+export type PlanStepKind = "tool" | "spawn" | "reasoning";+export interface PlanStep {step_id: string;name: string;status: PlanStepStatus;+ kind?: PlanStepKind;+ /** The worker (task dir) this step belongs to — the graph's lane key. */+ task_key?: string;output?: string | null;error?: string | null;duration_s?: number;diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 9e68e1ba1f..005e138f5c 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -4199,7 +4199,19 @@"empty_body": "Sobald ein Durchlauf archiviert ist, erscheint er hier als Graph: die Anfrage, jeder Werkzeug-Schritt und die erzeugten Dateien.","error_title": "Das Archiv der Durchläufe ist nicht lesbar","error_body": "Die Liste der Durchläufe ist gerade nicht verfügbar. Versuch es gleich noch einmal.",- "legend": "Obere Spur: was der Durchlauf tat, Schritt für Schritt. Untere Spur: die Dateien, die er hinterließ. Klick auf einen Knoten, um ihn zu inspizieren.",+ "legend": "Obere Spur: der Durchlauf Schritt für Schritt — Gedanken, Aktionen, Sub-Agenten, Ergebnis. Untere Spur: die Dateien, die er hinterließ. Klick auf einen Knoten, um ihn zu inspizieren.",+ "cat_trigger": "Auslöser",+ "cat_reasoning": "Denken",+ "cat_terminal": "Befehl",+ "cat_file": "Datei",+ "cat_search": "Suche",+ "cat_web": "Web",+ "cat_integration": "Integration",+ "cat_agent": "Agent",+ "cat_tool": "Werkzeug",+ "cat_result": "Ergebnis",+ "cat_deliverable": "Ergebnisdatei",+ "field_thought": "Gedanke","no_steps": "Für diesen Durchlauf sind keine Schritt-Aufzeichnungen erhalten — gezeigt werden Anfrage und Ergebnisdateien.","steps_dropped": "Langer Durchlauf: {0} weitere Schritte werden nicht gezeichnet.","node_start": "Anfrage",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 2645be7d18..b58cc8b255 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -4199,11 +4199,23 @@"empty_body": "As soon as a run has been archived it appears here as a graph: the request, every tool step, and the files it produced.","error_title": "The run archive could not be read","error_body": "The list of runs is unavailable right now. Try again in a moment.",- "legend": "Top track: what the run did, step by step. Bottom track: the files it left behind. Click a node to inspect it.",+ "legend": "Top track: the run step by step — thoughts, actions, sub-agents, result. Bottom track: the files it left behind. Click a node to inspect it.","no_steps": "No step records survived for this run — showing its request and deliverables.","steps_dropped": "Long run: {0} further steps are not drawn.","node_start": "Request","node_result": "Result",+ "cat_trigger": "Trigger",+ "cat_reasoning": "Reasoning",+ "cat_terminal": "Command",+ "cat_file": "File",+ "cat_search": "Search",+ "cat_web": "Web",+ "cat_integration": "Integration",+ "cat_agent": "Agent",+ "cat_tool": "Tool",+ "cat_result": "Result",+ "cat_deliverable": "Deliverable",+ "field_thought": "Thought","status_done": "Succeeded","status_failed": "Failed","status_running": "Running",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 78376e198d..c75b9713c7 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -4199,7 +4199,19 @@"empty_body": "En cuanto una ejecución quede archivada aparecerá aquí como un grafo: la petición, cada paso de herramienta y los archivos que produjo.","error_title": "No se pudo leer el archivo de ejecuciones","error_body": "La lista de ejecuciones no está disponible ahora mismo. Inténtalo de nuevo en un momento.",- "legend": "Pista superior: lo que hizo la ejecución, paso a paso. Pista inferior: los archivos que dejó. Haz clic en un nodo para inspeccionarlo.",+ "legend": "Pista superior: la ejecución paso a paso — pensamientos, acciones, subagentes, resultado. Pista inferior: los archivos que dejó. Haz clic en un nodo para inspeccionarlo.",+ "cat_trigger": "Disparador",+ "cat_reasoning": "Razonamiento",+ "cat_terminal": "Comando",+ "cat_file": "Archivo",+ "cat_search": "Búsqueda",+ "cat_web": "Web",+ "cat_integration": "Integración",+ "cat_agent": "Agente",+ "cat_tool": "Herramienta",+ "cat_result": "Resultado",+ "cat_deliverable": "Entregable",+ "field_thought": "Pensamiento","no_steps": "No se conservan registros de pasos de esta ejecución — se muestran su petición y sus archivos.","steps_dropped": "Ejecución larga: {0} pasos más no se dibujan.","node_start": "Petición",diff --git a/jarvis/ui/web/frontend/src/index.css b/jarvis/ui/web/frontend/src/index.cssindex 2be38b1d0b..381b12f063 100644--- a/jarvis/ui/web/frontend/src/index.css+++ b/jarvis/ui/web/frontend/src/index.css@@ -431,6 +431,22 @@--stage-vignette-rgb: 43 40 32;--stage-vignette-strength: 0.1;+ /* --- Run-graph node categories (Visualization) -----------------------+ The n8n-style family hues behind `nodeSpec.ts`. Every card's icon tile+ and kicker read `hsl(var(--viz-*))`; light values are darker so the+ category stays legible as ink on warm paper. */+ --viz-trigger: 38 100% 33%; /* the brand gold — the run's ignition */+ --viz-reasoning: 258 55% 45%; /* violet — the worker thinking */+ --viz-terminal: 190 85% 27%; /* cyan — shell commands */+ --viz-file: 210 80% 38%; /* blue — file writes/edits */+ --viz-search: 168 75% 26%; /* teal — read/grep/glob */+ --viz-web: 232 55% 46%; /* indigo — fetch/web */+ --viz-integration: 24 90% 36%; /* orange — MCP / external tools */+ --viz-agent: 292 60% 40%; /* magenta — sub-agent spawns */+ --viz-tool: 240 6% 38%; /* neutral — unrecognised tools */+ --viz-result: 152 65% 27%; /* green — the run's landing */+ --viz-deliverable: 240 6% 38%; /* neutral — files left behind */+/* Legacy aliases. Kept because they are referenced from a handful ofplaces that predate the token set; both now follow the theme. */--jarvis-yellow: 168 107 0;@@ -481,6 +497,19 @@--stage-vignette-rgb: 0 0 0;--stage-vignette-strength: 0.62;+ /* Run-graph node categories — signal hues on matte black (see :root). */+ --viz-trigger: 50 100% 52%;+ --viz-reasoning: 258 90% 72%;+ --viz-terminal: 187 85% 55%;+ --viz-file: 210 95% 66%;+ --viz-search: 168 70% 50%;+ --viz-web: 232 90% 74%;+ --viz-integration: 24 95% 60%;+ --viz-agent: 292 80% 70%;+ --viz-tool: 0 0% 62%;+ --viz-result: 152 65% 52%;+ --viz-deliverable: 0 0% 62%;+--jarvis-yellow: 255 214 10;--jarvis-yellow-dim: 230 190 40;--jarvis-grid: 0 0% 12%;diff --git a/jarvis/ui/web/frontend/src/lib/nodeSpec.ts b/jarvis/ui/web/frontend/src/lib/nodeSpec.tsnew file mode 100644index 0000000000..8585a5ee55--- /dev/null+++ b/jarvis/ui/web/frontend/src/lib/nodeSpec.ts@@ -0,0 +1,183 @@+/**+ * The Jarvis node design system — one vocabulary for every card on the run+ * canvas, the way n8n gives every node family its own colour and glyph.+ *+ * A node's CATEGORY answers "what sort of thing happened here" before the+ * title is read: a trigger, a thought, a shell command, a file edit, a+ * search, a web call, an integration (MCP), a sub-agent launch, the result,+ * or a deliverable. Each category owns exactly one icon and one colour+ * token, defined here and nowhere else — a new tool name gets classified in+ * THIS file or it renders as the neutral "tool" fallback, never as a+ * fresh ad-hoc style.+ *+ * Colours are `--viz-*` theme tokens (index.css defines both the light and+ * the dark value), consumed as `hsl(var(--viz-x))` — never a literal hex,+ * per the app-wide theming rule. The view builds its inline styles through+ * `categoryColor`/`categoryTint` so the alpha maths also lives in one place.+ */++import {+ Brain,+ FileCode,+ FileImage,+ FileText,+ Flag,+ Globe,+ MessageSquare,+ Plug,+ Search,+ SquarePen,+ Split,+ Terminal,+ Wrench,+ type LucideIcon,+} from "lucide-react";++import type { RunGraphNode } from "@/lib/runGraph";+import { classifyVisual } from "@/hooks/useVisualArtifacts";++export type NodeCategory =+ | "trigger"+ | "reasoning"+ | "terminal"+ | "file"+ | "search"+ | "web"+ | "integration"+ | "agent"+ | "tool"+ | "result"+ | "deliverable";++export interface NodeCategorySpec {+ /** The card glyph — one per category, like n8n's if-node branch sign. */+ icon: LucideIcon;+ /** The `--viz-*` custom property carrying the category hue (both themes). */+ cssVar: string;+ /** i18n key of the little uppercase kicker on the card. */+ labelKey: string;+}++export const NODE_CATEGORIES: Record<NodeCategory, NodeCategorySpec> = {+ trigger: {+ icon: MessageSquare,+ cssVar: "--viz-trigger",+ labelKey: "visualization.cat_trigger",+ },+ reasoning: {+ icon: Brain,+ cssVar: "--viz-reasoning",+ labelKey: "visualization.cat_reasoning",+ },+ terminal: {+ icon: Terminal,+ cssVar: "--viz-terminal",+ labelKey: "visualization.cat_terminal",+ },+ file: {+ icon: SquarePen,+ cssVar: "--viz-file",+ labelKey: "visualization.cat_file",+ },+ search: {+ icon: Search,+ cssVar: "--viz-search",+ labelKey: "visualization.cat_search",+ },+ web: {+ icon: Globe,+ cssVar: "--viz-web",+ labelKey: "visualization.cat_web",+ },+ integration: {+ icon: Plug,+ cssVar: "--viz-integration",+ labelKey: "visualization.cat_integration",+ },+ agent: {+ icon: Split,+ cssVar: "--viz-agent",+ labelKey: "visualization.cat_agent",+ },+ tool: {+ icon: Wrench,+ cssVar: "--viz-tool",+ labelKey: "visualization.cat_tool",+ },+ result: {+ icon: Flag,+ cssVar: "--viz-result",+ labelKey: "visualization.cat_result",+ },+ deliverable: {+ icon: FileText,+ cssVar: "--viz-deliverable",+ labelKey: "visualization.cat_deliverable",+ },+};++/* Tool-name families. Lowercased membership, mirrored from what the archived+ * streams of every provider actually contain (claude tools, codex synthetics,+ * generic snake_case fallbacks). */+const TERMINAL_TOOLS = new Set([+ "bash",+ "powershell",+ "runcommand",+ "shell",+ "exec",+ "execute",+ "run_command",+ "run_shell_command",+]);+const FILE_TOOLS = new Set([+ "write",+ "edit",+ "multiedit",+ "notebookedit",+ "file_write",+ "write_file",+ "create_file",+]);+const SEARCH_TOOLS = new Set(["read", "glob", "grep", "search", "ls", "list_files"]);++/** Which category a tool call belongs to — the n8n-style family sort. */+export function toolCategory(toolName: string | null | undefined): NodeCategory {+ const name = (toolName ?? "").toLowerCase();+ if (name.startsWith("mcp__") || name.includes("/")) return "integration";+ if (TERMINAL_TOOLS.has(name)) return "terminal";+ if (FILE_TOOLS.has(name)) return "file";+ if (SEARCH_TOOLS.has(name)) return "search";+ if (name.includes("web") || name.includes("fetch")) return "web";+ return "tool";+}++/** The category of a laid-out graph node. */+export function nodeCategory(node: RunGraphNode): NodeCategory {+ if (node.kind === "start") return "trigger";+ if (node.kind === "result") return "result";+ if (node.kind === "artifact") return "deliverable";+ if (node.step?.kind === "reasoning") return "reasoning";+ if (node.step?.kind === "spawn") return "agent";+ return toolCategory(node.step?.tool_name);+}++/** The glyph for a node — deliverables refine by what the file IS. */+export function nodeGlyph(node: RunGraphNode): LucideIcon {+ if (node.kind === "artifact") {+ const kind = classifyVisual(node.artifact?.path ?? "");+ if (kind === "image" || kind === "vector") return FileImage;+ if (kind === "page" || kind === "document") return FileCode;+ return FileText;+ }+ return NODE_CATEGORIES[nodeCategory(node)].icon;+}++/** The category hue as a CSS colour value (theme-following). */+export function categoryColor(category: NodeCategory): string {+ return `hsl(var(${NODE_CATEGORIES[category].cssVar}))`;+}++/** The same hue as a translucent tint — icon-tile grounds, hover washes. */+export function categoryTint(category: NodeCategory, alpha: number): string {+ return `hsl(var(${NODE_CATEGORIES[category].cssVar}) / ${alpha})`;+}diff --git a/jarvis/ui/web/frontend/src/lib/runGraph.test.ts b/jarvis/ui/web/frontend/src/lib/runGraph.test.tsindex 22c491f627..56231a10f4 100644--- a/jarvis/ui/web/frontend/src/lib/runGraph.test.ts+++ b/jarvis/ui/web/frontend/src/lib/runGraph.test.ts@@ -232,6 +232,117 @@ describe("buildRunGraph", () => {expect(graph.edges[0].failed).toBe(true);});+ it("branches a multi-worker mission into parallel lanes that merge at the result", () => {+ const graph = buildRunGraph({+ slug: "r",+ runStatus: "success",+ plan: {+ plan: { plan_id: "r", vision: "", status: "complete" },+ steps: [+ step({ step_id: "w1:0", task_key: "w1" }),+ step({ step_id: "w1:1", task_key: "w1" }),+ step({ step_id: "w2:0", task_key: "w2" }),+ step({ step_id: "w2:1", task_key: "w2" }),+ ],+ final_answer: "done",+ },+ files: [],+ });++ // Both workers branch out of the start node…+ const fromStart = graph.edges+ .filter((e) => e.from === "start")+ .map((e) => e.to);+ expect(fromStart).toEqual(["step:w1:0", "step:w2:0"]);+ // …into their own row bands, column-aligned…+ const w1 = graph.nodes.find((n) => n.id === "step:w1:0")!;+ const w2 = graph.nodes.find((n) => n.id === "step:w2:0")!;+ expect(w2.y).toBeGreaterThan(w1.y);+ expect(w2.x).toBe(w1.x);+ // …and every lane's last step merges into ONE result.+ const intoResult = graph.edges+ .filter((e) => e.to === "result")+ .map((e) => e.from);+ expect(intoResult).toEqual(["step:w1:1", "step:w2:1"]);+ });++ it("keeps legacy steps without task keys in one shared lane", () => {+ const graph = buildRunGraph({+ slug: "r",+ runStatus: "success",+ plan: {+ plan: { plan_id: "r", vision: "", status: "complete" },+ steps: [step({ step_id: "a" }), step({ step_id: "b" })],+ final_answer: "ok",+ },+ files: [],+ });+ // One chain on one row — never one lane per step.+ const ys = new Set(graph.nodes.map((n) => n.y));+ expect(ys.size).toBe(1);+ });++ it("draws ports only where an edge actually attaches", () => {+ const graph = buildRunGraph({+ slug: "r",+ runStatus: "success",+ plan: {+ plan: { plan_id: "r", vision: "", status: "complete" },+ steps: [step({ step_id: "t:0" })],+ final_answer: "ok",+ },+ files: [file("tasks/t1/artifacts/files/report.md")],+ });++ // The request only ever feeds forward — no input connector.+ const start = graph.nodes.find((n) => n.id === "start")!;+ expect(start.ports.left).toBe(false);+ expect(start.ports.right).toBe(true);+ // The result receives the track and hands the unclaimed file down.+ const result = graph.nodes.find((n) => n.id === "result")!;+ expect(result.ports.left).toBe(true);+ expect(result.ports.right).toBe(false);+ expect(result.ports.bottom).toBe(true);+ // A deliverable is an endpoint: one input from above, nothing else.+ const artifact = graph.nodes.find((n) => n.kind === "artifact")!;+ expect(artifact.ports).toEqual({+ left: false,+ right: false,+ top: true,+ bottom: false,+ });+ });++ it("threads reasoning steps through the flow as ordinary nodes", () => {+ const graph = buildRunGraph({+ slug: "r",+ runStatus: "success",+ plan: {+ plan: { plan_id: "r", vision: "", status: "complete" },+ steps: [+ step({+ step_id: "t:0",+ kind: "reasoning",+ tool_name: null,+ name: "Plan the deploy first.",+ }),+ step({ step_id: "t:1" }),+ ],+ final_answer: "ok",+ },+ files: [],+ });++ expect(graph.nodes.map((n) => n.id)).toEqual([+ "start",+ "step:t:0",+ "step:t:1",+ "result",+ ]);+ // Without a tool name the thought itself is the card headline.+ expect(graph.nodes[1].title).toBe("Plan the deploy first.");+ });+it("sizes the canvas to hold every node plus padding", () => {const graph = buildRunGraph({slug: "r",diff --git a/jarvis/ui/web/frontend/src/lib/runGraph.ts b/jarvis/ui/web/frontend/src/lib/runGraph.tsindex 036c7a0a50..dd1cce4290 100644--- a/jarvis/ui/web/frontend/src/lib/runGraph.ts+++ b/jarvis/ui/web/frontend/src/lib/runGraph.ts@@ -27,6 +27,16 @@ export type RunNodeKind = "start" | "step" | "result" | "artifact";/** Node state, unified across kinds so one dot component can render them. */export type RunNodeStatus = "done" | "failed" | "skipped" | "running" | "none";+/** Which card sides actually carry a connection — derived from the edges, so+ * a drawn port ALWAYS means "something attaches here" (start has no input,+ * a deliverable has no output, exactly like a workflow editor's nodes). */+export interface NodePorts {+ left: boolean;+ right: boolean;+ top: boolean;+ bottom: boolean;+}+export interface RunGraphNode {/** Stable id — selection key, React key and edge endpoint. */id: string;@@ -43,6 +53,8 @@ export interface RunGraphNode {/** Layout position (top-left corner) in unscaled canvas pixels. */x: number;y: number;+ /** Where edges attach — the only sides that render a connector dot. */+ ports: NodePorts;}export interface RunGraphEdge {@@ -83,10 +95,12 @@ const PADDING = 24;*/export const MAIN_TRACK_COLUMNS = 5;-/** Top-left corner of the main-track slot `index` (start = slot 0). */-function slotPosition(index: number): { x: number; y: number } {+/** Top-left corner of main-track slot `index`, `rowOffset` rows down. A+ * multi-worker mission gives each worker its own row band (a lane); a+ * single-worker run keeps `rowOffset` 0 and reads exactly as before. */+function slotPosition(index: number, rowOffset = 0): { x: number; y: number } {const column = index % MAIN_TRACK_COLUMNS;- const row = Math.floor(index / MAIN_TRACK_COLUMNS);+ const row = rowOffset + Math.floor(index / MAIN_TRACK_COLUMNS);return {x: PADDING + column * (NODE_W + GAP_X),y: PADDING + row * (NODE_H + ROW_GAP),@@ -138,6 +152,16 @@ export interface RunGraphInput {files: ArtifactSummary[];}+const NO_PORTS: NodePorts = { left: false, right: false, top: false, bottom: false };++/** The worker (lane) a step belongs to — explicit key, else the step_id's+ * task prefix, else one shared lane (legacy payloads without either). */+function laneKey(step: PlanStep): string {+ if (step.task_key) return step.task_key;+ const separator = step.step_id.indexOf(":");+ return separator > 0 ? step.step_id.slice(0, separator) : "";+}+/** Build the fully laid-out graph for one run. Pure. */export function buildRunGraph(input: RunGraphInput): RunGraph {const steps = input.plan?.steps ?? [];@@ -147,10 +171,22 @@ export function buildRunGraph(input: RunGraphInput): RunGraph {const lastUnconfirmed = [...steps].reverse().find((s) => s.status === "skipped");- /* Main track: start → steps → result, wrapping after MAIN_TRACK_COLUMNS- * so a long run reads like text — left to right, then down — instead of- * becoming a horizontal strip no screen can hold. */- let slot = 0;+ /* Lanes: one per worker, in first-seen order. A single-worker run is one+ * lane and lays out exactly as before; a mission that ran several workers+ * branches out of the start node into parallel bands and merges into the+ * result — the story a workflow editor would draw for parallel branches. */+ const laneOrder: string[] = [];+ const lanes = new Map<string, PlanStep[]>();+ for (const step of steps) {+ const key = laneKey(step);+ const lane = lanes.get(key);+ if (lane === undefined) {+ lanes.set(key, [step]);+ laneOrder.push(key);+ } else {+ lane.push(step);+ }+ }nodes.push({id: "start",@@ -163,35 +199,55 @@ export function buildRunGraph(input: RunGraphInput): RunGraph {: input.runStatus === "error"? "failed": "none",- ...slotPosition(slot),+ ...slotPosition(0),+ ports: { ...NO_PORTS },});- let previousId = "start";- slot += 1;- for (const step of steps) {- const id = `step:${step.step_id}`;- const status = stepStatus(step, step === lastUnconfirmed, input.runStatus);- nodes.push({- id,- kind: "step",- title: step.tool_name || step.name,- subtitle: step.tool_name && step.name !== step.tool_name ? step.name : "",- status,- step,- ...slotPosition(slot),- });- edges.push({- id: `${previousId}->${id}`,- from: previousId,- to: id,- failed: status === "failed",- });- previousId = id;- slot += 1;+ /* Main track(s): each lane wraps after MAIN_TRACK_COLUMNS so a long run+ * reads like text — left to right, then down — instead of becoming a+ * horizontal strip no screen can hold. Lane slots start at 1: the first+ * step sits beside the start node, later lanes directly below it. */+ let bandRow = 0;+ let lastSlot = 1; // where the result lands when there are no steps at all+ const laneEnds: { id: string }[] = [];+ for (const key of laneOrder) {+ const laneSteps = lanes.get(key) ?? [];+ let previousId = "start";+ let slot = 1;+ for (const step of laneSteps) {+ const id = `step:${step.step_id}`;+ const status = stepStatus(step, step === lastUnconfirmed, input.runStatus);+ nodes.push({+ id,+ kind: "step",+ title: step.tool_name || step.name,+ subtitle: step.tool_name && step.name !== step.tool_name ? step.name : "",+ status,+ step,+ ...slotPosition(slot, bandRow),+ ports: { ...NO_PORTS },+ });+ edges.push({+ id: `${previousId}->${id}`,+ from: previousId,+ to: id,+ failed: status === "failed",+ });+ previousId = id;+ slot += 1;+ }+ laneEnds.push({ id: previousId });+ lastSlot = slot;+ bandRow += Math.ceil((laneSteps.length + 1) / MAIN_TRACK_COLUMNS);}+ const lastBandRow = Math.max(+ 0,+ bandRow - Math.ceil(((lanes.get(laneOrder.at(-1) ?? "") ?? []).length + 1) / MAIN_TRACK_COLUMNS),+ );/* The result node closes the track whenever there is anything to close it- * with — an answer, or a terminal run outcome worth naming. */+ * with — an answer, or a terminal run outcome worth naming. Every lane's+ * last step merges into it. */const terminal =input.runStatus === "success" ||input.runStatus === "error" ||@@ -210,15 +266,18 @@ export function buildRunGraph(input: RunGraphInput): RunGraph {: input.runStatus === "cancelled" && !finalAnswer? "skipped": "done",- ...slotPosition(slot),- });- edges.push({- id: `${previousId}->result`,- from: previousId,- to: "result",- failed: input.runStatus === "error",+ ...slotPosition(lastSlot, lastBandRow),+ ports: { ...NO_PORTS },});- slot += 1;+ const sources = laneEnds.length > 0 ? laneEnds : [{ id: "start" }];+ for (const source of sources) {+ edges.push({+ id: `${source.id}->result`,+ from: source.id,+ to: "result",+ failed: input.runStatus === "error",+ });+ }}const hasResult = nodes[nodes.length - 1].id === "result";@@ -226,9 +285,8 @@ export function buildRunGraph(input: RunGraphInput): RunGraph {* that wrote it (result/start node when no step claims it). Each artifact* sits UNDER its source node where the row allows — provenance readable* from position alone, not only by tracing an edge across the canvas. */- const mainRows = Math.max(1, Math.ceil(slot / MAIN_TRACK_COLUMNS));- const artifactY =- PADDING + (mainRows - 1) * (NODE_H + ROW_GAP) + NODE_H + TRACK_GAP;+ const mainBottom = Math.max(...nodes.map((n) => n.y + NODE_H));+ const artifactY = mainBottom + TRACK_GAP;const byId = new Map(nodes.map((n) => [n.id, n]));const placed = input.files.map((file) => {const source = findSourceStep(steps, file.path);@@ -249,11 +307,31 @@ export function buildRunGraph(input: RunGraphInput): RunGraph {artifact: file,x,y: artifactY,+ ports: { ...NO_PORTS },});edges.push({ id: `${from}->${id}`, from, to: id, failed: false });artifactX = x + NODE_W + GAP_X;}+ /* Ports, derived from the edges that exist: the dot IS the attachment+ * point, so a side without a connection never wears one. */+ for (const edge of edges) {+ const from = byId.get(edge.from) ?? nodes.find((n) => n.id === edge.from);+ const to = byId.get(edge.to) ?? nodes.find((n) => n.id === edge.to);+ if (!from || !to) continue;+ const geometry = edgeGeometry(from, to);+ if (geometry === "h") {+ from.ports.right = true;+ to.ports.left = true;+ } else if (geometry === "down") {+ from.ports.bottom = true;+ to.ports.top = true;+ } else {+ from.ports.top = true;+ to.ports.bottom = true;+ }+ }+const width =Math.max(...nodes.map((n) => n.x + NODE_W), PADDING + NODE_W) + PADDING;const height =@@ -269,16 +347,29 @@ export function buildRunGraph(input: RunGraphInput): RunGraph {}/**- * The SVG path of one edge, n8n-style.- *- * Same-row edges leave the source's right port and enter the target's left- * port with a horizontal S-curve; cross-row edges leave the source's bottom- * and enter the target's top with a vertical one. Ports, not centers: an edge- * that visibly leaves a card edge is what makes the cards read as connected- * nodes rather than decorated boxes.+ * How one edge attaches, n8n-style: "h" leaves the source's right port and+ * enters the target's left port (also for branch/merge edges whose target+ * sits right AND below — the S-curve carries the dy); "down"/"up" connect+ * bottom to top when the target is not to the right (row wraps, artifacts+ * directly underneath). One function decides — `edgePath` draws with it and+ * `buildRunGraph` derives the port dots from it, so a dot and its edge can+ * never disagree.+ */+export function edgeGeometry(+ from: Pick<RunGraphNode, "x" | "y">,+ to: Pick<RunGraphNode, "x" | "y">,+): "h" | "down" | "up" {+ if (from.y === to.y || to.x >= from.x + NODE_W) return "h";+ return to.y > from.y ? "down" : "up";+}++/**+ * The SVG path of one edge. Ports, not centers: an edge that visibly leaves+ * a card edge is what makes the cards read as connected nodes rather than+ * decorated boxes.*/export function edgePath(from: RunGraphNode, to: RunGraphNode): string {- if (from.y === to.y) {+ if (edgeGeometry(from, to) === "h") {const x1 = from.x + NODE_W;const y1 = from.y + NODE_H / 2;const x2 = to.x;diff --git a/jarvis/ui/web/frontend/src/views/VisualizationView.test.tsx b/jarvis/ui/web/frontend/src/views/VisualizationView.test.tsxindex 2475f0b808..d5e8ba30a4 100644--- a/jarvis/ui/web/frontend/src/views/VisualizationView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/VisualizationView.test.tsx@@ -236,6 +236,46 @@ describe("VisualizationView", () => {expect(inspector.textContent).toContain("3.2 s");});+ it("draws a reasoning step as a dashed thought card, text in the inspector", async () => {+ installFetchMock(+ [{ slug: "run-think", utterance: "Explain the plan", status: "success" }],+ { "run-think": [] },+ {+ "run-think": {+ plan: { plan_id: "run-think", vision: "Explain", status: "complete" },+ steps: [+ {+ step_id: "t1:0",+ name: "Check the logs first.",+ tool_name: null,+ kind: "reasoning",+ status: "done",+ output: "Check the logs first, then decide.",+ },+ { step_id: "t1:1", name: "tail app.log", tool_name: "Bash", status: "done" },+ ],+ final_answer: "Done.",+ },+ },+ );++ renderView();++ const nodes = await screen.findAllByTestId("graph-node-step");+ const thought = nodes.find(+ (n) => n.getAttribute("data-category") === "reasoning",+ );+ expect(thought).toBeTruthy();+ // A thought is not an action — its card frame says so at a glance.+ expect(thought!.className).toContain("border-dashed");++ fireEvent.click(thought!);+ const inspector = await screen.findByTestId("visualization-inspector");+ // The full thought, not tool telemetry that never existed.+ expect(inspector.textContent).toContain("Check the logs first, then decide.");+ expect(inspector.textContent).not.toContain("Tool");+ });+it("frames a failed step in the alarm colour, not just a dot", async () => {installFetchMock([{ slug: "run-bad", utterance: "Deploy the site", status: "error" }],diff --git a/jarvis/ui/web/frontend/src/views/VisualizationView.tsx b/jarvis/ui/web/frontend/src/views/VisualizationView.tsxindex 662042ce2f..9417bee0b1 100644--- a/jarvis/ui/web/frontend/src/views/VisualizationView.tsx+++ b/jarvis/ui/web/frontend/src/views/VisualizationView.tsx@@ -9,28 +9,16 @@ import {import {Download,ExternalLink,- FileCode,- FileImage,- FileText,- Flag,FolderOpen,Frame,- Globe,Loader2,Maximize2,- MessageSquare,- Plug,RefreshCw,- Search,ShieldAlert,- SquarePen,- Terminal,Workflow,- Wrench,X,ZoomIn,ZoomOut,- type LucideIcon,} from "lucide-react";import { Button } from "@/components/ui/button";@@ -67,6 +55,13 @@ import {type RunGraph,type RunGraphNode,} from "@/lib/runGraph";+import {+ categoryColor,+ categoryTint,+ NODE_CATEGORIES,+ nodeCategory,+ nodeGlyph,+} from "@/lib/nodeSpec";/*** The Visualization section — a run drawn as a workflow, not listed as files.@@ -123,34 +118,6 @@ const NODE_DOT: Record<string, string> = {skipped: "bg-muted-foreground/40",};-/** The glyph a step node wears — recognisable tools get their own. */-function toolIcon(toolName: string | null | undefined): LucideIcon {- const name = (toolName ?? "").toLowerCase();- if (name.startsWith("mcp__") || name.includes("/")) return Plug;- if (["bash", "runcommand", "shell", "exec", "execute", "run_command", "run_shell_command"].includes(name))- return Terminal;- if (["write", "edit", "multiedit", "notebookedit", "file_write", "write_file", "create_file"].includes(name))- return SquarePen;- if (["read", "glob"].includes(name)) return FileText;- if (name === "grep" || name === "search") return Search;- if (name.includes("web") || name.includes("fetch")) return Globe;- return Wrench;-}--function artifactIcon(path: string): LucideIcon {- const kind = classifyVisual(path);- if (kind === "image" || kind === "vector") return FileImage;- if (kind === "page" || kind === "document") return FileCode;- return FileText;-}--function nodeIcon(node: RunGraphNode): LucideIcon {- if (node.kind === "start") return MessageSquare;- if (node.kind === "result") return Flag;- if (node.kind === "artifact") return artifactIcon(node.artifact?.path ?? "");- return toolIcon(node.step?.tool_name);-}-/** The rail row's timestamp — what tells two same-ask runs apart. */function formatRunDate(entry: OutputSummary): string {const ts = entry.completed_at ?? entry.started_at;@@ -755,8 +722,11 @@ function GraphCanvas({</svg>{graph.nodes.map((node) => {- const Icon = nodeIcon(node);+ const category = nodeCategory(node);+ const Icon = nodeGlyph(node);+ const hue = categoryColor(category);const selected = node.id === selectedId;+ const reasoning = category === "reasoning";const title =node.kind === "start"? t("visualization.node_start")@@ -764,6 +734,11 @@ function GraphCanvas({? t("visualization.node_result"): node.title;const subtitle = node.kind === "start" ? node.title : node.subtitle;+ /* Port dots come from the graph model (edge-derived), so a dot is+ * always a real attachment point — a start node has no input, a+ * deliverable no output, exactly like a workflow editor's nodes. */+ const port =+ "absolute h-1.5 w-1.5 rounded-full border border-background bg-primary/70";return (<buttonkey={node.id}@@ -771,9 +746,13 @@ function GraphCanvas({onClick={() => onSelect(node.id)}aria-current={selected}data-testid={`graph-node-${node.kind}`}+ data-category={category}style={{ left: node.x, top: node.y, width: NODE_W, height: NODE_H }}className={cn("absolute flex items-center gap-2.5 rounded-xl border bg-card px-3 text-left shadow-sm transition-colors",+ /* A thought is not an action: reasoning cards wear a dashed+ * frame, the visual grammar of "internal, produced nothing". */+ reasoning && "border-dashed",/* A failed or running step announces itself from the card* frame — a 6px dot alone is not a glanceable alarm. */selected@@ -785,26 +764,57 @@ function GraphCanvas({: "border-border hover:border-primary/50",)}>- {/* Ports — the connectors that make cards read as graph nodes. */}- <span- className="absolute -left-[3px] top-1/2 h-1.5 w-1.5 -translate-y-1/2 rounded-full bg-primary/60"- aria-hidden- />- <span- className="absolute -right-[3px] top-1/2 h-1.5 w-1.5 -translate-y-1/2 rounded-full bg-primary/60"- aria-hidden- />+ {node.ports.left && (+ <span+ className={cn(port, "-left-[3px] top-1/2 -translate-y-1/2")}+ aria-hidden+ />+ )}+ {node.ports.right &&+ (category === "agent" ? (+ /* A spawn node branches — its output port doubles, the way+ * n8n's if node wears one connector per outcome. */+ <>+ <span+ className={cn(port, "-right-[3px] top-1/2 -translate-y-[7px]")}+ aria-hidden+ />+ <span+ className={cn(port, "-right-[3px] top-1/2 translate-y-[1px]")}+ aria-hidden+ />+ </>+ ) : (+ <span+ className={cn(port, "-right-[3px] top-1/2 -translate-y-1/2")}+ aria-hidden+ />+ ))}+ {node.ports.top && (+ <span+ className={cn(port, "-top-[3px] left-1/2 -translate-x-1/2")}+ aria-hidden+ />+ )}+ {node.ports.bottom && (+ <span+ className={cn(port, "-bottom-[3px] left-1/2 -translate-x-1/2")}+ aria-hidden+ />+ )}<span- className={cn(- "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg",- node.kind === "artifact"- ? "bg-secondary text-foreground"- : "bg-primary/15 text-primary",- )}+ className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg"+ style={{ color: hue, backgroundColor: categoryTint(category, 0.14) }}><Icon className="h-4 w-4" aria-hidden /></span><span className="min-w-0 flex-1">+ <span+ className="block truncate text-[9px] font-semibold uppercase tracking-widest"+ style={{ color: hue }}+ >+ {t(NODE_CATEGORIES[category].labelKey)}+ </span><span className="block truncate text-xs font-medium text-foreground">{title}</span>@@ -814,7 +824,7 @@ function GraphCanvas({</span>)}</span>- {node.status !== "none" && (+ {node.status !== "none" && !reasoning && (<spanclassName={cn("h-1.5 w-1.5 shrink-0 rounded-full",@@ -884,7 +894,17 @@ function NodeInspector({<ScrollArea className="min-h-0 flex-1"><div className="space-y-3 p-3">- {node.kind === "step" && node.step && (+ {/* A reasoning step is a thought, not a call: it gets the thought+ text and nothing pretending to be tool telemetry. */}+ {node.kind === "step" && node.step?.kind === "reasoning" && (+ <InspectorField label={t("visualization.field_thought")}>+ <p className="whitespace-pre-wrap break-words text-xs">+ {node.step.output || node.step.name}+ </p>+ </InspectorField>+ )}++ {node.kind === "step" && node.step && node.step.kind !== "reasoning" && (<><InspectorField label={t("visualization.field_tool")}>{node.step.tool_name ?? "—"}