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
test(ui): solo deep link, detached-IDE unmount, detach button visibility
rubenluetke10-beepbcce25afc3bc
diff --git a/jarvis/ui/web/frontend/src/components/layout/MainView.detached.test.tsx b/jarvis/ui/web/frontend/src/components/layout/MainView.detached.test.tsxnew file mode 100644index 0000000000..3d25124c97--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/layout/MainView.detached.test.tsx@@ -0,0 +1,132 @@+/**+ * A detached coding view must leave NO mounted IDE behind in the main window.+ *+ * The sticky mount (MainView.sticky.test.tsx) keeps the Agentic IDE alive+ * across section changes because unmounting it is destructive. Detaching+ * inverts the rule: the solo window's panes claim the PTY streams, and a+ * second mounted instance — even a hidden sticky one — steals every pane's+ * output. So while a coding view is in `detachedViews`, the main window must+ * genuinely unmount its instance and show the placeholder instead; the solo+ * window itself (store flag `solo`) is exempt because it IS the detached+ * instance. The remount rides the DetachedViewClosed event clearing the+ * registry — pinned here by clearing the store the same way.+ */+import { act, cleanup, render, screen, waitFor } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++import { MainView } from "@/components/layout/MainView";+import { useEventStore } from "@/store/events";++const ide = vi.hoisted(() => ({ mounts: 0, unmounts: 0 }));++vi.mock("@/views/AgenticIdeView", async () => {+ const { useEffect } = await vi.importActual<typeof import("react")>("react");+ return {+ AgenticIdeView: () => {+ useEffect(() => {+ ide.mounts += 1;+ return () => {+ ide.unmounts += 1;+ };+ }, []);+ return <div data-testid="ide-stub">workspace</div>;+ },+ };+});++vi.mock("@/views/ChatsView", () => ({+ ChatsView: () => <div data-testid="chats-stub">chats</div>,+ ViewHeader: () => null,+}));++function setStore(state: {+ activeSection?: string;+ solo?: boolean;+ detachedViews?: string[];+}) {+ act(() => {+ useEventStore.setState(state as never);+ });+}++beforeEach(() => {+ ide.mounts = 0;+ ide.unmounts = 0;+ setStore({ activeSection: "chats", solo: false, detachedViews: [] });+});++afterEach(() => {+ cleanup();+ vi.clearAllMocks();+});++describe("MainView — detached coding view", () => {+ it("unmounts the sticky IDE when a coding view detaches", async () => {+ render(<MainView />);+ setStore({ activeSection: "agentic-ide" });+ await screen.findByTestId("ide-stub");+ expect(ide.mounts).toBe(1);++ // The desktop shell reports the view now lives in its own window.+ setStore({ detachedViews: ["agentic-ide"] });++ await waitFor(() => expect(screen.queryByTestId("ide-stub")).toBeNull());+ expect(ide.unmounts).toBe(1); // genuine unmount, not a CSS hide+ expect(screen.queryByTestId("sticky-agentic-ide")).toBeNull();+ });++ it("shows the placeholder with focus and bring-back actions", async () => {+ setStore({ activeSection: "agentic-ide", detachedViews: ["agentic-ide"] });+ render(<MainView />);++ await screen.findByTestId("detached-view-placeholder");+ expect(screen.getByTestId("detached-focus-button")).toBeTruthy();+ expect(screen.getByTestId("detached-reattach-button")).toBeTruthy();+ });++ it("covers the whole coding family while any coding view is detached", async () => {+ // agentic-ide detached, user opens the classic grid: same pane pool, so+ // the placeholder — not a second instance — must render.+ setStore({+ activeSection: "agentic-ide-classic",+ detachedViews: ["agentic-ide"],+ });+ render(<MainView />);++ await screen.findByTestId("detached-view-placeholder");+ expect(ide.mounts).toBe(0);+ });++ it("remounts through the sticky path once the registry clears", async () => {+ setStore({ activeSection: "agentic-ide", detachedViews: ["agentic-ide"] });+ render(<MainView />);+ await screen.findByTestId("detached-view-placeholder");++ // DetachedViewClosed → registry empty → the section returns here.+ setStore({ detachedViews: [] });++ await screen.findByTestId("ide-stub");+ expect(ide.mounts).toBe(1);+ });++ it("keeps non-coding sections rendering while the IDE is detached", async () => {+ setStore({ activeSection: "chats", detachedViews: ["agentic-ide"] });+ render(<MainView />);++ await screen.findByTestId("chats-stub");+ expect(screen.queryByTestId("detached-view-placeholder")).toBeNull();+ });++ it("mounts the IDE in the solo window despite its registry entry", async () => {+ // The solo window IS the detached instance the registry entry refers to.+ setStore({+ activeSection: "agentic-ide",+ solo: true,+ detachedViews: ["agentic-ide"],+ });+ render(<MainView />);++ await screen.findByTestId("ide-stub");+ expect(screen.queryByTestId("detached-view-placeholder")).toBeNull();+ });+});diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsxindex 4eeee906b2..a22840dca8 100644--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx@@ -1,4 +1,4 @@-import { fireEvent, render, screen, waitFor } from "@testing-library/react";+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { TopBar, TopBarActions } from "./TopBar";import { useEventStore } from "@/store/events";@@ -9,9 +9,29 @@ vi.mock("@/hooks/useUpdate", () => ({// The bar is section-aware now, so every test below states which screen it is// on rather than inheriting whatever a previous one left behind.-beforeEach(() => useEventStore.setState({ activeSection: "chats" }));+beforeEach(() =>+ useEventStore.setState({ activeSection: "chats", solo: false }),+);afterEach(() => vi.restoreAllMocks());+describe("TopBar detach button", () => {+ it("offers 'own window' on the detachable sections only", () => {+ render(<TopBar />);+ expect(screen.getByTestId("detach-view-button")).toBeTruthy();++ cleanup();+ useEventStore.setState({ activeSection: "settings" });+ render(<TopBar />);+ expect(screen.queryByTestId("detach-view-button")).toBeNull();+ });++ it("never renders inside a solo window (no detaching a detached view)", () => {+ useEventStore.setState({ solo: true });+ render(<TopBarActions />);+ expect(screen.queryByTestId("detach-view-button")).toBeNull();+ });+});+describe("TopBar restart button", () => {it("renders a restart button labelled in the active locale", () => {render(<TopBar />);diff --git a/jarvis/ui/web/frontend/src/store/events.test.ts b/jarvis/ui/web/frontend/src/store/events.test.tsindex 4c42b3df0a..2d7a45f5b7 100644--- a/jarvis/ui/web/frontend/src/store/events.test.ts+++ b/jarvis/ui/web/frontend/src/store/events.test.ts@@ -13,6 +13,7 @@import { beforeEach, describe, expect, it } from "vitest";import {initialSectionFromSearch,+ soloWindowFromSearch,useEventStore,type ChatMessage,} from "@/store/events";@@ -22,6 +23,36 @@ describe("initial section deep links", () => {expect(initialSectionFromSearch("?doc=voice-conversations")).toBe("docs");expect(initialSectionFromSearch("")).toBe("chats");});++ it("honors ?view= for any known section (the solo-window deep link)", () => {+ expect(initialSectionFromSearch("?view=agentic-ide&solo=1")).toBe(+ "agentic-ide",+ );+ expect(initialSectionFromSearch("?view=chats")).toBe("chats");+ expect(initialSectionFromSearch("?view=settings")).toBe("settings");+ });++ it("falls through an invalid ?view= to the older rules", () => {+ // Unknown section id: never crash, never trust the URL.+ expect(initialSectionFromSearch("?view=nope")).toBe("chats");+ // ...and the ?doc shortcut still applies behind it.+ expect(initialSectionFromSearch("?view=nope&doc=x")).toBe("docs");+ });++ it("prefers ?view= over ?doc when both are present", () => {+ // Pinned: the explicit deep link wins over the docs shortcut.+ expect(initialSectionFromSearch("?view=tasks&doc=x")).toBe("tasks");+ });+});++describe("solo window flag (?solo=1)", () => {+ it("is set only by the exact solo=1 value", () => {+ expect(soloWindowFromSearch("?view=chats&solo=1")).toBe(true);+ expect(soloWindowFromSearch("?solo=1")).toBe(true);+ expect(soloWindowFromSearch("?solo=0")).toBe(false);+ expect(soloWindowFromSearch("?solo=true")).toBe(false);+ expect(soloWindowFromSearch("")).toBe(false);+ });});function msg(