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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
perf(agentic-ide): drag a pane boundary at frame rate, not through React
Ruben Lütke6d0d3e66df4e
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsxindex 777e4294da..cb195fcc25 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx@@ -13,6 +13,19 @@ if (typeof globalThis.ResizeObserver === "undefined") {globalThis.ResizeObserver = ResizeObserverPolyfill;}+/**+ * How often each pane has been rendered.+ *+ * A pane in the real grid is a live terminal with a header, a recap card and a+ * scrollbar, so "how often is it re-rendered" is not a detail — it is what+ * decides whether dragging a boundary runs at sixty frames a second or at+ * three. Counted here so the drag tests can pin it.+ *+ * Through `vi.hoisted` because `vi.mock` factories are lifted above ordinary+ * module code and would otherwise reach a `const` that does not exist yet.+ */+const { paneRenders } = vi.hoisted(() => ({ paneRenders: new Map<string, number>() }));+const pushToast = vi.fn();vi.mock("@/store/events", () => ({useEventStore: (selector: (s: Record<string, unknown>) => unknown) =>@@ -79,6 +92,7 @@ vi.mock("./AgenticTerminal", () => ({onClose,onArrangeStart,arranging,+ layoutBusy,}: {name: string;maximized?: boolean;@@ -93,7 +107,10 @@ vi.mock("./AgenticTerminal", () => ({onClose?: () => void;onArrangeStart?: (event: PointerEventLike) => void;arranging?: boolean;- }) => (+ layoutBusy?: boolean;+ }) => {+ paneRenders.set(name, (paneRenders.get(name) ?? 0) + 1);+ return (<divdata-testid={`pane-${name}`}data-maximized={maximized ? "yes" : "no"}@@ -105,6 +122,9 @@ vi.mock("./AgenticTerminal", () => ({// currently in hand — the real header draws both; here they are read.data-arrangeable={onArrangeStart ? "yes" : "no"}data-arranging={arranging ? "yes" : "no"}+ // The real pane stops refitting its terminal while this is on. Read here+ // because it is the grid's job to say WHEN the geometry is in motion.+ data-layout-busy={layoutBusy ? "yes" : "no"}>{name}{/* Stands for the pane header, which is the grip in the real component. */}@@ -142,7 +162,8 @@ vi.mock("./AgenticTerminal", () => ({restart</button></div>- ),+ );+ },PaneStatusPill: () => <span>live</span>,}));@@ -1267,6 +1288,141 @@ describe("resizing the workspace", () => {}});+ /** Begin a drag and leave the pointer down, so the gesture can be inspected. */+ function holdSeam(testId: string, fromX: number) {+ act(() => {+ screen+ .getByTestId(testId)+ .dispatchEvent(new MouseEvent("pointerdown", { clientX: fromX, bubbles: true }));+ });+ }++ /**+ * Let one animation frame pass.+ *+ * A drag paints on FRAMES, not on pointer events — that is the whole point of+ * it (see `usePaneWeights`), so a test that moves the pointer and looks+ * immediately would be reading the frame before the one it caused.+ */+ async function flushFrame() {+ await act(async () => {+ await new Promise((resolve) => requestAnimationFrame(() => resolve(null)));+ });+ }++ /*+ * The panes follow the pointer WHILE it is down.+ *+ * This is the difference between a boundary you drag and one that jumps when+ * you let go, and it has to survive the thing that makes it fast: the frames+ * of a drag are painted straight onto the elements, and state is written once+ * at the end. Nothing about that may be visible from the outside — so the+ * width is checked mid-gesture, before any commit could have happened.+ */+ it("moves the panes while the pointer is still down, not on release", async () => {+ const restore = measured(1000, 600);+ try {+ renderGrid(sessionWith([["Mika", 0], ["Nova", 1]]));+ holdSeam("pane-seam-column:0:1", 500);+ act(() => {+ window.dispatchEvent(new MouseEvent("pointermove", { clientX: 750 }));+ });+ await flushFrame();++ expect(widthOf("Mika")).toBe(75);+ // ...and the workspace has not been told yet: a drag that committed per+ // frame is what re-rendered every terminal on every pointer move.+ expect(stored().columns).toEqual([]);++ act(() => window.dispatchEvent(new MouseEvent("pointerup")));++ // The release keeps exactly what was on screen — no snap back to the+ // frame before it, and no second jump.+ expect(widthOf("Mika")).toBe(75);+ expect(stored().columns).toEqual([1.5, 0.5]);+ } finally {+ restore();+ }+ });++ /*+ * The frames of a drag do not re-render the terminals.+ *+ * This is the fix itself, stated as a test. A pane is a live terminal with a+ * header, a recap card and a scrollbar; re-rendering a dozen of them on every+ * pointer move is what dropped the gesture to a few frames a second, and it+ * fed back — each render resized every pane's box, which woke each pane's own+ * observer, which refitted the terminal and made the agent behind it redraw.+ * So the boxes are painted directly and React is told once, at the end.+ */+ it("does not re-render the terminals for the frames of a drag", async () => {+ const restore = measured(1000, 600);+ try {+ renderGrid(sessionWith([["Mika", 0], ["Nova", 1]]));+ // Let the mount-time recap poll land first — its answer re-renders every+ // pane once, and counting that as a frame of the drag would be measuring+ // the test's own setup.+ await flushFrame();+ holdSeam("pane-seam-column:0:1", 500);+ const before = paneRenders.get("Mika") ?? 0;++ for (const x of [560, 620, 680, 750]) {+ act(() => window.dispatchEvent(new MouseEvent("pointermove", { clientX: x })));+ await flushFrame();+ }++ // Four frames of movement, visible on screen...+ expect(widthOf("Mika")).toBe(75);+ // ...and not one render of the pane behind it.+ expect(paneRenders.get("Mika")).toBe(before);++ act(() => window.dispatchEvent(new MouseEvent("pointerup")));+ // Letting go is what costs renders: the sizes go into state and the panes+ // are told the workspace has stopped moving. A couple of commits for the+ // whole gesture, rather than one per frame — that is the difference.+ expect(paneRenders.get("Mika")).toBeLessThanOrEqual(before + 2);+ } finally {+ restore();+ }+ });++ /*+ * A pane whose size is mid-gesture does not resize its terminal.+ *+ * Refitting means telling the agent behind the pane to redraw its whole+ * screen, and during a drag that answer is stale before it arrives — sixty+ * times a second, on the thread drawing the drag.+ */+ it("tells the panes to hold still while a seam is moving, and to catch up after", () => {+ const restore = measured(1000, 600);+ try {+ renderGrid(sessionWith([["Mika", 0], ["Nova", 1]]));+ const busy = () => screen.getByTestId("pane-Mika").getAttribute("data-layout-busy");+ expect(busy()).toBe("no");++ holdSeam("pane-seam-column:0:1", 500);+ expect(busy()).toBe("yes");++ act(() => window.dispatchEvent(new MouseEvent("pointerup")));+ expect(busy()).toBe("no");+ } finally {+ restore();+ }+ });++ /* The prompt bar changes every pane's height, so it counts as the same kind+ of motion — a pane must not refit for each frame of that drag either. */+ it("counts a prompt-bar drag as the workspace moving too", () => {+ renderGrid(sessionWith([["Mika", 0], ["Nova", 1]]));+ const busy = () => screen.getByTestId("pane-Mika").getAttribute("data-layout-busy");++ fireEvent.pointerDown(screen.getByTestId("pane-resizer-horizontal"), { clientY: 700 });+ expect(busy()).toBe("yes");++ act(() => window.dispatchEvent(new MouseEvent("pointerup")));+ expect(busy()).toBe("no");+ });+it("remembers the sizes so a restart brings the workspace back as it was", () => {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.tsxindex ff7506743a..a19554e908 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -672,6 +672,62 @@ export function AgenticGrid({* machine is the same arrangement at that machine's own sizes.*/const canvasRef = useRef<HTMLDivElement | null>(null);++ /*+ * The panes and seams as ELEMENTS, so a drag can move them itself.+ *+ * A drag re-lays the workspace out sixty times a second, and doing that+ * through React means re-rendering every terminal in it that often — which is+ * what made dragging a seam in a full workspace run at a few frames a second+ * (see `usePaneWeights`). With the nodes in hand a frame costs one layout+ * computation and a handful of style writes.+ *+ * The ref callbacks are memoised per pane and per seam for the reason+ * `usePaneArrange` memoises its own: a fresh closure each render makes React+ * detach and re-attach every node, so a drag could lose the element it is+ * halfway through moving.+ */+ const paneNodes = useRef(new Map<string, HTMLElement>());+ const seamNodes = useRef(new Map<string, HTMLElement>());+ const paneRefs = useRef(new Map<string, (element: HTMLElement | null) => void>());+ const seamRefs = useRef(new Map<string, (element: HTMLDivElement | null) => void>());++ const registerSeam = useCallback((id: string) => {+ const existing = seamRefs.current.get(id);+ if (existing) return existing;+ const callback = (element: HTMLDivElement | null) => {+ if (element) seamNodes.current.set(id, element);+ else seamNodes.current.delete(id);+ };+ seamRefs.current.set(id, callback);+ return callback;+ }, []);++ /**+ * Put every pane and seam where ``next`` says, without telling React.+ *+ * Used for the frames of a drag only. The last frame of a gesture writes the+ * same numbers that are then committed to state, so React's next render+ * agrees with what is already on screen and nothing flickers on release.+ */+ const paintDraggedLayout = useCallback(+ (next: PaneWeights) => {+ const live = paneLayout(session.terminals, perBand, next);+ session.terminals.forEach((term, index) => {+ const node = paneNodes.current.get(term.name);+ const box = live.boxes[index];+ // A pane with no box of its own is a maximized workspace, and a+ // maximized workspace has no seams to drag in the first place.+ if (node && box) writePosition(node, paneBoxStyle(box));+ });+ for (const seam of live.seams) {+ const node = seamNodes.current.get(seam.id);+ if (node) writePosition(node, seamStyle(seam));+ }+ },+ [session.terminals, perBand],+ );+const sizes = usePaneWeights(session.id,useCallback(@@ -681,12 +737,52 @@ export function AgenticGrid({}),[gridWidth, gridHeight],),+ paintDraggedLayout,);const layout = useMemo(() => paneLayout(session.terminals, perBand, sizes.weights),[session.terminals, perBand, sizes.weights],);+ /*+ * Hold the dragged sizes against anything else that renders mid-gesture.+ *+ * A drag deliberately leaves state alone until the pointer is released, so+ * any OTHER render in that window — the five-second recap poll, a pane+ * reporting that it went live — would repaint every box at the sizes the+ * workspace had when the drag started, and the panes would jump back under+ * the cursor. Re-applying the in-flight layout right after such a commit is+ * what keeps that from being visible.+ *+ * Deliberately without a dependency list, and deliberately cheap: outside a+ * drag it is one null check per commit and nothing else. It must not MEASURE+ * anything here — reading geometry in a commit is what forces the browser to+ * recompute the whole grid, which is half of what this change removes.+ */+ useLayoutEffect(() => {+ if (sizes.dragging === null) return;+ const inFlight = sizes.liveWeights.current;+ if (inFlight) paintDraggedLayout(inFlight);+ });++ /*+ * Is the workspace's own geometry in motion right now?+ *+ * The panes are told, and the reason is the second half of the resize+ * problem. A pane that notices it has changed size refits its terminal and+ * announces the new size to the agent behind it, which redraws its entire+ * screen in response. During a drag that is the wrong trade twice over: the+ * agent's redraw lands on the same thread that owes the user the next frame,+ * and it is thrown away by the next pixel of movement anyway. So the panes+ * hold still while the seam moves and take their new size in one pass when it+ * stops — which is also when the terminal's contents stop lagging behind the+ * frame around them.+ *+ * The prompt bar counts: dragging it changes the height of every pane above+ * it just as a seam does.+ */+ const layoutBusy = sizes.dragging !== null || composer.isResizing;+/** How tall the workspace is drawn, which is not always how tall it looks.*@@ -785,6 +881,31 @@ export function AgenticGrid({),);+ /**+ * One ref per pane cell, serving both things that need the element.+ *+ * Rearranging measures it as a drop target, resizing moves it; they are+ * separate gestures over the same node, and an element carries one ref. The+ * callback is memoised per pane so neither of them can be handed a node that+ * React detached and re-attached in between (see `usePaneArrange`).+ */+ const { registerCell } = arrange;+ const registerPaneCell = useCallback(+ (name: string) => {+ const existing = paneRefs.current.get(name);+ if (existing) return existing;+ const asDropTarget = registerCell(name);+ const callback = (element: HTMLElement | null) => {+ if (element) paneNodes.current.set(name, element);+ else paneNodes.current.delete(name);+ asDropTarget(element);+ };+ paneRefs.current.set(name, callback);+ return callback;+ },+ [registerCell],+ );+/** When a pane may be picked up at all.*@@ -1275,7 +1396,7 @@ export function AgenticGrid({return (<divkey={term.key}- ref={arrange.registerCell(term.name)}+ ref={registerPaneCell(term.name)}data-testid={`pane-cell-${term.name}`}className={cn("absolute min-h-0 min-w-0 rounded-lg",@@ -1320,6 +1441,7 @@ export function AgenticGrid({fontSize={fontSize}focused={target === term.name}maximized={isMaximized}+ layoutBusy={layoutBusy}splitDisabled={atLimit || busy || working}agents={agents}onFocus={() => {@@ -1444,6 +1566,7 @@ export function AgenticGrid({layout.seams.map((seam) => (<PaneResizerkey={seam.id}+ ref={registerSeam(seam.id)}testId={`pane-seam-${seam.id}`}orientation={seam.orientation}title={seam.label}diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsxindex 7a3e20778f..5a397e7f39 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx@@ -206,6 +206,18 @@ interface AgenticTerminalProps {onArrangeStart?: (event: React.PointerEvent) => void;/** True while THIS pane is the one being carried — it is drawn as lifted. */arranging?: boolean;+ /**+ * True while the workspace's geometry is actively being dragged.+ *+ * The pane then stops refitting itself: a fit reflows xterm's buffer AND+ * tells the agent its new size, and an agent answers that by redrawing its+ * whole screen. Sixty of those a second, across every pane a seam touches, is+ * what turned dragging a boundary into a slideshow — and every one of them is+ * discarded by the next pixel of movement. The size is taken in a single pass+ * the moment this goes false, which is also what stops the terminal's+ * contents from trailing the frame around them for longer than they must.+ */+ layoutBusy?: boolean;/*** Bump to reconnect this pane.*@@ -241,6 +253,7 @@ export function AgenticTerminal({restartToken = 0,onArrangeStart,arranging = false,+ layoutBusy = false,}: AgenticTerminalProps) {const containerRef = useRef<HTMLDivElement | null>(null);// The padded box around the xterm host. The pane's scrollbar overlays it and@@ -269,9 +282,13 @@ export function AgenticTerminal({// when it asks. Read at connect time, hence a ref rather than the prop: the// connect effect must not re-run when the user flips the theme.const appearanceRef = useRef(appearance);+ // Read by the connect effect's resize scheduler, which is built once and+ // therefore cannot see the prop change.+ const layoutBusyRef = useRef(layoutBusy);onStatusRef.current = onStatus;onAttachErrorRef.current = onAttachError;appearanceRef.current = appearance;+ layoutBusyRef.current = layoutBusy;useEffect(() => {const container = containerRef.current;@@ -568,6 +585,11 @@ export function AgenticTerminal({// flicker while resizing.let resizeTimer: number | undefined;const scheduleResize = () => {+ // Nothing at all while a seam or the prompt bar is being dragged: the+ // pane is mid-gesture, every size it could measure is about to be+ // replaced, and the fit would cost the frame the drag needs. The pane is+ // refitted from the `layoutBusy` effect the moment the drag ends.+ if (layoutBusyRef.current) return;if (resizeTimer !== undefined) window.clearTimeout(resizeTimer);resizeTimer = window.setTimeout(() => {resizeTimer = undefined;@@ -682,6 +704,26 @@ export function AgenticTerminal({};}, [maximized]);+ /*+ * Catch up the instant a drag lets go.+ *+ * While `layoutBusy` is true the pane deliberately ignores its own+ * ResizeObserver (see the prop), so this is where the size it ended up with+ * is finally taken. Immediately rather than through the observer's 80 ms+ * coalescing window: this is exactly the moment where the terminal's contents+ * still occupy the shape the pane had BEFORE the drag — the strip of empty+ * ground under the agent's last line — and every millisecond of it is+ * visible. The second pass one frame later is for the layout that settles+ * after the release (a scrollbar appearing, the prompt bar reflowing); a fit+ * that lands on the size the terminal already has sends nothing at all.+ */+ useEffect(() => {+ if (layoutBusy) return;+ resizeRef.current?.();+ const frame = requestAnimationFrame(() => resizeRef.current?.());+ return () => cancelAnimationFrame(frame);+ }, [layoutBusy]);+/** Drag a file onto the pane, or paste a screenshot into it.*@@ -811,6 +853,10 @@ export function AgenticTerminal({<divref={containerRef}data-testid={`agentic-terminal-host-${name}`}+ // Read by ./index.css, which anchors the contents to the bottom for+ // the length of a drag — see the rule there for why that is the side+ // the unused ground belongs on.+ data-layout-busy={layoutBusy ? "true" : "false"}className="agentic-terminal-host h-full min-h-0 w-full overflow-hidden"/>{/* Overlaid rather than laid out, and deliberately not the browser'sdiff --git a/jarvis/ui/web/frontend/src/components/agentic/PaneScrollbar.tsx b/jarvis/ui/web/frontend/src/components/agentic/PaneScrollbar.tsxindex 8ad5679a9a..522d151ec7 100644--- a/jarvis/ui/web/frontend/src/components/agentic/PaneScrollbar.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/PaneScrollbar.tsx@@ -35,13 +35,7 @@* scrolled there was nothing measured to draw. See `probeAppHistory` in* ./paneAppScroll — the gesture asks the question now.*/-import {- useCallback,- useEffect,- useLayoutEffect,- useRef,- useState,-} from "react";+import { useCallback, useEffect, useRef, useState } from "react";import type { Terminal } from "@xterm/xterm";import { cn } from "@/lib/utils";import type { TerminalAppearance } from "./terminalThemes";@@ -366,32 +360,57 @@ export function PaneScrollbar({setState((current) => (sameState(current, next) ? current : next));}, [position, getTerminal, epoch]);- // The track's height decides the thumb's, and it is only knowable once the- // track is in the document. Measured on every commit rather than from the- // metrics effect above, because a pane whose agent is idle emits no render- // events at all — and a bar that waited for one would come up thumbless.- //- // The bar's distance from the pane edge is read in the same pass: one layout- // flush covers both, and taking it from the live boxes is what keeps it correct- // when the region's padding changes.- useLayoutEffect(() => {+ /*+ * The track's height decides the thumb's, and the bar's distance from the+ * pane edge decides where it sits. Both are geometry, so both are MEASURED —+ * and both are measured when the boxes actually change rather than after+ * every render.+ *+ * That distinction is the whole point of this effect. It used to run on every+ * commit, and reading a box in a commit forces the browser to recompute the+ * layout there and then — for each pane, on a thread that has just resized+ * all of them. With a dozen panes and a seam being dragged, those forced+ * recomputations were the single most expensive thing in the frame, and the+ * measured height changing then fed a second render per pane on top. A+ * ResizeObserver answers the same question from outside the render, only when+ * there is a new answer.+ *+ * `state.mode` is in the dependencies because the track is in the document+ * only while there is something to scroll — the observer has to be attached+ * to the element that exists now.+ */+ useEffect(() => {const track = trackRef.current;if (!track) return;- const height = track.clientHeight;- setTrackPx((current) => (current === height ? current : height));- const region = regionRef.current;- const host = hostRef.current;- if (!region || !host) return;- const gap = Math.max(- 0,- Math.round(- region.getBoundingClientRect().right -- host.getBoundingClientRect().right,- ),- );- setHostGap((current) => (current === gap ? current : gap));- });+ const measure = () => {+ const height = track.clientHeight;+ setTrackPx((current) => (current === height ? current : height));++ const region = regionRef.current;+ const host = hostRef.current;+ if (!region || !host) return;+ const gap = Math.max(+ 0,+ Math.round(+ region.getBoundingClientRect().right -+ host.getBoundingClientRect().right,+ ),+ );+ setHostGap((current) => (current === gap ? current : gap));+ };++ measure();+ // No observer in this environment (older engines, some test setups): the+ // one measurement above still gives the bar a thumb, which is the+ // behaviour that matters.+ if (typeof ResizeObserver === "undefined") return;+ const observer = new ResizeObserver(measure);+ observer.observe(track);+ if (regionRef.current) observer.observe(regionRef.current);+ if (hostRef.current) observer.observe(hostRef.current);+ return () => observer.disconnect();+ }, [state.mode, regionRef, hostRef]);// ------------------------------------------------------------------ inputconst relay = useCallback(diff --git a/jarvis/ui/web/frontend/src/hooks/useResizablePane.test.ts b/jarvis/ui/web/frontend/src/hooks/useResizablePane.test.tsindex fe0868d520..45f5dfa5d7 100644--- a/jarvis/ui/web/frontend/src/hooks/useResizablePane.test.ts+++ b/jarvis/ui/web/frontend/src/hooks/useResizablePane.test.ts@@ -124,6 +124,38 @@ describe("useResizablePane", () => {expect(result.current.size).toBe(34);});+ /*+ * A burst of pointer moves costs ONE size change, not one each.+ *+ * This size is a layout — in the Agentic IDE it sets the height of every+ * terminal above the prompt bar — and a pointer emits far more moves than+ * there are frames to draw them in. So the moves are coalesced and the last+ * one wins, which is what the size standing still until the frame arrives+ * shows here.+ */+ it("coalesces a burst of pointer moves into one size change per frame", async () => {+ const { result } = renderHook(() => useResizablePane(opts));+ act(() => {+ result.current.startResize({+ clientX: 260,+ clientY: 0,+ preventDefault: () => {},+ } as unknown as React.PointerEvent);+ });++ act(() => {+ for (const x of [300, 320, 340]) {+ window.dispatchEvent(new MouseEvent("pointermove", { clientX: x }));+ }+ });+ expect(result.current.size).toBe(260);++ await act(async () => {+ await new Promise((resolve) => requestAnimationFrame(() => resolve(null)));+ });+ expect(result.current.size).toBe(340);+ });+it("nudge() moves the seam by whole pixels and stays inside the band", () => {const { result } = renderHook(() => useResizablePane(opts));act(() => result.current.nudge(16));diff --git a/jarvis/ui/web/frontend/src/hooks/useResizablePane.ts b/jarvis/ui/web/frontend/src/hooks/useResizablePane.tsindex 8896926d57..97d8dfed88 100644--- a/jarvis/ui/web/frontend/src/hooks/useResizablePane.ts+++ b/jarvis/ui/web/frontend/src/hooks/useResizablePane.ts@@ -117,12 +117,38 @@ export function useResizablePane({useEffect(() => {if (!isResizing) return;- const onMove = (e: PointerEvent) => {- const travelled = (axis === "x" ? e.clientX : e.clientY) - startPoint.current;+ /*+ * One size change per FRAME, not one per pointer event.+ *+ * A pointer emits up to 120 moves a second and this size is a layout: in+ * the Agentic IDE it decides the height of every terminal above the prompt+ * bar, so an unthrottled drag re-laid out the whole workspace twice per+ * frame and then threw the first one away. The pointer's latest position is+ * kept and read when the frame comes.+ */+ let frame: number | undefined;+ let point = startPoint.current;++ const apply = () => {+ frame = undefined;+ const travelled = point - startPoint.current;const grown = handle === "end" ? travelled : -travelled;setSize(clampSize(startSize.current + grown, min, max));};- const onUp = () => setIsResizing(false);++ const onMove = (e: PointerEvent) => {+ point = axis === "x" ? e.clientX : e.clientY;+ if (frame === undefined) frame = requestAnimationFrame(apply);+ };+ const onUp = () => {+ // Land the last move before the drag is declared over, so the settled+ // size — the one that gets persisted — is the one under the pointer.+ if (frame !== undefined) {+ cancelAnimationFrame(frame);+ apply();+ }+ setIsResizing(false);+ };window.addEventListener("pointermove", onMove);window.addEventListener("pointerup", onUp);@@ -133,6 +159,7 @@ export function useResizablePane({document.body.style.userSelect = "none";return () => {+ if (frame !== undefined) cancelAnimationFrame(frame);window.removeEventListener("pointermove", onMove);window.removeEventListener("pointerup", onUp);document.body.style.cursor = prevCursor;diff --git a/jarvis/ui/web/frontend/src/index.css b/jarvis/ui/web/frontend/src/index.cssindex c7fed5d020..ec9da52c77 100644--- a/jarvis/ui/web/frontend/src/index.css+++ b/jarvis/ui/web/frontend/src/index.css@@ -84,6 +84,31 @@height: 0;}+/* While a boundary is being dragged, the terminal inside a pane keeps the size+ it had — a terminal is a grid of whole character cells, and re-cutting that+ grid means telling the agent to redraw its entire screen, which is far too+ expensive to do per frame (see AgenticTerminal's `layoutBusy`). So for the+ length of the gesture the pane is a frame around contents of the old size,+ and the only question is where the difference shows.++ Anchoring the contents to the BOTTOM is what makes it look right: an agent+ draws its input box at the bottom of its screen, so the strip of unused+ ground ends up above the output instead of below the input — a terminal with+ room over it reads as normal, one with its prompt floating in the middle+ reads as broken. That was the reported symptom. Dragging the other way trims+ the oldest rows off the top, which is the direction a terminal grows anyway.++ Only during the drag: the moment it ends the pane refits and the contents+ fill the frame again. */+.agentic-terminal-host[data-layout-busy="true"] {+ display: flex;+ align-items: flex-end;+}++.agentic-terminal-host[data-layout-busy="true"] > .xterm {+ width: 100%;+}+@layer base {:root {/* Jarvis — Schwarz/Gelb Theme (matte, signal-yellow) */