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
docs: headless start (--run-now, run) in CLAUDE.md, CONTRIBUTING, SERVER.md (#925)
review74e29c9e3f6d
diff --git a/CLAUDE.md b/CLAUDE.mdindex ec9cf8886..3c55bf0aa 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -2923,7 +2923,15 @@ command-bearing opens; this does not add a human-confirm dialog or change mobilethat landed while they were busy elsewhere, and once it fades nothing anywhere says it happened. Route **`reopen` (a CLOSED project) cold-writestoo and does NOT reopen the tab** — closing is the user's explicit "park this, keep it running", sorestoring the tab *and* activating it is the loudest form of the hijack; the reply names the closure- so a caller does not report a session as started. On the cold path `--group`/`--after` ARE resolved+ so a caller does not report a session as started. **Exception (#925):** `--run-now` (and `run`)+ restores a closed project's tab WITHOUT activating it (`unhideProject`) and starts the node+ headless. A session that is running must be findable somewhere more durable than a notice, and+ not activating it keeps the half of this rule that matters. Two cases keep the tab closed: an SSH+ project, because its nodes are refused before any claim (`remote-unsupported`), so nothing starts;+ and the welcome screen (no project active), because un-closing one there would render a canvas+ with no active project. On the welcome screen the session still starts; the project just stays in+ Recently closed.+ On the cold path `--group`/`--after` ARE resolved(unlike with `--project`, where the ids would live in another project) against the serializednodes, defaults come from the OWNING project (`projectPermissionMode(owner, …)`, its account,its `ssh`), and `--after`'s dep ropes are left to `missingDepRopes` at that project's next load.@@ -3095,10 +3103,11 @@ command-bearing opens; this does not add a human-confirm dialog or change mobilegraphs through project switches/park expiry. Attempted/legacy-unknown intent stays manual: itsclearing autosave may have been lost after Enter. Explicit Run now rechecks the foreground shell andclears any incomplete line; a refused/throwing/cancelled launch stays held, `manualOnly`.- The Server Edition's immediate open delivers through the SAME echo-verified writer- (`@shared/command-delivery`, moved out of the renderer for this), via the headless launcher- `core/headless-launch.ts` (#925): a tmux paste is not immune to zsh's rc-time tty flush (#556) or- the canonical-line cap (#706).+ The Server Edition's immediate open and its `run`, and the desktop's headless start (`--run-now` /+ `run`, below), deliver through the SAME echo-verified writer (`@shared/command-delivery`, moved+ out of the renderer for this), via the headless launcher `core/headless-launch.ts` (#925): a tmux+ paste is not immune to zsh's rc-time tty flush (#556) or the canonical-line cap (#706). The+ Server Edition's deferred `--after` release (`refreshArmed`) still pastes with `sendText`.(5) UI `initialCommand` stays until submission; serialization converts unsubmitted UI intentinto a never-attempted `pendingLaunch`, including a project switch during shell settle. A liveinitialCommand alias on remount cannot reset an attempted marker. Server saves@@ -3193,6 +3202,62 @@ command-bearing opens; this does not add a human-confirm dialog or change mobileso reporting it as "the error" would be a confident wrong fact. Reading the text, and the*failed-to-start* watchdog (a station that never emits ANY hook event — the opposite failure,which hangs dependents honestly rather than firing them wrongly), stay open.+ **Headless start (`--run-now`, `run`, #925):** `open-*` with `--run-now` into a project that is+ not on screen starts the node at once instead of "when next viewed", and `run --node <id>+ [--project <id>]` is the CLI twin of the QUEUED badge's Run now (like ▶, a `run` that starts the+ node overrides its `--after` wait). Into a project that IS on screen `--run-now` changes nothing:+ the mount path already starts the node.+ - **Flow.** The renderer builds the node as a cold open, then writes an+ `executor:'core', attempted:true, manualOnly:true` claim to disk BEFORE any spawn (never+ spawn on an unsaved claim: a failed save restores the original launch and starts nothing,+ `claim-not-saved`). Desktop main's `pty.launchHeadless` runs core `launchHeadless` on+ `desktopHeadlessRequest(req)`: `createHeadless` (client 0), then settle a fresh shell (200 ms+ quiet / 1.5 s silence cap, under an absolute `SETTLE_MAX_MS` = 5 s ceiling that output never+ extends — nothing cancels this wait, and a pane that keeps painting never goes quiet), then the+ mounted writer's trust rule (`trustsFreshShell`, `@shared/launch-trust`: a fresh session-host+ session is trusted without a probe; every other pane must pass `isLaunchShell`, and an unknown+ answer is `no-shell`, nothing typed), then the echo-verified writer (`@shared/command-delivery`),+ then `releaseHeadless`.+ - **The IPC is desktop-only and host-only.** It is registered in `src/main`, not in core+ `registerIpc`, so a Server Edition browser cannot reach it (ws-bridge declares it+ `unsupported`), and `IPC.ptyLaunchHeadless` is in `HOST_ONLY_CHANNELS`, so a relay peer that+ sends the raw request is refused host-side. `desktopHeadlessRequest` strips `sshRemote` but+ KEEPS `requireRemote`: a remote node that got this far fails closed in `spawnNew` instead of+ starting a LOCAL `nt-<id>`. The renderer refuses it earlier still: `startHeadless` answers+ `remote-unsupported` for a node carrying `ssh` / `sshRemoteTmux` before any claim, and leaves+ its launch exactly as it was.+ - **Why release the client.** An invisible client would fight the viewer's window size and+ keep the session "attached" for the reaper forever.+ - **No persistent backend** (tmux or session-host): the start is refused before any spawn+ (`not-persistent`) and the node is handed back exactly as it was, so a cold open degrades to+ an ordinary queued node. Releasing a plain shell would kill it.+ - **Outcome patch.** It lands wherever the node lives at that moment (`savePendingAnywhere`):+ the live canvas if the user switched there mid-start, otherwise the store copy plus a disk+ write. `delivered` clears the launch; any other failure keeps the claim and marks the node+ failed (amber ⚠ QUEUED, recovered by Run now).+ - **While starting.** `launchDelivery` holds `starting`: the badge reads STARTING, ▶ is disabled+ (a click would splice a second copy into the pane), `launchesToFire` skips the node, and+ `list` names it. Canvas's delivery sweep spares it (`deliveriesToRetire`): the node lives in+ ANOTHER project by design, so "not armed on this canvas" does not mean "delivered".+ - **Notice.** A batch that started at least one session raises ONE sticky "Go there" notice+ (`headlessStartNoticeText`). A failure shows on the badge and in the reply instead.+ - **`--run-now` with `--after` is refused on both editions**, before any node is built, with the+ shared `RUN_NOW_AFTER_REFUSAL` (`@shared/control-verbs`): "start now" and "start when X is+ done" contradict each other.+ - **`run` gates.** `run` is verified-only (`requiresVerified`), reaches another project only+ through `--project` + the existing grant gate (`PROJECT_TARGETABLE_VERBS`), and is+ `stored-node` off screen. The renderer's `--project` belt is ONE pure resolver,+ `resolveProjectTarget` (`lib/projectOpen.ts`), shared with the open verbs. A project ON screen+ never starts headless (`planRunVerb`): `run` there uses the mounted writer (the ▶ path) when+ the node has one. Without one, a plain queued launch replies `queued` / `starts-when-mounted`,+ because the mount delivers it; a `manualOnly` or `--after`-armed launch is refused with+ `run-not-mounted`, because the mount fires neither, and "starts when mounted" would be a+ promise nobody keeps.+ - **Server Edition.** It accepts `--run-now` as a no-op (its opens are already immediate) and+ implements `run` under creator ownership, resolving the node through the ownership record,+ never by first id match. It neither unhides a closed project nor raises a notice, the same as+ its other immediate opens. Its immediate open delivers through the same launcher with+ `release:false`: the attached client is what keeps even a plain shell reachable there.**Settings (`settings`, 2026-09):** `settings [--project <id>]` lists, `settings --get <key>`reads, `settings --set <key> --value <v> [--project <id>]` asks to change — flags only, because theshim drops a positional sub-action for an unlisted verb and an SSH host keeps the shim it got atdiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 02bc4db9d..5df47503a 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -778,9 +778,10 @@ coordinate nodeterm, not external editors, so do not claim a filesystem-wide comuntil delivery is acknowledged, and report `queued` while it is held. A successful terminal sendproves delivery only; never describe it as a healthy/running agent without agent evidence.Every launch uses the echo-verified command writer (`@shared/command-delivery`), not `sendText`:-desktop automatic and Run now, and the Server Edition's immediate open (through-`core/headless-launch.ts`). The Server Edition's deferred `--after` release (`refreshArmed`) is the-one remaining `sendText` launch, pending a move that must never create a session.+desktop automatic and Run now, the desktop's headless start, and the Server Edition's immediate+open and `run` (the last three through `core/headless-launch.ts`). The Server Edition's deferred+`--after` release (`refreshArmed`) is the one remaining `sendText` launch, pending a move that must+never create a session.Keep unsubmitted UI intent durable through shell settle/unmount. New intent carries `attempted:false`;Desktop and Server save `attempted:true` before input. Never-attempted warm `--after` launches mayproceed after shell verification; attempted/legacy-unknown intent requires Run now. Only confirmed@@ -795,6 +796,13 @@ while save replaces the entire host index. A pre-input parked-project deferral knever-attempted; it must not poison the writer or trigger a retry timer.Held Desktop launches retain their attached transport even offscreen with tmux (large fan-outs costmemory). Server deferred delivery is one-shot: a failed probe/send needs explicit recovery.+A headless start (`--run-now` / `run`, #925) follows the same contract: the claim is saved before+any spawn, and "started" means the echo-verified writer submitted the line (never that the agent is+healthy). The desktop releases its headless client, so there a start without a persistent terminal+backend is refused before any spawn and hands the node back unchanged (a cold open stays an+ordinary queued node) rather than spawning a shell that the next mount would orphan. A remote (SSH)+node is refused before the claim; the desktop request keeps `requireRemote`, so core can never+start one as a local session.## Testingdiff --git a/docs/SERVER.md b/docs/SERVER.mdindex e7c6d56f0..dbf201bda 100644--- a/docs/SERVER.md+++ b/docs/SERVER.md@@ -574,6 +574,19 @@ factory had just persisted. On the new channel the browser three-way merges instare merged against the last-known disk copy, and unsaved local edits survive. Nothing is asked ofthe user, because both sides of this merge are the same application.+`open-terminal` / `open-agent` accept `--run-now` as a no-op: server opens already start at once,+headless. `--run-now` together with `--after` is refused, in the desktop's words+(`RUN_NOW_AFTER_REFUSAL`). `run --node <id>` delivers a node's retained launch (the Run now+button's job) for the node's creator only. It requires verified identity and resolves the node+through the ownership record, never by the first id match, because node ids can repeat across+projects. It refuses an SSH node before its write-ahead claim, and answers a `--project` naming any+other project as "no node with id". `run`, and every immediate open that carries a launch command,+deliver through the same echo-verified launcher the desktop's headless start uses+(`core/headless-launch.ts`), with `release:false`: the server keeps its client attached, which is+what keeps even a plain-shell session reachable. The deferred `--after` release (`refreshArmed`)+still pastes with `sendText`. Neither `--run-now` nor `run` unhides a closed project or raises a+notice, the same as the server's other immediate opens.+Validate upgrades with a disposable `NODETERM_DATA_DIR` and port. Restarting a shared live Serverservice is an explicit operator action; it is not part of a test, repair, or boot-rescue flow.