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(pairing): warn beside the QR when a dev build makes it LAN-only

enes482a557f0aeb
diff --git a/src/main/pairing-service.ts b/src/main/pairing-service.ts
index 408bb1c91..6707d57fc 100644
--- a/src/main/pairing-service.ts
+++ b/src/main/pairing-service.ts
@@ -136,6 +136,10 @@ export interface PairingStartResult {
payload: string
/** True when 127.0.0.1:22 accepted a connection — sshd is (probably) running. */
sshOpen: boolean
+ /** What the QR on screen will mint: 'ok' = carries a relay block, 'dev' = unpackaged build
+ * (relayAllowed() off — the QR is LAN-only regardless of the toggle), 'off' = toggle off.
+ * Known at start, so the UI can warn BESIDE the QR instead of after the pairing. */
+ relayPlan: 'ok' | 'dev' | 'off'
}
/** Fired once when pairing finishes: ok=true → a key was installed, ok=false → timeout/cancel. */
@@ -515,7 +519,11 @@ export function createPairingService(relayDeps?: PairingRelayDeps): PairingServi
}
}
- return { payload, sshOpen }
+ return {
+ payload,
+ sshOpen,
+ relayPlan: relayCtx ? 'ok' : relayDeps && !relayDeps.relayAllowed() ? 'dev' : 'off'
+ }
}
const stop = (): void => {
diff --git a/src/renderer/components/PhonePairPopover.tsx b/src/renderer/components/PhonePairPopover.tsx
index 0e7b9ae3e..a39d28b1a 100644
--- a/src/renderer/components/PhonePairPopover.tsx
+++ b/src/renderer/components/PhonePairPopover.tsx
@@ -23,7 +23,7 @@ export function PhonePairPopover({
onClose: () => void
onOpenSettings: () => void
}): React.JSX.Element {
- const { phase, qr, sshOpen, sshHealed, relayResult, error, busy, start } = usePhonePairing()
+ const { phase, qr, sshOpen, sshHealed, relayResult, relayPlan, error, busy, start } = usePhonePairing()
const phoneAccessEnabled = useSettings((s) => s.settings.phoneAccessEnabled)
const updateSettings = useSettings((s) => s.update)
@@ -90,7 +90,12 @@ export function PhonePairPopover({
<>
<img src={qr} width={208} height={208} alt="Pairing QR code" className="phone-pair__qr" />
<div className="phone-pair__hint">Scan with the nodeterm iOS app · waiting (10 min)</div>
- {!phoneAccessEnabled ? (
+ {relayPlan === 'dev' ? (
+ <div className="phone-pair__warn">
+ Dev build: the relay is off regardless of the toggle, so this code pairs
+ LAN-only. Run a packaged build — or set NODETERM_RELAY_URL — for remote access.
+ </div>
+ ) : !phoneAccessEnabled ? (
<div className="phone-pair__warn">
LAN-only code: the phone will reach this Mac only on this network. Flip the
toggle below first to also connect from anywhere — the QR refreshes by itself.
diff --git a/src/renderer/components/settings/sections/PhoneSection.tsx b/src/renderer/components/settings/sections/PhoneSection.tsx
index 0339e04e4..9c625880b 100644
--- a/src/renderer/components/settings/sections/PhoneSection.tsx
+++ b/src/renderer/components/settings/sections/PhoneSection.tsx
@@ -55,7 +55,7 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
// The shared pairing machine (also behind the top-right quick-pair popover); a completed
// pairing refreshes the device list below.
- const { phase, qr, sshOpen, sshHealed, relayResult, error, busy, start, stop, reset } = usePhonePairing(
+ const { phase, qr, sshOpen, sshHealed, relayResult, relayPlan, error, busy, start, stop, reset } = usePhonePairing(
() => void refreshDevices()
)
@@ -173,7 +173,13 @@ export function PhoneSection({ isActive }: { isActive: boolean }): React.JSX.Ele
className="rounded-lg bg-white p-2"
/>
<p className="text-sm text-muted">Waiting for your phone… (10 min)</p>
- {!phoneAccessEnabled ? (
+ {relayPlan === 'dev' ? (
+ <p className="text-sm" style={{ color: '#ff9f0a' }}>
+ Dev build: the relay is off regardless of the toggle, so this code pairs
+ LAN-only. Run a packaged build — or set NODETERM_RELAY_URL — for remote
+ access.
+ </p>
+ ) : !phoneAccessEnabled ? (
<p className="text-sm" style={{ color: '#ff9f0a' }}>
LAN-only code: the phone will reach this machine only on this network. Turn
on <strong>Remote access from your phone</strong> above first to also
diff --git a/src/renderer/components/settings/usePhonePairing.ts b/src/renderer/components/settings/usePhonePairing.ts
index b7a3afb07..c6f5c03c2 100644
--- a/src/renderer/components/settings/usePhonePairing.ts
+++ b/src/renderer/components/settings/usePhonePairing.ts
@@ -22,6 +22,9 @@ export function usePhonePairing(onPaired?: () => void): {
* 'failed' = mint failed → LAN-only). Surfaced so the silent degrade is visible at the one
* moment the user is looking. */
relayResult: 'ok' | 'off' | 'failed' | 'dev' | null
+ /** While 'waiting': what the QR on screen WILL mint — lets the surfaces warn beside the QR
+ * (esp. 'dev': unpackaged build, relay off regardless of the toggle). */
+ relayPlan: 'ok' | 'dev' | 'off' | null
error: string
busy: boolean
start: () => Promise<void>
@@ -35,6 +38,7 @@ export function usePhonePairing(onPaired?: () => void): {
// instead of silently dropping the warning (the user just flipped a toggle; acknowledge it).
const [sshHealed, setSshHealed] = useState(false)
const [relayResult, setRelayResult] = useState<'ok' | 'off' | 'failed' | 'dev' | null>(null)
+ const [relayPlan, setRelayPlan] = useState<'ok' | 'dev' | 'off' | null>(null)
const [error, setError] = useState('')
const [busy, setBusy] = useState(false)
// Track whether a pairing listener is currently running so unmount can stop it.
@@ -70,7 +74,8 @@ export function usePhonePairing(onPaired?: () => void): {
setError('')
setBusy(true)
try {
- const { payload, sshOpen: open } = await window.nodeTerminal.pairing.start()
+ const { payload, sshOpen: open, relayPlan: plan } = await window.nodeTerminal.pairing.start()
+ setRelayPlan(plan ?? null)
const dataUrl = await toDataURL(payload, { margin: 1, width: 240 })
setQr(dataUrl)
setSshOpen(open)
@@ -118,5 +123,5 @@ export function usePhonePairing(onPaired?: () => void): {
}
}, [])
- return { phase, qr, sshOpen, sshHealed, relayResult, error, busy, start, stop, reset: () => setPhase('idle') }
+ return { phase, qr, sshOpen, sshHealed, relayResult, relayPlan, error, busy, start, stop, reset: () => setPhase('idle') }
}
diff --git a/src/shared/types.ts b/src/shared/types.ts
index 3330e5315..e7bc6e34e 100644
--- a/src/shared/types.ts
+++ b/src/shared/types.ts
@@ -1892,7 +1892,7 @@ export interface PairedDevice {
/** Phone-pairing (nodeterm iOS "scan a QR" flow) bridge. */
export interface PairingApi {
/** Start the one-shot LAN listener; resolves with the QR payload + an SSH-reachable hint. */
- start(): Promise<{ payload: string; sshOpen: boolean }>
+ start(): Promise<{ payload: string; sshOpen: boolean; relayPlan?: 'ok' | 'dev' | 'off' }>
/** Cancel an in-flight pairing (e.g. when the settings section unmounts). */
stop(): Promise<void>
/** Fires once when pairing finishes (ok=true paired, ok=false timeout). Returns unsubscribe. */