jinzd-ai-cli 0.4.123 → 0.4.125
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-DPMBOGTO.js → batch-TCWNELYW.js} +2 -2
- package/dist/{chunk-PADJZBKH.js → chunk-4XI7RRIW.js} +1 -1
- package/dist/{chunk-AE6AICKJ.js → chunk-5242JF4Q.js} +1 -1
- package/dist/{chunk-HEYZ5MOY.js → chunk-5ZHTBFZ4.js} +20 -24
- package/dist/{chunk-TFCJJ5CP.js → chunk-6XPEB6PR.js} +3 -3
- package/dist/{chunk-VOJUSKA6.js → chunk-BMXOYPFZ.js} +1 -1
- package/dist/{chunk-NQRQJYGV.js → chunk-GMBLOBW7.js} +1 -1
- package/dist/{chunk-4EOQ52A4.js → chunk-IP6IPSZJ.js} +1 -1
- package/dist/{chunk-WTZXHT4E.js → chunk-OC3QPVR4.js} +2 -2
- package/dist/{chunk-W6FXW2VB.js → chunk-ZL5Q2HP4.js} +1 -1
- package/dist/{constants-NXZEOTUT.js → constants-QBA3BYQM.js} +1 -1
- package/dist/{doctor-cli-OG4WKPJV.js → doctor-cli-3PDBXO2M.js} +5 -5
- package/dist/electron-server.js +21 -25
- package/dist/{hub-LNJ7UIT5.js → hub-RH34TBP2.js} +1 -1
- package/dist/index.js +41 -32
- package/dist/{run-tests-YDXGZ57P.js → run-tests-27C4WSR6.js} +2 -2
- package/dist/{run-tests-KK4QP56Y.js → run-tests-VX33IWWD.js} +1 -1
- package/dist/{server-ZPEHPZ5I.js → server-4PNBZPHM.js} +8 -8
- package/dist/{server-HQARN5HJ.js → server-KNAD5HBQ.js} +4 -4
- package/dist/{task-orchestrator-FBW2AGZJ.js → task-orchestrator-IXBSUOVM.js} +4 -4
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ConfigManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BMXOYPFZ.js";
|
|
5
5
|
import "./chunk-2ZD3YTVM.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-GMBLOBW7.js";
|
|
7
7
|
import "./chunk-PDX44BCA.js";
|
|
8
8
|
|
|
9
9
|
// src/cli/batch.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
schemaToJsonSchema
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4XI7RRIW.js";
|
|
5
5
|
import {
|
|
6
6
|
AuthError,
|
|
7
7
|
ProviderError,
|
|
@@ -1121,25 +1121,6 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1121
1121
|
const usage = toUsage(response.usage);
|
|
1122
1122
|
const contentStr = typeof message.content === "string" ? message.content : "";
|
|
1123
1123
|
const hasToolCalls = !!(message.tool_calls && message.tool_calls.length > 0);
|
|
1124
|
-
if (!hasToolCalls && contentStr.trim() === "") {
|
|
1125
|
-
const providerId = this.info.id;
|
|
1126
|
-
if (finishReason === "length") {
|
|
1127
|
-
process.stderr.write(
|
|
1128
|
-
`[${providerId}] \u26A0 Empty response with finish_reason='length' \u2014 output/context limit reached. Try /compact, raise maxTokens, or switch to a larger-context model.
|
|
1129
|
-
`
|
|
1130
|
-
);
|
|
1131
|
-
} else if (finishReason === "content_filter") {
|
|
1132
|
-
process.stderr.write(
|
|
1133
|
-
`[${providerId}] \u26A0 Empty response with finish_reason='content_filter' \u2014 content was blocked.
|
|
1134
|
-
`
|
|
1135
|
-
);
|
|
1136
|
-
} else {
|
|
1137
|
-
process.stderr.write(
|
|
1138
|
-
`[${providerId}] \u26A0 Empty response (finish_reason=${finishReason ?? "unknown"}). Model produced no text and no tool calls. Context window may be exhausted.
|
|
1139
|
-
`
|
|
1140
|
-
);
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
1124
|
const reasoningContent = message.reasoning_content;
|
|
1144
1125
|
if (message.tool_calls && message.tool_calls.length > 0) {
|
|
1145
1126
|
const toolCalls = message.tool_calls.map((tc) => {
|
|
@@ -1173,7 +1154,12 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1173
1154
|
});
|
|
1174
1155
|
return { toolCalls, usage, reasoningContent };
|
|
1175
1156
|
}
|
|
1176
|
-
return {
|
|
1157
|
+
return {
|
|
1158
|
+
content: message.content ?? "",
|
|
1159
|
+
usage,
|
|
1160
|
+
...reasoningContent ? { reasoningContent } : {},
|
|
1161
|
+
...!hasToolCalls && (finishReason ?? "") ? { finishReason } : {}
|
|
1162
|
+
};
|
|
1177
1163
|
} catch (err) {
|
|
1178
1164
|
throw this.wrapError(err);
|
|
1179
1165
|
}
|
|
@@ -1196,7 +1182,13 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1196
1182
|
yield { type: "text_delta", delta: result.content };
|
|
1197
1183
|
}
|
|
1198
1184
|
const rc = "reasoningContent" in result ? result.reasoningContent : void 0;
|
|
1199
|
-
|
|
1185
|
+
const fr = "finishReason" in result ? result.finishReason : void 0;
|
|
1186
|
+
yield {
|
|
1187
|
+
type: "done",
|
|
1188
|
+
usage: result.usage,
|
|
1189
|
+
...rc ? { reasoningContent: rc } : {},
|
|
1190
|
+
...fr ? { finishReason: fr } : {}
|
|
1191
|
+
};
|
|
1200
1192
|
return;
|
|
1201
1193
|
}
|
|
1202
1194
|
const openaiTools = tools.map((t) => ({
|
|
@@ -1238,8 +1230,10 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1238
1230
|
let toolCallsEnded = false;
|
|
1239
1231
|
let thinkingStarted = false;
|
|
1240
1232
|
let reasoningAccumulator = "";
|
|
1233
|
+
let lastFinishReason;
|
|
1241
1234
|
for await (const chunk of stream) {
|
|
1242
1235
|
const choice = chunk.choices[0];
|
|
1236
|
+
if (choice?.finish_reason) lastFinishReason = choice.finish_reason;
|
|
1243
1237
|
if (!choice && chunk.usage) {
|
|
1244
1238
|
if (thinkingStarted) {
|
|
1245
1239
|
yield { type: "thinking_end" };
|
|
@@ -1254,7 +1248,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1254
1248
|
yield {
|
|
1255
1249
|
type: "done",
|
|
1256
1250
|
usage: toUsage(chunk.usage),
|
|
1257
|
-
...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {}
|
|
1251
|
+
...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {},
|
|
1252
|
+
...lastFinishReason && lastFinishReason !== "stop" ? { finishReason: lastFinishReason } : {}
|
|
1258
1253
|
};
|
|
1259
1254
|
continue;
|
|
1260
1255
|
}
|
|
@@ -1310,7 +1305,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1310
1305
|
}
|
|
1311
1306
|
yield {
|
|
1312
1307
|
type: "done",
|
|
1313
|
-
...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {}
|
|
1308
|
+
...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {},
|
|
1309
|
+
...lastFinishReason && lastFinishReason !== "stop" ? { finishReason: lastFinishReason } : {}
|
|
1314
1310
|
};
|
|
1315
1311
|
} catch (err) {
|
|
1316
1312
|
if (err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError")) {
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
} from "./chunk-3BICTI5M.js";
|
|
6
6
|
import {
|
|
7
7
|
runTestsTool
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IP6IPSZJ.js";
|
|
9
9
|
import {
|
|
10
10
|
getDangerLevel,
|
|
11
11
|
isFileWriteTool,
|
|
12
12
|
runTool
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4XI7RRIW.js";
|
|
14
14
|
import {
|
|
15
15
|
EnvLoader,
|
|
16
16
|
NetworkError,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
SUBAGENT_ALLOWED_TOOLS,
|
|
24
24
|
SUBAGENT_DEFAULT_MAX_ROUNDS,
|
|
25
25
|
SUBAGENT_MAX_ROUNDS_LIMIT
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-GMBLOBW7.js";
|
|
27
27
|
import {
|
|
28
28
|
fileCheckpoints
|
|
29
29
|
} from "./chunk-4BKXL7SM.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
truncateForPersist
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6XPEB6PR.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-GMBLOBW7.js";
|
|
15
15
|
import {
|
|
16
16
|
redactJson
|
|
17
17
|
} from "./chunk-7ZJN4KLV.js";
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getConfigDirUsage,
|
|
4
4
|
listRecentCrashes
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZL5Q2HP4.js";
|
|
6
6
|
import {
|
|
7
7
|
ProviderRegistry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5ZHTBFZ4.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigManager
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-BMXOYPFZ.js";
|
|
12
12
|
import {
|
|
13
13
|
getStatsSnapshot,
|
|
14
14
|
getTopFailingTools,
|
|
15
15
|
getTopUsedTools,
|
|
16
16
|
resetStats
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4XI7RRIW.js";
|
|
18
18
|
import "./chunk-2ZD3YTVM.js";
|
|
19
19
|
import {
|
|
20
20
|
DEV_STATE_FILE_NAME,
|
|
21
21
|
MEMORY_FILE_NAME,
|
|
22
22
|
VERSION
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-GMBLOBW7.js";
|
|
24
24
|
import "./chunk-PDX44BCA.js";
|
|
25
25
|
|
|
26
26
|
// src/diagnostics/doctor-cli.ts
|
package/dist/electron-server.js
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
VERSION,
|
|
37
37
|
buildUserIdentityPrompt,
|
|
38
38
|
runTestsTool
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-5242JF4Q.js";
|
|
40
40
|
import {
|
|
41
41
|
hasSemanticIndex,
|
|
42
42
|
semanticSearch
|
|
@@ -1667,25 +1667,6 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1667
1667
|
const usage = toUsage(response.usage);
|
|
1668
1668
|
const contentStr = typeof message.content === "string" ? message.content : "";
|
|
1669
1669
|
const hasToolCalls = !!(message.tool_calls && message.tool_calls.length > 0);
|
|
1670
|
-
if (!hasToolCalls && contentStr.trim() === "") {
|
|
1671
|
-
const providerId = this.info.id;
|
|
1672
|
-
if (finishReason === "length") {
|
|
1673
|
-
process.stderr.write(
|
|
1674
|
-
`[${providerId}] \u26A0 Empty response with finish_reason='length' \u2014 output/context limit reached. Try /compact, raise maxTokens, or switch to a larger-context model.
|
|
1675
|
-
`
|
|
1676
|
-
);
|
|
1677
|
-
} else if (finishReason === "content_filter") {
|
|
1678
|
-
process.stderr.write(
|
|
1679
|
-
`[${providerId}] \u26A0 Empty response with finish_reason='content_filter' \u2014 content was blocked.
|
|
1680
|
-
`
|
|
1681
|
-
);
|
|
1682
|
-
} else {
|
|
1683
|
-
process.stderr.write(
|
|
1684
|
-
`[${providerId}] \u26A0 Empty response (finish_reason=${finishReason ?? "unknown"}). Model produced no text and no tool calls. Context window may be exhausted.
|
|
1685
|
-
`
|
|
1686
|
-
);
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
1670
|
const reasoningContent = message.reasoning_content;
|
|
1690
1671
|
if (message.tool_calls && message.tool_calls.length > 0) {
|
|
1691
1672
|
const toolCalls = message.tool_calls.map((tc) => {
|
|
@@ -1719,7 +1700,12 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1719
1700
|
});
|
|
1720
1701
|
return { toolCalls, usage, reasoningContent };
|
|
1721
1702
|
}
|
|
1722
|
-
return {
|
|
1703
|
+
return {
|
|
1704
|
+
content: message.content ?? "",
|
|
1705
|
+
usage,
|
|
1706
|
+
...reasoningContent ? { reasoningContent } : {},
|
|
1707
|
+
...!hasToolCalls && (finishReason ?? "") ? { finishReason } : {}
|
|
1708
|
+
};
|
|
1723
1709
|
} catch (err) {
|
|
1724
1710
|
throw this.wrapError(err);
|
|
1725
1711
|
}
|
|
@@ -1742,7 +1728,13 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1742
1728
|
yield { type: "text_delta", delta: result.content };
|
|
1743
1729
|
}
|
|
1744
1730
|
const rc = "reasoningContent" in result ? result.reasoningContent : void 0;
|
|
1745
|
-
|
|
1731
|
+
const fr = "finishReason" in result ? result.finishReason : void 0;
|
|
1732
|
+
yield {
|
|
1733
|
+
type: "done",
|
|
1734
|
+
usage: result.usage,
|
|
1735
|
+
...rc ? { reasoningContent: rc } : {},
|
|
1736
|
+
...fr ? { finishReason: fr } : {}
|
|
1737
|
+
};
|
|
1746
1738
|
return;
|
|
1747
1739
|
}
|
|
1748
1740
|
const openaiTools = tools.map((t) => ({
|
|
@@ -1784,8 +1776,10 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1784
1776
|
let toolCallsEnded = false;
|
|
1785
1777
|
let thinkingStarted = false;
|
|
1786
1778
|
let reasoningAccumulator = "";
|
|
1779
|
+
let lastFinishReason;
|
|
1787
1780
|
for await (const chunk of stream) {
|
|
1788
1781
|
const choice = chunk.choices[0];
|
|
1782
|
+
if (choice?.finish_reason) lastFinishReason = choice.finish_reason;
|
|
1789
1783
|
if (!choice && chunk.usage) {
|
|
1790
1784
|
if (thinkingStarted) {
|
|
1791
1785
|
yield { type: "thinking_end" };
|
|
@@ -1800,7 +1794,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1800
1794
|
yield {
|
|
1801
1795
|
type: "done",
|
|
1802
1796
|
usage: toUsage(chunk.usage),
|
|
1803
|
-
...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {}
|
|
1797
|
+
...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {},
|
|
1798
|
+
...lastFinishReason && lastFinishReason !== "stop" ? { finishReason: lastFinishReason } : {}
|
|
1804
1799
|
};
|
|
1805
1800
|
continue;
|
|
1806
1801
|
}
|
|
@@ -1856,7 +1851,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
|
|
|
1856
1851
|
}
|
|
1857
1852
|
yield {
|
|
1858
1853
|
type: "done",
|
|
1859
|
-
...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {}
|
|
1854
|
+
...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {},
|
|
1855
|
+
...lastFinishReason && lastFinishReason !== "stop" ? { finishReason: lastFinishReason } : {}
|
|
1860
1856
|
};
|
|
1861
1857
|
} catch (err) {
|
|
1862
1858
|
if (err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError")) {
|
|
@@ -12207,7 +12203,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
12207
12203
|
case "test": {
|
|
12208
12204
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
12209
12205
|
try {
|
|
12210
|
-
const { executeTests } = await import("./run-tests-
|
|
12206
|
+
const { executeTests } = await import("./run-tests-VX33IWWD.js");
|
|
12211
12207
|
const argStr = args.join(" ").trim();
|
|
12212
12208
|
let testArgs = {};
|
|
12213
12209
|
if (argStr) {
|
|
@@ -386,7 +386,7 @@ ${content}`);
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
async function runTaskMode(config, providers, configManager, topic) {
|
|
389
|
-
const { TaskOrchestrator } = await import("./task-orchestrator-
|
|
389
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-IXBSUOVM.js");
|
|
390
390
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
391
391
|
let interrupted = false;
|
|
392
392
|
const onSigint = () => {
|
package/dist/index.js
CHANGED
|
@@ -16,12 +16,12 @@ import {
|
|
|
16
16
|
saveDevState,
|
|
17
17
|
sessionHasMeaningfulContent,
|
|
18
18
|
setupProxy
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-OC3QPVR4.js";
|
|
20
20
|
import {
|
|
21
21
|
getConfigDirUsage,
|
|
22
22
|
listRecentCrashes,
|
|
23
23
|
writeCrashLog
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-ZL5Q2HP4.js";
|
|
25
25
|
import {
|
|
26
26
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
27
27
|
HALLUCINATION_CORRECTION_MESSAGE,
|
|
@@ -39,10 +39,10 @@ import {
|
|
|
39
39
|
looksLikeDocumentBody,
|
|
40
40
|
stripPseudoToolCalls,
|
|
41
41
|
stripToolCallReminder
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-5ZHTBFZ4.js";
|
|
43
43
|
import {
|
|
44
44
|
ConfigManager
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-BMXOYPFZ.js";
|
|
46
46
|
import {
|
|
47
47
|
ToolExecutor,
|
|
48
48
|
ToolRegistry,
|
|
@@ -61,16 +61,16 @@ import {
|
|
|
61
61
|
spawnAgentContext,
|
|
62
62
|
theme,
|
|
63
63
|
undoStack
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-6XPEB6PR.js";
|
|
65
65
|
import "./chunk-3BICTI5M.js";
|
|
66
66
|
import "./chunk-2DXY7UGF.js";
|
|
67
|
-
import "./chunk-
|
|
67
|
+
import "./chunk-IP6IPSZJ.js";
|
|
68
68
|
import {
|
|
69
69
|
getStatsSnapshot,
|
|
70
70
|
getTopFailingTools,
|
|
71
71
|
getTopUsedTools,
|
|
72
72
|
installFlushOnExit
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-4XI7RRIW.js";
|
|
74
74
|
import "./chunk-2ZD3YTVM.js";
|
|
75
75
|
import {
|
|
76
76
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
SKILLS_DIR_NAME,
|
|
94
94
|
VERSION,
|
|
95
95
|
buildUserIdentityPrompt
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-GMBLOBW7.js";
|
|
97
97
|
import {
|
|
98
98
|
formatGitContextForPrompt,
|
|
99
99
|
getGitContext,
|
|
@@ -1748,7 +1748,7 @@ No tools match "${filter}".
|
|
|
1748
1748
|
const { join: join6 } = await import("path");
|
|
1749
1749
|
const { existsSync: existsSync6 } = await import("fs");
|
|
1750
1750
|
const { getGitRoot: getGitRoot2 } = await import("./git-context-7KIP4X2V.js");
|
|
1751
|
-
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-
|
|
1751
|
+
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-QBA3BYQM.js");
|
|
1752
1752
|
const { approveProject, hashMcpFile } = await import("./project-trust-IFM7FXEV.js");
|
|
1753
1753
|
const cwd = process.cwd();
|
|
1754
1754
|
const projectRoot = getGitRoot2(cwd) ?? cwd;
|
|
@@ -2809,7 +2809,7 @@ ${hint}` : "")
|
|
|
2809
2809
|
usage: "/test [command|filter]",
|
|
2810
2810
|
async execute(args, ctx) {
|
|
2811
2811
|
try {
|
|
2812
|
-
const { executeTests } = await import("./run-tests-
|
|
2812
|
+
const { executeTests } = await import("./run-tests-27C4WSR6.js");
|
|
2813
2813
|
const argStr = args.join(" ").trim();
|
|
2814
2814
|
let testArgs = {};
|
|
2815
2815
|
if (argStr) {
|
|
@@ -5063,10 +5063,17 @@ ${response.content.trim()}
|
|
|
5063
5063
|
timestamp: /* @__PURE__ */ new Date()
|
|
5064
5064
|
};
|
|
5065
5065
|
const beforeCount = session.messages.length;
|
|
5066
|
+
const ctxWindow = this.getContextWindowSize();
|
|
5067
|
+
const tokensBefore = ctxWindow > 0 ? this.estimateConversationTokens() : 0;
|
|
5066
5068
|
const removedCount = session.compact(summaryMsg, ackMsg, COMPACT_KEEP_LAST);
|
|
5067
5069
|
const afterCount = session.messages.length;
|
|
5070
|
+
const tokensAfter = ctxWindow > 0 ? this.estimateConversationTokens() : 0;
|
|
5071
|
+
const pctBefore = ctxWindow > 0 ? Math.round(tokensBefore / ctxWindow * 100) : 0;
|
|
5072
|
+
const pctAfter = ctxWindow > 0 ? Math.round(tokensAfter / ctxWindow * 100) : 0;
|
|
5073
|
+
const ctxLine = ctxWindow > 0 ? ` Context: ${pctBefore}% \u2192 ${pctAfter}% (freed ~${Math.round((tokensBefore - tokensAfter) / 1e3)}K tokens)` : "";
|
|
5068
5074
|
this.renderer.printSuccess(
|
|
5069
|
-
`Session compacted: ${beforeCount} \u2192 ${afterCount} messages (${removedCount} compressed into summary, ${COMPACT_KEEP_LAST} recent preserved)`
|
|
5075
|
+
`Session compacted: ${beforeCount} \u2192 ${afterCount} messages (${removedCount} compressed into summary, ${COMPACT_KEEP_LAST} recent preserved)` + (ctxLine ? `
|
|
5076
|
+
${ctxLine}` : "")
|
|
5070
5077
|
);
|
|
5071
5078
|
return true;
|
|
5072
5079
|
} catch (err) {
|
|
@@ -6019,6 +6026,7 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6019
6026
|
let usage;
|
|
6020
6027
|
let rawContent;
|
|
6021
6028
|
let reasoningContent;
|
|
6029
|
+
let finishReason;
|
|
6022
6030
|
let spinnerStopped = false;
|
|
6023
6031
|
const stopSpinner = () => {
|
|
6024
6032
|
if (!spinnerStopped) {
|
|
@@ -6068,6 +6076,7 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6068
6076
|
if (event.usage) usage = event.usage;
|
|
6069
6077
|
if (event.rawContent) rawContent = event.rawContent;
|
|
6070
6078
|
if (event.reasoningContent) reasoningContent = event.reasoningContent;
|
|
6079
|
+
if (event.finishReason) finishReason = event.finishReason;
|
|
6071
6080
|
break;
|
|
6072
6081
|
}
|
|
6073
6082
|
}
|
|
@@ -6080,7 +6089,8 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6080
6089
|
toolCalls: [],
|
|
6081
6090
|
usage,
|
|
6082
6091
|
rawContent,
|
|
6083
|
-
reasoningContent
|
|
6092
|
+
reasoningContent,
|
|
6093
|
+
finishReason
|
|
6084
6094
|
};
|
|
6085
6095
|
}
|
|
6086
6096
|
throw err;
|
|
@@ -6111,7 +6121,8 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6111
6121
|
toolCalls,
|
|
6112
6122
|
usage,
|
|
6113
6123
|
rawContent,
|
|
6114
|
-
reasoningContent
|
|
6124
|
+
reasoningContent,
|
|
6125
|
+
finishReason
|
|
6115
6126
|
};
|
|
6116
6127
|
}
|
|
6117
6128
|
async handleChatWithTools(provider, messages, modelOverride) {
|
|
@@ -6331,7 +6342,8 @@ ${mcpBudgetNote}` : "");
|
|
|
6331
6342
|
result = {
|
|
6332
6343
|
content: streamResult.textContent,
|
|
6333
6344
|
usage: streamResult.usage,
|
|
6334
|
-
...streamResult.reasoningContent ? { reasoningContent: streamResult.reasoningContent } : {}
|
|
6345
|
+
...streamResult.reasoningContent ? { reasoningContent: streamResult.reasoningContent } : {},
|
|
6346
|
+
...streamResult.finishReason ? { finishReason: streamResult.finishReason } : {}
|
|
6335
6347
|
};
|
|
6336
6348
|
alreadyRendered = true;
|
|
6337
6349
|
}
|
|
@@ -6372,15 +6384,15 @@ ${mcpBudgetNote}` : "");
|
|
|
6372
6384
|
continue;
|
|
6373
6385
|
}
|
|
6374
6386
|
if (!result.content || result.content.trim() === "") {
|
|
6387
|
+
const fr = "finishReason" in result ? result.finishReason : void 0;
|
|
6388
|
+
const reasonLabel = fr === "length" ? "output limit reached (finish_reason=length)" : fr === "content_filter" ? "content blocked (finish_reason=content_filter)" : fr ? `empty response (finish_reason=${fr})` : "empty response";
|
|
6375
6389
|
if (emptyResponseRetries === 0 && round < maxToolRounds - 1) {
|
|
6376
6390
|
emptyResponseRetries++;
|
|
6377
6391
|
spinner.stop();
|
|
6378
6392
|
if (alreadyRendered) process.stdout.write("\n");
|
|
6379
6393
|
process.stderr.write(
|
|
6380
|
-
theme.warning(
|
|
6381
|
-
|
|
6382
|
-
`
|
|
6383
|
-
)
|
|
6394
|
+
theme.warning(`\u26A0 ${reasonLabel} \u2014 nudging AI to continue...
|
|
6395
|
+
`)
|
|
6384
6396
|
);
|
|
6385
6397
|
extraMessages.push({
|
|
6386
6398
|
role: "user",
|
|
@@ -6391,20 +6403,17 @@ ${mcpBudgetNote}` : "");
|
|
|
6391
6403
|
}
|
|
6392
6404
|
spinner.stop();
|
|
6393
6405
|
if (alreadyRendered) process.stdout.write("\n");
|
|
6406
|
+
const frHint = fr === "length" ? "Output token limit hit \u2014 try /compact to reduce context, raise maxTokens, or /model to switch." : fr === "content_filter" ? "Content was blocked by the provider filter." : "Context window may be exhausted or max_tokens too low.";
|
|
6394
6407
|
process.stderr.write(
|
|
6395
|
-
theme.error(
|
|
6396
|
-
`
|
|
6408
|
+
theme.error(`
|
|
6397
6409
|
\u26A0 AI returned empty responses twice in a row. Stopping agentic loop.
|
|
6398
|
-
`
|
|
6399
|
-
)
|
|
6410
|
+
`)
|
|
6400
6411
|
);
|
|
6401
6412
|
process.stderr.write(
|
|
6402
|
-
theme.dim(
|
|
6403
|
-
|
|
6404
|
-
Try: /compact to reduce context, /clear to reset, or /model to switch.
|
|
6413
|
+
theme.dim(` ${frHint}
|
|
6414
|
+
Try: /compact, /clear, or /model to switch.
|
|
6405
6415
|
|
|
6406
|
-
`
|
|
6407
|
-
)
|
|
6416
|
+
`)
|
|
6408
6417
|
);
|
|
6409
6418
|
if (roundUsage.inputTokens > 0 || roundUsage.outputTokens > 0) {
|
|
6410
6419
|
this.addSessionUsage(roundUsage, effectiveModel);
|
|
@@ -7167,7 +7176,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
7167
7176
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
7168
7177
|
process.exit(1);
|
|
7169
7178
|
}
|
|
7170
|
-
const { startWebServer } = await import("./server-
|
|
7179
|
+
const { startWebServer } = await import("./server-4PNBZPHM.js");
|
|
7171
7180
|
await startWebServer({ port, host: options.host });
|
|
7172
7181
|
});
|
|
7173
7182
|
program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | logout-all <name> | migrate <name>)").action(async (action, username) => {
|
|
@@ -7334,12 +7343,12 @@ program.command("sessions").description("List recent conversation sessions").opt
|
|
|
7334
7343
|
console.log(footer + "\n");
|
|
7335
7344
|
});
|
|
7336
7345
|
program.command("doctor").description("Health check: API keys, config, MCP, recent crashes, tool usage, disk usage").option("--json", "Output as JSON (for scripting)").option("--reset-stats", "Reset accumulated tool usage statistics").action(async (options) => {
|
|
7337
|
-
const { runDoctorCli } = await import("./doctor-cli-
|
|
7346
|
+
const { runDoctorCli } = await import("./doctor-cli-3PDBXO2M.js");
|
|
7338
7347
|
await runDoctorCli({ json: !!options.json, resetStats: !!options.resetStats });
|
|
7339
7348
|
});
|
|
7340
7349
|
program.command("batch <action> [arg] [arg2]").description("Anthropic Message Batches: submit | list | status <id> | results <id> [out] | cancel <id>").option("--dry-run", "Parse and validate input without submitting (submit only)").action(async (action, arg, arg2, options) => {
|
|
7341
7350
|
try {
|
|
7342
|
-
const batch = await import("./batch-
|
|
7351
|
+
const batch = await import("./batch-TCWNELYW.js");
|
|
7343
7352
|
switch (action) {
|
|
7344
7353
|
case "submit":
|
|
7345
7354
|
if (!arg) {
|
|
@@ -7382,7 +7391,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
|
|
|
7382
7391
|
}
|
|
7383
7392
|
});
|
|
7384
7393
|
program.command("mcp-serve").description("Start an MCP server over STDIO, exposing aicli's built-in tools to Claude Desktop / Cursor / other MCP clients").option("--allow-destructive", "Allow bash / run_interactive / task_create (always destructive in MCP mode)").option("--allow-outside-cwd", "Allow tool path arguments to escape the sandbox root \u2014 disabled by default").option("--tools <list>", "Comma-separated whitelist of tools to expose (default: all eligible tools)").option("--cwd <path>", "Working directory AND sandbox root (default: current directory)").action(async (options) => {
|
|
7385
|
-
const { startMcpServer } = await import("./server-
|
|
7394
|
+
const { startMcpServer } = await import("./server-KNAD5HBQ.js");
|
|
7386
7395
|
await startMcpServer({
|
|
7387
7396
|
allowDestructive: !!options.allowDestructive,
|
|
7388
7397
|
allowOutsideCwd: !!options.allowOutsideCwd,
|
|
@@ -7509,7 +7518,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
7509
7518
|
}),
|
|
7510
7519
|
config.get("customProviders")
|
|
7511
7520
|
);
|
|
7512
|
-
const { startHub } = await import("./hub-
|
|
7521
|
+
const { startHub } = await import("./hub-RH34TBP2.js");
|
|
7513
7522
|
await startHub(
|
|
7514
7523
|
{
|
|
7515
7524
|
topic: topic ?? "",
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
loadDevState,
|
|
15
15
|
persistToolRound,
|
|
16
16
|
setupProxy
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-OC3QPVR4.js";
|
|
18
18
|
import {
|
|
19
19
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
20
20
|
HALLUCINATION_CORRECTION_MESSAGE,
|
|
@@ -28,10 +28,10 @@ import {
|
|
|
28
28
|
looksLikeDocumentBody,
|
|
29
29
|
stripPseudoToolCalls,
|
|
30
30
|
stripToolCallReminder
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-5ZHTBFZ4.js";
|
|
32
32
|
import {
|
|
33
33
|
ConfigManager
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-BMXOYPFZ.js";
|
|
35
35
|
import {
|
|
36
36
|
ToolExecutor,
|
|
37
37
|
ToolRegistry,
|
|
@@ -49,14 +49,14 @@ import {
|
|
|
49
49
|
spawnAgentContext,
|
|
50
50
|
truncateOutput,
|
|
51
51
|
undoStack
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-6XPEB6PR.js";
|
|
53
53
|
import "./chunk-3BICTI5M.js";
|
|
54
54
|
import "./chunk-2DXY7UGF.js";
|
|
55
|
-
import "./chunk-
|
|
55
|
+
import "./chunk-IP6IPSZJ.js";
|
|
56
56
|
import {
|
|
57
57
|
getDangerLevel,
|
|
58
58
|
runTool
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-4XI7RRIW.js";
|
|
60
60
|
import "./chunk-2ZD3YTVM.js";
|
|
61
61
|
import {
|
|
62
62
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
SKILLS_DIR_NAME,
|
|
77
77
|
VERSION,
|
|
78
78
|
buildUserIdentityPrompt
|
|
79
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-GMBLOBW7.js";
|
|
80
80
|
import {
|
|
81
81
|
formatGitContextForPrompt,
|
|
82
82
|
getGitContext,
|
|
@@ -2460,7 +2460,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
2460
2460
|
case "test": {
|
|
2461
2461
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
2462
2462
|
try {
|
|
2463
|
-
const { executeTests } = await import("./run-tests-
|
|
2463
|
+
const { executeTests } = await import("./run-tests-27C4WSR6.js");
|
|
2464
2464
|
const argStr = args.join(" ").trim();
|
|
2465
2465
|
let testArgs = {};
|
|
2466
2466
|
if (argStr) {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ToolRegistry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6XPEB6PR.js";
|
|
5
5
|
import "./chunk-3BICTI5M.js";
|
|
6
6
|
import "./chunk-2DXY7UGF.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-IP6IPSZJ.js";
|
|
8
8
|
import {
|
|
9
9
|
getDangerLevel,
|
|
10
10
|
runTool,
|
|
11
11
|
schemaToJsonSchema
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4XI7RRIW.js";
|
|
13
13
|
import "./chunk-2ZD3YTVM.js";
|
|
14
14
|
import {
|
|
15
15
|
VERSION
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GMBLOBW7.js";
|
|
17
17
|
import "./chunk-4BKXL7SM.js";
|
|
18
18
|
import "./chunk-7ZJN4KLV.js";
|
|
19
19
|
import "./chunk-KHYD3WXE.js";
|
|
@@ -3,18 +3,18 @@ import {
|
|
|
3
3
|
ToolRegistry,
|
|
4
4
|
googleSearchContext,
|
|
5
5
|
truncateOutput
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6XPEB6PR.js";
|
|
7
7
|
import "./chunk-3BICTI5M.js";
|
|
8
8
|
import "./chunk-2DXY7UGF.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-IP6IPSZJ.js";
|
|
10
10
|
import {
|
|
11
11
|
getDangerLevel,
|
|
12
12
|
runTool
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4XI7RRIW.js";
|
|
14
14
|
import "./chunk-2ZD3YTVM.js";
|
|
15
15
|
import {
|
|
16
16
|
SUBAGENT_ALLOWED_TOOLS
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-GMBLOBW7.js";
|
|
18
18
|
import "./chunk-4BKXL7SM.js";
|
|
19
19
|
import "./chunk-7ZJN4KLV.js";
|
|
20
20
|
import "./chunk-KHYD3WXE.js";
|