thinkpool-pair 0.7.122 → 0.7.124

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 +22 -0
  2. package/package.json +1 -1
package/bridge.mjs CHANGED
@@ -1663,6 +1663,15 @@ function openStructured({ id, model, resume, log, commands, mode, spawnedBy, rol
1663
1663
  // on the entry so the ANNOUNCE can hand it to clients that connect/reload
1664
1664
  // AFTER init (the one-time code-event would miss them), then re-announce.
1665
1665
  if (evt.kind === 'system' && Array.isArray(evt.commands) && evt.commands.length && !entry.commands) { entry.commands = evt.commands; announce(); persist() }
1666
+ // Auto-resume trigger (Max, 2026-07-02): the init `system` event means the SDK session
1667
+ // is LIVE (input stream now consumed). A restored mid-turn plain terminal flagged for
1668
+ // resume gets its single "continue" HERE — not on a blind timer that raced the ~40s
1669
+ // resume and dropped the turn into a dead input stream. Fires exactly once.
1670
+ if (evt.kind === 'system' && entry.pendingAutoResume) {
1671
+ entry.pendingAutoResume = false
1672
+ try { entry.session?.sendTurn('continue') } catch { /* not resumable — stays idle, user can continue manually */ }
1673
+ process.stderr.write(`\n ◆ auto-resumed interrupted turn (${id.slice(0, 8)}) — sent continue.\n`)
1674
+ }
1666
1675
  // Chrome events (mode / usage / clear / compact) are transient state, not
1667
1676
  // transcript — broadcast + print them but keep out of the persisted/replayed log.
1668
1677
  // 'stalled' is transient turn-liveness state (would replay as a stale frozen
@@ -2174,6 +2183,19 @@ channel
2174
2183
  if (re && rec.flowTaskKey && !restoredTurnOpen(rec.log || [])) {
2175
2184
  setTimeout(() => { try { re.markFlowDone?.() } catch { /* noop */ } }, 2000)
2176
2185
  }
2186
+ // Auto-resume (Max, 2026-07-02): a PLAIN terminal (NOT a flow lane — those have their
2187
+ // own re-dispatch) that was MID-TURN when the bridge stopped picks the work back up
2188
+ // instead of sitting aborted. If its SDK context resumes (canResume), send ONE
2189
+ // "continue" — like the user typing "continue" after a restart. We DON'T fire on a
2190
+ // fixed timer: a resume takes ~40s to become live (MCP boot + sanitizeSession), and a
2191
+ // 2.5s sendTurn pushed into an input stream nothing is consuming yet is silently lost
2192
+ // (the 2026-07-02 "didn't autocontinue" bug). Instead FLAG it here and fire the single
2193
+ // continue when the session's init `system` event actually arrives (onEvent), i.e. the
2194
+ // instant it's live. openStructured already closed the interrupted turn idle, so a
2195
+ // continue that can't be delivered just leaves it idle (recoverable) — never a hang.
2196
+ if (re && !rec.flowSessionId && canResume(rec) && restoredTurnOpen(rec.log || [])) {
2197
+ re.pendingAutoResume = true
2198
+ }
2177
2199
  }
2178
2200
  // Fresh open: ONLY for an explicit `-- <claude>` share. In account mode
2179
2201
  // (autoAgent set, no attachedCmd) the web's `?new=1` flow opens the first
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thinkpool-pair",
3
- "version": "0.7.122",
3
+ "version": "0.7.124",
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": {