@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/index.js
CHANGED
|
@@ -51772,7 +51772,10 @@ var PROVIDER_ERROR_PATTERNS = [
|
|
|
51772
51772
|
/payload too large/i,
|
|
51773
51773
|
/payment.*verification.*failed/i,
|
|
51774
51774
|
/model.*not.*allowed/i,
|
|
51775
|
-
/unknown.*model/i
|
|
51775
|
+
/unknown.*model/i,
|
|
51776
|
+
/reasoning_content.*missing/i,
|
|
51777
|
+
// Thinking model multi-turn: missing reasoning_content → fallback
|
|
51778
|
+
/thinking.*reasoning_content/i
|
|
51776
51779
|
];
|
|
51777
51780
|
var DEGRADED_RESPONSE_PATTERNS = [
|
|
51778
51781
|
/the ai service is temporarily overloaded/i,
|
|
@@ -51839,6 +51842,21 @@ function detectDegradedSuccessResponse(body) {
|
|
|
51839
51842
|
if (errorText && PROVIDER_ERROR_PATTERNS.some((pattern) => pattern.test(errorText))) {
|
|
51840
51843
|
return `degraded response: ${errorText.slice(0, 120)}`;
|
|
51841
51844
|
}
|
|
51845
|
+
const choices = parsed.choices;
|
|
51846
|
+
if (Array.isArray(choices) && choices.length > 0) {
|
|
51847
|
+
const choice = choices[0];
|
|
51848
|
+
const msg = choice.message ?? choice.delta;
|
|
51849
|
+
if (msg) {
|
|
51850
|
+
const content = msg.content;
|
|
51851
|
+
const toolCalls = msg.tool_calls;
|
|
51852
|
+
const hasContent = typeof content === "string" && content.trim().length > 0;
|
|
51853
|
+
const hasToolCalls = Array.isArray(toolCalls) && toolCalls.length > 0;
|
|
51854
|
+
const finishReason = choice.finish_reason;
|
|
51855
|
+
if (!hasContent && !hasToolCalls && finishReason === "stop") {
|
|
51856
|
+
return "degraded response: empty turn (no content or tool calls)";
|
|
51857
|
+
}
|
|
51858
|
+
}
|
|
51859
|
+
}
|
|
51842
51860
|
const assistantContent = extractAssistantContent(parsed);
|
|
51843
51861
|
if (!assistantContent) return void 0;
|
|
51844
51862
|
if (DEGRADED_RESPONSE_PATTERNS.some((pattern) => pattern.test(assistantContent))) {
|
|
@@ -51977,13 +51995,8 @@ function normalizeMessagesForThinking(messages) {
|
|
|
51977
51995
|
if (msg.role !== "assistant" || msg.reasoning_content !== void 0) {
|
|
51978
51996
|
return msg;
|
|
51979
51997
|
}
|
|
51980
|
-
|
|
51981
|
-
|
|
51982
|
-
if (hasOpenAIToolCalls || hasAnthropicToolUse) {
|
|
51983
|
-
hasChanges = true;
|
|
51984
|
-
return { ...msg, reasoning_content: "" };
|
|
51985
|
-
}
|
|
51986
|
-
return msg;
|
|
51998
|
+
hasChanges = true;
|
|
51999
|
+
return { ...msg, reasoning_content: "" };
|
|
51987
52000
|
});
|
|
51988
52001
|
return hasChanges ? normalized : messages;
|
|
51989
52002
|
}
|
|
@@ -54214,7 +54227,13 @@ data: [DONE]
|
|
|
54214
54227
|
let errPayload;
|
|
54215
54228
|
try {
|
|
54216
54229
|
const parsed = JSON.parse(transformedErr);
|
|
54217
|
-
|
|
54230
|
+
if (parsed && typeof parsed === "object" && "error" in parsed) {
|
|
54231
|
+
errPayload = JSON.stringify(parsed);
|
|
54232
|
+
} else {
|
|
54233
|
+
errPayload = JSON.stringify({
|
|
54234
|
+
error: { message: rawErrBody, type: "provider_error", status: errStatus }
|
|
54235
|
+
});
|
|
54236
|
+
}
|
|
54218
54237
|
} catch {
|
|
54219
54238
|
errPayload = JSON.stringify({
|
|
54220
54239
|
error: { message: rawErrBody, type: "provider_error", status: errStatus }
|