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(home): a voice session opened from the voice stage stays on the voice stage
rubenluetke10-beep55a3920af999
diff --git a/jarvis/ui/web/frontend/src/components/home/RecentChats.test.tsx b/jarvis/ui/web/frontend/src/components/home/RecentChats.test.tsxnew file mode 100644index 0000000000..f9a1518a18--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/home/RecentChats.test.tsx@@ -0,0 +1,82 @@+import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++import { RecentChats } from "@/components/home/RecentChats";+import { useEventStore, type ConversationSummary } from "@/store/events";+import { useHomeStore } from "@/store/home";++function row(kind: ConversationSummary["kind"], id: string, title: string): ConversationSummary {+ return { kind, id, title, preview: title, created_ms: 500, updated_ms: 1_000, message_count: 2 };+}++const DETAIL = {+ kind: "voice",+ id: "v1",+ title: "Voice session",+ messages: [+ { role: "user", text: "hello", ts_ms: 1_000 },+ { role: "assistant", text: "Hi there.", ts_ms: 2_000 },+ ],+ seeded_turns: 2,+};++async function flush() {+ await act(async () => {+ await Promise.resolve();+ await Promise.resolve();+ });+}++describe("RecentChats", () => {+ beforeEach(() => {+ vi.stubGlobal(+ "fetch",+ vi.fn(async (url: string) =>+ String(url).endsWith("/resume")+ ? new Response(JSON.stringify(DETAIL), { status: 200 })+ : new Response(JSON.stringify([]), { status: 200 }),+ ),+ );+ useEventStore.setState({+ conversations: [row("voice", "v1", "Spoken thread"), row("text", "t1", "Typed thread")],+ activeThreadId: null,+ messages: [],+ activeSection: "board",+ });+ useHomeStore.setState({ surface: "voice", transcript: [] });+ });+ afterEach(() => {+ cleanup();+ vi.unstubAllGlobals();+ });++ it("keeps a voice session on the voice surface and loads its words into the lane", async () => {+ render(<RecentChats />);+ fireEvent.click(screen.getByTitle("Spoken thread"));+ await flush();+ expect(useHomeStore.getState().surface).toBe("voice");+ expect(useEventStore.getState().activeSection).toBe("chats");+ expect(useEventStore.getState().activeThreadId).toBe("v1");+ expect(useHomeStore.getState().transcript.map((l) => [l.who, l.text])).toEqual([+ ["user", "hello"],+ ["assistant", "Hi there."],+ ]);+ });++ it("opens a text thread on the chat surface even from the voice stage", async () => {+ render(<RecentChats />);+ fireEvent.click(screen.getByTitle("Typed thread"));+ await flush();+ expect(useHomeStore.getState().surface).toBe("chat");+ expect(useHomeStore.getState().transcript).toEqual([]);+ });++ it("opens a voice session on the chat surface when that is where you are", async () => {+ useHomeStore.setState({ surface: "chat" });+ render(<RecentChats />);+ fireEvent.click(screen.getByTitle("Spoken thread"));+ await flush();+ expect(useHomeStore.getState().surface).toBe("chat");+ expect(useHomeStore.getState().transcript).toEqual([]);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/home/RecentChats.tsx b/jarvis/ui/web/frontend/src/components/home/RecentChats.tsxindex 98190ea604..0abdebff08 100644--- a/jarvis/ui/web/frontend/src/components/home/RecentChats.tsx+++ b/jarvis/ui/web/frontend/src/components/home/RecentChats.tsx@@ -5,6 +5,7 @@ import { useConversations } from "@/hooks/useConversations";import { useEventStore, type ConversationSummary } from "@/store/events";import { useHomeStore } from "@/store/home";import { useT } from "@/i18n";+import { transcriptFromMessages } from "@/lib/homeTranscript";import { cn } from "@/lib/utils";import { SidebarGroup } from "@/components/home/SidebarGroup";@@ -16,9 +17,14 @@ export const RECENT_CHATS_UNFOLDED = 15;* from the sidebar. This block is the one long-lived poller of the history* (`useConversations({ poll: true })`); the chat stage reads the same store.*- * Opening a row resumes it on the CHAT surface: that is where a stored- * thread can be read and continued by typing. The voice surface shows the- * live turn, not an archive.+ * Opening a row resumes it — the backend seeds the shared brain, so the next+ * turn continues it whether typed or spoken — and lands on the surface that+ * fits (maintainer, 2026-08-23): a VOICE session opened while the voice+ * stage is up stays there, its words loaded into the transcript lane, so+ * you just keep talking. Everything else (a text thread, or any row opened+ * from the chat surface) goes to the chat surface, where a thread is read+ * and continued by typing. Reading the surface at click time, not via a+ * subscription, keeps the list from re-rendering on every switch.*/export function RecentChats() {const t = useT();@@ -27,6 +33,19 @@ export function RecentChats() {const [open, setOpen] = useState(false);const setActive = useEventStore((s) => s.setActiveSection);const setSurface = useHomeStore((s) => s.setSurface);+ const seedTranscript = useHomeStore((s) => s.seedTranscript);++ const openRow = (c: ConversationSummary) => {+ const stayOnVoice = c.kind === "voice" && useHomeStore.getState().surface === "voice";+ const opened = openConversation(c.kind, c.id);+ if (stayOnVoice) {+ void opened.then((messages) => seedTranscript(transcriptFromMessages(messages)));+ } else {+ void opened;+ setSurface("chat");+ }+ setActive("chats");+ };const shown = conversations.slice(0, open ? RECENT_CHATS_UNFOLDED : RECENT_CHATS_FOLDED);const canExpand = conversations.length > RECENT_CHATS_FOLDED;@@ -54,11 +73,7 @@ export function RecentChats() {key={`${c.kind}-${c.id}`}conversation={c}active={c.id === activeThreadId}- onOpen={() => {- void openConversation(c.kind, c.id);- setSurface("chat");- setActive("chats");- }}+ onOpen={() => openRow(c)}onDelete={() => void removeConversation(c.id)}/>))}diff --git a/jarvis/ui/web/frontend/src/hooks/useConversations.ts b/jarvis/ui/web/frontend/src/hooks/useConversations.tsindex e6484e315b..ec10470cb3 100644--- a/jarvis/ui/web/frontend/src/hooks/useConversations.ts+++ b/jarvis/ui/web/frontend/src/hooks/useConversations.ts@@ -1,6 +1,6 @@import { useCallback, useEffect } from "react";-import { useEventStore, type ConversationKind } from "@/store/events";+import { useEventStore, type ChatMessage, type ConversationKind } from "@/store/events";import {deleteTextConversation,detailToMessages,@@ -45,15 +45,23 @@ export function useConversations({ poll = false }: { poll?: boolean } = {}) {return () => window.clearInterval(id);}, [poll, refresh]);+ /**+ * Make a conversation the active one and resume it on the backend (the+ * brain is seeded with it, so the next typed OR spoken turn continues it).+ * Resolves to the stored messages — empty when the backend had none or+ * could not be reached — so a caller can show them elsewhere too.+ */const openConversation = useCallback(- async (kind: ConversationKind, id: string) => {+ async (kind: ConversationKind, id: string): Promise<ChatMessage[]> => {setActiveConversation(kind, id);+ let messages: ChatMessage[] = [];try {- const detail = await resumeConversation(kind, id);- setMessages(detailToMessages(detail));+ messages = detailToMessages(await resumeConversation(kind, id));} catch {- setMessages([]);+ /* unreachable / gone — an empty thread is the honest view */}+ setMessages(messages);+ return messages;},[setActiveConversation, setMessages],);diff --git a/jarvis/ui/web/frontend/src/lib/homeTranscript.test.ts b/jarvis/ui/web/frontend/src/lib/homeTranscript.test.tsindex 10cd6b4713..51bb91dac8 100644--- a/jarvis/ui/web/frontend/src/lib/homeTranscript.test.ts+++ b/jarvis/ui/web/frontend/src/lib/homeTranscript.test.ts@@ -4,6 +4,7 @@ import {LATE_ATTACH_MS,STALE_TURN_MS,reduceTranscript,+ transcriptFromMessages,type TranscriptLine,type TranscriptStepsLine,} from "@/lib/homeTranscript";@@ -218,3 +219,40 @@ describe("homeTranscript reducer — steps per turn", () => {expect(stepsLine(lines).steps.length).toBe(MAX_THINKING_STEPS);});});++describe("transcriptFromMessages", () => {+ it("keeps the words of a stored conversation and drops UI-only roles", () => {+ const lines = transcriptFromMessages([+ { role: "user", content: " what's the weather ", ts: 1_000 },+ { role: "preamble", content: "One moment", ts: 1_500 },+ { role: "assistant", content: "Sunny, 24 degrees.", ts: 2_000 },+ { role: "assistant", content: " ", ts: 2_500 },+ ]);+ expect(shape(lines)).toEqual([+ ["user", "what's the weather"],+ ["assistant", "Sunny, 24 degrees."],+ ]);+ expect(lines.map((l) => l.ts)).toEqual([1_000, 2_000]);+ });++ it("lets live events append after the archive without joining old lines", () => {+ const seeded = transcriptFromMessages([+ { role: "user", content: "hello", ts: 1_000 },+ { role: "assistant", content: "Hi there.", ts: 2_000 },+ ]);+ const now = 5_000_000;+ const lines = run(+ [+ ["TranscriptFinal", { transcript: { text: "and now?" } }, now],+ ["SpeechSpoken", { text: "Still here.", spoken_kind: "reply" }, now + 800],+ ],+ seeded,+ );+ expect(shape(lines)).toEqual([+ ["user", "hello"],+ ["assistant", "Hi there."],+ ["user", "and now?"],+ ["assistant", "Still here."],+ ]);+ });+});diff --git a/jarvis/ui/web/frontend/src/lib/homeTranscript.ts b/jarvis/ui/web/frontend/src/lib/homeTranscript.tsindex 51844ee8a8..d216c2a734 100644--- a/jarvis/ui/web/frontend/src/lib/homeTranscript.ts+++ b/jarvis/ui/web/frontend/src/lib/homeTranscript.ts@@ -326,6 +326,29 @@ function reduceSteps(return cap([...lines, line]);}+/**+ * A stored conversation as transcript lines — what the voice stage shows+ * when a past voice session is reopened WITHOUT leaving the voice surface+ * (sidebar recent chats, 2026-08-23): you pick up where you left off and+ * keep talking. Only the words survive (user / assistant); a stored thread+ * carries no step trace, and UI-only roles (a preamble bubble, a system+ * note) are not part of the conversation. The reducer appends live events+ * after these lines as usual — their timestamps are old, so no live piece+ * ever joins or dedups against an archived line.+ */+export function transcriptFromMessages(+ messages: ReadonlyArray<{ role: string; content: string; ts: number }>,+): TranscriptLine[] {+ const lines: TranscriptLine[] = [];+ for (const m of messages) {+ if (m.role !== "user" && m.role !== "assistant") continue;+ const text = clean(m.content);+ if (!text) continue;+ lines.push({ id: nextId(m.ts), ts: m.ts, who: m.role, text });+ }+ return cap(lines);+}+export function reduceTranscript(lines: TranscriptLine[],name: string,diff --git a/jarvis/ui/web/frontend/src/store/home.ts b/jarvis/ui/web/frontend/src/store/home.tsindex c44427f84a..8793ccd5fe 100644--- a/jarvis/ui/web/frontend/src/store/home.ts+++ b/jarvis/ui/web/frontend/src/store/home.ts@@ -20,6 +20,11 @@ interface HomeStore {/** What was said and answered, oldest first (lib/homeTranscript.ts). */transcript: TranscriptLine[];ingest: (name: string, payload: unknown, tsMs: number) => void;+ /**+ * Replace the lane with a stored conversation (a reopened voice session);+ * live events append after it.+ */+ seedTranscript: (lines: TranscriptLine[]) => void;/** Tests and a fresh session. */resetTranscript: () => void;}@@ -36,5 +41,6 @@ export const useHomeStore = create<HomeStore>((set, get) => ({const after = reduceTranscript(before, name, payload, tsMs);if (after !== before) set({ transcript: after });},+ seedTranscript: (lines) => set({ transcript: lines }),resetTranscript: () => set({ transcript: [] }),}));