@blockrun/clawrouter 0.12.89 → 0.12.90
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 +15 -0
- package/dist/cli.js.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -51319,6 +51319,21 @@ function detectDegradedSuccessResponse(body) {
|
|
|
51319
51319
|
if (errorText && PROVIDER_ERROR_PATTERNS.some((pattern) => pattern.test(errorText))) {
|
|
51320
51320
|
return `degraded response: ${errorText.slice(0, 120)}`;
|
|
51321
51321
|
}
|
|
51322
|
+
const choices = parsed.choices;
|
|
51323
|
+
if (Array.isArray(choices) && choices.length > 0) {
|
|
51324
|
+
const choice = choices[0];
|
|
51325
|
+
const msg = choice.message ?? choice.delta;
|
|
51326
|
+
if (msg) {
|
|
51327
|
+
const content = msg.content;
|
|
51328
|
+
const toolCalls = msg.tool_calls;
|
|
51329
|
+
const hasContent = typeof content === "string" && content.trim().length > 0;
|
|
51330
|
+
const hasToolCalls = Array.isArray(toolCalls) && toolCalls.length > 0;
|
|
51331
|
+
const finishReason = choice.finish_reason;
|
|
51332
|
+
if (!hasContent && !hasToolCalls && finishReason === "stop") {
|
|
51333
|
+
return "degraded response: empty turn (no content or tool calls)";
|
|
51334
|
+
}
|
|
51335
|
+
}
|
|
51336
|
+
}
|
|
51322
51337
|
const assistantContent = extractAssistantContent(parsed);
|
|
51323
51338
|
if (!assistantContent) return void 0;
|
|
51324
51339
|
if (DEGRADED_RESPONSE_PATTERNS.some((pattern) => pattern.test(assistantContent))) {
|