@cocorograph/hub-agent 0.6.10 → 0.6.11
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/package.json +1 -1
- package/src/claude-stream-bridge.mjs +22 -1
- package/src/main.mjs +6 -0
package/package.json
CHANGED
|
@@ -48,6 +48,8 @@ class ClaudeStreamSession {
|
|
|
48
48
|
cwd,
|
|
49
49
|
model,
|
|
50
50
|
permissionMode,
|
|
51
|
+
maxTurns,
|
|
52
|
+
maxThinkingTokens,
|
|
51
53
|
resumeSessionId,
|
|
52
54
|
sdk,
|
|
53
55
|
logger,
|
|
@@ -61,6 +63,9 @@ class ClaudeStreamSession {
|
|
|
61
63
|
this.cwd = cwd
|
|
62
64
|
this.model = model || null
|
|
63
65
|
this.permissionMode = permissionMode || null
|
|
66
|
+
this.maxTurns = typeof maxTurns === "number" ? maxTurns : null
|
|
67
|
+
this.maxThinkingTokens =
|
|
68
|
+
typeof maxThinkingTokens === "number" ? maxThinkingTokens : null
|
|
64
69
|
this.sdk = sdk
|
|
65
70
|
this.logger = logger
|
|
66
71
|
this.onEvent = onEvent
|
|
@@ -185,6 +190,9 @@ class ClaudeStreamSession {
|
|
|
185
190
|
}
|
|
186
191
|
if (this.model) options.model = this.model
|
|
187
192
|
if (this.permissionMode) options.permissionMode = this.permissionMode
|
|
193
|
+
// Phase B: チャット SDK に効くオプション (拡張思考予算 / ツール往復上限)。
|
|
194
|
+
if (this.maxTurns != null) options.maxTurns = this.maxTurns
|
|
195
|
+
if (this.maxThinkingTokens != null) options.maxThinkingTokens = this.maxThinkingTokens
|
|
188
196
|
// 直前ターンまでの session_id があれば resume チェーン
|
|
189
197
|
if (this.sessionId) options.resume = this.sessionId
|
|
190
198
|
|
|
@@ -340,11 +348,21 @@ export class ClaudeStreamBridge extends EventEmitter {
|
|
|
340
348
|
* cwd?: string,
|
|
341
349
|
* model?: string|null,
|
|
342
350
|
* permissionMode?: string|null,
|
|
351
|
+
* maxTurns?: number|null,
|
|
352
|
+
* maxThinkingTokens?: number|null,
|
|
343
353
|
* resumeSessionId?: string|null,
|
|
344
354
|
* }} args
|
|
345
355
|
* @returns {{ stream_id: string, resuming: boolean }}
|
|
346
356
|
*/
|
|
347
|
-
attach({
|
|
357
|
+
attach({
|
|
358
|
+
stream_id,
|
|
359
|
+
cwd,
|
|
360
|
+
model,
|
|
361
|
+
permissionMode,
|
|
362
|
+
maxTurns,
|
|
363
|
+
maxThinkingTokens,
|
|
364
|
+
resumeSessionId,
|
|
365
|
+
}) {
|
|
348
366
|
if (!stream_id) throw new TypeError("attach requires stream_id")
|
|
349
367
|
if (this.sessions.has(stream_id)) {
|
|
350
368
|
throw new Error(`stream_id "${stream_id}" は既に attach 済みです`)
|
|
@@ -354,6 +372,9 @@ export class ClaudeStreamBridge extends EventEmitter {
|
|
|
354
372
|
cwd: cwd || process.env.HOME || process.cwd(),
|
|
355
373
|
model: model || null,
|
|
356
374
|
permissionMode: permissionMode || null,
|
|
375
|
+
maxTurns: typeof maxTurns === "number" ? maxTurns : null,
|
|
376
|
+
maxThinkingTokens:
|
|
377
|
+
typeof maxThinkingTokens === "number" ? maxThinkingTokens : null,
|
|
357
378
|
resumeSessionId: resumeSessionId || null,
|
|
358
379
|
sdk: this.sdk,
|
|
359
380
|
logger: this.logger,
|
package/src/main.mjs
CHANGED
|
@@ -628,6 +628,12 @@ async function dispatch(msg, ctx) {
|
|
|
628
628
|
msg.permission_mode ||
|
|
629
629
|
ctx.config?.claude_permission_mode ||
|
|
630
630
|
null,
|
|
631
|
+
// Phase B: チャット SDK に効くオプション (session 単位 override)。
|
|
632
|
+
maxTurns: typeof msg.max_turns === "number" ? msg.max_turns : null,
|
|
633
|
+
maxThinkingTokens:
|
|
634
|
+
typeof msg.max_thinking_tokens === "number"
|
|
635
|
+
? msg.max_thinking_tokens
|
|
636
|
+
: null,
|
|
631
637
|
resumeSessionId: msg.resume_session_id || null,
|
|
632
638
|
})
|
|
633
639
|
ctx.client.send({
|