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(agents): CANVAS_CONTROL_CAPABLE + NODETERM_CANVAS_CONTROL env (claude-only)

enese380437abdd8
diff --git a/src/main/agents/hook-server.ts b/src/main/agents/hook-server.ts
index cfcbdb344..f9a59509c 100644
--- a/src/main/agents/hook-server.ts
+++ b/src/main/agents/hook-server.ts
@@ -3,7 +3,7 @@ import { randomUUID, timingSafeEqual } from 'crypto'
import { writeFileSync, mkdirSync } from 'fs'
import path from 'path'
import { app } from 'electron'
-import type { AgentId } from '../../shared/agents/config'
+import { canControlCanvas, type AgentId } from '../../shared/agents/config'
import { normalizeFor, type NormalizedAgentEvent } from '../../shared/agents/normalize'
export const NODETERM_HOOK_PROTOCOL_VERSION = '1'
@@ -157,7 +157,8 @@ class HookServer {
NODETERM_HOOK_VERSION: NODETERM_HOOK_PROTOCOL_VERSION,
NODETERM_HOOK_ENDPOINT: this.endpointFilePath(),
NODETERM_NODE_ID: nodeId,
- NODETERM_AGENT_ID: agentId
+ NODETERM_AGENT_ID: agentId,
+ ...(canControlCanvas(agentId) ? { NODETERM_CANVAS_CONTROL: '1' } : {})
}
}
diff --git a/src/shared/agents/config.control.test.ts b/src/shared/agents/config.control.test.ts
new file mode 100644
index 000000000..be4a467a6
--- /dev/null
+++ b/src/shared/agents/config.control.test.ts
@@ -0,0 +1,11 @@
+import { describe, it, expect } from 'vitest'
+import { canControlCanvas } from './config'
+
+describe('canControlCanvas', () => {
+ it('is true for claude only', () => {
+ expect(canControlCanvas('claude')).toBe(true)
+ expect(canControlCanvas('codex')).toBe(false)
+ expect(canControlCanvas('gemini')).toBe(false)
+ expect(canControlCanvas('custom:abc')).toBe(false)
+ })
+})
diff --git a/src/shared/agents/config.ts b/src/shared/agents/config.ts
index 1cf13446d..670aeef10 100644
--- a/src/shared/agents/config.ts
+++ b/src/shared/agents/config.ts
@@ -58,6 +58,8 @@ export const TRANSFER_SOURCE_CAPABLE = ['claude', 'codex', 'gemini'] as const
// Agents that support naming the session in two directions: they emit a session title we adopt
// into the node title, and accept `/rename <name>` to push a renamed node title back. Claude-only.
export const RENAME_CAPABLE = ['claude'] as const
+// Agents allowed to drive the canvas via the `nodeterm` CLI (open/show/write/close). Claude-only.
+export const CANVAS_CONTROL_CAPABLE = ['claude'] as const
const includes = (list: readonly string[], id: AgentId): boolean => list.includes(id)
@@ -71,6 +73,7 @@ export const hasUsage = (id: AgentId): boolean => includes(USAGE_CAPABLE, id)
export const canChat = (id: AgentId): boolean => includes(CHAT_CAPABLE, id)
export const canTransferFrom = (id: AgentId): boolean => includes(TRANSFER_SOURCE_CAPABLE, id)
export const canRename = (id: AgentId): boolean => includes(RENAME_CAPABLE, id)
+export const canControlCanvas = (id: AgentId): boolean => includes(CANVAS_CONTROL_CAPABLE, id)
// Returns the builtin config for an id, or undefined for custom/unknown agents.
export const agentConfig = (id: AgentId): AgentConfig | undefined =>