thinkpool-pair 0.5.0 → 0.5.1

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 +4 -2
package/bridge.mjs CHANGED
@@ -212,7 +212,15 @@ const announce = () =>
212
212
  // updir: where room file-drops land (forward-slash normalised — the web
213
213
  // client string-joins host paths onto it; Node accepts `/` on Windows).
214
214
  updir: UPDIR.split(path.sep).join('/'),
215
- agents: installedAgents,
215
+ // canResume: this agent can continue a prior session in THIS cwd —
216
+ // re-probed per announce (a fresh run creates a session, so the flag
217
+ // can flip true while the bridge is up). Functions don't survive
218
+ // JSON, so the wire shape is explicit.
219
+ agents: installedAgents.map(a => {
220
+ let canResume = false
221
+ if (a.resume) { try { canResume = a.resume.probe() } catch { /* stays false */ } }
222
+ return { label: a.label, cmd: a.cmd, canResume }
223
+ }),
216
224
  // cols/rows: the PTY's one true size — web viewers render this grid and
217
225
  // scale it to their own page instead of voting to reflow it.
218
226
  terms: [...terms.entries()].map(([id, t]) => ({ id, cmd: t.cmd, alive: true, cols: t.term.cols, rows: t.term.rows })),
@@ -324,8 +332,17 @@ channel
324
332
  // Multi-bridge rooms: a targeted open is for ONE machine. Untargeted
325
333
  // opens (older web) are taken by whoever hears them — the solo case.
326
334
  if (payload.host && payload.host !== name) return
327
- openTerm({ id: payload.id, cmd: payload.cmd })
328
- process.stderr.write(`\n ◆ web opened a "${payload.cmd}" terminal (headless).\n`)
335
+ // resume is a FLAG, never argv: the channel must not pass arbitrary
336
+ // args even though the room is shell-trust by design. The args come
337
+ // from our own KNOWN_AGENTS table, probe-gated so `--continue` with
338
+ // no prior session can't insta-kill the fresh terminal.
339
+ let args = []
340
+ if (payload.resume) {
341
+ const agent = KNOWN_AGENTS.find(a => a.cmd === payload.cmd)
342
+ if (agent?.resume) { try { if (agent.resume.probe()) args = [...agent.resume.args] } catch { /* fresh */ } }
343
+ }
344
+ openTerm({ id: payload.id, cmd: payload.cmd, args })
345
+ process.stderr.write(`\n ◆ web opened a "${payload.cmd}"${args.length ? ' (continue)' : ''} terminal (headless).\n`)
329
346
  })
330
347
  .on('broadcast', { event: 'term-close' }, ({ payload }) => {
331
348
  const t = payload?.id && terms.get(payload.id)
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "thinkpool-pair",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
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
- "bin": { "thinkpool-pair": "bridge.mjs" },
6
+ "bin": {
7
+ "thinkpool-pair": "bridge.mjs"
8
+ },
7
9
  "engines": {
8
10
  "node": ">=18"
9
11
  },