Skip to content

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.

fix(agentic-ide): make command deck voice actionable

rubenluetke10-beepfb8b0d592718
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.deck.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.deck.test.tsx
index 7547316705..c739f3782e 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.deck.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.deck.test.tsx
@@ -22,10 +22,25 @@ if (typeof globalThis.ResizeObserver === "undefined") {
globalThis.ResizeObserver = ResizeObserverPolyfill;
}
+const deckVoice = vi.hoisted(() => ({
+ state: "idle" as string,
+ transcription: "",
+ assistantName: "Ben",
+}));
const pushToast = vi.fn();
vi.mock("@/store/events", () => ({
useEventStore: (selector: (s: Record<string, unknown>) => unknown) =>
- selector({ pushToast, voiceState: "idle" }),
+ selector({
+ pushToast,
+ voiceState: deckVoice.state,
+ transcription: deckVoice.transcription,
+ assistantName: deckVoice.assistantName,
+ }),
+}));
+
+vi.mock("@/lib/voiceApi", () => ({
+ requestVoiceCall: vi.fn(async () => ({ armed: true })),
+ requestVoiceHangup: vi.fn(async () => ({ stopped: true })),
}));
vi.mock("@/hooks/useTheme", () => ({ useThemeValue: () => "dark" }));
@@ -94,6 +109,7 @@ vi.mock("./VoiceOrb", () => ({
import { AgenticGrid } from "./AgenticGrid";
import * as api from "@/lib/agenticIdeApi";
+import * as voiceApi from "@/lib/voiceApi";
import type { SessionState, TerminalState } from "@/lib/agenticIdeApi";
function pane(name: string, column: number, index: number): TerminalState {
@@ -162,6 +178,9 @@ const toDeck = () => fireEvent.click(screen.getByTestId("agentic-view-mode-deck"
beforeEach(() => {
window.localStorage.clear();
+ deckVoice.state = "idle";
+ deckVoice.transcription = "";
+ deckVoice.assistantName = "Ben";
});
afterEach(() => {
@@ -205,7 +224,35 @@ describe("the room", () => {
renderGrid();
toDeck();
- expect(screen.getByTestId("deck-orb-caption").textContent).toMatch(/tap the orb/i);
+ expect(screen.getByTestId("deck-orb-caption").textContent).toMatch(
+ /say the wake word/i,
+ );
+ expect(screen.getByTestId("deck-voice-action")).toBeTruthy();
+ });
+
+ it("starts voice directly from the deck instead of opening another orb", async () => {
+ const openBubble = vi.fn();
+ renderGrid(FOUR, { voiceOpen: false, onToggleVoice: openBubble });
+ toDeck();
+
+ fireEvent.click(screen.getByTestId("deck-orb"));
+
+ await waitFor(() => expect(voiceApi.requestVoiceCall).toHaveBeenCalledTimes(1));
+ expect(openBubble).not.toHaveBeenCalled();
+ });
+
+ it("shows live speech and lets the same control end the conversation", async () => {
+ deckVoice.state = "listening";
+ deckVoice.transcription = "hand the test failure to T2";
+ renderGrid();
+ toDeck();
+
+ expect(screen.getByTestId("deck-orb-caption").textContent).toContain(
+ "hand the test failure to T2",
+ );
+ fireEvent.click(screen.getByTestId("deck-voice-action"));
+
+ await waitFor(() => expect(voiceApi.requestVoiceHangup).toHaveBeenCalledTimes(1));
});
it("has no seams to drag — there is no layout to size here", () => {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index 42bb456490..dee7b0484f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -74,7 +74,7 @@ import { DeckStage, type DeckAgent } from "./deck/DeckStage";
import type { CardState } from "./deck/AgentCard";
import { useDeckQueue } from "./deck/useDeckQueue";
import { PaneNotifications } from "./PaneNotifications";
-import { isVoiceActive } from "./VoiceBubble";
+import { isVoiceActive } from "./useVoiceCall";
import { PromptPreview } from "./PromptPreview";
import { PromptEditor } from "./PromptEditor";
import { WorkspaceSettings } from "./WorkspaceSettings";
@@ -1126,16 +1126,6 @@ export function AgenticGrid({
* describing a terminal differently from the grid beside it.
*/
const deck = useDeckQueue(deckView && onScreen);
- /*
- * The orb's state, read straight from the store the voice pipeline feeds.
- *
- * Subscribed in this very large component only because the deck's orb is
- * ON it — the floating bubble keeps its own subscription for exactly the
- * opposite reason (see VoiceBubble: it exists so voice state does not
- * re-render every terminal). The cost is paid back by the selector being a
- * single string: it changes a handful of times per turn, not per frame.
- */
- const voiceState = (useEventStore((s) => s.voiceState) ?? "idle") as VoiceState;
const deckAgents: DeckAgent[] = useMemo(() => {
if (!deckView) return [];
return session.terminals
@@ -3201,9 +3191,6 @@ export function AgenticGrid({
<div className="absolute inset-0 z-10">
<DeckStage
agents={deckAgents}
- voiceState={voiceState}
- listening={voiceOpen && isVoiceActive(voiceState)}
- onToggleVoice={onToggleVoice}
expanded={deckExpanded}
onToggleExpand={toggleDeckExpand}
onToggleHold={toggleDeckHold}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx
index e06e58ec3c..bebc76f03d 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceBubble.tsx
@@ -66,7 +66,6 @@ import { cn } from "@/lib/utils";
import { useEventStore, type VoiceState } from "@/store/events";
import {
fetchTtsVolume,
- requestVoiceCall,
requestVoiceHangup,
setTtsVolume,
} from "@/lib/voiceApi";
@@ -86,6 +85,7 @@ import {
} from "./paneDrop";
import { VoiceOrb } from "./VoiceOrb";
import { VoiceBubbleNotice } from "./VoiceBubbleNotice";
+import { useVoiceCall } from "./useVoiceCall";
const OPEN_KEY = "jarvis.agenticIde.voiceBubbleOpen";
const POS_KEY = "jarvis.agenticIde.voiceBubblePos";
@@ -169,18 +169,6 @@ const STATUS_KEY: Record<VoiceState, string> = {
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 {
@@ -235,14 +223,13 @@ export function VoiceBubble({
onJumpToPane?: (workspaceId: string, pane: string) => void;
}) {
const t = useT();
- const voiceState = (useEventStore((s) => s.voiceState) ?? "idle") as VoiceState;
+ const { active, busy, connecting, toggleCall, voiceState } = useVoiceCall();
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[]>([]);
@@ -250,7 +237,6 @@ export function VoiceBubble({
const fileInputRef = useRef<HTMLInputElement>(null);
const prevVolumeRef = useRef(1);
- const active = isVoiceActive(voiceState);
const mounted = open && onScreen;
/*
@@ -413,27 +399,6 @@ export function VoiceBubble({
}, [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
@@ -632,7 +597,7 @@ export function VoiceBubble({
if (dropPhase === "over") setDropPhase("idle");
}}
onDrop={(event) => void handleDrop(event)}
- disabled={busy || dropPhase === "reading"}
+ disabled={busy || connecting || dropPhase === "reading"}
aria-pressed={active}
title={
active
@@ -661,7 +626,7 @@ export function VoiceBubble({
? "[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",
+ (busy || connecting || dropPhase === "reading") && "cursor-wait opacity-80",
)}
>
<VoiceOrb state={voiceState} size={132} />
@@ -809,7 +774,7 @@ export function VoiceBubble({
type="button"
data-no-drag
data-testid="voice-bubble-mic"
- disabled={busy}
+ disabled={busy || connecting}
aria-pressed={active}
onClick={() => void toggleCall()}
title={
diff --git a/jarvis/ui/web/frontend/src/components/agentic/deck/DeckStage.tsx b/jarvis/ui/web/frontend/src/components/agentic/deck/DeckStage.tsx
index 92be13418c..fade5e9023 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/deck/DeckStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/deck/DeckStage.tsx
@@ -27,10 +27,12 @@
* says so. A voice-first surface that looks identical whether or not it is
* listening is the single most uncomfortable thing it could be.
*/
-import { Mic, Plus } from "lucide-react";
+import { AudioLines, Mic, MicOff, Plus } from "lucide-react";
+import { useT } from "@/i18n";
import { cn } from "@/lib/utils";
+import { useEventStore, type VoiceState } from "@/store/events";
import { VoiceOrb } from "../VoiceOrb";
-import type { VoiceState } from "@/store/events";
+import { useVoiceCall } from "../useVoiceCall";
import type { DeckReport } from "@/lib/agenticIdeApi";
import { AgentCard, type CardState } from "./AgentCard";
import { ReportLane } from "./ReportLane";
@@ -45,10 +47,6 @@ export interface DeckAgent {
export interface DeckStageProps {
agents: DeckAgent[];
- voiceState: VoiceState;
- /** Is a conversation open right now? Drives the orb's caption, not the orb. */
- listening: boolean;
- onToggleVoice?: () => void;
expanded: string | null;
onToggleExpand: (name: string) => void;
onToggleHold: (name: string) => void;
@@ -63,11 +61,48 @@ export interface DeckStageProps {
onWake: () => void;
}
+const VOICE_STATUS_KEY: Record<VoiceState, string> = {
+ idle: "agentic_grid.voice_bubble.ready",
+ connecting: "voice_state.connecting",
+ 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",
+};
+
+function voiceDetail(
+ t: (key: string) => string,
+ state: VoiceState,
+ assistantName: string,
+): string {
+ if (state === "idle") {
+ return t("agentic_grid.voice_bubble.talk_title").replace("{0}", assistantName);
+ }
+ if (state === "connecting") return t("voice_state.warming_hint");
+ if (state === "listening") return t("voice_state.ready_title");
+ if (state === "thinking") return t("sidebar.realtime_working");
+ if (state === "error") return t("sidebar.realtime_error");
+ return t(VOICE_STATUS_KEY[state]);
+}
+
+function voiceHeadline(
+ t: (key: string) => string,
+ state: VoiceState,
+ assistantName: string,
+): string {
+ if (state === "idle") {
+ return t("agentic_grid.voice_bubble.talk").replace("{0}", assistantName);
+ }
+ if (state === "connecting") return t("voice_state.warming_title");
+ if (state === "listening") return t("voice_state.ready_title");
+ if (state === "thinking") return t("sidebar.realtime_working");
+ if (state === "error") return t("sidebar.realtime_error");
+ return t(VOICE_STATUS_KEY[state]);
+}
+
export function DeckStage({
agents,
- voiceState,
- listening,
- onToggleVoice,
expanded,
onToggleExpand,
onToggleHold,
@@ -80,6 +115,18 @@ export function DeckStage({
onDropReport,
onWake,
}: DeckStageProps) {
+ const t = useT();
+ const { active, busy, connecting, toggleCall, voiceState } = useVoiceCall();
+ const transcription = (useEventStore((store) => store.transcription) ?? "").trim();
+ const assistantName =
+ (useEventStore((store) => store.assistantName) ?? "").trim() ||
+ t("agentic_grid.voice_bubble.assistant_fallback");
+ const disabled = busy || connecting;
+ const status = t(VOICE_STATUS_KEY[voiceState]);
+ const headline = voiceHeadline(t, voiceState, assistantName);
+ const liveTranscript = active ? transcription : "";
+ const detail = liveTranscript || voiceDetail(t, voiceState, assistantName);
+
return (
<div
data-testid="deck-stage"
@@ -91,33 +138,128 @@ export function DeckStage({
Both are buttons onto the same handler the bubble uses — a second
voice control with its own behaviour is two things to keep in step.
*/}
- <div className="flex shrink-0 flex-col items-center gap-3 pt-4">
- <button
- type="button"
- data-testid="deck-orb"
- onClick={onToggleVoice}
- disabled={!onToggleVoice}
- aria-pressed={listening}
- aria-label={listening ? "Hang up" : "Start talking to Jarvis"}
- className={cn(
- "rounded-full transition-transform",
- onToggleVoice
- ? "hover:scale-[1.02] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60"
- : "cursor-default",
- )}
- >
- <VoiceOrb state={voiceState} size={132} />
- </button>
- <p
- data-testid="deck-orb-caption"
- className="flex items-center gap-1.5 text-xs text-muted-foreground"
- >
- <Mic className={cn("h-3 w-3 shrink-0", listening && "text-primary")} />
- {listening
- ? "Listening — say what you want done."
- : "Tap the orb or say the wake word to hand out work."}
- </p>
- </div>
+ <section
+ data-testid="deck-voice-control"
+ data-state={voiceState}
+ aria-labelledby="deck-voice-title"
+ className={cn(
+ "relative isolate w-full max-w-2xl shrink-0 overflow-hidden rounded-[1.75rem] border",
+ "border-border/70 bg-card/80 px-4 py-3 shadow-[0_18px_55px_-30px_rgb(var(--scrim-rgb)/0.8)]",
+ "backdrop-blur-xl sm:px-6 sm:py-4",
+ active && "border-primary/35 shadow-[0_18px_60px_-28px_rgb(var(--accent-rgb)/0.5)]",
+ )}
+ >
+ <span
+ aria-hidden
+ className="pointer-events-none absolute -right-16 -top-24 h-64 w-64 rounded-full bg-primary/10 blur-3xl"
+ />
+ <div className="relative flex flex-col items-center gap-3 sm:flex-row sm:gap-6">
+ <div
+ data-state={voiceState}
+ className="agentic-voice-orb-stage relative grid h-32 w-32 shrink-0 place-items-center sm:h-36 sm:w-36"
+ >
+ <span
+ aria-hidden
+ className="agentic-voice-orb-ring agentic-voice-orb-ring-a"
+ />
+ <span
+ aria-hidden
+ className="agentic-voice-orb-ring agentic-voice-orb-ring-b"
+ />
+ <button
+ type="button"
+ data-testid="deck-orb"
+ onClick={() => void toggleCall()}
+ disabled={disabled}
+ aria-pressed={active}
+ aria-label={
+ active
+ ? t("agentic_grid.voice_bubble.hang_up")
+ : t("agentic_grid.voice_bubble.talk").replace("{0}", assistantName)
+ }
+ title={
+ active
+ ? t("agentic_grid.voice_bubble.hang_up_title")
+ : t("agentic_grid.voice_bubble.talk_title").replace(
+ "{0}",
+ assistantName,
+ )
+ }
+ className={cn(
+ "relative z-10 rounded-full outline-none transition-[transform,filter,opacity] duration-500",
+ "drop-shadow-[0_12px_24px_rgba(0,0,0,0.32)]",
+ "hover:scale-[1.025] active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-primary/60",
+ "motion-reduce:transform-none disabled:cursor-wait disabled:opacity-70",
+ active || connecting
+ ? "[filter:saturate(1)_brightness(1)]"
+ : "[filter:saturate(0.5)_brightness(0.82)] hover:[filter:saturate(0.78)_brightness(0.94)]",
+ )}
+ >
+ <VoiceOrb state={voiceState} size={116} />
+ </button>
+ </div>
+
+ <div className="flex min-w-0 flex-1 flex-col items-center text-center sm:items-start sm:text-left">
+ <div className="mb-1.5 inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/55 px-2.5 py-1">
+ <span
+ aria-hidden
+ data-state={voiceState}
+ className="agentic-voice-state-dot"
+ />
+ <span className="text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground">
+ {status}
+ </span>
+ </div>
+ <h2
+ id="deck-voice-title"
+ className="text-lg font-semibold tracking-tight text-foreground sm:text-xl"
+ >
+ {headline}
+ </h2>
+ <p
+ data-testid="deck-orb-caption"
+ aria-live="polite"
+ className={cn(
+ "mt-1 line-clamp-2 min-h-10 max-w-md text-sm leading-relaxed text-muted-foreground",
+ liveTranscript && "text-foreground/80",
+ )}
+ >
+ {detail}
+ </p>
+ <button
+ type="button"
+ data-testid="deck-voice-action"
+ onClick={() => void toggleCall()}
+ disabled={disabled}
+ aria-pressed={active}
+ className={cn(
+ "mt-2.5 inline-flex min-h-9 items-center gap-2 rounded-full border px-4 py-2 text-xs font-semibold",
+ "transition-[background-color,color,border-color,transform] hover:-translate-y-px active:translate-y-0",
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 disabled:cursor-wait disabled:opacity-60",
+ active
+ ? "border-destructive/30 bg-destructive/10 text-destructive hover:bg-destructive/15"
+ : "border-primary/30 bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",
+ )}
+ >
+ {active ? (
+ <MicOff className="h-3.5 w-3.5 shrink-0" />
+ ) : connecting ? (
+ <AudioLines className="h-3.5 w-3.5 shrink-0 animate-pulse motion-reduce:animate-none" />
+ ) : (
+ <Mic className="h-3.5 w-3.5 shrink-0" />
+ )}
+ {active
+ ? t("agentic_grid.voice_bubble.mic_stop")
+ : connecting
+ ? t("voice_state.connecting")
+ : t("agentic_grid.voice_bubble.mic_start").replace(
+ "{0}",
+ assistantName,
+ )}
+ </button>
+ </div>
+ </div>
+ </section>
{/* The room. One card per agent, laid out as a table rather than a list. */}
{agents.length === 0 ? (
diff --git a/jarvis/ui/web/frontend/src/components/agentic/useVoiceCall.ts b/jarvis/ui/web/frontend/src/components/agentic/useVoiceCall.ts
new file mode 100644
index 0000000000..098f49d121
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentic/useVoiceCall.ts
@@ -0,0 +1,60 @@
+import { useCallback, useState } from "react";
+import { useT } from "@/i18n";
+import { requestVoiceCall, requestVoiceHangup } from "@/lib/voiceApi";
+import { useEventStore, type VoiceState } from "@/store/events";
+
+/**
+ * Whether the next voice-control press should end the current conversation.
+ * Paused still belongs to the open call; connecting is kept separate so the
+ * controls can stay disabled while the transport negotiates.
+ */
+export function isVoiceActive(state: VoiceState): boolean {
+ return (
+ state === "listening" ||
+ state === "thinking" ||
+ state === "speaking" ||
+ state === "paused"
+ );
+}
+
+/**
+ * The one start/stop path shared by every Agentic IDE voice surface.
+ *
+ * Keeping the request and its user-visible failure handling here prevents the
+ * command deck and floating bubble from becoming two controls that look alike
+ * but behave differently.
+ */
+export function useVoiceCall() {
+ const t = useT();
+ const voiceState = (useEventStore((store) => store.voiceState) ?? "idle") as VoiceState;
+ const pushToast = useEventStore((store) => store.pushToast);
+ const [busy, setBusy] = useState(false);
+ const active = isVoiceActive(voiceState);
+
+ const toggleCall = useCallback(async () => {
+ if (busy || voiceState === "connecting") return;
+ setBusy(true);
+ try {
+ if (active) {
+ await requestVoiceHangup();
+ } else {
+ const { armed } = await requestVoiceCall();
+ if (!armed) {
+ pushToast("warning", t("agentic_grid.voice_bubble.start_failed"));
+ }
+ }
+ } catch (error) {
+ pushToast("error", (error as Error).message);
+ } finally {
+ setBusy(false);
+ }
+ }, [active, busy, pushToast, t, voiceState]);
+
+ return {
+ active,
+ busy,
+ connecting: voiceState === "connecting",
+ toggleCall,
+ voiceState,
+ };
+}