Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(ide): redesign the move dialog around the target grid itself

rubenluetke10-beep1fec986987eb
diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.py
index 5d5cd417d2..e0eef43a53 100644
--- a/jarvis/ui/web/agentic_ide_routes.py
+++ b/jarvis/ui/web/agentic_ide_routes.py
@@ -2965,6 +2965,9 @@ def get_workspace_layout(workspace_id: str) -> dict:
"agent": t.agent,
"display_name": t.display_name,
"history_id": t.history_id,
+ # What the pane's header shows, from memory — never a
+ # scrollback walk, so a map of a dozen panes stays cheap.
+ "title": recap_engine.known_headline(t),
}
for t in session.terminals
],
diff --git a/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.test.tsx
index 13debaf03b..700c5c70c2 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.test.tsx
@@ -1,9 +1,11 @@
/**
* The place picker for a pane moving into another workspace.
*
- * Its promise is that nothing it offers is refused later: a side that would
- * push the target grid past its largest shape is disabled, a full workspace
- * cannot be confirmed, and what is sent names the target pane by identity.
+ * Its promise is that nothing it offers is refused later and that what it
+ * shows is what will happen: the tile pointed at splits in place to show the
+ * moved pane, a side with no room says so instead of being offered, a full
+ * workspace cannot be confirmed, and what is sent names the target pane by
+ * identity.
*/
import { afterEach, beforeEach, expect, it, vi } from "vitest";
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
@@ -12,63 +14,105 @@ vi.mock("@/lib/agenticIdeApi", () => ({ fetchWorkspaceLayout: api.layout }));
import { MovePaneDialog, type MovePaneRequest } from "./MovePaneDialog";
import { balancedLayout } from "./workspaceDocking";
-const pane = (name: string) => ({ key: name.toLowerCase(), name, agent: "codex", display_name: "Codex", history_id: `h-${name}` });
+const pane = (name: string) => ({ key: name.toLowerCase(), name, agent: "codex", display_name: "Codex", history_id: `h-${name}`, title: `Work of ${name}` });
const workspace = (names: string[], layout = balancedLayout(names.map((name) => name.toLowerCase())), max = 16) =>
({ id: "w2", name: "Blog", layout, max_terminals: max, terminals: names.map(pane) });
const request: MovePaneRequest = { pane: { name: "T9", agent: "claude", displayName: "Claude Code" }, target: { id: "w2", name: "Blog" } };
+const status = () => screen.getByRole("status").textContent;
beforeEach(() => { vi.clearAllMocks(); });
afterEach(cleanup);
-it("defaults to automatic and confirms without a place", async () => {
+it("draws the target panes with their task and starts on the automatic place", async () => {
api.layout.mockResolvedValue(workspace(["T1", "T2"]));
const onConfirm = vi.fn();
render(<MovePaneDialog request={request} busy={false} onCancel={() => {}} onConfirm={onConfirm} />);
- await screen.findByRole("button", { name: "Place T9 below T1" });
- expect(screen.getByTestId("move-pane-auto").getAttribute("aria-checked")).toBe("true");
- expect(screen.getByRole("status").textContent).toContain("joins the right edge");
+ expect(await screen.findByText("Work of T1")).toBeTruthy();
+ expect(screen.getByTestId("move-pane-auto").getAttribute("aria-pressed")).toBe("true");
+ expect(status()).toContain("Automatic: T9 joins the right edge");
fireEvent.click(screen.getByTestId("move-pane-confirm"));
expect(api.layout).toHaveBeenCalledWith("w2");
expect(onConfirm).toHaveBeenCalledExactlyOnceWith(null);
});
-it("sends the picked pane by identity and the side", async () => {
+it("splits the pointed-at tile to preview the place, and keeps it on click", async () => {
api.layout.mockResolvedValue(workspace(["T1", "T2"]));
const onConfirm = vi.fn();
render(<MovePaneDialog request={request} busy={false} onCancel={() => {}} onConfirm={onConfirm} />);
- fireEvent.click(await screen.findByRole("button", { name: "Place T9 left of T2" }));
- expect(screen.getByRole("status").textContent).toBe("T9 goes left of T2 and shares its space.");
+ const left = await screen.findByRole("button", { name: "Place T9 left of T2" });
+ fireEvent.mouseEnter(left);
+ expect(screen.getByTestId("move-pane-tile-T2").dataset.lit).toBe("left");
+ // The pane keeps its own label beside the preview.
+ expect(screen.getByText("Work of T2")).toBeTruthy();
+ expect(status()).toBe("Left of T2: T9 takes half of its space.");
+
+ fireEvent.click(left);
+ fireEvent.mouseLeave(screen.getByTestId("move-pane-map").parentElement!);
+ expect(screen.getByTestId("move-pane-tile-T2").dataset.lit).toBe("left");
+ expect(screen.getByTestId("move-pane-auto").getAttribute("aria-pressed")).toBe("false");
fireEvent.click(screen.getByTestId("move-pane-confirm"));
expect(onConfirm).toHaveBeenCalledExactlyOnceWith({ anchor: "pane:h-T2", side: "left" });
});
-it("disables a side the grid has no room for", async () => {
+it("goes back to automatic from the edge column", async () => {
+ api.layout.mockResolvedValue(workspace(["T1"]));
+ const onConfirm = vi.fn();
+ render(<MovePaneDialog request={request} busy={false} onCancel={() => {}} onConfirm={onConfirm} />);
+
+ fireEvent.click(await screen.findByRole("button", { name: "Place T9 below T1" }));
+ fireEvent.click(screen.getByTestId("move-pane-auto"));
+ fireEvent.click(screen.getByTestId("move-pane-confirm"));
+
+ expect(onConfirm).toHaveBeenCalledExactlyOnceWith(null);
+});
+
+it("says a side has no room instead of taking it", async () => {
const row = ["T1", "T2", "T3", "T4"];
api.layout.mockResolvedValue(workspace(row, { direction: "row", children: row.map((name) => ({ pane: name.toLowerCase() })), weights: [1, 1, 1, 1] }));
- render(<MovePaneDialog request={request} busy={false} onCancel={() => {}} onConfirm={() => {}} />);
+ const onConfirm = vi.fn();
+ render(<MovePaneDialog request={request} busy={false} onCancel={() => {}} onConfirm={onConfirm} />);
// Four columns already: a fifth beside any of them does not fit, a second row does.
- expect((await screen.findByRole("button", { name: "Place T9 right of T1" }) as HTMLButtonElement).disabled).toBe(true);
- expect((screen.getByRole("button", { name: "Place T9 below T1" }) as HTMLButtonElement).disabled).toBe(false);
+ const right = await screen.findByRole("button", { name: "Place T9 right of T1" });
+ expect(right.getAttribute("aria-disabled")).toBe("true");
+ fireEvent.mouseEnter(right);
+ expect(screen.getByText("No room")).toBeTruthy();
+ expect(status()).toContain("No room right of T1");
+ fireEvent.click(right);
+ expect(screen.getByTestId("move-pane-auto").getAttribute("aria-pressed")).toBe("true");
+ expect(screen.getByRole("button", { name: "Place T9 below T1" }).getAttribute("aria-disabled")).toBe("false");
+});
+
+it("lets arrow keys pick a side of the focused pane", async () => {
+ api.layout.mockResolvedValue(workspace(["T1", "T2"]));
+ const onConfirm = vi.fn();
+ render(<MovePaneDialog request={request} busy={false} onCancel={() => {}} onConfirm={onConfirm} />);
+
+ await screen.findByText("Work of T1");
+ fireEvent.keyDown(screen.getByTestId("move-pane-tile-T1"), { key: "ArrowDown" });
+ fireEvent.click(screen.getByTestId("move-pane-confirm"));
+
+ expect(onConfirm).toHaveBeenCalledExactlyOnceWith({ anchor: "pane:h-T1", side: "below" });
});
it("cannot confirm into a full workspace", async () => {
api.layout.mockResolvedValue(workspace(["T1", "T2"], undefined, 2));
render(<MovePaneDialog request={request} busy={false} onCancel={() => {}} onConfirm={() => {}} />);
- await screen.findByRole("button", { name: "Place T9 below T1" });
+ await screen.findByText("Work of T1");
expect((screen.getByTestId("move-pane-confirm") as HTMLButtonElement).disabled).toBe(true);
- expect(screen.getByRole("status").textContent).toContain("is full");
+ expect(status()).toContain("is full");
});
it("says an empty workspace is simply filled", async () => {
api.layout.mockResolvedValue(workspace([], null));
render(<MovePaneDialog request={request} busy={false} onCancel={() => {}} onConfirm={() => {}} />);
- expect(await screen.findByText("No terminals open here yet.")).toBeTruthy();
- expect(screen.getByRole("status").textContent).toBe("Blog is empty, so T9 fills it.");
+ expect(await screen.findByText("Fills the empty workspace")).toBeTruthy();
+ expect(status()).toBe("Blog is empty, so T9 fills it.");
+ expect(screen.queryByTestId("move-pane-auto")).toBeNull();
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.tsx b/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.tsx
index f68122c8af..1b45592ab6 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/MovePaneDialog.tsx
@@ -1,6 +1,6 @@
-import { useEffect, useState, type ComponentType } from "react";
+import { useEffect, useState, type KeyboardEvent, type ReactNode } from "react";
import * as Dialog from "@radix-ui/react-dialog";
-import { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, FolderInput, Loader2, Wand2 } from "lucide-react";
+import { Check, FolderInput, Loader2, Wand2 } from "lucide-react";
import { AgentMark } from "./AgentMark";
import { treeLayout } from "./treeLayout";
import { GRID_LIMIT_HINT, fitsWorkspace, previewSplit, workspaceLayout } from "./workspaceDocking";
@@ -21,38 +21,67 @@ interface Props {
onConfirm: (placement: TransferPlacement | null) => void;
}
-const SIDES: { side: TransferSide; words: string; Icon: ComponentType<{ className?: string }>; at: string }[] = [
- { side: "left", words: "left of", Icon: ArrowLeft, at: "left-1 top-1/2 -translate-y-1/2" },
- { side: "right", words: "right of", Icon: ArrowRight, at: "right-1 top-1/2 -translate-y-1/2" },
- { side: "above", words: "above", Icon: ArrowUp, at: "left-1/2 top-1 -translate-x-1/2" },
- { side: "below", words: "below", Icon: ArrowDown, at: "bottom-1 left-1/2 -translate-x-1/2" },
-];
-
-/** The half of the anchor's tile the moved pane will take. */
-const HALF: Record<TransferSide, string> = {
- left: "inset-y-0 left-0 w-1/2",
- right: "inset-y-0 right-0 w-1/2",
- above: "inset-x-0 top-0 h-1/2",
- below: "inset-x-0 bottom-0 h-1/2",
-};
+type MapPane = WorkspaceLayoutView["terminals"][number];
+/** What the map is showing: the automatic place, or one side of one pane. */
+type Spot = { kind: "auto" } | { kind: "side"; anchor: string; side: TransferSide };
+/**
+ * Four triangles from the tile's centre to its edges: the side nearest the
+ * pointer is the one that lights up, the same rule the grid's own drag uses.
+ * Clipped buttons hit-test by their shape, so the whole tile is the target.
+ */
+const SIDES: { side: TransferSide; words: string; clip: string; key: string }[] = [
+ { side: "left", words: "left of", clip: "polygon(0 0, 50% 50%, 0 100%)", key: "ArrowLeft" },
+ { side: "right", words: "right of", clip: "polygon(100% 0, 100% 100%, 50% 50%)", key: "ArrowRight" },
+ { side: "above", words: "above", clip: "polygon(0 0, 100% 0, 50% 50%)", key: "ArrowUp" },
+ { side: "below", words: "below", clip: "polygon(0 100%, 50% 50%, 100% 100%)", key: "ArrowDown" },
+];
const SPLIT_DIRECTION = { left: "left", right: "right", above: "above", below: "down" } as const;
const INCOMING = "__incoming__";
+const anchorOf = (pane: MapPane) => pane.history_id ? `pane:${pane.history_id}` : pane.name;
+const capital = (text: string) => text.charAt(0).toUpperCase() + text.slice(1);
+
+/** A pane on the map, drawn like the real one: a title row over its task. */
+function MiniPane({ pane, dimmed = false }: { pane: MapPane; dimmed?: boolean }) {
+ return <div className={cn("flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden rounded-lg border border-border bg-card transition-opacity", dimmed && "opacity-60")}>
+ <div className="flex h-7 shrink-0 items-center gap-1.5 border-b border-border/70 px-2">
+ <AgentMark agent={pane.agent} label={pane.display_name} variant="plain" size="sm" />
+ <span className="truncate text-xs font-medium">{pane.name}</span>
+ </div>
+ <p className="line-clamp-3 px-2 py-1.5 text-[11px] leading-snug text-muted-foreground">{pane.title || pane.display_name}</p>
+ </div>;
+}
+
+/** Where the moved pane would sit: its own mark in the accent, or "no room". */
+function Ghost({ request, chosen, allowed, children }: { request: MovePaneRequest; chosen: boolean; allowed: boolean; children?: ReactNode }) {
+ return <div className={cn(
+ "flex h-full min-h-0 w-full min-w-0 flex-col items-center justify-center gap-1 rounded-lg border-2 px-2 text-center",
+ !allowed ? "border-dashed border-destructive/50 bg-destructive/5 text-destructive"
+ : chosen ? "border-primary bg-primary/15 text-primary" : "border-dashed border-primary/70 bg-primary/10 text-primary",
+ )}>
+ {allowed ? <span className="flex min-w-0 items-center gap-1.5 text-xs font-semibold">
+ {chosen && <Check className="h-3.5 w-3.5 shrink-0" aria-hidden />}
+ <AgentMark agent={request.pane.agent} label={request.pane.displayName} variant="plain" size="sm" />
+ <span className="truncate">{request.pane.name}</span>
+ </span> : <span className="text-[11px] font-medium">No room</span>}
+ {children}
+ </div>;
+}
/**
* Choose where a pane lands in another workspace's grid.
*
- * The target grid is drawn as a small map. Each of its panes offers four
- * arrows; picking one puts the moved pane on that side of it, sharing that
- * pane's room the way a split does. A side that would push the grid past its
- * largest shape is disabled rather than offered and then refused. "Automatic"
- * — the default, so Enter alone keeps the quick path — joins the right edge.
+ * The target grid is drawn as a map of its real panes. Pointing at a pane
+ * shows the moved one taking the half nearest the pointer — the tile splits
+ * in place, so nothing jumps under the cursor — and a click keeps that
+ * place. The dashed column on the right is the automatic place, chosen until
+ * something else is. Arrow keys pick a side of the focused pane.
*/
export function MovePaneDialog({ request, busy, onCancel, onConfirm }: Props) {
const [view, setView] = useState<WorkspaceLayoutView | null>(null);
const [loadError, setLoadError] = useState("");
const [choice, setChoice] = useState<TransferPlacement | null>(null);
- const [hover, setHover] = useState<TransferPlacement | null>(null);
+ const [hover, setHover] = useState<Spot | null>(null);
const targetId = request?.target.id;
useEffect(() => {
@@ -68,112 +97,128 @@ export function MovePaneDialog({ request, busy, onCancel, onConfirm }: Props) {
return () => { live = false; };
}, [targetId]);
- const terminals = view?.terminals ?? [];
- const current = view ? workspaceLayout(view.layout, terminals) : null;
- const boxes = treeLayout(current, terminals).boxes;
- const full = view !== null && terminals.length >= view.max_terminals;
- const anchorOf = (terminal: (typeof terminals)[number]) => terminal.history_id ? `pane:${terminal.history_id}` : terminal.name;
- const fits = (key: string, side: TransferSide) =>
- !full && current !== null && fitsWorkspace(previewSplit(current, key, INCOMING, SPLIT_DIRECTION[side]));
- const shown = hover ?? choice;
- const chosen = choice ? terminals.find((terminal) => anchorOf(terminal) === choice.anchor) : null;
+ const panes = view?.terminals ?? [];
+ const current = view ? workspaceLayout(view.layout, panes) : null;
+ const boxes = treeLayout(current, panes).boxes;
+ const full = view !== null && panes.length >= view.max_terminals;
+ const fits = (pane: MapPane, side: TransferSide) =>
+ !full && current !== null && fitsWorkspace(previewSplit(current, pane.key, INCOMING, SPLIT_DIRECTION[side]));
+ const chosenSpot: Spot = choice ? { kind: "side", ...choice } : { kind: "auto" };
+ const shown: Spot = hover ?? chosenSpot;
+ const sameSpot = (a: Spot, b: Spot) => a.kind === b.kind && (a.kind === "auto" || (b.kind === "side" && a.anchor === b.anchor && a.side === b.side));
const paneName = request?.pane.name ?? "";
- const summary = full
- ? `${request?.target.name} is full: a workspace holds ${view?.max_terminals} terminals.`
- : chosen && choice
- ? `${paneName} goes ${SIDES.find((entry) => entry.side === choice.side)?.words} ${chosen.name} and shares its space.`
- : terminals.length
- ? `${paneName} joins the right edge, and every pane gets an even share.`
- : `${request?.target.name} is empty, so ${paneName} fills it.`;
+ const targetName = request?.target.name ?? "";
+
+ const pick = (pane: MapPane, side: TransferSide) => { if (!busy && fits(pane, side)) setChoice({ anchor: anchorOf(pane), side }); };
+ const onTileKey = (event: KeyboardEvent<HTMLDivElement>, pane: MapPane) => {
+ const entry = SIDES.find((item) => item.key === event.key);
+ if (!entry) return;
+ event.preventDefault();
+ pick(pane, entry.side);
+ };
+
+ const summary = (() => {
+ if (!view) return "";
+ if (full) return `${targetName} is full: a workspace holds ${view.max_terminals} terminals.`;
+ if (!panes.length) return `${targetName} is empty, so ${paneName} fills it.`;
+ if (shown.kind === "auto") return `Automatic: ${paneName} joins the right edge and every pane gets an even share.`;
+ const pane = panes.find((entry) => anchorOf(entry) === shown.anchor);
+ const words = SIDES.find((entry) => entry.side === shown.side)?.words ?? shown.side;
+ if (!pane) return "";
+ if (!fits(pane, shown.side)) return `No room ${words} ${pane.name}. ${GRID_LIMIT_HINT}`;
+ return `${capital(words)} ${pane.name}: ${paneName} takes half of its space.`;
+ })();
const submit = () => { if (!busy && !full && view) onConfirm(choice); };
return <Dialog.Root open={request !== null} onOpenChange={(open) => { if (!open && !busy) onCancel(); }}>
<Dialog.Portal>
<Dialog.Overlay className="fixed inset-0 z-[80] bg-background/70 backdrop-blur-sm data-[state=open]:animate-in data-[state=open]:fade-in-0" />
<Dialog.Content data-testid="move-pane-dialog"
- className="fixed left-1/2 top-1/2 z-[90] w-[min(560px,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-border bg-popover p-6 text-popover-foreground shadow-2xl data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95">
+ className="fixed left-1/2 top-1/2 z-[90] w-[min(720px,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-2xl border border-border bg-popover p-6 text-popover-foreground shadow-2xl data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95">
<form onSubmit={(event) => { event.preventDefault(); submit(); }}>
<div className="flex items-start gap-4">
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary">
<FolderInput className="h-[18px] w-[18px]" aria-hidden />
</div>
<div className="min-w-0 flex-1">
- <Dialog.Title className="truncate text-base font-semibold">Move {paneName} to {request?.target.name}</Dialog.Title>
+ <Dialog.Title className="truncate text-base font-semibold">Move {paneName} to {targetName}</Dialog.Title>
<Dialog.Description className="mt-1.5 text-sm leading-relaxed text-muted-foreground">
- Pick where it goes in that grid. The agent keeps running.
+ Point at a pane and click the side it should go on. The agent keeps running.
</Dialog.Description>
</div>
</div>
- <button type="button" role="radio" aria-checked={choice === null} data-testid="move-pane-auto"
- disabled={busy} onClick={() => setChoice(null)}
- className={cn(
- "mt-4 flex w-full items-center gap-3 rounded-xl border px-3 py-2.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
- choice === null ? "border-primary bg-primary/5" : "border-border hover:bg-muted/60",
- )}>
- <Wand2 className={cn("h-4 w-4 shrink-0", choice === null ? "text-primary" : "text-muted-foreground")} aria-hidden />
- <span className="min-w-0">
- <span className="block text-sm font-medium">Automatic</span>
- <span className="block text-xs text-muted-foreground">At the right edge, every pane evened out</span>
- </span>
- </button>
-
- <div className="mt-3 rounded-xl border border-border bg-muted/30 p-1.5">
- <div data-testid="move-pane-map" className="relative aspect-[16/9] w-full" onMouseLeave={() => setHover(null)}>
+ <div className="mt-5 flex h-[clamp(200px,42vh,320px)] gap-1.5 rounded-xl border border-border bg-muted/30 p-1.5"
+ onMouseLeave={() => setHover(null)}>
+ <div data-testid="move-pane-map" className="relative min-w-0 flex-1">
{!view && !loadError && <div className="flex h-full items-center justify-center gap-2 text-xs text-muted-foreground">
- <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />Loading {request?.target.name}…</div>}
- {view && terminals.length === 0 && <div className="flex h-full items-center justify-center text-xs text-muted-foreground">
- No terminals open here yet.</div>}
- {terminals.map((terminal, index) => {
+ <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />Loading {targetName}…</div>}
+ {view && panes.length === 0 && request && <div className="h-full p-0.5"><Ghost request={request} chosen allowed>
+ <span className="text-[11px] text-primary/80">Fills the empty workspace</span></Ghost></div>}
+ {request && panes.map((pane, index) => {
const box = boxes[index];
if (!box) return null;
- const anchor = anchorOf(terminal);
- const lit = shown?.anchor === anchor ? shown.side : null;
- return <div key={terminal.key} data-testid={`move-pane-tile-${terminal.name}`}
- className="absolute p-0.5" style={{ left: `${box.x * 100}%`, top: `${box.y * 100}%`, width: `${box.w * 100}%`, height: `${box.h * 100}%` }}>
- <div className="relative flex h-full w-full items-center justify-center overflow-hidden rounded-lg border border-border bg-card">
- {lit && <div aria-hidden className={cn("absolute flex items-center justify-center rounded-md border-2 border-primary bg-primary/15 text-xs font-semibold text-primary", HALF[lit])}>
- {paneName}</div>}
- <span className={cn("flex min-w-0 items-center gap-1.5 px-7 text-xs font-medium", lit && "invisible")}>
- <AgentMark agent={terminal.agent} label={terminal.display_name} variant="plain" size="sm" />
- <span className="truncate">{terminal.name}</span>
- </span>
- {SIDES.map(({ side, words, Icon, at }) => {
- const allowed = fits(terminal.key, side);
- const selected = choice?.anchor === anchor && choice.side === side;
- return <button key={side} type="button" aria-pressed={selected} disabled={busy || !allowed}
- data-testid={`move-pane-${terminal.name}-${side}`}
- aria-label={`Place ${paneName} ${words} ${terminal.name}`}
- title={allowed ? `${words[0].toUpperCase()}${words.slice(1)} ${terminal.name}` : `No room here. ${GRID_LIMIT_HINT}`}
- onClick={() => setChoice({ anchor, side })}
- onMouseEnter={() => { if (allowed) setHover({ anchor, side }); }}
- onFocus={() => { if (allowed) setHover({ anchor, side }); }}
- onBlur={() => setHover(null)}
- className={cn(
- "absolute z-10 flex h-6 w-6 items-center justify-center rounded-md border transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-30",
- at,
- selected ? "border-primary bg-primary text-primary-foreground" : "border-border bg-popover text-muted-foreground hover:border-primary hover:text-primary",
- )}>
- <Icon className="h-3.5 w-3.5" aria-hidden />
- </button>;
- })}
+ const anchor = anchorOf(pane);
+ const lit = shown.kind === "side" && shown.anchor === anchor ? shown.side : null;
+ const chosenHere = lit !== null && choice?.anchor === anchor && choice.side === lit;
+ const horizontal = lit === "left" || lit === "right";
+ const ghostFirst = lit === "left" || lit === "above";
+ const parts = lit
+ ? [<MiniPane key="pane" pane={pane} dimmed />, <Ghost key="ghost" request={request} chosen={chosenHere} allowed={fits(pane, lit)} />]
+ : [<MiniPane key="pane" pane={pane} />];
+ if (ghostFirst) parts.reverse();
+ return <div key={pane.key} data-testid={`move-pane-tile-${pane.name}`} data-lit={lit ?? undefined}
+ tabIndex={0} role="group" aria-label={`${pane.name}. Arrow keys choose the side ${paneName} goes on.`}
+ onKeyDown={(event) => onTileKey(event, pane)}
+ className="absolute rounded-xl p-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ style={{ left: `${box.x * 100}%`, top: `${box.y * 100}%`, width: `${box.w * 100}%`, height: `${box.h * 100}%` }}>
+ <div className={cn("flex h-full w-full gap-1", horizontal ? "flex-row" : "flex-col")}>
+ {parts.map((part) => <div key={part.key} className="min-h-0 min-w-0 flex-1">{part}</div>)}
</div>
+ {SIDES.map(({ side, words, clip }) => {
+ const allowed = fits(pane, side);
+ return <button key={side} type="button" tabIndex={-1} aria-disabled={!allowed || busy}
+ aria-pressed={choice?.anchor === anchor && choice.side === side}
+ data-testid={`move-pane-${pane.name}-${side}`}
+ aria-label={`Place ${paneName} ${words} ${pane.name}`}
+ onMouseEnter={() => setHover({ kind: "side", anchor, side })}
+ onClick={() => pick(pane, side)}
+ style={{ clipPath: clip }}
+ className={cn("absolute inset-0 z-10 bg-transparent", allowed ? "cursor-pointer" : "cursor-not-allowed")} />;
+ })}
</div>;
})}
</div>
+ {panes.length > 0 && request && <button type="button" data-testid="move-pane-auto" aria-pressed={choice === null}
+ aria-label={`Place ${paneName} automatically at the right edge`} disabled={busy || full}
+ onClick={() => setChoice(null)} onMouseEnter={() => setHover({ kind: "auto" })} onFocus={() => setHover({ kind: "auto" })} onBlur={() => setHover(null)}
+ className={cn(
+ "flex w-[76px] shrink-0 flex-col items-center justify-center gap-1.5 rounded-lg border-2 px-1 text-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
+ sameSpot(shown, { kind: "auto" })
+ ? choice === null ? "border-primary bg-primary/15 text-primary" : "border-dashed border-primary/70 bg-primary/10 text-primary"
+ : "border-dashed border-border text-muted-foreground hover:border-primary/60 hover:text-primary",
+ )}>
+ {sameSpot(shown, { kind: "auto" })
+ ? <><AgentMark agent={request.pane.agent} label={request.pane.displayName} variant="plain" size="sm" />
+ <span className="max-w-full truncate text-xs font-semibold">{paneName}</span></>
+ : <Wand2 className="h-4 w-4" aria-hidden />}
+ <span className="text-[10px] font-medium uppercase tracking-wide">Auto</span>
+ </button>}
</div>
- <p role="status" className="mt-3 text-xs leading-relaxed text-muted-foreground">{view ? summary : ""}</p>
+ <p role="status" className={cn("mt-3 min-h-[1.25rem] text-xs leading-relaxed",
+ shown.kind === "side" && view && !panes.some((pane) => anchorOf(pane) === shown.anchor && fits(pane, shown.side)) ? "text-destructive" : "text-muted-foreground")}>
+ {summary}</p>
{loadError && <p role="alert" className="mt-2 text-xs text-destructive">{loadError}</p>}
- <div className="mt-5 flex justify-end gap-2">
+ <div className="mt-4 flex items-center justify-end gap-2">
<button type="button" disabled={busy} onClick={onCancel}
className="rounded-lg border border-border px-3.5 py-2 text-sm font-medium hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40">
Cancel</button>
<button type="submit" data-testid="move-pane-confirm" disabled={busy || full || !view}
className="flex items-center gap-1.5 rounded-lg bg-primary px-3.5 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-popover disabled:opacity-50">
{busy && <Loader2 className="h-3.5 w-3.5 animate-spin" aria-hidden />}
- Move to {request?.target.name}</button>
+ Move to {targetName}</button>
</div>
</form>
</Dialog.Content>
diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
index 0df7241895..61a872ac8c 100644
--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
@@ -1509,7 +1509,10 @@ export interface WorkspaceLayoutView {
id: string;
name: string;
layout: LayoutNode | null;
- terminals: Pick<TerminalState, "key" | "name" | "agent" | "display_name" | "history_id">[];
+ terminals: (Pick<TerminalState, "key" | "name" | "agent" | "display_name" | "history_id"> & {
+ /** What the pane's header shows: its goal in a few words, or empty. */
+ title?: string;
+ })[];
max_terminals: number;
}
diff --git a/tests/unit/agentic_ide/test_pane_transfer.py b/tests/unit/agentic_ide/test_pane_transfer.py
index ecb2769840..f1af3a19ff 100644
--- a/tests/unit/agentic_ide/test_pane_transfer.py
+++ b/tests/unit/agentic_ide/test_pane_transfer.py
@@ -341,6 +341,7 @@ async def test_the_layout_route_describes_another_tab(registry: Registry, tmp_pa
assert body["name"] == "Blog"
assert [t["name"] for t in body["terminals"]] == ["T1", "T2"]
+ assert all(isinstance(t["title"], str) for t in body["terminals"])
assert body["layout"] is not None
with pytest.raises(HTTPException) as missing:
routes.get_workspace_layout("ide_missing")