deepcode-ai 1.2.6 → 1.2.7
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 +31 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
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.
|
|
28620
|
+
var VERSION = "1.2.7".length > 0 ? "1.2.7" : "0.0.0-dev";
|
|
28593
28621
|
var updateCommand = {
|
|
28594
28622
|
name: "update",
|
|
28595
28623
|
description: "Check published DeepCode versions",
|