thinkpool-pair 0.6.15 → 0.6.16

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/claude-session.mjs +17 -0
  2. package/package.json +1 -1
@@ -123,6 +123,7 @@ export function startClaudeSession({ cwd, model, resume, onEvent, requestPermiss
123
123
  let mode = 'default' // mirrors Claude Code's ⇧⇥ cycle
124
124
  const alwaysAllow = new Set() // tool:risk signatures the user chose "don't ask again" for
125
125
  const toolStart = new Map() // tool_use id → start time, for the duration badge
126
+ let effort = null // active reasoning effort for the turn (from the hook input)
126
127
 
127
128
  const emit = (evt) => { try { onEvent?.(evt) } catch { /* never let a consumer throw into the loop */ } }
128
129
 
@@ -133,6 +134,11 @@ export function startClaudeSession({ cwd, model, resume, onEvent, requestPermiss
133
134
  const preTool = async (hookInput) => {
134
135
  const toolName = hookInput.tool_name
135
136
  const toolInput = hookInput.tool_input
137
+ // The hook input carries the turn's active reasoning effort (post any
138
+ // model downgrade) — the real signal for "thinking with <X> effort".
139
+ // Surface it to the room when it changes; absent on models without effort.
140
+ const lvl = hookInput.effort?.level
141
+ if (lvl && lvl !== effort) { effort = lvl; emit({ kind: 'effort', level: effort }) }
136
142
  // ── Plan approval — ExitPlanMode is how the agent presents its plan in
137
143
  // plan mode. Render a dedicated plan card (not the generic perm card) with
138
144
  // three outcomes: run (exit → default), accept (exit → acceptEdits), keep
@@ -207,6 +213,10 @@ export function startClaudeSession({ cwd, model, resume, onEvent, requestPermiss
207
213
  abortController: ac,
208
214
  permissionMode: 'default',
209
215
  hooks: { PreToolUse: [{ hooks: [preTool] }] },
216
+ // Needed for live thinking-token progress (SDKThinkingTokensMessage) to
217
+ // flow during a turn. We ignore the fine-grained stream_event partials in
218
+ // the loop; only the coarse thinking_tokens system message is surfaced.
219
+ includePartialMessages: true,
210
220
  }
211
221
  if (cwd) opts.cwd = cwd
212
222
  if (model) opts.model = model
@@ -219,6 +229,13 @@ export function startClaudeSession({ cwd, model, resume, onEvent, requestPermiss
219
229
  if (closed) break
220
230
  switch (m.type) {
221
231
  case 'system':
232
+ // Live thinking-token progress — the running estimate while the
233
+ // model reasons, surfaced as the indicator's ↓ N tokens. Coarse,
234
+ // emitted during extended thinking; not a per-token stream.
235
+ if (m.subtype === 'thinking_tokens') {
236
+ emit({ kind: 'thinking_tokens', tokens: m.estimated_tokens, delta: m.estimated_tokens_delta })
237
+ break
238
+ }
222
239
  if (m.session_id) sessionId = m.session_id
223
240
  emit({ kind: 'system', sessionId, model: m.model || model || null })
224
241
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thinkpool-pair",
3
- "version": "0.6.15",
3
+ "version": "0.6.16",
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": {