Skip to content

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

feat(agentic-ide): give the workspace back the space its chrome was taking

Ruben Lütke7524fcbc09ca
diff --git a/jarvis/ui/web/frontend/src/App.tsx b/jarvis/ui/web/frontend/src/App.tsx
index 6c6d88ba12..5e723c3874 100644
--- a/jarvis/ui/web/frontend/src/App.tsx
+++ b/jarvis/ui/web/frontend/src/App.tsx
@@ -3,7 +3,11 @@ import { useBrainStatus } from "@/hooks/useBrainStatus";
import { useVoiceStatus } from "@/hooks/useVoiceStatus";
import { useAssistantNameSeed } from "@/hooks/useAssistantNameSeed";
import { useCodingMode } from "@/hooks/useCodingMode";
-import { Sidebar, SIDEBAR_DEFAULT_WIDTH } from "@/components/layout/Sidebar";
+import {
+ Sidebar,
+ SIDEBAR_DEFAULT_WIDTH,
+ SIDEBAR_RAIL_WIDTH,
+} from "@/components/layout/Sidebar";
import { PaneResizer } from "@/components/layout/PaneResizer";
import { useResizablePane } from "@/hooks/useResizablePane";
import { TopBar } from "@/components/layout/TopBar";
@@ -30,13 +34,18 @@ export default function App() {
* It matters most in the Agentic IDE — every pixel taken from the nav is a
* pixel of agent output — but the seam belongs to the shell rather than to
* one view: a width that snapped back the moment you left the IDE would be a
- * different bug. The bounds keep the nav labels legible at one end and stop
- * it from eating the workspace at the other; a double-click restores 280 px.
+ * different bug.
+ *
+ * The lower bound is the icon RAIL, not the narrowest width labels survive at.
+ * Stopping at 200 px meant a workspace of a dozen terminals still gave a fifth
+ * of the window to a nav list nobody was reading; the sidebar now collapses to
+ * its icons instead (see `SIDEBAR_RAIL_AT_WIDTH`), and a double-click on the
+ * seam brings the full 280 px back.
*/
const sidebar = useResizablePane({
storageKey: "jarvis.sidebar.width.v1",
defaultSize: SIDEBAR_DEFAULT_WIDTH,
- min: 200,
+ min: SIDEBAR_RAIL_WIDTH,
max: 520,
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
index b82333fe04..34ac096877 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
@@ -185,7 +185,18 @@ const BASE = sessionWith([
["Nova", 1],
]);
+/*
+ * Open the prompt bar for the suites that are ABOUT the prompt bar.
+ *
+ * A fresh workspace now opens with it collapsed (the panes are what the user
+ * came for — see the seam suite at the bottom), so every test that types an
+ * instruction, picks a target or drops a file has to open it first. Doing that
+ * through the remembered height rather than a click keeps those tests about
+ * what they are testing; the seam suite clears the key again and drives the
+ * collapse/reopen behaviour itself.
+ */
beforeEach(() => {
+ window.localStorage.setItem("jarvis.agenticIde.composerHeight.v2", "176");
vi.mocked(api.addTerminal).mockResolvedValue(
sessionWith([
["Mika", 0],
@@ -1018,8 +1029,14 @@ describe("dropping files on the prompt bar", () => {
* the choice. Growing it is verified live in the browser.
*/
describe("prompt bar seam", () => {
- const HEIGHT_KEY = "jarvis.agenticIde.composerHeight.v1";
-
+ const HEIGHT_KEY = "jarvis.agenticIde.composerHeight.v2";
+ /** The height the strip collapses to, and the one it opens back up to. */
+ const SHUT = "28";
+ const OPEN = "176";
+
+ // This suite owns the remembered height — drop what the file-wide setup put
+ // there so each test below starts from the state it actually describes.
+ beforeEach(() => window.localStorage.removeItem(HEIGHT_KEY));
afterEach(() => window.localStorage.clear());
/** Drag the seam from `fromY` to `toY`, start to finish. */
@@ -1041,7 +1058,25 @@ describe("prompt bar seam", () => {
expect(seam.getAttribute("aria-orientation")).toBe("horizontal");
});
- it("dragging the seam to the bottom collapses the bar to a strip", () => {
+ /*
+ * A workspace this view has never been sized in opens with the bar SHUT.
+ *
+ * The panes are what the user came for; a 176 px writing surface held open
+ * under a dozen of them took a sixth of each pane's height for an input box
+ * that is empty most of the time — and everything typed there can be said out
+ * loud instead. The strip below it is what keeps that recoverable.
+ */
+ it("starts collapsed, with the way to open it on screen", () => {
+ renderGrid();
+
+ expect(screen.queryByTestId("agentic-composer")).toBeNull();
+ expect(screen.getByTestId("agentic-composer-collapsed")).toBeTruthy();
+ expect(screen.getByTestId("agentic-composer-reopen")).toBeTruthy();
+ expect(screen.getByTestId("pane-resizer-horizontal")).toBeTruthy();
+ });
+
+ it("dragging the seam to the bottom collapses an opened bar to a strip", () => {
+ window.localStorage.setItem(HEIGHT_KEY, OPEN);
renderGrid();
expect(screen.getByTestId("agentic-composer")).toBeTruthy();
@@ -1056,34 +1091,54 @@ describe("prompt bar seam", () => {
});
it("the reopen button brings the prompt bar back at its designed height", () => {
- window.localStorage.setItem(HEIGHT_KEY, "34");
renderGrid();
expect(screen.getByTestId("agentic-composer-collapsed")).toBeTruthy();
fireEvent.click(screen.getByTestId("agentic-composer-reopen"));
const composer = screen.getByTestId("agentic-composer");
- expect(composer.style.height).toBe("176px");
+ expect(composer.style.height).toBe(`${OPEN}px`);
expect(screen.getByPlaceholderText(/instruction for Mika/i)).toBeTruthy();
});
+ it("remembers an opened bar across a remount", () => {
+ // The stored height is the whole reason the default can be "shut": someone
+ // who wants the writing surface opens it once and keeps it.
+ renderGrid();
+ fireEvent.click(screen.getByTestId("agentic-composer-reopen"));
+ expect(window.localStorage.getItem(HEIGHT_KEY)).toBe(OPEN);
+
+ cleanup();
+ renderGrid();
+ expect(screen.getByTestId("agentic-composer")).toBeTruthy();
+ });
+
it("remembers a collapsed bar across a remount", () => {
+ window.localStorage.setItem(HEIGHT_KEY, OPEN);
renderGrid();
dragSeam(700, 1400);
- expect(window.localStorage.getItem(HEIGHT_KEY)).toBe("34");
+ expect(window.localStorage.getItem(HEIGHT_KEY)).toBe(SHUT);
cleanup();
renderGrid();
expect(screen.getByTestId("agentic-composer-collapsed")).toBeTruthy();
});
- it("double-clicking the seam restores the designed height", () => {
- window.localStorage.setItem(HEIGHT_KEY, "34");
+ /*
+ * Double-click TOGGLES rather than resets.
+ *
+ * `reset` means "back to the default", and the default is now the shut strip
+ * — so wiring the seam to it would give a closed bar a double-click that
+ * visibly does nothing, which reads as a dead control.
+ */
+ it("double-clicking the seam opens a shut bar and shuts an open one", () => {
renderGrid();
fireEvent.doubleClick(screen.getByTestId("pane-resizer-horizontal"));
+ expect(screen.getByTestId("agentic-composer").style.height).toBe(`${OPEN}px`);
- expect(screen.getByTestId("agentic-composer").style.height).toBe("176px");
+ fireEvent.doubleClick(screen.getByTestId("pane-resizer-horizontal"));
+ expect(screen.getByTestId("agentic-composer-collapsed")).toBeTruthy();
});
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index f8252c2cda..f1e7cc13e8 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -99,6 +99,19 @@ interface AgenticGridProps {
accounts?: IdeAccountState[];
/** The settings panel changed the workspace state — the owner applies it. */
onStateChanged?: (state: IdeState) => void;
+ /**
+ * The row of open workspaces, rendered INSIDE this workspace's toolbar.
+ *
+ * It arrives as a node rather than being rendered above the grid because the
+ * two belonged on one line all along: the tabs say which workspace you are
+ * in, the toolbar acts on it, and neither fills a row on its own. Kept apart
+ * they cost two lines of a view whose whole point is terminal output — with a
+ * third above them for the app's own bar, the chrome was taller than a pane's
+ * usable header area on a laptop screen.
+ *
+ * Left out (the wizard, tests) the toolbar simply names the project itself.
+ */
+ workspaceBar?: React.ReactNode;
}
const FONT_MIN = 10;
@@ -127,10 +140,17 @@ const RECAP_POLL_MS = 5000;
* Pulled all the way down the bar COLLAPSES to a thin strip instead of
* vanishing. A control that can be dragged out of existence has no way back —
* the strip keeps both the seam and a one-click reopen on screen.
+ *
+ * It now STARTS collapsed (see `defaultSize` below), which is the honest default
+ * for what this view is: a wall of running terminals you mostly watch. A 176 px
+ * writing surface held open under twelve panes cost each of them a sixth of
+ * their height for an input box that is empty most of the time — and everything
+ * typed there can be said out loud instead. One drag, one double-click on the
+ * seam, or the strip's own button opens it, and that choice is remembered.
*/
const COMPOSER_DEFAULT_PX = 176;
/** Height of the collapsed strip: its reopen button and nothing else. */
-const COMPOSER_COLLAPSED_PX = 34;
+const COMPOSER_COLLAPSED_PX = 28;
/** Below this dragged height the bar snaps shut rather than half-showing. */
const COMPOSER_COLLAPSE_AT_PX = 96;
/** Below this it is too short for the "you can also say this out loud" note. */
@@ -144,6 +164,23 @@ const COMPOSER_HINT_AT_PX = 190;
*/
const GRID_RESERVED_PX = 200;
+/*
+ * How tightly the panes are packed.
+ *
+ * The first version used `gap-3 p-3`, which put 12 px between neighbours and
+ * another 12 px around the outside. On a workspace of a dozen panes that is
+ * ~60 px of window spent on nothing at all, and — the actual complaint — it
+ * makes the grid read as a scattered set of cards rather than one wall of
+ * terminals, which is what a tiling terminal looks like everywhere else.
+ *
+ * 4 px is enough to keep each pane's own border legible as its edge, and no
+ * more. It is stated as a constant because the horizontal half of it also has
+ * to reach `layout.ts`: the column count is computed from the grid's CONTENT
+ * width, so a padding change the layout module does not know about would make
+ * the wizard's preview and the running grid disagree about how many panes fit.
+ */
+const GRID_GAP_PX = 4;
+
/*
* Terminal appearance and text size are remembered, and the appearance follows
* the app's own theme until the user says otherwise.
@@ -219,6 +256,7 @@ export function AgenticGrid({
onSessionChanged,
accounts = [],
onStateChanged,
+ workspaceBar,
}: AgenticGridProps) {
const t = useT();
const pushToast = useEventStore((s) => s.pushToast);
@@ -446,8 +484,11 @@ export function AgenticGrid({
(frameHeight || COMPOSER_DEFAULT_PX + GRID_RESERVED_PX) - GRID_RESERVED_PX,
);
const composer = useResizablePane({
- storageKey: "jarvis.agenticIde.composerHeight.v1",
- defaultSize: COMPOSER_DEFAULT_PX,
+ // v2: the default changed from "open at 176 px" to "collapsed", and a key
+ // people already have a value under would have kept the old behaviour for
+ // every existing install — which is precisely who asked for the change.
+ storageKey: "jarvis.agenticIde.composerHeight.v2",
+ defaultSize: COMPOSER_COLLAPSED_PX,
min: COMPOSER_COLLAPSED_PX,
max: composerMax,
axis: "y",
@@ -463,6 +504,20 @@ export function AgenticGrid({
? COMPOSER_COLLAPSED_PX
: requestedComposer;
+ /*
+ * Double-clicking the seam TOGGLES rather than resets.
+ *
+ * `reset` means "back to the default", and the default is now the closed
+ * strip — so wiring the seam to it would give a shut bar a double-click that
+ * visibly does nothing, which reads as a dead control. Toggling keeps one
+ * gesture for both directions, which is what a double-click on a collapsed
+ * splitter does in every editor.
+ */
+ const { resize: resizeComposer } = composer;
+ const toggleComposer = useCallback(() => {
+ resizeComposer(composerCollapsed ? COMPOSER_DEFAULT_PX : COMPOSER_COLLAPSED_PX);
+ }, [composerCollapsed, resizeComposer]);
+
const perBand = useMemo(() => bandCapacityFor(gridWidth), [gridWidth]);
const grid = useMemo(
() => paneGrid(session.terminals, perBand),
@@ -671,19 +726,41 @@ export function AgenticGrid({
return (
<div ref={frameRef} className="relative flex h-full flex-col">
{/* ---------------------------------------------------------- toolbar */}
- <div className="flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border px-4 py-2.5">
- <div className="flex min-w-0 flex-1 items-center gap-2">
- <FolderGit2 className="h-4 w-4 shrink-0 text-primary" />
- <span className="font-display text-sm font-semibold">{project.name}</span>
- {branchLabel && (
- <span className="chip shrink-0 text-[10px] uppercase tracking-wide">
- {branchLabel}
+ {/*
+ ONE row: the workspace tabs on the left, this workspace's controls on
+ the right. See the `workspaceBar` prop for why they were merged.
+
+ `flex-nowrap` rather than the old `flex-wrap` is deliberate. Wrapping
+ was what made this bar able to become two or three lines tall on a
+ narrow window — silently taking the height back off the panes. Now the
+ labels drop away at narrow widths (the icons and their hover text stay)
+ and the row keeps its single line whatever happens.
+ */}
+ <div
+ data-testid="agentic-toolbar"
+ className="flex shrink-0 flex-nowrap items-center gap-2 border-b border-border px-2 py-1"
+ >
+ {workspaceBar ?? (
+ <div className="flex min-w-0 flex-1 items-center gap-2">
+ <FolderGit2 className="h-4 w-4 shrink-0 text-primary" />
+ <span className="truncate font-display text-sm font-semibold">
+ {project.name}
</span>
- )}
- <code className="hidden min-w-0 truncate font-mono text-[11px] text-muted-foreground lg:block">
- {session.folder}
- </code>
- </div>
+ </div>
+ )}
+
+ {/* Which branch the agents are on. It stays even in the merged row —
+ the workspace tab names the folder, not the checkout, and "which
+ branch am I about to let a dozen agents commit to" is not a
+ question worth answering from memory. */}
+ {branchLabel && (
+ <span
+ className="chip hidden shrink-0 text-[10px] uppercase tracking-wide xl:inline-flex"
+ title={session.folder}
+ >
+ {branchLabel}
+ </span>
+ )}
{/* Focus mode — the explicit switch into "Jarvis codes with me here". */}
<button
@@ -697,24 +774,26 @@ export function AgenticGrid({
: "Turn on focused coding mode — Jarvis answers inside this workspace until you switch back."
}
className={cn(
- "flex shrink-0 items-center gap-2 rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors",
+ "flex shrink-0 items-center gap-1.5 rounded-lg border px-2 py-1 text-xs font-medium transition-colors",
focusMode
? "border-primary/60 bg-primary/15 text-primary"
: "border-border text-muted-foreground hover:border-primary/40 hover:text-foreground",
)}
>
- <Brain className="h-4 w-4" />
- {focusMode ? "Coding mode ON" : "Coding mode OFF"}
+ <Brain className="h-4 w-4 shrink-0" />
+ <span className="hidden lg:inline">
+ {focusMode ? "Coding mode ON" : "Coding mode OFF"}
+ </span>
</button>
- <div className="flex shrink-0 items-center gap-1 rounded-lg border border-border p-0.5">
+ <div className="flex shrink-0 items-center gap-0.5 rounded-lg border border-border p-0.5">
<button
type="button"
aria-label="Light terminals"
aria-pressed={appearance === "light"}
onClick={() => setAppearance("light")}
className={cn(
- "flex h-7 w-7 items-center justify-center rounded-md transition-colors",
+ "flex h-6 w-6 items-center justify-center rounded-md transition-colors",
appearance === "light" ? "bg-primary/20 text-primary" : "text-muted-foreground",
)}
>
@@ -726,7 +805,7 @@ export function AgenticGrid({
aria-pressed={appearance === "dark"}
onClick={() => setAppearance("dark")}
className={cn(
- "flex h-7 w-7 items-center justify-center rounded-md transition-colors",
+ "flex h-6 w-6 items-center justify-center rounded-md transition-colors",
appearance === "dark" ? "bg-primary/20 text-primary" : "text-muted-foreground",
)}
>
@@ -734,12 +813,12 @@ export function AgenticGrid({
</button>
</div>
- <div className="flex shrink-0 items-center gap-1 rounded-lg border border-border p-0.5">
+ <div className="hidden shrink-0 items-center gap-0.5 rounded-lg border border-border p-0.5 md:flex">
<button
type="button"
aria-label="Smaller text"
onClick={() => setFontSize(Math.max(FONT_MIN, fontSize - 1))}
- className="flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground"
+ className="flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-foreground"
>
<Minus className="h-3.5 w-3.5" />
</button>
@@ -748,7 +827,7 @@ export function AgenticGrid({
type="button"
aria-label="Larger text"
onClick={() => setFontSize(Math.min(FONT_MAX, fontSize + 1))}
- className="flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:text-foreground"
+ className="flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:text-foreground"
>
<Plus className="h-3.5 w-3.5" />
</button>
@@ -776,16 +855,18 @@ export function AgenticGrid({
onClick={selectionMode ? leaveSelectionMode : enterSelectionMode}
title={t("agentic_grid.selection.hint")}
className={cn(
- "flex shrink-0 items-center gap-2 rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors",
+ "flex shrink-0 items-center gap-1.5 rounded-lg border px-2 py-1 text-xs font-medium transition-colors",
selectionMode
? "border-primary/60 bg-primary/15 text-primary"
: "border-border text-muted-foreground hover:border-primary/40 hover:text-foreground",
)}
>
- <ListChecks className="h-4 w-4" />
- {selectionMode
- ? t("agentic_grid.selection.finish")
- : t("agentic_grid.selection.start")}
+ <ListChecks className="h-4 w-4 shrink-0" />
+ <span className="hidden xl:inline">
+ {selectionMode
+ ? t("agentic_grid.selection.finish")
+ : t("agentic_grid.selection.start")}
+ </span>
</button>
{selectionMode && (
@@ -847,12 +928,12 @@ export function AgenticGrid({
<Dialog.Trigger asChild>
<button
type="button"
- className="btn-ghost shrink-0"
+ className="flex shrink-0 items-center gap-1.5 rounded-lg border border-border px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:border-destructive/50 hover:text-destructive disabled:opacity-40"
disabled={busy}
title="Close the workspace and stop every agent in it"
>
- <Power className="h-4 w-4" />
- Close
+ <Power className="h-4 w-4 shrink-0" />
+ <span className="hidden xl:inline">Close</span>
</button>
</Dialog.Trigger>
<ConfirmWorkspaceClose
@@ -884,13 +965,17 @@ export function AgenticGrid({
ref={gridRef}
data-testid="agentic-grid"
className={cn(
- "grid min-h-0 flex-1 gap-3 p-3",
+ "grid min-h-0 flex-1",
// Scrolls only once the panes would be squeezed below a readable
// height. With a workspace that fits, this is `overflow-hidden`
// behaviour and nothing moves.
maximized !== null ? "overflow-hidden" : "overflow-y-auto scrollbar-jarvis",
)}
style={{
+ // Inline rather than a utility class so ONE number drives both the
+ // rendered gap and the width the column count is computed from.
+ gap: GRID_GAP_PX,
+ padding: GRID_GAP_PX,
// While one pane is maximized the grid IS that pane: a single track
// filling exactly what the window shows. Spanning the full template
// instead was wrong in a workspace large enough to scroll — the
@@ -921,7 +1006,7 @@ export function AgenticGrid({
key={term.key}
data-testid={`pane-cell-${term.name}`}
className={cn(
- "relative min-h-0 min-w-0 rounded-xl",
+ "relative min-h-0 min-w-0 rounded-lg",
selectedTerminals.has(term.name) &&
"ring-2 ring-primary ring-offset-2 ring-offset-background",
maximized !== null && !isMaximized && "hidden",
@@ -1012,7 +1097,7 @@ export function AgenticGrid({
event.stopPropagation();
}}
className={cn(
- "absolute inset-0 z-20 cursor-pointer rounded-xl transition-colors",
+ "absolute inset-0 z-20 cursor-pointer rounded-lg transition-colors",
selectedTerminals.has(term.name)
? "bg-primary/10"
: "bg-transparent hover:bg-primary/5",
@@ -1083,35 +1168,40 @@ export function AgenticGrid({
{/* ------------------------------------------------- prompt bar + seam */}
{/*
The seam replaces the bar's top border, so there is exactly one line
- there — and that line is the control. Double-click restores 176 px.
+ there — and that line is the control. Hovering it lights it up; dragging
+ it up opens the bar to whatever height you pull, and a double-click
+ toggles between shut and the designed 176 px.
*/}
<PaneResizer
orientation="horizontal"
onPointerDown={composer.startResize}
- onDoubleClick={composer.reset}
+ onDoubleClick={toggleComposer}
onNudge={composer.nudge}
active={composer.isResizing}
- title="Drag to resize the prompt bar — double-click to reset, drag all the way down to collapse"
+ title={
+ composerCollapsed
+ ? "Drag up to open the prompt bar — double-click to open it fully"
+ : "Drag to resize the prompt bar — double-click to close it, drag all the way down to collapse"
+ }
/>
{composerCollapsed ? (
<div
data-testid="agentic-composer-collapsed"
style={{ height: COMPOSER_COLLAPSED_PX }}
- className="flex shrink-0 items-center justify-between px-4"
+ className="flex shrink-0 items-center justify-between gap-2 px-3"
>
<span className="truncate text-[11px] text-muted-foreground">
- Prompt bar hidden — {target || "no terminal"} still receives what you
- say out loud.
+ {target || "No terminal"} hears whatever you say out loud.
</span>
<button
type="button"
data-testid="agentic-composer-reopen"
- onClick={composer.reset}
- className="flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
+ onClick={() => composer.resize(COMPOSER_DEFAULT_PX)}
+ className="flex shrink-0 items-center gap-1.5 rounded-md px-2 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
>
<ChevronUp className="h-3.5 w-3.5" />
- Show prompt bar
+ Write instead
</button>
</div>
) : (
@@ -1130,7 +1220,7 @@ export function AgenticGrid({
void attach({ paths: [], files: images });
}}
className={cn(
- "relative flex shrink-0 flex-col overflow-hidden px-4 py-3 transition-colors",
+ "relative flex shrink-0 flex-col overflow-hidden px-3 py-2 transition-colors",
dragging && "bg-primary/5 ring-1 ring-inset ring-primary/50",
)}
>
@@ -1142,8 +1232,8 @@ export function AgenticGrid({
Drop a screenshot or document — {target || "the agent"} gets what is in it
</div>
)}
- <div className="mb-2 flex max-h-24 shrink-0 flex-wrap items-center gap-2 overflow-y-auto scrollbar-jarvis">
- <span className="text-[11px] uppercase tracking-wider text-muted-foreground">
+ <div className="mb-1.5 flex max-h-16 shrink-0 flex-wrap items-center gap-1 overflow-y-auto scrollbar-jarvis">
+ <span className="text-[10px] uppercase tracking-wider text-muted-foreground">
Send to
</span>
{/* Agent panes only. A plain terminal is a shell prompt — it is
@@ -1158,7 +1248,7 @@ export function AgenticGrid({
onClick={() => setTarget(term.name)}
aria-pressed={target === term.name}
className={cn(
- "flex items-center gap-2 rounded-lg border px-2.5 py-1 text-xs transition-colors",
+ "flex items-center gap-1.5 rounded-lg border px-2 py-0.5 text-xs transition-colors",
target === term.name
? "border-primary/60 bg-primary/10 text-primary"
: "border-border text-muted-foreground hover:border-primary/40",
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
index 90febb2acc..154a25cc2a 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
@@ -128,9 +128,13 @@ describe("AgenticTerminal layout", () => {
expect(viewport).not.toBeNull();
expect(viewport?.className).toContain("min-h-0");
- expect(viewport?.className).toContain("px-2");
- expect(viewport?.className).toContain("pb-1");
- expect(viewport?.className).toContain("pt-1");
+ // The inset is on the VIEWPORT, whatever it currently measures — the pane
+ // frame has been tightened more than once and the exact values are a visual
+ // decision. What must not change is WHICH element carries it: padding on
+ // the host below would make FitAddon report a row the pane cannot show.
+ expect(viewport?.className).toMatch(/(?:^|\s)px-[\d.]+/);
+ expect(viewport?.className).toMatch(/(?:^|\s)pb-[\d.]+/);
+ expect(viewport?.className).toMatch(/(?:^|\s)pt-[\d.]+/);
expect(host.className).toContain("h-full");
expect(host.className).toContain("min-h-0");
expect(host.className).not.toMatch(/(?:^|\s)p[trblxy]?-/);
@@ -222,7 +226,7 @@ describe("pane header recap", () => {
expect(screen.queryByTestId("pane-agent-Dana")).toBeNull();
});
- it("offers the longer recap in a tooltip the clipped line points at", () => {
+ it("opens the longer recap in a card the header line controls", async () => {
render(
<AgenticTerminal
name="Dana"
@@ -235,16 +239,39 @@ describe("pane header recap", () => {
);
const line = screen.getByTestId("pane-recap-Dana");
- const tooltip = screen.getByTestId("pane-recap-tooltip-Dana");
-
- expect(tooltip.textContent).toContain("Fix the failing login test");
- // Which CLI runs here stays one hover away rather than being lost.
- expect(tooltip.textContent).toContain("Claude Code");
- expect(tooltip.getAttribute("role")).toBe("tooltip");
- // The clipped line names its own explanation, so a screen reader reaches
- // the full sentence the same way a mouse does.
- expect(line.getAttribute("aria-describedby")).toBe(tooltip.id);
- expect(line.getAttribute("tabindex")).toBe("0");
+ expect(screen.queryByTestId("pane-recap-card-Dana")).toBeNull();
+
+ fireEvent.click(line);
+ const card = screen.getByTestId("pane-recap-card-Dana");
+
+ expect(card.textContent).toContain("Fix the failing login test");
+ // Which CLI runs here is named in the card rather than lost.
+ expect(card.textContent).toContain("Claude Code");
+ // A dialog, not a tooltip: it can be clicked into, its text selected, and
+ // its buttons pressed — none of which the tooltip it replaces allowed.
+ expect(card.getAttribute("role")).toBe("dialog");
+ expect(line.getAttribute("aria-controls")).toBe(card.id);
+ expect(line.getAttribute("aria-expanded")).toBe("true");
+ });
+
+ it("closes the card again on Escape", () => {
+ render(
+ <AgenticTerminal
+ name="Dana"
+ displayName="Claude Code"
+ recap="Running pytest tests/unit/test_login.py"
+ recapDetail="Where the work stands."
+ appearance="dark"
+ fontSize={13}
+ />,
+ );
+
+ fireEvent.click(screen.getByTestId("pane-recap-Dana"));
+ expect(screen.getByTestId("pane-recap-card-Dana")).toBeTruthy();
+
+ fireEvent.keyDown(document, { key: "Escape" });
+
+ expect(screen.queryByTestId("pane-recap-card-Dana")).toBeNull();
});
it("falls back to the agent name while a pane has no recap yet", () => {
@@ -260,10 +287,10 @@ describe("pane header recap", () => {
expect(screen.getByTestId("pane-agent-Dana").textContent).toBe(
"Claude Code",
);
- expect(screen.queryByTestId("pane-recap-tooltip-Dana")).toBeNull();
+ expect(screen.queryByTestId("pane-recap-Dana")).toBeNull();
});
- it("adds no tooltip when the recap already says everything", () => {
+ it("repeats nothing when the long form says what the header line says", () => {
render(
<AgenticTerminal
name="Dana"
@@ -275,9 +302,12 @@ describe("pane header recap", () => {
/>,
);
- // jsdom measures no widths, so nothing is clipped here — with an identical
- // detail there is genuinely nothing more to reveal.
- expect(screen.queryByTestId("pane-recap-tooltip-Dana")).toBeNull();
+ fireEvent.click(screen.getByTestId("pane-recap-Dana"));
+
+ expect(screen.getByTestId("pane-recap-headline-Dana").textContent).toBe(
+ "Not started yet.",
+ );
+ expect(screen.queryByTestId("pane-recap-detail-Dana")).toBeNull();
});
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
index cf4d5acd89..e7364cc2e3 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
@@ -194,6 +194,18 @@ interface AgenticTerminalProps {
onAttachError?: (message: string) => void;
/** Called when the user asks a dead pane to start a fresh agent. */
onRestart?: () => void;
+ /**
+ * Press on the pane's header — the grip that picks this pane up.
+ *
+ * The header rather than the whole pane, because the rest of the pane is a
+ * live terminal: a drag started there would be a text selection inside the
+ * agent's output, which is a thing people do all day. Omitted, the header is
+ * an ordinary header and the pane cannot be dragged (a maximized pane, or one
+ * in selection mode, has nowhere to be dropped).
+ */
+ onArrangeStart?: (event: React.PointerEvent) => void;
+ /** True while THIS pane is the one being carried — it is drawn as lifted. */
+ arranging?: boolean;
/**
* Bump to reconnect this pane.
*
@@ -227,6 +239,8 @@ export function AgenticTerminal({
onAttachError,
onRestart,
restartToken = 0,
+ onArrangeStart,
+ arranging = false,
}: AgenticTerminalProps) {
const containerRef = useRef<HTMLDivElement | null>(null);
// The padded box around the xterm host. The pane's scrollbar overlays it and
@@ -746,11 +760,15 @@ export function AgenticTerminal({
onMouseDown={onFocus}
{...dragHandlers}
className={cn(
- "relative flex h-full w-full flex-col overflow-hidden rounded-xl border transition-shadow",
+ "relative flex h-full w-full flex-col overflow-hidden rounded-lg border transition-shadow",
focused
? "border-primary/60 shadow-[0_0_0_1px_hsl(var(--primary)/0.35),0_8px_24px_-12px_rgba(0,0,0,0.5)]"
: "shadow-[0_4px_16px_-10px_rgba(0,0,0,0.4)]",
dragging && "border-primary shadow-[0_0_0_2px_hsl(var(--primary)/0.5)]",
+ // Lifted out of the grid while it is being carried: the pane stays where
+ // it is (moving it under the cursor would tear down nothing but would
+ // reflow every other pane on every mouse move) and says so by fading.
+ arranging && "opacity-45",
)}
style={{
background: chrome.shell,
@@ -761,6 +779,8 @@ export function AgenticTerminal({
<PaneHeader
dead={visibleStatus === "exited" || visibleStatus === "error"}
onRestart={onRestart}
+ onArrangeStart={onArrangeStart}
+ arranging={arranging}
name={name}
displayName={displayName}
recap={recap}
@@ -786,7 +806,7 @@ export function AgenticTerminal({
*/}
<div
ref={scrollRegionRef}
- className="relative min-h-0 flex-1 overflow-hidden px-2 pb-1 pt-1"
+ className="relative min-h-0 flex-1 overflow-hidden px-1.5 pb-0.5 pt-0.5"
>
<div
ref={containerRef}
@@ -846,6 +866,8 @@ function PaneHeader({
splitDisabled,
dead,
onRestart,
+ onArrangeStart,
+ arranging = false,
}: {
name: string;
displayName: string;
@@ -882,7 +904,7 @@ function PaneHeader({
return (
<header
- className="group/header relative flex items-center justify-between gap-2 border-b px-3 py-2"
+ className="group/header relative flex items-center justify-between gap-1.5 border-b px-2 py-1"
style={{
borderColor: PANE_CHROME[appearance].border,
background: light ? "rgba(0,0,0,0.025)" : "rgba(255,255,255,0.03)",
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx
index c6206ebc60..58c9957dcb 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx
@@ -19,11 +19,17 @@
*
* Closing is deliberately a two-step: the X reveals a confirm, because it is the
* one control in this bar that stops work — every other one is reversible.
+ *
+ * The tabs are also file targets. Dropping a screenshot on a workspace tab is
+ * the natural way to say "this belongs to THAT project" while looking at
+ * another one — it addresses the workspace by name instead of making the user
+ * switch first, drop second, and remember which pane had focus.
*/
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { Check, FolderGit2, Pencil, Plus, X } from "lucide-react";
import { cn } from "@/lib/utils";
import type { WorkspaceCard } from "@/lib/agenticIdeApi";
+import { dragCarriesFiles, extractPaneDrop, type PaneDropPayload } from "./paneDrop";
interface WorkspaceBarProps {
workspaces: WorkspaceCard[];
@@ -36,8 +42,28 @@ interface WorkspaceBarProps {
onAdd: () => void;
onRename: (id: string, name: string) => Promise<boolean>;
onClose: (id: string) => void;
+ /**
+ * A file was dropped on a workspace TAB. Left out, the tabs refuse drags and
+ * the cursor says so rather than accepting a file nothing would do anything
+ * with.
+ */
+ onDropFiles?: (workspaceId: string, payload: PaneDropPayload) => void;
/** Disable every control while a switch or a close is in flight. */
busy?: boolean;
+ /**
+ * The workspace's own controls, pinned to the right of this same row.
+ *
+ * They used to sit in a second bar directly underneath, which cost a whole
+ * line of the window to hold half a dozen buttons — in a view whose entire
+ * job is showing terminal output. The tabs rarely fill their half of the row,
+ * so the controls ride along in the space that was already there.
+ */
+ actions?: React.ReactNode;
+ /**
+ * Rendered INSIDE another bar rather than as its own — drops the frame (its
+ * border and outer padding) so the host row draws exactly one line.
+ */
+ embedded?: boolean;
}
export function WorkspaceBar({
@@ -49,15 +75,70 @@ export function WorkspaceBar({
onAdd,
onRename,
onClose,
+ onDropFiles,
busy = false,
+ actions,
+ embedded = false,
}: WorkspaceBarProps) {
// Which tab has its close button armed. One at a time, and cleared on every
// other interaction, so an armed X can never be clicked by accident later.
const [confirming, setConfirming] = useState<string | null>(null);
const [editing, setEditing] = useState<string | null>(null);
const [draft, setDraft] = useState("");
+ // Which tab a file drag is currently over. One at a time — a drag has one
+ // position — so this is an id rather than a set.
+ const [dropTarget, setDropTarget] = useState<string | null>(null);
const full = workspaces.length >= maxWorkspaces;
+ // A drag that ends anywhere else owes this bar no `dragleave`, and a tab left
+ // highlighted over a workspace nobody dropped on is a lie about what will
+ // happen next. Watched globally, and only while something is actually armed.
+ useEffect(() => {
+ if (dropTarget === null) return;
+ const clear = () => setDropTarget(null);
+ window.addEventListener("drop", clear);
+ window.addEventListener("dragend", clear);
+ return () => {
+ window.removeEventListener("drop", clear);
+ window.removeEventListener("dragend", clear);
+ };
+ }, [dropTarget]);
+
+ /** Drag-drop handlers for one tab. Empty when the owner takes no drops. */
+ const dropHandlersFor = (workspace: WorkspaceCard) => {
+ if (!onDropFiles) return {};
+ return {
+ onDragEnter: (event: React.DragEvent) => {
+ // Claimed even for payloads this tab will not take: the default action
+ // for a dropped link is to NAVIGATE, which would replace the whole IDE
+ // — every running agent in it with it.
+ event.preventDefault();
+ if (!dragCarriesFiles(event.dataTransfer)) return;
+ setDropTarget(workspace.id);
+ },
+ onDragOver: (event: React.DragEvent) => {
+ event.preventDefault();
+ event.dataTransfer.dropEffect = dragCarriesFiles(event.dataTransfer)
+ ? "copy"
+ : "none";
+ },
+ onDragLeave: (event: React.DragEvent) => {
+ // A drag crossing the tab's own children fires leave for each of them;
+ // only a leave that actually exits the tab counts.
+ const next = event.relatedTarget as Node | null;
+ if (next && event.currentTarget.contains(next)) return;
+ setDropTarget((current) => (current === workspace.id ? null : current));
+ },
+ onDrop: (event: React.DragEvent) => {
+ event.preventDefault();
+ setDropTarget(null);
+ if (!dragCarriesFiles(event.dataTransfer)) return;
+ // Read SYNCHRONOUSLY — a DataTransfer empties the moment this returns.
+ onDropFiles(workspace.id, extractPaneDrop(event.dataTransfer));
+ },
+ };
+ };
+
const beginRename = (workspace: WorkspaceCard) => {
setConfirming(null);
setEditing(workspace.id);
@@ -72,29 +153,45 @@ export function WorkspaceBar({
}
};
- // Nothing open and nothing to add to: the wizard IS the screen, and an empty
- // bar above it would be furniture.
- if (workspaces.length === 0) return null;
+ // Nothing open, nothing to add to and no controls to carry: the wizard IS the
+ // screen, and an empty bar above it would be furniture.
+ if (workspaces.length === 0 && !actions) return null;
return (
<div
- data-testid="workspace-bar"
- className="flex items-center gap-1 overflow-x-auto border-b border-border px-3 py-1.5 scrollbar-jarvis"
- role="tablist"
- aria-label="Open workspaces"
+ className={cn(
+ "flex items-center gap-2",
+ embedded ? "min-w-0 flex-1" : "border-b border-border px-2 py-1",
+ )}
>
+ <div
+ data-testid="workspace-bar"
+ className="flex min-w-0 flex-1 items-center gap-1 overflow-x-auto scrollbar-jarvis"
+ role="tablist"
+ aria-label="Open workspaces"
+ >
{workspaces.map((workspace) => {
const selected = !addingNew && workspace.id === activeId;
const armed = confirming === workspace.id;
const renaming = editing === workspace.id;
+ const dropping = dropTarget === workspace.id;
return (
<div
key={workspace.id}
+ data-testid={`workspace-tab-drop-${workspace.id}`}
+ {...dropHandlersFor(workspace)}
+ title={
+ onDropFiles
+ ? `${workspace.folder} — drop a screenshot or document here to send it to this workspace`
+ : workspace.folder
+ }
className={cn(
- "group/tab flex shrink-0 items-center gap-2 rounded-lg border px-3 py-1.5 transition-colors",
- selected
- ? "border-primary/50 bg-primary/10"
- : "border-transparent hover:border-border hover:bg-muted/40",
+ "group/tab flex shrink-0 items-center gap-1.5 rounded-lg border px-2 py-1 transition-colors",
+ dropping
+ ? "border-primary border-dashed bg-primary/15"
+ : selected
+ ? "border-primary/50 bg-primary/10"
+ : "border-transparent hover:border-border hover:bg-muted/40",
)}
>
{renaming ? (
@@ -246,7 +343,7 @@ export function WorkspaceBar({
onAdd();
}}
className={cn(
- "flex shrink-0 items-center gap-1.5 rounded-lg border px-3 py-1.5 text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-40",
+ "flex shrink-0 items-center gap-1.5 rounded-lg border px-2 py-1 text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-40",
addingNew
? "border-primary/50 bg-primary/10 text-primary"
: "border-dashed border-border text-muted-foreground hover:border-primary/40 hover:text-foreground",
@@ -255,6 +352,16 @@ export function WorkspaceBar({
<Plus className="h-3.5 w-3.5" />
New workspace
</button>
+ </div>
+
+ {actions && (
+ <div
+ data-testid="workspace-bar-actions"
+ className="flex shrink-0 items-center gap-1"
+ >
+ {actions}
+ </div>
+ )}
</div>
);
}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
index a04498ec43..557d5cd7ce 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
import {
+ GRID_HORIZONTAL_PADDING_PX,
MAX_PANES_PER_BAND,
MIN_PANE_WIDTH_PX,
bandCapacityFor,
@@ -11,15 +12,31 @@ import {
workspaceBandCapacityFor,
} from "./layout";
+/*
+ * The thresholds are expressed as "content width + the grid's own padding"
+ * rather than as the literal pixel numbers they came to.
+ *
+ * Those literals were what made this file break when the grid was tightened
+ * from 12 px of padding a side to 4 — a purely visual change that has no
+ * business moving a column threshold, and did not: only the OUTER width at
+ * which it is crossed moved, by exactly the padding. Written this way the tests
+ * still pin the real contract (both helpers answer for the same window) and
+ * stop failing over the frame around it.
+ */
+const FOUR_COLUMNS_AT = 4 * MIN_PANE_WIDTH_PX;
+const SIX_COLUMNS_AT = 6 * MIN_PANE_WIDTH_PX;
+
describe("workspaceBandCapacityFor", () => {
it("uses the grid content width on both sides of the four-column threshold", () => {
- expect(workspaceBandCapacityFor(1543)).toBe(3);
- expect(workspaceBandCapacityFor(1544)).toBe(4);
+ const outer = FOUR_COLUMNS_AT + GRID_HORIZONTAL_PADDING_PX;
+ expect(workspaceBandCapacityFor(outer - 1)).toBe(3);
+ expect(workspaceBandCapacityFor(outer)).toBe(4);
});
it("uses the grid content width on both sides of the six-column threshold", () => {
- expect(workspaceBandCapacityFor(2303)).toBe(5);
- expect(workspaceBandCapacityFor(2304)).toBe(6);
+ const outer = SIX_COLUMNS_AT + GRID_HORIZONTAL_PADDING_PX;
+ expect(workspaceBandCapacityFor(outer - 1)).toBe(5);
+ expect(workspaceBandCapacityFor(outer)).toBe(6);
});
});
@@ -27,14 +44,21 @@ describe("the two width helpers say which width they take", () => {
it("separates the grid's own content width from the outer width", () => {
// The defect they exist to prevent: the running grid measures its CONTENT
// box (padding already excluded) while the wizard measures an unpadded
- // element. Feeding both to one helper made the grid lay itself out 24 px
- // narrower than it is, so the preview and the workspace changed column
- // count at different window widths and the preview looked like a liar.
- expect(bandCapacityFor(1520)).toBe(4);
- expect(workspaceBandCapacityFor(1520 + 24)).toBe(4);
+ // element. Feeding both to one helper made the grid lay itself out a
+ // padding's width narrower than it is, so the preview and the workspace
+ // changed column count at different window widths and the preview looked
+ // like a liar.
+ expect(bandCapacityFor(FOUR_COLUMNS_AT)).toBe(4);
+ expect(
+ workspaceBandCapacityFor(FOUR_COLUMNS_AT + GRID_HORIZONTAL_PADDING_PX),
+ ).toBe(4);
// Same physical window, same answer — which is the whole point.
- expect(bandCapacityFor(1519)).toBe(3);
- expect(workspaceBandCapacityFor(1519 + 24)).toBe(3);
+ expect(bandCapacityFor(FOUR_COLUMNS_AT - 1)).toBe(3);
+ expect(
+ workspaceBandCapacityFor(
+ FOUR_COLUMNS_AT - 1 + GRID_HORIZONTAL_PADDING_PX,
+ ),
+ ).toBe(3);
});
});
@@ -73,7 +97,9 @@ describe("widthForOneBand", () => {
it("names the width at which a count stops wrapping", () => {
// What the readout tells the user so a maximise cannot turn the preview
// into a broken promise: eight panes need 8 × 380 px plus the grid padding.
- expect(widthForOneBand(8)).toBe(8 * MIN_PANE_WIDTH_PX + 24);
+ expect(widthForOneBand(8)).toBe(
+ 8 * MIN_PANE_WIDTH_PX + GRID_HORIZONTAL_PADDING_PX,
+ );
// And it agrees with the helper the wizard measures through, rather than
// being a second opinion about the same threshold.
expect(workspaceBandCapacityFor(widthForOneBand(8) as number)).toBe(8);
diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.ts
index b4eac19a02..5aa5d2aed5 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/layout.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.ts
@@ -77,8 +77,15 @@ export const MIN_PANE_WIDTH_PX = 380;
*/
export const MIN_PANE_HEIGHT_PX = 240;
-/** Horizontal padding of the rendered grid (`p-3`: 12 px on each side). */
-export const GRID_HORIZONTAL_PADDING_PX = 24;
+/**
+ * Horizontal padding of the rendered grid — 4 px on each side.
+ *
+ * It mirrors `GRID_GAP_PX` in AgenticGrid, and the two must not drift: the
+ * column count is computed from the grid's CONTENT width, so a padding the
+ * layout module does not know about makes the wizard's preview and the running
+ * grid disagree about how many panes fit at a given window width.
+ */
+export const GRID_HORIZONTAL_PADDING_PX = 8;
/**
* How many columns fit in ``widthPx`` without starving them.
diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
index 152d1f7689..c9698c73c7 100644
--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx
@@ -167,6 +167,26 @@ export interface SidebarProps {
/** Width the sidebar was designed at, and the one a double-click restores. */
export const SIDEBAR_DEFAULT_WIDTH = 280;
+/**
+ * Narrowest the sidebar goes: the nav icons, and nothing else.
+ *
+ * The seam used to stop at 200 px, which is wide enough to still read every
+ * label — so in the Agentic IDE, where a workspace of a dozen terminals wants
+ * every pixel, a fifth of the window stayed spent on a list nobody was reading.
+ * The rail keeps navigation one click away (the icons are still there, each
+ * with its label on hover) while giving that space back to the panes.
+ */
+export const SIDEBAR_RAIL_WIDTH = 64;
+
+/**
+ * Below this dragged width the sidebar SNAPS to the rail rather than clipping.
+ *
+ * Between the two there is no useful layout: a 120 px sidebar shows half a word
+ * per row, which reads as a broken column rather than a deliberate one. So the
+ * band is skipped — pull past it and you get icons, pull back and you get text.
+ */
+export const SIDEBAR_RAIL_AT_WIDTH = 168;
+
export function Sidebar({ width = SIDEBAR_DEFAULT_WIDTH }: SidebarProps = {}) {
const t = useT();
const active = useEventStore((s) => s.activeSection);
@@ -254,22 +274,40 @@ export function Sidebar({ width = SIDEBAR_DEFAULT_WIDTH }: SidebarProps = {}) {
const [logoRetry, setLogoRetry] = useState(0);
+ // Dragged past the snap point the sidebar becomes a rail of icons. Everything
+ // that only makes sense with a label beside it — the wake-word hint, the
+ // realtime control, the brain card's provider and model — steps aside; the
+ // navigation itself never does, because losing it would make the rail a dead
+ // end rather than a narrow sidebar.
+ const railed = width < SIDEBAR_RAIL_AT_WIDTH;
+
return (
// No right border: the draggable seam beside it draws that line now, and
// two 1px lines three pixels apart read as a rendering fault.
<aside
- style={{ width }}
+ style={{ width: railed ? SIDEBAR_RAIL_WIDTH : width }}
+ data-testid="sidebar"
+ data-railed={railed ? "true" : "false"}
className="flex h-full shrink-0 flex-col bg-card/40 backdrop-blur"
>
- <div className="border-b border-border px-4 py-4">
- <div className="flex items-center gap-3">
+ <div className={cn("border-b border-border", railed ? "px-2 py-3" : "px-4 py-4")}>
+ <div
+ className={cn(
+ "flex items-center gap-3",
+ railed && "flex-col justify-center gap-1.5",
+ )}
+ >
{/* The original Personal Jarvis logo — the ghost mascot. A snapshot
had swapped the header avatar for a bar glyph / gold-spark mark;
this is the canonical brand identity (jarvis-gigi). */}
<span
data-testid="sidebar-style-avatar"
data-variant="logo"
- className="flex h-11 w-11 shrink-0 items-center justify-center"
+ title={railed ? `${assistantName} — ${voiceLabel}` : undefined}
+ className={cn(
+ "flex shrink-0 items-center justify-center",
+ railed ? "h-9 w-9" : "h-11 w-11",
+ )}
>
<img
src={
@@ -277,8 +315,8 @@ export function Sidebar({ width = SIDEBAR_DEFAULT_WIDTH }: SidebarProps = {}) {
? "/jarvis-logo.png"
: `/jarvis-logo.png?retry=${logoRetry}`
}
- width={40}
- height={40}
+ width={railed ? 32 : 40}
+ height={railed ? 32 : 40}
alt={PRODUCT_NAME}
className="shrink-0"
onError={() => {
@@ -291,14 +329,16 @@ export function Sidebar({ width = SIDEBAR_DEFAULT_WIDTH }: SidebarProps = {}) {
}}
/>
</span>
- <div className="flex min-w-0 flex-1 flex-col">
- <span className="font-display text-sm font-semibold tracking-tight">
- {assistantName}
- </span>
- <span className="text-[10px] uppercase tracking-wider text-muted-foreground">
- {voiceLabel}
- </span>
- </div>
+ {!railed && (
+ <div className="flex min-w-0 flex-1 flex-col">
+ <span className="font-display text-sm font-semibold tracking-tight">
+ {assistantName}
+ </span>
+ <span className="text-[10px] uppercase tracking-wider text-muted-foreground">
+ {voiceLabel}
+ </span>
+ </div>
+ )}
{showSpinner ? (
<Loader2
className="h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"
@@ -316,19 +356,30 @@ export function Sidebar({ width = SIDEBAR_DEFAULT_WIDTH }: SidebarProps = {}) {
/>
)}
</div>
- <div className="mt-3 min-h-[20px] rounded-md bg-background/40 px-2 py-1.5 text-xs text-muted-foreground">
- {transcription ? (
- <span className={cn("font-mono", !transcriptionFinal && "italic")}>
- {truncate(transcription, 48)}
- </span>
- ) : (
- <span className="text-muted-foreground/50">{t("sidebar.wake_hint")}</span>
- )}
- </div>
- <BrowserRealtimeControl />
+ {!railed && (
+ <>
+ <div className="mt-3 min-h-[20px] rounded-md bg-background/40 px-2 py-1.5 text-xs text-muted-foreground">
+ {transcription ? (
+ <span className={cn("font-mono", !transcriptionFinal && "italic")}>
+ {truncate(transcription, 48)}
+ </span>
+ ) : (
+ <span className="text-muted-foreground/50">
+ {t("sidebar.wake_hint")}
+ </span>
+ )}
+ </div>
+ <BrowserRealtimeControl />
+ </>
+ )}
</div>
- <nav className="flex-1 overflow-y-auto scrollbar-jarvis p-2">
+ <nav
+ className={cn(
+ "flex-1 overflow-y-auto scrollbar-jarvis",
+ railed ? "px-1.5 py-2" : "p-2",
+ )}
+ >
{NAV_GROUPS.map((group, groupIndex) => (
<ul
key={groupIndex}
@@ -342,6 +393,7 @@ export function Sidebar({ width = SIDEBAR_DEFAULT_WIDTH }: SidebarProps = {}) {
<NavRow
key={item.id}
item={item}
+ railed={railed}
label={resolveNavLabel(t, item)}
active={item.matchIds ? item.matchIds.includes(active) : item.id === active}
badge={item.id === "agents" ? agentsCount : undefined}
@@ -363,14 +415,25 @@ export function Sidebar({ width = SIDEBAR_DEFAULT_WIDTH }: SidebarProps = {}) {
))}
</nav>
- <div className="border-t border-border p-3">
+ <div className={cn("border-t border-border", railed ? "p-1.5" : "p-3")}>
<button
type="button"
onClick={() => setActive("apikeys")}
- className="group flex w-full items-center gap-3 rounded-lg border border-border bg-background/40 px-3 py-2 text-left transition-colors hover:border-primary/40 hover:bg-background/60"
- title={footerTooltip}
+ className={cn(
+ "group flex w-full items-center rounded-lg border border-border bg-background/40 text-left transition-colors hover:border-primary/40 hover:bg-background/60",
+ railed ? "justify-center px-2 py-2" : "gap-3 px-3 py-2",
+ )}
+ // On the rail the card shrinks to its status dot, so everything it
+ // would have said moves into the hover text — otherwise the dot is a
+ // button with no stated purpose.
+ title={
+ railed
+ ? `${footerLabel}: ${footerProvider}${footerModel ? ` · ${footerModel}` : ""} — ${footerTooltip}`
+ : footerTooltip
+ }
>
- <div className="h-2 w-2 rounded-full bg-primary shadow-[0_0_8px_rgba(255,214,10,0.7)]" />
+ <div className="h-2 w-2 shrink-0 rounded-full bg-primary shadow-[0_0_8px_rgba(255,214,10,0.7)]" />
+ {!railed && (
<div className="flex-1 min-w-0">
<div
className="text-[10px] uppercase tracking-wider text-muted-foreground"
@@ -392,7 +455,10 @@ export function Sidebar({ width = SIDEBAR_DEFAULT_WIDTH }: SidebarProps = {}) {
</div>
)}
</div>
- <ChevronRight className="h-4 w-4 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary" />
+ )}
+ {!railed && (
+ <ChevronRight className="h-4 w-4 text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-primary" />
+ )}
</button>
</div>
</aside>
@@ -408,6 +474,7 @@ function NavRow({
alertTitle,
warn = false,
warnTitle,
+ railed = false,
onClick,
}: {
item: NavItem;
@@ -424,17 +491,25 @@ function NavRow({
warn?: boolean;
/** Plain-language hover text for the warn dot. */
warnTitle?: string;
+ /** Icon-only row — the sidebar has been dragged down to its rail. */
+ railed?: boolean;
onClick: () => void;
}) {
const Icon = item.icon;
+ // On the rail the label is gone from the screen, so it has to survive
+ // somewhere: as the hover text and as the accessible name. Without both, the
+ // narrow sidebar would be a column of unlabelled glyphs.
+ const hint = alert ? alertTitle : warn ? warnTitle : undefined;
return (
<li>
<button
type="button"
onClick={onClick}
- title={alert ? alertTitle : warn ? warnTitle : undefined}
+ aria-label={railed ? label : undefined}
+ title={railed ? (hint ? `${label} — ${hint}` : label) : hint}
className={cn(
- "group relative flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm transition-all",
+ "group relative flex w-full items-center rounded-lg text-sm transition-all",
+ railed ? "justify-center px-0 py-2" : "gap-3 px-3 py-2",
"hover:bg-background/60",
active
? "bg-background text-foreground shadow-[inset_2px_0_0_hsl(var(--primary))]"
@@ -447,13 +522,18 @@ function NavRow({
active ? "text-primary" : "text-muted-foreground group-hover:text-foreground",
)}
/>
- <span className="flex-1 text-left">{label}</span>
+ {!railed && <span className="flex-1 text-left">{label}</span>}
+ {/* On the rail the status dots ride ON the icon rather than after the
+ label there is no room for — the signal is the point, not the row. */}
{alert && (
<span
data-testid={`nav-alert-${item.id}`}
role="status"
aria-label={alertTitle}
- className="h-2 w-2 shrink-0 rounded-full bg-destructive ring-2 ring-background"
+ className={cn(
+ "h-2 w-2 shrink-0 rounded-full bg-destructive ring-2 ring-background",
+ railed && "absolute right-1.5 top-1.5",
+ )}
/>
)}
{!alert && warn && (
@@ -461,10 +541,13 @@ function NavRow({
data-testid={`nav-warn-${item.id}`}
role="status"
aria-label={warnTitle}
- className="h-2 w-2 shrink-0 rounded-full bg-amber-500 ring-2 ring-background"
+ className={cn(
+ "h-2 w-2 shrink-0 rounded-full bg-amber-500 ring-2 ring-background",
+ railed && "absolute right-1.5 top-1.5",
+ )}
/>
)}
- {badge !== undefined && badge > 0 && (
+ {badge !== undefined && badge > 0 && !railed && (
<span className="rounded-full bg-primary/20 px-1.5 py-0.5 text-[10px] font-semibold text-primary">
{badge}
</span>
diff --git a/jarvis/ui/web/frontend/src/hooks/useResizablePane.ts b/jarvis/ui/web/frontend/src/hooks/useResizablePane.ts
index cf817171e4..8896926d57 100644
--- a/jarvis/ui/web/frontend/src/hooks/useResizablePane.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useResizablePane.ts
@@ -40,6 +40,15 @@ export interface ResizablePane {
reset: () => void;
/** Move the seam by ``delta`` px — the keyboard equivalent of a drag. */
nudge: (delta: number) => void;
+ /**
+ * Jump straight to ``px``.
+ *
+ * For the controls that name ONE size rather than nudge the current one — a
+ * "show the prompt bar" button, a collapse toggle. Those cannot use `reset`
+ * once the default IS the collapsed size, which is exactly the case for a
+ * pane that starts shut.
+ */
+ resize: (px: number) => void;
}
/**
@@ -99,6 +108,11 @@ export function useResizablePane({
[min, max],
);
+ const resize = useCallback(
+ (px: number) => setSize(clampSize(px, min, max)),
+ [min, max],
+ );
+
// Global pointer listeners are armed only while dragging.
useEffect(() => {
if (!isResizing) return;
@@ -137,7 +151,7 @@ export function useResizablePane({
}
}, [size, isResizing, storageKey]);
- return { size, isResizing, startResize, reset, nudge };
+ return { size, isResizing, startResize, reset, nudge, resize };
}
function loadSize(key: string, fallback: number): number {
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
index 8770517b69..979911c602 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx
@@ -70,10 +70,19 @@ vi.mock("@/lib/agenticIdeApi", () => ({
closeWorkspace: vi.fn(),
fetchNativePickerSupport: vi.fn(),
openNativePicker: vi.fn(),
+ // The grid polls this to keep the pane headers current.
+ fetchTerminalRecaps: vi.fn(async () => ({
+ workspace_id: null,
+ terminals: [],
+ })),
}));
import { AgenticIdeView } from "./AgenticIdeView";
import * as api from "@/lib/agenticIdeApi";
+import {
+ GRID_HORIZONTAL_PADDING_PX,
+ MIN_PANE_WIDTH_PX,
+} from "@/components/agentic/layout";
const AGENTS: api.AgentsResponse = {
terminal_available: true,
@@ -232,6 +241,10 @@ function sessionWith(names: string[], focus = false): api.SessionState {
}
beforeEach(() => {
+ // A workspace now opens with its prompt bar collapsed — the panes are what
+ // the user came for. The tests below that type an instruction want it open,
+ // and the remembered height is how a user who wants it open gets it.
+ window.localStorage.setItem("jarvis.agenticIde.composerHeight.v2", "176");
vi.mocked(api.fetchIdeAgents).mockResolvedValue(AGENTS);
vi.mocked(api.fetchIdeState).mockResolvedValue(EMPTY_STATE);
vi.mocked(api.fetchFolders).mockResolvedValue({
@@ -459,12 +472,19 @@ describe("Agentic IDE wizard", () => {
const readout = screen.getByTestId("workspace-stage-readout");
expect(readout.textContent).toContain("2 across");
expect(readout.textContent).toContain("4 down");
- // 8 × 380 px + the grid's padding — the width at which they all fit on one
- // line, stated so a maximise cannot turn the preview into a broken promise.
+ // 8 panes × the readable minimum + the grid's own padding — the width at
+ // which they all fit on one line, stated so a maximise cannot turn the
+ // preview into a broken promise. Computed rather than written out, because
+ // tightening the grid's padding moves this number without changing
+ // anything the test is actually about.
+ //
// `grouped` spells out the narrow no-break space the readout separates
// thousands with: an invisible literal here reads as a plain space,
// passes review, and fails the run.
- expect(readout.textContent).toContain(grouped("3 064"));
+ const oneBandWidth = 8 * MIN_PANE_WIDTH_PX + GRID_HORIZONTAL_PADDING_PX;
+ expect(readout.textContent).toContain(
+ grouped(String(oneBandWidth).replace(/\B(?=(\d{3})+(?!\d))/g, " ")),
+ );
// 1 056, not 1 050: the view rounds the measured width to 16 px steps so a
// one-pixel drift cannot churn the layout, and the readout reports the width
// the arrangement was actually decided from rather than a truer-looking one.
@@ -553,7 +573,11 @@ describe("Agentic IDE running workspace", () => {
fireEvent.click(screen.getByRole("button", { name: /send/i }));
await waitFor(() =>
- expect(api.promptTerminal).toHaveBeenCalledWith("Mika", "run the tests"),
+ // The third argument carries files dropped on the prompt bar — empty
+ // here, because this instruction was typed with nothing attached.
+ expect(api.promptTerminal).toHaveBeenCalledWith("Mika", "run the tests", {
+ attachments: [],
+ }),
);
});
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
index 7341a4bbe8..c1724afcda 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
@@ -46,8 +46,13 @@ import {
import { FolderPicker } from "@/components/agentic/FolderPicker";
import { ResumeCard } from "@/components/agentic/ResumeCard";
import { WorkspaceBar } from "@/components/agentic/WorkspaceBar";
+import {
+ isEmptyPayload,
+ type PaneDropPayload,
+} from "@/components/agentic/paneDrop";
import {
activateWorkspace,
+ attachToTerminal,
closeWorkspace,
endIdeSession,
fetchIdeAgents,
@@ -60,6 +65,7 @@ import {
startIdeSession,
type AgentStatus,
type AgentsResponse,
+ type IdeAccountState,
type IdeState,
type ResumeOffer,
type SessionState,
@@ -120,6 +126,10 @@ export function AgenticIdeView() {
// these are the others, still running, one click away.
const [workspaces, setWorkspaces] = useState<WorkspaceCard[]>([]);
const [maxWorkspaces, setMaxWorkspaces] = useState(6);
+ // Which subscription new terminals open on, per coding CLI. Carried on the
+ // workspace state rather than fetched separately, so the toolbar and the
+ // panes can never disagree about which plan the next one will spend.
+ const [ideAccounts, setIdeAccounts] = useState<IdeAccountState[]>([]);
/*
* The wizard is showing for an ADDITIONAL workspace.
*
@@ -155,6 +165,7 @@ export function AgenticIdeView() {
setSession(state.session);
setWorkspaces(state.workspaces ?? []);
setMaxWorkspaces(state.max_workspaces ?? 6);
+ setIdeAccounts(state.accounts ?? []);
setFocus(Boolean(state.session?.focus_mode));
// The backend is the authority on whether a workspace is on screen. It
// says so by carrying one in `session`, so a fetch that finds one ends
@@ -187,6 +198,9 @@ export function AgenticIdeView() {
setWorkspaces(state.workspaces ?? []);
setMaxWorkspaces(state.max_workspaces ?? 6);
setFocus(Boolean(state.session?.focus_mode));
+ // Absent on a backend that predates the switcher — keeping what we had
+ // beats blanking the toolbar over a field that simply was not sent.
+ if (state.accounts) setIdeAccounts(state.accounts);
}, []);
useEffect(() => {
@@ -202,6 +216,24 @@ export function AgenticIdeView() {
.catch(() => setAccounts(null));
}, []);
+ /*
+ * A state the workspace's settings panel handed back.
+ *
+ * Same as `applyState`, plus a re-read of the subscription list: that panel
+ * can ADD an account, and the wizard's per-pane picker was loaded once on
+ * mount — without this the next workspace would be offered a list one account
+ * short until the app is reloaded.
+ */
+ const applyStateFromSettings = useCallback(
+ (state: IdeState) => {
+ applyState(state);
+ fetchAgentAccounts()
+ .then(setAccounts)
+ .catch(() => undefined);
+ },
+ [applyState],
+ );
+
/** The registered subscriptions of one CLI, for the wizard's per-pane picker. */
const accountsFor = useCallback(
(platform: string): AgentAccount[] =>
@@ -303,14 +335,23 @@ export function AgenticIdeView() {
const defaultAgent = installed[0]?.name ?? "claude";
const maxTerminals = meta?.max_terminals ?? 12;
- // What the grid's split menus offer. Uninstalled CLIs stay in the list but
- // disabled, so their absence is visible rather than silently missing.
+ // What the grid's split menus offer — every entry the backend registered, so
+ // the coding CLIs and the plain terminal, and anything registered later
+ // without a change here. Uninstalled entries stay in the list but disabled,
+ // so their absence is visible rather than silently missing.
const splitChoices = useMemo(
() =>
agents.map((a) => ({
name: a.name,
displayName: a.display_name,
installed: a.installed,
+ kind: a.kind ?? "cli",
+ // For a plain terminal the useful second line is WHICH shell opens; a
+ // CLI's name already says what it is, so it gets no line of its own.
+ description:
+ a.kind === "shell" && a.version
+ ? `${a.version} — no agent, just a prompt`
+ : (a.description ?? ""),
})),
[agents],
);
@@ -431,6 +472,48 @@ export function AgenticIdeView() {
}
};
+ /*
+ * A file dropped on a workspace TAB.
+ *
+ * It goes to that workspace's first pane, and the pane types the reference
+ * rather than swallowing it: a tab is a coarse target — it names a project,
+ * not an agent — so the honest reading is "put this in front of the agents
+ * over there", and the user finishes the thought when they switch to it.
+ * That is why this does not analyse or compose: the prompt bar is where a
+ * dropped file becomes part of an instruction, and this is not that.
+ *
+ * Dropping on the tab you are already on is the same gesture, so it is not
+ * special-cased away; switching to the target afterwards is what makes the
+ * result visible rather than something the user has to go looking for.
+ */
+ const dropOnWorkspace = async (id: string, payload: PaneDropPayload) => {
+ if (isEmptyPayload(payload)) return;
+ const label = workspaces.find((w) => w.id === id)?.name ?? "that workspace";
+ try {
+ // Switch FIRST, and not as a courtesy: a workspace card carries no pane
+ // names, so activating it is how the target pane becomes knowable at all.
+ // It also puts the user in front of the result instead of leaving the
+ // file somewhere they would have to go and find.
+ let active = session;
+ if (id !== session?.id || addingNew) {
+ const state = await activateWorkspace(id);
+ applyState(state);
+ setAddingNew(false);
+ setOffer(null);
+ active = state.session;
+ }
+ const pane = active?.terminals[0]?.name;
+ if (!pane) {
+ pushToast("warning", `${label} has no agent running to give the file to.`);
+ return;
+ }
+ const result = await attachToTerminal(pane, payload);
+ pushToast("success", `${result.files.join(", ")} → ${pane} in ${label}.`);
+ } catch (e) {
+ pushToast("error", (e as Error).message);
+ }
+ };
+
const startAdding = async () => {
if (busy) return;
setBusy(true);
@@ -544,6 +627,11 @@ export function AgenticIdeView() {
* the wizard is below it. A bar that moved (or vanished while adding one)
* would leave the user without a way back to the workspaces still running.
*
+ * With a workspace open it is handed to the grid rather than rendered here,
+ * so the tabs and that workspace's controls share ONE row (see the grid's
+ * `workspaceBar` prop). Same bar, same place on screen — one line instead of
+ * two, which in a view full of terminals is a pane's worth of output.
+ *
* Pane actions return the updated session, while the compact workspace cards
* remain the snapshot from the last full-state request. Replace the active
* card's count from that live session so closing or adding a terminal updates
@@ -554,8 +642,9 @@ export function AgenticIdeView() {
? { ...workspace, terminals: session.terminals.length }
: workspace,
);
- const bar = (
+ const renderBar = (embedded: boolean) => (
<WorkspaceBar
+ embedded={embedded}
workspaces={barWorkspaces}
activeId={session?.id ?? null}
addingNew={addingNew}
@@ -564,6 +653,7 @@ export function AgenticIdeView() {
onAdd={() => void startAdding()}
onRename={renameOne}
onClose={(id) => void closeOne(id)}
+ onDropFiles={(id, payload) => void dropOnWorkspace(id, payload)}
busy={busy}
/>
);
@@ -572,7 +662,6 @@ export function AgenticIdeView() {
if (session && !addingNew) {
return (
<div className="flex h-full flex-col">
- {bar}
<div className="min-h-0 flex-1">
{/*
Keyed by workspace, so switching tabs REPLACES the grid instead of
@@ -584,6 +673,7 @@ export function AgenticIdeView() {
<AgenticGrid
key={session.id}
session={session}
+ workspaceBar={renderBar(true)}
focusMode={focusMode}
onToggleFocus={(v) => void toggleFocus(v)}
onClose={() => void close()}
@@ -591,6 +681,8 @@ export function AgenticIdeView() {
maxTerminals={maxTerminals}
agents={splitChoices}
onSessionChanged={setSession}
+ accounts={ideAccounts}
+ onStateChanged={applyStateFromSettings}
/>
</div>
{modeIntroFor === session.id && (
@@ -615,7 +707,7 @@ export function AgenticIdeView() {
return (
<div className="flex h-full flex-col" ref={shellRef}>
- {bar}
+ {renderBar(false)}
<ViewHeader
icon={<Sparkles className="h-4 w-4 text-primary" />}
title={