@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/index.js CHANGED
@@ -51839,6 +51839,21 @@ function detectDegradedSuccessResponse(body) {
51839
51839
  if (errorText && PROVIDER_ERROR_PATTERNS.some((pattern) => pattern.test(errorText))) {
51840
51840
  return `degraded response: ${errorText.slice(0, 120)}`;
51841
51841
  }
51842
+ const choices = parsed.choices;
51843
+ if (Array.isArray(choices) && choices.length > 0) {
51844
+ const choice = choices[0];
51845
+ const msg = choice.message ?? choice.delta;
51846
+ if (msg) {
51847
+ const content = msg.content;
51848
+ const toolCalls = msg.tool_calls;
51849
+ const hasContent = typeof content === "string" && content.trim().length > 0;
51850
+ const hasToolCalls = Array.isArray(toolCalls) && toolCalls.length > 0;
51851
+ const finishReason = choice.finish_reason;
51852
+ if (!hasContent && !hasToolCalls && finishReason === "stop") {
51853
+ return "degraded response: empty turn (no content or tool calls)";
51854
+ }
51855
+ }
51856
+ }
51842
51857
  const assistantContent = extractAssistantContent(parsed);
51843
51858
  if (!assistantContent) return void 0;
51844
51859
  if (DEGRADED_RESPONSE_PATTERNS.some((pattern) => pattern.test(assistantContent))) {