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.

Merge branch 'main' into feat/account-default-color

Uri Blochd8c46e9a920e
diff --cc CLAUDE.md
index 93b90a967,b03bac958..198ddd442
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@@ -1311,25 -1418,12 +1418,29 @@@ else, and its context links must keep c
(`resolveNewNodeAccount`: explicit submenu pick → `project.defaultAccountId` → system default
`~/.claude`), then **immutable** and **persisted** (serializers). `undefined` = system default
= **bit-for-bit legacy behavior** (no env touched). Inherited by **Branch** (the
- terminal→chat fork it also fed is gone — the SDK chat node was removed 2026-07). A pending
- (not-yet-logged-in) account resolves to `undefined` until it completes.
+ terminal→chat fork it also fed is gone — the SDK chat node was removed 2026-07). Two #419
+ rules inside the resolver: the submenu's **System row passes `null`** (an EXPLICIT system
+ pick that skips the project default — before that, the row wearing the system email launched
+ the project-default account), and validation runs against `accountsForProject`, not the raw
+ list, so a **pending** account or one **pinned to another machine's host** is never stamped
+ onto a node it cannot run on (both used to reach the missing-dir fallback at spawn).
+ - **Account default node color (`ClaudeAccount.color` / `CodexAccount.color`, optional)** — a
+ per-account default node color (Settings → Accounts) that beats the agent's own brand color in
+ `createAgentNode`, so a second login is recognizable on the canvas. Read off the SAME
+ `boundAccountId` that stamps `data.accountId`, so the color and the binding cannot drift.
+ Applied **at creation** and baked into `data.color` like any other node color: a hand-picked
+ node color is never overwritten and editing the account later repaints nothing. Unset / stale
+ id / an agent that takes no managed account ⇒ the agent's color, unchanged.
+ **Which list answers is `agentAccountColor`'s alone** (`shared/agents/account-color.ts`, one
+ definition shared by `createAgentNode` and the phone-registered node path in `src/main`):
+ claude reads `claudeAccounts`, codex reads `codexAccounts`, everything else reads nothing. The
+ two lists are keyed **independently** — nothing stops the same id appearing in both — so a node
+ colored from the other list would be repainted from a stranger's row; the swatch UI is one
+ component (`AccountColorSwatches`) rendered by both row kinds for the same reason.
+ The value is **re-validated as a string** at the read: the account lists come out of a
+ hand-editable settings.json that nothing checks field-by-field on load, and a `"color": 123`
+ would throw on `.trim()` INSIDE `createAgentNode` — stopping every new node under that account
+ from opening, with nothing pointing back at the edited file.
- **Env injection** — `pty-manager` sets `CLAUDE_CONFIG_DIR` in the spawn env AND as a tmux `-e`
(local); for a remote node it emits an **absolute-path** remote tmux `-e` built from the
connection-cached `remoteHome` (skipped **fail-open** if home is unresolved). `AUTH_ENV_STRIP`
diff --cc package-lock.json
index 2d9f21668,5d415dcc4..d267eb46a
--- a/package-lock.json
+++ b/package-lock.json
@@@ -1,12 -1,12 +1,12 @@@
{
"name": "node-terminal",
- "version": "0.3.2",
- "version": "0.3.3",
++ "version": "0.3.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "node-terminal",
- "version": "0.3.2",
- "version": "0.3.3",
++ "version": "0.3.4",
"hasInstallScript": true,
"license": "BUSL-1.1",
"dependencies": {
diff --cc src/main/index.ts
index f51ac86ac,70f2b3b8a..90a2e82dd
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@@ -3310,20 -3322,17 +3323,30 @@@ app.whenReady().then(async () =>
registerNode: (
projectId: string,
node: { id: string; title?: string; agentId?: string; accountId?: string }
- ) => workspaceStore.appendRemoteNode(projectId, node),
+ ) =>
+ workspaceStore.appendRemoteNode(
+ projectId,
+ node,
+ new Date(),
+ // Host-derived, exactly as on the canvas: the account's default color beats the agent's,
+ // so a phone-started session under a colored account is recognizable in the same way. The
+ // agent decides WHICH account list answers (agentAccountColor) — the phone supplies both
+ // ids, and the two lists are keyed independently.
+ agentAccountColor(node.agentId, node.accountId, {
+ claude: settingsStore.get().claudeAccounts ?? [],
+ codex: settingsStore.get().codexAccounts ?? []
+ })
+ ),
+ // "End session" from the phone (`pty.destroy`): the SAME two steps the desktop × performs —
+ // kill the tmux session on every socket it could live on (the sweep may have seen it on either
+ // — see the session-memory panel's kill rule), then take the node off its project's canvas
+ // (written as an outside edit, so the watcher broadcasts it and the canvas drops the node
+ // live). Node removal is best-effort by design: an unregistered phone session or an inline
+ // project has no file entry to remove, and that must not fail a destroy that already landed.
+ destroyNode: async (nodeId: string) => {
+ await ptyManager.destroySession(null, nodeId, { everySocket: true })
+ await workspaceStore.removeRemoteNode(nodeId).catch(() => false)
+ },
// Jail roots beyond the active canvas: the phone browses EVERY project (projects.list), so
// its fs/git access spans every local project root — not just the tab the desktop happens
// to have focused (that gap read as "cwd is outside the shared project roots" on the phone).