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(agentic-ide): voice orb panel + full-size chat stage
Ruben Lütkee930dc29b946
diff --git a/jarvis/speech/pipeline.py b/jarvis/speech/pipeline.pyindex 97045eecea..66575fe7af 100644--- a/jarvis/speech/pipeline.py+++ b/jarvis/speech/pipeline.py@@ -5865,6 +5865,22 @@ class SpeechPipeline:self._explicit_call_pending = Truereturn self._arm_call_event()+ def request_voice_hangup(self) -> bool:+ """Hang up the voice channel from outside the audio path.++ The voice orb's click and ``jarvis api voice hangup`` land here — the+ same absolute-kill contract as the hangup hotkey (2026-05-20: no matter+ what is playing or queued, the voice channel goes silent now). Safe to+ call while idle; answers ``False`` instead of raising so a UI click can+ report honestly rather than 500.+ """+ try:+ self._trigger_voice_hangup()+ return True+ except Exception: # noqa: BLE001 — a failed hangup must report, never raise+ log.warning("request_voice_hangup failed", exc_info=True)+ return False+def _arm_call_event(self) -> bool:"""Set the call edge on its owning asyncio loop.diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsxindex 2ecaadd697..3880914366 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -103,8 +103,10 @@ import {moveTerminal,clearTerminalRecap,fetchTerminalRecaps,+ fetchTerminalUiPreferences,refreshTerminalRecap,renameTerminal,+ saveTerminalFontSize,setTerminalRecap,promptTerminal,type ComposedPreview,diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsxnew file mode 100644index 0000000000..5e32f97c4d--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx@@ -0,0 +1,228 @@+/**+ * The voice orb — the assistant's presence as a living sphere.+ *+ * Modeled on the familiar voice-mode orbs (a soft sphere of drifting cloud+ * textures that breathes, vibrates and swells with the conversation), but in+ * this app's own brand: signal-yellow light on the dark surface, never a+ * borrowed palette.+ *+ * ## How the life-likeness is made+ *+ * The orb is a circular clip filled with a handful of soft radial-gradient+ * "clouds", each drifting on its own slow Lissajous path. Three motions layer+ * on top, all driven by the voice state:+ *+ * * **Breathing** — the whole sphere scales on a slow sine. Idle breathes+ * slowly and shallowly; speaking breathes fast and deep, with a second+ * out-of-phase wobble so it reads as talking rather than pulsing.+ * * **Vibration** — a small high-frequency jitter on each cloud's radius.+ * Barely visible while idle, distinct while listening and speaking — this is+ * the "vibrating sphere" texture of the original.+ * * **Swirl** — the cloud constellation rotates while thinking, the classic+ * "working on it" cue.+ *+ * State changes never snap: every parameter eases toward its target a little+ * each frame, so the orb flows from listening into speaking the way the real+ * ones do.+ *+ * Honest about cost: one 2D canvas, no filters (the gradients are soft by+ * construction), the animation pauses whenever the document is hidden, and a+ * `prefers-reduced-motion` viewer gets a still sphere.+ */+import { useEffect, useRef } from "react";+import { cn } from "@/lib/utils";+import { useDocumentVisible } from "@/hooks/useDocumentVisible";+import type { VoiceState } from "@/store/events";++/** The motion parameters one voice state asks for. */+interface Motion {+ /** How far the clouds roam, as a fraction of the radius. */+ drift: number;+ /** Cloud drift speed multiplier. */+ speed: number;+ /** Whole-sphere breathing depth (fraction of scale). */+ breathAmp: number;+ /** Breathing rate, Hz. */+ breathHz: number;+ /** High-frequency cloud jitter depth — the vibration. */+ jitter: number;+ /** Constellation rotation, radians per second. */+ swirl: number;+ /** 0..1 — how much of the bright palette shows (error dims to grey). */+ vivid: number;+}++const MOTIONS: Record<VoiceState, Motion> = {+ idle: { drift: 0.16, speed: 0.5, breathAmp: 0.015, breathHz: 0.22, jitter: 0.004, swirl: 0.05, vivid: 0.8 },+ listening: { drift: 0.3, speed: 1.1, breathAmp: 0.045, breathHz: 1.0, jitter: 0.014, swirl: 0.12, vivid: 1 },+ thinking: { drift: 0.24, speed: 0.9, breathAmp: 0.02, breathHz: 0.5, jitter: 0.006, swirl: 0.9, vivid: 0.9 },+ speaking: { drift: 0.34, speed: 1.4, breathAmp: 0.07, breathHz: 2.1, jitter: 0.02, swirl: 0.18, vivid: 1 },+ error: { drift: 0.08, speed: 0.25, breathAmp: 0.008, breathHz: 0.15, jitter: 0, swirl: 0, vivid: 0 },+};++/** Brand-gold cloud palette, light to deep — the sphere's inner weather. */+const CLOUDS = [+ "255, 247, 214", // warm white+ "255, 232, 138", // pale gold+ "255, 214, 10", // signal yellow (the brand primary)+ "255, 179, 0", // amber+ "245, 158, 11", // deep amber+ "255, 241, 176", // cream highlight+];++/** Grey twins of the palette, cross-faded in for the error state. */+const GREYS = ["221, 221, 221", "187, 187, 187", "153, 153, 153", "119, 119, 119", "102, 102, 102", "204, 204, 204"];++/** Fixed per-cloud motion seeds — the same weather on every mount. */+const SEEDS = [0.9, 2.1, 3.7, 4.6, 5.9, 0.3];++function mix(a: number, b: number, k: number): number {+ return a + (b - a) * k;+}++/** "r, g, b" cross-faded between the grey and vivid palettes. */+function cloudColor(index: number, vivid: number): string {+ const c = CLOUDS[index % CLOUDS.length].split(",").map(Number);+ const g = GREYS[index % GREYS.length].split(",").map(Number);+ return c.map((v, i) => Math.round(mix(g[i], v, vivid))).join(", ");+}++export function VoiceOrb({+ state,+ size = 176,+ className,+}: {+ state: VoiceState;+ size?: number;+ className?: string;+}) {+ const canvasRef = useRef<HTMLCanvasElement | null>(null);+ // Read by the draw loop without restarting it — a state flip mid-frame just+ // gives the easing a new target.+ const stateRef = useRef<VoiceState>(state);+ useEffect(() => {+ stateRef.current = state;+ }, [state]);++ // Nobody watches a hidden window; the sphere holds its breath until they do.+ const visible = useDocumentVisible();++ useEffect(() => {+ const canvas = canvasRef.current;+ if (!canvas || !visible) return;+ const ctx = canvas.getContext("2d");+ if (!ctx) return; // jsdom / a WebView without canvas — the orb stays a disc++ const dpr = Math.max(1, window.devicePixelRatio || 1);+ canvas.width = Math.round(size * dpr);+ canvas.height = Math.round(size * dpr);+ const half = (size * dpr) / 2;++ // The live parameters, eased toward the current state's targets each frame.+ const live: Motion = { ...MOTIONS[stateRef.current] };+ let angle = 0;+ let last = performance.now();++ const drawFrame = (now: number) => {+ const t = now / 1000;+ const dt = Math.min(0.1, (now - last) / 1000);+ last = now;++ const target = MOTIONS[stateRef.current] ?? MOTIONS.idle;+ for (const key of Object.keys(live) as (keyof Motion)[]) {+ live[key] = mix(live[key], target[key], 0.055);+ }+ angle += live.swirl * dt;++ // Breathing, with the second wobble that makes "speaking" read as speech.+ const breath =+ 1 ++ live.breathAmp * Math.sin(2 * Math.PI * live.breathHz * t) ++ 0.35 * live.breathAmp * Math.sin(2 * Math.PI * live.breathHz * 2.7 * t + 1.3);+ const radius = (half - 2 * dpr) * breath;++ ctx.clearRect(0, 0, canvas.width, canvas.height);+ ctx.save();+ ctx.beginPath();+ ctx.arc(half, half, radius, 0, Math.PI * 2);+ ctx.clip();++ // The sphere's body: a dark-amber ground the clouds glow out of.+ const body = ctx.createRadialGradient(+ half - radius * 0.3,+ half - radius * 0.35,+ radius * 0.1,+ half,+ half,+ radius,+ );+ body.addColorStop(0, `rgba(${cloudColor(1, live.vivid)}, 0.9)`);+ body.addColorStop(0.55, `rgba(${cloudColor(3, live.vivid)}, 0.85)`);+ body.addColorStop(1, `rgba(${cloudColor(4, live.vivid)}, 0.95)`);+ ctx.fillStyle = body;+ ctx.fillRect(0, 0, canvas.width, canvas.height);++ // The inner weather: soft clouds on slow individual orbits.+ ctx.globalCompositeOperation = "lighter";+ SEEDS.forEach((seed, i) => {+ const wobble = live.jitter * Math.sin(2 * Math.PI * 13 * t + seed * 7);+ const reach = radius * live.drift;+ const cx =+ half ++ reach * Math.sin(t * live.speed * (0.7 + seed * 0.13) + seed + angle) ++ reach * 0.4 * Math.sin(t * live.speed * 1.7 + seed * 2);+ const cy =+ half ++ reach * Math.cos(t * live.speed * (0.5 + seed * 0.17) + seed * 3 + angle) ++ reach * 0.4 * Math.cos(t * live.speed * 1.3 + seed);+ const r =+ radius * (0.42 + 0.22 * Math.sin(t * live.speed * 0.9 + seed * 5) + wobble);+ if (r <= 0) return;+ const cloud = ctx.createRadialGradient(cx, cy, 0, cx, cy, r);+ cloud.addColorStop(0, `rgba(${cloudColor(i, live.vivid)}, 0.5)`);+ cloud.addColorStop(1, `rgba(${cloudColor(i, live.vivid)}, 0)`);+ ctx.fillStyle = cloud;+ ctx.fillRect(0, 0, canvas.width, canvas.height);+ });+ ctx.globalCompositeOperation = "source-over";++ // A soft top-light, so it reads as a sphere rather than a disc.+ const sheen = ctx.createRadialGradient(+ half - radius * 0.35,+ half - radius * 0.45,+ 0,+ half - radius * 0.35,+ half - radius * 0.45,+ radius * 1.1,+ );+ sheen.addColorStop(0, `rgba(255, 255, 255, ${0.28 * Math.max(0.4, live.vivid)})`);+ sheen.addColorStop(0.5, "rgba(255, 255, 255, 0)");+ ctx.fillStyle = sheen;+ ctx.fillRect(0, 0, canvas.width, canvas.height);++ ctx.restore();+ };++ // A viewer who asked for reduced motion gets the sphere, standing still.+ if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {+ drawFrame(performance.now());+ return;+ }++ let raf = requestAnimationFrame(function loop(now: number) {+ drawFrame(now);+ raf = requestAnimationFrame(loop);+ });+ return () => cancelAnimationFrame(raf);+ }, [visible, size]);++ return (+ <canvas+ ref={canvasRef}+ data-testid="voice-orb-canvas"+ aria-hidden="true"+ className={cn("rounded-full", className)}+ style={{ width: size, height: size }}+ />+ );+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoicePanel.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoicePanel.test.tsxnew file mode 100644index 0000000000..0c3093e109--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/VoicePanel.test.tsx@@ -0,0 +1,124 @@+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++/**+ * The store the panel reads, as one mutable object a test can rewrite between+ * renders. Through `vi.hoisted` because the mock factory is lifted above+ * ordinary module code.+ */+const { storeState } = vi.hoisted(() => ({+ storeState: {} as Record<string, unknown>,+}));++vi.mock("@/store/events", () => ({+ useEventStore: (selector: (s: Record<string, unknown>) => unknown) =>+ selector(storeState),+}));++vi.mock("@/lib/voiceApi", () => ({+ requestVoiceCall: vi.fn(async () => ({ armed: true })),+ requestVoiceHangup: vi.fn(async () => ({ stopped: true })),+}));++import { VoicePanel } from "./VoicePanel";+import * as api from "@/lib/voiceApi";++const pushToast = vi.fn();++beforeEach(() => {+ window.localStorage.clear();+ for (const key of Object.keys(storeState)) delete storeState[key];+ Object.assign(storeState, {+ voiceState: "idle",+ transcription: "",+ assistantName: "Ben",+ pushToast,+ });+});++afterEach(() => {+ cleanup();+ vi.clearAllMocks();+});++describe("voice panel", () => {+ it("shows the orb, ready, with the wake-word hint", () => {+ render(<VoicePanel />);+ expect(screen.getByTestId("voice-panel")).toBeTruthy();+ expect(screen.getByTestId("voice-orb-canvas")).toBeTruthy();+ expect(screen.getByTestId("voice-panel-status").textContent).toBe("Ready");+ // The brand rule: the assistant's own name, never a hardcoded one.+ expect(screen.getByTestId("voice-orb-button").getAttribute("title")).toContain(+ "Ben",+ );+ });++ it("a click while idle starts the conversation", async () => {+ render(<VoicePanel />);+ fireEvent.click(screen.getByTestId("voice-orb-button"));+ await waitFor(() => expect(api.requestVoiceCall).toHaveBeenCalled());+ expect(api.requestVoiceHangup).not.toHaveBeenCalled();+ });++ it("a click during a conversation hangs up", async () => {+ storeState.voiceState = "speaking";+ render(<VoicePanel />);+ expect(screen.getByTestId("voice-panel-status").textContent).toBe("Speaking");+ fireEvent.click(screen.getByTestId("voice-orb-button"));+ await waitFor(() => expect(api.requestVoiceHangup).toHaveBeenCalled());+ expect(api.requestVoiceCall).not.toHaveBeenCalled();+ });++ it("says so when the pipeline refuses to arm", async () => {+ vi.mocked(api.requestVoiceCall).mockResolvedValue({ armed: false });+ render(<VoicePanel />);+ fireEvent.click(screen.getByTestId("voice-orb-button"));+ await waitFor(() =>+ expect(pushToast).toHaveBeenCalledWith(+ "warning",+ expect.stringContaining("Could not start"),+ ),+ );+ });++ it("reports an unreachable voice backend instead of a dead click", async () => {+ vi.mocked(api.requestVoiceCall).mockRejectedValue(+ new Error("Voice is not running on this computer."),+ );+ render(<VoicePanel />);+ fireEvent.click(screen.getByTestId("voice-orb-button"));+ await waitFor(() =>+ expect(pushToast).toHaveBeenCalledWith(+ "error",+ expect.stringContaining("not running"),+ ),+ );+ });++ it("shows the live transcript only while a conversation runs", () => {+ storeState.voiceState = "listening";+ storeState.transcription = "open the tests folder";+ render(<VoicePanel />);+ expect(screen.getByTestId("voice-panel-transcript").textContent).toContain(+ "open the tests folder",+ );+ cleanup();+ // The same sentence after the conversation ended must NOT linger.+ storeState.voiceState = "idle";+ render(<VoicePanel />);+ expect(screen.queryByTestId("voice-panel-transcript")).toBeNull();+ });++ it("collapses to a strip and remembers that choice", () => {+ render(<VoicePanel />);+ fireEvent.click(screen.getByTestId("voice-panel-close"));+ expect(screen.getByTestId("voice-panel-collapsed")).toBeTruthy();+ expect(screen.queryByTestId("voice-panel")).toBeNull();+ cleanup();+ // A fresh mount (another workspace, a restart) keeps the collapsed strip.+ render(<VoicePanel />);+ expect(screen.getByTestId("voice-panel-collapsed")).toBeTruthy();+ fireEvent.click(screen.getByTestId("voice-panel-open"));+ expect(screen.getByTestId("voice-panel")).toBeTruthy();+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoicePanel.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoicePanel.tsxnew file mode 100644index 0000000000..57dddded96--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/VoicePanel.tsx@@ -0,0 +1,205 @@+/**+ * The voice column of the Agentic IDE — talk to the assistant while the+ * agents work, without reaching for the wake word.+ *+ * One orb, one status line, the live transcript, and a hint. Clicking the orb+ * TOGGLES the conversation: idle it arms a wake-style session (the same+ * `request_voice_session` path the call hotkey and the chats "Speak" button+ * take, so a click can never behave differently from the wake word), active it+ * hangs up. The wake word keeps working in parallel — the orb is the faster+ * hand, not a replacement.+ *+ * The panel reads everything it shows from the event store the voice pipeline+ * already feeds over the WebSocket (`voiceState`, the live transcription), so+ * it costs no polling and is exactly as current as the sidebar's status dot.+ *+ * Collapsible to a slim strip rather than removable: the strip keeps the+ * reopen affordance and a minimal state dot on screen, the same reasoning as+ * the prompt bar's collapsed strip.+ */+import { useCallback, useState } from "react";+import { PanelRightClose, PanelRightOpen } from "lucide-react";+import { cn } from "@/lib/utils";+import { useEventStore, type VoiceState } from "@/store/events";+import { requestVoiceCall, requestVoiceHangup } from "@/lib/voiceApi";+import { VoiceOrb } from "./VoiceOrb";++const OPEN_KEY = "jarvis.agenticIde.voicePanelOpen";++function storedOpen(): boolean {+ try {+ return window.localStorage.getItem(OPEN_KEY) !== "closed";+ } catch {+ return true;+ }+}++function storeOpen(open: boolean): void {+ try {+ window.localStorage.setItem(OPEN_KEY, open ? "open" : "closed");+ } catch {+ /* private mode — the preference just will not survive this session */+ }+}++/** What the line under the orb says, per state. */+const STATUS: Record<VoiceState, string> = {+ idle: "Ready",+ listening: "Listening…",+ thinking: "Thinking…",+ speaking: "Speaking",+ error: "Voice trouble",+};++/** Is a conversation running — the half of the toggle a click would end? */+function isActive(state: VoiceState): boolean {+ return state === "listening" || state === "thinking" || state === "speaking";+}++export function VoicePanel() {+ const voiceState = (useEventStore((s) => s.voiceState) ?? "idle") as VoiceState;+ const transcription = useEventStore((s) => s.transcription) ?? "";+ const assistantName =+ (useEventStore((s) => s.assistantName) ?? "").trim() || "your assistant";+ const pushToast = useEventStore((s) => s.pushToast);++ const [open, setOpen] = useState(storedOpen);+ const [busy, setBusy] = useState(false);++ const active = isActive(voiceState);++ const toggleOpen = useCallback(() => {+ setOpen((current) => {+ storeOpen(!current);+ return !current;+ });+ }, []);++ const toggleCall = useCallback(async () => {+ if (busy) return;+ setBusy(true);+ try {+ if (active) {+ await requestVoiceHangup();+ } else {+ const { armed } = await requestVoiceCall();+ // A refusal is an answer: a session already runs, or activation is+ // blocked (the app window is hidden). Say so instead of a dead click.+ if (!armed) {+ pushToast(+ "warning",+ "Could not start listening — a conversation may already be running.",+ );+ }+ }+ } catch (error) {+ pushToast("error", (error as Error).message);+ } finally {+ setBusy(false);+ }+ }, [busy, active, pushToast]);++ if (!open) {+ return (+ <aside+ data-testid="voice-panel-collapsed"+ className="flex h-full w-10 shrink-0 flex-col items-center gap-3 border-l border-border py-2"+ >+ <button+ type="button"+ data-testid="voice-panel-open"+ onClick={toggleOpen}+ title={`Open the voice panel — talk to ${assistantName} here`}+ aria-label="Open the voice panel"+ className="flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"+ >+ <PanelRightOpen className="h-4 w-4" />+ </button>+ {/* The one-glance state the strip still owes: gold and pulsing while a+ conversation runs, quiet otherwise. */}+ <span+ aria-hidden="true"+ className={cn(+ "h-2.5 w-2.5 rounded-full",+ active ? "animate-pulse bg-primary" : "bg-muted-foreground/40",+ )}+ />+ </aside>+ );+ }++ return (+ <aside+ data-testid="voice-panel"+ className="flex h-full w-72 shrink-0 flex-col border-l border-border"+ >+ <div className="flex items-center justify-between px-3 py-2">+ <span className="text-[10px] font-semibold uppercase tracking-wider text-muted-foreground">+ Voice+ </span>+ <button+ type="button"+ data-testid="voice-panel-close"+ onClick={toggleOpen}+ title="Collapse the voice panel"+ aria-label="Collapse the voice panel"+ className="flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"+ >+ <PanelRightClose className="h-4 w-4" />+ </button>+ </div>++ <div className="flex min-h-0 flex-1 flex-col items-center justify-center gap-5 px-5 pb-6">+ <button+ type="button"+ data-testid="voice-orb-button"+ onClick={() => void toggleCall()}+ disabled={busy}+ aria-pressed={active}+ title={+ active+ ? "Hang up the conversation"+ : `Talk to ${assistantName} — or just say the wake word`+ }+ aria-label={active ? "Hang up" : `Talk to ${assistantName}`}+ className={cn(+ "rounded-full outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring/60",+ // The glow is the orb's aura, swelling with the conversation.+ active+ ? "shadow-[0_0_80px_-12px_hsl(50_100%_52%/0.55)]"+ : "shadow-[0_0_48px_-16px_hsl(50_100%_52%/0.3)]",+ busy && "opacity-70",+ )}+ >+ <VoiceOrb state={voiceState} size={176} />+ </button>++ <div className="flex flex-col items-center gap-1.5 text-center">+ <span+ data-testid="voice-panel-status"+ className="font-display text-base font-semibold"+ >+ {STATUS[voiceState] ?? STATUS.idle}+ </span>+ <span className="text-xs text-muted-foreground">+ {active+ ? "Click the orb to hang up."+ : `Click the orb — or say the wake word — to talk to ${assistantName}.`}+ </span>+ </div>++ {/* What the microphone is hearing, as it hears it. Shown only while a+ conversation runs — an idle panel repeating the last sentence of a+ finished one would read as a stuck microphone. */}+ {active && transcription && (+ <p+ data-testid="voice-panel-transcript"+ className="line-clamp-3 max-w-full text-center text-sm italic text-muted-foreground"+ >+ “{transcription}”+ </p>+ )}+ </div>+ </aside>+ );+}diff --git a/jarvis/ui/web/frontend/src/lib/voiceApi.ts b/jarvis/ui/web/frontend/src/lib/voiceApi.tsnew file mode 100644index 0000000000..bac42a80d4--- /dev/null+++ b/jarvis/ui/web/frontend/src/lib/voiceApi.ts@@ -0,0 +1,37 @@+// REST client for the voice orb. Plain same-origin fetch (mirrors+// agenticIdeApi), `no-store` so a WebView cannot answer with yesterday's state.++export interface VoiceCallAnswer {+ armed: boolean;+}++export interface VoiceHangupAnswer {+ stopped: boolean;+}++async function post<T>(path: string): Promise<T> {+ const res = await fetch(path, { method: "POST", cache: "no-store" });+ if (!res.ok) {+ let detail = "";+ try {+ detail = ((await res.json()) as { detail?: string }).detail ?? "";+ } catch {+ /* a non-JSON error body — the status line below still names the failure */+ }+ if (res.status === 503) {+ throw new Error("Voice is not running on this computer.");+ }+ throw new Error(detail || `Voice request failed (${res.status}).`);+ }+ return (await res.json()) as T;+}++/** Start a voice conversation — the click-shaped wake word. */+export function requestVoiceCall(): Promise<VoiceCallAnswer> {+ return post<VoiceCallAnswer>("/api/voice/call");+}++/** End the running voice conversation — same contract as the hangup key. */+export function requestVoiceHangup(): Promise<VoiceHangupAnswer> {+ return post<VoiceHangupAnswer>("/api/voice/hangup");+}diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsxindex e854736fed..e2043a1214 100644--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx@@ -19,6 +19,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { Loader2 } from "lucide-react";import { useEventStore } from "@/store/events";import { AgenticGrid } from "@/components/agentic/AgenticGrid";+import { VoicePanel } from "@/components/agentic/VoicePanel";import {WorkspaceLauncher,type PlannedTerminal,@@ -708,32 +709,41 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {if (session && !addingNew) {return (<div className="flex h-full flex-col">- <div className="min-h-0 flex-1">+ <div className="flex min-h-0 flex-1">+ <div className="min-h-0 min-w-0 flex-1">+ {/*+ Keyed by workspace, so switching tabs REPLACES the grid instead of+ re-using it. That is deliberate: each pane's terminal is wired to+ one call-sign for its whole life, and re-using the component across+ workspaces would leave xterm instances pointed at the panes of the+ workspace that just left.+ */}+ <AgenticGrid+ key={session.id}+ session={session}+ workspaceBar={renderBar(true)}+ appActions={<TopBarActions />}+ onJumpToWorkspace={(id, pane) => void jumpToPane(id, pane)}+ jumpTo={jumpTo}+ focusMode={focusMode}+ onToggleFocus={(v) => void toggleFocus(v)}+ onClose={() => void close()}+ busy={busy}+ maxTerminals={maxTerminals}+ agents={splitChoices}+ onSessionChanged={setSession}+ accounts={ideAccounts}+ onStateChanged={applyStateFromSettings}+ onScreen={onScreen}+ />+ </div>{/*- Keyed by workspace, so switching tabs REPLACES the grid instead of- re-using it. That is deliberate: each pane's terminal is wired to- one call-sign for its whole life, and re-using the component across- workspaces would leave xterm instances pointed at the panes of the- workspace that just left.+ The voice column: talk to the assistant while the agents work.+ OUTSIDE the per-workspace grid on purpose — the conversation+ belongs to the app, not to a workspace, so switching tabs must not+ reset the orb mid-sentence.*/}- <AgenticGrid- key={session.id}- session={session}- workspaceBar={renderBar(true)}- appActions={<TopBarActions />}- onJumpToWorkspace={(id, pane) => void jumpToPane(id, pane)}- jumpTo={jumpTo}- focusMode={focusMode}- onToggleFocus={(v) => void toggleFocus(v)}- onClose={() => void close()}- busy={busy}- maxTerminals={maxTerminals}- agents={splitChoices}- onSessionChanged={setSession}- accounts={ideAccounts}- onStateChanged={applyStateFromSettings}- onScreen={onScreen}- />+ <VoicePanel /></div>{modeIntroFor === session.id && (<CodingModeIntrodiff --git a/jarvis/ui/web/server.py b/jarvis/ui/web/server.pyindex 28df6ff8dc..ab88b786f7 100644--- a/jarvis/ui/web/server.py+++ b/jarvis/ui/web/server.py@@ -360,6 +360,7 @@ class WebServer:from .ultrawiki_identity_routes import router as ultrawiki_identity_routerfrom .ultrawiki_routes import router as ultrawiki_routerfrom .update_routes import router as update_router+ from .voice_call_routes import router as voice_call_routerfrom .wiki_routes import router as wiki_routerfrom .wiki_ws import router as wiki_ws_routerfrom .workflows_routes import router as workflows_router@@ -449,6 +450,8 @@ class WebServer:# Mounted so every action is also `jarvis api dictation <op>`, which is# the documented Wayland path (no app-owned global shortcuts there).app.include_router(dictation_router)+ # The voice orb's click — call / hangup without speaking the wake word.+ app.include_router(voice_call_router)app.include_router(workflows_router)if conductor_router is not None:app.include_router(conductor_router)diff --git a/jarvis/ui/web/voice_call_routes.py b/jarvis/ui/web/voice_call_routes.pynew file mode 100644index 0000000000..48b2aac79c--- /dev/null+++ b/jarvis/ui/web/voice_call_routes.py@@ -0,0 +1,71 @@+"""REST API for the voice orb — start or end a conversation without speaking.++Endpoints (mounted by the WebServer in ``_build_app()``):++ GET /api/voice/state → is a speech pipeline running, and what it is doing.+ POST /api/voice/call → arm a wake-style voice session (the click-shaped+ wake word — same path as the call hotkey).+ POST /api/voice/hangup → hard-stop the voice channel (same contract as the+ hangup hotkey).++The click path is deliberately the SAME one the call hotkey and the chats+"Speak in this conversation" button take — ``SpeechPipeline.request_voice_session``+— so a click on the orb can never behave differently from the wake word beyond+skipping the audio trigger. Under the CLI-first contract these routes also make+the orb's actions scriptable as ``jarvis api voice <op>``.++No Brain dependency; on a headless install (no microphone, voice disabled) the+state endpoint answers honestly and the actions 503 instead of 500-ing.+"""+from __future__ import annotations++import logging+from typing import Any++from fastapi import APIRouter, HTTPException++log = logging.getLogger(__name__)++router = APIRouter(prefix="/api/voice", tags=["voice"])+++def _pipeline() -> Any:+ """The live SpeechPipeline, or ``None`` (headless / voice disabled)."""+ try:+ from jarvis.core.runtime_refs import get_speech_pipeline++ return get_speech_pipeline()+ except Exception: # noqa: BLE001 — a missing runtime ref is "no pipeline"+ return None++[email protected]("/state")+async def voice_state() -> dict[str, Any]:+ """Whether voice is available here, and what the pipeline is doing now."""+ pipeline = _pipeline()+ if pipeline is None:+ return {"available": False, "state": "unavailable"}+ state = getattr(getattr(pipeline, "_state", None), "name", "unknown")+ return {"available": True, "state": str(state).lower()}++[email protected]("/call")+async def voice_call() -> dict[str, Any]:+ """Start a voice conversation — functionally the wake word, by click.++ ``armed`` is ``False`` when the pipeline refused (a session already runs,+ or activation is blocked) — that is an answer, not an error.+ """+ pipeline = _pipeline()+ if pipeline is None or not hasattr(pipeline, "request_voice_session"):+ raise HTTPException(status_code=503, detail="voice-pipeline-unavailable")+ return {"armed": bool(pipeline.request_voice_session())}++[email protected]("/hangup")+async def voice_hangup() -> dict[str, Any]:+ """End the running voice conversation — the hangup key's contract."""+ pipeline = _pipeline()+ if pipeline is None or not hasattr(pipeline, "request_voice_hangup"):+ raise HTTPException(status_code=503, detail="voice-pipeline-unavailable")+ return {"stopped": bool(pipeline.request_voice_hangup())}diff --git a/tests/unit/ui/test_voice_call_routes.py b/tests/unit/ui/test_voice_call_routes.pynew file mode 100644index 0000000000..b71c4a0c42--- /dev/null+++ b/tests/unit/ui/test_voice_call_routes.py@@ -0,0 +1,84 @@+"""GET /api/voice/state + POST /api/voice/call + /hangup — the voice orb's click.++The click must take the SAME path as the call hotkey (``request_voice_session``+/ ``request_voice_hangup``), report a pipeline refusal as an answer rather than+an error, and degrade honestly on a headless install (503 / available=false)+instead of 500-ing.+"""+from __future__ import annotations++from types import SimpleNamespace++from fastapi import FastAPI+from fastapi.testclient import TestClient++from jarvis.ui.web import voice_call_routes+from jarvis.ui.web.voice_call_routes import router+++class _Pipeline:+ """The two public arming methods, and the state the GET reads."""++ def __init__(self, armed: bool = True, stopped: bool = True) -> None:+ self._armed = armed+ self._stopped = stopped+ self.calls: list[str] = []+ self._state = SimpleNamespace(name="IDLE")++ def request_voice_session(self) -> bool:+ self.calls.append("call")+ return self._armed++ def request_voice_hangup(self) -> bool:+ self.calls.append("hangup")+ return self._stopped+++def _client(monkeypatch, pipeline) -> TestClient:+ monkeypatch.setattr(voice_call_routes, "_pipeline", lambda: pipeline)+ app = FastAPI()+ app.include_router(router)+ return TestClient(app)+++def test_call_arms_a_wake_style_session(monkeypatch):+ pipeline = _Pipeline()+ client = _client(monkeypatch, pipeline)+ answer = client.post("/api/voice/call")+ assert answer.status_code == 200+ assert answer.json() == {"armed": True}+ assert pipeline.calls == ["call"]+++def test_call_reports_a_refusal_as_an_answer(monkeypatch):+ # A session already running (or a hidden window) is a refusal, not an error.+ client = _client(monkeypatch, _Pipeline(armed=False))+ answer = client.post("/api/voice/call")+ assert answer.status_code == 200+ assert answer.json() == {"armed": False}+++def test_hangup_takes_the_hangup_contract(monkeypatch):+ pipeline = _Pipeline()+ client = _client(monkeypatch, pipeline)+ answer = client.post("/api/voice/hangup")+ assert answer.status_code == 200+ assert answer.json() == {"stopped": True}+ assert pipeline.calls == ["hangup"]+++def test_headless_answers_honestly_instead_of_500(monkeypatch):+ client = _client(monkeypatch, None)+ assert client.post("/api/voice/call").status_code == 503+ assert client.post("/api/voice/hangup").status_code == 503+ answer = client.get("/api/voice/state")+ assert answer.status_code == 200+ assert answer.json() == {"available": False, "state": "unavailable"}+++def test_state_names_the_pipeline_state(monkeypatch):+ client = _client(monkeypatch, _Pipeline())+ assert client.get("/api/voice/state").json() == {+ "available": True,+ "state": "idle",+ }