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(agent-status): wire mirror settings providers (local caps/accounts, per-SSH-host)
enesc0bb0b4bfa6b
diff --git a/src/main/index.ts b/src/main/index.tsindex a9f60b554..b2672be16 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -21,7 +21,9 @@ import {initAgentStatusMirror,onMirrorFlush,flush as flushAgentStatusMirror,- recordAgentEvent+ recordAgentEvent,+ setMirrorSettingsProvider,+ type MirrorSettings} from '../core/agent-status-mirror'import { initRemoteStatusPush } from './remote-ssh/remote-status-push'import { initCanvasSync } from '../core/canvas-sync'@@ -57,9 +59,13 @@ import { initClaudeUsage } from './claude-usage'import { initLicense, isPremium, getStoredEntitlement } from '../core/license'import { initRelayQuota, broadcastRelayQuota, relayQuotaAvailable } from '../core/relay-quota'import { initClaudeAccounts } from './claude-accounts'-import { claudeCliCaps, registerClaudeCliIpc } from '../core/claude-cli'+import { claudeCliCaps, registerClaudeCliIpc, type ClaudeCliCaps } from '../core/claude-cli'import { claudeConfigDirFor } from '../core/claude-config-dir'-import { isSafeLocalTranscriptPath, isSafeRemoteTranscriptPath } from '../core/claude-accounts-core'+import {+ isSafeLocalTranscriptPath,+ isSafeRemoteTranscriptPath,+ remoteAccountConfigDirAbs+} from '../core/claude-accounts-core'import { installClaudeHooksInto, ensureClaudeFullscreenTuiInto } from '../core/agents/hooks/claude'import { createPairingService } from './pairing-service'import {@@ -628,6 +634,26 @@ app.whenReady().then(async () => {})// Mirror live agent status to <userData>/agent-status.json for the external mobile host agent.initAgentStatusMirror()+ // Advertise launch settings to the mobile companion through the mirror. The provider is+ // consulted at every flush (heartbeat ≤60s), so a settings change propagates without extra+ // plumbing. Caps arrive async: re-flush once the memoized probe answers.+ let localClaudeCaps: ClaudeCliCaps | undefined+ void claudeCliCaps()+ .then((c) => {+ localClaudeCaps = c+ void flushAgentStatusMirror()+ })+ .catch(() => {})+ setMirrorSettingsProvider((): MirrorSettings => {+ const s = settingsStore.get()+ return {+ claudePermissionMode: s.claudePermissionMode,+ autoSupported: localClaudeCaps?.autoPermissionMode === true,+ claudeAccounts: (s.claudeAccounts ?? [])+ .filter((a) => !a.host && !a.pending)+ .map((a) => ({ id: a.id, dir: claudeConfigDirFor(a.id) }))+ }+ })// And push each connected SSH project's slice of it onto its host// (`~/.nodeterm/agent-status-<projectId>.json`): hook events tunnel from the host to THIS// process, so that file is the only agent-status source a phone browsing the host directly@@ -638,7 +664,24 @@ app.whenReady().then(async () => {sshProjectIds: () => workspaceStore.sshProjectIds(),nodeIdsFor: (projectId) => workspaceStore.sshProjectNodeIds(projectId),push: (projectId, json) =>- sshProjectManager ? sshProjectManager.pushAgentStatus(projectId, json) : Promise.resolve()+ sshProjectManager ? sshProjectManager.pushAgentStatus(projectId, json) : Promise.resolve(),+ settingsFor: (projectId) => {+ const s = settingsStore.get()+ const home = sshProjectManager?.remoteHomeFor(projectId)+ const hostKey = sshProjectManager?.hostKeyFor(projectId)+ return {+ claudePermissionMode: s.claudePermissionMode,+ // The phone launches claude on the REMOTE host — its CLI is the gate, never the local one.+ autoSupported: sshProjectManager?.remoteAutoPermFor(projectId) === true,+ ...(home && hostKey+ ? {+ claudeAccounts: (s.claudeAccounts ?? [])+ .filter((a) => a.host === hostKey && !a.pending)+ .map((a) => ({ id: a.id, dir: remoteAccountConfigDirAbs(home, a.id) }))+ }+ : {}) // unresolved home ⇒ no accounts advertised (fail-open), autoSupported still ships+ }+ }})// Canvas sync: the same reflector the Server Edition boots. With a single window clientIds()// returns one id, so on the desktop today it is a no-op — wired for parity (and for thediff --git a/src/main/remote-ssh/ssh-project.ts b/src/main/remote-ssh/ssh-project.tsindex 18a852add..56a97ff25 100644--- a/src/main/remote-ssh/ssh-project.ts+++ b/src/main/remote-ssh/ssh-project.ts@@ -3,7 +3,7 @@ import path from 'path'import { spawn, execFile, execFileSync } from 'child_process'import { app, ipcMain, type BrowserWindow } from 'electron'import { IPC } from '../../shared/ipc'-import { parseLsDirs, posixQuote, quoteRemotePath, remoteTmuxConf, type SshConnection } from '../../shared/ssh'+import { parseLsDirs, posixQuote, quoteRemotePath, remoteTmuxConf, sshHostKey, type SshConnection } from '../../shared/ssh'import type { SshProjectStatusEvent } from '../../shared/types'import { remoteAccountConfigDir, isSupportedClaudeVersion } from '../../core/claude-accounts-core'import { supportsAutoPermissionMode, supportsFullscreenTui } from '../../shared/agents/config'@@ -431,6 +431,18 @@ export class SshProjectManager {return this.conns.get(projectId)?.remoteHome}+ /** The connection's cached remote `--permission-mode auto` capability (undefined = not+ * probed / not connected). Feeds the agent-status settings block the phone reads. */+ remoteAutoPermFor(projectId: string): boolean | undefined {+ return this.conns.get(projectId)?.claudeAutoPermissionMode+ }++ /** `user@host` key of a connected project (matches ClaudeAccount.host). */+ hostKeyFor(projectId: string): string | undefined {+ const c = this.conns.get(projectId)+ return c ? sshHostKey(c.conn) : undefined+ }+/** Remote path of this project's pushed agent-status mirror (`~`-relative when the remote* home never resolved — the shell expands it in the commands below). */private statusFilePath(projectId: string, c: Conn): string {diff --git a/src/server/index.ts b/src/server/index.tsindex 3d8b6a21b..074c3fae1 100644--- a/src/server/index.ts+++ b/src/server/index.ts@@ -15,7 +15,14 @@ import { PtyManager } from '../core/pty-manager'import { registerCoreHandlers } from './handlers'import { hookServer } from '../core/agents/hook-server'import { installManagedAgentHooks } from '../core/agents/hooks'-import { initAgentStatusMirror } from '../core/agent-status-mirror'+import {+ initAgentStatusMirror,+ flush as flushAgentStatusMirror,+ setMirrorSettingsProvider,+ type MirrorSettings+} from '../core/agent-status-mirror'+import { claudeCliCaps, type ClaudeCliCaps } from '../core/claude-cli'+import { claudeConfigDirFor } from '../core/claude-config-dir'import { presenceHub } from '../core/presence/hub'import { initCanvasSync } from '../core/canvas-sync'import { wireAgentStatus } from './agent-status'@@ -121,6 +128,28 @@ export async function startServer(// scripts → start the loopback hook server. The hook server binds its own port independent of// the main HTTP server below.initAgentStatusMirror()+ // Advertise launch settings to the mobile companion through the mirror (same provider the+ // desktop wires in src/main/index.ts). No SSH push exists server-side, so only the local+ // provider applies. The provider is consulted at every flush (heartbeat ≤60s), so a settings+ // change propagates without extra plumbing. Caps arrive async: re-flush once the memoized+ // probe answers.+ let localClaudeCaps: ClaudeCliCaps | undefined+ void claudeCliCaps()+ .then((c) => {+ localClaudeCaps = c+ void flushAgentStatusMirror()+ })+ .catch(() => {})+ setMirrorSettingsProvider((): MirrorSettings => {+ const s = settingsStore.get()+ return {+ claudePermissionMode: s.claudePermissionMode,+ autoSupported: localClaudeCaps?.autoPermissionMode === true,+ claudeAccounts: (s.claudeAccounts ?? [])+ .filter((a) => !a.host && !a.pending)+ .map((a) => ({ id: a.id, dir: claudeConfigDirFor(a.id) }))+ }+ })wireAgentStatus(platform)// `installHooks: false` (tests) skips the merge into the user's real ~/.claude et al —// the hook it would write points into `dataDir`, which a test then deletes.