deepcode-ai 1.2.28 → 1.2.29
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 +18 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2779,10 +2779,11 @@ function buildFallbackToolCallPrompt(allowedToolNames) {
|
|
|
2779
2779
|
return [
|
|
2780
2780
|
"Tool fallback for this model:",
|
|
2781
2781
|
"Prefer native tool calling when the model supports it.",
|
|
2782
|
-
"If you need
|
|
2782
|
+
"If you need one or more tools and native tool calling is unavailable for this model, emit one XML block per tool call, each in this format:",
|
|
2783
2783
|
'<tool_call>{"name":"tool_name","arguments":{"key":"value"}}</tool_call>',
|
|
2784
|
+
"You may emit multiple <tool_call> blocks in a single response to invoke several tools in parallel.",
|
|
2784
2785
|
"Do not wrap the JSON in markdown fences.",
|
|
2785
|
-
"Use only
|
|
2786
|
+
"Use only tool names from this turn's allowed set.",
|
|
2786
2787
|
`Allowed tool names: ${[...allowedToolNames].join(", ")}`,
|
|
2787
2788
|
"If no tool is needed, answer normally with plain text."
|
|
2788
2789
|
].join("\n");
|
|
@@ -2794,16 +2795,16 @@ function applyFallbackToolCallParsing(assistantText, nativeToolCalls, allowedToo
|
|
|
2794
2795
|
toolCalls: nativeToolCalls
|
|
2795
2796
|
};
|
|
2796
2797
|
}
|
|
2797
|
-
const
|
|
2798
|
-
if (
|
|
2798
|
+
const fallbackCalls = extractFallbackToolCalls(assistantText, allowedToolNames);
|
|
2799
|
+
if (fallbackCalls.length === 0) {
|
|
2799
2800
|
return {
|
|
2800
2801
|
assistantText: stripFallbackToolEnvelope(assistantText),
|
|
2801
2802
|
toolCalls: nativeToolCalls
|
|
2802
2803
|
};
|
|
2803
2804
|
}
|
|
2804
2805
|
return {
|
|
2805
|
-
assistantText:
|
|
2806
|
-
toolCalls:
|
|
2806
|
+
assistantText: stripFallbackToolEnvelope(assistantText),
|
|
2807
|
+
toolCalls: fallbackCalls
|
|
2807
2808
|
};
|
|
2808
2809
|
}
|
|
2809
2810
|
function truncateToolOutput(output, maxLength = MAX_TOOL_OUTPUT_LENGTH) {
|
|
@@ -2861,26 +2862,19 @@ function shouldDropSchemaKey(key, schemaMode, depth) {
|
|
|
2861
2862
|
}
|
|
2862
2863
|
return false;
|
|
2863
2864
|
}
|
|
2864
|
-
function
|
|
2865
|
-
const
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
return void 0;
|
|
2872
|
-
}
|
|
2873
|
-
const cleanedText = collapseFallbackWhitespace(
|
|
2874
|
-
`${assistantText.slice(0, match.index)}${assistantText.slice(match.index + match[0].length)}`
|
|
2875
|
-
);
|
|
2876
|
-
return {
|
|
2877
|
-
call: {
|
|
2865
|
+
function extractFallbackToolCalls(assistantText, allowedToolNames) {
|
|
2866
|
+
const matches = [...assistantText.matchAll(/<tool_call>\s*([\s\S]*?)\s*<\/tool_call>/gi)];
|
|
2867
|
+
const calls = [];
|
|
2868
|
+
for (const match of matches) {
|
|
2869
|
+
const payload = parseFallbackToolPayload(match[1] ?? "");
|
|
2870
|
+
if (!payload || !allowedToolNames.has(payload.name)) continue;
|
|
2871
|
+
calls.push({
|
|
2878
2872
|
id: createId("toolcall"),
|
|
2879
2873
|
name: payload.name,
|
|
2880
2874
|
arguments: payload.arguments
|
|
2881
|
-
}
|
|
2882
|
-
|
|
2883
|
-
|
|
2875
|
+
});
|
|
2876
|
+
}
|
|
2877
|
+
return calls;
|
|
2884
2878
|
}
|
|
2885
2879
|
function stripFallbackToolEnvelope(assistantText) {
|
|
2886
2880
|
return collapseFallbackWhitespace(
|
|
@@ -11511,7 +11505,7 @@ function parseVersion(version) {
|
|
|
11511
11505
|
if (!match) return null;
|
|
11512
11506
|
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
11513
11507
|
}
|
|
11514
|
-
var VERSION = "1.2.
|
|
11508
|
+
var VERSION = "1.2.29".length > 0 ? "1.2.29" : "0.0.0-dev";
|
|
11515
11509
|
async function updateCommand() {
|
|
11516
11510
|
writeStdoutLine(`Current version: ${VERSION}`);
|
|
11517
11511
|
const update = await checkForUpdate(VERSION, { force: true });
|