thinkpool-pair 0.7.262 → 0.7.263

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 +13 -3
  2. package/package.json +1 -1
package/bridge.mjs CHANGED
@@ -3104,9 +3104,12 @@ function cancelPendingDurablePermissions(s, permissionIds = null, reason = 'perm
3104
3104
  })
3105
3105
  }
3106
3106
 
3107
- async function cancelRestoredDurablePermissions(terminalIds) {
3108
- const terminals = [...new Set((terminalIds || []).filter(Boolean))]
3109
- await Promise.all(terminals.map(async (terminalId) => {
3107
+ const restoredPermissionCleanupPending = new Set()
3108
+
3109
+ async function cancelRestoredDurablePermissions(terminalIds = []) {
3110
+ for (const terminalId of terminalIds) if (terminalId) restoredPermissionCleanupPending.add(terminalId)
3111
+ const terminals = [...restoredPermissionCleanupPending]
3112
+ const outcomes = await Promise.all(terminals.map(async (terminalId) => {
3110
3113
  const result = await cancelDurablePermissions({
3111
3114
  supabaseUrl: SUPABASE_URL, anonKey: SUPABASE_ANON, token: codeAuthToken, roomCode: room,
3112
3115
  // New bridge process, old durable bridge authority: filter by the
@@ -3114,7 +3117,10 @@ async function cancelRestoredDurablePermissions(terminalIds) {
3114
3117
  terminalId, reason: 'bridge_restarted',
3115
3118
  })
3116
3119
  if (!result.ok && process.env.TP_DEBUG) process.stderr.write(`\n ◇ restored permission cleanup incomplete (${result.code})\n`)
3120
+ return { terminalId, ok: result.ok }
3117
3121
  }))
3122
+ for (const outcome of outcomes) if (outcome.ok) restoredPermissionCleanupPending.delete(outcome.terminalId)
3123
+ return { ok: restoredPermissionCleanupPending.size === 0, pending: [...restoredPermissionCleanupPending] }
3118
3124
  }
3119
3125
 
3120
3126
  function drainPending(s) {
@@ -4601,6 +4607,10 @@ if (process.env.THINKPOOL_PAIR_AUTOUPDATE === '1' && VERSION) {
4601
4607
  if (!ok && codeAuthToken) process.stderr.write('\n ⚠ realtime auth refresh failed; private bridge features may need a reconnect.\n')
4602
4608
  })
4603
4609
  refreshOwnerPlan()
4610
+ // A restart sweep may have raced an expiring owner JWT. Keep failed
4611
+ // terminal ids until the supervisor hands us its next fresh token, then
4612
+ // retry the exact cleanup instead of leaving dead question cards forever.
4613
+ if (restoredPermissionCleanupPending.size) void cancelRestoredDurablePermissions()
4604
4614
  }
4605
4615
  })
4606
4616
  setInterval(() => { try { process.send({ t: 'idle', idle: idleNow(), between: betweenTurns(), webPeer: webPeerPresent() }) } catch { /* parent gone */ } }, 5000).unref()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thinkpool-pair",
3
- "version": "0.7.262",
3
+ "version": "0.7.263",
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": {