deepcode-ai 1.2.28 → 1.2.30

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
@@ -2762,14 +2762,14 @@ var XmlToolCallStreamFilter = class {
2762
2762
  }
2763
2763
  };
2764
2764
  function compactToolDescription(description, schemaMode) {
2765
- const maxLength = schemaMode === "full" ? 240 : schemaMode === "compact" ? 140 : 96;
2765
+ const maxLength = schemaMode === "full" ? 240 : schemaMode === "compact" ? 140 : 120;
2766
2766
  if (description.length <= maxLength) {
2767
2767
  return description;
2768
2768
  }
2769
2769
  return `${description.slice(0, maxLength - 3).trimEnd()}...`;
2770
2770
  }
2771
2771
  function simplifyToolSchema(schema, schemaMode) {
2772
- const normalized2 = sanitizeSchemaNode(schema, schemaMode, 0);
2772
+ const normalized2 = sanitizeSchemaNode(schema, schemaMode);
2773
2773
  if (normalized2 && typeof normalized2 === "object" && !Array.isArray(normalized2)) {
2774
2774
  return normalized2;
2775
2775
  }
@@ -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 a tool and native tool calling is unavailable for this model, emit exactly one XML block in this format:",
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 a tool name from this turn's allowed set.",
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 fallbackCall = extractFallbackToolCall(assistantText, allowedToolNames);
2798
- if (!fallbackCall) {
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: fallbackCall.cleanedText,
2806
- toolCalls: [fallbackCall.call]
2806
+ assistantText: stripFallbackToolEnvelope(assistantText),
2807
+ toolCalls: fallbackCalls
2807
2808
  };
2808
2809
  }
2809
2810
  function truncateToolOutput(output, maxLength = MAX_TOOL_OUTPUT_LENGTH) {
@@ -2818,9 +2819,9 @@ function truncateToolOutput(output, maxLength = MAX_TOOL_OUTPUT_LENGTH) {
2818
2819
 
2819
2820
  ${end}`;
2820
2821
  }
2821
- function sanitizeSchemaNode(value, schemaMode, depth) {
2822
+ function sanitizeSchemaNode(value, schemaMode) {
2822
2823
  if (Array.isArray(value)) {
2823
- return value.map((item) => sanitizeSchemaNode(item, schemaMode, depth + 1)).filter((item) => item !== void 0);
2824
+ return value.map((item) => sanitizeSchemaNode(item, schemaMode)).filter((item) => item !== void 0);
2824
2825
  }
2825
2826
  if (!value || typeof value !== "object") {
2826
2827
  return value;
@@ -2828,10 +2829,10 @@ function sanitizeSchemaNode(value, schemaMode, depth) {
2828
2829
  const input = value;
2829
2830
  const next = {};
2830
2831
  for (const [key, child] of Object.entries(input)) {
2831
- if (shouldDropSchemaKey(key, schemaMode, depth)) {
2832
+ if (shouldDropSchemaKey(key, schemaMode)) {
2832
2833
  continue;
2833
2834
  }
2834
- const normalizedChild = sanitizeSchemaNode(child, schemaMode, depth + 1);
2835
+ const normalizedChild = sanitizeSchemaNode(child, schemaMode);
2835
2836
  if (normalizedChild !== void 0) {
2836
2837
  next[key] = normalizedChild;
2837
2838
  }
@@ -2849,38 +2850,28 @@ function sanitizeSchemaNode(value, schemaMode, depth) {
2849
2850
  }
2850
2851
  return next;
2851
2852
  }
2852
- function shouldDropSchemaKey(key, schemaMode, depth) {
2853
+ function shouldDropSchemaKey(key, schemaMode) {
2853
2854
  if (key === "$schema" || key === "definitions" || key === "$defs") {
2854
2855
  return true;
2855
2856
  }
2856
2857
  if (schemaMode !== "full" && (key === "title" || key === "default" || key === "examples" || key === "example" || key === "deprecated")) {
2857
2858
  return true;
2858
2859
  }
2859
- if (schemaMode === "minimal" && key === "description" && depth > 0) {
2860
- return true;
2861
- }
2862
2860
  return false;
2863
2861
  }
2864
- function extractFallbackToolCall(assistantText, allowedToolNames) {
2865
- const match = assistantText.match(/<tool_call>\s*([\s\S]*?)\s*<\/tool_call>/i);
2866
- if (!match || match.index === void 0) {
2867
- return void 0;
2868
- }
2869
- const payload = parseFallbackToolPayload(match[1] ?? "");
2870
- if (!payload || !allowedToolNames.has(payload.name)) {
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: {
2862
+ function extractFallbackToolCalls(assistantText, allowedToolNames) {
2863
+ const matches = [...assistantText.matchAll(/<tool_call>\s*([\s\S]*?)\s*<\/tool_call>/gi)];
2864
+ const calls = [];
2865
+ for (const match of matches) {
2866
+ const payload = parseFallbackToolPayload(match[1] ?? "");
2867
+ if (!payload || !allowedToolNames.has(payload.name)) continue;
2868
+ calls.push({
2878
2869
  id: createId("toolcall"),
2879
2870
  name: payload.name,
2880
2871
  arguments: payload.arguments
2881
- },
2882
- cleanedText
2883
- };
2872
+ });
2873
+ }
2874
+ return calls;
2884
2875
  }
2885
2876
  function stripFallbackToolEnvelope(assistantText) {
2886
2877
  return collapseFallbackWhitespace(
@@ -11511,7 +11502,7 @@ function parseVersion(version) {
11511
11502
  if (!match) return null;
11512
11503
  return [Number(match[1]), Number(match[2]), Number(match[3])];
11513
11504
  }
11514
- var VERSION = "1.2.28".length > 0 ? "1.2.28" : "0.0.0-dev";
11505
+ var VERSION = "1.2.30".length > 0 ? "1.2.30" : "0.0.0-dev";
11515
11506
  async function updateCommand() {
11516
11507
  writeStdoutLine(`Current version: ${VERSION}`);
11517
11508
  const update = await checkForUpdate(VERSION, { force: true });