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.

refactor(agentic-ide): open a workspace from one screen, not four steps

Ruben Lütke15f3eb74c1a8
diff --git a/jarvis/ui/web/frontend/src/components/agentic/FolderPicker.tsx b/jarvis/ui/web/frontend/src/components/agentic/FolderPicker.tsx
index 97936ecebf..dbdba24339 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/FolderPicker.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/FolderPicker.tsx
@@ -1,13 +1,13 @@
/**
- * Folder picker for step 1 of the Agentic-IDE wizard.
+ * Which folder the agents work in.
*
- * Five ways to arrive at a folder, because people arrive differently:
+ * Six ways to arrive at one, because people arrive differently:
*
* 1. **The system folder window** — Explorer on Windows, Finder on macOS, the
* desktop's own dialog on Linux. The one people already know. Offered only
* when the backend confirms this machine can actually show it (see below).
- * 2. **Recents** — the workspaces opened before, with their previous layout.
- * One click and the wizard already knows how many terminals to open.
+ * 2. **Recents** — the folders opened before, with their previous layout. One
+ * click and the launcher already knows how many terminals to open.
* 3. **Search** — type a name, get matches from anywhere under home and the
* usual code directories. Faster than clicking down five levels.
* 4. **Browsing** — the list, projects and repositories sorted first.
@@ -20,25 +20,40 @@
* over a network and absent on a headless server. Everything here therefore
* works without it, and the button appears only where it can deliver.
*
+ * ## Six ways, one list
+ *
+ * Those six used to be six regions stacked down a column — a grid of recent
+ * cards, a search row, a breadcrumb, the listing, a drop result, a path field,
+ * and a bar repeating what was selected — each with its own border and its own
+ * heading. Every one of them answers the same question, so a reader had to scan
+ * seven bordered boxes to find the one route they wanted.
+ *
+ * Now there is one scrolling list. Recents are a labelled group at the top of
+ * it, not a separate control with a different shape; search filters that same
+ * list in place; the path field sits under it as a single line. What is above
+ * the list is only ever navigation, what is below it is only ever typing, and
+ * the folder that is chosen is reported once — in the launcher's header, where
+ * the button that acts on it is.
+ *
* The start view is labelled with the machine's own name rather than the account
* folder: "Administrator" says nothing about which computer you are looking at,
* "Ruben's MacBook" does.
*/
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import {
+ CornerDownLeft,
CornerLeftUp,
Folder,
FolderGit2,
FolderOpen,
- Laptop,
Loader2,
RefreshCw,
Search,
Star,
- Terminal,
X,
} from "lucide-react";
import { cn } from "@/lib/utils";
+import { Button, Field, IconButton, SectionLabel } from "./controls";
import {
fetchFolders,
fetchNativePickerSupport,
@@ -93,9 +108,12 @@ export function extractDropPayload(dt: DataTransfer | null): {
const items = dt.items ? Array.from(dt.items) : [];
for (const item of items) {
const getAsEntry = (
- item as DataTransferItem & { webkitGetAsEntry?: () => { isDirectory?: boolean; name?: string } | null }
+ item as DataTransferItem & {
+ webkitGetAsEntry?: () => { isDirectory?: boolean; name?: string } | null;
+ }
).webkitGetAsEntry;
- const entry = typeof getAsEntry === "function" ? getAsEntry.call(item) : null;
+ const entry =
+ typeof getAsEntry === "function" ? getAsEntry.call(item) : null;
if (entry?.isDirectory && entry.name) {
out.name = entry.name;
break;
@@ -103,14 +121,19 @@ export function extractDropPayload(dt: DataTransfer | null): {
}
if (!out.name && dt.files && dt.files.length > 0) {
- const rel = (dt.files[0] as File & { webkitRelativePath?: string }).webkitRelativePath;
+ const rel = (dt.files[0] as File & { webkitRelativePath?: string })
+ .webkitRelativePath;
if (rel && rel.includes("/")) out.name = rel.split("/")[0];
}
return out;
}
-export function FolderPicker({ selected, onSelect, onSelectRecent }: FolderPickerProps) {
+export function FolderPicker({
+ selected,
+ onSelect,
+ onSelectRecent,
+}: FolderPickerProps) {
const [path, setPath] = useState<string | null>(null);
const [parent, setParent] = useState<string | null>(null);
const [entries, setEntries] = useState<FolderItem[]>([]);
@@ -128,7 +151,9 @@ export function FolderPicker({ selected, onSelect, onSelectRecent }: FolderPicke
const [dropChoices, setDropChoices] = useState<FolderItem[]>([]);
const dragDepth = useRef(0);
- const [nativePicker, setNativePicker] = useState<NativePickerSupport | null>(null);
+ const [nativePicker, setNativePicker] = useState<NativePickerSupport | null>(
+ null,
+ );
const [nativeOpen, setNativeOpen] = useState(false);
const [nativeNote, setNativeNote] = useState<string | null>(null);
@@ -157,7 +182,7 @@ export function FolderPicker({ selected, onSelect, onSelectRecent }: FolderPicke
if (res.device_name) setDeviceName(res.device_name);
})
.catch(() => {
- /* no recents yet — the section just stays hidden */
+ /* no recents yet — the group just stays hidden */
});
void fetchNativePickerSupport()
.then(setNativePicker)
@@ -252,7 +277,9 @@ export function FolderPicker({ selected, onSelect, onSelectRecent }: FolderPicke
// Read the DataTransfer BEFORE awaiting anything (see extractDropPayload).
const payload = extractDropPayload(event.dataTransfer);
if (!payload.path && !payload.name) {
- setDropNote("That drop carried no folder — browse to it or paste its path.");
+ setDropNote(
+ "That drop carried no folder — browse to it or paste its path.",
+ );
return;
}
setDropNote("Resolving the dropped folder…");
@@ -270,6 +297,8 @@ export function FolderPicker({ selected, onSelect, onSelectRecent }: FolderPicke
.catch((e) => setDropNote((e as Error).message));
};
+ const searchingMachine = searchHits !== null;
+
return (
<div
onDragEnter={(e) => {
@@ -288,194 +317,188 @@ export function FolderPicker({ selected, onSelect, onSelectRecent }: FolderPicke
}}
onDrop={onDrop}
data-testid="folder-drop-zone"
- className={cn(
- "relative space-y-4 rounded-xl transition-colors",
- dragOver && "ring-2 ring-primary/60 ring-offset-2 ring-offset-background",
- )}
+ className="relative flex min-h-0 flex-1 flex-col"
>
{dragOver && (
- <div className="pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-background/80">
- <div className="flex items-center gap-2 rounded-lg border border-primary/50 bg-card px-4 py-3 text-sm font-medium text-primary">
+ <div className="pointer-events-none absolute inset-0 z-20 flex items-center justify-center rounded-surface bg-background/85 ring-2 ring-inset ring-primary/60">
+ <span className="flex items-center gap-2 text-sm font-medium text-primary">
<FolderOpen className="h-4 w-4" />
Drop a folder to open it here
- </div>
+ </span>
</div>
)}
- {/* ------------------------------------------------------------ recents */}
- {recents.length > 0 && searchHits === null && (
- <section className="space-y-2">
- <h4 className="flex items-center gap-2 text-[11px] uppercase tracking-wider text-muted-foreground">
- <Star className="h-3.5 w-3.5 fill-current text-primary" />
- Recent folders
- </h4>
- <ul className="grid gap-2 sm:grid-cols-2">
- {recents.map((recent) => (
- <li key={recent.path} className="group relative">
- <button
- type="button"
- onClick={() => pickRecent(recent)}
- className={cn(
- "flex w-full items-center gap-3 rounded-lg border px-3 py-2 text-left transition-colors",
- selected === recent.path
- ? "border-primary/50 bg-primary/5"
- : "border-border bg-card/60 hover:border-primary/40",
- )}
- >
- <Star
- data-testid="recent-folder-star"
- className="h-4 w-4 shrink-0 fill-current text-primary"
- />
- <span className="min-w-0 flex-1">
- <span className="block truncate text-sm font-medium">{recent.name}</span>
- <span className="block truncate font-mono text-[10px] text-muted-foreground">
- {recent.path}
- </span>
- </span>
- <span className="flex shrink-0 items-center gap-1 text-[11px] text-muted-foreground">
- <Terminal className="h-3 w-3" />
- {recent.terminals}
- </span>
- </button>
- <button
- type="button"
- aria-label={`Forget ${recent.name}`}
- title="Remove from this list (the folder itself stays)"
- onClick={(e) => {
- e.stopPropagation();
- setRecents((prev) => prev.filter((r) => r.path !== recent.path));
- void forgetRecent(recent.path).catch(() => {
- /* list refreshes on next visit */
- });
- }}
- className="absolute right-1 top-1 hidden rounded p-1 text-muted-foreground hover:text-foreground group-hover:block"
- >
- <X className="h-3 w-3" />
- </button>
- </li>
- ))}
- </ul>
- </section>
- )}
-
- {/* ------------------------------------------------------------- search */}
- <div className="flex flex-wrap items-center gap-2">
+ {/* --------------------------------------------------------- navigation */}
+ <div className="flex items-center gap-1.5 p-3 pb-2">
<div className="relative min-w-0 flex-1">
{searching ? (
- <Loader2 className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 animate-spin text-muted-foreground" />
+ <Loader2 className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 animate-spin text-muted-foreground" />
) : (
- <Search className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
+ <Search className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
)}
- <input
+ <Field
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder="Search folders by name…"
aria-label="Search folders by name"
data-testid="folder-search"
- className="w-full rounded-lg border border-border bg-background/60 py-2 pl-9 pr-8 text-sm outline-none focus:border-primary/50"
+ className="w-full pl-8 pr-7"
spellCheck={false}
/>
{query && (
- <button
- type="button"
- aria-label="Clear search"
+ <IconButton
+ size="sm"
+ label="Clear search"
onClick={() => setQuery("")}
- className="absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 text-muted-foreground hover:text-foreground"
+ className="absolute right-1 top-1/2 -translate-y-1/2"
>
- <X className="h-3.5 w-3.5" />
- </button>
+ <X className="h-3 w-3" />
+ </IconButton>
)}
</div>
{nativePicker?.available && (
- <button
- type="button"
- className="btn-primary"
+ <Button
onClick={browseNatively}
disabled={nativeOpen}
data-testid="native-browse"
title="Open the folder window this computer normally uses"
>
{nativeOpen ? (
- <Loader2 className="h-4 w-4 animate-spin" />
+ <Loader2 className="h-3.5 w-3.5 animate-spin" />
) : (
- <FolderOpen className="h-4 w-4" />
+ <FolderOpen className="h-3.5 w-3.5" />
)}
- {nativeOpen ? "Waiting for the window…" : "Browse…"}
- </button>
+ {nativeOpen ? "Waiting…" : "Browse"}
+ </Button>
)}
- <button
- type="button"
- className="btn-ghost"
+ <IconButton
+ label="Go up one folder"
onClick={() => void load(parent)}
- disabled={loading || searchHits !== null || (!parent && path === null)}
- title="Go up one folder"
+ disabled={loading || searchingMachine || (!parent && path === null)}
>
<CornerLeftUp className="h-4 w-4" />
- Up
- </button>
- <button
- type="button"
- className="btn-ghost"
+ </IconButton>
+ <IconButton
+ label="Reload this folder"
onClick={() => void load(path)}
disabled={loading}
- title="Reload this folder"
>
{loading ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<RefreshCw className="h-4 w-4" />
)}
- </button>
+ </IconButton>
</div>
- {/* The window can still end up behind the app despite being opened
- topmost — a user who does not know it is there just sees a button
- that hung. Saying so costs one line and saves the confusion. */}
- {nativeOpen && (
- <p className="text-xs text-primary" role="status">
- A folder window is open — pick a folder there. If you cannot see it,
- check behind this window or on your taskbar.
- </p>
- )}
- {nativeNote && !nativeOpen && (
- <p className="text-xs text-muted-foreground" role="alert">
- {nativeNote}
- </p>
- )}
-
- {/* ---------------------------------------------------------- breadcrumb */}
- <div className="flex items-center gap-2 text-xs text-muted-foreground">
- {searchHits !== null ? (
- <span>
+ {/* ------------------------------------------------------- where you are */}
+ <div className="flex min-w-0 items-center gap-1.5 px-3 pb-2 text-xs text-muted-foreground">
+ {searchingMachine ? (
+ <span className="truncate">
{visible.length === 0 && !searching
? `Nothing matches “${query.trim()}”`
- : `Matches for “${query.trim()}”`}
+ : `Matches for “${query.trim()}”, anywhere on this machine`}
</span>
) : (
<>
- <Laptop className="h-3.5 w-3.5 shrink-0 text-primary/70" />
<span className="shrink-0 font-medium text-foreground">
{deviceName || "This machine"}
</span>
{path && (
- <code className="min-w-0 truncate rounded bg-background/60 px-2 py-0.5 font-mono">
- {path}
- </code>
+ <>
+ <span className="shrink-0 opacity-50">›</span>
+ <code className="min-w-0 truncate font-mono">{path}</code>
+ </>
)}
</>
)}
</div>
+ {/* The window can still end up behind the app despite being opened
+ topmost — a user who does not know it is there just sees a button
+ that hung. Saying so costs one line and saves the confusion. */}
+ {nativeOpen && (
+ <p className="px-3 pb-2 text-xs text-primary" role="status">
+ A folder window is open — pick a folder there. If you cannot see it,
+ check behind this window or on your taskbar.
+ </p>
+ )}
+
{/* --------------------------------------------------------------- list */}
- <div className="max-h-[300px] overflow-y-auto scrollbar-jarvis rounded-xl border border-border bg-card/40">
+ <div className="min-h-[16rem] flex-1 overflow-y-auto scrollbar-jarvis border-y border-border/70">
+ {recents.length > 0 && !searchingMachine && (
+ <>
+ <div className="sticky top-0 z-10 bg-card/95 px-3 py-1.5 backdrop-blur">
+ <SectionLabel>Recent folders</SectionLabel>
+ </div>
+ <ul>
+ {recents.map((recent) => (
+ <li key={recent.path} className="group/row relative">
+ <button
+ type="button"
+ onClick={() => pickRecent(recent)}
+ className={cn(
+ "flex w-full items-center gap-2.5 px-3 py-1.5 text-left transition-colors",
+ selected === recent.path
+ ? "bg-primary/10"
+ : "hover:bg-secondary/60",
+ )}
+ >
+ <Star
+ data-testid="recent-folder-star"
+ className="h-3.5 w-3.5 shrink-0 fill-current text-primary"
+ />
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-sm">
+ {recent.name}
+ </span>
+ <span className="block truncate font-mono text-[10px] text-muted-foreground">
+ {recent.path}
+ </span>
+ </span>
+ <span className="shrink-0 pr-5 font-mono text-[11px] tabular-nums text-muted-foreground">
+ {recent.terminals}
+ </span>
+ </button>
+ <IconButton
+ size="sm"
+ label={`Forget ${recent.name}`}
+ title="Remove from this list (the folder itself stays)"
+ onClick={(e) => {
+ e.stopPropagation();
+ setRecents((prev) =>
+ prev.filter((r) => r.path !== recent.path),
+ );
+ void forgetRecent(recent.path).catch(() => {
+ /* list refreshes on next visit */
+ });
+ }}
+ className="absolute right-1.5 top-1/2 -translate-y-1/2 opacity-0 focus-visible:opacity-100 group-hover/row:opacity-100"
+ >
+ <X className="h-3 w-3" />
+ </IconButton>
+ </li>
+ ))}
+ </ul>
+ {/*
+ Not the machine's name a second time: it is already in the line
+ above the list, and a label repeated twelve pixels apart reads as
+ two different things being named rather than one.
+ */}
+ <div className="sticky top-0 z-10 bg-card/95 px-3 py-1.5 backdrop-blur">
+ <SectionLabel>Browse</SectionLabel>
+ </div>
+ </>
+ )}
+
{visible.length === 0 && !loading && !searching ? (
- <p className="p-4 text-sm text-muted-foreground">
- {searchHits !== null
+ <p className="px-3 py-4 text-sm text-muted-foreground">
+ {searchingMachine
? "No folder with that name was found."
- : "Nothing to list here — search above, drop a folder, or paste a path below."}
+ : "Nothing to list here — search above, drop a folder, or type its path below."}
</p>
) : (
- <ul className="divide-y divide-border/50">
+ <ul>
{visible.map((item) => {
const isSelected = selected === item.path;
return (
@@ -484,27 +507,46 @@ export function FolderPicker({ selected, onSelect, onSelectRecent }: FolderPicke
type="button"
onClick={() => open(item)}
className={cn(
- "flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors",
- isSelected ? "bg-primary/10 text-foreground" : "hover:bg-background/60",
+ "flex w-full items-center gap-2.5 px-3 py-1.5 text-left text-sm transition-colors",
+ isSelected ? "bg-primary/10" : "hover:bg-secondary/60",
)}
>
{item.is_repo ? (
- <FolderGit2 className="h-4 w-4 shrink-0 text-primary" />
- ) : item.is_project ? (
- <FolderOpen className="h-4 w-4 shrink-0 text-primary/70" />
+ <FolderGit2
+ className={cn(
+ "h-4 w-4 shrink-0",
+ isSelected ? "text-primary" : "text-muted-foreground",
+ )}
+ />
) : (
- <Folder className="h-4 w-4 shrink-0 text-muted-foreground" />
+ <Folder
+ className={cn(
+ "h-4 w-4 shrink-0",
+ isSelected
+ ? "text-primary"
+ : "text-muted-foreground/60",
+ )}
+ />
)}
<span className="min-w-0 flex-1">
- <span className="block truncate">{item.name}</span>
- {searchHits !== null && (
+ <span
+ className={cn(
+ "block truncate",
+ isSelected && "text-primary",
+ )}
+ >
+ {item.name}
+ </span>
+ {searchingMachine && (
<span className="block truncate font-mono text-[10px] text-muted-foreground">
{item.path}
</span>
)}
</span>
{item.is_repo && (
- <span className="chip shrink-0 text-[10px] uppercase tracking-wide">git</span>
+ <span className="shrink-0 font-mono text-[10px] uppercase tracking-wider text-muted-foreground/70">
+ git
+ </span>
)}
</button>
</li>
@@ -514,49 +556,49 @@ export function FolderPicker({ selected, onSelect, onSelectRecent }: FolderPicke
)}
</div>
- {error && (
- <p className="text-xs text-destructive" role="alert">
- {error}
- </p>
- )}
-
- {/* --------------------------------------------------------- drop result */}
- {dropNote && (
- <div className="space-y-2 rounded-lg border border-border bg-card/60 px-3 py-2">
- <p className="text-xs text-muted-foreground">{dropNote}</p>
- {dropChoices.length > 0 && (
- <ul className="space-y-1">
- {dropChoices.map((choice) => (
- <li key={choice.path}>
- <button
- type="button"
- onClick={() => {
- setDropNote(null);
- setDropChoices([]);
- open(choice);
- }}
- className="flex w-full items-center gap-2 rounded px-2 py-1 text-left text-xs hover:bg-background/60"
- >
- <FolderOpen className="h-3.5 w-3.5 shrink-0 text-primary/70" />
- <code className="min-w-0 truncate font-mono">{choice.path}</code>
- </button>
- </li>
- ))}
- </ul>
- )}
- </div>
- )}
-
- {/* ----------------------------------------------------------- raw path */}
+ {/* ------------------------------------------------------------- typing */}
<PathInput base={path} onUse={usePath} />
- {selected && (
- <div className="flex items-center gap-2 rounded-lg border border-primary/40 bg-primary/5 px-3 py-2 text-sm">
- <FolderOpen className="h-4 w-4 shrink-0 text-primary" />
- <span className="text-muted-foreground">Selected:</span>
- <code className="min-w-0 flex-1 truncate font-mono text-xs text-foreground">
- {selected}
- </code>
+ {/* ---------------------------------------------------------- reporting */}
+ {(error || nativeNote || dropNote) && (
+ <div className="space-y-1 px-3 pb-3">
+ {error && (
+ <p className="text-xs text-destructive" role="alert">
+ {error}
+ </p>
+ )}
+ {nativeNote && !nativeOpen && (
+ <p className="text-xs text-muted-foreground" role="alert">
+ {nativeNote}
+ </p>
+ )}
+ {dropNote && (
+ <>
+ <p className="text-xs text-muted-foreground">{dropNote}</p>
+ {dropChoices.length > 0 && (
+ <ul>
+ {dropChoices.map((choice) => (
+ <li key={choice.path}>
+ <button
+ type="button"
+ onClick={() => {
+ setDropNote(null);
+ setDropChoices([]);
+ open(choice);
+ }}
+ className="flex w-full items-center gap-2 rounded px-1 py-0.5 text-left text-xs hover:bg-secondary/60"
+ >
+ <FolderOpen className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
+ <code className="min-w-0 truncate font-mono">
+ {choice.path}
+ </code>
+ </button>
+ </li>
+ ))}
+ </ul>
+ )}
+ </>
+ )}
</div>
)}
</div>
@@ -600,7 +642,13 @@ export function joinPath(base: string, name: string): string {
* above it: `cd` shows what is in THIS folder, and a field that answered with
* matches from across the disk would be a different tool wearing the same shape.
*/
-function PathInput({ base, onUse }: { base: string | null; onUse: (value: string) => void }) {
+function PathInput({
+ base,
+ onUse,
+}: {
+ base: string | null;
+ onUse: (value: string) => void;
+}) {
const [value, setValue] = useState("");
const [options, setOptions] = useState<FolderItem[]>([]);
const [active, setActive] = useState(-1);
@@ -623,7 +671,9 @@ function PathInput({ base, onUse }: { base: string | null; onUse: (value: string
if (cancelled) return;
const needle = leaf.toLowerCase();
setOptions(
- res.entries.filter((e) => !needle || e.name.toLowerCase().startsWith(needle)),
+ res.entries.filter(
+ (e) => !needle || e.name.toLowerCase().startsWith(needle),
+ ),
);
setActive(-1);
})
@@ -683,65 +733,72 @@ function PathInput({ base, onUse }: { base: string | null; onUse: (value: string
};
return (
- <div className="space-y-1">
- <div className="flex flex-wrap items-center gap-2">
- <div className="relative min-w-0 flex-1">
- <input
- value={value}
- onChange={(e) => {
- setValue(e.target.value);
- setOpen(true);
- }}
- onKeyDown={onKeyDown}
- onFocus={() => setOpen(true)}
- // Closing on blur is delayed: a click on a suggestion blurs the
- // input first, and an immediate close would remove the element
- // under the pointer before the click lands on it.
- onBlur={() => window.setTimeout(() => setOpen(false), 150)}
- placeholder="…or type a path — Tab completes, like cd"
- aria-label="Folder path"
- data-testid="folder-path-input"
- className="w-full rounded-lg border border-border bg-background/60 px-3 py-2 font-mono text-xs outline-none focus:border-primary/50"
- spellCheck={false}
- autoComplete="off"
- />
- {open && options.length > 0 && (
- <ul
- data-testid="path-suggestions"
- className="absolute bottom-full z-20 mb-1 max-h-48 w-full overflow-y-auto scrollbar-jarvis rounded-lg border border-border bg-card shadow-lg"
- >
- {options.slice(0, 40).map((item, index) => (
- <li key={item.path}>
- <button
- type="button"
- onMouseDown={(e) => e.preventDefault()}
- onClick={() => complete(item)}
- className={cn(
- "flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",
- index === active ? "bg-primary/15" : "hover:bg-background/60",
- )}
- >
- {item.is_repo ? (
- <FolderGit2 className="h-3.5 w-3.5 shrink-0 text-primary" />
- ) : (
- <Folder className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
- )}
- <span className="truncate font-mono">{item.name}</span>
- </button>
- </li>
- ))}
- </ul>
- )}
- </div>
- <button
- type="button"
- className="btn-ghost"
- disabled={!value.trim()}
+ <div className="relative p-3">
+ <Field
+ value={value}
+ onChange={(e) => {
+ setValue(e.target.value);
+ setOpen(true);
+ }}
+ onKeyDown={onKeyDown}
+ onFocus={() => setOpen(true)}
+ // Closing on blur is delayed: a click on a suggestion blurs the input
+ // first, and an immediate close would remove the element under the
+ // pointer before the click lands on it.
+ onBlur={() => window.setTimeout(() => setOpen(false), 150)}
+ placeholder="…or type a path — Tab completes, like cd"
+ aria-label="Folder path"
+ data-testid="folder-path-input"
+ className="w-full pr-8 font-mono text-xs"
+ spellCheck={false}
+ autoComplete="off"
+ />
+ {/*
+ The field's own confirm, in place of the "Use this path" button that
+ used to sit beside it. Enter already does this, but only for someone who
+ guesses that it will — and a control that can only be reached by guessing
+ is not a route, so the affordance stays. It is inside the field because
+ it belongs to it: as a sibling it was a second full-width control for a
+ line of text nobody had typed yet.
+ */}
+ {value.trim() && (
+ <IconButton
+ size="sm"
+ label="Use this path"
+ onMouseDown={(e) => e.preventDefault()}
onClick={submit}
+ className="absolute right-4 top-1/2 -translate-y-1/2 text-primary"
>
- Use this path
- </button>
- </div>
+ <CornerDownLeft className="h-3.5 w-3.5" />
+ </IconButton>
+ )}
+ {open && options.length > 0 && (
+ <ul
+ data-testid="path-suggestions"
+ className="absolute bottom-full left-3 right-3 z-30 mb-1 max-h-48 overflow-y-auto scrollbar-jarvis rounded-control border border-border bg-popover shadow-xl"
+ >
+ {options.slice(0, 40).map((item, index) => (
+ <li key={item.path}>
+ <button
+ type="button"
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={() => complete(item)}
+ className={cn(
+ "flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-xs",
+ index === active ? "bg-primary/15" : "hover:bg-secondary/60",
+ )}
+ >
+ {item.is_repo ? (
+ <FolderGit2 className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
+ ) : (
+ <Folder className="h-3.5 w-3.5 shrink-0 text-muted-foreground/60" />
+ )}
+ <span className="truncate font-mono">{item.name}</span>
+ </button>
+ </li>
+ ))}
+ </ul>
+ )}
</div>
);
}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/TerminalCountStep.tsx b/jarvis/ui/web/frontend/src/components/agentic/TerminalCountStep.tsx
deleted file mode 100644
index 450c8f0a90..0000000000
--- a/jarvis/ui/web/frontend/src/components/agentic/TerminalCountStep.tsx
+++ /dev/null
@@ -1,556 +0,0 @@
-/**
- * "How many terminals?" — the wizard step where the shape of the workspace is
- * decided.
- *
- * ## Why this is a picture and not a number
- *
- * The step used to be six square cards of dots plus a separate "Custom
- * Terminals" row. Three things were wrong with it, and only the third is about
- * looks.
- *
- * 1. **It could overflow.** The custom row drew its dots inside a fixed 40×40 px
- * box with nothing stopping them. Twenty-three terminals in a narrow window
- * is twelve rows of dots — about 120 px — so the column grew straight out
- * through the card, over the buttons above and below it.
- * 2. **It made a promise it did not keep.** The dots described an arrangement
- * that depends on something the user is not thinking about: how wide the
- * window happens to be right now. Eight terminals are "2 across, 4 down" in a
- * 1050 px window and "4 across, 2 down" maximised. The preview showed the
- * first and the workspace opened the second, and nothing anywhere said why.
- * 3. **Dots are not the thing.** A dot grid is a diagram OF a workspace. Since
- * the real arrangement is one function call away (`paneGrid`, the same one
- * the running grid lays itself out with), the preview can simply BE the
- * workspace, small — real panes, real call-signs, the real aspect ratio.
- *
- * So: one stage showing the workspace that is about to open, one track to pick
- * the count, and a readout underneath that states the arrangement together with
- * the condition it holds under. A preview that names its own assumption cannot
- * be caught lying by a maximise button.
- *
- * The stage is a fixed-height box whose panes are laid out by a CSS grid with
- * `minmax(0, 1fr)` tracks. Overflow is not clipped away as an afterthought —
- * the container mathematically cannot be exceeded, whatever number is picked.
- */
-import { useEffect, useMemo, useRef, useState } from "react";
-import { Minus, Plus } from "lucide-react";
-import { cn } from "@/lib/utils";
-import {
- MAX_PANES_PER_BAND,
- paneGrid,
- paneLines,
- widthForOneBand,
- wizardPanes,
- workspaceBandCapacityFor,
-} from "./layout";
-
-/**
- * Counts worth a labelled notch on the track.
- *
- * Not "presets" — the track already covers every number. These are the ones
- * people actually reach for, marked so they are one click rather than a careful
- * drag. Anything above the workspace maximum is filtered out at render time.
- */
-const NOTCHES = [1, 2, 3, 4, 6, 8, 12] as const;
-
-/**
- * Shape of the area the panes will actually fill, width ÷ height.
- *
- * The workspace grid sits under a toolbar and above the prompt bar, so it is
- * markedly wider relative to its height than the window is: a maximised 1920 ×
- * 1080 window leaves the grid roughly 1636 × 726.
- *
- * The stage takes its height from this, so a miniature pane has the proportions
- * of the pane it stands for. Without it the stage would be right about the
- * arrangement and wrong about the panes — four across would look like letterbox
- * strips where the real ones are nearly square, which is the sort of small lie
- * that makes a preview feel untrustworthy even when its numbers are correct.
- */
-const WORKSPACE_ASPECT = 1636 / 726;
-
-/**
- * Bounds on the stage's height, in px.
- *
- * Safety rails for extreme window widths only — at the wizard's own column
- * width the derived height lands comfortably inside them, so the stage keeps
- * its true proportions and holds still while the count changes.
- */
-const STAGE_MIN_HEIGHT_PX = 160;
-const STAGE_MAX_HEIGHT_PX = 340;
-
-/*
- * How much of itself a miniature pane has room to draw.
- *
- * BOTH axes, which the first version got wrong: it asked only about width, so
- * sixty terminals — laid out three across and twenty down — kept their title
- * bars at 16 px of height and rendered every call-sign as a squashed smear.
- * A pane that is wide and flat has no more room for a name than a narrow one.
- *
- * Dropping detail as the panes shrink is also the stage being honest: sixty
- * terminals really are sixty slivers, and showing them as plain rectangles says
- * so more clearly than sixty illegible labels.
- */
-const PANE_LABEL_MIN_WIDTH_PX = 54;
-const PANE_LABEL_MIN_HEIGHT_PX = 44;
-const PANE_CHROME_MIN_WIDTH_PX = 22;
-const PANE_CHROME_MIN_HEIGHT_PX = 22;
-
-interface TerminalCountStepProps {
- /** Terminals currently chosen. */
- count: number;
- /** Workspace maximum, from the backend. */
- max: number;
- /** Call-signs the panes will open with, so the stage shows the real names. */
- names: string[];
- /**
- * Width of the slot the workspace will occupy, in px — measured by the view
- * from the element the grid will later fill. The arrangement depends on it,
- * so the stage is told rather than left to guess.
- */
- workspaceWidthPx: number;
- onChange: (count: number) => void;
-}
-
-export function TerminalCountStep({
- count,
- max,
- names,
- workspaceWidthPx,
- onChange,
-}: TerminalCountStepProps) {
- const perBand = useMemo(
- () => workspaceBandCapacityFor(workspaceWidthPx),
- [workspaceWidthPx],
- );
- const grid = useMemo(
- () => paneGrid(wizardPanes(count), perBand),
- [count, perBand],
- );
- const bands = useMemo(() => paneLines(count, perBand), [count, perBand]);
-
- const set = (next: number) =>
- onChange(Math.max(1, Math.min(max, Math.trunc(next))));
-
- return (
- <div className="flex flex-col gap-5">
- <WorkspaceStage
- columns={grid.columns}
- rows={bands}
- count={count}
- names={names}
- />
-
- <Readout
- columns={grid.columns}
- bands={bands}
- count={count}
- workspaceWidthPx={workspaceWidthPx}
- />
-
- <CountTrack count={count} max={max} onChange={set} />
- </div>
- );
-}
-
-/**
- * The workspace that is about to open, at a scale that fits on this screen.
- *
- * Every pane is placed by `paneGrid` — the function the running workspace uses
- * — over the panes the backend will actually create (`wizardPanes`). The two
- * cannot drift apart without the running grid changing too.
- */
-function WorkspaceStage({
- columns,
- rows,
- count,
- names,
-}: {
- columns: number;
- rows: number;
- count: number;
- names: string[];
-}) {
- /*
- * The stage measures ITSELF rather than being told its size.
- *
- * Its height comes from CSS (`aspect-ratio`), so only the browser knows what
- * it ended up being once the min/max rails are applied — and each pane needs
- * that to decide how much of itself it has room to draw. Four panes get
- * call-signs and output lines; forty get a tinted tile, which is the stage
- * being honest about what forty terminals look like.
- */
- const stageRef = useRef<HTMLDivElement | null>(null);
- const [size, setSize] = useState({ width: 0, height: 0 });
- useEffect(() => {
- const node = stageRef.current;
- if (!node || typeof ResizeObserver === "undefined") return;
- setSize({ width: node.clientWidth, height: node.clientHeight });
- const observer = new ResizeObserver((entries) => {
- const box = entries[0]?.contentRect;
- setSize({
- width: box?.width ?? node.clientWidth,
- height: box?.height ?? node.clientHeight,
- });
- });
- observer.observe(node);
- return () => observer.disconnect();
- }, []);
-
- const safeColumns = Math.max(1, columns);
- const safeRows = Math.max(1, rows);
- const paneWidth = size.width > 0 ? size.width / safeColumns : 0;
- const paneHeight = size.height > 0 ? size.height / safeRows : 0;
- // Panes are laid out as a grid of equal cells, so one pane's detail level is
- // every pane's — decided once rather than per tile. Before the first measure
- // both are 0; assume the roomy case so the stage never flashes as bare tiles.
- const unmeasured = paneWidth === 0 || paneHeight === 0;
- const detail: PaneDetail =
- unmeasured ||
- (paneWidth >= PANE_LABEL_MIN_WIDTH_PX && paneHeight >= PANE_LABEL_MIN_HEIGHT_PX)
- ? "full"
- : paneWidth >= PANE_CHROME_MIN_WIDTH_PX &&
- paneHeight >= PANE_CHROME_MIN_HEIGHT_PX
- ? "chrome"
- : "tile";
-
- return (
- <div
- data-testid="workspace-stage"
- className="relative overflow-hidden rounded-2xl border border-border bg-background/80"
- style={{
- aspectRatio: `${WORKSPACE_ASPECT}`,
- minHeight: STAGE_MIN_HEIGHT_PX,
- maxHeight: STAGE_MAX_HEIGHT_PX,
- }}
- >
- {/*
- A faint bench grid under the panes. It is not decoration for its own
- sake: it gives the floating panes a surface to sit on, so the stage
- reads as a place rather than as shapes on a background.
- */}
- <div
- aria-hidden
- className="pointer-events-none absolute inset-0 opacity-[0.35]"
- style={{
- backgroundImage:
- "linear-gradient(to right, hsl(var(--border)) 1px, transparent 1px)," +
- "linear-gradient(to bottom, hsl(var(--border)) 1px, transparent 1px)",
- backgroundSize: "28px 28px",
- maskImage:
- "radial-gradient(ellipse at center, black 40%, transparent 85%)",
- WebkitMaskImage:
- "radial-gradient(ellipse at center, black 40%, transparent 85%)",
- }}
- />
-
- <div
- ref={stageRef}
- data-testid="workspace-stage-grid"
- className="relative grid h-full w-full gap-1.5 p-2"
- style={{
- gridTemplateColumns: `repeat(${safeColumns}, minmax(0, 1fr))`,
- gridTemplateRows: `repeat(${safeRows}, minmax(0, 1fr))`,
- }}
- >
- {Array.from({ length: count }).map((_, index) => (
- <StagePane
- key={index}
- name={names[index] ?? `T${index + 1}`}
- index={index}
- detail={detail}
- /* The workspace opens with the first pane selected — the prompt bar
- types into it. Showing that here means the stage is not just the
- right shape, it is the right state. */
- focused={index === 0}
- height={paneHeight}
- />
- ))}
- </div>
- </div>
- );
-}
-
-type PaneDetail = "full" | "chrome" | "tile";
-
-/** One terminal, as it will look — title bar, call-sign, and agent output. */
-function StagePane({
- name,
- index,
- detail,
- focused,
- height,
-}: {
- name: string;
- index: number;
- detail: PaneDetail;
- focused: boolean;
- height: number;
-}) {
- // Output lines are only worth drawing where there is height for them to read
- // as lines rather than as a smear.
- const lines = height >= 64 ? 3 : height >= 42 ? 2 : 0;
-
- return (
- <div
- /*
- * Dark, like the terminals it stands for — not a tile of brand colour.
- *
- * The first version filled every pane with the accent, and eight of them
- * read as a wall of yellow rather than as a workspace. Colour now marks
- * ONE thing: which pane the prompt bar will type into. That is also the
- * one piece of state the stage can honestly show, since a fresh workspace
- * really does open with the first pane selected.
- */
- className={cn(
- "flex min-h-0 min-w-0 flex-col overflow-hidden rounded-md border transition-colors",
- focused
- ? "border-primary/45 bg-primary/[0.05]"
- : "border-border/80 bg-background/70",
- )}
- >
- {detail !== "tile" && (
- <div
- className={cn(
- "flex shrink-0 items-center gap-1.5 border-b px-1.5 py-1",
- focused
- ? "border-primary/25 bg-primary/[0.07]"
- : "border-border/60 bg-muted/20",
- )}
- >
- <span
- className={cn(
- "h-1.5 w-1.5 shrink-0 rounded-full",
- focused ? "bg-primary" : "bg-muted-foreground/50",
- )}
- />
- {detail === "full" && (
- <span
- className={cn(
- "truncate font-mono text-[10px] leading-none",
- focused ? "text-primary" : "text-muted-foreground",
- )}
- >
- {name}
- </span>
- )}
- </div>
- )}
-
- {detail === "full" && lines > 0 && (
- <div className="flex min-h-0 flex-1 flex-col justify-start gap-1 p-1.5">
- {Array.from({ length: lines }).map((_, line) => (
- <span
- key={line}
- /*
- Agent output, suggested rather than faked: bars of varying width
- breathing slightly out of step, the way several terminals working
- at once actually look. Deterministic widths and delays, so the
- stage does not reshuffle itself on every keystroke.
- */
- className={cn(
- "h-1 shrink-0 animate-pulse rounded-full motion-reduce:animate-none",
- focused ? "bg-primary/30" : "bg-muted-foreground/25",
- )}
- style={{
- width: `${[82, 58, 71, 45, 64][(index + line) % 5]}%`,
- animationDelay: `${((index * 3 + line) % 7) * 260}ms`,
- animationDuration: `${2400 + ((index + line) % 3) * 700}ms`,
- }}
- />
- ))}
- {focused && (
- <span className="mt-auto h-1.5 w-1.5 shrink-0 animate-pulse rounded-[1px] bg-primary motion-reduce:animate-none" />
- )}
- </div>
- )}
- </div>
- );
-}
-
-/**
- * What the stage shows, in words, together with what it depends on.
- *
- * The second half is the part that matters. An arrangement stated without its
- * condition is the bug this step had: correct on screen, wrong five seconds
- * later, with nothing to explain the difference.
- */
-function Readout({
- columns,
- bands,
- count,
- workspaceWidthPx,
-}: {
- columns: number;
- bands: number;
- count: number;
- workspaceWidthPx: number;
-}) {
- const oneBandAt = widthForOneBand(count);
- const wrapped = bands > 1;
- const canUnwrap =
- wrapped && oneBandAt !== null && oneBandAt > Math.round(workspaceWidthPx);
-
- let condition: string;
- if (!wrapped) {
- condition = "All side by side — this window is wide enough.";
- } else if (canUnwrap) {
- condition = `Wrapped to keep every pane readable. From ${formatPx(
- oneBandAt,
- )} px wide they would all fit on one line — this window is ${formatPx(
- Math.round(workspaceWidthPx),
- )} px.`;
- } else if (count > MAX_PANES_PER_BAND) {
- condition = `More than ${MAX_PANES_PER_BAND} side by side is unreadable at any window size, so they wrap.`;
- } else {
- condition = "Wrapped to keep every pane readable.";
- }
-
- return (
- <div
- data-testid="workspace-stage-readout"
- className="flex flex-wrap items-baseline gap-x-3 gap-y-1"
- >
- <span className="font-mono text-sm font-semibold tracking-tight text-primary">
- {columns} across
- <span className="mx-1.5 text-muted-foreground">×</span>
- {bands} down
- </span>
- <span className="min-w-0 flex-1 text-xs text-muted-foreground">
- {condition}
- </span>
- </div>
- );
-}
-
-/**
- * Digit grouping for a pixel width the user READS: 1\u202F636, not 1636.
- *
- * The separator is an explicit NARROW NO-BREAK SPACE escape rather than a
- * literal one, so it stays visible in the source and cannot be mistaken for
- * an ordinary space by the next person who greps for it — which is exactly
- * how it slipped past a test that searched for a plain space. It also keeps
- * the number from breaking across two lines mid-thousands.
- *
- * Grouped by hand rather than through `toLocaleString`, whose output depends
- * on the runtime's locale data: a number the user reads should not change
- * shape with the machine that rendered it.
- */
-const THOUSANDS_SEPARATOR = "\u202F";
-
-function formatPx(value: number): string {
- return String(Math.round(value)).replace(
- /\B(?=(\d{3})+(?!\d))/g,
- THOUSANDS_SEPARATOR,
- );
-}
-
-/**
- * The one control: a track from 1 to the workspace maximum.
- *
- * One control rather than the old six cards PLUS a custom row. Two ways to set
- * one number meant two competing "selected" states, and the cards claimed the
- * common counts were somehow a different kind of choice than 7. They are not —
- * they are just the ones people reach for, so they get a notch on the track.
- *
- * A native range input, so keyboard, screen reader, and touch all work without
- * being re-implemented. The notches are buttons over it, not a second control:
- * they set the same value.
- */
-function CountTrack({
- count,
- max,
- onChange,
-}: {
- count: number;
- max: number;
- onChange: (next: number) => void;
-}) {
- const notches = NOTCHES.filter((n) => n <= max);
-
- return (
- <div className="rounded-2xl border border-border bg-card/60 p-4">
- <div className="flex flex-wrap items-center justify-between gap-3">
- <div className="flex items-baseline gap-2">
- <span
- data-testid="terminal-count-value"
- className="font-mono text-3xl font-semibold leading-none text-primary"
- >
- {count}
- </span>
- <span className="text-sm text-muted-foreground">
- {count === 1 ? "terminal" : "terminals"}
- </span>
- </div>
-
- <div className="flex shrink-0 items-center gap-1 rounded-lg border border-border bg-background/60 p-1">
- <button
- type="button"
- aria-label="Use one fewer terminal"
- disabled={count <= 1}
- onClick={() => onChange(count - 1)}
- className="flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40"
- >
- <Minus className="h-4 w-4" />
- </button>
- <input
- type="number"
- min={1}
- max={max}
- value={count}
- aria-label="Number of terminals"
- onChange={(event) =>
- onChange(
- Number.isFinite(event.currentTarget.valueAsNumber)
- ? event.currentTarget.valueAsNumber
- : 1,
- )
- }
- className="h-8 w-14 rounded-md border border-border bg-background text-center font-mono text-sm font-semibold outline-none focus:border-primary/60"
- />
- <button
- type="button"
- aria-label="Use one more terminal"
- disabled={count >= max}
- onClick={() => onChange(count + 1)}
- className="flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40"
- >
- <Plus className="h-4 w-4" />
- </button>
- </div>
- </div>
-
- <input
- type="range"
- min={1}
- max={max}
- step={1}
- value={count}
- aria-label="Number of terminals"
- data-testid="terminal-count-range"
- onChange={(event) => onChange(Number(event.currentTarget.value))}
- className="mt-4 w-full accent-primary"
- />
-
- <div className="mt-2 flex flex-wrap items-center gap-1.5">
- {notches.map((n) => (
- <button
- key={n}
- type="button"
- aria-pressed={count === n}
- onClick={() => onChange(n)}
- className={cn(
- "rounded-md px-2 py-1 font-mono text-xs transition-colors",
- count === n
- ? "bg-primary/15 text-primary"
- : "text-muted-foreground hover:bg-muted hover:text-foreground",
- )}
- >
- {n}
- </button>
- ))}
- <span className="ml-auto font-mono text-[11px] text-muted-foreground">
- max {max}
- </span>
- </div>
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx
new file mode 100644
index 0000000000..ccf757cb2f
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceLauncher.tsx
@@ -0,0 +1,495 @@
+/**
+ * Opening a workspace — one screen.
+ *
+ * ## Why this stopped being a wizard
+ *
+ * Opening a workspace is three decisions: which folder, how many terminals, and
+ * which coding agent runs in each. They used to be four steps with Back/Next
+ * between them and a fifth screen that showed the three answers back and asked
+ * for one more click.
+ *
+ * A wizard is the right shape when a step's answer changes what the NEXT step
+ * may ask. None of these do. The count does not depend on the folder, the agents
+ * do not depend on the count, and nothing depends on the confirmation screen at
+ * all. What the steps bought was hiding: three quiet decisions became three
+ * full-screen episodes, each padded out with a heading, a sentence of guidance
+ * and a pair of navigation buttons, so the interface spent its space on
+ * scaffolding around the decisions rather than on the decisions.
+ *
+ * They also cost changes of mind. Realising at the agent step that you wanted a
+ * different folder was two Back presses and losing the plan on the way.
+ * Everything here is visible together and stays live: pick a different folder
+ * with the terminals already named and the names stay.
+ *
+ * ## What each half is for
+ *
+ * Left is WHERE — the folder browser, which needs a tall column because it is a
+ * list you scroll. Right is WHAT — the number of terminals, the arrangement they
+ * will land in, and one row per terminal. That split is also why the panel with
+ * the scrolling list is on the left: reading order puts the decision that
+ * everything else describes first, and the right column is the one that grows
+ * with the count.
+ *
+ * The single primary action lives in the header, next to a one-line summary of
+ * all three answers. That line is the confirmation step, and it costs no click.
+ */
+import { useEffect } from "react";
+import { cn } from "@/lib/utils";
+import { FolderPicker } from "./FolderPicker";
+import { ResumeCard } from "./ResumeCard";
+import { Button, Field, Notice, Panel, Select, SectionLabel } from "./controls";
+import { CountStepper, CountTrack, WorkspaceShape } from "./WorkspaceShape";
+import type { AgentAccount } from "@/lib/agentAccountsApi";
+import type {
+ AgentStatus,
+ RecentWorkspace,
+ ResumeOffer,
+} from "@/lib/agenticIdeApi";
+
+/** One pane the workspace will open with, as the launcher holds it. */
+export interface PlannedTerminal {
+ agent: string;
+ name: string;
+ /**
+ * Which subscription of `agent` this pane opens on, or undefined for the
+ * active one. Per pane rather than per workspace on purpose: that is what lets
+ * two seats of the same plan run side by side in one folder — which is the
+ * entire reason for holding two.
+ */
+ account?: string;
+}
+
+export interface WorkspaceLauncherProps {
+ /** True while this is opening an ADDITIONAL workspace beside running ones. */
+ addingNew: boolean;
+ /** A request is in flight — every control that starts one is disabled. */
+ busy: boolean;
+
+ folder: string | null;
+ onSelectFolder: (path: string) => void;
+ onSelectRecent: (recent: RecentWorkspace) => void;
+
+ count: number;
+ maxTerminals: number;
+ suggestedNames: string[];
+ /** Width the workspace grid will occupy, measured by the view. */
+ workspaceWidthPx: number;
+ /** Height it will occupy — panes wrap on shape, not on width alone. */
+ workspaceHeightPx: number;
+ onCount: (next: number) => void;
+
+ planned: PlannedTerminal[];
+ onPlanned: (
+ update: (previous: PlannedTerminal[]) => PlannedTerminal[],
+ ) => void;
+ /** Every registered entry — coding CLIs and the plain shell. */
+ agents: AgentStatus[];
+ /** The registered subscriptions of one CLI, for the per-pane picker. */
+ accountsFor: (platform: string) => AgentAccount[];
+
+ /** False when this machine has no PTY backend, so no pane could run. */
+ terminalAvailable: boolean;
+ /** True when the agent sweep landed and found no coding CLI installed. */
+ nothingInstalled: boolean;
+ onOpenClis: () => void;
+
+ /** Workspaces from a previous session that can come back, or null. */
+ offer: ResumeOffer | null;
+ onResume: () => void;
+ onDismissOffer: () => void;
+
+ onStart: () => void;
+}
+
+export function WorkspaceLauncher({
+ addingNew,
+ busy,
+ folder,
+ onSelectFolder,
+ onSelectRecent,
+ count,
+ maxTerminals,
+ suggestedNames,
+ workspaceWidthPx,
+ workspaceHeightPx,
+ onCount,
+ planned,
+ onPlanned,
+ agents,
+ accountsFor,
+ terminalAvailable,
+ nothingInstalled,
+ onOpenClis,
+ offer,
+ onResume,
+ onDismissOffer,
+ onStart,
+}: WorkspaceLauncherProps) {
+ const ready =
+ Boolean(folder) &&
+ planned.length > 0 &&
+ planned.every((pane) => pane.name.trim() && pane.agent);
+ const canStart = ready && !busy;
+
+ /*
+ * Ctrl/Cmd + Enter opens, from anywhere on the screen.
+ *
+ * Not plain Enter: the folder path field uses it to mean "go to this path",
+ * and the call-sign fields are ordinary text inputs where Enter would be a
+ * surprise. A modified chord has no such collision and is what every terminal
+ * on this screen already teaches.
+ */
+ useEffect(() => {
+ if (!canStart) return;
+ const onKey = (event: KeyboardEvent) => {
+ if (event.key !== "Enter" || !(event.metaKey || event.ctrlKey)) return;
+ event.preventDefault();
+ onStart();
+ };
+ window.addEventListener("keydown", onKey);
+ return () => window.removeEventListener("keydown", onKey);
+ }, [canStart, onStart]);
+
+ const setPane = (index: number, patch: Partial<PlannedTerminal>) =>
+ onPlanned((previous) =>
+ previous.map((pane, i) => (i === index ? { ...pane, ...patch } : pane)),
+ );
+
+ return (
+ <div
+ data-testid="workspace-launcher"
+ className="flex h-full min-h-0 flex-col"
+ >
+ <Header
+ addingNew={addingNew}
+ folder={folder}
+ planned={planned}
+ agents={agents}
+ canStart={canStart}
+ busy={busy}
+ onStart={onStart}
+ />
+
+ <div className="min-h-0 flex-1 overflow-y-auto scrollbar-jarvis">
+ <div className="flex flex-col gap-3 px-4 pb-4">
+ {!terminalAvailable && (
+ <Notice tone="error">
+ <span>
+ This machine has no usable terminal backend, so agent panes
+ cannot run here — <code className="font-mono">pywinpty</code> on
+ Windows, <code className="font-mono">ptyprocess</code> on macOS
+ and Linux. Both ship with the desktop extra.
+ </span>
+ </Notice>
+ )}
+
+ {nothingInstalled && (
+ <Notice tone="warning">
+ <span>
+ No coding-agent CLI was found on this machine’s PATH. Install one
+ and it is picked up automatically.
+ </span>
+ <Button
+ variant="subtle"
+ className="h-6 px-2 text-amber-200/90"
+ onClick={onOpenClis}
+ >
+ Open CLIs
+ </Button>
+ </Notice>
+ )}
+
+ {offer && (
+ <ResumeCard
+ offer={offer}
+ busy={busy}
+ onResume={onResume}
+ onDismiss={onDismissOffer}
+ />
+ )}
+
+ {/*
+ Two columns that become one on a narrow window. The folder column is
+ given slightly less than half: it holds one list, while the right
+ column holds the arrangement AND a row per terminal.
+ */}
+ <div className="grid min-h-0 items-start gap-3 lg:grid-cols-[minmax(0,7fr)_minmax(0,9fr)]">
+ <Panel title="Folder" className="min-h-0">
+ <FolderPicker
+ selected={folder}
+ onSelect={onSelectFolder}
+ onSelectRecent={onSelectRecent}
+ />
+ </Panel>
+
+ <div className="flex min-w-0 flex-col gap-3">
+ <Panel
+ title="Terminals"
+ aside={
+ <CountStepper
+ count={count}
+ max={maxTerminals}
+ onChange={onCount}
+ />
+ }
+ >
+ <WorkspaceShape
+ count={count}
+ names={suggestedNames}
+ workspaceWidthPx={workspaceWidthPx}
+ workspaceHeightPx={workspaceHeightPx}
+ />
+ <CountTrack
+ count={count}
+ max={maxTerminals}
+ onChange={onCount}
+ />
+ </Panel>
+
+ <PanePlan
+ planned={planned}
+ agents={agents}
+ accountsFor={accountsFor}
+ onChange={setPane}
+ />
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+/**
+ * The screen's one heading, its one-line summary, and its one primary action.
+ *
+ * The summary is what the old fourth step was: folder, count, and the agents in
+ * play, read back before anything starts. Here it is a line rather than a screen
+ * — the same information, none of the ceremony, and it stays true while the
+ * choices underneath it change instead of being a snapshot taken at step four.
+ */
+function Header({
+ addingNew,
+ folder,
+ planned,
+ agents,
+ canStart,
+ busy,
+ onStart,
+}: {
+ addingNew: boolean;
+ folder: string | null;
+ planned: PlannedTerminal[];
+ agents: AgentStatus[];
+ canStart: boolean;
+ busy: boolean;
+ onStart: () => void;
+}) {
+ return (
+ <header className="flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-4 py-3">
+ <div className="min-w-0">
+ <h2 className="font-display text-base font-semibold leading-tight">
+ {addingNew ? "Open another project" : "Open a project"}
+ </h2>
+ <p className="mt-0.5 truncate text-xs text-muted-foreground">
+ {folder ? (
+ <Summary folder={folder} planned={planned} agents={agents} />
+ ) : addingNew ? (
+ "The workspaces you already have keep running."
+ ) : (
+ "Coding agents run in named terminals inside the folder you pick."
+ )}
+ </p>
+ </div>
+
+ <Button
+ variant="primary"
+ disabled={!canStart}
+ onClick={onStart}
+ className="px-4"
+ >
+ {busy ? "Opening…" : "Open workspace"}
+ {/*
+ The chord is shown on the button rather than explained in a line of
+ prose underneath it — that is where someone looks for it, and it costs
+ no space anyone was using.
+ */}
+ <kbd className="ml-1 hidden font-mono text-[10px] font-normal opacity-60 sm:inline">
+ ⌘↵
+ </kbd>
+ </Button>
+ </header>
+ );
+}
+
+/** Folder, count and agents in one line — the confirmation step, uncharged. */
+function Summary({
+ folder,
+ planned,
+ agents,
+}: {
+ folder: string;
+ planned: PlannedTerminal[];
+ agents: AgentStatus[];
+}) {
+ const nameOf = (id: string) =>
+ agents.find((agent) => agent.name === id)?.display_name ?? id;
+ // Named in the order they first appear, so the line reads like the grid does.
+ const used: string[] = [];
+ for (const pane of planned) {
+ const label = nameOf(pane.agent);
+ if (!used.includes(label)) used.push(label);
+ }
+ return (
+ <>
+ <span className="font-mono text-foreground">{folder}</span>
+ <span className="px-1.5 opacity-50">·</span>
+ {planned.length} terminal{planned.length === 1 ? "" : "s"}
+ {used.length > 0 && (
+ <>
+ <span className="px-1.5 opacity-50">·</span>
+ {used.join(", ")}
+ </>
+ )}
+ </>
+ );
+}
+
+/**
+ * One row per terminal: its call-sign, its coding agent, and — only when the
+ * user actually holds several — which subscription it opens on.
+ *
+ * A table rather than a stack of bordered cards. Twelve cards is twelve frames
+ * drawn around three controls each; twelve rows under one set of column labels
+ * is the same information with the repetition carried by alignment instead of
+ * by outlines.
+ */
+function PanePlan({
+ planned,
+ agents,
+ accountsFor,
+ onChange,
+}: {
+ planned: PlannedTerminal[];
+ agents: AgentStatus[];
+ accountsFor: (platform: string) => AgentAccount[];
+ onChange: (index: number, patch: Partial<PlannedTerminal>) => void;
+}) {
+ return (
+ <Panel
+ title="Who runs where"
+ aside={
+ <span className="text-[11px] text-muted-foreground">
+ Say “what is {planned[1]?.name || planned[0]?.name || "T2"} doing?”
+ </span>
+ }
+ >
+ <div className="max-h-[22rem] overflow-y-auto scrollbar-jarvis">
+ <table className="w-full border-separate border-spacing-0">
+ <thead className="sticky top-0 z-10 bg-card">
+ <tr>
+ <th className="w-8 px-3 py-1.5 text-left">
+ <SectionLabel>#</SectionLabel>
+ </th>
+ <th className="px-1 py-1.5 text-left">
+ <SectionLabel>Call-sign</SectionLabel>
+ </th>
+ <th className="px-1 py-1.5 text-left">
+ <SectionLabel>Agent</SectionLabel>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ {planned.map((pane, index) => {
+ const accounts = accountsFor(pane.agent);
+ return (
+ <tr key={index} className="group">
+ <td className="px-3 py-1 align-middle font-mono text-xs tabular-nums text-muted-foreground">
+ {index + 1}
+ </td>
+ <td className="px-1 py-1 align-middle">
+ <Field
+ value={pane.name}
+ onChange={(event) =>
+ onChange(index, { name: event.target.value })
+ }
+ aria-label={`Call-sign for terminal ${index + 1}`}
+ className="w-28 font-mono"
+ spellCheck={false}
+ />
+ </td>
+ <td className="px-1 py-1 align-middle">
+ <div className="flex flex-wrap items-center gap-1.5">
+ <Select
+ value={pane.agent}
+ aria-label={`Agent for terminal ${index + 1}`}
+ onChange={(event) =>
+ onChange(index, {
+ agent: event.target.value,
+ // The account belongs to the OLD CLI — an id from
+ // one CLI means nothing to the other.
+ account: undefined,
+ })
+ }
+ className="w-40"
+ >
+ {agents.map((agent) => (
+ <option
+ key={agent.name}
+ value={agent.name}
+ /* Kept in the list but unselectable, so a missing
+ CLI is visible rather than silently absent. */
+ disabled={!agent.installed}
+ >
+ {agent.display_name}
+ {agent.installed ? "" : " — not installed"}
+ </option>
+ ))}
+ </Select>
+ {/*
+ Renders NOTHING with a single login, which is almost
+ everybody: a control that answers a question the user
+ does not have is noise. It appears the moment a second
+ seat is registered, and then it is per pane, so one
+ folder can hold panes on both plans at once.
+ */}
+ {accounts.length >= 2 && (
+ <Select
+ value={pane.account ?? ""}
+ aria-label={`Subscription for the ${pane.agent} terminal`}
+ onChange={(event) =>
+ onChange(index, {
+ account: event.target.value || undefined,
+ })
+ }
+ className="w-36 text-xs"
+ >
+ <option value="">Active account</option>
+ {accounts.map((account) => (
+ <option key={account.id} value={account.id}>
+ {account.label}
+ {account.connected ? "" : " (not signed in)"}
+ </option>
+ ))}
+ </Select>
+ )}
+ </div>
+ </td>
+ </tr>
+ );
+ })}
+ </tbody>
+ </table>
+ </div>
+ <p
+ className={cn(
+ "border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",
+ )}
+ >
+ Terminals are numbered by position, so a call-sign is what you say out
+ loud. Coding mode turns on when the workspace opens, and off again from
+ the toolbar.
+ </p>
+ </Panel>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx
new file mode 100644
index 0000000000..c2cf417fe3
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceShape.tsx
@@ -0,0 +1,480 @@
+/**
+ * How many terminals the workspace opens with, and the shape they land in.
+ *
+ * ## One control, three grips
+ *
+ * The count used to be four separate controls sitting one under the other: a
+ * number field with its own minus and plus, a slider, and a row of seven preset
+ * buttons. All four set the same integer, so all four had to show the same
+ * "selected" state, and a screen that says one thing four times in four visual
+ * languages is what makes an interface feel machine-assembled.
+ *
+ * It is now ONE control that happens to be reachable three ways — a stepper you
+ * read the number off, a track you drag, and tick labels under that track. The
+ * ticks are not presets and are not styled as buttons: they are the scale's
+ * legend, and clicking a legend entry is a convenience, not a second mechanism.
+ * Every value between them is still reachable, which is the whole reason a
+ * "custom" row never needed to exist.
+ *
+ * ## The stage shows the workspace, not a picture of agents working
+ *
+ * Each miniature pane used to draw three animated bars standing in for the
+ * agent's output. It looked alive and said nothing — no agent has started, and
+ * the bars' widths came from an array indexed by pane number. Invented content
+ * is the cheapest way to make a preview feel untrustworthy, because the moment
+ * the reader works out the bars are fake they stop believing the arrangement
+ * too. So the panes now show exactly what is knowable before the workspace
+ * opens: how many there are, where each one sits, what each one is called, and
+ * which one the prompt bar will type into.
+ *
+ * The arrangement itself is not decorative. `paneGrid` is the same function the
+ * running workspace lays itself out with, fed the same panes the backend will
+ * create, at the measured width the grid will occupy — so the preview cannot
+ * describe a workspace that will not appear.
+ */
+import { useEffect, useMemo, useRef, useState } from "react";
+import { Minus, Plus } from "lucide-react";
+import { cn } from "@/lib/utils";
+import { IconButton } from "./controls";
+import {
+ MAX_PANES_PER_BAND,
+ paneGrid,
+ paneLines,
+ widthForOneBand,
+ wizardPanes,
+ workspaceBandCapacityForArea,
+} from "./layout";
+
+/**
+ * Counts that get a labelled tick on the track.
+ *
+ * The ones people reach for, so they are one click rather than a careful drag.
+ * Anything above the workspace maximum is dropped at render time.
+ */
+const TICKS = [1, 2, 4, 6, 8, 12] as const;
+
+/**
+ * Shape of the area the panes will actually fill, width ÷ height.
+ *
+ * The workspace grid sits under a toolbar and above the prompt bar, so it is
+ * markedly wider relative to its height than the window is: a maximised
+ * 1920 × 1080 window leaves the grid roughly 1636 × 726.
+ *
+ * The stage takes its height from this, so a miniature pane has the proportions
+ * of the pane it stands for. Without it the stage would be right about the
+ * arrangement and wrong about the panes — four across would look like letterbox
+ * strips where the real ones are nearly square, which is the sort of small lie
+ * that makes a preview feel untrustworthy even when its numbers are correct.
+ */
+const WORKSPACE_ASPECT = 1636 / 726;
+
+/**
+ * Bounds on the stage's height, in px.
+ *
+ * Safety rails for extreme column widths only — at the launcher's own width the
+ * derived height lands comfortably inside them, so the stage keeps its true
+ * proportions and holds still while the count changes.
+ */
+const STAGE_MIN_HEIGHT_PX = 120;
+const STAGE_MAX_HEIGHT_PX = 260;
+
+/*
+ * How much of itself a miniature pane has room to draw.
+ *
+ * BOTH axes, which an earlier version got wrong: it asked only about width, so
+ * sixty terminals — laid out three across and twenty down — kept their title
+ * bars at 16 px of height and rendered every call-sign as a squashed smear. A
+ * pane that is wide and flat has no more room for a name than a narrow one.
+ *
+ * Dropping detail as the panes shrink is also the stage being honest: sixty
+ * terminals really are sixty slivers, and showing them as plain rectangles says
+ * so more clearly than sixty illegible labels.
+ */
+const PANE_LABEL_MIN_WIDTH_PX = 48;
+const PANE_LABEL_MIN_HEIGHT_PX = 34;
+const PANE_CHROME_MIN_WIDTH_PX = 18;
+const PANE_CHROME_MIN_HEIGHT_PX = 16;
+
+interface WorkspaceShapeProps {
+ /** Terminals currently chosen. */
+ count: number;
+ /** Call-signs the panes will open with, so the stage shows the real names. */
+ names: string[];
+ /**
+ * Width of the slot the workspace will occupy, in px — measured by the view
+ * from the element the grid will later fill. Together with the height below,
+ * it keeps both unreadably narrow and excessively tall panes out of the
+ * preview and the running workspace.
+ */
+ workspaceWidthPx: number;
+ /** Height the live grid will occupy with its default collapsed composer. */
+ workspaceHeightPx: number;
+}
+
+export function WorkspaceShape({
+ count,
+ names,
+ workspaceWidthPx,
+ workspaceHeightPx,
+}: WorkspaceShapeProps) {
+ const perBand = useMemo(
+ () =>
+ workspaceBandCapacityForArea(workspaceWidthPx, workspaceHeightPx, count),
+ [workspaceWidthPx, workspaceHeightPx, count],
+ );
+ const grid = useMemo(
+ () => paneGrid(wizardPanes(count), perBand),
+ [count, perBand],
+ );
+ const bands = useMemo(() => paneLines(count, perBand), [count, perBand]);
+
+ return (
+ <div className="flex flex-col gap-3 p-3">
+ <WorkspaceStage
+ columns={grid.columns}
+ rows={bands}
+ count={count}
+ names={names}
+ />
+ <Readout
+ columns={grid.columns}
+ bands={bands}
+ count={count}
+ workspaceWidthPx={workspaceWidthPx}
+ />
+ </div>
+ );
+}
+
+/**
+ * The stepper the count is read off — the header half of this control.
+ *
+ * Lives in the panel's title row rather than above the stage, so the number sits
+ * on the same line as the word "Terminals" and the stage below it is the only
+ * thing that changes when the number does.
+ */
+export function CountStepper({
+ count,
+ max,
+ onChange,
+}: {
+ count: number;
+ max: number;
+ onChange: (next: number) => void;
+}) {
+ const set = (next: number) =>
+ onChange(Math.max(1, Math.min(max, Math.trunc(next))));
+ return (
+ <div className="flex items-center gap-0.5 rounded-control border border-border bg-background p-0.5">
+ <IconButton
+ size="sm"
+ label="Use one fewer terminal"
+ disabled={count <= 1}
+ onClick={() => set(count - 1)}
+ >
+ <Minus className="h-3.5 w-3.5" />
+ </IconButton>
+ <input
+ type="number"
+ min={1}
+ max={max}
+ value={count}
+ aria-label="Number of terminals"
+ data-testid="terminal-count-value"
+ onChange={(event) =>
+ set(
+ Number.isFinite(event.currentTarget.valueAsNumber)
+ ? event.currentTarget.valueAsNumber
+ : 1,
+ )
+ }
+ /*
+ * The spin buttons the browser adds are hidden: this field already has
+ * a minus and a plus either side of it, at a size a pointer can hit, and
+ * the native pair is a third of that size and only appears on hover.
+ * Two steppers on one number is the exact duplication this control was
+ * rebuilt to remove.
+ */
+ className={
+ "h-6 w-10 border-0 bg-transparent p-0 text-center font-mono text-sm " +
+ "font-semibold tabular-nums text-foreground outline-none " +
+ "[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none " +
+ "[&::-webkit-outer-spin-button]:appearance-none"
+ }
+ />
+ <IconButton
+ size="sm"
+ label="Use one more terminal"
+ disabled={count >= max}
+ onClick={() => set(count + 1)}
+ >
+ <Plus className="h-3.5 w-3.5" />
+ </IconButton>
+ </div>
+ );
+}
+
+/**
+ * The track, with the common counts labelled beneath it.
+ *
+ * A native range input, so keyboard, screen reader and touch all work without
+ * being reimplemented. The labels under it are buttons, but deliberately styled
+ * as a scale legend — see the note at the top of this file.
+ */
+export function CountTrack({
+ count,
+ max,
+ onChange,
+}: {
+ count: number;
+ max: number;
+ onChange: (next: number) => void;
+}) {
+ const ticks = TICKS.filter((n) => n <= max);
+ return (
+ <div className="flex flex-col gap-1.5 px-3 pb-3">
+ <input
+ type="range"
+ min={1}
+ max={max}
+ step={1}
+ value={count}
+ aria-label="Number of terminals"
+ data-testid="terminal-count-range"
+ onChange={(event) => onChange(Number(event.currentTarget.value))}
+ className="h-1 w-full cursor-pointer accent-primary"
+ />
+ <div className="flex items-center justify-between">
+ {ticks.map((n) => (
+ <button
+ key={n}
+ type="button"
+ aria-pressed={count === n}
+ onClick={() => onChange(n)}
+ className={cn(
+ "rounded px-1 font-mono text-[11px] tabular-nums transition-colors",
+ count === n
+ ? "text-primary"
+ : "text-muted-foreground/60 hover:text-foreground",
+ )}
+ >
+ {n}
+ </button>
+ ))}
+ </div>
+ </div>
+ );
+}
+
+/**
+ * The workspace that is about to open, at a scale that fits on this screen.
+ *
+ * Every pane is placed by `paneGrid` — the function the running workspace uses
+ * — over the panes the backend will actually create (`wizardPanes`). The two
+ * cannot drift apart without the running grid changing too.
+ */
+function WorkspaceStage({
+ columns,
+ rows,
+ count,
+ names,
+}: {
+ columns: number;
+ rows: number;
+ count: number;
+ names: string[];
+}) {
+ /*
+ * The stage measures ITSELF rather than being told its size.
+ *
+ * Its height comes from CSS (`aspect-ratio`), so only the browser knows what
+ * it ended up being once the min/max rails are applied — and each pane needs
+ * that to decide how much of itself it has room to draw.
+ */
+ const stageRef = useRef<HTMLDivElement | null>(null);
+ const [size, setSize] = useState({ width: 0, height: 0 });
+ useEffect(() => {
+ const node = stageRef.current;
+ if (!node || typeof ResizeObserver === "undefined") return;
+ setSize({ width: node.clientWidth, height: node.clientHeight });
+ const observer = new ResizeObserver((entries) => {
+ const box = entries[0]?.contentRect;
+ setSize({
+ width: box?.width ?? node.clientWidth,
+ height: box?.height ?? node.clientHeight,
+ });
+ });
+ observer.observe(node);
+ return () => observer.disconnect();
+ }, []);
+
+ const safeColumns = Math.max(1, columns);
+ const safeRows = Math.max(1, rows);
+ const paneWidth = size.width > 0 ? size.width / safeColumns : 0;
+ const paneHeight = size.height > 0 ? size.height / safeRows : 0;
+ // Panes are laid out as a grid of equal cells, so one pane's detail level is
+ // every pane's — decided once rather than per tile. Before the first measure
+ // both are 0; assume the roomy case so the stage never flashes as bare tiles.
+ const unmeasured = paneWidth === 0 || paneHeight === 0;
+ const detail: PaneDetail =
+ unmeasured ||
+ (paneWidth >= PANE_LABEL_MIN_WIDTH_PX &&
+ paneHeight >= PANE_LABEL_MIN_HEIGHT_PX)
+ ? "full"
+ : paneWidth >= PANE_CHROME_MIN_WIDTH_PX &&
+ paneHeight >= PANE_CHROME_MIN_HEIGHT_PX
+ ? "chrome"
+ : "tile";
+
+ return (
+ <div
+ data-testid="workspace-stage"
+ className="overflow-hidden rounded-control bg-background/70 ring-1 ring-inset ring-border/60"
+ style={{
+ aspectRatio: `${WORKSPACE_ASPECT}`,
+ minHeight: STAGE_MIN_HEIGHT_PX,
+ maxHeight: STAGE_MAX_HEIGHT_PX,
+ }}
+ >
+ <div
+ ref={stageRef}
+ data-testid="workspace-stage-grid"
+ className="grid h-full w-full gap-1 p-1"
+ style={{
+ gridTemplateColumns: `repeat(${safeColumns}, minmax(0, 1fr))`,
+ gridTemplateRows: `repeat(${safeRows}, minmax(0, 1fr))`,
+ }}
+ >
+ {Array.from({ length: count }).map((_, index) => (
+ <StagePane
+ key={index}
+ name={names[index] ?? `T${index + 1}`}
+ detail={detail}
+ /* The workspace opens with the first pane selected — the prompt bar
+ types into it. Showing that here means the stage is not just the
+ right shape, it is the right state. */
+ focused={index === 0}
+ />
+ ))}
+ </div>
+ </div>
+ );
+}
+
+type PaneDetail = "full" | "chrome" | "tile";
+
+/** One terminal, showing only what is knowable before anything has started. */
+function StagePane({
+ name,
+ detail,
+ focused,
+}: {
+ name: string;
+ detail: PaneDetail;
+ focused: boolean;
+}) {
+ return (
+ <div
+ /*
+ * Dark, like the terminals it stands for — not a tile of brand colour.
+ * Colour marks ONE thing here: which pane the prompt bar will type into.
+ */
+ className={cn(
+ "flex min-h-0 min-w-0 items-start justify-start overflow-hidden rounded-[3px]",
+ focused ? "bg-primary/[0.09] ring-1 ring-inset ring-primary/40" : "bg-muted/40",
+ )}
+ >
+ {detail === "full" && (
+ <span
+ className={cn(
+ "truncate px-1.5 py-1 font-mono text-[10px] leading-none",
+ focused ? "text-primary" : "text-muted-foreground",
+ )}
+ >
+ {name}
+ </span>
+ )}
+ {detail === "chrome" && (
+ <span
+ className={cn(
+ "m-1 h-1 w-1 shrink-0 rounded-full",
+ focused ? "bg-primary" : "bg-muted-foreground/50",
+ )}
+ />
+ )}
+ </div>
+ );
+}
+
+/**
+ * What the stage shows, in words, together with what it depends on.
+ *
+ * The second half is the part that matters. An arrangement stated without its
+ * condition is a bug this step actually had: correct on screen, wrong five
+ * seconds later after a maximise, with nothing to explain the difference.
+ */
+function Readout({
+ columns,
+ bands,
+ count,
+ workspaceWidthPx,
+}: {
+ columns: number;
+ bands: number;
+ count: number;
+ workspaceWidthPx: number;
+}) {
+ const oneBandAt = widthForOneBand(count);
+ const wrapped = bands > 1;
+ const canUnwrap =
+ wrapped && oneBandAt !== null && oneBandAt > Math.round(workspaceWidthPx);
+
+ let condition: string;
+ if (!wrapped) {
+ condition = "All side by side — this window is wide enough.";
+ } else if (canUnwrap) {
+ condition = `Wrapped to keep every pane readable. From ${formatPx(
+ oneBandAt,
+ )} px wide they would all fit on one line — this window is ${formatPx(
+ Math.round(workspaceWidthPx),
+ )} px.`;
+ } else if (count > MAX_PANES_PER_BAND) {
+ condition = `More than ${MAX_PANES_PER_BAND} side by side is unreadable at any window size, so they wrap.`;
+ } else {
+ condition = "Wrapped to keep every pane readable.";
+ }
+
+ return (
+ <p
+ data-testid="workspace-stage-readout"
+ className="text-xs leading-relaxed text-muted-foreground"
+ >
+ <span className="font-mono tabular-nums text-foreground">
+ {columns} across × {bands} down
+ </span>{" "}
+ · {condition}
+ </p>
+ );
+}
+
+/**
+ * Digit grouping for a pixel width the user READS: 1 636, not 1636.
+ *
+ * The separator is an explicit NARROW NO-BREAK SPACE escape rather than a
+ * literal one, so it stays visible in the source and cannot be mistaken for an
+ * ordinary space by the next person who greps for it — which is exactly how it
+ * slipped past a test that searched for a plain space. It also keeps the number
+ * from breaking across two lines mid-thousands.
+ *
+ * Grouped by hand rather than through `toLocaleString`, whose output depends on
+ * the runtime's locale data: a number the user reads should not change shape
+ * with the machine that rendered it.
+ */
+const THOUSANDS_SEPARATOR = "\u202F";
+
+function formatPx(value: number): string {
+ return String(Math.round(value)).replace(
+ /\B(?=(\d{3})+(?!\d))/g,
+ THOUSANDS_SEPARATOR,
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/controls.tsx b/jarvis/ui/web/frontend/src/components/agentic/controls.tsx
new file mode 100644
index 0000000000..bc94a67074
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentic/controls.tsx
@@ -0,0 +1,260 @@
+/**
+ * The controls the Agentic IDE's own screens are built from.
+ *
+ * ## Why this section does not use `.btn-primary` / `.btn-ghost`
+ *
+ * Those two are the app's marketing-weight controls: a full pill, 24 px of
+ * horizontal padding, 12 px of vertical padding, and a 32 px yellow glow on
+ * hover. They are right on a settings page with four buttons on it and wrong
+ * here, where a single screen carries a folder browser, a count, and one row per
+ * terminal. Sized like that, the launcher became a column of large soft shapes
+ * with no hierarchy left to spend — every control shouted, so none of them led.
+ *
+ * These are the same design language one size down and one volume quieter:
+ * 32 px tall, 6 px radius, no glow, and colour reserved. That reservation is the
+ * actual rule and the reason this file exists:
+ *
+ * * **Yellow means one of two things** — "this is the choice you made" or "this
+ * is the one action that starts something". Nothing else may be yellow. An
+ * accent spent on decoration cannot also mark a selection, and this screen has
+ * real selections to mark.
+ * * **Icons carry meaning or they are not there.** A rocket beside "Open" and a
+ * sparkle beside a heading tell the reader nothing they did not already read
+ * in the word next to it.
+ *
+ * Radii are a closed set across this section: `rounded-control` (6 px) for a
+ * control, a row or a tile, and `rounded-surface` (10 px) for a panel. Both are
+ * defined in tailwind.config.ts, where the note explains why the theme's own
+ * `md`/`lg`/`xl` could not be used: they all resolve to 10-12 px, so nesting
+ * them produced no sense of one thing sitting inside another.
+ */
+import { forwardRef } from "react";
+import { cn } from "@/lib/utils";
+
+type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
+ /**
+ * `primary` starts something and there is at most one per screen; `quiet` is
+ * every other action; `subtle` is for controls that live inside a row and
+ * should recede until the row is hovered.
+ */
+ variant?: "primary" | "quiet" | "subtle";
+};
+
+const BASE =
+ "inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-control px-3 " +
+ "text-sm font-medium transition-colors " +
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 " +
+ "disabled:cursor-not-allowed disabled:opacity-40";
+
+const VARIANTS: Record<NonNullable<ButtonProps["variant"]>, string> = {
+ primary: "bg-primary text-primary-foreground hover:bg-primary/90",
+ quiet:
+ "border border-border bg-card/60 text-foreground hover:border-border hover:bg-secondary",
+ subtle: "text-muted-foreground hover:bg-secondary hover:text-foreground",
+};
+
+export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
+ function Button({ variant = "quiet", className, type, ...rest }, ref) {
+ return (
+ <button
+ ref={ref}
+ // Every button in this section sits inside the launcher, which is not a
+ // form — but the folder path field IS wrapped in one, and a button
+ // without an explicit type submits it. Defaulting here rather than at
+ // each call site is what stops one forgotten attribute from reloading
+ // the view.
+ type={type ?? "button"}
+ className={cn(BASE, VARIANTS[variant], className)}
+ {...rest}
+ />
+ );
+ },
+);
+
+/**
+ * A square button that is only an icon.
+ *
+ * Separate from `Button` because the padding rule is different — an icon needs
+ * equal space on all four sides — and because it MUST be given a label. An
+ * unlabelled icon button is invisible to a screen reader and unguessable to
+ * everyone else, so the prop is required rather than optional.
+ */
+type IconButtonProps = Omit<
+ React.ButtonHTMLAttributes<HTMLButtonElement>,
+ "aria-label"
+> & {
+ label: string;
+ /** Matches `Button`'s scale, so the two line up in a row. */
+ size?: "sm" | "md";
+};
+
+export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
+ function IconButton({ label, size = "md", className, type, ...rest }, ref) {
+ return (
+ <button
+ ref={ref}
+ type={type ?? "button"}
+ aria-label={label}
+ title={rest.title ?? label}
+ className={cn(
+ "inline-flex shrink-0 items-center justify-center rounded-control " +
+ "text-muted-foreground transition-colors " +
+ "hover:bg-secondary hover:text-foreground " +
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 " +
+ "disabled:cursor-not-allowed disabled:opacity-40",
+ size === "sm" ? "h-6 w-6" : "h-8 w-8",
+ className,
+ )}
+ {...rest}
+ />
+ );
+ },
+);
+
+/**
+ * A text field at the same scale as `Button`.
+ *
+ * The focus treatment is a border change rather than a ring on purpose: several
+ * of these sit in one row beside chips and selects, and a 2 px ring around each
+ * would make a focused row look like an error state.
+ */
+export const Field = forwardRef<
+ HTMLInputElement,
+ React.InputHTMLAttributes<HTMLInputElement>
+>(function Field({ className, ...rest }, ref) {
+ return (
+ <input
+ ref={ref}
+ className={cn(
+ "h-8 min-w-0 rounded-control border border-border bg-background px-2.5 text-sm " +
+ "text-foreground placeholder:text-muted-foreground/70 " +
+ "outline-none transition-colors focus:border-primary/60",
+ className,
+ )}
+ {...rest}
+ />
+ );
+});
+
+/**
+ * A native select at the same scale.
+ *
+ * Native rather than a custom menu because the two places it is used — which
+ * coding CLI runs in a pane, which subscription it opens on — are short lists
+ * where the OS control is better than anything worth reimplementing: it is
+ * keyboard-navigable, it scrolls, and on a phone it becomes the platform picker.
+ */
+export const Select = forwardRef<
+ HTMLSelectElement,
+ React.SelectHTMLAttributes<HTMLSelectElement>
+>(function Select({ className, children, ...rest }, ref) {
+ return (
+ <select
+ ref={ref}
+ className={cn(
+ "h-8 max-w-full rounded-control border border-border bg-background px-2 text-sm " +
+ "text-foreground outline-none transition-colors focus:border-primary/60 " +
+ "disabled:cursor-not-allowed disabled:opacity-40",
+ className,
+ )}
+ {...rest}
+ >
+ {children}
+ </select>
+ );
+});
+
+/**
+ * A panel — the one container shape this section uses.
+ *
+ * `title` is rendered as a small caps-tracked label rather than a heading with
+ * its own font size. The launcher has one real heading; everything else is a
+ * label on a region, and giving those heading-sized type is what made the old
+ * screen read as four unrelated cards stacked in a column.
+ */
+export function Panel({
+ title,
+ aside,
+ className,
+ bodyClassName,
+ children,
+ ...rest
+}: React.HTMLAttributes<HTMLElement> & {
+ title?: React.ReactNode;
+ /** Controls that belong to this panel, pinned to the right of its label. */
+ aside?: React.ReactNode;
+ bodyClassName?: string;
+}) {
+ return (
+ <section
+ className={cn(
+ "flex min-h-0 min-w-0 flex-col rounded-surface border border-border/70 bg-card/30",
+ className,
+ )}
+ {...rest}
+ >
+ {(title || aside) && (
+ <div className="flex h-11 shrink-0 items-center justify-between gap-3 border-b border-border/70 px-3">
+ {title ? <SectionLabel>{title}</SectionLabel> : <span />}
+ {aside && (
+ <div className="flex shrink-0 items-center gap-1.5">{aside}</div>
+ )}
+ </div>
+ )}
+ <div className={cn("flex min-h-0 flex-1 flex-col", bodyClassName)}>
+ {children}
+ </div>
+ </section>
+ );
+}
+
+/** The one label style for a region of this screen. */
+export function SectionLabel({
+ children,
+ className,
+}: {
+ children: React.ReactNode;
+ className?: string;
+}) {
+ return (
+ <span
+ className={cn(
+ "truncate text-[11px] font-semibold uppercase tracking-[0.12em] text-muted-foreground",
+ className,
+ )}
+ >
+ {children}
+ </span>
+ );
+}
+
+/**
+ * Something the user should know before they press Open.
+ *
+ * One line, a rule down its left edge, no filled background and no icon. The
+ * previous version was a filled box with a border, an alert glyph and its own
+ * colour — three ways of saying "notice" stacked on one another, which at the
+ * top of a screen out-shouted the screen. A coloured edge is enough to find and
+ * quiet enough to walk past, and walking past it is the common case: both of
+ * these describe the machine, not the choice being made.
+ */
+export function Notice({
+ tone,
+ children,
+}: {
+ tone: "warning" | "error";
+ children: React.ReactNode;
+}) {
+ return (
+ <div
+ className={cn(
+ "flex flex-wrap items-center gap-x-2 gap-y-1 border-l-2 py-1 pl-3 text-sm",
+ tone === "error"
+ ? "border-destructive/70 text-destructive"
+ : "border-amber-400/70 text-amber-200/90",
+ )}
+ >
+ {children}
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
index a07e3d9dc6..bef0a828ff 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
@@ -302,13 +302,13 @@ describe("Agentic IDE — before the first read lands", () => {
/**
* A workspace the view has not heard about yet is NOT "no workspace".
*
- * This view used to fall straight through to the wizard while it waited, so
+ * This view used to fall straight through to the launcher while it waited, so
* a user returning to a running workspace was met by step 1 of the onboarding
* flow asking which folder the agents should work in — in front of eleven
* agents that had never stopped (maintainer report 2026-07-29). Being told to
* wait a moment is a far better answer than being told to start over.
*/
- it("shows a neutral placeholder rather than the onboarding wizard", async () => {
+ it("shows a neutral placeholder rather than the onboarding screen", async () => {
// Both reads hang: this is the state the view is in on every cold start,
// held open so it can be asserted on.
vi.mocked(api.fetchIdeState).mockReturnValue(new Promise(() => {}));
@@ -317,9 +317,8 @@ describe("Agentic IDE — before the first read lands", () => {
render(<AgenticIdeView />);
expect(await screen.findByTestId("agentic-ide-loading")).toBeTruthy();
- // The two things that would read as "there is nothing open here".
- expect(screen.queryByText(/which folder should the agents work in/i)).toBeNull();
- expect(screen.queryByRole("button", { name: /next/i })).toBeNull();
+ // The thing that would read as "there is nothing open here".
+ expect(screen.queryByTestId("workspace-launcher")).toBeNull();
});
it("draws a running workspace without waiting for the CLI sweep", async () => {
@@ -337,7 +336,7 @@ describe("Agentic IDE — before the first read lands", () => {
expect(await screen.findByTestId("pane-Mika")).toBeTruthy();
});
- it("holds the placeholder until the wizard has agents to offer", async () => {
+ it("holds the placeholder until the launcher has agents to offer", async () => {
// The reverse: with no workspace open, the wizard's agent step is the whole
// point of the sweep, so showing the wizard before it lands would offer an
// empty list.
@@ -346,43 +345,45 @@ describe("Agentic IDE — before the first read lands", () => {
render(<AgenticIdeView />);
expect(await screen.findByTestId("agentic-ide-loading")).toBeTruthy();
- expect(screen.queryByRole("button", { name: /next/i })).toBeNull();
+ expect(screen.queryByTestId("workspace-launcher")).toBeNull();
});
});
-describe("Agentic IDE wizard", () => {
- it("starts on the folder step and blocks Next until a folder is picked", async () => {
+describe("Agentic IDE launcher", () => {
+ it("blocks the one action until a folder is picked", async () => {
render(<AgenticIdeView />);
await waitFor(() => expect(api.fetchIdeAgents).toHaveBeenCalled());
- const next = screen.getByRole("button", {
- name: /next/i,
+ const open = screen.getByRole("button", {
+ name: /open workspace/i,
}) as HTMLButtonElement;
- expect(next.disabled).toBe(true);
+ expect(open.disabled).toBe(true);
fireEvent.click(await screen.findByRole("button", { name: /project/i }));
- await waitFor(() => expect(next.disabled).toBe(false));
+ await waitFor(() => expect(open.disabled).toBe(false));
});
- it("walks folder → count → agents → start and opens the workspace", async () => {
+ /**
+ * The three decisions are on ONE screen, so opening is: pick a folder, press
+ * the button. The count and the call-signs are already answered with
+ * defaults, and both are on screen while the folder is being chosen — which
+ * is what let the wizard's Back/Next pair and its confirmation step go.
+ */
+ it("opens the workspace from one screen, with no step to walk", async () => {
vi.mocked(api.startIdeSession).mockResolvedValue(
stateWith(sessionWith(["Mika", "Nova"])),
);
render(<AgenticIdeView />);
await waitFor(() => expect(api.fetchIdeAgents).toHaveBeenCalled());
- fireEvent.click(await screen.findByRole("button", { name: /project/i }));
- fireEvent.click(screen.getByRole("button", { name: /next/i }));
-
- // Count step — pick 2 terminals.
- fireEvent.click(screen.getByRole("button", { name: "2" }));
- fireEvent.click(screen.getByRole("button", { name: /next/i }));
-
- // Agent step — the call-signs are pre-filled from the suggested pool.
- expect(screen.getByDisplayValue("Mika")).toBeTruthy();
+ // Visible before anything has been chosen, with the call-signs pre-filled
+ // from the pool the backend suggested.
+ expect(await screen.findByDisplayValue("Mika")).toBeTruthy();
expect(screen.getByDisplayValue("Nova")).toBeTruthy();
- fireEvent.click(screen.getByRole("button", { name: /next/i }));
+ expect(screen.queryByRole("button", { name: /^next$/i })).toBeNull();
+ expect(screen.queryByRole("button", { name: /^back$/i })).toBeNull();
+ fireEvent.click(await screen.findByRole("button", { name: /project/i }));
fireEvent.click(screen.getByRole("button", { name: /open workspace/i }));
await waitFor(() =>
@@ -395,18 +396,36 @@ describe("Agentic IDE wizard", () => {
expect(await screen.findByTestId("pane-Mika")).toBeTruthy();
});
+ it("keeps a half-made plan when the folder is changed afterwards", async () => {
+ // What the wizard charged two Back presses for. The plan lives in the view,
+ // not in the panel that renders it, so re-deciding the folder cannot cost
+ // the call-signs someone has already typed.
+ render(<AgenticIdeView />);
+ await waitFor(() => expect(api.fetchIdeAgents).toHaveBeenCalled());
+
+ fireEvent.change(await screen.findByLabelText("Call-sign for terminal 1"), {
+ target: { value: "Scout" },
+ });
+ fireEvent.click(await screen.findByRole("button", { name: /project/i }));
+
+ expect(screen.getByDisplayValue("Scout")).toBeTruthy();
+ });
+
/**
- * Drive the wizard to the count step in a workspace of ``width`` pixels, set
- * the count to ``n``, and return the stage — the miniature of the workspace
- * that is about to open.
+ * Set the count to ``n`` in a workspace of ``width`` × ``height`` pixels and
+ * return the stage — the miniature of the workspace that is about to open.
*/
- async function stageAt(width: number, n: string): Promise<HTMLElement> {
+ async function stageAt(
+ width: number,
+ n: string,
+ height: number = 0,
+ ): Promise<HTMLElement> {
const previous = globalThis.ResizeObserver;
class WidthObserver {
constructor(private readonly callback: ResizeObserverCallback) {}
observe(): void {
this.callback(
- [{ contentRect: { width } } as ResizeObserverEntry],
+ [{ contentRect: { width, height } } as ResizeObserverEntry],
this as unknown as ResizeObserver,
);
}
@@ -418,10 +437,12 @@ describe("Agentic IDE wizard", () => {
try {
render(<AgenticIdeView />);
await waitFor(() => expect(api.fetchIdeAgents).toHaveBeenCalled());
- fireEvent.click(await screen.findByRole("button", { name: /project/i }));
- fireEvent.click(screen.getByRole("button", { name: /next/i }));
+ // No steps to walk to reach the count: it sits on the same screen as the
+ // folder list, which is what these arrangement assertions render against.
fireEvent.change(
- screen.getByRole("spinbutton", { name: /number of terminals/i }),
+ await screen.findByRole("spinbutton", {
+ name: /number of terminals/i,
+ }),
{ target: { value: n } },
);
return screen.getByTestId("workspace-stage-grid");
@@ -445,8 +466,8 @@ describe("Agentic IDE wizard", () => {
const grouped = (digits: string) => digits.replace(/ /g, "\u202F");
it("sets any count from one control instead of cards plus a custom row", async () => {
- // Two ways to set one number meant two competing "selected" states. The
- // track covers every value, and the common ones are notches on it.
+ // Two ways to set one number meant two competing "selected" states. One
+ // control now covers every value, and its two grips must never disagree.
await stageAt(2328, "10");
expect(
@@ -456,7 +477,13 @@ describe("Agentic IDE wizard", () => {
}) as HTMLInputElement
).value,
).toBe("10");
- expect(screen.getByTestId("terminal-count-value").textContent).toBe("10");
+ expect(
+ (
+ screen.getByRole("spinbutton", {
+ name: /number of terminals/i,
+ }) as HTMLInputElement
+ ).value,
+ ).toBe("10");
expect(
screen.queryByRole("button", { name: /custom terminals/i }),
).toBeNull();
@@ -465,13 +492,10 @@ describe("Agentic IDE wizard", () => {
it("builds the requested number of terminal plans", async () => {
render(<AgenticIdeView />);
await waitFor(() => expect(api.fetchIdeAgents).toHaveBeenCalled());
- fireEvent.click(await screen.findByRole("button", { name: /project/i }));
- fireEvent.click(screen.getByRole("button", { name: /next/i }));
fireEvent.change(
- screen.getByRole("spinbutton", { name: /number of terminals/i }),
+ await screen.findByRole("spinbutton", { name: /number of terminals/i }),
{ target: { value: "10" } },
);
- fireEvent.click(screen.getByRole("button", { name: /next/i }));
expect(screen.getByLabelText("Call-sign for terminal 10")).toBeTruthy();
});
@@ -518,6 +542,16 @@ describe("Agentic IDE wizard", () => {
expect(rowsOf(stage)).toBe("repeat(1, minmax(0, 1fr))");
});
+ it("previews four terminals as two by two in a tall 2K workspace", async () => {
+ // The live grid gets 1,100 px after its 64 px toolbar/composer chrome. Four
+ // full-height TUI columns would pin their input at the bottom and leave the
+ // reported half-screen gap above it, so the preview must show the same 2 x
+ // 2 arrangement the running workspace now chooses.
+ const stage = await stageAt(2048, "4", 1164);
+ expect(columnsOf(stage)).toBe("repeat(2, minmax(0, 1fr))");
+ expect(rowsOf(stage)).toBe("repeat(2, minmax(0, 1fr))");
+ });
+
it("draws one pane per terminal and never more than the stage can hold", async () => {
// The old dot preview sat in a fixed 40×40 px box with nothing bounding it,
// so a high count in a narrow window grew a tall column of dots straight out
@@ -594,7 +628,7 @@ describe("Agentic IDE running workspace", () => {
);
render(<AgenticIdeView />);
expect(await screen.findByTestId("pane-Mika")).toBeTruthy();
- expect(screen.queryByRole("button", { name: /next/i })).toBeNull();
+ expect(screen.queryByTestId("workspace-launcher")).toBeNull();
});
it("toggles focus mode through the API, not just locally", async () => {
@@ -709,13 +743,13 @@ describe("AgenticIdeView — resuming the last workspace", () => {
await screen.findByTestId("resume-card");
expect(screen.getByTestId("resume-pane-alex")).toBeTruthy();
- // The wizard is still right there — the offer never blocks it.
- expect(screen.getByText("Folder")).toBeTruthy();
+ // The launcher is still right there — the offer never blocks it.
+ expect(screen.getByTestId("workspace-launcher")).toBeTruthy();
});
it("says nothing when there is nothing to resume", async () => {
render(<AgenticIdeView />);
- await screen.findByText("Folder");
+ await screen.findByTestId("workspace-launcher");
expect(screen.queryByTestId("resume-card")).toBeNull();
});
@@ -835,7 +869,7 @@ describe("AgenticIdeView — the workspace bar", () => {
it("stays hidden while nothing is open", async () => {
render(<AgenticIdeView />);
- await screen.findByText("Folder");
+ await screen.findByTestId("workspace-launcher");
expect(screen.queryByTestId("workspace-bar")).toBeNull();
});
@@ -875,8 +909,8 @@ describe("AgenticIdeView — the workspace bar", () => {
);
expect(api.closeWorkspace).not.toHaveBeenCalled();
expect(api.endIdeSession).not.toHaveBeenCalled();
- // The wizard is showing, and the bar still lists both workspaces.
- await screen.findByText("Folder");
+ // The launcher is showing, and the bar still lists both workspaces.
+ await screen.findByTestId("workspace-launcher");
expect(screen.getByTestId("workspace-tab-ide_other")).toBeTruthy();
expect(screen.getByTestId("workspace-tab-ide_test")).toBeTruthy();
});
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
index 82ddff0d2c..dc1699b2f1 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
@@ -16,27 +16,14 @@
* panel copy inside is still English-only source awaiting its i18n keys.
*/
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
-import {
- AlertCircle,
- ArrowLeft,
- ArrowRight,
- Brain,
- Check,
- Download,
- FolderOpen,
- Loader2,
- Mic,
- Rocket,
- Sparkles,
- Terminal,
- Users,
-} from "lucide-react";
-import { ViewHeader } from "@/views/ChatsView";
+import { Loader2 } from "lucide-react";
import { useEventStore } from "@/store/events";
-import { cn } from "@/lib/utils";
-import { useT } from "@/i18n";
import { AgenticGrid } from "@/components/agentic/AgenticGrid";
-import { TerminalCountStep } from "@/components/agentic/TerminalCountStep";
+import {
+ WorkspaceLauncher,
+ type PlannedTerminal,
+} from "@/components/agentic/WorkspaceLauncher";
+import { Button } from "@/components/agentic/controls";
import {
type AgentAccount,
type AgentAccountsResponse,
@@ -44,8 +31,6 @@ import {
groupFor,
} from "@/lib/agentAccountsApi";
import { TopBarActions } from "@/components/layout/TopBar";
-import { FolderPicker } from "@/components/agentic/FolderPicker";
-import { ResumeCard } from "@/components/agentic/ResumeCard";
import { WorkspaceBar } from "@/components/agentic/WorkspaceBar";
import {
isEmptyPayload,
@@ -64,7 +49,6 @@ import {
resumeWorkspace,
setFocusMode,
startIdeSession,
- type AgentStatus,
type AgentsResponse,
type IdeAccountState,
type IdeState,
@@ -73,19 +57,16 @@ import {
type WorkspaceCard,
} from "@/lib/agenticIdeApi";
-type Step = 0 | 1 | 2 | 3;
-
-interface PlannedTerminal {
- agent: string;
- name: string;
- /**
- * Which subscription of `agent` this pane opens on, or undefined for the
- * active one. Per pane rather than per workspace on purpose: that is what
- * lets two seats of the same plan run side by side in one folder — which is
- * the entire reason for holding two.
- */
- account?: string;
-}
+/**
+ * The running workspace's one-line toolbar plus its default collapsed composer.
+ *
+ * The wizard measures the whole slot before either exists, while the terminal
+ * layout measures only the grid between them. Removing their stable default
+ * height lets the preview make the same width-and-height decision the live grid
+ * will make. An opened composer is deliberately excluded: it is a later user
+ * resize, and the live grid responds to that measurement itself.
+ */
+const WORKSPACE_GRID_CHROME_PX = 64;
/**
* Terminal plan for ``count`` panes, preserving whatever the user already chose
@@ -129,7 +110,6 @@ export interface AgenticIdeViewProps {
}
export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
- const t = useT();
const pushToast = useEventStore((s) => s.pushToast);
const setActiveSection = useEventStore((s) => s.setActiveSection);
@@ -159,7 +139,6 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
*/
const [addingNew, setAddingNew] = useState(false);
- const [step, setStep] = useState<Step>(0);
const [folder, setFolder] = useState<string | null>(null);
const [count, setCount] = useState(2);
const [planned, setPlanned] = useState<PlannedTerminal[]>([]);
@@ -318,30 +297,35 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
const [modeIntroFor, setModeIntroFor] = useState<string | null>(null);
/*
- * How wide the workspace will be — measured here, in the wizard, because the
- * preview dots must promise the arrangement the grid will actually produce.
+ * How large the workspace will be — measured here, in the wizard, because
+ * the preview must promise the arrangement the grid will actually produce.
*
- * The grid decides its band width from its own width (a pane below
- * MIN_PANE_WIDTH_PX is unreadable), so a preview computing columns from the
- * count alone drifts apart from it the moment the window is narrow: it drew
- * "12 → 6 above, 6 below" while the grid, in the same window, produced three
- * columns and four rows. The wizard shell sits in the same slot the grid will
- * occupy, so measuring it here answers the same question.
+ * Width stops panes becoming unreadably narrow; height stops full-screen TUIs
+ * becoming tall shafts with their answer at the top and their input at the
+ * bottom. A preview computing columns from the count alone drifts apart from
+ * the running grid on either axis. The wizard shell sits in the same slot the
+ * grid will occupy, so measuring it here answers the same question.
*
- * This is the width the preview then NAMES rather than silently assumes — see
- * TerminalCountStep. Measuring it right only makes the preview correct for the
- * window it was shown in; saying so is what makes it correct after a maximise.
+ * The readout names the width condition rather than silently assuming it —
+ * see WorkspaceShape. Measuring the area makes the picture correct for the
+ * window it was shown in; saying so is what keeps it honest after a resize.
*/
const shellRef = useRef<HTMLDivElement | null>(null);
const [shellWidth, setShellWidth] = useState(0);
+ const [shellHeight, setShellHeight] = useState(0);
useEffect(() => {
const node = shellRef.current;
if (!node || typeof ResizeObserver === "undefined") return;
setShellWidth(node.clientWidth);
+ setShellHeight(Math.round(node.clientHeight / 16) * 16);
const observer = new ResizeObserver((entries) => {
const width = entries[0]?.contentRect.width ?? node.clientWidth;
+ const height = entries[0]?.contentRect.height ?? node.clientHeight;
// Same 16 px step the grid rounds to, so both sides flip at one width.
setShellWidth(Math.round(width / 16) * 16);
+ // Height can now move a whole terminal band too; keep the decision stable
+ // through one-pixel WebView resize noise just as width already does.
+ setShellHeight(Math.round(height / 16) * 16);
});
observer.observe(node);
return () => observer.disconnect();
@@ -436,14 +420,28 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
);
};
- const goToStep = (next: Step) => {
- // Entering the agent step is the moment the plan has to exist and the
- // suggested call-signs have certainly arrived.
- if (next === 2) {
- setPlanned((prev) => buildPlan(count, prev, defaultAgent, suggested));
- }
- setStep(next);
- };
+ /*
+ * The plan is built when the count changes rather than held in sync with it.
+ *
+ * It is also built once the agent sweep lands, which is the case the launcher
+ * created: with everything on one screen the terminal rows are visible from
+ * the first paint, so the plan has to exist before the user touches anything.
+ * A wizard could defer this to the moment the agent step was entered; there
+ * is no such moment any more. Guarded on length, so it can never overwrite
+ * choices already made.
+ */
+ useEffect(() => {
+ // Not before the sweep lands. `suggested` is empty until it does, so an
+ // earlier run would fill the plan with T1/T2 placeholders — and the guard
+ // below, which exists to protect choices the user has made, would then
+ // faithfully protect those placeholders from the real call-signs.
+ if (!meta) return;
+ setPlanned((previous) =>
+ previous.length === count
+ ? previous
+ : buildPlan(count, previous, defaultAgent, suggested),
+ );
+ }, [meta, count, defaultAgent, suggested]);
const start = async () => {
if (!folder) return;
@@ -454,9 +452,8 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
const next = await startIdeSession(folder, planned);
applyState(next);
setAddingNew(false);
- // The wizard is reusable — someone who opens a third workspace should not
- // land on the leftovers of the second one's plan.
- setStep(0);
+ // The launcher is reusable — someone who opens a third workspace should
+ // not land on the leftovers of the second one's plan.
setFolder(null);
const names = next.session?.terminals.map((x) => x.name).join(", ") ?? "";
pushToast("success", `Workspace open — ${names}`);
@@ -472,7 +469,6 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
try {
await endIdeSession();
setFocus(false);
- setStep(0);
// Closing on purpose withdraws the offer, so the wizard comes back clean
// rather than immediately proposing the workspace just shut down.
setOffer(null);
@@ -583,7 +579,6 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
applyState(await activateWorkspace(null));
setAddingNew(true);
// A fresh plan, not the previous workspace's.
- setStep(0);
setFolder(null);
setOffer(null);
} catch (e) {
@@ -603,7 +598,6 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
// Nothing left — the wizard is the screen again, and the offer for the
// workspace just shut down has been withdrawn with it.
setAddingNew(false);
- setStep(0);
setOffer(null);
}
} catch (e) {
@@ -806,238 +800,39 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
);
}
- // ------------------------------------------------------------------ wizard
- const canAdvance =
- (step === 0 && Boolean(folder)) ||
- (step === 1 && count > 0) ||
- (step === 2 && planned.every((p) => p.name.trim() && p.agent));
-
+ // ---------------------------------------------------------------- launcher
return (
- <div className="flex h-full flex-col" ref={shellRef}>
+ <div className="flex h-full min-h-0 flex-col" ref={shellRef}>
{renderBar(false)}
- <ViewHeader
- icon={<Sparkles className="h-4 w-4 text-primary" />}
- title={
- t("nav.agentic_ide") === "nav.agentic_ide"
- ? "Agentic IDE"
- : t("nav.agentic_ide")
- }
- subtitle={
- addingNew
- ? "Open another folder — the workspaces you already have keep running."
- : "Open a folder, run coding agents in named terminals, and talk to them."
- }
- />
-
- <div className="flex-1 overflow-y-auto scrollbar-jarvis">
- <div className="mx-auto flex w-full max-w-3xl flex-col gap-6 p-6">
- {/*
- Above the wizard, not in front of it. Someone who came here to open
- a different folder can walk straight past; someone who lost a window
- full of running agents sees the way back first.
- */}
- {offer && (
- <ResumeCard
- offer={offer}
- busy={busy}
- onResume={() => void resumeAll()}
- onDismiss={() => void dismissOffer()}
- />
- )}
-
- <StepRail step={step} />
-
- {meta && !meta.terminal_available && (
- <Callout tone="error">
- This machine has no usable terminal backend, so agent panes cannot
- run here. On Windows that means <code>pywinpty</code>, on macOS
- and Linux <code>ptyprocess</code> — both ship with the desktop
- extra.
- </Callout>
- )}
-
- {meta && installed.length === 0 && (
- <Callout tone="warn">
- No coding-agent CLI was found on this machine’s PATH. Install
- one from the CLIs page, then come back — the wizard picks it up
- automatically.
- <button
- type="button"
- className="btn-ghost mt-2"
- onClick={() => setActiveSection("clis")}
- >
- <Download className="h-4 w-4" />
- Open CLIs
- </button>
- </Callout>
- )}
-
- {step === 0 && (
- <Section
- title="Which folder should the agents work in?"
- hint="Pick the project root. Everything the agents do happens inside it."
- >
- <FolderPicker
- selected={folder}
- onSelect={setFolder}
- onSelectRecent={replayRecent}
- />
- </Section>
- )}
-
- {step === 1 && (
- <Section
- title="How many terminals?"
- hint="Each terminal runs its own agent. Below is the workspace you are about to open — the panes sit exactly like that."
- >
- <TerminalCountStep
- count={count}
- max={maxTerminals}
- names={suggested}
- workspaceWidthPx={shellWidth}
- onChange={chooseCount}
- />
- </Section>
- )}
-
- {step === 2 && (
- <Section
- title="Who runs where?"
- hint="Terminals are numbered by position — T1, T2, T3 — so you can just say “what is T2 doing?”. Rename one if you prefer."
- >
- <ul className="space-y-2">
- {planned.map((pane, index) => (
- <li
- key={index}
- className="flex flex-wrap items-center gap-3 rounded-xl border border-border bg-card/60 p-3"
- >
- <span className="w-6 shrink-0 text-center font-mono text-xs text-muted-foreground">
- {index + 1}
- </span>
- <input
- value={pane.name}
- onChange={(e) =>
- setPlanned((prev) =>
- prev.map((p, i) =>
- i === index ? { ...p, name: e.target.value } : p,
- ),
- )
- }
- aria-label={`Call-sign for terminal ${index + 1}`}
- className="w-32 shrink-0 rounded-lg border border-border bg-background/60 px-3 py-1.5 text-sm outline-none focus:border-primary/50"
- spellCheck={false}
- />
- <div className="flex flex-wrap items-center gap-2">
- {agents.map((agent) => (
- <AgentChoice
- key={agent.name}
- agent={agent}
- selected={pane.agent === agent.name}
- onSelect={() =>
- setPlanned((prev) =>
- prev.map((p, i) =>
- i === index
- ? // The account belongs to the OLD CLI — an id
- // from one CLI means nothing to the other.
- {
- ...p,
- agent: agent.name,
- account: undefined,
- }
- : p,
- ),
- )
- }
- />
- ))}
- </div>
- <AccountChoice
- platform={pane.agent}
- accounts={accountsFor(pane.agent)}
- value={pane.account}
- onSelect={(id) =>
- setPlanned((prev) =>
- prev.map((p, i) =>
- i === index ? { ...p, account: id } : p,
- ),
- )
- }
- />
- </li>
- ))}
- </ul>
- </Section>
- )}
-
- {step === 3 && (
- <Section title="Ready to open" hint="Nothing has started yet.">
- <div className="space-y-4 rounded-xl border border-border bg-card/60 p-5">
- <div className="flex items-center gap-2 text-sm">
- <FolderOpen className="h-4 w-4 shrink-0 text-primary" />
- <code className="min-w-0 truncate font-mono text-xs">
- {folder}
- </code>
- </div>
- <ul className="flex flex-wrap gap-2">
- {planned.map((pane, i) => (
- <li
- key={i}
- className="flex items-center gap-2 rounded-lg bg-primary/10 px-3 py-1.5 text-sm text-primary"
- >
- <Terminal className="h-3.5 w-3.5" />
- <span className="font-medium">{pane.name}</span>
- <span className="text-primary/70">
- {agents.find((a) => a.name === pane.agent)
- ?.display_name ?? pane.agent}
- </span>
- </li>
- ))}
- </ul>
- <p className="text-xs text-muted-foreground">
- Once the panes are up you can turn on coding mode, which lets
- Jarvis answer inside this workspace — and switch it off again
- at any time.
- </p>
- </div>
- </Section>
- )}
-
- <div className="flex items-center justify-between pt-2">
- <button
- type="button"
- className={cn("btn-ghost", step === 0 && "invisible")}
- onClick={() => goToStep((step > 0 ? step - 1 : step) as Step)}
- >
- <ArrowLeft className="h-4 w-4" />
- Back
- </button>
- {step < 3 ? (
- <button
- type="button"
- className="btn-primary disabled:cursor-not-allowed disabled:opacity-40"
- disabled={!canAdvance}
- onClick={() => goToStep((step + 1) as Step)}
- >
- Next
- <ArrowRight className="h-4 w-4" />
- </button>
- ) : (
- <button
- type="button"
- className="btn-primary disabled:cursor-not-allowed disabled:opacity-40"
- disabled={busy || !folder || planned.length === 0}
- onClick={() => void start()}
- >
- {busy ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : (
- <Rocket className="h-4 w-4" />
- )}
- {busy ? "Opening…" : "Open workspace"}
- </button>
- )}
- </div>
- </div>
+ <div className="min-h-0 flex-1">
+ <WorkspaceLauncher
+ addingNew={addingNew}
+ busy={busy}
+ folder={folder}
+ onSelectFolder={setFolder}
+ onSelectRecent={replayRecent}
+ count={count}
+ maxTerminals={maxTerminals}
+ suggestedNames={suggested}
+ workspaceWidthPx={shellWidth}
+ workspaceHeightPx={Math.max(0, shellHeight - WORKSPACE_GRID_CHROME_PX)}
+ onCount={chooseCount}
+ planned={planned}
+ onPlanned={setPlanned}
+ agents={agents}
+ accountsFor={accountsFor}
+ /* Before the sweep lands `meta` is null, and this screen is not
+ reached in that state at all (see the `loading` branch above). The
+ optimistic default is still the right one: a machine is assumed
+ capable until it has said otherwise, never accused on no evidence. */
+ terminalAvailable={meta ? meta.terminal_available : true}
+ nothingInstalled={Boolean(meta) && installed.length === 0}
+ onOpenClis={() => setActiveSection("clis")}
+ offer={offer}
+ onResume={() => void resumeAll()}
+ onDismissOffer={() => void dismissOffer()}
+ onStart={() => void start()}
+ />
</div>
</div>
);
@@ -1072,6 +867,20 @@ function rememberModeIntro(): void {
}
}
+/**
+ * What just changed, once, in four sentences.
+ *
+ * It used to be four bullets with bolded lead-ins — "**Talk to the agents by
+ * name.**", "**Jarvis writes the prompt.**" — each followed by a sentence
+ * explaining the lead-in. That is feature-list prose: it advertises a thing the
+ * reader has already chosen and opened, and the bolding makes the eye skip
+ * precisely the half that carries the information. The same four facts as four
+ * plain sentences take a third of the room and are actually read.
+ *
+ * It stays a dialog rather than becoming a toast because it appears exactly once
+ * per machine and describes a mode change the user did not ask for — which is
+ * the one thing on this screen worth interrupting for.
+ */
function CodingModeIntro({
terminals,
project,
@@ -1081,242 +890,44 @@ function CodingModeIntro({
project: string;
onDismiss: () => void;
}) {
- const first = terminals[0] ?? "Mika";
- const second = terminals[1] ?? "Nova";
+ const first = terminals[0] ?? "T1";
+ const second = terminals[1] ?? terminals[0] ?? "T2";
return (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-background/70 p-6 backdrop-blur-sm">
- <div className="w-full max-w-lg rounded-2xl border border-primary/30 bg-card p-6 shadow-2xl">
- <div className="mb-4 flex items-center gap-3">
- <span className="flex h-10 w-10 items-center justify-center rounded-xl bg-primary/15">
- <Brain className="h-5 w-5 text-primary" />
- </span>
- <div>
- <h3 className="font-display text-lg font-semibold">
- Coding mode is on
- </h3>
- <p className="text-xs text-muted-foreground">
- While this workspace is open, Jarvis works inside {project}.
- </p>
- </div>
- </div>
+ <div className="w-full max-w-md rounded-surface border border-border bg-card p-5 shadow-2xl">
+ <h3 className="font-display text-base font-semibold">
+ Coding mode is on
+ </h3>
+ <p className="mt-1 text-xs text-muted-foreground">
+ While this workspace is open, Jarvis works inside {project}.
+ </p>
- <ul className="space-y-3 text-sm">
- <li className="flex gap-3">
- <Mic className="mt-0.5 h-4 w-4 shrink-0 text-primary" />
- <span>
- <strong className="font-medium">
- Talk to the agents by name.
- </strong>{" "}
- Say “tell {first} to look at the wake word code” and it goes
- straight into {first}’s terminal — you never type the prompt
- yourself.
- </span>
+ <ul className="mt-4 space-y-2 text-sm leading-relaxed text-foreground/90">
+ <li>
+ Talk to the agents by name — “tell {first} to look at the wake word
+ code” goes straight into that terminal.
</li>
- <li className="flex gap-3">
- <Sparkles className="mt-0.5 h-4 w-4 shrink-0 text-primary" />
- <span>
- <strong className="font-medium">Jarvis writes the prompt.</strong>{" "}
- What you say gets turned into a proper instruction, with the
- relevant files of this repository attached as <code>@</code>{" "}
- references.
- </span>
+ <li>
+ What you say is turned into a proper instruction, with the relevant
+ files of this repository attached as{" "}
+ <code className="font-mono text-xs">@</code> references.
</li>
- <li className="flex gap-3">
- <Terminal className="mt-0.5 h-4 w-4 shrink-0 text-primary" />
- <span>
- <strong className="font-medium">Ask what they are doing.</strong>{" "}
- “What is {second} up to?” is answered from what that terminal
- actually printed.
- </span>
+ <li>
+ “What is {second} up to?” is answered from what that terminal
+ actually printed.
</li>
- <li className="flex gap-3">
- <Brain className="mt-0.5 h-4 w-4 shrink-0 text-primary" />
- <span>
- <strong className="font-medium">
- Think out loud with Jarvis.
- </strong>{" "}
- It knows this codebase — the stack, the branch, the instruction
- files — so planning happens here instead of in a chat window.
- </span>
+ <li>
+ Nothing is started in the background: work you give a terminal stays
+ with that terminal. Turn the mode off any time from the toolbar.
</li>
</ul>
- <p className="mt-4 text-xs text-muted-foreground">
- No background agents are started while you are in here: work you give
- a terminal stays with that terminal. Turn the mode off any time with
- the button in the toolbar.
- </p>
-
<div className="mt-5 flex justify-end">
- <button type="button" className="btn-primary" onClick={onDismiss}>
+ <Button variant="primary" onClick={onDismiss}>
Got it
- </button>
+ </Button>
</div>
</div>
</div>
);
}
-
-function StepRail({ step }: { step: Step }) {
- const labels = ["Folder", "Terminals", "Agents", "Start"];
- return (
- <ol className="flex items-center gap-2">
- {labels.map((label, index) => (
- <li key={label} className="flex flex-1 items-center gap-2">
- <span
- className={cn(
- "flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold",
- index < step
- ? "bg-primary/20 text-primary"
- : index === step
- ? "bg-primary text-background"
- : "bg-muted text-muted-foreground",
- )}
- >
- {index < step ? <Check className="h-3.5 w-3.5" /> : index + 1}
- </span>
- <span
- className={cn(
- "truncate text-xs",
- index === step ? "text-foreground" : "text-muted-foreground",
- )}
- >
- {label}
- </span>
- {index < labels.length - 1 && (
- <span className="hidden h-px flex-1 bg-border sm:block" />
- )}
- </li>
- ))}
- </ol>
- );
-}
-
-function Section({
- title,
- hint,
- children,
-}: {
- title: string;
- hint: string;
- children: React.ReactNode;
-}) {
- return (
- <div className="space-y-4">
- <div>
- <h3 className="font-display text-lg font-semibold">{title}</h3>
- <p className="text-sm text-muted-foreground">{hint}</p>
- </div>
- {children}
- </div>
- );
-}
-
-function AgentChoice({
- agent,
- selected,
- onSelect,
-}: {
- agent: AgentStatus;
- selected: boolean;
- onSelect: () => void;
-}) {
- return (
- <button
- type="button"
- onClick={onSelect}
- disabled={!agent.installed}
- aria-pressed={selected}
- title={
- agent.installed
- ? (agent.version ?? undefined)
- : "Not installed on this machine"
- }
- className={cn(
- "flex items-center gap-2 rounded-lg border px-3 py-1.5 text-sm transition-colors",
- selected
- ? "border-primary/60 bg-primary/10 text-primary"
- : "border-border text-muted-foreground hover:border-primary/40",
- !agent.installed && "cursor-not-allowed opacity-40",
- )}
- >
- <Terminal className="h-3.5 w-3.5" />
- {agent.display_name}
- </button>
- );
-}
-
-/**
- * Which of several subscriptions of one CLI this pane opens on.
- *
- * Renders NOTHING when the user has only the one login, which is almost
- * everybody — the wizard must not grow a control that answers a question the
- * user does not have. It appears the moment a second seat is registered, and
- * then it is per pane, so one folder can hold panes on both plans at once.
- */
-function AccountChoice({
- platform,
- accounts,
- value,
- onSelect,
-}: {
- platform: string;
- accounts: AgentAccount[];
- value: string | undefined;
- onSelect: (id: string | undefined) => void;
-}) {
- if (accounts.length < 2) return null;
- return (
- <label className="flex items-center gap-1.5 text-xs text-muted-foreground">
- <Users className="h-3.5 w-3.5 shrink-0" />
- <span className="sr-only">Subscription for this terminal</span>
- <select
- value={value ?? ""}
- onChange={(e) => onSelect(e.target.value || undefined)}
- aria-label={`Subscription for the ${platform} terminal`}
- className="rounded-lg border border-border bg-background/60 px-2 py-1.5 text-xs outline-none focus:border-primary/50"
- >
- <option value="">Active account</option>
- {accounts.map((account) => (
- <option key={account.id} value={account.id}>
- {account.label}
- {account.connected ? "" : " (not signed in)"}
- </option>
- ))}
- </select>
- </label>
- );
-}
-
-/**
- * The arrangement ``n`` terminals will actually open in.
- *
- * Both numbers behind this come from the grid itself: `perBand` is what fits in
- * the measured width, and `paneColumns` is the function the grid lays itself out
- * with. The preview used to have its own formula (three per line), so choosing 4
- * previewed 3 above and 1 below and then opened 4 side by side; then it dropped
- * the width and promised 6 + 6 where a narrow window gave three columns and four
- * rows. A preview is only worth showing while it cannot disagree with the real
- * thing, and that means sharing every input, not just the function.
- */
-function Callout({
- tone,
- children,
-}: {
- tone: "error" | "warn";
- children: React.ReactNode;
-}) {
- return (
- <div
- className={cn(
- "flex items-start gap-2 rounded-lg border px-4 py-3 text-sm",
- tone === "error"
- ? "border-destructive/40 bg-destructive/10 text-destructive"
- : "border-amber-500/40 bg-amber-500/10 text-amber-200",
- )}
- >
- <AlertCircle className="mt-0.5 h-4 w-4 shrink-0" />
- <div className="flex flex-col items-start">{children}</div>
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/tailwind.config.ts b/jarvis/ui/web/frontend/tailwind.config.ts
index 40e1239cb7..01575627ab 100644
--- a/jarvis/ui/web/frontend/tailwind.config.ts
+++ b/jarvis/ui/web/frontend/tailwind.config.ts
@@ -51,6 +51,19 @@ const config: Config = {
lg: "var(--radius)",
md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)",
+ /*
+ * Two tighter steps for dense, tool-shaped surfaces — the Agentic IDE's
+ * launcher above all (see components/agentic/controls.tsx).
+ *
+ * They exist because the three above do not separate: `--radius` is
+ * 0.75rem, so `md`, `lg` and Tailwind's own `xl` all land between 10 and
+ * 12 px. That is a fine radius for a settings card and no radius scale
+ * at all for a screen that stacks a 32 px control inside a row inside a
+ * panel — everything came out equally round, so nothing read as
+ * contained by anything else. Additive: no existing class changes.
+ */
+ control: "6px",
+ surface: "10px",
},
keyframes: {
"accordion-down": {