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(relay): standing phone host survives the boot license race

enescaf47a20f614
diff --git a/src/core/license.ts b/src/core/license.ts
index 4a8ff18a1..079236aad 100644
--- a/src/core/license.ts
+++ b/src/core/license.ts
@@ -140,10 +140,15 @@ export function isPremium(): boolean {
return verify(load().token) !== null
}
-export function initLicense(): void {
+export function initLicense(onChange?: () => void): void {
const deviceId = getDeviceId()
const broadcast = (s: LicenseStatus) => {
platform().broadcast(IPC.licenseChanged, s)
+ // Let the main process react to a Pro state change (activate / refresh / device-poll). The
+ // launch-time refresh is ASYNC, so anything gated on isPremium() at boot (the standing phone
+ // host) must re-reconcile once the entitlement settles — without this it would stay down
+ // until the toggle is flipped or the app restarts with an already-valid token.
+ onChange?.()
}
platform().handle(IPC.licenseStatus, () => statusFrom(load().token))
diff --git a/src/main/index.ts b/src/main/index.ts
index 353028b09..904a02a8a 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -857,15 +857,19 @@ app.whenReady().then(async () => {
initCanvasControl()
initClaudeUsage(win)
initTelemetry(() => settingsStore.get())
- initLicense()
+ // Declared before initLicense so its onChange hook can re-reconcile the standing host once the
+ // async launch-time entitlement refresh settles (fixes the boot race where Pro isn't yet valid
+ // when syncFromSettings first runs).
+ let standingHost: ReturnType<typeof initStandingHost> | undefined
+ initLicense(() => standingHost?.syncFromSettings())
// Lazy getter: sshProjectManager is created just below, so a remote account op (which only runs
// after the user has connected an SSH project) always sees the live manager.
initClaudeAccounts(() => sshProjectManager)
initRemoteHost(win, ptyManager, listProjectsOutput)
// Standing (phone) relay host: keep a host connection registered so a paired phone can reach
// this Mac from anywhere. Honors settings.phoneAccessEnabled + the Pro gate internally.
- const standingHost = initStandingHost(win, ptyManager, () => settingsStore.get(), listProjectsOutput)
- ipcMain.on(IPC.remoteStandingHostSet, (_e, enabled: boolean) => standingHost.setEnabled(!!enabled))
+ standingHost = initStandingHost(win, ptyManager, () => settingsStore.get(), listProjectsOutput)
+ ipcMain.on(IPC.remoteStandingHostSet, (_e, enabled: boolean) => standingHost?.setEnabled(!!enabled))
// Reconcile from persisted settings on launch (starts hosting if enabled + Pro).
standingHost.syncFromSettings()
initRemoteClient(win, { isPackaged: app.isPackaged })