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
fix(voice): start a seeded call when continuing a spoken thread
rubenluetke10-beep3fc9e4d06543
diff --git a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsxindex 11baaa05b2..6a66fc0424 100644--- a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx+++ b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx@@ -8,6 +8,7 @@ import type { AgentChatCatalog, AgentChatEvent } from "@/lib/agentChatApi";import { AgentChatStoreProvider } from "@/components/agentchat/AgentChatStoreContext";import { useAgentChatStore, useAgentSessionStore } from "@/store/agentChat";import { useEventStore } from "@/store/events";+import { useHomeStore } from "@/store/home";const CATALOG: AgentChatCatalog = {default_cwd: "C:\\work",@@ -735,6 +736,60 @@ describe("ChatStage (agent chat)", () => {expect(screen.getByTestId("continue-by-voice")).toBeTruthy();});+ it("continues a spoken thread by starting a call seeded with it", async () => {+ const fetchMock = vi.fn(async () =>+ new Response(JSON.stringify({ armed: true, seeded_turns: 2 }), { status: 200 }),+ );+ vi.stubGlobal("fetch", fetchMock);+ useAgentChatStore.setState({ activeSessionId: null, timeline: EMPTY_TIMELINE });+ useHomeStore.setState({ surface: "chat", jarvisCardMode: "chat", transcript: [] });+ useEventStore.setState({+ activeKind: "voice",+ activeThreadId: "v1",+ messages: [+ { id: "m1", role: "user", content: "set a timer", ts: 1 },+ { id: "m2", role: "assistant", content: "Ten minutes, running.", ts: 2 },+ ],+ thinkingTraces: {},+ });+ render(<ChatStage />);++ await act(async () => {+ fireEvent.click(screen.getByTestId("continue-by-voice"));+ });++ // The call itself starts — switching the screen alone left a silent orb.+ expect(fetchMock).toHaveBeenCalledWith("/api/chats/voice/v1/speak", { method: "POST" });+ expect(useHomeStore.getState().surface).toBe("voice");+ expect(useHomeStore.getState().jarvisCardMode).toBe("voice");+ expect(useHomeStore.getState().transcript.length).toBe(2);+ vi.unstubAllGlobals();+ });++ it("says so when the seeded call could not start", async () => {+ vi.stubGlobal(+ "fetch",+ vi.fn(async () => new Response(JSON.stringify({ armed: false, seeded_turns: 0 }), { status: 200 })),+ );+ const pushToast = vi.fn();+ useAgentChatStore.setState({ activeSessionId: null, timeline: EMPTY_TIMELINE });+ useEventStore.setState({+ activeKind: "voice",+ activeThreadId: "v1",+ messages: [{ id: "m1", role: "user", content: "set a timer", ts: 1 }],+ thinkingTraces: {},+ pushToast,+ });+ render(<ChatStage />);++ await act(async () => {+ fireEvent.click(screen.getByTestId("continue-by-voice"));+ });++ expect(pushToast).toHaveBeenCalledWith("warning", expect.any(String));+ vi.unstubAllGlobals();+ });+it("gives the stage back to the agent chat once a session is open", () => {useEventStore.setState({ activeKind: "voice", activeThreadId: "v1", messages: [] });useAgentChatStore.setState({ activeSessionId: "s1", timeline: EMPTY_TIMELINE });diff --git a/jarvis/ui/web/frontend/src/components/home/VoiceThreadStage.tsx b/jarvis/ui/web/frontend/src/components/home/VoiceThreadStage.tsxindex a5820f3565..1f63e4668a 100644--- a/jarvis/ui/web/frontend/src/components/home/VoiceThreadStage.tsx+++ b/jarvis/ui/web/frontend/src/components/home/VoiceThreadStage.tsx@@ -1,9 +1,10 @@import { ChatMarkdown } from "@/components/agentchat/ChatMarkdown";-import { useLayoutEffect, useMemo } from "react";+import { useLayoutEffect, useMemo, useRef, useState } from "react";import { AudioLines, Mic } from "lucide-react";import { useEventStore, type ChatMessage } from "@/store/events";import { useHomeStore } from "@/store/home";+import { ChatsApiError, speakInConversation } from "@/lib/chatsApi";import { ScrollArea } from "@/components/ui/scroll-area";import { ScrollToEndButton } from "@/components/ui/scroll-to-end-button";import { useStickToBottom } from "@/hooks/useStickToBottom";@@ -24,8 +25,11 @@ import { cn } from "@/lib/utils";* screen: the words were loaded into a store the stage did not read.** "Continue by voice" hands the thread to the voice stage with its words- * already in the lane — the same seeding the sidebar does when you open a- * voice session while standing on that stage.+ * already in the lane AND starts the call: the backend re-seeds the brain+ * with this thread and arms the microphone (POST .../speak). Switching the+ * screen alone left the user in front of a silent orb, and whatever had+ * happened since the row was opened (a new-run reset after a hangup, another+ * call) had already spent the one-shot seed from opening it.*/export function VoiceThreadStage({ onContinueByVoice }: { onContinueByVoice?: () => void } = {}) {const t = useT();@@ -34,6 +38,10 @@ export function VoiceThreadStage({ onContinueByVoice }: { onContinueByVoice?: ()const conversations = useEventStore((s) => s.conversations);const setSurface = useHomeStore((s) => s.setSurface);const seedTranscript = useHomeStore((s) => s.seedTranscript);+ const setJarvisCardMode = useHomeStore((s) => s.setJarvisCardMode);+ const pushToast = useEventStore((s) => s.pushToast);+ const [starting, setStarting] = useState(false);+ const startingRef = useRef(false);const title = useMemo(() => conversations.find((c) => c.kind === "voice" && c.id === activeThreadId)?.title ?? "",@@ -46,16 +54,34 @@ export function VoiceThreadStage({ onContinueByVoice }: { onContinueByVoice?: ()const { rootRef, contentRef, atEnd, jumpToEnd, follow } = useStickToBottom();useLayoutEffect(follow, [follow, activeThreadId, messages.length]);- const continueByVoice = () => {+ const continueByVoice = async () => {+ if (startingRef.current) return;+ const threadId = activeThreadId;// Inside the Jarvis agent card the caller owns the Voice | Chat half, so- // it takes over (seeding the lane and showing the voice stage itself);- // everywhere else this is the front page's own surface switch.+ // it takes over the display (seeding the lane and showing the voice+ // stage itself); everywhere else this is the front page's surface switch.if (onContinueByVoice) {onContinueByVoice();- return;+ } else {+ seedTranscript(transcriptFromMessages(messages));+ setSurface("voice");+ setJarvisCardMode("voice");+ }+ if (!threadId) return;+ startingRef.current = true;+ setStarting(true);+ try {+ const { armed } = await speakInConversation("voice", threadId);+ // Not armed: a call is still running or the window is hidden. The+ // backend seeds nothing then, so say so instead of a silent orb.+ if (!armed) pushToast("warning", t("voice_thread.continue_busy"));+ } catch (error) {+ const unavailable = error instanceof ChatsApiError && error.status === 503;+ pushToast(unavailable ? "warning" : "error", t("chats_view.speak_unavailable"));+ } finally {+ startingRef.current = false;+ setStarting(false);}- seedTranscript(transcriptFromMessages(messages));- setSurface("voice");};return (@@ -101,12 +127,14 @@ export function VoiceThreadStage({ onContinueByVoice }: { onContinueByVoice?: ()</p><buttontype="button"- onClick={continueByVoice}+ onClick={() => void continueByVoice()}+ disabled={starting}data-testid="continue-by-voice"className={cn("flex shrink-0 items-center gap-2 rounded-xl border border-primary/40 bg-primary/10 px-3 py-1.5","text-xs font-medium text-primary transition-colors hover:bg-primary/20","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ "disabled:cursor-default disabled:opacity-60",)}><AudioLines aria-hidden className="h-3.5 w-3.5" />diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 03b13458bb..7a6a80f747 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -5148,7 +5148,8 @@"subtitle": "Gesprochene Unterhaltung · {count} Beiträge","empty": "In dieser Sitzung wurde nichts aufgezeichnet.","read_only": "Eine gesprochene Unterhaltung. Sprich weiter, um sie fortzusetzen.",- "continue": "Per Sprache fortsetzen"+ "continue": "Per Sprache fortsetzen",+ "continue_busy": "Der Anruf konnte nicht starten. Beende den laufenden Anruf oder hol die App nach vorne und versuch es erneut."},"ready_note": {"title": "Alle Lichter grün.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 6e6c97ace5..e988af59f7 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -5181,7 +5181,8 @@"subtitle": "Spoken conversation · {count} turns","empty": "Nothing was recorded in this session.","read_only": "A spoken conversation. Continue it by talking.",- "continue": "Continue by voice"+ "continue": "Continue by voice",+ "continue_busy": "The call could not start. End the running call or bring the app to the front, then try again."},"ready_note": {"title": "All lights green.",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex c8c71cfb60..657947bcbb 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -5148,7 +5148,8 @@"subtitle": "Conversación hablada · {count} turnos","empty": "No se grabó nada en esta sesión.","read_only": "Una conversación hablada. Continúala hablando.",- "continue": "Continuar por voz"+ "continue": "Continuar por voz",+ "continue_busy": "La llamada no pudo iniciarse. Termina la llamada en curso o trae la app al frente e inténtalo de nuevo."},"ready_note": {"title": "Todo en verde.",diff --git a/jarvis/ui/web/frontend/src/lib/chatsApi.ts b/jarvis/ui/web/frontend/src/lib/chatsApi.tsindex bb8bc812a0..15371d8867 100644--- a/jarvis/ui/web/frontend/src/lib/chatsApi.ts+++ b/jarvis/ui/web/frontend/src/lib/chatsApi.ts@@ -65,15 +65,23 @@ export async function resumeConversation(});}+/**+ * Start a call that already remembers this conversation: the backend seeds+ * the brain (and the next live call) with its turns and arms the microphone.+ * Queued with the other context changes so a slower archive load can never+ * re-seed a different thread after it.+ */export async function speakInConversation(kind: ConversationKind,id: string,): Promise<{ armed: boolean; seeded_turns: number }> {- const res = await fetch(`/api/chats/${kind}/${encodeURIComponent(id)}/speak`, {- method: "POST",+ return changeContext(async () => {+ const res = await fetch(`/api/chats/${kind}/${encodeURIComponent(id)}/speak`, {+ method: "POST",+ });+ if (!res.ok) throw new ChatsApiError("speak-failed", res.status);+ return (await res.json()) as { armed: boolean; seeded_turns: number };});- if (!res.ok) throw new ChatsApiError("speak-failed", res.status);- return (await res.json()) as { armed: boolean; seeded_turns: number };}/**