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(ssh-projects): ✦ AI-name spawns locally; widen the remote transcript jail to account dirs
enes65172b232575
diff --git a/src/core/claude-accounts-core.test.ts b/src/core/claude-accounts-core.test.tsindex bed50ea46..f009698e6 100644--- a/src/core/claude-accounts-core.test.ts+++ b/src/core/claude-accounts-core.test.ts@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest'import {accountConfigDir,remoteAccountConfigDir,+ isSafeRemoteTranscriptPath,remoteAccountConfigDirAbs,claudeKeychainService,usageCredsPaths,@@ -178,3 +179,38 @@ describe('isSafeLocalTranscriptPath', () => {expect(isSafeLocalTranscriptPath(`${acctRoot}/a1/projects-evil/x`, home, ud)).toBe(false)})})++// The remote analogue of isSafeLocalTranscriptPath. A remote node's managed account writes its+// transcripts under `~/.nodeterm/claude-accounts/<id>/projects` (remoteAccountConfigDir), NOT+// under `~/.claude/projects` — jailing to the latter alone silently dropped every hook payload+// for a remote account, which killed the session-name sync, the context meter and subagent cards.+describe('isSafeRemoteTranscriptPath', () => {+ const home = '/home/enes'+ const ok = (p: string) => isSafeRemoteTranscriptPath(p, home)++ it('accepts the system-default remote root', () => {+ expect(ok('/home/enes/.claude/projects/-srv-proj/abc.jsonl')).toBe(true)+ })++ it('accepts a managed REMOTE account root', () => {+ expect(ok('/home/enes/.nodeterm/claude-accounts/a1/projects/-srv-proj/abc.jsonl')).toBe(true)+ })++ it('rejects an arbitrary remote file (forged POST over the reverse tunnel)', () => {+ expect(ok('/home/enes/.ssh/id_rsa')).toBe(false)+ expect(ok('/etc/passwd')).toBe(false)+ })++ it('rejects a sibling-prefix root', () => {+ expect(ok('/home/enes/.claude/projects-evil/x.jsonl')).toBe(false)+ })++ it('rejects a non-projects dir inside the accounts root, and a traversing account id', () => {+ expect(ok('/home/enes/.nodeterm/claude-accounts/a1/.ssh/id_rsa')).toBe(false)+ expect(ok('/home/enes/.nodeterm/claude-accounts/../../.ssh/id_rsa')).toBe(false)+ })++ it('is false when the remote home is unknown', () => {+ expect(isSafeRemoteTranscriptPath('/home/enes/.claude/projects/x.jsonl', undefined)).toBe(false)+ })+})diff --git a/src/core/claude-accounts-core.ts b/src/core/claude-accounts-core.tsindex bc2f2c02d..b6863317d 100644--- a/src/core/claude-accounts-core.ts+++ b/src/core/claude-accounts-core.ts@@ -82,6 +82,31 @@ export function isSafeLocalTranscriptPath(return segs.length >= 2 && ACCOUNT_ID_RE.test(segs[0]) && segs[1] === 'projects'}+/**+ * Remote analogue of `isSafeLocalTranscriptPath`, for the transcript_path a REMOTE node's hooks+ * POST over the reverse tunnel. Same threat (a forged POST must not make the app read an arbitrary+ * file) and the same two-root shape, but resolved with POSIX semantics (remote hosts are POSIX)+ * and rooted at the project's remote `$HOME`:+ * - the system default `<remoteHome>/.claude/projects`, and+ * - a managed REMOTE account's `<remoteHome>/.nodeterm/claude-accounts/<accountId>/projects`+ * (see `remoteAccountConfigDir`) — jailing to the default root alone dropped every payload+ * for a remote account, which silently killed the session-name sync, the context meter and+ * the subagent cards on those nodes.+ * `remoteHome` unknown ⇒ false (fail closed: without a root there is nothing to jail against).+ */+export function isSafeRemoteTranscriptPath(abs: string, remoteHome: string | undefined): boolean {+ if (!abs || !remoteHome) return false+ const p = path.posix.resolve(abs)+ const legacyRoot = path.posix.join(remoteHome, '.claude', 'projects')+ if (p === legacyRoot || p.startsWith(legacyRoot + '/')) return true+ const accountsRoot = path.posix.join(remoteHome, '.nodeterm', 'claude-accounts')+ if (!p.startsWith(accountsRoot + '/')) return false+ // Relative to the accounts root: expect `<accountId>/projects[/…]`. `p` is normalized and+ // confirmed under `accountsRoot`, so `relative` yields no leading `..`.+ const segs = path.posix.relative(accountsRoot, p).split('/')+ return segs.length >= 2 && ACCOUNT_ID_RE.test(segs[0]) && segs[1] === 'projects'+}+/*** Claude Code ≥ 2.1 scopes its macOS Keychain service name per config dir:* 'Claude Code-credentials-' + first 8 hex chars of sha256(CLAUDE_CONFIG_DIR).diff --git a/src/main/index.ts b/src/main/index.tsindex 8f04ab0c0..fb4206c09 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -52,7 +52,7 @@ import { initLicense, isPremium, getStoredEntitlement } from '../core/license'import { initClaudeAccounts } from './claude-accounts'import { claudeCliCaps, registerClaudeCliIpc } from '../core/claude-cli'import { claudeConfigDirFor } from '../core/claude-config-dir'-import { isSafeLocalTranscriptPath } from '../core/claude-accounts-core'+import { isSafeLocalTranscriptPath, isSafeRemoteTranscriptPath } from '../core/claude-accounts-core'import { installClaudeHooksInto } from '../core/agents/hooks/claude'import { createPairingService } from './pairing-service'import {@@ -372,13 +372,24 @@ app.whenReady().then(async () => {browserGuests.delete(webContentsId)})+ // The naming agent runs LOCALLY on captured output, so it needs a cwd that exists on THIS+ // machine. An SSH-project node's `data.cwd` is a path on the REMOTE host — spawning there fails+ // (ENOENT) and the ✦ button silently did nothing. The cwd carries no meaning for naming (the+ // terminal output is in the prompt), so a remote node falls back to '' → runAgent's os.homedir().+ const localNamingCwd = (keys: string[], cwd: string): string =>+ keys.some((k) => ptyManager.sshRemoteForNode(k)) ? '' : cwd+ipcMain.handle(IPC.ptyGenerateName, async (_e, persistKey: string, cwd: string) =>- generateTerminalName(await ptyManager.captureSession(persistKey), cwd, settingsStore.get())+ generateTerminalName(+ await ptyManager.captureSession(persistKey),+ localNamingCwd([persistKey], cwd),+ settingsStore.get()+ ))ipcMain.handle(IPC.ptyGenerateGroupName, async (_e, memberKeys: string[], cwd: string) => {const contents = await Promise.all(memberKeys.map((k) => ptyManager.captureSession(k)))- return generateGroupName(contents, cwd, settingsStore.get())+ return generateGroupName(contents, localNamingCwd(memberKeys, cwd), settingsStore.get())})ipcMain.handle(IPC.ptyCapture, (_e, persistKey: string, full?: boolean) =>@@ -772,16 +783,15 @@ app.whenReady().then(async () => {}// Remote analogue of safeTranscriptPath: a remote node's transcript_path is a remote absolute// path arriving over the reverse tunnel — a forged POST must not read an arbitrary remote file.- // Jail it under the project's remote `<remoteHome>/.claude/projects` using POSIX semantics- // (remote hosts are POSIX). The `+ '/'` boundary rejects sibling-prefix paths (…/projects-evil).+ // The jail (both allowed roots, incl. a managed remote account's) is pure + unit-tested in+ // claude-accounts-core.const safeRemoteTranscriptPath = (tp: string | undefined,remoteHome: string | undefined): string | undefined => {- if (!tp || !remoteHome) return undefined- const root = posix.join(remoteHome, '.claude', 'projects')+ if (!tp) return undefinedconst abs = posix.resolve(tp)- return abs === root || abs.startsWith(root + '/') ? abs : undefined+ return isSafeRemoteTranscriptPath(abs, remoteHome) ? abs : undefined}const SUBAGENT_TOOLS = new Set(['Agent', 'Task'])hookServer.setRawListener((agentId, nodeId, payload) => {