thinkpool-pair 0.7.121 → 0.7.123

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 +20 -3
  2. package/package.json +1 -1
package/bridge.mjs CHANGED
@@ -1178,7 +1178,7 @@ function openStructured({ id, model, resume, log, commands, mode, spawnedBy, rol
1178
1178
  // spawnedBy: set when this lane was Dispatched (spawn_terminal). Restored from the
1179
1179
  // session store so the Ensemble flag survives a bridge restart (else a respin
1180
1180
  // stripped it and the lane reverted to a plain tab — the t6 "no chip" bug).
1181
- const entry = { cmd: 'claude', kind: 'structured', log: Array.isArray(log) ? log.slice(-STRUCTURED_LOG_MAX) : [], pending: new Map(), session: null, recovered: false, commands: Array.isArray(commands) ? commands : undefined, mode, spawnedBy: spawnedBy || undefined, flowSessionId: flowSessionId || null, flowTaskKey: flowTaskKey || null, cwd: cwd || null }
1181
+ const entry = { cmd: 'claude', kind: 'structured', log: Array.isArray(log) ? log.slice(-STRUCTURED_LOG_MAX) : [], pending: new Map(), session: null, recovered: false, commands: Array.isArray(commands) ? commands : undefined, mode, model: model || null, spawnedBy: spawnedBy || undefined, flowSessionId: flowSessionId || null, flowTaskKey: flowTaskKey || null, cwd: cwd || null }
1182
1182
  // C1 (RT-2): per-term contiguous seq counter. Seeded from the restored log's max
1183
1183
  // so a bridge restart resumes ABOVE every persisted seq — fresh events never reuse
1184
1184
  // an old seq, which is what keeps the between-turns restart dup-free (see
@@ -1911,8 +1911,12 @@ channel
1911
1911
  if (agent?.resume) { try { if (agent.resume.probe()) args = [...agent.resume.args] } catch { /* fresh */ } }
1912
1912
  }
1913
1913
  if (wantStructured(payload.cmd)) {
1914
- openStructured({ id: payload.id, mode: payload.mode })
1915
- process.stderr.write(`\n ◆ web opened a structured "${payload.cmd}" session (${payload.mode || 'default'}).\n`)
1914
+ // model: the web passes the model to open on — a NEW terminal inherits the
1915
+ // previous terminal's model (and the first uses the provider default). Falls
1916
+ // through to the SDK default when absent. Stamped on the entry so the announce
1917
+ // carries it at open (chip shows the model immediately, not the branch).
1918
+ openStructured({ id: payload.id, mode: payload.mode, model: payload.model || undefined })
1919
+ process.stderr.write(`\n ◆ web opened a structured "${payload.cmd}" session (${payload.mode || 'default'}${payload.model ? `, model ${payload.model}` : ''}).\n`)
1916
1920
  return
1917
1921
  }
1918
1922
  openTerm({ id: payload.id, cmd: payload.cmd, args })
@@ -2170,6 +2174,19 @@ channel
2170
2174
  if (re && rec.flowTaskKey && !restoredTurnOpen(rec.log || [])) {
2171
2175
  setTimeout(() => { try { re.markFlowDone?.() } catch { /* noop */ } }, 2000)
2172
2176
  }
2177
+ // Auto-resume (Max, 2026-07-02): a PLAIN terminal (NOT a flow lane — those have their
2178
+ // own re-dispatch) that was MID-TURN when the bridge stopped picks the work back up
2179
+ // instead of sitting aborted. If its SDK context resumes (canResume), send ONE
2180
+ // "continue" once the session is live — like the user typing "continue" after a
2181
+ // restart. openStructured already closed the interrupted turn idle, so a continue that
2182
+ // can't be delivered just leaves it idle (recoverable) — never a hang or a loop.
2183
+ if (re && !rec.flowSessionId && canResume(rec) && restoredTurnOpen(rec.log || [])) {
2184
+ const rid = rec.id
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)
2189
+ }
2173
2190
  }
2174
2191
  // Fresh open: ONLY for an explicit `-- <claude>` share. In account mode
2175
2192
  // (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.121",
3
+ "version": "0.7.123",
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": {