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(local-models): the setup helper is its own screen, and its work reads as sentences
rubenluetke10-beep52b18e3900cd
diff --git a/jarvis/ui/web/frontend/src/components/local-models/AssistantPanel.tsx b/jarvis/ui/web/frontend/src/components/local-models/AssistantPanel.tsxindex fc6511208b..b7f0078996 100644--- a/jarvis/ui/web/frontend/src/components/local-models/AssistantPanel.tsx+++ b/jarvis/ui/web/frontend/src/components/local-models/AssistantPanel.tsx@@ -1,35 +1,42 @@/**- * The Local models setup assistant — a guided chat inside the section.+ * The Local models setup assistant — a plain chat that shows its work.** Three buttons start a canned turn on the backend (`POST …/assistant/run`* with a mode): "Help me set up" plans one complete setup, "Test" runs the* end-to-end check, "Something is broken" diagnoses. The conversation itself- * is an ordinary agent-chat session on the `local-models` surface, so the- * timeline, streaming, approval cards and cancel are the shared ones; only- * the store instance is this panel's own (`assistantStore.ts`).+ * is an ordinary agent-chat session on the `local-models` surface, so+ * streaming, approvals and cancel are the shared ones; only the store instance+ * is this panel's own (`assistantStore.ts`).*- * When the assistant ends a turn with a ```jarvis-proposal block, the plan- * is shown as a checklist (`SetupProposalCard`). ONE Confirm sends the- * "Execute steps: …" message and remembers the steps; every- * `approval_required` the runner raises for exactly those steps is answered- * "allow" here, on the client, so the user clicks once. The ToolExecutor still- * asks (AP-3) — the panel only answers what was already confirmed; anything- * else keeps its ordinary card.+ * Three deliberate departures from the coding-agent chat:*- * Honest states, never toasts: a 409 from `/run` means the Tool Model (or its Agents-tier fallback)- * is not usable and the sentence links to API Keys; a 404 means the backend- * predates the assistant. The header carries the monitor's last check with a- * "Fix" that opens diagnose mode.+ * 1. **The conversation scrolls inside itself.** The panel is one screen with+ * the composer at the bottom, so opening the helper never turns the section+ * into a page thousands of pixels tall that buries the roles below it.+ * 2. **Only the current run is shown.** Every click on a mode button starts a+ * new run; the ones before collapse behind one "earlier messages" line+ * instead of stacking five identical setups on top of each other.+ * 3. **Steps read as sentences** (`AssistantSteps`), not as tool names — this+ * reader wants to follow what is being done to their machine.+ *+ * When a turn ends with a ```jarvis-proposal block, the plan is shown as a+ * checklist (`SetupProposalCard`). ONE Confirm sends the "Execute steps: …"+ * message and remembers the steps; every `approval_required` the runner raises+ * for exactly those steps is answered "allow" here, on the client, so the user+ * clicks once. The ToolExecutor still asks (AP-3) — the panel only answers what+ * was already confirmed; anything else keeps its own inline question.+ *+ * Honest states, never toasts: a 409 from `/run` means the Tool Model (or its+ * Agents-tier fallback) is not usable and the sentence links to API Keys; a 404+ * means the backend predates the assistant.*/-import { AlertTriangle, FlaskConical, Send, Sparkles, Square, X } from "lucide-react";+import { AlertTriangle, FlaskConical, History, Send, Sparkles, Square } from "lucide-react";import { useCallback, useEffect, useMemo, useRef, useState } from "react";-import { AgentTimeline } from "@/components/agentchat/AgentTimeline";-import type { TextBlock, TurnItem } from "@/components/agentchat/reduce";-import { Panel, SoftButton, StatusDot } from "@/components/extensions/primitives";+import type { TextBlock, TimelineItem, TurnItem } from "@/components/agentchat/reduce";+import { SoftButton, StatusDot } from "@/components/extensions/primitives";import { fill, useT } from "@/i18n";import type { ApprovalDecision } from "@/lib/agentChatApi";-import { useEventStore } from "@/store/events";import { cn } from "@/lib/utils";import {@@ -41,6 +48,7 @@ import {type AssistantHealth,type AssistantMode,} from "./assistantApi";+import { AssistantSteps } from "./AssistantSteps";import {matchesConfirmedStep,proposalFromText,@@ -61,27 +69,37 @@ export interface AssistantRequest {/** The steps confirmed per session survive a close/reopen of the panel. */const confirmedBySession = new Map<string, { hash: string; steps: ProposalStep[] }>();+function turnText(turn: TurnItem): string {+ return turn.blocks+ .filter((b): b is TextBlock => b.kind === "text")+ .map((b) => b.text)+ .join("\n");+}+/** The text of the last finished assistant turn — where a proposal lives. */-function lastAssistantText(items: readonly { type: string }[]): { text: string; turnId: string } | null {+function lastAssistantText(items: readonly TimelineItem[]): { text: string; turnId: string } | null {for (let i = items.length - 1; i >= 0; i--) {const item = items[i];if (item.type !== "turn") continue;- const turn = item as TurnItem;// A turn still streaming has no plan yet; the previous finished one keeps// its card instead of the card blinking out for the length of a follow-up.- if (turn.status !== "done") continue;- const text = turn.blocks- .filter((b): b is TextBlock => b.kind === "text")- .map((b) => b.text)- .join("\n");- return { text, turnId: turn.id };+ if (item.status !== "done") continue;+ return { text: turnText(item), turnId: item.id };}return null;}-function isRunning(items: readonly { type: string }[]): boolean {+function isRunning(items: readonly TimelineItem[]): boolean {const last = items[items.length - 1];- return Boolean(last && last.type === "turn" && (last as TurnItem).status === "running");+ return Boolean(last && last.type === "turn" && last.status === "running");+}++/** Where the current run begins: the last user message, or the whole history. */+function defaultRunStart(items: readonly TimelineItem[]): number {+ for (let i = items.length - 1; i >= 0; i--) {+ if (items[i].type === "user") return i;+ }+ return 0;}export function AssistantPanel({@@ -90,7 +108,6 @@ export function AssistantPanel({request,onOpenApiKeys,onOpenServerLog,- onClose,}: {providerId: string;/** What the section calls the local server ("Ollama"). */@@ -98,12 +115,10 @@ export function AssistantPanel({/** The mode the section asked for (Help me set up / Something is not working). */request: AssistantRequest | null;onOpenApiKeys: () => void;- /** The old "Something is not working" path: the Server tab with the log open. */+ /** The Server tab with the log open — one link for the reader who wants it raw. */onOpenServerLog?: () => void;- onClose?: () => void;}) {const t = useT();- const assistantName = useEventStore((s) => s.assistantName);const items = useLocalModelsAssistantStore((s) => s.timeline.items);const pendingApprovals = useLocalModelsAssistantStore((s) => s.timeline.pendingApprovals);const activeSessionId = useLocalModelsAssistantStore((s) => s.activeSessionId);@@ -124,9 +139,17 @@ export function AssistantPanel({const [runError, setRunError] = useState<string | null>(null);const [draft, setDraft] = useState("");const [confirmed, setConfirmed] = useState<{ hash: string; steps: ProposalStep[] } | null>(null);+ /** Index in `items` where the current run starts; null = derive it. */+ const [runStart, setRunStart] = useState<number | null>(null);+ const [showEarlier, setShowEarlier] = useState(false);const answered = useRef<Set<string>>(new Set());+ const scroller = useRef<HTMLDivElement | null>(null);const running = isRunning(items);+ const start = runStart ?? defaultRunStart(items);+ const current = items.slice(Math.min(start, items.length));+ const earlier = items.slice(0, Math.min(start, items.length));+ const shown = showEarlier ? items : current;// The one session per install: open it (and its socket) when the panel mounts.useEffect(() => {@@ -166,11 +189,21 @@ export function AssistantPanel({answered.current = new Set();}, [activeSessionId]);+ // Follow the conversation while it writes, the way a chat does.+ useEffect(() => {+ const el = scroller.current;+ if (el) el.scrollTop = el.scrollHeight;+ }, [items, shown.length]);+const run = useCallback(async (mode: AssistantMode) => {setStarting(mode);setBlocked(null);setRunError(null);+ setShowEarlier(false);+ // Everything already on screen becomes "earlier": a second setup run is+ // a fresh start, not a fifth copy stacked under the fourth.+ setRunStart(useLocalModelsAssistantStore.getState().timeline.items.length);try {const res = await runAssistant(providerId, mode);if (res.session_id !== activeSessionId) openSession(res.session_id);@@ -197,33 +230,13 @@ export function AssistantPanel({if (!running) void loadHealth();}, [running, loadHealth]);- // The chat shows the words, the card shows the plan: the raw JSON block is- // stripped from every finished turn's text before the timeline sees it.- const displayItems = useMemo(- () =>- items.map((item) => {- if (item.type !== "turn") return item;- const turn = item as TurnItem;- if (!turn.blocks.some((b) => b.kind === "text" && /```jarvis-proposal/.test((b as TextBlock).text))) {- return item;- }- return {- ...turn,- blocks: turn.blocks.map((b) =>- b.kind === "text" ? { ...b, text: stripProposalBlocks((b as TextBlock).text) } : b,- ),- };- }),- [items],- );-- // The plan in the last finished turn, if any.+ // The plan in the last finished turn of the current run, if any.const proposal: { value: Proposal; turnId: string } | null = useMemo(() => {- const last = lastAssistantText(items);+ const last = lastAssistantText(current);if (!last) return null;const value = proposalFromText(last.text);return value ? { value, turnId: last.turnId } : null;- }, [items]);+ }, [current]);const onConfirm = useCallback(async (steps: ProposalStep[], message: string) => {@@ -255,8 +268,6 @@ export function AssistantPanel({[decide],);- const providerLabel = useCallback((id: string) => id, []);-const submit = useCallback(async () => {const text = draft.trim();if (!text || !activeSessionId || busy || running) return;@@ -269,45 +280,59 @@ export function AssistantPanel({health?.status === "ok" ? "ok" : health?.status === "unknown" || !health ? "off" : "warn";const needsFix = health?.status === "error" || health?.status === "needs_setup";+ // One line that says what the helper is doing right now.+ const statusLine = running+ ? t("local_models.assistant.status_working")+ : starting+ ? t("local_models.assistant.status_starting")+ : proposal+ ? t("local_models.assistant.status_plan_ready")+ : items.length > 0+ ? t("local_models.assistant.status_idle")+ : t("local_models.assistant.status_empty");++ const busyNow = starting !== null || running;+return (- <Panel className="p-4">- <div className="space-y-4" data-testid="local-models-assistant">- <div className="flex flex-wrap items-center justify-between gap-2">+ <div+ className="flex flex-col gap-3 rounded-xl border border-border bg-card/60"+ data-testid="local-models-assistant"+ >+ {/* Header: what it is, what it is doing, and the three things it can start. */}+ <div className="flex flex-col gap-3 border-b border-border/70 px-4 pt-4 pb-3">+ <div className="flex flex-wrap items-start justify-between gap-3">+ <div className="min-w-0">+ <h3 className="text-[15px] font-semibold leading-tight">+ {t("local_models.assistant.title")}+ </h3>+ <p className="mt-0.5 text-sm text-muted-foreground" data-testid="assistant-status">+ {statusLine}+ </p>+ </div><div className="flex flex-wrap items-center gap-2">- <SoftButton- primary- onClick={() => void run("setup")}- disabled={starting !== null || running}- >+ <SoftButton primary onClick={() => void run("setup")} disabled={busyNow}><Sparkles className="h-3.5 w-3.5" />{t("local_models.assistant.action_setup")}</SoftButton>- <SoftButton onClick={() => void run("test")} disabled={starting !== null || running}>+ <SoftButton onClick={() => void run("test")} disabled={busyNow}><FlaskConical className="h-3.5 w-3.5" />{t("local_models.assistant.action_test")}</SoftButton>- <SoftButton onClick={() => void run("diagnose")} disabled={starting !== null || running}>+ <SoftButton onClick={() => void run("diagnose")} disabled={busyNow}><AlertTriangle className="h-3.5 w-3.5" />{t("local_models.assistant.action_diagnose")}</SoftButton>- </div>- <div className="flex items-center gap-2">{running && (<SoftButton onClick={() => void cancel()} ariaLabel={t("local_models.assistant.cancel")}><Square className="h-3.5 w-3.5" />{t("local_models.assistant.cancel")}</SoftButton>)}- {onClose && (- <SoftButton onClick={onClose} ariaLabel={t("local_models.assistant.close")}>- <X className="h-3.5 w-3.5" />- </SoftButton>- )}</div></div>{health && checkedAt && (- <p className="flex flex-wrap items-center gap-3 text-sm" data-testid="assistant-health">+ <p className="flex flex-wrap items-center gap-3 text-[13px]" data-testid="assistant-health"><StatusDottone={healthTone}label={fill(t("local_models.assistant.last_check"), {@@ -318,7 +343,7 @@ export function AssistantPanel({{needsFix && (<buttontype="button"- className="text-sm font-medium text-primary underline-offset-4 hover:underline"+ className="font-medium text-primary underline-offset-4 hover:underline"onClick={() => void run("diagnose")}data-testid="assistant-health-fix">@@ -327,7 +352,9 @@ export function AssistantPanel({)}</p>)}+ </div>+ <div className="flex flex-col gap-3 px-4 pb-4">{blocked && (<divclassName="flex flex-wrap items-center justify-between gap-3 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm"@@ -351,38 +378,86 @@ export function AssistantPanel({)}{items.length === 0 && !blocked && !backendMissing && (- <p className="text-sm text-muted-foreground">- {starting ? t("local_models.assistant.starting") : t("local_models.assistant.empty")}+ <p className="rounded-lg border border-dashed border-border px-3 py-6 text-center text-sm text-muted-foreground">+ {t("local_models.assistant.empty")}</p>)}{items.length > 0 && (- <div className="flex max-h-[60vh] flex-col gap-5 overflow-y-auto pr-1" data-testid="assistant-timeline">- <AgentTimeline- items={displayItems}- assistantName={assistantName}- providerLabel={providerLabel}- onDecide={onDecide}- />- </div>- )}-- {proposal && (- <SetupProposalCard- key={proposal.turnId}- proposal={proposal.value}- onConfirm={onConfirm}- busy={running || busy}- confirmedHash={confirmed?.hash ?? null}- />- )}+ <div+ ref={scroller}+ className="flex max-h-[46vh] min-h-[8rem] flex-col gap-4 overflow-y-auto pr-1"+ data-testid="assistant-timeline"+ >+ {earlier.length > 0 && (+ <button+ type="button"+ onClick={() => setShowEarlier((v) => !v)}+ className="mx-auto inline-flex items-center gap-1.5 rounded-full border border-border px-3 py-1 text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ data-testid="assistant-earlier"+ >+ <History className="h-3 w-3" />+ {showEarlier+ ? t("local_models.assistant.earlier_hide")+ : fill(t("local_models.assistant.earlier_show"), { n: String(earlier.length) })}+ </button>+ )}- {proposal?.value.brain_switch && !running && (- <BrainSwitchCard- provider={proposal.value.brain_switch.provider}- why={proposal.value.brain_switch.why}- serverLabel={serverLabel}- />+ {shown.map((item) => {+ if (item.type === "user") {+ return (+ <p+ key={item.id}+ className="self-end max-w-[85%] rounded-xl rounded-br-sm bg-primary/10 px-3 py-2 text-[13.5px] text-foreground"+ data-testid="assistant-you"+ >+ {item.text}+ </p>+ );+ }+ if (item.type === "error") {+ return (+ <p key={item.id} className="text-sm text-destructive">+ {item.text}+ </p>+ );+ }+ const answer = stripProposalBlocks(turnText(item));+ return (+ <div key={item.id} className="flex flex-col gap-3">+ <AssistantSteps blocks={item.blocks} onDecide={onDecide} />+ {answer && (+ <div+ className="whitespace-pre-wrap text-[14px] leading-relaxed text-foreground"+ data-testid="assistant-answer"+ >+ {answer}+ </div>+ )}+ {item.status === "error" && item.error && (+ <p className="text-sm text-destructive">{item.error}</p>+ )}+ {proposal?.turnId === item.id && (+ <>+ <SetupProposalCard+ proposal={proposal.value}+ onConfirm={onConfirm}+ busy={running || busy}+ confirmedHash={confirmed?.hash ?? null}+ />+ {proposal.value.brain_switch && !running && (+ <BrainSwitchCard+ provider={proposal.value.brain_switch.provider}+ why={proposal.value.brain_switch.why}+ serverLabel={serverLabel}+ />+ )}+ </>+ )}+ </div>+ );+ })}+ </div>)}<form@@ -401,7 +476,7 @@ export function AssistantPanel({void submit();}}}- rows={2}+ rows={1}disabled={!activeSessionId}placeholder={activeSessionId@@ -430,13 +505,13 @@ export function AssistantPanel({<buttontype="button"onClick={onOpenServerLog}- className="text-xs text-muted-foreground underline-offset-4 hover:text-foreground hover:underline"+ className="self-start text-xs text-muted-foreground underline-offset-4 hover:text-foreground hover:underline"data-testid="assistant-open-server-log">{t("local_models.assistant.open_server_log")}</button>)}</div>- </Panel>+ </div>);}diff --git a/jarvis/ui/web/frontend/src/components/local-models/AssistantSteps.tsx b/jarvis/ui/web/frontend/src/components/local-models/AssistantSteps.tsxnew file mode 100644index 0000000000..bcd2cdc7b9--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/local-models/AssistantSteps.tsx@@ -0,0 +1,250 @@+/**+ * The assistant's work, readable.+ *+ * The shared `AgentTimeline` is built for a coding agent: it shows a tool call+ * as its raw name (`lm_inventory`) and a JSON body, which is the right answer+ * when the reader writes code and the wrong one here — this panel is opened by+ * someone who wants to know what the helper is doing to their machine.+ *+ * So every step gets one plain sentence ("Read the installed models"), a dot+ * that carries its state, and its duration; the raw call and result stay one+ * click away for the reader who does want them. Thinking is one quiet line.+ * A question the runner asks (an approval that is not covered by a confirmed+ * plan) is the one step that can act: it renders its two buttons inline.+ */+import { useState } from "react";+import { Check, ChevronRight, Loader2, X } from "lucide-react";++import type { ReasoningBlock, ToolBlock, TurnBlock } from "@/components/agentchat/reduce";+import { fill, useT } from "@/i18n";+import type { ApprovalDecision } from "@/lib/agentChatApi";+import { cn } from "@/lib/utils";++/** Tool name → i18n key of its sentence. Unknown tools fall back to the name. */+const STEP_KEYS: Record<string, string> = {+ lm_hardware: "hardware",+ lm_server_status: "server_status",+ lm_inventory: "inventory",+ lm_roles: "roles",+ lm_recommendations: "recommendations",+ lm_catalog_search: "catalog_search",+ lm_catalog_tags: "catalog_tags",+ lm_hf_search: "hf_search",+ lm_benchmarks: "benchmarks",+ lm_pull_status: "pull_status",+ lm_server_log: "server_log",+ lm_env_guide: "env_guide",+ lm_suggested_options: "suggested_options",+ lm_test_plan: "test_plan",+ lm_install_ollama: "install_ollama",+ lm_start_server: "start_server",+ lm_stop_server: "stop_server",+ lm_pull: "pull",+ lm_set_role: "set_role",+ lm_set_model_options: "set_options",+ lm_unload: "unload",+ lm_install_voice_server: "install_voice",+ lm_apply_voice_stack: "apply_voice",+ search_web: "search_web",+};++function argOf(input: unknown, key: string): string {+ if (!input || typeof input !== "object") return "";+ const value = (input as Record<string, unknown>)[key];+ return typeof value === "string" ? value : "";+}++/** Seconds with one decimal, so a fast step does not read as "0". */+function seconds(ms: number | null): string {+ if (ms === null) return "";+ return `${(ms / 1000).toFixed(1)}s`;+}++function StepShell({+ tone,+ icon,+ label,+ meta,+ detail,+ children,+}: {+ tone: "run" | "done" | "fail" | "ask";+ icon: React.ReactNode;+ label: string;+ meta?: string;+ detail?: string;+ children?: React.ReactNode;+}) {+ const t = useT();+ const [open, setOpen] = useState(false);+ const hasDetail = Boolean(detail && detail.trim());+ return (+ <li className="relative pl-6" data-testid="assistant-step" data-tone={tone}>+ {/* The rail: one continuous line through every step of a turn. */}+ <span+ aria-hidden="true"+ className="absolute left-[7px] top-5 bottom-[-6px] w-px bg-border last:hidden"+ />+ <span+ aria-hidden="true"+ className={cn(+ "absolute left-0 top-[3px] flex h-3.5 w-3.5 items-center justify-center rounded-full",+ tone === "done" && "text-emerald-600 dark:text-emerald-400",+ tone === "run" && "text-primary",+ tone === "fail" && "text-destructive",+ tone === "ask" && "text-amber-600 dark:text-amber-400",+ )}+ >+ {icon}+ </span>+ <div className="flex flex-wrap items-baseline gap-x-2 gap-y-0.5">+ <span className={cn("text-[13.5px]", tone === "fail" ? "text-destructive" : "text-foreground")}>+ {label}+ </span>+ {meta && <span className="font-mono text-[11px] tabular-nums text-muted-foreground">{meta}</span>}+ {hasDetail && (+ <button+ type="button"+ onClick={() => setOpen((v) => !v)}+ className="inline-flex items-center gap-0.5 rounded text-[11px] text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ >+ <ChevronRight className={cn("h-3 w-3 transition-transform", open && "rotate-90")} />+ {open ? t("local_models.assistant.steps.hide") : t("local_models.assistant.steps.show")}+ </button>+ )}+ </div>+ {open && hasDetail && (+ <pre className="mt-1.5 max-h-48 overflow-auto rounded-md border border-border bg-muted/40 p-2 font-mono text-[11px] leading-relaxed text-muted-foreground">+ {detail}+ </pre>+ )}+ {children}+ </li>+ );+}++function ToolStep({+ block,+ onDecide,+}: {+ block: ToolBlock;+ onDecide?: (approvalId: string, decision: ApprovalDecision) => void;+}) {+ const t = useT();+ const key = STEP_KEYS[block.name];+ const label = key+ ? fill(t(`local_models.assistant.steps.${key}`), {+ model: argOf(block.input, "model") || argOf(block.input, "name"),+ role: argOf(block.input, "role"),+ query: argOf(block.input, "q") || argOf(block.input, "query"),+ }).replace(/\s{2,}/g, " ").trim()+ : block.name;++ const waiting = Boolean(block.approval && !block.approval.decision);+ const tone: "run" | "done" | "fail" | "ask" = waiting+ ? "ask"+ : block.isError+ ? "fail"+ : block.output === null+ ? "run"+ : "done";+ const icon =+ tone === "run" ? (+ <Loader2 className="h-3 w-3 animate-spin" />+ ) : tone === "fail" ? (+ <X className="h-3 w-3" />+ ) : tone === "ask" ? (+ <span className="h-2 w-2 rounded-full bg-current" />+ ) : (+ <Check className="h-3 w-3" />+ );++ const detail = [+ block.input && Object.keys(block.input as object).length+ ? JSON.stringify(block.input, null, 1)+ : "",+ block.output ?? "",+ ]+ .filter(Boolean)+ .join("\n\n");++ return (+ <StepShell+ tone={tone}+ icon={icon}+ label={label}+ meta={seconds(block.durationMs)}+ detail={detail}+ >+ {waiting && block.approval && onDecide && (+ <div className="mt-2 flex flex-wrap items-center gap-2 rounded-md border border-amber-500/40 bg-amber-500/5 p-2">+ <span className="text-[13px] text-foreground">{block.approval.summary}</span>+ <div className="ml-auto flex gap-1.5">+ <button+ type="button"+ onClick={() => onDecide(block.approval!.approvalId, "allow")}+ className="rounded-md bg-primary px-2.5 py-1 text-[12px] font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ >+ {t("local_models.assistant.steps.allow")}+ </button>+ <button+ type="button"+ onClick={() => onDecide(block.approval!.approvalId, "deny")}+ className="rounded-md border border-border px-2.5 py-1 text-[12px] hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ >+ {t("local_models.assistant.steps.deny")}+ </button>+ </div>+ </div>+ )}+ </StepShell>+ );+}++function ThinkingStep({ block }: { block: ReasoningBlock }) {+ const t = useT();+ const label = block.live+ ? t("local_models.assistant.steps.thinking_live")+ : fill(t("local_models.assistant.steps.thinking"), { s: seconds(block.durationMs) || "—" });+ return (+ <StepShell+ tone={block.live ? "run" : "done"}+ icon={+ block.live ? (+ <Loader2 className="h-3 w-3 animate-spin" />+ ) : (+ <span className="h-1.5 w-1.5 rounded-full bg-current" />+ )+ }+ label={label}+ detail={block.text}+ />+ );+}++/**+ * The steps of one turn. Text blocks are NOT rendered here — the answer is the+ * panel's own paragraph, so the steps stay a list of work and the words stay+ * prose.+ */+export function AssistantSteps({+ blocks,+ onDecide,+}: {+ blocks: readonly TurnBlock[];+ onDecide?: (approvalId: string, decision: ApprovalDecision) => void;+}) {+ const steps = blocks.filter((b) => b.kind !== "text");+ if (steps.length === 0) return null;+ return (+ <ul className="flex flex-col gap-2.5" data-testid="assistant-steps">+ {steps.map((block) =>+ block.kind === "tool" ? (+ <ToolStep key={block.callId} block={block} onDecide={onDecide} />+ ) : (+ <ThinkingStep key={block.id} block={block as ReasoningBlock} />+ ),+ )}+ </ul>+ );+}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/local_models/de.json b/jarvis/ui/web/frontend/src/i18n/locales/local_models/de.jsonindex 6b9504a0a7..b84fc13df7 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/local_models/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/local_models/de.json@@ -397,7 +397,7 @@"open_api_keys": "API-Schlüssel öffnen","backend_missing": "Das laufende Backend kennt den Einrichtungsassistenten noch nicht — starte die App neu, um das Update zu übernehmen.","starting": "Startet…",- "empty": "Wähle oben eine Aktion oder stelle unten eine Frage.",+ "empty": "Fang mit „Hilf mir einzurichten“ an oder stell unten eine Frage.","composer_placeholder": "Frag den Assistenten…","composer_locked": "Beginne mit einer der Aktionen oben.","send": "Senden",@@ -412,7 +412,48 @@"badge_stale": "veraltet","brain_switch_title": "{server} zum aktiven Gehirn machen","brain_switch_action": "Jetzt umschalten",- "brain_switch_done": "{server} antwortet ab jetzt"- }+ "brain_switch_done": "{server} antwortet ab jetzt",+ "title": "Einrichtungshilfe",+ "status_empty": "Bereit. Wähle, was sie tun soll.",+ "status_starting": "Startet…",+ "status_working": "Arbeitet — jeder Schritt steht unten.",+ "status_plan_ready": "Der Plan steht. Sieh ihn dir an und bestätige.",+ "status_idle": "Fertig. Stell eine Frage oder starte einen neuen Lauf.",+ "earlier_show": "{n} frühere Nachrichten zeigen",+ "earlier_hide": "Frühere Nachrichten ausblenden",+ "steps": {+ "show": "Details",+ "hide": "ausblenden",+ "allow": "Erlauben",+ "deny": "Überspringen",+ "thinking": "Hat nachgedacht · {s}",+ "thinking_live": "Denkt nach…",+ "hardware": "Hat deine Hardware angesehen",+ "server_status": "Hat den lokalen Server geprüft",+ "inventory": "Hat die installierten Modelle gelesen",+ "roles": "Hat gelesen, welches Modell welche Aufgabe hat",+ "recommendations": "Hat die Empfehlungen auf diesen Rechner abgestimmt",+ "catalog_search": "Hat den Katalog nach {query} durchsucht",+ "catalog_tags": "Hat die Versionen von {model} aufgelistet",+ "hf_search": "Hat Hugging Face nach {query} durchsucht",+ "benchmarks": "Hat nachgesehen, wie gut diese Modelle abschneiden",+ "pull_status": "Hat den Download von {model} geprüft",+ "server_log": "Hat das Server-Protokoll gelesen",+ "env_guide": "Hat die Umgebungsanleitung gelesen",+ "suggested_options": "Hat die Einstellungen für {model} berechnet",+ "test_plan": "Hat jede Rolle komplett getestet",+ "install_ollama": "Hat den lokalen Server installiert",+ "start_server": "Hat den lokalen Server gestartet",+ "stop_server": "Hat den lokalen Server gestoppt",+ "pull": "Hat {model} heruntergeladen",+ "set_role": "Hat {model} für {role} gesetzt",+ "set_options": "Hat die Einstellungen für {model} gespeichert",+ "unload": "Hat {model} aus dem Speicher entladen",+ "install_voice": "Hat den Sprachserver installiert",+ "apply_voice": "Hat den Sprach-Stack eingerichtet und getestet",+ "search_web": "Hat im Web nach {query} gesucht"+ }+ },+ "tab_assistant": "Einrichtungshilfe"}}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/local_models/en.json b/jarvis/ui/web/frontend/src/i18n/locales/local_models/en.jsonindex c9d315ccc5..8fb2ba2e95 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/local_models/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/local_models/en.json@@ -397,7 +397,7 @@"open_api_keys": "Open API Keys","backend_missing": "The running backend does not know the setup assistant yet — restart the app to pick up the update.","starting": "Starting…",- "empty": "Pick one of the buttons above, or ask a question below.",+ "empty": "Start with “Help me set up”, or ask a question below.","composer_placeholder": "Ask the assistant…","composer_locked": "Start with one of the buttons above.","send": "Send",@@ -412,7 +412,48 @@"badge_stale": "stale","brain_switch_title": "Make {server} the active brain","brain_switch_action": "Switch now",- "brain_switch_done": "{server} answers from now on"- }+ "brain_switch_done": "{server} answers from now on",+ "title": "Setup helper",+ "status_empty": "Ready. Pick what you want it to do.",+ "status_starting": "Starting…",+ "status_working": "Working — every step it takes is listed below.",+ "status_plan_ready": "The plan is ready. Look it over, then confirm.",+ "status_idle": "Done for now. Ask a question or start another run.",+ "earlier_show": "Show {n} earlier messages",+ "earlier_hide": "Hide earlier messages",+ "steps": {+ "show": "details",+ "hide": "hide",+ "allow": "Allow",+ "deny": "Skip",+ "thinking": "Thought it through · {s}",+ "thinking_live": "Thinking…",+ "hardware": "Looked at your hardware",+ "server_status": "Checked the local server",+ "inventory": "Read the installed models",+ "roles": "Read which model does which job",+ "recommendations": "Matched the shortlist to this machine",+ "catalog_search": "Searched the catalogue for {query}",+ "catalog_tags": "Listed the versions of {model}",+ "hf_search": "Searched Hugging Face for {query}",+ "benchmarks": "Looked up how these models score",+ "pull_status": "Checked the download of {model}",+ "server_log": "Read the server log",+ "env_guide": "Read the environment guide",+ "suggested_options": "Worked out the settings for {model}",+ "test_plan": "Tested every role end to end",+ "install_ollama": "Installed the local server",+ "start_server": "Started the local server",+ "stop_server": "Stopped the local server",+ "pull": "Downloaded {model}",+ "set_role": "Set {model} for {role}",+ "set_options": "Saved the settings for {model}",+ "unload": "Unloaded {model} from memory",+ "install_voice": "Installed the voice server",+ "apply_voice": "Set up and tested the voice stack",+ "search_web": "Searched the web for {query}"+ }+ },+ "tab_assistant": "Setup helper"}}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/local_models/es.json b/jarvis/ui/web/frontend/src/i18n/locales/local_models/es.jsonindex 6a9195e37c..ee28a63f7e 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/local_models/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/local_models/es.json@@ -397,7 +397,7 @@"open_api_keys": "Abrir claves API","backend_missing": "El backend en ejecución aún no conoce el asistente de configuración: reinicia la app para aplicar la actualización.","starting": "Iniciando…",- "empty": "Elige una de las acciones de arriba o haz una pregunta abajo.",+ "empty": "Empieza con «Ayúdame a configurar» o pregunta abajo.","composer_placeholder": "Pregunta al asistente…","composer_locked": "Empieza con una de las acciones de arriba.","send": "Enviar",@@ -412,7 +412,48 @@"badge_stale": "desactualizado","brain_switch_title": "Hacer de {server} el cerebro activo","brain_switch_action": "Cambiar ahora",- "brain_switch_done": "{server} responde a partir de ahora"- }+ "brain_switch_done": "{server} responde a partir de ahora",+ "title": "Asistente de configuración",+ "status_empty": "Listo. Elige qué debe hacer.",+ "status_starting": "Iniciando…",+ "status_working": "Trabajando: cada paso aparece abajo.",+ "status_plan_ready": "El plan está listo. Revísalo y confirma.",+ "status_idle": "Terminado. Haz una pregunta o inicia otra ejecución.",+ "earlier_show": "Mostrar {n} mensajes anteriores",+ "earlier_hide": "Ocultar mensajes anteriores",+ "steps": {+ "show": "detalles",+ "hide": "ocultar",+ "allow": "Permitir",+ "deny": "Omitir",+ "thinking": "Lo pensó · {s}",+ "thinking_live": "Pensando…",+ "hardware": "Revisó tu hardware",+ "server_status": "Comprobó el servidor local",+ "inventory": "Leyó los modelos instalados",+ "roles": "Leyó qué modelo hace cada tarea",+ "recommendations": "Ajustó las recomendaciones a esta máquina",+ "catalog_search": "Buscó {query} en el catálogo",+ "catalog_tags": "Listó las versiones de {model}",+ "hf_search": "Buscó {query} en Hugging Face",+ "benchmarks": "Consultó qué puntuación tienen estos modelos",+ "pull_status": "Comprobó la descarga de {model}",+ "server_log": "Leyó el registro del servidor",+ "env_guide": "Leyó la guía de entorno",+ "suggested_options": "Calculó los ajustes para {model}",+ "test_plan": "Probó cada función de principio a fin",+ "install_ollama": "Instaló el servidor local",+ "start_server": "Inició el servidor local",+ "stop_server": "Detuvo el servidor local",+ "pull": "Descargó {model}",+ "set_role": "Asignó {model} a {role}",+ "set_options": "Guardó los ajustes de {model}",+ "unload": "Descargó {model} de la memoria",+ "install_voice": "Instaló el servidor de voz",+ "apply_voice": "Configuró y probó la pila de voz",+ "search_web": "Buscó {query} en la web"+ }+ },+ "tab_assistant": "Asistente de configuración"}}diff --git a/jarvis/ui/web/frontend/src/views/LocalModelsView.test.tsx b/jarvis/ui/web/frontend/src/views/LocalModelsView.test.tsxindex 63e89c0a6e..c9292fc6be 100644--- a/jarvis/ui/web/frontend/src/views/LocalModelsView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/LocalModelsView.test.tsx@@ -104,11 +104,9 @@ vi.mock("@/components/local-models/AssistantPanel", () => ({AssistantPanel: ({request,onOpenServerLog,- onClose,}: {request: { mode: string; token: number } | null;onOpenServerLog?: () => void;- onClose?: () => void;}) => (<divdata-testid="local-models-assistant"@@ -118,9 +116,6 @@ vi.mock("@/components/local-models/AssistantPanel", () => ({<button type="button" onClick={onOpenServerLog}>server log</button>- <button type="button" onClick={onClose}>- close assistant- </button></div>),}));@@ -282,23 +277,25 @@ describe("LocalModelsView", () => {expect(screen.getByText("local_models.no_provider")).toBeDefined();});- it("wires the overview actions: browse, the assistant in setup mode, diagnose mode, server log", () => {+ it("the helper is an area of its own, and the rail stays reachable from it", () => {render(<LocalModelsView />);- // "Help me set up" opens the assistant and asks for a setup run; a- // second click closes it again.+ // "Help me set up" switches to the helper's area with a setup run.fireEvent.click(screen.getByRole("button", { name: "assistant" }));const panel = screen.getByTestId("local-models-assistant");expect(panel.getAttribute("data-mode")).toBe("setup");expect(panel.getAttribute("data-token")).toBe("1");- fireEvent.click(screen.getByRole("button", { name: "assistant" }));- expect(screen.queryByTestId("local-models-assistant")).toBeNull();+ // The overview is no longer underneath it — this is a separate screen.+ expect(screen.queryByTestId("overview-panel")).toBeNull();- fireEvent.click(screen.getByRole("button", { name: "browse" }));+ // The user's complaint: from the helper, the catalogue is ONE click away.+ fireEvent.click(+ screen.getByRole("tab", { name: "local_models.tab_catalogue" }),+ );expect(screen.getByTestId("catalogue-panel")).toBeDefined();+ expect(screen.queryByTestId("local-models-assistant")).toBeNull();- // "Something is not working" opens the assistant in diagnose mode and- // stays on the overview; the server log is one link away inside it.+ // "Something is not working" opens the same area in diagnose mode.fireEvent.click(screen.getByRole("tab", { name: "local_models.tab_overview" }),);@@ -314,10 +311,4 @@ describe("LocalModelsView", () => {).toBe("yes");});- it("closes the assistant from its own close button", () => {- render(<LocalModelsView />);- fireEvent.click(screen.getByRole("button", { name: "assistant" }));- fireEvent.click(screen.getByRole("button", { name: "close assistant" }));- expect(screen.queryByTestId("local-models-assistant")).toBeNull();- });});diff --git a/jarvis/ui/web/frontend/src/views/LocalModelsView.tsx b/jarvis/ui/web/frontend/src/views/LocalModelsView.tsxindex 29c189a23e..ee01423443 100644--- a/jarvis/ui/web/frontend/src/views/LocalModelsView.tsx+++ b/jarvis/ui/web/frontend/src/views/LocalModelsView.tsx@@ -50,7 +50,7 @@ import { useLocaleChunk, useT } from "@/i18n";export type LocalModelsMode = "simple" | "advanced";export type LocalModelsTab =- "overview" | "models" | "catalogue" | "huggingface" | "server";+ "overview" | "assistant" | "models" | "catalogue" | "huggingface" | "server";/** Browser-local preference; a private window simply starts on Simple. */export const LOCAL_MODELS_MODE_KEY = "jarvis.localModels.mode";@@ -150,22 +150,19 @@ export function LocalModelsView() {// it and asks for a setup run; "Something is not working" opens it in// diagnose mode (the Server tab with the log stays one link away inside// the panel). The token makes a repeated click a repeated request.- const [assistantOpen, setAssistantOpen] = useState(false);const [assistantRequest, setAssistantRequest] =useState<AssistantRequest | null>(null);const [serverLogOpen, setServerLogOpen] = useState(false);const openBrowse = useCallback(() => setTab("catalogue"), []);+ // The helper is an area of its own, not a block that pushes the overview+ // down: the rail stays on screen, so "Browse models" is always one click+ // away and the page never grows to a scroll of thousands of pixels.const openAssistant = useCallback(() => {- setAssistantOpen((open) => {- if (!open) {- setAssistantRequest((r) => ({ mode: "setup", token: (r?.token ?? 0) + 1 }));- }- return !open;- });+ setTab("assistant");+ setAssistantRequest((r) => ({ mode: "setup", token: (r?.token ?? 0) + 1 }));}, []);- const closeAssistant = useCallback(() => setAssistantOpen(false), []);const reportProblem = useCallback(() => {- setAssistantOpen(true);+ setTab("assistant");setAssistantRequest((r) => ({ mode: "diagnose", token: (r?.token ?? 0) + 1 }));}, []);const openServerLog = useCallback(() => {@@ -192,6 +189,7 @@ export function LocalModelsView() {const tabs = useMemo(() => {const all: { id: LocalModelsTab; label: string }[] = [{ id: "overview", label: t("local_models.tab_overview") },+ { id: "assistant", label: t("local_models.tab_assistant") },{ id: "models", label: t("local_models.tab_models") },{ id: "catalogue", label: t("local_models.tab_catalogue") },{ id: "huggingface", label: t("local_models.tab_huggingface") },@@ -212,7 +210,22 @@ export function LocalModelsView() {<PanelHeadertitle={t("local_models.title")}subtitle={t("local_models.subtitle")}- actions={+ />++ {/* The rail and the detail level belong together: the switch adds two+ areas to this very row (and detail to the rows below), so it sits+ beside what it changes instead of alone in the header. */}+ <div className="flex flex-wrap items-center justify-between gap-3">+ <SegmentedFilter<LocalModelsTab>+ label={t("local_models.tabs_label")}+ value={tab}+ onChange={setTab}+ options={tabs}+ />+ <div className="flex items-center gap-2">+ <span className="text-[11px] uppercase tracking-[0.14em] text-muted-foreground">+ {t("local_models.mode_label")}+ </span><SegmentedFilter<LocalModelsMode>label={t("local_models.mode_label")}value={mode}@@ -222,15 +235,8 @@ export function LocalModelsView() {{ id: "advanced", label: t("local_models.mode_advanced") },]}/>- }- />-- <SegmentedFilter<LocalModelsTab>- label={t("local_models.tabs_label")}- value={tab}- onChange={setTab}- options={tabs}- />+ </div>+ </div>{loading && !providerId && (<p className="text-sm text-muted-foreground">@@ -255,18 +261,7 @@ export function LocalModelsView() {onBrowse={openBrowse}onOpenAssistant={openAssistant}onReportProblem={reportProblem}- assistantSlot={- assistantOpen ? (- <AssistantPanel- providerId={providerId}- serverLabel={descriptor?.label ?? "Ollama"}- request={assistantRequest}- onOpenApiKeys={openApiKeys}- onOpenServerLog={openServerLog}- onClose={closeAssistant}- />- ) : null- }+ advanced={mode === "advanced"}/>{tuneModel && (<RoleTuneDrawer@@ -278,6 +273,18 @@ export function LocalModelsView() {</div>)}+ {providerId && tab === "assistant" && (+ <div data-testid="local-models-assistant-tab">+ <AssistantPanel+ providerId={providerId}+ serverLabel={descriptor?.label ?? "Ollama"}+ request={assistantRequest}+ onOpenApiKeys={openApiKeys}+ onOpenServerLog={openServerLog}+ />+ </div>+ )}+{providerId && tab === "models" && (<div data-testid="local-models-models"><InventoryPanel providerId={providerId} />diff --git a/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.test.tsx b/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.test.tsxindex a9f5fc89f9..6784d94802 100644--- a/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.test.tsx+++ b/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.test.tsx@@ -412,7 +412,6 @@ describe("OverviewPanel", () => {onBrowse,onOpenAssistant,onReportProblem,- assistantSlot: <div data-testid="assistant-slot" />,});await screen.findByTestId("overview-actions");@@ -428,7 +427,19 @@ describe("OverviewPanel", () => {expect(onBrowse).toHaveBeenCalledTimes(1);expect(onOpenAssistant).toHaveBeenCalledTimes(1);expect(onReportProblem).toHaveBeenCalledTimes(1);- expect(screen.getByTestId("assistant-slot")).toBeDefined();+ });++ it("the detail level changes the roles on this very screen", async () => {+ installFetchMock();+ const { unmount } = renderPanel();+ const simple = await screen.findByTestId("local-models-roles");+ expect(simple.getAttribute("data-variant")).toBe("checklist");+ unmount();++ installFetchMock();+ renderPanel({ advanced: true });+ const advanced = await screen.findByTestId("local-models-roles");+ expect(advanced.getAttribute("data-variant")).not.toBe("checklist");});it("hides the action row when no handler is wired", async () => {diff --git a/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.tsx b/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.tsxindex dd610fe847..d8d6b3e138 100644--- a/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.tsx+++ b/jarvis/ui/web/frontend/src/views/local-models/OverviewPanel.tsx@@ -9,9 +9,9 @@* now), and the roles as a checklist. Nothing here writes; the roles part is* `RolesPanel`, mounted underneath so the integration wires one component.*- * The setup assistant plugs in through `assistantSlot` + `onOpenAssistant`:- * the caller owns the open state and the panel it renders, so the assistant- * can land without touching this file again.+ * The setup assistant is NOT rendered here: "Help me set up" and "Something is+ * not working" switch the section to the helper's own area, so the overview+ * never becomes a page thousands of pixels tall with the roles at the bottom.** Props take `providerId` — the id of the card that declares* `supports_model_pull` — never a provider name.@@ -46,12 +46,16 @@ import { RolesPanel, type RolesPanelProps } from "./RolesPanel";export interface OverviewPanelProps extends RolesPanelProps {/** Opens the catalogue ("Browse models"); the button hides without it. */onBrowse?: () => void;- /** Opens the setup assistant; the caller renders it into `assistantSlot`. */+ /** Opens the setup assistant — its own area, not a block inside this one. */onOpenAssistant?: () => void;- /** Rendered right under the action row while the assistant is open. */- assistantSlot?: ReactNode;- /** "Something is not working" — the Server tab with the log open. */+ /** "Something is not working" — opens the assistant in diagnose mode. */onReportProblem?: () => void;+ /**+ * Detail level. The switch beside the rail must change what is on screen+ * HERE too, or it reads as a dead control: Simple keeps the roles a+ * checklist, Advanced opens every row to its picker, capabilities and Tune.+ */+ advanced?: boolean;}/** Bytes to a short gigabyte figure ("12.4 GB"); "0 GB" below a megabyte. */@@ -68,8 +72,8 @@ export function OverviewPanel({onOpenApiKeys,onBrowse,onOpenAssistant,- assistantSlot,onReportProblem,+ advanced = false,}: OverviewPanelProps) {const t = useT();const overview = useOverview(providerId);@@ -290,8 +294,6 @@ export function OverviewPanel({</div>)}- {assistantSlot}-<div className="grid grid-cols-1 gap-3 sm:grid-cols-3"><StatTileicon={<HardDrive className="h-3.5 w-3.5" />}@@ -323,7 +325,7 @@ export function OverviewPanel({providerId={providerId}onTune={onTune}onOpenApiKeys={onOpenApiKeys}- variant="checklist"+ variant={advanced ? "ledger" : "checklist"}/></div>);diff --git a/jarvis/ui/web/frontend/src/views/local-models/RolesPanel.tsx b/jarvis/ui/web/frontend/src/views/local-models/RolesPanel.tsxindex d5ca95038d..c3cf9d3481 100644--- a/jarvis/ui/web/frontend/src/views/local-models/RolesPanel.tsx+++ b/jarvis/ui/web/frontend/src/views/local-models/RolesPanel.tsx@@ -315,7 +315,7 @@ export function RolesPanel({return (<Panel className="p-4">- <div className="space-y-3" data-testid="local-models-roles">+ <div className="space-y-3" data-testid="local-models-roles" data-variant={variant}><PanelHeadertitle={t("local_models.roles.title")}subtitle={t("local_models.roles.subtitle")}