Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(agents): the insight page explains a run in sentences, and every row opens one

rubenluetke10-beepa1bb96a14409
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index 360fab0a9c..d6ea5a97c9 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -720,7 +720,6 @@
"board_subtitle": "Live aus der Backend-Registry und dem Mission-WebSocket.",
"live_label": "Live",
"standby_label": "Standby",
- "col_expand": "Zeile ausklappen",
"col_agent": "{name}-Agent",
"col_task": "Aufgabe / Projekt",
"col_status": "Status",
@@ -739,10 +738,6 @@
"empty_body": "Sobald {name} einen echten {agent} startet, erscheint er hier mit Aufgabe, Status, Tool-Aufrufen, Laufzeit und Ergebnis.",
"snapshot_error": "Die Tafel konnte nicht geladen werden: {detail}",
"history_error": "Der Verlauf konnte nicht geladen werden — angezeigt wird nur, was gerade läuft.",
- "drill_tools": "Tool-Aufrufe",
- "drill_tools_empty": "Keine Tool-Aufrufe erfasst.",
- "drill_details": "{agent} – Details",
- "drill_trace": "Trace {trace}",
"tool_unnamed": "Tool",
"tool_status": {
"running": "Läuft",
@@ -763,26 +758,12 @@
"provider_unreachable": "Anbieter vorübergehend nicht erreichbar.",
"worker_timeout": "Der Worker hat das Zeitlimit überschritten."
},
- "insight_byline": "{agent} · gestartet {started} · Laufzeit {runtime}",
"insight_loading": "Der Verlauf des Laufs wird gelesen…",
"insight_load_error": "Der Verlauf des Laufs konnte nicht geladen werden: {detail}",
"action_open_output": "Ergebnis öffnen",
"action_map": "Missionskarte",
"no_output_dir": "Ausgabeordner liegt nicht mehr auf der Platte",
- "tabs_label": "Laufprotokoll",
- "tab_story": "Verlauf",
- "tab_transcript": "Transkript",
- "tab_review": "Prüfung",
- "tab_output": "Ergebnis",
- "stat_workers_label": "Worker",
- "stat_workers_hint_none": "keiner gestartet",
- "stat_tools_hint_run": "Aktionen in diesem Lauf",
- "stat_reviews_label": "Prüfungen",
- "stat_reviews_hint_none": "keine Überarbeitungsrunde",
- "stat_reviews_hint_revisions": "{n} Überarbeitungsrunde(n)",
"stat_cost_label": "Kosten",
- "stat_cost_hint_tokens": "{n} Tokens",
- "stat_cost_hint_none": "kein Verbrauch gemeldet",
"outcome": {
"running": "Arbeitet noch",
"approved": "Geliefert",
@@ -790,32 +771,6 @@
"cancelled": "Absichtlich gestoppt",
"timed_out": "Zeit abgelaufen"
},
- "outcome_hint": {
- "running": "Das Protokoll unten wächst, sobald der Agent sich meldet.",
- "failed": "Hier steht, was kaputtging — mit den Worten des Anbieters und des Prüfers, wo sie welche hinterlassen haben.",
- "cancelled": "Jemand hat diesen Lauf gestoppt, bevor er fertig war.",
- "timed_out": "Der Lauf hat seine Frist überschritten, bevor er liefern konnte."
- },
- "outcome_approved_hint": "Geprüft und abgenommen · {n} gelieferte Datei(en)",
- "line_reason": "Warum",
- "line_error_class": "Ursache",
- "line_provider_said": "Anbieter meldete",
- "line_provider": "Anbieter",
- "line_worker_stopped": "Worker gestoppt",
- "line_worker_stopped_iter": "Worker (Runde {n}) gestoppt",
- "line_reviewer": "Prüfer: {verdict}",
- "line_correction": "Korrektur verlangt",
- "line_last_state": "Abbruch während",
- "line_partial": "Behalten",
- "line_partial_text": "{n} Teil-Datei(en) sind erhalten und unter Ergebnis gelistet",
- "line_deadline": "Frist",
- "line_cascade": "Kaskade",
- "line_cascade_text": "der laufende Worker wurde mit beendet",
- "line_summary": "Zusammenfassung",
- "line_revisions": "Überarbeitungen",
- "line_revisions_text": "abgenommen nach {n} Überarbeitungsrunde(n)",
- "line_progress": "Fortschritt",
- "line_progress_text": "bisher {n} Meldungen",
"verdict": {
"approve": "abgenommen",
"revise": "überarbeiten",
@@ -849,27 +804,22 @@
"dispatched": "Auftrag an den {agent} übergeben",
"plan": "Plan steht · {n} Worker",
"spawn": "Worker gestartet · {cli} · Runde {iter}",
- "narration": "{agent} sagt",
- "draft": "Entwurf an den Prüfer übergeben · {n} Diff-Zeilen",
- "verdict": "Prüfer: {verdict} · {confidence}",
- "correction": "Überarbeitung verlangt",
- "correction_model": "Überarbeitung verlangt · nächstes Modell {model}",
- "killed": "Worker gestoppt: {reason}",
+ "draft": "Entwurf an den Prüfer übergeben",
+ "verdict": "Prüfer",
+ "correction": "Prüfer hat Änderungen verlangt",
+ "correction_model": "Prüfer hat Änderungen verlangt · nächstes Modell {model}",
+ "killed": "Worker gestoppt — {reason}",
"budget": "Budget-Warnung · {pct} von {limit}",
"approved": "Abgenommen und geliefert",
- "failed": "Fehlgeschlagen: {reason}",
- "cancelled": "Abgebrochen: {reason}",
+ "failed": "Ohne Ergebnis beendet — {reason}",
+ "cancelled": "Gestoppt — {reason}",
"timed_out": "Zeit abgelaufen"
},
"story_empty": "Für diesen Lauf sind keine Ereignisse aufgezeichnet.",
- "iteration_short": "Runde {n}",
"transcript_no_dir": "Das Worker-Transkript ist mit dem Ausgabeordner verschwunden — der Reiter Verlauf hat weiterhin jedes Ereignis des Laufs.",
- "transcript_empty": "Das Transkript enthält für diesen Lauf keine Schritte.",
"transcript_truncated": "Das Transkript war länger als hier gezeigt.",
"transcript_dropped": "{n} weitere Schritte werden nicht gezeigt.",
- "transcript_lane": "Worker {n}",
"final_answer": "Abschließende Antwort",
- "step_writes": "schrieb {path}",
"step_status": {
"pending": "Ausstehend",
"running": "Läuft",
@@ -877,15 +827,70 @@
"failed": "Fehlgeschlagen",
"skipped": "Kein Ergebnis"
},
- "review_empty": "Für diesen Lauf ist keine Prüfung aufgezeichnet.",
- "output_empty": "Es wurde nichts geliefert.",
"deliverables": "{n} gelieferte Datei(en)",
"deliverables_truncated": "(Liste gekürzt)",
"see_more": "Mehr anzeigen",
"see_less": "Weniger anzeigen",
"fact_mission_id": "Mission",
"fact_request": "Auftrag",
- "fact_result_uri": "Abgelegt unter"
+ "fact_result_uri": "Abgelegt unter",
+ "col_open": "Öffnen",
+ "board_subtitle_open": "Live aus der Backend-Registry und dem Mission-WebSocket. Zeile anklicken, um zu sehen, was passiert ist.",
+ "fact_started": "Gestartet",
+ "fact_worker": "Worker",
+ "fact_rounds": "Prüfrunden",
+ "fact_actions": "Aktionen",
+ "fact_reason": "Roher Grund",
+ "fact_output_dir": "Ausgabeordner",
+ "details_title": "Details",
+ "live_title": "Gerade jetzt",
+ "live_subtitle": "Tool-Aufrufe, die der Agent in diesem Moment ausführt.",
+ "timeline_title": "Schritt für Schritt",
+ "timeline_subtitle": "Was {agent} gesagt und getan hat, der Reihe nach.",
+ "output_title": "Was herausgekommen ist",
+ "actions_one": "1 Aktion ausgeführt",
+ "actions_many": "{n} Aktionen in {span} ausgeführt",
+ "transcript_fold": "Vollständiges Worker-Transkript · {n} Schritte",
+ "axis": {
+ "correctness": "Korrekt",
+ "completeness": "Vollständig",
+ "side_effects": "Keine Nebenwirkungen",
+ "security": "Sicher"
+ },
+ "narrative": {
+ "the_provider": "der Anbieter",
+ "quote_provider": "Der Anbieter meldete",
+ "quote_reviewer": "Der Prüfer sagte",
+ "running_fresh": "{agent} ist gerade gestartet und hat sich noch nicht gemeldet.",
+ "running_notes": "{agent} arbeitet noch — bisher {n} Meldungen.",
+ "approved_plain": "{agent} hat die Aufgabe erledigt.",
+ "approved_first_round": "Der Prüfer hat das Ergebnis geprüft und in der ersten Runde abgenommen.",
+ "approved_after_rounds": "Der Prüfer hat es nach {n} Runden abgenommen.",
+ "delivered_files": "{n} Datei(en) wurden geliefert — siehe unten.",
+ "cancelled_by_you": "Du hast diesen Lauf nach {runtime} gestoppt. Es wurde nichts geliefert.",
+ "cancelled_parent": "Dieser Lauf wurde zusammen mit dem Lauf gestoppt, der ihn gestartet hat.",
+ "cancelled_other": "Dieser Lauf wurde gestoppt: {reason}.",
+ "timed_out": "Der Lauf hat nach {runtime} sein Zeitlimit erreicht und wurde gestoppt, bevor er liefern konnte.",
+ "kept_partial": "{n} Teil-Datei(en) wurden behalten.",
+ "failed_provider_quota": "Der Worker wurde gestoppt, weil beim Anbieter ({provider}) das Kontingent aufgebraucht war — Nutzungs- oder Abrechnungslimit erreicht. Es wurde nichts geliefert.",
+ "failed_provider_auth": "Der Worker konnte sich beim Anbieter ({provider}) nicht anmelden — der Schlüssel oder Login ist ungültig oder abgelaufen. Unter API Keys neu verbinden.",
+ "failed_provider_unreachable": "Der Anbieter ({provider}) war nicht erreichbar — ausgefallen oder überlastet. Es wurde nichts geliefert.",
+ "failed_worker_timeout": "Der Worker ({provider}) hat innerhalb seines Zeitlimits nicht geantwortet und wurde gestoppt.",
+ "failed_injection": "Die Ausgabe des Workers enthielt etwas, das wie eine Prompt-Injection aussah — er wurde zur Sicherheit gestoppt. Es wurde nichts geliefert.",
+ "failed_path_guard": "Der Worker wollte einen geschützten Pfad anfassen und wurde zur Sicherheit gestoppt. Es wurde nichts geliefert.",
+ "failed_timeout": "Dem Worker ist nach {runtime} die Zeit ausgegangen; er wurde gestoppt, bevor er liefern konnte.",
+ "failed_budget": "Der Lauf hat sein Kosten- oder Nutzungsbudget erreicht und wurde gestoppt. Es wurde nichts geliefert.",
+ "failed_review_time": "Der Worker hat einen Entwurf abgeliefert, aber der Prüfer war nicht zufrieden — und die Prüfzeit war vorbei, bevor eine Überarbeitung fertig wurde.",
+ "failed_review_loop": "Der Prüfer hat in {n} Runden Änderungen verlangt; nach der letzten endete der Lauf ohne abgenommenes Ergebnis.",
+ "failed_review_rejected": "Der Prüfer hat das Ergebnis rundweg abgelehnt.",
+ "failed_no_reviewer": "Der Worker war fertig, aber kein Prüfer war verfügbar, um das Ergebnis zu prüfen — es wurde nicht abgenommen.",
+ "failed_workspace": "Der Arbeitsbereich für den Worker ließ sich nicht einrichten, die Aufgabe hat nie begonnen.",
+ "failed_plan": "Die Aufgabe ließ sich nicht in Schritte zerlegen. {detail}",
+ "failed_interrupted": "Die App wurde beendet, während dieser Lauf noch arbeitete — er wurde nie fertig.",
+ "failed_worker_error": "Der Worker-Prozess ist abgestürzt. Es wurde nichts geliefert.",
+ "failed_after_review": "Der Worker hat einen Entwurf abgeliefert, aber der Prüfer hat ihn nicht abgenommen — dort endete der Lauf.",
+ "failed_generic": "Die Aufgabe des Workers ist nach {runtime} fehlgeschlagen. Es wurde nichts geliefert."
+ }
},
"tasks_view": {
"title": "Automatisierungen",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 42f5ada626..27993d7da3 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -720,7 +720,6 @@
"board_subtitle": "Live from the backend registry and the mission WebSocket.",
"live_label": "Live",
"standby_label": "Standby",
- "col_expand": "Expand row",
"col_agent": "{name}-Agent",
"col_task": "Task / project",
"col_status": "Status",
@@ -739,10 +738,6 @@
"empty_body": "When {name} starts a real {agent}, it appears here with its task, status, tool calls, runtime and result.",
"snapshot_error": "The board could not be loaded: {detail}",
"history_error": "Past runs could not be loaded — showing only what is running right now.",
- "drill_tools": "Tool calls",
- "drill_tools_empty": "No tool calls recorded.",
- "drill_details": "{agent} details",
- "drill_trace": "trace {trace}",
"tool_unnamed": "tool",
"tool_status": {
"running": "Running",
@@ -763,26 +758,12 @@
"provider_unreachable": "Provider temporarily unreachable.",
"worker_timeout": "The worker hit its time limit."
},
- "insight_byline": "{agent} · started {started} · ran {runtime}",
"insight_loading": "Reading the run's record…",
"insight_load_error": "The run's record could not be loaded: {detail}",
"action_open_output": "Open output",
"action_map": "Mission map",
"no_output_dir": "output directory no longer on disk",
- "tabs_label": "Run record",
- "tab_story": "Story",
- "tab_transcript": "Transcript",
- "tab_review": "Review",
- "tab_output": "Output",
- "stat_workers_label": "Workers",
- "stat_workers_hint_none": "none spawned",
- "stat_tools_hint_run": "actions in this run",
- "stat_reviews_label": "Reviews",
- "stat_reviews_hint_none": "no revision round",
- "stat_reviews_hint_revisions": "{n} revision round(s)",
"stat_cost_label": "Cost",
- "stat_cost_hint_tokens": "{n} tokens",
- "stat_cost_hint_none": "no usage reported",
"outcome": {
"running": "Still working",
"approved": "Delivered",
@@ -790,32 +771,6 @@
"cancelled": "Stopped on purpose",
"timed_out": "Ran out of time"
},
- "outcome_hint": {
- "running": "The record below grows as the agent reports back.",
- "failed": "Here is what broke — in the provider's and the reviewer's own words where they left any.",
- "cancelled": "Someone stopped this run before it landed.",
- "timed_out": "The run hit its deadline before it could deliver."
- },
- "outcome_approved_hint": "Reviewed and signed off · {n} deliverable file(s)",
- "line_reason": "Why",
- "line_error_class": "Cause",
- "line_provider_said": "Provider said",
- "line_provider": "Provider",
- "line_worker_stopped": "Worker stopped",
- "line_worker_stopped_iter": "Worker (round {n}) stopped",
- "line_reviewer": "Reviewer: {verdict}",
- "line_correction": "Correction asked",
- "line_last_state": "Broke during",
- "line_partial": "Kept",
- "line_partial_text": "{n} partial file(s) survived and are listed under Output",
- "line_deadline": "Deadline",
- "line_cascade": "Cascade",
- "line_cascade_text": "the running worker was killed with it",
- "line_summary": "Summary",
- "line_revisions": "Revisions",
- "line_revisions_text": "approved after {n} revision round(s)",
- "line_progress": "Progress",
- "line_progress_text": "{n} notes reported so far",
"verdict": {
"approve": "approve",
"revise": "revise",
@@ -849,27 +804,22 @@
"dispatched": "Request handed to the {agent}",
"plan": "Plan ready · {n} worker(s)",
"spawn": "Worker started · {cli} · round {iter}",
- "narration": "{agent} says",
- "draft": "Draft handed to the reviewer · {n} diff lines",
- "verdict": "Reviewer: {verdict} · {confidence}",
- "correction": "Revision requested",
- "correction_model": "Revision requested · next model {model}",
- "killed": "Worker stopped: {reason}",
+ "draft": "Draft handed to the reviewer",
+ "verdict": "Reviewer",
+ "correction": "Reviewer asked for changes",
+ "correction_model": "Reviewer asked for changes · next model {model}",
+ "killed": "Worker stopped — {reason}",
"budget": "Budget warning · {pct} of {limit}",
"approved": "Approved and delivered",
- "failed": "Failed: {reason}",
- "cancelled": "Cancelled: {reason}",
- "timed_out": "Timed out"
+ "failed": "Ended without a result — {reason}",
+ "cancelled": "Stopped — {reason}",
+ "timed_out": "Ran out of time"
},
"story_empty": "No events recorded for this run.",
- "iteration_short": "round {n}",
"transcript_no_dir": "The worker transcript went with the output directory — the Story tab still has every event of the run.",
- "transcript_empty": "The transcript holds no steps for this run.",
"transcript_truncated": "The transcript was longer than what is shown.",
"transcript_dropped": "{n} more steps are not shown.",
- "transcript_lane": "Worker {n}",
"final_answer": "Final answer",
- "step_writes": "wrote {path}",
"step_status": {
"pending": "Pending",
"running": "Running",
@@ -877,15 +827,70 @@
"failed": "Failed",
"skipped": "No result"
},
- "review_empty": "No review recorded for this run.",
- "output_empty": "Nothing was delivered.",
"deliverables": "{n} deliverable file(s)",
"deliverables_truncated": "(list shortened)",
"see_more": "See more",
"see_less": "See less",
"fact_mission_id": "Mission",
"fact_request": "Request",
- "fact_result_uri": "Stored at"
+ "fact_result_uri": "Stored at",
+ "col_open": "Open",
+ "board_subtitle_open": "Live from the backend registry and the mission WebSocket. Click a row to see what happened.",
+ "fact_started": "Started",
+ "fact_worker": "Worker",
+ "fact_rounds": "Review rounds",
+ "fact_actions": "Actions",
+ "fact_reason": "Raw reason",
+ "fact_output_dir": "Output folder",
+ "details_title": "Details",
+ "live_title": "Right now",
+ "live_subtitle": "Tool calls the agent is running at this moment.",
+ "timeline_title": "Step by step",
+ "timeline_subtitle": "What {agent} said and did, in order.",
+ "output_title": "What came out",
+ "actions_one": "Ran 1 action",
+ "actions_many": "Ran {n} actions in {span}",
+ "transcript_fold": "Full worker transcript · {n} steps",
+ "axis": {
+ "correctness": "Correct",
+ "completeness": "Complete",
+ "side_effects": "No side effects",
+ "security": "Safe"
+ },
+ "narrative": {
+ "the_provider": "the provider",
+ "quote_provider": "Provider said",
+ "quote_reviewer": "Reviewer said",
+ "running_fresh": "{agent} has just started and has not reported back yet.",
+ "running_notes": "{agent} is still working — {n} notes so far.",
+ "approved_plain": "{agent} finished the task.",
+ "approved_first_round": "The reviewer checked the result and approved it on the first round.",
+ "approved_after_rounds": "The reviewer approved it after {n} rounds.",
+ "delivered_files": "{n} file(s) were delivered — see below.",
+ "cancelled_by_you": "You stopped this run after {runtime}. Nothing was delivered.",
+ "cancelled_parent": "This run was stopped together with the run that started it.",
+ "cancelled_other": "This run was stopped: {reason}.",
+ "timed_out": "The run hit its time limit after {runtime} and stopped before it could deliver.",
+ "kept_partial": "{n} partial file(s) were kept.",
+ "failed_provider_quota": "The worker stopped because the provider ({provider}) ran out of quota — the usage or billing limit was reached. Nothing was delivered.",
+ "failed_provider_auth": "The worker could not sign in to the provider ({provider}) — the key or login is invalid or expired. Reconnect it under API Keys.",
+ "failed_provider_unreachable": "The provider ({provider}) could not be reached — it was down or overloaded at the time. Nothing was delivered.",
+ "failed_worker_timeout": "The worker ({provider}) did not answer within its time limit and was stopped.",
+ "failed_injection": "The worker's output contained something that looked like a prompt injection, so it was stopped for safety. Nothing was delivered.",
+ "failed_path_guard": "The worker tried to touch a protected path and was stopped for safety. Nothing was delivered.",
+ "failed_timeout": "The worker ran out of time after {runtime} and was stopped before it could deliver.",
+ "failed_budget": "The run hit its cost or usage budget and was stopped. Nothing was delivered.",
+ "failed_review_time": "The worker produced a draft, but the reviewer was not satisfied and the review ran out of time before a revision could land.",
+ "failed_review_loop": "The reviewer asked for changes in {n} rounds; after the last one the run stopped without an approved result.",
+ "failed_review_rejected": "The reviewer rejected the result outright.",
+ "failed_no_reviewer": "The worker finished, but no reviewer was available to check the result, so it was not signed off.",
+ "failed_workspace": "The workspace for the worker could not be set up, so the task never started.",
+ "failed_plan": "The task could not be broken into steps. {detail}",
+ "failed_interrupted": "The app was closed while this run was still working, so it never finished.",
+ "failed_worker_error": "The worker process crashed. Nothing was delivered.",
+ "failed_after_review": "The worker produced a draft, but the reviewer did not approve it and the run ended there.",
+ "failed_generic": "The worker's task failed after {runtime}. Nothing was delivered."
+ }
},
"tasks_view": {
"title": "Automations",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 7d83ae3b6a..6019c12915 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -718,7 +718,6 @@
"board_subtitle": "En vivo desde el registro del backend y el WebSocket de misiones.",
"live_label": "En vivo",
"standby_label": "En espera",
- "col_expand": "Desplegar fila",
"col_agent": "{name}-Agent",
"col_task": "Tarea / proyecto",
"col_status": "Estado",
@@ -737,10 +736,6 @@
"empty_body": "Cuando {name} inicie un {agent} real, aparecerá aquí con su tarea, estado, llamadas a herramientas, duración y resultado.",
"snapshot_error": "No se pudo cargar el panel: {detail}",
"history_error": "No se pudo cargar el historial — se muestra solo lo que está en marcha.",
- "drill_tools": "Llamadas a herramientas",
- "drill_tools_empty": "No se registraron llamadas a herramientas.",
- "drill_details": "Detalles de {agent}",
- "drill_trace": "traza {trace}",
"tool_unnamed": "herramienta",
"tool_status": {
"running": "En curso",
@@ -761,26 +756,12 @@
"provider_unreachable": "Proveedor temporalmente inaccesible.",
"worker_timeout": "El worker alcanzó su límite de tiempo."
},
- "insight_byline": "{agent} · iniciado {started} · duración {runtime}",
"insight_loading": "Leyendo el registro de la ejecución…",
"insight_load_error": "No se pudo cargar el registro de la ejecución: {detail}",
"action_open_output": "Abrir resultado",
"action_map": "Mapa de la misión",
"no_output_dir": "la carpeta de salida ya no está en el disco",
- "tabs_label": "Registro de la ejecución",
- "tab_story": "Historia",
- "tab_transcript": "Transcripción",
- "tab_review": "Revisión",
- "tab_output": "Resultado",
- "stat_workers_label": "Workers",
- "stat_workers_hint_none": "ninguno iniciado",
- "stat_tools_hint_run": "acciones en esta ejecución",
- "stat_reviews_label": "Revisiones",
- "stat_reviews_hint_none": "sin ronda de corrección",
- "stat_reviews_hint_revisions": "{n} ronda(s) de corrección",
"stat_cost_label": "Coste",
- "stat_cost_hint_tokens": "{n} tokens",
- "stat_cost_hint_none": "sin consumo reportado",
"outcome": {
"running": "Sigue trabajando",
"approved": "Entregado",
@@ -788,32 +769,6 @@
"cancelled": "Detenido a propósito",
"timed_out": "Se agotó el tiempo"
},
- "outcome_hint": {
- "running": "El registro de abajo crece a medida que el agente informa.",
- "failed": "Esto es lo que falló — con las palabras del proveedor y del revisor donde las dejaron.",
- "cancelled": "Alguien detuvo esta ejecución antes de que terminara.",
- "timed_out": "La ejecución alcanzó su plazo antes de poder entregar."
- },
- "outcome_approved_hint": "Revisado y aprobado · {n} archivo(s) entregado(s)",
- "line_reason": "Por qué",
- "line_error_class": "Causa",
- "line_provider_said": "El proveedor dijo",
- "line_provider": "Proveedor",
- "line_worker_stopped": "Worker detenido",
- "line_worker_stopped_iter": "Worker (ronda {n}) detenido",
- "line_reviewer": "Revisor: {verdict}",
- "line_correction": "Corrección pedida",
- "line_last_state": "Falló durante",
- "line_partial": "Conservado",
- "line_partial_text": "{n} archivo(s) parcial(es) sobrevivieron y aparecen en Resultado",
- "line_deadline": "Plazo",
- "line_cascade": "Cascada",
- "line_cascade_text": "el worker en marcha se detuvo con ella",
- "line_summary": "Resumen",
- "line_revisions": "Correcciones",
- "line_revisions_text": "aprobado tras {n} ronda(s) de corrección",
- "line_progress": "Progreso",
- "line_progress_text": "{n} notas reportadas hasta ahora",
"verdict": {
"approve": "aprobado",
"revise": "corregir",
@@ -847,27 +802,22 @@
"dispatched": "Petición entregada al {agent}",
"plan": "Plan listo · {n} worker(s)",
"spawn": "Worker iniciado · {cli} · ronda {iter}",
- "narration": "{agent} dice",
- "draft": "Borrador entregado al revisor · {n} líneas de diff",
- "verdict": "Revisor: {verdict} · {confidence}",
- "correction": "Corrección pedida",
- "correction_model": "Corrección pedida · siguiente modelo {model}",
- "killed": "Worker detenido: {reason}",
+ "draft": "Borrador entregado al revisor",
+ "verdict": "Revisor",
+ "correction": "El revisor pidió cambios",
+ "correction_model": "El revisor pidió cambios · siguiente modelo {model}",
+ "killed": "Worker detenido — {reason}",
"budget": "Aviso de presupuesto · {pct} de {limit}",
"approved": "Aprobado y entregado",
- "failed": "Fallido: {reason}",
- "cancelled": "Cancelado: {reason}",
- "timed_out": "Tiempo agotado"
+ "failed": "Terminó sin resultado — {reason}",
+ "cancelled": "Detenido — {reason}",
+ "timed_out": "Se agotó el tiempo"
},
"story_empty": "No hay eventos registrados para esta ejecución.",
- "iteration_short": "ronda {n}",
"transcript_no_dir": "La transcripción del worker se fue con la carpeta de salida — la pestaña Historia conserva cada evento de la ejecución.",
- "transcript_empty": "La transcripción no contiene pasos para esta ejecución.",
"transcript_truncated": "La transcripción era más larga de lo que se muestra.",
"transcript_dropped": "{n} pasos más no se muestran.",
- "transcript_lane": "Worker {n}",
"final_answer": "Respuesta final",
- "step_writes": "escribió {path}",
"step_status": {
"pending": "Pendiente",
"running": "En marcha",
@@ -875,15 +825,70 @@
"failed": "Fallido",
"skipped": "Sin resultado"
},
- "review_empty": "No hay revisión registrada para esta ejecución.",
- "output_empty": "No se entregó nada.",
"deliverables": "{n} archivo(s) entregado(s)",
"deliverables_truncated": "(lista acortada)",
"see_more": "Ver más",
"see_less": "Ver menos",
"fact_mission_id": "Misión",
"fact_request": "Petición",
- "fact_result_uri": "Guardado en"
+ "fact_result_uri": "Guardado en",
+ "col_open": "Abrir",
+ "board_subtitle_open": "En directo desde el registro del backend y el WebSocket de misiones. Pulsa una fila para ver qué pasó.",
+ "fact_started": "Inicio",
+ "fact_worker": "Worker",
+ "fact_rounds": "Rondas de revisión",
+ "fact_actions": "Acciones",
+ "fact_reason": "Motivo bruto",
+ "fact_output_dir": "Carpeta de salida",
+ "details_title": "Detalles",
+ "live_title": "Ahora mismo",
+ "live_subtitle": "Llamadas a herramientas que el agente ejecuta en este momento.",
+ "timeline_title": "Paso a paso",
+ "timeline_subtitle": "Lo que {agent} dijo e hizo, en orden.",
+ "output_title": "Lo que salió",
+ "actions_one": "Ejecutó 1 acción",
+ "actions_many": "Ejecutó {n} acciones en {span}",
+ "transcript_fold": "Transcripción completa del worker · {n} pasos",
+ "axis": {
+ "correctness": "Correcto",
+ "completeness": "Completo",
+ "side_effects": "Sin efectos secundarios",
+ "security": "Seguro"
+ },
+ "narrative": {
+ "the_provider": "el proveedor",
+ "quote_provider": "El proveedor dijo",
+ "quote_reviewer": "El revisor dijo",
+ "running_fresh": "{agent} acaba de empezar y aún no ha informado.",
+ "running_notes": "{agent} sigue trabajando — {n} notas hasta ahora.",
+ "approved_plain": "{agent} terminó la tarea.",
+ "approved_first_round": "El revisor comprobó el resultado y lo aprobó en la primera ronda.",
+ "approved_after_rounds": "El revisor lo aprobó tras {n} rondas.",
+ "delivered_files": "Se entregaron {n} archivo(s) — ver abajo.",
+ "cancelled_by_you": "Detuviste esta ejecución tras {runtime}. No se entregó nada.",
+ "cancelled_parent": "Esta ejecución se detuvo junto con la que la inició.",
+ "cancelled_other": "Esta ejecución se detuvo: {reason}.",
+ "timed_out": "La ejecución alcanzó su límite de tiempo tras {runtime} y se detuvo antes de poder entregar.",
+ "kept_partial": "Se conservaron {n} archivo(s) parcial(es).",
+ "failed_provider_quota": "El worker se detuvo porque el proveedor ({provider}) agotó su cuota — se alcanzó el límite de uso o facturación. No se entregó nada.",
+ "failed_provider_auth": "El worker no pudo iniciar sesión en el proveedor ({provider}) — la clave o el acceso no es válido o ha caducado. Vuelve a conectarlo en API Keys.",
+ "failed_provider_unreachable": "No se pudo contactar con el proveedor ({provider}) — estaba caído o saturado. No se entregó nada.",
+ "failed_worker_timeout": "El worker ({provider}) no respondió dentro de su límite de tiempo y se detuvo.",
+ "failed_injection": "La salida del worker contenía algo parecido a una inyección de prompt, así que se detuvo por seguridad. No se entregó nada.",
+ "failed_path_guard": "El worker intentó tocar una ruta protegida y se detuvo por seguridad. No se entregó nada.",
+ "failed_timeout": "El worker agotó su tiempo tras {runtime} y se detuvo antes de poder entregar.",
+ "failed_budget": "La ejecución alcanzó su presupuesto de coste o uso y se detuvo. No se entregó nada.",
+ "failed_review_time": "El worker produjo un borrador, pero el revisor no quedó satisfecho y la revisión agotó su tiempo antes de que llegara una corrección.",
+ "failed_review_loop": "El revisor pidió cambios en {n} rondas; tras la última la ejecución terminó sin un resultado aprobado.",
+ "failed_review_rejected": "El revisor rechazó el resultado de plano.",
+ "failed_no_reviewer": "El worker terminó, pero no había revisor disponible para comprobar el resultado, así que no se aprobó.",
+ "failed_workspace": "No se pudo preparar el espacio de trabajo del worker, la tarea nunca empezó.",
+ "failed_plan": "La tarea no se pudo dividir en pasos. {detail}",
+ "failed_interrupted": "La app se cerró mientras esta ejecución seguía trabajando, así que nunca terminó.",
+ "failed_worker_error": "El proceso del worker falló. No se entregó nada.",
+ "failed_after_review": "El worker produjo un borrador, pero el revisor no lo aprobó y la ejecución terminó ahí.",
+ "failed_generic": "La tarea del worker falló tras {runtime}. No se entregó nada."
+ }
},
"tasks_view": {
"title": "Automatizaciones",
diff --git a/jarvis/ui/web/frontend/src/views/sub-agents/AgentInsight.test.tsx b/jarvis/ui/web/frontend/src/views/sub-agents/AgentInsight.test.tsx
index e2da3e8373..2515f27d52 100644
--- a/jarvis/ui/web/frontend/src/views/sub-agents/AgentInsight.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/sub-agents/AgentInsight.test.tsx
@@ -4,8 +4,7 @@ import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/re
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { SubAgentNode } from "@/store/jarvisAgents";
-import { AgentInsight, outcomeLines, reasonLabel, requestTitle } from "./AgentInsight";
-import { deriveOutcome } from "./outcome";
+import { AgentInsight, requestTitle } from "./AgentInsight";
const MISSION_ID = "019fecaa-5a92-7360-a784-829281639cf6";
const WID = "019fecaa-5a92::019fecaa-5aa5::iter0";
@@ -24,6 +23,13 @@ function envelope(payload: Record<string, unknown>, n: number, workerId: string
};
}
+const note = (n: number, text: string) =>
+ envelope(
+ { event_type: "WorkerProgress", worker_id: WID, pct: null, note: text, stalled: false, tokens_so_far: 0, cost_so_far: 0 },
+ n,
+ WID,
+ );
+
const DETAIL = {
mission: {
id: MISSION_ID,
@@ -43,14 +49,14 @@ const DETAIL = {
3,
WID,
),
- envelope(
- { event_type: "WorkerProgress", worker_id: WID, pct: null, note: "Grep: jarvis/ui", stalled: false, tokens_so_far: 0, cost_so_far: 0 },
- 4,
- WID,
- ),
+ note(4, "I will look at the workspace first."),
+ note(5, "Grep: jarvis/ui"),
+ note(6, "Read: C:/x.py"),
+ note(7, "Grep: jarvis/core"),
+ note(8, "You've reached your limit."),
envelope(
{ event_type: "WorkerKilled", worker_id: WID, reason: "budget", error_class: "provider_quota", error_detail: "You've reached your limit." },
- 5,
+ 9,
WID,
),
envelope(
@@ -63,7 +69,7 @@ const DETAIL = {
error_detail: "You've reached your limit.",
failed_provider: "claude",
},
- 6,
+ 10,
),
],
verdicts: [],
@@ -136,8 +142,6 @@ function renderWithQuery(ui: ReactElement) {
return render(<QueryClientProvider client={client}>{ui}</QueryClientProvider>);
}
-const identity = (key: string) => key;
-
describe("AgentInsight", () => {
beforeEach(() => {
vi.stubGlobal(
@@ -158,24 +162,33 @@ describe("AgentInsight", () => {
vi.unstubAllGlobals();
});
- it("explains a quota failure in plain words, with the provider's own text", async () => {
+ it("explains a quota failure in one plain sentence and quotes the provider once", async () => {
renderWithQuery(<AgentInsight agent={agentNode()} onBack={() => {}} onOpenOutput={() => {}} />);
- // "Did not deliver" shows from the row's own status before the record
- // arrives; the reason line is the first thing that needs the fetch.
expect(await screen.findByText("Did not deliver")).toBeTruthy();
- expect(await screen.findByText("The worker's task failed")).toBeTruthy();
- // The classified cause and the raw upstream message.
- expect(screen.getByText(/Provider quota exhausted/)).toBeTruthy();
- // Quoted in the verdict AND in the story's kill entry — both on purpose.
- expect(screen.getAllByText("You've reached your limit.").length).toBeGreaterThanOrEqual(2);
- // The kill and where in the pipeline it broke.
- // Rounds are 1-based for people; the worker id says iter0.
- expect(screen.getByText("Worker (round 1) stopped")).toBeTruthy();
- expect(screen.getByText("budget or provider quota")).toBeTruthy();
- // The story timeline lands on the failure by default for a failed run.
- expect(await screen.findByText("Worker started · claude · round 1")).toBeTruthy();
- expect(screen.getByText("Grep")).toBeTruthy();
+ expect(
+ await screen.findByText(/stopped because the provider \(claude\) ran out of quota/i),
+ ).toBeTruthy();
+ // Quoted in the verdict card; the timeline's kill and failure rows do
+ // NOT repeat it (the note before them already said it).
+ expect(screen.getByText("Provider said")).toBeTruthy();
+ expect(screen.getAllByText("You've reached your limit.")).toHaveLength(2);
+ // No jargon table: the raw tokens live behind "Details".
+ expect(screen.queryByText("Broke during")).toBeNull();
+ expect(screen.getByText(/task_error · provider_quota · CRITIQUING/)).toBeTruthy();
+ });
+
+ it("folds consecutive tool calls into one timeline block", async () => {
+ renderWithQuery(<AgentInsight agent={agentNode()} onBack={() => {}} onOpenOutput={() => {}} />);
+ await screen.findByText("Did not deliver");
+
+ const fold = await screen.findByRole("button", { name: /Ran 3 actions/ });
+ expect(screen.getByText("×2")).toBeTruthy(); // Grep ran twice
+ expect(screen.queryByText("jarvis/core")).toBeNull();
+ fireEvent.click(fold);
+ expect(screen.getByText("jarvis/core")).toBeTruthy();
+ // The worker's own words stand alone as a quote.
+ expect(screen.getByText("I will look at the workspace first.")).toBeTruthy();
});
it("hands the archived output slug to the Artifacts section", async () => {
@@ -188,15 +201,14 @@ describe("AgentInsight", () => {
expect(opened).toEqual(["mission_019fecaa-5a92"]);
});
- it("shows the reconstructed transcript with reasoning and a failed tool step", async () => {
+ it("keeps the worker transcript folded away under the timeline", async () => {
renderWithQuery(<AgentInsight agent={agentNode()} onBack={() => {}} onOpenOutput={() => {}} />);
await screen.findByText("Did not deliver");
- fireEvent.click(await screen.findByRole("tab", { name: /transcript/i }));
- expect(await screen.findByText("I will look at the workspace first.")).toBeTruthy();
+ const fold = await screen.findByRole("button", { name: /transcript · 2 steps/i });
+ expect(screen.queryByText("quota")).toBeNull();
+ fireEvent.click(fold);
expect(screen.getByText("quota")).toBeTruthy();
- // The header's status dot says "Failed" too; the step adds a second one.
- expect(screen.getAllByText("Failed", { selector: "span" }).length).toBeGreaterThanOrEqual(2);
});
it("goes back to the board", async () => {
@@ -207,33 +219,10 @@ describe("AgentInsight", () => {
});
});
-describe("outcomeLines", () => {
- it("lists nothing beyond progress for a run still working", () => {
- const outcome = deriveOutcome(DETAIL.events.slice(0, 4) as never, "en");
- const lines = outcomeLines(agentNode({ status: "running" }), outcome, identity);
- expect(lines.map((l) => l.id)).toEqual(["notes"]);
- });
-
- it("orders a failure as reason → cause → provider text → kills → state", () => {
- const outcome = deriveOutcome(DETAIL.events as never, "en");
- const lines = outcomeLines(agentNode(), outcome, identity);
- expect(lines.map((l) => l.id)).toEqual(["reason", "class", "detail", "provider", `kill-${WID}`, "state"]);
- expect(lines.find((l) => l.id === "detail")?.mono).toBe(true);
- });
-});
-
-describe("requestTitle / reasonLabel", () => {
+describe("requestTitle", () => {
it("takes the first paragraph and clamps it", () => {
expect(requestTitle("Do this\n\nSupporting context: …", "none")).toBe("Do this");
expect(requestTitle(" ", "none")).toBe("none");
expect(requestTitle("x".repeat(300), "none")).toHaveLength(178);
});
-
- it("falls back to the raw token for an unknown reason and keeps the tail", () => {
- expect(reasonLabel("decompose_failed: no brain", identity)).toBe(
- "subagents_view.reason.decompose_failed (no brain)",
- );
- expect(reasonLabel("something_new", identity)).toBe("something_new");
- expect(reasonLabel(null, identity)).toBeNull();
- });
});
diff --git a/jarvis/ui/web/frontend/src/views/sub-agents/AgentInsight.tsx b/jarvis/ui/web/frontend/src/views/sub-agents/AgentInsight.tsx
index 84a5d521f5..5feb5c74e5 100644
--- a/jarvis/ui/web/frontend/src/views/sub-agents/AgentInsight.tsx
+++ b/jarvis/ui/web/frontend/src/views/sub-agents/AgentInsight.tsx
@@ -1,26 +1,23 @@
/**
- * AgentInsight — one agent run, in full.
+ * AgentInsight — one agent run, explained.
*
- * The board row answers "did it land?" in one word. This page answers the
- * questions that word raises: what exactly went wrong, what the agent did
- * step by step, what the reviewer said, and what it left behind. It replaces
- * the board inside the section (a "← Back" link at the top, the same quiet
- * primitives) rather than opening a dialog, because a run's story is a page,
- * not a tooltip.
+ * The board row answers "did it land?" in one word. This page answers what a
+ * person asks next, in the order they ask it:
*
- * Four sources, all of which already exist — nothing here is a second store:
+ * 1. What happened? — one paragraph in plain words, with the provider's
+ * or the reviewer's own sentence when they left one.
+ * 2. How did it go? — a timeline: what the agent said, what it ran
+ * (folded: "ran 14 actions"), what the reviewer
+ * said, where it stopped.
+ * 3. What came out? — the answer and the files, with the way to them.
+ *
+ * Everything else (ids, raw reason tokens, the full request) sits behind a
+ * "Details" fold at the bottom. No tabs: a run's story is read top to bottom.
*
- * - `GET /api/missions/{id}` — the durable event stream (dispatch, spawns,
- * the worker's own progress notes, verdicts, kills, the terminal event).
- * `outcome.ts` turns it into the verdict paragraph and the story timeline.
- * - `GET /api/missions/{id}/result` — the signed summary and the deliverable
- * files with bounded contents.
- * - `GET /api/outputs` + `GET /api/outputs/{slug}/plan` — the archived worker
- * transcript, reconstructed into reasoning / tool / spawn steps and the final
- * answer. Only while the output directory still exists; a cleaned-up run
- * says so instead of pretending the agent did nothing.
- * - The live registry node the board already holds — tool calls with real
- * status and a running clock for an agent that is still working.
+ * Four sources, all of which already exist — nothing here is a second store:
+ * `GET /api/missions/{id}` (events), `GET /api/missions/{id}/result` (summary
+ * + files), `GET /api/outputs` + `/{slug}/plan` (the archived transcript, only
+ * while the directory exists) and the live registry node the board holds.
*
* Every visible string goes through i18n; the brand is the wake-word-derived
* assistant name (lib/agentBrand.ts), never a product name.
@@ -33,13 +30,14 @@ import {
Bot,
Brain,
CheckCircle2,
+ ChevronDown,
+ ChevronRight,
CircleAlert,
FileText,
Gavel,
ListChecks,
Map as MapIcon,
Rocket,
- ScrollText,
StopCircle,
TerminalSquare,
Timer,
@@ -54,35 +52,25 @@ import { useOutputsList, usePlanForOutput, type PlanStep } from "@/hooks/useOutp
import { missionMapUrl } from "@/hooks/useVisualArtifacts";
import { openExternalUrl } from "@/lib/openExternal";
import { ScrollArea } from "@/components/ui/scroll-area";
-import {
- BackLink,
- DetailHeader,
- FactRows,
- Panel,
- SegmentedFilter,
- SoftButton,
- StatusDot,
- StatTile,
-} from "@/components/extensions/primitives";
+import { BackLink, Panel, SoftButton, StatusDot } from "@/components/extensions/primitives";
import { agentBrand, agentsBrand } from "@/lib/agentBrand";
import { cn } from "@/lib/utils";
import { useEventStore } from "@/store/events";
import { fill, useT, useUiLanguage } from "@/i18n";
-import { failureLabel } from "./failureLabel";
import {
buildStory,
deriveOutcome,
+ groupStory,
KILL_REASON_LABEL_KEYS,
missionIdFromTraceId,
- REASON_LABEL_KEYS,
- splitReason,
- type AgentOutcome,
+ type ActionsBlock,
+ type StoryBlock,
type StoryEntry,
type StoryTone,
} from "./outcome";
+import { composeNarrative, reasonText, type Narrative } from "./narrative";
import { formatBytes, formatClock, formatDuration, formatOffset, formatUsd } from "./format";
-type Tab = "story" | "transcript" | "review" | "output";
type T = (key: string) => string;
const STATUS_TONE: Record<SubAgentNode["status"], "busy" | "ok" | "error" | "warn"> = {
@@ -108,6 +96,22 @@ const TONE_RING: Record<StoryTone, string> = {
error: "border-destructive/50 bg-destructive/10",
};
+const STATE_TONE: Record<Narrative["state"], StoryTone> = {
+ running: "busy",
+ approved: "ok",
+ failed: "error",
+ cancelled: "warn",
+ timed_out: "error",
+};
+
+const STATE_ICON: Record<Narrative["state"], typeof Bot> = {
+ running: Rocket,
+ approved: CheckCircle2,
+ failed: XCircle,
+ cancelled: StopCircle,
+ timed_out: Timer,
+};
+
/** The first paragraph of the request — the part the user actually said. */
export function requestTitle(text: string | null | undefined, fallback: string): string {
const raw = (text ?? "").trim();
@@ -116,13 +120,10 @@ export function requestTitle(text: string | null | undefined, fallback: string):
return first.length > 180 ? `${first.slice(0, 177).trimEnd()}…` : first || fallback;
}
-/** Plain-language label for a mission-level reason, else the raw token. */
-export function reasonLabel(reason: string | null | undefined, t: T): string | null {
- const { head, tail } = splitReason(reason);
- if (!head) return null;
- const key = REASON_LABEL_KEYS[head];
- const label = key ? t(key) : head;
- return tail ? `${label} (${tail})` : label;
+function axisPassed(axis: CriticAxisResult): boolean | null {
+ if (axis.pass === true || axis.status === "pass") return true;
+ if (axis.pass === false || axis.status === "fail") return false;
+ return null;
}
function killLabel(reason: string, t: T): string {
@@ -130,12 +131,6 @@ function killLabel(reason: string, t: T): string {
return key ? t(key) : reason;
}
-function axisPassed(axis: CriticAxisResult): boolean | null {
- if (axis.pass === true || axis.status === "pass") return true;
- if (axis.pass === false || axis.status === "fail") return false;
- return null;
-}
-
interface Props {
agent: SubAgentNode;
onBack: () => void;
@@ -146,6 +141,7 @@ export function AgentInsight({ agent, onBack, onOpenOutput }: Props) {
const t = useT();
const locale = useUiLanguage();
const assistantName = useEventStore((s) => s.assistantName);
+ const agentName = agentBrand(assistantName);
const missionId = agent.mission_id ?? missionIdFromTraceId(agent.trace_id);
const running = agent.status === "running";
@@ -169,223 +165,237 @@ export function AgentInsight({ agent, onBack, onOpenOutput }: Props) {
const events = detail.data?.events ?? [];
const language = detail.data?.mission.language ?? "en";
const outcome = useMemo(() => deriveOutcome(events, language), [events, language]);
- const story = useMemo(() => buildStory(events), [events]);
+ const blocks = useMemo(() => groupStory(buildStory(events)), [events]);
const steps: PlanStep[] = plan.data?.steps ?? [];
const artifacts: MissionArtifact[] = result.data?.artifacts ?? [];
const finalAnswer = plan.data?.final_answer ?? null;
- const hasOutput = artifacts.length > 0 || !!finalAnswer || !!outcome.summary;
- const [tab, setTab] = useState<Tab | null>(null);
- // Land where the answer is: a delivered run opens on its output, everything
- // else opens on the story of how it got where it got.
- const activeTab: Tab = tab ?? (outcome.terminal === "approved" && hasOutput ? "output" : "story");
-
const title = requestTitle(result.data?.prompt ?? agent.utterance, t("subagents_view.task_none"));
const startedMs = events[0]?.ts_ms ?? Math.floor(agent.started_ns / 1_000_000);
const endedMs = detail.data?.mission.updated_ms ?? null;
const runtimeMs =
agent.duration_ms ??
(outcome.terminal && endedMs ? endedMs - startedMs : running ? Date.now() - startedMs : null);
+ const runtime = runtimeMs != null ? formatDuration(runtimeMs) : "—";
+ const notes = outcome.workers.reduce((sum, w) => sum + w.notes, 0);
+ const actions = Math.max(
+ agent.tool_calls.length,
+ steps.filter((s) => s.kind !== "reasoning").length,
+ outcome.workers.reduce((sum, w) => sum + w.tool_notes, 0),
+ );
- const tabOptions: { id: Tab; label: string; count?: number }[] = [
- { id: "story", label: t("subagents_view.tab_story"), count: story.length },
- { id: "transcript", label: t("subagents_view.tab_transcript"), count: steps.length },
- { id: "review", label: t("subagents_view.tab_review"), count: outcome.verdicts.length },
- { id: "output", label: t("subagents_view.tab_output"), count: artifacts.length },
+ const narrative = useMemo(
+ () =>
+ composeNarrative(
+ agent,
+ outcome,
+ { agentName, runtime, artifactCount: result.data?.artifact_count ?? artifacts.length, notes },
+ t,
+ ),
+ [agent, outcome, agentName, runtime, result.data?.artifact_count, artifacts.length, notes, t],
+ );
+
+ const worker = outcome.workers.at(0) ?? null;
+ const rounds = Math.max(outcome.revisions, outcome.verdicts.at(-1)?.iteration ?? 0) + 1;
+ const cost = Math.max(outcome.cost_usd, agent.cost_usd);
+ const facts: Array<{ label: string; value: string; hint?: string }> = [
+ { label: t("subagents_view.fact_started"), value: formatClock(startedMs, locale) },
+ { label: t("subagents_view.col_runtime"), value: runtime },
+ ...(worker
+ ? [{ label: t("subagents_view.fact_worker"), value: worker.cli || "—", hint: worker.model || undefined }]
+ : []),
+ ...(outcome.verdicts.length > 0 || outcome.revisions > 0
+ ? [{ label: t("subagents_view.fact_rounds"), value: String(rounds) }]
+ : []),
+ ...(actions > 0 ? [{ label: t("subagents_view.fact_actions"), value: String(actions) }] : []),
+ ...(cost > 0 ? [{ label: t("subagents_view.stat_cost_label"), value: formatUsd(cost) }] : []),
];
+ const hasOutput = !!finalAnswer || artifacts.length > 0;
+
return (
<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">
+ <div className="mx-auto flex w-full max-w-[980px] flex-col gap-5 px-6 py-6">
<BackLink label={agentsBrand(assistantName)} onClick={onBack} />
- <DetailHeader
- leading={
- <span className="grid h-10 w-10 shrink-0 place-items-center rounded-xl border border-border bg-card/60 text-primary">
- <Bot className="h-5 w-5" />
- </span>
- }
- title={title}
- titleAccessory={
- <StatusDot
- tone={STATUS_TONE[agent.status]}
- pulse={running}
- label={t(`subagents_view.status.${agent.status}`)}
- />
- }
- byline={fill(t("subagents_view.insight_byline"), {
- agent: agentBrand(assistantName),
- started: formatClock(startedMs, locale),
- runtime: runtimeMs != null ? formatDuration(runtimeMs) : "—",
- })}
- actions={
- <>
- {slug && (
- <SoftButton
- onClick={() => void openExternalUrl(`${window.location.origin}${missionMapUrl(slug)}`)}
- >
- <MapIcon className="h-3.5 w-3.5" />
- {t("subagents_view.action_map")}
- </SoftButton>
- )}
- {/* Only while the output directory exists: a bright primary
- button that cannot do anything reads as broken, and the
- tab bar already says the directory is gone. */}
- {slug && (
- <SoftButton primary onClick={() => onOpenOutput(slug)}>
- <ArrowUpRight className="h-3.5 w-3.5" />
- {t("subagents_view.action_open_output")}
- </SoftButton>
- )}
- </>
- }
- />
+ {/* Header ---------------------------------------------------- */}
+ <div className="flex flex-wrap items-start justify-between gap-x-6 gap-y-3">
+ <div className="min-w-0 flex-1">
+ <div className="text-xs font-medium uppercase tracking-wider text-muted-foreground">
+ {agentName}
+ </div>
+ <h1 className="mt-1 line-clamp-2 font-display text-[22px] font-semibold leading-snug tracking-tight text-foreground">
+ {title}
+ </h1>
+ <div className="mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm text-muted-foreground">
+ <StatusDot
+ tone={STATUS_TONE[agent.status]}
+ pulse={running}
+ label={t(`subagents_view.status.${agent.status}`)}
+ />
+ <span aria-hidden>·</span>
+ <span>{formatClock(startedMs, locale)}</span>
+ <span aria-hidden>·</span>
+ <span>{runtime}</span>
+ </div>
+ </div>
+ {slug && (
+ <div className="flex shrink-0 items-center gap-2">
+ <SoftButton
+ onClick={() => void openExternalUrl(`${window.location.origin}${missionMapUrl(slug)}`)}
+ >
+ <MapIcon className="h-3.5 w-3.5" />
+ {t("subagents_view.action_map")}
+ </SoftButton>
+ <SoftButton primary onClick={() => onOpenOutput(slug)}>
+ <ArrowUpRight className="h-3.5 w-3.5" />
+ {t("subagents_view.action_open_output")}
+ </SoftButton>
+ </div>
+ )}
+ </div>
{detail.isError && (
- <Notice tone="error">
+ <Notice>
{fill(t("subagents_view.insight_load_error"), {
detail: detail.error instanceof Error ? detail.error.message : "",
})}
</Notice>
)}
- {/* The verdict — what happened, in words ------------------------ */}
- <OutcomePanel
- agent={agent}
- outcome={outcome}
- loading={detail.isPending}
- artifactCount={result.data?.artifact_count ?? artifacts.length}
- t={t}
- />
-
- {/* The numbers ------------------------------------------------- */}
- <div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5">
- <StatTile
- icon={<Timer className="h-4 w-4" />}
- label={t("subagents_view.col_runtime")}
- value={runtimeMs != null ? formatDuration(runtimeMs) : "—"}
- hint={endedMs && outcome.terminal ? formatClock(endedMs, locale) : t("subagents_view.stat_active_hint_idle")}
- />
- <StatTile
- icon={<Bot className="h-4 w-4" />}
- label={t("subagents_view.stat_workers_label")}
- value={String(outcome.workers.length)}
- hint={
- outcome.workers.length > 0
- ? outcome.workers.map((w) => w.cli).filter(Boolean).join(", ") || "—"
- : t("subagents_view.stat_workers_hint_none")
- }
- />
- <StatTile
- icon={<Wrench className="h-4 w-4" />}
- label={t("subagents_view.stat_tools_label")}
- value={String(
- Math.max(
- agent.tool_calls.length,
- steps.filter((s) => s.kind !== "reasoning").length,
- outcome.workers.reduce((sum, w) => sum + w.tool_notes, 0),
- ),
- )}
- hint={t("subagents_view.stat_tools_hint_run")}
- />
- <StatTile
- icon={<Gavel className="h-4 w-4" />}
- label={t("subagents_view.stat_reviews_label")}
- value={String(outcome.verdicts.length)}
- tone={outcome.revisions > 0 ? "warn" : "ok"}
- hint={
- outcome.revisions > 0
- ? fill(t("subagents_view.stat_reviews_hint_revisions"), { n: outcome.revisions })
- : t("subagents_view.stat_reviews_hint_none")
- }
- />
- <StatTile
- icon={<ScrollText className="h-4 w-4" />}
- label={t("subagents_view.stat_cost_label")}
- value={formatUsd(Math.max(outcome.cost_usd, agent.cost_usd))}
- hint={
- outcome.tokens_used > 0
- ? fill(t("subagents_view.stat_cost_hint_tokens"), { n: outcome.tokens_used.toLocaleString() })
- : t("subagents_view.stat_cost_hint_none")
- }
- />
- </div>
+ {/* 1. What happened ----------------------------------------- */}
+ <VerdictCard narrative={narrative} loading={detail.isPending} facts={facts} t={t} />
- {/* Live tool calls from the registry, while it still holds them --- */}
+ {/* Live tool calls, while the registry still holds them ------ */}
{agent.tool_calls.length > 0 && (
- <Panel>
- <div className="flex items-center gap-2 border-b border-border px-4 py-2.5 text-xs font-medium text-muted-foreground">
- <TerminalSquare className="h-3.5 w-3.5 text-primary" />
- {t("subagents_view.drill_tools")}
- </div>
- <div className="divide-y divide-border/70">
+ <Section icon={TerminalSquare} title={t("subagents_view.live_title")} subtitle={t("subagents_view.live_subtitle")}>
+ <div className="divide-y divide-border/60">
{agent.tool_calls.map((call, idx) => (
<LiveToolCall key={`${agent.trace_id}-${idx}`} call={call} t={t} />
))}
</div>
- </Panel>
+ </Section>
+ )}
+
+ {/* 2. How it went ------------------------------------------- */}
+ <Section
+ icon={ListChecks}
+ title={t("subagents_view.timeline_title")}
+ subtitle={fill(t("subagents_view.timeline_subtitle"), { agent: agentName })}
+ >
+ <Timeline
+ blocks={blocks}
+ startedMs={startedMs}
+ loading={detail.isPending}
+ agentName={agentName}
+ quoteText={narrative.quote?.text ?? null}
+ t={t}
+ />
+ <TranscriptFold
+ steps={steps}
+ hasSlug={!!slug}
+ hadWorkers={outcome.workers.length > 0}
+ loading={!!slug && plan.isPending}
+ truncated={!!plan.data?.truncated}
+ dropped={plan.data?.dropped_steps ?? 0}
+ t={t}
+ />
+ </Section>
+
+ {/* 3. What came out ----------------------------------------- */}
+ {hasOutput && (
+ <Section
+ icon={FileText}
+ title={t("subagents_view.output_title")}
+ subtitle={
+ artifacts.length > 0
+ ? fill(t("subagents_view.deliverables"), { n: artifacts.length })
+ : t("subagents_view.final_answer")
+ }
+ actions={
+ slug ? (
+ <SoftButton primary onClick={() => onOpenOutput(slug)}>
+ <ArrowUpRight className="h-3.5 w-3.5" />
+ {t("subagents_view.action_open_output")}
+ </SoftButton>
+ ) : null
+ }
+ >
+ {finalAnswer && (
+ <div className="px-5 py-4">
+ <ClampedBlock text={finalAnswer} t={t} lines={8} className="whitespace-pre-wrap text-[15px] leading-relaxed text-foreground/90" />
+ </div>
+ )}
+ {artifacts.length > 0 && (
+ <ul className={cn("divide-y divide-border/60", finalAnswer && "border-t border-border/60")}>
+ {artifacts.map((a) => (
+ <li key={a.path} className="px-5 py-3">
+ <div className="flex items-center gap-2.5 text-sm">
+ <FileText className="h-4 w-4 shrink-0 text-muted-foreground" />
+ <span className="min-w-0 flex-1 truncate font-medium" title={a.deliverable_path}>
+ {a.deliverable_path}
+ </span>
+ <span className="shrink-0 text-xs tabular-nums text-muted-foreground">{formatBytes(a.size)}</span>
+ </div>
+ </li>
+ ))}
+ {result.data?.truncated && (
+ <li className="px-5 py-2 text-xs text-muted-foreground">{t("subagents_view.deliverables_truncated")}</li>
+ )}
+ </ul>
+ )}
+ </Section>
)}
- {/* The record ---------------------------------------------------- */}
- <Panel>
- <div className="flex flex-wrap items-center justify-between gap-3 border-b border-border px-4 py-3">
- <SegmentedFilter
- value={activeTab}
- onChange={setTab}
- options={tabOptions}
- label={t("subagents_view.tabs_label")}
- />
+ {/* Details, for the curious ---------------------------------- */}
+ <details className="group rounded-xl border border-border/70 bg-card/30 px-5 py-3 text-sm">
+ <summary className="flex cursor-pointer select-none items-center gap-2 text-muted-foreground hover:text-foreground">
+ <ChevronRight className="h-4 w-4 transition-transform group-open:rotate-90" />
+ {t("subagents_view.details_title")}
+ </summary>
+ <dl className="mt-3 grid grid-cols-[max-content_minmax(0,1fr)] gap-x-6 gap-y-2 text-sm">
+ <dt className="text-muted-foreground">{t("subagents_view.fact_request")}</dt>
+ <dd className="whitespace-pre-wrap break-words text-foreground/85">{result.data?.prompt ?? agent.utterance ?? "—"}</dd>
+ <dt className="text-muted-foreground">{t("subagents_view.fact_mission_id")}</dt>
+ <dd className="font-mono text-xs">{missionId}</dd>
+ {outcome.reason && (
+ <>
+ <dt className="text-muted-foreground">{t("subagents_view.fact_reason")}</dt>
+ <dd className="font-mono text-xs">
+ {outcome.reason}
+ {outcome.error_class ? ` · ${outcome.error_class}` : ""}
+ {outcome.last_state ? ` · ${outcome.last_state}` : ""}
+ </dd>
+ </>
+ )}
+ {worker && (
+ <>
+ <dt className="text-muted-foreground">{t("subagents_view.fact_worker")}</dt>
+ <dd className="font-mono text-xs">
+ {outcome.workers.map((w) => `${w.cli}${w.model ? ` (${w.model})` : ""} · ${w.worker_id}`).join("\n")}
+ </dd>
+ </>
+ )}
+ {outcome.result_uri && (
+ <>
+ <dt className="text-muted-foreground">{t("subagents_view.fact_result_uri")}</dt>
+ <dd className="break-all font-mono text-xs">{outcome.result_uri}</dd>
+ </>
+ )}
{slug ? (
- <span className="font-mono text-[11px] text-muted-foreground/70">{slug}</span>
+ <>
+ <dt className="text-muted-foreground">{t("subagents_view.fact_output_dir")}</dt>
+ <dd className="font-mono text-xs">{slug}</dd>
+ </>
) : (
- <span className="text-[11px] text-muted-foreground/70">
- {t("subagents_view.no_output_dir")}
- </span>
+ <>
+ <dt className="text-muted-foreground">{t("subagents_view.fact_output_dir")}</dt>
+ <dd className="text-muted-foreground">{t("subagents_view.no_output_dir")}</dd>
+ </>
)}
- </div>
-
- {activeTab === "story" && (
- <StoryList story={story} startedMs={startedMs} loading={detail.isPending} assistantName={assistantName} t={t} />
- )}
- {activeTab === "transcript" && (
- <Transcript
- steps={steps}
- finalAnswer={finalAnswer}
- truncated={!!plan.data?.truncated}
- dropped={plan.data?.dropped_steps ?? 0}
- hasSlug={!!slug}
- loading={!!slug && plan.isPending}
- t={t}
- />
- )}
- {activeTab === "review" && <Review outcome={outcome} t={t} />}
- {activeTab === "output" && (
- <Output
- outcome={outcome}
- finalAnswer={finalAnswer}
- artifacts={artifacts}
- truncated={!!result.data?.truncated}
- slug={slug}
- onOpenOutput={onOpenOutput}
- t={t}
- />
- )}
- </Panel>
-
- <FactRows
- className="px-1"
- rows={[
- { label: t("subagents_view.fact_mission_id"), value: <span className="font-mono text-sm">{missionId}</span> },
- {
- label: t("subagents_view.fact_request"),
- value: <ClampedBlock text={result.data?.prompt ?? agent.utterance ?? ""} t={t} lines={3} />,
- },
- ...(outcome.result_uri
- ? [{ label: t("subagents_view.fact_result_uri"), value: <span className="break-all font-mono text-xs">{outcome.result_uri}</span> }]
- : []),
- ]}
- />
+ </dl>
+ </details>
</div>
</ScrollArea>
</div>
@@ -393,164 +403,74 @@ export function AgentInsight({ agent, onBack, onOpenOutput }: Props) {
}
// ---------------------------------------------------------------------------
-// Outcome — the verdict paragraph
+// 1. The verdict card
// ---------------------------------------------------------------------------
-interface OutcomeLine {
- id: string;
- tone: StoryTone;
- label: string;
- text: string;
- mono?: boolean;
-}
-
-export function outcomeLines(agent: SubAgentNode, outcome: AgentOutcome, t: T): OutcomeLine[] {
- const lines: OutcomeLine[] = [];
- const reason = reasonLabel(outcome.reason, t);
-
- if (outcome.terminal === "failed" || outcome.terminal === "timed_out") {
- if (reason) lines.push({ id: "reason", tone: "error", label: t("subagents_view.line_reason"), text: reason });
- const cls = failureLabel({ error: null, error_class: outcome.error_class }, t);
- if (cls) lines.push({ id: "class", tone: "error", label: t("subagents_view.line_error_class"), text: cls });
- if (outcome.error_detail) {
- lines.push({ id: "detail", tone: "neutral", label: t("subagents_view.line_provider_said"), text: outcome.error_detail, mono: true });
- }
- if (outcome.failed_provider) {
- lines.push({ id: "provider", tone: "neutral", label: t("subagents_view.line_provider"), text: outcome.failed_provider });
- }
- for (const kill of outcome.kills) {
- // Rounds are numbered from 1 everywhere the page speaks to a person;
- // the worker id carries the 0-based iteration.
- const iter = /::iter(\d+)$/.exec(kill.worker_id)?.[1];
- lines.push({
- id: `kill-${kill.worker_id}`,
- tone: kill.reason === "user" ? "warn" : "error",
- label: iter != null
- ? fill(t("subagents_view.line_worker_stopped_iter"), { n: Number(iter) + 1 })
- : t("subagents_view.line_worker_stopped"),
- text: kill.error_detail && kill.error_detail !== outcome.error_detail
- ? `${killLabel(kill.reason, t)} — ${kill.error_detail}`
- : killLabel(kill.reason, t),
- });
- }
- if (outcome.lastVerdict && outcome.lastVerdict.verdict !== "approve") {
- lines.push({
- id: "verdict",
- tone: "warn",
- label: fill(t("subagents_view.line_reviewer"), { verdict: t(`subagents_view.verdict.${outcome.lastVerdict.verdict}`) }),
- text: outcome.lastVerdict.summary,
- });
- }
- if (outcome.lastCorrection) {
- lines.push({ id: "correction", tone: "warn", label: t("subagents_view.line_correction"), text: outcome.lastCorrection.correction_instruction });
- }
- if (outcome.last_state) {
- lines.push({ id: "state", tone: "neutral", label: t("subagents_view.line_last_state"), text: t(`mission_state.${outcome.last_state.toLowerCase()}`) });
- }
- if (outcome.partial_artifacts.length > 0) {
- lines.push({
- id: "partial",
- tone: "neutral",
- label: t("subagents_view.line_partial"),
- text: fill(t("subagents_view.line_partial_text"), { n: outcome.partial_artifacts.length }),
- });
- }
- if (outcome.terminal === "timed_out" && outcome.deadline_ms) {
- lines.push({ id: "deadline", tone: "neutral", label: t("subagents_view.line_deadline"), text: formatDuration(outcome.deadline_ms) });
- }
- } else if (outcome.terminal === "cancelled") {
- if (reason) lines.push({ id: "reason", tone: "warn", label: t("subagents_view.line_reason"), text: reason });
- if (outcome.cascade) lines.push({ id: "cascade", tone: "neutral", label: t("subagents_view.line_cascade"), text: t("subagents_view.line_cascade_text") });
- for (const kill of outcome.kills) {
- lines.push({ id: `kill-${kill.worker_id}`, tone: "warn", label: t("subagents_view.line_worker_stopped"), text: killLabel(kill.reason, t) });
- }
- } else if (outcome.terminal === "approved") {
- if (outcome.summary) lines.push({ id: "summary", tone: "ok", label: t("subagents_view.line_summary"), text: outcome.summary });
- if (outcome.lastVerdict) {
- lines.push({
- id: "verdict",
- tone: "ok",
- label: fill(t("subagents_view.line_reviewer"), { verdict: t(`subagents_view.verdict.${outcome.lastVerdict.verdict}`) }),
- text: outcome.lastVerdict.summary,
- });
- }
- if (outcome.revisions > 0) {
- lines.push({ id: "revisions", tone: "warn", label: t("subagents_view.line_revisions"), text: fill(t("subagents_view.line_revisions_text"), { n: outcome.revisions }) });
- }
- } else {
- // Still running, or no terminal event recorded yet.
- const live = failureLabel(agent, t);
- if (live) lines.push({ id: "live-error", tone: "error", label: t("subagents_view.line_reason"), text: live });
- const notes = outcome.workers.reduce((sum, w) => sum + w.notes, 0);
- if (notes > 0) lines.push({ id: "notes", tone: "busy", label: t("subagents_view.line_progress"), text: fill(t("subagents_view.line_progress_text"), { n: notes }) });
- if (outcome.lastCorrection) {
- lines.push({ id: "correction", tone: "warn", label: t("subagents_view.line_correction"), text: outcome.lastCorrection.correction_instruction });
- }
- }
- return lines;
-}
-
-function OutcomePanel({
- agent,
- outcome,
+function VerdictCard({
+ narrative,
loading,
- artifactCount,
+ facts,
t,
}: {
- agent: SubAgentNode;
- outcome: AgentOutcome;
+ narrative: Narrative;
loading: boolean;
- artifactCount: number;
+ facts: Array<{ label: string; value: string; hint?: string }>;
t: T;
}) {
- const state: "running" | "approved" | "failed" | "cancelled" | "timed_out" =
- outcome.terminal ?? (agent.status === "running" ? "running" : agent.status === "failed" ? "failed" : agent.status === "cancelled" ? "cancelled" : "approved");
- const tone: StoryTone =
- state === "approved" ? "ok" : state === "running" ? "busy" : state === "cancelled" ? "warn" : "error";
- const Icon =
- state === "approved" ? CheckCircle2 : state === "running" ? Rocket : state === "cancelled" ? StopCircle : XCircle;
- const lines = outcomeLines(agent, outcome, t);
-
+ const tone = STATE_TONE[narrative.state];
+ const Icon = STATE_ICON[narrative.state];
return (
<Panel>
- <div className="flex items-start gap-3 px-4 py-4">
- <span className={cn("grid h-9 w-9 shrink-0 place-items-center rounded-full border", TONE_RING[tone], TONE_TEXT[tone])}>
- <Icon className="h-[18px] w-[18px]" />
+ <div className="flex items-start gap-4 px-5 pb-4 pt-5">
+ <span className={cn("grid h-11 w-11 shrink-0 place-items-center rounded-full border", TONE_RING[tone], TONE_TEXT[tone])}>
+ <Icon className="h-5 w-5" />
</span>
<div className="min-w-0 flex-1">
- <div className="font-display text-[15px] font-semibold text-foreground">
- {t(`subagents_view.outcome.${state}`)}
- </div>
- <p className="mt-0.5 text-sm text-muted-foreground">
- {loading
- ? t("subagents_view.insight_loading")
- : state === "approved"
- ? fill(t("subagents_view.outcome_approved_hint"), { n: artifactCount })
- : t(`subagents_view.outcome_hint.${state}`)}
+ <h2 className="font-display text-lg font-semibold leading-tight text-foreground">{narrative.headline}</h2>
+ <p className="mt-1.5 text-[15px] leading-relaxed text-foreground/90">
+ {loading ? t("subagents_view.insight_loading") : narrative.paragraph}
</p>
+ {narrative.quote && (
+ <blockquote className="mt-3 border-l-2 border-border pl-3">
+ <div className="text-xs font-medium text-muted-foreground">{narrative.quote.label}</div>
+ <div
+ className={cn(
+ "mt-0.5 whitespace-pre-wrap break-words text-foreground/85",
+ narrative.quote.mono ? "font-mono text-[12.5px] leading-relaxed" : "text-[14px] leading-relaxed",
+ )}
+ >
+ {narrative.quote.text}
+ </div>
+ </blockquote>
+ )}
+ {narrative.note && (
+ <p className="mt-3 flex items-center gap-1.5 text-sm text-muted-foreground">
+ <CircleAlert className="h-3.5 w-3.5 shrink-0" />
+ {narrative.note}
+ </p>
+ )}
</div>
</div>
- {lines.length > 0 && (
- <dl className="grid grid-cols-[max-content_minmax(0,1fr)] gap-x-6 gap-y-2 border-t border-border px-4 py-3 text-sm">
- {lines.map((line) => (
- <div key={line.id} className="contents">
- <dt className={cn("text-xs leading-6", TONE_TEXT[line.tone])}>{line.label}</dt>
- <dd className={cn("min-w-0 leading-6 text-foreground/90", line.mono && "whitespace-pre-wrap break-words font-mono text-[12.5px]")}>
- {line.text}
- </dd>
- </div>
- ))}
- </dl>
- )}
+ <dl className="grid grid-cols-2 gap-px border-t border-border bg-border/60 sm:grid-cols-3 lg:grid-cols-6">
+ {facts.map((f) => (
+ <div key={f.label} className="bg-card/80 px-4 py-2.5">
+ <dt className="text-[11px] uppercase tracking-wider text-muted-foreground">{f.label}</dt>
+ <dd className="mt-0.5 truncate text-sm font-medium text-foreground" title={f.hint ?? f.value}>
+ {f.value}
+ {f.hint && <span className="ml-1.5 font-normal text-muted-foreground">{f.hint}</span>}
+ </dd>
+ </div>
+ ))}
+ </dl>
</Panel>
);
}
// ---------------------------------------------------------------------------
-// Story — the run as it unfolded
+// 2. The timeline
// ---------------------------------------------------------------------------
-const STORY_ICON: Record<StoryEntry["kind"], typeof Bot> = {
+const ENTRY_ICON: Record<StoryEntry["kind"], typeof Bot> = {
dispatched: Rocket,
plan: ListChecks,
spawn: Bot,
@@ -567,30 +487,31 @@ const STORY_ICON: Record<StoryEntry["kind"], typeof Bot> = {
timed_out: Timer,
};
-function storyTitle(entry: StoryEntry, assistantName: string, t: T): string {
- const agent = agentBrand(assistantName);
+const AXIS_KEYS: Record<string, string> = {
+ correctness: "subagents_view.axis.correctness",
+ completeness: "subagents_view.axis.completeness",
+ side_effects: "subagents_view.axis.side_effects",
+ security: "subagents_view.axis.security",
+};
+
+function entryTitle(entry: StoryEntry, agentName: string, t: T): string {
const m = entry.meta;
switch (entry.kind) {
case "dispatched":
- return fill(t("subagents_view.story.dispatched"), { agent });
+ return fill(t("subagents_view.story.dispatched"), { agent: agentName });
case "plan":
return fill(t("subagents_view.story.plan"), { n: m.workers ?? "1" });
case "spawn":
- return fill(t("subagents_view.story.spawn"), {
- cli: m.cli || "—",
- iter: String((entry.iteration ?? 0) + 1),
- }) + (m.model ? ` · ${m.model}` : "");
+ return (
+ fill(t("subagents_view.story.spawn"), { cli: m.cli || "—", iter: String((entry.iteration ?? 0) + 1) }) +
+ (m.model ? ` · ${m.model}` : "")
+ );
case "narration":
- return fill(t("subagents_view.story.narration"), { agent });
- case "tool":
- return entry.tool ?? t("subagents_view.tool_unnamed");
+ return agentName;
case "draft":
- return fill(t("subagents_view.story.draft"), { n: m.diff_lines ?? "0" });
+ return t("subagents_view.story.draft");
case "verdict":
- return fill(t("subagents_view.story.verdict"), {
- verdict: t(`subagents_view.verdict.${m.verdict}`),
- confidence: m.confidence ?? "",
- });
+ return t("subagents_view.story.verdict");
case "correction":
return m.next_model
? fill(t("subagents_view.story.correction_model"), { model: m.next_model })
@@ -602,9 +523,9 @@ function storyTitle(entry: StoryEntry, assistantName: string, t: T): string {
case "approved":
return t("subagents_view.story.approved");
case "failed":
- return fill(t("subagents_view.story.failed"), { reason: reasonLabel(m.reason, t) ?? "" });
+ return fill(t("subagents_view.story.failed"), { reason: reasonText(m.reason, t) });
case "cancelled":
- return fill(t("subagents_view.story.cancelled"), { reason: reasonLabel(m.reason, t) ?? "" });
+ return fill(t("subagents_view.story.cancelled"), { reason: reasonText(m.reason, t) });
case "timed_out":
return t("subagents_view.story.timed_out");
default:
@@ -612,344 +533,288 @@ function storyTitle(entry: StoryEntry, assistantName: string, t: T): string {
}
}
-function StoryList({
- story,
+function Timeline({
+ blocks,
startedMs,
loading,
- assistantName,
+ agentName,
+ quoteText,
t,
}: {
- story: StoryEntry[];
+ blocks: StoryBlock[];
startedMs: number;
loading: boolean;
- assistantName: string;
+ agentName: string;
+ /** The sentence the verdict card already quotes — not repeated down here. */
+ quoteText: string | null;
t: T;
}) {
- if (story.length === 0) {
+ if (blocks.length === 0) {
return <EmptyNote>{loading ? t("subagents_view.insight_loading") : t("subagents_view.story_empty")}</EmptyNote>;
}
return (
- <ol className="divide-y divide-border/60">
- {story.map((entry) => {
- const Icon = STORY_ICON[entry.kind];
- const title = storyTitle(entry, assistantName, t);
- return (
- <li key={entry.id} className="grid grid-cols-[64px_28px_minmax(0,1fr)] items-start gap-x-3 px-4 py-2.5">
- <span className="pt-0.5 text-right font-mono text-[11px] tabular-nums text-muted-foreground/70">
- {formatOffset(entry.ts_ms - startedMs)}
- </span>
- <span className={cn("grid h-6 w-6 place-items-center rounded-full border", TONE_RING[entry.tone], TONE_TEXT[entry.tone])}>
- <Icon className="h-3.5 w-3.5" />
- </span>
- <div className="min-w-0">
- <div className="flex flex-wrap items-center gap-x-2 gap-y-0.5">
- <span className={cn("text-sm font-medium", entry.kind === "tool" ? "font-mono text-[13px] text-foreground" : "text-foreground")}>
- {title}
- </span>
- {entry.iteration != null && entry.kind !== "spawn" && entry.kind !== "verdict" && entry.kind !== "correction" && (
- <span className="text-[11px] text-muted-foreground/70">
- {fill(t("subagents_view.iteration_short"), { n: entry.iteration + 1 })}
- </span>
- )}
- {entry.meta.pct && <span className="text-[11px] text-muted-foreground/70">{entry.meta.pct}</span>}
- </div>
- {entry.text && (
- <ClampedBlock
- text={entry.text}
- t={t}
- lines={entry.kind === "tool" ? 2 : 3}
- className={cn("mt-0.5 text-sm", entry.kind === "tool" ? "font-mono text-[12.5px] text-muted-foreground" : "text-foreground/85")}
- />
- )}
- {entry.verdict && <AxisChips verdict={entry.verdict} />}
- </div>
- </li>
- );
- })}
+ <ol className="relative py-2">
+ {/* The rail the nodes sit on. */}
+ <span aria-hidden className="absolute bottom-6 left-[83px] top-6 w-px bg-border" />
+ {blocks.map((block) =>
+ block.kind === "actions" ? (
+ <ActionsRow key={block.id} block={block} startedMs={startedMs} t={t} />
+ ) : (
+ <EntryRow
+ key={block.entry.id}
+ entry={block.entry}
+ startedMs={startedMs}
+ agentName={agentName}
+ hideText={!!quoteText && block.entry.text === quoteText && block.entry.kind !== "narration"}
+ t={t}
+ />
+ ),
+ )}
</ol>
);
}
-function AxisChips({ verdict }: { verdict: CriticVerdictReady }) {
- const entries = Object.entries(verdict.axes ?? {});
- if (entries.length === 0) return null;
+function RowFrame({
+ offset,
+ icon: Icon,
+ tone,
+ children,
+}: {
+ offset: string;
+ icon: typeof Bot;
+ tone: StoryTone;
+ children: React.ReactNode;
+}) {
return (
- <div className="mt-1.5 flex flex-wrap gap-1.5">
- {entries.map(([name, axis]) => {
- const passed = axisPassed(axis);
- return (
- <span
- key={name}
- className={cn(
- "inline-flex h-5 items-center gap-1 rounded-md border px-1.5 font-mono text-[10.5px]",
- passed === true && "border-emerald-500/40 text-emerald-600 dark:text-emerald-400",
- passed === false && "border-destructive/40 text-destructive",
- passed === null && "border-border text-muted-foreground",
- )}
- >
- {passed === true ? <CheckCircle2 className="h-3 w-3" /> : passed === false ? <XCircle className="h-3 w-3" /> : null}
- {name}
- </span>
- );
- })}
- </div>
+ <li className="relative grid grid-cols-[56px_28px_minmax(0,1fr)] items-start gap-x-3 px-5 py-2.5">
+ <span className="pt-1 text-right font-mono text-[11px] tabular-nums text-muted-foreground/70">{offset}</span>
+ <span className={cn("relative z-[1] grid h-7 w-7 place-items-center rounded-full border", TONE_RING[tone], TONE_TEXT[tone])}>
+ <Icon className="h-3.5 w-3.5" />
+ </span>
+ <div className="min-w-0 pt-0.5">{children}</div>
+ </li>
);
}
-// ---------------------------------------------------------------------------
-// Transcript — reasoning / tool / spawn steps from the archived stream
-// ---------------------------------------------------------------------------
-
-const STEP_TONE: Record<string, "busy" | "ok" | "error" | "warn" | "off"> = {
- pending: "off",
- running: "busy",
- done: "ok",
- failed: "error",
- skipped: "warn",
-};
-
-function Transcript({
- steps,
- finalAnswer,
- truncated,
- dropped,
- hasSlug,
- loading,
+function EntryRow({
+ entry,
+ startedMs,
+ agentName,
+ hideText,
t,
}: {
- steps: PlanStep[];
- finalAnswer: string | null;
- truncated: boolean;
- dropped: number;
- hasSlug: boolean;
- loading: boolean;
+ entry: StoryEntry;
+ startedMs: number;
+ agentName: string;
+ hideText: boolean;
t: T;
}) {
- const lanes = useMemo(() => {
- const map = new Map<string, PlanStep[]>();
- for (const step of steps) {
- const key = step.task_key ?? "";
- if (!map.has(key)) map.set(key, []);
- map.get(key)!.push(step);
- }
- return [...map.entries()];
- }, [steps]);
-
- if (!hasSlug) return <EmptyNote>{t("subagents_view.transcript_no_dir")}</EmptyNote>;
- if (loading) return <EmptyNote>{t("subagents_view.insight_loading")}</EmptyNote>;
- if (steps.length === 0 && !finalAnswer) return <EmptyNote>{t("subagents_view.transcript_empty")}</EmptyNote>;
+ const title = entryTitle(entry, agentName, t);
+ const strong = ["approved", "failed", "cancelled", "timed_out", "killed", "verdict", "spawn"].includes(entry.kind);
+ const text = hideText ? "" : entry.text;
return (
- <div>
- {(truncated || dropped > 0) && (
- <div className="border-b border-border px-4 py-2 text-[11px] text-amber-600 dark:text-amber-400">
- {dropped > 0
- ? fill(t("subagents_view.transcript_dropped"), { n: dropped })
- : t("subagents_view.transcript_truncated")}
+ <RowFrame offset={formatOffset(entry.ts_ms - startedMs)} icon={ENTRY_ICON[entry.kind]} tone={entry.tone}>
+ {entry.kind === "narration" ? (
+ <div className="border-l-2 border-primary/40 pl-3">
+ <div className="text-xs font-medium text-muted-foreground">{title}</div>
+ <ClampedBlock text={text} t={t} lines={3} className="mt-0.5 text-[14.5px] leading-relaxed text-foreground/90" />
</div>
- )}
- {lanes.map(([key, laneSteps], laneIdx) => (
- <div key={key || laneIdx}>
- {lanes.length > 1 && (
- <div className="border-b border-border bg-sheen/[0.03] px-4 py-1.5 text-[11px] font-medium text-muted-foreground">
- {fill(t("subagents_view.transcript_lane"), { n: laneIdx + 1 })}
- <span className="ml-2 font-mono text-muted-foreground/60">{key}</span>
- </div>
+ ) : entry.kind === "verdict" && entry.verdict ? (
+ <VerdictRow verdict={entry.verdict} t={t} />
+ ) : (
+ <>
+ <div className={cn("text-sm", strong ? "font-semibold text-foreground" : "font-medium text-foreground/85")}>{title}</div>
+ {text && (
+ <ClampedBlock
+ text={text}
+ t={t}
+ lines={3}
+ className={cn("mt-0.5 text-sm leading-relaxed", entry.tone === "error" ? "text-destructive/90" : "text-muted-foreground")}
+ />
)}
- <ol className="divide-y divide-border/60">
- {laneSteps.map((step, idx) => (
- <TranscriptStep key={step.step_id} step={step} index={idx + 1} t={t} />
- ))}
- </ol>
- </div>
- ))}
- {finalAnswer && (
- <div className="border-t border-border px-4 py-3">
- <div className="mb-1.5 flex items-center gap-2 text-xs font-medium text-muted-foreground">
- <CheckCircle2 className="h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400" />
- {t("subagents_view.final_answer")}
- </div>
- <ClampedBlock text={finalAnswer} t={t} lines={8} className="whitespace-pre-wrap text-sm text-foreground/90" />
- </div>
+ </>
)}
- </div>
+ </RowFrame>
);
}
-function TranscriptStep({ step, index, t }: { step: PlanStep; index: number; t: T }) {
- const kind = step.kind ?? "tool";
- const Icon = kind === "reasoning" ? Brain : kind === "spawn" ? Bot : Wrench;
- const body = step.error ?? step.output ?? null;
+function VerdictRow({ verdict, t }: { verdict: CriticVerdictReady; t: T }) {
+ const tone: StoryTone = verdict.verdict === "approve" ? "ok" : verdict.verdict === "revise" ? "warn" : "error";
+ const axes = Object.entries(verdict.axes ?? {});
return (
- <li className="grid grid-cols-[36px_28px_minmax(0,1fr)_110px] items-start gap-x-3 px-4 py-2.5">
- <span className="pt-0.5 text-right font-mono text-[11px] tabular-nums text-muted-foreground/60">{index}</span>
- <span className={cn("grid h-6 w-6 place-items-center rounded-full border border-border bg-card", kind === "reasoning" ? "text-primary" : "text-muted-foreground")}>
- <Icon className="h-3.5 w-3.5" />
- </span>
- <div className="min-w-0">
- <div className={cn("text-sm", kind === "reasoning" ? "text-foreground/85" : "font-mono text-[13px] text-foreground")}>
- {kind === "reasoning" ? (
- <ClampedBlock text={step.output ?? step.name} t={t} lines={3} />
- ) : (
- <>
- {step.tool_name && <span className="mr-2 text-muted-foreground">{step.tool_name}</span>}
- <span className="break-all">{step.name}</span>
- </>
- )}
- </div>
- {kind !== "reasoning" && body && (
- <ClampedBlock
- text={body}
- t={t}
- lines={2}
- className={cn("mt-0.5 whitespace-pre-wrap font-mono text-[12px]", step.error ? "text-destructive" : "text-muted-foreground")}
- />
- )}
- {step.writes && step.writes.length > 0 && (
- <div className="mt-0.5 font-mono text-[11px] text-muted-foreground/70">
- {fill(t("subagents_view.step_writes"), { path: step.writes.join(", ") })}
- </div>
- )}
- </div>
- <div className="flex justify-end">
- {kind !== "reasoning" && (
- <StatusDot tone={STEP_TONE[step.status] ?? "off"} pulse={step.status === "running"} label={t(`subagents_view.step_status.${step.status}`)} />
- )}
+ <div>
+ <div className="flex flex-wrap items-center gap-2">
+ <span className="text-sm font-semibold text-foreground">{t("subagents_view.story.verdict")}</span>
+ <span className={cn("rounded-md border px-1.5 py-0.5 text-[11px] font-medium", TONE_RING[tone], TONE_TEXT[tone])}>
+ {t(`subagents_view.verdict.${verdict.verdict}`)}
+ </span>
+ <span className="text-xs text-muted-foreground">{Math.round(verdict.confidence * 100)}%</span>
</div>
- </li>
+ <p className="mt-1 text-sm leading-relaxed text-foreground/85">{verdict.summary}</p>
+ {axes.length > 0 && (
+ <ul className="mt-1.5 flex flex-wrap gap-x-4 gap-y-1">
+ {axes.map(([name, axis]) => {
+ const passed = axisPassed(axis);
+ const label = AXIS_KEYS[name] ? t(AXIS_KEYS[name]) : name;
+ return (
+ <li
+ key={name}
+ className={cn(
+ "inline-flex items-center gap-1 text-xs",
+ passed === true ? TONE_TEXT.ok : passed === false ? TONE_TEXT.error : "text-muted-foreground",
+ )}
+ >
+ {passed === true ? <CheckCircle2 className="h-3.5 w-3.5" /> : passed === false ? <XCircle className="h-3.5 w-3.5" /> : <CircleAlert className="h-3.5 w-3.5" />}
+ {label}
+ </li>
+ );
+ })}
+ </ul>
+ )}
+ </div>
);
}
-// ---------------------------------------------------------------------------
-// Review — the critic's verdicts and the corrections it demanded
-// ---------------------------------------------------------------------------
-
-function Review({ outcome, t }: { outcome: AgentOutcome; t: T }) {
- if (outcome.verdicts.length === 0 && !outcome.lastCorrection) {
- return <EmptyNote>{t("subagents_view.review_empty")}</EmptyNote>;
- }
+function ActionsRow({ block, startedMs, t }: { block: ActionsBlock; startedMs: number; t: T }) {
+ const [open, setOpen] = useState(false);
+ const span = block.end_ms - block.ts_ms;
return (
- <div className="divide-y divide-border/60">
- {outcome.verdicts.map((v, idx) => {
- const tone: StoryTone = v.verdict === "approve" ? "ok" : v.verdict === "revise" ? "warn" : "error";
- return (
- <div key={`${v.worker_id}-${v.iteration}-${idx}`} className="px-4 py-3">
- <div className="flex flex-wrap items-center gap-2">
- <span className={cn("rounded-md border px-1.5 py-0.5 font-mono text-[10.5px] uppercase tracking-wider", TONE_RING[tone], TONE_TEXT[tone])}>
- {t(`subagents_view.verdict.${v.verdict}`)}
- </span>
- <span className="text-[11px] text-muted-foreground">
- {fill(t("subagents_view.iteration_short"), { n: v.iteration + 1 })} · {Math.round(v.confidence * 100)}%
+ <RowFrame offset={formatOffset(block.ts_ms - startedMs)} icon={Wrench} tone="neutral">
+ <button
+ type="button"
+ onClick={() => setOpen((v) => !v)}
+ aria-expanded={open}
+ className="flex w-full items-center gap-2 text-left"
+ >
+ <span className="text-sm font-medium text-foreground/85">
+ {fill(t(block.entries.length === 1 ? "subagents_view.actions_one" : "subagents_view.actions_many"), {
+ n: block.entries.length,
+ span: formatDuration(span),
+ })}
+ </span>
+ <ChevronDown className={cn("h-3.5 w-3.5 text-muted-foreground transition-transform", open && "rotate-180")} />
+ </button>
+ <div className="mt-1.5 flex flex-wrap gap-1.5">
+ {block.counts.map((c) => (
+ <span key={c.tool} className="inline-flex h-6 items-center gap-1 rounded-md border border-border bg-sheen/[0.04] px-2 font-mono text-[11.5px] text-foreground/80">
+ {c.tool}
+ {c.n > 1 && <span className="text-muted-foreground">×{c.n}</span>}
+ </span>
+ ))}
+ </div>
+ {open && (
+ <ol className="mt-2 divide-y divide-border/50 rounded-lg border border-border/70 bg-sheen/[0.03]">
+ {block.entries.map((e) => (
+ <li key={e.id} className="grid grid-cols-[52px_minmax(0,1fr)] gap-x-3 px-3 py-1.5 font-mono text-[12px]">
+ <span className="text-muted-foreground/60">{formatOffset(e.ts_ms - startedMs)}</span>
+ <span className="min-w-0 break-all text-foreground/85">
+ <span className="mr-2 text-muted-foreground">{e.tool}</span>
+ {e.text}
</span>
- </div>
- <p className="mt-1.5 text-sm text-foreground/90">{v.summary}</p>
- <ul className="mt-2 space-y-1">
- {Object.entries(v.axes ?? {}).map(([name, axis]) => {
- const passed = axisPassed(axis);
- const evidence = (axis.evidence ?? []).filter((e): e is string => typeof e === "string");
- return (
- <li key={name} className="text-xs">
- <span className={cn("mr-2 inline-flex items-center gap-1 font-mono", passed === true ? TONE_TEXT.ok : passed === false ? TONE_TEXT.error : "text-muted-foreground")}>
- {passed === true ? <CheckCircle2 className="h-3 w-3" /> : passed === false ? <XCircle className="h-3 w-3" /> : <CircleAlert className="h-3 w-3" />}
- {name}
- </span>
- {evidence.length > 0 && (
- <span className="text-muted-foreground">{evidence.join(" · ")}</span>
- )}
- {axis.notes && <span className="ml-1 italic text-muted-foreground">{String(axis.notes)}</span>}
- </li>
- );
- })}
- </ul>
- </div>
- );
- })}
- {outcome.lastCorrection && (
- <div className="px-4 py-3">
- <div className="flex items-center gap-2 text-xs font-medium text-amber-600 dark:text-amber-400">
- <AlertTriangle className="h-3.5 w-3.5" />
- {outcome.lastCorrection.next_model
- ? fill(t("subagents_view.story.correction_model"), { model: outcome.lastCorrection.next_model })
- : t("subagents_view.story.correction")}
- </div>
- <p className="mt-1 whitespace-pre-wrap text-sm text-foreground/90">{outcome.lastCorrection.correction_instruction}</p>
- </div>
+ </li>
+ ))}
+ </ol>
)}
- </div>
+ </RowFrame>
);
}
// ---------------------------------------------------------------------------
-// Output — summary, final answer, deliverables
+// The archived transcript, folded under the timeline
// ---------------------------------------------------------------------------
-function Output({
- outcome,
- finalAnswer,
- artifacts,
+const STEP_TONE: Record<string, "busy" | "ok" | "error" | "warn" | "off"> = {
+ pending: "off",
+ running: "busy",
+ done: "ok",
+ failed: "error",
+ skipped: "warn",
+};
+
+function TranscriptFold({
+ steps,
+ hasSlug,
+ hadWorkers,
+ loading,
truncated,
- slug,
- onOpenOutput,
+ dropped,
t,
}: {
- outcome: AgentOutcome;
- finalAnswer: string | null;
- artifacts: MissionArtifact[];
+ steps: PlanStep[];
+ hasSlug: boolean;
+ hadWorkers: boolean;
+ loading: boolean;
truncated: boolean;
- slug: string | null;
- onOpenOutput: (slug: string) => void;
+ dropped: number;
t: T;
}) {
- if (!outcome.summary && !finalAnswer && artifacts.length === 0) {
- return <EmptyNote>{t("subagents_view.output_empty")}</EmptyNote>;
+ const [open, setOpen] = useState(false);
+ if (!hasSlug) {
+ return hadWorkers ? (
+ <div className="border-t border-border/60 px-5 py-2.5 text-xs text-muted-foreground">{t("subagents_view.transcript_no_dir")}</div>
+ ) : null;
}
+ if (loading || steps.length === 0) return null;
+
return (
- <div className="divide-y divide-border/60">
- {outcome.summary && (
- <div className="px-4 py-3">
- <div className="mb-1 text-xs font-medium text-muted-foreground">{t("subagents_view.line_summary")}</div>
- <p className="text-sm text-foreground/90">{outcome.summary}</p>
- </div>
- )}
- {finalAnswer && (
- <div className="px-4 py-3">
- <div className="mb-1 text-xs font-medium text-muted-foreground">{t("subagents_view.final_answer")}</div>
- <ClampedBlock text={finalAnswer} t={t} lines={10} className="whitespace-pre-wrap text-sm text-foreground/90" />
- </div>
- )}
- {artifacts.length > 0 && (
- <div>
- <div className="flex items-center justify-between gap-3 px-4 py-2.5">
- <div className="text-xs font-medium text-muted-foreground">
- {fill(t("subagents_view.deliverables"), { n: artifacts.length })}
- {truncated && <span className="ml-2 text-amber-600 dark:text-amber-400">{t("subagents_view.deliverables_truncated")}</span>}
+ <div className="border-t border-border/60">
+ <button
+ type="button"
+ onClick={() => setOpen((v) => !v)}
+ aria-expanded={open}
+ className="flex w-full items-center gap-2 px-5 py-3 text-left text-sm text-muted-foreground hover:text-foreground"
+ >
+ <ChevronRight className={cn("h-4 w-4 transition-transform", open && "rotate-90")} />
+ {fill(t("subagents_view.transcript_fold"), { n: steps.length })}
+ </button>
+ {open && (
+ <div className="border-t border-border/60">
+ {(truncated || dropped > 0) && (
+ <div className="px-5 py-2 text-xs text-amber-600 dark:text-amber-400">
+ {dropped > 0 ? fill(t("subagents_view.transcript_dropped"), { n: dropped }) : t("subagents_view.transcript_truncated")}
</div>
- {slug && (
- <SoftButton onClick={() => onOpenOutput(slug)}>
- <ArrowUpRight className="h-3.5 w-3.5" />
- {t("subagents_view.action_open_output")}
- </SoftButton>
- )}
- </div>
- <ul className="divide-y divide-border/60 border-t border-border/60">
- {artifacts.map((a) => (
- <li key={a.path} className="px-4 py-2.5">
- <div className="flex items-center gap-2 text-sm">
- <FileText className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
- <span className="min-w-0 flex-1 truncate font-mono text-[13px]" title={a.deliverable_path}>{a.deliverable_path}</span>
- <span className="shrink-0 text-xs tabular-nums text-muted-foreground">{formatBytes(a.size)}</span>
- </div>
- {a.content && (
- <ClampedBlock
- text={a.content}
- t={t}
- lines={4}
- className="mt-1 whitespace-pre-wrap rounded-md bg-sheen/[0.04] px-2.5 py-1.5 font-mono text-[12px] text-muted-foreground"
- />
- )}
- </li>
- ))}
- </ul>
+ )}
+ <ol className="divide-y divide-border/50">
+ {steps.map((step, idx) => {
+ const kind = step.kind ?? "tool";
+ const Icon = kind === "reasoning" ? Brain : kind === "spawn" ? Bot : Wrench;
+ const body = step.error ?? step.output ?? null;
+ return (
+ <li key={step.step_id} className="grid grid-cols-[36px_28px_minmax(0,1fr)_100px] items-start gap-x-3 px-5 py-2.5">
+ <span className="pt-0.5 text-right font-mono text-[11px] tabular-nums text-muted-foreground/60">{idx + 1}</span>
+ <span className={cn("grid h-6 w-6 place-items-center rounded-full border border-border bg-card", kind === "reasoning" ? "text-primary" : "text-muted-foreground")}>
+ <Icon className="h-3.5 w-3.5" />
+ </span>
+ <div className="min-w-0">
+ {kind === "reasoning" ? (
+ <ClampedBlock text={step.output ?? step.name} t={t} lines={3} className="text-sm leading-relaxed text-foreground/85" />
+ ) : (
+ <>
+ <div className="font-mono text-[12.5px] text-foreground">
+ {step.tool_name && <span className="mr-2 text-muted-foreground">{step.tool_name}</span>}
+ <span className="break-all">{step.name}</span>
+ </div>
+ {body && (
+ <ClampedBlock
+ text={body}
+ t={t}
+ lines={2}
+ className={cn("mt-0.5 whitespace-pre-wrap font-mono text-[11.5px]", step.error ? "text-destructive" : "text-muted-foreground")}
+ />
+ )}
+ </>
+ )}
+ </div>
+ <div className="flex justify-end">
+ {kind !== "reasoning" && (
+ <StatusDot tone={STEP_TONE[step.status] ?? "off"} pulse={step.status === "running"} label={t(`subagents_view.step_status.${step.status}`)} />
+ )}
+ </div>
+ </li>
+ );
+ })}
+ </ol>
</div>
)}
</div>
@@ -960,10 +825,40 @@ function Output({
// Small shared pieces
// ---------------------------------------------------------------------------
+function Section({
+ icon: Icon,
+ title,
+ subtitle,
+ actions,
+ children,
+}: {
+ icon: typeof Bot;
+ title: string;
+ subtitle?: string;
+ actions?: React.ReactNode;
+ children: React.ReactNode;
+}) {
+ return (
+ <Panel>
+ <div className="flex items-start justify-between gap-4 border-b border-border px-5 py-3.5">
+ <div className="flex min-w-0 items-start gap-2.5">
+ <Icon className="mt-0.5 h-4 w-4 shrink-0 text-primary" />
+ <div className="min-w-0">
+ <h2 className="font-display text-[15px] font-semibold text-foreground">{title}</h2>
+ {subtitle && <p className="mt-0.5 text-xs text-muted-foreground">{subtitle}</p>}
+ </div>
+ </div>
+ {actions ? <div className="shrink-0">{actions}</div> : null}
+ </div>
+ {children}
+ </Panel>
+ );
+}
+
function LiveToolCall({ call, t }: { call: ToolCallEntry; t: T }) {
const tone: Record<ToolCallEntry["status"], "busy" | "ok" | "error"> = { running: "busy", completed: "ok", failed: "error" };
return (
- <div className="grid grid-cols-[minmax(0,1fr)_64px_96px] items-center gap-3 px-4 py-2.5 text-sm">
+ <div className="grid grid-cols-[minmax(0,1fr)_64px_96px] items-center gap-3 px-5 py-2.5 text-sm">
<div className="min-w-0">
<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}>
@@ -983,17 +878,15 @@ function LiveToolCall({ call, t }: { call: ToolCallEntry; t: T }) {
const CLAMP_CLASS: Record<number, string> = {
2: "line-clamp-2",
3: "line-clamp-3",
- 4: "line-clamp-4",
8: "line-clamp-[8]",
- 10: "line-clamp-[10]",
};
/** Text that clamps to `lines` and expands on a click — the page's own "more". */
-function ClampedBlock({ text, t, lines, className }: { text: string; t: T; lines: 2 | 3 | 4 | 8 | 10; className?: string }) {
+function ClampedBlock({ text, t, lines, className }: { text: string; t: T; lines: 2 | 3 | 8; className?: string }) {
const [open, setOpen] = useState(false);
- // Roughly: a text that cannot overflow needs no toggle. Measured by length
- // and line breaks rather than layout so the list never re-flows on mount.
- const long = text.length > lines * 90 || text.split("\n").length > lines;
+ // Judged by length and line breaks rather than layout, so the list never
+ // re-flows on mount.
+ const long = text.length > lines * 100 || text.split("\n").length > lines;
return (
<div className={cn("min-w-0", className)}>
<div className={cn("break-words", !open && long && CLAMP_CLASS[lines])}>{text}</div>
@@ -1007,19 +900,12 @@ function ClampedBlock({ text, t, lines, className }: { text: string; t: T; lines
}
function EmptyNote({ children }: { children: React.ReactNode }) {
- return <div className="px-4 py-8 text-center text-sm text-muted-foreground">{children}</div>;
+ return <div className="px-5 py-8 text-center text-sm text-muted-foreground">{children}</div>;
}
-function Notice({ tone, children }: { tone: "warn" | "error"; children: React.ReactNode }) {
+function Notice({ children }: { children: React.ReactNode }) {
return (
- <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",
- )}
- >
+ <div className="flex items-center gap-2 rounded-xl border border-destructive/30 bg-destructive/10 px-3.5 py-2.5 text-sm text-destructive">
<CircleAlert className="h-4 w-4 shrink-0" />
<span className="min-w-0 flex-1 truncate">{children}</span>
</div>
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.tsx
index af681ad2d0..a2bca67c25 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
@@ -76,31 +76,25 @@ describe("DepartureBoard cancellation status", () => {
});
describe("DepartureBoard row click", () => {
- it("opens the run's insight page from the row and keeps the chevron for the inline peek", () => {
+ it("opens the run's insight page from EVERY row, with or without tool calls", () => {
const opened: string[] = [];
- // A finished run with tool calls: it has a drilldown but is not
- // auto-expanded (only running rows are), so the chevron's effect is visible.
- const agent = node({
- trace_id: "m-live",
+ const withTools = node({
+ trace_id: "m-tools",
status: "completed",
- utterance: "Live mission",
- tool_calls: [
- { tool_name: "Read", args_preview: "x.py", started_ns: 1, status: "completed" },
- ],
+ utterance: "Tools mission",
+ tool_calls: [{ tool_name: "Read", args_preview: "x.py", started_ns: 2, status: "completed" }],
});
- render(<DepartureBoard agents={[agent]} onOpen={(a) => opened.push(a.trace_id)} />);
+ const bare = node({ trace_id: "m-bare", status: "completed", utterance: "Bare mission", started_ns: 1 });
+ render(<DepartureBoard agents={[withTools, bare]} onOpen={(a) => opened.push(a.trace_id)} />);
- const row = screen.getByRole("row", { name: "Live mission" });
- expect(screen.queryByText("x.py")).toBeNull();
- fireEvent.click(row);
- expect(opened).toEqual(["m-live"]);
- expect(screen.queryByText("x.py")).toBeNull();
+ fireEvent.click(screen.getByRole("row", { name: "Tools mission" }));
+ fireEvent.click(screen.getByRole("row", { name: "Bare mission" }));
+ expect(opened).toEqual(["m-tools", "m-bare"]);
- // The chevron is its own control: it expands the row in place and does
- // NOT navigate — clicking it must not add a second "opened" entry.
- fireEvent.click(within(row).getByRole("button", { name: /expand row/i }));
- expect(opened).toEqual(["m-live"]);
- expect(screen.getByText("x.py")).toBeTruthy();
+ // Nothing expands in place any more — the inline peek that only SOME
+ // rows had is gone, so no tool-call detail leaks into the board.
+ expect(screen.queryByText("x.py")).toBeNull();
+ expect(screen.queryByRole("button", { name: /expand row/i })).toBeNull();
});
it("shows the archived terminal reason in the result column of a failed row", () => {
@@ -131,8 +125,8 @@ describe("DepartureBoard empty state", () => {
});
});
-describe("DepartureBoard drilldown", () => {
- it("opens a running agent's tool calls and details inline", () => {
+describe("DepartureBoard without a page to open", () => {
+ it("keeps every row plain and unclickable, running ones included", () => {
render(
<DepartureBoard
agents={[
@@ -142,52 +136,19 @@ describe("DepartureBoard drilldown", () => {
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,
- },
+ { tool_name: "Grep", args_preview: "pattern=BUG-", started_ns: 1, 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);
- });
-
- 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 row = screen.getByRole("row", { name: /nothing to drill into/i });
+ // The board no longer expands anything in place: a running agent's tool
+ // calls live on its insight page, and without `onOpen` there is no page.
+ const row = screen.getByRole("row", { name: /audit the release notes/i });
expect(row.getAttribute("tabindex")).toBeNull();
- expect(screen.queryByText(/trace m-bare/)).toBeNull();
+ expect(screen.queryByText("pattern=BUG-")).toBeNull();
+ expect(screen.getAllByRole("row")).toHaveLength(2); // header + the one agent
});
});
diff --git a/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.tsx b/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.tsx
index b5038b7aab..333219133b 100644
--- a/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.tsx
+++ b/jarvis/ui/web/frontend/src/views/sub-agents/DepartureBoard.tsx
@@ -10,29 +10,19 @@
* 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."
+ * Every row opens the run's own page (`AgentInsight`) — the same way for every
+ * row. The board used to expand SOME rows in place (only those the registry
+ * still held tool calls for, or that carried a summary), which read as "why
+ * does this one have an arrow and that one not?"; the inline drilldown is gone
+ * and the chevron now means one thing everywhere: there is a page behind this.
*
* 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 {
- AlertTriangle,
- Bot,
- CheckCircle2,
- ChevronDown,
- ChevronRight,
- CircleAlert,
- Radio,
- TerminalSquare,
- Wrench,
-} from "lucide-react";
+import { useEffect, useMemo, useState } from "react";
+import { AlertTriangle, Bot, CheckCircle2, ChevronRight, CircleAlert, Radio, Wrench } from "lucide-react";
-import type { SubAgentNode, ToolCallEntry } from "@/store/jarvisAgents";
+import type { SubAgentNode } from "@/store/jarvisAgents";
import type { SectionHealth } from "@/hooks/useProviders";
import { ExplicitSpawnHint } from "@/components/ExplicitSpawnHint";
import { ScrollArea } from "@/components/ui/scroll-area";
@@ -66,14 +56,6 @@ const STATUS_TONE: Record<SubAgentNode["status"], "busy" | "ok" | "error" | "war
cancelled: "warn",
};
-const TOOL_STATUS_TONE: Record<ToolCallEntry["status"], "busy" | "ok" | "error"> = {
- running: "busy",
- completed: "ok",
- failed: "error",
-};
-
-const formatRelative = formatDuration;
-
function startedMs(node: SubAgentNode): number {
return node.started_ns > 1_000_000_000_000_000
? Math.floor(node.started_ns / 1_000_000)
@@ -81,8 +63,8 @@ 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));
+ if (node.duration_ms != null) return formatDuration(node.duration_ms);
+ if (node.status === "running") return formatDuration(nowMs - startedMs(node));
return "—";
}
@@ -149,27 +131,12 @@ export function DepartureBoard({
const t = useT();
const assistantName = useEventStore((s) => s.assistantName);
const [nowMs, setNowMs] = useState(() => Date.now());
- const [expanded, setExpanded] = useState<Set<string>>(new Set());
useEffect(() => {
const id = window.setInterval(() => setNowMs(Date.now()), 1000);
return () => window.clearInterval(id);
}, []);
- useEffect(() => {
- setExpanded((prev) => {
- const next = new Set(prev);
- let changed = false;
- for (const agent of agents) {
- if (agent.status === "running" && agent.tool_calls.length > 0 && !next.has(agent.trace_id)) {
- next.add(agent.trace_id);
- changed = true;
- }
- }
- return changed ? next : prev;
- });
- }, [agents]);
-
const sortedAgents = useMemo(
() => [...agents].sort((a, b) => b.started_ns - a.started_ns),
[agents],
@@ -184,22 +151,14 @@ export function DepartureBoard({
0,
);
- const toggle = (traceId: string) =>
- setExpanded((prev) => {
- const next = new Set(prev);
- if (next.has(traceId)) next.delete(traceId);
- else next.add(traceId);
- return 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)" },
+ { id: "open", label: t("subagents_view.col_open"), width: "28px", srOnly: true },
];
return (
@@ -291,7 +250,7 @@ export function DepartureBoard({
<div className="px-4 pt-4">
<PanelHeader
title={t("subagents_view.board_title")}
- subtitle={t("subagents_view.board_subtitle")}
+ subtitle={t(onOpen ? "subagents_view.board_subtitle_open" : "subagents_view.board_subtitle")}
actions={
<StatusDot
tone={activeCount > 0 ? "busy" : "off"}
@@ -336,8 +295,6 @@ export function DepartureBoard({
agent={agent}
columns={columns}
nowMs={nowMs}
- expanded={expanded.has(agent.trace_id)}
- onToggle={() => toggle(agent.trace_id)}
onOpen={onOpen ? () => onOpen(agent) : undefined}
t={t}
/>
@@ -382,195 +339,64 @@ function Notice({
}
// ---------------------------------------------------------------------------
-// One agent, plus its drilldown
+// One agent — a row that opens its page
// ---------------------------------------------------------------------------
function AgentRow({
agent,
columns,
nowMs,
- expanded,
- onToggle,
onOpen,
t,
}: {
agent: SubAgentNode;
columns: Column[];
nowMs: number;
- expanded: boolean;
- onToggle: () => void;
onOpen?: () => 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 task = taskLabel(agent, t);
const result = resultLabel(agent, t);
- // The row itself opens the run's insight page; the chevron keeps the quick
- // inline peek at live tool calls for a run that is still working. Without an
- // `onOpen` (the board rendered on its own) the row falls back to the peek.
- const rowClick = onOpen ?? (hasDrilldown ? onToggle : undefined);
-
return (
- <Fragment>
- <TableRow
- columns={columns}
- onClick={rowClick}
- selected={expanded}
- ariaLabel={task}
- >
- <Cell className="text-muted-foreground" stop={hasDrilldown && !!onOpen}>
- {hasDrilldown ? (
- <button
- type="button"
- onClick={onToggle}
- aria-expanded={expanded}
- aria-label={t("subagents_view.col_expand")}
- className="grid h-6 w-6 place-items-center rounded-md hover:bg-accent hover:text-foreground"
- >
- {expanded ? (
- <ChevronDown className="h-4 w-4" />
- ) : (
- <ChevronRight className="h-4 w-4" />
- )}
- </button>
- ) : onOpen ? (
- <ChevronRight className="h-4 w-4 opacity-0 transition-opacity group-hover:opacity-60" />
- ) : 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>
- </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>
- </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>
- ) : (
- <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>
- )}
- {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>
- </Panel>
+ <TableRow columns={columns} onClick={onOpen} ariaLabel={task}>
+ <Cell>
+ <div className="truncate text-[15px] font-medium text-foreground">
+ {displayAgentName(agent, assistantName, t)}
</div>
- </div>
- </div>
- );
-}
-
-function ToolCallRow({ call, t }: { call: ToolCallEntry; t: (key: string) => string }) {
- return (
- <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 font-medium text-foreground">
- {call.tool_name || t("subagents_view.tool_unnamed")}
+ <div className="truncate text-xs text-muted-foreground">
+ {agent.kind === "harness"
+ ? t("subagents_view.role_worker_hint")
+ : t("subagents_view.role_agent_hint")}
</div>
- <div className="truncate text-xs text-muted-foreground" title={call.args_preview}>
- {call.args_preview || call.output_preview || "—"}
- </div>
- </div>
- <div className="text-right text-xs tabular-nums text-muted-foreground">
- {call.duration_ms != null ? formatRelative(call.duration_ms) : "—"}
- </div>
- <div className="flex justify-end">
+ </Cell>
+ <Cell muted>
+ <span className="block truncate" title={task}>
+ {task}
+ </span>
+ </Cell>
+ <Cell>
<StatusDot
- tone={TOOL_STATUS_TONE[call.status]}
- pulse={call.status === "running"}
- label={t(`subagents_view.tool_status.${call.status}`)}
+ tone={STATUS_TONE[agent.status]}
+ pulse={agent.status === "running"}
+ label={t(`subagents_view.status.${agent.status}`)}
/>
- </div>
- </div>
+ </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>
+ </Cell>
+ <Cell align="right" className="text-muted-foreground/50 group-hover:text-foreground">
+ {onOpen ? <ChevronRight className="h-4 w-4" aria-hidden /> : null}
+ </Cell>
+ </TableRow>
);
}
diff --git a/jarvis/ui/web/frontend/src/views/sub-agents/narrative.test.ts b/jarvis/ui/web/frontend/src/views/sub-agents/narrative.test.ts
new file mode 100644
index 0000000000..8e878e71ea
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/sub-agents/narrative.test.ts
@@ -0,0 +1,138 @@
+import { describe, expect, it } from "vitest";
+
+import type { SubAgentNode } from "@/store/jarvisAgents";
+import type { CriticVerdictReady, WorkerKilled } from "@/types/missions";
+import { composeNarrative } from "./narrative";
+import type { AgentOutcome } from "./outcome";
+
+const identity = (key: string) => key;
+
+function agent(over: Partial<SubAgentNode> = {}): SubAgentNode {
+ return {
+ trace_id: "t",
+ kind: "jarvis_agent",
+ name: "",
+ status: "failed",
+ parent_trace_id: null,
+ started_ns: 1,
+ cost_usd: 0,
+ tokens_in: 0,
+ tokens_out: 0,
+ context_hints: [],
+ prompts: [],
+ tool_calls: [],
+ children_trace_ids: [],
+ review_iterations: 0,
+ depth: 0,
+ ui_appeared_at: 1,
+ ...over,
+ };
+}
+
+function outcome(over: Partial<AgentOutcome> = {}): AgentOutcome {
+ return {
+ terminal: "failed",
+ reason: "task_error",
+ error_class: null,
+ error_detail: null,
+ failed_provider: null,
+ last_state: null,
+ partial_artifacts: [],
+ summary: null,
+ result_uri: null,
+ cascade: false,
+ deadline_ms: null,
+ last_progress_ms: null,
+ wall_ms: null,
+ tokens_used: 0,
+ cost_usd: 0,
+ kills: [],
+ verdicts: [],
+ lastVerdict: null,
+ lastCorrection: null,
+ workers: [],
+ revisions: 0,
+ planWorkers: null,
+ expectedOutput: null,
+ ...over,
+ };
+}
+
+const ctx = { agentName: "Agent", runtime: "12s", artifactCount: 0, notes: 0 };
+const kill = (reason: WorkerKilled["reason"]): WorkerKilled => ({
+ event_type: "WorkerKilled",
+ worker_id: "m::t::iter0",
+ reason,
+});
+const verdict = (v: CriticVerdictReady["verdict"], iteration = 1): CriticVerdictReady => ({
+ event_type: "CriticVerdictReady",
+ worker_id: "m::t::iter1",
+ verdict: v,
+ summary: "The document is missing.",
+ confidence: 0.8,
+ axes: {},
+ iteration,
+});
+
+describe("composeNarrative — failures pick the most specific cause", () => {
+ it("names a provider quota failure and quotes the provider", () => {
+ const n = composeNarrative(
+ agent(),
+ outcome({ error_class: "provider_quota", error_detail: "limit reached", failed_provider: "claude", kills: [kill("budget")] }),
+ ctx,
+ identity,
+ );
+ expect(n.state).toBe("failed");
+ expect(n.paragraph).toBe("subagents_view.narrative.failed_provider_quota");
+ expect(n.quote).toEqual({ label: "subagents_view.narrative.quote_provider", text: "limit reached", mono: true });
+ });
+
+ it("explains an injection kill without a quote", () => {
+ const n = composeNarrative(agent(), outcome({ kills: [kill("injection_detected")] }), ctx, identity);
+ expect(n.paragraph).toBe("subagents_view.narrative.failed_injection");
+ expect(n.quote).toBeNull();
+ });
+
+ it("quotes the reviewer when the review ran out of time", () => {
+ const n = composeNarrative(
+ agent(),
+ outcome({ reason: "review_time_budget_exhausted", verdicts: [verdict("revise")], lastVerdict: verdict("revise"), revisions: 1 }),
+ ctx,
+ identity,
+ );
+ expect(n.paragraph).toBe("subagents_view.narrative.failed_review_time");
+ expect(n.quote?.label).toBe("subagents_view.narrative.quote_reviewer");
+ expect(n.quote?.text).toBe("The document is missing.");
+ });
+
+ it("mentions kept partial files as the closing note", () => {
+ const n = composeNarrative(agent(), outcome({ partial_artifacts: ["a", "b"] }), ctx, identity);
+ expect(n.paragraph).toBe("subagents_view.narrative.failed_generic");
+ expect(n.note).toBe("subagents_view.narrative.kept_partial");
+ });
+});
+
+describe("composeNarrative — the other outcomes", () => {
+ it("uses the run's own summary when it delivered, plus the review tail", () => {
+ const n = composeNarrative(
+ agent({ status: "completed" }),
+ outcome({ terminal: "approved", reason: null, summary: "Done. 3 files.", verdicts: [verdict("approve", 0)], lastVerdict: verdict("approve", 0) }),
+ { ...ctx, artifactCount: 3 },
+ identity,
+ );
+ expect(n.state).toBe("approved");
+ expect(n.paragraph).toBe("Done. 3 files. subagents_view.narrative.approved_first_round");
+ expect(n.note).toBe("subagents_view.narrative.delivered_files");
+ });
+
+ it("says you stopped it for a UI cancel", () => {
+ const n = composeNarrative(agent({ status: "cancelled" }), outcome({ terminal: "cancelled", reason: "ui_cancel" }), ctx, identity);
+ expect(n.paragraph).toBe("subagents_view.narrative.cancelled_by_you");
+ });
+
+ it("reports progress while still running", () => {
+ const n = composeNarrative(agent({ status: "running" }), outcome({ terminal: null, reason: null }), { ...ctx, notes: 4 }, identity);
+ expect(n.state).toBe("running");
+ expect(n.paragraph).toBe("subagents_view.narrative.running_notes");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/views/sub-agents/narrative.ts b/jarvis/ui/web/frontend/src/views/sub-agents/narrative.ts
new file mode 100644
index 0000000000..d53a0d93c4
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/views/sub-agents/narrative.ts
@@ -0,0 +1,201 @@
+/**
+ * The one paragraph that explains a run to a person.
+ *
+ * The event stream knows a run failed with `reason=task_error`,
+ * `error_class=provider_quota`, `killed=budget`, `last_state=CRITIQUING`. Read
+ * as a table of six labelled facts that is a puzzle; read as ONE sentence —
+ * "The worker stopped because the provider (claude) ran out of quota" — it is
+ * an answer. This module picks the most specific cause the facts support and
+ * turns it into that sentence, plus at most one quotation (what the provider
+ * or the reviewer actually said) and a closing note (what was kept).
+ *
+ * Pure: facts in, i18n keys + variables out. The component only renders.
+ */
+import { fill } from "@/i18n";
+import type { SubAgentNode } from "@/store/jarvisAgents";
+import { type AgentOutcome, splitReason, REASON_LABEL_KEYS } from "./outcome";
+
+type T = (key: string) => string;
+
+export interface Narrative {
+ /** `running` | `approved` | `failed` | `cancelled` | `timed_out` */
+ state: "running" | "approved" | "failed" | "cancelled" | "timed_out";
+ headline: string;
+ /** The explanation, one to three plain sentences. */
+ paragraph: string;
+ /** What the provider or the reviewer literally said, when they said anything. */
+ quote: { label: string; text: string; mono: boolean } | null;
+ /** A closing fact — "3 partial files were kept" — or null. */
+ note: string | null;
+}
+
+const K = "subagents_view.narrative";
+
+function roundsOf(outcome: AgentOutcome): number {
+ return Math.max(outcome.revisions, outcome.verdicts.length > 0 ? outcome.verdicts.at(-1)!.iteration : 0) + 1;
+}
+
+/** Also collapses the story's own repetition: the same upstream message can
+ * arrive as a progress note, a kill detail and the terminal detail. */
+export function composeNarrative(
+ agent: SubAgentNode,
+ outcome: AgentOutcome,
+ ctx: { agentName: string; runtime: string; artifactCount: number; notes: number },
+ t: T,
+): Narrative {
+ const vars = {
+ agent: ctx.agentName,
+ runtime: ctx.runtime,
+ provider: outcome.failed_provider || outcome.workers.at(0)?.cli || t(`${K}.the_provider`),
+ n: 0,
+ };
+ const say = (key: string, extra: Record<string, string | number> = {}) =>
+ fill(t(`${K}.${key}`), { ...vars, ...extra });
+
+ const state: Narrative["state"] =
+ outcome.terminal ??
+ (agent.status === "running"
+ ? "running"
+ : agent.status === "failed"
+ ? "failed"
+ : agent.status === "cancelled"
+ ? "cancelled"
+ : "approved");
+
+ const providerQuote = outcome.error_detail
+ ? { label: t(`${K}.quote_provider`), text: outcome.error_detail, mono: true }
+ : null;
+ const reviewerQuote = outcome.lastVerdict
+ ? { label: t(`${K}.quote_reviewer`), text: outcome.lastVerdict.summary, mono: false }
+ : null;
+ const kept =
+ outcome.partial_artifacts.length > 0
+ ? say("kept_partial", { n: outcome.partial_artifacts.length })
+ : null;
+
+ if (state === "running") {
+ return {
+ state,
+ headline: t("subagents_view.outcome.running"),
+ paragraph: ctx.notes > 0 ? say("running_notes", { n: ctx.notes }) : say("running_fresh"),
+ quote: outcome.lastCorrection
+ ? { label: t(`${K}.quote_reviewer`), text: outcome.lastCorrection.correction_instruction, mono: false }
+ : null,
+ note: null,
+ };
+ }
+
+ if (state === "approved") {
+ const rounds = roundsOf(outcome);
+ const reviewed = outcome.verdicts.length > 0;
+ const base = outcome.summary || say("approved_plain", { n: ctx.artifactCount });
+ const tail = reviewed
+ ? rounds > 1
+ ? say("approved_after_rounds", { n: rounds })
+ : say("approved_first_round")
+ : "";
+ return {
+ state,
+ headline: t("subagents_view.outcome.approved"),
+ paragraph: tail ? `${base} ${tail}` : base,
+ quote: null,
+ note: ctx.artifactCount > 0 ? say("delivered_files", { n: ctx.artifactCount }) : null,
+ };
+ }
+
+ if (state === "cancelled") {
+ const { head } = splitReason(outcome.reason);
+ const paragraph =
+ head === "ui_cancel" || head === "user_cancelled" || head === "user"
+ ? say("cancelled_by_you")
+ : head === "parent_cancelled"
+ ? say("cancelled_parent")
+ : say("cancelled_other", { reason: reasonText(outcome.reason, t) });
+ return { state, headline: t("subagents_view.outcome.cancelled"), paragraph, quote: null, note: kept };
+ }
+
+ if (state === "timed_out") {
+ return {
+ state,
+ headline: t("subagents_view.outcome.timed_out"),
+ paragraph: say("timed_out"),
+ quote: reviewerQuote,
+ note: kept,
+ };
+ }
+
+ // Failed — the most specific cause the facts support, in this order:
+ // a classified provider failure, a safety or runtime kill, a review
+ // outcome, a mission-level reason, then the generic sentence.
+ const kill = outcome.kills.at(-1) ?? null;
+ const { head, tail } = splitReason(outcome.reason);
+ let paragraph: string;
+ let quote: Narrative["quote"] = null;
+
+ switch (outcome.error_class) {
+ case "provider_quota":
+ paragraph = say("failed_provider_quota");
+ quote = providerQuote;
+ break;
+ case "provider_auth":
+ paragraph = say("failed_provider_auth");
+ quote = providerQuote;
+ break;
+ case "provider_unreachable":
+ paragraph = say("failed_provider_unreachable");
+ quote = providerQuote;
+ break;
+ case "worker_timeout":
+ paragraph = say("failed_worker_timeout");
+ quote = providerQuote;
+ break;
+ default:
+ if (kill?.reason === "injection_detected") {
+ paragraph = say("failed_injection");
+ } else if (kill?.reason === "path_guard") {
+ paragraph = say("failed_path_guard");
+ } else if (kill?.reason === "timeout" || head === "attempts_timed_out") {
+ paragraph = say("failed_timeout");
+ } else if (kill?.reason === "budget" || head === "budget_exceeded") {
+ paragraph = say("failed_budget");
+ quote = providerQuote;
+ } else if (head === "review_time_budget_exhausted") {
+ paragraph = say("failed_review_time");
+ quote = reviewerQuote;
+ } else if (head === "critic_loop_exhausted") {
+ paragraph = say("failed_review_loop", { n: roundsOf(outcome) });
+ quote = reviewerQuote;
+ } else if (head === "critic_rejected") {
+ paragraph = say("failed_review_rejected");
+ quote = reviewerQuote;
+ } else if (head === "critic_unavailable") {
+ paragraph = say("failed_no_reviewer");
+ } else if (head === "worktree_setup_failed") {
+ paragraph = say("failed_workspace");
+ } else if (head === "decompose_failed") {
+ paragraph = say("failed_plan", { detail: tail ?? "" }).trim();
+ } else if (head === "interrupted") {
+ paragraph = say("failed_interrupted");
+ } else if (kill?.reason === "worker_error") {
+ paragraph = say("failed_worker_error");
+ quote = providerQuote;
+ } else if (outcome.lastVerdict && outcome.lastVerdict.verdict !== "approve") {
+ paragraph = say("failed_after_review");
+ quote = reviewerQuote;
+ } else {
+ paragraph = say("failed_generic");
+ quote = providerQuote;
+ }
+ }
+
+ return { state, headline: t("subagents_view.outcome.failed"), paragraph, quote, note: kept };
+}
+
+/** Human label for a raw reason token, falling back to the token itself. */
+export function reasonText(reason: string | null | undefined, t: T): string {
+ const { head, tail } = splitReason(reason);
+ if (!head) return "";
+ const key = REASON_LABEL_KEYS[head];
+ const label = key ? t(key) : head;
+ return tail ? `${label} (${tail})` : label;
+}
diff --git a/jarvis/ui/web/frontend/src/views/sub-agents/outcome.test.ts b/jarvis/ui/web/frontend/src/views/sub-agents/outcome.test.ts
index 79a35a5f83..b95c76c26a 100644
--- a/jarvis/ui/web/frontend/src/views/sub-agents/outcome.test.ts
+++ b/jarvis/ui/web/frontend/src/views/sub-agents/outcome.test.ts
@@ -5,6 +5,7 @@ import {
buildStory,
classifyNote,
deriveOutcome,
+ groupStory,
missionIdFromTraceId,
splitReason,
} from "./outcome";
@@ -176,6 +177,45 @@ describe("buildStory", () => {
});
});
+describe("groupStory", () => {
+ it("folds a run of tool calls into one block and drops repeated kill text", () => {
+ const wid = "m::t::iter0";
+ const note = (text: string) =>
+ env(
+ { event_type: "WorkerProgress", worker_id: wid, pct: null, note: text, stalled: false, tokens_so_far: 0, cost_so_far: 0 },
+ { worker_id: wid, source_actor: "worker" },
+ );
+ const blocks = groupStory(
+ buildStory([
+ note("Grep: a"),
+ note("Read: b"),
+ note("Grep: c"),
+ note("Limit reached."),
+ env({ event_type: "WorkerKilled", worker_id: wid, reason: "budget", error_detail: "Limit reached." }, { worker_id: wid }),
+ env({ event_type: "MissionFailed", reason: "task_error", error_class: null, last_state: "RUNNING", partial_artifacts: [], error_detail: "Limit reached." }),
+ ]),
+ );
+ expect(blocks.map((b) => (b.kind === "actions" ? `actions:${b.entries.length}` : b.entry.kind))).toEqual([
+ "actions:3",
+ "narration",
+ "killed",
+ "failed",
+ ]);
+ const actions = blocks[0];
+ if (actions.kind !== "actions") throw new Error("expected an actions block");
+ expect(actions.counts).toEqual([
+ { tool: "Grep", n: 2 },
+ { tool: "Read", n: 1 },
+ ]);
+ // The kill and the terminal event repeat the note verbatim — the fold
+ // blanks their text so the same sentence is not printed three times.
+ const killed = blocks[2];
+ const failed = blocks[3];
+ expect(killed.kind === "entry" && killed.entry.text).toBe("");
+ expect(failed.kind === "entry" && failed.entry.text).toBe("");
+ });
+});
+
describe("classifyNote", () => {
it("does not mistake a sentence with a colon for a tool", () => {
expect(classifyNote("Note: the build passed").kind).toBe("narration");
diff --git a/jarvis/ui/web/frontend/src/views/sub-agents/outcome.ts b/jarvis/ui/web/frontend/src/views/sub-agents/outcome.ts
index 0186700712..75a3c15540 100644
--- a/jarvis/ui/web/frontend/src/views/sub-agents/outcome.ts
+++ b/jarvis/ui/web/frontend/src/views/sub-agents/outcome.ts
@@ -514,3 +514,65 @@ export function buildStory(events: EventEnvelope[]): StoryEntry[] {
}
return story;
}
+
+/** A run of consecutive tool calls, folded into one timeline block. */
+export interface ActionsBlock {
+ kind: "actions";
+ id: string;
+ ts_ms: number;
+ end_ms: number;
+ entries: StoryEntry[];
+ /** Tool name → how often it ran, insertion-ordered by first use. */
+ counts: Array<{ tool: string; n: number }>;
+}
+
+export type StoryBlock = { kind: "entry"; entry: StoryEntry } | ActionsBlock;
+
+/**
+ * Fold the story for reading: a worker that ran sixty tools in a row becomes
+ * ONE "ran 60 actions" block (expandable), while every narration, verdict,
+ * kill and terminal event keeps its own line. Also drops a kill's or terminal
+ * event's detail text when it merely repeats the note just before it — the
+ * same upstream error arrives three times in a real quota failure.
+ */
+export function groupStory(story: StoryEntry[]): StoryBlock[] {
+ const blocks: StoryBlock[] = [];
+ let run: StoryEntry[] = [];
+ let lastText = "";
+
+ const flush = () => {
+ if (run.length === 0) return;
+ const counts: Array<{ tool: string; n: number }> = [];
+ for (const e of run) {
+ const tool = e.tool ?? "tool";
+ const hit = counts.find((c) => c.tool === tool);
+ if (hit) hit.n += 1;
+ else counts.push({ tool, n: 1 });
+ }
+ blocks.push({
+ kind: "actions",
+ id: `actions-${run[0].id}`,
+ ts_ms: run[0].ts_ms,
+ end_ms: run[run.length - 1].ts_ms,
+ entries: run,
+ counts,
+ });
+ run = [];
+ };
+
+ for (const entry of story) {
+ if (entry.kind === "tool") {
+ run.push(entry);
+ continue;
+ }
+ flush();
+ let text = entry.text;
+ if ((entry.kind === "killed" || entry.kind === "failed") && text && text === lastText) {
+ text = "";
+ }
+ if (entry.text) lastText = entry.text;
+ blocks.push({ kind: "entry", entry: text === entry.text ? entry : { ...entry, text } });
+ }
+ flush();
+ return blocks;
+}