cc-claw 0.13.0 → 0.13.1
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/dist/cli.js +47 -13
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -72,7 +72,7 @@ var VERSION;
|
|
|
72
72
|
var init_version = __esm({
|
|
73
73
|
"src/version.ts"() {
|
|
74
74
|
"use strict";
|
|
75
|
-
VERSION = true ? "0.13.
|
|
75
|
+
VERSION = true ? "0.13.1" : (() => {
|
|
76
76
|
try {
|
|
77
77
|
return JSON.parse(readFileSync(join2(process.cwd(), "package.json"), "utf-8")).version ?? "unknown";
|
|
78
78
|
} catch {
|
|
@@ -9727,10 +9727,11 @@ function spawnQuery(adapter, config2, model2, cancelState, thinkingLevel, timeou
|
|
|
9727
9727
|
let firstLine = true;
|
|
9728
9728
|
const frTimeoutMs = opts?.firstResponseTimeoutMs ?? FIRST_RESPONSE_TIMEOUT_MS;
|
|
9729
9729
|
let firstResponseTimer;
|
|
9730
|
+
let gotModelContent = false;
|
|
9730
9731
|
if (frTimeoutMs > 0) {
|
|
9731
9732
|
firstResponseTimer = setTimeout(() => {
|
|
9732
|
-
if (
|
|
9733
|
-
warn(`[agent] First-response timeout after ${frTimeoutMs}ms for ${adapter.id} \u2014 no
|
|
9733
|
+
if (!gotModelContent) {
|
|
9734
|
+
warn(`[agent] First-response timeout after ${frTimeoutMs}ms for ${adapter.id} \u2014 no model content received (init may have arrived), killing`);
|
|
9734
9735
|
killProcessGroup(proc, "SIGTERM");
|
|
9735
9736
|
timedOut = true;
|
|
9736
9737
|
cancelState.__firstResponseTimeout = true;
|
|
@@ -9743,10 +9744,6 @@ function spawnQuery(adapter, config2, model2, cancelState, thinkingLevel, timeou
|
|
|
9743
9744
|
if (firstLine) {
|
|
9744
9745
|
log(`[agent] First CLI message after ${elapsed()}`);
|
|
9745
9746
|
firstLine = false;
|
|
9746
|
-
if (firstResponseTimer) {
|
|
9747
|
-
clearTimeout(firstResponseTimer);
|
|
9748
|
-
firstResponseTimer = void 0;
|
|
9749
|
-
}
|
|
9750
9747
|
}
|
|
9751
9748
|
let msg;
|
|
9752
9749
|
try {
|
|
@@ -9766,12 +9763,26 @@ function spawnQuery(adapter, config2, model2, cancelState, thinkingLevel, timeou
|
|
|
9766
9763
|
if (ev.sessionId) sessionId = ev.sessionId;
|
|
9767
9764
|
break;
|
|
9768
9765
|
case "text":
|
|
9766
|
+
if (!gotModelContent) {
|
|
9767
|
+
gotModelContent = true;
|
|
9768
|
+
if (firstResponseTimer) {
|
|
9769
|
+
clearTimeout(firstResponseTimer);
|
|
9770
|
+
firstResponseTimer = void 0;
|
|
9771
|
+
}
|
|
9772
|
+
}
|
|
9769
9773
|
if (ev.text) {
|
|
9770
9774
|
accumulatedText = appendTextChunk(accumulatedText, ev.text);
|
|
9771
9775
|
if (opts?.onStream) opts.onStream(ev.text);
|
|
9772
9776
|
}
|
|
9773
9777
|
break;
|
|
9774
9778
|
case "tool_start":
|
|
9779
|
+
if (!gotModelContent) {
|
|
9780
|
+
gotModelContent = true;
|
|
9781
|
+
if (firstResponseTimer) {
|
|
9782
|
+
clearTimeout(firstResponseTimer);
|
|
9783
|
+
firstResponseTimer = void 0;
|
|
9784
|
+
}
|
|
9785
|
+
}
|
|
9775
9786
|
sawToolEvents = true;
|
|
9776
9787
|
if (opts?.onToolAction && ev.toolName) {
|
|
9777
9788
|
const toolInput = ev.toolInput ?? {};
|
|
@@ -9821,6 +9832,13 @@ function spawnQuery(adapter, config2, model2, cancelState, thinkingLevel, timeou
|
|
|
9821
9832
|
}
|
|
9822
9833
|
break;
|
|
9823
9834
|
case "result":
|
|
9835
|
+
if (!gotModelContent) {
|
|
9836
|
+
gotModelContent = true;
|
|
9837
|
+
if (firstResponseTimer) {
|
|
9838
|
+
clearTimeout(firstResponseTimer);
|
|
9839
|
+
firstResponseTimer = void 0;
|
|
9840
|
+
}
|
|
9841
|
+
}
|
|
9824
9842
|
sawResultEvent = true;
|
|
9825
9843
|
log(`[agent] Result received at ${elapsed()}`);
|
|
9826
9844
|
resultText = ev.resultText || accumulatedText;
|
|
@@ -9956,7 +9974,9 @@ async function spawnGeminiWithRotation(chatId, adapter, baseConfig, configWithSe
|
|
|
9956
9974
|
}
|
|
9957
9975
|
}
|
|
9958
9976
|
}
|
|
9959
|
-
|
|
9977
|
+
const fallbackResult = await spawnQuery(adapter, fallbackConfig, GEMINI_FALLBACK_MODEL, cancelState, thinkingLevel, timeoutMs, maxTurns, { ...opts, envOverride: env, firstResponseTimeoutMs: 0 });
|
|
9978
|
+
fallbackResult.resolvedModel = GEMINI_FALLBACK_MODEL;
|
|
9979
|
+
return fallbackResult;
|
|
9960
9980
|
}
|
|
9961
9981
|
const quotaClass = classifyGeminiQuota(errMsg);
|
|
9962
9982
|
if (quotaClass === "rate_limited") {
|
|
@@ -10084,6 +10104,7 @@ async function askAgentImpl(chatId, userMessage, opts) {
|
|
|
10084
10104
|
fallbackConfig.args = injectMcpConfig(adapter.id, fallbackConfig.args, mcpConfigPath);
|
|
10085
10105
|
}
|
|
10086
10106
|
result = await spawnQuery(adapter, fallbackConfig, GEMINI_FALLBACK_MODEL, cancelState, thinkingLevel, timeoutMs, maxTurns, { ...spawnOpts, firstResponseTimeoutMs: 0 });
|
|
10107
|
+
result.resolvedModel = GEMINI_FALLBACK_MODEL;
|
|
10087
10108
|
} else {
|
|
10088
10109
|
throw err;
|
|
10089
10110
|
}
|
|
@@ -10154,7 +10175,8 @@ async function askAgentImpl(chatId, userMessage, opts) {
|
|
|
10154
10175
|
return {
|
|
10155
10176
|
text: result.resultText || `(No response from ${adapter.displayName})`,
|
|
10156
10177
|
sessionId: result.sessionId,
|
|
10157
|
-
usage: { input: result.input, output: result.output, cacheRead: result.cacheRead, contextSize: result.contextSize }
|
|
10178
|
+
usage: { input: result.input, output: result.output, cacheRead: result.cacheRead, contextSize: result.contextSize },
|
|
10179
|
+
resolvedModel: result.resolvedModel
|
|
10158
10180
|
};
|
|
10159
10181
|
}
|
|
10160
10182
|
function getMcpConfigPath(chatId) {
|
|
@@ -10191,7 +10213,7 @@ var init_agent = __esm({
|
|
|
10191
10213
|
activeChats = /* @__PURE__ */ new Map();
|
|
10192
10214
|
chatLocks = /* @__PURE__ */ new Map();
|
|
10193
10215
|
SPAWN_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
10194
|
-
FIRST_RESPONSE_TIMEOUT_MS = parseInt(process.env.GEMINI_FIRST_RESPONSE_TIMEOUT_MS ?? "
|
|
10216
|
+
FIRST_RESPONSE_TIMEOUT_MS = parseInt(process.env.GEMINI_FIRST_RESPONSE_TIMEOUT_MS ?? "30000", 10);
|
|
10195
10217
|
FIRST_RESPONSE_TIMEOUT_ERROR = "FIRST_RESPONSE_TIMEOUT";
|
|
10196
10218
|
GEMINI_FALLBACK_MODEL = "gemini-2.5-pro";
|
|
10197
10219
|
GEMINI_DOWNGRADE_MODELS = /* @__PURE__ */ new Set(["gemini-3.1-pro-preview"]);
|
|
@@ -15202,12 +15224,20 @@ You're still in discussion mode \u2014 try again or click a button to exit.`, {
|
|
|
15202
15224
|
const sigEnabled = getModelSignature(chatId);
|
|
15203
15225
|
if (sigEnabled === "on" && responseText && !responseText.startsWith("(No response")) {
|
|
15204
15226
|
const adapter = getAdapterForChat(chatId);
|
|
15205
|
-
const modelId = model2 ?? adapter.defaultModel;
|
|
15227
|
+
const modelId = response.resolvedModel ?? model2 ?? adapter.defaultModel;
|
|
15206
15228
|
const thinking2 = getThinkingLevel(chatId) || "auto";
|
|
15207
15229
|
const shortModel = formatModelShort(modelId);
|
|
15230
|
+
let slotTag = "";
|
|
15231
|
+
if (adapter.id === "gemini") {
|
|
15232
|
+
const slotId = getChatGeminiSlotId(chatId);
|
|
15233
|
+
if (slotId) {
|
|
15234
|
+
const slot = getGeminiSlots().find((s) => s.id === slotId);
|
|
15235
|
+
if (slot) slotTag = ` \xB7 ${slot.label || `slot-${slot.id}`}`;
|
|
15236
|
+
}
|
|
15237
|
+
}
|
|
15208
15238
|
responseText += `
|
|
15209
15239
|
|
|
15210
|
-
\u{1F9E0} [${shortModel} | ${capitalize(thinking2)}] \u23F1\uFE0F ${elapsedSec}s`;
|
|
15240
|
+
\u{1F9E0} [${shortModel} | ${capitalize(thinking2)}${slotTag}] \u23F1\uFE0F ${elapsedSec}s`;
|
|
15211
15241
|
}
|
|
15212
15242
|
if (observedSubagents.size > 0) {
|
|
15213
15243
|
const names = [...observedSubagents].join(", ");
|
|
@@ -16474,7 +16504,11 @@ Result: ${task.result.slice(0, 500)}` : ""
|
|
|
16474
16504
|
pinChatGeminiSlot(chatId, slotId);
|
|
16475
16505
|
const label2 = slot.label || `slot-${slot.id}`;
|
|
16476
16506
|
const icon = slot.slotType === "oauth" ? "\u{1F468}\u{1F3FD}\u200D\u{1F4BB}" : "\u{1F511}";
|
|
16477
|
-
|
|
16507
|
+
const rotationMode = getGeminiRotationMode();
|
|
16508
|
+
const rotationLabels = { off: "off", all: "all slots", accounts: "accounts only", keys: "keys only" };
|
|
16509
|
+
const rotationNote = rotationMode === "off" ? "Rotation is off \u2014 only this account will be used." : `Rotation: ${rotationLabels[rotationMode]} (this is the starting slot).`;
|
|
16510
|
+
await channel.sendText(chatId, `${icon} Account set to <b>${label2}</b>
|
|
16511
|
+
${rotationNote}`, { parseMode: "html" });
|
|
16478
16512
|
}
|
|
16479
16513
|
}
|
|
16480
16514
|
return;
|
package/package.json
CHANGED