thinkpool-pair 0.7.65 → 0.7.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/account.mjs +19 -1
  2. package/package.json +1 -1
package/account.mjs CHANGED
@@ -270,9 +270,27 @@ export async function runAccount(SUPABASE_URL, SUPABASE_ANON) {
270
270
  // just stops — restart is meaningful for the always-on bridge. Old bridges (pre-0.7.60)
271
271
  // don't subscribe to this event, so the dashboard button is a harmless no-op there.
272
272
  acct.on('broadcast', { event: 'restart' }, () => {
273
+ const supervised = process.env.THINKPOOL_PAIR_AUTOUPDATE === '1'
273
274
  process.stderr.write('\n ◇ restart requested from the dashboard — bouncing bridge (sessions resume).\n')
274
275
  restarting = true
275
- setTimeout(() => { try { releaseSingleton() } catch { /* noop */ } process.exit(1) }, 2500)
276
+ setTimeout(() => {
277
+ try { releaseSingleton() } catch { /* noop */ }
278
+ // A SUPERVISED bridge (launchd KeepAlive / systemd Restart=always / the
279
+ // bridge.mjs --supervise wrapper) is respawned by its supervisor on exit, so a
280
+ // bare exit(1) bounces cleanly. A plain FOREGROUND bridge has NO supervisor —
281
+ // there exit = death and the dashboard "Restart" becomes a footgun (2026-06-25:
282
+ // Max's manual `npx thinkpool-pair` died on Restart and never came back). So when
283
+ // unsupervised, re-spawn ourselves DETACHED *after* releasing the machine lock
284
+ // (the child's acquireSingleton() then sees no live owner and takes it). The child
285
+ // has no TTY → bridge.mjs routes a bare invocation straight to account mode. Gated
286
+ // on `supervised` so we never double-spawn (supervisor + self) into two bridges.
287
+ if (!supervised) {
288
+ try {
289
+ spawn(process.execPath, [process.argv[1]], { detached: true, stdio: 'ignore', env: process.env }).unref()
290
+ } catch { /* respawn failed → exit anyway, no worse than the old behaviour */ }
291
+ }
292
+ process.exit(1)
293
+ }, 2500)
276
294
  process.kill(process.pid, 'SIGTERM')
277
295
  })
278
296
  // Throttled so a realtime reconnect storm can't machine-gun track() into the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thinkpool-pair",
3
- "version": "0.7.65",
3
+ "version": "0.7.66",
4
4
  "description": "Share a local coding-agent CLI (Claude Code, Codex, Gemini, Aider, …) into a ThinkPool Code room, live.",
5
5
  "type": "module",
6
6
  "bin": {