@blockrun/clawrouter 0.8.15 → 0.8.16

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
@@ -2641,7 +2641,12 @@ function normalizeMessagesForThinking(messages) {
2641
2641
  if (!messages || messages.length === 0) return messages;
2642
2642
  let hasChanges = false;
2643
2643
  const normalized = messages.map((msg) => {
2644
- if (msg.role === "assistant" && msg.tool_calls && Array.isArray(msg.tool_calls) && msg.tool_calls.length > 0 && msg.reasoning_content === void 0) {
2644
+ if (msg.role !== "assistant" || msg.reasoning_content !== void 0) {
2645
+ return msg;
2646
+ }
2647
+ const hasOpenAIToolCalls = msg.tool_calls && Array.isArray(msg.tool_calls) && msg.tool_calls.length > 0;
2648
+ const hasAnthropicToolUse = Array.isArray(msg.content) && msg.content.some((block) => block?.type === "tool_use");
2649
+ if (hasOpenAIToolCalls || hasAnthropicToolUse) {
2645
2650
  hasChanges = true;
2646
2651
  return { ...msg, reasoning_content: "" };
2647
2652
  }