Skip to content

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.

feat(node-sizing): shared NODE_MIN_SIZES module + four-corner grid snap

Darren Kattanabef2b25c392
diff --git a/.gitignore b/.gitignore
index 84e40fbae..29f76f115 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,3 +38,4 @@ build/icon.png
/dictation-tour.mp4
/canvas-tour.mp4
/hero-tour.mp4
+nodeterm.worktrees/
diff --git a/scripts/run-dev.sh b/scripts/run-dev.sh
new file mode 100755
index 000000000..fc3b2cf34
--- /dev/null
+++ b/scripts/run-dev.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+# run-dev.sh — kill the running nodeterm and launch a fresh one from this branch.
+#
+# Kills the installed /Applications/nodeterm.app and any `electron-vite dev` instance,
+# builds the renderer+main (npm run build — native modules like node-pty ship N-API
+# prebuilds, so electron-rebuild is NOT needed), then launches the Electron binary
+# against the built out/ with this branch's code. Logs to stdout/stderr.
+#
+# Usage: ./scripts/run-dev.sh # build, then run
+# ./scripts/run-dev.sh --no-build # skip the build (reuse existing out/)
+set -euo pipefail
+
+cd "$(dirname "$0")/.."
+
+BUILD=1
+for arg in "$@"; do
+ case "$arg" in
+ --no-build) BUILD=0 ;;
+ *) echo "unknown arg: $arg" >&2; exit 2 ;;
+ esac
+done
+
+# --- 1. Kill any running nodeterm -----------------------------------------------
+# The installed app's main process is literally named "nodeterm"; a `dev` run is the
+# Electron binary (path contains node_modules/electron). Kill both, tolerate absence.
+echo "→ Stopping running nodeterm…"
+pkill -x nodeterm 2>/dev/null || true
+pkill -f "node_modules/electron/dist/Electron.app" 2>/dev/null || true
+# `electron-vite dev` spawns an Electron whose app name is "Electron"; scope the match
+# to our repo's node_modules so we don't touch other Electron apps (VS Code, etc.).
+pkill -f "Electron.app/Contents/MacOS/Electron.*$(pwd | sed 's/[\/&]/\\&/g')" 2>/dev/null || true
+sleep 1 # let the OS reclaim the single-instance lock + user-data-dir handle
+
+# --- 2. Build (renderer + main) -------------------------------------------------
+if [[ "$BUILD" -eq 1 ]]; then
+ echo "→ Building (npm run build)…"
+ npm run build
+fi
+
+# --- 3. Locate the Electron binary ---------------------------------------------
+ELECTRON_BIN="node_modules/electron/dist/Electron.app/Contents/MacOS/Electron"
+if [[ ! -x "$ELECTRON_BIN" ]]; then
+ echo "✗ Electron binary not found at $ELECTRON_BIN" >&2
+ echo " Run: node node_modules/electron/install.js" >&2
+ exit 1
+fi
+
+# --- 4. Launch -----------------------------------------------------------------
+# Electron loads `main` from package.json (./out/main/index.js). Running from the repo
+# root with our binary uses this branch's built code, NOT /Applications/nodeterm.app.
+echo "→ Launching nodeterm from this branch…"
+exec "$ELECTRON_BIN" .
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 11610480f..68f3fe032 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -308,6 +308,7 @@ import type { SshServer, SshConnection } from '@shared/ssh'
import { sshHostKey } from '@shared/ssh'
import type {
CanvasNodeState,
+ NodeKind,
Project,
ProjectKanban,
SshPassphraseRequest,
@@ -317,6 +318,7 @@ import type {
import type { KanbanCreateChoice, KanbanSession } from '../components/kanban/KanbanView'
import { assignNode, assignedTo, defaultKanban, labelsForCard, migrateProjectTags, resolveColumnRef, unassigned } from '../lib/kanban'
import { registerWorkspaceDirty } from '../state/workspaceDirty'
+import { snapNodeToGrid } from '../lib/nodeSizing'
import { canClearDirty, canCommitCanvas } from '../state/persistGuards'
import { isHidden } from '../lib/ui-visibility'
import { boardLogEvents } from '../lib/boardLogDiff'
@@ -4969,17 +4971,28 @@ export function Canvas() {
const g = useSettings.getState().settings.gridSize || GRID
const set = new Set(ids)
setNodes((ns) =>
- ns.map((n) =>
- set.has(n.id)
- ? {
- ...n,
- position: {
- x: Math.round(n.position.x / g) * g,
- y: Math.round(n.position.y / g) * g
- }
- }
- : n
- )
+ ns.map((n) => {
+ if (!set.has(n.id)) return n
+ // Snap all four corners to the grid: each edge rounds to its nearest grid
+ // line, so the node is moved AND resized to land every corner on a grid
+ // intersection. Size is clamped to the kind's minimum (the resizer's mins
+ // don't apply to programmatic changes). A collapsed node keeps its collapsed
+ // bar height — only its position and width snap; expanding still restores the
+ // saved height.
+ const kind = (n.type ?? 'terminal') as NodeKind
+ const w = n.measured?.width ?? (n.width as number) ?? 0
+ const h = n.measured?.height ?? (n.height as number) ?? 0
+ const snapped = snapNodeToGrid(g, kind, { x: n.position.x, y: n.position.y, width: w, height: h })
+ const height = n.data?.collapsed ? h : snapped.height
+ return {
+ ...n,
+ position: { x: snapped.x, y: snapped.y },
+ width: snapped.width,
+ height,
+ measured: { width: snapped.width, height },
+ style: { ...n.style, width: snapped.width, height }
+ }
+ })
)
markDirty()
},
@@ -5496,7 +5509,6 @@ export function Canvas() {
branchClaude,
transferConversation,
agentIdOf,
- alignToGrid,
toggleCollapseNodes,
toggleMarkdown,
reloadTerminals,
@@ -5780,7 +5792,7 @@ export function Canvas() {
{ type: 'separator' },
// Canvas actions.
{ label: 'Select all', icon: <IconSelectAll />, onClick: selectAll },
- { label: 'Fit view', icon: <IconFit />, onClick: fitAll },
+ { label: 'Fit view', icon: <IconFit />, onClick: fitView },
// Project-wide: restart every idle agent CLI in place (new model pickup). Hidden on a
// canvas with no restartable agent node — there it could only ever report "0 restarted".
...(hasRestartableAgents()
@@ -5802,7 +5814,7 @@ export function Canvas() {
addHandlers,
addCtx,
selectAll,
- fitAll,
+ fitView,
hasRestartableAgents,
restartIdleAgents
]
@@ -9122,6 +9134,12 @@ export function Canvas() {
variant={BackgroundVariant.Dots}
gap={settings.gridSize || GRID}
size={2.5}
+ /* React Flow centers each dot in its pattern tile, so by default dots sit at cell
+ centers (n·g + g/2) while every grid snap — drag snapGrid and align-to-grid —
+ targets cell corners (n·g). That mismatch makes snapped nodes look half a cell off
+ the dots. offset = size/2 shifts the tiling so dots render exactly on the grid
+ lines (n·g), aligning the visible grid with what snaps to it. */
+ offset={1.25}
/* React Flow paints the dots from a JS prop, so this can't be a rule — it reads the
token instead. On white the dark-mode grey reads as noise rather than as a grid. */
color="var(--canvas-dot)"
diff --git a/src/renderer/lib/nodeSizing.test.ts b/src/renderer/lib/nodeSizing.test.ts
new file mode 100644
index 000000000..3324cdeb3
--- /dev/null
+++ b/src/renderer/lib/nodeSizing.test.ts
@@ -0,0 +1,65 @@
+import { describe, it, expect } from 'vitest'
+import { NODE_MIN_SIZES, snapNodeToGrid } from './nodeSizing'
+import type { NodeKind } from '@shared/types'
+
+const G = 24
+
+describe('snapNodeToGrid', () => {
+ it('snaps each edge to its nearest grid line', () => {
+ // x=10 -> 0, y=10 -> 0, right=210 -> 216, bottom=210 -> 216
+ const r = snapNodeToGrid(G, 'sticky', { x: 10, y: 10, width: 200, height: 200 })
+ expect(r).toEqual({ x: 0, y: 0, width: 216, height: 216 })
+ })
+
+ it('lands every corner on a grid intersection', () => {
+ const r = snapNodeToGrid(G, 'sticky', { x: 10, y: 10, width: 200, height: 200 })
+ expect(r.x % G).toBe(0)
+ expect(r.y % G).toBe(0)
+ expect((r.x + r.width) % G).toBe(0)
+ expect((r.y + r.height) % G).toBe(0)
+ })
+
+ it('leaves an already-aligned, above-minimum node untouched', () => {
+ // terminal grid-aligned minimum is 264x168
+ const r = snapNodeToGrid(G, 'terminal', { x: 0, y: 0, width: 264, height: 168 })
+ expect(r).toEqual({ x: 0, y: 0, width: 264, height: 168 })
+ })
+
+ it('rounds edges independently — right edge goes to its own nearest line, not left + rounded width', () => {
+ // right=210 -> 216 (nearest), so width is 216. A "round size" scheme would give
+ // round(200/24)*24 = 192 and a right edge at 192 — farther from 210.
+ const r = snapNodeToGrid(G, 'sticky', { x: 10, y: 0, width: 200, height: 140 })
+ expect(r).toEqual({ x: 0, y: 0, width: 216, height: 144 })
+ })
+
+ it('clamps a tiny node up to the kind grid-aligned minimum', () => {
+ // terminal min 260x160 -> grid-aligned ceil(260/24)*24 = 264, ceil(160/24)*24 = 168
+ const r = snapNodeToGrid(G, 'terminal', { x: 5, y: 5, width: 20, height: 20 })
+ expect(r).toEqual({ x: 0, y: 0, width: 264, height: 168 })
+ })
+
+ it('clamps at a large grid size without inverting (a sub-grid box grows to the minimum)', () => {
+ // grid 96, sticky 160x120 -> grid-aligned ceil(160/96)*96 = 192, ceil(120/96)*96 = 192
+ const r = snapNodeToGrid(96, 'sticky', { x: 10, y: 10, width: 20, height: 20 })
+ expect(r).toEqual({ x: 0, y: 0, width: 192, height: 192 })
+ })
+
+ it('keeps a size that already clears the minimum at its snapped value', () => {
+ const r = snapNodeToGrid(G, 'sticky', { x: 10, y: 10, width: 200, height: 200 })
+ // snapped 216x216 is above sticky's grid-aligned min (168x120), so no clamp
+ expect(r.width).toBe(216)
+ expect(r.height).toBe(216)
+ })
+
+ it('every kind has a positive min-size entry', () => {
+ const kinds: NodeKind[] = [
+ 'terminal', 'sticky', 'group', 'editor', 'diff',
+ 'video', 'web', 'browser', 'subagent', 'loop', 'dino'
+ ]
+ for (const k of kinds) {
+ expect(NODE_MIN_SIZES[k]).toBeDefined()
+ expect(NODE_MIN_SIZES[k].width).toBeGreaterThan(0)
+ expect(NODE_MIN_SIZES[k].height).toBeGreaterThan(0)
+ }
+ })
+})
diff --git a/src/renderer/lib/nodeSizing.ts b/src/renderer/lib/nodeSizing.ts
new file mode 100644
index 000000000..c9451d7bb
--- /dev/null
+++ b/src/renderer/lib/nodeSizing.ts
@@ -0,0 +1,53 @@
+import type { NodeKind } from '@shared/types'
+
+/**
+ * Minimum width/height for each node kind. These are the single source of truth
+ * for the `minWidth`/`minHeight` every node passes to React Flow's `<NodeResizer>` —
+ * the components read them here instead of re-declaring the literals, so the two
+ * can't drift apart.
+ *
+ * The resizer enforces these only during a drag. Programmatic size changes (e.g.
+ * align-to-grid) bypass the resizer, so they must clamp to these values themselves
+ * to avoid shrinking a node below what its resizer would allow.
+ */
+export const NODE_MIN_SIZES: Record<NodeKind, { width: number; height: number }> = {
+ terminal: { width: 260, height: 160 },
+ sticky: { width: 160, height: 120 },
+ group: { width: 200, height: 140 },
+ editor: { width: 320, height: 200 },
+ diff: { width: 420, height: 220 },
+ video: { width: 320, height: 200 },
+ web: { width: 320, height: 200 },
+ browser: { width: 360, height: 240 },
+ subagent: { width: 180, height: 84 },
+ loop: { width: 180, height: 84 },
+ dino: { width: 400, height: 160 }
+}
+
+export interface Rect {
+ x: number
+ y: number
+ width: number
+ height: number
+}
+
+/**
+ * Snap a rectangle so all four corners land on grid intersections: each edge
+ * (left, top, right, bottom) rounds independently to its nearest grid line. The
+ * width/height are then raised to the node kind's grid-aligned minimum so a small
+ * node (or a large grid) never inverts or undershoots what its `<NodeResizer>`
+ * would allow. Left/top stay at their snapped positions; only the right/bottom
+ * edge extends when the minimum has to kick in.
+ */
+export function snapNodeToGrid(g: number, kind: NodeKind, r: Rect): Rect {
+ const x = Math.round(r.x / g) * g
+ const y = Math.round(r.y / g) * g
+ let width = Math.round((r.x + r.width) / g) * g - x
+ let height = Math.round((r.y + r.height) / g) * g - y
+ const min = NODE_MIN_SIZES[kind] ?? { width: 0, height: 0 }
+ const minW = Math.ceil(min.width / g) * g
+ const minH = Math.ceil(min.height / g) * g
+ if (width < minW) width = minW
+ if (height < minH) height = minH
+ return { x, y, width, height }
+}
diff --git a/src/renderer/nodes/BrowserNode.tsx b/src/renderer/nodes/BrowserNode.tsx
index 1c96ed066..6549aefb8 100644
--- a/src/renderer/nodes/BrowserNode.tsx
+++ b/src/renderer/nodes/BrowserNode.tsx
@@ -1,4 +1,5 @@
import { Handle, NodeResizer, Position, useReactFlow, type NodeProps } from '@xyflow/react'
+import { NODE_MIN_SIZES } from '../lib/nodeSizing'
import type { CanvasNode } from '../state/workspace'
import { BrowserSurface } from './BrowserSurface'
@@ -12,7 +13,7 @@ export default function BrowserNode({ id, data, selected }: NodeProps<CanvasNode
return (
<div className={`term-node browser-node${selected ? ' selected' : ''}`} style={{ borderTopColor: data.color }}>
- <NodeResizer minWidth={360} minHeight={240} isVisible={selected} color={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. */}
<Handle
id="flow-in"
diff --git a/src/renderer/nodes/DiffNode.tsx b/src/renderer/nodes/DiffNode.tsx
index 7b3fa04c8..b3467a9a5 100644
--- a/src/renderer/nodes/DiffNode.tsx
+++ b/src/renderer/nodes/DiffNode.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from 'react'
import { NodeResizer, useReactFlow, type NodeProps } from '@xyflow/react'
+import { NODE_MIN_SIZES } from '../lib/nodeSizing'
import { monaco } from '../editor/monaco-setup'
import { monacoTheme } from '../lib/appTheme'
import { useAppTheme } from '../state/useAppTheme'
@@ -135,7 +136,7 @@ export function DiffNode({ id, data, selected }: NodeProps<CanvasNode>) {
className={`term-node editor-node${selected ? ' selected' : ''}`}
style={{ borderTopColor: data.color }}
>
- <NodeResizer minWidth={420} minHeight={220} isVisible={selected} color={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'}`}>
diff --git a/src/renderer/nodes/DinoNode.tsx b/src/renderer/nodes/DinoNode.tsx
index dfb6daab7..351918b8b 100644
--- a/src/renderer/nodes/DinoNode.tsx
+++ b/src/renderer/nodes/DinoNode.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from 'react'
import { NodeResizer, useReactFlow, type NodeProps } from '@xyflow/react'
+import { NODE_MIN_SIZES } from '../lib/nodeSizing'
import { useShallow } from 'zustand/react/shallow'
import { type CanvasNode } from '../state/workspace'
import { useProjects } from '../state/projects'
@@ -92,7 +93,7 @@ export function DinoNode({ id, data, selected }: NodeProps<CanvasNode>) {
return (
<div className={`dino-node${selected ? ' selected' : ''}`} style={{ borderColor: data.color }}>
- <NodeResizer minWidth={400} minHeight={160} isVisible={selected} color={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 }} />
diff --git a/src/renderer/nodes/EditorNode.tsx b/src/renderer/nodes/EditorNode.tsx
index e88d76d71..97cc94377 100644
--- a/src/renderer/nodes/EditorNode.tsx
+++ b/src/renderer/nodes/EditorNode.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from 'react'
import { Handle, NodeResizer, Position, useReactFlow, type NodeProps } from '@xyflow/react'
+import { NODE_MIN_SIZES } from '../lib/nodeSizing'
import { monaco } from '../editor/monaco-setup'
import { monacoTheme } from '../lib/appTheme'
import { useAppTheme } from '../state/useAppTheme'
@@ -245,7 +246,7 @@ export function EditorNode({ id, data, selected }: NodeProps<CanvasNode>) {
onMouseEnter={() => (hoveredRef.current = true)}
onMouseLeave={() => (hoveredRef.current = false)}
>
- <NodeResizer minWidth={320} minHeight={200} isVisible={selected} color={data.color} />
+ <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. */}
<Handle
id="flow-in"
diff --git a/src/renderer/nodes/GroupNode.tsx b/src/renderer/nodes/GroupNode.tsx
index 66e92ddd5..d81871cb1 100644
--- a/src/renderer/nodes/GroupNode.tsx
+++ b/src/renderer/nodes/GroupNode.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from 'react'
import { NodeResizer, useReactFlow, type NodeProps } from '@xyflow/react'
+import { NODE_MIN_SIZES } from '../lib/nodeSizing'
import { NODE_COLORS, ungroupNodes, type CanvasNode } from '../state/workspace'
import { useProjects } from '../state/projects'
import { useWorktrees, WORKTREE_STATUS_POLL_MS } from '../state/worktrees'
@@ -140,8 +141,8 @@ export function GroupNode({ id, data, selected }: NodeProps<CanvasNode>) {
}}
>
<NodeResizer
- minWidth={200}
- minHeight={140}
+ minWidth={NODE_MIN_SIZES.group.width}
+ minHeight={NODE_MIN_SIZES.group.height}
isVisible={selected}
color={data.color}
lineStyle={{ borderColor: 'transparent' }}
diff --git a/src/renderer/nodes/LoopNode.tsx b/src/renderer/nodes/LoopNode.tsx
index 81101b77d..34c75d2e1 100644
--- a/src/renderer/nodes/LoopNode.tsx
+++ b/src/renderer/nodes/LoopNode.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef } from 'react'
import { Handle, NodeResizer, Position, type NodeProps } from '@xyflow/react'
+import { NODE_MIN_SIZES } from '../lib/nodeSizing'
import type { CanvasNode } from '../state/workspace'
import { useAgentNodes } from '../state/agentNodes'
import { applyLoopDismiss } from '../lib/loopCard'
@@ -52,7 +53,7 @@ export function LoopNode({ id, data, selected }: NodeProps<CanvasNode>) {
return (
<div onPointerDownCapture={select} className={`loop-node${active ? ' working' : ''}`}>
- <NodeResizer isVisible={selected} minWidth={180} minHeight={84} color="#bf7af0" />
+ <NodeResizer isVisible={selected} minWidth={NODE_MIN_SIZES.loop.width} minHeight={NODE_MIN_SIZES.loop.height} color="#bf7af0" />
<Handle type="target" position={Position.Top} isConnectable={false} />
<div className="loop-node__head nodrag" onClick={toggle} style={{ cursor: 'pointer' }}>
<button
diff --git a/src/renderer/nodes/StickyNode.tsx b/src/renderer/nodes/StickyNode.tsx
index a362d8d14..16b1fe21a 100644
--- a/src/renderer/nodes/StickyNode.tsx
+++ b/src/renderer/nodes/StickyNode.tsx
@@ -1,5 +1,6 @@
import { useState } from 'react'
import { Handle, NodeResizer, Position, useReactFlow, type NodeProps } from '@xyflow/react'
+import { NODE_MIN_SIZES } from '../lib/nodeSizing'
import { COLLAPSED_HEIGHT, NODE_COLORS, type CanvasNode } from '../state/workspace'
import { ColumnPill } from '../components/kanban/ColumnPill'
@@ -49,7 +50,7 @@ export function StickyNode({ id, data, selected }: NodeProps<CanvasNode>) {
className={`sticky-node${selected ? ' selected' : ''}${collapsed ? ' collapsed' : ''}`}
style={{ background: `${data.color}22`, borderColor: data.color }}
>
- <NodeResizer minWidth={160} minHeight={120} isVisible={selected && !collapsed} color={data.color} />
+ <NodeResizer minWidth={NODE_MIN_SIZES.sticky.width} minHeight={NODE_MIN_SIZES.sticky.height} isVisible={selected && !collapsed} color={data.color} />
{/* Note-link handles: drag to/from a terminal node to attach this note as context. */}
<Handle
diff --git a/src/renderer/nodes/SubagentNode.tsx b/src/renderer/nodes/SubagentNode.tsx
index e5167e146..1913eed2b 100644
--- a/src/renderer/nodes/SubagentNode.tsx
+++ b/src/renderer/nodes/SubagentNode.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from 'react'
import { Handle, NodeResizer, Position, type NodeProps } from '@xyflow/react'
+import { NODE_MIN_SIZES } from '../lib/nodeSizing'
import type { CanvasNode } from '../state/workspace'
import { useAgentNodes } from '../state/agentNodes'
diff --git a/src/renderer/nodes/TerminalNode.tsx b/src/renderer/nodes/TerminalNode.tsx
index f2d2b0d76..f59cabaa9 100644
--- a/src/renderer/nodes/TerminalNode.tsx
+++ b/src/renderer/nodes/TerminalNode.tsx
@@ -1,4 +1,5 @@
import { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import { NODE_MIN_SIZES } from '../lib/nodeSizing'
import {
Handle,
NodeResizer,
@@ -4069,7 +4070,7 @@ export function TerminalNode({
onMouseEnter={() => (hoveredRef.current = true)}
onMouseLeave={() => (hoveredRef.current = false)}
>
- <NodeResizer minWidth={260} minHeight={160} isVisible={selected && !collapsed} color="#0a84ff" />
+ <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. */}
<Handle
id="flow-out"
diff --git a/src/renderer/nodes/VideoNode.tsx b/src/renderer/nodes/VideoNode.tsx
index 3e4077b13..3988a3172 100644
--- a/src/renderer/nodes/VideoNode.tsx
+++ b/src/renderer/nodes/VideoNode.tsx
@@ -1,5 +1,6 @@
import { useEffect, useState } from 'react'
import { Handle, NodeResizer, Position, useReactFlow, type NodeProps } from '@xyflow/react'
+import { NODE_MIN_SIZES } from '../lib/nodeSizing'
import type { CanvasNode } from '../state/workspace'
import { useProjects } from '../state/projects'
@@ -69,7 +70,7 @@ export default function VideoNode({ id, data, selected }: NodeProps<CanvasNode>)
className={`term-node video-node${selected ? ' selected' : ''}`}
style={{ borderTopColor: data.color }}
>
- <NodeResizer minWidth={320} minHeight={200} isVisible={selected} color={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. */}
<Handle
id="flow-in"
diff --git a/src/renderer/nodes/WebNode.tsx b/src/renderer/nodes/WebNode.tsx
index ef18892e7..c5a27dcc9 100644
--- a/src/renderer/nodes/WebNode.tsx
+++ b/src/renderer/nodes/WebNode.tsx
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from 'react'
import { Handle, NodeResizer, Position, useReactFlow, type NodeProps } from '@xyflow/react'
+import { NODE_MIN_SIZES } from '../lib/nodeSizing'
import type { CanvasNode } from '../state/workspace'
import { httpUrl } from './webUrl'
import { useDiscardWhenHidden, webviewAudible, type AudibleWebview } from './useDiscardWhenHidden'