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.

fix(ssh): delimit the remote claude version probe, and take it off the connect path

enes39c899fdddbe
diff --git a/src/core/remote-ssh/claude-version-probe.test.ts b/src/core/remote-ssh/claude-version-probe.test.ts
new file mode 100644
index 000000000..b5611c902
--- /dev/null
+++ b/src/core/remote-ssh/claude-version-probe.test.ts
@@ -0,0 +1,68 @@
+import { describe, expect, it } from 'vitest'
+import { isSupportedClaudeVersion } from '../claude-accounts-core'
+import { supportsAutoPermissionMode } from '../../shared/agents/config'
+import {
+ CLAUDE_VERSION_END,
+ CLAUDE_VERSION_START,
+ claudeVersionProbeCommand,
+ parseClaudeVersionProbe
+} from './claude-version-probe'
+
+const wrap = (v: string): string => `${CLAUDE_VERSION_START}${v}${CLAUDE_VERSION_END}`
+
+describe('claudeVersionProbeCommand', () => {
+ it('prints the version between markers, through the login shell with a plain-shell fallback', () => {
+ const cmd = claudeVersionProbeCommand()
+ expect(cmd).toContain('$SHELL -lc')
+ expect(cmd).toContain('sh -c')
+ expect(cmd).toContain(CLAUDE_VERSION_START)
+ expect(cmd).toContain(CLAUDE_VERSION_END)
+ expect(cmd).toContain('claude --version')
+ })
+})
+
+describe('parseClaudeVersionProbe', () => {
+ it('reads the delimited value', () => {
+ expect(parseClaudeVersionProbe(wrap('2.1.90 (Claude Code)'))).toBe('2.1.90 (Claude Code)')
+ })
+
+ it('ignores login-profile noise printed around the markers', () => {
+ const noisy = [
+ 'Welcome — Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-89-generic x86_64)',
+ 'kernel 6.8.0-106-generic',
+ 'pyenv: version 3.11.6 activated',
+ wrap('2.0.30 (Claude Code)'),
+ 'have a nice day 9.9.9'
+ ].join('\n')
+ expect(parseClaudeVersionProbe(noisy)).toBe('2.0.30 (Claude Code)')
+ })
+
+ it('treats missing markers as a FAILED probe (never "modern CLI")', () => {
+ // The exact merge-blocker: a profile banner on stdout with no claude output at all.
+ expect(parseClaudeVersionProbe('Welcome — Ubuntu 22.04.3 LTS')).toBeNull()
+ expect(parseClaudeVersionProbe(`${CLAUDE_VERSION_START}2.1.90`)).toBeNull() // truncated
+ expect(parseClaudeVersionProbe(wrap(' '))).toBeNull()
+ expect(parseClaudeVersionProbe('')).toBeNull()
+ expect(parseClaudeVersionProbe(null)).toBeNull()
+ })
+
+ it('banner-contaminated output never reports auto support, nor a supported account CLI', () => {
+ // Old remote CLI (2.0.30) behind an Ubuntu banner: the ONLY version the consumers may see is
+ // claude's own, so both gates say "old" — no `--permission-mode auto`, keychain warning kept.
+ const noisy = `Welcome — Ubuntu 22.04.3 LTS\n${wrap('2.0.30 (Claude Code)')}`
+ const version = parseClaudeVersionProbe(noisy)
+ expect(supportsAutoPermissionMode(version)).toBe(false)
+ expect(isSupportedClaudeVersion(version ?? '')).toBe(false)
+
+ // …and a banner with no claude output at all parses to null, which every caller treats as
+ // "unknown" (fail-open: no flag).
+ expect(supportsAutoPermissionMode(parseClaudeVersionProbe('Welcome — Ubuntu 22.04.3 LTS'))).toBe(
+ false
+ )
+ })
+
+ it('a modern CLI behind a banner still reports auto support', () => {
+ const noisy = `neofetch 7.1.0\n${wrap('2.1.90 (Claude Code)')}\n`
+ expect(supportsAutoPermissionMode(parseClaudeVersionProbe(noisy))).toBe(true)
+ })
+})
diff --git a/src/core/remote-ssh/claude-version-probe.ts b/src/core/remote-ssh/claude-version-probe.ts
new file mode 100644
index 000000000..0d3226f62
--- /dev/null
+++ b/src/core/remote-ssh/claude-version-probe.ts
@@ -0,0 +1,47 @@
+// Pure shell command + parser for the REMOTE `claude --version` probe.
+//
+// The probe has to run through the LOGIN shell (`$SHELL -lc`): an ssh exec channel gets a
+// non-interactive, non-login shell whose rc file usually bails out early, so a claude installed via
+// nvm/asdf/homebrew can be invisible to a bare `claude --version`. But a login shell SOURCES the
+// user's profile, and profiles print to STDOUT — corp banners, `neofetch`, `echo "kernel $(uname
+// -r)"`, pyenv/conda notices. Every version check in the app first-matches a `\d+\.\d+\.\d+`
+// anywhere in the string, so a banner line like `Welcome — Ubuntu 22.04.3 LTS` would be read as
+// "claude 22.04.3" → "new enough for --permission-mode auto" → every Claude node in that project
+// launches a flag its 2.0.x CLI rejects with exit 1 (dead node).
+//
+// So the value is DELIMITED, exactly like the login-shell PATH probe in `core/pty-manager.ts`
+// (`__NT_PATH_START__`/`__NT_PATH_END__`): print it between markers and read only what sits between
+// them. No markers ⇒ the probe FAILED (⇒ unknown version ⇒ no flag), never "modern CLI".
+import { posixQuote } from '../../shared/ssh'
+
+export const CLAUDE_VERSION_START = '__NT_V_START__'
+export const CLAUDE_VERSION_END = '__NT_V_END__'
+
+/**
+ * The remote shell command that prints `claude --version` between the markers, or nothing.
+ * Login shell first, plain exec shell as the fallback (some hosts have no usable `$SHELL -l`).
+ */
+export function claudeVersionProbeCommand(): string {
+ // `[ -n "$v" ]` keeps the exit code non-zero when claude is missing or prints nothing, so the
+ // `||` fallback still gets its turn — the same two-step lookup as before the markers.
+ const emit =
+ `v=$(claude --version 2>/dev/null) && [ -n "$v" ] && ` +
+ `printf '${CLAUDE_VERSION_START}%s${CLAUDE_VERSION_END}' "$v"`
+ const q = posixQuote(emit)
+ return `$SHELL -lc ${q} 2>/dev/null || sh -c ${q} 2>/dev/null`
+}
+
+/**
+ * The version string between the markers, or null when they're absent/empty — i.e. the probe
+ * failed. Profile noise printed before/after the markers is discarded, so it can never be parsed
+ * as the CLI's version.
+ */
+export function parseClaudeVersionProbe(stdout: string | null | undefined): string | null {
+ if (!stdout) return null
+ const start = stdout.indexOf(CLAUDE_VERSION_START)
+ if (start < 0) return null
+ const from = start + CLAUDE_VERSION_START.length
+ const end = stdout.indexOf(CLAUDE_VERSION_END, from)
+ if (end < 0) return null
+ return stdout.slice(from, end).trim() || null
+}
diff --git a/src/main/remote-ssh/ssh-project.test.ts b/src/main/remote-ssh/ssh-project.test.ts
index 597ec2916..77b208c21 100644
--- a/src/main/remote-ssh/ssh-project.test.ts
+++ b/src/main/remote-ssh/ssh-project.test.ts
@@ -26,7 +26,8 @@ describe('SshProjectManager', () => {
const { mgr, statuses } = makeMgr()
const { controlPath } = await mgr.connect('p1', conn)
expect(controlPath).toBe(controlPathFor('p1'))
- expect(statuses).toEqual(['connecting', 'connected'])
+ // (A later `connected` event can carry the async claude-CLI probe's answer — see below.)
+ expect(statuses.slice(0, 2)).toEqual(['connecting', 'connected'])
})
it('connect is idempotent — second call reuses the live master', async () => {
@@ -156,6 +157,105 @@ describe('SshProjectManager', () => {
expect(controlPath).toBe(controlPathFor('p1'))
})
+ // --- remote `claude --version` probe ------------------------------------------------------
+ //
+ // The probe runs through a LOGIN shell, so the user's profile can print banners to stdout. The
+ // value is marker-delimited and only what sits between the markers is parsed — a banner version
+ // (`Ubuntu 22.04.3`) must NEVER be read as claude's version, or every Claude node in the project
+ // would launch `--permission-mode auto` on a CLI that exits 1 on it.
+ const BANNER = 'Welcome — Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-89-generic)\nkernel 6.8.0-106\n'
+
+ /** A manager whose remote claude probe answers with `banner + <markers>version</markers>`. */
+ function mgrWithClaude(versionOut: string | null) {
+ const events: { status: string; claudeAutoPermissionMode?: boolean }[] = []
+ const run = vi.fn(async (args: string[]) => {
+ const cmd = args.join(' ')
+ if (cmd.includes('__NT_V_START__')) {
+ return { code: 0, stdout: versionOut === null ? BANNER : `${BANNER}${versionOut}` }
+ }
+ if (cmd.includes('printf %s')) return { code: 0, stdout: '/home/u' }
+ return { code: 0, stdout: '' }
+ })
+ const mgr = new SshProjectManager({
+ userDataDir: '/ud',
+ spawnMaster: vi.fn(() => ({ kill: vi.fn(), on: vi.fn() })),
+ run,
+ runScp: vi.fn(async () => ({ code: 0 })),
+ getHook: () => ({ port: 1, token: 't', version: '1' }),
+ onStatus: (e) => events.push({ status: e.status, claudeAutoPermissionMode: e.claudeAutoPermissionMode })
+ })
+ return { mgr, events, run }
+ }
+
+ const probeEvent = (events: { claudeAutoPermissionMode?: boolean }[]) =>
+ events.find((e) => e.claudeAutoPermissionMode !== undefined)
+
+ it('a login-shell BANNER around an OLD claude never reports auto support (merge blocker)', async () => {
+ const { mgr, events } = mgrWithClaude('__NT_V_START__2.0.30 (Claude Code)__NT_V_END__')
+ await mgr.connect('p1', conn)
+ await vi.waitFor(() => expect(probeEvent(events)).toBeDefined())
+ // The banner's `22.04.3` is NOT the version: the CLI is 2.0.30 → no `--permission-mode auto`.
+ expect(probeEvent(events)?.claudeAutoPermissionMode).toBe(false)
+ })
+
+ it('a banner with no claude output at all is a FAILED probe, not a modern CLI', async () => {
+ const { mgr, events } = mgrWithClaude(null) // markers absent → unknown
+ await mgr.connect('p1', conn)
+ await vi.waitFor(() => expect(probeEvent(events)).toBeDefined())
+ expect(probeEvent(events)?.claudeAutoPermissionMode).toBe(false)
+ })
+
+ it('a modern claude behind a banner does report auto support', async () => {
+ const { mgr, events } = mgrWithClaude('__NT_V_START__2.1.90 (Claude Code)__NT_V_END__')
+ await mgr.connect('p1', conn)
+ await vi.waitFor(() => expect(probeEvent(events)).toBeDefined())
+ expect(probeEvent(events)?.claudeAutoPermissionMode).toBe(true)
+ })
+
+ it('connect does NOT wait on the claude probe (it runs after `connected`)', async () => {
+ // The probe's `$SHELL -lc` sources nvm/conda inits and can take seconds; every remote terminal
+ // in the project waits on connect, so the probe must be off that path.
+ const events: string[] = []
+ let releaseProbe: (() => void) | undefined
+ const run = vi.fn(async (args: string[]) => {
+ const cmd = args.join(' ')
+ if (cmd.includes('__NT_V_START__')) {
+ await new Promise<void>((r) => (releaseProbe = r)) // never resolves during this test
+ return { code: 0, stdout: '' }
+ }
+ return { code: 0, stdout: '' }
+ })
+ const mgr = new SshProjectManager({
+ userDataDir: '/ud',
+ spawnMaster: vi.fn(() => ({ kill: vi.fn(), on: vi.fn() })),
+ run,
+ runScp: vi.fn(async () => ({ code: 0 })),
+ getHook: () => ({ port: 1, token: 't', version: '1' }),
+ onStatus: (e) => events.push(e.status)
+ })
+ const res = await mgr.connect('p1', conn) // resolves while the probe is still hanging
+ expect(events).toEqual(['connecting', 'connected'])
+ expect(res.claudeAutoPermissionMode).toBeUndefined() // unknown ⇒ bare command (fail-open)
+ releaseProbe?.()
+ })
+
+ it('remoteAccountAdd reads the version from the markers, not from banner noise', async () => {
+ // Same probe, other consumer: an OLD remote CLI must still report versionSupported=false so the
+ // keychain-collision warning survives (the banner's `22.04.3` would have suppressed it).
+ const { mgr } = mgrWithClaude('__NT_V_START__2.0.14 (Claude Code)__NT_V_END__')
+ await mgr.connect('p1', conn)
+ expect((await mgr.remoteAccountAdd('p1', 'acc1'))?.versionSupported).toBe(false)
+
+ const modern = mgrWithClaude('__NT_V_START__2.1.0 (Claude Code)__NT_V_END__')
+ await modern.mgr.connect('p2', conn)
+ expect((await modern.mgr.remoteAccountAdd('p2', 'acc1'))?.versionSupported).toBe(true)
+
+ // Probe failed entirely (no markers) → fail-open true: adding an account is never blocked.
+ const unknown = mgrWithClaude(null)
+ await unknown.mgr.connect('p3', conn)
+ expect((await unknown.mgr.remoteAccountAdd('p3', 'acc1'))?.versionSupported).toBe(true)
+ })
+
it('uploadFile fails open (null) when not connected', async () => {
const { mgr } = makeMgr()
expect(await mgr.uploadFile('nope', '/x', 'x')).toBeNull()
diff --git a/src/main/remote-ssh/ssh-project.ts b/src/main/remote-ssh/ssh-project.ts
index 2709d3181..d7caf3b09 100644
--- a/src/main/remote-ssh/ssh-project.ts
+++ b/src/main/remote-ssh/ssh-project.ts
@@ -4,7 +4,7 @@ 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 type { SshProjectStatus } from '../../shared/types'
+import type { SshProjectStatusEvent } from '../../shared/types'
import { remoteAccountConfigDir, isSupportedClaudeVersion } from '../../core/claude-accounts-core'
import { supportsAutoPermissionMode } from '../../shared/agents/config'
import {
@@ -19,6 +19,7 @@ import {
scpArgs,
RMT_TMUX_SOCKET
} from '../../core/remote-ssh/control-master'
+import { claudeVersionProbeCommand, parseClaudeVersionProbe } from '../../core/remote-ssh/claude-version-probe'
import { RemoteHooks } from './remote-hooks'
import { hookServer } from '../../core/agents/hook-server'
import { sessionName } from '../../core/tmux-naming'
@@ -33,7 +34,7 @@ interface Runners {
runScp: (args: string[]) => Promise<{ code: number }>
/** Live loopback hook-server coordinates (injected so the manager stays testable). */
getHook: () => { port: number; token: string; version: string }
- onStatus: (e: { projectId: string; status: SshProjectStatus; error?: string }) => void
+ onStatus: (e: SshProjectStatusEvent) => void
}
interface Conn {
@@ -210,21 +211,26 @@ export class SshProjectManager {
/* fail-open: no conf → remote tmux uses host defaults */
}
}
- // Probe the REMOTE claude CLI once per connect: `--permission-mode auto` only exists in
- // >= 2.1.71 and the host's CLI may be older than the local one. Unknown ⇒ false ⇒ the
- // renderer launches this project's Claude nodes with the bare command (fail-open).
- const claudeAutoPermissionMode = supportsAutoPermissionMode(
- await this.remoteClaudeVersion(conn, controlPath)
- )
const entry = this.conns.get(projectId)
if (entry) {
entry.hookEndpointPath = hookEndpointPath
entry.remoteHome = remoteHome
entry.tmuxConfPath = tmuxConfPath
- entry.claudeAutoPermissionMode = claudeAutoPermissionMode
}
this.r.onStatus({ projectId, status: 'connected' })
- return { controlPath, hookEndpointPath, tmuxConfPath, remoteHome, claudeAutoPermissionMode }
+ // Probe the REMOTE claude CLI once per connect — `--permission-mode auto` only exists in
+ // >= 2.1.71 and the host's CLI may be older than the local one. NOT awaited: the answer is
+ // only ever an optional flag, and the probe's login shell must not delay the connect (and
+ // with it every terminal in the project). It pushes itself into the conn + renderer when
+ // it lands; until then this project's Claude nodes launch with the bare command.
+ if (entry) void this.probeClaudeAutoPermissionMode(projectId, entry)
+ return {
+ controlPath,
+ hookEndpointPath,
+ tmuxConfPath,
+ remoteHome,
+ claudeAutoPermissionMode: entry?.claudeAutoPermissionMode
+ }
}
await new Promise((res) => setTimeout(res, 100))
}
@@ -400,20 +406,40 @@ export class SshProjectManager {
* An ssh EXEC channel gets a non-interactive, non-login shell, whose rc file usually bails out
* early — so a claude installed via nvm/asdf/homebrew-on-PATH may be invisible to a plain
* `claude --version`. The remote tmux session that actually RUNS the node uses a login shell, so
- * we try that first and only then the bare command.
+ * the probe tries that first and only then the bare command. A login shell also sources the
+ * user's profile, whose STDOUT noise (banners, neofetch, …) would otherwise be parsed as the
+ * version — hence the marker-delimited value (see `claude-version-probe.ts`).
*/
private async remoteClaudeVersion(conn: SshConnection, controlPath: string): Promise<string | null> {
try {
- const { code, stdout } = await this.r.run(
- childArgs(conn, controlPath, `$SHELL -lc 'claude --version' 2>/dev/null || claude --version 2>/dev/null`)
- )
- const out = stdout.trim()
- return code === 0 && out ? out : null
+ const { stdout } = await this.r.run(childArgs(conn, controlPath, claudeVersionProbeCommand()))
+ // Markers absent ⇒ FAILED probe ⇒ null (unknown). Never scrape free-form stdout.
+ return parseClaudeVersionProbe(stdout)
} catch {
return null
}
}
+ /**
+ * Probe the remote CLI's `--permission-mode auto` support AFTER the connect resolves, then push
+ * the answer into the live conn + the renderer (a `connected` status event carrying it).
+ *
+ * Deliberately OFF the connect critical path: it runs `$SHELL -lc`, which sources nvm/conda/rbenv
+ * inits — routinely hundreds of ms, sometimes seconds — and every remote terminal in the project
+ * waits on connect. A node launched in the gap just omits the flag (the designed fail-open
+ * fallback); the next launch, once the answer lands, gets `auto`.
+ */
+ private async probeClaudeAutoPermissionMode(projectId: string, entry: Conn): Promise<void> {
+ const supported = supportsAutoPermissionMode(
+ await this.remoteClaudeVersion(entry.conn, entry.controlPath)
+ )
+ // Disconnected / reconnected (new Conn) while we probed → the answer belongs to a dead
+ // connection; drop it rather than write it onto the new one.
+ if (this.conns.get(projectId) !== entry) return
+ entry.claudeAutoPermissionMode = supported
+ this.r.onStatus({ projectId, status: 'connected', claudeAutoPermissionMode: supported })
+ }
+
/** Is the remote claude new enough to scope credentials per config dir? Returns true when it
* can't be determined so remote account add is never blocked on detection (fail-open). */
private async remoteClaudeVersionOk(c: Conn): Promise<boolean> {
diff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsx
index 7769de849..72039a3ef 100644
--- a/src/renderer/canvas/Canvas.tsx
+++ b/src/renderer/canvas/Canvas.tsx
@@ -3430,9 +3430,15 @@ export function Canvas() {
// Track SSH project connection status for the thin connection banner (keyed by project id).
useEffect(() => {
- return window.nodeTerminal.sshProject.onStatus((e) =>
+ return window.nodeTerminal.sshProject.onStatus((e) => {
setSshStatus((prev) => ({ ...prev, [e.projectId]: e.status }))
- )
+ // The remote claude probe runs AFTER connect (its login shell is slow) and pushes its answer
+ // on a later `connected` event — record it so this project's next Claude launch can use
+ // `--permission-mode auto`. Absent = nothing new to record (keep omitting the flag).
+ if (e.claudeAutoPermissionMode !== undefined) {
+ useSshConn.getState().setClaudeAutoPermissionMode(e.projectId, e.claudeAutoPermissionMode)
+ }
+ })
}, [])
// Create an SSH project from the dialog: commit the current canvas, add + switch to the new
diff --git a/src/renderer/state/sshConn.ts b/src/renderer/state/sshConn.ts
index c63f37346..64b734bed 100644
--- a/src/renderer/state/sshConn.ts
+++ b/src/renderer/state/sshConn.ts
@@ -13,9 +13,11 @@ export interface SshConnInfo {
/** The connection's resolved remote `$HOME`. Used to build an ABSOLUTE remote
* `CLAUDE_CONFIG_DIR` for a managed remote account. Optional: absent if it couldn't resolve. */
remoteHome?: string
- /** Does the REMOTE host's claude CLI accept `--permission-mode auto` (>= 2.1.71)? Probed on the
- * host at connect — the local CLI's answer says nothing about the remote one. Absent/false ⇒
- * this project's Claude nodes launch with the bare command (no `auto` flag). */
+ /** Does the REMOTE host's claude CLI accept `--permission-mode auto` (>= 2.1.71)? The local
+ * CLI's answer says nothing about the remote one, so the host is probed on its own — AFTER
+ * connect (the probe's login shell is slow and must not delay the project's terminals), so this
+ * is usually absent here and arrives later on a `connected` status event. Absent/false ⇒ this
+ * project's Claude nodes launch with the bare command (no `auto` flag). */
claudeAutoPermissionMode?: boolean
}
@@ -28,7 +30,13 @@ export interface SshConnInfo {
*/
interface SshConnState {
byProject: Record<string, SshConnInfo>
+ /** project id → "the remote CLI accepts `--permission-mode auto`". Kept OUTSIDE `byProject`
+ * because the remote probe runs after connect and can land before OR after the connect promise
+ * writes the entry — a separate map makes the two orders equivalent. */
+ autoPermByProject: Record<string, boolean>
setConn(projectId: string, info: SshConnInfo): void
+ /** Record the remote CLI probe's answer (pushed on a `connected` status event once it lands). */
+ setClaudeAutoPermissionMode(projectId: string, supported: boolean): void
getControlPath(projectId: string): string | undefined
getHookEndpointPath(projectId: string): string | undefined
getTmuxConfPath(projectId: string): string | undefined
@@ -41,8 +49,19 @@ interface SshConnState {
export const useSshConn = create<SshConnState>((set, get) => ({
byProject: {},
+ autoPermByProject: {},
setConn(projectId, info) {
- set((s) => ({ byProject: { ...s.byProject, [projectId]: info } }))
+ set((s) => ({
+ byProject: { ...s.byProject, [projectId]: info },
+ // A reused (already probed) connection returns the answer with the connect result.
+ autoPermByProject:
+ info.claudeAutoPermissionMode === undefined
+ ? s.autoPermByProject
+ : { ...s.autoPermByProject, [projectId]: info.claudeAutoPermissionMode }
+ }))
+ },
+ setClaudeAutoPermissionMode(projectId, supported) {
+ set((s) => ({ autoPermByProject: { ...s.autoPermByProject, [projectId]: supported } }))
},
getControlPath(projectId) {
return get().byProject[projectId]?.controlPath
@@ -57,13 +76,15 @@ export const useSshConn = create<SshConnState>((set, get) => ({
return get().byProject[projectId]?.remoteHome
},
supportsAutoPermissionMode(projectId) {
- return get().byProject[projectId]?.claudeAutoPermissionMode === true
+ return get().autoPermByProject[projectId] === true
},
clear(projectId) {
set((s) => {
const next = { ...s.byProject }
delete next[projectId]
- return { byProject: next }
+ const nextAuto = { ...s.autoPermByProject }
+ delete nextAuto[projectId]
+ return { byProject: next, autoPermByProject: nextAuto }
})
}
}))
diff --git a/src/shared/types.ts b/src/shared/types.ts
index df57bb9db..3d4e22f00 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -437,6 +437,19 @@ export interface SshApi {
export type SshProjectStatus = 'connecting' | 'connected' | 'disconnected' | 'reconnecting' | 'error'
+/**
+ * A live SSH project's status, pushed from main. `claudeAutoPermissionMode` rides a `connected`
+ * event: the remote `claude --version` probe runs AFTER connect (its login shell is slow and must
+ * not delay the project's terminals), so the answer arrives on its own event once it lands.
+ * Absent = not probed / nothing new ⇒ the renderer keeps omitting the `auto` flag (fail-open).
+ */
+export interface SshProjectStatusEvent {
+ projectId: string
+ status: SshProjectStatus
+ error?: string
+ claudeAutoPermissionMode?: boolean
+}
+
export interface SshProjectApi {
/** Open (or reuse) the ControlMaster for an SSH project; resolves once connected. */
connect(
@@ -470,7 +483,7 @@ export interface SshProjectApi {
* success, or null on any failure (not connected, unresolved remote home, mkdir/scp failure).
*/
uploadFile(projectId: string, localPath: string, fileName: string): Promise<string | null>
- onStatus(cb: (e: { projectId: string; status: SshProjectStatus; error?: string }) => void): () => void
+ onStatus(cb: (e: SshProjectStatusEvent) => void): () => void
}
/**