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
feat(ide): let every path build up to four rows, never past 4x4
rubenluetke10-beepb1208850ea22
diff --git a/jarvis/agentic_ide/layout_tree.py b/jarvis/agentic_ide/layout_tree.pyindex afd5ffdcef..2f1a996646 100644--- a/jarvis/agentic_ide/layout_tree.py+++ b/jarvis/agentic_ide/layout_tree.py@@ -170,6 +170,23 @@ def leaves(node: LayoutNode | None) -> list[str]:return found+def grid_span(node: LayoutNode | None) -> tuple[int, int]:+ """How many columns and rows ``node`` occupies at its widest and tallest.++ Siblings in a row add their columns and share the tallest row count;+ siblings in a column the other way round. Mirrored by `layoutSpan` in the+ frontend's ``workspaceDocking.ts``, which enforces the same grid bounds.+ """+ if node is None:+ return (0, 0)+ if isinstance(node, Leaf):+ return (1, 1)+ spans = [grid_span(child) for child in node.children]+ if node.direction == "row":+ return (sum(cols for cols, _ in spans), max(rows for _, rows in spans))+ return (max(cols for cols, _ in spans), sum(rows for _, rows in spans))++def contains(node: LayoutNode | None, pane: str) -> bool:return pane in leaves(node)diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.pyindex b742626900..aed467fc00 100644--- a/jarvis/agentic_ide/session.py+++ b/jarvis/agentic_ide/session.py@@ -4734,6 +4734,12 @@ class Registry:)else:session.layout = layout_tree.append_pane(session.layout, term.key)+ # A split or an appended column may not leave the largest grid the+ # workspace draws; past it the panes are dealt into the even grid+ # instead (voice and the CLI have no preview to stop them first).+ columns, rows = layout_tree.grid_span(session.layout)+ if columns > MAX_GRID_COLUMNS or rows > MAX_GRID_ROWS:+ self._row_major_grid(session)# Then every terminal back to an equal share — the same act as the# grid's "even out" button, run for the user on every open — EXCEPT# inside a container whose boundaries were dragged by handdiff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceAgentSetup.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceAgentSetup.test.tsxindex dfd3f6e945..fec919d232 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceAgentSetup.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceAgentSetup.test.tsx@@ -44,14 +44,23 @@ describe("Workspace agent selection", () => {expect(screen.getByTestId("plan").textContent).toBe("codex,codex");});- it("clears a removed editing target and never offers more than eight sessions", () => {+ it("offers up to sixteen sessions and names the grid they open as", () => {+ render(<Setup />);+ fireEvent.click(screen.getByRole("button", { name: "16 sessions" }));+ expect(screen.getByText(/opens as 4 × 4/)).toBeTruthy();+ fireEvent.click(screen.getByRole("button", { name: "9 sessions" }));+ expect(screen.getByText(/opens as 3 × 3/)).toBeTruthy();+ expect(screen.queryByRole("button", { name: "17 sessions" })).toBeNull();+ });++ it("clears a removed editing target when the count shrinks", () => {render(<Setup />);fireEvent.click(screen.getByRole("button", { name: "8 sessions" }));fireEvent.click(screen.getByRole("button", { name: "Edit session 8: Claude Code" }));fireEvent.click(screen.getByRole("button", { name: "1 session" }));fireEvent.click(screen.getByRole("button", { name: "Codex" }));expect(screen.getByTestId("plan").textContent).toBe("codex");- expect(screen.queryByRole("button", { name: "9 sessions" })).toBeNull();+ expect(screen.queryByRole("button", { name: "17 sessions" })).toBeNull();});it("fills an unassigned seat when discovery arrives without replacing existing picks", () => {diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceAgentSetup.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceAgentSetup.tsxindex ef2fe2fb8d..90ddc0ab3f 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceAgentSetup.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceAgentSetup.tsx@@ -3,16 +3,19 @@ import { Check } from "lucide-react";import type { AgentStatus } from "@/lib/agenticIdeApi";import { cn } from "@/lib/utils";import { AgentMark } from "./AgentMark";+import { MAX_WORKSPACE_PANES, balancedColumns } from "./workspaceDocking";interface Props {agents: AgentStatus[];sessions: string[];onChange: (sessions: string[]) => void;disabled?: boolean;+ /** The server's per-workspace pane limit (`max_terminals`). */+ maxSessions?: number;}/** One launch plan: choose an agent for everyone, then customize individual seats. */-export function WorkspaceAgentSetup({ agents, sessions, onChange, disabled = false }: Props) {+export function WorkspaceAgentSetup({ agents, sessions, onChange, disabled = false, maxSessions = MAX_WORKSPACE_PANES }: Props) {const [editingSeat, setEditing] = useState<number | null>(null);const editing = editingSeat !== null && editingSeat < sessions.length ? editingSeat : null;const firstAgent = agents[0]?.name ?? "";@@ -82,14 +85,16 @@ export function WorkspaceAgentSetup({ agents, sessions, onChange, disabled = fal<section aria-label="Number of sessions"><h3 className="mb-3 text-xs font-semibold uppercase tracking-[0.14em] text-muted-foreground">How many sessions?</h3><div className="flex flex-wrap items-center gap-2">- {Array.from({ length: 8 }, (_, index) => index + 1).map((count) => <button+ {Array.from({ length: maxSessions }, (_, index) => index + 1).map((count) => <buttonkey={count} type="button" aria-label={`${count} ${count === 1 ? "session" : "sessions"}`}aria-pressed={sessions.length === count} disabled={disabled || !firstAgent}onClick={() => chooseCount(count)}className={cn("flex h-11 w-11 items-center justify-center rounded-lg border text-sm font-semibold tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40", sessions.length === count ? selection : idle)}>{count}</button>)}- <span className="ml-2 text-xs text-muted-foreground">Up to 8 per workspace</span>+ <span className="ml-2 text-xs text-muted-foreground">+ Up to {maxSessions} per workspace{sessions.length > 1 && <> · opens as {balancedColumns(sessions.length)} × {Math.ceil(sessions.length / balancedColumns(sessions.length))}</>}+ </span></div></section>diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsxindex 6570f18a09..1b1d443d98 100644--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx@@ -487,7 +487,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {<input value={workspaceName} disabled={busy} onChange={(event) => setWorkspaceName(event.target.value)}placeholder="Workspace" className="mt-2 h-11 w-full rounded-lg border border-input bg-background/60 px-3 text-sm text-foreground outline-none focus:border-ring focus:ring-1 focus:ring-ring/30" /></label>- <WorkspaceAgentSetup agents={installed} sessions={workspaceAgents} onChange={setWorkspaceAgents} disabled={busy} />+ <WorkspaceAgentSetup agents={installed} sessions={workspaceAgents} onChange={setWorkspaceAgents} disabled={busy} maxSessions={maxPanes} /></div><footer className="flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-border bg-muted/20 px-6 py-4 sm:px-8"><span className="text-xs text-muted-foreground" aria-live="polite">{workspaceAgents.length} {workspaceAgents.length === 1 ? "session" : "sessions"} · {new Set(workspaceAgents.filter(Boolean)).size} {new Set(workspaceAgents.filter(Boolean)).size === 1 ? "agent" : "agents"}</span>diff --git a/tests/unit/agentic_ide/test_many_terminals.py b/tests/unit/agentic_ide/test_many_terminals.pyindex 5f56d092c6..a41a21b6e0 100644--- a/tests/unit/agentic_ide/test_many_terminals.py+++ b/tests/unit/agentic_ide/test_many_terminals.py@@ -237,3 +237,38 @@ async def test_a_full_workspace_rebalances_into_four_by_four(assert all(len(ide.layout_tree.leaves(row)) == ide.MAX_GRID_COLUMNS for row in layout.children)with pytest.raises(ide.SessionError):await registry.add_terminal(agent="claude")+++ ("count", "direction"), [(8, None), (12, None), (15, "down"), (15, "right")]+)+async def test_no_way_of_adding_a_pane_leaves_the_four_by_four_grid(+ registry: ide.Registry, tmp_path: Path, count: int, direction: str | None+) -> None:+ """Voice and the CLI have no preview, so the server keeps the bounds itself."""+ await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(count)])+ session = registry.session+ assert session is not None+ if direction is None:+ await registry.add_terminal(agent="claude")+ else:+ await registry.add_terminal(+ anchor=session.terminals[0].name, agent="claude", direction=direction+ )+ columns, rows = ide.layout_tree.grid_span(session.layout)+ assert columns <= ide.MAX_GRID_COLUMNS and rows <= ide.MAX_GRID_ROWS+ assert len(ide.layout_tree.leaves(session.layout)) == count + 1+++async def test_a_split_within_the_grid_keeps_the_users_shape(+ registry: ide.Registry, tmp_path: Path+) -> None:+ """Rebalancing is only the fallback: a split that fits stays where it was put."""+ await registry.start(str(tmp_path), [{"agent": "claude"} for _ in range(8)])+ session = registry.session+ assert session is not None+ anchor = session.terminals[0]+ added = await registry.add_terminal(anchor=anchor.name, agent="claude", direction="down")+ assert ide.layout_tree.grid_span(session.layout) == (4, 3)+ first_column = ide.layout_tree.leaves(session.layout)+ assert first_column.index(added.key) > first_column.index(anchor.key)