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.

feat(agentic-ide): choose chat or terminal grid in the workspace wizard

Ruben Lütkee3816e9b3a89
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index d796400b19..312fba918f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -405,7 +405,7 @@ function writePosition(node: HTMLElement, style: React.CSSProperties): void {
* The text size is the exception and is kept by the BACKEND as well (see
* `fetchTerminalUiPreferences`). The desktop window is an embedded WebView that
* starts every run with empty browser storage, so a size kept only here is
- * forgotten on each restart — which reads as the control having stopped
+ * forgotten on each restart — which reads as the control having stopped
* working. Its localStorage entry stays as the first-paint cache so the panes
* open at the remembered size instead of visibly resizing a moment later.
*/
@@ -422,16 +422,28 @@ const FONT_KEY = "jarvis.agenticIde.terminalFontSize";
* pure restyle of the same mounted elements, because unmounting a pane kills
* the coding agent behind it (see the grid container's comment below).
*/
-type WorkspaceView = "grid" | "chat";
+export type WorkspaceView = "grid" | "chat";
const VIEW_KEY = "jarvis.agenticIde.workspaceView";
-function storedViewMode(): WorkspaceView | null {
+export function storedViewMode(): WorkspaceView | null {
return readStored(VIEW_KEY, (raw) =>
raw === "grid" || raw === "chat" ? raw : null,
);
}
+/**
+ * Record which way the workspace should be read, ahead of the grid mounting.
+ *
+ * Exported for the workspace wizard: its last step asks grid-or-chat before
+ * anything opens, and the grid then simply reads the answer on mount — the
+ * same stored preference the toolbar toggle below keeps, so the wizard's
+ * choice and a later toggle can never disagree about where the answer lives.
+ */
+export function rememberViewMode(next: WorkspaceView): void {
+ writeStored(VIEW_KEY, next);
+}
+
function readStored<T>(key: string, parse: (raw: string) => T | null): T | null {
try {
const raw = window.localStorage.getItem(key);
@@ -538,7 +550,7 @@ export function AgenticGrid({
writeStored(FONT_KEY, String(next));
// The backend is what makes the choice survive a restart; the line above is
// only this window's cache. A failed write is reported rather than
- // swallowed — the panes still resize, they just would not remember it.
+ // swallowed — the panes still resize, they just would not remember it.
void saveTerminalFontSize(next).catch((err) => {
console.warn("Agentic IDE: terminal text size not remembered:", err);
});
@@ -559,7 +571,7 @@ export function AgenticGrid({
}
// Nothing stored yet, but this window still holds a size chosen before
// the backend kept them. Hand that choice over instead of letting the
- // default silently replace it — otherwise upgrading resets it once.
+ // default silently replace it — otherwise upgrading resets it once.
const local = storedFontSize();
if (local === null) return;
void saveTerminalFontSize(local).catch((err) => {
@@ -623,7 +635,7 @@ export function AgenticGrid({
);
const setViewMode = useCallback((next: WorkspaceView) => {
setViewModeState(next);
- writeStored(VIEW_KEY, next);
+ rememberViewMode(next);
// Chat shows exactly one pane already; a leftover maximize from the grid
// would silently pin the stage to a pane the rail no longer highlights.
if (next === "chat") setMaximized(null);
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx
index a997f41752..99e48e293f 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx
@@ -1,13 +1,20 @@
/**
* The staged workspace launcher.
*
- * Folder, layout, terminal assignments and review are separate decisions. The
- * values live in AgenticIdeView rather than in the active step, so moving back
- * never throws work away. Visually this is one continuous work surface: steps
- * are separated by typography and rules, not by stacking cards inside cards.
+ * Folder, layout, terminal assignments, the reading view and review are
+ * separate decisions. The values live in AgenticIdeView rather than in the
+ * active step, so moving back never throws work away. Visually this is one
+ * continuous work surface: steps are separated by typography and rules, not by
+ * stacking cards inside cards.
*/
-import { useEffect, useMemo, useState } from "react";
-import { ArrowLeft, ArrowRight, Loader2 } from "lucide-react";
+import { useEffect, useMemo, useState, type ReactNode } from "react";
+import {
+ ArrowLeft,
+ ArrowRight,
+ LayoutGrid,
+ Loader2,
+ MessagesSquare,
+} from "lucide-react";
import { useT } from "@/i18n";
import { cn } from "@/lib/utils";
import { FolderPicker } from "./FolderPicker";
@@ -15,6 +22,7 @@ import { ResumeCard } from "./ResumeCard";
import { AgentAllocation, type PlannedTerminal } from "./AgentAllocation";
import { Button, Notice, SectionLabel } from "./controls";
import { CountStepper, CountTrack, WorkspaceShape } from "./WorkspaceShape";
+import type { WorkspaceView } from "./AgenticGrid";
import type { AgentAccount } from "@/lib/agentAccountsApi";
import type {
AgentStatus,
@@ -61,10 +69,14 @@ export interface WorkspaceLauncherProps {
onResume: () => void;
onDismissOffer: () => void;
+ /** How the workspace opens: the full terminal grid, or the chat view. */
+ view: WorkspaceView;
+ onView: (next: WorkspaceView) => void;
+
onStart: () => void;
}
-type LauncherStep = 0 | 1 | 2 | 3;
+type LauncherStep = 0 | 1 | 2 | 3 | 4;
const STEPS = [
{
@@ -82,6 +94,11 @@ const STEPS = [
title: "Choose the coding agents",
hint: "Distribute all terminal slots at once instead of editing every pane.",
},
+ {
+ label: "View",
+ title: "Choose how to read the workspace",
+ hint: "The same agents either way — the toolbar switches between the two at any time.",
+ },
{
label: "Review",
title: "Review before opening",
@@ -110,6 +127,8 @@ export function WorkspaceLauncher({
offer,
onResume,
onDismissOffer,
+ view,
+ onView,
onStart,
}: WorkspaceLauncherProps) {
const t = useT();
@@ -123,7 +142,8 @@ export function WorkspaceLauncher({
(step === 0 && Boolean(folder)) ||
(step === 1 && count > 0) ||
(step === 2 && planReady) ||
- step === 3;
+ // The view step always carries a preselected answer, and review is last.
+ step >= 3;
const canVisit = (target: LauncherStep) => {
if (target <= step) return true;
@@ -134,7 +154,7 @@ export function WorkspaceLauncher({
/* The launch chord is intentionally limited to the review step. */
useEffect(() => {
- if (step !== 3 || !ready || busy) return;
+ if (step !== 4 || !ready || busy) return;
const onKey = (event: KeyboardEvent) => {
if (event.key !== "Enter" || !(event.metaKey || event.ctrlKey)) return;
event.preventDefault();
@@ -236,6 +256,7 @@ export function WorkspaceLauncher({
folder={folder}
count={count}
planned={planned}
+ view={view}
canVisit={canVisit}
onStep={setStep}
/>
@@ -291,11 +312,14 @@ export function WorkspaceLauncher({
/>
)}
- {step === 3 && folder && (
+ {step === 3 && <ViewChoice view={view} onView={onView} />}
+
+ {step === 4 && folder && (
<WorkspaceReview
folder={folder}
planned={planned}
agents={agents}
+ view={view}
/>
)}
@@ -312,7 +336,7 @@ export function WorkspaceLauncher({
<span />
)}
- {step < 3 ? (
+ {step < 4 ? (
<Button
variant="primary"
disabled={!canLeaveCurrent}
@@ -323,7 +347,9 @@ export function WorkspaceLauncher({
? "Continue to layout"
: step === 1
? "Continue to agents"
- : "Review workspace"}
+ : step === 2
+ ? "Choose the view"
+ : "Review workspace"}
<ArrowRight className="h-3.5 w-3.5" />
</Button>
) : (
@@ -356,6 +382,7 @@ function StepNavigation({
folder,
count,
planned,
+ view,
canVisit,
onStep,
}: {
@@ -363,6 +390,7 @@ function StepNavigation({
folder: string | null;
count: number;
planned: PlannedTerminal[];
+ view: WorkspaceView;
canVisit: (target: LauncherStep) => boolean;
onStep: (step: LauncherStep) => void;
}) {
@@ -375,14 +403,15 @@ function StepNavigation({
t("workspace_launcher.agents.nav_summary")
.replace("{0}", String(assigned))
.replace("{1}", String(planned.length)),
+ VIEW_NAMES[view],
"Check and open",
],
- [assigned, count, folder, planned.length, t],
+ [assigned, count, folder, planned.length, t, view],
);
return (
<nav aria-label="Workspace setup" className="min-w-0">
- <ol className="grid grid-cols-4 border-b border-border/70 lg:flex lg:flex-col lg:border-b-0 lg:border-r lg:pr-6">
+ <ol className="grid grid-cols-5 border-b border-border/70 lg:flex lg:flex-col lg:border-b-0 lg:border-r lg:pr-6">
{STEPS.map((item, index) => {
const target = index as LauncherStep;
const selected = target === step;
@@ -425,14 +454,160 @@ function StepNavigation({
);
}
+/** The user-facing names of the two reading modes, shared by every step. */
+const VIEW_NAMES: Record<WorkspaceView, string> = {
+ grid: "Terminal grid",
+ chat: "Chat view",
+};
+
+/**
+ * The last decision before review: how the workspace is read.
+ *
+ * Two ways of looking at the SAME panes (see WorkspaceView in AgenticGrid) —
+ * the grid shows every terminal at once, chat puts one agent on a stage like a
+ * conversation. A choice of presentation, not of substance, which is why the
+ * step needs no gate: both answers are always valid and one is preselected.
+ */
+function ViewChoice({
+ view,
+ onView,
+}: {
+ view: WorkspaceView;
+ onView: (next: WorkspaceView) => void;
+}) {
+ return (
+ <div>
+ <SectionLabel>Reading mode</SectionLabel>
+ <div
+ role="radiogroup"
+ aria-label="How the workspace opens"
+ className="mt-4 grid gap-4 sm:grid-cols-2"
+ >
+ <ViewOption
+ selected={view === "grid"}
+ onSelect={() => onView("grid")}
+ testId="view-choice-grid"
+ icon={<LayoutGrid className="h-4 w-4 shrink-0" />}
+ title={VIEW_NAMES.grid}
+ description="Every pane on screen at once, side by side — the full wall of terminals."
+ preview={<GridPreview />}
+ />
+ <ViewOption
+ selected={view === "chat"}
+ onSelect={() => onView("chat")}
+ testId="view-choice-chat"
+ icon={<MessagesSquare className="h-4 w-4 shrink-0" />}
+ title={VIEW_NAMES.chat}
+ description="One agent at a time on a calm stage, the rest on a rail — read like a conversation."
+ preview={<ChatPreview />}
+ />
+ </div>
+ <p className="mt-5 max-w-2xl text-xs leading-relaxed text-muted-foreground">
+ Only how the workspace is read changes — the agents, panes and
+ conversations are the same either way, and the workspace toolbar
+ switches between the two whenever you like.
+ </p>
+ </div>
+ );
+}
+
+function ViewOption({
+ selected,
+ onSelect,
+ testId,
+ icon,
+ title,
+ description,
+ preview,
+}: {
+ selected: boolean;
+ onSelect: () => void;
+ testId: string;
+ icon: ReactNode;
+ title: string;
+ description: string;
+ preview: ReactNode;
+}) {
+ return (
+ <button
+ type="button"
+ role="radio"
+ aria-checked={selected}
+ data-testid={testId}
+ onClick={onSelect}
+ className={cn(
+ "group min-w-0 border px-5 py-5 text-left transition-colors",
+ selected
+ ? "border-primary/70 bg-primary/[0.04]"
+ : "border-border/70 hover:border-border",
+ )}
+ >
+ {preview}
+ <span
+ className={cn(
+ "mt-4 flex items-center gap-2 text-sm font-medium",
+ selected ? "text-foreground" : "text-muted-foreground",
+ )}
+ >
+ {icon}
+ {title}
+ {selected && (
+ <span className="ml-auto text-[10px] font-semibold uppercase tracking-[0.14em] text-primary">
+ Selected
+ </span>
+ )}
+ </span>
+ <span className="mt-1.5 block text-xs leading-relaxed text-muted-foreground">
+ {description}
+ </span>
+ </button>
+ );
+}
+
+/* Miniatures of the two modes, drawn with rules like the rest of the wizard. */
+
+function GridPreview() {
+ return (
+ <span aria-hidden className="grid grid-cols-2 gap-1.5">
+ {[0, 1, 2, 3].map((i) => (
+ <span
+ key={i}
+ className="block h-9 border border-border/70 bg-muted/30"
+ />
+ ))}
+ </span>
+ );
+}
+
+function ChatPreview() {
+ return (
+ <span aria-hidden className="flex gap-1.5">
+ <span className="flex w-1/4 flex-col gap-1.5">
+ {[0, 1, 2].map((i) => (
+ <span
+ key={i}
+ className={cn(
+ "block flex-1 border border-border/70",
+ i === 0 ? "bg-muted/60" : "bg-muted/20",
+ )}
+ />
+ ))}
+ </span>
+ <span className="block h-[4.875rem] flex-1 border border-border/70 bg-muted/30" />
+ </span>
+ );
+}
+
function WorkspaceReview({
folder,
planned,
agents,
+ view,
}: {
folder: string;
planned: PlannedTerminal[];
agents: AgentStatus[];
+ view: WorkspaceView;
}) {
const displayName = (agentId: string) =>
agents.find((agent) => agent.name === agentId)?.display_name ?? agentId;
@@ -455,6 +630,12 @@ function WorkspaceReview({
{planned.length}
</dd>
</div>
+ <div className="flex items-center justify-between gap-5 border-b border-border/50 py-3 text-sm">
+ <dt className="text-muted-foreground">Opens as</dt>
+ <dd className="text-foreground" data-testid="review-view-mode">
+ {VIEW_NAMES[view]}
+ </dd>
+ </div>
<div className="flex items-center justify-between gap-5 py-3 text-sm">
<dt className="text-muted-foreground">Coding mode</dt>
<dd className="text-foreground">Turns on when opened</dd>
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
index 2b2f538c2f..10085b67ff 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
@@ -274,6 +274,10 @@ beforeEach(() => {
// the user came for. The tests below that type an instruction want it open,
// and the remembered height is how a user who wants it open gets it.
window.localStorage.setItem("jarvis.agenticIde.composerHeight.v2", "176");
+ // The wizard's view step preselects the remembered reading mode, and the
+ // grid reads the same key on mount — a value left behind by one test must
+ // not decide how the next one's workspace opens.
+ window.localStorage.removeItem("jarvis.agenticIde.workspaceView");
vi.mocked(api.fetchIdeAgents).mockResolvedValue(AGENTS);
vi.mocked(api.fetchIdeState).mockResolvedValue(EMPTY_STATE);
vi.mocked(api.fetchFolders).mockResolvedValue({
@@ -399,7 +403,7 @@ describe("Agentic IDE launcher", () => {
await waitFor(() => expect(next.disabled).toBe(false));
});
- it("walks through folder, layout, agents and review before opening", async () => {
+ it("walks through folder, layout, agents, view and review before opening", async () => {
vi.mocked(api.startIdeSession).mockResolvedValue(
stateWith(sessionWith(["Mika", "Nova"])),
);
@@ -426,10 +430,22 @@ describe("Agentic IDE launcher", () => {
fireEvent.click(screen.getAllByText("workspace_launcher.agents.all")[0]);
expect(screen.getByText("2 / 2")).toBeTruthy();
+ fireEvent.click(screen.getByRole("button", { name: /choose the view/i }));
+ expect(
+ screen.getByRole("heading", { name: /choose how to read the workspace/i }),
+ ).toBeTruthy();
+ // The full terminal grid is the preselected answer, not an open question.
+ expect(
+ screen.getByTestId("view-choice-grid").getAttribute("aria-checked"),
+ ).toBe("true");
+
fireEvent.click(screen.getByRole("button", { name: /review workspace/i }));
expect(
screen.getByRole("heading", { name: /review before opening/i }),
).toBeTruthy();
+ expect(screen.getByTestId("review-view-mode").textContent).toBe(
+ "Terminal grid",
+ );
fireEvent.click(screen.getByRole("button", { name: /open workspace/i }));
await waitFor(() =>
@@ -442,6 +458,38 @@ describe("Agentic IDE launcher", () => {
expect(await screen.findByTestId("pane-Mika")).toBeTruthy();
});
+ it("opens the workspace in chat view when the view step says so", async () => {
+ vi.mocked(api.startIdeSession).mockResolvedValue(
+ stateWith(sessionWith(["Mika", "Nova"])),
+ );
+ render(<AgenticIdeView />);
+ await waitFor(() => expect(api.fetchIdeAgents).toHaveBeenCalled());
+ await openAgents();
+ fireEvent.click(screen.getAllByText("workspace_launcher.agents.all")[0]);
+
+ fireEvent.click(screen.getByRole("button", { name: /choose the view/i }));
+ fireEvent.click(screen.getByTestId("view-choice-chat"));
+ expect(
+ screen.getByTestId("view-choice-chat").getAttribute("aria-checked"),
+ ).toBe("true");
+
+ fireEvent.click(screen.getByRole("button", { name: /review workspace/i }));
+ expect(screen.getByTestId("review-view-mode").textContent).toBe(
+ "Chat view",
+ );
+ fireEvent.click(screen.getByRole("button", { name: /open workspace/i }));
+
+ // The grid reads the stored preference on mount, so the workspace comes up
+ // with the chat rail showing instead of the wall of terminals.
+ expect(await screen.findByTestId("pane-Mika")).toBeTruthy();
+ expect(
+ window.localStorage.getItem("jarvis.agenticIde.workspaceView"),
+ ).toBe("chat");
+ const rail = screen.getByTestId("agentic-chat-rail");
+ expect(rail.className).toContain("flex");
+ expect(rail.className).not.toContain("hidden");
+ });
+
it("keeps an aggregate agent split across backward navigation", async () => {
render(<AgenticIdeView />);
await waitFor(() => expect(api.fetchIdeAgents).toHaveBeenCalled());
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
index e2043a1214..41d56109fe 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
@@ -3,14 +3,14 @@
*
* Two states in one view:
*
- * * no workspace open → a four-step wizard: folder, how many terminals, an
- * aggregate agent allocation, then start,
+ * * no workspace open → a five-step wizard: folder, how many terminals, an
+ * aggregate agent allocation, grid or chat view, then start,
* * workspace open → the terminal grid (see AgenticGrid).
*
* The wizard order is deliberate and matches how the decision actually gets
- * made: you know the folder first, the number of panes second, and only then
- * care which agent sits in which pane. Every step is reversible and nothing is
- * started until the last one.
+ * made: you know the folder first, the number of panes second, then which agent
+ * sits in which pane, and last how you want to read them. Every step is
+ * reversible and nothing is started until the last one.
*
* i18n note: the section label and view header go through the locale files; the
* panel copy inside is still English-only source awaiting its i18n keys.
@@ -18,7 +18,12 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Loader2 } from "lucide-react";
import { useEventStore } from "@/store/events";
-import { AgenticGrid } from "@/components/agentic/AgenticGrid";
+import {
+ AgenticGrid,
+ rememberViewMode,
+ storedViewMode,
+ type WorkspaceView,
+} from "@/components/agentic/AgenticGrid";
import { VoicePanel } from "@/components/agentic/VoicePanel";
import {
WorkspaceLauncher,
@@ -132,6 +137,12 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
const [folder, setFolder] = useState<string | null>(null);
const [count, setCount] = useState(2);
const [planned, setPlanned] = useState<PlannedTerminal[]>([]);
+ // Grid or chat, the wizard's last decision. Starts from the remembered
+ // reading preference so returning users see their usual answer preselected;
+ // it is written back only when a workspace actually opens (see `start`).
+ const [view, setView] = useState<WorkspaceView>(
+ () => storedViewMode() ?? "grid",
+ );
// The registered subscriptions per CLI. Only ever used to OFFER a choice, so
// a failed load costs the picker, never the wizard: with none loaded every
// pane simply opens on the active account, exactly as before.
@@ -428,6 +439,9 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
const start = async () => {
if (!folder) return;
setBusy(true);
+ // Recorded BEFORE the grid can mount: the grid reads the stored preference
+ // once, when it appears, so the wizard's answer has to be on disk by then.
+ rememberViewMode(view);
try {
// The open answers with the whole state — the new workspace AND the bar.
// Re-fetching instead would be a race that can blank what was just opened.
@@ -821,6 +835,8 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
offer={offer}
onResume={() => void resumeAll()}
onDismissOffer={() => void dismissOffer()}
+ view={view}
+ onView={setView}
onStart={() => void start()}
/>
</div>