Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(artifacts): the Outputs section folds into Artifacts — every run in one rail, with its files, status and controls
rubenluetke10-beep3016383fd9db
diff --git a/jarvis/plugins/tool/navigate.py b/jarvis/plugins/tool/navigate.pyindex 220d33e556..c625b67977 100644--- a/jarvis/plugins/tool/navigate.py+++ b/jarvis/plugins/tool/navigate.py@@ -41,7 +41,6 @@ KNOWN: frozenset[str] = frozenset("settings","telephony","telephony-setup",- "outputs","socials","taskbar","contacts",@@ -134,8 +133,13 @@ _ALIASES: dict[str, str] = {"telefonie setup": "telephony-setup","telefon setup": "telephony-setup","telefonie einrichten": "telephony-setup",- "ausgaben": "outputs",- "output": "outputs",+ # The Outputs section folded into Artifacts (2026-08-23): every run is+ # listed there now, with or without a page. The old words still land.+ "outputs": "visualization",+ "output": "visualization",+ "ausgaben": "visualization", # i18n-allow: input vocab+ "ergebnisse": "visualization", # i18n-allow: input vocab+ "resultados": "visualization", # i18n-allow: input vocab"wallpapers": "wallpaper","background": "wallpaper","hintergrund": "wallpaper", # i18n-allow: input vocabdiff --git a/jarvis/ui/web/frontend/src/components/JarvisDock.tsx b/jarvis/ui/web/frontend/src/components/JarvisDock.tsxindex 7f44995bfd..e8dfb46253 100644--- a/jarvis/ui/web/frontend/src/components/JarvisDock.tsx+++ b/jarvis/ui/web/frontend/src/components/JarvisDock.tsx@@ -9,9 +9,12 @@ import { playDropConfirm } from "@/lib/sound";import { cn } from "@/lib/utils";import { useT } from "@/i18n";-/** MIME type carrying a mission reference from an Outputs card. Must match- * `MISSION_DND_MIME` in `views/OutputsView.tsx`. */-export const MISSION_DND_MIME = "application/x-jarvis-mission";+import { MISSION_DND_MIME } from "@/lib/missionDnd";++/** The MIME type a dragged run arrives under — one definition, shared with the+ * rail rows that start the drag (`lib/missionDnd.ts`). Re-exported for the+ * dock's own tests. */+export { MISSION_DND_MIME };function hasMission(dt: DataTransfer | null): boolean {if (!dt) return false;diff --git a/jarvis/ui/web/frontend/src/components/deck/DeckActivityCards.tsx b/jarvis/ui/web/frontend/src/components/deck/DeckActivityCards.tsxindex 680c64b7ad..a16b4982ee 100644--- a/jarvis/ui/web/frontend/src/components/deck/DeckActivityCards.tsx+++ b/jarvis/ui/web/frontend/src/components/deck/DeckActivityCards.tsx@@ -1,9 +1,9 @@import { useEffect, useMemo, useRef } from "react";import { useQuery } from "@tanstack/react-query";import {- FolderOpen,Gauge,MessagesSquare,+ Shapes,Terminal,} from "lucide-react";import { useEventStore } from "@/store/events";@@ -116,12 +116,14 @@ export function OutputsCard({ className }: { className?: string }) {return (<DeckCard- icon={FolderOpen}- title={t("deck.card_outputs")}+ icon={Shapes}+ title={t("nav.visualization")}meta={running > 0 ? running : outputs.data ? outputs.data.length : undefined}live={running > 0}variant="chamfer"- onOpen={() => setActiveSection("outputs")}+ // The Outputs section folded into Artifacts (2026-08-23): every run is+ // listed there, with or without a page.+ onOpen={() => setActiveSection("visualization")}openLabel={t("deck.open_section")}className={className}bodyClassName="overflow-y-auto"diff --git a/jarvis/ui/web/frontend/src/components/layout/MainView.sticky.test.tsx b/jarvis/ui/web/frontend/src/components/layout/MainView.sticky.test.tsxindex f193ea68bb..d1dc2352fb 100644--- a/jarvis/ui/web/frontend/src/components/layout/MainView.sticky.test.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/MainView.sticky.test.tsx@@ -52,8 +52,8 @@ vi.mock("@/views/ChatsSurface", () => ({ViewHeader: () => null,}));-vi.mock("@/views/OutputsView", () => ({- OutputsView: () => <div data-testid="outputs-stub">outputs</div>,+vi.mock("@/views/VisualizationView", () => ({+ VisualizationView: () => <div data-testid="artifacts-stub">artifacts</div>,}));function goTo(section: string) {@@ -90,8 +90,8 @@ describe("MainView — the classic terminal grid is sticky", () => {await screen.findByTestId("ide-stub");expect(ide.mounts).toBe(1);- goTo("outputs");- await screen.findByTestId("outputs-stub");+ goTo("visualization");+ await screen.findByTestId("artifacts-stub");// Still there, and still the FIRST one: a second mount would mean a dozen// terminals were torn down and rebuilt for a section change.@@ -100,7 +100,7 @@ describe("MainView — the classic terminal grid is sticky", () => {goTo("agentic-ide-classic");await waitFor(() =>- expect(screen.queryByTestId("outputs-stub")).toBeNull(),+ expect(screen.queryByTestId("artifacts-stub")).toBeNull(),);expect(ide.mounts).toBe(1);});@@ -114,8 +114,8 @@ describe("MainView — the classic terminal grid is sticky", () => {expect(sticky.className).not.toContain("hidden");expect(sticky.getAttribute("aria-hidden")).toBe("false");- goTo("outputs");- await screen.findByTestId("outputs-stub");+ goTo("visualization");+ await screen.findByTestId("artifacts-stub");expect(sticky.className).toContain("hidden");expect(sticky.getAttribute("aria-hidden")).toBe("true");@@ -127,8 +127,8 @@ describe("MainView — the classic terminal grid is sticky", () => {await screen.findByTestId("ide-stub");expect(ide.lastOnScreen).toBe(true);- goTo("outputs");- await screen.findByTestId("outputs-stub");+ goTo("visualization");+ await screen.findByTestId("artifacts-stub");// The view cannot measure this itself once it is `display: none`, and its// pollers need the answer to stop asking the backend about panes nobody is@@ -144,6 +144,6 @@ describe("MainView — the classic terminal grid is sticky", () => {// Two live copies of a workspace would fight over every pane's output// stream, so the ordinary switch must render nothing at all here.expect(screen.queryByTestId("chats-stub")).toBeNull();- expect(screen.queryByTestId("outputs-stub")).toBeNull();+ expect(screen.queryByTestId("artifacts-stub")).toBeNull();});});diff --git a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx b/jarvis/ui/web/frontend/src/components/layout/MainView.tsxindex 0936924c70..7b4b02d2f1 100644--- a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/MainView.tsx@@ -100,9 +100,6 @@ const TasksView = lazyView(() =>const SessionsView = lazyView(() =>import("@/views/SessionsView").then((m) => ({ default: m.SessionsView })),);-const OutputsView = lazyView(() =>- import("@/views/OutputsView").then((m) => ({ default: m.OutputsView })),-);const ClisHubView = lazyView(() =>import("@/views/ClisHubView").then((m) => ({ default: m.ClisHubView })),);@@ -476,8 +473,6 @@ function SwitchOnActiveSection({ active }: { active: string }) {case "voice-language":case "voice-api-keys":return <VoiceHubView />;- case "outputs":- return <OutputsView />;case "socials":return <SocialsView />;case "contacts":diff --git a/jarvis/ui/web/frontend/src/components/layout/navGroups.ts b/jarvis/ui/web/frontend/src/components/layout/navGroups.tsindex 11206b61e8..f282380ec1 100644--- a/jarvis/ui/web/frontend/src/components/layout/navGroups.ts+++ b/jarvis/ui/web/frontend/src/components/layout/navGroups.ts@@ -13,7 +13,6 @@ import {BookOpen,Boxes,Contact,- FolderOpen,Gauge,KeyRound,ListTodo,@@ -120,14 +119,17 @@ export const NAV_GROUPS: NavItem[][] = [{ id: "tasks", labelKey: "nav.tasks", icon: ListTodo },{ id: "sessions", labelKey: "nav.sessions", icon: Mic },{ id: "run_inspector", labelKey: "nav.run_inspector", icon: Gauge },- // The visual stage. Sits with the content group next to Outputs on- // purpose: it reads the same run archive, it just shows the pictures in it- // instead of listing the files.+ // Artifacts — everything a run produced: the pages and pictures on a+ // full-size stage, and every other run (its files, status and controls)+ // in the same rail. The Outputs section that used to list the runs+ // folded into this one (2026-08-23); the id stays "visualization" because+ // it crosses the navigate parity test, the detachable-view registry and+ // deep links.{id: "visualization",labelKey: "nav.visualization",icon: Shapes,- fallbackLabel: "Visualization",+ fallbackLabel: "Artifacts",},{ id: "board", labelKey: "nav.board", icon: Sparkles },{ id: "memory", labelKey: "nav.wiki", icon: Notebook },@@ -180,7 +182,6 @@ export const NAV_GROUPS: NavItem[][] = [// missing from a locale, and it is NOT interpolated.fallbackLabel: "Voice",},- { id: "outputs", labelKey: "nav.outputs", icon: FolderOpen },// Appearance. Sits with the configuration group rather than with the// content views: it changes how the app looks, not what it holds.{diff --git a/jarvis/ui/web/frontend/src/components/visualization/RunPanels.tsx b/jarvis/ui/web/frontend/src/components/visualization/RunPanels.tsxnew file mode 100644index 0000000000..e75ccac33a--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/visualization/RunPanels.tsx@@ -0,0 +1,401 @@+/**+ * The run-level pieces of the Artifacts section — what the Outputs section+ * used to show about a mission, now sitting next to the artifact it produced.+ *+ * - `RunStatusBadge`: the run's status word (running / success / error /+ * cancelled / needs review), one colour language for rail and stage.+ * - `RunActions`: hold-to-abort while it runs, Continue / Restart when it+ * ended early, the live-continuation chip, the GitHub link.+ * - `RunNotes`: why it ended (failure / cancellation / needs review), the+ * summary, the error — only drawn when there is something to say.+ * - `RunFiles`: every deliverable the run left behind, in the document reader+ * (`ArtifactViewer`), plumbing hidden and primary files first.+ *+ * All of it came over from `views/OutputsView.tsx` when that section folded+ * into Artifacts (2026-08-23); the i18n keys kept their `outputs_view.` prefix+ * because the strings did not change.+ */+import { useMemo } from "react";+import { FileText, Github, Loader2 } from "lucide-react";++import { cn } from "@/lib/utils";+import { useT } from "@/i18n";+import { HoldToAbortButton } from "@/components/HoldToAbortButton";+import { RerunButton } from "@/components/RerunButton";+import {+ ArtifactViewer,+ deliverableDisplayPath,+} from "@/components/outputs/ArtifactViewer";+import {+ useArtifactsForOutput,+ useCancelMission,+ useOutputsCapabilities,+ type ArtifactSummary,+ type OutputStatus,+ type OutputSummary,+} from "@/hooks/useOutputs";++const STATUS_BADGE: Record<OutputStatus, string> = {+ success: "border-emerald-400/40 bg-emerald-400/10 text-emerald-400",+ error: "border-destructive/40 bg-destructive/10 text-destructive",+ running: "border-primary/40 bg-primary/10 text-primary",+ // Deliberate user abort — amber, not the destructive red of a failure.+ cancelled: "border-amber-400/40 bg-amber-400/10 text-amber-400",+ unknown: "border-border bg-secondary/40 text-muted-foreground",+};++const NEEDS_REVIEW_BADGE = "border-amber-400/40 bg-amber-400/10 text-amber-300";++/** Review ended without approval, but a genuine deliverable was retained. */+export function runNeedsReview(run: OutputSummary): boolean {+ return (run.status ?? "unknown") === "error" && !!run.needs_review;+}++/** Tiny ping dot inside the RUNNING badge — inherits the badge colour. */+export function PulseDot() {+ return (+ <span className="relative flex h-1.5 w-1.5" aria-hidden="true">+ <span className="absolute inline-flex h-full w-full animate-ping rounded-full bg-current opacity-60" />+ <span className="relative inline-flex h-1.5 w-1.5 rounded-full bg-current" />+ </span>+ );+}++export function RunStatusBadge({+ run,+ size = "sm",+}: {+ run: OutputSummary;+ size?: "sm" | "md";+}) {+ const t = useT();+ const statusKey = run.status ?? "unknown";+ const needsReview = runNeedsReview(run);+ const badgeClass = needsReview ? NEEDS_REVIEW_BADGE : STATUS_BADGE[statusKey];+ const label = needsReview ? t("outputs_view.needs_review") : statusKey;+ return (+ <span+ data-testid="run-status-badge"+ className={cn(+ "inline-flex shrink-0 items-center gap-1 rounded border font-semibold uppercase tracking-wide",+ size === "sm" ? "px-1.5 py-0.5 text-[10px]" : "px-2 py-0.5 text-[10px]",+ badgeClass,+ )}+ >+ {statusKey === "running" && <PulseDot />}+ {label}+ </span>+ );+}++/**+ * Shown on a terminal (cancelled / errored) run whose re-run continuation is+ * still running. Replaces the "Continue"/"Restart" button so the run stops+ * implying the work is idle and re-runnable — the truth is that it is alive in+ * a linked child mission. Clicking jumps the selection to that live child+ * (forensic 2026-06-28: a cancelled run and its running continuation looked+ * identical, so the user could not tell whether the mission was running).+ */+function ContinuationChip({ onJump }: { onJump: () => void }) {+ const t = useT();+ const label = t("outputs_view.continuation_running");+ return (+ <button+ type="button"+ title={label}+ aria-label={label}+ data-testid="continuation-chip"+ onClick={(e) => {+ e.stopPropagation();+ onJump();+ }}+ className={cn(+ "inline-flex shrink-0 select-none items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide transition-colors",+ "border-primary/40 bg-primary/10 text-primary hover:bg-primary/20",+ )}+ >+ <PulseDot />+ <span>{label}</span>+ </button>+ );+}++/**+ * What can be done about the run right now: abort it while it runs, continue+ * or restart it once it ended early, jump to its live continuation, open the+ * GitHub page it produced. Nothing for a run that simply finished.+ */+export function RunActions({+ run,+ onJumpToRun,+}: {+ run: OutputSummary;+ /** Select another run by slug — how the continuation chip jumps to the child. */+ onJumpToRun: (slug: string) => void;+}) {+ const t = useT();+ const cancel = useCancelMission();+ const statusKey = run.status ?? "unknown";+ const canAbort = statusKey === "running" && !!run.mission_id;+ // A cancelled/errored run whose re-run continuation is still running: show+ // a live "running" chip (jumps to the child) instead of a "Continue" button.+ const liveChildSlug =+ statusKey === "cancelled" || statusKey === "error"+ ? (run.active_child_slug ?? null)+ : null;++ return (+ <span className="flex shrink-0 items-center gap-1.5" data-testid="run-actions">+ {canAbort && (+ <HoldToAbortButton+ size="sm"+ pending={cancel.isPending}+ onConfirm={() => {+ if (run.mission_id) cancel.mutate(run.mission_id);+ }}+ label={+ cancel.isPending ? t("outputs_view.aborting") : t("outputs_view.abort_hold")+ }+ />+ )}+ {liveChildSlug ? (+ <ContinuationChip onJump={() => onJumpToRun(liveChildSlug)} />+ ) : (+ <>+ {statusKey === "cancelled" && run.mission_id && (+ <RerunButton missionId={run.mission_id} action="continue" size="sm" />+ )}+ {statusKey === "error" && run.mission_id && (+ <RerunButton missionId={run.mission_id} action="restart" size="sm" />+ )}+ </>+ )}+ {run.github_url && (+ <a+ href={run.github_url}+ target="_blank"+ rel="noopener noreferrer"+ onClick={(e) => e.stopPropagation()}+ title="GitHub"+ className="inline-flex items-center gap-1 rounded border border-border bg-secondary/40 px-1.5 py-0.5 text-[10px] text-muted-foreground hover:text-primary"+ >+ <Github className="h-3 w-3" aria-hidden />+ GitHub+ </a>+ )}+ </span>+ );+}++/* ------------------------------------------------------------------------- */++const URL_REGEX = /(https?:\/\/[^\s)]+[^\s.,;:!?)])/g;++/**+ * Linkifies URLs in the text. The regex is deliberately simple — proper+ * Markdown support would need a real parser, but the summary is plain text+ * with the occasional link.+ */+function LinkifiedText({ text }: { text: string }) {+ const parts = useMemo(() => {+ const out: Array<{ type: "text" | "url"; value: string }> = [];+ let last = 0;+ URL_REGEX.lastIndex = 0;+ let match: RegExpExecArray | null;+ while ((match = URL_REGEX.exec(text)) !== null) {+ if (match.index > last) {+ out.push({ type: "text", value: text.slice(last, match.index) });+ }+ out.push({ type: "url", value: match[0] });+ last = match.index + match[0].length;+ }+ if (last < text.length) {+ out.push({ type: "text", value: text.slice(last) });+ }+ return out;+ }, [text]);++ return (+ <>+ {parts.map((p, i) =>+ p.type === "url" ? (+ <a+ key={i}+ href={p.value}+ target="_blank"+ rel="noopener noreferrer"+ className="text-primary underline-offset-2 hover:underline"+ >+ {p.value}+ </a>+ ) : (+ <span key={i}>{p.value}</span>+ ),+ )}+ </>+ );+}++/** True when `RunNotes` would draw anything for this run. */+export function runHasNotes(run: OutputSummary): boolean {+ return !!(run.terminal_reason || runNeedsReview(run) || run.summary || run.error);+}++/**+ * Why the run ended the way it did, and what it said about itself. The+ * failure / cancellation / needs-review card first (the thing that needs a+ * decision), the summary next, a bare error last. Nothing at all for a run+ * with nothing to say — the caller skips the block.+ */+export function RunNotes({ run, className }: { run: OutputSummary; className?: string }) {+ const t = useT();+ const statusKey = run.status ?? "unknown";+ const needsReview = runNeedsReview(run);+ const isCancelled = statusKey === "cancelled";+ if (!runHasNotes(run)) return null;++ return (+ <div className={cn("flex flex-col gap-3", className)} data-testid="run-notes">+ {(run.terminal_reason || needsReview) && (+ <section+ data-testid={needsReview ? "output-needs-review" : "output-terminal-reason"}+ className={cn(+ "rounded-xl border p-3",+ needsReview || isCancelled+ ? "border-amber-400/30 bg-amber-400/5"+ : "border-destructive/30 bg-destructive/5",+ )}+ >+ <div className="mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground">+ {needsReview+ ? t("outputs_view.needs_review")+ : isCancelled+ ? t("outputs_view.cancellation_reason")+ : t("outputs_view.failure_reason")}+ </div>+ {needsReview && (+ <p className="text-sm leading-relaxed text-foreground/90">+ {t("outputs_view.needs_review_hint")}+ </p>+ )}+ {!needsReview && !isCancelled && run.has_partial_output && (+ <p className="text-sm leading-relaxed text-foreground/90">+ {t("outputs_view.partial_output_hint")}+ </p>+ )}+ {run.terminal_reason && (+ <div className="mt-1 font-mono text-[11px] text-muted-foreground">+ {run.terminal_reason}+ </div>+ )}+ </section>+ )}++ {run.summary && (+ <section className="rounded-xl border border-border bg-card/40 p-3">+ <div className="mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground">+ Summary+ </div>+ <p className="whitespace-pre-wrap text-sm leading-relaxed text-foreground/90">+ <LinkifiedText text={run.summary} />+ </p>+ </section>+ )}++ {run.error && !run.terminal_reason && (+ <section className="rounded-xl border border-destructive/30 bg-destructive/5 p-3">+ <div className="mb-1 text-[10px] font-semibold uppercase tracking-wide text-destructive">+ {t("common.error")}+ </div>+ <pre className="whitespace-pre-wrap text-xs text-destructive/90">{run.error}</pre>+ </section>+ )}+ </div>+ );+}++/* ------------------------------------------------------------------------- */++// Pure plumbing the worker subprocess emits — never a user deliverable.+// Hiding it keeps the list to the actual files the worker created (under+// artifacts/files/) plus the captured diff, so a non-coder sees their result+// instead of stream logs (2026-05-29).+function isPlumbingArtifact(path: string): boolean {+ return (+ path.endsWith("stream.jsonl") ||+ path.endsWith("stderr.log") ||+ path.endsWith(".jarvis-mcp.json") ||+ path === "reflections.md"+ );+}++/** Put primary top-level files first, then group nested assets alphabetically. */+function compareDeliverablePaths(a: ArtifactSummary, b: ArtifactSummary): number {+ const left = deliverableDisplayPath(a.path);+ const right = deliverableDisplayPath(b.path);+ const depth = left.split("/").length - right.split("/").length;+ return (+ depth ||+ left.localeCompare(right, undefined, {+ numeric: true,+ sensitivity: "base",+ })+ );+}++/** The deliverables worth showing, primary files first. */+export function deliverableFiles(files: ArtifactSummary[]): ArtifactSummary[] {+ return files.filter((f) => !isPlumbingArtifact(f.path)).sort(compareDeliverablePaths);+}++/**+ * Every file the run left behind, in the document reader. The run's notes+ * (summary, why it ended) sit above the files: for a run that produced no+ * page — a research answer, a failed build — they ARE the result.+ */+export function RunFiles({ run }: { run: OutputSummary }) {+ const t = useT();+ const q = useArtifactsForOutput(run.slug);+ const caps = useOutputsCapabilities();+ const nativeActions = caps.data?.native_file_actions ?? false;+ const files = useMemo(() => deliverableFiles(q.data?.files ?? []), [q.data]);++ return (+ <div className="flex h-full flex-col gap-4 overflow-auto p-4" data-testid="run-files">+ <RunNotes run={run} />+ <section className="flex min-h-0 flex-col">+ <div className="mb-2 flex items-center gap-2">+ <FileText className="h-4 w-4 text-primary" aria-hidden />+ <span className="text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">+ {t("outputs_view.results")}+ </span>+ {!q.isLoading && (+ <span className="text-[11px] text-muted-foreground">+ {files.length}{" "}+ {files.length === 1 ? t("outputs_view.file") : t("outputs_view.files")}+ </span>+ )}+ </div>+ {q.isLoading ? (+ <div className="flex items-center gap-2 text-xs text-muted-foreground">+ <Loader2 className="h-3 w-3 animate-spin" aria-hidden />+ {t("outputs_view.loading_artifacts")}+ </div>+ ) : q.isError ? (+ <div className="text-xs text-destructive">+ {t("outputs_view.artifacts_load_error")}: {String(q.error)}+ </div>+ ) : files.length === 0 ? (+ <div className="text-xs text-muted-foreground">{t("outputs_view.no_files")}</div>+ ) : (+ <ArtifactViewer+ key={run.slug}+ slug={run.slug}+ files={files}+ nativeActions={nativeActions}+ />+ )}+ </section>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/hooks/useSectionUrlMemory.test.ts b/jarvis/ui/web/frontend/src/hooks/useSectionUrlMemory.test.tsindex 32b30d519f..f8ab8675a7 100644--- a/jarvis/ui/web/frontend/src/hooks/useSectionUrlMemory.test.ts+++ b/jarvis/ui/web/frontend/src/hooks/useSectionUrlMemory.test.ts@@ -33,8 +33,8 @@ describe("useSectionUrlMemory", () => {window.history.replaceState(null, "", "/?solo=1&view=chats");renderHook(() => useSectionUrlMemory());- act(() => useEventStore.getState().setActiveSection("outputs"));+ act(() => useEventStore.getState().setActiveSection("visualization"));- expect(window.location.search).toBe("?solo=1&view=outputs");+ expect(window.location.search).toBe("?solo=1&view=visualization");});});diff --git a/jarvis/ui/web/frontend/src/hooks/useVisualArtifacts.ts b/jarvis/ui/web/frontend/src/hooks/useVisualArtifacts.tsindex ab4c4d8249..86902a92b6 100644--- a/jarvis/ui/web/frontend/src/hooks/useVisualArtifacts.ts+++ b/jarvis/ui/web/frontend/src/hooks/useVisualArtifacts.ts@@ -3,7 +3,7 @@** No new REST surface: `/api/outputs` already lists the runs and* `/api/outputs/{slug}/artifacts` already lists their files, so this hook is a- * read over what the Outputs view reads too. What it adds is the SELECTION —+ * read over what the run graph reads too. What it adds is the SELECTION —* which of those files are things a person can look at — and a flat, newest-* first list across runs, because "show me what came out of this" is a question* about pages and pictures, not about directories.@@ -31,7 +31,8 @@ export type VisualKind = "image" | "vector" | "page" | "document";* Extension → kind. Deliberately narrow: everything here must render inside the* desktop WebView without a plugin or a converter. A format that only *some** hosts can draw would make the stage a coin flip, and a blank frame is a worse- * answer than not listing the file at all (it still shows up in Outputs).+ * answer than not listing the file at all (it still shows up under the+ * run's Files tab).*/const VISUAL_EXTENSIONS: ReadonlyArray<readonly [string, VisualKind]> = [[".png", "image"],@@ -81,8 +82,14 @@ export interface VisualArtifact {url: string;}-/** Newest runs scanned for visuals. See the module docstring for the why. */-export const DEFAULT_RUN_SCAN_LIMIT = 10;+/**+ * Newest runs scanned for visuals. See the module docstring for the why. Twenty+ * because that is how many runs the Outputs section listed before it folded+ * into Artifacts (2026-08-23): the rail shows every run the list returns, but+ * only these many are looked inside for pages and pictures up front — an older+ * run still shows as a run row and is read when picked.+ */+export const DEFAULT_RUN_SCAN_LIMIT = 20;/*** Encode an artifact path segment by segment.@@ -144,7 +151,8 @@ function decodeEntities(text: string): string {.replace(/'|'/g, "'");}-function toVisuals(run: OutputSummary, files: ArtifactSummary[]): VisualArtifact[] {+/** The visuals among a run's files, carrying the run they belong to. */+export function toVisuals(run: OutputSummary, files: ArtifactSummary[]): VisualArtifact[] {const visuals: VisualArtifact[] = [];for (const file of files) {const kind = classifyVisual(file.path);@@ -198,8 +206,9 @@ export function useVisualArtifacts(return useQueries({queries: scanned.map((run) => ({- // Same key as `useArtifactsForOutput`, so the Outputs view and this- // section share one cache entry rather than each fetching their own.+ // Same key as `useArtifactsForOutput`, so the stage's Files tab and the+ // run graph share one cache entry with this scan rather than each+ // fetching their own.queryKey: ["output-artifacts", run.slug],queryFn: async (): Promise<ArtifactsResponse> => {const response = await fetch(diff --git a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts b/jarvis/ui/web/frontend/src/hooks/useWebSocket.tsindex 9305e79cb3..12f35fba00 100644--- a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts+++ b/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts@@ -12,6 +12,7 @@ import {SECTION_LABELS,VOICE_STATES,isSectionId,+ resolveSectionId,useEventStore,type ChatMessage,type VoiceState,@@ -364,8 +365,11 @@ export function useWebSocket(): void {if (env.event_name === "NavigateSidebar") {const p = env.payload as { section?: string };const solo = useEventStore.getState().solo;- if (isSectionId(p.section)) {- if (p.section === "visualization") {+ // A retired id ("outputs") still arrives from older deep links and+ // spoken aliases; it lands on the section that holds its content now.+ const section = resolveSectionId(p.section);+ if (section !== null) {+ if (section === "visualization") {// The one section whose event can mean "and here is a NEW// picture": the visualize tool publishes this right after// archiving one. Landing on the gallery with the newest tile@@ -379,12 +383,12 @@ export function useWebSocket(): void {// A detached solo window is pinned to its one section; the spoken// "go to settings" targets the main window, and following it here// would blank the very view the user split off to keep.- setActiveSection(p.section);+ setActiveSection(section);}if (!solo) {pushToast("info",- `${translate("use_web_socket.jarvis_opened")} ${SECTION_LABELS[p.section]}`,+ `${translate("use_web_socket.jarvis_opened")} ${SECTION_LABELS[section]}`,);}}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 36e1c0af6f..6dfbaa2573 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -94,7 +94,6 @@"dictionary": "Wörterbuch","dictation": "Diktat","telephony": "Telefonie",- "outputs": "Outputs","socials": "Socials","taskbar": "Taskbar","contacts": "Kontakte",@@ -4471,22 +4470,23 @@},"visualization": {"title": "Artefakte",- "subtitle": "Die Seiten und Bilder, die deine Durchläufe erzeugt haben — in voller Größe, Quelltext und Durchlauf einen Tab entfernt",+ "subtitle": "Alles, was deine Durchläufe erzeugt haben — Seiten und Bilder in voller Größe, jeder andere Durchlauf mit Dateien, Status und Steuerung; Quelltext und Durchlauf einen Tab entfernt","refresh": "Aktualisieren",- "rail": "Artefakte",+ "rail": "Artefakte & Durchläufe","building": "Wird gebaut …","building_title": "„{0}“ wird gebaut","building_body": "Ein Hintergrund-Agent schreibt die Seite gerade. Sie erscheint hier, sobald sie fertig ist — meist innerhalb von ein bis zwei Minuten.",- "older_not_scanned": "Hier werden nur die neuesten {0} Durchläufe durchsucht — das ganze Archiv findest du unter Ausgaben.",+ "older_not_scanned": "Nur die neuesten {0} Durchläufe wurden nach Seiten und Bildern durchsucht — ältere stehen als Durchläufe in der Liste und werden beim Öffnen gelesen.","tab_preview": "Vorschau","tab_code": "Code",+ "tab_files": "Dateien","tab_run": "Durchlauf","stage_tabs": "Ansicht dieses Artefakts","open_external_hint": "Öffnet dieses Artefakt im Browser — ganzes Fenster, teilbar, druckbar.","page_sandbox_note": "Läuft in einer Sandbox: die Skripte der Seite funktionieren, das Netzwerk ist aus.","source_failed": "Der Quelltext dieses Artefakts konnte nicht gelesen werden.",- "empty_title": "Noch keine Artefakte",- "empty_body": "Bitte um eins — „visualisier mir das“, „mach ein Dashboard daraus“, „bau mir ein Artefakt“ — und die Seite erscheint hier, sobald der Agent sie geschrieben hat.",+ "empty_title": "Noch nichts da",+ "empty_body": "Alles, was Jarvis und seine Agenten erzeugen, landet hier — bitte um ein Artefakt („visualisier mir das“, „mach ein Dashboard daraus“) oder gib irgendeine Aufgabe, und sie erscheint, sobald der Durchlauf startet.","error_title": "Das Archiv der Durchläufe ist nicht lesbar","error_body": "Die Liste der Durchläufe ist gerade nicht verfügbar. Versuch es gleich noch einmal.","legend": "Obere Spur: der Durchlauf Schritt für Schritt — Gedanken, Aktionen, Sub-Agenten, Ergebnis. Untere Spur: die Dateien, die er hinterließ. Klick auf einen Knoten, um ihn zu inspizieren.",@@ -4619,7 +4619,6 @@"unavailable": "Gerade nicht verfügbar","card_runs": "Läufe","runs_empty": "Noch keine Läufe.",- "card_outputs": "Ergebnisse","outputs_empty": "Noch keine Ergebnisse.","card_ide": "Coding-Workspace","ide_empty": "Kein Workspace offen.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex b8bc45c459..7ef00862c9 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -94,7 +94,6 @@"dictionary": "Dictionary","dictation": "Dictation","telephony": "Telephony",- "outputs": "Outputs","socials": "Socials","taskbar": "Taskbar","contacts": "Contacts",@@ -4471,22 +4470,23 @@},"visualization": {"title": "Artifacts",- "subtitle": "The pages and pictures your runs produced — full-size, with the source and the run one tab away",+ "subtitle": "Everything your runs produced — pages and pictures full-size, every other run with its files, status and controls; source and run one tab away","refresh": "Refresh",- "rail": "Artifacts",+ "rail": "Artifacts & runs","building": "Building…","building_title": "Building “{0}”","building_body": "A background agent is writing the page. It appears here the moment it is done — usually within a minute or two.",- "older_not_scanned": "Only the newest {0} runs are scanned here — open Outputs for the full archive.",+ "older_not_scanned": "Only the newest {0} runs were scanned for pages and pictures — older runs are listed as runs and read when you open them.","tab_preview": "Preview","tab_code": "Code",+ "tab_files": "Files","tab_run": "Run","stage_tabs": "How to view this artifact","open_external_hint": "Open this artifact in your browser — full window, shareable, printable.","page_sandbox_note": "Runs in a sandbox: the page's own scripts work, the network is off.","source_failed": "The source of this artifact could not be read.",- "empty_title": "No artifacts yet",- "empty_body": "Ask for one — “visualize this”, “make a dashboard of it”, “build me an artifact” — and the page appears here as soon as the agent has written it.",+ "empty_title": "Nothing here yet",+ "empty_body": "Everything Jarvis and its agents produce lands here — ask for an artifact (“visualize this”, “make a dashboard of it”) or dispatch any task, and it appears as soon as the run starts.","error_title": "The run archive could not be read","error_body": "The list of runs is unavailable right now. Try again in a moment.","legend": "Top track: the run step by step — thoughts, actions, sub-agents, result. Bottom track: the files it left behind. Click a node to inspect it.",@@ -4619,7 +4619,6 @@"unavailable": "Not available right now","card_runs": "Runs","runs_empty": "No runs yet.",- "card_outputs": "Outputs","outputs_empty": "No outputs yet.","card_ide": "Coding workspace","ide_empty": "No workspace open.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 1a7196a973..fff5088640 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -94,7 +94,6 @@"dictionary": "Diccionario","dictation": "Dictado","telephony": "Telefonía",- "outputs": "Salidas","socials": "Redes","taskbar": "Barra","contacts": "Contactos",@@ -4471,22 +4470,23 @@},"visualization": {"title": "Artefactos",- "subtitle": "Las páginas e imágenes que produjeron tus ejecuciones — a tamaño completo, con el código y la ejecución a una pestaña de distancia",+ "subtitle": "Todo lo que produjeron tus ejecuciones — páginas e imágenes a tamaño completo, cada otra ejecución con sus archivos, estado y controles; código y ejecución a una pestaña de distancia","refresh": "Actualizar",- "rail": "Artefactos",+ "rail": "Artefactos y ejecuciones","building": "Creando…","building_title": "Creando «{0}»","building_body": "Un agente en segundo plano está escribiendo la página. Aparecerá aquí en cuanto termine — normalmente en uno o dos minutos.",- "older_not_scanned": "Aquí solo se revisan las {0} ejecuciones más recientes — abre Salidas para ver todo el archivo.",+ "older_not_scanned": "Solo las {0} ejecuciones más recientes se revisaron en busca de páginas e imágenes — las anteriores aparecen como ejecuciones y se leen al abrirlas.","tab_preview": "Vista previa","tab_code": "Código",+ "tab_files": "Archivos","tab_run": "Ejecución","stage_tabs": "Cómo ver este artefacto","open_external_hint": "Abre este artefacto en el navegador — ventana completa, se puede compartir e imprimir.","page_sandbox_note": "Se ejecuta en un entorno aislado: los scripts de la página funcionan, la red está desactivada.","source_failed": "No se pudo leer el código de este artefacto.",- "empty_title": "Todavía no hay artefactos",- "empty_body": "Pide uno — «visualízame esto», «haz un panel con ello», «créame un artefacto» — y la página aparecerá aquí en cuanto el agente la haya escrito.",+ "empty_title": "Todavía no hay nada",+ "empty_body": "Todo lo que Jarvis y sus agentes producen aparece aquí — pide un artefacto («visualízame esto», «haz un panel con ello») o envía cualquier tarea, y aparecerá en cuanto empiece la ejecución.","error_title": "No se pudo leer el archivo de ejecuciones","error_body": "La lista de ejecuciones no está disponible ahora mismo. Inténtalo de nuevo en un momento.","legend": "Pista superior: la ejecución paso a paso — pensamientos, acciones, subagentes, resultado. Pista inferior: los archivos que dejó. Haz clic en un nodo para inspeccionarlo.",@@ -4619,7 +4619,6 @@"unavailable": "No disponible ahora","card_runs": "Ejecuciones","runs_empty": "Aún no hay ejecuciones.",- "card_outputs": "Resultados","outputs_empty": "Aún no hay resultados.","card_ide": "Espacio de código","ide_empty": "Ningún espacio abierto.",diff --git a/jarvis/ui/web/frontend/src/views/OutputsView.dragdrop.test.tsx b/jarvis/ui/web/frontend/src/lib/missionDnd.payload.test.tssimilarity index 92%rename from jarvis/ui/web/frontend/src/views/OutputsView.dragdrop.test.tsxrename to jarvis/ui/web/frontend/src/lib/missionDnd.payload.test.tsindex 7f7455fb9b..f0157ca6ab 100644--- a/jarvis/ui/web/frontend/src/views/OutputsView.dragdrop.test.tsx+++ b/jarvis/ui/web/frontend/src/lib/missionDnd.payload.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from "vitest";-import { buildMissionDragPayload, MISSION_DND_MIME } from "./OutputsView";+import { buildMissionDragPayload, MISSION_DND_MIME } from "./missionDnd";describe("buildMissionDragPayload", () => {it("serialises the fields the dock needs", () => {diff --git a/jarvis/ui/web/frontend/src/views/OutputsView.dnd.test.ts b/jarvis/ui/web/frontend/src/lib/missionDnd.test.tssimilarity index 95%rename from jarvis/ui/web/frontend/src/views/OutputsView.dnd.test.tsrename to jarvis/ui/web/frontend/src/lib/missionDnd.test.tsindex a6d03cf4e8..de2eff4dd8 100644--- a/jarvis/ui/web/frontend/src/views/OutputsView.dnd.test.ts+++ b/jarvis/ui/web/frontend/src/lib/missionDnd.test.ts@@ -2,8 +2,8 @@ import { describe, it, expect, vi, beforeEach } from "vitest";import {startMissionDrag,MISSION_DND_MIME,- type OutputsDragMeta,-} from "./OutputsView";+ type MissionDragMeta,+} from "./missionDnd";import { useMissionDrag } from "@/store/missionDrag";function fakeDragEvent() {@@ -17,7 +17,7 @@ function fakeDragEvent() {return { dataTransfer, setData, setDragImage };}-const meta: OutputsDragMeta = {+const meta: MissionDragMeta = {slug: "mission_019ecc78",utterance: "Build the landing page",status: "success",diff --git a/jarvis/ui/web/frontend/src/lib/missionDnd.ts b/jarvis/ui/web/frontend/src/lib/missionDnd.tsnew file mode 100644index 0000000000..f5b90fb90f--- /dev/null+++ b/jarvis/ui/web/frontend/src/lib/missionDnd.ts@@ -0,0 +1,51 @@+/**+ * Dragging a run toward the Jarvis dock — the payload and the drag start.+ *+ * Lived in `views/OutputsView.tsx` until the Outputs section folded into the+ * Artifacts section (2026-08-23). The dock (`components/JarvisDock.tsx`) reads+ * the same MIME type; both sides import it from here so the two can never+ * drift apart.+ */+import type { DragEvent } from "react";++import { applyMissionDragImage } from "@/lib/missionDragImage";+import { useMissionDrag } from "@/store/missionDrag";+import type { OutputSummary } from "@/hooks/useOutputs";++/** MIME type carrying a mission reference between a rail row and the dock. */+export const MISSION_DND_MIME = "application/x-jarvis-mission";++/** The subset of a run the drag carries to the dock/server. */+export type MissionDragMeta = Pick<+ OutputSummary,+ "slug" | "utterance" | "status" | "summary" | "error" | "mission_id"+>;++/** Serialise the fields the dock/server need from a dragged run. */+export function buildMissionDragPayload(meta: MissionDragMeta): string {+ return JSON.stringify({+ slug: meta.slug,+ utterance: meta.utterance ?? "",+ status: meta.status ?? "unknown",+ summary: meta.summary ?? "",+ error: meta.error ?? "",+ mission_id: meta.mission_id ?? null,+ });+}++/**+ * Begin dragging a run toward the Jarvis dock. Writes the payload, swaps the+ * giant native drag ghost for a compact branded chip, and flags the drag+ * globally so the dock blooms into a big, forgiving target.+ */+export function startMissionDrag(e: DragEvent, meta: MissionDragMeta): void {+ e.dataTransfer.setData(MISSION_DND_MIME, buildMissionDragPayload(meta));+ e.dataTransfer.effectAllowed = "copy";+ applyMissionDragImage(e.dataTransfer, meta.utterance || meta.slug);+ useMissionDrag.getState().begin();+}++/** The drag ended (dropped or cancelled) — let the dock shrink back. */+export function endMissionDrag(): void {+ useMissionDrag.getState().end();+}diff --git a/jarvis/ui/web/frontend/src/store/events.ts b/jarvis/ui/web/frontend/src/store/events.tsindex bba0bd8bdc..0c966fb5da 100644--- a/jarvis/ui/web/frontend/src/store/events.ts+++ b/jarvis/ui/web/frontend/src/store/events.ts@@ -61,7 +61,6 @@ export type SectionId =| "settings"| "telephony"| "telephony-setup"- | "outputs"| "socials"| "taskbar"| "contacts"@@ -113,7 +112,6 @@ export const SECTION_IDS = ["settings","telephony","telephony-setup",- "outputs","socials","taskbar","contacts",@@ -139,12 +137,33 @@ export function isSectionId(value: unknown): value is SectionId {return typeof value === "string" && SECTION_IDS.includes(value as SectionId);}+/**+ * Section ids that no longer exist, mapped to where their content lives now.+ * A deep link, a remembered `?view=`, a voice command or a backend event that+ * still names the old id lands on the new section instead of nowhere.+ *+ * - "outputs": the Outputs section folded into Artifacts (2026-08-23) — every+ * run, with or without a page, is listed there now.+ */+export const LEGACY_SECTION_ALIASES: Readonly<Record<string, SectionId>> = {+ outputs: "visualization",+};++/** The section an id names today — itself, its successor, or null. */+export function resolveSectionId(value: unknown): SectionId | null {+ if (isSectionId(value)) return value;+ if (typeof value === "string" && value in LEGACY_SECTION_ALIASES) {+ return LEGACY_SECTION_ALIASES[value];+ }+ return null;+}+export function initialSectionFromSearch(search: string): SectionId {const params = new URLSearchParams(search);// ?view= is the general deep-link (drives detached solo windows); an invalid// value falls through to the older ?doc shortcut, then the default.- const view = params.get("view");- if (isSectionId(view)) return view;+ const view = resolveSectionId(params.get("view"));+ if (view !== null) return view;return params.has("doc") ? "docs" : "chats";}@@ -180,7 +199,6 @@ export const SECTION_LABELS: Record<SectionId, string> = {settings: "Settings",telephony: "Telephony","telephony-setup": "Telephony setup",- outputs: "Outputs",socials: "Socials",taskbar: "Taskbar",contacts: "Contacts",diff --git a/jarvis/ui/web/frontend/src/store/missionDrag.ts b/jarvis/ui/web/frontend/src/store/missionDrag.tsindex 176607f31e..0b19c375f6 100644--- a/jarvis/ui/web/frontend/src/store/missionDrag.ts+++ b/jarvis/ui/web/frontend/src/store/missionDrag.ts@@ -3,7 +3,8 @@ import { create } from "zustand";/*** Shared "a mission card is being dragged" flag.*- * The drag source (`SessionRow` in `OutputsView`) and the drop surface+ * The drag source (a rail row in the Artifacts section, via `lib/missionDnd`)+ * and the drop surface* (`JarvisDock`, far away in the tree) need to agree that a drag is in flight so* the dock can bloom into a big, forgiving target and mount its full-window* catch layer. A tiny zustand store is the lightest way to bridge them — samediff --git a/jarvis/ui/web/frontend/src/views/OutputsView.htmlpreview.test.tsx b/jarvis/ui/web/frontend/src/views/OutputsView.htmlpreview.test.tsxdeleted file mode 100644index ce8906917d..0000000000--- a/jarvis/ui/web/frontend/src/views/OutputsView.htmlpreview.test.tsx+++ /dev/null@@ -1,155 +0,0 @@-/**- * Outputs view — a selected HTML artifact shows the RENDERED page, not markup.- *- * Regression for "HTML files appear as raw source in the outputs section":- * `.html` counts as a text file server-side, so the old preview dumped the- * markup into a <pre>. The viewer frames the file from the `/page` endpoint- * (scripts run, network shut) with `sandbox="allow-scripts"` and no- * same-origin; the source stays reachable behind an explicit "Source" toggle.- */-import { afterEach, describe, expect, it, vi } from "vitest";-import {- cleanup,- fireEvent,- render,- screen,- waitFor,-} from "@testing-library/react";-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";--import { OutputsView } from "@/views/OutputsView";-import type { ArtifactSummary, OutputSummary } from "@/hooks/useOutputs";--vi.mock("@/hooks/useWebSocket", () => ({- getWSClient: () => null,-}));-vi.mock("@/lib/openExternal", () => ({- openExternalUrl: vi.fn(async () => {}),-}));--afterEach(() => {- cleanup();- vi.restoreAllMocks();- vi.clearAllMocks();-});--const SLUG = "mission_019f0fa6-4ff6";-const HTML_PATH = "tasks/019e3288/artifacts/files/HelloBot.html";-const HTML_SOURCE = "<html><body><h1>Hello</h1></body></html>";--function installFetchMock(artifacts: ArtifactSummary[]) {- const sessions: OutputSummary[] = [- {- slug: SLUG,- utterance: "Build a page",- status: "success",- mission_id: "m-1",- started_at: 1_750_000_000,- },- ];- const fetchMock = vi.fn(async (input: RequestInfo | URL) => {- const url = String(input);- if (url.includes("/raw")) {- return {- ok: true,- status: 200,- json: async () => ({- path: HTML_PATH,- size: HTML_SOURCE.length,- text: HTML_SOURCE,- truncated: false,- }),- };- }- if (url.includes("/artifacts")) {- return { ok: true, status: 200, json: async () => ({ files: artifacts }) };- }- if (url.includes("/plan")) {- return { ok: true, status: 200, json: async () => ({ plan: null, steps: [] }) };- }- if (url.includes("/capabilities")) {- return {- ok: true,- status: 200,- json: async () => ({ native_file_actions: true, platform: "win32" }),- };- }- if (url.includes("/openers")) {- return { ok: true, status: 200, json: async () => ({ openers: [] }) };- }- if (url.includes("/preferred-opener")) {- return { ok: true, status: 200, json: async () => ({ opener: "" }) };- }- if (url.includes("/api/outputs")) {- return { ok: true, status: 200, json: async () => ({ sessions }) };- }- return { ok: true, status: 200, json: async () => ({}) };- });- vi.stubGlobal("fetch", fetchMock);- return fetchMock;-}--function renderView() {- const client = new QueryClient({- defaultOptions: { queries: { retry: false, gcTime: 0, staleTime: 0 } },- });- return render(- <QueryClientProvider client={client}>- <OutputsView />- </QueryClientProvider>,- );-}--const HTML_ARTIFACT: ArtifactSummary = {- path: HTML_PATH,- size: HTML_SOURCE.length,- mtime: 1_750_000_100,- is_text: true,- preview: HTML_SOURCE,-};--describe("OutputsView — HTML artifacts render as pages", () => {- it("shows an html artifact in a sandboxed iframe, not a source dump", async () => {- installFetchMock([HTML_ARTIFACT]);- renderView();-- await waitFor(() => expect(screen.getByText("HelloBot.html")).toBeTruthy());- fireEvent.click(screen.getByText("HelloBot.html"));-- const iframe = await waitFor(() => {- const el = document.querySelector("iframe");- expect(el).toBeTruthy();- return el as HTMLIFrameElement;- });- // The page endpoint (scripts allowed, every way out shut) inside a frame- // that runs scripts in an opaque origin — never allow-same-origin.- expect(iframe.getAttribute("src")).toBe(- `/api/outputs/${SLUG}/files/${HTML_PATH}/page`,- );- expect(iframe.getAttribute("sandbox")).toBe("allow-scripts");- // The markup is NOT dumped as visible text by default.- expect(screen.queryByText(HTML_SOURCE)).toBeNull();- });-- it("keeps the source reachable behind the explicit toggle", async () => {- const fetchMock = installFetchMock([HTML_ARTIFACT]);- renderView();-- await waitFor(() => expect(screen.getByText("HelloBot.html")).toBeTruthy());- fireEvent.click(screen.getByText("HelloBot.html"));- await waitFor(() => expect(document.querySelector("iframe")).toBeTruthy());-- // Rendered mode never fetches the raw text.- expect(- fetchMock.mock.calls.some(([input]) => String(input).includes("/raw")),- ).toBe(false);-- fireEvent.click(screen.getByRole("button", { name: "Source" }));- await waitFor(() => expect(screen.getByText(HTML_SOURCE)).toBeTruthy());- expect(document.querySelector("iframe")).toBeNull();-- // And back to the rendered page.- fireEvent.click(screen.getByRole("button", { name: "Rendered" }));- await waitFor(() => expect(document.querySelector("iframe")).toBeTruthy());- });-});diff --git a/jarvis/ui/web/frontend/src/views/OutputsView.openbrowser.test.tsx b/jarvis/ui/web/frontend/src/views/OutputsView.openbrowser.test.tsxdeleted file mode 100644index b88a3c6924..0000000000--- a/jarvis/ui/web/frontend/src/views/OutputsView.openbrowser.test.tsx+++ /dev/null@@ -1,139 +0,0 @@-/**- * Outputs view — the "Browser" opener must reach the user's REAL browser.- *- * Regression for the "Browser does nothing" bug: the desktop app embeds- * WebView2, which silently drops `window.open` / `target="_blank"`. The "Browser"- * opener (and the ExternalLink open button) therefore must route through the- * open-external bridge (`openExternalUrl` -> `open_url`, the OS default browser- * on every OS), NOT a bare `window.open`. The url handed to the bridge must be- * ABSOLUTE, because `open_url` validates an http(s) absolute url.- */-import { afterEach, describe, expect, it, vi } from "vitest";-import {- cleanup,- fireEvent,- render,- screen,- waitFor,-} from "@testing-library/react";-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";--import { OutputsView } from "@/views/OutputsView";-import type { ArtifactSummary, OutputSummary } from "@/hooks/useOutputs";--vi.mock("@/hooks/useWebSocket", () => ({- getWSClient: () => null,-}));--// Spy on the bridge helper; the real implementation hits fetch + window.open.-vi.mock("@/lib/openExternal", () => ({- openExternalUrl: vi.fn(async () => {}),-}));-import { openExternalUrl } from "@/lib/openExternal";--afterEach(() => {- cleanup();- vi.restoreAllMocks();- vi.clearAllMocks();-});--const SLUG = "mission_019f0fa6-4ff6";--function installFetchMock(artifacts: ArtifactSummary[]) {- const sessions: OutputSummary[] = [- {- slug: SLUG,- utterance: "Some task",- status: "success",- mission_id: "m-1",- started_at: 1_750_000_000,- },- ];- const fetchMock = vi.fn(async (input: RequestInfo | URL) => {- const url = String(input);- if (url.includes("/artifacts")) {- return { ok: true, status: 200, json: async () => ({ files: artifacts }) };- }- if (url.includes("/plan")) {- return { ok: true, status: 200, json: async () => ({ plan: null, steps: [] }) };- }- if (url.includes("/capabilities")) {- // Desktop run (WebView2) — this is the context that drops window.open.- return {- ok: true,- status: 200,- json: async () => ({ native_file_actions: true, platform: "win32" }),- };- }- if (url.includes("/openers")) {- return {- ok: true,- status: 200,- json: async () => ({- openers: [- { id: "default", label: "System default app" },- { id: "browser", label: "Browser" },- ],- }),- };- }- if (url.includes("/preferred-opener")) {- return { ok: true, status: 200, json: async () => ({ opener: "" }) };- }- if (url.includes("/api/outputs")) {- return { ok: true, status: 200, json: async () => ({ sessions }) };- }- return { ok: true, status: 200, json: async () => ({}) };- });- vi.stubGlobal("fetch", fetchMock);-}--function renderView() {- const client = new QueryClient({- defaultOptions: { queries: { retry: false, gcTime: 0, staleTime: 0 } },- });- return render(- <QueryClientProvider client={client}>- <OutputsView />- </QueryClientProvider>,- );-}--const REPORT: ArtifactSummary = {- path: "tasks/019e3288/artifacts/files/report.md",- size: 64,- mtime: 1_750_000_100,- is_text: true,- preview: "# Report",-};--describe("OutputsView — Browser opener reaches the real browser", () => {- it("routes the 'Browser' pick through openExternalUrl, not window.open", async () => {- const winOpen = vi.spyOn(window, "open").mockReturnValue(null);- installFetchMock([REPORT]);- renderView();-- // The single session auto-selects, so its artifact row is on screen.- await waitFor(() => expect(screen.getByText("report.md")).toBeTruthy());- expect(screen.getByTestId("artifact-path").getAttribute("title")).toBe(- REPORT.path,- );-- // Open the "Open with…" chooser (the ChevronDown next to the open button).- fireEvent.click(screen.getByTitle("Change how this opens"));- // Pick "Browser".- fireEvent.click(await screen.findByRole("button", { name: "Browser" }));-- await waitFor(() =>- expect(openExternalUrl).toHaveBeenCalledTimes(1),- );- const calledWith = vi.mocked(openExternalUrl).mock.calls[0][0];- // Absolute http(s) url ending at the artifact's render endpoint.- expect(calledWith).toMatch(/^https?:\/\//);- expect(calledWith).toContain(- `/api/outputs/${SLUG}/files/tasks/019e3288/artifacts/files/report.md/view`,- );- // The WebView2-dropped bare window.open must NOT be used for the browser pick.- expect(winOpen).not.toHaveBeenCalled();- });-});diff --git a/jarvis/ui/web/frontend/src/views/OutputsView.rerun.test.tsx b/jarvis/ui/web/frontend/src/views/OutputsView.rerun.test.tsxdeleted file mode 100644index fbc65b38cc..0000000000--- a/jarvis/ui/web/frontend/src/views/OutputsView.rerun.test.tsx+++ /dev/null@@ -1,395 +0,0 @@-/**- * Outputs view — Continue/Restart button visibility per mission status.- *- * Gating contract:- * - status "cancelled" + a mission_id → a "Continue" button.- * - status "error" + a mission_id → a "Restart" button.- * - status "running" / "success" / no mission_id → neither.- */-import { afterEach, describe, expect, it, vi } from "vitest";-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";--import { OutputsView } from "@/views/OutputsView";-import type { ArtifactSummary, OutputSummary } from "@/hooks/useOutputs";--// ViewHeader pulls in ChatsView, which subscribes to a WS client; null keeps-// that effect a deterministic no-op in jsdom (same pattern as ClisView.test).-vi.mock("@/hooks/useWebSocket", () => ({- getWSClient: () => null,-}));--// The "Browser" opener must reach the user's real browser via the open-external-// bridge (WebView2 drops a bare window.open) — spy on it, not on window.open.-vi.mock("@/lib/openExternal", () => ({- openExternalUrl: vi.fn(async () => {}),-}));-import { openExternalUrl } from "@/lib/openExternal";--afterEach(() => {- cleanup();- vi.restoreAllMocks();- vi.clearAllMocks();-});--function installFetchMock(- sessions: OutputSummary[],- artifacts: ArtifactSummary[] = [],- openers = [- { id: "default", label: "System default app" },- { id: "code", label: "VS Code" },- ],- preferredOpener = "",-) {- const fetchMock = vi.fn(async (input: RequestInfo | URL) => {- const url = String(input);- if (url.includes("/artifacts")) {- return { ok: true, status: 200, json: async () => ({ files: artifacts }) };- }- if (url.includes("/plan")) {- return {- ok: true,- status: 200,- json: async () => ({ plan: null, steps: [] }),- };- }- if (url.includes("/capabilities")) {- return {- ok: true,- status: 200,- json: async () => ({- native_file_actions: true,- platform: "win32",- }),- };- }- if (url.includes("/openers")) {- return {- ok: true,- status: 200,- json: async () => ({ openers }),- };- }- if (url.includes("/preferred-opener")) {- return {- ok: true,- status: 200,- json: async () => ({ opener: preferredOpener }),- };- }- if (url.includes("/api/outputs")) {- return { ok: true, status: 200, json: async () => ({ sessions }) };- }- return { ok: true, status: 200, json: async () => ({}) };- });- vi.stubGlobal("fetch", fetchMock);- return fetchMock;-}--function renderView() {- const client = new QueryClient({- defaultOptions: { queries: { retry: false, gcTime: 0, staleTime: 0 } },- });- return render(- <QueryClientProvider client={client}>- <OutputsView />- </QueryClientProvider>,- );-}--function session(over: Partial<OutputSummary>): OutputSummary {- return {- slug: "20260615T120000__task__abcdef123456",- utterance: "Some task",- status: "unknown",- mission_id: "mission-1",- started_at: 1_750_000_000,- ...over,- };-}--describe("OutputsView rerun button gating", () => {- it("shows Continue (and no Restart) for a cancelled mission", async () => {- installFetchMock([- session({ slug: "cancelled-slug", status: "cancelled", mission_id: "m-c" }),- ]);- renderView();- await waitFor(() =>- expect(- screen.getAllByRole("button", { name: "Continue" }).length,- ).toBeGreaterThan(0),- );- expect(screen.queryByRole("button", { name: "Restart" })).toBeNull();- });-- it("shows Restart (and no Continue) for a failed mission", async () => {- installFetchMock([- session({ slug: "error-slug", status: "error", mission_id: "m-e" }),- ]);- renderView();- await waitFor(() =>- expect(- screen.getAllByRole("button", { name: "Restart" }).length,- ).toBeGreaterThan(0),- );- expect(screen.queryByRole("button", { name: "Continue" })).toBeNull();- });-- it("shows retained output as needs-review instead of a generic error", async () => {- installFetchMock([- session({- slug: "review-slug",- status: "error",- mission_id: "m-review",- has_partial_output: true,- needs_review: true,- artifact_count: 1,- terminal_reason: "critic_loop_exhausted",- error: "critic_loop_exhausted",- }),- ]);-- renderView();-- await waitFor(() =>- expect(screen.getByTestId("output-needs-review")).toBeDefined(),- );- expect(screen.getAllByText("Needs review").length).toBeGreaterThan(0);- expect(screen.getAllByText("critic_loop_exhausted").length).toBeGreaterThan(0);- expect(screen.queryByTestId("output-terminal-reason")).toBeNull();- });-- it("keeps a worker failure red when it merely retained a partial file", async () => {- installFetchMock([- session({- slug: "failed-partial",- status: "error",- mission_id: "m-failed",- has_partial_output: true,- needs_review: false,- artifact_count: 1,- terminal_reason: "task_error",- error: "task_error",- }),- ]);-- renderView();-- await waitFor(() =>- expect(screen.getByTestId("output-terminal-reason")).toBeDefined(),- );- expect(screen.queryByTestId("output-needs-review")).toBeNull();- expect(screen.getAllByText("error").length).toBeGreaterThan(0);- });-- it("replaces Continue with a live continuation chip and jumps to the child", async () => {- // Forensic 2026-06-28: a cancelled mission that was already "continued"- // kept showing a Continue button next to its own running child — the two- // cards looked identical, so the user could not tell whether it was- // running. With a live child the card shows a "running" chip instead, and- // clicking it jumps to the child.- installFetchMock([- session({- slug: "mission_019f0fa6-4ff6",- utterance: "Parent task",- status: "cancelled",- mission_id: "m-parent",- active_child_id: "019f0fac-26a3-7c59",- active_child_slug: "mission_019f0fac-26a3",- }),- session({- slug: "mission_019f0fac-26a3",- utterance: "Child task",- status: "running",- mission_id: "m-child",- }),- ]);- renderView();- await waitFor(() =>- expect(- screen.getAllByTestId("continuation-chip").length,- ).toBeGreaterThan(0),- );- // The redundant Continue button is gone while the continuation is live.- expect(screen.queryByRole("button", { name: "Continue" })).toBeNull();- // Clicking the chip selects the running child card.- fireEvent.click(screen.getAllByTestId("continuation-chip")[0]);- await waitFor(() =>- expect(- screen.getByRole("heading", { name: "Child task" }),- ).toBeDefined(),- );- });-- it("shows neither for running or successful missions", async () => {- installFetchMock([- session({ slug: "run-slug", status: "running", mission_id: "m-r" }),- session({ slug: "ok-slug", status: "success", mission_id: "m-ok" }),- ]);- renderView();- // Let the list settle: the running row renders a hold-to-abort control- // (there may be more than one — the auto-selected detail pane too).- await waitFor(() =>- expect(- screen.getAllByRole("button", { name: "Hold to abort" }).length,- ).toBeGreaterThan(0),- );- expect(screen.queryByRole("button", { name: "Continue" })).toBeNull();- expect(screen.queryByRole("button", { name: "Restart" })).toBeNull();- });-});--describe("OutputsView artifact actions", () => {- it("shows clean paths with primary files before nested assets", async () => {- installFetchMock(- [session({ slug: "artifact-slug", status: "success", mission_id: "m-a" })],- [- {- path: "tasks/019edf/artifacts/files/assets/site.css",- size: 10,- mtime: 1_750_000_003,- is_text: true,- preview: "body {}",- },- {- path: "tasks/019edf/artifacts/files/report10.md",- size: 10,- mtime: 1_750_000_002,- is_text: true,- preview: "# Ten",- },- {- path: "tasks/019edf/artifacts/files/report2.md",- size: 10,- mtime: 1_750_000_001,- is_text: true,- preview: "# Two",- },- ],- );-- renderView();-- await waitFor(() =>- expect(screen.getAllByTestId("artifact-path")).toHaveLength(3),- );- expect(- screen.getAllByTestId("artifact-path").map((node) => node.textContent),- ).toEqual(["report2.md", "report10.md", "assets/site.css"]);- });-- it("does not render a direct download action for saved mission artifacts", async () => {- installFetchMock(- [session({ slug: "artifact-slug", status: "success", mission_id: "m-a" })],- [- {- path: "tasks/019edf/artifacts/files/report.md",- size: 34_700,- mtime: 1_750_000_000,- is_text: true,- preview: "# Report",- },- ],- );-- renderView();-- await waitFor(() =>- expect(screen.getByText("report.md")).toBeDefined(),- );- expect(- screen.queryByText("tasks/019edf/artifacts/files/report.md"),- ).toBeNull();-- expect(screen.queryByTitle("Download")).toBeNull();- // The artifact opens in an app of the user's choice (chooser), not a fixed- // "open in browser" — and the file is already mirrored to Downloads.- expect(screen.getByTitle("Open")).toBeDefined();- expect(screen.getByTitle("Change how this opens")).toBeDefined();- expect(screen.getByTitle("Reveal in folder")).toBeDefined();- expect(screen.queryByTitle("Open in browser")).toBeNull();- });-- it("routes the browser chooser option through the open-external bridge", async () => {- const fetchMock = installFetchMock(- [session({ slug: "artifact-slug", status: "success", mission_id: "m-a" })],- [- {- path: "tasks/019edf/artifacts/files/report.md",- size: 34_700,- mtime: 1_750_000_000,- is_text: true,- preview: "# Report",- },- ],- [- { id: "default", label: "System default app" },- { id: "browser", label: "Browser" },- { id: "code", label: "VS Code" },- ],- );- const openSpy = vi.spyOn(window, "open").mockImplementation(() => null);-- renderView();-- await waitFor(() =>- expect(screen.getByText("report.md")).toBeDefined(),- );-- fireEvent.click(screen.getByTitle("Change how this opens"));- fireEvent.click(await screen.findByText("Browser"));-- // Absolute render URL handed to the bridge (open_url needs http(s) absolute),- // never a bare window.open (WebView2 drops it) and never /open-with.- await waitFor(() => expect(openExternalUrl).toHaveBeenCalledTimes(1));- const url = vi.mocked(openExternalUrl).mock.calls[0][0];- expect(url).toMatch(/^https?:\/\//);- expect(url).toContain(- "/api/outputs/artifact-slug/files/tasks/019edf/artifacts/files/report.md/view",- );- expect(openSpy).not.toHaveBeenCalled();- expect(- fetchMock.mock.calls.some(([input]) => String(input).includes("/open-with")),- ).toBe(false);- });-- it("routes a remembered browser preference through the open-external bridge", async () => {- const fetchMock = installFetchMock(- [session({ slug: "artifact-slug", status: "success", mission_id: "m-a" })],- [- {- path: "tasks/019edf/artifacts/files/report.md",- size: 34_700,- mtime: 1_750_000_000,- is_text: true,- preview: "# Report",- },- ],- [- { id: "default", label: "System default app" },- { id: "browser", label: "Browser" },- ],- "browser",- );- const openSpy = vi.spyOn(window, "open").mockImplementation(() => null);-- renderView();-- await waitFor(() =>- expect(screen.getByText("report.md")).toBeDefined(),- );-- fireEvent.click(screen.getByTitle("Open"));-- await waitFor(() => expect(openExternalUrl).toHaveBeenCalledTimes(1));- const url = vi.mocked(openExternalUrl).mock.calls[0][0];- expect(url).toMatch(/^https?:\/\//);- expect(url).toContain(- "/api/outputs/artifact-slug/files/tasks/019edf/artifacts/files/report.md/view",- );- expect(openSpy).not.toHaveBeenCalled();- expect(- fetchMock.mock.calls.some(([input]) => String(input).includes("/open-with")),- ).toBe(false);- });-});diff --git a/jarvis/ui/web/frontend/src/views/OutputsView.tsx b/jarvis/ui/web/frontend/src/views/OutputsView.tsxdeleted file mode 100644index 73199dc918..0000000000--- a/jarvis/ui/web/frontend/src/views/OutputsView.tsx+++ /dev/null@@ -1,695 +0,0 @@-import { useMemo, useState, type DragEvent } from "react";-import {- FolderOpen,- ExternalLink,- Github,- Loader2,- ListChecks,- FileQuestion,- FileText,-} from "lucide-react";-import { cn } from "@/lib/utils";-import { ViewHeader } from "@/views/ChatsView";-import { ScrollArea } from "@/components/ui/scroll-area";-import { ExplicitSpawnHint } from "@/components/ExplicitSpawnHint";-import { PlanStepList } from "@/components/PlanStepList";-import { HoldToAbortButton } from "@/components/HoldToAbortButton";-import { RerunButton } from "@/components/RerunButton";-import {- useOutputsList,- usePlanForOutput,- useArtifactsForOutput,- useCancelMission,- useOutputsCapabilities,- type OutputSummary,- type OutputStatus,- type ArtifactSummary,-} from "@/hooks/useOutputs";-import {- ArtifactViewer,- deliverableDisplayPath,-} from "@/components/outputs/ArtifactViewer";-import { useT } from "@/i18n";-import { applyMissionDragImage } from "@/lib/missionDragImage";-import { useMissionDrag } from "@/store/missionDrag";--const STATUS_BADGE: Record<OutputStatus, string> = {- success: "border-emerald-400/40 bg-emerald-400/10 text-emerald-400",- error: "border-destructive/40 bg-destructive/10 text-destructive",- running: "border-primary/40 bg-primary/10 text-primary",- // Deliberate user abort — amber, not the destructive red of a failure.- cancelled: "border-amber-400/40 bg-amber-400/10 text-amber-400",- unknown: "border-border bg-secondary/40 text-muted-foreground",-};--const NEEDS_REVIEW_BADGE =- "border-amber-400/40 bg-amber-400/10 text-amber-300";--/** Tiny ping dot inside the RUNNING badge — inherits the badge colour. */-function PulseDot() {- return (- <span className="relative flex h-1.5 w-1.5" aria-hidden="true">- <span className="absolute inline-flex h-full w-full animate-ping rounded-full bg-current opacity-60" />- <span className="relative inline-flex h-1.5 w-1.5 rounded-full bg-current" />- </span>- );-}--/**- * Shown on a terminal (cancelled / errored) card whose re-run continuation is- * still running. Replaces the "Continue"/"Restart" button so the card stops- * implying the work is idle and re-runnable — the truth is that it is alive in- * a linked child mission. Clicking jumps the selection to that live child card- * (forensic 2026-06-28: a cancelled card and its running continuation looked- * identical, so the user could not tell whether the mission was running).- */-function ContinuationChip({- onJump,- size = "sm",-}: {- onJump: () => void;- size?: "sm" | "md";-}) {- const t = useT();- const sizing =- size === "sm" ? "px-1.5 py-0.5 text-[10px]" : "px-2 py-1 text-[11px]";- const label = t("outputs_view.continuation_running");- return (- <button- type="button"- title={label}- aria-label={label}- data-testid="continuation-chip"- onClick={(e) => {- e.stopPropagation();- onJump();- }}- className={cn(- "inline-flex shrink-0 select-none items-center gap-1 rounded border font-semibold uppercase tracking-wide transition-colors",- "border-primary/40 bg-primary/10 text-primary hover:bg-primary/20",- sizing,- )}- >- <PulseDot />- <span>{label}</span>- </button>- );-}--const URL_REGEX = /(https?:\/\/[^\s)]+[^\s.,;:!?)])/g;--/** MIME type carrying a mission reference between a card and the Jarvis dock.- * Must match `MISSION_DND_MIME` in `components/JarvisDock.tsx`. */-export const MISSION_DND_MIME = "application/x-jarvis-mission";--/** The subset of an Outputs card the drag carries to the dock/server. */-export type OutputsDragMeta = Pick<- OutputSummary,- "slug" | "utterance" | "status" | "summary" | "error" | "mission_id"->;--/** Serialise the fields the dock/server need from a dragged Outputs card. */-export function buildMissionDragPayload(meta: OutputsDragMeta): string {- return JSON.stringify({- slug: meta.slug,- utterance: meta.utterance ?? "",- status: meta.status ?? "unknown",- summary: meta.summary ?? "",- error: meta.error ?? "",- mission_id: meta.mission_id ?? null,- });-}--/**- * Begin dragging an Outputs card toward the Jarvis dock. Writes the payload,- * swaps the giant native drag ghost for a compact branded chip, and flags the- * drag globally so the dock blooms into a big, forgiving target.- */-export function startMissionDrag(e: DragEvent, meta: OutputsDragMeta): void {- e.dataTransfer.setData(MISSION_DND_MIME, buildMissionDragPayload(meta));- e.dataTransfer.effectAllowed = "copy";- applyMissionDragImage(e.dataTransfer, meta.utterance || meta.slug);- useMissionDrag.getState().begin();-}--export function OutputsView() {- const t = useT();- const { data, isLoading, error } = useOutputsList();- const sessions = useMemo(- () => (data ?? []).slice(0, 20),- [data],- );- const [selectedSlug, setSelectedSlug] = useState<string | null>(null);-- const selected = useMemo(- () => sessions.find((s) => s.slug === selectedSlug) ?? null,- [sessions, selectedSlug],- );-- // Auto-select: the first entry, as soon as data is present and nothing is selected.- const effectiveSlug =- selectedSlug ?? (sessions.length > 0 ? sessions[0].slug : null);- const effectiveSelected =- selected ?? (sessions.length > 0 ? sessions[0] : null);-- const openOnDesktop = async (slug: string) => {- try {- await fetch(`/api/outputs/${slug}/open`, { method: "POST" });- } catch {- // Ignored — a toast would be nice-to-have, but the call is best-effort.- }- };-- return (- <div className="flex h-full min-h-0 flex-col">- <ViewHeader- icon={<FolderOpen className="h-4 w-4 text-primary" />}- title={t("outputs_view.title")}- subtitle={t("outputs_view.subtitle")}- />-- <ExplicitSpawnHint className="shrink-0 border-b border-border bg-card/40" />-- <div className="flex flex-1 min-h-0">- <aside className="flex w-96 shrink-0 flex-col border-r border-border">- {isLoading ? (- <div className="flex flex-1 items-center justify-center text-xs text-muted-foreground">- <Loader2 className="h-4 w-4 animate-spin" />- </div>- ) : error ? (- <div className="p-4 text-xs text-destructive">- {t("outputs_view.list_load_error")}: {String(error)}- </div>- ) : sessions.length === 0 ? (- <div className="flex flex-1 items-center justify-center p-6 text-center text-xs text-muted-foreground">- {t("outputs_view.empty_sessions")}- </div>- ) : (- <ScrollArea className="flex-1">- <ul className="flex flex-col gap-1 px-3 py-3">- {sessions.map((s) => (- <li key={s.slug}>- <SessionRow- meta={s}- isSelected={effectiveSlug === s.slug}- onSelect={() => setSelectedSlug(s.slug)}- onOpenDesktop={() => openOnDesktop(s.slug)}- onJumpToSlug={setSelectedSlug}- />- </li>- ))}- </ul>- </ScrollArea>- )}- </aside>-- <section className="flex min-w-0 flex-1 flex-col">- {effectiveSelected ? (- <SessionDetail- meta={effectiveSelected}- onJumpToSlug={setSelectedSlug}- />- ) : (- <div className="flex flex-1 items-center justify-center text-xs text-muted-foreground">- {t("outputs_view.select_session")}- </div>- )}- </section>- </div>- </div>- );-}--function SessionRow({- meta,- isSelected,- onSelect,- onOpenDesktop,- onJumpToSlug,-}: {- meta: OutputSummary;- isSelected: boolean;- onSelect: () => void;- onOpenDesktop: () => void;- onJumpToSlug?: (slug: string) => void;-}) {- const t = useT();- const cancel = useCancelMission();- const statusKey = meta.status ?? "unknown";- const needsReview = statusKey === "error" && !!meta.needs_review;- const badgeClass = needsReview ? NEEDS_REVIEW_BADGE : STATUS_BADGE[statusKey];- const statusLabel = needsReview ? t("outputs_view.needs_review") : statusKey;- const ts = meta.completed_at ?? meta.started_at;- const tsLabel = ts ? new Date(ts * 1000).toLocaleString() : "--";- const canAbort = statusKey === "running" && !!meta.mission_id;- // A cancelled/errored card whose re-run continuation is still running: show- // a live "running" chip (jumps to the child) instead of a "Continue" button.- const liveChildSlug =- statusKey === "cancelled" || statusKey === "error"- ? meta.active_child_slug ?? null- : null;-- return (- <button- type="button"- draggable- onDragStart={(e) => startMissionDrag(e, meta)}- onDragEnd={() => useMissionDrag.getState().end()}- onClick={onSelect}- className={cn(- "w-full cursor-grab rounded-lg border p-3 text-left transition-colors hover:border-primary/40 active:cursor-grabbing",- isSelected- ? "border-primary/40 bg-primary/10"- : "border-border bg-card/40",- )}- >- <div className="flex items-start justify-between gap-2">- <div className="min-w-0 flex-1">- <div className="truncate font-mono text-[10px] text-muted-foreground">- {meta.slug}- </div>- {meta.utterance && (- <div className="mt-0.5 break-words text-sm">{meta.utterance}</div>- )}- </div>- <div className="flex shrink-0 flex-col items-end gap-1">- <span className="flex items-center gap-1.5">- {canAbort && (- <HoldToAbortButton- size="sm"- pending={cancel.isPending}- onConfirm={() => {- if (meta.mission_id) cancel.mutate(meta.mission_id);- }}- label={- cancel.isPending- ? t("outputs_view.aborting")- : t("outputs_view.abort_hold")- }- />- )}- {liveChildSlug ? (- <ContinuationChip- size="sm"- onJump={() => onJumpToSlug?.(liveChildSlug)}- />- ) : (- <>- {statusKey === "cancelled" && meta.mission_id && (- <RerunButton- missionId={meta.mission_id}- action="continue"- size="sm"- />- )}- {statusKey === "error" && meta.mission_id && (- <RerunButton- missionId={meta.mission_id}- action="restart"- size="sm"- />- )}- </>- )}- <span- className={cn(- "flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",- badgeClass,- )}- >- {statusKey === "running" && <PulseDot />}- {statusLabel}- </span>- </span>- {meta.github_url && (- <a- href={meta.github_url}- target="_blank"- rel="noopener noreferrer"- onClick={(e) => e.stopPropagation()}- title="GitHub"- className="text-muted-foreground hover:text-primary"- >- <Github className="h-3 w-3" />- </a>- )}- </div>- </div>-- <div className="mt-1.5 flex items-center gap-3 text-[10px] text-muted-foreground">- <span>{tsLabel}</span>- {typeof meta.duration_s === "number" && (- <span>{meta.duration_s.toFixed(1)}s</span>- )}- <button- type="button"- onClick={(e) => {- e.stopPropagation();- onOpenDesktop();- }}- className="ml-auto flex items-center gap-1 hover:text-primary"- title={t("common.open_in_explorer")}- >- <ExternalLink className="h-3 w-3" />- Desktop- </button>- </div>-- {meta.summary && (- <div className="mt-1 line-clamp-2 text-[11px] text-muted-foreground">- {meta.summary}- </div>- )}- </button>- );-}--function SessionDetail({- meta,- onJumpToSlug,-}: {- meta: OutputSummary;- onJumpToSlug?: (slug: string) => void;-}) {- const t = useT();- const cancel = useCancelMission();- const plan = usePlanForOutput(meta.slug);- const statusKey = meta.status ?? "unknown";- const needsReview = statusKey === "error" && !!meta.needs_review;- const isCancelled = statusKey === "cancelled";- const badgeClass = needsReview ? NEEDS_REVIEW_BADGE : STATUS_BADGE[statusKey];- const statusLabel = needsReview ? t("outputs_view.needs_review") : statusKey;- const canAbort = statusKey === "running" && !!meta.mission_id;- const liveChildSlug =- statusKey === "cancelled" || statusKey === "error"- ? meta.active_child_slug ?? null- : null;- const hasPlan =- !plan.isLoading && plan.data && plan.data.plan !== null;- const isSingleShot =- !plan.isLoading && plan.data !== undefined && plan.data.plan === null;-- return (- <ScrollArea className="h-full">- <div className="flex flex-col gap-5 px-6 py-5">- <header className="flex flex-col gap-2">- <div className="flex flex-wrap items-center gap-2">- <h3 className="text-lg font-semibold text-foreground">- {meta.utterance ?? meta.slug}- </h3>- <span- className={cn(- "flex items-center gap-1.5 rounded border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide",- badgeClass,- )}- >- {statusKey === "running" && <PulseDot />}- {statusLabel}- </span>- {typeof meta.duration_s === "number" && (- <span className="text-xs text-muted-foreground">- {meta.duration_s.toFixed(1)}s- </span>- )}- {canAbort && (- <span className="inline-flex items-center gap-1.5 rounded-full border border-destructive/30 bg-destructive/5 py-0.5 pl-1 pr-2.5">- <HoldToAbortButton- size="md"- pending={cancel.isPending}- onConfirm={() => {- if (meta.mission_id) cancel.mutate(meta.mission_id);- }}- label={- cancel.isPending- ? t("outputs_view.aborting")- : t("outputs_view.abort_label")- }- />- <span className="text-[11px] text-muted-foreground">- {cancel.isPending- ? t("outputs_view.aborting")- : t("outputs_view.abort_hold")}- </span>- </span>- )}- {liveChildSlug ? (- <ContinuationChip- size="md"- onJump={() => onJumpToSlug?.(liveChildSlug)}- />- ) : (- <>- {statusKey === "cancelled" && meta.mission_id && (- <RerunButton- missionId={meta.mission_id}- action="continue"- size="md"- />- )}- {statusKey === "error" && meta.mission_id && (- <RerunButton- missionId={meta.mission_id}- action="restart"- size="md"- />- )}- </>- )}- {meta.github_url && (- <a- href={meta.github_url}- target="_blank"- rel="noopener noreferrer"- className="inline-flex items-center gap-1 rounded border border-border bg-secondary/40 px-2 py-0.5 text-[11px] text-muted-foreground hover:text-primary"- >- <Github className="h-3 w-3" />- GitHub- </a>- )}- </div>- <div className="font-mono text-[11px] text-muted-foreground">- {meta.slug}- </div>- </header>-- {(meta.terminal_reason || needsReview) && (- <section- data-testid={needsReview ? "output-needs-review" : "output-terminal-reason"}- className={cn(- "rounded-xl border p-4",- needsReview || isCancelled- ? "border-amber-400/30 bg-amber-400/5"- : "border-destructive/30 bg-destructive/5",- )}- >- <div className="mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground">- {needsReview- ? t("outputs_view.needs_review")- : isCancelled- ? t("outputs_view.cancellation_reason")- : t("outputs_view.failure_reason")}- </div>- {needsReview && (- <p className="text-sm leading-relaxed text-foreground/90">- {t("outputs_view.needs_review_hint")}- </p>- )}- {!needsReview && !isCancelled && meta.has_partial_output && (- <p className="text-sm leading-relaxed text-foreground/90">- {t("outputs_view.partial_output_hint")}- </p>- )}- {meta.terminal_reason && (- <div className="mt-2 font-mono text-[11px] text-muted-foreground">- {meta.terminal_reason}- </div>- )}- </section>- )}-- {meta.summary && (- <section className="rounded-xl border border-border bg-card/40 p-4">- <div className="mb-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground">- Summary- </div>- <p className="text-sm leading-relaxed text-foreground/90">- <LinkifiedText text={meta.summary} />- </p>- </section>- )}-- {meta.error && !meta.terminal_reason && (- <section className="rounded-xl border border-destructive/30 bg-destructive/5 p-4">- <div className="mb-1 text-[10px] font-semibold uppercase tracking-wide text-destructive">- {t("common.error")}- </div>- <pre className="whitespace-pre-wrap text-xs text-destructive/90">- {meta.error}- </pre>- </section>- )}-- <ArtifactsSection slug={meta.slug} />-- <section className="rounded-xl border border-border bg-card/40 p-4">- <div className="mb-3 flex items-center gap-2">- <ListChecks className="h-4 w-4 text-primary" />- <span className="text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">- Plan- </span>- {hasPlan && plan.data?.plan && (- <span className="text-[11px] text-muted-foreground">- {plan.data.plan.total_steps} Steps - Status{" "}- {plan.data.plan.status}- </span>- )}- </div>-- {plan.isLoading ? (- <div className="flex items-center gap-2 text-xs text-muted-foreground">- <Loader2 className="h-3 w-3 animate-spin" />- {t("outputs_view.loading_plan")}- </div>- ) : plan.isError ? (- <div className="text-xs text-destructive">- {t("outputs_view.plan_load_error")}: {String(plan.error)}- </div>- ) : isSingleShot ? (- <div className="flex items-center gap-2 rounded-lg border border-border bg-background/50 p-3 text-xs text-muted-foreground">- <FileQuestion className="h-4 w-4" />- {t("outputs_view.single_shot_no_plan")}- </div>- ) : hasPlan && plan.data ? (- <>- {plan.data.plan?.vision && (- <p className="mb-3 border-l-2 border-primary/40 pl-3 text-xs italic text-muted-foreground">- {plan.data.plan.vision}- </p>- )}- <PlanStepList steps={plan.data.steps} />- </>- ) : null}- </section>- </div>- </ScrollArea>- );-}--// Pure plumbing the worker subprocess emits — never a user deliverable.-// Hiding it keeps the list to the actual files the worker created (under-// artifacts/files/) plus the captured diff, so a non-coder sees their result-// instead of stream logs (2026-05-29).-function isPlumbingArtifact(path: string): boolean {- return (- path.endsWith("stream.jsonl") ||- path.endsWith("stderr.log") ||- path.endsWith(".jarvis-mcp.json") ||- path === "reflections.md"- );-}--/** Put primary top-level files first, then group nested assets alphabetically. */-function compareDeliverablePaths(a: ArtifactSummary, b: ArtifactSummary): number {- const left = deliverableDisplayPath(a.path);- const right = deliverableDisplayPath(b.path);- const depth = left.split("/").length - right.split("/").length;- return depth || left.localeCompare(right, undefined, {- numeric: true,- sensitivity: "base",- });-}--function ArtifactsSection({ slug }: { slug: string }) {- const t = useT();- const q = useArtifactsForOutput(slug);- const caps = useOutputsCapabilities();- const nativeActions = caps.data?.native_file_actions ?? false;- const allFiles = q.data?.files ?? [];- // Keep a defensive client-side plumbing filter for older API responses.- const files = allFiles- .filter((f) => !isPlumbingArtifact(f.path))- .sort(compareDeliverablePaths);-- return (- <section className="rounded-xl border border-border bg-card/40 p-4">- <div className="mb-3 flex items-center gap-2">- <FileText className="h-4 w-4 text-primary" />- <span className="text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">- {t("outputs_view.results")}- </span>- {!q.isLoading && (- <span className="text-[11px] text-muted-foreground">- {files.length} {files.length === 1 ? t("outputs_view.file") : t("outputs_view.files")}- </span>- )}- </div>-- {q.isLoading ? (- <div className="flex items-center gap-2 text-xs text-muted-foreground">- <Loader2 className="h-3 w-3 animate-spin" />- {t("outputs_view.loading_artifacts")}- </div>- ) : q.isError ? (- <div className="text-xs text-destructive">- {t("outputs_view.artifacts_load_error")}: {String(q.error)}- </div>- ) : files.length === 0 ? (- <div className="text-xs text-muted-foreground">- {t("outputs_view.no_files")}- </div>- ) : (- <ArtifactViewer- key={slug}- slug={slug}- files={files}- nativeActions={nativeActions}- />- )}- </section>- );-}--/**- * Linkifies URLs in the text. The regex is deliberately simple — proper- * Markdown support would need a real parser, but the summary is- * plain text with the occasional link.- */-function LinkifiedText({ text }: { text: string }) {- const parts = useMemo(() => {- const out: Array<{ type: "text" | "url"; value: string }> = [];- let last = 0;- URL_REGEX.lastIndex = 0;- let match: RegExpExecArray | null;- while ((match = URL_REGEX.exec(text)) !== null) {- if (match.index > last) {- out.push({ type: "text", value: text.slice(last, match.index) });- }- out.push({ type: "url", value: match[0] });- last = match.index + match[0].length;- }- if (last < text.length) {- out.push({ type: "text", value: text.slice(last) });- }- return out;- }, [text]);-- return (- <>- {parts.map((p, i) =>- p.type === "url" ? (- <a- key={i}- href={p.value}- target="_blank"- rel="noopener noreferrer"- className="text-primary underline-offset-2 hover:underline"- >- {p.value}- </a>- ) : (- <span key={i}>{p.value}</span>- ),- )}- </>- );-}diff --git a/jarvis/ui/web/frontend/src/views/VisualizationView.runs.test.tsx b/jarvis/ui/web/frontend/src/views/VisualizationView.runs.test.tsxnew file mode 100644index 0000000000..ada1cab296--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/VisualizationView.runs.test.tsx@@ -0,0 +1,488 @@+/**+ * The Artifacts section as the home of EVERY run — what the Outputs section+ * used to guarantee, now pinned here (the Outputs section folded into+ * Artifacts on 2026-08-23).+ *+ * Contracts:+ * - a run without a page or picture shows as a run row; its stage opens on+ * Files, with the summary / reason it ended above the files; the empty+ * state appears only when there are no runs at all,+ * - Continue / Restart gating per status, the needs-review card, the live+ * continuation chip that jumps to the child, hold-to-abort while running,+ * - Files: clean paths with primary files first, no direct download, the+ * opener model (Open / Change how this opens / Reveal), the Browser pick+ * going through the open-external bridge, an HTML file rendered as a page+ * with its source behind the toggle,+ * - every rail row can be dragged onto the dock with the mission payload,+ * - the retired "outputs" id still resolves to this section.+ */+import { afterEach, describe, expect, it, vi } from "vitest";+import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";++import { VisualizationView } from "@/views/VisualizationView";+import { MISSION_DND_MIME } from "@/lib/missionDnd";+import { initialSectionFromSearch, resolveSectionId } from "@/store/events";+import type { ArtifactSummary, OutputSummary } from "@/hooks/useOutputs";++// ViewHeader pulls in ChatsView, which subscribes to a WS client; null keeps+// that effect a deterministic no-op in jsdom.+vi.mock("@/hooks/useWebSocket", () => ({+ getWSClient: () => null,+}));++// The "Browser" opener must reach the user's real browser via the open-external+// bridge (WebView2 drops a bare window.open) — spy on it, not on window.open.+vi.mock("@/lib/openExternal", () => ({+ openExternalUrl: vi.fn(async () => {}),+}));+import { openExternalUrl } from "@/lib/openExternal";++afterEach(() => {+ cleanup();+ vi.restoreAllMocks();+ vi.clearAllMocks();+});++function installFetchMock(+ runs: OutputSummary[],+ artifactsBySlug: Record<string, ArtifactSummary[]> = {},+ options: {+ openers?: Array<{ id: string; label: string }>;+ preferredOpener?: string;+ rawBySlug?: Record<string, string>;+ } = {},+) {+ const openers = options.openers ?? [+ { id: "default", label: "System default app" },+ { id: "code", label: "VS Code" },+ ];+ const fetchMock = vi.fn(async (input: RequestInfo | URL) => {+ const url = String(input);+ if (url.includes("/capabilities")) {+ return {+ ok: true,+ status: 200,+ json: async () => ({ native_file_actions: true, platform: "win32" }),+ };+ }+ if (url.includes("/openers")) {+ return { ok: true, status: 200, json: async () => ({ openers }) };+ }+ if (url.includes("/preferred-opener")) {+ return {+ ok: true,+ status: 200,+ json: async () => ({ opener: options.preferredOpener ?? "" }),+ };+ }+ const raw = /\/api\/outputs\/([^/]+)\/files\/.+\/raw/.exec(url);+ if (raw) {+ const slug = decodeURIComponent(raw[1]);+ return {+ ok: true,+ status: 200,+ json: async () => ({+ path: "x",+ size: 1,+ text: options.rawBySlug?.[slug] ?? "",+ truncated: false,+ }),+ };+ }+ const plan = /\/api\/outputs\/([^/]+)\/plan/.exec(url);+ if (plan) {+ return { ok: true, status: 200, json: async () => ({ plan: null, steps: [] }) };+ }+ const artifacts = /\/api\/outputs\/([^/]+)\/artifacts/.exec(url);+ if (artifacts) {+ const slug = decodeURIComponent(artifacts[1]);+ return {+ ok: true,+ status: 200,+ json: async () => ({ files: artifactsBySlug[slug] ?? [] }),+ };+ }+ if (url.includes("/api/outputs")) {+ return { ok: true, status: 200, json: async () => ({ sessions: runs }) };+ }+ return { ok: true, status: 200, json: async () => ({}) };+ });+ vi.stubGlobal("fetch", fetchMock);+ return fetchMock;+}++function renderView() {+ const client = new QueryClient({+ defaultOptions: { queries: { retry: false, gcTime: 0, staleTime: 0 } },+ });+ return render(+ <QueryClientProvider client={client}>+ <VisualizationView />+ </QueryClientProvider>,+ );+}++function run(over: Partial<OutputSummary>): OutputSummary {+ return {+ slug: "20260615T120000__task__abcdef123456",+ utterance: "Some task",+ status: "unknown",+ mission_id: "mission-1",+ started_at: 1_750_000_000,+ ...over,+ };+}++function file(path: string, over: Partial<ArtifactSummary> = {}): ArtifactSummary {+ return { path, size: 10, mtime: 1_750_000_000, is_text: true, preview: "# x", ...over };+}++const REPORT = file("tasks/019edf/artifacts/files/report.md", {+ size: 34_700,+ preview: "# Report",+});++describe("VisualizationView — runs without an artifact", () => {+ it("lists a page-less run as a run row and opens it on Files with its notes", async () => {+ installFetchMock(+ [+ run({+ slug: "notes-run",+ utterance: "Write notes",+ status: "success",+ summary: "Three notes, saved.",+ }),+ ],+ { "notes-run": [file("tasks/t1/artifacts/files/notes.md")] },+ );++ renderView();++ const rows = await screen.findAllByTestId("visualization-run-row");+ expect(rows).toHaveLength(1);+ expect(rows[0].textContent).toContain("Write notes");+ expect(rows[0].textContent).toContain("Three notes, saved.");+ expect(screen.queryAllByTestId("visualization-artifact-row")).toHaveLength(0);+ // No empty state: the run IS the content.+ expect(screen.queryByTestId("visualization-empty")).toBeNull();+ // The stage opens on Files (there is no page to preview) …+ const filesTab = await screen.findByTestId("visualization-tab-files");+ expect(filesTab.getAttribute("aria-selected")).toBe("true");+ expect(screen.queryByTestId("visualization-tab-preview")).toBeNull();+ // … with the summary above the files, and the file itself in the reader.+ await screen.findByTestId("run-notes");+ expect(screen.getAllByText("Three notes, saved.").length).toBeGreaterThan(0);+ await waitFor(() => expect(screen.getByTestId("artifact-path").textContent).toBe("notes.md"));+ // The run status sits in the toolbar, one badge.+ expect(screen.getByTestId("run-status-badge").textContent).toContain("success");+ });++ it("says so only when there are no runs at all", async () => {+ installFetchMock([], {});+ renderView();+ await screen.findByTestId("visualization-empty");+ expect(screen.queryAllByTestId("visualization-run-row")).toHaveLength(0);+ });++ it("shows Continue (and no Restart) for a cancelled run", async () => {+ installFetchMock([run({ slug: "cancelled-slug", status: "cancelled", mission_id: "m-c" })]);+ renderView();+ await waitFor(() =>+ expect(screen.getAllByRole("button", { name: "Continue" }).length).toBeGreaterThan(0),+ );+ expect(screen.queryByRole("button", { name: "Restart" })).toBeNull();+ });++ it("shows Restart (and no Continue) for a failed run", async () => {+ installFetchMock([run({ slug: "error-slug", status: "error", mission_id: "m-e" })]);+ renderView();+ await waitFor(() =>+ expect(screen.getAllByRole("button", { name: "Restart" }).length).toBeGreaterThan(0),+ );+ expect(screen.queryByRole("button", { name: "Continue" })).toBeNull();+ });++ it("shows retained output as needs-review instead of a generic error", async () => {+ installFetchMock([+ run({+ slug: "review-slug",+ status: "error",+ mission_id: "m-review",+ has_partial_output: true,+ needs_review: true,+ artifact_count: 1,+ terminal_reason: "critic_loop_exhausted",+ error: "critic_loop_exhausted",+ }),+ ]);++ renderView();++ await waitFor(() => expect(screen.getByTestId("output-needs-review")).toBeDefined());+ expect(screen.getAllByText("Needs review").length).toBeGreaterThan(0);+ expect(screen.getAllByText("critic_loop_exhausted").length).toBeGreaterThan(0);+ expect(screen.queryByTestId("output-terminal-reason")).toBeNull();+ });++ it("keeps a worker failure red when it merely retained a partial file", async () => {+ installFetchMock([+ run({+ slug: "failed-partial",+ status: "error",+ mission_id: "m-failed",+ has_partial_output: true,+ needs_review: false,+ artifact_count: 1,+ terminal_reason: "task_error",+ error: "task_error",+ }),+ ]);++ renderView();++ await waitFor(() => expect(screen.getByTestId("output-terminal-reason")).toBeDefined());+ expect(screen.queryByTestId("output-needs-review")).toBeNull();+ expect(screen.getByTestId("run-status-badge").textContent).toContain("error");+ });++ it("replaces Continue with a live continuation chip and jumps to the child", async () => {+ // Forensic 2026-06-28: a cancelled mission that was already "continued"+ // kept showing a Continue button next to its own running child — the two+ // looked identical, so the user could not tell whether it was running.+ // With a live child the run shows a "running" chip instead, and clicking+ // it jumps to the child.+ installFetchMock([+ run({+ slug: "mission_019f0fa6-4ff6",+ utterance: "Parent task",+ status: "cancelled",+ mission_id: "m-parent",+ active_child_id: "019f0fac-26a3-7c59",+ active_child_slug: "mission_019f0fac-26a3",+ }),+ run({+ slug: "mission_019f0fac-26a3",+ utterance: "Child task",+ status: "running",+ mission_id: "m-child",+ }),+ ]);+ renderView();++ // The running child sorts first and is on stage; pick the parent.+ const rows = await screen.findAllByTestId("visualization-run-row");+ expect(rows).toHaveLength(2);+ expect(rows[0].textContent).toContain("Child task");+ fireEvent.click(rows[1]);++ await waitFor(() => expect(screen.getByTestId("continuation-chip")).toBeDefined());+ // The redundant Continue button is gone while the continuation is live.+ expect(screen.queryByRole("button", { name: "Continue" })).toBeNull();+ // Clicking the chip selects the running child.+ fireEvent.click(screen.getByTestId("continuation-chip"));+ await waitFor(() =>+ expect(screen.getByTestId("visualization-title").textContent).toBe("Child task"),+ );+ });++ it("offers hold-to-abort for a running run and nothing to re-run for a finished one", async () => {+ installFetchMock([+ run({ slug: "run-slug", status: "running", mission_id: "m-r" }),+ run({ slug: "ok-slug", status: "success", mission_id: "m-ok" }),+ ]);+ renderView();+ await waitFor(() =>+ expect(screen.getAllByRole("button", { name: "Hold to abort" }).length).toBeGreaterThan(0),+ );+ expect(screen.queryByRole("button", { name: "Continue" })).toBeNull();+ expect(screen.queryByRole("button", { name: "Restart" })).toBeNull();+ });++ it("carries the mission payload when a rail row is dragged", async () => {+ installFetchMock([+ run({ slug: "drag-slug", utterance: "Draggable task", status: "success", mission_id: "m-d" }),+ ]);+ renderView();+ const row = (await screen.findAllByTestId("visualization-run-row"))[0];+ expect(row.getAttribute("draggable")).toBe("true");++ const setData = vi.fn();+ const dataTransfer = { setData, setDragImage: vi.fn(), effectAllowed: "" };+ fireEvent.dragStart(row, { dataTransfer });+ expect(setData).toHaveBeenCalledTimes(1);+ const [mime, json] = setData.mock.calls[0];+ expect(mime).toBe(MISSION_DND_MIME);+ expect(JSON.parse(json)).toMatchObject({+ slug: "drag-slug",+ utterance: "Draggable task",+ mission_id: "m-d",+ });+ });+});++describe("VisualizationView — the Files tab", () => {+ it("shows clean paths with primary files before nested assets", async () => {+ installFetchMock(+ [run({ slug: "artifact-slug", status: "success", mission_id: "m-a" })],+ {+ "artifact-slug": [+ file("tasks/019edf/artifacts/files/assets/site.css", { preview: "body {}" }),+ file("tasks/019edf/artifacts/files/report10.md", { preview: "# Ten" }),+ file("tasks/019edf/artifacts/files/report2.md", { preview: "# Two" }),+ ],+ },+ );++ renderView();++ await waitFor(() => expect(screen.getAllByTestId("artifact-path")).toHaveLength(3));+ expect(screen.getAllByTestId("artifact-path").map((node) => node.textContent)).toEqual([+ "report2.md",+ "report10.md",+ "assets/site.css",+ ]);+ });++ it("does not render a direct download action for saved mission artifacts", async () => {+ installFetchMock([run({ slug: "artifact-slug", status: "success", mission_id: "m-a" })], {+ "artifact-slug": [REPORT],+ });++ renderView();++ await waitFor(() => expect(screen.getByText("report.md")).toBeDefined());+ expect(screen.queryByText("tasks/019edf/artifacts/files/report.md")).toBeNull();++ expect(screen.queryByTitle("Download")).toBeNull();+ // The artifact opens in an app of the user's choice (chooser), not a fixed+ // "open in browser" — and the file is already mirrored to Downloads.+ expect(screen.getByTitle("Open")).toBeDefined();+ expect(screen.getByTitle("Change how this opens")).toBeDefined();+ expect(screen.getByTitle("Reveal in folder")).toBeDefined();+ expect(screen.queryByTitle("Open in browser")).toBeNull();+ });++ it("routes the browser chooser option through the open-external bridge", async () => {+ const fetchMock = installFetchMock(+ [run({ slug: "artifact-slug", status: "success", mission_id: "m-a" })],+ { "artifact-slug": [REPORT] },+ {+ openers: [+ { id: "default", label: "System default app" },+ { id: "browser", label: "Browser" },+ { id: "code", label: "VS Code" },+ ],+ },+ );+ const openSpy = vi.spyOn(window, "open").mockImplementation(() => null);++ renderView();++ await waitFor(() => expect(screen.getByText("report.md")).toBeDefined());++ fireEvent.click(screen.getByTitle("Change how this opens"));+ fireEvent.click(await screen.findByText("Browser"));++ // Absolute render URL handed to the bridge (open_url needs http(s) absolute),+ // never a bare window.open (WebView2 drops it) and never /open-with.+ await waitFor(() => expect(openExternalUrl).toHaveBeenCalledTimes(1));+ const url = vi.mocked(openExternalUrl).mock.calls[0][0];+ expect(url).toMatch(/^https?:\/\//);+ expect(url).toContain(+ "/api/outputs/artifact-slug/files/tasks/019edf/artifacts/files/report.md/view",+ );+ expect(openSpy).not.toHaveBeenCalled();+ expect(+ fetchMock.mock.calls.some(([input]) => String(input).includes("/open-with")),+ ).toBe(false);+ });++ it("routes a remembered browser preference through the open-external bridge", async () => {+ const fetchMock = installFetchMock(+ [run({ slug: "artifact-slug", status: "success", mission_id: "m-a" })],+ { "artifact-slug": [REPORT] },+ {+ openers: [+ { id: "default", label: "System default app" },+ { id: "browser", label: "Browser" },+ ],+ preferredOpener: "browser",+ },+ );+ const openSpy = vi.spyOn(window, "open").mockImplementation(() => null);++ renderView();++ await waitFor(() => expect(screen.getByText("report.md")).toBeDefined());+ // The remembered preference is a query of its own; "Open" asks the chooser+ // until it has resolved, so wait for it before clicking.+ await waitFor(() =>+ expect(+ fetchMock.mock.calls.some(([input]) => String(input).includes("/preferred-opener")),+ ).toBe(true),+ );+ await act(() => new Promise((resolve) => setTimeout(resolve, 20)));+ fireEvent.click(screen.getByTitle("Open"));++ await waitFor(() => expect(openExternalUrl).toHaveBeenCalledTimes(1));+ const url = vi.mocked(openExternalUrl).mock.calls[0][0];+ expect(url).toMatch(/^https?:\/\//);+ expect(url).toContain(+ "/api/outputs/artifact-slug/files/tasks/019edf/artifacts/files/report.md/view",+ );+ expect(openSpy).not.toHaveBeenCalled();+ expect(+ fetchMock.mock.calls.some(([input]) => String(input).includes("/open-with")),+ ).toBe(false);+ });++ it("renders an HTML file in the reader as a sandboxed page, source behind the toggle", async () => {+ // Regression for "HTML files appear as raw source": `.html` counts as a+ // text file server-side, so the old preview dumped the markup into a+ // <pre>. The reader frames the file from `/page` (scripts run, network+ // shut) with `sandbox="allow-scripts"` and no same-origin.+ const HTML_SOURCE = "<!doctype html><html><head><title>HelloBot</title></head><body>hi</body></html>";+ const HTML_PATH = "tasks/019e3288/artifacts/files/HelloBot.html";+ const fetchMock = installFetchMock(+ [run({ slug: "html-slug", status: "success", mission_id: "m-h" })],+ { "html-slug": [file(HTML_PATH, { preview: HTML_SOURCE, size: HTML_SOURCE.length })] },+ { rawBySlug: { "html-slug": HTML_SOURCE } },+ );++ renderView();++ // The page is an artifact: it opens on Preview, the stage's own frame.+ await screen.findByTestId("visualization-frame");+ fireEvent.click(screen.getByTestId("visualization-tab-files"));++ const reader = await screen.findByTestId("run-files");+ await waitFor(() => expect(within(reader).getByText("HelloBot.html")).toBeTruthy());+ const iframe = await waitFor(() => {+ const el = reader.querySelector("iframe");+ expect(el).toBeTruthy();+ return el as HTMLIFrameElement;+ });+ expect(iframe.getAttribute("src")).toBe(`/api/outputs/html-slug/files/${HTML_PATH}/page`);+ expect(iframe.getAttribute("sandbox")).toBe("allow-scripts");+ expect(screen.queryByText(HTML_SOURCE)).toBeNull();+ // Rendered mode never fetches the raw text.+ expect(fetchMock.mock.calls.some(([input]) => String(input).includes("/raw"))).toBe(false);++ fireEvent.click(within(reader).getByRole("button", { name: "Source" }));+ await waitFor(() => expect(screen.getByText(HTML_SOURCE)).toBeTruthy());+ expect(reader.querySelector("iframe")).toBeNull();++ fireEvent.click(within(reader).getByRole("button", { name: "Rendered" }));+ await waitFor(() => expect(reader.querySelector("iframe")).toBeTruthy());+ });+});++describe("the retired outputs section id", () => {+ it("still resolves to Artifacts — deep links, remembered views, voice", () => {+ expect(resolveSectionId("outputs")).toBe("visualization");+ expect(resolveSectionId("visualization")).toBe("visualization");+ expect(resolveSectionId("weather")).toBeNull();+ expect(initialSectionFromSearch("?view=outputs")).toBe("visualization");+ });+});diff --git a/jarvis/ui/web/frontend/src/views/VisualizationView.test.tsx b/jarvis/ui/web/frontend/src/views/VisualizationView.test.tsxindex 91d6c22344..7fa8a09623 100644--- a/jarvis/ui/web/frontend/src/views/VisualizationView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/VisualizationView.test.tsx@@ -32,7 +32,7 @@ import type {} from "@/hooks/useOutputs";// ViewHeader lives in ChatsView, which subscribes to a WS client on mount —-// null keeps that a deterministic no-op in jsdom (same pattern as OutputsView).+// null keeps that a deterministic no-op in jsdom.vi.mock("@/hooks/useWebSocket", () => ({getWSClient: () => null,}));@@ -341,7 +341,10 @@ describe("VisualizationView", () => {}});- it("says so when there are no artifacts at all", async () => {+ it("lists a run without a page as a run row, never as an artifact", async () => {+ // Since the Outputs section folded into Artifacts (2026-08-23) every run+ // is here: one that produced only a text file is a run row (its file is+ // behind the Files tab), not an artifact row and not an empty stage.installFetchMock([{ slug: "run-text", utterance: "Write notes", status: "success" }],{ "run-text": [file("tasks/t1/artifacts/files/notes.md", { is_text: true })] },@@ -349,10 +352,22 @@ describe("VisualizationView", () => {renderView();- await screen.findByTestId("visualization-empty");+ const rows = await screen.findAllByTestId("visualization-run-row");+ expect(rows).toHaveLength(1);+ expect(rows[0].textContent).toContain("Write notes");expect(screen.queryByTestId("visualization-frame")).toBeNull();+ expect(screen.queryByTestId("visualization-empty")).toBeNull();expect(screen.queryAllByTestId("visualization-artifact-row")).toHaveLength(0);});++ it("says so when there are no runs at all", async () => {+ installFetchMock([], {});++ renderView();++ await screen.findByTestId("visualization-empty");+ expect(screen.queryByTestId("visualization-frame")).toBeNull();+ });});describe("SectionStage", () => {diff --git a/jarvis/ui/web/frontend/src/views/VisualizationView.tsx b/jarvis/ui/web/frontend/src/views/VisualizationView.tsxindex eb62720ab3..9b28959a00 100644--- a/jarvis/ui/web/frontend/src/views/VisualizationView.tsx+++ b/jarvis/ui/web/frontend/src/views/VisualizationView.tsx@@ -1,4 +1,4 @@-import { useCallback, useEffect, useMemo, useRef, useState } from "react";+import { useCallback, useEffect, useMemo, useState, type DragEvent } from "react";import {Code2,Download,@@ -6,6 +6,7 @@ import {Eye,FileImage,FileText,+ Files,FolderOpen,Globe,Loader2,@@ -18,16 +19,23 @@ import {import { Button } from "@/components/ui/button";import { ScrollArea } from "@/components/ui/scroll-area";import { RunGraphPanel } from "@/components/visualization/RunGraphPanel";+import {+ RunActions,+ RunFiles,+ RunStatusBadge,+} from "@/components/visualization/RunPanels";import { ViewHeader } from "@/views/ChatsView";import { useT } from "@/i18n";import { useThemeValue } from "@/hooks/useTheme";import { cn } from "@/lib/utils";import { useEventStore } from "@/store/events";import { openExternalUrl } from "@/lib/openExternal";+import { endMissionDrag, startMissionDrag } from "@/lib/missionDnd";import {artifactDownloadUrl,revealArtifact,useArtifactFile,+ useArtifactsForOutput,useOutputsCapabilities,useOutputsList,type OutputStatus,@@ -36,6 +44,7 @@ import {import {artifactPageUrl,missionMapUrl,+ toVisuals,useVisualArtifacts,visualId,type VisualArtifact,@@ -43,26 +52,36 @@ import {} from "@/hooks/useVisualArtifacts";/**- * The Artifacts section — every page and picture a run produced, full-size.+ * The Artifacts section — everything a run produced, with the artifact itself+ * on stage.** An artifact is the thing the user asked to LOOK AT: the dashboard, the* report, the diagram a background agent wrote as one self-contained HTML* file (`create_artifact`), or any image/PDF a worker left behind. It is* shown the way Claude shows an artifact: the page fills the stage, its own- * scripts run inside a sandbox, the source is one tab away, and "how did- * this come to be" — the n8n-style run graph that used to BE this section —- * sits behind a third tab instead of in front of the page.+ * scripts run inside a sandbox, the source is one tab away, every file of+ * the run is behind "Files", and "how did this come to be" — the n8n-style+ * run graph — behind "Run".+ *+ * Since 2026-08-23 this section is ALSO where every other run lands. The+ * Outputs section that used to list them is gone: a run that produced no+ * page or picture — a research answer, a refactor, a failed build — shows as+ * a run row in the same rail, with its status, its summary or the reason it+ * ended, its files, and the controls it always had (hold-to-abort, Continue,+ * Restart, the GitHub link). One place for what Jarvis and its agents made,+ * not two.** It owns no data: runs come from `/api/outputs`, files from the artifact- * listing (`useVisualArtifacts`), a page's source from `/raw`. A run that is- * still building its artifact shows as a "building…" row the rail follows- * until the page lands — the list for a running run polls, nothing else does.+ * listing (`useVisualArtifacts`, `useArtifactsForOutput`), a page's source+ * from `/raw`. A run that is still building its artifact shows as a+ * "building…" row the rail follows until the page lands — the listings of+ * running runs poll, nothing else does.** Detachable (`DETACHABLE_VIEWS` in jarvis/ui/desktop_app.py): an artifact is* the thing people put on a second monitor.*/-/** What a row's status dot means — the Outputs vocabulary, one language. */+/** What a row's status dot means — the run vocabulary, one language. */const RUN_DOT: Record<OutputStatus, string> = {success: "bg-emerald-400",error: "bg-destructive",@@ -78,17 +97,31 @@ const KIND_ICON: Record<VisualKind, typeof Globe> = {document: FileText,};-type StageMode = "preview" | "code" | "run";+type StageMode = "preview" | "code" | "files" | "run";-/** The rail's pick: an artifact (`path`) or a whole run still building (`null`). */+/** The rail's pick: an artifact (`path`) or a whole run (`null`). */interface Selection {slug: string;path: string | null;}+/** One rail row — a build in progress, an artifact, or a run without one. */+type RailRow =+ | { kind: "build"; run: OutputSummary; key: string }+ | { kind: "visual"; run: OutputSummary | null; visual: VisualArtifact; key: string }+ | { kind: "run"; run: OutputSummary; key: string };++/** What the stage shows: a run (always), and its artifact when it has one. */+interface StageTarget {+ run: OutputSummary | null;+ visual: VisualArtifact | null;+ /** The run is a `create_artifact` build still writing its page. */+ building: boolean;+}+/*** A `create_artifact` mission's prompt leads with `Artifact: <title>` and the- * user's request right after (jarvis/artifacts/brief.py). The Outputs list+ * user's request right after (jarvis/artifacts/brief.py). The run list* already strips the quality lead, so the run's `utterance` starts with that* line — which is how a running build is recognised and labelled here.*/@@ -103,6 +136,11 @@ export function parseArtifactUtterance(return { title: match[1].trim(), request };}+/** What a run is called when it has no page title of its own. */+function runTitle(run: OutputSummary): string {+ return parseArtifactUtterance(run.utterance)?.title || run.utterance?.trim() || run.slug;+}+/** The rail row's timestamp — what tells two same-named artifacts apart. */function formatWhen(seconds: number): string {if (!seconds) return "";@@ -120,6 +158,50 @@ function formatSize(bytes: number): string {return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;}+/** The run's moment for ordering — when it ended, else when it began. */+function runWhen(run: OutputSummary): number {+ return run.completed_at ?? run.started_at ?? 0;+}++/**+ * The rail, in order: builds in progress, then running runs, then every+ * artifact and every artifact-less run newest first. A run with at least one+ * artifact is reached through its artifact rows (its other files sit behind+ * the stage's Files tab), so it gets no row of its own.+ */+export function buildRailRows(+ runs: OutputSummary[],+ visuals: VisualArtifact[],+ building: OutputSummary[],+): RailRow[] {+ const bySlug = new Map(runs.map((run) => [run.slug, run]));+ const visualSlugs = new Set(visuals.map((v) => v.slug));+ const buildSlugs = new Set(building.map((r) => r.slug));++ const rest: Array<{ row: RailRow; running: boolean; when: number }> = [];+ for (const visual of visuals) {+ rest.push({+ row: { kind: "visual", run: bySlug.get(visual.slug) ?? null, visual, key: visualId(visual) },+ running: visual.status === "running",+ when: visual.mtime,+ });+ }+ for (const run of runs) {+ if (visualSlugs.has(run.slug) || buildSlugs.has(run.slug)) continue;+ rest.push({+ row: { kind: "run", run, key: `run:${run.slug}` },+ running: run.status === "running",+ when: runWhen(run),+ });+ }+ rest.sort((a, b) => Number(b.running) - Number(a.running) || b.when - a.when);++ return [+ ...building.map((run): RailRow => ({ kind: "build", run, key: `build:${run.slug}` })),+ ...rest.map((entry) => entry.row),+ ];+}+export function VisualizationView() {const t = useT();const outputs = useOutputsList();@@ -137,6 +219,8 @@ export function VisualizationView() {[runs],);+ const rows = useMemo(() => buildRailRows(runs, visuals, building), [runs, visuals, building]);+/* A `?run=<slug>` in the URL pre-selects that run's newest artifact — what* makes a detached window or a pasted link open on the page it talks about.* Read once at mount; clicks own it after. */@@ -145,9 +229,10 @@ export function VisualizationView() {return slug ? { slug, path: null } : null;});/* Once the user picked a row, the newest artifact landing must not steal the- * stage — an explicit choice is never fought. A pick of a BUILDING run is the- * exception it resolves itself: its page replaces the spinner when it lands. */- const userPicked = useRef(selection !== null);+ * stage — an explicit choice is never fought (the selection stays until the+ * next click). A pick of a BUILDING run is the exception it resolves itself:+ * its page replaces the spinner when it lands. */+ const pick = useCallback((next: Selection) => setSelection(next), []);/** Another surface asked for something to be staged ("show visuals" on the@@ -158,13 +243,11 @@ export function VisualizationView() {useEffect(() => {if (visualStage === null) return;if (visualStage.target === "latest") {- userPicked.current = false;setSelection(null);return;}const separator = visualStage.target.indexOf("::");if (separator > 0) {- userPicked.current = true;setSelection({slug: visualStage.target.slice(0, separator),path: visualStage.target.slice(separator + 2),@@ -173,41 +256,36 @@ export function VisualizationView() {}, [visualStage]);/*- * What the stage shows. In order: the row the user picked (an artifact, or- * a run's newest artifact once it has one); while nothing was picked, the- * newest build in progress; otherwise the newest artifact there is.+ * What the stage shows. The row the user picked — an artifact, or a run+ * (its newest artifact once it has one, the run itself otherwise). While+ * nothing was picked, the first rail row: the newest build in progress,+ * else the newest thing there is.*/- const currentBuild: OutputSummary | null = useMemo(() => {- if (selection !== null) {- if (selection.path !== null) return null;- const hasPage = visuals.some((v) => v.slug === selection.slug);- return hasPage ? null : (building.find((r) => r.slug === selection.slug) ?? null);- }- return building[0] ?? null;- }, [selection, visuals, building]);-- const current: VisualArtifact | null = useMemo(() => {- if (currentBuild !== null) return null;+ const target: StageTarget = useMemo(() => {+ const bySlug = (slug: string) => runs.find((r) => r.slug === slug) ?? null;+ const resolveRun = (slug: string): StageTarget | null => {+ const run = bySlug(slug);+ const visual = visuals.find((v) => v.slug === slug) ?? null;+ if (run === null && visual === null) return null;+ const isBuilding = run !== null && building.includes(run) && visual === null;+ return { run, visual, building: isBuilding };+ };if (selection !== null) {- const picked =- selection.path !== null- ? visuals.find((v) => v.slug === selection.slug && v.path === selection.path)- : visuals.find((v) => v.slug === selection.slug);- if (picked) return picked;- if (userPicked.current) return visuals[0] ?? null;+ if (selection.path !== null) {+ const visual = visuals.find(+ (v) => v.slug === selection.slug && v.path === selection.path,+ );+ if (visual) return { run: bySlug(visual.slug), visual, building: false };+ }+ const resolved = resolveRun(selection.slug);+ if (resolved) return resolved;}- return visuals[0] ?? null;- }, [currentBuild, selection, visuals]);-- const currentRun: OutputSummary | null = useMemo(- () => (current ? (runs.find((r) => r.slug === current.slug) ?? null) : null),- [current, runs],- );-- const [mode, setMode] = useState<StageMode>("preview");- const currentId = current ? visualId(current) : null;- // A new artifact opens on its page, whatever tab the previous one was on.- useEffect(() => setMode("preview"), [currentId]);+ const first = rows[0];+ if (!first) return { run: null, visual: null, building: false };+ if (first.kind === "build") return { run: first.run, visual: null, building: true };+ if (first.kind === "visual") return { run: first.run, visual: first.visual, building: false };+ return { run: first.run, visual: null, building: false };+ }, [selection, runs, visuals, building, rows]);const refetch = useCallback(() => {void outputs.refetch();@@ -215,6 +293,14 @@ export function VisualizationView() {}, [outputs, gallery]);const loading = outputs.isLoading || gallery.isLoading;+ const activeKey =+ target.building && target.run+ ? `build:${target.run.slug}`+ : target.visual+ ? visualId(target.visual)+ : target.run+ ? `run:${target.run.slug}`+ : null;return (<div className="flex h-full min-h-0 flex-col">@@ -241,101 +327,27 @@ export function VisualizationView() {/><div className="flex min-h-0 flex-1">- {/* Rail — builds in progress first, then every artifact, newest first. */}+ {/* Rail — builds in progress first, then every artifact and run, newest first. */}<aside className="flex w-72 shrink-0 flex-col border-r border-border"><p className="border-b border-border px-3 py-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground">{t("visualization.rail")}- {visuals.length > 0 && (+ {rows.length > 0 && (<span className="ml-1.5 normal-case tracking-normal text-muted-foreground/70">- · {visuals.length}+ · {rows.length}</span>)}</p><ScrollArea className="min-h-0 flex-1"><ul className="space-y-1 p-2" data-testid="visualization-artifacts">- {building.map((run) => {- const parsed = parseArtifactUtterance(run.utterance);- const active = currentBuild?.slug === run.slug;- return (- <li key={`build:${run.slug}`}>- <button- type="button"- onClick={() => {- userPicked.current = true;- setSelection({ slug: run.slug, path: null });- }}- aria-current={active}- data-testid="visualization-building-row"- className={cn(- "flex w-full items-start gap-2 rounded-md px-2 py-2 text-left text-xs transition-colors",- active- ? "bg-primary/15 text-foreground"- : "text-muted-foreground hover:bg-secondary/60 hover:text-foreground",- )}- >- <Loader2- className="mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-primary"- aria-hidden- />- <span className="min-w-0 flex-1">- <span className="block truncate font-medium text-foreground">- {parsed?.title || t("visualization.building")}- </span>- <span className="block truncate">{t("visualization.building")}</span>- </span>- </button>- </li>- );- })}- {visuals.map((visual) => {- const Icon = KIND_ICON[visual.kind];- const active = current !== null && visualId(current) === visualId(visual);- const parsed = parseArtifactUtterance(visual.utterance);- return (- <li key={visualId(visual)}>- <button- type="button"- onClick={() => {- userPicked.current = true;- setSelection({ slug: visual.slug, path: visual.path });- }}- aria-current={active}- data-testid="visualization-artifact-row"- data-kind={visual.kind}- className={cn(- "flex w-full items-start gap-2 rounded-md px-2 py-2 text-left text-xs transition-colors",- active- ? "bg-primary/15 text-foreground"- : "text-muted-foreground hover:bg-secondary/60 hover:text-foreground",- )}- >- <span className="relative mt-0.5 shrink-0">- <Icon className="h-3.5 w-3.5" aria-hidden />- <span- className={cn(- "absolute -right-0.5 -top-0.5 h-1.5 w-1.5 rounded-full",- RUN_DOT[visual.status ?? "unknown"],- )}- aria-hidden- />- </span>- <span className="min-w-0 flex-1">- <span className="block truncate font-medium text-foreground">- {visual.title}- </span>- <span className="block truncate">- {[- formatWhen(visual.mtime),- parsed?.request || visual.utterance?.trim() || visual.name,- ]- .filter(Boolean)- .join(" · ")}- </span>- </span>- </button>- </li>- );- })}+ {rows.map((row) => (+ <li key={row.key}>+ <RailRowButton+ row={row}+ active={activeKey === row.key}+ onPick={pick}+ />+ </li>+ ))}</ul>{gallery.skippedRuns > 0 && (<p className="px-3 pb-3 text-[11px] text-muted-foreground/70">@@ -348,33 +360,19 @@ export function VisualizationView() {</ScrollArea></aside>- {/* Stage — the artifact itself, full-size. */}+ {/* Stage — the artifact itself, full-size; the run around it. */}<section className="flex min-h-0 min-w-0 flex-1 flex-col">- {currentBuild !== null ? (- <BuildingStage run={currentBuild} />- ) : current === null ? (- <EmptyStage- loading={loading}- error={outputs.isError || gallery.isError}- />+ {target.building && target.run !== null ? (+ <BuildingStage run={target.run} />+ ) : target.run === null && target.visual === null ? (+ <EmptyStage loading={loading} error={outputs.isError || gallery.isError} />) : (- <>- <ArtifactToolbar- visual={current}- mode={mode}- onMode={setMode}- runAvailable={currentRun !== null}- />- <div className="min-h-0 flex-1" data-testid="visualization-stage">- {mode === "preview" && <ArtifactStage visual={current} />}- {mode === "code" && (- <ArtifactSource slug={current.slug} path={current.path} />- )}- {mode === "run" && currentRun !== null && (- <RunGraphPanel key={currentRun.slug} run={currentRun} />- )}- </div>- </>+ <Stage+ key={target.run?.slug ?? target.visual?.slug}+ run={target.run}+ visual={target.visual}+ onJumpToRun={(slug) => pick({ slug, path: null })}+ />)}</section></div>@@ -384,23 +382,211 @@ export function VisualizationView() {/* ------------------------------------------------------------------------- */+function RailRowButton({+ row,+ active,+ onPick,+}: {+ row: RailRow;+ active: boolean;+ onPick: (next: Selection) => void;+}) {+ const t = useT();+ const base = cn(+ "flex w-full items-start gap-2 rounded-md px-2 py-2 text-left text-xs transition-colors",+ active+ ? "bg-primary/15 text-foreground"+ : "text-muted-foreground hover:bg-secondary/60 hover:text-foreground",+ );+ // Every row can be dragged onto the Jarvis dock — the run is what the dock+ // takes, whichever of its artifacts the row happens to show.+ const dragRun = row.run;+ const dragProps = dragRun+ ? {+ draggable: true,+ onDragStart: (e: DragEvent) => startMissionDrag(e, dragRun),+ onDragEnd: endMissionDrag,+ }+ : {};++ if (row.kind === "build") {+ const parsed = parseArtifactUtterance(row.run.utterance);+ return (+ <button+ type="button"+ onClick={() => onPick({ slug: row.run.slug, path: null })}+ aria-current={active}+ data-testid="visualization-building-row"+ className={base}+ {...dragProps}+ >+ <Loader2 className="mt-0.5 h-3.5 w-3.5 shrink-0 animate-spin text-primary" aria-hidden />+ <span className="min-w-0 flex-1">+ <span className="block truncate font-medium text-foreground">+ {parsed?.title || t("visualization.building")}+ </span>+ <span className="block truncate">{t("visualization.building")}</span>+ </span>+ </button>+ );+ }++ if (row.kind === "visual") {+ const { visual } = row;+ const Icon = KIND_ICON[visual.kind];+ const parsed = parseArtifactUtterance(visual.utterance);+ return (+ <button+ type="button"+ onClick={() => onPick({ slug: visual.slug, path: visual.path })}+ aria-current={active}+ data-testid="visualization-artifact-row"+ data-kind={visual.kind}+ className={base}+ {...dragProps}+ >+ <span className="relative mt-0.5 shrink-0">+ <Icon className="h-3.5 w-3.5" aria-hidden />+ <span+ className={cn(+ "absolute -right-0.5 -top-0.5 h-1.5 w-1.5 rounded-full",+ RUN_DOT[visual.status ?? "unknown"],+ )}+ aria-hidden+ />+ </span>+ <span className="min-w-0 flex-1">+ <span className="block truncate font-medium text-foreground">{visual.title}</span>+ <span className="block truncate">+ {[+ formatWhen(visual.mtime),+ parsed?.request || visual.utterance?.trim() || visual.name,+ ]+ .filter(Boolean)+ .join(" · ")}+ </span>+ </span>+ </button>+ );+ }++ // A run without a page or picture: the answer, the refactor, the failure.+ const { run } = row;+ const status = run.status ?? "unknown";+ const Icon = status === "running" ? Loader2 : (run.artifact_count ?? 0) > 0 ? FileText : Workflow;+ return (+ <button+ type="button"+ onClick={() => onPick({ slug: run.slug, path: null })}+ aria-current={active}+ data-testid="visualization-run-row"+ data-status={status}+ className={base}+ {...dragProps}+ >+ <span className="relative mt-0.5 shrink-0">+ <Icon+ className={cn("h-3.5 w-3.5", status === "running" && "animate-spin text-primary")}+ aria-hidden+ />+ {status !== "running" && (+ <span+ className={cn("absolute -right-0.5 -top-0.5 h-1.5 w-1.5 rounded-full", RUN_DOT[status])}+ aria-hidden+ />+ )}+ </span>+ <span className="min-w-0 flex-1">+ <span className="block truncate font-medium text-foreground">{runTitle(run)}</span>+ <span className="block truncate">+ {[formatWhen(runWhen(run)), run.summary?.trim() || run.terminal_reason || status]+ .filter(Boolean)+ .join(" · ")}+ </span>+ </span>+ </button>+ );+}++/* ------------------------------------------------------------------------- */++/**+ * The stage for one run: its artifact (when it has one) under Preview / Code,+ * every file under Files, the graph under Run. Keyed by run in the caller, so+ * a new run opens on its own default tab.+ *+ * A run outside the rail's scan window arrives without artifacts in hand; its+ * listing is read here (same cache entry the rail's scan fills) and the newest+ * page or picture in it goes on stage — an older dashboard is one click away+ * instead of "not scanned".+ */+function Stage({+ run,+ visual: pickedVisual,+ onJumpToRun,+}: {+ run: OutputSummary | null;+ visual: VisualArtifact | null;+ onJumpToRun: (slug: string) => void;+}) {+ const slug = run?.slug ?? pickedVisual?.slug ?? null;+ const listing = useArtifactsForOutput(run !== null && pickedVisual === null ? slug : null);+ const visual: VisualArtifact | null = useMemo(() => {+ if (pickedVisual) return pickedVisual;+ if (run === null) return null;+ const found = toVisuals(run, listing.data?.files ?? []);+ found.sort((a, b) => b.mtime - a.mtime);+ return found[0] ?? null;+ }, [pickedVisual, run, listing.data]);++ const [mode, setMode] = useState<StageMode>(visual ? "preview" : "files");+ const currentId = visual ? visualId(visual) : null;+ // A new artifact opens on its page, whatever tab the previous one was on; a+ // run that turns out to have one (its listing just arrived) moves to it too.+ useEffect(() => {+ setMode(currentId ? "preview" : "files");+ }, [currentId]);++ return (+ <>+ <ArtifactToolbar+ run={run}+ visual={visual}+ mode={mode}+ onMode={setMode}+ onJumpToRun={onJumpToRun}+ />+ <div className="min-h-0 flex-1" data-testid="visualization-stage">+ {mode === "preview" && visual && <ArtifactStage visual={visual} />}+ {mode === "code" && visual && <ArtifactSource slug={visual.slug} path={visual.path} />}+ {mode === "files" && run && <RunFiles run={run} />}+ {mode === "run" && run && <RunGraphPanel key={run.slug} run={run} />}+ </div>+ </>+ );+}+function ArtifactToolbar({+ run,visual,mode,onMode,- runAvailable,+ onJumpToRun,}: {- visual: VisualArtifact;+ run: OutputSummary | null;+ visual: VisualArtifact | null;mode: StageMode;onMode: (mode: StageMode) => void;- runAvailable: boolean;+ onJumpToRun: (slug: string) => void;}) {const t = useT();const pushToast = useEventStore((s) => s.pushToast);const capabilities = useOutputsCapabilities();- const parsed = parseArtifactUtterance(visual.utterance);+ const parsed = parseArtifactUtterance(visual?.utterance ?? run?.utterance);+ const slug = visual?.slug ?? run?.slug ?? "";const onReveal = useCallback(async () => {+ if (!visual) return;try {await revealArtifact(visual.slug, visual.path);} catch {@@ -409,32 +595,45 @@ function ArtifactToolbar({}, [visual, pushToast, t]);const theme = useThemeValue();- const externalUrl =- visual.kind === "page"+ const externalUrl = visual+ ? visual.kind === "page"? `${artifactPageUrl(visual.slug, visual.path)}?theme=${theme}`- : visual.url;+ : visual.url+ : null;++ const title = visual?.title ?? (run ? runTitle(run) : "");+ const caption = [+ visual ? formatWhen(visual.mtime) : run ? formatWhen(runWhen(run)) : "",+ visual ? formatSize(visual.size) : "",+ run && typeof run.duration_s === "number" ? `${run.duration_s.toFixed(1)} s` : "",+ parsed?.request || (visual ? visual.utterance?.trim() || visual.name : ""),+ ]+ .filter(Boolean)+ .join(" · ");const tabs: Array<{ id: StageMode; label: string; Icon: typeof Eye; show: boolean }> = [- { id: "preview", label: t("visualization.tab_preview"), Icon: Eye, show: true },- { id: "code", label: t("visualization.tab_code"), Icon: Code2, show: visual.kind === "page" || visual.kind === "vector" },- { id: "run", label: t("visualization.tab_run"), Icon: Workflow, show: runAvailable },+ { id: "preview", label: t("visualization.tab_preview"), Icon: Eye, show: visual !== null },+ {+ id: "code",+ label: t("visualization.tab_code"),+ Icon: Code2,+ show: visual !== null && (visual.kind === "page" || visual.kind === "vector"),+ },+ { id: "files", label: t("visualization.tab_files"), Icon: Files, show: run !== null },+ { id: "run", label: t("visualization.tab_run"), Icon: Workflow, show: run !== null },];return (<div className="flex shrink-0 items-center gap-3 border-b border-border px-4 py-2"><div className="min-w-0 flex-1">- <p className="truncate text-sm font-medium" data-testid="visualization-title">- {visual.title}- </p>- <p className="truncate text-[11px] text-muted-foreground">- {[- formatWhen(visual.mtime),- formatSize(visual.size),- parsed?.request || visual.utterance?.trim() || visual.name,- ]- .filter(Boolean)- .join(" · ")}- </p>+ <div className="flex min-w-0 items-center gap-2">+ <p className="truncate text-sm font-medium" data-testid="visualization-title">+ {title}+ </p>+ {run && <RunStatusBadge run={run} />}+ {run && <RunActions run={run} onJumpToRun={onJumpToRun} />}+ </div>+ <p className="truncate text-[11px] text-muted-foreground">{caption}</p></div><div@@ -466,13 +665,11 @@ function ArtifactToolbar({</div><div className="flex shrink-0 items-center gap-1">- {mode === "run" && (+ {mode === "run" && slug && (<Buttonvariant="ghost"size="sm"- onClick={() =>- void openExternalUrl(`${window.location.origin}${missionMapUrl(visual.slug)}`)- }+ onClick={() => void openExternalUrl(`${window.location.origin}${missionMapUrl(slug)}`)}title={t("visualization.open_map_page_hint")}data-testid="visualization-open-map">@@ -480,29 +677,33 @@ function ArtifactToolbar({{t("visualization.open_map_page")}</Button>)}- <Button- variant="ghost"- size="sm"- onClick={() => void openExternalUrl(`${window.location.origin}${externalUrl}`)}- title={t("visualization.open_external_hint")}- data-testid="visualization-open-external"- >- <ExternalLink className="mr-1.5 h-3.5 w-3.5" aria-hidden />- {t("visualization.open_external")}- </Button>- <Button variant="ghost" size="sm" asChild>- <a- href={artifactDownloadUrl(visual.slug, visual.path)}- download- title={t("visualization.download")}- aria-label={t("visualization.download")}+ {visual && externalUrl && (+ <Button+ variant="ghost"+ size="sm"+ onClick={() => void openExternalUrl(`${window.location.origin}${externalUrl}`)}+ title={t("visualization.open_external_hint")}+ data-testid="visualization-open-external">- <Download className="h-3.5 w-3.5" aria-hidden />- </a>- </Button>+ <ExternalLink className="mr-1.5 h-3.5 w-3.5" aria-hidden />+ {t("visualization.open_external")}+ </Button>+ )}+ {visual && (+ <Button variant="ghost" size="sm" asChild>+ <a+ href={artifactDownloadUrl(visual.slug, visual.path)}+ download+ title={t("visualization.download")}+ aria-label={t("visualization.download")}+ >+ <Download className="h-3.5 w-3.5" aria-hidden />+ </a>+ </Button>+ )}{/* Desktop only: a headless host has no file manager to open, so thebutton is absent rather than dead. */}- {capabilities.data?.native_file_actions && (+ {visual && capabilities.data?.native_file_actions && (<Buttonvariant="ghost"size="sm"diff --git a/tests/unit/plugins/tool/test_navigate.py b/tests/unit/plugins/tool/test_navigate.pyindex 44e15dcd87..f6df873e27 100644--- a/tests/unit/plugins/tool/test_navigate.py+++ b/tests/unit/plugins/tool/test_navigate.py@@ -64,6 +64,11 @@ async def test_canonical_id_publishes_navigate(tool: NavigateTool, bus: Recordin("Kontakte", "contacts"),("kontakt", "contacts"),("contacts", "contacts"),+ # The retired Outputs section: its old id and spoken names land on+ # Artifacts, where every run is listed now (2026-08-23).+ ("outputs", "visualization"),+ ("Ausgaben", "visualization"),+ ("ergebnisse", "visualization"),],)async def test_alias_normalizes_to_id(