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(chat): the IDE's chat and the front page's chat no longer share a store
rubenluetke10-beep9a926f76918a
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentChatStoreContext.test.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentChatStoreContext.test.tsxnew file mode 100644index 0000000000..5b37f33ada--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentChatStoreContext.test.tsx@@ -0,0 +1,53 @@+import { render, screen } from "@testing-library/react";+import { describe, expect, it } from "vitest";++import {+ AgentChatStoreProvider,+ useAgentChat,+ useAgentChatApi,+} from "@/components/agentchat/AgentChatStoreContext";+import { useAgentChatStore, useAgentSessionStore } from "@/store/agentChat";++function Probe() {+ const surface = useAgentChat((s) => s.surface);+ const activeSessionId = useAgentChat((s) => s.activeSessionId);+ const api = useAgentChatApi();+ return (+ <div data-testid="probe" data-surface={surface} data-active={activeSessionId ?? ""}>+ {api.getState().surface}+ </div>+ );+}++describe("the agent-chat store context", () => {+ it("reads the front page's store without a provider", () => {+ useAgentChatStore.setState({ activeSessionId: "front-1" });+ useAgentSessionStore.setState({ activeSessionId: "ide-1" });+ render(<Probe />);+ const probe = screen.getByTestId("probe");+ expect(probe.dataset.surface).toBe("jarvis");+ expect(probe.dataset.active).toBe("front-1");+ expect(probe.textContent).toBe("jarvis");+ });++ it("reads the IDE's store inside its provider — the two chats never mix", () => {+ useAgentChatStore.setState({ activeSessionId: "front-1" });+ useAgentSessionStore.setState({ activeSessionId: "ide-1" });+ render(+ <AgentChatStoreProvider store={useAgentSessionStore}>+ <Probe />+ </AgentChatStoreProvider>,+ );+ const probe = screen.getByTestId("probe");+ expect(probe.dataset.surface).toBe("agent");+ expect(probe.dataset.active).toBe("ide-1");+ expect(probe.textContent).toBe("agent");+ });++ it("keeps the two stores' sessions apart", () => {+ useAgentChatStore.setState({ activeSessionId: "front-2" });+ expect(useAgentSessionStore.getState().activeSessionId).not.toBe("front-2");+ expect(useAgentChatStore.getState().surface).toBe("jarvis");+ expect(useAgentSessionStore.getState().surface).toBe("agent");+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentChatStoreContext.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentChatStoreContext.tsxnew file mode 100644index 0000000000..66ef12f0c1--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentChatStoreContext.tsx@@ -0,0 +1,41 @@+import { createContext, useContext, type ReactNode } from "react";++import { useAgentChatStore, type AgentChatStore, type AgentChatStoreHook } from "@/store/agentChat";++/**+ * Which agent-chat store a chat column reads — the seam between two chats.+ *+ * The front page's Chat section and the Agentic IDE's chat mode wear the same+ * face (`ChatStage`, the composer, the timeline) and are two different chats:+ * the front page is Jarvis with a keyboard (surface `jarvis`), the IDE runs+ * coding-agent sessions in a workspace's folder (surface `agent`). One store+ * per surface keeps their sessions, drafts and sockets apart — and this+ * context tells the shared components WHICH store they are standing on.+ *+ * Without a provider the components read the front page's store, so every+ * existing mount keeps working byte-identically; the IDE wraps its surface in+ * `AgentChatStoreProvider` with the agent store. Opening the IDE's last chat+ * must never put it on the front page again (maintainer, 2026-08-25).+ */+const AgentChatStoreContext = createContext<AgentChatStoreHook>(useAgentChatStore);++export function AgentChatStoreProvider({+ store,+ children,+}: {+ store: AgentChatStoreHook;+ children: ReactNode;+}) {+ return <AgentChatStoreContext.Provider value={store}>{children}</AgentChatStoreContext.Provider>;+}++/** The store hook of the chat this component is mounted in (front page by default). */+export function useAgentChatApi(): AgentChatStoreHook {+ return useContext(AgentChatStoreContext);+}++/** Select from the chat's own store — the drop-in for `useAgentChatStore(selector)`. */+export function useAgentChat<T>(selector: (state: AgentChatStore) => T): T {+ const store = useContext(AgentChatStoreContext);+ return store(selector);+}diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsxindex 3ee16707d6..5bb5987f6a 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx@@ -14,7 +14,8 @@ import {import { Combobox, type ComboboxGroup, type ComboboxOption } from "@/components/ui/combobox";import { ProviderLogo } from "@/components/providers/ProviderLogo";-import { useAgentChatStore, type ProviderOption } from "@/store/agentChat";+import { useAgentChat, useAgentChatApi } from "@/components/agentchat/AgentChatStoreContext";+import type { ProviderOption } from "@/store/agentChat";import { useEventStore } from "@/store/events";import { pickAgentChatFolder } from "@/lib/agentChatApi";import { runningTurn } from "@/components/agentchat/reduce";@@ -70,30 +71,31 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {const pushToast = useEventStore((s) => s.pushToast);const [restarting, setRestarting] = useState(false);- const catalog = useAgentChatStore((s) => s.catalog);- const catalogError = useAgentChatStore((s) => s.catalogError);- const backendOutdated = useAgentChatStore((s) => s.backendOutdated);- const connections = useAgentChatStore((s) => s.connections);- const liveModels = useAgentChatStore((s) => s.liveModels);- const draft = useAgentChatStore((s) => s.draft);- const timeline = useAgentChatStore((s) => s.timeline);- const busy = useAgentChatStore((s) => s.busy);- const lastError = useAgentChatStore((s) => s.lastError);- const setDraft = useAgentChatStore((s) => s.setDraft);- const setPlan = useAgentChatStore((s) => s.setPlan);- const send = useAgentChatStore((s) => s.send);- const cancel = useAgentChatStore((s) => s.cancel);- const loadCatalog = useAgentChatStore((s) => s.loadCatalog);+ const store = useAgentChatApi();+ const catalog = useAgentChat((s) => s.catalog);+ const catalogError = useAgentChat((s) => s.catalogError);+ const backendOutdated = useAgentChat((s) => s.backendOutdated);+ const connections = useAgentChat((s) => s.connections);+ const liveModels = useAgentChat((s) => s.liveModels);+ const draft = useAgentChat((s) => s.draft);+ const timeline = useAgentChat((s) => s.timeline);+ const busy = useAgentChat((s) => s.busy);+ const lastError = useAgentChat((s) => s.lastError);+ const setDraft = useAgentChat((s) => s.setDraft);+ const setPlan = useAgentChat((s) => s.setPlan);+ const send = useAgentChat((s) => s.send);+ const cancel = useAgentChat((s) => s.cancel);+ const loadCatalog = useAgentChat((s) => s.loadCatalog);useEffect(() => {if (!catalog) void loadCatalog();}, [catalog, loadCatalog]);const providers = useMemo<ProviderOption[]>(- () => useAgentChatStore.getState().providerOptions(),+ () => store.getState().providerOptions(),// Recompute when either half of the join changes.// eslint-disable-next-line react-hooks/exhaustive-deps- [catalog, connections],+ [catalog, connections, store],);const provider = providers.find((p) => p.id === draft.provider) ?? null;diff --git a/jarvis/ui/web/frontend/src/components/agentic/IdeChatSurface.tsx b/jarvis/ui/web/frontend/src/components/agentic/IdeChatSurface.tsxindex c5372730ca..781f80363b 100644--- a/jarvis/ui/web/frontend/src/components/agentic/IdeChatSurface.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/IdeChatSurface.tsx@@ -1,20 +1,25 @@import { useEffect } from "react";+import { AgentChatStoreProvider } from "@/components/agentchat/AgentChatStoreContext";import { ChatStage } from "@/components/home/ChatStage";-import { useAgentChatStore } from "@/store/agentChat";+import { useAgentSessionStore } from "@/store/agentChat";import type { IdeWorkspace } from "@/store/ideChat";/**- * The Agentic IDE's chat surface — the agent chat, in this workspace's folder.+ * The Agentic IDE's chat surface — a coding-agent session in this workspace's folder.*- * It IS the front page's chat: same `ChatStage`, same composer, same store, so- * a conversation started here can be picked up there and neither has to be- * kept in step with the other by hand. What this component adds is the one- * thing the IDE knows and the front page does not — WHICH FOLDER you are- * working in. The workspace you opened is the working directory of every chat- * started on this surface, which is what "logged into your workspace" means in- * practice: the agent runs there, on those files, under that folder's- * credentials.+ * It wears the front page's face — same `ChatStage`, same composer — and is a+ * DIFFERENT chat: the front page is Jarvis with a keyboard, this is a coding+ * agent (Claude Code, Codex, the API loop) working in the folder. So it runs+ * on its own store (`useAgentSessionStore`, surface `agent`): its own+ * sessions, draft and socket, handed to the shared components through+ * `AgentChatStoreProvider`. Opening a chat here never changes what the front+ * page shows, and the other way round (maintainer, 2026-08-25). What this+ * component adds on top is the one thing the IDE knows and the front page+ * does not — WHICH FOLDER you are working in. The workspace you opened is the+ * working directory of every chat started on this surface, which is what+ * "logged into your workspace" means in practice: the agent runs there, on+ * those files, under that folder's credentials.** A chat belonging to another folder is not silently re-pointed. Moving an* existing conversation to a new working directory mid-thread would change@@ -27,10 +32,10 @@ import type { IdeWorkspace } from "@/store/ideChat";*/export function IdeChatSurface({ workspace }: { workspace: IdeWorkspace }) {const folder = workspace.path;- const activeSession = useAgentChatStore((s) => s.activeSession);- const draftCwd = useAgentChatStore((s) => s.draft.cwd);- const setDraft = useAgentChatStore((s) => s.setDraft);- const newChat = useAgentChatStore((s) => s.newChat);+ const activeSession = useAgentSessionStore((s) => s.activeSession);+ const draftCwd = useAgentSessionStore((s) => s.draft.cwd);+ const setDraft = useAgentSessionStore((s) => s.setDraft);+ const newChat = useAgentSessionStore((s) => s.newChat);useEffect(() => {if (!folder) return;@@ -52,7 +57,9 @@ export function IdeChatSurface({ workspace }: { workspace: IdeWorkspace }) {data-workspace={workspace.id}data-folder={folder}>- <ChatStage />+ <AgentChatStoreProvider store={useAgentSessionStore}>+ <ChatStage />+ </AgentChatStoreProvider></div>);}diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsxindex 36aad1100d..8d6639831e 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx@@ -2,7 +2,7 @@ import { cleanup, fireEvent, render, screen } from "@testing-library/react";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { WorkspaceChats, groupByFolder } from "@/components/agentic/WorkspaceChats";-import { useAgentChatStore } from "@/store/agentChat";+import { useAgentSessionStore } from "@/store/agentChat";import { useIdeChatStore } from "@/store/ideChat";import type { AgentChatSession } from "@/lib/agentChatApi";@@ -45,7 +45,7 @@ describe("the sidebar's chat face", () => {sidebarFace: "chats",workspace: { id: "w1", name: "Personal Jarvis", path: HERE },});- useAgentChatStore.setState({+ useAgentSessionStore.setState({sessions: SESSIONS,activeSessionId: "a",loadSessions: async () => {},diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsxindex 3937dd6b49..0637bfe342 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx@@ -2,7 +2,7 @@ import { useEffect, useMemo, useState } from "react";import { ChevronLeft, Folder, MessageSquare, Plus, Trash2 } from "lucide-react";import { CONVERSATIONS_REFRESH_MS } from "@/hooks/useConversations";-import { useAgentChatStore } from "@/store/agentChat";+import { useAgentSessionStore } from "@/store/agentChat";import { useIdeChatStore } from "@/store/ideChat";import { folderLeaf } from "@/lib/folderPath";import { folderColor } from "@/components/agentic/folderColor";@@ -31,13 +31,13 @@ export function WorkspaceChats() {const workspace = useIdeChatStore((s) => s.workspace);const setSidebarFace = useIdeChatStore((s) => s.setSidebarFace);- const sessions = useAgentChatStore((s) => s.sessions);- const activeSessionId = useAgentChatStore((s) => s.activeSessionId);- const loadSessions = useAgentChatStore((s) => s.loadSessions);- const openSession = useAgentChatStore((s) => s.openSession);- const removeSession = useAgentChatStore((s) => s.removeSession);- const newChat = useAgentChatStore((s) => s.newChat);- const setDraft = useAgentChatStore((s) => s.setDraft);+ const sessions = useAgentSessionStore((s) => s.sessions);+ const activeSessionId = useAgentSessionStore((s) => s.activeSessionId);+ const loadSessions = useAgentSessionStore((s) => s.loadSessions);+ const openSession = useAgentSessionStore((s) => s.openSession);+ const removeSession = useAgentSessionStore((s) => s.removeSession);+ const newChat = useAgentSessionStore((s) => s.newChat);+ const setDraft = useAgentSessionStore((s) => s.setDraft);useEffect(() => {void loadSessions();diff --git a/jarvis/ui/web/frontend/src/components/home/ChatStage.tsx b/jarvis/ui/web/frontend/src/components/home/ChatStage.tsxindex 65cb018f76..24a7ecb3ec 100644--- a/jarvis/ui/web/frontend/src/components/home/ChatStage.tsx+++ b/jarvis/ui/web/frontend/src/components/home/ChatStage.tsx@@ -1,7 +1,7 @@import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from "react";import { useEventStore } from "@/store/events";-import { useAgentChatStore } from "@/store/agentChat";+import { useAgentChat } from "@/components/agentchat/AgentChatStoreContext";import { ScrollArea } from "@/components/ui/scroll-area";import { AgentComposer } from "@/components/agentchat/AgentComposer";import { AgentTimeline } from "@/components/agentchat/AgentTimeline";@@ -43,12 +43,13 @@ import { useT } from "@/i18n";export function ChatStage() {const t = useT();const assistantName = useEventStore((s) => s.assistantName);- const items = useAgentChatStore((s) => s.timeline.items);- const activeSessionId = useAgentChatStore((s) => s.activeSessionId);- const catalog = useAgentChatStore((s) => s.catalog);- const decide = useAgentChatStore((s) => s.decide);- const loadCatalog = useAgentChatStore((s) => s.loadCatalog);- const loadSessions = useAgentChatStore((s) => s.loadSessions);+ const surface = useAgentChat((s) => s.surface);+ const items = useAgentChat((s) => s.timeline.items);+ const activeSessionId = useAgentChat((s) => s.activeSessionId);+ const catalog = useAgentChat((s) => s.catalog);+ const decide = useAgentChat((s) => s.decide);+ const loadCatalog = useAgentChat((s) => s.loadCatalog);+ const loadSessions = useAgentChat((s) => s.loadSessions);const voiceThreadId = useEventStore((s) => (s.activeKind === "voice" ? s.activeThreadId : null));const hasContent = items.length > 0;@@ -136,7 +137,9 @@ export function ChatStage() {// A spoken thread was opened from the history: read it here, in the column// the composer would otherwise own. An agent chat opening clears this.- if (voiceThreadId && !activeSessionId) return <VoiceThreadStage />;+ // Only the front page shares its column with the voice archive; the IDE's+ // chat is coding sessions and never shows a spoken thread.+ if (surface === "jarvis" && voiceThreadId && !activeSessionId) return <VoiceThreadStage />;if (!hasContent) {return (diff --git a/jarvis/ui/web/frontend/src/store/agentChat.ts b/jarvis/ui/web/frontend/src/store/agentChat.tsindex b6f2430b41..5a228295d1 100644--- a/jarvis/ui/web/frontend/src/store/agentChat.ts+++ b/jarvis/ui/web/frontend/src/store/agentChat.ts@@ -553,3 +553,15 @@ export function createAgentChatStore(surface: AgentChatSurface) {/** The front page's store — every existing call site reads this one. */export const useAgentChatStore = createAgentChatStore("jarvis");++/**+ * The Agentic IDE's chat store — surface `agent`: coding-agent sessions in a+ * workspace's folder, with their own sessions, draft and socket. The shared+ * chat components reach it through `AgentChatStoreProvider`+ * (components/agentchat/AgentChatStoreContext); nothing on the front page+ * ever reads it, so the IDE's last chat can never appear there.+ */+export const useAgentSessionStore = createAgentChatStore("agent");++/** The hook a `createAgentChatStore` call returns — what the context carries. */+export type AgentChatStoreHook = typeof useAgentChatStore;