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): even every terminal out from one toolbar button

rubenluetke10-beep40e1e10614eb
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 04e175aea1..725efc6df2 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
@@ -1419,6 +1419,27 @@ describe("resizing the workspace", () => {
});
}
+ /** The same, down the other axis — a horizontal seam reads `clientY`. */
+ function dragSeamDownBy(testId: string, fromY: number, toY: number) {
+ const seam = screen.getByTestId(testId);
+ act(() => {
+ seam.dispatchEvent(
+ new MouseEvent("pointerdown", { clientY: fromY, bubbles: true }),
+ );
+ });
+ act(() => {
+ window.dispatchEvent(new MouseEvent("pointermove", { clientY: toY }));
+ });
+ act(() => {
+ window.dispatchEvent(new MouseEvent("pointerup"));
+ });
+ }
+
+ /** Is a toolbar control currently refusing clicks? */
+ function disabled(testId: string): boolean {
+ return (screen.getByTestId(testId) as HTMLButtonElement).disabled;
+ }
+
it("puts a grab handle on every boundary between panes", () => {
renderGrid(sessionWith([["Mika", 0], ["Nova", 0, 1], ["Aria", 1]]));
// One between the two columns, one between the panes stacked in the first.
@@ -1612,6 +1633,113 @@ describe("resizing the workspace", () => {
}
});
+ /*
+ * The toolbar's "even them out" button.
+ *
+ * The request it answers (2026-08-04): after an hour of dragging, a wall of
+ * terminals is five different widths and straightening it by hand means
+ * dragging every seam back one at a time. The one thing it must NEVER do is
+ * rearrange anything — which pane sits in which column, and which pane is
+ * stacked under which, is exactly what the user asked to keep.
+ */
+ it("evens every terminal out on one click", () => {
+ const restore = measured(1800, 900);
+ try {
+ renderGrid(
+ sessionWith([
+ ["Mika", 0],
+ ["Nova", 1],
+ ["Vega", 1, 1],
+ ["Aria", 2],
+ ]),
+ );
+ // Out of shape on BOTH axes: one column dragged wide, and the stack
+ // inside another column dragged so its two panes are unequal.
+ dragSeamBy("pane-seam-column:0:1", 600, 900);
+ dragSeamDownBy("pane-seam-pane:Nova:Vega", 450, 700);
+ expect(widthOf("Mika")).not.toBe(33.3);
+ expect(Math.round(box("Vega").height)).not.toBe(50);
+
+ fireEvent.click(screen.getByTestId("agentic-even-panes"));
+
+ // Every column the same width...
+ expect(widthOf("Mika")).toBe(33.3);
+ expect(widthOf("Nova")).toBe(33.3);
+ expect(widthOf("Aria")).toBe(33.3);
+ // ...and the two panes sharing a column splitting its height equally.
+ expect(box("Nova").height).toBeCloseTo(50, 3);
+ expect(box("Vega").height).toBeCloseTo(50, 3);
+ // Remembered, so the workspace comes back straight rather than snapping
+ // to the pre-click sizes on the next mount.
+ expect(stored()).toEqual({ columns: [], panes: {} });
+ } finally {
+ restore();
+ }
+ });
+
+ it("moves no pane while it evens the sizes out", () => {
+ const restore = measured(1800, 900);
+ try {
+ renderGrid(
+ sessionWith([
+ ["Mika", 0],
+ ["Nova", 1],
+ ["Vega", 1, 1],
+ ["Aria", 2],
+ ]),
+ );
+ dragSeamBy("pane-seam-column:0:1", 600, 900);
+
+ fireEvent.click(screen.getByTestId("agentic-even-panes"));
+
+ // Same left-to-right order as before, Vega still stacked under Nova in
+ // the middle column, and nothing pushed onto another line.
+ expect(box("Mika").left).toBe(0);
+ expect(box("Nova").left).toBeCloseTo(33.333, 2);
+ expect(box("Aria").left).toBeCloseTo(66.667, 2);
+ expect(box("Vega").left).toBe(box("Nova").left);
+ expect(box("Nova").top).toBe(0);
+ expect(box("Vega").top).toBeCloseTo(50, 3);
+ } finally {
+ restore();
+ }
+ });
+
+ it("offers nothing to press while the workspace is already even", () => {
+ // A live button that would change nothing is a button people press twice
+ // and then distrust.
+ const restore = measured(1000, 600);
+ try {
+ renderGrid(sessionWith([["Mika", 0], ["Nova", 1]]));
+ expect(disabled("agentic-even-panes")).toBe(true);
+
+ dragSeamBy("pane-seam-column:0:1", 500, 750);
+ expect(disabled("agentic-even-panes")).toBe(false);
+
+ fireEvent.click(screen.getByTestId("agentic-even-panes"));
+ expect(disabled("agentic-even-panes")).toBe(true);
+ } finally {
+ restore();
+ }
+ });
+
+ it("stands down while one pane covers the others", () => {
+ // A maximized workspace has no boundaries on screen, so evening them out
+ // would be a click with nothing to show for it.
+ const restore = measured(1000, 600);
+ try {
+ renderGrid(sessionWith([["Mika", 0], ["Nova", 1]]));
+ dragSeamBy("pane-seam-column:0:1", 500, 750);
+ fireEvent.click(screen.getByTestId("pane-maximize-Mika"));
+ expect(disabled("agentic-even-panes")).toBe(true);
+
+ fireEvent.click(screen.getByTestId("pane-maximize-Mika"));
+ expect(disabled("agentic-even-panes")).toBe(false);
+ } finally {
+ restore();
+ }
+ });
+
it("moves a seam from the keyboard, which is the only way back on a touchpad", () => {
const restore = measured(1000, 600);
try {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index 6bca020eaa..861b216898 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -12,6 +12,7 @@
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import * as Dialog from "@radix-ui/react-dialog";
import {
+ AlignHorizontalDistributeCenter,
AudioLines,
Brain,
Check,
@@ -47,6 +48,8 @@ import { PaneActivityPill } from "./PaneActivityPill";
import { AgentPickerMenu, offersAgentChoice, type SplitAgentChoice } from "./AgentPicker";
import type { TerminalAppearance } from "./terminalThemes";
import {
+ evenWeights,
+ isEvenLayout,
paneArrangement,
paneLayout,
panesFromArrangement,
@@ -1023,6 +1026,33 @@ export function AgenticGrid({
[session.terminals, sizes.weights],
);
+ /*
+ * "Even them out" — every terminal back to the same share of the window.
+ *
+ * A workspace drifts out of shape one drag at a time: a pane is widened to
+ * read a diff, another is squeezed to make room, and an hour later the wall
+ * is five different widths for no reason anyone remembers. Straightening it
+ * by hand means dragging every seam back and never quite landing on even.
+ *
+ * It resets the WEIGHTS and nothing else, which is the whole point: the
+ * arrangement — which column each terminal is in, which slot down that
+ * column — lives in `session.terminals` and only the backend may change it.
+ * So no pane is re-ordered, moved to another column or stacked under
+ * another one; the boundaries simply even out where they already are. The
+ * same act therefore covers every arrangement there is: columns side by
+ * side share the width equally, and panes stacked in one column share that
+ * column's height equally.
+ */
+ const evenPanes = useCallback(() => {
+ sizes.setWeights(evenWeights());
+ }, [sizes.setWeights]);
+
+ /** Would evening out change anything? Answers for the button's own state. */
+ const alreadyEven = useMemo(
+ () => isEvenLayout(session.terminals, sizes.weights),
+ [session.terminals, sizes.weights],
+ );
+
/*
* Which panes the current column weights are keyed to.
*
@@ -1780,6 +1810,33 @@ export function AgenticGrid({
)}
</button>
+ {/* Even out the sizes. Beside the grid/chat toggle because both are
+ about the SHAPE of the workspace rather than what is in it, and
+ before the appearance controls because it changes the panes
+ themselves, not how their text is drawn.
+
+ Off in chat view and while a pane is maximized: both hide the
+ boundaries this evens out, so the click would be a change nobody
+ can see — and a control whose effect is invisible reads as a dead
+ one. The tooltip says which of the reasons applies. */}
+ <button
+ type="button"
+ data-testid="agentic-even-panes"
+ onClick={evenPanes}
+ disabled={chatView || maximized !== null || alreadyEven}
+ title={
+ chatView || maximized !== null
+ ? t("agentic_grid.even.grid_only")
+ : alreadyEven
+ ? t("agentic_grid.even.already")
+ : t("agentic_grid.even.hint")
+ }
+ aria-label={t("agentic_grid.even.label")}
+ className={TOOLBAR_BTN}
+ >
+ <AlignHorizontalDistributeCenter className="h-4 w-4 shrink-0" />
+ </button>
+
{/* Appearance stays behind one quiet menu; text size is deliberately
exposed beside it. Somebody opening this workspace because the
terminal is too small must be able to find the remedy without
diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneLayout.test.ts b/jarvis/ui/web/frontend/src/components/agentic/paneLayout.test.ts
index 4abddd24fb..a5d03c4388 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/paneLayout.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/paneLayout.test.ts
@@ -3,6 +3,7 @@ import {
dragSeam,
evenSeam,
evenWeights,
+ isEvenLayout,
MIN_SEAM_PANE_PX,
paneArrangement,
paneLayout,
@@ -319,3 +320,34 @@ describe("sameArrangement", () => {
expect(sameArrangement({ A: 0, B: 1 }, { A: 0, C: 1 })).toBe(false);
});
});
+
+describe("isEvenLayout", () => {
+ const row = [pane("A", 0), pane("B", 1), pane("C", 2)];
+
+ it("calls an untouched workspace even", () => {
+ expect(isEvenLayout(row, evenWeights())).toBe(true);
+ });
+
+ it("reads equal weights as even whatever number they are written as", () => {
+ // The button asks "would this change anything on screen", not "are the
+ // stored numbers the defaults" — three columns at 7 are the same picture
+ // as three columns at 1.
+ expect(isEvenLayout(row, { ...evenWeights(), columns: [7, 7, 7] })).toBe(true);
+ });
+
+ it("spots a dragged column and a dragged stack alike", () => {
+ expect(isEvenLayout(row, { ...evenWeights(), columns: [2, 1, 1] })).toBe(false);
+ const stack = [pane("A", 0), pane("B", 0, 1)];
+ expect(isEvenLayout(stack, { ...evenWeights(), panes: { A: 3 } })).toBe(false);
+ });
+
+ it("ignores a weight belonging to a pane that is no longer open", () => {
+ // Closing a pane leaves its height weight behind until the next remap. It
+ // sizes nothing, so it must not keep the button lit for work it cannot do.
+ expect(isEvenLayout(row, { ...evenWeights(), panes: { Gone: 9 } })).toBe(true);
+ });
+
+ it("has no opinion about an empty workspace", () => {
+ expect(isEvenLayout([], evenWeights())).toBe(true);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneLayout.ts b/jarvis/ui/web/frontend/src/components/agentic/paneLayout.ts
index 05364be139..31694cecc3 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/paneLayout.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/paneLayout.ts
@@ -324,6 +324,44 @@ export function evenSeam(weights: PaneWeights, seam: PaneSeam): PaneWeights {
return writeSide(writeSide(weights, seam, seam.before, half), seam, seam.after, half);
}
+/**
+ * How close two fractions have to be before nobody could see the difference.
+ *
+ * A fraction of the workspace, so on a 4K monitor this is four thousandths of a
+ * pixel — far below anything a screen can draw, and loose enough that a seam
+ * dragged to visually-even (or the float noise a chain of drags leaves behind)
+ * counts as even rather than leaving the toolbar offering a button that would
+ * change nothing.
+ */
+const EVEN_EPSILON = 1e-4;
+
+/**
+ * Is every terminal already sharing its space equally with its siblings?
+ *
+ * Answered by comparing the layout the current weights produce against the one
+ * `evenWeights` produces, rather than by inspecting the weights themselves.
+ * That is the honest question — "would evening this out move anything on
+ * screen" — and it is the same answer for weights of `[1, 1]` and `[7, 7]`,
+ * which no comparison of the stored numbers alone would give.
+ */
+export function isEvenLayout<T extends Sized>(
+ panes: readonly T[],
+ weights: PaneWeights,
+): boolean {
+ const current = paneLayout(panes, weights);
+ const even = paneLayout(panes, evenWeights());
+ return current.boxes.every((box, index) => {
+ const target = even.boxes[index];
+ if (!target) return false;
+ return (
+ Math.abs(box.x - target.x) <= EVEN_EPSILON &&
+ Math.abs(box.y - target.y) <= EVEN_EPSILON &&
+ Math.abs(box.w - target.w) <= EVEN_EPSILON &&
+ Math.abs(box.h - target.h) <= EVEN_EPSILON
+ );
+ });
+}
+
// ------------------------------------------------------- splits and closes
/** Which column index each pane sits in, gaps closed, for a set of panes. */
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index a460cb26db..7e33c222c3 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -3730,6 +3730,12 @@
"starting": "Der Agent startet noch — er wird fortgesetzt, sobald er läuft.",
"result_queued": "{0} starten noch; sie machen weiter, sobald sie laufen: {1}."
},
+ "even": {
+ "label": "Terminal-Größen angleichen",
+ "hint": "Jedes Terminal bekommt dieselbe Größe. Nichts wird verschoben — die Grenzen gleichen sich dort an, wo sie schon sind.",
+ "already": "Alle Terminals haben bereits dieselbe Größe.",
+ "grid_only": "Größen gleichen sich im Terminal-Raster an — hier gibt es keine Grenzen zum Angleichen."
+ },
"arrange": {
"carrying": "auf ein Terminal ziehen",
"swap": "Mit {0} tauschen",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 7254afef35..5099ea5bab 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -3730,6 +3730,12 @@
"starting": "Its agent is still starting — it will be continued as soon as it is up.",
"result_queued": "{0} still starting; they carry on the moment they are up: {1}."
},
+ "even": {
+ "label": "Even out the terminal sizes",
+ "hint": "Give every terminal the same size. Nothing is moved — the boundaries even out where they already are.",
+ "already": "Every terminal already has the same size.",
+ "grid_only": "Sizes even out in the terminal grid — there are no boundaries to even here."
+ },
"arrange": {
"carrying": "drop it on a terminal",
"swap": "Swap with {0}",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 534b9ed348..3a69d43b9b 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -3730,6 +3730,12 @@
"starting": "Su agente todavía está arrancando: continuará en cuanto esté listo.",
"result_queued": "{0} aún arrancan; seguirán en cuanto estén listos: {1}."
},
+ "even": {
+ "label": "Igualar el tamaño de los terminales",
+ "hint": "Da a cada terminal el mismo tamaño. No se mueve nada: los bordes se igualan donde ya están.",
+ "already": "Todos los terminales ya tienen el mismo tamaño.",
+ "grid_only": "Los tamaños se igualan en la cuadrícula de terminales: aquí no hay bordes que igualar."
+ },
"arrange": {
"carrying": "suéltalo sobre un terminal",
"swap": "Intercambiar con {0}",