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(agentic): link stacked seams up to 24 px apart and cover the grab zones

rubenluetke10-beep6f37edcb3ea1
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 67b95dfa5b..1ab4b197a8 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
@@ -1381,6 +1381,102 @@ describe("resizing the workspace", () => {
* rearrange anything — which pane sits in which column, and which pane is
* stacked under which, is exactly what the user asked to keep.
*/
+ /*
+ * Sideways drags depend on WHERE the seam is held: near the middle of a
+ * pane's height they move that one boundary, near its top or bottom end
+ * they move the aligned boundary of every pane stacked under it as well.
+ */
+ describe("a vertical seam held at its end", () => {
+ const twoRows: LayoutNode = {
+ direction: "column",
+ children: [
+ { direction: "row", children: [{ pane: "mika" }, { pane: "nova" }], weights: [1, 1] },
+ { direction: "row", children: [{ pane: "vega" }, { pane: "aria" }], weights: [1, 1] },
+ ],
+ weights: [1, 1],
+ };
+ const panes: Array<[string, number]> = [
+ ["Mika", 0],
+ ["Nova", 1],
+ ["Vega", 0],
+ ["Aria", 1],
+ ];
+
+ /** jsdom lays nothing out, so the top seam is given a 300 px tall box. */
+ function topSeam(): HTMLElement {
+ const seam = screen.getByTestId("pane-seam-0:1");
+ vi.spyOn(seam, "getBoundingClientRect").mockReturnValue({
+ top: 0,
+ height: 300,
+ left: 498,
+ width: 4,
+ } as DOMRect);
+ return seam;
+ }
+
+ function dragTopSeam(atY: number, fromX: number, toX: number) {
+ const seam = topSeam();
+ act(() => {
+ seam.dispatchEvent(
+ new MouseEvent("pointerdown", { clientX: fromX, clientY: atY, bubbles: true }),
+ );
+ });
+ act(() => {
+ window.dispatchEvent(new MouseEvent("pointermove", { clientX: toX }));
+ });
+ act(() => {
+ window.dispatchEvent(new MouseEvent("pointerup"));
+ });
+ }
+
+ it("moves only its own boundary when held in the middle", () => {
+ const restore = measured(1000, 600);
+ try {
+ renderGrid(sessionWith(panes, twoRows));
+ dragTopSeam(150, 500, 600);
+ expect(widthOf("Mika")).toBe(60);
+ expect(widthOf("Vega")).toBe(50);
+ } finally {
+ restore();
+ }
+ });
+
+ it("moves the whole stack when held near its bottom end", () => {
+ const restore = measured(1000, 600);
+ try {
+ renderGrid(sessionWith(panes, twoRows));
+ dragTopSeam(280, 500, 600);
+ expect(widthOf("Mika")).toBe(60);
+ expect(widthOf("Vega")).toBe(60);
+ } finally {
+ restore();
+ }
+ });
+
+ it("lights the seams that would follow before the press", () => {
+ const restore = measured(1000, 600);
+ try {
+ renderGrid(sessionWith(panes, twoRows));
+ const seam = topSeam();
+ const below = screen.getByTestId("pane-seam-1:1");
+ act(() => {
+ seam.dispatchEvent(
+ new MouseEvent("pointermove", { clientX: 500, clientY: 20, bubbles: true }),
+ );
+ });
+ expect(below.getAttribute("data-linked")).toBe("true");
+ act(() => {
+ seam.dispatchEvent(
+ new MouseEvent("pointermove", { clientX: 500, clientY: 150, bubbles: true }),
+ );
+ });
+ expect(below.getAttribute("data-linked")).toBeNull();
+ } finally {
+ restore();
+ }
+ });
+ });
+
it("evens every terminal out on one click", async () => {
const restore = measured(1800, 900);
try {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/treeLayout.ts b/jarvis/ui/web/frontend/src/components/agentic/treeLayout.ts
index 5deb2a8dd9..169c90309c 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/treeLayout.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/treeLayout.ts
@@ -312,8 +312,14 @@ export function treeSeams(root: LayoutNode): PaneSeam[] {
*/
export const SEAM_END_ZONE = 0.3;
-/** How far apart two stacked seams may be and still count as one line. */
-export const SEAM_LINK_TOLERANCE_PX = 8;
+/**
+ * How far apart two stacked seams may be and still count as one line.
+ *
+ * Generous on purpose: rows dragged separately rarely line up to the pixel
+ * (the first live workspace checked sat 9 px apart), and a line that sits
+ * within this much reads as "the same boundary" — the drag straightens it.
+ */
+export const SEAM_LINK_TOLERANCE_PX = 24;
/** Do two seam ends touch? Both come from the same cursor sums. */
const EDGE_EPSILON = 1e-6;