jinzd-ai-cli 0.4.163 → 0.4.165
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-23RWXUJ6.js → batch-KV33HTXT.js} +2 -2
- package/dist/{chunk-AIZOARZY.js → chunk-2INGXRYC.js} +40 -0
- package/dist/{chunk-KAGGATDS.js → chunk-3IRLZJEZ.js} +1 -1
- package/dist/{chunk-J3VOAA3L.js → chunk-A2QRIRWR.js} +1 -1
- package/dist/{chunk-QC752ZCX.js → chunk-AYYIFOLV.js} +1 -1
- package/dist/{chunk-BW3DZ7BJ.js → chunk-GX4MZJ6R.js} +1 -1
- package/dist/{chunk-CLANK3BE.js → chunk-R6F6V6AA.js} +1 -1
- package/dist/{chunk-CYKPD43M.js → chunk-TQOW4QXI.js} +1 -1
- package/dist/{chunk-2QIYG35F.js → chunk-VSJHW3CU.js} +10 -7
- package/dist/{chunk-ZQUQQO53.js → chunk-YC7N44MJ.js} +2 -2
- package/dist/{ci-Y2DIKFVY.js → ci-H3U5MT23.js} +3 -3
- package/dist/{constants-IXF5BW5V.js → constants-EFVA3BWE.js} +1 -1
- package/dist/{doctor-cli-5ZZCLK6T.js → doctor-cli-WIQX3QCP.js} +5 -5
- package/dist/electron-server.js +47 -7
- package/dist/{hub-VGXOX46Q.js → hub-OVROTRRS.js} +1 -1
- package/dist/index.js +20 -17
- package/dist/{run-tests-5BVEGMJJ.js → run-tests-SH56G6VK.js} +2 -2
- package/dist/{run-tests-CVGZWFHD.js → run-tests-WOGF7YL7.js} +1 -1
- package/dist/{server-B6LAFRQ2.js → server-EC4VLKEM.js} +11 -9
- package/dist/{server-YAXJP7RB.js → server-YOOT2T67.js} +4 -4
- package/dist/{task-orchestrator-4POUJZYE.js → task-orchestrator-QLMPQB3D.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-3IRLZJEZ.js";
|
|
5
5
|
import "./chunk-2ZD3YTVM.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-R6F6V6AA.js";
|
|
7
7
|
import "./chunk-PDX44BCA.js";
|
|
8
8
|
|
|
9
9
|
// src/cli/batch.ts
|
|
@@ -1737,6 +1737,42 @@ function extractWrittenFilePaths(extraMessages) {
|
|
|
1737
1737
|
}
|
|
1738
1738
|
return Array.from(paths);
|
|
1739
1739
|
}
|
|
1740
|
+
function extractBashCommands(extraMessages) {
|
|
1741
|
+
const cmds = [];
|
|
1742
|
+
const msgs = extraMessages;
|
|
1743
|
+
const addCmd = (raw) => {
|
|
1744
|
+
if (typeof raw === "string") {
|
|
1745
|
+
try {
|
|
1746
|
+
const parsed = JSON.parse(raw);
|
|
1747
|
+
if (typeof parsed.command === "string") cmds.push(parsed.command);
|
|
1748
|
+
} catch {
|
|
1749
|
+
}
|
|
1750
|
+
} else if (raw && typeof raw === "object") {
|
|
1751
|
+
const c = raw.command;
|
|
1752
|
+
if (typeof c === "string") cmds.push(c);
|
|
1753
|
+
}
|
|
1754
|
+
};
|
|
1755
|
+
for (const msg of msgs) {
|
|
1756
|
+
if (msg.role === "assistant" && Array.isArray(msg.tool_calls)) {
|
|
1757
|
+
for (const tc of msg.tool_calls) {
|
|
1758
|
+
const fn = tc.function;
|
|
1759
|
+
if (fn?.name === "bash") addCmd(fn?.arguments);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
if (msg.role === "assistant" && Array.isArray(msg.content)) {
|
|
1763
|
+
for (const block of msg.content) {
|
|
1764
|
+
if (block.type === "tool_use" && block.name === "bash") addCmd(block.input);
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
if (msg.role === "model" && Array.isArray(msg.parts)) {
|
|
1768
|
+
for (const part of msg.parts) {
|
|
1769
|
+
const fc = part.functionCall;
|
|
1770
|
+
if (fc && fc.name === "bash") addCmd(fc.args);
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
return cmds;
|
|
1775
|
+
}
|
|
1740
1776
|
function findPhantomClaims(content, extraMessages) {
|
|
1741
1777
|
const claimed = extractClaimedFilePaths(content);
|
|
1742
1778
|
if (claimed.length === 0) return [];
|
|
@@ -1748,6 +1784,7 @@ function findPhantomClaims(content, extraMessages) {
|
|
|
1748
1784
|
const written = extractWrittenFilePaths(extraMessages).map(normalize);
|
|
1749
1785
|
const writtenBases = new Set(written.map(basename));
|
|
1750
1786
|
const writtenFull = new Set(written);
|
|
1787
|
+
const bashText = extractBashCommands(extraMessages).map((c) => c.replace(/\\/g, "/").toLowerCase()).join("\n");
|
|
1751
1788
|
return claimed.filter((raw) => {
|
|
1752
1789
|
const norm = normalize(raw);
|
|
1753
1790
|
if (writtenFull.has(norm)) return false;
|
|
@@ -1755,6 +1792,8 @@ function findPhantomClaims(content, extraMessages) {
|
|
|
1755
1792
|
if (w.endsWith("/" + norm) || norm.endsWith("/" + w)) return false;
|
|
1756
1793
|
}
|
|
1757
1794
|
if (writtenBases.has(basename(norm))) return false;
|
|
1795
|
+
const base = basename(norm);
|
|
1796
|
+
if (base && bashText.includes(base)) return false;
|
|
1758
1797
|
return true;
|
|
1759
1798
|
});
|
|
1760
1799
|
}
|
|
@@ -2536,6 +2575,7 @@ export {
|
|
|
2536
2575
|
buildWriteRoundReminder,
|
|
2537
2576
|
HALLUCINATION_CORRECTION_MESSAGE,
|
|
2538
2577
|
extractWrittenFilePaths,
|
|
2578
|
+
extractBashCommands,
|
|
2539
2579
|
findPhantomClaims,
|
|
2540
2580
|
buildPhantomCorrectionMessage,
|
|
2541
2581
|
detectPseudoToolCalls,
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "./chunk-HDSKW7Q3.js";
|
|
6
6
|
import {
|
|
7
7
|
runTestsTool
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AYYIFOLV.js";
|
|
9
9
|
import {
|
|
10
10
|
runTool
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-A2QRIRWR.js";
|
|
12
12
|
import {
|
|
13
13
|
getDangerLevel,
|
|
14
14
|
isFileWriteTool
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
SUBAGENT_ALLOWED_TOOLS,
|
|
26
26
|
SUBAGENT_DEFAULT_MAX_ROUNDS,
|
|
27
27
|
SUBAGENT_MAX_ROUNDS_LIMIT
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-R6F6V6AA.js";
|
|
29
29
|
import {
|
|
30
30
|
fileCheckpoints
|
|
31
31
|
} from "./chunk-4BKXL7SM.js";
|
|
@@ -400,10 +400,13 @@ function buildErrorHint(command, stderr) {
|
|
|
400
400
|
`Hint: PowerShell parses '||' as a pipeline operator (PS 5.x) or logical-or (PS 7+), it CANNOT be passed inline as SQL string concatenation. Workaround: write the SQL to a local .sql file with write_file, then 'scp' it to the remote host and run 'psql -f /tmp/x.sql'. Do NOT try to escape || or wrap the command differently \u2014 it will not work.`
|
|
401
401
|
);
|
|
402
402
|
}
|
|
403
|
-
if (IS_WINDOWS && /\bpython3\b/.test(command)
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
403
|
+
if (IS_WINDOWS && /\bpython3\b/.test(command)) {
|
|
404
|
+
const trivialStderr = stderr.trim().length === 0 || /^[·\s]*exit 1\b/i.test(stderr.trim());
|
|
405
|
+
if (/(not recognized|is not recognized|无法将.*识别)/i.test(stderr) || trivialStderr) {
|
|
406
|
+
hints.push(
|
|
407
|
+
`Hint: On Windows 'python3' often points to the Microsoft Store stub (WindowsApps\\python3.exe) which exits 1 without running. Use 'python' (not 'python3'), or run the real interpreter by full path: first \`(Get-Command python).Source\`, then \`& '<that path>' script.py\`.`
|
|
408
|
+
);
|
|
409
|
+
}
|
|
407
410
|
}
|
|
408
411
|
if (IS_WINDOWS && /^\s*ssh\b/.test(command) && /\\"/.test(command) && /(syntax error|ERROR:|ParserError|unexpected|parser|意外的|语法|不是此版本|所在位置\s+行)/i.test(stderr)) {
|
|
409
412
|
hints.push(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
truncateForPersist
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VSJHW3CU.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-R6F6V6AA.js";
|
|
15
15
|
|
|
16
16
|
// src/mcp/client.ts
|
|
17
17
|
import { spawn } from "child_process";
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-HLWUDRBO.js";
|
|
7
7
|
import {
|
|
8
8
|
ProviderRegistry
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-2INGXRYC.js";
|
|
10
10
|
import "./chunk-NXXNLLSG.js";
|
|
11
11
|
import {
|
|
12
12
|
ConfigManager
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3IRLZJEZ.js";
|
|
14
14
|
import "./chunk-2ZD3YTVM.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-R6F6V6AA.js";
|
|
18
18
|
import "./chunk-PDX44BCA.js";
|
|
19
19
|
|
|
20
20
|
// src/cli/ci.ts
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getConfigDirUsage,
|
|
4
4
|
listRecentCrashes
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TQOW4QXI.js";
|
|
6
6
|
import {
|
|
7
7
|
ProviderRegistry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2INGXRYC.js";
|
|
9
9
|
import {
|
|
10
10
|
getStatsSnapshot,
|
|
11
11
|
getTopFailingTools,
|
|
12
12
|
getTopUsedTools,
|
|
13
13
|
resetStats
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-A2QRIRWR.js";
|
|
15
15
|
import "./chunk-NXXNLLSG.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigManager
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3IRLZJEZ.js";
|
|
19
19
|
import "./chunk-2ZD3YTVM.js";
|
|
20
20
|
import {
|
|
21
21
|
DEV_STATE_FILE_NAME,
|
|
22
22
|
MEMORY_FILE_NAME,
|
|
23
23
|
VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-R6F6V6AA.js";
|
|
25
25
|
import "./chunk-PDX44BCA.js";
|
|
26
26
|
|
|
27
27
|
// 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-GX4MZJ6R.js";
|
|
40
40
|
import {
|
|
41
41
|
hasSemanticIndex,
|
|
42
42
|
semanticSearch
|
|
@@ -2291,6 +2291,42 @@ CRITICAL \u2014 Batch file generation rules:
|
|
|
2291
2291
|
4. Only produce a text summary AFTER all write_file calls have been made and returned success.
|
|
2292
2292
|
5. The system compares every "file saved" claim against actual tool calls. Phantom claims trigger an automatic retry \u2014 do not waste rounds.`;
|
|
2293
2293
|
var HALLUCINATION_CORRECTION_MESSAGE = "You did NOT actually call the write_file tool \u2014 the file was NOT created! Please immediately use the write_file tool via the function calling API to perform the actual file write. Do NOT describe file content in text \u2014 you MUST invoke write_file through the tool_calls mechanism.";
|
|
2294
|
+
function extractBashCommands(extraMessages) {
|
|
2295
|
+
const cmds = [];
|
|
2296
|
+
const msgs = extraMessages;
|
|
2297
|
+
const addCmd = (raw) => {
|
|
2298
|
+
if (typeof raw === "string") {
|
|
2299
|
+
try {
|
|
2300
|
+
const parsed = JSON.parse(raw);
|
|
2301
|
+
if (typeof parsed.command === "string") cmds.push(parsed.command);
|
|
2302
|
+
} catch {
|
|
2303
|
+
}
|
|
2304
|
+
} else if (raw && typeof raw === "object") {
|
|
2305
|
+
const c = raw.command;
|
|
2306
|
+
if (typeof c === "string") cmds.push(c);
|
|
2307
|
+
}
|
|
2308
|
+
};
|
|
2309
|
+
for (const msg of msgs) {
|
|
2310
|
+
if (msg.role === "assistant" && Array.isArray(msg.tool_calls)) {
|
|
2311
|
+
for (const tc of msg.tool_calls) {
|
|
2312
|
+
const fn = tc.function;
|
|
2313
|
+
if (fn?.name === "bash") addCmd(fn?.arguments);
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
if (msg.role === "assistant" && Array.isArray(msg.content)) {
|
|
2317
|
+
for (const block of msg.content) {
|
|
2318
|
+
if (block.type === "tool_use" && block.name === "bash") addCmd(block.input);
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
if (msg.role === "model" && Array.isArray(msg.parts)) {
|
|
2322
|
+
for (const part of msg.parts) {
|
|
2323
|
+
const fc = part.functionCall;
|
|
2324
|
+
if (fc && fc.name === "bash") addCmd(fc.args);
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
return cmds;
|
|
2329
|
+
}
|
|
2294
2330
|
var PSEUDO_TOOL_CALL_PATTERNS = [
|
|
2295
2331
|
// <tool_call name="..."> ... </tool_call> (DeepSeek V4 thinking, GLM)
|
|
2296
2332
|
/<tool_call\s+name\s*=\s*["'][\w._-]+["']/,
|
|
@@ -4163,10 +4199,13 @@ function buildErrorHint(command, stderr) {
|
|
|
4163
4199
|
`Hint: PowerShell parses '||' as a pipeline operator (PS 5.x) or logical-or (PS 7+), it CANNOT be passed inline as SQL string concatenation. Workaround: write the SQL to a local .sql file with write_file, then 'scp' it to the remote host and run 'psql -f /tmp/x.sql'. Do NOT try to escape || or wrap the command differently \u2014 it will not work.`
|
|
4164
4200
|
);
|
|
4165
4201
|
}
|
|
4166
|
-
if (IS_WINDOWS && /\bpython3\b/.test(command)
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4202
|
+
if (IS_WINDOWS && /\bpython3\b/.test(command)) {
|
|
4203
|
+
const trivialStderr = stderr.trim().length === 0 || /^[·\s]*exit 1\b/i.test(stderr.trim());
|
|
4204
|
+
if (/(not recognized|is not recognized|无法将.*识别)/i.test(stderr) || trivialStderr) {
|
|
4205
|
+
hints.push(
|
|
4206
|
+
`Hint: On Windows 'python3' often points to the Microsoft Store stub (WindowsApps\\python3.exe) which exits 1 without running. Use 'python' (not 'python3'), or run the real interpreter by full path: first \`(Get-Command python).Source\`, then \`& '<that path>' script.py\`.`
|
|
4207
|
+
);
|
|
4208
|
+
}
|
|
4170
4209
|
}
|
|
4171
4210
|
if (IS_WINDOWS && /^\s*ssh\b/.test(command) && /\\"/.test(command) && /(syntax error|ERROR:|ParserError|unexpected|parser|意外的|语法|不是此版本|所在位置\s+行)/i.test(stderr)) {
|
|
4172
4211
|
hints.push(
|
|
@@ -12043,7 +12082,8 @@ Details: ${errMsg.split("\n")[0]}
|
|
|
12043
12082
|
if (result.content && !result.toolCalls) {
|
|
12044
12083
|
const hasWriteTools = toolDefs.some((t) => t.name === "write_file" || t.name === "edit_file");
|
|
12045
12084
|
const alreadyWrote = hadPreviousWriteToolCalls(extraMessages);
|
|
12046
|
-
|
|
12085
|
+
const bashRanThisTurn = extractBashCommands(extraMessages).length > 0;
|
|
12086
|
+
if (hasWriteTools && !alreadyWrote && !bashRanThisTurn && detectsHallucinatedFileOp(result.content) && round < maxToolRounds - 1) {
|
|
12047
12087
|
this.send({ type: "info", message: "\u26A0 Hallucinated completion detected, forcing retry..." });
|
|
12048
12088
|
const reasoningField = result.reasoningContent ? { reasoning_content: result.reasoningContent } : this.currentProvider === "deepseek" ? { reasoning_content: "" } : {};
|
|
12049
12089
|
extraMessages.push(
|
|
@@ -13443,7 +13483,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
13443
13483
|
case "test": {
|
|
13444
13484
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
13445
13485
|
try {
|
|
13446
|
-
const { executeTests } = await import("./run-tests-
|
|
13486
|
+
const { executeTests } = await import("./run-tests-WOGF7YL7.js");
|
|
13447
13487
|
const argStr = args.join(" ").trim();
|
|
13448
13488
|
let testArgs = {};
|
|
13449
13489
|
if (argStr) {
|
|
@@ -155,7 +155,7 @@ ${content}`);
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
async function runTaskMode(config, providers, configManager, topic) {
|
|
158
|
-
const { TaskOrchestrator } = await import("./task-orchestrator-
|
|
158
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-QLMPQB3D.js");
|
|
159
159
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
160
160
|
let interrupted = false;
|
|
161
161
|
const onSigint = () => {
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
saveDevState,
|
|
19
19
|
sessionHasMeaningfulContent,
|
|
20
20
|
setupProxy
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-YC7N44MJ.js";
|
|
22
22
|
import {
|
|
23
23
|
ToolExecutor,
|
|
24
24
|
ToolRegistry,
|
|
@@ -37,10 +37,10 @@ import {
|
|
|
37
37
|
spawnAgentContext,
|
|
38
38
|
theme,
|
|
39
39
|
undoStack
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-VSJHW3CU.js";
|
|
41
41
|
import "./chunk-HDSKW7Q3.js";
|
|
42
42
|
import "./chunk-ZWVIDFGY.js";
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-AYYIFOLV.js";
|
|
44
44
|
import {
|
|
45
45
|
SessionManager,
|
|
46
46
|
getContentText
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
getConfigDirUsage,
|
|
50
50
|
listRecentCrashes,
|
|
51
51
|
writeCrashLog
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-TQOW4QXI.js";
|
|
53
53
|
import {
|
|
54
54
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
55
55
|
HALLUCINATION_CORRECTION_MESSAGE,
|
|
@@ -61,23 +61,24 @@ import {
|
|
|
61
61
|
detectMetaNarration,
|
|
62
62
|
detectPseudoToolCalls,
|
|
63
63
|
detectsHallucinatedFileOp,
|
|
64
|
+
extractBashCommands,
|
|
64
65
|
extractWrittenFilePaths,
|
|
65
66
|
findPhantomClaims,
|
|
66
67
|
hadPreviousWriteToolCalls,
|
|
67
68
|
looksLikeDocumentBody,
|
|
68
69
|
stripPseudoToolCalls,
|
|
69
70
|
stripToolCallReminder
|
|
70
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-2INGXRYC.js";
|
|
71
72
|
import {
|
|
72
73
|
getStatsSnapshot,
|
|
73
74
|
getTopFailingTools,
|
|
74
75
|
getTopUsedTools,
|
|
75
76
|
installFlushOnExit
|
|
76
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-A2QRIRWR.js";
|
|
77
78
|
import "./chunk-NXXNLLSG.js";
|
|
78
79
|
import {
|
|
79
80
|
ConfigManager
|
|
80
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-3IRLZJEZ.js";
|
|
81
82
|
import {
|
|
82
83
|
AuthError,
|
|
83
84
|
ProviderError,
|
|
@@ -104,7 +105,7 @@ import {
|
|
|
104
105
|
SKILLS_DIR_NAME,
|
|
105
106
|
VERSION,
|
|
106
107
|
buildUserIdentityPrompt
|
|
107
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-R6F6V6AA.js";
|
|
108
109
|
import {
|
|
109
110
|
formatGitContextForPrompt,
|
|
110
111
|
getGitContext,
|
|
@@ -1773,7 +1774,7 @@ No tools match "${filter}".
|
|
|
1773
1774
|
const { join: join6 } = await import("path");
|
|
1774
1775
|
const { existsSync: existsSync6 } = await import("fs");
|
|
1775
1776
|
const { getGitRoot: getGitRoot2 } = await import("./git-context-7KIP4X2V.js");
|
|
1776
|
-
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-
|
|
1777
|
+
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-EFVA3BWE.js");
|
|
1777
1778
|
const { approveProject, hashMcpFile } = await import("./project-trust-IFM7FXEV.js");
|
|
1778
1779
|
const cwd = process.cwd();
|
|
1779
1780
|
const projectRoot = getGitRoot2(cwd) ?? cwd;
|
|
@@ -2834,7 +2835,7 @@ ${hint}` : "")
|
|
|
2834
2835
|
usage: "/test [command|filter]",
|
|
2835
2836
|
async execute(args, ctx) {
|
|
2836
2837
|
try {
|
|
2837
|
-
const { executeTests } = await import("./run-tests-
|
|
2838
|
+
const { executeTests } = await import("./run-tests-SH56G6VK.js");
|
|
2838
2839
|
const argStr = args.join(" ").trim();
|
|
2839
2840
|
let testArgs = {};
|
|
2840
2841
|
if (argStr) {
|
|
@@ -6712,7 +6713,9 @@ ${mcpBudgetNote}` : "");
|
|
|
6712
6713
|
const alreadyWrote = hadPreviousWriteToolCalls(extraMessages);
|
|
6713
6714
|
const coarseHallucination = !this.planMode && hasWriteTools && !alreadyWrote && !!result.content && detectsHallucinatedFileOp(result.content);
|
|
6714
6715
|
const phantomPaths = (coarseHallucination || alreadyWrote) && !this.planMode && hasWriteTools && result.content ? findPhantomClaims(result.content, extraMessages) : [];
|
|
6715
|
-
|
|
6716
|
+
const bashRanThisTurn = extractBashCommands(extraMessages).length > 0;
|
|
6717
|
+
const coarseShouldFire = coarseHallucination && !bashRanThisTurn;
|
|
6718
|
+
if ((phantomPaths.length > 0 || coarseShouldFire) && round < maxToolRounds - 1) {
|
|
6716
6719
|
const providerName = this.currentProvider;
|
|
6717
6720
|
const detail = phantomPaths.length > 0 ? ` phantom files: ${phantomPaths.join(", ")}` : "";
|
|
6718
6721
|
process.stderr.write(
|
|
@@ -7534,7 +7537,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
7534
7537
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
7535
7538
|
process.exit(1);
|
|
7536
7539
|
}
|
|
7537
|
-
const { startWebServer } = await import("./server-
|
|
7540
|
+
const { startWebServer } = await import("./server-EC4VLKEM.js");
|
|
7538
7541
|
await startWebServer({ port, host: options.host });
|
|
7539
7542
|
});
|
|
7540
7543
|
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) => {
|
|
@@ -7701,12 +7704,12 @@ program.command("sessions").description("List recent conversation sessions").opt
|
|
|
7701
7704
|
console.log(footer + "\n");
|
|
7702
7705
|
});
|
|
7703
7706
|
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) => {
|
|
7704
|
-
const { runDoctorCli } = await import("./doctor-cli-
|
|
7707
|
+
const { runDoctorCli } = await import("./doctor-cli-WIQX3QCP.js");
|
|
7705
7708
|
await runDoctorCli({ json: !!options.json, resetStats: !!options.resetStats });
|
|
7706
7709
|
});
|
|
7707
7710
|
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) => {
|
|
7708
7711
|
try {
|
|
7709
|
-
const batch = await import("./batch-
|
|
7712
|
+
const batch = await import("./batch-KV33HTXT.js");
|
|
7710
7713
|
switch (action) {
|
|
7711
7714
|
case "submit":
|
|
7712
7715
|
if (!arg) {
|
|
@@ -7749,7 +7752,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
|
|
|
7749
7752
|
}
|
|
7750
7753
|
});
|
|
7751
7754
|
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) => {
|
|
7752
|
-
const { startMcpServer } = await import("./server-
|
|
7755
|
+
const { startMcpServer } = await import("./server-YOOT2T67.js");
|
|
7753
7756
|
await startMcpServer({
|
|
7754
7757
|
allowDestructive: !!options.allowDestructive,
|
|
7755
7758
|
allowOutsideCwd: !!options.allowOutsideCwd,
|
|
@@ -7758,7 +7761,7 @@ program.command("mcp-serve").description("Start an MCP server over STDIO, exposi
|
|
|
7758
7761
|
});
|
|
7759
7762
|
});
|
|
7760
7763
|
program.command("ci").description("Headless PR review (code + security) \u2014 reads git/gh diff, optionally posts to PR. Designed for GitHub Actions.").option("--pr <num>", "PR number; diff fetched via `gh pr diff <num>`", (v) => parseInt(v, 10)).option("--base <ref>", "Base ref for `git diff <ref>...HEAD` (ignored when --pr set)").option("--post", "Post review as a PR comment (requires gh CLI + GH_TOKEN, needs --pr)").option("--no-update", "Always create a new comment instead of updating the previous aicli review").option("--skip-code", "Skip the code review section").option("--skip-security", "Skip the security review section").option("--detailed", "Use the detailed code-review prompt").option("--max-diff <n>", "Max diff chars sent to the model (default 30000)", (v) => parseInt(v, 10)).option("--provider <id>", "Override provider (default: config.defaultProvider)").option("--model <id>", "Override model").option("--dry-run", "Print result to stdout instead of posting (overrides --post)").action(async (options) => {
|
|
7761
|
-
const { runCi } = await import("./ci-
|
|
7764
|
+
const { runCi } = await import("./ci-H3U5MT23.js");
|
|
7762
7765
|
const result = await runCi({
|
|
7763
7766
|
pr: options.pr,
|
|
7764
7767
|
base: options.base,
|
|
@@ -7903,7 +7906,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
7903
7906
|
}),
|
|
7904
7907
|
config.get("customProviders")
|
|
7905
7908
|
);
|
|
7906
|
-
const { startHub } = await import("./hub-
|
|
7909
|
+
const { startHub } = await import("./hub-OVROTRRS.js");
|
|
7907
7910
|
await startHub(
|
|
7908
7911
|
{
|
|
7909
7912
|
topic: topic ?? "",
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
loadDevState,
|
|
22
22
|
persistToolRound,
|
|
23
23
|
setupProxy
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-YC7N44MJ.js";
|
|
25
25
|
import {
|
|
26
26
|
ToolExecutor,
|
|
27
27
|
ToolRegistry,
|
|
@@ -39,10 +39,10 @@ import {
|
|
|
39
39
|
spawnAgentContext,
|
|
40
40
|
truncateOutput,
|
|
41
41
|
undoStack
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-VSJHW3CU.js";
|
|
43
43
|
import "./chunk-HDSKW7Q3.js";
|
|
44
44
|
import "./chunk-ZWVIDFGY.js";
|
|
45
|
-
import "./chunk-
|
|
45
|
+
import "./chunk-AYYIFOLV.js";
|
|
46
46
|
import {
|
|
47
47
|
SessionManager,
|
|
48
48
|
getContentText
|
|
@@ -56,20 +56,21 @@ import {
|
|
|
56
56
|
detectMetaNarration,
|
|
57
57
|
detectPseudoToolCalls,
|
|
58
58
|
detectsHallucinatedFileOp,
|
|
59
|
+
extractBashCommands,
|
|
59
60
|
hadPreviousWriteToolCalls,
|
|
60
61
|
looksLikeDocumentBody,
|
|
61
62
|
stripPseudoToolCalls,
|
|
62
63
|
stripToolCallReminder
|
|
63
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-2INGXRYC.js";
|
|
64
65
|
import {
|
|
65
66
|
runTool
|
|
66
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-A2QRIRWR.js";
|
|
67
68
|
import {
|
|
68
69
|
getDangerLevel
|
|
69
70
|
} from "./chunk-NXXNLLSG.js";
|
|
70
71
|
import {
|
|
71
72
|
ConfigManager
|
|
72
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-3IRLZJEZ.js";
|
|
73
74
|
import "./chunk-2ZD3YTVM.js";
|
|
74
75
|
import {
|
|
75
76
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
@@ -89,7 +90,7 @@ import {
|
|
|
89
90
|
SKILLS_DIR_NAME,
|
|
90
91
|
VERSION,
|
|
91
92
|
buildUserIdentityPrompt
|
|
92
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-R6F6V6AA.js";
|
|
93
94
|
import {
|
|
94
95
|
formatGitContextForPrompt,
|
|
95
96
|
getGitContext,
|
|
@@ -1175,7 +1176,8 @@ Details: ${errMsg.split("\n")[0]}
|
|
|
1175
1176
|
if (result.content && !result.toolCalls) {
|
|
1176
1177
|
const hasWriteTools = toolDefs.some((t) => t.name === "write_file" || t.name === "edit_file");
|
|
1177
1178
|
const alreadyWrote = hadPreviousWriteToolCalls(extraMessages);
|
|
1178
|
-
|
|
1179
|
+
const bashRanThisTurn = extractBashCommands(extraMessages).length > 0;
|
|
1180
|
+
if (hasWriteTools && !alreadyWrote && !bashRanThisTurn && detectsHallucinatedFileOp(result.content) && round < maxToolRounds - 1) {
|
|
1179
1181
|
this.send({ type: "info", message: "\u26A0 Hallucinated completion detected, forcing retry..." });
|
|
1180
1182
|
const reasoningField = result.reasoningContent ? { reasoning_content: result.reasoningContent } : this.currentProvider === "deepseek" ? { reasoning_content: "" } : {};
|
|
1181
1183
|
extraMessages.push(
|
|
@@ -2575,7 +2577,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
2575
2577
|
case "test": {
|
|
2576
2578
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
2577
2579
|
try {
|
|
2578
|
-
const { executeTests } = await import("./run-tests-
|
|
2580
|
+
const { executeTests } = await import("./run-tests-SH56G6VK.js");
|
|
2579
2581
|
const argStr = args.join(" ").trim();
|
|
2580
2582
|
let testArgs = {};
|
|
2581
2583
|
if (argStr) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ToolRegistry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VSJHW3CU.js";
|
|
5
5
|
import "./chunk-HDSKW7Q3.js";
|
|
6
6
|
import "./chunk-ZWVIDFGY.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-AYYIFOLV.js";
|
|
8
8
|
import {
|
|
9
9
|
runTool
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-A2QRIRWR.js";
|
|
11
11
|
import {
|
|
12
12
|
getDangerLevel,
|
|
13
13
|
schemaToJsonSchema
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import "./chunk-2ZD3YTVM.js";
|
|
16
16
|
import {
|
|
17
17
|
VERSION
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-R6F6V6AA.js";
|
|
19
19
|
import "./chunk-4BKXL7SM.js";
|
|
20
20
|
import "./chunk-MM3F43H6.js";
|
|
21
21
|
import "./chunk-KHYD3WXE.js";
|
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
ToolRegistry,
|
|
4
4
|
googleSearchContext,
|
|
5
5
|
truncateOutput
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VSJHW3CU.js";
|
|
7
7
|
import "./chunk-HDSKW7Q3.js";
|
|
8
8
|
import "./chunk-ZWVIDFGY.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-AYYIFOLV.js";
|
|
10
10
|
import {
|
|
11
11
|
runTool
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-A2QRIRWR.js";
|
|
13
13
|
import {
|
|
14
14
|
getDangerLevel
|
|
15
15
|
} from "./chunk-NXXNLLSG.js";
|
|
16
16
|
import "./chunk-2ZD3YTVM.js";
|
|
17
17
|
import {
|
|
18
18
|
SUBAGENT_ALLOWED_TOOLS
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-R6F6V6AA.js";
|
|
20
20
|
import "./chunk-4BKXL7SM.js";
|
|
21
21
|
import "./chunk-MM3F43H6.js";
|
|
22
22
|
import "./chunk-KHYD3WXE.js";
|