@blockrun/clawrouter 0.12.89 → 0.12.91
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 +28 -9
- package/dist/cli.js.map +1 -1
- package/dist/index.js +28 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/imagegen/SKILL.md +9 -7
- package/skills/predexon/SKILL.md +45 -38
package/dist/cli.js
CHANGED
|
@@ -51252,7 +51252,10 @@ var PROVIDER_ERROR_PATTERNS = [
|
|
|
51252
51252
|
/payload too large/i,
|
|
51253
51253
|
/payment.*verification.*failed/i,
|
|
51254
51254
|
/model.*not.*allowed/i,
|
|
51255
|
-
/unknown.*model/i
|
|
51255
|
+
/unknown.*model/i,
|
|
51256
|
+
/reasoning_content.*missing/i,
|
|
51257
|
+
// Thinking model multi-turn: missing reasoning_content → fallback
|
|
51258
|
+
/thinking.*reasoning_content/i
|
|
51256
51259
|
];
|
|
51257
51260
|
var DEGRADED_RESPONSE_PATTERNS = [
|
|
51258
51261
|
/the ai service is temporarily overloaded/i,
|
|
@@ -51319,6 +51322,21 @@ function detectDegradedSuccessResponse(body) {
|
|
|
51319
51322
|
if (errorText && PROVIDER_ERROR_PATTERNS.some((pattern) => pattern.test(errorText))) {
|
|
51320
51323
|
return `degraded response: ${errorText.slice(0, 120)}`;
|
|
51321
51324
|
}
|
|
51325
|
+
const choices = parsed.choices;
|
|
51326
|
+
if (Array.isArray(choices) && choices.length > 0) {
|
|
51327
|
+
const choice = choices[0];
|
|
51328
|
+
const msg = choice.message ?? choice.delta;
|
|
51329
|
+
if (msg) {
|
|
51330
|
+
const content = msg.content;
|
|
51331
|
+
const toolCalls = msg.tool_calls;
|
|
51332
|
+
const hasContent = typeof content === "string" && content.trim().length > 0;
|
|
51333
|
+
const hasToolCalls = Array.isArray(toolCalls) && toolCalls.length > 0;
|
|
51334
|
+
const finishReason = choice.finish_reason;
|
|
51335
|
+
if (!hasContent && !hasToolCalls && finishReason === "stop") {
|
|
51336
|
+
return "degraded response: empty turn (no content or tool calls)";
|
|
51337
|
+
}
|
|
51338
|
+
}
|
|
51339
|
+
}
|
|
51322
51340
|
const assistantContent = extractAssistantContent(parsed);
|
|
51323
51341
|
if (!assistantContent) return void 0;
|
|
51324
51342
|
if (DEGRADED_RESPONSE_PATTERNS.some((pattern) => pattern.test(assistantContent))) {
|
|
@@ -51457,13 +51475,8 @@ function normalizeMessagesForThinking(messages) {
|
|
|
51457
51475
|
if (msg.role !== "assistant" || msg.reasoning_content !== void 0) {
|
|
51458
51476
|
return msg;
|
|
51459
51477
|
}
|
|
51460
|
-
|
|
51461
|
-
|
|
51462
|
-
if (hasOpenAIToolCalls || hasAnthropicToolUse) {
|
|
51463
|
-
hasChanges = true;
|
|
51464
|
-
return { ...msg, reasoning_content: "" };
|
|
51465
|
-
}
|
|
51466
|
-
return msg;
|
|
51478
|
+
hasChanges = true;
|
|
51479
|
+
return { ...msg, reasoning_content: "" };
|
|
51467
51480
|
});
|
|
51468
51481
|
return hasChanges ? normalized : messages;
|
|
51469
51482
|
}
|
|
@@ -53694,7 +53707,13 @@ data: [DONE]
|
|
|
53694
53707
|
let errPayload;
|
|
53695
53708
|
try {
|
|
53696
53709
|
const parsed = JSON.parse(transformedErr);
|
|
53697
|
-
|
|
53710
|
+
if (parsed && typeof parsed === "object" && "error" in parsed) {
|
|
53711
|
+
errPayload = JSON.stringify(parsed);
|
|
53712
|
+
} else {
|
|
53713
|
+
errPayload = JSON.stringify({
|
|
53714
|
+
error: { message: rawErrBody, type: "provider_error", status: errStatus }
|
|
53715
|
+
});
|
|
53716
|
+
}
|
|
53698
53717
|
} catch {
|
|
53699
53718
|
errPayload = JSON.stringify({
|
|
53700
53719
|
error: { message: rawErrBody, type: "provider_error", status: errStatus }
|