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.

feat(pairing): the Remote Login warning opens System Settings and clears itself

enesebed3e25ecc7
diff --git a/src/main/index.ts b/src/main/index.ts
index 9718a3176..f15ed94b5 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -524,6 +524,7 @@ app.whenReady().then(async () => {
})
)
ipcMain.handle(IPC.pairingStop, () => pairingService.stop())
+ ipcMain.handle(IPC.pairingProbeSsh, () => pairingService.probeSsh())
ipcMain.handle(IPC.pairingListDevices, () => pairingService.listDevices())
ipcMain.handle(IPC.pairingRevokeDevice, (_e, id: string) => pairingService.revokeDevice(id))
diff --git a/src/main/pairing-service.ts b/src/main/pairing-service.ts
index 00919516e..18303462e 100644
--- a/src/main/pairing-service.ts
+++ b/src/main/pairing-service.ts
@@ -145,6 +145,8 @@ export interface PairingService {
listDevices(): Promise<PublicDevice[]>
/** Revoke a device: drop its agent.json entry AND delete its authorized_keys line. */
revokeDevice(id: string): Promise<void>
+ /** Live re-probe of sshd (127.0.0.1:22), for the Remote Login warning's auto-clear. */
+ probeSsh(): Promise<boolean>
}
/** ~/.nodeterm holds the host-agent config (agent.json). Created 0700 if missing. */
@@ -499,5 +501,5 @@ export function createPairingService(relayDeps?: PairingRelayDeps): PairingServi
await removeAuthorizedKeysForDevice(id)
}
- return { start, stop, listDevices, revokeDevice }
+ return { start, stop, listDevices, revokeDevice, probeSsh }
}
diff --git a/src/preload/index.ts b/src/preload/index.ts
index e008a0d36..ddcce94f0 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -415,6 +415,7 @@ const api: NodeTerminalApi = {
ipcRenderer.on(IPC.pairingDone, handler)
return () => ipcRenderer.removeListener(IPC.pairingDone, handler)
},
+ probeSsh: () => ipcRenderer.invoke(IPC.pairingProbeSsh),
listDevices: () => ipcRenderer.invoke(IPC.pairingListDevices),
revokeDevice: (id) => ipcRenderer.invoke(IPC.pairingRevokeDevice, id)
},
diff --git a/src/renderer/bridge/stubs.ts b/src/renderer/bridge/stubs.ts
index f27205930..465dc092a 100644
--- a/src/renderer/bridge/stubs.ts
+++ b/src/renderer/bridge/stubs.ts
@@ -280,6 +280,7 @@ export function buildStubApi(): Omit<
start: U('pairing.start'),
stop: U('pairing.stop'),
onDone: noopUnsub,
+ probeSsh: U('pairing.probeSsh'),
listDevices: U('pairing.listDevices'),
revokeDevice: U('pairing.revokeDevice')
},
diff --git a/src/renderer/components/settings/sections/PhoneSection.tsx b/src/renderer/components/settings/sections/PhoneSection.tsx
index 98092b22b..ad5ae83cf 100644
--- a/src/renderer/components/settings/sections/PhoneSection.tsx
+++ b/src/renderer/components/settings/sections/PhoneSection.tsx
@@ -37,10 +37,25 @@ function formatPairedAt(ms: number): string {
type Phase = 'idle' | 'waiting' | 'paired' | 'timeout'
+/** How often the Remote Login warning re-probes sshd while it is showing. */
+const SSH_RECHECK_MS = 2000
+
+/** Deep link straight to System Settings → General → Sharing (the Remote Login toggle lives
+ * there). The `Services_RemoteLogin` query selected the service in the pre-Ventura prefpane and
+ * is harmless on newer macOS, which opens the Sharing pane either way. macOS-only. */
+const REMOTE_LOGIN_SETTINGS_URL =
+ 'x-apple.systempreferences:com.apple.preferences.sharing?Services_RemoteLogin'
+
+/** The pairing host is this machine, so the renderer's own UA answers "is this a Mac?". */
+const isMac = /Mac/i.test(navigator.platform || navigator.userAgent)
+
export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Element {
const [phase, setPhase] = useState<Phase>('idle')
const [qr, setQr] = useState('')
const [sshOpen, setSshOpen] = useState(true)
+ // Went from unreachable → reachable while the warning was showing: show a green confirmation
+ // instead of silently dropping the warning (the user just flipped a toggle; acknowledge it).
+ const [sshHealed, setSshHealed] = useState(false)
const [error, setError] = useState('')
const [busy, setBusy] = useState(false)
const [devices, setDevices] = useState<PairedDevice[]>([])
@@ -66,6 +81,32 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
}
}, [])
+ // Live re-check while the Remote Login warning is visible: the initial probe runs once at
+ // pairing start, so without this the warning could never clear — the user enables Remote Login
+ // in System Settings and nothing changes on screen. Poll only in that exact state (waiting +
+ // unreachable); the interval dies with the warning.
+ useEffect(() => {
+ if (phase !== 'waiting' || sshOpen) return
+ let cancelled = false
+ const timer = setInterval(() => {
+ void window.nodeTerminal.pairing
+ .probeSsh()
+ .then((open) => {
+ if (!cancelled && open) {
+ setSshOpen(true)
+ setSshHealed(true)
+ }
+ })
+ .catch(() => {
+ // transient probe error: keep the warning, try again on the next tick
+ })
+ }, SSH_RECHECK_MS)
+ return () => {
+ cancelled = true
+ clearInterval(timer)
+ }
+ }, [phase, sshOpen])
+
const startPairing = async (): Promise<void> => {
setError('')
setBusy(true)
@@ -74,6 +115,7 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
const dataUrl = await toDataURL(payload, { margin: 1, width: 240 })
setQr(dataUrl)
setSshOpen(open)
+ setSshHealed(false)
setPhase('waiting')
runningRef.current = true
} catch (err) {
@@ -195,9 +237,21 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
/>
<p className="text-sm text-muted">Waiting for your phone… (2 min)</p>
{!sshOpen ? (
- <p className="text-sm" style={{ color: '#ff9f0a' }}>
- SSH doesn&apos;t appear to be reachable. Enable Remote Login in System Settings →
- General → Sharing so your phone can connect after pairing.
+ <div className="space-y-2">
+ <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ SSH doesn&apos;t appear to be reachable — your phone won&apos;t be able to
+ connect after pairing. Turn on <strong>Remote Login</strong>
+ {isMac ? ' (watching — this notice clears by itself once it is on).' : '.'}
+ </p>
+ {isMac ? (
+ <Button onClick={() => window.nodeTerminal.shell.openExternal(REMOTE_LOGIN_SETTINGS_URL)}>
+ Open System Settings
+ </Button>
+ ) : null}
+ </div>
+ ) : sshHealed ? (
+ <p className="text-sm" style={{ color: '#30d158' }}>
+ ✓ Remote Login is on — your phone can connect after pairing.
</p>
) : null}
<Button onClick={stopPairing}>Cancel</Button>
diff --git a/src/shared/ipc.ts b/src/shared/ipc.ts
index c5b42d5b4..1cba96c7a 100644
--- a/src/shared/ipc.ts
+++ b/src/shared/ipc.ts
@@ -257,6 +257,7 @@ export const IPC = {
pairingStart: 'pairing:start',
pairingStop: 'pairing:stop',
pairingDone: 'pairing:done',
+ pairingProbeSsh: 'pairing:probe-ssh',
pairingListDevices: 'pairing:listDevices',
pairingRevokeDevice: 'pairing:revokeDevice'
} as const
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 2cba09ac2..f01ee146c 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -1224,6 +1224,9 @@ export interface PairingApi {
stop(): Promise<void>
/** Fires once when pairing finishes (ok=true paired, ok=false timeout). Returns unsubscribe. */
onDone(cb: (result: { ok: boolean }) => void): () => void
+ /** Live re-probe of 127.0.0.1:22, so the Remote Login warning can clear the moment the user
+ * flips the toggle in System Settings (polled by the UI only while the warning is showing). */
+ probeSsh(): Promise<boolean>
/** List paired devices from ~/.nodeterm/agent.json (never includes the token). */
listDevices(): Promise<PairedDevice[]>
/** Revoke a device: remove its registry entry and delete its authorized_keys line. */