thinkpool-pair 0.6.11 → 0.6.13

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/README.md CHANGED
@@ -51,6 +51,29 @@ every byte mirrors to the web. The web's **"+ New terminal"** spawns additional
51
51
  **headless** terminals here (same directory, same env), driven entirely from
52
52
  the room. One bridge, many terminals.
53
53
 
54
+ ## Run it in the cloud (remote host / VM / container)
55
+
56
+ The bridge connects **outbound** to Supabase — no inbound ports, no public IP, no
57
+ tunnel. So a cloud VM, container, devcontainer, or remote dev box can stream its
58
+ Claude Code into the room exactly like a laptop. Run the same command there:
59
+
60
+ ```bash
61
+ export ANTHROPIC_API_KEY=sk-ant-... # headless auth (no Keychain login)
62
+ cd /path/to/your/repo
63
+ npx thinkpool-pair <ROOM> -- claude # structured Claude, no TTY needed
64
+ ```
65
+
66
+ - **Auth**: set `ANTHROPIC_API_KEY` (or `CLAUDE_CODE_OAUTH_TOKEN`) in the box's
67
+ env — the Agent SDK reads it automatically. The structured path runs the SDK's
68
+ bundled `claude`, so you don't need Claude Code separately installed.
69
+ - **No TTY required**: the agent picker auto-selects and raw-mode is skipped when
70
+ there's no terminal, so it runs fine under CI / a service / `nohup`.
71
+ - **Always-on**: `npx thinkpool-pair install-service <ROOM> -- claude` installs a
72
+ systemd `--user` unit (auto-restart + boot-persistent + auto-update). On a
73
+ server, also run `loginctl enable-linger $USER` so it survives logout.
74
+ - **Security**: anyone with the room code can drive the agent (shell-trust by
75
+ design) — on a server that's a real shell, so treat the room code like a secret.
76
+
54
77
  ## How it works
55
78
 
56
79
  `bridge.mjs` ⇄ **Supabase realtime** (`tpcode:<ROOM>`) ⇄ web `xterm`:
@@ -92,6 +92,7 @@ export function startClaudeSession({ cwd, model, resume, onEvent, requestPermiss
92
92
  // setPermissionMode) route through it once streaming.
93
93
  let mode = 'default' // mirrors Claude Code's ⇧⇥ cycle
94
94
  const alwaysAllow = new Set() // tool:risk signatures the user chose "don't ask again" for
95
+ const toolStart = new Map() // tool_use id → start time, for the duration badge
95
96
 
96
97
  const emit = (evt) => { try { onEvent?.(evt) } catch { /* never let a consumer throw into the loop */ } }
97
98
 
@@ -193,13 +194,19 @@ export function startClaudeSession({ cwd, model, resume, onEvent, requestPermiss
193
194
  emit({ kind: 'system', sessionId, model: m.model || model || null })
194
195
  break
195
196
  case 'assistant':
197
+ // Stamp tool-call start times so tool_result can report a duration.
198
+ for (const b of (m.message?.content || [])) {
199
+ if (b?.type === 'tool_use' && b.id) toolStart.set(b.id, Date.now())
200
+ }
196
201
  emit({ kind: 'assistant', blocks: simplifyBlocks(m.message?.content) })
197
202
  break
198
203
  case 'user':
199
204
  // tool_result blocks arrive on the user-role echo
200
205
  for (const b of (m.message?.content || [])) {
201
206
  if (b?.type === 'tool_result') {
202
- emit({ kind: 'tool_result', toolUseId: b.tool_use_id, content: b.content, isError: !!b.is_error })
207
+ const start = toolStart.get(b.tool_use_id)
208
+ if (start != null) toolStart.delete(b.tool_use_id)
209
+ emit({ kind: 'tool_result', toolUseId: b.tool_use_id, content: b.content, isError: !!b.is_error, durationMs: start != null ? Date.now() - start : undefined })
203
210
  }
204
211
  }
205
212
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thinkpool-pair",
3
- "version": "0.6.11",
3
+ "version": "0.6.13",
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": {