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.

refactor(settings): read the terminal size bounds from @shared/default-node-size

review6d88bd1e5c1e
diff --git a/src/server/headless-node-factory.ts b/src/server/headless-node-factory.ts
index 4d5a3a009..643f9bc18 100644
--- a/src/server/headless-node-factory.ts
+++ b/src/server/headless-node-factory.ts
@@ -69,7 +69,13 @@ import type {
Settings,
Workspace
} from '../shared/types'
-import { STICKY_NODE_MIN_SIZE, STICKY_NODE_SIZE, resolveDefaultNodeSize } from '../shared/default-node-size'
+import {
+ NODE_SIZE_MAX,
+ STICKY_NODE_MIN_SIZE,
+ STICKY_NODE_SIZE,
+ TERMINAL_NODE_SIZE_MIN,
+ resolveDefaultNodeSize
+} from '../shared/default-node-size'
export interface ServerControlReply {
ok: boolean
@@ -264,8 +270,8 @@ function terminalSize(settings: Settings): { width: number; height: number } {
return Math.min(max, Math.max(min, n))
}
return {
- width: clamp(settings.defaultNodeWidth, 280, 2400, TERMINAL_SIZE.width),
- height: clamp(settings.defaultNodeHeight, 160, 1600, TERMINAL_SIZE.height)
+ width: clamp(settings.defaultNodeWidth, TERMINAL_NODE_SIZE_MIN.width, NODE_SIZE_MAX.width, TERMINAL_SIZE.width),
+ height: clamp(settings.defaultNodeHeight, TERMINAL_NODE_SIZE_MIN.height, NODE_SIZE_MAX.height, TERMINAL_SIZE.height)
}
}
diff --git a/src/shared/settings-verb.ts b/src/shared/settings-verb.ts
index d29a53488..7fe3112df 100644
--- a/src/shared/settings-verb.ts
+++ b/src/shared/settings-verb.ts
@@ -38,6 +38,7 @@ import {
type CapabilityAckMap
} from './project-capability-consent'
import type { Project, Settings } from './types'
+import { NODE_SIZE_MAX, TERMINAL_NODE_SIZE_MIN } from './default-node-size'
/** Where a setting lives. `project` = a per-project capability (the project's file + this
* machine's answer); `machine` = settings.json on this machine, every project. */
@@ -99,13 +100,13 @@ export const SETTINGS_VERB_KEYS: Readonly<Record<SettingsVerbKey, SettingsVerbKe
},
defaultNodeWidth: {
scope: 'machine',
- type: { kind: 'integer', min: 280, max: 2400 },
+ type: { kind: 'integer', min: TERMINAL_NODE_SIZE_MIN.width, max: NODE_SIZE_MAX.width },
label: 'Default width of new terminal and agent nodes (px)',
why: 'Canvas layout only. Bounds are terminalNodeSize’s clamp, so nothing out of range persists.'
},
defaultNodeHeight: {
scope: 'machine',
- type: { kind: 'integer', min: 160, max: 1600 },
+ type: { kind: 'integer', min: TERMINAL_NODE_SIZE_MIN.height, max: NODE_SIZE_MAX.height },
label: 'Default height of new terminal and agent nodes (px)',
why: 'Canvas layout only. Bounds are terminalNodeSize’s clamp, so nothing out of range persists.'
}