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: keep navigation after detaching coding view

rubenluetke10-beepb5fe851217c5
diff --git a/jarvis/ui/web/frontend/src/App.detached.test.tsx b/jarvis/ui/web/frontend/src/App.detached.test.tsx
new file mode 100644
index 0000000000..b04e57b658
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/App.detached.test.tsx
@@ -0,0 +1,114 @@
+import { cleanup, render, screen } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+import App from "@/App";
+import { useEventStore } from "@/store/events";
+
+vi.mock("@/hooks/useWebSocket", () => ({ useWebSocket: () => undefined }));
+vi.mock("@/hooks/useBrainStatus", () => ({ useBrainStatus: () => undefined }));
+vi.mock("@/hooks/useVoiceStatus", () => ({ useVoiceStatus: () => undefined }));
+vi.mock("@/hooks/useAssistantNameSeed", () => ({
+ useAssistantNameSeed: () => undefined,
+}));
+vi.mock("@/hooks/useCodingMode", () => ({ useCodingMode: () => undefined }));
+vi.mock("@/hooks/useResizablePane", () => ({
+ useResizablePane: () => ({
+ size: 280,
+ isResizing: false,
+ startResize: vi.fn(),
+ reset: vi.fn(),
+ nudge: vi.fn(),
+ }),
+}));
+vi.mock("@/lib/dictationTarget", () => ({
+ installDictationFocusTracker: () => vi.fn(),
+}));
+
+vi.mock("@/components/layout/Sidebar", () => ({
+ SIDEBAR_DEFAULT_WIDTH: 280,
+ SIDEBAR_RAIL_WIDTH: 56,
+ Sidebar: () => <aside data-testid="sidebar" />,
+}));
+vi.mock("@/components/layout/PaneResizer", () => ({
+ PaneResizer: () => <div data-testid="sidebar-resizer" />,
+}));
+vi.mock("@/components/layout/TopBar", () => ({
+ TopBar: () => <div data-testid="topbar" />,
+}));
+vi.mock("@/components/layout/MainView", () => ({
+ MainView: () => <div data-testid="main-view" />,
+}));
+vi.mock("@/components/layout/PermissionsAlertBanner", () => ({
+ PermissionsAlertBanner: () => null,
+}));
+vi.mock("@/components/layout/InputIsolationBanner", () => ({
+ InputIsolationBanner: () => null,
+}));
+vi.mock("@/components/layout/VoiceWarmingBanner", () => ({
+ VoiceWarmingBanner: () => null,
+}));
+vi.mock("@/components/voice/SubscriptionRealtimeTransportBroker", () => ({
+ SubscriptionRealtimeTransportBroker: () => null,
+}));
+vi.mock("@/components/ToastLayer", () => ({ ToastLayer: () => null }));
+vi.mock("@/components/EditContextMenu", () => ({ EditContextMenu: () => null }));
+vi.mock("@/components/JarvisDock", () => ({ JarvisDock: () => null }));
+vi.mock("@/components/CliConnectPoller", () => ({ CliConnectPoller: () => null }));
+vi.mock("@/components/onboarding/OnboardingGate", () => ({
+ OnboardingGate: () => null,
+}));
+
+beforeEach(() => {
+ vi.stubGlobal("fetch", vi.fn().mockResolvedValue({ ok: false }));
+ useEventStore.setState({
+ activeSection: "chats",
+ navRevealed: false,
+ solo: false,
+ detachedViews: [],
+ });
+});
+
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+});
+
+describe("App shell around detached coding views", () => {
+ it("keeps the sidebar reachable in the main window", () => {
+ useEventStore.setState({
+ activeSection: "agentic-ide",
+ navRevealed: false,
+ detachedViews: ["agentic-ide"],
+ });
+
+ render(<App />);
+
+ expect(screen.getByTestId("sidebar")).toBeTruthy();
+ expect(screen.getByTestId("sidebar-resizer")).toBeTruthy();
+ });
+
+ it("still hides the sidebar for an attached coding workspace", () => {
+ useEventStore.setState({
+ activeSection: "agentic-ide",
+ navRevealed: false,
+ detachedViews: [],
+ });
+
+ render(<App />);
+
+ expect(screen.queryByTestId("sidebar")).toBeNull();
+ });
+
+ it("keeps a detached solo window chrome-free", () => {
+ useEventStore.setState({
+ activeSection: "agentic-ide",
+ solo: true,
+ detachedViews: ["agentic-ide"],
+ });
+
+ render(<App />);
+
+ expect(screen.queryByTestId("sidebar")).toBeNull();
+ expect(screen.queryByTestId("topbar")).toBeNull();
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/App.tsx b/jarvis/ui/web/frontend/src/App.tsx
index 4ecc6292bd..cc273148ad 100644
--- a/jarvis/ui/web/frontend/src/App.tsx
+++ b/jarvis/ui/web/frontend/src/App.tsx
@@ -167,7 +167,17 @@ export default function App() {
const navRevealed = useEventStore((s) => s.navRevealed);
const solo = useEventStore((s) => s.solo);
const detachedViews = useEventStore((s) => s.detachedViews);
- const codingSurface = CODING_SECTIONS.has(activeSection);
+ /*
+ * A detached IDE leaves a placeholder in the main window, not a coding
+ * surface. The actual IDE normally carries its own menu-reveal control, but
+ * it is deliberately unmounted while detached to protect the PTY streams.
+ * Treating the placeholder like the IDE therefore hid the only navigation
+ * with no control left to bring it back. Give that state the regular shell
+ * so every other section remains reachable while the IDE stays detached.
+ */
+ const codingDetached =
+ !solo && detachedViews.some((view) => CODING_SECTIONS.has(view));
+ const codingSurface = CODING_SECTIONS.has(activeSection) && !codingDetached;
const railHidden = codingSurface && !navRevealed;
/*
diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx
index a22840dca8..7f5df97e4f 100644
--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.test.tsx
@@ -10,7 +10,11 @@ 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", solo: false }),
+ useEventStore.setState({
+ activeSection: "chats",
+ solo: false,
+ detachedViews: [],
+ }),
);
afterEach(() => vi.restoreAllMocks());
@@ -158,6 +162,18 @@ describe("TopBar in the classic terminal grid", () => {
expect(screen.getByRole("button", { name: /^restart$/i })).toBeTruthy();
});
+ it("restores the global bar in the main window while the IDE is detached", () => {
+ useEventStore.setState({
+ activeSection: "agentic-ide-classic",
+ detachedViews: ["agentic-ide"],
+ });
+
+ const { container } = render(<TopBar />);
+
+ expect(container.firstChild).not.toBeNull();
+ expect(screen.getByRole("button", { name: /^restart$/i })).toBeTruthy();
+ });
+
it("keeps its bar on every other screen", () => {
const { container } = render(<TopBar />);
diff --git a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
index f08054594e..941ddd76e8 100644
--- a/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/TopBar.tsx
@@ -39,17 +39,25 @@ import { openExternalUrl } from "@/lib/openExternal";
*/
const CONFIRM_TIMEOUT_MS = 4000;
+const CODING_SECTIONS = new Set<SectionId>([
+ "agentic-ide",
+ "agentic-ide-classic",
+ "chat-workspace",
+]);
+
export function TopBar() {
const activeSection = useEventStore((s) => s.activeSection);
+ const solo = useEventStore((s) => s.solo);
+ const detachedViews = useEventStore((s) => s.detachedViews);
// The coding workspace takes the actions into its own toolbar row, under
// every id that reaches it. The rule is "the section carries the actions
// itself" — a section that does not would lose Restart, which is the one
- // control a frontend change is reached through.
- if (
- activeSection === "agentic-ide" ||
- activeSection === "agentic-ide-classic" ||
- activeSection === "chat-workspace"
- ) {
+ // control a frontend change is reached through. Once detached, that toolbar
+ // lives in the solo window and the main window only has a placeholder, so
+ // the main shell must provide the global bar again.
+ const codingDetached =
+ !solo && detachedViews.some((view) => CODING_SECTIONS.has(view));
+ if (CODING_SECTIONS.has(activeSection) && !codingDetached) {
return null;
}