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): expand responsive workspace tabs

rubenluetke10-beep79f254ab97dd
diff --git a/jarvis/agentic_ide/resume_store.py b/jarvis/agentic_ide/resume_store.py
index 0cddba3908..f915dd0bbb 100644
--- a/jarvis/agentic_ide/resume_store.py
+++ b/jarvis/agentic_ide/resume_store.py
@@ -238,7 +238,7 @@ class Snapshot:
**The bug this exists for.** Remembering closed folders (so opening one
new workspace could not wipe out the twelve panes you shut down an hour
- ago) turned the restore point into an archive of the last ten folders
+ ago) turned the restore point into an archive of recently used folders
ever opened — and "Resume all sessions" reopened all ten. Restarting
therefore brought back Tuesday's folders beside today's, each one
carrying the same call-signs out of the same pool, so the deduplicator
@@ -374,7 +374,7 @@ def save(snapshot: Snapshot) -> None:
# How many workspaces one restore point may remember. Above the number that can
# be open at once, so folders you closed earlier survive alongside what is open
# now — and bounded, so the offer stays a screen rather than an archive.
-MAX_REMEMBERED_WORKSPACES = 10
+MAX_REMEMBERED_WORKSPACES = 20
def _merged_with_stored(snapshot: Snapshot) -> Snapshot:
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index 1076235826..0cae86f77b 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -263,9 +263,9 @@ MOVE_POSITIONS = ("swap", "left", "right", "above", "below")
MAX_PROMPT_CHARS = 6000
# How many workspaces may be open at once. Not a technical ceiling — a real one
# costs a folder's worth of running coding agents, so the cap exists to keep an
-# accidental click from spawning them, and the number is what still fits in a
-# row of tabs the user can read.
-MAX_WORKSPACES = 6
+# accidental click from spawning them. The workspace bar compacts crowded tabs
+# into numbered folder icons, which keeps this larger set on one visible row.
+MAX_WORKSPACES = 12
# How long to wait for the pane to SHOW the prompt before pressing Enter, and
# how finely to look. This replaced a fixed 120 ms delay: the wait is not really
# about debouncing, it is about the pane having taken the text at all. A pane
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
index e75b8c9ee2..ce491eb8bc 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
@@ -2415,6 +2415,30 @@ describe("the workspace header row", () => {
).toBe(true);
});
+ it("keeps crowded toolbar controls in one narrow-window overflow panel", () => {
+ renderGrid(BASE, {
+ workspaceBar: <div data-testid="stand-in-tabs">tabs</div>,
+ appActions: <button type="button">Restart</button>,
+ });
+
+ const trigger = screen.getByTestId("agentic-toolbar-overflow");
+ fireEvent.click(trigger);
+ const panel = screen.getByTestId("agentic-toolbar-overflow-panel");
+ expect(trigger.getAttribute("aria-expanded")).toBe("true");
+ expect(panel.contains(screen.getByTestId("agentic-focus-toggle"))).toBe(true);
+ expect(panel.contains(screen.getByRole("button", { name: "Restart" }))).toBe(true);
+ expect(
+ (screen.getByRole("button", {
+ name: "Close workspace controls",
+ }) as HTMLButtonElement).tabIndex,
+ ).toBe(-1);
+
+ fireEvent.focus(screen.getByTestId("agentic-focus-toggle"));
+ fireEvent.keyDown(panel, { key: "Escape" });
+ expect(trigger.getAttribute("aria-expanded")).toBe("false");
+ expect(document.activeElement).toBe(trigger);
+ });
+
it("names the project itself when no tabs were handed to it", () => {
// The wizard and the component tests render the grid on its own. Without
// the tabs the row would otherwise open with no idea which folder it is.
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index dee7b0484f..b4866b99dd 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -30,6 +30,7 @@ import {
Minus,
MoveHorizontal,
Moon,
+ MoreHorizontal,
Plus,
Power,
Search,
@@ -2299,6 +2300,8 @@ export function AgenticGrid({
</span>
)}
+ <ToolbarOverflow>
+
{/* Focus mode — the explicit switch into "Jarvis codes with me here".
A quiet glyph that lights up while the mode is on; the one-time
intro dialog and the tooltip carry the explanation. */}
@@ -2534,6 +2537,7 @@ export function AgenticGrid({
{appActions}
</div>
)}
+ </ToolbarOverflow>
</div>
{/* ------------------------------------------------------------- grid */}
@@ -3618,6 +3622,67 @@ function ViewMenu({
);
}
+/**
+ * Keep every workspace tab visible in the desktop's narrowest supported window.
+ *
+ * At normal widths this wrapper is `display: contents`, so the toolbar keeps
+ * its exact established order and spacing. Below 900 px the controls stay
+ * mounted but move behind one overflow button; live status controls therefore
+ * keep their state and polling while the tab bar receives its reserved width.
+ */
+function ToolbarOverflow({ children }: { children: React.ReactNode }) {
+ const t = useT();
+ const [open, setOpen] = useState(false);
+ const triggerRef = useRef<HTMLButtonElement>(null);
+ const closeAndRestoreFocus = () => {
+ setOpen(false);
+ triggerRef.current?.focus();
+ };
+ return (
+ <div className="contents max-[900px]:relative max-[900px]:block max-[900px]:shrink-0">
+ <button
+ ref={triggerRef}
+ type="button"
+ data-testid="agentic-toolbar-overflow"
+ aria-expanded={open}
+ aria-controls="agentic-toolbar-overflow-panel"
+ aria-label={t("agentic_grid.toolbar.more_controls")}
+ title={t("agentic_grid.toolbar.more_controls")}
+ onClick={() => setOpen((current) => !current)}
+ className={cn(TOOLBAR_BTN, "hidden max-[900px]:flex")}
+ >
+ <MoreHorizontal className="h-4 w-4" />
+ </button>
+ {open && (
+ <button
+ type="button"
+ tabIndex={-1}
+ aria-label={t("agentic_grid.toolbar.close_controls")}
+ className="fixed inset-0 z-40 hidden cursor-default max-[900px]:block"
+ onClick={() => setOpen(false)}
+ />
+ )}
+ <div
+ id="agentic-toolbar-overflow-panel"
+ data-testid="agentic-toolbar-overflow-panel"
+ onKeyDown={(event) => {
+ if (event.key !== "Escape") return;
+ event.preventDefault();
+ closeAndRestoreFocus();
+ }}
+ className={cn(
+ "contents",
+ open
+ ? "max-[900px]:absolute max-[900px]:right-0 max-[900px]:top-full max-[900px]:z-50 max-[900px]:mt-1 max-[900px]:flex max-[900px]:w-[min(22rem,calc(100vw-1rem))] max-[900px]:flex-wrap max-[900px]:items-center max-[900px]:justify-end max-[900px]:gap-1 max-[900px]:rounded-xl max-[900px]:border max-[900px]:border-border max-[900px]:bg-card max-[900px]:p-2 max-[900px]:shadow-xl"
+ : "max-[900px]:hidden",
+ )}
+ >
+ {children}
+ </div>
+ </div>
+ );
+}
+
/** Always-visible terminal text sizing for the active workspace. */
/**
* The toolbar's voice button — summons the floating voice bubble.
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.test.tsx
new file mode 100644
index 0000000000..a7b73ad04e
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.test.tsx
@@ -0,0 +1,165 @@
+import { fireEvent, render, screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+import type { WorkspaceCard } from "@/lib/agenticIdeApi";
+import { WorkspaceBar } from "./WorkspaceBar";
+
+function card(index: number): WorkspaceCard {
+ return {
+ id: `w${index}`,
+ folder: `C:/work/Workspace ${index}`,
+ name: `Workspace ${index}`,
+ branch: "main",
+ terminals: 2,
+ live_terminals: 2,
+ focus_mode: false,
+ created_at: index,
+ last_active_at: index,
+ active: index === 1,
+ };
+}
+
+function renderBar(count: number, maxWorkspaces = 12, embedded = false) {
+ return render(
+ <WorkspaceBar
+ workspaces={Array.from({ length: count }, (_, index) => card(index + 1))}
+ activeId="w1"
+ addingNew={false}
+ maxWorkspaces={maxWorkspaces}
+ onSelect={vi.fn()}
+ onAdd={vi.fn()}
+ onRename={vi.fn(async () => true)}
+ onClose={vi.fn()}
+ embedded={embedded}
+ />,
+ );
+}
+
+describe("WorkspaceBar density", () => {
+ it("keeps six named workspaces in one shrinking row without a scrollbar", () => {
+ const bounds = vi
+ .spyOn(HTMLElement.prototype, "getBoundingClientRect")
+ .mockReturnValue({ width: 1200 } as DOMRect);
+ renderBar(6);
+
+ const bar = screen.getByTestId("workspace-bar");
+ expect(bar.dataset.density).toBe("full");
+ expect(bar.className).toContain("overflow-hidden");
+ expect(bar.className).not.toContain("overflow-x-auto");
+ expect(screen.getByText("Workspace 6").className).not.toContain("sr-only");
+ expect((screen.getByTestId("workspace-add") as HTMLButtonElement).disabled).toBe(
+ false,
+ );
+ bounds.mockRestore();
+ });
+
+ it("compacts additional workspaces to folder icons and ordinal numbers", () => {
+ const bounds = vi
+ .spyOn(HTMLElement.prototype, "getBoundingClientRect")
+ .mockReturnValue({ width: 800 } as DOMRect);
+ renderBar(9);
+
+ expect(screen.getByTestId("workspace-bar").dataset.density).toBe("compact");
+ for (let index = 1; index <= 9; index += 1) {
+ expect(screen.getByTestId(`workspace-ordinal-w${index}`).textContent).toBe(
+ String(index),
+ );
+ expect(screen.getByText(`Workspace ${index}`).className).toContain("sr-only");
+ }
+ expect((screen.getByTestId("workspace-add") as HTMLButtonElement).disabled).toBe(
+ false,
+ );
+ expect(screen.getByText("New workspace").className).toContain("sr-only");
+ bounds.mockRestore();
+ });
+
+ it("renders all twelve workspaces and only then reaches the cap", () => {
+ renderBar(12);
+
+ expect(screen.getAllByRole("tab")).toHaveLength(13);
+ expect(screen.getByTestId("workspace-ordinal-w12").textContent).toBe("12");
+ expect((screen.getByTestId("workspace-add") as HTMLButtonElement).disabled).toBe(
+ true,
+ );
+ });
+
+ it("drops the folder glyph tier when the measured bar is especially narrow", () => {
+ const bounds = vi
+ .spyOn(HTMLElement.prototype, "getBoundingClientRect")
+ .mockReturnValue({ width: 200 } as DOMRect);
+ renderBar(9, 12, true);
+
+ expect(screen.getByTestId("workspace-bar").dataset.density).toBe("ordinal");
+ expect(screen.getByTestId("workspace-ordinal-w9").textContent).toBe("9");
+ expect(screen.getByTestId("workspace-bar").parentElement?.className).toContain(
+ "min-w-[12rem]",
+ );
+ bounds.mockRestore();
+ });
+
+ it("moves focus across the workspace tabs with arrow, home and end keys", () => {
+ renderBar(4);
+ const tabs = screen.getAllByRole("tab") as HTMLButtonElement[];
+
+ fireEvent.focus(tabs[0]);
+ fireEvent.keyDown(tabs[0], { key: "ArrowRight" });
+ expect(document.activeElement).toBe(tabs[1]);
+ fireEvent.keyDown(tabs[1], { key: "End" });
+ expect(document.activeElement).toBe(tabs[4]);
+ fireEvent.keyDown(tabs[4], { key: "Home" });
+ expect(document.activeElement).toBe(tabs[0]);
+ fireEvent.keyDown(tabs[0], { key: "ArrowLeft" });
+ expect(document.activeElement).toBe(tabs[4]);
+ });
+
+ it("keeps exactly one declarative tab stop after an external workspace switch", () => {
+ const props = {
+ workspaces: Array.from({ length: 4 }, (_, index) => card(index + 1)),
+ addingNew: false,
+ maxWorkspaces: 12,
+ onSelect: vi.fn(),
+ onAdd: vi.fn(),
+ onRename: vi.fn(async () => true),
+ onClose: vi.fn(),
+ };
+ const { rerender } = render(<WorkspaceBar {...props} activeId="w1" />);
+ const tabs = screen.getAllByRole("tab") as HTMLButtonElement[];
+ fireEvent.focus(tabs[0]);
+ fireEvent.keyDown(tabs[0], { key: "ArrowRight" });
+
+ rerender(<WorkspaceBar {...props} activeId="w3" />);
+
+ const currentTabs = screen.getAllByRole("tab") as HTMLButtonElement[];
+ expect(currentTabs.filter((tab) => tab.tabIndex === 0)).toEqual([currentTabs[2]]);
+ });
+
+ it("preserves roved focus when a refresh clones the same workspace list", () => {
+ const callbacks = {
+ addingNew: false,
+ maxWorkspaces: 12,
+ onSelect: vi.fn(),
+ onAdd: vi.fn(),
+ onRename: vi.fn(async () => true),
+ onClose: vi.fn(),
+ };
+ const initial = Array.from({ length: 4 }, (_, index) => card(index + 1));
+ const { rerender } = render(
+ <WorkspaceBar {...callbacks} workspaces={initial} activeId="w1" />,
+ );
+ const tabs = screen.getAllByRole("tab") as HTMLButtonElement[];
+ fireEvent.focus(tabs[0]);
+ fireEvent.keyDown(tabs[0], { key: "ArrowRight" });
+
+ rerender(
+ <WorkspaceBar
+ {...callbacks}
+ workspaces={initial.map((workspace) => ({ ...workspace }))}
+ activeId="w1"
+ />,
+ );
+
+ const refreshedTabs = screen.getAllByRole("tab") as HTMLButtonElement[];
+ expect(refreshedTabs.filter((tab) => tab.tabIndex === 0)).toEqual([
+ refreshedTabs[1],
+ ]);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx
index d2478d1854..34517c1766 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx
@@ -25,12 +25,41 @@
* another one — it addresses the workspace by name instead of making the user
* switch first, drop second, and remember which pane had focus.
*/
-import { useEffect, useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { Check, FolderGit2, Pencil, Plus, X } from "lucide-react";
+import { useT } from "@/i18n";
import { cn } from "@/lib/utils";
import type { WorkspaceCard } from "@/lib/agenticIdeApi";
import { dragCarriesFiles, extractPaneDrop, type PaneDropPayload } from "./paneDrop";
+/** Names remain useful through six tabs; after that, numbered icons scan better. */
+const COMPACT_FROM_WORKSPACES = 7;
+const FULL_TAB_TARGET_PX = 112;
+const FULL_ADD_BUTTON_PX = 116;
+const COMPACT_TAB_TARGET_PX = 36;
+const COMPACT_ADD_BUTTON_PX = 28;
+const ADD_TAB_FOCUS_ID = "__add_workspace__";
+
+type WorkspaceDensity = "full" | "compact" | "ordinal";
+
+/** Pick the smallest readable presentation for the space the toolbar left us. */
+function densityFor(width: number | null, workspaceCount: number): WorkspaceDensity {
+ const measured = width !== null;
+ if (
+ measured &&
+ width < workspaceCount * COMPACT_TAB_TARGET_PX + COMPACT_ADD_BUTTON_PX
+ ) {
+ return "ordinal";
+ }
+ if (
+ workspaceCount >= COMPACT_FROM_WORKSPACES ||
+ (measured && width < workspaceCount * FULL_TAB_TARGET_PX + FULL_ADD_BUTTON_PX)
+ ) {
+ return "compact";
+ }
+ return "full";
+}
+
interface WorkspaceBarProps {
workspaces: WorkspaceCard[];
/** Id of the workspace on screen, or null while the wizard is showing. */
@@ -80,6 +109,8 @@ export function WorkspaceBar({
actions,
embedded = false,
}: WorkspaceBarProps) {
+ const t = useT();
+ const barRef = useRef<HTMLDivElement>(null);
// Which tab has its close button armed. One at a time, and cleared on every
// other interaction, so an armed X can never be clicked by accident later.
const [confirming, setConfirming] = useState<string | null>(null);
@@ -88,6 +119,11 @@ export function WorkspaceBar({
// Which tab a file drag is currently over. One at a time — a drag has one
// position — so this is an id rather than a set.
const [dropTarget, setDropTarget] = useState<string | null>(null);
+ const [barWidth, setBarWidth] = useState<number | null>(null);
+ const [rovingFocusId, setRovingFocusId] = useState(
+ addingNew ? ADD_TAB_FOCUS_ID : (activeId ?? workspaces[0]?.id ?? ADD_TAB_FOCUS_ID),
+ );
+ const workspaceIdKey = workspaces.map((workspace) => workspace.id).join("\u0000");
const full = workspaces.length >= maxWorkspaces;
// A drag that ends anywhere else owes this bar no `dragleave`, and a tab left
@@ -167,6 +203,71 @@ export function WorkspaceBar({
*/
const hasTabs = workspaces.length > 0;
+ // The surrounding toolbar owns a variable number of icon controls. Count
+ // alone cannot know how much width they leave, so the tab density follows the
+ // space the bar actually receives and updates as the desktop window changes.
+ useEffect(() => {
+ const bar = barRef.current;
+ if (!hasTabs || !bar) return;
+ const update = (width: number) => {
+ if (width >= 0 && Number.isFinite(width)) setBarWidth(width);
+ };
+ update(bar.getBoundingClientRect().width);
+ if (typeof ResizeObserver === "undefined") return;
+ const observer = new ResizeObserver((entries) => {
+ update(entries[0]?.contentRect.width ?? bar.getBoundingClientRect().width);
+ });
+ observer.observe(bar);
+ return () => observer.disconnect();
+ }, [hasTabs]);
+
+ // An external workspace switch becomes the roving tab stop too. Keeping the
+ // value in React state avoids imperative DOM mutations leaving two tab stops
+ // behind after a parent rerender.
+ useEffect(() => {
+ setRovingFocusId(
+ addingNew ? ADD_TAB_FOCUS_ID : (activeId ?? workspaces[0]?.id ?? ADD_TAB_FOCUS_ID),
+ );
+ }, [activeId, addingNew]);
+
+ // A refreshed array with the same IDs is not a navigation event. Only repair
+ // roving focus when its actual target disappeared (or Add became disabled).
+ useEffect(() => {
+ setRovingFocusId((current) => {
+ const stillAvailable =
+ current === ADD_TAB_FOCUS_ID
+ ? !full
+ : workspaces.some((workspace) => workspace.id === current);
+ if (stillAvailable) return current;
+ return activeId ?? workspaces[0]?.id ?? (!full ? ADD_TAB_FOCUS_ID : current);
+ });
+ }, [workspaceIdKey, full]);
+
+ const density = densityFor(barWidth, workspaces.length);
+ const compact = density !== "full";
+ const ordinalOnly = density === "ordinal";
+
+ /** Standard roving focus for a tablist with up to thirteen focus targets. */
+ const moveTabFocus = (event: React.KeyboardEvent<HTMLDivElement>) => {
+ if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
+ const tabs = Array.from(
+ event.currentTarget.querySelectorAll<HTMLElement>('[role="tab"]:not(:disabled)'),
+ );
+ const current = (event.target as HTMLElement).closest<HTMLElement>('[role="tab"]');
+ const currentIndex = current ? tabs.indexOf(current) : -1;
+ if (currentIndex < 0 || tabs.length === 0) return;
+ event.preventDefault();
+ let nextIndex = currentIndex;
+ if (event.key === "Home") nextIndex = 0;
+ if (event.key === "End") nextIndex = tabs.length - 1;
+ if (event.key === "ArrowRight") nextIndex = (currentIndex + 1) % tabs.length;
+ if (event.key === "ArrowLeft") nextIndex = (currentIndex - 1 + tabs.length) % tabs.length;
+ const next = tabs[nextIndex];
+ if (!next) return;
+ setRovingFocusId(next.dataset.workspaceFocusId ?? ADD_TAB_FOCUS_ID);
+ next.focus();
+ };
+
// Nothing open, nothing to add to and no controls to carry: the wizard IS the
// screen, and an empty bar above it would be furniture.
if (!hasTabs && !actions) return null;
@@ -175,22 +276,54 @@ export function WorkspaceBar({
<div
className={cn(
"flex items-center gap-2",
- embedded ? "min-w-0 flex-1" : "border-b border-border px-2 py-1",
+ embedded ? "min-w-[12rem] flex-1" : "border-b border-border px-2 py-1",
)}
>
{!hasTabs && <div className="min-w-0 flex-1" />}
{hasTabs && (
<div
+ ref={barRef}
data-testid="workspace-bar"
- className="flex min-w-0 flex-1 items-center gap-1 overflow-x-auto scrollbar-jarvis"
+ data-density={density}
+ className={cn(
+ "flex min-w-0 flex-1 items-center overflow-hidden",
+ ordinalOnly ? "gap-px" : "gap-1",
+ )}
role="tablist"
- aria-label="Open workspaces"
+ aria-label={t("workspace_bar.open_workspaces")}
+ onKeyDown={moveTabFocus}
>
- {workspaces.map((workspace) => {
+ {workspaces.map((workspace, index) => {
const selected = !addingNew && workspace.id === activeId;
const armed = confirming === workspace.id;
const renaming = editing === workspace.id;
const dropping = dropTarget === workspace.id;
+ const summary = t(
+ workspace.terminals === 1
+ ? "workspace_bar.workspace_summary_one"
+ : "workspace_bar.workspace_summary_many",
+ )
+ .replace("{workspace}", workspace.name)
+ .replace("{index}", String(index + 1))
+ .replace("{count}", String(workspace.terminals));
+ const overlayAlignment =
+ index === 0
+ ? "left-0"
+ : index === workspaces.length - 1
+ ? "right-0"
+ : "left-1/2 -translate-x-1/2";
+ const ordinalRenamePosition =
+ index === 0
+ ? "left-0"
+ : index === workspaces.length - 1
+ ? "right-5"
+ : "left-1/2 -translate-x-full";
+ const ordinalClosePosition =
+ index === 0
+ ? "left-5"
+ : index === workspaces.length - 1
+ ? "right-0"
+ : "left-1/2";
return (
<div
key={workspace.id}
@@ -209,9 +342,18 @@ export function WorkspaceBar({
* anything else in this row. One filled surface carries "you are
* here"; the glyph keeps the colour because it is the smallest of
* the four and reads at a glance across a wide bar.
- */
+ */
className={cn(
- "group/tab flex shrink-0 items-center gap-1.5 rounded-control border px-2 py-1 transition-colors",
+ "group/tab relative flex items-center gap-1.5 rounded-control border py-1 transition-colors",
+ compact
+ ? ordinalOnly
+ ? "min-w-0 flex-1 basis-0 justify-center px-0"
+ : renaming
+ ? "min-w-0 flex-[10_1_0%] px-1"
+ : armed
+ ? "min-w-0 flex-[8_1_0%] px-1"
+ : "min-w-0 flex-1 basis-0 justify-center px-1 hover:flex-[3_1_0%] focus-within:flex-[3_1_0%]"
+ : "min-w-[2.5rem] max-w-[18rem] shrink px-2",
dropping
? "border-dashed border-primary bg-primary/10"
: selected
@@ -221,7 +363,12 @@ export function WorkspaceBar({
>
{renaming ? (
<form
- className="flex items-center gap-1"
+ className={cn(
+ "flex items-center gap-1",
+ ordinalOnly &&
+ "absolute top-0 z-30 rounded-control border border-border bg-secondary p-0.5 shadow-lg",
+ ordinalOnly && overlayAlignment,
+ )}
onSubmit={(event) => {
event.preventDefault();
void commitRename(workspace);
@@ -239,7 +386,10 @@ export function WorkspaceBar({
onKeyDown={(event) => {
if (event.key === "Escape") setEditing(null);
}}
- className="w-40 rounded border border-primary/40 bg-background px-2 py-0.5 text-sm outline-none focus:border-primary disabled:opacity-60"
+ className={cn(
+ "rounded border border-primary/40 bg-background px-2 py-0.5 text-sm outline-none focus:border-primary disabled:opacity-60",
+ ordinalOnly ? "w-24" : "w-40",
+ )}
/>
<button
type="submit"
@@ -266,24 +416,34 @@ export function WorkspaceBar({
type="button"
role="tab"
aria-selected={selected}
+ aria-label={summary}
+ tabIndex={rovingFocusId === workspace.id ? 0 : -1}
+ data-workspace-focus-id={workspace.id}
disabled={busy}
data-testid={`workspace-tab-${workspace.id}`}
- title={workspace.folder}
+ title={compact ? `${summary} — ${workspace.folder}` : workspace.folder}
onClick={() => {
setConfirming(null);
if (!selected) onSelect(workspace.id);
}}
- className="flex min-w-0 items-center gap-2 text-left disabled:cursor-not-allowed disabled:opacity-60"
+ onFocus={() => setRovingFocusId(workspace.id)}
+ className={cn(
+ "flex min-w-0 items-center text-left disabled:cursor-not-allowed disabled:opacity-60",
+ compact ? "flex-1 justify-center gap-1" : "gap-2",
+ )}
>
- <FolderGit2
- className={cn(
- "h-3.5 w-3.5 shrink-0",
- selected ? "text-primary" : "text-muted-foreground",
- )}
- />
+ {!ordinalOnly && (
+ <FolderGit2
+ className={cn(
+ "h-3.5 w-3.5 shrink-0",
+ selected ? "text-primary" : "text-muted-foreground",
+ )}
+ />
+ )}
<span
className={cn(
"max-w-[14rem] truncate text-sm",
+ compact && "sr-only",
selected
? "font-medium text-foreground"
: "text-muted-foreground",
@@ -291,7 +451,19 @@ export function WorkspaceBar({
>
{workspace.name}
</span>
- <PaneCount workspace={workspace} selected={selected} />
+ {compact ? (
+ <span
+ data-testid={`workspace-ordinal-${workspace.id}`}
+ className={cn(
+ "font-mono text-[11px] tabular-nums",
+ selected ? "font-semibold text-foreground" : "text-muted-foreground",
+ )}
+ >
+ {index + 1}
+ </span>
+ ) : (
+ <PaneCount workspace={workspace} selected={selected} />
+ )}
</button>
<button
@@ -301,7 +473,11 @@ export function WorkspaceBar({
disabled={busy}
data-testid={`workspace-rename-${workspace.id}`}
onClick={() => beginRename(workspace)}
- className="flex h-5 w-5 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover/tab:opacity-100 disabled:opacity-40"
+ className={cn(
+ "flex h-5 w-5 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover/tab:opacity-100 disabled:opacity-40",
+ compact && "absolute z-20 bg-secondary/95",
+ compact && (ordinalOnly ? ordinalRenamePosition : "left-0"),
+ )}
>
<Pencil className="h-3 w-3" />
</button>
@@ -309,7 +485,14 @@ export function WorkspaceBar({
)}
{!renaming && armed ? (
- <span className="flex items-center gap-1">
+ <span
+ className={cn(
+ "flex items-center gap-1",
+ ordinalOnly &&
+ "absolute top-0 z-30 rounded-control border border-border bg-secondary p-0.5 shadow-lg",
+ ordinalOnly && overlayAlignment,
+ )}
+ >
<button
type="button"
disabled={busy}
@@ -342,7 +525,12 @@ export function WorkspaceBar({
onClick={() => setConfirming(workspace.id)}
className={cn(
"flex h-5 w-5 items-center justify-center rounded text-muted-foreground transition-opacity hover:bg-destructive/20 hover:text-destructive",
- selected
+ compact
+ ? cn(
+ "absolute z-20 bg-secondary/95 opacity-0 focus-visible:opacity-100 group-hover/tab:opacity-100",
+ ordinalOnly ? ordinalClosePosition : "right-0",
+ )
+ : selected
? "opacity-100"
: "opacity-0 focus-visible:opacity-100 group-hover/tab:opacity-100",
)}
@@ -358,6 +546,8 @@ export function WorkspaceBar({
type="button"
role="tab"
aria-selected={addingNew}
+ tabIndex={rovingFocusId === ADD_TAB_FOCUS_ID ? 0 : -1}
+ data-workspace-focus-id={ADD_TAB_FOCUS_ID}
disabled={busy || full}
data-testid="workspace-add"
title={
@@ -369,15 +559,23 @@ export function WorkspaceBar({
setConfirming(null);
onAdd();
}}
+ onFocus={() => setRovingFocusId(ADD_TAB_FOCUS_ID)}
className={cn(
- "flex shrink-0 items-center gap-1.5 rounded-lg border border-transparent px-2 py-1 text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-40",
+ "flex shrink-0 items-center rounded-lg border border-transparent text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-40",
+ ordinalOnly
+ ? "h-7 w-6 justify-center p-0"
+ : compact
+ ? "h-7 w-7 justify-center p-0"
+ : "gap-1.5 px-2 py-1",
addingNew
? "border-primary/50 bg-primary/10 text-primary"
: "text-muted-foreground hover:bg-secondary hover:text-foreground",
)}
>
<Plus className="h-3.5 w-3.5" />
- New workspace
+ <span className={cn(compact && "sr-only")}>
+ {t("workspace_bar.new_workspace")}
+ </span>
</button>
</div>
)}
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index b887981cc2..0fc8eadc71 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -3728,6 +3728,12 @@
"paste_unavailable": "Zwischenablage konnte nicht gelesen werden.",
"paste_failed": "Hier kann nicht eingefügt werden."
},
+ "workspace_bar": {
+ "open_workspaces": "Offene Arbeitsbereiche",
+ "workspace_summary_one": "{workspace}, Arbeitsbereich {index}, 1 Terminal",
+ "workspace_summary_many": "{workspace}, Arbeitsbereich {index}, {count} Terminals",
+ "new_workspace": "Neuer Arbeitsbereich"
+ },
"workspace_launcher": {
"wizard": {
"new_workspace": "Neuer Arbeitsbereich",
@@ -3895,6 +3901,10 @@
}
},
"agentic_grid": {
+ "toolbar": {
+ "more_controls": "Weitere Arbeitsbereich-Steuerelemente",
+ "close_controls": "Arbeitsbereich-Steuerelemente schließen"
+ },
"continue": {
"button": "Fortsetzen",
"hint": "Prüfen, welche Coding-Sitzungen unterbrochen wurden, und sie weiterarbeiten lassen.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index d2ae2cc6a2..d44cedba86 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -3728,6 +3728,12 @@
"paste_unavailable": "Could not read the clipboard.",
"paste_failed": "Cannot paste here."
},
+ "workspace_bar": {
+ "open_workspaces": "Open workspaces",
+ "workspace_summary_one": "{workspace}, workspace {index}, 1 terminal",
+ "workspace_summary_many": "{workspace}, workspace {index}, {count} terminals",
+ "new_workspace": "New workspace"
+ },
"workspace_launcher": {
"wizard": {
"new_workspace": "New workspace",
@@ -3895,6 +3901,10 @@
}
},
"agentic_grid": {
+ "toolbar": {
+ "more_controls": "More workspace controls",
+ "close_controls": "Close workspace controls"
+ },
"continue": {
"button": "Continue",
"hint": "Check which coding sessions were interrupted and tell them to carry on.",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 21378d0043..1aa19bea72 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -3728,6 +3728,12 @@
"paste_unavailable": "No se pudo leer el portapapeles.",
"paste_failed": "Aquí no se puede pegar."
},
+ "workspace_bar": {
+ "open_workspaces": "Espacios de trabajo abiertos",
+ "workspace_summary_one": "{workspace}, espacio de trabajo {index}, 1 terminal",
+ "workspace_summary_many": "{workspace}, espacio de trabajo {index}, {count} terminales",
+ "new_workspace": "Nuevo espacio de trabajo"
+ },
"workspace_launcher": {
"wizard": {
"new_workspace": "Nuevo espacio de trabajo",
@@ -3895,6 +3901,10 @@
}
},
"agentic_grid": {
+ "toolbar": {
+ "more_controls": "Más controles del espacio de trabajo",
+ "close_controls": "Cerrar controles del espacio de trabajo"
+ },
"continue": {
"button": "Continuar",
"hint": "Comprueba qué sesiones de programación se interrumpieron y pídeles que sigan.",
diff --git a/tests/unit/agentic_ide/test_many_terminals.py b/tests/unit/agentic_ide/test_many_terminals.py
index a7cf279d3f..e890fbaba3 100644
--- a/tests/unit/agentic_ide/test_many_terminals.py
+++ b/tests/unit/agentic_ide/test_many_terminals.py
@@ -1,10 +1,10 @@
"""What holds — and what does not — once a workspace has far more than 12 panes.
-The cap was 12 and is now 100 per workspace, with up to 6 workspaces. Twelve was
-small enough that several things could get away with being O(n) in disguise or
-quietly bounded; a hundred is not. These tests pin the parts that must scale and
-name the ones that are deliberately bounded, so raising the cap again is a
-measurement rather than a hope.
+The cap was 12 and is now 100 per workspace, with up to 12 workspaces. Twelve
+panes was small enough that several things could get away with being O(n) in
+disguise or quietly bounded; a hundred is not. These tests pin the parts that
+must scale and name the ones that are deliberately bounded, so raising the cap
+again is a measurement rather than a hope.
"""
from __future__ import annotations
diff --git a/tests/unit/agentic_ide/test_session.py b/tests/unit/agentic_ide/test_session.py
index b3f5b42aad..ea3f28e9eb 100644
--- a/tests/unit/agentic_ide/test_session.py
+++ b/tests/unit/agentic_ide/test_session.py
@@ -458,6 +458,10 @@ async def test_the_workspace_cap_is_refused_in_plain_language(
await _open(registry, one_too_many, [{"agent": "claude"}])
+def test_workspace_capacity_is_larger_than_the_original_six_tabs() -> None:
+ assert session_mod.MAX_WORKSPACES == 12
+
+
# --------------------------------------------------------------------- attach
async def _noop_output(_text: str) -> None:
return None