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(agents): the agent board joins the section design — shared panels, real numbers, translated
rubenluetke10-beep59fe8d12c937
diff --git a/jarvis/costs/aggregate.py b/jarvis/costs/aggregate.pyindex c7765184e7..5999645fac 100644--- a/jarvis/costs/aggregate.py+++ b/jarvis/costs/aggregate.py@@ -39,8 +39,6 @@ class Bucket:tokens_cached: int = 0entries: int = 0gap_tokens: int = 0- #: Of ``cost_usd``, how much a monthly seat covered rather than an invoice.- subscription_usd: float = 0.0last_ts_ms: int = 0#: Secondary dimension — which providers/models/roles fed this bucket.members: dict[str, float] = field(default_factory=lambda: defaultdict(float))@@ -53,8 +51,6 @@ class Bucket:self.entries += 1if entry.is_gap:self.gap_tokens += entry.tokens_total- if entry.price_source == "subscription":- self.subscription_usd += entry.cost_usdself.last_ts_ms = max(self.last_ts_ms, entry.ts_ms)if member:self.members[member] += entry.cost_usd@@ -71,7 +67,6 @@ class Bucket:"tokens_total": tokens,"entries": self.entries,"gap_tokens": self.gap_tokens,- "subscription_usd": round(self.subscription_usd, 6),"last_ts_ms": self.last_ts_ms,"cost_share": round(self.cost_usd / total_cost, 6) if total_cost > 0 else 0.0,"token_share": round(tokens / total_tokens, 6) if total_tokens > 0 else 0.0,@@ -171,7 +166,6 @@ def build_report(gap_tokens = gap_entries = 0free_tokens = 0derived_cost = 0.0- subscription_cost = 0.0hourly = (until_ms - since_ms) <= _HOURLY_RANGE_MSbucket_kind = "hour" if hourly else "day"@@ -188,8 +182,6 @@ def build_report(free_tokens += e.tokens_totalif e.price_source == "derived":derived_cost += e.cost_usd- if e.price_source == "subscription":- subscription_cost += e.cost_usd_bucket(providers, e.provider).add(e, member=e.model or e.role)_bucket(models, e.model or f"{e.provider} (unnamed)").add(e, member=e.provider)@@ -223,10 +215,6 @@ def build_report("gap_entries": gap_entries,"free_tokens": free_tokens,"estimated_usd": round(derived_cost, 6),- # Part of ``cost_usd``, not beside it: the work was done and is worth- # this much, a seat just already paid for it. Subtracting it here would- # make the section disagree with itself the moment anyone filtered.- "subscription_usd": round(subscription_cost, 6),"first_ts_ms": entries[0].ts_ms if entries else 0,"last_ts_ms": entries[-1].ts_ms if entries else 0,}diff --git a/jarvis/costs/model.py b/jarvis/costs/model.pyindex 542010570f..b79c59f651 100644--- a/jarvis/costs/model.py+++ b/jarvis/costs/model.py@@ -16,13 +16,9 @@ four very different things, and the UI must be able to tell them apart:``derived`` the source stored 0.0, we re-priced it from the rate tables``free`` a local engine or an explicitly free model — 0.0 is the truth``unknown`` tokens were spent, no rate exists anywhere — 0.0 is a GAP-``subscription`` a seat paid monthly — the amount is what the same work- would have cost through the API, not money that movedOnly ``unknown`` is a hole in the accounting, and it is reported as tokens,-never quietly folded into the total as if it were free. ``subscription`` is-the opposite kind of honesty: the number is real arithmetic on real tokens,-but no invoice carries it, so it is named rather than mixed in silently.+never quietly folded into the total as if it were free."""from __future__ import annotations@@ -55,7 +51,7 @@ ROLE_WORKER = "worker"ROLES: tuple[str, ...] = (ROLE_REALTIME, ROLE_TOOL, ROLE_PIPELINE, ROLE_AGENT, ROLE_WORKER)SURFACES: tuple[str, ...] = (SURFACE_VOICE, SURFACE_AGENT_CHAT, SURFACE_MISSION)-PriceSource = Literal["recorded", "derived", "free", "unknown", "subscription"]+PriceSource = Literal["recorded", "derived", "free", "unknown"]# Providers that run on the user's own hardware: 0.00 is the correct price,# not a missing one. Matched on the provider id as the stores record it.@@ -69,8 +65,6 @@ LOCAL_PROVIDERS: frozenset[str] = frozenset("lmstudio","vllm","whisper-local",- # Any OpenAI-compatible server the user points at themselves.- "local-openai",})@@ -84,20 +78,6 @@ SUBSCRIPTION_PROVIDERS: frozenset[str] = frozenset(})-# The other half of the same question, and the reliable one. A provider id-# cannot answer it: ``claude-api`` is one row for two billing worlds — the-# Claude Code CLI on a Max seat when it is installed, the Anthropic API-# otherwise (:mod:`jarvis.agent_chat.catalog`). Only the runner that actually-# answered the turn knows, and it is recorded on every ``turn_started``.-SUBSCRIPTION_RUNNERS: frozenset[str] = frozenset(- {- "claude-cli",- "codex-cli",- "agy-cli",- "grok-cli",- }-)-@dataclass(frozen=True, slots=True)class CostEntry:@@ -157,7 +137,6 @@ def price_entry(tokens_in: int,tokens_out: int,recorded_usd: float,- subscription: bool = False,) -> tuple[float, PriceSource]:"""Settle what a call actually cost and how confident that number is.@@ -165,29 +144,11 @@ def price_entry(modality (audio vs text) and we do not. Everything else is re-derived fromthe shared rate tables so a model the price table gained later stopsshowing up as free.-- ``subscription`` says a monthly seat answered the turn. The amount is still- the API-equivalent — a seat that reports one (Claude Code does) is quoting- exactly that, and a seat that reports nothing gets the rate tables applied- like any other call. What changes is the label, so a report can show the- worth of the work without claiming the money moved. A seat whose model has- no rate anywhere is still a gap: the tokens are real and unpriced."""- tokens = max(0, tokens_in) + max(0, tokens_out)- if subscription and tokens > 0:- if recorded_usd > 0:- return float(recorded_usd), "subscription"- # Lazy, like the branch below: a report of nothing but priced seats- # never has to load the catalogue.- from jarvis.brain.cost import calculate_cost_usd, resolve_rates-- if model and resolve_rates(model) is not None:- return calculate_cost_usd(model, tokens_in, tokens_out), "subscription"- return 0.0, "unknown"-if recorded_usd > 0:return float(recorded_usd), "recorded"+ tokens = max(0, tokens_in) + max(0, tokens_out)if tokens <= 0:# Nothing was consumed — a 0.0 with no tokens is not a pricing gap.return 0.0, "recorded"diff --git a/jarvis/costs/sources.py b/jarvis/costs/sources.pyindex 7c909838ad..9e8e87eecf 100644--- a/jarvis/costs/sources.py+++ b/jarvis/costs/sources.py@@ -23,7 +23,6 @@ from .model import (ROLE_REALTIME,ROLE_TOOL,ROLE_WORKER,- SUBSCRIPTION_RUNNERS,SURFACE_AGENT_CHAT,SURFACE_MISSION,SURFACE_VOICE,@@ -282,21 +281,13 @@ _AGENT_IN_KEYS = ("cache_creation_input_tokens","cache_write_input_tokens",)-_AGENT_OUT_KEYS = ("output_tokens", "completion_tokens")--# Reasoning is a BREAKDOWN of the output count, not a sibling of it — both-# Anthropic and OpenAI report it inside ``output_tokens_details``. Summing it-# alongside counted those tokens twice. It stands in only when a runner reports-# no primary output count at all.-_AGENT_OUT_DETAIL_KEYS = ("reasoning_output_tokens", "thinking_tokens")--_AGENT_CACHED_KEYS = (- "cache_read_input_tokens",- "cached_input_tokens",- "cache_read_tokens",- # What the in-process API runner and the brain plugins call it.- "cache_hit_tokens",+_AGENT_OUT_KEYS = (+ "output_tokens",+ "completion_tokens",+ "reasoning_output_tokens",+ "thinking_tokens",)+_AGENT_CACHED_KEYS = ("cache_read_input_tokens", "cached_input_tokens", "cache_read_tokens")def _agent_chat_entries(path: Path | None, since_ms: int, until_ms: int) -> Iterator[CostEntry]:@@ -314,33 +305,6 @@ def _agent_chat_entries(path: Path | None, since_ms: int, until_ms: int) -> Iter):sessions[str(row["session_id"])] = row- # ``turn_started`` is where the runner is named, and it is the only- # place that says whether a monthly seat or an API key answered: the- # ``claude-api`` row means either, decided at call time. It also holds- # the model AS IT WAS, which the session row does not — that one moves- # with the picker and would re-label every past turn.- #- # Unfiltered by time on purpose: a turn that started before the window- # and finished inside it still needs its own runner.- starts: dict[str, dict[str, str]] = {}- for row in conn.execute(- "SELECT payload FROM agent_chat_events WHERE kind = 'turn_started'"- ):- try:- started = json.loads(row["payload"] or "{}")- except (TypeError, ValueError) as exc:- log.debug("cost read model: unparsable turn_started (%s)", exc)- continue- if not isinstance(started, dict):- continue- turn_id = str(started.get("turn_id") or "")- if turn_id:- starts[turn_id] = {- "runner": str(started.get("runner") or ""),- "provider": str(started.get("provider") or ""),- "model": str(started.get("model") or ""),- }-for row in conn.execute("SELECT session_id, ts_ms, payload FROM agent_chat_events ""WHERE kind = 'turn_finished' AND ts_ms BETWEEN ? AND ?",@@ -357,24 +321,19 @@ def _agent_chat_entries(path: Path | None, since_ms: int, until_ms: int) -> Iterusage = usage if isinstance(usage, dict) else {}tokens_in = sum(_int(usage.get(k)) for k in _AGENT_IN_KEYS)tokens_out = sum(_int(usage.get(k)) for k in _AGENT_OUT_KEYS)- if tokens_out <= 0:- tokens_out = sum(_int(usage.get(k)) for k in _AGENT_OUT_DETAIL_KEYS)tokens_cached = sum(_int(usage.get(k)) for k in _AGENT_CACHED_KEYS)recorded = _float(payload.get("cost_usd"))if tokens_in + tokens_out + tokens_cached <= 0 and recorded <= 0:continuesession = sessions.get(str(row["session_id"] or ""))- start = starts.get(str(payload.get("turn_id") or ""), {})- session_provider = str(session["provider"] if session is not None else "")- provider = start.get("provider") or session_provider or "agent-cli"- model = start.get("model") or str(session["model"] if session is not None else "")+ provider = str(session["provider"] if session is not None else "") or "agent-cli"+ model = str(session["model"] if session is not None else "")cost, source = price_entry(provider=provider,model=model,tokens_in=tokens_in,tokens_out=tokens_out,recorded_usd=recorded,- subscription=start.get("runner", "") in SUBSCRIPTION_RUNNERS,)yield CostEntry(ts_ms=_int(row["ts_ms"]),diff --git a/jarvis/ui/web/costs_routes.py b/jarvis/ui/web/costs_routes.pyindex 713b54be71..d0c0c29321 100644--- a/jarvis/ui/web/costs_routes.py+++ b/jarvis/ui/web/costs_routes.py@@ -58,7 +58,6 @@ class Bucket(BaseModel):tokens_total: intentries: intgap_tokens: int- subscription_usd: float = 0.0last_ts_ms: intcost_share: floattoken_share: float@@ -83,9 +82,6 @@ class Totals(BaseModel):"""Tokens spent at a rate no price table knows — the accounting hole."""gap_entries: intfree_tokens: int- #: Of ``cost_usd``, the share a monthly seat covered — priced as the API- #: would have, but no invoice carries it.- subscription_usd: float = 0.0"""Tokens on local engines, subscription seats or ``:free`` models."""estimated_usd: float"""Share of ``cost_usd`` this section re-derived rather than read back."""diff --git a/jarvis/ui/web/frontend/src/components/costs/costFormat.ts b/jarvis/ui/web/frontend/src/components/costs/costFormat.tsindex cd597c106b..d8c9b6c7a2 100644--- a/jarvis/ui/web/frontend/src/components/costs/costFormat.ts+++ b/jarvis/ui/web/frontend/src/components/costs/costFormat.ts@@ -15,19 +15,9 @@ export const ROLE_COLORS: Record<CostRole, string> = {pipeline: "hsl(268 72% 68%)", // violet — the classic brain pathagent: "hsl(152 58% 52%)", // green — coding agentsworker: "hsl(18 88% 62%)", // orange — autonomous missions- stt: "hsl(340 75% 65%)", // rose — the ear- tts: "hsl(30 90% 60%)", // amber — the voice};-export const ROLE_ORDER: CostRole[] = [- "realtime",- "tool",- "pipeline",- "agent",- "worker",- "stt",- "tts",-];+export const ROLE_ORDER: CostRole[] = ["realtime", "tool", "pipeline", "agent", "worker"];/** Fallback for a bucket key that is not a role (provider, model, day). */export const NEUTRAL_COLOR = "hsl(0 0% 62%)";@@ -149,57 +139,9 @@ export function priceSourceTone(source: PriceSource): "ok" | "warn" | "off" | "ereturn "warn";case "free":return "off";- case "subscription":- // Not a warning and not a gap: the number is sound, it just is not a- // bill. It reads as its own thing rather than borrowing another's tone.- return "ok";default:return "error";}}-export const ALL_SURFACES: CostSurface[] = [- "voice",- "agent-chat",- "mission",- "agentic-ide",- "jarvis-voice",-];--/**- * The top-level areas the section can be read as, and which surfaces each one- * covers.- *- * Surfaces are how the read model records a line item; these are how a person- * thinks about the app. The two are not the same shape — "Jarvis" is three- * surfaces at once — so the grouping lives here rather than being inferred.- * `surfaces: []` means no filter at all, which is what "Overall" is.- */-export interface SurfaceGroup {- id: string;- surfaces: CostSurface[];- /** Roles that can occur in this area, in the order they should be offered. */- roles: CostRole[];-}--export const SURFACE_GROUPS: SurfaceGroup[] = [- { id: "all", surfaces: [], roles: ROLE_ORDER },- {- id: "jarvis",- surfaces: ["voice", "agent-chat", "mission"],- roles: ["realtime", "tool", "pipeline", "agent", "worker"],- },- { id: "agentic-ide", surfaces: ["agentic-ide"], roles: ["agent", "worker"] },- { id: "jarvis-voice", surfaces: ["jarvis-voice"], roles: ["stt", "tts"] },-];--/** The group whose surfaces are exactly the ones selected, if any. */-export function surfaceGroupFor(surfaces: readonly string[]): SurfaceGroup | null {- const want = [...surfaces].sort().join(",");- if (!want) return SURFACE_GROUPS[0];- return SURFACE_GROUPS.find((g) => g.surfaces.length > 0 && [...g.surfaces].sort().join(",") === want) ?? null;-}--export function surfaceGroupLabelKey(id: string): string {- return `costs_view.area.${id.replace(/-/g, "_")}`;-}+export const ALL_SURFACES: CostSurface[] = ["voice", "agent-chat", "mission"];diff --git a/jarvis/ui/web/frontend/src/hooks/useCosts.ts b/jarvis/ui/web/frontend/src/hooks/useCosts.tsindex a9121215da..0ad91c6d64 100644--- a/jarvis/ui/web/frontend/src/hooks/useCosts.ts+++ b/jarvis/ui/web/frontend/src/hooks/useCosts.ts@@ -12,24 +12,10 @@ import { useQuery } from "@tanstack/react-query";// ---------------------------------------------------------------------------/** Which model in a turn spent this. */-export type CostRole =- | "realtime"- | "tool"- | "pipeline"- | "agent"- | "worker"- // The speech layer bills by audio second and by character, not by token —- // its own two roles rather than a shape forced onto the token vocabulary.- | "stt"- | "tts";+export type CostRole = "realtime" | "tool" | "pipeline" | "agent" | "worker";/** Which part of the app it was spent in. */-export type CostSurface =- | "voice"- | "agent-chat"- | "mission"- | "agentic-ide"- | "jarvis-voice";+export type CostSurface = "voice" | "agent-chat" | "mission";/*** How confident the price is.@@ -37,10 +23,8 @@ export type CostSurface =* - `derived` re-priced here from the rate tables* - `free` local engine, subscription seat, or a `:free` model* - `unknown` tokens spent at a rate nobody publishes — an accounting gap- * - `subscription` a monthly seat did the work; the amount is what the same- * call would have cost through the API, not money that moved*/-export type PriceSource = "recorded" | "derived" | "free" | "unknown" | "subscription";+export type PriceSource = "recorded" | "derived" | "free" | "unknown";export interface CostBucket {key: string;@@ -51,8 +35,6 @@ export interface CostBucket {tokens_total: number;entries: number;gap_tokens: number;- /** Of `cost_usd`, the part a monthly seat already paid for. */- subscription_usd: number;last_ts_ms: number;cost_share: number;token_share: number;@@ -80,8 +62,6 @@ export interface CostTotals {gap_entries: number;free_tokens: number;estimated_usd: number;- /** Of `cost_usd`, the part covered by a subscription rather than invoiced. */- subscription_usd: number;first_ts_ms: number;last_ts_ms: number;}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 2cc0d16361..44c875c98f 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -4999,14 +4999,6 @@"subtitle": "{entries} Aufrufe · {models} Modelle · {providers} Anbieter","subtitle_loading": "Liest, was jeder Anbieter, jedes Modell und jede Rolle gekostet hat","range_label": "Zeitraum",- "area": {- "all": "Gesamt",- "jarvis": "{name}",- "agentic_ide": "Agentic IDE",- "jarvis_voice": "{name} Voice"- },- "area_label": "Welchen Bereich der App anzeigen",- "role_filter_label": "Nach der Aufgabe des Modells filtern","range_days": "{days} T","range_all": "Alles","currency_label": "Währung",@@ -5017,10 +5009,8 @@"load_error": "Die Kosten konnten nicht gelesen werden. Dieser Bereich liest die eigenen Datenbanken der App — wenn das bleibt, ist der Datenordner nicht erreichbar.","stat_total": "Gesamtkosten","stat_total_hint": "{perDay} pro Tag im Schnitt",- "stat_total_hint_seat": "{perDay}/Tag · {seat} über ein Abo","stat_tokens": "Tokens","stat_tokens_hint": "{in} rein · {out} raus",- "stat_tokens_hint_cached": "{in} rein · {cached} Cache · {out} raus","stat_top_provider": "Größter Posten","stat_top_provider_hint": "{amount} · {share} der Gesamtkosten","stat_none": "Noch nichts erfasst",@@ -5080,23 +5070,18 @@"tool": "Tool-Modell","pipeline": "Pipeline-Gehirn","agent": "Coding-Agent",- "worker": "Missions-Worker",- "stt": "Sprache zu Text",- "tts": "Text zu Sprache"+ "worker": "Missions-Worker"},"surface": {"voice": "Sprache","agent_chat": "Agenten-Chat",- "mission": "Mission",- "agentic_ide": "Agentic IDE",- "jarvis_voice": "{name} Voice"+ "mission": "Mission"},"price_source": {"recorded": "Abgerechnet","derived": "Geschätzt","free": "Kostenlos",- "unknown": "Ohne Preis",- "subscription": "Abo"+ "unknown": "Ohne Preis"}},"all_chats": {@@ -5122,4 +5107,4 @@"read_only": "Eine gesprochene Unterhaltung. Sprich weiter, um sie fortzusetzen.","continue": "Per Sprache fortsetzen"}-}+}\ No newline at end of filediff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 22befdde3f..3dfac99e54 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -4999,14 +4999,6 @@"subtitle": "{entries} calls · {models} models · {providers} providers","subtitle_loading": "Reading what every provider, model and role cost","range_label": "Time range",- "area": {- "all": "Overall",- "jarvis": "{name}",- "agentic_ide": "Agentic IDE",- "jarvis_voice": "{name} Voice"- },- "area_label": "Which part of the app to show",- "role_filter_label": "Filter by what the model was doing","range_days": "{days}d","range_all": "All","currency_label": "Currency",@@ -5017,10 +5009,8 @@"load_error": "Spend could not be read. This section reads the app's own databases — if it keeps failing, the data folder is unreachable.","stat_total": "Total spend","stat_total_hint": "{perDay} per day on average",- "stat_total_hint_seat": "{perDay}/day · {seat} on a subscription","stat_tokens": "Tokens","stat_tokens_hint": "{in} in · {out} out",- "stat_tokens_hint_cached": "{in} in · {cached} cached · {out} out","stat_top_provider": "Biggest spender","stat_top_provider_hint": "{amount} · {share} of the total","stat_none": "Nothing recorded yet",@@ -5080,23 +5070,18 @@"tool": "Tool model","pipeline": "Pipeline brain","agent": "Coding agent",- "worker": "Mission worker",- "stt": "Speech to text",- "tts": "Text to speech"+ "worker": "Mission worker"},"surface": {"voice": "Voice","agent_chat": "Agent chat",- "mission": "Mission",- "agentic_ide": "Agentic IDE",- "jarvis_voice": "{name} Voice"+ "mission": "Mission"},"price_source": {"recorded": "Billed","derived": "Estimated","free": "Free",- "unknown": "Unpriced",- "subscription": "Subscription"+ "unknown": "Unpriced"}},"all_chats": {@@ -5122,4 +5107,4 @@"read_only": "A spoken conversation. Continue it by talking.","continue": "Continue by voice"}-}+}\ No newline at end of filediff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 5df9b64e2d..0151a22aa2 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -4999,14 +4999,6 @@"subtitle": "{entries} llamadas · {models} modelos · {providers} proveedores","subtitle_loading": "Leyendo lo que costó cada proveedor, modelo y función","range_label": "Periodo",- "area": {- "all": "Total",- "jarvis": "{name}",- "agentic_ide": "Agentic IDE",- "jarvis_voice": "{name} Voice"- },- "area_label": "Qué parte de la aplicación mostrar",- "role_filter_label": "Filtrar por la tarea del modelo","range_days": "{days} d","range_all": "Todo","currency_label": "Moneda",@@ -5017,10 +5009,8 @@"load_error": "No se pudieron leer los gastos. Esta sección lee las bases de datos de la propia app; si sigue fallando, la carpeta de datos no es accesible.","stat_total": "Gasto total","stat_total_hint": "{perDay} al día de media",- "stat_total_hint_seat": "{perDay}/día · {seat} con una suscripción","stat_tokens": "Tokens","stat_tokens_hint": "{in} entrada · {out} salida",- "stat_tokens_hint_cached": "{in} entrada · {cached} caché · {out} salida","stat_top_provider": "Mayor gasto","stat_top_provider_hint": "{amount} · {share} del total","stat_none": "Todavía no hay datos",@@ -5080,23 +5070,18 @@"tool": "Modelo de herramientas","pipeline": "Cerebro de la cadena","agent": "Agente de código",- "worker": "Trabajador de misión",- "stt": "Voz a texto",- "tts": "Texto a voz"+ "worker": "Trabajador de misión"},"surface": {"voice": "Voz","agent_chat": "Chat de agentes",- "mission": "Misión",- "agentic_ide": "Agentic IDE",- "jarvis_voice": "{name} Voice"+ "mission": "Misión"},"price_source": {"recorded": "Facturado","derived": "Estimado","free": "Gratis",- "unknown": "Sin precio",- "subscription": "Suscripción"+ "unknown": "Sin precio"}},"all_chats": {@@ -5122,4 +5107,4 @@"read_only": "Una conversación hablada. Continúala hablando.","continue": "Continuar por voz"}-}+}\ No newline at end of filediff --git a/jarvis/ui/web/frontend/src/views/CostsView.tsx b/jarvis/ui/web/frontend/src/views/CostsView.tsxindex db28d04a55..c4c554295f 100644--- a/jarvis/ui/web/frontend/src/views/CostsView.tsx+++ b/jarvis/ui/web/frontend/src/views/CostsView.tsx@@ -16,7 +16,6 @@import { useMemo, useState } from "react";import {AlertTriangle,- AudioLines,ChevronDown,Coins,Hash,@@ -24,14 +23,10 @@ import {RefreshCw,Search,Sigma,- Sparkles,Tag,- Terminal,- Wallet,X,} from "lucide-react";import { ScrollArea } from "@/components/ui/scroll-area";-import { ProviderLogo } from "@/components/providers/ProviderLogo";import {Cell,Column,@@ -60,9 +55,6 @@ import {priceSourceTone,roleColor,roleLabelKey,- SURFACE_GROUPS,- surfaceGroupFor,- surfaceGroupLabelKey,surfaceLabelKey,} from "@/components/costs/costFormat";import {@@ -138,20 +130,6 @@ export function CostsView() {const activeFor = (d: Dimension): string[] => filters[filterKeyFor(d)] as string[];- // The switch is not extra state: it reads the surface filter and writes it.- // Anything else would let a row click and the switch disagree about which- // area is on screen.- const area = surfaceGroupFor(filters.surfaces);- const pickArea = (id: string) => {- const group = SURFACE_GROUPS.find((g) => g.id === id);- if (!group) return;- setVisible(ENTRY_PAGE);- // Roles are cleared with the area: "pipeline brain" means nothing once you- // are looking at the speech layer, and a stale role filter would silently- // empty the new area.- setFilters((f) => ({ ...f, surfaces: [...group.surfaces], roles: [] }));- };-const topSpender = data?.by_provider[0];const rangeMs = Math.max(1, (data?.until_ms ?? 0) - (data?.since_ms ?? 0));const perDay = totals ? totals.cost_usd / Math.max(1, rangeMs / 86_400_000) : 0;@@ -215,21 +193,6 @@ export function CostsView() {}/>- {/* ---------------------------------------------------------------- Which part of the app you are looking at. Roles answer "what kind- of model"; this answers "where" — and the two together are the- question people actually ask ("what does the coding agent cost me").- --------------------------------------------------------------- */}- <div className="flex flex-wrap items-center gap-x-2 gap-y-2">- <AreaSwitch value={area?.id ?? null} onChange={pickArea} />- <RoleFilters- roles={(area ?? SURFACE_GROUPS[0]).roles}- available={data?.facets.roles ?? []}- active={filters.roles}- onToggle={(role) => toggle("roles", role)}- />- </div>-{searchOpen ? (<div className="max-w-sm"><InlineSearch@@ -266,47 +229,21 @@ export function CostsView() {one number without the other hides that.--------------------------------------------------------------- */}<div className="grid gap-3 sm:grid-cols-2 xl:grid-cols-4">- {/*- The headline is everything the work was worth. A subscription seat- did some of it, and that part is named rather than netted out —- hiding it would make the total disagree with every breakdown below.- */}<StatTileicon={<Coins className="h-4 w-4" />}label={t("costs_view.stat_total")}value={money(totals?.cost_usd ?? 0)}- hint={- (totals?.subscription_usd ?? 0) > 0- ? fill(t("costs_view.stat_total_hint_seat"), {- perDay: money(perDay),- seat: money(totals?.subscription_usd ?? 0),- })- : fill(t("costs_view.stat_total_hint"), { perDay: money(perDay) })- }+ hint={fill(t("costs_view.stat_total_hint"), { perDay: money(perDay) })}loading={summary.isLoading}/>- {/*- The headline is in + cached + out. Cache reads bill at their own- rate, so the read model keeps them out of `tokens_in` — naming only- two of the three buckets made the tile look like it could not add- up. The cached term appears only when there is cache to report.- */}<StatTileicon={<Sigma className="h-4 w-4" />}label={t("costs_view.stat_tokens")}value={formatTokens(totals?.tokens_total ?? 0)}- hint={fill(- t(- (totals?.tokens_cached ?? 0) > 0- ? "costs_view.stat_tokens_hint_cached"- : "costs_view.stat_tokens_hint",- ),- {- in: formatTokens(totals?.tokens_in ?? 0),- cached: formatTokens(totals?.tokens_cached ?? 0),- out: formatTokens(totals?.tokens_out ?? 0),- },- )}+ hint={fill(t("costs_view.stat_tokens_hint"), {+ in: formatTokens(totals?.tokens_in ?? 0),+ out: formatTokens(totals?.tokens_out ?? 0),+ })}loading={summary.isLoading}/><StatTile@@ -518,136 +455,6 @@ export function CostsView() {);}-// ----------------------------------------------------------------------------// Which area of the app — and which kind of model inside it-// -----------------------------------------------------------------------------/** One lucide mark per area, so the switch reads without its labels too. */-const AREA_ICONS = {- all: Wallet,- jarvis: Sparkles,- "agentic-ide": Terminal,- "jarvis-voice": AudioLines,-} as const;--/**- * Overall · Jarvis · Agentic IDE · Jarvis Voice.- *- * The same pill the front page uses for Voice/Chat (`home/SurfaceSwitch`) —- * one shape for "which area am I in", wherever the question appears.- *- * `value` is null when a breakdown row produced a surface selection no area- * matches. Nothing is lit then, which is the honest state: the chips under- * the header say what is actually filtered.- */-function AreaSwitch({- value,- onChange,-}: {- value: string | null;- onChange: (id: string) => void;-}) {- const t = useT();- return (- <div- role="tablist"- aria-label={t("costs_view.area_label")}- data-testid="costs-area-switch"- // Hugs its labels on a real window and only goes full width when- // there is no room to sit beside itself — a control stretched across- // 1400px reads as a header bar, not as a choice between four things.- className={cn(- "flex w-full flex-wrap items-center gap-0.5 rounded-xl border border-border bg-secondary p-0.5",- "sm:w-auto sm:flex-nowrap sm:self-start",- )}- >- {SURFACE_GROUPS.map((group) => {- const active = group.id === value;- const Icon = AREA_ICONS[group.id as keyof typeof AREA_ICONS] ?? Wallet;- return (- <button- key={group.id}- type="button"- role="tab"- aria-selected={active}- data-testid={`costs-area-${group.id}`}- onClick={() => onChange(group.id)}- className={cn(- "flex flex-1 items-center justify-center gap-1.5 rounded-[10px] px-3 py-1.5 text-xs font-medium transition-colors sm:flex-none",- "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",- active- ? "bg-card text-foreground shadow-sm"- : "text-muted-foreground hover:text-foreground",- )}- >- <Icon aria-hidden className="h-3.5 w-3.5" />- <span className="truncate">{t(surfaceGroupLabelKey(group.id))}</span>- </button>- );- })}- </div>- );-}--/**- * The roles that can occur in the chosen area, as toggles.- *- * Only roles the data has actually seen are offered — an area that has never- * run shows no chips rather than a row of dead buttons. A single possible- * role is not a choice, so the row hides itself entirely.- */-function RoleFilters({- roles,- available,- active,- onToggle,-}: {- roles: CostRole[];- available: CostRole[];- active: CostRole[];- onToggle: (role: CostRole) => void;-}) {- const t = useT();- const shown = roles.filter((r) => available.includes(r));- if (shown.length < 2) return null;- return (- <div- role="group"- aria-label={t("costs_view.role_filter_label")}- data-testid="costs-role-filters"- className="flex flex-wrap items-center gap-1"- >- <span className="mr-1 hidden h-4 w-px shrink-0 bg-border sm:block" aria-hidden />- {shown.map((role) => {- const on = active.includes(role);- return (- <button- key={role}- type="button"- aria-pressed={on}- data-testid={`costs-role-${role}`}- onClick={() => onToggle(role)}- className={cn(- "inline-flex h-7 items-center gap-1.5 rounded-md px-2.5 text-xs transition-colors",- "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",- on- ? "bg-sheen/[0.08] font-medium text-foreground"- : "text-muted-foreground hover:text-foreground",- )}- >- <span- className="h-2 w-2 shrink-0 rounded-[3px]"- style={{ background: roleColor(role) }}- aria-hidden- />- {t(roleLabelKey(role))}- </button>- );- })}- </div>- );-}-// ---------------------------------------------------------------------------// Active filters// ---------------------------------------------------------------------------@@ -752,15 +559,6 @@ function BreakdownTable({{rows.map((row) => {const isActive = active.includes(row.key);const color = dimension === "role" ? roleColor(row.key) : keyColor(row.key);- // A provider row IS its vendor; a model row belongs to one. Roles and- // surfaces are ours, not a vendor's — they keep the colour chip that- // ties the row to its stack in the chart above.- const logoId =- dimension === "provider"- ? row.key- : dimension === "model"- ? (row.members[0] ?? row.key)- : null;return (<TableRowkey={row.key}@@ -771,15 +569,11 @@ function BreakdownTable({><Cell><div className="flex min-w-0 items-center gap-2.5">- {logoId ? (- <ProviderLogo providerId={logoId} label={row.key} size="sm" />- ) : (- <span- className="h-2.5 w-2.5 shrink-0 rounded-[3px]"- style={{ background: color }}- aria-hidden- />- )}+ <span+ className="h-2.5 w-2.5 shrink-0 rounded-[3px]"+ style={{ background: color }}+ aria-hidden+ /><div className="min-w-0"><div className="truncate font-medium text-foreground">{dimension === "role"diff --git a/jarvis/ui/web/frontend/src/views/JarvisAgentsView.tsx b/jarvis/ui/web/frontend/src/views/JarvisAgentsView.tsxindex d08dc65a8e..b375901094 100644--- a/jarvis/ui/web/frontend/src/views/JarvisAgentsView.tsx+++ b/jarvis/ui/web/frontend/src/views/JarvisAgentsView.tsx@@ -1,26 +1,23 @@/**- * SubAgentsView — live board of all active Jarvis-Agents.+ * JarvisAgentsView — live board of all active Jarvis-Agents.*- * Instead of a ReactFlow canvas with cards, the view now renders a- * train-station departure board (DepartureBoard) that continuously fills- * from the empty standby state to the active drilldown state. All- * tool calls are expandable inline per agent row — no box layout,- * no canvas, everything in one column.+ * This file is the data half: it hydrates the board from the REST snapshot,+ * keeps it live off the mission WebSocket, and sweeps expired nodes. All of+ * the presentation — header, headline numbers, table and per-row drilldown —+ * lives in `DepartureBoard`, which renders it with the shared+ * `components/extensions/primitives` so this section looks like Spend, Skills,+ * Plugins, MCPs and CLIs rather than like a screen of its own.*/-import { Trash2, Users } from "lucide-react";import { useCallback, useEffect, useMemo, useState } from "react";-import { ExplicitSpawnHint } from "@/components/ExplicitSpawnHint";import { useSubAgentStore, type SubAgentTreeSnapshot } from "@/store/jarvisAgents";import { DepartureBoard } from "./sub-agents/DepartureBoard";import { selectTaskRows } from "./sub-agents/rows";import { useMissionWebSocket } from "@/components/missions/useMissionWebSocket";import { useMissionsStore } from "@/components/missions/store";-import { useT } from "@/i18n";import { useSectionHealth } from "@/hooks/useProviders";export function JarvisAgentsView() {- const t = useT();const { health } = useSectionHealth();const subAgents = useSubAgentStore((s) => s.subAgents);const sweepExpired = useSubAgentStore((s) => s.sweepExpired);@@ -86,39 +83,12 @@ export function JarvisAgentsView() {return () => window.clearTimeout(id);}, [missionLastSeq, loadSnapshot]);- const activeCount = nodesList.filter((n) => n.status === "running").length;-return (- <div className="relative h-full w-full flex flex-col bg-background">- <header className="px-4 py-3 border-b border-border flex items-center justify-between shrink-0 z-10 bg-background/80 backdrop-blur">- <div className="flex items-center gap-3">- <Users className="h-5 w-5 text-sky-600 dark:text-sky-400" />- <div>- <div className="text-sm font-semibold text-foreground">{t("subagents_view.title")}</div>- <div className="text-[11px] text-muted-foreground">- {activeCount} {t("subagents_view.stat_active")} · {nodesList.length} {t("subagents_view.stat_total")}- </div>- </div>- </div>- <button- onClick={() => clear()}- className="text-xs px-2 py-1 rounded border border-border bg-secondary text-secondary-foreground hover:bg-sheen/[0.08] flex items-center gap-1.5"- title={t("subagents_view.clear_tooltip")}- >- <Trash2 className="h-3 w-3" />- {t("subagents_view.clear")}- </button>- </header>-- <ExplicitSpawnHint className="shrink-0 border-b border-border bg-sheen/[0.03]" />-- <div className="flex-1 relative overflow-hidden">- <DepartureBoard- agents={nodesList}- snapshotError={snapshotError}- health={health["subagents"] ?? null}- />- </div>- </div>+ <DepartureBoard+ agents={nodesList}+ snapshotError={snapshotError}+ health={health["subagents"] ?? null}+ onClear={() => clear()}+ />);}diff --git a/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.test.tsx b/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.test.tsxindex edee147543..decdb85cb3 100644--- a/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.test.tsx+++ b/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.test.tsx@@ -10,7 +10,7 @@ type JarvisAgentNode = NonNullable<ComponentProps<typeof DepartureBoard>["agents"]>[number];-function cancelledNode(): JarvisAgentNode {+function node(over: Partial<JarvisAgentNode> = {}): JarvisAgentNode {return {trace_id: "mission-cancelled",kind: "jarvis_agent",@@ -33,19 +33,114 @@ function cancelledNode(): JarvisAgentNode {review_iterations: 0,depth: 0,ui_appeared_at: 1,+ ...over,};}+/**+ * The headline tile carrying `label`, so its number can be asserted.+ *+ * Addressed by its group role, not by its text: "Failed" is both a tile label+ * and a row status, so a plain text lookup matches two nodes as soon as one+ * agent actually failed.+ */+function tile(label: string): HTMLElement {+ return screen.getByRole("group", { name: label });+}+describe("DepartureBoard cancellation status", () => {it("renders cancellation distinctly and does not count it as failed", () => {- render(<DepartureBoard agents={[cancelledNode()]} />);+ render(<DepartureBoard agents={[node()]} />);++ const row = screen.getByRole("row", { name: /cancelled mission/i });+ expect(within(row).getByText("Cancelled")).toBeTruthy();+ expect(within(row).queryByText("Failed")).toBeNull();++ // A cancellation is a decision, not a fault: the Failed tile stays at 0+ // and the Done tile does not absorb it either.+ expect(within(tile("Failed")).getByText("0")).toBeTruthy();+ expect(within(tile("Done")).getByText("0")).toBeTruthy();+ });++ it("counts a real failure in the Failed tile", () => {+ render(+ <DepartureBoard+ agents={[node({ trace_id: "m-failed", status: "failed", utterance: "Broken mission" })]}+ />,+ );++ expect(within(tile("Failed")).getByText("1")).toBeTruthy();+ const row = screen.getByRole("row", { name: /broken mission/i });+ expect(within(row).getByText("Failed")).toBeTruthy();+ });+});++describe("DepartureBoard empty state", () => {+ it("says nothing is running rather than showing an empty table", () => {+ render(<DepartureBoard agents={[]} />);++ expect(screen.getByText(/no .*-agents are running right now/i)).toBeTruthy();+ expect(screen.queryByRole("row", { name: /mission/i })).toBeNull();+ });+});++describe("DepartureBoard drilldown", () => {+ it("opens a running agent's tool calls and details inline", () => {+ render(+ <DepartureBoard+ agents={[+ node({+ trace_id: "m-running",+ status: "running",+ utterance: "Audit the release notes",+ duration_ms: null,+ error: null,+ context_hints: ["docs/CHANGELOG.md"],+ tool_calls: [+ {+ tool_name: "Grep",+ args_preview: "pattern=BUG-",+ started_ns: 1,+ output_preview: "",+ status: "completed",+ duration_ms: 1200,+ },+ ],+ }),+ ]}+ />,+ );++ // A running agent with tool calls opens itself — the operator should not+ // have to click to see what is happening right now.+ expect(screen.getByText("Grep")).toBeTruthy();+ expect(screen.getByText("pattern=BUG-")).toBeTruthy();+ expect(screen.getByText("docs/CHANGELOG.md")).toBeTruthy();+ expect(screen.getByText(/trace m-running/)).toBeTruthy();++ // The drilldown is a table row, so the grid it sits in stays valid.+ const rows = screen.getAllByRole("row");+ expect(rows.length).toBeGreaterThan(2);+ });- const row = screen.getByRole("button", { name: /cancelled mission/i });- expect(within(row).getByText("CANCELLED")).toBeTruthy();- expect(within(row).queryByText("FAILED")).toBeNull();+ it("leaves an agent with nothing to show collapsed and unclickable", () => {+ render(+ <DepartureBoard+ agents={[+ node({+ trace_id: "m-bare",+ status: "completed",+ utterance: "Nothing to drill into",+ error: null,+ prompts: [],+ tool_calls: [],+ }),+ ]}+ />,+ );- const failedMetric = screen.getByText("Failed").parentElement;- expect(failedMetric).not.toBeNull();- expect(within(failedMetric as HTMLElement).getByText("0")).toBeTruthy();+ const row = screen.getByRole("row", { name: /nothing to drill into/i });+ expect(row.getAttribute("tabindex")).toBeNull();+ expect(screen.queryByText(/trace m-bare/)).toBeNull();});});diff --git a/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.tsx b/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.tsxindex 48ecc0b7a7..587d4c8e71 100644--- a/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.tsx+++ b/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.tsx@@ -1,6 +1,27 @@-import { useEffect, useMemo, useState } from "react";+/**+ * The agent board — every {name}-Agent the assistant has started, what it is+ * working on, and what it left behind.+ *+ * Same surface as Spend, Skills, Plugins, MCPs and CLIs: one column of quiet+ * panels built from `components/extensions/primitives`, so this section cannot+ * drift into a look of its own. It replaces the "departure board" — a+ * train-station metaphor rendered as an edge-to-edge hairline metric strip, a+ * hand-built 1040px grid and monospace in every cell, which was the last screen+ * still wearing a look no other section wears. A finished agent said "arrived",+ * the way a train does; it now says "done", the way a task does.+ *+ * The content is unchanged: the same five numbers, the same seven columns, the+ * same inline drilldown per row. What changed is that they are rendered by the+ * shared primitives and that every visible string goes through i18n — the old+ * board hard-coded its English, so a German or Spanish UI still read "Tool+ * calls / In progress / No agents are running right now."+ *+ * The brand comes from `agentBrand`, so the board follows whatever wake word is+ * configured rather than a product name (see lib/agentBrand.ts).+ */+import { Fragment, useEffect, useMemo, useState } from "react";import {- Activity,+ AlertTriangle,Bot,CheckCircle2,ChevronDown,@@ -8,44 +29,51 @@ import {CircleAlert,Radio,TerminalSquare,- type LucideIcon,+ Trash2,Wrench,} from "lucide-react";import type { SubAgentNode, ToolCallEntry } from "@/store/jarvisAgents";import type { SectionHealth } from "@/hooks/useProviders";+import { ExplicitSpawnHint } from "@/components/ExplicitSpawnHint";+import { ScrollArea } from "@/components/ui/scroll-area";+import {+ Cell,+ type Column,+ IconButton,+ Panel,+ PanelHeader,+ StatTile,+ StatusDot,+ Table,+ TableHead,+ TableRow,+} from "@/components/extensions/primitives";import { agentBrand, agentsBrand } from "@/lib/agentBrand";import { cn } from "@/lib/utils";import { useEventStore } from "@/store/events";-import { useT } from "@/i18n";+import { fill, useT } from "@/i18n";import { failureLabel } from "./failureLabel";-// Emerald and amber carry meaning the token set has no name for ("finished-// cleanly" / "stopped on purpose"), so they stay literal — but each needs its-// own value per theme: the 400 shades are tuned to glow on black and drop to-// ~2:1 on paper, which is a status nobody can read.-const STATUS_COLOR: Record<SubAgentNode["status"], string> = {- running: "text-primary",- completed: "text-emerald-600 dark:text-emerald-400",- failed: "text-destructive",- cancelled: "text-amber-600 dark:text-amber-400",-};--const STATUS_LABEL: Record<SubAgentNode["status"], string> = {- running: "ACTIVE",- completed: "DONE",- failed: "FAILED",- cancelled: "CANCELLED",+// The four run states map onto the shared StatusDot tones: a running agent is+// the app's own "busy" (brand primary), a finished one is the token set's+// success green, a failure is `destructive`, and a deliberate stop is a warning+// rather than an error — it is a decision, not a fault.+const STATUS_TONE: Record<SubAgentNode["status"], "busy" | "ok" | "error" | "warn"> = {+ running: "busy",+ completed: "ok",+ failed: "error",+ cancelled: "warn",};-const TOOL_STATUS_LABEL: Record<ToolCallEntry["status"], string> = {- running: "RUNNING",- completed: "DONE",- failed: "FAILED",+const TOOL_STATUS_TONE: Record<ToolCallEntry["status"], "busy" | "ok" | "error"> = {+ running: "busy",+ completed: "ok",+ failed: "error",};function formatRelative(ms: number): string {- if (!Number.isFinite(ms) || ms < 0) return "-";+ if (!Number.isFinite(ms) || ms < 0) return "—";if (ms < 1000) return `${Math.floor(ms)}ms`;if (ms < 60_000) return `${Math.floor(ms / 1000)}s`;if (ms < 3_600_000) return `${Math.floor(ms / 60_000)}m`;@@ -61,7 +89,7 @@ function startedMs(node: SubAgentNode): number {function runtimeLabel(node: SubAgentNode, nowMs: number): string {if (node.duration_ms != null) return formatRelative(node.duration_ms);if (node.status === "running") return formatRelative(nowMs - startedMs(node));- return "-";+ return "—";}// User-facing role label only. The underlying engine, provider and model are@@ -71,12 +99,12 @@ function runtimeLabel(node: SubAgentNode, nowMs: number): string {// vs. harness == the worker subprocess) and is never shown raw — see the// subtitle below. The concrete "what is it doing" lives in the Task/Project// column (`taskLabel`).-function displayAgentName(node: SubAgentNode, assistantName: string): string {- return node.kind === "harness" ? "Worker" : agentBrand(assistantName);+function displayAgentName(node: SubAgentNode, assistantName: string, t: (key: string) => string): string {+ return node.kind === "harness" ? t("subagents_view.role_worker") : agentBrand(assistantName);}-function taskLabel(node: SubAgentNode): string {- return node.utterance || node.context_hints.at(0) || node.prompts.at(0) || "-";+function taskLabel(node: SubAgentNode, t: (key: string) => string): string {+ return node.utterance || node.context_hints.at(0) || node.prompts.at(0) || t("subagents_view.task_none");}function resultLabel(node: SubAgentNode, t: (key: string) => string): string {@@ -84,18 +112,24 @@ function resultLabel(node: SubAgentNode, t: (key: string) => string): string {if (failure) return failure;const summary = [...node.prompts].reverse().find((p) => p.startsWith("[summary] "));if (summary) return summary.replace("[summary] ", "");- if (node.status === "completed") return "Done";- if (node.status === "running") return "In progress";- return "-";+ if (node.status === "completed") return t("subagents_view.result_done");+ if (node.status === "running") return t("subagents_view.result_running");+ return "—";}interface Props {agents?: SubAgentNode[];snapshotError?: string | null;health?: SectionHealth | null;+ onClear?: () => void;}-export function DepartureBoard({ agents = [], snapshotError = null, health = null }: Props) {+export function DepartureBoard({+ agents = [],+ snapshotError = null,+ health = null,+ onClear,+}: Props) {const t = useT();const assistantName = useEventStore((s) => s.assistantName);const [nowMs, setNowMs] = useState(() => Date.now());@@ -129,6 +163,10 @@ export function DepartureBoard({ agents = [], snapshotError = null, health = nulconst doneCount = agents.filter((a) => a.status === "completed").length;const failedCount = agents.filter((a) => a.status === "failed").length;const toolCount = agents.reduce((sum, a) => sum + a.tool_calls.length, 0);+ const runningTools = agents.reduce(+ (sum, a) => sum + a.tool_calls.filter((c) => c.status === "running").length,+ 0,+ );const toggle = (traceId: string) =>setExpanded((prev) => {@@ -138,279 +176,373 @@ export function DepartureBoard({ agents = [], snapshotError = null, health = nulreturn next;});+ const columns: Column[] = [+ { id: "expand", label: t("subagents_view.col_expand"), width: "22px", srOnly: true },+ { id: "agent", label: t("subagents_view.col_agent"), width: "minmax(0, 1.1fr)" },+ { id: "task", label: t("subagents_view.col_task"), width: "minmax(0, 2.4fr)" },+ { id: "status", label: t("subagents_view.col_status"), width: "124px" },+ { id: "tools", label: t("subagents_view.col_tools"), width: "62px", align: "right" },+ { id: "runtime", label: t("subagents_view.col_runtime"), width: "76px", align: "right" },+ { id: "result", label: t("subagents_view.col_result"), width: "minmax(0, 1.4fr)" },+ ];+return (- <div className="agents-board-stage flex h-full w-full flex-col overflow-hidden">- {/* `gap-px` on a bordered ground: the gaps between the metric cells ARE- the hairlines, so this background is the divider colour. */}- <div className="grid grid-cols-2 gap-px border-b border-border bg-border md:grid-cols-5">- <Metric label={agentsBrand(assistantName)} value={agents.length.toString()} icon={Bot} />- <Metric label="Active" value={activeCount.toString()} icon={Radio} tone="primary" />- <Metric label="Done" value={doneCount.toString()} icon={CheckCircle2} tone="success" />- <Metric label="Failed" value={failedCount.toString()} icon={Activity} tone={failedCount ? "danger" : "muted"} />- <Metric label="Tool calls" value={toolCount.toString()} icon={Wrench} />- </div>+ <div className="flex h-full min-h-0 flex-col">+ <ScrollArea className="flex-1">+ <div className="mx-auto flex w-full max-w-[1180px] flex-col gap-4 px-6 py-6">+ <PanelHeader+ title={t("subagents_view.title")}+ subtitle={fill(t("subagents_view.subtitle"), {+ active: activeCount,+ total: agents.length,+ })}+ actions={+ onClear ? (+ <IconButton+ label={t("subagents_view.clear_tooltip")}+ onClick={onClear}+ disabled={agents.length === 0}+ >+ <Trash2 className="h-4 w-4" />+ </IconButton>+ ) : null+ }+ />- <div className="flex min-h-0 flex-1 flex-col px-5 py-4">- <div className="mb-3 flex items-center justify-between gap-4">- <div>- <div className="font-mono text-[11px] uppercase tracking-[0.32em] text-primary/80">- {agentBrand(assistantName)} operations board- </div>- <div className="mt-1 text-xs text-muted-foreground">- Live table from the {agentBrand(assistantName)} backend registry and WebSocket events.- </div>- </div>- <div className="flex items-center gap-2 rounded-full border border-primary/20 bg-primary/5 px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.22em] text-primary">- <span className="h-1.5 w-1.5 rounded-full bg-primary animate-jarvis-pulse" />- {activeCount > 0 ? "live" : "standby"}- </div>- </div>+ {health && (health.status === "needs_setup" || health.status === "error") && (+ <Notice tone={health.status === "error" ? "error" : "warn"}>+ <span className="font-medium">+ {t(+ health.status === "error"+ ? "subagents_view.health_error"+ : "subagents_view.health_degraded",+ )}+ </span>+ {health.detail ? <span className="opacity-80">{health.detail}</span> : null}+ </Notice>+ )}- {health && (health.status === "needs_setup" || health.status === "error") && (- <div- className={cn(- "mb-3 flex items-center gap-2 rounded-md border px-3 py-2 text-xs",- health.status === "error"- ? "border-destructive/30 bg-destructive/10 text-destructive"- : "border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",- )}- >- <CircleAlert className="h-4 w-4 shrink-0" />- <span className="font-medium">- {t(- health.status === "error"- ? "subagents_view.health_error"- : "subagents_view.health_degraded",- )}- </span>- <span className="opacity-80">{health.detail}</span>- </div>- )}+ {snapshotError && (+ <Notice tone="error">+ {fill(t("subagents_view.snapshot_error"), { detail: snapshotError })}+ </Notice>+ )}- {snapshotError && (- <div className="mb-3 flex items-center gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive">- <CircleAlert className="h-4 w-4" />- {agentBrand(assistantName)} snapshot could not be loaded: {snapshotError}+ {/* ---------------------------------------------------------------+ Headline numbers. Failed keeps its own tile rather than hiding+ inside "Done": a run that ended and a run that broke are not the+ same outcome, and a cancellation is neither.+ --------------------------------------------------------------- */}+ <div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5">+ <StatTile+ icon={<Bot className="h-4 w-4" />}+ label={agentsBrand(assistantName)}+ value={String(agents.length)}+ hint={t("subagents_view.stat_agents_hint")}+ />+ <StatTile+ icon={<Radio className="h-4 w-4" />}+ label={t("subagents_view.stat_active_label")}+ value={String(activeCount)}+ tone={activeCount > 0 ? "primary" : "ok"}+ hint={+ runningTools > 0+ ? fill(t("subagents_view.stat_active_hint"), { tools: runningTools })+ : t("subagents_view.stat_active_hint_idle")+ }+ />+ <StatTile+ icon={<CheckCircle2 className="h-4 w-4" />}+ label={t("subagents_view.stat_done_label")}+ value={String(doneCount)}+ tone={doneCount > 0 ? "success" : "ok"}+ hint={t("subagents_view.stat_done_hint")}+ />+ <StatTile+ icon={<AlertTriangle className="h-4 w-4" />}+ label={t("subagents_view.stat_failed_label")}+ value={String(failedCount)}+ tone={failedCount > 0 ? "danger" : "ok"}+ hint={+ failedCount > 0+ ? t("subagents_view.stat_failed_hint")+ : t("subagents_view.stat_failed_hint_none")+ }+ />+ <StatTile+ icon={<Wrench className="h-4 w-4" />}+ label={t("subagents_view.stat_tools_label")}+ value={String(toolCount)}+ hint={t("subagents_view.stat_tools_hint")}+ /></div>- )}- <div className="min-h-0 flex-1 overflow-auto rounded-lg border border-border bg-card/70 scrollbar-jarvis">- <div className="min-w-[1040px]">- <BoardHeader />- {sortedAgents.length === 0 ? (- <EmptyState />- ) : (- <div className="divide-y divide-border">- {sortedAgents.map((agent) => (- <AgentRow- key={agent.trace_id}- agent={agent}- nowMs={nowMs}- expanded={expanded.has(agent.trace_id)}- onToggle={() => toggle(agent.trace_id)}- t={t}+ {/* The board ---------------------------------------------------- */}+ <Panel>+ <div className="px-4 pt-4">+ <PanelHeader+ title={t("subagents_view.board_title")}+ subtitle={t("subagents_view.board_subtitle")}+ actions={+ <StatusDot+ tone={activeCount > 0 ? "busy" : "off"}+ pulse={activeCount > 0}+ label={t(+ activeCount > 0+ ? "subagents_view.live_label"+ : "subagents_view.standby_label",+ )}/>- ))}+ }+ />+ </div>++ {/* The seven columns need room; below that width the table scrolls+ inside the panel rather than pushing the page sideways. */}+ <div className="mt-3 overflow-x-auto">+ <div className="min-w-[820px]">+ <Table label={t("subagents_view.board_title")}>+ <TableHead columns={columns} />+ {sortedAgents.length === 0 ? (+ // No dashed frame here: the panel already draws one, and a+ // second rule inside it reads as an empty input rather than+ // as a calm "nothing yet".+ <div className="flex flex-col items-center px-8 py-14 text-center">+ <Bot className="mb-3.5 h-7 w-7 text-muted-foreground/60" />+ <div className="font-display text-[15px] font-semibold text-foreground">+ {fill(t("subagents_view.empty_title"), {+ agents: agentsBrand(assistantName),+ })}+ </div>+ <p className="mt-1.5 max-w-lg text-sm text-muted-foreground">+ {fill(t("subagents_view.empty_body"), {+ agent: agentBrand(assistantName),+ })}+ </p>+ </div>+ ) : (+ sortedAgents.map((agent) => (+ <AgentRow+ key={agent.trace_id}+ agent={agent}+ columns={columns}+ nowMs={nowMs}+ expanded={expanded.has(agent.trace_id)}+ onToggle={() => toggle(agent.trace_id)}+ t={t}+ />+ ))+ )}+ </Table></div>- )}- </div>+ </div>+ </Panel>++ <ExplicitSpawnHint className="px-1" /></div>- </div>+ </ScrollArea></div>);}-function Metric({- label,- value,- icon: Icon,- tone = "muted",+// ---------------------------------------------------------------------------+// Notice — the health / snapshot banners+// ---------------------------------------------------------------------------++function Notice({+ tone,+ children,}: {- label: string;- value: string;- icon: LucideIcon;- tone?: "muted" | "primary" | "success" | "danger";+ tone: "warn" | "error";+ children: React.ReactNode;}) {return (- <div className="flex min-w-0 items-center gap-3 bg-background px-4 py-3">- <Icon- className={cn(- "h-4 w-4 shrink-0",- tone === "primary" && "text-primary",- tone === "success" && "text-emerald-600 dark:text-emerald-400",- tone === "danger" && "text-destructive",- tone === "muted" && "text-muted-foreground",- )}- />- <div className="min-w-0">- <div className="truncate font-mono text-[10px] uppercase tracking-[0.18em] text-muted-foreground">- {label}- </div>- <div className="truncate text-sm font-semibold text-foreground">{value}</div>- </div>- </div>- );-}--function BoardHeader() {- const assistantName = useEventStore((s) => s.assistantName);- return (- <div className="sticky top-0 z-10 grid grid-cols-[44px_1.4fr_3fr_0.85fr_0.7fr_0.8fr_1.4fr] gap-4 border-b border-border bg-card/95 px-4 py-3 font-mono text-[10px] uppercase tracking-[0.18em] text-muted-foreground backdrop-blur">- <span />- <span>{agentBrand(assistantName)}</span>- <span>Task / Project</span>- <span>Status</span>- <span>Tools</span>- <span>Runtime</span>- <span>Result</span>+ <div+ className={cn(+ "flex items-center gap-2 rounded-xl border px-3.5 py-2.5 text-sm",+ tone === "error"+ ? "border-destructive/30 bg-destructive/10 text-destructive"+ : "border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",+ )}+ >+ <CircleAlert className="h-4 w-4 shrink-0" />+ <span className="min-w-0 flex-1 truncate">{children}</span></div>);}-function EmptyState() {- const assistantName = useEventStore((s) => s.assistantName);- return (- <div className="flex min-h-[420px] flex-col items-center justify-center px-8 text-center">- <Bot className="mb-4 h-8 w-8 text-muted-foreground/70" />- <div className="font-display text-base font-semibold text-foreground">- No {agentsBrand(assistantName)} are running right now.- </div>- <p className="mt-2 max-w-lg text-sm text-muted-foreground">- When {assistantName} starts a real {agentBrand(assistantName)}, it will appear here with- its task, status, tool calls, runtime and result.- </p>- </div>- );-}+// ---------------------------------------------------------------------------+// One agent, plus its drilldown+// ---------------------------------------------------------------------------function AgentRow({agent,+ columns,nowMs,expanded,onToggle,t,}: {agent: SubAgentNode;+ columns: Column[];nowMs: number;expanded: boolean;onToggle: () => void;t: (key: string) => string;}) {const assistantName = useEventStore((s) => s.assistantName);- const hasDrilldown = agent.tool_calls.length > 0 || agent.error || agent.prompts.length > 0;+ const hasDrilldown = agent.tool_calls.length > 0 || !!agent.error || agent.prompts.length > 0;+ const task = taskLabel(agent, t);+ const result = resultLabel(agent, t);return (- <div>- <button- type="button"- disabled={!hasDrilldown}+ <Fragment>+ <TableRow+ columns={columns}onClick={hasDrilldown ? onToggle : undefined}- className={cn(- "grid w-full grid-cols-[44px_1.4fr_3fr_0.85fr_0.7fr_0.8fr_1.4fr] gap-4 px-4 py-3.5 text-left font-mono text-xs tabular-nums",- hasDrilldown && "transition-colors hover:bg-sheen/[0.05]",- )}+ selected={expanded}+ ariaLabel={task}>- <span className="flex items-center text-muted-foreground">+ <Cell className="text-muted-foreground">{hasDrilldown ? (- expanded ? <ChevronDown className="h-4 w-4" /> : <ChevronRight className="h-4 w-4" />- ) : (- <span className="pl-1">-</span>- )}- </span>- <span className="min-w-0">- <span className="block truncate text-foreground">- {displayAgentName(agent, assistantName)}+ expanded ? (+ <ChevronDown className="h-4 w-4" />+ ) : (+ <ChevronRight className="h-4 w-4" />+ )+ ) : null}+ </Cell>+ <Cell>+ <div className="truncate text-[15px] font-medium text-foreground">+ {displayAgentName(agent, assistantName, t)}+ </div>+ <div className="truncate text-xs text-muted-foreground">+ {agent.kind === "harness"+ ? t("subagents_view.role_worker_hint")+ : t("subagents_view.role_agent_hint")}+ </div>+ </Cell>+ <Cell muted>+ <span className="block truncate" title={task}>+ {task}</span>- <span className="block truncate text-[10px] uppercase tracking-[0.16em] text-muted-foreground">- {agent.kind === "harness" ? "worker" : agentBrand(assistantName).toLowerCase()}+ </Cell>+ <Cell>+ <StatusDot+ tone={STATUS_TONE[agent.status]}+ pulse={agent.status === "running"}+ label={t(`subagents_view.status.${agent.status}`)}+ />+ </Cell>+ <Cell align="right" muted>+ <span className="tabular-nums">{agent.tool_calls.length}</span>+ </Cell>+ <Cell align="right" muted>+ <span className="tabular-nums">{runtimeLabel(agent, nowMs)}</span>+ </Cell>+ <Cell muted>+ <span className="block truncate" title={result}>+ {result}</span>- </span>- <span className="truncate text-muted-foreground" title={taskLabel(agent)}>- {taskLabel(agent)}- </span>- <span className={cn("flex items-center gap-2", STATUS_COLOR[agent.status])}>- {agent.status === "running" && <span className="h-1.5 w-1.5 rounded-full bg-primary animate-jarvis-pulse" />}- {STATUS_LABEL[agent.status]}- </span>- <span className="text-muted-foreground">{agent.tool_calls.length}</span>- <span className="text-muted-foreground">{runtimeLabel(agent, nowMs)}</span>- <span className="truncate text-muted-foreground" title={resultLabel(agent, t)}>- {resultLabel(agent, t)}- </span>- </button>-- {expanded && hasDrilldown && (- <div className="border-t border-border bg-sheen/[0.03] px-4 pb-4 pt-3">- <div className="grid grid-cols-[1.35fr_1fr] gap-4">- <div className="min-w-0 rounded-md border border-border bg-card/60">- <div className="flex items-center gap-2 border-b border-border px-3 py-2 font-mono text-[10px] uppercase tracking-[0.18em] text-muted-foreground">- <TerminalSquare className="h-3.5 w-3.5 text-primary" />- Tool calls+ </Cell>+ </TableRow>++ {expanded && hasDrilldown && <Drilldown agent={agent} task={task} t={t} />}+ </Fragment>+ );+}++/**+ * The expanded half of a row.+ *+ * `role="row"` with a single `role="cell"` rather than a bare `<div>`: the+ * parent is `role="table"`, which accepts only rows as children, and a div+ * table has no colspan to widen a cell with.+ */+function Drilldown({+ agent,+ task,+ t,+}: {+ agent: SubAgentNode;+ task: string;+ t: (key: string) => string;+}) {+ const assistantName = useEventStore((s) => s.assistantName);+ const failure = failureLabel(agent, t);++ return (+ <div role="row" className="border-b border-border/70 bg-sheen/[0.04] last:border-b-0">+ <div role="cell" className="px-3 py-3.5">+ <div className="grid gap-3 lg:grid-cols-[1.4fr_1fr]">+ <Panel className="bg-card/60">+ <div className="flex items-center gap-2 border-b border-border px-3 py-2 text-xs font-medium text-muted-foreground">+ <TerminalSquare className="h-3.5 w-3.5 text-primary" />+ {t("subagents_view.drill_tools")}+ </div>+ {agent.tool_calls.length > 0 ? (+ <div className="divide-y divide-border/70">+ {agent.tool_calls.map((call, idx) => (+ <ToolCallRow key={`${agent.trace_id}-${idx}`} call={call} t={t} />+ ))}</div>- {agent.tool_calls.length > 0 ? (- <div className="divide-y divide-border">- {agent.tool_calls.map((call, idx) => (- <ToolCallRow key={`${agent.trace_id}-${idx}`} call={call} />+ ) : (+ <div className="px-3 py-3 text-sm text-muted-foreground">+ {t("subagents_view.drill_tools_empty")}+ </div>+ )}+ </Panel>++ <Panel className="bg-card/60">+ <div className="border-b border-border px-3 py-2 text-xs font-medium text-muted-foreground">+ {fill(t("subagents_view.drill_details"), { agent: agentBrand(assistantName) })}+ </div>+ <div className="space-y-2.5 px-3 py-3 text-sm text-muted-foreground">+ <p className="line-clamp-4 text-foreground/85">{task}</p>+ {agent.context_hints.length > 0 && (+ <div className="flex flex-wrap gap-1.5">+ {agent.context_hints.slice(0, 5).map((hint) => (+ <span+ key={hint}+ className="inline-flex h-6 items-center rounded-md border border-border bg-card/60 px-2 text-[11px] text-foreground/80"+ >+ {hint}+ </span>))}</div>- ) : (- <div className="px-3 py-3 font-mono text-xs text-muted-foreground">- No tool calls recorded.- </div>)}+ {failure && <p className="text-destructive">{failure}</p>}+ <p className="font-mono text-[11px] text-muted-foreground/70">+ {fill(t("subagents_view.drill_trace"), { trace: agent.trace_id.slice(0, 10) })}+ </p></div>-- <div className="min-w-0 rounded-md border border-border bg-card/60">- <div className="border-b border-border px-3 py-2 font-mono text-[10px] uppercase tracking-[0.18em] text-muted-foreground">- {agentBrand(assistantName)} details- </div>- <div className="space-y-2 px-3 py-3 font-mono text-xs text-muted-foreground">- <div className="line-clamp-4">{taskLabel(agent)}</div>- {agent.context_hints.length > 0 && (- <div className="flex flex-wrap gap-1.5">- {agent.context_hints.slice(0, 5).map((hint) => (- <span key={hint} className="rounded border border-primary/20 bg-primary/5 px-2 py-0.5 text-[10px] text-primary/80">- {hint}- </span>- ))}- </div>- )}- {failureLabel(agent, t) && (- <div className="text-destructive">{failureLabel(agent, t)}</div>- )}- <div className="text-[10px] uppercase tracking-[0.16em] text-muted-foreground/70">- trace {agent.trace_id.slice(0, 10)}- </div>- </div>- </div>- </div>+ </Panel></div>- )}+ </div></div>);}-function ToolCallRow({ call }: { call: ToolCallEntry }) {+function ToolCallRow({ call, t }: { call: ToolCallEntry; t: (key: string) => string }) {return (- <div className="grid grid-cols-[1fr_110px_90px] gap-3 px-3 py-2.5 font-mono text-xs tabular-nums">+ <div className="grid grid-cols-[minmax(0,1fr)_64px_96px] items-center gap-3 px-3 py-2.5 text-sm"><div className="min-w-0">- <div className="truncate text-foreground">{call.tool_name || "tool"}</div>- <div className="truncate text-[11px] text-muted-foreground" title={call.args_preview}>- {call.args_preview || call.output_preview || "-"}+ <div className="truncate font-medium text-foreground">+ {call.tool_name || t("subagents_view.tool_unnamed")}+ </div>+ <div className="truncate text-xs text-muted-foreground" title={call.args_preview}>+ {call.args_preview || call.output_preview || "—"}</div></div>- <div className="text-muted-foreground">- {call.duration_ms != null ? formatRelative(call.duration_ms) : "-"}+ <div className="text-right text-xs tabular-nums text-muted-foreground">+ {call.duration_ms != null ? formatRelative(call.duration_ms) : "—"}</div>- <div- className={cn(- "text-right",- call.status === "running" && "text-primary",- call.status === "completed" && "text-emerald-600 dark:text-emerald-400",- call.status === "failed" && "text-destructive",- )}- >- {TOOL_STATUS_LABEL[call.status]}+ <div className="flex justify-end">+ <StatusDot+ tone={TOOL_STATUS_TONE[call.status]}+ pulse={call.status === "running"}+ label={t(`subagents_view.tool_status.${call.status}`)}+ /></div></div>);