@blockrun/clawrouter 0.12.90 → 0.12.92

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
@@ -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,
@@ -51992,13 +51995,8 @@ function normalizeMessagesForThinking(messages) {
51992
51995
  if (msg.role !== "assistant" || msg.reasoning_content !== void 0) {
51993
51996
  return msg;
51994
51997
  }
51995
- const hasOpenAIToolCalls = msg.tool_calls && Array.isArray(msg.tool_calls) && msg.tool_calls.length > 0;
51996
- const hasAnthropicToolUse = Array.isArray(msg.content) && msg.content.some((block) => block?.type === "tool_use");
51997
- if (hasOpenAIToolCalls || hasAnthropicToolUse) {
51998
- hasChanges = true;
51999
- return { ...msg, reasoning_content: "" };
52000
- }
52001
- return msg;
51998
+ hasChanges = true;
51999
+ return { ...msg, reasoning_content: "" };
52002
52000
  });
52003
52001
  return hasChanges ? normalized : messages;
52004
52002
  }
@@ -54229,7 +54227,13 @@ data: [DONE]
54229
54227
  let errPayload;
54230
54228
  try {
54231
54229
  const parsed = JSON.parse(transformedErr);
54232
- errPayload = JSON.stringify(parsed);
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
+ }
54233
54237
  } catch {
54234
54238
  errPayload = JSON.stringify({
54235
54239
  error: { message: rawErrBody, type: "provider_error", status: errStatus }