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(ui): redesign transcription and retire run inspector
rubenluetke10-beep3624961d6123
diff --git a/jarvis/plugins/tool/navigate.py b/jarvis/plugins/tool/navigate.pyindex dbd0d52a70..559c40bb54 100644--- a/jarvis/plugins/tool/navigate.py+++ b/jarvis/plugins/tool/navigate.py@@ -30,7 +30,6 @@ KNOWN: frozenset[str] = frozenset("docs","mcps","sessions",- "run_inspector",# Spend & Tokens."costs","clis",@@ -82,6 +81,8 @@ KNOWN: frozenset[str] = frozenset(# Natural-language aliases (DE + EN) → canonical id. The router usually passes an# id from the schema enum; this is the safety net for spoken labels/synonyms._ALIASES: dict[str, str] = {+ # Retired inspection links open the saved conversation archive.+ "run_inspector": "sessions",# Agentic IDE — the spoken forms people reach for. "agentic" is a mouthful# in every supported language, so the plain-words variants matter more here# than for sections whose label is already a common noun.diff --git a/jarvis/ui/web/frontend/src/components/deck/DeckActivityCards.tsx b/jarvis/ui/web/frontend/src/components/deck/DeckActivityCards.tsxindex c8de3af4c8..97fafe8f67 100644--- a/jarvis/ui/web/frontend/src/components/deck/DeckActivityCards.tsx+++ b/jarvis/ui/web/frontend/src/components/deck/DeckActivityCards.tsx@@ -36,7 +36,7 @@ import { useT } from "@/i18n";*/// -----------------------------------------------------------------------// Runs — the run inspector's list, newest first+// Runs — recent telemetry, newest first// ----------------------------------------------------------------------function outcomeTone(outcome: string): string {@@ -54,7 +54,6 @@ function fmtClock(ms: number): string {export function RunsCard({ className }: { className?: string }) {const t = useT();- const setActiveSection = useEventStore((s) => s.setActiveSection);const runs = useRuns();const items: RunListItem[] = (runs.data ?? []).slice(0, 6);const live = items.some((r) => r.ended_ms === null);@@ -66,8 +65,6 @@ export function RunsCard({ className }: { className?: string }) {meta={runs.data ? runs.data.length : undefined}live={live}variant="chamfer"- onOpen={() => setActiveSection("run_inspector")}- openLabel={t("deck.open_section")}className={className}bodyClassName="overflow-y-auto">diff --git a/jarvis/ui/web/frontend/src/components/deck/DeckTurnCard.tsx b/jarvis/ui/web/frontend/src/components/deck/DeckTurnCard.tsxindex 2fea55e41c..ac2495b1d9 100644--- a/jarvis/ui/web/frontend/src/components/deck/DeckTurnCard.tsx+++ b/jarvis/ui/web/frontend/src/components/deck/DeckTurnCard.tsx@@ -1,6 +1,5 @@import { useEffect, useState } from "react";import { Timer } from "lucide-react";-import { useEventStore } from "@/store/events";import { useDeckStore } from "@/store/deck";import type { TurnPhase } from "@/lib/deckState";import { DeckCard } from "@/components/deck/DeckCard";@@ -37,7 +36,6 @@ export function TurnCard({ className }: { className?: string }) {const t = useT();const turn = useDeckStore((s) => s.turn);const cuActive = useDeckStore((s) => s.cu.active);- const setActiveSection = useEventStore((s) => s.setActiveSection);const live = turn.phase !== "idle";// The stopwatch ticks only while a turn is open — ten times a second, which@@ -66,8 +64,6 @@ export function TurnCard({ className }: { className?: string }) {}live={live && !quiet}variant="chamfer"- onOpen={() => setActiveSection("run_inspector")}- openLabel={t("deck.open_section")}className={className}bodyClassName="p-0">diff --git a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx b/jarvis/ui/web/frontend/src/components/layout/MainView.tsxindex 0e585bc6f7..7afccc0e07 100644--- a/jarvis/ui/web/frontend/src/components/layout/MainView.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/MainView.tsx@@ -130,11 +130,6 @@ const DocsView = lazyView(() =>const BoardView = lazyView(() =>import("@/views/BoardView").then((m) => ({ default: m.BoardView })),);-const RunInspectorView = lazyView(() =>- import("@/views/RunInspectorView").then((m) => ({- default: m.RunInspectorView,- })),-);// Dictation + Dictionary + Shortcuts + Language + Voice API keys are merged// behind the one "{name} Voice" sidebar entry. Only the hub is split out here —// it statically imports its five tabs, so they travel in its chunk instead of@@ -494,8 +489,6 @@ function SwitchOnActiveSection({ active }: { active: string }) {return <DocsView />;case "sessions":return <SessionsView />;- case "run_inspector":- return <RunInspectorView />;case "board":return <BoardView />;case "memory":diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsxindex dedec66466..9f96e47ccc 100644--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx@@ -323,7 +323,7 @@ export function Sidebar({const allItems = NAV_GROUPS.flat();const findItem = (id: string) => allItems.find((item) => item.id === id)!;- const toolIds = ["memory", "board", "docs", "sessions", "run_inspector", "clis"];+ const toolIds = ["memory", "board", "docs", "sessions", "clis"];const toolItems = toolIds.map(findItem);// Artifacts ("visualization") sits directly in the main list where the// retired "Jarvis Tools" folder used to be — it was the only entry hidingdiff --git a/jarvis/ui/web/frontend/src/components/layout/navGroups.ts b/jarvis/ui/web/frontend/src/components/layout/navGroups.tsindex 63257ffeaa..5eebbfdb92 100644--- a/jarvis/ui/web/frontend/src/components/layout/navGroups.ts+++ b/jarvis/ui/web/frontend/src/components/layout/navGroups.ts@@ -24,7 +24,6 @@ import {ExtensionsIcon,FeedbackIcon,AssistantIcon,- InspectorIcon,MarketplaceIcon,MicrophoneIcon,PermissionsIcon,@@ -160,7 +159,6 @@ export const NAV_GROUPS: NavItem[][] = [// so its row says "Beta" up front).[{ id: "sessions", labelKey: "nav.sessions", icon: MicrophoneIcon },- { id: "run_inspector", labelKey: "nav.run_inspector", icon: InspectorIcon },// CLIs — the CLIs list + the CLI Test Hub behind one tab switch (CLIs first).{ id: "clis", labelKey: "nav.clis_hub", icon: TerminalIcon, matchIds: ["clis", "cli-test-hub"] },{diff --git a/jarvis/ui/web/frontend/src/components/transcription/TranscriptActions.test.tsx b/jarvis/ui/web/frontend/src/components/transcription/TranscriptActions.test.tsxnew file mode 100644index 0000000000..f287cced95--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/transcription/TranscriptActions.test.tsx@@ -0,0 +1,35 @@+import { act, cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { afterEach, expect, it, vi } from "vitest";+import { TranscriptActions } from "./TranscriptActions";+import { transcriptFixture } from "./testFixtures";+import { useI18nStore } from "@/i18n";++afterEach(() => { cleanup(); vi.unstubAllGlobals(); vi.useRealTimers(); });++it("opens an export with the remembered native application exactly once", async () => {+ vi.useFakeTimers();+ useI18nStore.setState({ ui: "en" });+ const requests: { url: string; body?: string }[] = [];+ vi.stubGlobal("fetch", async (input: RequestInfo | URL, init?: RequestInit) => {+ const url = String(input);+ requests.push({ url, body: init?.body as string | undefined });+ if (url === "/api/downloads/capabilities") return Response.json({ native_file_actions: true, platform: "win32" });+ if (url === "/api/outputs/openers") return Response.json({ openers: [{ id: "editor", label: "Text editor" }] });+ if (url === "/api/outputs/preferred-opener") return Response.json({ opener: "editor" });+ if (url.endsWith("/open-with?format=markdown")) return Response.json({ opened: true });+ throw new Error(`Unexpected request: ${url}`);+ });+ const client = new QueryClient({ defaultOptions: { queries: { retry: false, gcTime: 0 } } });+ render(<QueryClientProvider client={client}><TranscriptActions detail={transcriptFixture()} /></QueryClientProvider>);+ await act(async () => { await vi.advanceTimersByTimeAsync(4_000); });+ vi.useRealTimers();+ fireEvent.click(screen.getByRole("button", { name: "Export" }));+ fireEvent.change(screen.getByRole("combobox", { name: "File format" }), { target: { value: "markdown" } });+ fireEvent.click(await screen.findByRole("button", { name: "Open with…" }));+ await waitFor(() => expect(requests.filter((r) => r.url.includes("/open-with?"))).toEqual([+ { url: "/api/sessions/voice%2Fone/open-with?format=markdown", body: JSON.stringify({ opener: "editor" }) },+ ]));+ await waitFor(() => expect(screen.getByRole("status").textContent).toMatch(/opened/i));+ client.clear();+});diff --git a/jarvis/ui/web/frontend/src/components/transcription/TranscriptActions.tsx b/jarvis/ui/web/frontend/src/components/transcription/TranscriptActions.tsxnew file mode 100644index 0000000000..064dc12f75--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/transcription/TranscriptActions.tsx@@ -0,0 +1,103 @@+import { useEffect, useId, useRef, useState } from "react";+import { AlertCircle, Check, ChevronDown, Copy, Download, ExternalLink } from "lucide-react";+import { Button } from "@/components/ui/button";+import { OpenWithDialog } from "@/components/OpenWithDialog";+import { fetchSessionExport, openSessionWith, sessionExportUrl } from "@/components/sessions/api";+import type { SessionDetail } from "@/components/sessions/types";+import { useCapabilities } from "@/hooks/useCapabilities";+import { useOpeners, usePreferredOpener, useSetPreferredOpener } from "@/hooks/useOutputs";+import { buildSessionFilename, mimeFor, robustCopy, saveOrDownload } from "@/lib/clipboard";+import { useT } from "@/i18n";++type Format = "plain" | "markdown" | "json";++export function TranscriptActions({ detail }: { detail: SessionDetail }) {+ const t = useT();+ const panelId = useId();+ const [expanded, setExpanded] = useState(false);+ const [format, setFormat] = useState<Format>("plain");+ const [busy, setBusy] = useState(false);+ const [message, setMessage] = useState("");+ const [failed, setFailed] = useState(false);+ const [chooseOpener, setChooseOpener] = useState(false);+ const native = useCapabilities().data?.native_file_actions ?? false;++ async function perform(action: "copy" | "download", selectedFormat: Format) {+ setBusy(true);+ setMessage("");+ setFailed(false);+ try {+ const text = await fetchSessionExport(detail.session.id, selectedFormat);+ if (action === "copy") {+ if (!await robustCopy(text)) throw new Error("Clipboard unavailable");+ } else {+ await saveOrDownload({+ filename: buildSessionFilename(detail.session, detail.turns.find((turn) => turn.user_text)?.user_text ?? "", selectedFormat),+ text, mime: mimeFor(selectedFormat), native,+ });+ }+ setMessage(t(action === "copy" ? "transcription.copied" : "transcription.saved"));+ } catch {+ // Surface a useful recovery message without leaking a provider response.+ setFailed(true);+ setMessage(t(action === "copy" ? "session_detail.copy_failed_clipboard" : "session_detail.download_failed"));+ } finally {+ setBusy(false);+ }+ }++ return (+ <div className="transcript-actions">+ <div className="transcript-action-buttons">+ <Button variant="ghost" disabled={busy} onClick={() => void perform("copy", "plain")}><Copy aria-hidden />{t("transcription.copy")}</Button>+ <Button variant="outline" aria-expanded={expanded} aria-controls={panelId} onClick={() => setExpanded(!expanded)}><Download aria-hidden />{t("session_detail.export_label")}<ChevronDown aria-hidden /></Button>+ </div>+ {expanded && (+ <div className="transcript-export" id={panelId}>+ <label htmlFor={`${panelId}-format`}>{t("transcription.format")}</label>+ <select id={`${panelId}-format`} value={format} onChange={(event) => setFormat(event.target.value as Format)}>+ <option value="plain">{t("transcription.plain_text")}</option><option value="markdown">Markdown</option><option value="json">JSON</option>+ </select>+ <Button variant="secondary" disabled={busy} onClick={() => void perform("download", format)}><Download aria-hidden />{t("transcription.download")}</Button>+ <Button variant="ghost" disabled={busy} onClick={() => void perform("copy", format)}><Copy aria-hidden />{t("turn_card.copy")}</Button>+ {native ? (+ <Button variant="ghost" disabled={busy} onClick={() => setChooseOpener(true)}><ExternalLink aria-hidden />{t("transcription.open_with")}</Button>+ ) : (+ <Button asChild variant="ghost"><a href={sessionExportUrl(detail.session.id, format)} target="_blank" rel="noopener noreferrer"><ExternalLink aria-hidden />{t("transcription.open_file")}</a></Button>+ )}+ </div>+ )}+ <p className={failed ? "transcript-feedback is-error" : "transcript-feedback"} role={failed ? "alert" : "status"}>{busy ? t("transcription.preparing") : message && <>{failed ? <AlertCircle aria-hidden /> : <Check aria-hidden />}{message}</>}</p>+ {chooseOpener && <TranscriptOpener sessionId={detail.session.id} format={format} onClose={() => setChooseOpener(false)} onResult={(ok) => { setFailed(!ok); setMessage(t(ok ? "session_detail.opened_in_editor" : "session_detail.open_failed")); }} />}+ </div>+ );+}++function TranscriptOpener({ sessionId, format, onClose, onResult }: {+ sessionId: string; format: Format; onClose: () => void; onResult: (ok: boolean) => void;+}) {+ const openers = useOpeners();+ const preferred = usePreferredOpener();+ const setPreferred = useSetPreferredOpener();+ const autoOpened = useRef(false);++ useEffect(() => {+ if (!preferred.data || autoOpened.current) return;+ autoOpened.current = true;+ const opener = preferred.data;+ onClose();+ void openSessionWith(sessionId, format, opener).then(onResult).catch(() => onResult(false));+ }, [preferred.data, sessionId, format, onClose, onResult]);++ async function pick(opener: string, remember: boolean) {+ onClose();+ try {+ const opened = await openSessionWith(sessionId, format, opener);+ if (opened && remember && preferred.data !== opener) setPreferred.mutate(opener);+ onResult(opened);+ } catch {+ onResult(false);+ }+ }+ return <OpenWithDialog openers={preferred.isLoading ? [] : openers.data ?? []} loading={openers.isLoading || preferred.isLoading} onPick={(opener, remember) => void pick(opener, remember)} onClose={onClose} />;+}diff --git a/jarvis/ui/web/frontend/src/components/transcription/TranscriptReader.tsx b/jarvis/ui/web/frontend/src/components/transcription/TranscriptReader.tsxnew file mode 100644index 0000000000..8f0ab8e921--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/transcription/TranscriptReader.tsx@@ -0,0 +1,129 @@+import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";+import { AlertCircle, ArrowLeft, AudioLines, Copy, Download, Loader2, RefreshCw, Search, X } from "lucide-react";+import { Button } from "@/components/ui/button";+import type { SessionListItem } from "@/components/sessions/types";+import { useSessionDetail } from "@/hooks/useSessions";+import { useCapabilities } from "@/hooks/useCapabilities";+import { fill, useT, useUiLanguage } from "@/i18n";+import { useEventStore } from "@/store/events";+import { robustCopy, saveOrDownload } from "@/lib/clipboard";+import { TranscriptActions } from "./TranscriptActions";+import { elapsedTime, exchangeText, passageText, transcriptExchanges, type TranscriptExchange } from "./transcript";++export function TranscriptState({ kind = "empty", title, body, retry, children }: {+ kind?: "empty" | "loading" | "error"; title: string; body?: string; retry?: () => void; children?: ReactNode;+}) {+ const t = useT();+ const Icon = kind === "error" ? AlertCircle : kind === "loading" ? Loader2 : AudioLines;+ return <div className={`transcription-state is-${kind}`} role={kind === "error" ? "alert" : "status"}>+ <Icon aria-hidden className={kind === "loading" ? "motion-safe:animate-spin" : undefined} />+ <h2>{title}</h2>{body && <p>{body}</p>}+ {retry && <Button variant="outline" onClick={retry}><RefreshCw aria-hidden />{t("transcription.retry")}</Button>}{children}+ </div>;+}++export function TranscriptReader({ session, onBack }: { session: SessionListItem; onBack: () => void }) {+ const t = useT();+ const locale = useUiLanguage();+ const detail = useSessionDetail(session.id);+ const [search, setSearch] = useState("");+ const [original, setOriginal] = useState(false);+ const heading = useRef<HTMLHeadingElement>(null);+ const exchanges = useMemo(() => detail.data ? transcriptExchanges(detail.data) : [], [detail.data]);+ const term = search.trim().toLocaleLowerCase(locale);+ const visible = useMemo(() => term ? exchanges.filter((exchange) => exchange.passages.some((p) => passageText(p, original).toLocaleLowerCase(locale).includes(term))) : exchanges, [exchanges, term, original, locale]);+ const hasPolished = exchanges.some((exchange) => exchange.passages.some((p) => p.original));+ const current = detail.data?.session ?? session;+ const finished = current.ended_ms !== null;++ useEffect(() => { heading.current?.focus(); }, []);++ return <div className="transcription-reader">+ <div className="transcription-reader-bar">+ <Button variant="ghost" onClick={onBack}><ArrowLeft aria-hidden />{t("transcription.all_conversations")}</Button>+ <span>{t("sessions_view.title")}</span>+ </div>+ <div className="transcription-page">+ <header className="transcription-document-header">+ <p className="transcription-eyebrow">{new Date(current.started_ms).toLocaleDateString(locale, { day: "numeric", month: "long", year: "numeric" })}<span aria-hidden> / </span>{new Date(current.started_ms).toLocaleTimeString(locale, { hour: "2-digit", minute: "2-digit" })}</p>+ <h1 ref={heading} tabIndex={-1}>{session.preview || t("transcription.untitled")}</h1>+ <div className="transcription-document-meta">+ <span className={!finished ? "transcription-live" : undefined}>{t(finished ? "transcription.saved_conversation" : "transcription.in_progress")}</span>+ {finished && <span>{elapsedTime(current.ended_ms! - current.started_ms)}</span>}+ <span>{fill(t("transcription.exchanges"), { count: current.turn_count })}</span>+ </div>+ {detail.data && <TranscriptActions detail={detail.data} />}+ </header>+ {detail.isLoading ? <TranscriptState kind="loading" title={t("session_detail.loading")} /> : detail.error ? (+ <TranscriptState kind="error" title={t("session_detail.load_error")} body={t("transcription.retry_help")} retry={() => void detail.refetch()} />+ ) : <>+ {!finished && <p className="transcription-recording-note" role="status">{t("transcription.live_help")}<Button variant="ghost" disabled={detail.isFetching} onClick={() => void detail.refetch()}><RefreshCw aria-hidden />{t("transcription.refresh")}</Button></p>}+ {exchanges.length > 0 && <div className="transcription-reading-tools">+ <div className="transcription-search">+ <Search aria-hidden /><input type="search" aria-label={t("transcription.find")} placeholder={t("transcription.find")} value={search} onChange={(event) => setSearch(event.target.value)} />+ {search && <button type="button" aria-label={t("transcription.clear_search")} onClick={() => setSearch("")}><X aria-hidden /></button>}+ </div>+ {hasPolished && <label className="transcription-original"><input type="checkbox" checked={original} onChange={(event) => setOriginal(event.target.checked)} />{t("transcription.original_wording")}</label>}+ </div>}+ {term && <p className="transcription-find-count" role="status">{fill(t("transcription.results"), { count: visible.length })}</p>}+ {visible.length ? <div className="transcription-passages" aria-label={t("transcription.transcript")}>+ {visible.map((exchange) => <Exchange key={exchange.id} exchange={exchange} original={original} search={search.trim()} started={current.started_ms} />)}+ <p className="transcription-end"><span />{t(finished ? "transcription.end" : "transcription.latest")}<span /></p>+ </div> : <TranscriptState title={t(term ? "transcription.no_matches" : "transcription.no_speech")} body={t(term ? "transcription.find_help" : "transcription.no_speech_help")}>+ {term && <Button variant="outline" onClick={() => setSearch("")}>{t("transcription.clear_search")}</Button>}+ </TranscriptState>}+ </>}+ </div>+ </div>;+}++function Exchange({ exchange, original, search, started }: { exchange: TranscriptExchange; original: boolean; search: string; started: number }) {+ const t = useT();+ const assistant = useEventStore((state) => state.assistantName);+ const native = useCapabilities().data?.native_file_actions ?? false;+ const [feedback, setFeedback] = useState("");+ const [busy, setBusy] = useState(false);+ const [failed, setFailed] = useState(false);+ async function exportExchange(download: boolean) {+ setBusy(true);+ setFeedback("");+ setFailed(false);+ try {+ const text = exchangeText(exchange, original, t("session_detail.you"), assistant);+ if (download) await saveOrDownload({ filename: `voice-excerpt-${Math.floor(started)}-${exchange.number ?? "spoken"}.txt`, text, mime: "text/plain;charset=utf-8", native });+ else if (!await robustCopy(text)) throw new Error("Clipboard unavailable");+ setFeedback(t(download ? "transcription.saved" : "transcription.copied"));+ } catch {+ setFailed(true);+ setFeedback(t(download ? "session_detail.download_failed" : "session_detail.copy_failed_clipboard"));+ } finally { setBusy(false); }+ }+ return <article className="transcription-exchange">+ <div className="transcription-exchange-rule">+ <span>{exchange.number === null ? t("transcription.spoken_output") : fill(t("transcription.exchange"), { number: String(exchange.number).padStart(2, "0") })}</span>+ <div>+ <Button variant="ghost" size="icon" disabled={busy} aria-label={t("turn_card.copy_turn")} title={t("turn_card.copy_turn")} onClick={() => void exportExchange(false)}><Copy aria-hidden /></Button>+ <Button variant="ghost" size="icon" disabled={busy} aria-label={t("turn_card.download_turn")} title={t("turn_card.download_turn")} onClick={() => void exportExchange(true)}><Download aria-hidden /></Button>+ </div>+ </div>+ {exchange.passages.map((passage) => <div className="transcription-passage" key={passage.id}>+ <div className="transcription-speaker" data-speaker={passage.speaker}>+ <span>{passage.speaker === "you" ? t("session_detail.you") : assistant}</span>+ <time>{elapsedTime(passage.at - started)}</time>+ </div>+ <div className="transcription-words">+ {passage.original && !original && <span className="transcription-wording-note">{t("session_turn.polished")}</span>}+ {passage.pending && <span className="transcription-pending">{t("transcription.pending")}</span>}+ {passage.kind && passage.kind !== "reply" && <span className="transcription-wording-note">{t(`transcription.spoken_${passage.kind}`) === `transcription.spoken_${passage.kind}` ? t("transcription.spoken_output") : t(`transcription.spoken_${passage.kind}`)}</span>}+ <p><Highlight text={passageText(passage, original)} term={search} /></p>+ </div>+ </div>)}+ <p className={failed ? "transcript-feedback is-error" : "transcript-feedback"} role={failed ? "alert" : "status"}>{feedback}</p>+ </article>;+}++function Highlight({ text, term }: { text: string; term: string }) {+ if (!term) return <>{text}</>;+ const escaped = term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");+ return <>{text.split(new RegExp(`(${escaped})`, "gi")).map((part, index) => index % 2 ? <mark key={index}>{part}</mark> : part)}</>;+}diff --git a/jarvis/ui/web/frontend/src/components/transcription/navigation.test.ts b/jarvis/ui/web/frontend/src/components/transcription/navigation.test.tsnew file mode 100644index 0000000000..fc9a1f7fdf--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/transcription/navigation.test.ts@@ -0,0 +1,12 @@+import { expect, it } from "vitest";+import { initialSectionFromSearch, resolveSectionId, SECTION_IDS, SECTION_LABELS } from "@/store/events";+import { NAV_GROUPS } from "@/components/layout/navGroups";++it("retires Run Inspector while preserving old links and the transcription destination", () => {+ expect(SECTION_IDS).not.toContain("run_inspector");+ expect(Object.values(SECTION_LABELS)).not.toContain("Run Inspector");+ expect(JSON.stringify(NAV_GROUPS)).not.toContain("run_inspector");+ expect(JSON.stringify(NAV_GROUPS)).toContain("sessions");+ expect(initialSectionFromSearch("?view=run_inspector&solo=1")).toBe("sessions");+ expect(resolveSectionId("run_inspector")).toBe("sessions");+});diff --git a/jarvis/ui/web/frontend/src/components/transcription/testFixtures.ts b/jarvis/ui/web/frontend/src/components/transcription/testFixtures.tsnew file mode 100644index 0000000000..dfb6b3935a--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/transcription/testFixtures.ts@@ -0,0 +1,19 @@+import type { SessionDetail } from "@/components/sessions/types";++export function transcriptFixture(): SessionDetail {+ return {+ session: { id: "voice/one", started_ms: 1000, ended_ms: 31000, hangup_reason: "hotkey", turn_count: 1,+ total_cost_usd: 0, total_tokens_in: 0, total_tokens_out: 0, providers_used: [], language: "en", wake_keyword: "", voice_mode: "realtime" },+ turns: [{ id: "turn-a", session_id: "voice/one", idx: 0, started_ms: 2000, ended_ms: 8000,+ user_text: "um find [notes] please", user_text_polished: "Find [notes], please.", user_lang: "en",+ jarvis_text: "An unspoken draft", jarvis_lang: "en", tier: "fast", provider: "private-provider", model: "private-model",+ tokens_in: 123, tokens_out: 456, cost_usd: 0, latency_total_ms: 100, think_ms: 50, speak_ms: 50,+ tool_calls: ["private-tool"], awaiting_confirmation: true, voice_name: "", voice_provider: "" }],+ events: [+ { seq: 1, session_id: "voice/one", turn_id: "turn-a", ts_ms: 7000, kind: "SpeechSpoken", payload: { text: "Here are the [notes].", spoken_kind: "reply" } },+ { seq: 2, session_id: "voice/one", turn_id: "turn-a", ts_ms: 3000, kind: "SpeechSpoken", payload: { text: "One moment.", spoken_kind: "progress" } },+ { seq: 3, session_id: "voice/one", turn_id: null, ts_ms: 1100, kind: "SpeechSpoken", payload: { text: "Ready to listen.", spoken_kind: "announcement" } },+ { seq: 4, session_id: "voice/one", turn_id: "retired-turn", ts_ms: 20000, kind: "SpeechSpoken", payload: { text: "Your background task is complete.", spoken_kind: "completion" } },+ ],+ };+}diff --git a/jarvis/ui/web/frontend/src/components/transcription/transcript.test.ts b/jarvis/ui/web/frontend/src/components/transcription/transcript.test.tsnew file mode 100644index 0000000000..162cd5ecb0--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/transcription/transcript.test.ts@@ -0,0 +1,35 @@+import { describe, expect, it } from "vitest";+import type { VoiceTurnRow } from "@/components/sessions/types";+import { elapsedTime, exchangeText, transcriptExchanges } from "./transcript";++import { transcriptFixture } from "./testFixtures";++describe("transcript reading contract", () => {+ it("reads confirmed speech in order, retaining orphaned announcements and original wording", () => {+ const detail = transcriptFixture();+ const before = JSON.stringify(detail);+ const exchanges = transcriptExchanges(detail);+ expect(exchanges.map((exchange) => exchange.number)).toEqual([null, 1, null]);+ const turn = exchanges[1];+ expect(turn.passages.map((passage) => passage.text)).toEqual(["Find [notes], please.", "One moment.", "Here are the [notes]."]);+ expect(turn.passages.at(-1)?.pending).toBe(true);+ expect(exchangeText(turn, true, "You", "Assistant")).toContain("um find [notes] please");+ expect(exchangeText(turn, false, "You", "Assistant")).not.toContain("An unspoken draft");+ expect(JSON.stringify(detail)).toBe(before);+ });++ it("falls back to legacy replies, ignores malformed speech, and keeps stable turn numbers", () => {+ const detail = transcriptFixture();+ detail.events = [{ ...detail.events[0], payload: { text: { secret: "not speech" } } }];+ detail.turns.unshift({ ...detail.turns[0], id: "silent", user_text: "", jarvis_text: "" } as VoiceTurnRow);+ const exchanges = transcriptExchanges(detail);+ expect(exchanges).toHaveLength(1);+ expect(exchanges[0].number).toBe(2);+ expect(exchanges[0].passages.at(-1)?.text).toBe("An unspoken draft");+ });++ it("formats elapsed time without negative timestamps or minute wrapping", () => {+ expect(elapsedTime(-50)).toBe("0:00");+ expect(elapsedTime(3_661_000)).toBe("61:01");+ });+});diff --git a/jarvis/ui/web/frontend/src/components/transcription/transcript.ts b/jarvis/ui/web/frontend/src/components/transcription/transcript.tsnew file mode 100644index 0000000000..2d66192465--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/transcription/transcript.ts@@ -0,0 +1,86 @@+import type { SessionDetail, VoiceSpokenLine, VoiceTurnRow } from "@/components/sessions/types";++export interface TranscriptPassage {+ id: string;+ speaker: "you" | "assistant";+ text: string;+ original?: string;+ at: number;+ kind?: string;+ pending?: boolean;+}++export interface TranscriptExchange {+ id: string;+ number: number | null;+ passages: TranscriptPassage[];+}++/** SpeechSpoken is the playback record; never substitute an unspoken draft. */+export function transcriptExchanges(detail: SessionDetail): TranscriptExchange[] {+ const spoken = new Map<string, VoiceSpokenLine[]>();+ for (const event of detail.events) {+ if (event.kind !== "SpeechSpoken" || typeof event.payload.text !== "string" || !event.payload.text.trim()) continue;+ const key = event.turn_id ?? "";+ const lines = spoken.get(key) ?? [];+ lines.push({+ turn_id: event.turn_id, ts_ms: event.ts_ms, text: event.payload.text,+ spoken_kind: typeof event.payload.spoken_kind === "string" ? event.payload.spoken_kind : "other",+ });+ spoken.set(key, lines);+ }+ const exchanges: TranscriptExchange[] = detail.turns.map((turn, index) => ({+ id: turn.id, number: index + 1,+ passages: turnPassages(turn, spoken.get(turn.id) ?? []),+ }));+ // Announcements and background results may have no surviving turn. Keep them.+ const turnIds = new Set(detail.turns.map((turn) => turn.id));+ for (const [id, lines] of spoken) {+ if (turnIds.has(id)) continue;+ for (const [index, line] of lines.entries()) {+ exchanges.push({ id: `spoken-${id}-${index}`, number: null,+ passages: [spokenPassage(line, `${id}-${index}`)] });+ }+ }+ return exchanges+ .map((exchange) => ({ ...exchange, passages: exchange.passages.sort((a, b) => a.at - b.at) }))+ .filter((exchange) => exchange.passages.length > 0)+ .sort((a, b) => a.passages[0].at - b.passages[0].at);+}++function spokenPassage(line: VoiceSpokenLine, id: string): TranscriptPassage {+ return { id, speaker: "assistant", text: line.text, at: line.ts_ms, kind: line.spoken_kind };+}++function turnPassages(turn: VoiceTurnRow, spoken: VoiceSpokenLine[]): TranscriptPassage[] {+ const passages: TranscriptPassage[] = [];+ if (turn.user_text) {+ const polished = turn.user_text_polished?.trim();+ passages.push({+ id: `${turn.id}-you`, speaker: "you", at: turn.started_ms,+ text: polished || turn.user_text,+ original: polished && polished !== turn.user_text.trim() ? turn.user_text : undefined,+ });+ }+ for (const [index, line] of spoken.entries()) {+ passages.push({ ...spokenPassage(line, `${turn.id}-spoken-${index}`), pending: line.spoken_kind === "reply" && turn.awaiting_confirmation });+ }+ if (!spoken.some((line) => line.spoken_kind === "reply") && turn.jarvis_text) {+ passages.push({ id: `${turn.id}-reply`, speaker: "assistant", text: turn.jarvis_text,+ at: turn.ended_ms ?? turn.started_ms, pending: turn.awaiting_confirmation });+ }+ return passages;+}++export function passageText(passage: TranscriptPassage, original: boolean): string {+ return original && passage.original ? passage.original : passage.text;+}++export function elapsedTime(ms: number): string {+ const seconds = Math.max(0, Math.floor(ms / 1000));+ return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;+}++export function exchangeText(exchange: TranscriptExchange, original: boolean, you: string, assistant: string): string {+ return exchange.passages.map((p) => `${p.speaker === "you" ? you : assistant}\n${passageText(p, original)}`).join("\n\n");+}diff --git a/jarvis/ui/web/frontend/src/components/transcription/transcription.css b/jarvis/ui/web/frontend/src/components/transcription/transcription.cssnew file mode 100644index 0000000000..f19c9059cb--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/transcription/transcription.css@@ -0,0 +1,88 @@+.transcription-workspace { height: 100%; min-height: 0; min-width: 0; container: transcription / inline-size; color: hsl(var(--foreground)); background: hsl(var(--background)); }+.transcription-library, .transcription-reader { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }+.transcription-library[hidden] { display: none; }+.transcription-library-inner { max-width: 1120px; margin: 0 auto; padding: 56px 48px 72px; }+.transcription-masthead { margin-bottom: 38px; }+.transcription-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: hsl(var(--muted-foreground)); font-size: 12px; line-height: 1.6; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }+.transcription-eyebrow svg { width: 19px; height: 19px; color: hsl(var(--accent)); }+.transcription-masthead h1 { font-family: Georgia, "Times New Roman", serif; color: hsl(var(--foreground-strong)); font-size: clamp(36px, 5cqw, 56px); letter-spacing: -.045em; line-height: 1.15; margin: 15px 0; font-weight: 400; }+.transcription-intro { font-size: 16px; line-height: 1.7; color: hsl(var(--muted-foreground)); max-width: 52ch; }+.transcription-library-tools { display: flex; align-items: center; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid hsl(var(--border-strong)); }+.transcription-search { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: hsl(var(--muted-foreground)); border-radius: 6px; background: hsl(var(--secondary)); padding: 0 12px; }+.transcription-search > svg { width: 17px; height: 17px; flex-shrink: 0; }+.transcription-search input { min-width: 0; width: 100%; height: 44px; color: hsl(var(--foreground)); background: transparent; outline: none; font-size: 14px; }+.transcription-search input::-webkit-search-cancel-button { display: none; }+.transcription-search:focus-within { outline: 2px solid hsl(var(--ring)); outline-offset: 3px; }+.transcription-search button { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 4px; }+.transcription-search button svg { width: 16px; height: 16px; }+.transcription-library-count, .transcription-find-count { font-size: 13px; color: hsl(var(--muted-foreground)); margin: 18px 0 28px; }+.transcription-day { margin-top: 28px; }+.transcription-day h2 { font-size: 13px; line-height: 1.6; font-weight: 600; padding-bottom: 12px; color: hsl(var(--muted-foreground)); }+.transcription-day ul { list-style: none; padding: 0; }+.transcription-session { width: 100%; display: grid; grid-template-columns: 80px minmax(0, 1fr) 24px; align-items: center; gap: 24px; text-align: start; padding: 24px 12px 24px 0; border-top: 1px solid hsl(var(--border)); transition: background-color 150ms; }+.transcription-session:hover { background: hsl(var(--secondary)); }+.transcription-session-time { font-size: 13px; font-variant-numeric: tabular-nums; color: hsl(var(--muted-foreground)); }+.transcription-session-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 18px; line-height: 1.5; font-weight: 500; letter-spacing: -.015em; overflow-wrap: anywhere; color: hsl(var(--foreground-strong)); }+.transcription-session-meta, .transcription-document-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 13px; color: hsl(var(--muted-foreground)); margin-top: 8px; }+.transcription-session-arrow { height: 19px; width: 19px; color: hsl(var(--muted-foreground)); }+.transcription-live { display: inline-flex; align-items: center; gap: 7px; color: hsl(var(--foreground)); }+.transcription-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: hsl(var(--accent)); }+.transcription-reader-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; padding: 14px 28px; border-bottom: 1px solid hsl(var(--border)); background: hsl(var(--background)); gap: 12px; }+.transcription-reader-bar > span { font-family: Georgia, "Times New Roman", serif; font-size: 18px; color: hsl(var(--muted-foreground)); }+.transcription-page { max-width: 960px; margin: 0 auto; padding: 44px 48px 64px; }+.transcription-document-header h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(27px, 3.6cqw, 40px); font-weight: 400; line-height: 1.3; letter-spacing: -.025em; color: hsl(var(--foreground-strong)); margin: 18px 0; overflow-wrap: anywhere; }+.transcription-document-header h1:focus { outline: none; }+.transcription-document-meta { margin-bottom: 24px; }+.transcript-action-buttons { display: flex; flex-wrap: wrap; gap: 8px; }+.transcript-export { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 0; font-size: 14px; }+.transcript-export select { border: 1px solid hsl(var(--border-strong)); border-radius: 6px; height: 38px; padding: 0 28px 0 10px; background: hsl(var(--background)); color: hsl(var(--foreground)); }+.transcript-feedback { display: flex; align-items: center; gap: 6px; color: hsl(var(--muted-foreground)); font-size: 13px; line-height: 1.6; }+.transcript-feedback:not(:empty) { margin: 12px 0; }+.transcript-feedback svg { width: 14px; height: 14px; }+.transcript-feedback.is-error { color: hsl(var(--destructive)); }+.transcription-reading-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin: 28px 0 16px; padding-top: 24px; border-top: 1px solid hsl(var(--border-strong)); }+.transcription-reading-tools .transcription-search { flex: 1 1 210px; }+.transcription-original { display: flex; align-items: center; gap: 8px; color: hsl(var(--muted-foreground)); font-size: 13px; cursor: pointer; min-height: 44px; }+.transcription-original input { width: 16px; height: 16px; accent-color: hsl(var(--accent)); }+.transcription-exchange { padding: 20px 0 8px; }+.transcription-exchange + .transcription-exchange { border-top: 1px solid hsl(var(--border)); margin-top: 16px; }+.transcription-exchange-rule { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; font-size: 12px; letter-spacing: .05em; color: hsl(var(--muted-foreground)); }+.transcription-exchange-rule > div { display: flex; }+.transcription-passage { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 24px; margin-bottom: 30px; }+.transcription-speaker { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-top: 5px; font-size: 13px; overflow-wrap: anywhere; }+.transcription-speaker > span { font-weight: 600; line-height: 1.5; max-width: 100%; }+.transcription-speaker[data-speaker="assistant"] > span { padding-left: 10px; border-left: 2px solid hsl(var(--accent)); }+.transcription-speaker time { font-size: 12px; font-variant-numeric: tabular-nums; color: hsl(var(--muted-foreground)); }+.transcription-words { min-width: 0; }+.transcription-words p { font-size: 17px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }+.transcription-words mark { color: hsl(var(--foreground-strong)); background: hsl(var(--accent) / .2); box-shadow: 0 1px 0 hsl(var(--accent)); }+.transcription-wording-note, .transcription-pending { display: inline-block; margin: 0 10px 7px 0; font-size: 12px; color: hsl(var(--muted-foreground)); }+.transcription-pending { color: hsl(var(--warning)); }+.transcription-end { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 36px; font-size: 12px; color: hsl(var(--muted-foreground)); }+.transcription-end span { height: 1px; width: 32px; background: hsl(var(--border-strong)); }+.transcription-recording-note { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 14px; line-height: 1.7; color: hsl(var(--muted-foreground)); padding: 16px 0; }+.transcription-state { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; max-width: 540px; padding: 52px 0; }+.transcription-state > svg { width: 28px; height: 28px; color: hsl(var(--muted-foreground)); margin-bottom: 6px; }+.transcription-state h2 { font-size: 23px; font-weight: 500; line-height: 1.4; letter-spacing: -.025em; }+.transcription-state p { font-size: 15px; line-height: 1.8; color: hsl(var(--muted-foreground)); }+.transcription-state.is-error { border-bottom: 1px solid hsl(var(--border)); }+.transcription-state.is-error > svg { color: hsl(var(--destructive)); }+.transcription-workspace :is(button, input, select, a):focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 3px; }+@container transcription (max-width: 650px) {+ .transcription-library-inner { padding: 32px 24px 48px; }+ .transcription-page { padding: 32px 24px 48px; }+ .transcription-reader-bar { padding: 10px 16px; }+ .transcription-reader-bar > span { display: none; }+ .transcription-session { grid-template-columns: minmax(0, 1fr) 20px; gap: 10px; padding: 20px 4px; }+ .transcription-session-time { grid-column: 1 / -1; }+ .transcription-session-title { font-size: 17px; }+ .transcription-passage { grid-template-columns: 1fr; gap: 10px; }+ .transcription-speaker { flex-direction: row; align-items: baseline; gap: 12px; }+ .transcription-words p { font-size: 16px; line-height: 1.8; }+}+@container transcription (max-width: 380px) {+ .transcription-library-inner, .transcription-page { padding-left: 16px; padding-right: 16px; }+ .transcription-library-tools { gap: 8px; }+ .transcription-library-tools > button > span { display: none; }+}+@media (prefers-reduced-motion: reduce) { .transcription-session { transition: none; } }diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 9aa13da658..acc60e6740 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -140,7 +140,6 @@"docs": "Docs","mcps": "MCPs","sessions": "Transkription",- "run_inspector": "Run Inspector","costs": "Kosten","visualization": "Artefakte","clis": "CLIs",@@ -1428,6 +1427,66 @@"pipeline": "Pipeline","unknown": "Unbekannt"},+ "transcription": {+ "archive": "Spracharchiv",+ "intro": "Ein Ort für deine Gespräche. Finde die Worte, zu denen du zurückkehren möchtest.",+ "search_sessions": "Gesprächsanfänge durchsuchen",+ "clear_search": "Suche löschen",+ "refresh": "Aktualisieren",+ "recorder_off": "Transkription nicht verfügbar",+ "recorder_help": "Die Gesprächsaufzeichnung ist derzeit ausgeschaltet. Versuche es erneut, sobald sie verfügbar ist.",+ "list_error": "Deine Gespräche konnten nicht geladen werden",+ "retry_help": "Deine gespeicherten Gespräche bleiben unverändert. Prüfe die Verbindung und versuche es erneut.",+ "retry": "Erneut versuchen",+ "loading_library": "Deine Gespräche werden geladen…",+ "results": "{count} Ergebnisse",+ "recent_count": "{count} Gespräche · die letzten 100",+ "untitled": "Unbenanntes Gespräch",+ "in_progress": "Läuft gerade",+ "exchanges": "{count} Wortwechsel",+ "no_matches": "Keine passenden Worte gefunden",+ "search_help": "Versuche einen anderen Ausdruck vom Anfang eines Gesprächs.",+ "empty_title": "Hier finden deine Gespräche ihren Platz",+ "empty_body": "Lies nach einem Sprachgespräch nach, was gesagt wurde, finde ein Detail oder speichere eine Kopie.",+ "open_chat": "Zum Chat",+ "all_conversations": "Alle Gespräche",+ "saved_conversation": "Gespeichertes Gespräch",+ "live_help": "Dieses Gespräch läuft noch. Aktualisiere die Ansicht für die zuletzt gespeicherten Worte.",+ "find": "In diesem Transkript suchen",+ "original_wording": "Originalwortlaut",+ "transcript": "Gesprächstranskript",+ "end": "Ende des Gesprächs",+ "latest": "Zuletzt gespeicherte Worte",+ "no_speech": "Keine Sprache aufgezeichnet",+ "no_speech_help": "Für dieses Gespräch wurde noch keine Sprache gespeichert.",+ "find_help": "Versuche einen anderen Ausdruck oder lösche die Suche, um das ganze Gespräch zu lesen.",+ "exchange": "Wortwechsel {number}",+ "spoken_output": "Gesprochene Ausgabe",+ "pending": "Bestätigung ausstehend",+ "copy": "Transkript kopieren",+ "format": "Dateiformat",+ "plain_text": "Klartext",+ "download": "Herunterladen",+ "open_with": "Öffnen mit…",+ "open_file": "Datei öffnen",+ "preparing": "Transkript wird vorbereitet…",+ "copied": "In die Zwischenablage kopiert",+ "saved": "Transkript gespeichert",+ "spoken_clarify": "Rückfrage",+ "spoken_timeout": "Zeitüberschreitung",+ "spoken_unavailable": "Assistent nicht verfügbar",+ "spoken_stt_unavailable": "Sprache nicht erkannt",+ "spoken_privacy": "Datenschutzhinweis",+ "spoken_completion": "Hintergrundergebnis",+ "spoken_subagent": "Agentenantwort",+ "spoken_action_done": "Aktion bestätigt",+ "spoken_backchannel": "Rückmeldung",+ "spoken_announcement": "Ankündigung",+ "spoken_preamble": "Einleitung",+ "spoken_progress": "Fortschritt",+ "spoken_withheld": "Antwort zurückgehalten",+ "spoken_other": "Gesprochene Ausgabe"+ },"sessions_view": {"title": "Transkription","subtitle": "Letzte Voice-Sessions, Turn für Turn.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex b3bfc2e0fa..7133124fa3 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -140,7 +140,6 @@"docs": "Docs","mcps": "MCPs","sessions": "Transcription",- "run_inspector": "Run Inspector","costs": "Spend","visualization": "Artifacts","clis": "CLIs",@@ -1461,6 +1460,66 @@"pipeline": "Pipeline","unknown": "Unknown"},+ "transcription": {+ "archive": "Voice archive",+ "intro": "A place for every conversation. Find the words you want to return to.",+ "search_sessions": "Search conversation previews",+ "clear_search": "Clear search",+ "refresh": "Refresh",+ "recorder_off": "Transcription is unavailable",+ "recorder_help": "The conversation recorder is currently turned off. Try again when recording is available.",+ "list_error": "Your conversations could not be loaded",+ "retry_help": "Your saved conversations have not been changed. Check the connection and try again.",+ "retry": "Try again",+ "loading_library": "Loading your conversations…",+ "results": "{count} results",+ "recent_count": "{count} recent conversations · latest 100",+ "untitled": "Untitled conversation",+ "in_progress": "In progress",+ "exchanges": "{count} exchanges",+ "no_matches": "No matching words",+ "search_help": "Try another phrase from the beginning of a conversation.",+ "empty_title": "Your conversations belong here",+ "empty_body": "After a voice conversation, come back to read what was said, find a detail, or keep a copy.",+ "open_chat": "Go to chat",+ "all_conversations": "All conversations",+ "saved_conversation": "Saved conversation",+ "live_help": "This conversation is still in progress. Refresh to see the latest saved words.",+ "find": "Find in this transcript",+ "original_wording": "Original wording",+ "transcript": "Conversation transcript",+ "end": "End of conversation",+ "latest": "Latest saved words",+ "no_speech": "No speech recorded",+ "no_speech_help": "This conversation does not have any saved speech yet.",+ "find_help": "Try a different phrase, or clear the search to read the whole conversation.",+ "exchange": "Exchange {number}",+ "spoken_output": "Spoken output",+ "pending": "Awaiting confirmation",+ "copy": "Copy transcript",+ "format": "File format",+ "plain_text": "Plain text",+ "download": "Download",+ "open_with": "Open with…",+ "open_file": "Open file",+ "preparing": "Preparing transcript…",+ "copied": "Copied to clipboard",+ "saved": "Transcript saved",+ "spoken_clarify": "Clarifying question",+ "spoken_timeout": "Timeout notice",+ "spoken_unavailable": "Assistant unavailable",+ "spoken_stt_unavailable": "Speech not recognized",+ "spoken_privacy": "Privacy notice",+ "spoken_completion": "Background result",+ "spoken_subagent": "Agent response",+ "spoken_action_done": "Action confirmed",+ "spoken_backchannel": "Acknowledgement",+ "spoken_announcement": "Announcement",+ "spoken_preamble": "Introduction",+ "spoken_progress": "Progress update",+ "spoken_withheld": "Answer withheld",+ "spoken_other": "Spoken output"+ },"sessions_view": {"title": "Transcription","subtitle": "Recent voice sessions, turn by turn.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 2dee4f81ca..e9cc628a1f 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -140,7 +140,6 @@"docs": "Documentos","mcps": "MCPs","sessions": "Transcripción",- "run_inspector": "Run Inspector","costs": "Gastos","visualization": "Artefactos","clis": "CLIs",@@ -1428,6 +1427,66 @@"pipeline": "Pipeline","unknown": "Desconocido"},+ "transcription": {+ "archive": "Archivo de voz",+ "intro": "Un lugar para tus conversaciones. Encuentra las palabras que quieres volver a leer.",+ "search_sessions": "Buscar en el inicio de las conversaciones",+ "clear_search": "Borrar búsqueda",+ "refresh": "Actualizar",+ "recorder_off": "Transcripción no disponible",+ "recorder_help": "La grabación de conversaciones está desactivada. Vuelve a intentarlo cuando está disponible.",+ "list_error": "No se pudieron cargar tus conversaciones",+ "retry_help": "Tus conversaciones guardadas no han cambiado. Comprueba la conexión e inténtalo de nuevo.",+ "retry": "Reintentar",+ "loading_library": "Cargando tus conversaciones…",+ "results": "{count} resultados",+ "recent_count": "{count} conversaciones recientes · últimas 100",+ "untitled": "Conversación sin título",+ "in_progress": "En curso",+ "exchanges": "{count} intercambios",+ "no_matches": "No hay palabras coincidentes",+ "search_help": "Prueba otra frase del inicio de una conversación.",+ "empty_title": "Aquí tienen lugar tus conversaciones",+ "empty_body": "Después de una conversación de voz, vuelve para leer lo que se dijo, encontrar un detalle o guardar una copia.",+ "open_chat": "Ir al chat",+ "all_conversations": "Todas las conversaciones",+ "saved_conversation": "Conversación guardada",+ "live_help": "Esta conversación sigue en curso. Actualiza para ver las últimas palabras guardadas.",+ "find": "Buscar en esta transcripción",+ "original_wording": "Texto original",+ "transcript": "Transcripción de la conversación",+ "end": "Fin de la conversación",+ "latest": "Últimas palabras guardadas",+ "no_speech": "No hay voz registrada",+ "no_speech_help": "Esta conversación aún no tiene voz guardada.",+ "find_help": "Prueba otra frase o borra la búsqueda para leer toda la conversación.",+ "exchange": "Intercambio {number}",+ "spoken_output": "Salida de voz",+ "pending": "Confirmación pendiente",+ "copy": "Copiar transcripción",+ "format": "Formato de archivo",+ "plain_text": "Texto sin formato",+ "download": "Descargar",+ "open_with": "Abrir con…",+ "open_file": "Abrir archivo",+ "preparing": "Preparando transcripción…",+ "copied": "Copiado al portapapeles",+ "saved": "Transcripción guardada",+ "spoken_clarify": "Pregunta de aclaración",+ "spoken_timeout": "Tiempo de espera agotado",+ "spoken_unavailable": "Asistente no disponible",+ "spoken_stt_unavailable": "Voz no reconocida",+ "spoken_privacy": "Aviso de privacidad",+ "spoken_completion": "Resultado en segundo plano",+ "spoken_subagent": "Respuesta del agente",+ "spoken_action_done": "Acción confirmada",+ "spoken_backchannel": "Confirmación",+ "spoken_announcement": "Anuncio",+ "spoken_preamble": "Introducción",+ "spoken_progress": "Actualización de progreso",+ "spoken_withheld": "Respuesta retenida",+ "spoken_other": "Salida de voz"+ },"sessions_view": {"title": "Transcripción","subtitle": "Sesiones de voz recientes, turno por turno.",diff --git a/jarvis/ui/web/frontend/src/lib/quickSwitch.ts b/jarvis/ui/web/frontend/src/lib/quickSwitch.tsindex 923931f896..35c7bdf7f8 100644--- a/jarvis/ui/web/frontend/src/lib/quickSwitch.ts+++ b/jarvis/ui/web/frontend/src/lib/quickSwitch.ts@@ -80,7 +80,6 @@ const ALIASES: Partial<Record<string, readonly string[]>> = {visualization: ["outputs", "results", "images", "pages"],costs: ["tokens", "usage", "money", "billing", "budget"],sessions: ["transcripts", "recordings", "history"],- run_inspector: ["runs", "debug", "trace"],computers: ["servers", "ssh", "vps", "remote", "machines"],"agent-instructions": ["assistant", "soul", "soul md", "character", "persona", "instructions", "memory md"],marketplace: ["store", "shop", "install"],diff --git a/jarvis/ui/web/frontend/src/store/events.ts b/jarvis/ui/web/frontend/src/store/events.tsindex 9f7ed434b5..c2ab2e1959 100644--- a/jarvis/ui/web/frontend/src/store/events.ts+++ b/jarvis/ui/web/frontend/src/store/events.ts@@ -60,7 +60,6 @@ export type SectionId =| "docs"| "mcps"| "sessions"- | "run_inspector"// Spend & Tokens — what every provider, model and role actually cost.| "costs"| "clis"@@ -129,7 +128,6 @@ export const SECTION_IDS = ["docs","mcps","sessions",- "run_inspector","costs","clis","cli-test-hub",@@ -185,6 +183,7 @@ export function isSectionId(value: unknown): value is SectionId {* lives on agents now, as each agent's routines.*/export const LEGACY_SECTION_ALIASES: Readonly<Record<string, SectionId>> = {+ run_inspector: "sessions",outputs: "visualization",wallpaper: "settings",tasks: "agents",@@ -228,7 +227,6 @@ export const SECTION_LABELS: Record<SectionId, string> = {docs: "Docs",mcps: "MCPs",sessions: "Transcription",- run_inspector: "Run Inspector",costs: "Spend",clis: "CLIs","cli-test-hub": "CLI Test Hub",diff --git a/jarvis/ui/web/frontend/src/views/RunInspectorView.tsx b/jarvis/ui/web/frontend/src/views/RunInspectorView.tsxdeleted file mode 100644index 8cbba8672d..0000000000--- a/jarvis/ui/web/frontend/src/views/RunInspectorView.tsx+++ /dev/null@@ -1,189 +0,0 @@-import { useEffect, useMemo, useRef, useState } from "react";-import { FlaskConical, Search } from "lucide-react";--import { EmptyState } from "@/components/ui/empty-state";-import { Input } from "@/components/ui/input";-import { PanelSkeleton } from "@/components/layout/PanelSkeleton";-import { RunDetail } from "@/components/runs/RunDetail";-import { RunList } from "@/components/runs/RunList";-import { useRuns } from "@/hooks/useRuns";-import { useT } from "@/i18n";-import { cn } from "@/lib/utils";-import { ViewHeader } from "@/views/ChatsView";--/**- * Run Inspector — master–detail over every recorded run.- *- * Left: the rail, one row per run, searchable across the utterance, the- * session id and the capabilities the run touched. Right: the selected run,- * whose own header and tabs carry the forensic material.- *- * The layout measures ITSELF, not the window: this view also runs in a solo- * window and beside a wide sidebar, and below ~900 px a 320 px rail plus a- * reading column no longer fit. There it stacks — the rail is the screen, and- * picking a run replaces it with the detail plus a Back control.- */--/** Below this container width the master–detail splits into stacked screens. */-const NARROW_PX = 900;--export function RunInspectorView() {- const t = useT();- const { data: runs, isError, isLoading } = useRuns();- const [selected, setSelected] = useState<string | null>(null);- const [query, setQuery] = useState("");- // `null` = not measured yet, so nothing auto-selects before the layout is- // known — on a narrow container an auto-selection hides the list outright.- const [narrow, setNarrow] = useState<boolean | null>(null);- const rootRef = useRef<HTMLDivElement>(null);-- useEffect(() => {- const el = rootRef.current;- if (!el || typeof ResizeObserver === "undefined") {- setNarrow(false);- return;- }- const observer = new ResizeObserver((entries) => {- const width = entries[0]?.contentRect.width ?? 0;- if (width > 0) setNarrow(width < NARROW_PX);- });- observer.observe(el);- return () => observer.disconnect();- }, []);-- // Wide layouts open on the newest run, because the detail pane is on screen- // anyway and an empty one next to a full list reads as a failure to load.- useEffect(() => {- if (narrow !== false || selected !== null) return;- if (runs && runs.length > 0) setSelected(runs[0].session_id);- }, [narrow, runs, selected]);-- const filtered = useMemo(() => {- const q = query.trim().toLowerCase();- if (!q || !runs) return runs ?? [];- return runs.filter(- (r) =>- r.preview.toLowerCase().includes(q) ||- r.session_id.toLowerCase().includes(q) ||- r.feature_tags.some((tag) => tag.toLowerCase().includes(q)),- );- }, [runs, query]);-- if (isError) {- // The recorder is off, not broken — a designed state, with the reason.- return (- <div className="flex h-full flex-col">- <ViewHeader- icon={<FlaskConical />}- title={t("run_inspector.title")}- subtitle={t("run_inspector.subtitle")}- />- <div className="flex min-h-0 flex-1 items-center justify-center p-8">- <EmptyState- icon={<FlaskConical />}- title={t("run_inspector.unavailable")}- description={t("run_inspector.unavailable_body")}- />- </div>- </div>- );- }-- const hasRuns = (runs?.length ?? 0) > 0;- const isNarrow = narrow === true;- const showList = !isNarrow || selected === null;- const showDetail = !isNarrow || selected !== null;-- return (- <div ref={rootRef} className="flex h-full flex-col">- <ViewHeader- icon={<FlaskConical />}- title={t("run_inspector.title")}- subtitle={t("run_inspector.subtitle")}- />-- <div className="flex min-h-0 flex-1">- {showList && (- // A standing column the full height of the section: far too wide to- // earn --card, so it separates from the detail by taking the rail's- // own ground rather than by a rule.- <div- className={cn(- "flex min-h-0 shrink-0 flex-col border-r border-border bg-sidebar",- isNarrow ? "w-full" : "w-[320px]",- )}- >- {hasRuns && (- <div className="shrink-0 p-3">- <div className="relative">- <Search- aria-hidden- className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"- />- <Input- value={query}- onChange={(e) => setQuery(e.target.value)}- placeholder={t("run_inspector.search")}- aria-label={t("run_inspector.search")}- data-testid="run-search"- className="pl-9 ring-offset-sidebar"- />- </div>- </div>- )}- <nav- aria-label={t("run_inspector.title")}- className="min-h-0 flex-1 overflow-y-auto scrollbar-jarvis p-2"- >- {isLoading ? (- // Real rows at their real height, not a spinner in a void.- <PanelSkeleton- rows={7}- rowHeight={72}- label={t("run_inspector.loading")}- className="p-1"- />- ) : !hasRuns ? (- // The stage carries the empty state; the rail says nothing twice.- null- ) : filtered.length === 0 ? (- <p className="px-3 py-8 text-center text-base text-muted-foreground">- {t("run_inspector.no_matches")}- </p>- ) : (- <RunList items={filtered} selectedId={selected} onSelect={setSelected} />- )}- </nav>- </div>- )}-- {showDetail && (- <div className="flex min-h-0 min-w-0 flex-1 flex-col">- {selected ? (- <RunDetail- sessionId={selected}- onBack={isNarrow ? () => setSelected(null) : undefined}- />- ) : !hasRuns && !isLoading ? (- <div className="flex h-full items-center justify-center p-8">- <EmptyState- icon={<FlaskConical />}- title={t("run_inspector.empty_title")}- description={t("run_inspector.empty_body")}- />- </div>- ) : (- <div className="flex h-full items-center justify-center p-8">- <EmptyState- icon={<FlaskConical />}- title={t("run_inspector.empty")}- description={t("run_inspector.empty_hint")}- />- </div>- )}- </div>- )}- </div>- </div>- );-}diff --git a/jarvis/ui/web/frontend/src/views/SessionsView.test.tsx b/jarvis/ui/web/frontend/src/views/SessionsView.test.tsxnew file mode 100644index 0000000000..b437bfbf8b--- /dev/null+++ b/jarvis/ui/web/frontend/src/views/SessionsView.test.tsx@@ -0,0 +1,126 @@+import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { SessionsView } from "./SessionsView";+import { transcriptFixture } from "@/components/transcription/testFixtures";+import { useEventStore } from "@/store/events";+import { useI18nStore } from "@/i18n";++let detail = transcriptFixture();+let listStatus = 200;+let detailStatus = 200;+let empty = false;+let loading = false;+let exportStatus = 200;+let client: QueryClient;+let requests: string[];+const copy = vi.fn(async (_text: string) => undefined);++beforeEach(() => {+ detail = transcriptFixture();+ listStatus = detailStatus = exportStatus = 200;+ empty = loading = false;+ requests = [];+ copy.mockClear();+ useI18nStore.setState({ ui: "en" });+ useEventStore.setState({ assistantName: "Assistant", events: [], activeSection: "sessions" });+ Object.defineProperty(navigator, "clipboard", { configurable: true, value: { writeText: copy } });+ vi.stubGlobal("fetch", async (input: RequestInfo | URL) => {+ const url = String(input);+ requests.push(url);+ if (url.startsWith("/api/sessions?")) {+ if (loading) return new Promise<Response>(() => {});+ return new Response(JSON.stringify(empty ? [] : [{ ...detail.session, duration_s: 30, preview: "Find my meeting notes" }]), { status: listStatus });+ }+ if (url.includes("/export?")) return new Response("Exported conversation", { status: exportStatus });+ if (url.startsWith("/api/sessions/")) return new Response(JSON.stringify(detail), { status: detailStatus });+ if (url === "/api/downloads/capabilities") return Response.json({ native_file_actions: false, platform: "linux" });+ throw new Error(`Unexpected request: ${url}`);+ });+ client = new QueryClient({ defaultOptions: { queries: { retry: false, gcTime: 0 } } });+});++afterEach(() => { cleanup(); client.clear(); vi.unstubAllGlobals(); });++function mount() { return render(<QueryClientProvider client={client}><SessionsView /></QueryClientProvider>); }+async function openConversation() { fireEvent.click(await screen.findByRole("button", { name: /Find my meeting notes/ })); }++describe("Transcription workspace", () => {+ it("opens a reading page and restores the filtered archive and keyboard focus on return", async () => {+ mount();+ const row = await screen.findByRole("button", { name: /Find my meeting notes/ });+ expect(requests.some((url) => url.includes("/api/sessions/"))).toBe(false);+ fireEvent.change(screen.getByRole("searchbox"), { target: { value: "meeting" } });+ fireEvent.click(row);+ expect(await screen.findByText("Here are the [notes].")).toBeTruthy();+ expect(screen.getByRole("heading", { name: "Find my meeting notes" })).toBe(document.activeElement);+ expect(screen.queryByText("An unspoken draft")).toBeNull();+ expect(screen.queryByText("private-model")).toBeNull();+ expect(screen.getByText("Ready to listen.")).toBeTruthy();+ expect(screen.getByText("Your background task is complete.")).toBeTruthy();+ expect(screen.getByText("Awaiting confirmation")).toBeTruthy();+ fireEvent.click(screen.getByRole("button", { name: "All conversations" }));+ await waitFor(() => expect(document.activeElement).toBe(row));+ expect((screen.getByRole("searchbox") as HTMLInputElement).value).toBe("meeting");+ });++ it("searches literal punctuation, switches original wording and copies only the selected excerpt", async () => {+ mount(); await openConversation();+ await screen.findByText("Here are the [notes].");+ fireEvent.click(screen.getByRole("checkbox", { name: "Original wording" }));+ expect(screen.getByText("um find [notes] please")).toBeTruthy();+ fireEvent.change(screen.getByRole("searchbox", { name: "Find in this transcript" }), { target: { value: "[notes]" } });+ expect(document.querySelectorAll("mark")).toHaveLength(2);+ expect(screen.queryByText("Ready to listen.")).toBeNull();+ const excerpt = screen.getByRole("article");+ fireEvent.click(within(excerpt).getByRole("button", { name: /copy/i }));+ await waitFor(() => expect(copy).toHaveBeenCalledWith(expect.stringContaining("um find [notes] please")));+ expect(copy.mock.calls[0][0]).not.toContain("private-model");+ fireEvent.change(screen.getByRole("searchbox", { name: "Find in this transcript" }), { target: { value: "no such phrase" } });+ expect(screen.getByText("No matching words")).toBeTruthy();+ fireEvent.click(screen.getAllByRole("button", { name: "Clear search" }).at(-1)!);+ expect(screen.getByText("Ready to listen.")).toBeTruthy();+ });++ it("exports through the existing encoded endpoint and reports failures", async () => {+ mount(); await openConversation();+ fireEvent.click(await screen.findByRole("button", { name: "Copy transcript" }));+ await waitFor(() => expect(copy).toHaveBeenCalledWith("Exported conversation"));+ expect(requests).toContain("/api/sessions/voice%2Fone/export?format=plain");+ fireEvent.click(screen.getByRole("button", { name: "Export" }));+ fireEvent.change(screen.getByRole("combobox", { name: "File format" }), { target: { value: "json" } });+ expect(screen.getByRole("link", { name: "Open file" }).getAttribute("href")).toBe("/api/sessions/voice%2Fone/export?format=json");+ exportStatus = 500;+ const panel = screen.getByRole("combobox").parentElement!;+ fireEvent.click(within(panel).getByRole("button", { name: "Copy" }));+ await waitFor(() => expect(screen.getByRole("alert").textContent).toMatch(/clipboard/i));+ });++ it("has distinct loading and empty states", async () => {+ loading = true; mount();+ expect(screen.getByText("Loading your conversations…")).toBeTruthy();+ expect(screen.queryByText("Your conversations belong here")).toBeNull();+ loading = false; empty = true;+ await act(async () => { client.setQueryData(["sessions"], []); });+ fireEvent.click(await screen.findByRole("button", { name: "Go to chat" }));+ expect(useEventStore.getState().activeSection).toBe("chats");+ });++ it("explains a disabled recorder without presenting a false empty archive", async () => {+ listStatus = 503; mount();+ expect(await screen.findByText("Transcription is unavailable")).toBeTruthy();+ expect(screen.queryByText("Your conversations belong here")).toBeNull();+ listStatus = 200;+ fireEvent.click(screen.getByRole("button", { name: "Try again" }));+ expect(await screen.findByRole("button", { name: /Find my meeting notes/ })).toBeTruthy();+ });++ it("offers recovery and a way back when a transcript cannot load", async () => {+ detailStatus = 500; mount(); await openConversation();+ expect(await screen.findByRole("alert")).toBeTruthy();+ expect(screen.getByRole("button", { name: "All conversations" })).toBeTruthy();+ detailStatus = 200;+ fireEvent.click(screen.getByRole("button", { name: "Try again" }));+ expect(await screen.findByText("Here are the [notes].")).toBeTruthy();+ });+});diff --git a/jarvis/ui/web/frontend/src/views/SessionsView.tsx b/jarvis/ui/web/frontend/src/views/SessionsView.tsxindex c730fc9c14..ee1b4768a0 100644--- a/jarvis/ui/web/frontend/src/views/SessionsView.tsx+++ b/jarvis/ui/web/frontend/src/views/SessionsView.tsx@@ -1,133 +1,92 @@-import { AlertTriangle, Mic } from "lucide-react";-import { useCallback, useEffect, useRef, useState } from "react";+import { useMemo, useRef, useState } from "react";+import { ArrowRight, AudioLines, RefreshCw, Search, X } from "lucide-react";+import { Button } from "@/components/ui/button";+import { useSessions } from "@/hooks/useSessions";+import { fill, useT, useUiLanguage } from "@/i18n";import { useEventStore } from "@/store/events";+import type { SessionListItem } from "@/components/sessions/types";+import { TranscriptReader, TranscriptState } from "@/components/transcription/TranscriptReader";+import { elapsedTime } from "@/components/transcription/transcript";+import "@/components/transcription/transcription.css";-import { ViewHeader } from "@/views/ChatsView";-import { SessionDetail } from "@/components/sessions/SessionDetail";-import { SessionList } from "@/components/sessions/SessionList";-import { resolveSelectedSessionId } from "@/components/sessions/sessionSelection";-import { useSessionDetail, useSessions } from "@/hooks/useSessions";-import { useT } from "@/i18n";-import { cn } from "@/lib/utils";--/**- * Below this much width the two columns stop fitting: the app's own navigation- * rail already takes 240 px, so an 850 px window leaves ~610 px here — a 320 px- * session rail beside it would push the transcript off screen.- */-const NARROW_PX = 900;--/**- * Transcription: a 320 px rail of sessions on the sidebar ground, and the- * chosen session read as a conversation on the page ground.- *- * Narrow containers get the master–detail treatment instead: the rail alone,- * and the transcript alone once a session is picked, with the way back in its- * header. Width is measured on this view's own box, not the window — the view- * can share the window with anything else.- */+/** A conversation index opens into a full reading page at every window size. */export function SessionsView() {- const assistantName = useEventStore((s) => s.assistantName);const t = useT();- const sessionsQuery = useSessions();- const [selectedId, setSelectedId] = useState<string | null>(null);- const [narrow, setNarrow] = useState(false);- // Stacked layout only: whether the transcript is the thing on screen. The- // selection itself resolves on its own (newest finished session), and that- // must NOT count as opening a session — a narrow view opens on the list.- const [detailOpen, setDetailOpen] = useState(false);- const rootRef = useRef<HTMLDivElement>(null);-- useEffect(() => {- const list = sessionsQuery.data;- if (!list) return;- setSelectedId((currentId) => resolveSelectedSessionId(list, currentId));- }, [sessionsQuery.data]);-- useEffect(() => {- const el = rootRef.current;- if (!el || typeof ResizeObserver === "undefined") return;- const observer = new ResizeObserver((entries) => {- const width = entries[0]?.contentRect.width ?? 0;- setNarrow(width > 0 && width < NARROW_PX);- });- observer.observe(el);- return () => observer.disconnect();- }, []);-- const selectSession = useCallback((id: string) => {- setSelectedId(id);- setDetailOpen(true);- }, []);-- const detailQuery = useSessionDetail(selectedId);+ const locale = useUiLanguage();+ const sessions = useSessions();+ const [selected, setSelected] = useState<SessionListItem | null>(null);+ const [search, setSearch] = useState("");+ const lastOpened = useRef<HTMLButtonElement | null>(null);+ const setSection = useEventStore((state) => state.setActiveSection);+ const groups = useMemo(() => {+ const byDay = new Map<string, SessionListItem[]>();+ for (const session of [...(sessions.data ?? [])].sort((a, b) => b.started_ms - a.started_ms)) {+ if (search.trim() && !session.preview.toLocaleLowerCase(locale).includes(search.trim().toLocaleLowerCase(locale))) continue;+ const day = new Date(session.started_ms).toLocaleDateString(locale, { weekday: "long", month: "long", day: "numeric", year: "numeric" });+ const list = byDay.get(day) ?? [];+ list.push(session);+ byDay.set(day, list);+ }+ return [...byDay];+ }, [sessions.data, search, locale]);+ const disabledRecorder = sessions.error instanceof Error && /HTTP 503/.test(sessions.error.message);- const errorMessage = sessionsQuery.error- ? sessionsQuery.error instanceof Error- ? sessionsQuery.error.message- : t("sessions_view.unknown_error")- : null;-- const showList = !narrow || !detailOpen;- const showDetail = !narrow || detailOpen;+ function back() {+ setSelected(null);+ requestAnimationFrame(() => lastOpened.current?.focus());+ }return (- <div ref={rootRef} className="flex h-full flex-col">- <ViewHeader- icon={<Mic />}- title={t("sessions_view.title")}- subtitle={t("sessions_view.subtitle")}- />-- {/* The recorder being switched off is a degraded state, not a failure:- everything else on this screen still works, so it is a warning- callout on the room's own ground. */}- {errorMessage && /HTTP 503/.test(errorMessage) && (- <div className="mx-8 mb-4 flex items-start gap-3 rounded-lg border border-warning/20 bg-warning/[0.08] px-4 py-3">- <AlertTriangle aria-hidden="true" className="mt-0.5 h-4 w-4 shrink-0 text-warning" />- <div className="min-w-0">- <div className="text-base font-medium text-foreground-strong">- {t("sessions_view.recorder_disabled")}- </div>- <div className="mt-1 text-sm text-muted-foreground">- {t("sessions_view.recorder_hint_a")}{" "}- <code className="font-mono">[sessions]</code>{" "}- {t("sessions_view.recorder_hint_b")}{" "}- <code className="font-mono">jarvis.toml</code>{" "}- (<code className="font-mono">enabled = true</code>){" "}- {t("sessions_view.recorder_hint_c")} {assistantName}.+ <section className="transcription-workspace" aria-label={t("sessions_view.title")}>+ <div className="transcription-library" hidden={selected !== null}>+ <div className="transcription-library-inner">+ <header className="transcription-masthead">+ <p className="transcription-eyebrow"><AudioLines aria-hidden />{t("transcription.archive")}</p>+ <h1>{t("sessions_view.title")}</h1>+ <p className="transcription-intro">{t("transcription.intro")}</p>+ </header>+ <div className="transcription-library-tools">+ <div className="transcription-search">+ <Search aria-hidden />+ <input aria-label={t("transcription.search_sessions")} placeholder={t("transcription.search_sessions")} value={search} onChange={(event) => setSearch(event.target.value)} type="search" />+ {search && <button type="button" aria-label={t("transcription.clear_search")} onClick={() => setSearch("")}><X aria-hidden /></button>}</div>+ <Button variant="ghost" disabled={sessions.isFetching} onClick={() => void sessions.refetch()} aria-label={t("transcription.refresh")}><RefreshCw aria-hidden className={sessions.isFetching ? "motion-safe:animate-spin" : undefined} /><span>{t("transcription.refresh")}</span></Button></div>+ {sessions.error && <TranscriptState kind="error" title={t(disabledRecorder ? "transcription.recorder_off" : "transcription.list_error")} body={t(disabledRecorder ? "transcription.recorder_help" : "transcription.retry_help")} retry={() => void sessions.refetch()} />}+ {sessions.isLoading ? <TranscriptState kind="loading" title={t("transcription.loading_library")} /> : groups.length > 0 ? (+ <>+ <p className="transcription-library-count" role="status">{fill(t(search.trim() ? "transcription.results" : "transcription.recent_count"), { count: groups.reduce((count, [, list]) => count + list.length, 0) })}</p>+ {groups.map(([day, list]) => (+ <section className="transcription-day" key={day} aria-label={day}>+ <h2>{day}</h2>+ <ul>{list.map((session) => (+ <li key={session.id}>+ <button className="transcription-session" type="button" onClick={(event) => { lastOpened.current = event.currentTarget; setSelected(session); }}>+ <time className="transcription-session-time" dateTime={new Date(session.started_ms).toISOString()}>{new Date(session.started_ms).toLocaleTimeString(locale, { hour: "2-digit", minute: "2-digit" })}</time>+ <span className="transcription-session-main">+ <span className="transcription-session-title">{session.preview || t("transcription.untitled")}</span>+ <span className="transcription-session-meta">+ {session.ended_ms === null ? <span className="transcription-live">{t("transcription.in_progress")}</span> : session.duration_s !== null ? <span>{elapsedTime(session.duration_s * 1000)}</span> : null}+ <span>{fill(t("transcription.exchanges"), { count: session.turn_count })}</span>+ {session.language && <span>{session.language.toLocaleUpperCase(locale)}</span>}+ </span>+ </span>+ <ArrowRight aria-hidden className="transcription-session-arrow" />+ </button>+ </li>+ ))}</ul>+ </section>+ ))}+ </>+ ) : !sessions.error && (+ <TranscriptState title={t(search.trim() ? "transcription.no_matches" : "transcription.empty_title")} body={t(search.trim() ? "transcription.search_help" : "transcription.empty_body")}>+ {search.trim() ? <Button variant="outline" onClick={() => setSearch("")}>{t("transcription.clear_search")}</Button> : <Button variant="outline" onClick={() => setSection("chats")}>{t("transcription.open_chat")}<ArrowRight aria-hidden /></Button>}+ </TranscriptState>+ )}</div>- )}-- <div className="flex min-h-0 flex-1 border-t border-border">- {showList && (- <div- className={cn(- "min-h-0 overflow-hidden bg-sidebar",- narrow ? "w-full" : "w-[320px] shrink-0 border-r border-border",- )}- >- <SessionList- sessions={sessionsQuery.data ?? []}- selectedId={selectedId}- onSelect={selectSession}- loading={sessionsQuery.isLoading}- />- </div>- )}- {showDetail && (- <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">- <SessionDetail- detail={detailQuery.data}- loading={detailQuery.isLoading && selectedId !== null}- error={detailQuery.error as Error | null}- onBack={narrow ? () => setDetailOpen(false) : undefined}- />- </div>- )}</div>- </div>+ {selected && <TranscriptReader key={selected.id} session={selected} onBack={back} />}+ </section>);}