Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(canvas): resize from every edge with Liquid Glass on
Ara Babigianb4fca1b95b79
diff --git a/src/renderer/nodes/BrowserNode.tsx b/src/renderer/nodes/BrowserNode.tsxindex 3b5561170..89b4d5880 100644--- a/src/renderer/nodes/BrowserNode.tsx+++ b/src/renderer/nodes/BrowserNode.tsx@@ -24,8 +24,8 @@ export default function BrowserNode({ id, data, selected }: NodeProps<CanvasNodeconst ghost = data.ghost === truereturn (+ <><div className={`term-node browser-node${selected ? ' selected' : ''}`} style={{ borderTopColor: data.color }}>- <NodeResizer minWidth={NODE_MIN_SIZES.browser.width} minHeight={NODE_MIN_SIZES.browser.height} isVisible={selected} color={data.color} />{/* Invisible target handle so a rope from the agent node that opened this can attach. */}<Handleid="flow-in"@@ -75,5 +75,12 @@ export default function BrowserNode({ id, data, selected }: NodeProps<CanvasNode/></div></div>+ {/* Sibling of the root, not a child: under Liquid Glass the root has a backdrop-filter,+ which makes it the containing block for these absolute edges, so they were clipped and+ covered (only the top edge stayed grabbable). Out here they sit on the node wrapper.+ AFTER the root, never before it: focus mode reparents the root out of this wrapper, and+ React inserting a control "before the root" would then throw NotFoundError. */}+ <NodeResizer minWidth={NODE_MIN_SIZES.browser.width} minHeight={NODE_MIN_SIZES.browser.height} isVisible={selected} color={data.color} />+ </>)}diff --git a/src/renderer/nodes/DiffNode.tsx b/src/renderer/nodes/DiffNode.tsxindex 6aff2c7a9..c9c05eb30 100644--- a/src/renderer/nodes/DiffNode.tsx+++ b/src/renderer/nodes/DiffNode.tsx@@ -135,12 +135,11 @@ export function DiffNode({ id, data, selected }: NodeProps<CanvasNode>) {}, [])return (+ <><divclassName={`term-node editor-node${selected ? ' selected' : ''}`}style={{ borderTopColor: data.color }}>- <NodeResizer minWidth={NODE_MIN_SIZES.diff.width} minHeight={NODE_MIN_SIZES.diff.height} isVisible={selected} color={data.color} />-<div className="term-node__header"><span className="term-node__title-text" title={`${rel} — ${commitOid ? commitOid.slice(0, 7) : staged ? 'staged' : 'working'}`}>{rel.split('/').pop()}@@ -175,5 +174,12 @@ export function DiffNode({ id, data, selected }: NodeProps<CanvasNode>) {<div className="editor-node__body nodrag nowheel nokey" ref={bodyRef} />)}</div>+ {/* Sibling of the root, not a child: under Liquid Glass the root has a backdrop-filter,+ which makes it the containing block for these absolute edges, so they were clipped and+ covered (only the top edge stayed grabbable). Out here they sit on the node wrapper.+ AFTER the root, never before it: focus mode reparents the root out of this wrapper, and+ React inserting a control "before the root" would then throw NotFoundError. */}+ <NodeResizer minWidth={NODE_MIN_SIZES.diff.width} minHeight={NODE_MIN_SIZES.diff.height} isVisible={selected} color={data.color} />+ </>)}diff --git a/src/renderer/nodes/DinoNode.tsx b/src/renderer/nodes/DinoNode.tsxindex 4e948c451..bb4164b93 100644--- a/src/renderer/nodes/DinoNode.tsx+++ b/src/renderer/nodes/DinoNode.tsx@@ -94,9 +94,8 @@ export function DinoNode({ id, data, selected }: NodeProps<CanvasNode>) {}, [peer, myId])return (+ <><div className={`dino-node${selected ? ' selected' : ''}`} style={{ borderColor: data.color }}>- <NodeResizer minWidth={NODE_MIN_SIZES.dino.width} minHeight={NODE_MIN_SIZES.dino.height} isVisible={selected} color={data.color} />-<div className="dino-node__header" style={{ background: `${data.color}33` }}><span className="term-node__color" style={{ background: data.color }} /><input@@ -123,5 +122,12 @@ export function DinoNode({ id, data, selected }: NodeProps<CanvasNode>) {<div ref={hostRef} className="dino-node__body nodrag nowheel" tabIndex={0} /></div>+ {/* Sibling of the root, not a child: under Liquid Glass the root has a backdrop-filter,+ which makes it the containing block for these absolute edges, so they were clipped and+ covered (only the top edge stayed grabbable). Out here they sit on the node wrapper.+ AFTER the root, never before it: focus mode reparents the root out of this wrapper, and+ React inserting a control "before the root" would then throw NotFoundError. */}+ <NodeResizer minWidth={NODE_MIN_SIZES.dino.width} minHeight={NODE_MIN_SIZES.dino.height} isVisible={selected} color={data.color} />+ </>)}diff --git a/src/renderer/nodes/EditorNode.tsx b/src/renderer/nodes/EditorNode.tsxindex 5805e5281..e9a53ce96 100644--- a/src/renderer/nodes/EditorNode.tsx+++ b/src/renderer/nodes/EditorNode.tsx@@ -261,13 +261,13 @@ export function EditorNode({ id, data, selected }: NodeProps<CanvasNode>) {const mdChip = chipFor('node.toggleMarkdown')return (+ <><divclassName={`term-node editor-node${selected ? ' selected' : ''}`}style={{ borderTopColor: data.color }}onMouseEnter={() => (hoveredRef.current = true)}onMouseLeave={() => (hoveredRef.current = false)}>- <NodeResizer minWidth={NODE_MIN_SIZES.editor.width} minHeight={NODE_MIN_SIZES.editor.height} isVisible={selected} color={data.color} />{/* Invisible target handle so a rope from an agent node that opened this can attach. */}<Handleid="flow-in"@@ -374,5 +374,12 @@ export function EditorNode({ id, data, selected }: NodeProps<CanvasNode>) {)}</div></div>+ {/* Sibling of the root, not a child: under Liquid Glass the root has a backdrop-filter,+ which makes it the containing block for these absolute edges, so they were clipped and+ covered (only the top edge stayed grabbable). Out here they sit on the node wrapper.+ AFTER the root, never before it: focus mode reparents the root out of this wrapper, and+ React inserting a control "before the root" would then throw NotFoundError. */}+ <NodeResizer minWidth={NODE_MIN_SIZES.editor.width} minHeight={NODE_MIN_SIZES.editor.height} isVisible={selected} color={data.color} />+ </>)}diff --git a/src/renderer/nodes/FilesNode.tsx b/src/renderer/nodes/FilesNode.tsxindex 1bb1faaa0..d1c27be90 100644--- a/src/renderer/nodes/FilesNode.tsx+++ b/src/renderer/nodes/FilesNode.tsx@@ -439,14 +439,8 @@ export function FilesNode({ id, data, selected }: NodeProps<CanvasNode>) {const crumbs = useMemo(() => breadcrumbs(cwd), [cwd])return (+ <><div className={`files-node${selected ? ' selected' : ''}${collapsed ? ' collapsed' : ''}`}>- <NodeResizer- minWidth={NODE_MIN_SIZES.files.width}- minHeight={NODE_MIN_SIZES.files.height}- isVisible={selected && !collapsed}- color={data.color as string}- />-<div className="files-node__header" style={{ background: `${data.color}22` }}><button className="term-node__collapse" title={collapsed ? 'Expand' : 'Collapse'} onClick={toggleCollapse}>{collapsed ? '▸' : '▾'}@@ -616,5 +610,17 @@ export function FilesNode({ id, data, selected }: NodeProps<CanvasNode>) {<ContextMenu x={menu.x} y={menu.y} items={menu.items} onClose={() => setMenu(null)} />)}</div>+ {/* Sibling of the root, not a child: under Liquid Glass the root has a backdrop-filter,+ which makes it the containing block for these absolute edges, so they were clipped and+ covered (only the top edge stayed grabbable). Out here they sit on the node wrapper.+ AFTER the root, never before it: focus mode reparents the root out of this wrapper, and+ React inserting a control "before the root" would then throw NotFoundError. */}+ <NodeResizer+ minWidth={NODE_MIN_SIZES.files.width}+ minHeight={NODE_MIN_SIZES.files.height}+ isVisible={selected && !collapsed}+ color={data.color as string}+ />+ </>)}diff --git a/src/renderer/nodes/LoopNode.tsx b/src/renderer/nodes/LoopNode.tsxindex b61a149e8..f47419b0a 100644--- a/src/renderer/nodes/LoopNode.tsx+++ b/src/renderer/nodes/LoopNode.tsx@@ -54,8 +54,8 @@ export function LoopNode({ id, data, selected }: NodeProps<CanvasNode>) {const select = () => useAgentNodes.getState().select(id)return (+ <><div onPointerDownCapture={select} className={`loop-node${active ? ' working' : ''}`}>- <NodeResizer isVisible={selected} minWidth={NODE_MIN_SIZES.loop.width} minHeight={NODE_MIN_SIZES.loop.height} color="var(--state-automation)" /><Handle type="target" position={Position.Top} isConnectable={false} /><div className="loop-node__head nodrag" onClick={toggle} style={{ cursor: 'pointer' }}><button@@ -99,5 +99,12 @@ export function LoopNode({ id, data, selected }: NodeProps<CanvasNode>) {</div>)}</div>+ {/* Sibling of the root, not a child: under Liquid Glass the root has a backdrop-filter,+ which makes it the containing block for these absolute edges, so they were clipped and+ covered (only the top edge stayed grabbable). Out here they sit on the node wrapper.+ AFTER the root, never before it: focus mode reparents the root out of this wrapper, and+ React inserting a control "before the root" would then throw NotFoundError. */}+ <NodeResizer isVisible={selected} minWidth={NODE_MIN_SIZES.loop.width} minHeight={NODE_MIN_SIZES.loop.height} color="var(--state-automation)" />+ </>)}diff --git a/src/renderer/nodes/SubagentNode.tsx b/src/renderer/nodes/SubagentNode.tsxindex 19359640d..3fad5c4b8 100644--- a/src/renderer/nodes/SubagentNode.tsx+++ b/src/renderer/nodes/SubagentNode.tsx@@ -60,8 +60,8 @@ export function SubagentNode({ id, data, selected }: NodeProps<CanvasNode>) {const select = () => useAgentNodes.getState().select(id)return (+ <><div onPointerDownCapture={select} className={`subagent-node${working ? ' working' : ' done'}`}>- <NodeResizer isVisible={selected} minWidth={NODE_MIN_SIZES.subagent.width} minHeight={NODE_MIN_SIZES.subagent.height} color="#d97757" /><Handle type="target" position={Position.Top} isConnectable={false} /><div className="subagent-node__head nodrag" onClick={toggle} style={{ cursor: 'pointer' }}><button@@ -87,5 +87,12 @@ export function SubagentNode({ id, data, selected }: NodeProps<CanvasNode>) {</div>)}</div>+ {/* Sibling of the root, not a child: under Liquid Glass the root has a backdrop-filter,+ which makes it the containing block for these absolute edges, so they were clipped and+ covered (only the top edge stayed grabbable). Out here they sit on the node wrapper.+ AFTER the root, never before it: focus mode reparents the root out of this wrapper, and+ React inserting a control "before the root" would then throw NotFoundError. */}+ <NodeResizer isVisible={selected} minWidth={NODE_MIN_SIZES.subagent.width} minHeight={NODE_MIN_SIZES.subagent.height} color="#d97757" />+ </>)}diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsxindex 84ac94dce..cb436f21a 100644--- a/src/renderer/nodes/TerminalNode.tsx+++ b/src/renderer/nodes/TerminalNode.tsx@@ -5987,7 +5987,6 @@ export function TerminalNode({onMouseEnter={() => (hoveredRef.current = true)}onMouseLeave={() => (hoveredRef.current = false)}>- <NodeResizer minWidth={NODE_MIN_SIZES.terminal.width} minHeight={NODE_MIN_SIZES.terminal.height} isVisible={selected && !collapsed} color="#0a84ff" />{/* Invisible source handle so edges to subagent/loop nodes can attach. */}<Handleid="flow-out"@@ -6004,32 +6003,6 @@ export function TerminalNode({isConnectable={false}style={{ opacity: 0, pointerEvents: 'none', top: 0 }}/>- {/* Link handles (all terminal nodes): drag right→left to link. Between two context-capable- (Claude) nodes this shares context; from a sticky note it attaches the note as context.- Vertically centered on the side edges; raised above the body so they're never buried. */}- <Handle- id="link-out"- type="source"- position={Position.Right}- className="bridge-handle bridge-handle--out"- data-tip={- contextLinkCapable- ? "Link out — drag to another Claude node so they can read each other's context"- : 'Link out — drag to a sticky note to attach it as context'- }- />- <Handle- id="link-in"- type="target"- position={Position.Left}- className="bridge-handle bridge-handle--in"- data-tip={- contextLinkCapable- ? 'Link in — drop a link here to share context with this Claude session'- : 'Link in — drop a sticky note link here to attach it as context'- }- />-<div className="term-node__header"><Tooltip label={collapsed ? 'Expand' : 'Collapse'}><button@@ -6880,6 +6853,40 @@ export function TerminalNode({<NodeCommentsPanel id={id} /></div>)}+ {/* Link handles (all terminal nodes): drag right→left to link. Between two context-capable+ (Claude) nodes this shares context; from a sticky note it attaches the note as context.+ Vertically centered on the side edges; raised above the body so they're never buried.+ Siblings AFTER the root, like the resizer: inside a glass root (backdrop-filter = its own+ stacking context) their z-index only counted inside it, so the resize controls covered+ them and the outer half was clipped. */}+ <Handle+ id="link-out"+ type="source"+ position={Position.Right}+ className="bridge-handle bridge-handle--out"+ data-tip={+ contextLinkCapable+ ? "Link out — drag to another Claude node so they can read each other's context"+ : 'Link out — drag to a sticky note to attach it as context'+ }+ />+ <Handle+ id="link-in"+ type="target"+ position={Position.Left}+ className="bridge-handle bridge-handle--in"+ data-tip={+ contextLinkCapable+ ? 'Link in — drop a link here to share context with this Claude session'+ : 'Link in — drop a sticky note link here to attach it as context'+ }+ />+ {/* Sibling of the root, not a child: under Liquid Glass the root has a backdrop-filter,+ which makes it the containing block for these absolute edges, so they were clipped and+ covered (only the top edge stayed grabbable). Out here they sit on the node wrapper.+ AFTER the root, never before it: focus mode reparents the root out of this wrapper, and+ React inserting a control "before the root" would then throw NotFoundError. */}+ <NodeResizer minWidth={NODE_MIN_SIZES.terminal.width} minHeight={NODE_MIN_SIZES.terminal.height} isVisible={selected && !collapsed && !focused} color="#0a84ff" /></>)}diff --git a/src/renderer/nodes/TriggerNode.tsx b/src/renderer/nodes/TriggerNode.tsxindex 55f9f95a1..3bd8c0683 100644--- a/src/renderer/nodes/TriggerNode.tsx+++ b/src/renderer/nodes/TriggerNode.tsx@@ -200,13 +200,8 @@ export function TriggerNode({ id, data, selected }: NodeProps<CanvasNode>) {) : nullreturn (+ <><div className={`trigger-node${selected ? ' selected' : ''}`} style={{ borderColor: data.color }}>- <NodeResizer- minWidth={NODE_MIN_SIZES.trigger.width}- minHeight={NODE_MIN_SIZES.trigger.height}- isVisible={selected}- color={data.color}- /><div className="trigger-node__header" style={{ background: `${data.color}33` }}><span className="term-node__color" style={{ background: data.color }} /><input@@ -381,5 +376,17 @@ export function TriggerNode({ id, data, selected }: NodeProps<CanvasNode>) {/>)}</div>+ {/* Sibling of the root, not a child: under Liquid Glass the root has a backdrop-filter,+ which makes it the containing block for these absolute edges, so they were clipped and+ covered (only the top edge stayed grabbable). Out here they sit on the node wrapper.+ AFTER the root, never before it: focus mode reparents the root out of this wrapper, and+ React inserting a control "before the root" would then throw NotFoundError. */}+ <NodeResizer+ minWidth={NODE_MIN_SIZES.trigger.width}+ minHeight={NODE_MIN_SIZES.trigger.height}+ isVisible={selected}+ color={data.color}+ />+ </>)}diff --git a/src/renderer/nodes/VideoNode.tsx b/src/renderer/nodes/VideoNode.tsxindex f309de3c6..313b18729 100644--- a/src/renderer/nodes/VideoNode.tsx+++ b/src/renderer/nodes/VideoNode.tsx@@ -73,11 +73,11 @@ export default function VideoNode({ id, data, selected }: NodeProps<CanvasNode>)}, [filePath, remote])return (+ <><divclassName={`term-node video-node${selected ? ' selected' : ''}`}style={{ borderTopColor: data.color }}>- <NodeResizer minWidth={NODE_MIN_SIZES.video.width} minHeight={NODE_MIN_SIZES.video.height} isVisible={selected} color={data.color} />{/* Invisible target handle so a rope from the agent node that opened this can attach. */}<Handleid="flow-in"@@ -121,5 +121,12 @@ export default function VideoNode({ id, data, selected }: NodeProps<CanvasNode>)</div></div></div>+ {/* Sibling of the root, not a child: under Liquid Glass the root has a backdrop-filter,+ which makes it the containing block for these absolute edges, so they were clipped and+ covered (only the top edge stayed grabbable). Out here they sit on the node wrapper.+ AFTER the root, never before it: focus mode reparents the root out of this wrapper, and+ React inserting a control "before the root" would then throw NotFoundError. */}+ <NodeResizer minWidth={NODE_MIN_SIZES.video.width} minHeight={NODE_MIN_SIZES.video.height} isVisible={selected} color={data.color} />+ </>)}diff --git a/src/renderer/nodes/WebNode.tsx b/src/renderer/nodes/WebNode.tsxindex 8f5e8f83f..b07d72a8d 100644--- a/src/renderer/nodes/WebNode.tsx+++ b/src/renderer/nodes/WebNode.tsx@@ -166,12 +166,12 @@ export default function WebNode({ id, data, selected }: NodeProps<CanvasNode>) {})return (+ <><divref={rootRef}className={`term-node web-node${selected ? ' selected' : ''}`}style={{ borderTopColor: data.color }}>- <NodeResizer minWidth={NODE_MIN_SIZES.web.width} minHeight={NODE_MIN_SIZES.web.height} isVisible={selected} color={data.color} />{/* Invisible target handle so a rope from the agent node that opened this can attach. */}<Handleid="flow-in"@@ -247,5 +247,12 @@ export default function WebNode({ id, data, selected }: NodeProps<CanvasNode>) {</div></div></div>+ {/* Sibling of the root, not a child: under Liquid Glass the root has a backdrop-filter,+ which makes it the containing block for these absolute edges, so they were clipped and+ covered (only the top edge stayed grabbable). Out here they sit on the node wrapper.+ AFTER the root, never before it: focus mode reparents the root out of this wrapper, and+ React inserting a control "before the root" would then throw NotFoundError. */}+ <NodeResizer minWidth={NODE_MIN_SIZES.web.width} minHeight={NODE_MIN_SIZES.web.height} isVisible={selected} color={data.color} />+ </>)}diff --git a/src/renderer/nodes/node-resizer-placement.test.ts b/src/renderer/nodes/node-resizer-placement.test.tsnew file mode 100644index 000000000..b1eb3fa57--- /dev/null+++ b/src/renderer/nodes/node-resizer-placement.test.ts@@ -0,0 +1,100 @@+// @vitest-environment jsdom+//+// Under Liquid Glass these node roots carry a backdrop-filter (styles.css glass rules), and a+// backdrop-filter makes the element the containing block for its absolute descendants. A+// <NodeResizer> rendered INSIDE such a root therefore positioned its edges against the root+// instead of the React Flow node wrapper: the outer halves were clipped by the root's+// overflow:hidden and the right/bottom/left lines sat under the terminal's hover guard, so only+// the top edge (over the header) could be dragged. The resizer must be a sibling of the root —+// and AFTER it: focus mode reparents a terminal's root out of the node wrapper, and React+// inserting a sibling "before the root" while it is away throws NotFoundError (renderer crash).+// A real node render needs a React Flow store, a session and a pty, so the order is pinned in the+// source and the reparent hazard is reproduced with React and the same reparent primitive.+import { act, createElement as h, Fragment, useLayoutEffect, useRef } from 'react'+import { createRoot } from 'react-dom/client'+import { describe, it, expect } from 'vitest'+import fs from 'node:fs'+import path from 'node:path'++const read = (f: string): string =>+ fs.readFileSync(path.join(__dirname, f), 'utf8').replace(/\r\n/g, '\n')++// file -> the class its glass-filtered root opens with+const FILTERED_ROOTS: Record<string, string> = {+ 'TerminalNode.tsx': 'term-node${',+ 'EditorNode.tsx': 'term-node editor-node',+ 'DiffNode.tsx': 'term-node editor-node',+ 'BrowserNode.tsx': 'term-node browser-node',+ 'VideoNode.tsx': 'term-node video-node',+ 'WebNode.tsx': 'term-node web-node',+ 'FilesNode.tsx': 'files-node${',+ 'LoopNode.tsx': 'loop-node',+ 'SubagentNode.tsx': 'subagent-node',+ 'TriggerNode.tsx': 'trigger-node',+ 'DinoNode.tsx': 'dino-node'+}++/** Index of the root's closing tag: the last 4-space-indented `</div>` of the component's return. */+const rootClose = (src: string): number => src.lastIndexOf('\n </div>\n')++describe('NodeResizer sits outside, after, a backdrop-filtered node root', () => {+ it.each(Object.entries(FILTERED_ROOTS))('%s', (file, rootClass) => {+ const src = read(file)+ const root = src.indexOf(`className={\`${rootClass}`)+ const resizer = src.indexOf('<NodeResizer')+ expect(root).toBeGreaterThan(-1)+ expect(resizer).toBeGreaterThan(rootClose(src))+ })++ it('the terminal link dots sit outside, after, the root too', () => {+ const src = read('TerminalNode.tsx')+ for (const id of ['id="link-out"', 'id="link-in"']) expect(src.indexOf(id)).toBeGreaterThan(rootClose(src))+ })+})++describe('focus mode reparenting', () => {+ ;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true+ const Control = ({ visible }: { visible: boolean }) => (visible ? h('div', { className: 'ctl' }) : null)+ // The TerminalNode shape: a root moved into the focus surface by a layout effect (whose cleanup+ // appends it back), and a resize control whose visibility flips with focus and selection.+ const Node = ({ focused, after }: { focused: boolean; after: boolean }) => {+ const ref = useRef<HTMLDivElement>(null)+ useLayoutEffect(() => {+ if (!focused) return+ const root = ref.current!+ const home = root.parentElement!+ document.getElementById('surface')!.appendChild(root)+ return () => void home.appendChild(root)+ }, [focused])+ const ctl = h(Control, { key: 'c', visible: !focused })+ const root = h('div', { key: 'r', ref, className: 'root' })+ return h(Fragment, null, after ? [root, ctl] : [ctl, root])+ }+ const run = (after: boolean): unknown => {+ document.body.innerHTML = '<div id="wrap"></div><div id="surface"></div>'+ const r = createRoot(document.getElementById('wrap')!)+ act(() => r.render(h(Node, { focused: false, after })))+ act(() => r.render(h(Node, { focused: true, after })))+ try {+ act(() => r.render(h(Node, { focused: false, after })))+ return null+ } catch (e) {+ return e+ } finally {+ try {+ act(() => r.unmount())+ } catch {+ /* the broken tree may not unmount cleanly; the throw above is the finding */+ }+ }+ }++ it('a control rendered AFTER the root survives exiting focus mode while selected', () => {+ expect(run(true)).toBeNull()+ expect(document.querySelectorAll('.ctl').length).toBe(0) // unmounted cleanly+ })++ it('negative control: rendered BEFORE the root, the same exit throws', () => {+ expect((run(false) as Error | null)?.name).toBe('NotFoundError')+ })+})