@cocorograph/hub-agent 0.6.9 → 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/src/skills.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({
|
package/src/skills.mjs
CHANGED
|
@@ -52,6 +52,10 @@ function extractFrontmatter(text) {
|
|
|
52
52
|
if (nameMatch) out.name = nameMatch[1].trim()
|
|
53
53
|
const descMatch = fm.match(/^description:\s*["']?(.*)["']?\s*$/m)
|
|
54
54
|
if (descMatch) out.description = descMatch[1].replace(/^["']|["']$/g, "").trim()
|
|
55
|
+
// label_ja: cockpit chat の SkillBar / サジェストに出す日本語ボタンラベル。
|
|
56
|
+
// 無ければ表示側で `/name` にフォールバック (送信は常に `/name`)。
|
|
57
|
+
const labelMatch = fm.match(/^label_ja:\s*["']?(.*?)["']?\s*$/m)
|
|
58
|
+
if (labelMatch) out.label_ja = labelMatch[1].replace(/^["']|["']$/g, "").trim()
|
|
55
59
|
return out
|
|
56
60
|
}
|
|
57
61
|
|
|
@@ -80,6 +84,7 @@ async function loadSkillsDir(skillsDir, source) {
|
|
|
80
84
|
out.push({
|
|
81
85
|
name: fm.name || e.name,
|
|
82
86
|
description: fm.description || "",
|
|
87
|
+
...(fm.label_ja ? { label: fm.label_ja } : {}),
|
|
83
88
|
source,
|
|
84
89
|
})
|
|
85
90
|
}
|
|
@@ -103,6 +108,7 @@ async function loadCommandsDir(commandsDir, source) {
|
|
|
103
108
|
out.push({
|
|
104
109
|
name: fm.name || f.replace(/\.md$/, ""),
|
|
105
110
|
description: fm.description || "",
|
|
111
|
+
...(fm.label_ja ? { label: fm.label_ja } : {}),
|
|
106
112
|
source,
|
|
107
113
|
})
|
|
108
114
|
}
|