@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/cli.js CHANGED
@@ -2502,7 +2502,12 @@ function normalizeMessagesForThinking(messages) {
2502
2502
  if (!messages || messages.length === 0) return messages;
2503
2503
  let hasChanges = false;
2504
2504
  const normalized = messages.map((msg) => {
2505
- if (msg.role === "assistant" && msg.tool_calls && Array.isArray(msg.tool_calls) && msg.tool_calls.length > 0 && msg.reasoning_content === void 0) {
2505
+ if (msg.role !== "assistant" || msg.reasoning_content !== void 0) {
2506
+ return msg;
2507
+ }
2508
+ const hasOpenAIToolCalls = msg.tool_calls && Array.isArray(msg.tool_calls) && msg.tool_calls.length > 0;
2509
+ const hasAnthropicToolUse = Array.isArray(msg.content) && msg.content.some((block) => block?.type === "tool_use");
2510
+ if (hasOpenAIToolCalls || hasAnthropicToolUse) {
2506
2511
  hasChanges = true;
2507
2512
  return { ...msg, reasoning_content: "" };
2508
2513
  }