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
feat(accounts): shared contract for observed + linked Claude accounts
freshjuiceza0494c56a5db
diff --git a/src/preload/index.ts b/src/preload/index.tsindex e9c32acbe..1be99122e 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -536,7 +536,8 @@ const api: NodeTerminalApi = {add: (ctx) => ipcRenderer.invoke(IPC.claudeAccountsAdd, ctx),waitLogin: (id, ctx) => ipcRenderer.invoke(IPC.claudeAccountsWaitLogin, id, ctx),cancelWaitLogin: (id) => ipcRenderer.invoke(IPC.claudeAccountsCancelWait, id),- remove: (id, ctx) => ipcRenderer.invoke(IPC.claudeAccountsRemove, id, ctx)+ remove: (id, ctx) => ipcRenderer.invoke(IPC.claudeAccountsRemove, id, ctx),+ link: (configDir) => ipcRenderer.invoke(IPC.claudeAccountsLink, configDir)},codexAccounts: {add: () => ipcRenderer.invoke(IPC.codexAccountsAdd),diff --git a/src/renderer/bridge/ws-bridge.ts b/src/renderer/bridge/ws-bridge.tsindex 5950bad78..5928678ec 100644--- a/src/renderer/bridge/ws-bridge.ts+++ b/src/renderer/bridge/ws-bridge.ts@@ -919,7 +919,13 @@ export function buildClaudeAccountsApi(client: RpcClient): Pick<NodeTerminalApi,client.request(IPC.claudeAccountsWaitLogin, id, ctx) as Promise<{ email: string } | null>,cancelWaitLogin: (id) =>client.request(IPC.claudeAccountsCancelWait, id) as Promise<void>,- remove: (id, ctx) => client.request(IPC.claudeAccountsRemove, id, ctx) as Promise<void>+ remove: (id, ctx) => client.request(IPC.claudeAccountsRemove, id, ctx) as Promise<void>,+ link: (configDir) =>+ client.request(IPC.claudeAccountsLink, configDir) as Promise<{+ id: string+ configDir: string+ email: string | null+ }>}}}diff --git a/src/shared/agents/normalize.ts b/src/shared/agents/normalize.tsindex db8b3325d..b9cb2ca89 100644--- a/src/shared/agents/normalize.ts+++ b/src/shared/agents/normalize.ts@@ -1,4 +1,5 @@import type { AgentId } from './config'+import type { ObservedClaudeAccount } from '../types'export type AgentState = 'working' | 'waiting' | 'blocked' | 'done'@@ -74,6 +75,13 @@ export interface NormalizedAgentEvent {* Like `verified` it is a LABEL: nothing may refuse a POST because of it.*/clientRevision?: number+ /**+ * Which Claude account the posting session was OBSERVED to run under, derived by the hook server+ * from the payload's `transcript_path` (claude events only). Set by the hook server, never by a+ * normalizer. A LABEL like `verified`: it drives the per-node account chip and the account-scoped+ * transcript readers for nodes that carry no `data.accountId`; nothing may refuse or grant on it.+ */+ account?: ObservedClaudeAccount// recurringrecurringKind?: 'loop' | 'schedule' | 'cron'/** The recurring job was REMOVED (e.g. CronDelete) — take the card down. */diff --git a/src/shared/ipc.ts b/src/shared/ipc.tsindex d6a0d2abf..bdc872644 100644--- a/src/shared/ipc.ts+++ b/src/shared/ipc.ts@@ -43,6 +43,7 @@ export const IPC = {claudeAccountsWaitLogin: 'claude-accounts:wait-login',claudeAccountsCancelWait: 'claude-accounts:cancel-wait',claudeAccountsRemove: 'claude-accounts:remove',+ claudeAccountsLink: 'claude-accounts:link',// Machine-scoped managed Codex accounts (S6). Add/device-login/removal, plus the three-phase,// owner-authorized account switch (resume the SAME conversation id, never fork) and the// source-side leg of moving an idle conversation to an SSH account. See main/codex-accounts.ts.diff --git a/src/shared/types.ts b/src/shared/types.tsindex 1be5668d6..628d654e1 100644--- a/src/shared/types.ts+++ b/src/shared/types.ts@@ -1153,9 +1153,36 @@ export interface ClaudeAccount {* unset = the agent's own brand color. Read through `accountNodeColor`, which re-validates it* as a string — this file is hand-editable and nothing checks it field-by-field on load. */color?: string+ /**+ * LINKED account: an ABSOLUTE local path to a pre-existing Claude config dir the user already+ * owns (e.g. `~/.claude-2` driven by their own `CLAUDE_CONFIG_DIR` shell setup). Set only by+ * `claudeAccounts.link`; never combined with `host`. A linked account has no managed dir under+ * `{userData}/claude-accounts/` — `claudeConfigDirFor` resolves it to this path — and REMOVING+ * it only forgets the record: the directory is the user's and is never deleted. Hand-editable+ * (settings.json), so it is re-validated at every point of use (absolute, normalized).+ */+ configDir?: stringcreatedAt: number}+/**+ * Which Claude account a RUNNING session was observed to use — derived by the hook server from+ * the `transcript_path` its hooks report (`<configDir>/projects/<slug>/<session>.jsonl`), never+ * from anything the node was created with. A LABEL, exactly like `NormalizedAgentEvent.verified`:+ * it tells the UI which identity a pane is on (a hand-launched `claude` in a plain terminal, an+ * account switched by the user's own shell), it never grants anything.+ * - `accountId === null` ⇒ the system default (`<home>/.claude`).+ * - `accountId` set + `known` ⇒ a managed or linked `ClaudeAccount` from settings.+ * - `known === false` ⇒ a config dir nodeterm has no record of (`accountId` is null); the UI+ * labels it by its path and offers to link it. No filesystem read is ever made for such a dir.+ */+export interface ObservedClaudeAccount {+ /** The config dir as the hook reported it (normalized string; may be a REMOTE path for SSH nodes). */+ configDir: string+ accountId: string | null+ known: boolean+}+export interface SpeechSettings {engine: 'whisper' | 'cloud'/** WhisperModelInfo id — meaningful while engine === 'whisper'. */@@ -2390,8 +2417,16 @@ export interface ClaudeAccountsApi {waitLogin(id: string, ctx?: AccountSshCtx): Promise<{ email: string } | null>/** Cancel an in-flight `waitLogin` for this account. */cancelWaitLogin(id: string): Promise<void>- /** Delete a managed account's config dir (recursive). With an SSH `ctx`, `rm -rf` on the host. */+ /** Delete a managed account's config dir (recursive). With an SSH `ctx`, `rm -rf` on the host.+ * For a LINKED account (`configDir` set) this only forgets the record — the dir is untouched. */remove(id: string, ctx?: AccountSshCtx): Promise<void>+ /**+ * Link a PRE-EXISTING local Claude config dir as an account (see `ClaudeAccount.configDir`).+ * Validates the path (absolute, exists, is a directory, not the system `~/.claude`, not a managed+ * dir, not already linked), reads its `.claude.json` for the signed-in email (null when not logged+ * in yet), and installs the managed status hook into it. Local only — no SSH ctx.+ */+ link(configDir: string): Promise<{ id: string; configDir: string; email: string | null }>}/**