jinzd-ai-cli 0.4.252 → 0.4.254
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/{batch-UCAVB77F.js → batch-WRISEJGQ.js} +2 -2
- package/dist/{chunk-TQVR2URD.js → chunk-5CCIFT5B.js} +1 -1
- package/dist/{chunk-HUV7TFOH.js → chunk-6OEZMFMM.js} +1 -1
- package/dist/{chunk-EPL77VAA.js → chunk-EOZROPAY.js} +4 -4
- package/dist/{chunk-QW6M662O.js → chunk-KGJCRE6U.js} +1 -1
- package/dist/{chunk-KTE4BHHI.js → chunk-MBOEMIH2.js} +1 -1
- package/dist/{chunk-4BOT4YNT.js → chunk-OI247DUJ.js} +1 -1
- package/dist/{chunk-O3XSFPYH.js → chunk-PSXIVQ3N.js} +14 -6
- package/dist/{chunk-7P3EP5OO.js → chunk-Q6MD47RH.js} +1 -1
- package/dist/{chunk-JWSMRAVK.js → chunk-QXIKCU5R.js} +1 -1
- package/dist/{chunk-XINRSNNL.js → chunk-SCLXRJKE.js} +4 -4
- package/dist/{chunk-AXNUGP53.js → chunk-TF5XR7NI.js} +2 -2
- package/dist/{chunk-2N3IEEY4.js → chunk-TUPLHKYE.js} +1 -1
- package/dist/{chunk-5GWGXJQN.js → chunk-VCY6NH43.js} +19 -8
- package/dist/{chunk-EEFHKKT2.js → chunk-XBCOYS22.js} +1 -1
- package/dist/{chunk-2QZMITSL.js → chunk-ZRBGH245.js} +5 -4
- package/dist/{ci-LOL5I5DP.js → ci-JINX6RT6.js} +6 -6
- package/dist/{ci-format-TT5IZATX.js → ci-format-ZQX57BPV.js} +2 -2
- package/dist/{constants-R57JYUHW.js → constants-ASRW3Y6O.js} +1 -1
- package/dist/{doctor-cli-ODPYWX4T.js → doctor-cli-CKJ7NEKC.js} +6 -6
- package/dist/electron-server.js +43 -16
- package/dist/{hub-BNUQJOBO.js → hub-LBPFXAXM.js} +1 -1
- package/dist/index.js +118 -114
- package/dist/{persistent-memory-ITDGIW3Z.js → persistent-memory-HJB6XTWD.js} +2 -2
- package/dist/{persistent-memory-US6A7WMA.js → persistent-memory-LKWQ777N.js} +2 -2
- package/dist/{pr-6PR2OO5F.js → pr-JM266VJT.js} +6 -6
- package/dist/{run-tests-IM3GSWBM.js → run-tests-CMCXT3ZW.js} +2 -2
- package/dist/{run-tests-4FSTZ22Q.js → run-tests-DAOPTU2O.js} +2 -2
- package/dist/{server-WZFZEVCQ.js → server-4KFSPCPP.js} +6 -6
- package/dist/{server-ULAI723O.js → server-ADRQ3MFV.js} +23 -13
- package/dist/{task-orchestrator-KWM7J4US.js → task-orchestrator-OH5S26KX.js} +6 -6
- package/dist/{usage-E72O4RHB.js → usage-MKPF3XFL.js} +2 -2
- package/dist/web/client/api.js +41 -0
- package/dist/web/client/app.js +9 -35
- package/package.json +2 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ConfigManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Q6MD47RH.js";
|
|
5
5
|
import "./chunk-5ULLIOVC.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-XBCOYS22.js";
|
|
7
7
|
import {
|
|
8
8
|
atomicWriteFileSync
|
|
9
9
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
evaluateCiGate,
|
|
4
4
|
normalizeCiThresholds
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OI247DUJ.js";
|
|
6
6
|
import {
|
|
7
7
|
buildReviewPrompt,
|
|
8
8
|
buildSecurityReviewPrompt,
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
} from "./chunk-HLWUDRBO.js";
|
|
11
11
|
import {
|
|
12
12
|
ProviderRegistry
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZRBGH245.js";
|
|
14
14
|
import {
|
|
15
15
|
ConfigManager
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-Q6MD47RH.js";
|
|
17
17
|
import {
|
|
18
18
|
VERSION
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-XBCOYS22.js";
|
|
20
20
|
|
|
21
21
|
// src/cli/ci.ts
|
|
22
22
|
import { execFileSync } from "child_process";
|
|
@@ -687,10 +687,10 @@ var ThinkTagFilter = class {
|
|
|
687
687
|
return "";
|
|
688
688
|
}
|
|
689
689
|
};
|
|
690
|
-
function
|
|
690
|
+
function parseToolCallArguments(raw, onWarn) {
|
|
691
691
|
const argStr = raw || "{}";
|
|
692
692
|
try {
|
|
693
|
-
return JSON.parse(argStr);
|
|
693
|
+
return { args: JSON.parse(argStr), status: "ok" };
|
|
694
694
|
} catch {
|
|
695
695
|
const truncated = argStr.trimEnd();
|
|
696
696
|
const lastComma = truncated.lastIndexOf(",");
|
|
@@ -698,13 +698,18 @@ function repairToolCallArguments(raw, onWarn) {
|
|
|
698
698
|
try {
|
|
699
699
|
const repaired = JSON.parse(fixed);
|
|
700
700
|
onWarn?.("Tool call JSON was truncated and auto-repaired. Some parameters may be missing.");
|
|
701
|
-
return repaired;
|
|
701
|
+
return { args: repaired, status: "repaired" };
|
|
702
702
|
} catch {
|
|
703
703
|
onWarn?.("Tool call JSON could not be parsed, using empty arguments.");
|
|
704
|
-
return {};
|
|
704
|
+
return { args: {}, status: "failed" };
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
+
function buildTruncatedArgumentsError(toolName, status, parsedKeys) {
|
|
709
|
+
const lost = status === "failed" ? "The arguments JSON was cut off and could not be parsed at all." : `The arguments JSON was cut off mid-way; only these keys survived: ${parsedKeys.join(", ") || "(none)"}. Any remaining value is incomplete.`;
|
|
710
|
+
const longContentHint = toolName === "write_file" || toolName === "edit_file" ? " For long documents (300+ lines / 3 KB+), do NOT retry write_file \u2014 use `save_last_response`, which streams the document straight to disk without an argument size limit." : "";
|
|
711
|
+
return `[${toolName}] NOT EXECUTED \u2014 the model output hit its length limit while emitting this tool call, so the arguments were truncated. ${lost} Nothing was written or changed. Retry with a smaller payload: split the work into several calls, or shorten the arguments.${longContentHint}`;
|
|
712
|
+
}
|
|
708
713
|
async function consumeToolCallStream(stream, hooks = {}) {
|
|
709
714
|
const textParts = [];
|
|
710
715
|
const accumulators = /* @__PURE__ */ new Map();
|
|
@@ -777,10 +782,12 @@ async function consumeToolCallStream(stream, hooks = {}) {
|
|
|
777
782
|
}
|
|
778
783
|
const toolCalls = [];
|
|
779
784
|
for (const [, acc] of accumulators) {
|
|
785
|
+
const parsed = parseToolCallArguments(acc.arguments, hooks.onWarn);
|
|
780
786
|
toolCalls.push({
|
|
781
787
|
id: acc.id,
|
|
782
788
|
name: acc.name,
|
|
783
|
-
arguments:
|
|
789
|
+
arguments: parsed.args,
|
|
790
|
+
...parsed.status === "ok" ? {} : { argumentsTruncated: parsed.status }
|
|
784
791
|
});
|
|
785
792
|
}
|
|
786
793
|
if (toolCalls.length > 0) {
|
|
@@ -1150,7 +1157,8 @@ export {
|
|
|
1150
1157
|
buildDeferredSaveInstruction,
|
|
1151
1158
|
teeStreamErrorSummary,
|
|
1152
1159
|
ThinkTagFilter,
|
|
1153
|
-
|
|
1160
|
+
parseToolCallArguments,
|
|
1161
|
+
buildTruncatedArgumentsError,
|
|
1154
1162
|
consumeToolCallStream,
|
|
1155
1163
|
accumulateUsage,
|
|
1156
1164
|
buildRoundBudgetHint,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ProviderRegistry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZRBGH245.js";
|
|
5
5
|
import {
|
|
6
6
|
ConfigManager
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-Q6MD47RH.js";
|
|
8
8
|
import {
|
|
9
9
|
getActivePluginAssets,
|
|
10
10
|
getPendingHookTrust,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
listHooks,
|
|
15
15
|
listInstalledPlugins,
|
|
16
16
|
resetStats
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KGJCRE6U.js";
|
|
18
18
|
import {
|
|
19
19
|
getGitRoot
|
|
20
20
|
} from "./chunk-HOSJZMQS.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
MCP_PROJECT_CONFIG_NAME,
|
|
27
27
|
MEMORY_FILE_NAME,
|
|
28
28
|
VERSION
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-XBCOYS22.js";
|
|
30
30
|
|
|
31
31
|
// src/diagnostics/doctor-report.ts
|
|
32
32
|
import { existsSync as existsSync3, statSync as statSync2 } from "fs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
truncateForPersist
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VCY6NH43.js";
|
|
5
5
|
import {
|
|
6
6
|
APP_NAME,
|
|
7
7
|
CONFIG_DIR_NAME,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
MCP_PROTOCOL_VERSION,
|
|
12
12
|
MCP_TOOL_PREFIX,
|
|
13
13
|
VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-XBCOYS22.js";
|
|
15
15
|
import {
|
|
16
16
|
atomicWriteFileSync
|
|
17
17
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
searchPersistentMemories,
|
|
8
8
|
touchMemoryReferences,
|
|
9
9
|
updateMemoryEntry
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6OEZMFMM.js";
|
|
11
11
|
import {
|
|
12
12
|
indexProject
|
|
13
13
|
} from "./chunk-GLSR2NR3.js";
|
|
@@ -23,12 +23,13 @@ import {
|
|
|
23
23
|
runHook,
|
|
24
24
|
runLifecycleHooks,
|
|
25
25
|
runTool
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-KGJCRE6U.js";
|
|
27
27
|
import {
|
|
28
|
+
buildTruncatedArgumentsError,
|
|
28
29
|
getDangerLevel,
|
|
29
30
|
isFileWriteTool,
|
|
30
31
|
runLeanAgentLoop
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-PSXIVQ3N.js";
|
|
32
33
|
import {
|
|
33
34
|
EnvLoader,
|
|
34
35
|
NetworkError,
|
|
@@ -39,14 +40,14 @@ import {
|
|
|
39
40
|
} from "./chunk-4BKXL7SM.js";
|
|
40
41
|
import {
|
|
41
42
|
runTestsTool
|
|
42
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-MBOEMIH2.js";
|
|
43
44
|
import {
|
|
44
45
|
CONFIG_DIR_NAME,
|
|
45
46
|
DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
|
|
46
47
|
SUBAGENT_ALLOWED_TOOLS,
|
|
47
48
|
SUBAGENT_DEFAULT_MAX_ROUNDS,
|
|
48
49
|
SUBAGENT_MAX_ROUNDS_LIMIT
|
|
49
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-XBCOYS22.js";
|
|
50
51
|
import {
|
|
51
52
|
loadChatIndex,
|
|
52
53
|
searchChatMemory
|
|
@@ -2273,6 +2274,15 @@ var ToolExecutor = class {
|
|
|
2273
2274
|
isError: true
|
|
2274
2275
|
};
|
|
2275
2276
|
}
|
|
2277
|
+
if (call.argumentsTruncated) {
|
|
2278
|
+
const message = buildTruncatedArgumentsError(
|
|
2279
|
+
call.name,
|
|
2280
|
+
call.argumentsTruncated,
|
|
2281
|
+
Object.keys(call.arguments)
|
|
2282
|
+
);
|
|
2283
|
+
console.log(theme.warning(` \u26A0 ${call.name}: arguments truncated by output limit \u2014 not executed`));
|
|
2284
|
+
return { callId: call.id, content: message, isError: true };
|
|
2285
|
+
}
|
|
2276
2286
|
const dangerLevel = getDangerLevel(call.name, call.arguments);
|
|
2277
2287
|
let toolCallAlreadyPrinted = false;
|
|
2278
2288
|
runHook(this.hookConfig?.preToolExecution, {
|
|
@@ -2963,9 +2973,10 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
|
|
|
2963
2973
|
if (appendMode) {
|
|
2964
2974
|
appendFileSync(filePath, content, encoding);
|
|
2965
2975
|
} else {
|
|
2966
|
-
atomicWriteFileSync(filePath, content);
|
|
2976
|
+
atomicWriteFileSync(filePath, encoding === "utf-8" || encoding === "utf8" ? content : Buffer.from(content, encoding));
|
|
2967
2977
|
}
|
|
2968
2978
|
const lines = content.split("\n").length;
|
|
2979
|
+
const bytes = Buffer.byteLength(content, encoding);
|
|
2969
2980
|
const mode = appendMode ? "appended" : "written";
|
|
2970
2981
|
void (async () => {
|
|
2971
2982
|
try {
|
|
@@ -2974,7 +2985,7 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
|
|
|
2974
2985
|
} catch {
|
|
2975
2986
|
}
|
|
2976
2987
|
})();
|
|
2977
|
-
return `File ${mode}: ${filePath} (${lines} lines, ${
|
|
2988
|
+
return `File ${mode}: ${filePath} (${lines} lines, ${bytes} bytes)`;
|
|
2978
2989
|
}
|
|
2979
2990
|
};
|
|
2980
2991
|
|
|
@@ -4810,7 +4821,7 @@ Any of these triggers means use save_last_response, NOT write_file:
|
|
|
4810
4821
|
mkdirSync2(dirname4(filePath), { recursive: true });
|
|
4811
4822
|
atomicWriteFileSync(filePath, content);
|
|
4812
4823
|
const lines = content.split("\n").length;
|
|
4813
|
-
return `File saved: ${filePath} (${lines} lines, ${content
|
|
4824
|
+
return `File saved: ${filePath} (${lines} lines, ${Buffer.byteLength(content, "utf-8")} bytes)`;
|
|
4814
4825
|
}
|
|
4815
4826
|
};
|
|
4816
4827
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
detectsHallucinatedFileOp,
|
|
4
|
-
|
|
4
|
+
parseToolCallArguments,
|
|
5
5
|
schemaToJsonSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PSXIVQ3N.js";
|
|
7
7
|
import {
|
|
8
8
|
AuthError,
|
|
9
9
|
ProviderError,
|
|
@@ -1168,7 +1168,7 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1168
1168
|
const reasoningContent = message.reasoning_content;
|
|
1169
1169
|
if (message.tool_calls && message.tool_calls.length > 0) {
|
|
1170
1170
|
const toolCalls = message.tool_calls.map((tc) => {
|
|
1171
|
-
const
|
|
1171
|
+
const parsed = parseToolCallArguments(
|
|
1172
1172
|
tc.function.arguments || "{}",
|
|
1173
1173
|
(m) => process.stderr.write(`[warn] ${m}
|
|
1174
1174
|
`)
|
|
@@ -1176,7 +1176,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1176
1176
|
return {
|
|
1177
1177
|
id: tc.id,
|
|
1178
1178
|
name: tc.function.name,
|
|
1179
|
-
arguments:
|
|
1179
|
+
arguments: parsed.args,
|
|
1180
|
+
...parsed.status === "ok" ? {} : { argumentsTruncated: parsed.status }
|
|
1180
1181
|
};
|
|
1181
1182
|
});
|
|
1182
1183
|
return { toolCalls, usage, reasoningContent };
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
CI_COMMENT_MARKER,
|
|
4
4
|
countSeverity,
|
|
5
5
|
runCi
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-EOZROPAY.js";
|
|
7
|
+
import "./chunk-OI247DUJ.js";
|
|
8
8
|
import "./chunk-HLWUDRBO.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-ZRBGH245.js";
|
|
10
|
+
import "./chunk-Q6MD47RH.js";
|
|
11
|
+
import "./chunk-PSXIVQ3N.js";
|
|
12
12
|
import "./chunk-5ULLIOVC.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-XBCOYS22.js";
|
|
14
14
|
import "./chunk-IW3Q7AE5.js";
|
|
15
15
|
export {
|
|
16
16
|
CI_COMMENT_MARKER,
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
formatDoctorReport,
|
|
4
4
|
runDoctorCli
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-SCLXRJKE.js";
|
|
6
|
+
import "./chunk-ZRBGH245.js";
|
|
7
|
+
import "./chunk-Q6MD47RH.js";
|
|
8
|
+
import "./chunk-KGJCRE6U.js";
|
|
9
|
+
import "./chunk-PSXIVQ3N.js";
|
|
10
10
|
import "./chunk-5ULLIOVC.js";
|
|
11
11
|
import "./chunk-HOSJZMQS.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-XBCOYS22.js";
|
|
13
13
|
import "./chunk-IW3Q7AE5.js";
|
|
14
14
|
export {
|
|
15
15
|
formatDoctorReport,
|
package/dist/electron-server.js
CHANGED
|
@@ -34,14 +34,14 @@ import {
|
|
|
34
34
|
touchMemoryReferences,
|
|
35
35
|
updateMemoryApproval,
|
|
36
36
|
updateMemoryEntry
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-QXIKCU5R.js";
|
|
38
38
|
import {
|
|
39
39
|
redactJson,
|
|
40
40
|
scanString
|
|
41
41
|
} from "./chunk-YVTASHS5.js";
|
|
42
42
|
import {
|
|
43
43
|
runTestsTool
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-TUPLHKYE.js";
|
|
45
45
|
import {
|
|
46
46
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
47
47
|
APP_NAME,
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
SUBAGENT_MAX_ROUNDS_LIMIT,
|
|
74
74
|
VERSION,
|
|
75
75
|
buildUserIdentityPrompt
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-5CCIFT5B.js";
|
|
77
77
|
import {
|
|
78
78
|
hasSemanticIndex,
|
|
79
79
|
semanticSearch
|
|
@@ -2307,10 +2307,10 @@ var ThinkTagFilter = class {
|
|
|
2307
2307
|
return "";
|
|
2308
2308
|
}
|
|
2309
2309
|
};
|
|
2310
|
-
function
|
|
2310
|
+
function parseToolCallArguments(raw, onWarn) {
|
|
2311
2311
|
const argStr = raw || "{}";
|
|
2312
2312
|
try {
|
|
2313
|
-
return JSON.parse(argStr);
|
|
2313
|
+
return { args: JSON.parse(argStr), status: "ok" };
|
|
2314
2314
|
} catch {
|
|
2315
2315
|
const truncated = argStr.trimEnd();
|
|
2316
2316
|
const lastComma = truncated.lastIndexOf(",");
|
|
@@ -2318,13 +2318,18 @@ function repairToolCallArguments(raw, onWarn) {
|
|
|
2318
2318
|
try {
|
|
2319
2319
|
const repaired = JSON.parse(fixed);
|
|
2320
2320
|
onWarn?.("Tool call JSON was truncated and auto-repaired. Some parameters may be missing.");
|
|
2321
|
-
return repaired;
|
|
2321
|
+
return { args: repaired, status: "repaired" };
|
|
2322
2322
|
} catch {
|
|
2323
2323
|
onWarn?.("Tool call JSON could not be parsed, using empty arguments.");
|
|
2324
|
-
return {};
|
|
2324
|
+
return { args: {}, status: "failed" };
|
|
2325
2325
|
}
|
|
2326
2326
|
}
|
|
2327
2327
|
}
|
|
2328
|
+
function buildTruncatedArgumentsError(toolName, status, parsedKeys) {
|
|
2329
|
+
const lost = status === "failed" ? "The arguments JSON was cut off and could not be parsed at all." : `The arguments JSON was cut off mid-way; only these keys survived: ${parsedKeys.join(", ") || "(none)"}. Any remaining value is incomplete.`;
|
|
2330
|
+
const longContentHint = toolName === "write_file" || toolName === "edit_file" ? " For long documents (300+ lines / 3 KB+), do NOT retry write_file \u2014 use `save_last_response`, which streams the document straight to disk without an argument size limit." : "";
|
|
2331
|
+
return `[${toolName}] NOT EXECUTED \u2014 the model output hit its length limit while emitting this tool call, so the arguments were truncated. ${lost} Nothing was written or changed. Retry with a smaller payload: split the work into several calls, or shorten the arguments.${longContentHint}`;
|
|
2332
|
+
}
|
|
2328
2333
|
async function consumeToolCallStream(stream, hooks = {}) {
|
|
2329
2334
|
const textParts = [];
|
|
2330
2335
|
const accumulators = /* @__PURE__ */ new Map();
|
|
@@ -2397,10 +2402,12 @@ async function consumeToolCallStream(stream, hooks = {}) {
|
|
|
2397
2402
|
}
|
|
2398
2403
|
const toolCalls = [];
|
|
2399
2404
|
for (const [, acc] of accumulators) {
|
|
2405
|
+
const parsed = parseToolCallArguments(acc.arguments, hooks.onWarn);
|
|
2400
2406
|
toolCalls.push({
|
|
2401
2407
|
id: acc.id,
|
|
2402
2408
|
name: acc.name,
|
|
2403
|
-
arguments:
|
|
2409
|
+
arguments: parsed.args,
|
|
2410
|
+
...parsed.status === "ok" ? {} : { argumentsTruncated: parsed.status }
|
|
2404
2411
|
});
|
|
2405
2412
|
}
|
|
2406
2413
|
if (toolCalls.length > 0) {
|
|
@@ -2986,7 +2993,7 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
2986
2993
|
const reasoningContent = message.reasoning_content;
|
|
2987
2994
|
if (message.tool_calls && message.tool_calls.length > 0) {
|
|
2988
2995
|
const toolCalls = message.tool_calls.map((tc) => {
|
|
2989
|
-
const
|
|
2996
|
+
const parsed = parseToolCallArguments(
|
|
2990
2997
|
tc.function.arguments || "{}",
|
|
2991
2998
|
(m) => process.stderr.write(`[warn] ${m}
|
|
2992
2999
|
`)
|
|
@@ -2994,7 +3001,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
2994
3001
|
return {
|
|
2995
3002
|
id: tc.id,
|
|
2996
3003
|
name: tc.function.name,
|
|
2997
|
-
arguments:
|
|
3004
|
+
arguments: parsed.args,
|
|
3005
|
+
...parsed.status === "ok" ? {} : { argumentsTruncated: parsed.status }
|
|
2998
3006
|
};
|
|
2999
3007
|
});
|
|
3000
3008
|
return { toolCalls, usage, reasoningContent };
|
|
@@ -7157,6 +7165,15 @@ var ToolExecutor = class {
|
|
|
7157
7165
|
isError: true
|
|
7158
7166
|
};
|
|
7159
7167
|
}
|
|
7168
|
+
if (call.argumentsTruncated) {
|
|
7169
|
+
const message = buildTruncatedArgumentsError(
|
|
7170
|
+
call.name,
|
|
7171
|
+
call.argumentsTruncated,
|
|
7172
|
+
Object.keys(call.arguments)
|
|
7173
|
+
);
|
|
7174
|
+
console.log(theme.warning(` \u26A0 ${call.name}: arguments truncated by output limit \u2014 not executed`));
|
|
7175
|
+
return { callId: call.id, content: message, isError: true };
|
|
7176
|
+
}
|
|
7160
7177
|
const dangerLevel = getDangerLevel(call.name, call.arguments);
|
|
7161
7178
|
let toolCallAlreadyPrinted = false;
|
|
7162
7179
|
runHook(this.hookConfig?.preToolExecution, {
|
|
@@ -7847,9 +7864,10 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
|
|
|
7847
7864
|
if (appendMode) {
|
|
7848
7865
|
appendFileSync(filePath, content, encoding);
|
|
7849
7866
|
} else {
|
|
7850
|
-
atomicWriteFileSync(filePath, content);
|
|
7867
|
+
atomicWriteFileSync(filePath, encoding === "utf-8" || encoding === "utf8" ? content : Buffer.from(content, encoding));
|
|
7851
7868
|
}
|
|
7852
7869
|
const lines = content.split("\n").length;
|
|
7870
|
+
const bytes = Buffer.byteLength(content, encoding);
|
|
7853
7871
|
const mode = appendMode ? "appended" : "written";
|
|
7854
7872
|
void (async () => {
|
|
7855
7873
|
try {
|
|
@@ -7858,7 +7876,7 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
|
|
|
7858
7876
|
} catch {
|
|
7859
7877
|
}
|
|
7860
7878
|
})();
|
|
7861
|
-
return `File ${mode}: ${filePath} (${lines} lines, ${
|
|
7879
|
+
return `File ${mode}: ${filePath} (${lines} lines, ${bytes} bytes)`;
|
|
7862
7880
|
}
|
|
7863
7881
|
};
|
|
7864
7882
|
|
|
@@ -9694,7 +9712,7 @@ Any of these triggers means use save_last_response, NOT write_file:
|
|
|
9694
9712
|
mkdirSync7(dirname6(filePath), { recursive: true });
|
|
9695
9713
|
atomicWriteFileSync(filePath, content);
|
|
9696
9714
|
const lines = content.split("\n").length;
|
|
9697
|
-
return `File saved: ${filePath} (${lines} lines, ${content
|
|
9715
|
+
return `File saved: ${filePath} (${lines} lines, ${Buffer.byteLength(content, "utf-8")} bytes)`;
|
|
9698
9716
|
}
|
|
9699
9717
|
};
|
|
9700
9718
|
|
|
@@ -13137,6 +13155,15 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
|
|
|
13137
13155
|
if (!tool) {
|
|
13138
13156
|
return { callId: call.id, content: `Unknown tool: ${call.name}`, isError: true };
|
|
13139
13157
|
}
|
|
13158
|
+
if (call.argumentsTruncated) {
|
|
13159
|
+
const message = buildTruncatedArgumentsError(
|
|
13160
|
+
call.name,
|
|
13161
|
+
call.argumentsTruncated,
|
|
13162
|
+
Object.keys(call.arguments)
|
|
13163
|
+
);
|
|
13164
|
+
this.send({ type: "info", message: `\u26A0 ${call.name}: arguments truncated by output limit \u2014 not executed` });
|
|
13165
|
+
return { callId: call.id, content: message, isError: true };
|
|
13166
|
+
}
|
|
13140
13167
|
const dangerLevel = getDangerLevel(call.name, call.arguments);
|
|
13141
13168
|
let toolCallStarted = false;
|
|
13142
13169
|
runHook(this.hookConfig?.preToolExecution, {
|
|
@@ -15178,7 +15205,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
|
|
|
15178
15205
|
Cost: ${formatCost(cost)}` : "";
|
|
15179
15206
|
let memoryLine = "";
|
|
15180
15207
|
try {
|
|
15181
|
-
const { countPendingMemories } = await import("./persistent-memory-
|
|
15208
|
+
const { countPendingMemories } = await import("./persistent-memory-LKWQ777N.js");
|
|
15182
15209
|
const pending = countPendingMemories(ctx.config.getConfigDir());
|
|
15183
15210
|
if (pending > 0) memoryLine = `
|
|
15184
15211
|
Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
|
|
@@ -15987,7 +16014,7 @@ async function handleSecurityReview(args, ctx) {
|
|
|
15987
16014
|
async function handleTest(args, ctx) {
|
|
15988
16015
|
ctx.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
15989
16016
|
try {
|
|
15990
|
-
const { executeTests } = await import("./run-tests-
|
|
16017
|
+
const { executeTests } = await import("./run-tests-DAOPTU2O.js");
|
|
15991
16018
|
const argStr = args.join(" ").trim();
|
|
15992
16019
|
let testArgs = {};
|
|
15993
16020
|
if (argStr) {
|
|
@@ -16251,7 +16278,7 @@ async function handleMemory(args, ctx) {
|
|
|
16251
16278
|
ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
|
|
16252
16279
|
} else if (sub === "export") {
|
|
16253
16280
|
if (args[1] === "md") {
|
|
16254
|
-
const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-
|
|
16281
|
+
const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-LKWQ777N.js");
|
|
16255
16282
|
ctx.send({
|
|
16256
16283
|
type: "export_data",
|
|
16257
16284
|
format: "md",
|
|
@@ -154,7 +154,7 @@ ${content}`);
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
async function runTaskMode(config, providers, configManager, topic) {
|
|
157
|
-
const { TaskOrchestrator } = await import("./task-orchestrator-
|
|
157
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-OH5S26KX.js");
|
|
158
158
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
159
159
|
let interrupted = false;
|
|
160
160
|
const onSigint = () => {
|