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(server): make recovery ownership fail closed
freshjuicezc4ac797b9836
diff --git a/CLAUDE.md b/CLAUDE.mdindex 125d7c969..794c52728 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -102,9 +102,11 @@ The codebase is split by Electron process boundary — keep code on the correctbridge, so agent-status badges, subagent cards, and the context meter now work in thebrowser (transcript-path jailed against forged POSTs). It also serves the two transcript READchannels (`registerTranscriptIpc` — the ⌘M chat view + the find-bar's transcript index; see the- ⌘M bullet under Agent support). Still deferred:- **canvas-control** (`agent:control`) is not wired. (The SDK **chat node** — once listed here- as deferred — was removed entirely, 2026-07; see the chat-node note in the node-kinds list.)+ ⌘M bullet under Agent support). **Canvas control is opt-in**+ (`NODETERM_SERVER_CANVAS_CONTROL=1` / `--canvas-control`): the Server shell installs its own shim+ and runs a serialized `HeadlessNodeFactory`; disabled remains the default. (The SDK **chat node**+ — once listed here as deferred — was removed entirely, 2026-07; see the chat-node note in the+ node-kinds list.)- **`src/preload/`** — the only bridge. `index.ts` uses `contextBridge` to expose anarrow API on `window.nodeTerminal` (typed in `index.d.ts`). `contextIsolation` is on,`nodeIntegration` off.@@ -1280,6 +1282,17 @@ else, and its context links must keep classifying across restarts).(which sets `NODETERM_CANVAS_CONTROL`) is the whole wiring. That premise rests on grok's shippeddocs and is **unverified** (`grok inspect --json` never run); if it does not hold, grok takes themarker-block route instead — see docs/grok-agent.md.+ **Server creator ownership (2026-08 incident hardening):** enabled Server control accepts only+ verified node identity. `HeadlessNodeFactory` records which source node opened each new node in a+ process-local ledger; link/group/rename/color/sticky-update, message delivery, and close validate+ the whole target set as current-run creations before writing or killing anything. Queued messages+ revalidate creator ownership before flush. The ledger is intentionally empty after restart —+ project JSON, titles, hook history and tmux names are not creator proof — so+ boot neither attaches/creates backends nor sends persisted queued commands. A live backend with a+ durable arm remains untouched until an explicit owner action or browser view. `open-terminal` and+ `open-agent` are verified-only at the Server handler boundary. A plain terminal keeps generic+ node hook wiring but receives neither `NODETERM_AGENT_ID` nor `NODETERM_CANVAS_CONTROL`; missing+ identity never defaults to Claude.**SSH projects** (docs/ssh-agent-skills.md): the SAME shim + skill + blocks are installed onthe remote host at connect (`RemoteHooks.installCanvasControl` + per-account`installCanvasSkillIntoAccountDir`), gated on the VERIFIED reverse hook tunnel — the shim@@ -1470,9 +1483,9 @@ else, and its context links must keep classifying across restarts).`core/claude-accounts-service.ts` owns the four `claude-accounts:*` channels (add / wait-login/ cancel-wait / remove) behind `platform().handle`; `main/claude-accounts.ts` is a thin desktopwrapper and `registerCoreHandlers` calls the same `registerClaudeAccountsIpc()`. Two optional- deps carry everything core cannot reach: `installSkill` (desktop passes `installCanvasSkillInto`- — the server passes none, because **canvas control is not wired on that shell at all**, so a- per-account SKILL.md would point at nothing) and `remote`, a **thunk** resolving the SSH legs+ deps carry everything core cannot reach: `installSkill` (desktop passes `installCanvasSkillInto`;+ an enabled Server canvas-control runtime installs its Server-specific skill separately) and+ `remote`, a **thunk** resolving the SSH legs(desktop's manager is created after the registration, and the server has none — in both casesan `AccountCtx` carrying a `projectId` degrades to the LOCAL path, which is the pre-existingbehavior this preserves). **Three surfaces:** Desktop unchanged (same channels, same shapes,diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 2ca7fee44..fcc8b329e 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -107,6 +107,19 @@ reporting "no sessions" on a host running thirty.never a substituted nearest match. A hand-editable value that is unrecognised must yield the safedefault, never something more destructive than the default.+**A Server Edition agent owns only nodes it freshly opened in this server run.** The+creator ledger is process-local and must never be rebuilt from `.nodeterm/project.json`, titles,+hook history, or a surviving tmux name: all are writable or stale. A restart therefore clears+ownership, performs no node/session adoption, and leaves durable queued launches dormant. Metadata+mutations and message delivery validate every target before writing anything; missing proof is a+named refusal. Validate Server upgrades against a disposable data directory and port. Restarting a+shared live service is+an explicit operator action, never a test or an automatic repair step.++**A plain terminal is not a Claude node.** It may carry the generic node/endpoint wiring needed for+a hand-launched agent to report hooks, but it gets no `NODETERM_AGENT_ID` and no+`NODETERM_CANVAS_CONTROL` until the serialized node explicitly names an agent.+**Re-validate hand-editable values at the point of use**, not by their TypeScript type. Settingscome from git-shared JSON and can end up interpolated into a shell command line.diff --git a/docs/SERVER.md b/docs/SERVER.mdindex 622aaf4b0..c61589da3 100644--- a/docs/SERVER.md+++ b/docs/SERVER.md@@ -480,24 +480,22 @@ Consequences worth knowing:announces a new link cannot quote the shim path. The boot-installed instructions coverdiscovery independently.-**Deliberate scope skips (Phase 3b):**+**Deliberate scope and feature-gate differences:**- The SDK **chat node** is still **deferred** — it is not wired into the server bridge.-- **Canvas-control** (`agent:control`, the Claude-only `nodeterm` CLI verbs) is **not- wired** over the server, and since the strict-verb work it says so **by name**:- `/control/<verb>` answers HTTP 400 with `error: control-unsupported-on-this-edition`- and a sentence containing the literal *"do not retry"*. The old generic- `control unavailable` read to an agent like a transient outage, and an agent retries an- outage. `browser` additionally names why it is **structural** rather than unimplemented —+- **Canvas-control** (`agent:control`) is opt-in on the Server Edition. With the feature disabled,+ `/control/<verb>` answers HTTP 400 with `error: control-unsupported-on-this-edition` and a+ sentence containing the literal *"do not retry"*. With it enabled, only the bounded v1 verbs+ described below are wired; every other verb receives the same named permanent refusal.+ `browser` additionally names why it is **structural** rather than unimplemented —a browser node on this edition renders in the **viewer's own** browser tab, which thisserver has no debugger for, and never can. The whole `browser` drive set shipped overS8 (nav/read/click/type/press/scroll/wait/screenshot/cookies) is therefore **desktop-only**:it needs Electron's `<webview>` + CDP, which this edition has none of, so there is nobrowser driving here at all. See `src/server/control-unsupported.ts`.- The agent-messaging verbs (`send`/`reply`/`notify`) are additionally **verified-only at- the route** on every edition, so on this one an unverified caller gets the flat 403- messaging refusal and a verified caller gets the same- `control-unsupported-on-this-edition` — both terminal, neither an invitation to retry.+ The agent-messaging verbs (`send`/`reply`/`notify`) are verified-only. When Server control is+ enabled they additionally require process-local proof that the caller spawned the target in this+ run; with control disabled they receive `control-unsupported-on-this-edition`.- The **`ptyDestroy` tail-teardown** — *resolved in Phase 3c.* Phase 3b left this skipped(agent tails self-cleared only on `SessionEnd`, so a node closed *without* one left anidle file-tail); the server now untracks agent tails on node close, at desktop parity.@@ -522,13 +520,34 @@ desktop parity on agent-tail cleanup and first-connect behavior:boots the app into a broken/blank state — the bridge shows the standard reconnect overlayand the app reloads on reopen, so first-load failure now behaves like a mid-session drop.-**Still deferred** (unchanged from Phase 3b): the SDK **chat node**, **canvas-control**-(`agent:control` / the `nodeterm` CLI verbs — now a *named, non-retryable* refusal rather-than a generic failure, see above), full **two-master flow-control coordination**+**Still deferred:** the SDK **chat node**, full+**two-master flow-control coordination**(the server still re-asserts its WS backpressure pause on each send rather than co-managinga single actuator with the renderer), and the web folder picker's **hardcoded startdirectory**.+### Opt-in canvas control and creator ownership++Server canvas control is disabled by default. Set `NODETERM_SERVER_CANVAS_CONTROL=1` (or pass+`--canvas-control`) to install the Server-local shim and enable its `/control/*` implementation.+Every enabled request requires verified node identity.++Ownership is intentionally narrower than the desktop confirmation UI: an agent may mutate, message,+or close only a node it opened during the current Server process run. Link, group, rename, color,+sticky updates, dependency targets, message delivery, and close validate their complete target set+before any write or PTY kill; an unowned member refuses the whole operation. Queued messages repeat+the creator check at flush time in addition to the existing verified and per-project switch gates.++The creator ledger is memory-only and is never reconstructed from a project file, title, hook+record, or tmux session name. After a service restart it is empty, and boot performs no canvas-node+or terminal-session adoption: it does not attach-or-create missing backends and does not send a+persisted queued command even when a tmux backend survived. A later explicit owner open or browser+view is the only cold-spawn path. Plain terminals carry no agent identity or canvas-control grant;+missing `agentId` never means Claude.++Validate upgrades with a disposable `NODETERM_DATA_DIR` and port. Restarting a shared live Server+service is an explicit operator action; it is not part of a test, repair, or boot-rescue flow.+### Managed Claude accountsManaged Claude accounts (several logged-in Claude identities side by side, each with its owndiff --git a/src/core/agents/agent-message-decide.ts b/src/core/agents/agent-message-decide.tsindex ef5236452..104811c4d 100644--- a/src/core/agents/agent-message-decide.ts+++ b/src/core/agents/agent-message-decide.ts@@ -30,6 +30,10 @@ export type NotPermittedReason =| 'self-send'| 'unsupported-edition'| 'unaddressable-node-id'+ /** Server Edition's process-local creator ledger says the sender did not spawn this target in+ * the current server run. This is separate from pane/project ownership: proving which project+ * spawned a pane does not prove which agent is allowed to control it. */+ | 'caller-not-owner'/** The target id names nodes in MORE THAN ONE project while panes are keyed by the bare id —* one global pane, several possible owners, and one of them may be ungranted. Refused because* the per-project grant cannot be attributed (PR #237 review I-1); its own word because thediff --git a/src/core/agents/agent-messaging.ts b/src/core/agents/agent-messaging.tsindex 3833c435f..dcaebdc4a 100644--- a/src/core/agents/agent-messaging.ts+++ b/src/core/agents/agent-messaging.ts@@ -88,6 +88,12 @@ export interface AgentMessagingDeps {* refuse `unproven-target-owner`.*/paneOwnerProject(nodeId: string): string | undefined+ /**+ * Optional shell-specific creator gate. Server Edition supplies its process-local caller→target+ * proof so message delivery cannot type into a session the caller did not spawn. Desktop omits+ * this because its control path remains user-confirmed. Checked on every queued flush too.+ */+ callerOwnsTarget?(sourceNodeId: string, targetNodeId: string): booleancustomAgents(): readonly { id: string; launchCmd: string }[] | undefinedappendBoardLog(projectId: string, entry: BoardLogEntry): Promise<boolean>/** Test seam: override the receipt subscription. Production uses the module bus below. */@@ -293,6 +299,9 @@ const NOT_PERMITTED_TEXT: Record<NotPermittedReason, string> = {'self-send': 'a node cannot message itself.','unsupported-edition': 'agent messaging does not exist on this edition.','unaddressable-node-id': 'that node id cannot be addressed safely.',+ 'caller-not-owner':+ 'the sending agent did not spawn the target during this Server run, so it may not type into ' ++ 'or notify that session. This ownership refusal is permanent for this target.','ambiguous-target-node-id':'that node id exists in more than one project, so the target pane cannot be attributed to a ' +'single project\'s messaging grant. De-duplicate the id (re-add the cloned folder to mint ' +@@ -468,6 +477,10 @@ export async function runDelivery(const scope = resolveDeliveryScope(projects, req.sourceNodeId, req.targetNodeId)let notPermitted = scopeRefusal(scope)const projectId = scope.kind === 'same-project' ? scope.projectId : undefined+ if (!notPermitted && deps.callerOwnsTarget &&+ !deps.callerOwnsTarget(req.sourceNodeId, req.targetNodeId)) {+ notPermitted = 'caller-not-owner'+ }if (!notPermitted) {// OWNERSHIP IS PROVEN AT RUNTIME, NOT READ FROM THE STORE (PR #237 fix round 2). The scope// above resolved `projectId` from the persisted node-set, which is attacker-writable — a@@ -499,10 +512,11 @@ export async function runDelivery(const owner = projects.find((p) => p.id === projectId)const sourceNode = owner?.nodes.find((n) => n.id === req.sourceNodeId)const targetNode = owner?.nodes.find((n) => n.id === req.targetNodeId)- // The spawn-time default (`options.agentId ?? 'claude'`), mirrored: a plain terminal node got- // the claude hook env at spawn, so its pane is judged against claude's binaries — and a bare- // shell in it still refuses as `targetNotAgentPane`.- const targetAgentId = targetNode?.agentId ?? 'claude'+ // A plain terminal is not Claude by default. A hand-launched agent may still prove its runtime+ // identity through a hook event; absent either stored or runtime evidence, the binary predicate+ // receives an unknowable identity and refuses instead of guessing a provider.+ const targetAgentId = targetNode?.agentId ??+ (deps.mirrorEntry ?? coreMirrorEntry)(req.targetNodeId)?.agentId ?? ''const delivery: DeliveryDeps = {paneOwner: (id) => deps.paneOwner(id),diff --git a/src/core/agents/hook-server.env.test.ts b/src/core/agents/hook-server.env.test.tsindex e18947ffe..5ba4ac825 100644--- a/src/core/agents/hook-server.env.test.ts+++ b/src/core/agents/hook-server.env.test.ts@@ -35,6 +35,14 @@ afterAll(() => {})describe('hookServer.buildPtyEnv — canvas control gate', () => {+ it('gives a plain terminal node identity without pretending it is an agent', () => {+ const env = hookServer.buildPtyEnv('plain')+ expect(env.NODETERM_NODE_ID).toBe('plain')+ expect(env).not.toHaveProperty('NODETERM_AGENT_ID')+ expect(env).not.toHaveProperty('NODETERM_CANVAS_CONTROL')+ expect(env).not.toHaveProperty('NODETERM_PERM_WAIT_SECS')+ })+it('arms canvas control for a grok session', () => {expect(hookServer.buildPtyEnv('n1', 'grok').NODETERM_CANVAS_CONTROL).toBe('1')})diff --git a/src/core/agents/hook-server.ts b/src/core/agents/hook-server.tsindex 01c73ff61..3e5428cdb 100644--- a/src/core/agents/hook-server.ts+++ b/src/core/agents/hook-server.ts@@ -1064,7 +1064,7 @@ class HookServer {// managed permission hook holds for that many seconds for a phone/canvas answer file before// falling through to Claude's interactive prompt. 0/undefined ⇒ NODETERM_PERM_WAIT_SECS absent ⇒// the hook's wait-branch is inert (exact legacy behavior). See docs/hook-reply-approvals.md.- buildPtyEnv(nodeId: string, agentId: AgentId, permWaitSecs = 0): Record<string, string> {+ buildPtyEnv(nodeId: string, agentId?: AgentId, permWaitSecs = 0): Record<string, string> {if (this.port <= 0 || !this.token) return {}return {// NO NODETERM_HOOK_TOKEN, NO NODETERM_HOOK_PORT — measured 2026-08-13: these ride the tmux@@ -1086,9 +1086,9 @@ class HookServer {// what a sandboxed sh could not read....(this.sockPath ? { NODETERM_HOOK_SOCK: this.sockPath } : {}),NODETERM_NODE_ID: nodeId,- NODETERM_AGENT_ID: agentId,- ...(permWaitSecs > 0 ? { NODETERM_PERM_WAIT_SECS: String(permWaitSecs) } : {}),- ...(canControlCanvas(agentId) ? { NODETERM_CANVAS_CONTROL: '1' } : {})+ ...(agentId ? { NODETERM_AGENT_ID: agentId } : {}),+ ...(agentId && permWaitSecs > 0 ? { NODETERM_PERM_WAIT_SECS: String(permWaitSecs) } : {}),+ ...(agentId && canControlCanvas(agentId) ? { NODETERM_CANVAS_CONTROL: '1' } : {})// NO NODETERM_CODEX_NODE_TOKEN either. The per-node capability is the same class of leak as// the app-wide bearer above, and a worse one to reason about: it is the credential that// proves WHICH node is calling, so a sibling uid reading it off /proc/<pid>/cmdline coulddiff --git a/src/core/canvas-control-core.ts b/src/core/canvas-control-core.tsindex 5bfb78781..f31a19a8a 100644--- a/src/core/canvas-control-core.ts+++ b/src/core/canvas-control-core.ts@@ -292,6 +292,11 @@ export function buildCanvasControlInstructions(shimPath: string): string {'starts with `--` (`--cmd=--version`); written as two tokens, a leading `--` is read as the next','flag. A flag with no value is allowed anywhere on the line.','',+ 'Server Edition ownership is fail-closed: every request requires verified node identity, and',+ 'a caller may mutate or message only nodes it opened during the current server run.',+ 'Restarting the server clears that creator proof; persisted nodes and queued launches are never',+ 'auto-adopted, relaunched, or controlled at boot. An unowned target receives a named refusal.',+ '','Verbs:','- `list` — current nodes (id, kind, title). Start here when you need a node id.','- `open-terminal [--count N] [--cwd P] [--cmd C] [--group <id>] [--after <id,id>] [--project <id>]` — open N plain terminals.',@@ -331,7 +336,8 @@ export function buildCanvasControlInstructions(shimPath: string): string {'- `link --to <id,id> [--from <id>]` — context-link nodes so each can READ the other\'s transcript',' on demand (nodeterm linked-context CLI). `--from` defaults to you; nothing is pushed into the',' linked sessions. Agent sessions you open are linked to you automatically — use `link` for nodes',- ' you did not open, or to link two OTHER nodes together.',+ ' you did not open, or to link two OTHER nodes together. On Server Edition the ownership rule',+ ' is stricter: every endpoint must be a node you opened during this server run.','- `verify --node <id> [--lenses correctness,security,tests] [--focus "..."] [--synthesis off]` — open a',' review panel over that node\'s work: one reviewer per lens, each armed behind the target and linked',' to it, plus a judge armed behind the panel that merges the findings into one verdict. Reviewers are',@@ -346,11 +352,12 @@ export function buildCanvasControlInstructions(shimPath: string): string {'- `rename --node <id> --title "New Name"` — rename any node (terminals, groups, stickies…).',`- \`color --node <id,id> --color C\` — recolor nodes, frames, or stickies. C is one of: ${NODE_COLORS.join(', ')}.`,'- `write --node <id> --text "..."` / `close --node <id>` — type into / close a node.',- ' Desktop asks the user to confirm both. Server Edition close is narrower: only nodes this',- ' caller opened during the current server run can be closed, and those close without a dialog;',- ' every other target receives a named ownership refusal.',+ ' Desktop asks the user to confirm both. Server Edition is narrower: close requires a node this',+ ' caller opened during the current server run, and all node-mutating verbs (link/group/rename/',+ ' color/sticky update) accept only current-run creations; every other',+ ' target receives a named ownership refusal before any partial mutation.','- `send --node <id> --text "..."` / `reply --node <id> --text "..."` — deliver a message into',- ' another AGENT node in this project (no confirm dialog: verified-only, gated by the project\'s',+ ' an AGENT node the caller opened this run (no confirm dialog: verified-only, gated by the project\'s',' agent-messaging switch — off by default — and rate-limited). A busy target is not interrupted',' and does not lose the message: it is queued (bounded, TTL\'d) and delivered when the target',' next goes idle. An incoming message is framed `--- NODETERM MESSAGE <nonce> ---` with a `reply-to:`',@@ -637,6 +644,11 @@ starts with \`--\` (\`--cmd=--version\`); written as two tokens, a leading \`--\next flag, so \`--text --oops\` sends an empty \`--text\` plus a stray \`--oops\`. A flag with novalue is allowed anywhere on the line, not only at the end.+Server Edition ownership is fail-closed: every request requires verified node identity, and a+caller may mutate or message only nodes it opened during the current server run. Restarting+the server clears that creator proof; persisted nodes and queued launches are never auto-adopted,+relaunched, or controlled at boot. An unowned target receives a named refusal.+Verbs:- \`list\` — list current nodes (id, kind, title). Start here when you need a node id.- \`open-terminal [--count N] [--cwd P] [--cmd C] [--group <id>] [--after <id,id>] [--project <id>]\` — open N plain terminals (default 1).@@ -698,6 +710,8 @@ Verbs:pushed into the linked sessions — reading is on demand, so linking never interrupts anyone.Agent sessions you open (\`open-claude\`/\`open-agent\`/\`spawn-team\`) are linked to youautomatically; use \`link\` for nodes you did not open, or to link two OTHER nodes together.+ On Server Edition the ownership rule is stricter: every endpoint must be a node you opened+ during this server run.- \`verify --node <id> [--lenses correctness,security,tests] [--focus "..."] [--agent <id>] [--synthesis off] [--label L]\` —open a review PANEL over that node's work: one reviewer per lens, each armed behind the target(they start when it goes idle) and linked to it so they can read what it actually did, plus a@@ -722,10 +736,11 @@ Verbs:- \`color --node <id,id> --color C\` — recolor nodes, frames, or stickies. C is one of: ${NODE_COLORS.join(', ')}.- \`write --node <id> --text "..."\` — type text into a terminal node. (Asks the user to confirm.)- \`close --node <id>\` — close a node. Desktop asks the user to confirm. Server Edition closes- only nodes this caller opened during the current server run, without a dialog; every other- target receives a named ownership refusal.-- \`send --node <id> --text "..."\` — deliver a message INTO another agent node's session, in this- project only. No confirm dialog; instead it is verified-only, gated by the project's+ only nodes this caller opened during the current server run, without a dialog. Its other+ node-mutating verbs (link/group/rename/color/sticky update) likewise accept only current-run+ creations, and refuse the whole request before any partial mutation.+- \`send --node <id> --text "..."\` — deliver a message INTO an agent node the caller opened during+ this server run, in this project only. No confirm dialog; instead it is verified-only, gated by the project'sagent-messaging switch (Settings → Agents, OFF by default), and rate-limited. Delivery lands whenthe target is idle at its prompt; a BUSY target is never interrupted and does not lose themessage — it is held in a bounded, TTL'd per-target queue and delivered when the target next goesdiff --git a/src/core/pty-manager.ts b/src/core/pty-manager.tsindex 86ac94e73..6e8cee8fb 100644--- a/src/core/pty-manager.ts+++ b/src/core/pty-manager.ts@@ -2148,7 +2148,7 @@ export class PtyManager {// Rewrite the launcher on every create: it is generated, so an app upgrade must not leave an// old copy behind. Failure is not fatal — `installCodexLauncher` answers null, the caps probe// says "no shared identity", and the launch line the renderer already chose is the bare CLI.- if (hasSharedIdentity((options.agentId ?? 'claude') as AgentId) && !options.sshRemote) {+ if (options.agentId && hasSharedIdentity(options.agentId as AgentId) && !options.sshRemote) {installCodexLauncher()}// Resolved HERE rather than inside `spawnSession` because that function is synchronous and two@@ -2672,7 +2672,7 @@ export class PtyManager {// wait-branch for claude sessions when the setting is on. `permWaitSecs > 0` injects// NODETERM_PERM_WAIT_SECS; off / non-claude ⇒ 0 ⇒ absent ⇒ legacy behavior.const permWaitSecs =- this.getSettings().hookReplyApprovals && (options.agentId ?? 'claude') === 'claude'+ this.getSettings().hookReplyApprovals && options.agentId === 'claude'? PERM_WAIT_SECS_DEFAULT: 0// Materialise this node's token BEFORE the session exists, so the very first hook event the@@ -2681,7 +2681,7 @@ export class PtyManager {if (options.persistKey && !options.sshRemote) ensureNodeToken(options.persistKey)const hookEnv =options.persistKey && !options.sshRemote- ? hookServer.buildPtyEnv(options.persistKey, options.agentId ?? 'claude', permWaitSecs)+ ? hookServer.buildPtyEnv(options.persistKey, options.agentId, permWaitSecs): {}for (const [k, v] of Object.entries(hookEnv)) env[k] = v@@ -2689,7 +2689,7 @@ export class PtyManager {// managed launcher by NAME, so its directory goes first on THIS session's PATH only. A plain// terminal, and every other agent, sees the PATH it always saw. The launcher itself falls back// to the bare CLI, so a session that gets the PATH but no identity is still a working session.- if (hasSharedIdentity((options.agentId ?? 'claude') as AgentId) && !options.sshRemote) {+ if (options.agentId && hasSharedIdentity(options.agentId as AgentId) && !options.sshRemote) {env.PATH = `${codexLauncherDir()}${path.delimiter}${env.PATH ?? ''}`}@@ -2873,9 +2873,9 @@ export class PtyManager {options.sshRemote.hookEndpointPath,options.persistKey,hookServer.getVersion(),- // Same default the local path applies (`hookServer.buildPtyEnv(persistKey, agentId ??- // 'claude', …)`) so a remote node's agent env matches its local twin exactly.- options.agentId ?? 'claude'+ // Plain terminals carry no agent identity or control grant. An explicit agent node+ // matches the local `buildPtyEnv` path exactly.+ options.agentId),// Arm the remote permission hook's wait-branch too (deterministic approvals over SSH):// the request/answer files live on the REMOTE host; the desktop answers over thediff --git a/src/core/pty-single-user.test.ts b/src/core/pty-single-user.test.tsindex 2ea5a4523..042ce9278 100644--- a/src/core/pty-single-user.test.ts+++ b/src/core/pty-single-user.test.ts@@ -369,6 +369,8 @@ describe('SINGLE-USER REGRESSION: co-attach must not change the solo path', () =// Plain shells still inherit the user's ordinary process environment; the gateway neither// overwrites it nor emits an explicit tmux session value.expect(spawnArgs[0].env.ANTHROPIC_AUTH_TOKEN).toBe('preexisting-shell-token')+ expect(spawnArgs[0].env.NODETERM_AGENT_ID).toBeUndefined()+ expect(spawnArgs[0].env.NODETERM_CANVAS_CONTROL).toBeUndefined()expect(spawnArgs[0].args.join(' ')).not.toContain('vk-secret')expect(spawnArgs[0].args.join(' ')).not.toContain('bifrost.example.test')} finally {diff --git a/src/main/agent-messaging.test.ts b/src/main/agent-messaging.test.tsindex 04d84489a..5752ae6e6 100644--- a/src/main/agent-messaging.test.ts+++ b/src/main/agent-messaging.test.ts@@ -114,6 +114,21 @@ describe('deliverFromControl', () => {expect(deps.rec.sent).toEqual([])})+ it('revalidates an injected caller-to-target creator gate before touching the pane', async () => {+ const owns = vi.fn(() => false)+ const deps = fakeDeps({ callerOwnsTarget: owns })+ const { outcome, reply } = await deliverFromControl(req(), deps)++ expect(outcome).toEqual({ kind: 'notPermitted', reason: 'caller-not-owner' })+ expect(reply).toMatchObject({+ ok: false,+ error: expect.stringContaining('caller-not-owner')+ })+ expect(owns).toHaveBeenCalledWith('a1', 'b1')+ expect(deps.rec.paneOwnerCalls).toEqual([])+ expect(deps.rec.sent).toEqual([])+ })+it('refuses a cross-project target and a self-send, resolved off the store', async () => {const deps = fakeDeps()const cross = await deliverFromControl(req({ targetNodeId: 'c2' }), deps)@@ -393,6 +408,33 @@ describe('deliver-on-idle wiring (PR 7)', () => {expect(flushed).toHaveBeenCalledTimes(1)})+ it('drops a queued send if caller ownership is gone before the idle flush', async () => {+ let owns = true+ const busy: MirrorEntry = {+ state: 'working',+ updatedAt: 1,+ stateVerified: true,+ clientRevision: MANAGED_SCRIPT_REVISION+ }+ const deps = fakeDeps({+ mirrorEntry: () => busy,+ callerOwnsTarget: () => owns+ })+ const queue = createDeliveryQueue(deps, { schedule: () => () => {} })+ deps.queue = queue++ expect((await deliverFromControl(req(), deps)).outcome.kind).toBe('queued')+ expect(queue.depth('b1')).toBe(1)+ owns = false++ onMessagingAgentEvent(+ { nodeId: 'b1', state: 'done', verified: true, newTurn: false },+ queue+ )+ await vi.waitFor(() => expect(queue.depth('b1')).toBe(0))+ expect(deps.rec.sent).toEqual([])+ })+it('without a queue, the same busy target is refused `targetBusy` (old behaviour intact)', async () => {const busy: MirrorEntry = { state: 'working', updatedAt: 1, stateVerified: true, clientRevision: MANAGED_SCRIPT_REVISION }const deps = fakeDeps({ mirrorEntry: () => busy })diff --git a/src/main/canvas-control-core.test.ts b/src/main/canvas-control-core.test.tsindex 13efc27ca..a64a45ba9 100644--- a/src/main/canvas-control-core.test.ts+++ b/src/main/canvas-control-core.test.ts@@ -342,6 +342,16 @@ describe('parseControlRequest', () => {}})+ it('both agent-facing texts state the Server creator-ownership and inert-boot contract', () => {+ for (const body of [buildCanvasSkillBody('/x/shim.sh'), buildCanvasControlInstructions('/tmp/nodeterm.sh')]) {+ expect(body).toContain('ownership is fail-closed')+ expect(body).toContain('verified node identity')+ expect(body).toContain('current server run')+ expect(body).toMatch(/never[\s\S]*auto-adopted[\s\S]*relaunched[\s\S]*controlled at boot/)+ expect(body).toContain('before any partial mutation')+ }+ })+it('renders the RETRYABLE table — the table is the source, not a re-typed copy', () => {const body = buildCanvasSkillBody('/x/shim.sh')const yesAt = body.indexOf('Worth retrying')diff --git a/src/renderer/lib/controlRouting.test.ts b/src/renderer/lib/controlRouting.test.tsindex 510642101..5ccab3331 100644--- a/src/renderer/lib/controlRouting.test.ts+++ b/src/renderer/lib/controlRouting.test.ts@@ -103,9 +103,9 @@ describe('needsLiveCanvas', () => {})describe('sourceIsControlCapable', () => {- it('defaults a plain terminal node (no agentId) to claude, mirroring the spawn-time env', () => {- expect(sourceIsControlCapable(undefined)).toBe(true)- expect(sourceIsControlCapable('')).toBe(true)+ it('does not relabel a plain terminal node as Claude', () => {+ expect(sourceIsControlCapable(undefined)).toBe(false)+ expect(sourceIsControlCapable('')).toBe(false)})it('accepts every canvas-control-capable agent', () => {diff --git a/src/renderer/lib/controlRouting.ts b/src/renderer/lib/controlRouting.tsindex e25069e52..a4dbfd3db 100644--- a/src/renderer/lib/controlRouting.ts+++ b/src/renderer/lib/controlRouting.ts@@ -131,13 +131,12 @@ export function needsLiveCanvas(verb: string): boolean {/*** The capability half of the guard: may a session in this node drive the canvas?*- * The empty/absent default MIRRORS pty-manager's spawn-time default (`options.agentId ?? 'claude'`):- * a plain terminal node received the claude hook env at spawn, so a manual `claude` there holds- * NODETERM_CANVAS_CONTROL — rejecting it here would contradict the env it was handed.+ * Plain terminals are not agent nodes. Treating missing identity as Claude made a bare shell look+ * control-capable and let recovery code relabel it as an agent. A hand-launched CLI is still+ * observable through its runtime hooks, but the serialized node does not gain agent authority.*/export function sourceIsControlCapable(agentId: unknown): boolean {- const id = typeof agentId === 'string' && agentId ? agentId : 'claude'- return canControlCanvas(id as AgentId)+ return typeof agentId === 'string' && agentId.length > 0 && canControlCanvas(agentId as AgentId)}/**diff --git a/src/server/canvas-control.test.ts b/src/server/canvas-control.test.tsindex 38d721285..2ad89876b 100644--- a/src/server/canvas-control.test.ts+++ b/src/server/canvas-control.test.ts@@ -140,16 +140,30 @@ describe('initServerCanvasControl', () => {verified: true})expect(opened).toMatchObject({ ok: true })+ const openedId = (opened.result as { id: string }).idexpect(sendText.mock.calls.at(-1)?.[1]).toBe("nodeterm-codex 'identity proof' --ask-for-approval on-request")- // Prove ownership so the next gate reached is specifically the per-project capability switch.- recordFreshSpawnOwner('target', 'p1')+ const unowned = await runtime.handler({+ verb: 'send',+ nodeId: 'source',+ args: { node: 'target', text: 'must not land' },+ verified: true+ })+ expect(unowned).toMatchObject({+ ok: false,+ error: expect.stringContaining('caller-not-owner')+ })+ expect(paneOwner).not.toHaveBeenCalled()++ // Prove pane ownership for the caller's own spawn so the next gate reached is specifically the+ // per-project capability switch.+ recordFreshSpawnOwner(openedId, 'p1')const reply = await runtime.handler({verb: 'send',nodeId: 'source',- args: { node: 'target', text: 'hello' },+ args: { node: openedId, text: 'hello' },verified: true})expect(reply).toMatchObject({@@ -211,11 +225,11 @@ describe('initServerCanvasControl', () => {createHeadless: vi.fn(async () => ({ sessionId: 'unused', fresh: true })),captureSession: vi.fn(async () =>pasted ? `Claude composer\n${pasted.split('\n').at(-1)}` : 'Claude composer'),- sendText: vi.fn(async (_nodeId: string, text: string, opts?: { enter?: boolean }) => {+ sendText: vi.fn(async (nodeId: string, text: string, opts?: { enter?: boolean }) => {writes.push({ text, enter: opts?.enter })if (text) pasted = textelse queueMicrotask(() => runtime?.onAgentEvent({- nodeId: 'target',+ nodeId,agentId: 'claude',kind: 'state',state: 'working',@@ -238,17 +252,6 @@ describe('initServerCanvasControl', () => {hasLiveSession: () => true} as unknown as PtyManager- recordFreshSpawnOwner('target', 'p1')- expect(writeNodeTokenFile('target', 'token')).toBe(true)- recordAgentEvent({- nodeId: 'target',- agentId: 'claude',- kind: 'state',- state: 'done',- verified: true,- clientRevision: MANAGED_SCRIPT_REVISION- } as never)-runtime = await initServerCanvasControl({workspaceStore: store,ptyManager: pty,@@ -257,10 +260,31 @@ describe('initServerCanvasControl', () => {installAgentIntegrations: false})+ const opened = await runtime.handler({+ verb: 'open-agent',+ nodeId: 'source',+ args: { agent: 'claude', prompt: 'owned target' },+ verified: true+ })+ expect(opened).toMatchObject({ ok: true })+ const targetId = (opened.result as { id: string }).id+ writes.length = 0+ pasted = ''+ recordFreshSpawnOwner(targetId, 'p1')+ expect(writeNodeTokenFile(targetId, 'token')).toBe(true)+ recordAgentEvent({+ nodeId: targetId,+ agentId: 'claude',+ kind: 'state',+ state: 'done',+ verified: true,+ clientRevision: MANAGED_SCRIPT_REVISION+ } as never)+const reply = await runtime.handler({verb: 'send',nodeId: 'source',- args: { node: 'target', text: 'hello' },+ args: { node: targetId, text: 'hello' },verified: true})expect(reply).toMatchObject({ ok: true, message: expect.stringContaining('delivered') })diff --git a/src/server/canvas-control.ts b/src/server/canvas-control.tsindex 5aa218c61..4f4852c67 100644--- a/src/server/canvas-control.ts+++ b/src/server/canvas-control.ts@@ -163,6 +163,8 @@ export async function initServerCanvasControl(messagingEnabled: messagingEnabledVia((projectId) =>deps.workspaceStore.capabilityProjectFor(projectId)),paneOwnerProject,+ callerOwnsTarget: (sourceNodeId, targetNodeId) =>+ factory.ownsSpawn(sourceNodeId, targetNodeId),customAgents: () => deps.settings().customAgents,appendBoardLog: (projectId, entry) => deps.boardLog.append(projectId, entry)}@@ -181,10 +183,13 @@ export async function initServerCanvasControl(rename: (sourceNodeId, args) => factory.rename(sourceNodeId, args),color: (sourceNodeId, args) => factory.color(sourceNodeId, args),sticky: (sourceNodeId, args) => factory.sticky(sourceNodeId, args),+ // `runDelivery` applies caller→target creator proof before any pane probe or write, and+ // re-applies it when a queued delivery flushes.deliver: async (input) => (await deliverFromControl(input, messaging)).reply}- // Re-adopt any durable server-owned `--after` launch with no browser connected.+ // Boot deliberately performs no canvas/session adoption. Creator proof is process-local and a+ // restart clears it, so an owner request or browser view is the only cold-spawn authority.await factory.start()return {diff --git a/src/server/control-unsupported.test.ts b/src/server/control-unsupported.test.tsindex e7d438982..48a7f644e 100644--- a/src/server/control-unsupported.test.ts+++ b/src/server/control-unsupported.test.ts@@ -236,6 +236,32 @@ describe('the enabled Server Edition handler parses and dispatches the v1 surfac)})+ it('refuses every enabled verb at the handler boundary when creator identity is unverified', async () => {+ const a = actions()+ const handler = createServerEditionControlHandler(a)++ await expect(handler({+ verb: 'group',+ nodeId: 'term-source',+ args: { nodes: 'term-source,term-target' },+ verified: false+ })).resolves.toEqual({+ ok: false,+ error: 'group-identity-refused: Server Edition canvas control requires verified node identity'+ })+ await expect(handler({+ verb: 'open-terminal',+ nodeId: 'term-source',+ args: {},+ verified: false+ })).resolves.toEqual({+ ok: false,+ error: 'open-terminal-identity-refused: Server Edition canvas control requires verified node identity'+ })+ expect(a.group).not.toHaveBeenCalled()+ expect(a.openTerminal).not.toHaveBeenCalled()+ })+it('routes messaging without trusting a notify body', async () => {const a = actions()const handler = createServerEditionControlHandler(a)diff --git a/src/server/control-unsupported.ts b/src/server/control-unsupported.tsindex 561e5a752..c3acc2c3c 100644--- a/src/server/control-unsupported.ts+++ b/src/server/control-unsupported.ts@@ -147,6 +147,15 @@ export function createServerEditionControlHandler(actions: ServerEditionControlA}const command = parseControlRequest(verb, args)if ('error' in command) return { ok: false, error: command.error }+ // Creator ownership is meaningful only for an authenticated node identity. Keep this at the+ // Server boundary so every mutating/executing verb — including ones whose factory method has no+ // `verified` parameter — fails before it can inspect or change shared state.+ if (!verified) {+ return {+ ok: false,+ error: `${command.verb}-identity-refused: Server Edition canvas control requires verified node identity`+ }+ }switch (command.verb) {case 'open-project':diff --git a/src/server/headless-node-factory.test.ts b/src/server/headless-node-factory.test.tsindex a244f5ac4..2a4f49a54 100644--- a/src/server/headless-node-factory.test.ts+++ b/src/server/headless-node-factory.test.ts@@ -16,7 +16,12 @@ import {type Settings,type Workspace} from '../shared/types'-import { HeadlessNodeFactory, type HeadlessPty } from './headless-node-factory'+import {+ createHeadlessNodeOwnership,+ HeadlessNodeFactory,+ type HeadlessNodeOwnership,+ type HeadlessPty+} from './headless-node-factory'class FakePty implements HeadlessPty {readonly creates: PtyCreateOptions[] = []@@ -36,6 +41,10 @@ class FakePty implements HeadlessPty {return { sessionId: `pty-${options.persistKey}`, fresh: true, persistent: true }}+ async sessionExists(persistKey: string): Promise<boolean> {+ return this.live.has(persistKey)+ }+async sendText(nodeId: string, text: string): Promise<boolean> {this.sends.push({ nodeId, text })return true@@ -84,6 +93,7 @@ describe('HeadlessNodeFactory', () => {let removed: string[]let publishedProjects: Workspace['projects']let factory: HeadlessNodeFactory+ let ownership: HeadlessNodeOwnershiplet codexSharedIdentity: booleanconst settings = (): Settings => ({@@ -105,6 +115,15 @@ describe('HeadlessNodeFactory', () => {removed = []publishedProjects = []codexSharedIdentity = false+ ownership = createHeadlessNodeOwnership()+ ownership.record('term-upstream', {+ sourceNodeId: 'term-source',+ projectId: 'project-1'+ })+ ownership.record('term-owned', {+ sourceNodeId: 'term-source',+ projectId: 'project-1'+ })const initial: Workspace = {version: 2,activeProjectId: 'project-1',@@ -115,7 +134,11 @@ describe('HeadlessNodeFactory', () => {color: '#0a84ff',cwd: projectDir,viewport: { x: 0, y: 0, zoom: 1 },- nodes: [terminal('term-source', 'Director'), terminal('term-upstream', 'Upstream', 'codex', 80)],+ nodes: [+ terminal('term-source', 'Director'),+ terminal('term-upstream', 'Upstream', 'codex', 80),+ terminal('term-owned', 'Owned', 'gemini', 900)+ ],bridges: [],ropes: []}@@ -133,6 +156,7 @@ describe('HeadlessNodeFactory', () => {sessionIdFlag: false}),codexSharedIdentity: async () => codexSharedIdentity,+ ownership,stateOf: (id) => states[id],publishNode: (_projectId, node) => published.push(node),publishRemoval: (_projectId, nodeId) => removed.push(nodeId),@@ -350,36 +374,98 @@ describe('HeadlessNodeFactory', () => {expect(pty.destroys).toEqual([])})- it('links the caller to an existing node, persists the read graph, and fans out without writing to a pane', async () => {+ it('refuses every node mutation against an unowned target without a partial write or spawn', async () => {+ const workspace = await store.load({ sideline: false })+ workspace.projects[0].nodes.push(+ terminal('term-foreign', 'Foreign', 'claude', 900),+ {+ id: 'sticky-foreign',+ kind: 'sticky',+ position: { x: 1200, y: 30 },+ size: { width: 240, height: 200 },+ title: 'Foreign note',+ color: '#ffd60a',+ group: null,+ text: 'do not touch'+ }+ )+ await store.save(workspace)+ const before = structuredClone((await store.load({ sideline: false })).projects[0])++ const replies = [+ await factory.link('term-source', { to: 'term-foreign' }, true),+ await factory.group('term-source', { nodes: 'term-source,term-foreign' }),+ await factory.rename('term-source', { node: 'term-foreign', title: 'Stolen' }),+ await factory.color('term-source', { node: 'term-foreign', color: '#32d74b' }),+ await factory.sticky('term-source', { node: 'sticky-foreign', append: 'stolen' }),+ await factory.openAgent(+ 'term-source',+ { agent: 'claude', after: 'term-foreign', prompt: 'wait on foreign work' },+ true+ )+ ]++ expect(replies.map((reply) => reply.ok)).toEqual([false, false, false, false, false, false])+ expect(replies.map((reply) => reply.error)).toEqual([+ expect.stringContaining('link-not-owner'),+ expect.stringContaining('group-not-owner'),+ expect.stringContaining('rename-not-owner'),+ expect.stringContaining('color-not-owner'),+ expect.stringContaining('sticky-not-owner'),+ expect.stringContaining('open-agent-not-owner')+ ])+ expect((await store.load({ sideline: false })).projects[0]).toEqual(before)+ expect(pty.creates).toEqual([])+ expect(pty.sends).toEqual([])+ expect(published).toEqual([])+ expect(publishedProjects).toEqual([])+ })++ it('refuses to close an owned frame if doing so would reparent an unowned child', async () => {+ const opened = await factory.openTerminal('term-source', {}, true)+ const ownedId = (opened.result as { id: string }).id+ const grouped = await factory.group('term-source', { nodes: ownedId })+ const groupId = (grouped.result as { groupId: string }).groupId+ const workspace = await store.load({ sideline: false })+ const foreign = terminal('term-foreign-child', 'Foreign child')+ foreign.parentId = groupId+ workspace.projects[0].nodes.push(foreign)+ await store.save(workspace)+ pty.destroys.length = 0++ await expect(factory.close('term-source', { node: groupId }, true)).resolves.toMatchObject({+ ok: false,+ error: expect.stringContaining('close-not-owner')+ })+ expect(pty.destroys).toEqual([])+ const after = (await store.load({ sideline: false })).projects[0]+ expect(after.nodes.find((node) => node.id === groupId)).toBeDefined()+ expect(after.nodes.find((node) => node.id === 'term-foreign-child')?.parentId).toBe(groupId)+ })++ it('refuses a default link endpoint because the caller did not spawn its own node', async () => {const reply = await factory.link('term-source', { to: 'term-upstream' }, true)expect(reply).toMatchObject({- ok: true,- result: { from: 'term-source', linked: ['term-upstream'], skipped: [] }+ ok: false,+ error: expect.stringContaining('link-not-owner')})expect(pty.sends).toEqual([])const workspace = await new WorkspaceStore().load({ sideline: false })- expect(workspace.projects[0].bridges).toEqual([- {- id: 'bridge-term-source-term-upstream',- source: 'term-source',- target: 'term-upstream'- }- ])+ expect(workspace.projects[0].bridges).toEqual([])const projectFile = JSON.parse(fs.readFileSync(path.join(projectDir, '.nodeterm', 'project.json'), 'utf8')) as { bridges?: Array<{ source: string; target: string }> }- expect(projectFile.bridges).toEqual([- expect.objectContaining({ source: 'term-source', target: 'term-upstream' })- ])+ expect(projectFile.bridges).toEqual([])expect(published).toEqual([])- expect(publishedProjects.at(-1)?.bridges).toEqual(workspace.projects[0].bridges)+ expect(publishedProjects).toEqual([])})it('links two arbitrary existing nodes in the caller project', async () => {const workspace = await store.load({ sideline: false })workspace.projects[0].nodes.push(terminal('term-third', 'Third', 'gemini', 900))await store.save(workspace)+ ownership.record('term-third', { sourceNodeId: 'term-source', projectId: 'project-1' })await expect(factory.link('term-source', { from: 'term-upstream', to: 'term-third' }, true)@@ -429,14 +515,14 @@ describe('HeadlessNodeFactory', () => {const before = (await store.load({ sideline: false })).projects[0]const beforePositions = new Map(before.nodes.map((node) => [node.id, node.position]))const reply = await factory.group('term-source', {- nodes: 'term-source,term-upstream',+ nodes: 'term-upstream,term-owned',label: 'Director team'})expect(reply).toMatchObject({ok: true,result: {groupId: expect.stringMatching(/^group-/),- grouped: ['term-source', 'term-upstream'],+ grouped: ['term-upstream', 'term-owned'],skipped: 0}})@@ -445,7 +531,7 @@ describe('HeadlessNodeFactory', () => {const group = project.nodes.find((node) => node.id === groupId)!expect(project.nodes[0]).toMatchObject({ id: groupId, kind: 'group' })expect(group.title).toBe('Director team')- for (const id of ['term-source', 'term-upstream']) {+ for (const id of ['term-upstream', 'term-owned']) {const child = project.nodes.find((node) => node.id === id)!expect(child.parentId).toBe(groupId)expect({@@ -454,7 +540,7 @@ describe('HeadlessNodeFactory', () => {}).toEqual(beforePositions.get(id))}expect(published.map((node) => node.id)).toEqual(- expect.arrayContaining([groupId, 'term-source', 'term-upstream'])+ expect.arrayContaining([groupId, 'term-upstream', 'term-owned']))expect(publishedProjects.at(-1)?.nodes.find((node) => node.id === groupId)?.title).toBe('Director team'@@ -470,12 +556,12 @@ describe('HeadlessNodeFactory', () => {it('lets the creator close a nested frame only, promoting surviving members to its parent', async () => {const outerReply = await factory.group('term-source', {- nodes: 'term-source,term-upstream',+ nodes: 'term-upstream,term-owned',label: 'Outer'})const outerId = (outerReply.result as { groupId: string }).groupIdconst innerReply = await factory.group('term-source', {- nodes: 'term-source,term-upstream',+ nodes: 'term-upstream,term-owned',label: 'Inner'})const innerId = (innerReply.result as { groupId: string }).groupId@@ -497,7 +583,7 @@ describe('HeadlessNodeFactory', () => {return { x, y }}const rootsBefore = new Map(- ['term-source', 'term-upstream'].map((id) => [id, root(before, id)])+ ['term-upstream', 'term-owned'].map((id) => [id, root(before, id)]))published.length = 0publishedProjects.length = 0@@ -511,21 +597,21 @@ describe('HeadlessNodeFactory', () => {const after = (await new WorkspaceStore().load({ sideline: false })).projects[0]expect(after.nodes.some((node) => node.id === innerId)).toBe(false)expect(after.nodes.some((node) => node.id === outerId)).toBe(true)- for (const id of ['term-source', 'term-upstream']) {+ for (const id of ['term-upstream', 'term-owned']) {expect(after.nodes.find((node) => node.id === id)?.parentId).toBe(outerId)expect(root(after, id)).toEqual(rootsBefore.get(id))}expect(pty.destroys).toEqual([])expect(removed).toEqual([innerId])expect(published.map((node) => node.id)).toEqual(- expect.arrayContaining(['term-source', 'term-upstream'])+ expect.arrayContaining(['term-upstream', 'term-owned']))expect(publishedProjects.at(-1)?.nodes.some((node) => node.id === innerId)).toBe(false)})it('refuses a non-creator that tries to close a headless-created frame', async () => {const grouped = await factory.group('term-source', {- nodes: 'term-source,term-upstream'+ nodes: 'term-upstream,term-owned'})const groupId = (grouped.result as { groupId: string }).groupIdpublishedProjects.length = 0@@ -573,7 +659,7 @@ describe('HeadlessNodeFactory', () => {it('applies a validated palette color when creating a group', async () => {const reply = await factory.group('term-source', {- nodes: 'term-source,term-upstream',+ nodes: 'term-upstream,term-owned',label: 'Purple team',color: '#bf5af2'})@@ -591,7 +677,7 @@ describe('HeadlessNodeFactory', () => {it('recolors a node, frame, and sticky with persistence and fanout but no PTY write', async () => {const grouped = await factory.group('term-source', {- nodes: 'term-source,term-upstream',+ nodes: 'term-upstream,term-owned',label: 'Color targets'})const groupId = (grouped.result as { groupId: string }).groupId@@ -607,6 +693,7 @@ describe('HeadlessNodeFactory', () => {text: 'ready'})await store.save(workspace)+ ownership.record('sticky-color', { sourceNodeId: 'term-source', projectId: 'project-1' })published.length = 0publishedProjects.length = 0@@ -641,7 +728,7 @@ describe('HeadlessNodeFactory', () => {it('refuses invalid group and recolor values by name without persistence or fanout', async () => {await expect(factory.group('term-source', {- nodes: 'term-source,term-upstream',+ nodes: 'term-upstream,term-owned',color: 'var(--danger)'})).resolves.toMatchObject({ok: false,@@ -678,8 +765,10 @@ describe('HeadlessNodeFactory', () => {workspace.projects[0].nodes.unshift(frame)workspace.projects[0].nodes.push(child)await store.save(workspace)+ ownership.record('group-existing', { sourceNodeId: 'term-source', projectId: 'project-1' })+ ownership.record('term-inside', { sourceNodeId: 'term-source', projectId: 'project-1' })- for (const nodes of ['term-inside,term-source', 'group-existing,term-inside']) {+ for (const nodes of ['term-inside,term-upstream', 'group-existing,term-inside']) {await expect(factory.group('term-source', { nodes })).resolves.toMatchObject({ok: false,error: expect.stringContaining('siblings in one container')@@ -695,7 +784,7 @@ describe('HeadlessNodeFactory', () => {it('renames a node, group, and sticky durably without ever writing into their panes', async () => {const grouped = await factory.group('term-source', {- nodes: 'term-source,term-upstream',+ nodes: 'term-upstream,term-owned',label: 'Old group'})const groupId = (grouped.result as { groupId: string }).groupId@@ -711,6 +800,7 @@ describe('HeadlessNodeFactory', () => {text: 'ready'})await store.save(workspace)+ ownership.record('sticky-status', { sourceNodeId: 'term-source', projectId: 'project-1' })published.length = 0publishedProjects.length = 0@@ -801,6 +891,65 @@ describe('HeadlessNodeFactory', () => {expect(pty.sends.at(-1)).toEqual({ nodeId: id, text: command })})+ it('never cold-spawns a persisted arm during boot reconciliation', async () => {+ const workspace = await store.load({ sideline: false })+ workspace.projects[0].nodes.push({+ ...terminal('term-dormant', 'Dormant'),+ pendingLaunch: {+ after: [],+ command: "claude 'must stay dormant'",+ executor: 'server'+ }+ })+ await store.save(workspace)++ const load = vi.spyOn(store, 'load')+ await factory.start()++ expect(load).not.toHaveBeenCalled()+ expect(pty.creates).toEqual([])+ expect(pty.sends).toEqual([])+ load.mockRestore()+ expect((await store.load({ sideline: false })).projects[0].nodes+ .find((node) => node.id === 'term-dormant')?.pendingLaunch).toBeDefined()+ })++ it('does not adopt or control a persisted arm even when its backend survived', async () => {+ const workspace = await store.load({ sideline: false })+ workspace.projects[0].nodes.push({+ ...terminal('term-survivor', 'Survivor'),+ pendingLaunch: {+ after: [],+ command: "claude 'resume owned work'",+ executor: 'server'+ }+ })+ await store.save(workspace)+ pty.live.add('term-survivor')++ await factory.start()++ expect(pty.creates).toEqual([])+ expect(pty.sends).toEqual([])+ expect((await store.load({ sideline: false })).projects[0].nodes+ .find((node) => node.id === 'term-survivor')?.pendingLaunch).toBeDefined()+ })++ it('does not grant a plain shell Claude control authority by default', async () => {+ const workspace = await store.load({ sideline: false })+ workspace.projects[0].nodes.push({+ ...terminal('term-plain', 'Plain shell'),+ agentId: undefined+ })+ await store.save(workspace)++ await expect(factory.openTerminal('term-plain', {}, true)).resolves.toEqual({+ ok: false,+ error: 'source node is not a control-capable agent'+ })+ expect(pty.creates).toEqual([])+ })+it('routes a Codex launch through the managed launcher when Server shared identity is ready', async () => {codexSharedIdentity = truediff --git a/src/server/headless-node-factory.ts b/src/server/headless-node-factory.tsindex 49985b8c3..131660d55 100644--- a/src/server/headless-node-factory.ts+++ b/src/server/headless-node-factory.ts@@ -47,6 +47,8 @@ export interface ServerControlReply {/** The PtyManager surface the headless factory uses, kept narrow for deterministic tests. */export interface HeadlessPty {createHeadless(options: PtyCreateOptions): Promise<PtyCreateResult>+ /** Probe only. Boot reconciliation must never turn absence into a fresh session. */+ sessionExists(persistKey: string): Promise<boolean>sendText(nodeId: string, text: string, opts?: { enter?: boolean }): Promise<boolean>destroySession(clientId: number | null,@@ -75,6 +77,35 @@ export interface HeadlessNodeFactoryDeps {publishProject?: (project: Project) => voidschedule?: (cb: () => void, ms: number) => ReturnType<typeof setTimeout>clearSchedule?: (timer: ReturnType<typeof setTimeout>) => void+ /** Injectable only so tests can seed creator facts; production uses a fresh process-local ledger. */+ ownership?: HeadlessNodeOwnership+}++export interface HeadlessNodeOwner {+ sourceNodeId: string+ projectId: string+}++export interface HeadlessNodeOwnership {+ ownerOf(nodeId: string): HeadlessNodeOwner | undefined+ record(nodeId: string, owner: HeadlessNodeOwner): void+ forget(nodeId: string): void+ clear(): void+}++/**+ * Creator proof for Server Edition canvas mutations. Deliberately process-local: after a service+ * restart, a git-shared/hand-editable project file cannot reassert who created a node. Unknown+ * ownership therefore fails closed until this server run records a fresh agent-requested spawn.+ */+export function createHeadlessNodeOwnership(): HeadlessNodeOwnership {+ const owners = new Map<string, HeadlessNodeOwner>()+ return {+ ownerOf: (nodeId) => owners.get(nodeId),+ record: (nodeId, owner) => owners.set(nodeId, owner),+ forget: (nodeId) => owners.delete(nodeId),+ clear: () => owners.clear()+ }}const TERMINAL_LIMIT = 8@@ -138,15 +169,17 @@ function sourceProject(workspace: Workspace, nodeId: string): { project: Projectfunction effectiveAgentId(node: CanvasNodeState,runtimeAgentId: ((nodeId: string) => string | undefined) | undefined-): AgentId {- return (node.agentId || runtimeAgentId?.(node.id) || 'claude') as AgentId+): AgentId | undefined {+ const id = node.agentId || runtimeAgentId?.(node.id)+ return id ? (id as AgentId) : undefined}function sourceCanControl(node: CanvasNodeState,runtimeAgentId: ((nodeId: string) => string | undefined) | undefined): boolean {- return canControlCanvas(effectiveAgentId(node, runtimeAgentId))+ const agentId = effectiveAgentId(node, runtimeAgentId)+ return !!agentId && canControlCanvas(agentId)}function absolutePosition(project: Project, node: CanvasNodeState): { x: number; y: number } {@@ -450,7 +483,7 @@ export class HeadlessNodeFactory {private serial: Promise<unknown> = Promise.resolve()private attached = new Set<string>()/** Process-local proof that a caller created a node during THIS Server Edition run. */- private spawnedBy = new Map<string, { sourceNodeId: string; projectId: string }>()+ private ownership: HeadlessNodeOwnership/** Fresh server-spawned agents that have not emitted their first real working turn yet. */private awaitingFirstWorking = new Set<string>()/**@@ -464,7 +497,9 @@ export class HeadlessNodeFactory {private retryTimers = new Map<string, ReturnType<typeof setTimeout>>()private stopped = false- constructor(private readonly deps: HeadlessNodeFactoryDeps) {}+ constructor(private readonly deps: HeadlessNodeFactoryDeps) {+ this.ownership = deps.ownership ?? createHeadlessNodeOwnership()+ }private runExclusive<T>(work: () => Promise<T>): Promise<T> {const run = this.serial.then(work, work)@@ -495,6 +530,30 @@ export class HeadlessNodeFactory {this.publishChangeSet(project, nodes, [])}+ /** Literal creator ownership: a caller may act only on nodes it freshly spawned this run. */+ ownsSpawn(sourceNodeId: string, nodeId: string): boolean {+ return this.ownership.ownerOf(nodeId)?.sourceNodeId === sourceNodeId+ }++ /** A verified caller may mutate only a node it freshly created during this server run. */+ private ownsMutation(sourceNodeId: string, nodeId: string): boolean {+ return this.ownsSpawn(sourceNodeId, nodeId)+ }++ /** All-or-nothing ownership gate: validate every id before any canvas or session mutation. */+ private unownedMutation(sourceNodeId: string, nodeIds: readonly string[]): string | undefined {+ return nodeIds.find((nodeId) => !this.ownsMutation(sourceNodeId, nodeId))+ }++ private ownershipRefusal(verb: string, sourceNodeId: string, nodeId: string): ServerControlReply {+ return {+ ok: false,+ error:+ `${verb}-not-owner: ${sourceNodeId} may modify only nodes it spawned during this server ` ++ `run; ${nodeId} was not spawned by this caller`+ }+ }+private projectGranted(sourceNodeId: string, projectId: string): boolean {return this.projectGrants.get(sourceNodeId)?.has(projectId) ?? false}@@ -555,7 +614,7 @@ export class HeadlessNodeFactory {const node = project.nodes.find((candidate) => candidate.id === id)if (!node) return { ok: false, error: `${verb}: --after names no existing node (${id})` }const agentId = effectiveAgentId(node, this.deps.agentIdOf)- if (!hasHooks(agentId)) {+ if (!agentId || !hasHooks(agentId)) {return {ok: false,error: `${verb}: --after ${id} is not an agent session that reports when it is done`@@ -685,7 +744,7 @@ export class HeadlessNodeFactory {// refusal, never a partial destructive success whose surviving ids the caller must guess.const frameIds = new Set<string>()for (const id of ids) {- const ownership = this.spawnedBy.get(id)+ const ownership = this.ownership.ownerOf(id)if (!ownership || ownership.sourceNodeId !== sourceNodeId) {return {ok: false,@@ -693,7 +752,15 @@ export class HeadlessNodeFactory {}}const project = workspace.projects.find((candidate) => candidate.id === ownership.projectId)- if (project?.nodes.find((node) => node.id === id)?.kind === 'group') frameIds.add(id)+ const target = project?.nodes.find((node) => node.id === id)+ if (target?.kind === 'group') {+ const unownedChild = this.unownedMutation(+ sourceNodeId,+ project!.nodes.filter((node) => node.parentId === id).map((node) => node.id)+ )+ if (unownedChild) return this.ownershipRefusal('close', sourceNodeId, unownedChild)+ frameIds.add(id)+ }}// Kill terminal panes first: the durable canvas must never lose a session whose outcome is@@ -708,7 +775,7 @@ export class HeadlessNodeFactory {const removedByProject = new Map<Project, string[]>()const changedByProject = new Map<Project, Map<string, CanvasNodeState>>()for (const id of ids) {- const projectId = this.spawnedBy.get(id)!.projectId+ const projectId = this.ownership.ownerOf(id)!.projectIdconst project = workspace.projects.find((candidate) => candidate.id === projectId)const target = project?.nodes.find((node) => node.id === id)if (!project || !target) continue@@ -744,7 +811,7 @@ export class HeadlessNodeFactory {}for (const id of ids) {- this.spawnedBy.delete(id)+ this.ownership.forget(id)this.attached.delete(id)this.awaitingFirstWorking.delete(id)this.retryCount.delete(id)@@ -798,6 +865,8 @@ export class HeadlessNodeFactory {}}}+ const unowned = this.unownedMutation(sourceNodeId, [from, ...targets])+ if (unowned) return this.ownershipRefusal('link', sourceNodeId, unowned)const byId = new Map(source.project.nodes.map((node) => [node.id, node]))if (!byId.has(from)) {@@ -854,6 +923,8 @@ export class HeadlessNodeFactory {}const ids = (args.nodes ?? '').split(',').map((id) => id.trim()).filter(Boolean)+ const unowned = this.unownedMutation(sourceNodeId, ids)+ if (unowned) return this.ownershipRefusal('group', sourceNodeId, unowned)const resolvable = ids.filter((id) => source.project.nodes.some((node) => node.id === id))if (!resolvable.length) {return { ok: false, error: 'group: none of the given node ids exist' }@@ -875,7 +946,7 @@ export class HeadlessNodeFactory {source.project.nodes = grouped.nodesawait this.deps.workspaceStore.save(workspace)- this.spawnedBy.set(grouped.groupId, {+ this.ownership.record(grouped.groupId, {sourceNodeId,projectId: source.project.id})@@ -911,6 +982,9 @@ export class HeadlessNodeFactory {}const target = source.project.nodes.find((node) => node.id === id)if (!target) return { ok: false, error: `rename: no node with id ${id}` }+ if (!this.ownsMutation(sourceNodeId, id)) {+ return this.ownershipRefusal('rename', sourceNodeId, id)+ }const title = oneLine(args.title ?? '')const renamed = { ...target, title, titleAuto: false }@@ -938,6 +1012,8 @@ export class HeadlessNodeFactory {}const ids = [...new Set((args.node ?? '').split(',').map((id) => id.trim()).filter(Boolean))]+ const unowned = this.unownedMutation(sourceNodeId, ids)+ if (unowned) return this.ownershipRefusal('color', sourceNodeId, unowned)const changed = ids.map((id) => source.project.nodes.find((node) => node.id === id)).filter((node): node is CanvasNodeState => !!node)@@ -973,6 +1049,12 @@ export class HeadlessNodeFactory {: new Set(['agent', 'count', 'cwd', 'prompt', 'after', 'project', 'model']))if (flagError) return { ok: false, error: `${verb}: ${flagError}` }+ if (!verified) {+ return {+ ok: false,+ error: `${verb}-identity-refused: Server Edition ${verb} requires verified node identity`+ }+ }const workspace = await this.deps.workspaceStore.load({ sideline: false })const source = sourceProject(workspace, sourceNodeId)@@ -984,6 +1066,8 @@ export class HeadlessNodeFactory {if ('ok' in target) return targetconst after = this.resolveAfter(target, args.after, verb)if (!Array.isArray(after)) return after+ const unownedAfter = this.unownedMutation(sourceNodeId, after)+ if (unownedAfter) return this.ownershipRefusal(verb, sourceNodeId, unownedAfter)const settings = this.deps.settings()const nodeSize = terminalSize(settings)@@ -1095,13 +1179,14 @@ export class HeadlessNodeFactory {if (verb === 'open-agent') {const sourceAgent = effectiveAgentId(source.node, this.deps.agentIdOf)- if (canContextLink(sourceAgent) && canContextLink(agentId as AgentId)) {+ if (sourceAgent && canContextLink(sourceAgent) && canContextLink(agentId as AgentId)) {addEdge(bridges, source.node.id, id, 'link')}for (const depId of after) {const dep = target.nodes.find((candidate) => candidate.id === depId)- if (dep && canContextLink(effectiveAgentId(dep, this.deps.agentIdOf)) &&- canContextLink(agentId as AgentId)) addEdge(bridges, id, depId, 'link')+ const depAgent = dep ? effectiveAgentId(dep, this.deps.agentIdOf) : undefined+ if (depAgent && canContextLink(depAgent) && canContextLink(agentId as AgentId))+ addEdge(bridges, id, depId, 'link')}}}@@ -1111,7 +1196,7 @@ export class HeadlessNodeFactory {target.bridges = bridgesawait this.deps.workspaceStore.save(workspace)for (const node of created) {- this.spawnedBy.set(node.id, { sourceNodeId, projectId: target.id })+ this.ownership.record(node.id, { sourceNodeId, projectId: target.id })}this.publish(target, created)@@ -1197,6 +1282,9 @@ export class HeadlessNodeFactory {}}if (!node) return { ok: false, error: 'sticky: note disappeared while resolving it' }+ if (!created && !this.ownsMutation(sourceNodeId, node.id)) {+ return this.ownershipRefusal('sticky', sourceNodeId, node.id)+ }const write = applyStickyWrite(node.text ?? '', parsed.write)if ('error' in write) return { ok: false, error: `sticky: ${write.error}` }@@ -1205,7 +1293,7 @@ export class HeadlessNodeFactory {node.textUpdatedBy = source.node.title || source.node.idawait this.deps.workspaceStore.save(workspace)if (created) {- this.spawnedBy.set(node.id, { sourceNodeId, projectId: source.project.id })+ this.ownership.record(node.id, { sourceNodeId, projectId: source.project.id })}this.publish(source.project, [node])return {@@ -1216,9 +1304,13 @@ export class HeadlessNodeFactory {})}- /** Reattach persisted server-owned armed nodes at boot, then fire anything already satisfied. */+ /**+ * Boot is intentionally inert. Creator proof is process-local and empty after restart, so even+ * sending a persisted command would control a session this process cannot attribute. Owner opens+ * and browser views are the only cold-spawn authority; current-run agent events drive arms below.+ */start(): Promise<void> {- return this.refreshArmed()+ return Promise.resolve()}onAgentEvent(event: Pick<NormalizedAgentEvent, 'nodeId' | 'state'>): void {@@ -1237,6 +1329,9 @@ export class HeadlessNodeFactory {for (const node of project.nodes) {const pending = node.pendingLaunchif (!pending || pending.executor !== 'server' || !pending.command) continue+ // A persisted arm surviving a restart is data, not creator proof. Only a node freshly+ // spawned for this caller during the current run may receive automatic input.+ if (!this.ownership.ownerOf(node.id)) continueconst markChanged = (): void => {const list = changedByProject.get(project) ?? []if (!list.includes(node)) list.push(node)@@ -1253,14 +1348,6 @@ export class HeadlessNodeFactory {if (!(observed?.state === 'working' && observed.nodeId === depId))this.awaitingFirstWorking.add(depId)}- try {- const result = await this.attach(project, node)- if (!result.sessionId) continue- } catch {- this.scheduleRetry(node.id)- continue- }-const ready = pending.after.every((depId) => {const stillExists = project.nodes.some((candidate) => candidate.id === depId)if (!stillExists) return true@@ -1270,6 +1357,13 @@ export class HeadlessNodeFactory {: this.deps.stateOf(depId) === 'done'})if (!ready) continue+ // `sessionExists` is a probe, whereas `createHeadless` is attach-or-create. Never call+ // the latter from boot/event reconciliation: a dead node stays dormant until its owner+ // explicitly opens it or a user views it. A probe failure also stays dormant because an+ // unreadable backend is not proof that delivery is safe.+ const live = this.attached.has(node.id) ||+ await this.deps.ptyManager.sessionExists(node.id).catch(() => false)+ if (!live) continueif (!(await this.deps.ptyManager.sendText(node.id, pending.command))) {this.scheduleRetry(node.id)continue@@ -1311,7 +1405,7 @@ export class HeadlessNodeFactory {this.stopped = truefor (const timer of this.retryTimers.values()) (this.deps.clearSchedule ?? clearTimeout)(timer)this.retryTimers.clear()- this.spawnedBy.clear()+ this.ownership.clear()this.projectGrants.clear()}}diff --git a/test/server/canvas-control-boot-e2e.test.ts b/test/server/canvas-control-boot-e2e.test.tsnew file mode 100644index 000000000..419b7d6fb--- /dev/null+++ b/test/server/canvas-control-boot-e2e.test.ts@@ -0,0 +1,119 @@+import { execFileSync } from 'node:child_process'+import fs from 'node:fs'+import os from 'node:os'+import path from 'node:path'++import { afterAll, beforeAll, describe, expect, it } from 'vitest'++import { sessionName, TMUX_SOCKET } from '../../src/core/tmux-naming'+import { startServer } from '../../src/server/index'+import type { Workspace } from '../../src/shared/types'++const hasTmux = (() => {+ try {+ execFileSync('tmux', ['-V'], { stdio: 'ignore' })+ return true+ } catch {+ return false+ }+})()++const PERSIST_KEY = `boot-rescue-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`+const TMUX_TARGET = sessionName(PERSIST_KEY)++function backendExists(): boolean {+ try {+ execFileSync('tmux', ['-L', TMUX_SOCKET, 'has-session', '-t', TMUX_TARGET], {+ stdio: 'ignore'+ })+ return true+ } catch {+ return false+ }+}++describe.skipIf(!hasTmux)('disposable Server boot rescue', () => {+ let dataDir = ''+ let projectDir = ''+ let close: (() => Promise<void>) | undefined++ beforeAll(async () => {+ dataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'nt-server-boot-rescue-'))+ projectDir = fs.mkdtempSync(path.join(os.tmpdir(), 'nt-server-boot-project-'))+ const workspace: Workspace = {+ version: 2,+ activeProjectId: 'boot-project',+ projects: [+ {+ id: 'boot-project',+ name: 'Disposable boot rescue',+ color: '#0a84ff',+ cwd: projectDir,+ viewport: { x: 0, y: 0, zoom: 1 },+ nodes: [+ {+ id: PERSIST_KEY,+ kind: 'terminal',+ position: { x: 0, y: 0 },+ size: { width: 640, height: 440 },+ title: 'Persisted missing backend',+ color: '#d97757',+ group: null,+ agentId: 'claude',+ pendingLaunch: {+ after: [],+ command: "claude 'must remain dormant'",+ executor: 'server'+ }+ }+ ],+ bridges: [],+ ropes: []+ }+ ]+ }+ fs.writeFileSync(path.join(dataDir, 'workspace.json'), JSON.stringify(workspace), 'utf8')+ expect(backendExists()).toBe(false)++ const server = await startServer({+ port: 0,+ host: '127.0.0.1',+ dataDir,+ rendererDir: path.join(dataDir, 'no-renderer'),+ insecureHttp: false,+ passwordSeed: 'disposable-boot-rescue-password',+ installHooks: false,+ canvasControl: true,+ headless: false+ })+ close = server.close+ }, 30_000)++ afterAll(async () => {+ await close?.()+ // This exact session can exist only if this disposable server regressed and spawned it. Never+ // touch the tmux server or any broad target; cleanup is scoped to the test-owned unique id.+ if (backendExists()) {+ try {+ execFileSync('tmux', ['-L', TMUX_SOCKET, 'kill-session', '-t', TMUX_TARGET], {+ stdio: 'ignore'+ })+ } catch {+ // Already gone.+ }+ }+ fs.rmSync(dataDir, { recursive: true, force: true })+ fs.rmSync(projectDir, { recursive: true, force: true })+ })++ it('leaves a persisted queued node dormant when no backend exists', () => {+ expect(backendExists()).toBe(false)+ const persisted = JSON.parse(+ fs.readFileSync(path.join(dataDir, 'workspace.json'), 'utf8')+ ) as Workspace+ expect(persisted.projects[0].nodes[0].pendingLaunch).toMatchObject({+ command: "claude 'must remain dormant'",+ executor: 'server'+ })+ })+})