thinkpool-pair 0.6.19 → 0.6.20

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/bridge.mjs +17 -0
  2. package/package.json +1 -1
package/bridge.mjs CHANGED
@@ -730,6 +730,23 @@ if (process.env.THINKPOOL_PAIR_AUTOUPDATE === '1' && VERSION) {
730
730
  setInterval(check, POLL_MS).unref() // poll the registry
731
731
  setInterval(applyIfIdle, 15000).unref() // once pending, land it as soon as idle
732
732
  setTimeout(check, 60000).unref() // first check after the session settles
733
+ } else if (VERSION) {
734
+ // Foreground run (not the supervised service): it can't self-restart, but
735
+ // nudge once if a newer version is out so a relaunch with @latest picks it up.
736
+ setTimeout(async () => {
737
+ try {
738
+ const ctrl = new AbortController(); const to = setTimeout(() => ctrl.abort(), 8000)
739
+ const res = await fetch('https://registry.npmjs.org/thinkpool-pair/latest', { signal: ctrl.signal, headers: { accept: 'application/json' } }).finally(() => clearTimeout(to))
740
+ if (!res.ok) return
741
+ const j = await res.json(); const latest = typeof j?.version === 'string' ? j.version : null
742
+ if (!latest) return
743
+ const core = (v) => String(v).split('-')[0].split('.').map((n) => parseInt(n, 10) || 0)
744
+ const a = core(latest), b = core(VERSION)
745
+ let newer = false
746
+ for (let i = 0; i < 3; i++) { if ((a[i] || 0) > (b[i] || 0)) { newer = true; break } if ((a[i] || 0) < (b[i] || 0)) break }
747
+ if (newer) process.stderr.write(`\n ◆ thinkpool-pair ${latest} is out (you're on ${VERSION}) — restart with: npx thinkpool-pair@latest ${room}\n`)
748
+ } catch { /* offline — never block the session */ }
749
+ }, 60000).unref()
733
750
  }
734
751
 
735
752
  function shutdown() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thinkpool-pair",
3
- "version": "0.6.19",
3
+ "version": "0.6.20",
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": {