thinkpool-pair 0.6.12 → 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.
@@ -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.12",
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": {