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
feat(canvas): edges anchor on side midpoints; context links on the bridge handles
enes087ebc2d5cc8
diff --git a/CLAUDE.md b/CLAUDE.mdindex 0c4323eb9..9e4530ed0 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -1624,8 +1624,10 @@ else, and its context links must keep classifying across restarts).node that has none at **project load**: `pendingLaunch` is persisted and the rope is not, so a nodearmed by any other path — or by a build older than this one — would otherwise hold a launch withno arrow saying what for. All edges route through the single `floating` edge type- (`canvas/FloatingEdge.tsx`, a bezier between the nearest borders of the two node rectangles; an- unmeasured node draws nothing rather than a path to the origin) — no family sets a handle side;+ (`canvas/FloatingEdge.tsx`, a bezier between the MIDPOINTS of the two nodes' facing sides — one+ anchor per side, so a hub's arrows converge instead of fanning along its border; context and note+ links are restricted to the left/right sides, where the bridge handles sit; an unmeasured node+ draws nothing rather than a path to the origin) — no family sets a handle side;and a node whose eye is closed (`hideFanout`) hides every edge touching it as well as its cards(2026-09-02 edge model, spec in docs/superpowers/specs).**(7) Delivery waits for the node's PTY, and never fails silently** (issue #569 item 1, 2026-09).@@ -2440,9 +2442,12 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord mea- **Add menu** = bottom dock (`Dock.tsx`) `+`, mirrored by the pane menu and command palette.- **Edges** are all one React Flow type, `floating` (`canvas/FloatingEdge.tsx` over the pure`lib/floatingEdge.ts`): every family — ropes, context bridges, note links, subagent/loop card- edges, trigger edges — is drawn between the two nodes' nearest borders instead of fixed handle- sides, so an edge to a node placed left of or above its source takes the short way round rather- than looping across the canvas. A terminal node's **eye** (`hide-fanout`, "Hide cards &+ edges, trigger edges — is drawn between the midpoints of the two nodes' facing sides instead of+ fixed handle sides, so an edge to a node placed left of or above its source takes the short way+ round rather than looping across the canvas, and every edge using a side meets the node at ONE+ point (2026-09-03: enes's first try showed a hub with entries fanned along its whole top edge).+ Context and note links are the exception in one respect: they anchor only on the left/right+ sides (`data.anchor: 'horizontal'`), where the `link-out`/`link-in` drag handles are drawn. A terminal node's **eye** (`hide-fanout`, "Hide cards &connections") hides its subagent/loop cards AND every edge touching that node — display only:the links still authorise reads and an `--after` still waits. See the `--after` bullet underCanvas control for the rope model the eye hides.diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 9c7c99bf0..b77cca41e 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -1972,6 +1972,9 @@ export function Canvas() {return {...e,type: 'floating',+ // Context and note links meet the node at its bridge handles (left/right dots) — the point+ // the user dragged from — never at the top or bottom.+ data: { anchor: 'horizontal' },label: sel ? `${baseLabel} — ⌫ to remove` : baseLabel,labelStyle: { fill: stroke, fontSize: 11, fontWeight: 600 },...labelBg,@@ -8592,7 +8595,7 @@ export function Canvas() {// A browser guest's new-window (target=_blank / window.open) request → open another browser node// (never a real popup; main denies the real one) roped below/right of the source. Reads the- // latest nodes via nodesRef so the deps stay []. Rope is display-only (controlEdges, not persisted).+ // latest nodes via nodesRef so the deps stay []. Rope is display-only lineage (controlEdges, persisted as `ropes`).useEffect(() => {return window.nodeTerminal.browser.onBrowserNewWindow(({ url, sourceNodeId }) => {const src = nodesRef.current.find((n) => n.id === sourceNodeId)diff --git a/src/renderer/canvas/FloatingEdge.tsx b/src/renderer/canvas/FloatingEdge.tsxindex 9013a7ee3..76562dea9 100644--- a/src/renderer/canvas/FloatingEdge.tsx+++ b/src/renderer/canvas/FloatingEdge.tsx@@ -1,10 +1,11 @@// The canvas's ONE edge type. Reads both nodes' absolute rectangles from React Flow's internals-// (so nodes inside group frames resolve correctly) and draws a bezier between their nearest-// borders — see lib/floatingEdge.ts. An UNMEASURED node draws nothing this frame: React Flow's+// (so nodes inside group frames resolve correctly) and draws a bezier between the midpoints of+// their facing sides — see lib/floatingEdge.ts. `data.anchor === 'horizontal'` (context and note+// links) restricts both ends to the left/right sides, where the bridge handles are drawn. An UNMEASURED node draws nothing this frame: React Flow's// internals report a 0×0 rectangle for the first tick after mount, and a path drawn from it would// point at the node's top-left corner, or at the origin.import { BaseEdge, getBezierPath, useInternalNode, type EdgeProps } from '@xyflow/react'-import { floatingEdgeParams, type Rect } from '../lib/floatingEdge'+import { floatingEdgeParams, type AnchorSides, type Rect } from '../lib/floatingEdge'function rectOf(n: ReturnType<typeof useInternalNode>): Rect | null {if (!n) return null@@ -33,7 +34,8 @@ export function FloatingEdge(props: EdgeProps) {const a = rectOf(useInternalNode(source))const b = rectOf(useInternalNode(target))if (!a || !b) return null- const p = floatingEdgeParams(a, b)+ const anchor = (props.data as { anchor?: AnchorSides } | undefined)?.anchor+ const p = floatingEdgeParams(a, b, anchor === 'horizontal' ? 'horizontal' : 'all')const [path, labelX, labelY] = getBezierPath({sourceX: p.sx,sourceY: p.sy,diff --git a/src/renderer/canvas/edge-model.source.test.ts b/src/renderer/canvas/edge-model.source.test.tsindex e75cdd4c4..844a9dd66 100644--- a/src/renderer/canvas/edge-model.source.test.ts+++ b/src/renderer/canvas/edge-model.source.test.ts@@ -16,6 +16,12 @@ describe('canvas edge model (source pins)', () => {expect(src).not.toMatch(/targetHandle:\s*'/)})+ it('context and note links anchor on the bridge handles (left/right), ropes on any side', () => {+ expect(src).toContain("data: { anchor: 'horizontal' }")+ // Exactly the one family: ropes and card edges keep the four-side choice.+ expect((src.match(/anchor: 'horizontal'/g) ?? []).length).toBe(1)+ })+it('the separate "waits for" family is gone; the waiting look is the rope\'s, from the model', () => {expect(src).not.toContain('dependencyEdges')expect(src).not.toContain('depEdges')diff --git a/src/renderer/lib/floatingEdge.test.ts b/src/renderer/lib/floatingEdge.test.tsindex b064caa5d..c6918efbf 100644--- a/src/renderer/lib/floatingEdge.test.ts+++ b/src/renderer/lib/floatingEdge.test.ts@@ -17,12 +17,18 @@ describe('borderExit — where the centre-to-centre line leaves a rectangle', ()it('exits the TOP toward a point above', () => {expect(borderExit(box(0, 0), { x: 50, y: -500 })).toEqual({ x: 50, y: 0, position: Position.Top })})- it('a diagonal target exits the side the line actually crosses (wide box → left/right)', () => {- // centre (50,25); toward (250,125): dx=200, dy=100 → |dx|/w=4 > |dy|/h=4? equal → right wins.+ it('a diagonal target picks the side the centre line crosses (|dx|/hw vs |dy|/hh; tie → left/right)', () => {+ // centre (50,25); toward (250,125): dx=200, dy=100 → |dx|·hh = |dy|·hw → right wins.const e = borderExit(box(0, 0), { x: 250, y: 125 })expect(e.position).toBe(Position.Right)- expect(e.x).toBe(100)- expect(e.y).toBeCloseTo(50)+ // The point is the side's MIDPOINT, not the crossing: every edge leaving a side leaves from+ // one place, so arrows converge instead of fanning along the border.+ expect({ x: e.x, y: e.y }).toEqual({ x: 100, y: 25 })+ })+ it('restricted to the horizontal sides (context links use the left/right bridge handles), a target above still exits left or right', () => {+ expect(borderExit(box(0, 0), { x: 50, y: -500 }, 'horizontal')).toEqual({ x: 100, y: 25, position: Position.Right })+ expect(borderExit(box(0, 0), { x: -300, y: -500 }, 'horizontal')).toEqual({ x: 0, y: 25, position: Position.Left })+ expect(borderExit(box(0, 0), { x: 300, y: 500 }, 'horizontal')).toEqual({ x: 100, y: 25, position: Position.Right })})it('a coincident centre (overlapping nodes) degrades to the right side, never NaN', () => {const e = borderExit(box(0, 0), { x: 50, y: 25 })@@ -48,8 +54,12 @@ describe('floatingEdgeParams — both ends, facing each other', () => {const p = floatingEdgeParams(box(1000, 1000), box(0, 0))expect([Position.Left, Position.Top]).toContain(p.sourcePosition)expect([Position.Right, Position.Bottom]).toContain(p.targetPosition)- // The exact point, not just the side: the vertical branch interpolates x by HALF THE HEIGHT- // over |dy|, and a swapped half-extent still lands on the right side while missing the corner.- expect({ x: p.sx, y: p.sy }).toEqual({ x: 1025, y: 1000 })+ // The exact point is the TOP side's midpoint (the centre line crosses the top: |dy|·hw > |dx|·hh).+ expect({ x: p.sx, y: p.sy }).toEqual({ x: 1050, y: 1000 })+ expect({ x: p.tx, y: p.ty }).toEqual({ x: 50, y: 50 })+ })+ it('horizontal-only params: a node ABOVE another still connects right → left at the handle heights', () => {+ const p = floatingEdgeParams(box(0, 0), box(0, 300), 'horizontal')+ expect(p).toEqual({ sx: 100, sy: 25, sourcePosition: Position.Right, tx: 100, ty: 325, targetPosition: Position.Right })})})diff --git a/src/renderer/lib/floatingEdge.ts b/src/renderer/lib/floatingEdge.tsindex f9ecad2ad..c05d4b514 100644--- a/src/renderer/lib/floatingEdge.ts+++ b/src/renderer/lib/floatingEdge.ts@@ -1,9 +1,15 @@-// Pure geometry for the canvas's one edge type. An edge is drawn between the two points where the-// centre-to-centre line leaves each node's rectangle, so it always takes the short way round — the-// fixed-side handles it replaces sent an edge to a node placed left of (or above) its source on a-// loop across the whole canvas, with its label drifting into empty space.+// Pure geometry for the canvas's one edge type. An edge leaves each node from the MIDPOINT of the+// side its centre-to-centre line crosses, so it always takes the short way round — the fixed-side+// handles it replaces sent an edge to a node placed left of (or above) its source on a loop across+// the whole canvas — and every edge using a side leaves from ONE point, so arrows converge instead+// of fanning out along the border (measured on a hub node with a dozen ropes: entries were spread+// across the whole top edge). Context links are restricted to the left/right sides: those are where+// the drag handles (`link-out` / `link-in`) sit, and the edge should meet the dot the user dragged.import { Position } from '@xyflow/react'+/** Which sides an edge may leave from: every side, or only left/right (the bridge handles). */+export type AnchorSides = 'all' | 'horizontal'+export interface Rect {x: numbery: number@@ -18,11 +24,17 @@ export interface EdgeEnd {}/**- * The point on `from`'s border where the line from its centre toward `toward` exits, and the side- * it exits on. A degenerate rectangle (unmeasured) or a coincident centre answers deterministically- * (its own point, `Right`) — never NaN, so a path is always drawable.+ * The MIDPOINT of the side of `from` that the line from its centre toward `toward` crosses, and+ * that side. `sides: 'horizontal'` restricts the choice to left/right (a target above or below+ * still leaves from a side, picked by the sign of dx). A degenerate rectangle (unmeasured) or a+ * coincident centre answers deterministically (its own point, `Right`) — never NaN, so a path is+ * always drawable.*/-export function borderExit(from: Rect, toward: { x: number; y: number }): EdgeEnd {+export function borderExit(+ from: Rect,+ toward: { x: number; y: number },+ sides: AnchorSides = 'all'+): EdgeEnd {const hw = from.width / 2const hh = from.height / 2const cx = from.x + hw@@ -30,14 +42,12 @@ export function borderExit(from: Rect, toward: { x: number; y: number }): EdgeEnif (!(hw > 0) || !(hh > 0)) return { x: from.x, y: from.y, position: Position.Right }const dx = toward.x - cxconst dy = toward.y - cy- if (dx === 0 && dy === 0) return { x: cx + hw, y: cy, position: Position.Right }+ const right = { x: cx + hw, y: cy, position: Position.Right }+ const left = { x: cx - hw, y: cy, position: Position.Left }+ if (dx === 0 && dy === 0) return right// Compare the slopes against the corner: |dx|/hw vs |dy|/hh decides which side the line crosses.- if (Math.abs(dx) * hh >= Math.abs(dy) * hw) {- const sx = dx >= 0 ? 1 : -1- return { x: cx + sx * hw, y: cy + dy * (hw / Math.abs(dx)), position: sx > 0 ? Position.Right : Position.Left }- }- const sy = dy >= 0 ? 1 : -1- return { x: cx + dx * (hh / Math.abs(dy)), y: cy + sy * hh, position: sy > 0 ? Position.Bottom : Position.Top }+ if (sides === 'horizontal' || Math.abs(dx) * hh >= Math.abs(dy) * hw) return dx >= 0 ? right : left+ return dy >= 0 ? { x: cx, y: cy + hh, position: Position.Bottom } : { x: cx, y: cy - hh, position: Position.Top }}export interface FloatingParams {@@ -49,9 +59,9 @@ export interface FloatingParams {targetPosition: Position}-export function floatingEdgeParams(a: Rect, b: Rect): FloatingParams {+export function floatingEdgeParams(a: Rect, b: Rect, sides: AnchorSides = 'all'): FloatingParams {const centre = (r: Rect) => ({ x: r.x + r.width / 2, y: r.y + r.height / 2 })- const s = borderExit(a, centre(b))- const t = borderExit(b, centre(a))+ const s = borderExit(a, centre(b), sides)+ const t = borderExit(b, centre(a), sides)return { sx: s.x, sy: s.y, sourcePosition: s.position, tx: t.x, ty: t.y, targetPosition: t.position }}