deepcode-ai 1.2.6 → 1.2.8

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
@@ -3865,7 +3865,9 @@ ${assistantText}` : assistantText;
3865
3865
  for (const name of this.getRevealedTools(session)) {
3866
3866
  if (this.tools.get(name)) allowedToolNames.add(name);
3867
3867
  }
3868
- while (iterations < maxIterations) {
3868
+ let consecutiveErrorKey = "";
3869
+ let consecutiveErrorCount = 0;
3870
+ toolLoop: while (iterations < maxIterations) {
3869
3871
  iterations += 1;
3870
3872
  options.onIteration?.(iterations, maxIterations);
3871
3873
  this.enforceBudget(session.id);
@@ -3964,6 +3966,25 @@ ${assistantText}` : assistantText;
3964
3966
  content: truncateToolOutput(result.output),
3965
3967
  toolCallId: call.id
3966
3968
  });
3969
+ if (!result.ok) {
3970
+ const key = `${call.name}:${result.errorMessage ?? result.output}`;
3971
+ if (key === consecutiveErrorKey) {
3972
+ consecutiveErrorCount++;
3973
+ } else {
3974
+ consecutiveErrorKey = key;
3975
+ consecutiveErrorCount = 1;
3976
+ }
3977
+ if (consecutiveErrorCount >= 3) {
3978
+ const abortMsg = `
3979
+ [${call.name} falhou com o mesmo erro ${consecutiveErrorCount} vezes seguidas. Abortando para evitar loop. Tente uma abordagem diferente.]`;
3980
+ finalText += abortMsg;
3981
+ options.onChunk?.(abortMsg);
3982
+ break toolLoop;
3983
+ }
3984
+ } else {
3985
+ consecutiveErrorKey = "";
3986
+ consecutiveErrorCount = 0;
3987
+ }
3967
3988
  }
3968
3989
  }
3969
3990
  return finalText;
@@ -4013,9 +4034,16 @@ ${assistantText}` : assistantText;
4013
4034
  }
4014
4035
  const parsed = tool.parameters.safeParse(call.arguments);
4015
4036
  if (!parsed.success) {
4037
+ let hint = "";
4038
+ if (call.name === "write_file") {
4039
+ const args = call.arguments;
4040
+ if (!args?.path || !args?.content) {
4041
+ hint = " Your output was likely truncated before the tool call completed. Use multiple edit_file calls to apply changes in smaller chunks instead of rewriting the whole file.";
4042
+ }
4043
+ }
4016
4044
  return {
4017
4045
  ok: false,
4018
- output: `Error: invalid arguments for ${call.name}: ${parsed.error.message}`,
4046
+ output: `Error: invalid arguments for ${call.name}: ${parsed.error.message}${hint}`,
4019
4047
  errorMessage: `Invalid arguments for ${call.name}: ${parsed.error.message}`
4020
4048
  };
4021
4049
  }
@@ -28589,7 +28617,7 @@ function parseVersion2(version) {
28589
28617
  if (!match) return null;
28590
28618
  return [Number(match[1]), Number(match[2]), Number(match[3])];
28591
28619
  }
28592
- var VERSION = "1.2.6".length > 0 ? "1.2.6" : "0.0.0-dev";
28620
+ var VERSION = "1.2.8".length > 0 ? "1.2.8" : "0.0.0-dev";
28593
28621
  var updateCommand = {
28594
28622
  name: "update",
28595
28623
  description: "Check published DeepCode versions",
@@ -30194,7 +30222,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30194
30222
  "idle"
30195
30223
  /* Idle */
30196
30224
  );
30197
- const [compactMode, setCompactMode] = useState29(false);
30225
+ const [compactMode, setCompactMode] = useState29(true);
30198
30226
  const [shellModeActive, setShellModeActive] = useState29(false);
30199
30227
  const [showEscapePrompt, setShowEscapePrompt] = useState29(false);
30200
30228
  const [messageQueue, setMessageQueue] = useState29([]);
@@ -30239,6 +30267,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30239
30267
  const taskStreamsBufferRef = useRef17({});
30240
30268
  const liveToolCallsBufferRef = useRef17([]);
30241
30269
  const subagentChunkBufferRef = useRef17(/* @__PURE__ */ new Map());
30270
+ const subagentToolBufferRef = useRef17([]);
30242
30271
  const drainingQueueRef = useRef17(false);
30243
30272
  const messageQueueRef = useRef17([]);
30244
30273
  const sessionShellAllowlistRef = useRef17(/* @__PURE__ */ new Set());
@@ -30544,14 +30573,20 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30544
30573
  setLiveToolCalls((prev) => activities.reduce(reduceToolActivity, prev));
30545
30574
  }
30546
30575
  const subagentChunks = subagentChunkBufferRef.current;
30547
- if (subagentChunks.size > 0) {
30576
+ const subagentTools = subagentToolBufferRef.current;
30577
+ if (subagentChunks.size > 0 || subagentTools.length > 0) {
30548
30578
  subagentChunkBufferRef.current = /* @__PURE__ */ new Map();
30579
+ subagentToolBufferRef.current = [];
30549
30580
  setSubagentMap((prev) => {
30550
30581
  const next = new Map(prev);
30551
30582
  for (const [taskId, output] of subagentChunks) {
30552
30583
  const entry = next.get(taskId);
30553
30584
  if (entry) next.set(taskId, { ...entry, currentOutput: output });
30554
30585
  }
30586
+ for (const { taskId, toolName, active } of subagentTools) {
30587
+ const entry = next.get(taskId);
30588
+ if (entry) next.set(taskId, { ...entry, currentTool: active ? toolName : void 0 });
30589
+ }
30555
30590
  return next;
30556
30591
  });
30557
30592
  }
@@ -30610,7 +30645,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30610
30645
  runtimeRef.current = runtime;
30611
30646
  sessionRef.current = session;
30612
30647
  configAdapterRef.current = new DeepCodeConfigAdapter(cwd);
30613
- setCompactMode(runtime.config.tui.compactMode);
30648
+ setCompactMode(runtime.config.tui.compactMode ?? true);
30614
30649
  const savedTheme = readSavedTheme(cwd) ?? runtime.config.tui.theme;
30615
30650
  themeManager.setActiveTheme(savedTheme);
30616
30651
  setThemeName(themeManager.getActiveTheme().name);
@@ -30700,13 +30735,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30700
30735
  );
30701
30736
  unsubscribers.push(
30702
30737
  runtime.events.on("subagent:tool", ({ taskId, toolName, active }) => {
30703
- setSubagentMap((prev) => {
30704
- const entry = prev.get(taskId);
30705
- if (!entry) return prev;
30706
- const next = new Map(prev);
30707
- next.set(taskId, { ...entry, currentTool: active ? toolName : void 0 });
30708
- return next;
30709
- });
30738
+ subagentToolBufferRef.current.push({ taskId, toolName, active });
30710
30739
  })
30711
30740
  );
30712
30741
  unsubscribers.push(
@@ -31535,6 +31564,10 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
31535
31564
  setActiveDialog("provider");
31536
31565
  return;
31537
31566
  }
31567
+ if (key.ctrl && input === "o") {
31568
+ setCompactMode((prev) => !prev);
31569
+ return;
31570
+ }
31538
31571
  if (approvalQueue.length > 0) {
31539
31572
  const pressed = input.toLowerCase();
31540
31573
  const enterArmed = approvalPromptVisibleAtRef.current !== null && Date.now() - approvalPromptVisibleAtRef.current >= APPROVAL_ENTER_ARM_DELAY_MS;