thinkpool-pair 0.7.123 → 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.
- package/bridge.mjs +17 -8
- 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
|
|
@@ -2177,15 +2186,15 @@ channel
|
|
|
2177
2186
|
// Auto-resume (Max, 2026-07-02): a PLAIN terminal (NOT a flow lane — those have their
|
|
2178
2187
|
// own re-dispatch) that was MID-TURN when the bridge stopped picks the work back up
|
|
2179
2188
|
// instead of sitting aborted. If its SDK context resumes (canResume), send ONE
|
|
2180
|
-
// "continue"
|
|
2181
|
-
//
|
|
2182
|
-
//
|
|
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.
|
|
2183
2196
|
if (re && !rec.flowSessionId && canResume(rec) && restoredTurnOpen(rec.log || [])) {
|
|
2184
|
-
|
|
2185
|
-
setTimeout(() => {
|
|
2186
|
-
const e = sessions.get(rid)
|
|
2187
|
-
try { e?.session?.sendTurn('continue') } catch { /* session still starting — stays idle, user can resume manually */ }
|
|
2188
|
-
}, 2500)
|
|
2197
|
+
re.pendingAutoResume = true
|
|
2189
2198
|
}
|
|
2190
2199
|
}
|
|
2191
2200
|
// Fresh open: ONLY for an explicit `-- <claude>` share. In account mode
|