@blockrun/clawrouter 0.12.247 → 0.12.248
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 +11 -4
- package/dist/index.js +11 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -89132,6 +89132,9 @@ function stripThinkingTokens(content) {
|
|
|
89132
89132
|
cleaned = cleaned.replace(THINKING_TAG_RE, "");
|
|
89133
89133
|
return cleaned;
|
|
89134
89134
|
}
|
|
89135
|
+
function forwardToolCallProse() {
|
|
89136
|
+
return process.env.CLAWROUTER_TOOL_CALL_PROSE?.trim().toLowerCase() !== "off";
|
|
89137
|
+
}
|
|
89135
89138
|
function buildModelPricing() {
|
|
89136
89139
|
const map = /* @__PURE__ */ new Map();
|
|
89137
89140
|
for (const m of BLOCKRUN_MODELS) {
|
|
@@ -92344,13 +92347,16 @@ data: [DONE]
|
|
|
92344
92347
|
const endsWithToolCalls = choice.finish_reason === "tool_calls";
|
|
92345
92348
|
let toolCalls = choice.message?.tool_calls ?? choice.delta?.tool_calls;
|
|
92346
92349
|
const rawContent = choice.message?.content ?? choice.delta?.content ?? "";
|
|
92350
|
+
let proseContent = rawContent;
|
|
92347
92351
|
if (!endsWithToolCalls && (!toolCalls || toolCalls.length === 0) && rawContent) {
|
|
92348
92352
|
const extracted = extractTextualToolCalls(rawContent, { tools: requestTools });
|
|
92349
92353
|
if (extracted.toolCalls.length > 0) {
|
|
92350
92354
|
toolCalls = extracted.toolCalls;
|
|
92355
|
+
proseContent = extracted.cleanedContent;
|
|
92351
92356
|
}
|
|
92352
92357
|
}
|
|
92353
|
-
const
|
|
92358
|
+
const suppressProse = (endsWithToolCalls || toolCalls && toolCalls.length > 0) && !forwardToolCallProse();
|
|
92359
|
+
const content = suppressProse ? "" : stripThinkingTokens(proseContent);
|
|
92354
92360
|
const role = choice.message?.role ?? choice.delta?.role ?? "assistant";
|
|
92355
92361
|
const index2 = choice.index ?? 0;
|
|
92356
92362
|
if (content) {
|
|
@@ -92552,8 +92558,9 @@ data: [DONE]
|
|
|
92552
92558
|
const message = choice.message;
|
|
92553
92559
|
if (!message || typeof message.content !== "string") continue;
|
|
92554
92560
|
if (choice.finish_reason === "tool_calls" || Array.isArray(message.tool_calls) && message.tool_calls.length > 0) {
|
|
92555
|
-
|
|
92556
|
-
|
|
92561
|
+
const next = forwardToolCallProse() ? stripThinkingTokens(message.content) : "";
|
|
92562
|
+
if (message.content !== next) {
|
|
92563
|
+
message.content = next;
|
|
92557
92564
|
changed = true;
|
|
92558
92565
|
}
|
|
92559
92566
|
continue;
|
|
@@ -92561,7 +92568,7 @@ data: [DONE]
|
|
|
92561
92568
|
const extracted = extractTextualToolCalls(message.content, { tools: requestTools });
|
|
92562
92569
|
if (extracted.toolCalls.length > 0) {
|
|
92563
92570
|
message.tool_calls = extracted.toolCalls;
|
|
92564
|
-
message.content = "";
|
|
92571
|
+
message.content = forwardToolCallProse() ? stripThinkingTokens(extracted.cleanedContent) : "";
|
|
92565
92572
|
choice.finish_reason = "tool_calls";
|
|
92566
92573
|
changed = true;
|
|
92567
92574
|
continue;
|
package/dist/index.js
CHANGED
|
@@ -88952,6 +88952,9 @@ function stripThinkingTokens(content) {
|
|
|
88952
88952
|
cleaned = cleaned.replace(THINKING_TAG_RE, "");
|
|
88953
88953
|
return cleaned;
|
|
88954
88954
|
}
|
|
88955
|
+
function forwardToolCallProse() {
|
|
88956
|
+
return process.env.CLAWROUTER_TOOL_CALL_PROSE?.trim().toLowerCase() !== "off";
|
|
88957
|
+
}
|
|
88955
88958
|
function buildModelPricing() {
|
|
88956
88959
|
const map = /* @__PURE__ */ new Map();
|
|
88957
88960
|
for (const m of BLOCKRUN_MODELS) {
|
|
@@ -92164,13 +92167,16 @@ data: [DONE]
|
|
|
92164
92167
|
const endsWithToolCalls = choice.finish_reason === "tool_calls";
|
|
92165
92168
|
let toolCalls = choice.message?.tool_calls ?? choice.delta?.tool_calls;
|
|
92166
92169
|
const rawContent = choice.message?.content ?? choice.delta?.content ?? "";
|
|
92170
|
+
let proseContent = rawContent;
|
|
92167
92171
|
if (!endsWithToolCalls && (!toolCalls || toolCalls.length === 0) && rawContent) {
|
|
92168
92172
|
const extracted = extractTextualToolCalls(rawContent, { tools: requestTools });
|
|
92169
92173
|
if (extracted.toolCalls.length > 0) {
|
|
92170
92174
|
toolCalls = extracted.toolCalls;
|
|
92175
|
+
proseContent = extracted.cleanedContent;
|
|
92171
92176
|
}
|
|
92172
92177
|
}
|
|
92173
|
-
const
|
|
92178
|
+
const suppressProse = (endsWithToolCalls || toolCalls && toolCalls.length > 0) && !forwardToolCallProse();
|
|
92179
|
+
const content = suppressProse ? "" : stripThinkingTokens(proseContent);
|
|
92174
92180
|
const role = choice.message?.role ?? choice.delta?.role ?? "assistant";
|
|
92175
92181
|
const index2 = choice.index ?? 0;
|
|
92176
92182
|
if (content) {
|
|
@@ -92372,8 +92378,9 @@ data: [DONE]
|
|
|
92372
92378
|
const message = choice.message;
|
|
92373
92379
|
if (!message || typeof message.content !== "string") continue;
|
|
92374
92380
|
if (choice.finish_reason === "tool_calls" || Array.isArray(message.tool_calls) && message.tool_calls.length > 0) {
|
|
92375
|
-
|
|
92376
|
-
|
|
92381
|
+
const next = forwardToolCallProse() ? stripThinkingTokens(message.content) : "";
|
|
92382
|
+
if (message.content !== next) {
|
|
92383
|
+
message.content = next;
|
|
92377
92384
|
changed = true;
|
|
92378
92385
|
}
|
|
92379
92386
|
continue;
|
|
@@ -92381,7 +92388,7 @@ data: [DONE]
|
|
|
92381
92388
|
const extracted = extractTextualToolCalls(message.content, { tools: requestTools });
|
|
92382
92389
|
if (extracted.toolCalls.length > 0) {
|
|
92383
92390
|
message.tool_calls = extracted.toolCalls;
|
|
92384
|
-
message.content = "";
|
|
92391
|
+
message.content = forwardToolCallProse() ? stripThinkingTokens(extracted.cleanedContent) : "";
|
|
92385
92392
|
choice.finish_reason = "tool_calls";
|
|
92386
92393
|
changed = true;
|
|
92387
92394
|
continue;
|
package/package.json
CHANGED