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): trade the voice side column for a draggable voice bubble
rubenluetke10-beep4691cb3ac133
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsxindex 9678d72fef..43650f419d 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -12,6 +12,7 @@import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";import * as Dialog from "@radix-ui/react-dialog";import {+ AudioLines,Brain,Check,ChevronUp,@@ -39,7 +40,7 @@ import { useThemeValue } from "@/hooks/useTheme";import { useDocumentVisible } from "@/hooks/useDocumentVisible";import { useResizablePane } from "@/hooks/useResizablePane";import { PaneResizer } from "@/components/layout/PaneResizer";-import { useEventStore } from "@/store/events";+import { useEventStore, type VoiceState } from "@/store/events";import { AgenticTerminal, type PaneStatus, type SplitDirection } from "./AgenticTerminal";import { AgentMark } from "./AgentMark";import { PaneActivityPill } from "./PaneActivityPill";@@ -64,6 +65,7 @@ import {import { loadStoredArrangement, saveStoredArrangement, usePaneWeights } from "./usePaneWeights";import { ContinueInterrupted } from "./ContinueInterrupted";import { PaneNotifications } from "./PaneNotifications";+import { isVoiceActive } from "./VoiceBubble";import { PromptPreview } from "./PromptPreview";import { PromptEditor } from "./PromptEditor";import { WorkspaceSettings } from "./WorkspaceSettings";@@ -181,6 +183,19 @@ interface AgenticGridProps {* is an ordinary maximized pane the user can restore themselves.*/jumpTo?: { pane: string; nonce: number } | null;+ /**+ * Is the floating voice bubble on screen, and the toggle that summons it.+ *+ * The bubble itself is NOT rendered here: the conversation belongs to the+ * app, not to a workspace, and this grid is keyed by workspace — mounting+ * the bubble inside it would reset the orb mid-sentence on every tab+ * switch. The view above owns the bubble; the toolbar only carries the+ * button, because the toolbar is where every other control of this screen+ * lives. Left out (tests, embeddings), the toolbar simply has no voice+ * button.+ */+ voiceOpen?: boolean;+ onToggleVoice?: () => void;}const FONT_MIN = 10;@@ -529,6 +544,8 @@ export function AgenticGrid({jumpTo = null,onScreen = true,onPromptTargetChange,+ voiceOpen = false,+ onToggleVoice,}: AgenticGridProps) {const t = useT();const pushToast = useEventStore((s) => s.pushToast);@@ -1841,6 +1858,13 @@ export function AgenticGrid({busy={busy || working}/>+ {/* Summon or dismiss the floating voice bubble. The glyph pulses gold+ while a conversation runs so a closed bubble still has a visible+ heartbeat somewhere on screen. */}+ {onToggleVoice && (+ <WorkspaceVoiceButton open={voiceOpen} onToggle={onToggleVoice} />+ )}+<buttonref={selectionToggleRef}type="button"@@ -2769,6 +2793,50 @@ function ViewMenu({}/** Always-visible terminal text sizing for the active workspace. */+/**+ * The toolbar's voice button — summons the floating voice bubble.+ *+ * Its own component so only IT re-renders on voice-state changes: it+ * subscribes to `voiceState` for the gold pulse, and re-rendering the whole+ * grid a few times per spoken turn to animate one glyph would be the tail+ * wagging a very large dog.+ */+function WorkspaceVoiceButton({+ open,+ onToggle,+}: {+ open: boolean;+ onToggle: () => void;+}) {+ const t = useT();+ const voiceState = (useEventStore((s) => s.voiceState) ?? "idle") as VoiceState;+ const assistantName =+ (useEventStore((s) => s.assistantName) ?? "").trim() ||+ t("agentic_grid.voice_bubble.assistant_fallback");+ const active = isVoiceActive(voiceState);+ return (+ <button+ type="button"+ data-testid="agentic-voice-toggle"+ aria-pressed={open}+ onClick={onToggle}+ title={+ open+ ? t("agentic_grid.voice_bubble.button_close")+ : t("agentic_grid.voice_bubble.button_open").replace("{0}", assistantName)+ }+ className={cn(TOOLBAR_BTN, open && TOOLBAR_BTN_ON)}+ >+ <AudioLines+ className={cn(+ "h-4 w-4 shrink-0",+ active && "animate-pulse text-primary motion-reduce:animate-none",+ )}+ />+ </button>+ );+}+function TerminalFontSizeControl({fontSize,onFontSize,diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoicePanel.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.test.tsxsimilarity index 54%rename from jarvis/ui/web/frontend/src/components/agentic/VoicePanel.test.tsxrename to jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.test.tsxindex 8179b3328d..fcb74907d2 100644--- a/jarvis/ui/web/frontend/src/components/agentic/VoicePanel.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.test.tsx@@ -2,7 +2,7 @@ import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/reimport { afterEach, beforeEach, describe, expect, it, vi } from "vitest";/**- * The store the panel reads, as one mutable object a test can rewrite between+ * The store the bubble reads, as one mutable object a test can rewrite between* renders. Through `vi.hoisted` because the mock factory is lifted above* ordinary module code.*/@@ -22,6 +22,8 @@ vi.mock("@/store/events", () => ({vi.mock("@/lib/voiceApi", () => ({requestVoiceCall: vi.fn(async () => ({ armed: true })),requestVoiceHangup: vi.fn(async () => ({ stopped: true })),+ fetchTtsVolume: vi.fn(async () => ({ volume: 0.8 })),+ setTtsVolume: vi.fn(async () => undefined),}));vi.mock("@/lib/agenticIdeApi", () => ({@@ -40,13 +42,6 @@ vi.mock("@/lib/agenticIdeApi", () => ({analysis: [],};}),- fetchVoiceAttachments: vi.fn(async (terminal: string) => ({- terminal,- batches: Array.from(pendingVoiceBatches.values()).map((batch) => ({- ...batch,- reserved: batch.reserved ?? false,- })),- })),fetchAllVoiceAttachments: vi.fn(async () => ({batches: Array.from(pendingVoiceBatches.values()).map((batch) => ({...batch,@@ -61,11 +56,29 @@ vi.mock("@/lib/agenticIdeApi", () => ({vi.mock("@/lib/sound", () => ({ playDropConfirm: vi.fn() }));-import { VoicePanel } from "./VoicePanel";+import { VoiceBubble } from "./VoiceBubble";import * as api from "@/lib/voiceApi";import * as ideApi from "@/lib/agenticIdeApi";const pushToast = vi.fn();+const onClose = vi.fn();++/**+ * jsdom has no PointerEvent constructor, so `fireEvent.pointerDown` falls back+ * to a bare Event that silently drops `button` and the coordinates — and the+ * drag handler correctly ignores a button-less press. A MouseEvent dispatched+ * under the pointer event's NAME carries them; React listens by name, and+ * `pointerId` is consistently undefined on both sides of the identity check.+ */+function firePointer(element: Element | Window, type: string, init: MouseEventInit) {+ fireEvent(element, new MouseEvent(type, { bubbles: true, cancelable: true, ...init }));+}++function renderBubble(props: Partial<Parameters<typeof VoiceBubble>[0]> = {}) {+ return render(+ <VoiceBubble open onClose={onClose} promptTarget="Mika" {...props} />,+ );+}beforeEach(() => {vi.spyOn(HTMLCanvasElement.prototype, "getContext").mockReturnValue(null);@@ -86,31 +99,112 @@ afterEach(() => {vi.restoreAllMocks();});-describe("voice panel", () => {- it("shows the orb, ready, with the wake-word hint", () => {- render(<VoicePanel />);- expect(screen.getByTestId("voice-panel")).toBeTruthy();+describe("voice bubble", () => {+ it("shows the orb, ready, with the brand name in its tooltip", () => {+ renderBubble();+ expect(screen.getByTestId("voice-bubble")).toBeTruthy();const orb = screen.getByTestId("voice-orb-canvas");expect(orb.getAttribute("data-state")).toBe("idle");- // A status light, not a centrepiece — see the panel's own note on why this- // came down from 176 px.- expect(orb.getAttribute("style")).toContain("width: 96px");- expect(screen.getByTestId("voice-panel-status").textContent).toBe("Ready");+ expect(orb.getAttribute("style")).toContain("width: 132px");+ expect(screen.getByTestId("voice-bubble-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 />);+ it("renders nothing while closed or off screen", () => {+ renderBubble({ open: false });+ expect(screen.queryByTestId("voice-bubble")).toBeNull();+ cleanup();+ renderBubble({ onScreen: false });+ expect(screen.queryByTestId("voice-bubble")).toBeNull();+ });++ it("a click on the orb while idle starts the conversation", async () => {+ renderBubble();fireEvent.click(screen.getByTestId("voice-orb-button"));await waitFor(() => expect(api.requestVoiceCall).toHaveBeenCalled());expect(api.requestVoiceHangup).not.toHaveBeenCalled();});+ it("the mic button is the same toggle said explicitly", async () => {+ renderBubble();+ fireEvent.click(screen.getByTestId("voice-bubble-mic"));+ await waitFor(() => expect(api.requestVoiceCall).toHaveBeenCalled());+ cleanup();+ vi.clearAllMocks();+ storeState.voiceState = "listening";+ renderBubble();+ fireEvent.click(screen.getByTestId("voice-bubble-mic"));+ await waitFor(() => expect(api.requestVoiceHangup).toHaveBeenCalled());+ });++ it("dragging moves the bubble, remembers the spot, and swallows the click", async () => {+ renderBubble();+ const bubble = screen.getByTestId("voice-bubble");+ const before = { left: bubble.style.left, top: bubble.style.top };++ firePointer(bubble, "pointerdown", { button: 0, clientX: 300, clientY: 300 });+ firePointer(bubble, "pointermove", { clientX: 240, clientY: 380 });+ firePointer(bubble, "pointerup", { clientX: 240, clientY: 380 });++ expect(bubble.style.left).not.toBe(before.left);+ expect(bubble.style.top).not.toBe(before.top);+ expect(+ window.localStorage.getItem("jarvis.agenticIde.voiceBubblePos"),+ ).toBeTruthy();++ // The click that ends a drag must not also toggle the conversation…+ fireEvent.click(screen.getByTestId("voice-orb-button"));+ expect(api.requestVoiceCall).not.toHaveBeenCalled();+ // …and the suppression is one-shot: the next real click goes through.+ fireEvent.click(screen.getByTestId("voice-orb-button"));+ await waitFor(() => expect(api.requestVoiceCall).toHaveBeenCalledTimes(1));+ });++ it("a press that never moved is a click, not a drag", async () => {+ renderBubble();+ const orb = screen.getByTestId("voice-orb-button");+ firePointer(orb, "pointerdown", { button: 0, clientX: 100, clientY: 100 });+ firePointer(orb, "pointerup", { clientX: 101, clientY: 100 });+ fireEvent.click(orb);+ await waitFor(() => expect(api.requestVoiceCall).toHaveBeenCalled());+ });++ it("the speaker mutes session-only and restores the previous volume", async () => {+ renderBubble();+ const speaker = screen.getByTestId("voice-bubble-speaker");+ await waitFor(() => expect(api.fetchTtsVolume).toHaveBeenCalled());++ fireEvent.click(speaker);+ await waitFor(() => expect(api.setTtsVolume).toHaveBeenCalledWith(0, false));+ await waitFor(() => expect(speaker.getAttribute("aria-pressed")).toBe("true"));++ fireEvent.click(speaker);+ // persist=false both ways: a bubble mute must never survive into+ // jarvis.toml as the boot default.+ await waitFor(() => expect(api.setTtsVolume).toHaveBeenCalledWith(0.8, false));+ await waitFor(() => expect(speaker.getAttribute("aria-pressed")).toBe("false"));+ });++ it("X hangs up a running conversation and puts the bubble away", async () => {+ storeState.voiceState = "speaking";+ renderBubble();+ fireEvent.click(screen.getByTestId("voice-bubble-close"));+ expect(onClose).toHaveBeenCalled();+ await waitFor(() => expect(api.requestVoiceHangup).toHaveBeenCalled());+ });++ it("X while idle only closes — there is nothing to hang up", () => {+ renderBubble();+ fireEvent.click(screen.getByTestId("voice-bubble-close"));+ expect(onClose).toHaveBeenCalled();+ expect(api.requestVoiceHangup).not.toHaveBeenCalled();+ });+it("stages a file dropped on the orb for the selected pane's next prompt", async () => {- render(<VoicePanel promptTarget="Mika" />);+ renderBubble();const orb = screen.getByTestId("voice-orb-button");const file = new File(["pixels"], "layout.png", { type: "image/png" });const dataTransfer = {@@ -142,7 +236,7 @@ describe("voice panel", () => {});it("keeps a receipt bound to its original pane until the backend consumes it", async () => {- const { rerender } = render(<VoicePanel promptTarget="Mika" />);+ const { rerender } = renderBubble();const file = new File(["pixels"], "layout.png", { type: "image/png" });const dataTransfer = {files: [file],@@ -155,23 +249,23 @@ describe("voice panel", () => {expect(receipt.textContent).toContain("Mika");storeState.voiceState = "thinking";- rerender(<VoicePanel promptTarget="Bruno" />);+ rerender(<VoiceBubble open onClose={onClose} promptTarget="Bruno" />);expect(screen.getByTestId("voice-orb-drop-context").textContent).toContain("Mika");pendingVoiceBatches.clear();storeState.voiceState = "speaking";- rerender(<VoicePanel promptTarget="Bruno" />);+ rerender(<VoiceBubble open onClose={onClose} promptTarget="Bruno" />);await waitFor(() =>expect(screen.queryByTestId("voice-orb-drop-context")).toBeNull(),);});- it("hydrates pending context after a panel remount and locks reserved context", async () => {+ it("hydrates pending context after a remount and locks reserved context", async () => {pendingVoiceBatches.set("batch-old", {batch_id: "batch-old",files: ["existing.png"],reserved: true,});- render(<VoicePanel promptTarget="Mika" />);+ renderBubble();const receipt = await screen.findByTestId("voice-orb-drop-context");expect(receipt.textContent).toContain("existing.png");@@ -182,8 +276,8 @@ describe("voice panel", () => {).toBe(true);});- it("discovers a native Jarvis Bar drop after the panel is already mounted", async () => {- render(<VoicePanel promptTarget="Mika" />);+ it("discovers a native Jarvis Bar drop after the bubble is already open", async () => {+ renderBubble();await waitFor(() => expect(ideApi.fetchAllVoiceAttachments).toHaveBeenCalled());expect(screen.queryByTestId("voice-orb-drop-context")).toBeNull();@@ -200,8 +294,8 @@ describe("voice panel", () => {it("a click during a conversation hangs up", async () => {storeState.voiceState = "speaking";- render(<VoicePanel />);- expect(screen.getByTestId("voice-panel-status").textContent).toBe("Speaking");+ renderBubble();+ expect(screen.getByTestId("voice-bubble-status").textContent).toBe("Speaking");fireEvent.click(screen.getByTestId("voice-orb-button"));await waitFor(() => expect(api.requestVoiceHangup).toHaveBeenCalled());expect(api.requestVoiceCall).not.toHaveBeenCalled();@@ -209,7 +303,7 @@ describe("voice panel", () => {it("says so when the pipeline refuses to arm", async () => {vi.mocked(api.requestVoiceCall).mockResolvedValue({ armed: false });- render(<VoicePanel />);+ renderBubble();fireEvent.click(screen.getByTestId("voice-orb-button"));await waitFor(() =>expect(pushToast).toHaveBeenCalledWith(@@ -223,7 +317,7 @@ describe("voice panel", () => {vi.mocked(api.requestVoiceCall).mockRejectedValue(new Error("Voice is not running on this computer."),);- render(<VoicePanel />);+ renderBubble();fireEvent.click(screen.getByTestId("voice-orb-button"));await waitFor(() =>expect(pushToast).toHaveBeenCalledWith(@@ -236,27 +330,14 @@ describe("voice panel", () => {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(+ renderBubble();+ expect(screen.getByTestId("voice-bubble-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();+ renderBubble();+ expect(screen.queryByTestId("voice-bubble-transcript")).toBeNull();});});diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsxnew file mode 100644index 0000000000..07753f2839--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx@@ -0,0 +1,776 @@+/**+ * The floating voice bubble of the Agentic IDE — talk to the assistant while+ * the agents work, without giving up a column of the screen for it.+ *+ * It replaces the old fixed voice side panel: the terminals now own the whole+ * width, and the conversation surface is a bubble the user summons from the+ * toolbar and drags wherever it is least in the way. The position and the+ * open/closed choice are remembered per browser profile.+ *+ * One orb, a control row, the live transcript. Clicking the orb TOGGLES the+ * conversation: idle it arms a wake-style session (the same+ * `request_voice_session` path the call hotkey takes, so a click can never+ * behave differently from the wake word), active it hangs up. The wake word+ * keeps working in parallel — the bubble is the faster hand, not a+ * replacement. The mic button is the same toggle said explicitly; X hangs up+ * and puts the bubble away; the speaker mutes the assistant's voice for this+ * session only (never persisted — a forgotten mute must not survive a+ * restart).+ *+ * Everything shown is read from the event store the voice pipeline already+ * feeds over the WebSocket (`voiceState`, the live transcription), so the+ * bubble costs no polling of its own and is exactly as current as the+ * sidebar's status dot. Files dropped on the orb are staged for the voice+ * conversation, same contract as the old panel and the native Jarvis Bar.+ */+import {+ type DragEvent,+ type PointerEvent as ReactPointerEvent,+ useCallback,+ useEffect,+ useRef,+ useState,+} from "react";+import {+ Check,+ FilePlus2,+ Mic,+ MicOff,+ Paperclip,+ Volume2,+ VolumeX,+ X,+} from "lucide-react";+import { cn } from "@/lib/utils";+import { useEventStore, type VoiceState } from "@/store/events";+import {+ fetchTtsVolume,+ requestVoiceCall,+ requestVoiceHangup,+ setTtsVolume,+} from "@/lib/voiceApi";+import {+ attachToTerminal,+ fetchAllVoiceAttachments,+ removeVoiceAttachment,+} from "@/lib/agenticIdeApi";+import { playDropConfirm } from "@/lib/sound";+import { useT } from "@/i18n";+import {+ dragCarriesFiles,+ extractPaneDrop,+ isEmptyPayload,+ type PaneDropPayload,+} from "./paneDrop";+import { VoiceOrb } from "./VoiceOrb";++const OPEN_KEY = "jarvis.agenticIde.voiceBubbleOpen";+const POS_KEY = "jarvis.agenticIde.voiceBubblePos";++/** The bubble's fixed width; the drag clamp keeps this much reachable. */+const BUBBLE_WIDTH_PX = 224;+/** How much of the bubble must stay inside the window after a drag/resize. */+const MIN_VISIBLE_PX = 88;++export function storedVoiceBubbleOpen(): boolean {+ try {+ return window.localStorage.getItem(OPEN_KEY) === "open";+ } catch {+ return false;+ }+}++export function storeVoiceBubbleOpen(open: boolean): void {+ try {+ window.localStorage.setItem(OPEN_KEY, open ? "open" : "closed");+ } catch {+ /* private mode — the preference just will not survive this session */+ }+}++interface BubblePos {+ x: number;+ y: number;+}++/** Under the toolbar, hugging the right edge — where the old panel lived. */+function defaultPos(): BubblePos {+ return {+ x: Math.max(8, window.innerWidth - BUBBLE_WIDTH_PX - 24),+ y: 88,+ };+}++/** Keep enough of the bubble inside the window to grab it back. */+function clampPos(pos: BubblePos): BubblePos {+ return {+ x: Math.min(+ Math.max(pos.x, MIN_VISIBLE_PX - BUBBLE_WIDTH_PX),+ window.innerWidth - MIN_VISIBLE_PX,+ ),+ y: Math.min(Math.max(pos.y, 0), window.innerHeight - MIN_VISIBLE_PX),+ };+}++function storedPos(): BubblePos | null {+ try {+ const raw = window.localStorage.getItem(POS_KEY);+ if (!raw) return null;+ const parsed = JSON.parse(raw) as Partial<BubblePos>;+ if (typeof parsed.x !== "number" || typeof parsed.y !== "number") return null;+ return clampPos({ x: parsed.x, y: parsed.y });+ } catch {+ return null;+ }+}++function storePos(pos: BubblePos): void {+ try {+ window.localStorage.setItem(POS_KEY, JSON.stringify(pos));+ } catch {+ /* private mode — the bubble simply opens at the default spot next time */+ }+}++/** Locale keys for the status line, per state. */+const STATUS_KEY: Record<VoiceState, string> = {+ idle: "agentic_grid.voice_bubble.ready",+ listening: "agentic_grid.voice_bubble.listening",+ thinking: "agentic_grid.voice_bubble.thinking",+ speaking: "agentic_grid.voice_bubble.speaking",+ paused: "agentic_grid.voice_bubble.paused",+ error: "agentic_grid.voice_bubble.error",+};++/** Is a conversation running — the half of the toggle a click would end?+ * A paused session counts: it is held, not gone, and the honest click on it+ * is still "hang up". */+export function isVoiceActive(state: VoiceState): boolean {+ return (+ state === "listening" ||+ state === "thinking" ||+ state === "speaking" ||+ state === "paused"+ );+}++type DropPhase = "idle" | "over" | "reading";++interface DropReceipt {+ batchId: string;+ target: string;+ files: string[];+ reserved: boolean;+}++function format(text: string, ...values: Array<string | number>): string {+ return values.reduce<string>(+ (result, value, index) => result.replace(`{${index}}`, String(value)),+ text,+ );+}++/** One round control of the bubble's action row. */+const BUBBLE_BTN =+ "flex h-9 w-9 items-center justify-center rounded-full border border-border/70 " ++ "bg-secondary/70 text-muted-foreground transition-colors hover:bg-secondary " ++ "hover:text-foreground focus-visible:outline-none focus-visible:ring-2 " ++ "focus-visible:ring-primary/50 disabled:cursor-not-allowed disabled:opacity-40";++export function VoiceBubble({+ open,+ onClose,+ promptTarget = "",+ onScreen = true,+}: {+ open: boolean;+ onClose: () => void;+ promptTarget?: string;+ onScreen?: boolean;+}) {+ const t = useT();+ const voiceState = (useEventStore((s) => s.voiceState) ?? "idle") as VoiceState;+ const transcription = useEventStore((s) => s.transcription) ?? "";+ const assistantName =+ (useEventStore((s) => s.assistantName) ?? "").trim() ||+ t("agentic_grid.voice_bubble.assistant_fallback");+ const pushToast = useEventStore((s) => s.pushToast);++ const [busy, setBusy] = useState(false);+ const [dropPhase, setDropPhase] = useState<DropPhase>("idle");+ const [dropTarget, setDropTarget] = useState("");+ const [receipts, setReceipts] = useState<DropReceipt[]>([]);+ const [muted, setMuted] = useState(false);+ const fileInputRef = useRef<HTMLInputElement>(null);+ const prevVolumeRef = useRef(1);++ const active = isVoiceActive(voiceState);+ const mounted = open && onScreen;++ /*+ * ------------------------------------------------------------------- drag+ *+ * The whole bubble is the handle, except the controls (`data-no-drag`): a+ * button that sometimes moves the bubble instead of doing its job is a+ * button nobody trusts. A press only becomes a drag after 4 px of travel,+ * and a drag that actually moved suppresses the click that follows it —+ * otherwise every reposition would also toggle the conversation.+ */+ const [pos, setPos] = useState<BubblePos | null>(null);+ const posRef = useRef<BubblePos | null>(null);+ posRef.current = pos;+ const dragRef = useRef<{+ pointerId: number;+ startX: number;+ startY: number;+ originX: number;+ originY: number;+ moved: boolean;+ } | null>(null);+ const suppressClickRef = useRef(false);++ // Position is resolved when the bubble appears, not at module load: the+ // stored point may be off screen after a window resize, and the default+ // depends on the window size at the moment of opening.+ useEffect(() => {+ if (!mounted) return;+ setPos((current) => current ?? storedPos() ?? defaultPos());+ }, [mounted]);++ useEffect(() => {+ if (!mounted) return;+ const onResize = () => setPos((p) => (p ? clampPos(p) : p));+ window.addEventListener("resize", onResize);+ return () => window.removeEventListener("resize", onResize);+ }, [mounted]);++ const onDragPointerDown = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {+ if (event.button !== 0) return;+ suppressClickRef.current = false;+ if ((event.target as HTMLElement).closest("[data-no-drag]")) return;+ const origin = posRef.current;+ if (!origin) return;+ dragRef.current = {+ pointerId: event.pointerId,+ startX: event.clientX,+ startY: event.clientY,+ originX: origin.x,+ originY: origin.y,+ moved: false,+ };+ // Optional-chained: jsdom has no pointer capture, and losing it only+ // means a very fast drag can slip off the bubble mid-gesture.+ event.currentTarget.setPointerCapture?.(event.pointerId);+ }, []);++ const onDragPointerMove = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {+ const drag = dragRef.current;+ if (!drag || event.pointerId !== drag.pointerId) return;+ const dx = event.clientX - drag.startX;+ const dy = event.clientY - drag.startY;+ if (!drag.moved && Math.hypot(dx, dy) < 4) return;+ drag.moved = true;+ setPos(clampPos({ x: drag.originX + dx, y: drag.originY + dy }));+ }, []);++ const onDragPointerEnd = useCallback((event: ReactPointerEvent<HTMLDivElement>) => {+ const drag = dragRef.current;+ if (!drag || event.pointerId !== drag.pointerId) return;+ dragRef.current = null;+ if (drag.moved) {+ suppressClickRef.current = true;+ const settled = posRef.current;+ if (settled) storePos(settled);+ }+ }, []);++ // ------------------------------------------------------------ attachments+ // The native Jarvis Bar lives in another process, so it cannot update this+ // component's local state when a file lands. Reconcile the authoritative+ // backend queue while the bubble is visible: this both discovers external+ // drops and removes a receipt only after the spoken delivery consumed it.+ useEffect(() => {+ if (!mounted) return;+ let cancelled = false;+ let inFlight = false;+ let refreshQueued = false;+ let timer: number | undefined;+ const reconcile = () => {+ if (cancelled) return;+ if (inFlight) {+ refreshQueued = true;+ return;+ }+ inFlight = true;+ void fetchAllVoiceAttachments()+ .then((response) => {+ if (cancelled) return;+ setReceipts(+ response.batches.map((batch) => ({+ batchId: batch.batch_id,+ target: batch.terminal,+ files: batch.files,+ reserved: batch.reserved,+ })),+ );+ })+ .catch(() => {+ // A transient reconnect must not invent an empty queue. The next+ // interval/focus reconciliation retries without erasing the receipt.+ })+ .finally(() => {+ inFlight = false;+ if (refreshQueued) {+ refreshQueued = false;+ reconcile();+ } else if (!cancelled) {+ timer = window.setTimeout(reconcile, active ? 750 : 1_500);+ }+ });+ };+ reconcile();+ const refreshNow = () => {+ if (timer !== undefined) window.clearTimeout(timer);+ timer = undefined;+ reconcile();+ };+ window.addEventListener("focus", refreshNow);+ return () => {+ cancelled = true;+ if (timer !== undefined) window.clearTimeout(timer);+ window.removeEventListener("focus", refreshNow);+ };+ }, [active, mounted]);++ // A drag may leave the app without sending the orb a final dragleave.+ // Clear only the hover state; reading/ready are real work and must remain.+ useEffect(() => {+ if (dropPhase !== "over") return;+ const clear = () => setDropPhase("idle");+ window.addEventListener("drop", clear);+ window.addEventListener("dragend", clear);+ return () => {+ window.removeEventListener("drop", clear);+ window.removeEventListener("dragend", clear);+ };+ }, [dropPhase]);++ // ------------------------------------------------------------------ voice+ 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", t("agentic_grid.voice_bubble.start_failed"));+ }+ }+ } catch (error) {+ pushToast("error", (error as Error).message);+ } finally {+ setBusy(false);+ }+ }, [busy, active, pushToast, t]);++ const closeBubble = useCallback(() => {+ // X is the "put the voice away" gesture: a running conversation ends with+ // it. Fired without awaiting — the bubble should leave the screen on the+ // click, and a failed hangup still lands as a toolbar pulse the user can+ // see and act on.+ if (active) {+ requestVoiceHangup().catch((error) =>+ pushToast("error", (error as Error).message),+ );+ }+ onClose();+ }, [active, onClose, pushToast]);++ // The speaker toggle mirrors the master TTS volume so it agrees with the+ // settings slider, but its own writes are session-only (persist=false).+ useEffect(() => {+ if (!mounted) return;+ let cancelled = false;+ fetchTtsVolume()+ .then((state) => {+ if (cancelled) return;+ if (state.volume > 0) prevVolumeRef.current = state.volume;+ setMuted(state.volume === 0);+ })+ .catch(() => {+ // Unknown volume — treat as audible. The first toggle then simply+ // mutes, and any real failure surfaces through the toggle's own toast.+ });+ return () => {+ cancelled = true;+ };+ }, [mounted]);++ const toggleMute = useCallback(async () => {+ const next = !muted;+ try {+ await setTtsVolume(next ? 0 : prevVolumeRef.current || 1, false);+ setMuted(next);+ } catch (error) {+ pushToast("error", (error as Error).message);+ }+ }, [muted, pushToast]);++ // ------------------------------------------------------------------ files+ const stageFiles = useCallback(+ async (payload: PaneDropPayload, target: string) => {+ if (isEmptyPayload(payload)) {+ pushToast("warning", t("agentic_grid.voice_drop.empty"));+ return;+ }+ if (!target) {+ pushToast("warning", t("agentic_grid.voice_drop.no_target"));+ return;+ }++ setDropTarget(target);+ setDropPhase("reading");+ try {+ const result = await attachToTerminal(target, {+ ...payload,+ analyze: true,+ deliver: false,+ stageForVoice: true,+ });+ if (!result.staged_for_voice || !result.voice_batch_id) {+ pushToast("warning", t("agentic_grid.voice_drop.empty"));+ return;+ }+ setReceipts((current) => [+ ...current,+ {+ batchId: result.voice_batch_id as string,+ target,+ files: result.files,+ reserved: false,+ },+ ]);+ playDropConfirm();+ } catch (error) {+ pushToast("error", (error as Error).message);+ } finally {+ setDropPhase("idle");+ setDropTarget("");+ }+ },+ [pushToast, t],+ );++ const handleDrop = useCallback(+ (event: DragEvent<HTMLButtonElement>) => {+ event.preventDefault();+ event.stopPropagation();+ // Read synchronously: DataTransfer is emptied as soon as this handler+ // yields, so extracting after the first await would produce a ghost drop.+ const payload = extractPaneDrop(event.dataTransfer);+ if (!dragCarriesFiles(event.dataTransfer)) {+ setDropPhase("idle");+ pushToast("warning", t("agentic_grid.voice_drop.empty"));+ return;+ }+ void stageFiles(payload, promptTarget);+ },+ [promptTarget, pushToast, stageFiles, t],+ );++ const removeReceipt = useCallback(+ async (receipt: DropReceipt) => {+ try {+ await removeVoiceAttachment(receipt.target, receipt.batchId);+ setReceipts((current) =>+ current.filter((item) => item.batchId !== receipt.batchId),+ );+ } catch (error) {+ pushToast("error", (error as Error).message);+ }+ },+ [pushToast],+ );++ // After every hook: hooks must run in the same order on every render, so+ // the bubble decides to be invisible down here, never above a hook.+ if (!mounted || !pos) return null;++ return (+ <div+ data-testid="voice-bubble"+ role="dialog"+ aria-label={t("agentic_grid.voice_bubble.button_label")}+ style={{ left: pos.x, top: pos.y }}+ onPointerDown={onDragPointerDown}+ onPointerMove={onDragPointerMove}+ onPointerUp={onDragPointerEnd}+ onPointerCancel={onDragPointerEnd}+ onClickCapture={(event) => {+ // A drag that moved must not also click whatever it started on.+ if (suppressClickRef.current) {+ suppressClickRef.current = false;+ event.preventDefault();+ event.stopPropagation();+ }+ }}+ className={cn(+ "fixed z-50 flex w-56 cursor-grab select-none flex-col items-center gap-2.5",+ "rounded-3xl border border-border/60 bg-background/95 p-4 shadow-2xl",+ "active:cursor-grabbing",+ )}+ >+ <div+ data-testid="voice-orb-stage"+ data-state={voiceState}+ data-drop-state={+ dropPhase === "idle" && receipts.some((receipt) => receipt.reserved)+ ? "using"+ : dropPhase === "idle" && receipts.length > 0+ ? "ready"+ : dropPhase+ }+ className="agentic-voice-orb-stage relative grid h-40 w-40 shrink-0 place-items-center"+ >+ <span aria-hidden="true" className="agentic-voice-orb-ring agentic-voice-orb-ring-a" />+ <span aria-hidden="true" className="agentic-voice-orb-ring agentic-voice-orb-ring-b" />+ <button+ type="button"+ data-testid="voice-orb-button"+ onClick={() => void toggleCall()}+ onDragEnter={(event) => {+ event.preventDefault();+ if (dragCarriesFiles(event.dataTransfer)) setDropPhase("over");+ }}+ onDragOver={(event) => {+ event.preventDefault();+ event.dataTransfer.dropEffect = dragCarriesFiles(event.dataTransfer)+ ? "copy"+ : "none";+ }}+ onDragLeave={(event) => {+ const next = event.relatedTarget as Node | null;+ if (next && event.currentTarget.contains(next)) return;+ if (dropPhase === "over") setDropPhase("idle");+ }}+ onDrop={(event) => void handleDrop(event)}+ disabled={busy || dropPhase === "reading"}+ aria-pressed={active}+ title={+ active+ ? t("agentic_grid.voice_bubble.hang_up_title")+ : format(t("agentic_grid.voice_bubble.talk_title"), assistantName)+ }+ aria-label={+ active+ ? t("agentic_grid.voice_bubble.hang_up")+ : format(t("agentic_grid.voice_bubble.talk"), assistantName)+ }+ className={cn(+ /*+ * The idle orb is DESATURATED and dimmed, and only a running+ * conversation brings its colour up. The renderer paints the same+ * ivory-to-amber weather either way; what changes is how loudly+ * it is allowed to say so — an indicator that looks identical+ * whether or not anything is happening is decoration.+ */+ "relative z-10 rounded-full outline-none transition-[transform,filter,opacity] duration-700 ease-out",+ "hover:scale-[1.02] active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-primary/50 motion-reduce:transform-none",+ active+ ? "[filter:saturate(1)_brightness(1)]"+ : "[filter:saturate(0.45)_brightness(0.72)] hover:[filter:saturate(0.7)_brightness(0.85)]",+ dropPhase === "over" && "scale-[1.04]",+ (busy || dropPhase === "reading") && "cursor-wait opacity-80",+ )}+ >+ <VoiceOrb state={voiceState} size={132} />+ </button>+ </div>++ <span className="flex shrink-0 items-center gap-1.5">+ <span+ aria-hidden="true"+ data-state={voiceState}+ className="agentic-voice-state-dot"+ />+ <span+ data-testid="voice-bubble-status"+ aria-live="polite"+ className={cn(+ "text-[11px] font-medium uppercase tracking-[0.1em] transition-colors",+ active ? "text-primary" : "text-muted-foreground",+ )}+ >+ {dropPhase === "over"+ ? format(+ t("agentic_grid.voice_drop.hover"),+ promptTarget || t("agentic_grid.voice_drop.target_fallback"),+ )+ : dropPhase === "reading"+ ? format(t("agentic_grid.voice_drop.reading"), dropTarget)+ : t(STATUS_KEY[voiceState] ?? STATUS_KEY.idle)}+ </span>+ </span>++ {/* What the microphone is hearing, as it hears it. Shown only while a+ conversation runs — an idle bubble repeating the last sentence of a+ finished one would read as a stuck microphone. */}+ {active && transcription && (+ <p+ data-testid="voice-bubble-transcript"+ className="line-clamp-3 max-w-full shrink-0 text-center text-[13px] leading-relaxed text-muted-foreground"+ >+ {transcription}+ </p>+ )}++ {receipts.map((receipt) => (+ <div+ key={receipt.batchId}+ data-testid="voice-orb-drop-context"+ aria-live="polite"+ className="flex w-full max-w-full shrink-0 items-start gap-2 rounded-control border border-border/70 bg-card/50 px-2.5 py-2 text-left"+ >+ <span className="mt-0.5 grid h-4 w-4 shrink-0 place-items-center rounded-full bg-primary/15 text-primary">+ <Check className="h-2.5 w-2.5" aria-hidden="true" />+ </span>+ <span className="min-w-0 flex-1 text-[11px] leading-relaxed text-muted-foreground">+ <span className="block truncate font-medium text-foreground">+ <FilePlus2+ className="mr-1 inline h-3.5 w-3.5 text-primary"+ aria-hidden="true"+ />+ {receipt.files.join(", ")}+ </span>+ {receipt.reserved+ ? format(+ t("agentic_grid.voice_drop.using"),+ receipt.files.length,+ receipt.target,+ )+ : format(+ t(+ receipt.files.length === 1+ ? "agentic_grid.voice_drop.ready_one"+ : "agentic_grid.voice_drop.ready_many",+ ),+ receipt.files.length,+ receipt.target,+ )}+ </span>+ <button+ type="button"+ data-no-drag+ disabled={receipt.reserved}+ onClick={() => void removeReceipt(receipt)}+ title={t("agentic_grid.voice_drop.remove")}+ aria-label={t("agentic_grid.voice_drop.remove")}+ className="grid h-5 w-5 shrink-0 place-items-center rounded text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35"+ >+ <X className="h-3 w-3" aria-hidden="true" />+ </button>+ </div>+ ))}++ <input+ ref={fileInputRef}+ type="file"+ multiple+ className="sr-only"+ tabIndex={-1}+ onChange={(event) => {+ const files = Array.from(event.currentTarget.files ?? []);+ event.currentTarget.value = "";+ void stageFiles({ paths: [], files }, promptTarget);+ }}+ />++ {/* The action row: attach, talk, put away, mute — four equal circles so+ none of them reads as the "main" one; the orb above is the main one. */}+ <div className="flex shrink-0 items-center gap-2.5 pt-0.5">+ <button+ type="button"+ data-no-drag+ data-testid="voice-bubble-attach"+ disabled={!promptTarget || dropPhase === "reading"}+ onClick={() => fileInputRef.current?.click()}+ title={t("agentic_grid.voice_drop.choose")}+ aria-label={t("agentic_grid.voice_drop.choose")}+ className={BUBBLE_BTN}+ >+ <Paperclip className="h-4 w-4" aria-hidden="true" />+ </button>+ <button+ type="button"+ data-no-drag+ data-testid="voice-bubble-mic"+ disabled={busy}+ aria-pressed={active}+ onClick={() => void toggleCall()}+ title={+ active+ ? t("agentic_grid.voice_bubble.mic_stop")+ : format(t("agentic_grid.voice_bubble.mic_start"), assistantName)+ }+ aria-label={+ active+ ? t("agentic_grid.voice_bubble.mic_stop")+ : format(t("agentic_grid.voice_bubble.mic_start"), assistantName)+ }+ className={cn(+ BUBBLE_BTN,+ active && "border-primary/50 bg-primary/15 text-primary hover:bg-primary/20 hover:text-primary",+ )}+ >+ {active ? (+ <Mic className="h-4 w-4" aria-hidden="true" />+ ) : (+ <MicOff className="h-4 w-4" aria-hidden="true" />+ )}+ </button>+ <button+ type="button"+ data-no-drag+ data-testid="voice-bubble-close"+ onClick={closeBubble}+ title={t("agentic_grid.voice_bubble.close")}+ aria-label={t("agentic_grid.voice_bubble.close")}+ className={cn(BUBBLE_BTN, "hover:bg-destructive/15 hover:text-destructive")}+ >+ <X className="h-4 w-4" aria-hidden="true" />+ </button>+ <button+ type="button"+ data-no-drag+ data-testid="voice-bubble-speaker"+ aria-pressed={muted}+ onClick={() => void toggleMute()}+ title={+ muted+ ? format(t("agentic_grid.voice_bubble.unmute"), assistantName)+ : format(t("agentic_grid.voice_bubble.mute"), assistantName)+ }+ aria-label={+ muted+ ? format(t("agentic_grid.voice_bubble.unmute"), assistantName)+ : format(t("agentic_grid.voice_bubble.mute"), assistantName)+ }+ className={cn(+ BUBBLE_BTN,+ muted && "border-destructive/40 bg-destructive/10 text-destructive hover:bg-destructive/15 hover:text-destructive",+ )}+ >+ {muted ? (+ <VolumeX className="h-4 w-4" aria-hidden="true" />+ ) : (+ <Volume2 className="h-4 w-4" aria-hidden="true" />+ )}+ </button>+ </div>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsxindex 2b3262ffd4..64a8119370 100644--- a/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx@@ -71,6 +71,17 @@ const MOTIONS: Record<VoiceState, Motion> = {energy: 1,voiceImpact: 0.045,},+ paused: {+ // Stiller than idle: the session is held, not gone — the weather keeps+ // drifting, just with nothing to say and no breath worth noticing.+ flowX: 0.015,+ flowY: 0.004,+ breathAmp: 0.003,+ breathHz: 0.1,+ turbulence: 0.75,+ energy: 0.78,+ voiceImpact: 0,+ },error: {flowX: 0.012,flowY: 0,diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoicePanel.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoicePanel.tsxdeleted file mode 100644index 04c6fa7a83..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/VoicePanel.tsx+++ /dev/null@@ -1,558 +0,0 @@-/**- * 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 { type DragEvent, useCallback, useEffect, useRef, useState } from "react";-import {- Check,- FilePlus2,- PanelRightClose,- PanelRightOpen,- Paperclip,- X,-} from "lucide-react";-import { cn } from "@/lib/utils";-import { useEventStore, type VoiceState } from "@/store/events";-import { requestVoiceCall, requestVoiceHangup } from "@/lib/voiceApi";-import {- attachToTerminal,- fetchAllVoiceAttachments,- removeVoiceAttachment,-} from "@/lib/agenticIdeApi";-import { playDropConfirm } from "@/lib/sound";-import { useT } from "@/i18n";-import {- dragCarriesFiles,- extractPaneDrop,- isEmptyPayload,- type PaneDropPayload,-} from "./paneDrop";-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 */- }-}--/** Locale keys for the line under the orb, per state. */-const STATUS_KEY: Record<VoiceState, string> = {- idle: "agentic_grid.voice_panel.ready",- listening: "agentic_grid.voice_panel.listening",- thinking: "agentic_grid.voice_panel.thinking",- speaking: "agentic_grid.voice_panel.speaking",- error: "agentic_grid.voice_panel.error",-};--/** 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";-}--type DropPhase = "idle" | "over" | "reading";--interface DropReceipt {- batchId: string;- target: string;- files: string[];- reserved: boolean;-}--function format(text: string, ...values: Array<string | number>): string {- return values.reduce<string>(- (result, value, index) => result.replace(`{${index}}`, String(value)),- text,- );-}--export function VoicePanel({- promptTarget = "",- onScreen = true,-}: {- promptTarget?: string;- onScreen?: boolean;-}) {- const t = useT();- const voiceState = (useEventStore((s) => s.voiceState) ?? "idle") as VoiceState;- const transcription = useEventStore((s) => s.transcription) ?? "";- const assistantName =- (useEventStore((s) => s.assistantName) ?? "").trim() ||- t("agentic_grid.voice_panel.assistant_fallback");- const pushToast = useEventStore((s) => s.pushToast);-- const [open, setOpen] = useState(storedOpen);- const [busy, setBusy] = useState(false);- const [dropPhase, setDropPhase] = useState<DropPhase>("idle");- const [dropTarget, setDropTarget] = useState("");- const [receipts, setReceipts] = useState<DropReceipt[]>([]);- const fileInputRef = useRef<HTMLInputElement>(null);-- const active = isActive(voiceState);-- // The native Jarvis Bar lives in another process, so it cannot update this- // component's local state when a file lands. Reconcile the authoritative- // backend queue while the panel is mounted: this both discovers external- // drops and removes a receipt only after the spoken delivery consumed it.- useEffect(() => {- if (!onScreen) return;- let cancelled = false;- let inFlight = false;- let refreshQueued = false;- let timer: number | undefined;- const reconcile = () => {- if (cancelled) return;- if (inFlight) {- refreshQueued = true;- return;- }- inFlight = true;- void fetchAllVoiceAttachments()- .then((response) => {- if (cancelled) return;- setReceipts(- response.batches.map((batch) => ({- batchId: batch.batch_id,- target: batch.terminal,- files: batch.files,- reserved: batch.reserved,- })),- );- })- .catch(() => {- // A transient reconnect must not invent an empty queue. The next- // interval/focus reconciliation retries without erasing the receipt.- })- .finally(() => {- inFlight = false;- if (refreshQueued) {- refreshQueued = false;- reconcile();- } else if (!cancelled) {- timer = window.setTimeout(reconcile, active ? 750 : 1_500);- }- });- };- reconcile();- const refreshNow = () => {- if (timer !== undefined) window.clearTimeout(timer);- timer = undefined;- reconcile();- };- window.addEventListener("focus", refreshNow);- return () => {- cancelled = true;- if (timer !== undefined) window.clearTimeout(timer);- window.removeEventListener("focus", refreshNow);- };- }, [active, onScreen]);-- // A drag may leave the app without sending this button a final dragleave.- // Clear only the hover state; reading/ready are real work and must remain.- useEffect(() => {- if (dropPhase !== "over") return;- const clear = () => setDropPhase("idle");- window.addEventListener("drop", clear);- window.addEventListener("dragend", clear);- return () => {- window.removeEventListener("drop", clear);- window.removeEventListener("dragend", clear);- };- }, [dropPhase]);-- 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",- t("agentic_grid.voice_panel.start_failed"),- );- }- }- } catch (error) {- pushToast("error", (error as Error).message);- } finally {- setBusy(false);- }- }, [busy, active, pushToast, t]);-- const stageFiles = useCallback(- async (payload: PaneDropPayload, target: string) => {- if (isEmptyPayload(payload)) {- pushToast("warning", t("agentic_grid.voice_drop.empty"));- return;- }- if (!target) {- pushToast("warning", t("agentic_grid.voice_drop.no_target"));- return;- }-- setDropTarget(target);- setDropPhase("reading");- try {- const result = await attachToTerminal(target, {- ...payload,- analyze: true,- deliver: false,- stageForVoice: true,- });- if (!result.staged_for_voice || !result.voice_batch_id) {- pushToast("warning", t("agentic_grid.voice_drop.empty"));- return;- }- setReceipts((current) => [- ...current,- {- batchId: result.voice_batch_id as string,- target,- files: result.files,- reserved: false,- },- ]);- playDropConfirm();- } catch (error) {- pushToast("error", (error as Error).message);- } finally {- setDropPhase("idle");- setDropTarget("");- }- },- [pushToast, t],- );-- const handleDrop = useCallback(- (event: DragEvent<HTMLButtonElement>) => {- event.preventDefault();- event.stopPropagation();- // Read synchronously: DataTransfer is emptied as soon as this handler- // yields, so extracting after the first await would produce a ghost drop.- const payload = extractPaneDrop(event.dataTransfer);- if (!dragCarriesFiles(event.dataTransfer)) {- setDropPhase("idle");- pushToast("warning", t("agentic_grid.voice_drop.empty"));- return;- }- void stageFiles(payload, promptTarget);- },- [promptTarget, pushToast, stageFiles, t],- );-- const removeReceipt = useCallback(- async (receipt: DropReceipt) => {- try {- await removeVoiceAttachment(receipt.target, receipt.batchId);- setReceipts((current) =>- current.filter((item) => item.batchId !== receipt.batchId),- );- } catch (error) {- pushToast("error", (error as Error).message);- }- },- [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={format(- t("agentic_grid.voice_panel.open_title"),- assistantName,- )}- aria-label={t("agentic_grid.voice_panel.open")}- className="flex h-7 w-7 items-center justify-center rounded-control 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-[#e7c46e] motion-reduce:animate-none"- : "bg-muted-foreground/40",- )}- />- </aside>- );- }-- return (- <aside- data-testid="voice-panel"- /*- * 240 px rather than 288. This column is a presence indicator and a- * transcript, not a reading surface — and it is the third vertical band- * on a screen whose actual content is the terminals. Every pixel it does- * not need belongs to them.- */- className="flex h-full w-60 shrink-0 flex-col border-l border-border"- >- <div className="flex h-11 shrink-0 items-center justify-between border-b border-border/60 px-3">- <span className="truncate text-[11px] font-semibold uppercase tracking-[0.12em] text-muted-foreground">- {t("agentic_grid.voice_panel.label")}- </span>- <button- type="button"- data-testid="voice-panel-close"- onClick={toggleOpen}- title={t("agentic_grid.voice_panel.close")}- aria-label={t("agentic_grid.voice_panel.close")}- className="flex h-7 w-7 items-center justify-center rounded-control text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground"- >- <PanelRightClose className="h-4 w-4" />- </button>- </div>-- {/*- Aligned to the TOP of the column, not centred in it.- A 176 px orb parked in the middle of a full-height column reads as a- splash screen — the largest, brightest, most animated object on a- screen whose subject is a wall of terminals. Sat at the top at 96 px it- is what it actually is: a status light you can click, with the- transcript under it and the column's own controls at its foot.- */}- <div className="flex min-h-0 flex-1 flex-col items-center gap-3 px-4 pb-3 pt-6">- <div- data-testid="voice-orb-stage"- data-state={voiceState}- data-drop-state={- dropPhase === "idle" && receipts.some((receipt) => receipt.reserved)- ? "using"- : dropPhase === "idle" && receipts.length > 0- ? "ready"- : dropPhase- }- className="agentic-voice-orb-stage relative grid h-28 w-28 shrink-0 place-items-center"- >- <span aria-hidden="true" className="agentic-voice-orb-ring agentic-voice-orb-ring-a" />- <span aria-hidden="true" className="agentic-voice-orb-ring agentic-voice-orb-ring-b" />- <button- type="button"- data-testid="voice-orb-button"- onClick={() => void toggleCall()}- onDragEnter={(event) => {- event.preventDefault();- if (dragCarriesFiles(event.dataTransfer)) setDropPhase("over");- }}- onDragOver={(event) => {- event.preventDefault();- event.dataTransfer.dropEffect = dragCarriesFiles(event.dataTransfer)- ? "copy"- : "none";- }}- onDragLeave={(event) => {- const next = event.relatedTarget as Node | null;- if (next && event.currentTarget.contains(next)) return;- if (dropPhase === "over") setDropPhase("idle");- }}- onDrop={(event) => void handleDrop(event)}- disabled={busy || dropPhase === "reading"}- aria-pressed={active}- title={- active- ? t("agentic_grid.voice_panel.hang_up_title")- : format(- t("agentic_grid.voice_panel.talk_title"),- assistantName,- )- }- aria-label={- active- ? t("agentic_grid.voice_panel.hang_up")- : format(t("agentic_grid.voice_panel.talk"), assistantName)- }- className={cn(- /*- * The idle orb is DESATURATED and dimmed, and only a running- * conversation brings its colour up. The renderer paints the same- * ivory-to-amber weather either way; what changes is how loudly- * it is allowed to say so. An indicator that looks identical- * whether or not anything is happening is decoration, and a- * decoration this bright is what made the column read as a- * screensaver bolted to an IDE.- */- "relative z-10 rounded-full outline-none transition-[transform,filter,opacity] duration-700 ease-out",- "hover:scale-[1.02] active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-primary/50 motion-reduce:transform-none",- active- ? "[filter:saturate(1)_brightness(1)]"- : "[filter:saturate(0.45)_brightness(0.72)] hover:[filter:saturate(0.7)_brightness(0.85)]",- dropPhase === "over" && "scale-[1.04]",- (busy || dropPhase === "reading") && "cursor-wait opacity-80",- )}- >- <VoiceOrb state={voiceState} size={96} />- </button>- </div>-- {/*- One line, at label weight. It used to be a 16 px display-font- headline with a second explanatory sentence under it — "Ready" set- larger than anything in the terminals beside it, followed by a- standing instruction telling the reader how to click the thing they- were looking at. The instruction is now the button's own tooltip,- which is where an instruction about a control belongs.- */}- <span className="flex shrink-0 items-center gap-1.5">- <span- aria-hidden="true"- data-state={voiceState}- className="agentic-voice-state-dot"- />- <span- data-testid="voice-panel-status"- aria-live="polite"- className={cn(- "text-[11px] font-medium uppercase tracking-[0.1em] transition-colors",- active ? "text-primary" : "text-muted-foreground",- )}- >- {dropPhase === "over"- ? format(- t("agentic_grid.voice_drop.hover"),- promptTarget || t("agentic_grid.voice_drop.target_fallback"),- )- : dropPhase === "reading"- ? format(t("agentic_grid.voice_drop.reading"), dropTarget)- : t(STATUS_KEY[voiceState] ?? STATUS_KEY.idle)}- </span>- </span>-- {receipts.map((receipt) => (- <div- key={receipt.batchId}- data-testid="voice-orb-drop-context"- aria-live="polite"- className="flex w-full max-w-full shrink-0 items-start gap-2 rounded-control border border-border/70 bg-card/50 px-2.5 py-2 text-left"- >- <span className="mt-0.5 grid h-4 w-4 shrink-0 place-items-center rounded-full bg-primary/15 text-primary">- <Check className="h-2.5 w-2.5" aria-hidden="true" />- </span>- <span className="min-w-0 flex-1 text-[11px] leading-relaxed text-muted-foreground">- <span className="block truncate font-medium text-foreground">- <FilePlus2- className="mr-1 inline h-3.5 w-3.5 text-primary"- aria-hidden="true"- />- {receipt.files.join(", ")}- </span>- {receipt.reserved- ? format(- t("agentic_grid.voice_drop.using"),- receipt.files.length,- receipt.target,- )- : format(- t(- receipt.files.length === 1- ? "agentic_grid.voice_drop.ready_one"- : "agentic_grid.voice_drop.ready_many",- ),- receipt.files.length,- receipt.target,- )}- </span>- <button- type="button"- disabled={receipt.reserved}- onClick={() => void removeReceipt(receipt)}- title={t("agentic_grid.voice_drop.remove")}- aria-label={t("agentic_grid.voice_drop.remove")}- className="grid h-5 w-5 shrink-0 place-items-center rounded text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground disabled:cursor-not-allowed disabled:opacity-35"- >- <X className="h-3 w-3" aria-hidden="true" />- </button>- </div>- ))}-- <input- ref={fileInputRef}- type="file"- multiple- className="sr-only"- tabIndex={-1}- onChange={(event) => {- const files = Array.from(event.currentTarget.files ?? []);- event.currentTarget.value = "";- void stageFiles({ paths: [], files }, promptTarget);- }}- />- {/* 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-4 max-w-full shrink-0 text-center text-[13px] leading-relaxed text-muted-foreground"- >- {transcription}- </p>- )}-- {/* Last in the column, pushed to its foot: the fallback for people who- do not drag files onto the orb. `mt-auto` is what keeps it there- whether or not a transcript and a receipt are above it — a control- that drifts up and down the column as state arrives is one nobody- can learn the position of. */}- <button- type="button"- disabled={!promptTarget || dropPhase === "reading"}- onClick={() => fileInputRef.current?.click()}- className="mt-auto flex shrink-0 items-center gap-1.5 rounded-control px-2 py-1 text-[11px] text-muted-foreground/80 transition-colors hover:bg-secondary hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40"- >- <Paperclip className="h-3.5 w-3.5" aria-hidden="true" />- {t("agentic_grid.voice_drop.choose")}- </button>- </div>- </aside>- );-}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 816c09b7cd..eeff3cb5ca 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -3758,23 +3758,26 @@"kind_failed": "FEHLGESCHLAGEN","gone": "{0} gibt es in diesem Workspace nicht mehr — das Terminal wurde geschlossen, seit die Benachrichtigung kam."},- "voice_panel": {+ "voice_bubble": {"assistant_fallback": "Assistent",- "label": "Stimme",+ "button_label": "Sprach-Bubble",+ "button_open": "Sprach-Bubble öffnen — mit {0} sprechen",+ "button_close": "Sprach-Bubble schließen","ready": "Bereit","listening": "Hört zu…","thinking": "Denkt nach…","speaking": "Spricht",+ "paused": "Pausiert","error": "Sprachfunktion gestört",- "open": "Sprachbereich öffnen",- "open_title": "Sprachbereich öffnen — hier mit {0} sprechen",- "close": "Sprachbereich einklappen","hang_up": "Auflegen","hang_up_title": "Gespräch beenden","talk": "Mit {0} sprechen","talk_title": "Mit {0} sprechen — oder einfach das Aktivierungswort sagen",- "active_hint": "Zum Auflegen auf die Kugel klicken.",- "idle_hint": "Auf die Kugel klicken — oder das Aktivierungswort sagen — um mit {0} zu sprechen.",+ "mic_start": "Gespräch mit {0} starten",+ "mic_stop": "Gespräch beenden",+ "close": "Sprach-Bubble schließen",+ "mute": "Stimme von {0} für diese Sitzung stummschalten",+ "unmute": "Stummschaltung von {0} aufheben","start_failed": "Das Zuhören konnte nicht gestartet werden — möglicherweise läuft bereits ein Gespräch."},"voice_drop": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex e94e051239..a7cb304b17 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -3759,23 +3759,26 @@"kind_failed": "FAILED","gone": "{0} is not in this workspace any more — that terminal was closed since the notification arrived."},- "voice_panel": {+ "voice_bubble": {"assistant_fallback": "Assistant",- "label": "Voice",+ "button_label": "Voice bubble",+ "button_open": "Open the voice bubble — talk to {0}",+ "button_close": "Close the voice bubble","ready": "Ready","listening": "Listening…","thinking": "Thinking…","speaking": "Speaking",+ "paused": "Paused","error": "Voice trouble",- "open": "Open the voice panel",- "open_title": "Open the voice panel — talk to {0} here",- "close": "Collapse the voice panel","hang_up": "Hang up","hang_up_title": "Hang up the conversation","talk": "Talk to {0}","talk_title": "Talk to {0} — or just say the wake word",- "active_hint": "Click the orb to hang up.",- "idle_hint": "Click the orb — or say the wake word — to talk to {0}.",+ "mic_start": "Start a conversation with {0}",+ "mic_stop": "End the conversation",+ "close": "Close the voice bubble",+ "mute": "Mute {0}'s voice for this session",+ "unmute": "Unmute {0}'s voice","start_failed": "Could not start listening — a conversation may already be running."},"voice_drop": {diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 5d1af8bc84..51add471c1 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -3758,23 +3758,26 @@"kind_failed": "FALLIDO","gone": "{0} ya no está en este espacio de trabajo: ese terminal se cerró después de llegar la notificación."},- "voice_panel": {+ "voice_bubble": {"assistant_fallback": "Asistente",- "label": "Voz",+ "button_label": "Burbuja de voz",+ "button_open": "Abrir la burbuja de voz — habla con {0}",+ "button_close": "Cerrar la burbuja de voz","ready": "Listo","listening": "Escuchando…","thinking": "Pensando…","speaking": "Hablando",+ "paused": "En pausa","error": "Problema de voz",- "open": "Abrir el panel de voz",- "open_title": "Abrir el panel de voz — habla con {0} aquí",- "close": "Contraer el panel de voz","hang_up": "Colgar","hang_up_title": "Finalizar la conversación","talk": "Hablar con {0}","talk_title": "Habla con {0} — o di la palabra de activación",- "active_hint": "Haz clic en el orbe para colgar.",- "idle_hint": "Haz clic en el orbe — o di la palabra de activación — para hablar con {0}.",+ "mic_start": "Iniciar una conversación con {0}",+ "mic_stop": "Finalizar la conversación",+ "close": "Cerrar la burbuja de voz",+ "mute": "Silenciar la voz de {0} en esta sesión",+ "unmute": "Reactivar la voz de {0}","start_failed": "No se pudo empezar a escuchar — puede que ya haya una conversación en curso."},"voice_drop": {diff --git a/jarvis/ui/web/frontend/src/lib/voiceApi.ts b/jarvis/ui/web/frontend/src/lib/voiceApi.tsindex bac42a80d4..363faa3c7a 100644--- a/jarvis/ui/web/frontend/src/lib/voiceApi.ts+++ b/jarvis/ui/web/frontend/src/lib/voiceApi.ts@@ -35,3 +35,40 @@ export function requestVoiceCall(): Promise<VoiceCallAnswer> {export function requestVoiceHangup(): Promise<VoiceHangupAnswer> {return post<VoiceHangupAnswer>("/api/voice/hangup");}++export interface TtsVolumeState {+ volume: number;+}++/** The master TTS volume — 0.0–1.0, the same value the settings slider shows. */+export async function fetchTtsVolume(): Promise<TtsVolumeState> {+ const res = await fetch("/api/settings/tts-volume", { cache: "no-store" });+ if (!res.ok) throw new Error(`Voice volume request failed (${res.status}).`);+ return (await res.json()) as TtsVolumeState;+}++/**+ * Set the master TTS volume. `persist: false` keeps the change session-only —+ * the voice bubble's speaker toggle must never write a mute into jarvis.toml+ * that would survive a restart the user has long forgotten about.+ */+export async function setTtsVolume(+ volume: number,+ persist: boolean,+): Promise<void> {+ const res = await fetch("/api/settings/tts-volume", {+ method: "PUT",+ cache: "no-store",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ volume, persist }),+ });+ 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 */+ }+ throw new Error(detail || `Voice volume change failed (${res.status}).`);+ }+}diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsxindex f80d4c0085..2bfe883e12 100644--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx@@ -24,7 +24,11 @@ import {storedViewMode,type WorkspaceView,} from "@/components/agentic/AgenticGrid";-import { VoicePanel } from "@/components/agentic/VoicePanel";+import {+ VoiceBubble,+ storedVoiceBubbleOpen,+ storeVoiceBubbleOpen,+} from "@/components/agentic/VoiceBubble";import {WorkspaceLauncher,type PlannedTerminal,@@ -114,6 +118,25 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {const [promptTarget, setPromptTarget] = useState("");const [focusMode, setFocus] = useState(false);const [busy, setBusy] = useState(false);+ /*+ * The floating voice bubble — held HERE, not in the grid, because the+ * conversation belongs to the app: the grid is keyed by workspace, and a+ * bubble mounted inside it would reset the orb mid-sentence on every tab+ * switch (the same reason the old voice column lived outside the grid).+ * The choice survives restarts so the bubble greets its user where they+ * left it.+ */+ const [voiceOpen, setVoiceOpen] = useState(storedVoiceBubbleOpen);+ const toggleVoiceBubble = useCallback(() => {+ setVoiceOpen((current) => {+ storeVoiceBubbleOpen(!current);+ return !current;+ });+ }, []);+ const closeVoiceBubble = useCallback(() => {+ storeVoiceBubbleOpen(false);+ setVoiceOpen(false);+ }, []);// Every open workspace, for the bar above. The one on screen is `session`;// these are the others, still running, one click away.@@ -724,55 +747,58 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {if (session && !addingNew) {return (<div className="flex h-full flex-col">- <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}- onPromptTargetChange={setPromptTarget}- />- </div>+ <div className="min-h-0 min-w-0 flex-1">{/*- 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.+ 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.*/}- <VoicePanel+ <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}- promptTarget={- session.terminals.some(- (terminal) =>- terminal.name === promptTarget && terminal.accepts_prompts !== false,- )- ? promptTarget- : session.terminals.find(- (terminal) => terminal.accepts_prompts !== false,- )?.name ?? ""- }+ onPromptTargetChange={setPromptTarget}+ voiceOpen={voiceOpen}+ onToggleVoice={toggleVoiceBubble}/></div>+ {/*+ The floating voice bubble: talk to the assistant while the agents+ work. A fixed overlay rather than a column, so the terminals keep+ the whole width in every view mode; 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.+ */}+ <VoiceBubble+ open={voiceOpen}+ onClose={closeVoiceBubble}+ onScreen={onScreen}+ promptTarget={+ session.terminals.some(+ (terminal) =>+ terminal.name === promptTarget && terminal.accepts_prompts !== false,+ )+ ? promptTarget+ : session.terminals.find(+ (terminal) => terminal.accepts_prompts !== false,+ )?.name ?? ""+ }+ />{modeIntroFor === session.id && (<CodingModeIntroterminals={session.terminals.map((x) => x.name)}