jinzd-ai-cli 0.4.190 → 0.4.191
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-HF5RWUBL.js → batch-4XSN4VF7.js} +2 -2
- package/dist/{chunk-ZN5IEPSS.js → chunk-6Z42O3DN.js} +1 -1
- package/dist/{chunk-4KMDKDAK.js → chunk-ASVBZIUE.js} +1 -1
- package/dist/{chunk-NV6W7TZW.js → chunk-HSQAKOYX.js} +1 -1
- package/dist/{chunk-JATZIZJV.js → chunk-IMSENBJ6.js} +2 -2
- package/dist/{chunk-IQ7JE43O.js → chunk-JTLPYPT3.js} +48 -4
- package/dist/{chunk-5CLH6XAW.js → chunk-RQ7JVLFM.js} +3 -3
- package/dist/{chunk-UVW3WLSV.js → chunk-TRV47UK4.js} +1 -1
- package/dist/{chunk-X4J2DZB5.js → chunk-XDH5EFWC.js} +1 -1
- package/dist/{chunk-KHS7RSGR.js → chunk-Y3PNCW7A.js} +1 -1
- package/dist/{ci-X24WFUDF.js → ci-USJCTRP7.js} +3 -3
- package/dist/{constants-4QBBHLU4.js → constants-3T5G34S5.js} +1 -1
- package/dist/{doctor-cli-EUOCY7VN.js → doctor-cli-3QE7FZKB.js} +5 -5
- package/dist/electron-server.js +58 -44
- package/dist/{hub-YW3KLBZM.js → hub-LABDYMAE.js} +1 -1
- package/dist/index.js +58 -101
- package/dist/{run-tests-OTZE5CEN.js → run-tests-H3VCHOJB.js} +1 -1
- package/dist/{run-tests-7ZUNEUEX.js → run-tests-X2MCBIKN.js} +2 -2
- package/dist/{server-YMCGJOXV.js → server-FE7XTYVC.js} +4 -4
- package/dist/{server-WMLZOLD5.js → server-TJDKEECG.js} +21 -55
- package/dist/{task-orchestrator-DEWKVJGQ.js → task-orchestrator-VFCQGTYA.js} +4 -4
- package/dist/{usage-5LMWDGZ4.js → usage-FYKIOPJI.js} +2 -2
- 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-XDH5EFWC.js";
|
|
5
5
|
import "./chunk-TZQHYZKT.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-ASVBZIUE.js";
|
|
7
7
|
import {
|
|
8
8
|
atomicWriteFileSync
|
|
9
9
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
truncateForPersist
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RQ7JVLFM.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-ASVBZIUE.js";
|
|
15
15
|
|
|
16
16
|
// src/mcp/client.ts
|
|
17
17
|
import { spawn } from "child_process";
|
|
@@ -1320,6 +1320,52 @@ You are now in a CONTENT-ONLY streaming pass. The file at the configured path wi
|
|
|
1320
1320
|
- If you accidentally start a <tool_call>, STOP and produce the document body instead.
|
|
1321
1321
|
|
|
1322
1322
|
The file is closed and named when this stream ends. If your output contains pseudo-tool-call markup, the save will be REJECTED and you will be asked to retry.`;
|
|
1323
|
+
function teeFileStats(content) {
|
|
1324
|
+
return { lines: content.split("\n").length, bytes: Buffer.byteLength(content, "utf-8") };
|
|
1325
|
+
}
|
|
1326
|
+
function evaluateTeeContent(rawContent, saveToFile) {
|
|
1327
|
+
const metaMatch = detectMetaNarration(rawContent);
|
|
1328
|
+
if (metaMatch) {
|
|
1329
|
+
return {
|
|
1330
|
+
kind: "reject",
|
|
1331
|
+
reason: "meta-narration",
|
|
1332
|
+
matched: metaMatch,
|
|
1333
|
+
summary: `[save_last_response REJECTED] Your output was internal reasoning / meta-narration (e.g. "Let me re-read\u2026", "the user is asking me to\u2026") instead of the requested document body (matched: ${metaMatch}). ${saveToFile} was NOT saved.
|
|
1334
|
+
|
|
1335
|
+
This fresh stream has NO tools. Produce ONLY the document body: start with a markdown heading like "# \u5BA1\u8BA1\u62A5\u544A" / "# Audit Report" and write the full content. Do NOT narrate that you will produce the document \u2014 produce it.`
|
|
1336
|
+
};
|
|
1337
|
+
}
|
|
1338
|
+
const pseudoMatch = detectPseudoToolCalls(rawContent);
|
|
1339
|
+
if (pseudoMatch) {
|
|
1340
|
+
const cleaned = stripPseudoToolCalls(rawContent);
|
|
1341
|
+
if (looksLikeDocumentBody(cleaned)) {
|
|
1342
|
+
const { lines: lines2, bytes: bytes2 } = teeFileStats(cleaned);
|
|
1343
|
+
return {
|
|
1344
|
+
kind: "salvaged",
|
|
1345
|
+
content: cleaned,
|
|
1346
|
+
matched: pseudoMatch,
|
|
1347
|
+
summary: `File saved (with cleanup): ${saveToFile} (${lines2} lines, ${bytes2} bytes; pseudo-tool-call markup matching ${pseudoMatch} was stripped before save)`
|
|
1348
|
+
};
|
|
1349
|
+
}
|
|
1350
|
+
return {
|
|
1351
|
+
kind: "reject",
|
|
1352
|
+
reason: "pseudo-tool-call",
|
|
1353
|
+
matched: pseudoMatch,
|
|
1354
|
+
summary: `[save_last_response REJECTED] Your output was tool-call markup with no usable document body (matched: ${pseudoMatch}). ${saveToFile} was NOT saved.
|
|
1355
|
+
|
|
1356
|
+
This fresh stream has NO tools \u2014 output is captured verbatim. STOP emitting <tool_call>, <function_calls>, <invoke>, <think>, or JSON tool blocks. Produce the document body NOW: start with a markdown heading like "# \u5BA1\u8BA1\u62A5\u544A" and write the full report.`
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1359
|
+
const { lines, bytes } = teeFileStats(rawContent);
|
|
1360
|
+
return {
|
|
1361
|
+
kind: "ok",
|
|
1362
|
+
content: rawContent,
|
|
1363
|
+
summary: `File saved: ${saveToFile} (${lines} lines, ${bytes} bytes)`
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
function teeStreamErrorSummary(saveToFile, errMsg) {
|
|
1367
|
+
return `[save_last_response failed] streaming was interrupted: ${errMsg}. ${saveToFile} (partial) was deleted. Retry \u2014 and consider producing a more compact output (split very large reports across multiple save_last_response calls if the previous attempt timed out).`;
|
|
1368
|
+
}
|
|
1323
1369
|
|
|
1324
1370
|
// src/core/agent-loop.ts
|
|
1325
1371
|
function partialTagTail(s, tag) {
|
|
@@ -3125,13 +3171,11 @@ export {
|
|
|
3125
3171
|
TOOL_CALL_REMINDER,
|
|
3126
3172
|
buildWriteRoundReminder,
|
|
3127
3173
|
extractWrittenFilePaths,
|
|
3128
|
-
detectPseudoToolCalls,
|
|
3129
|
-
stripPseudoToolCalls,
|
|
3130
|
-
detectMetaNarration,
|
|
3131
|
-
looksLikeDocumentBody,
|
|
3132
3174
|
stripToolCallReminder,
|
|
3133
3175
|
TEE_FINAL_USER_NUDGE,
|
|
3134
3176
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
3177
|
+
evaluateTeeContent,
|
|
3178
|
+
teeStreamErrorSummary,
|
|
3135
3179
|
ThinkTagFilter,
|
|
3136
3180
|
consumeToolCallStream,
|
|
3137
3181
|
accumulateUsage,
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "./chunk-T2NL5ZIA.js";
|
|
6
6
|
import {
|
|
7
7
|
runTestsTool
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HSQAKOYX.js";
|
|
9
9
|
import {
|
|
10
10
|
runTool
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-Y3PNCW7A.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-ASVBZIUE.js";
|
|
29
29
|
import {
|
|
30
30
|
fileCheckpoints
|
|
31
31
|
} from "./chunk-4BKXL7SM.js";
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-HLWUDRBO.js";
|
|
7
7
|
import {
|
|
8
8
|
ProviderRegistry
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JTLPYPT3.js";
|
|
10
10
|
import "./chunk-HIU2SH4V.js";
|
|
11
11
|
import {
|
|
12
12
|
ConfigManager
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-XDH5EFWC.js";
|
|
14
14
|
import "./chunk-TZQHYZKT.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ASVBZIUE.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/ci.ts
|
|
20
20
|
import { execFileSync, execSync } from "child_process";
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getConfigDirUsage,
|
|
4
4
|
listRecentCrashes
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TRV47UK4.js";
|
|
6
6
|
import {
|
|
7
7
|
ProviderRegistry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JTLPYPT3.js";
|
|
9
9
|
import {
|
|
10
10
|
getStatsSnapshot,
|
|
11
11
|
getTopFailingTools,
|
|
12
12
|
getTopUsedTools,
|
|
13
13
|
resetStats
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Y3PNCW7A.js";
|
|
15
15
|
import "./chunk-HIU2SH4V.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigManager
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-XDH5EFWC.js";
|
|
19
19
|
import "./chunk-TZQHYZKT.js";
|
|
20
20
|
import {
|
|
21
21
|
DEV_STATE_FILE_NAME,
|
|
22
22
|
MEMORY_FILE_NAME,
|
|
23
23
|
VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-ASVBZIUE.js";
|
|
25
25
|
import "./chunk-IW3Q7AE5.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-6Z42O3DN.js";
|
|
40
40
|
import {
|
|
41
41
|
hasSemanticIndex,
|
|
42
42
|
semanticSearch
|
|
@@ -1965,6 +1965,52 @@ You are now in a CONTENT-ONLY streaming pass. The file at the configured path wi
|
|
|
1965
1965
|
- If you accidentally start a <tool_call>, STOP and produce the document body instead.
|
|
1966
1966
|
|
|
1967
1967
|
The file is closed and named when this stream ends. If your output contains pseudo-tool-call markup, the save will be REJECTED and you will be asked to retry.`;
|
|
1968
|
+
function teeFileStats(content) {
|
|
1969
|
+
return { lines: content.split("\n").length, bytes: Buffer.byteLength(content, "utf-8") };
|
|
1970
|
+
}
|
|
1971
|
+
function evaluateTeeContent(rawContent, saveToFile) {
|
|
1972
|
+
const metaMatch = detectMetaNarration(rawContent);
|
|
1973
|
+
if (metaMatch) {
|
|
1974
|
+
return {
|
|
1975
|
+
kind: "reject",
|
|
1976
|
+
reason: "meta-narration",
|
|
1977
|
+
matched: metaMatch,
|
|
1978
|
+
summary: `[save_last_response REJECTED] Your output was internal reasoning / meta-narration (e.g. "Let me re-read\u2026", "the user is asking me to\u2026") instead of the requested document body (matched: ${metaMatch}). ${saveToFile} was NOT saved.
|
|
1979
|
+
|
|
1980
|
+
This fresh stream has NO tools. Produce ONLY the document body: start with a markdown heading like "# \u5BA1\u8BA1\u62A5\u544A" / "# Audit Report" and write the full content. Do NOT narrate that you will produce the document \u2014 produce it.`
|
|
1981
|
+
};
|
|
1982
|
+
}
|
|
1983
|
+
const pseudoMatch = detectPseudoToolCalls(rawContent);
|
|
1984
|
+
if (pseudoMatch) {
|
|
1985
|
+
const cleaned = stripPseudoToolCalls(rawContent);
|
|
1986
|
+
if (looksLikeDocumentBody(cleaned)) {
|
|
1987
|
+
const { lines: lines2, bytes: bytes2 } = teeFileStats(cleaned);
|
|
1988
|
+
return {
|
|
1989
|
+
kind: "salvaged",
|
|
1990
|
+
content: cleaned,
|
|
1991
|
+
matched: pseudoMatch,
|
|
1992
|
+
summary: `File saved (with cleanup): ${saveToFile} (${lines2} lines, ${bytes2} bytes; pseudo-tool-call markup matching ${pseudoMatch} was stripped before save)`
|
|
1993
|
+
};
|
|
1994
|
+
}
|
|
1995
|
+
return {
|
|
1996
|
+
kind: "reject",
|
|
1997
|
+
reason: "pseudo-tool-call",
|
|
1998
|
+
matched: pseudoMatch,
|
|
1999
|
+
summary: `[save_last_response REJECTED] Your output was tool-call markup with no usable document body (matched: ${pseudoMatch}). ${saveToFile} was NOT saved.
|
|
2000
|
+
|
|
2001
|
+
This fresh stream has NO tools \u2014 output is captured verbatim. STOP emitting <tool_call>, <function_calls>, <invoke>, <think>, or JSON tool blocks. Produce the document body NOW: start with a markdown heading like "# \u5BA1\u8BA1\u62A5\u544A" and write the full report.`
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
2004
|
+
const { lines, bytes } = teeFileStats(rawContent);
|
|
2005
|
+
return {
|
|
2006
|
+
kind: "ok",
|
|
2007
|
+
content: rawContent,
|
|
2008
|
+
summary: `File saved: ${saveToFile} (${lines} lines, ${bytes} bytes)`
|
|
2009
|
+
};
|
|
2010
|
+
}
|
|
2011
|
+
function teeStreamErrorSummary(saveToFile, errMsg) {
|
|
2012
|
+
return `[save_last_response failed] streaming was interrupted: ${errMsg}. ${saveToFile} (partial) was deleted. Retry \u2014 and consider producing a more compact output (split very large reports across multiple save_last_response calls if the previous attempt timed out).`;
|
|
2013
|
+
}
|
|
1968
2014
|
|
|
1969
2015
|
// src/core/agent-loop.ts
|
|
1970
2016
|
function partialTagTail(s, tag) {
|
|
@@ -12965,53 +13011,21 @@ ${summaryContent}`,
|
|
|
12965
13011
|
await new Promise((resolve7, reject) => {
|
|
12966
13012
|
fileStream.end((err) => err ? reject(err) : resolve7());
|
|
12967
13013
|
});
|
|
12968
|
-
const
|
|
12969
|
-
if (
|
|
13014
|
+
const verdict = evaluateTeeContent(fullContent, saveToFile);
|
|
13015
|
+
if (verdict.kind === "reject") {
|
|
12970
13016
|
try {
|
|
12971
13017
|
unlinkSync4(saveToFile);
|
|
12972
13018
|
} catch {
|
|
12973
13019
|
}
|
|
12974
13020
|
isError = true;
|
|
12975
|
-
summary =
|
|
12976
|
-
|
|
12977
|
-
This fresh stream has NO tools. Produce ONLY the document body: start with a markdown heading and write the full content. Do NOT narrate that you will produce the document \u2014 produce it.`;
|
|
12978
|
-
if (teeUsage) {
|
|
12979
|
-
roundUsage.inputTokens += teeUsage.inputTokens;
|
|
12980
|
-
roundUsage.outputTokens += teeUsage.outputTokens;
|
|
12981
|
-
roundUsage.cacheCreationTokens += teeUsage.cacheCreationTokens ?? 0;
|
|
12982
|
-
roundUsage.cacheReadTokens += teeUsage.cacheReadTokens ?? 0;
|
|
12983
|
-
}
|
|
12984
|
-
this.send({
|
|
12985
|
-
type: "tool_call_result",
|
|
12986
|
-
callId: call.id,
|
|
12987
|
-
toolName: call.name,
|
|
12988
|
-
content: summary,
|
|
12989
|
-
isError: true
|
|
12990
|
-
});
|
|
12991
|
-
return { content: "", summary, isError: true };
|
|
12992
|
-
}
|
|
12993
|
-
const pseudoMatch = detectPseudoToolCalls(fullContent);
|
|
12994
|
-
if (pseudoMatch) {
|
|
12995
|
-
const cleaned = stripPseudoToolCalls(fullContent);
|
|
12996
|
-
if (looksLikeDocumentBody(cleaned)) {
|
|
12997
|
-
writeFileSync7(saveToFile, cleaned, "utf-8");
|
|
12998
|
-
fullContent = cleaned;
|
|
12999
|
-
const lines = cleaned.split("\n").length;
|
|
13000
|
-
const bytes = Buffer.byteLength(cleaned, "utf-8");
|
|
13001
|
-
summary = `File saved (with cleanup): ${saveToFile} (${lines} lines, ${bytes} bytes; pseudo-tool-call markup matching ${pseudoMatch} was stripped before save)`;
|
|
13002
|
-
undoStack.push(saveToFile, `save_last_response: ${saveToFile}`);
|
|
13003
|
-
} else {
|
|
13004
|
-
try {
|
|
13005
|
-
unlinkSync4(saveToFile);
|
|
13006
|
-
} catch {
|
|
13007
|
-
}
|
|
13008
|
-
isError = true;
|
|
13009
|
-
summary = `[save_last_response REJECTED] Your output was tool-call markup with no usable document body (matched: ${pseudoMatch}). ${saveToFile} was NOT saved. This fresh stream has NO tools \u2014 output is captured verbatim. STOP emitting <tool_call>, <function_calls>, <invoke>, <think>, or JSON tool blocks. Produce the document body NOW: start with a markdown heading and write the full content.`;
|
|
13010
|
-
}
|
|
13021
|
+
summary = verdict.summary;
|
|
13022
|
+
fullContent = "";
|
|
13011
13023
|
} else {
|
|
13012
|
-
|
|
13013
|
-
|
|
13014
|
-
|
|
13024
|
+
if (verdict.kind === "salvaged") {
|
|
13025
|
+
writeFileSync7(saveToFile, verdict.content, "utf-8");
|
|
13026
|
+
fullContent = verdict.content;
|
|
13027
|
+
}
|
|
13028
|
+
summary = verdict.summary;
|
|
13015
13029
|
undoStack.push(saveToFile, `save_last_response: ${saveToFile}`);
|
|
13016
13030
|
}
|
|
13017
13031
|
if (teeUsage) {
|
|
@@ -13033,7 +13047,7 @@ This fresh stream has NO tools. Produce ONLY the document body: start with a mar
|
|
|
13033
13047
|
}
|
|
13034
13048
|
isError = true;
|
|
13035
13049
|
const msg = err instanceof Error ? err.message : String(err);
|
|
13036
|
-
summary =
|
|
13050
|
+
summary = teeStreamErrorSummary(saveToFile, msg);
|
|
13037
13051
|
}
|
|
13038
13052
|
this.send({
|
|
13039
13053
|
type: "tool_call_result",
|
|
@@ -14076,7 +14090,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
14076
14090
|
case "test": {
|
|
14077
14091
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
14078
14092
|
try {
|
|
14079
|
-
const { executeTests } = await import("./run-tests-
|
|
14093
|
+
const { executeTests } = await import("./run-tests-H3VCHOJB.js");
|
|
14080
14094
|
const argStr = args.join(" ").trim();
|
|
14081
14095
|
let testArgs = {};
|
|
14082
14096
|
if (argStr) {
|
|
@@ -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-VFCQGTYA.js");
|
|
158
158
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
159
159
|
let interrupted = false;
|
|
160
160
|
const onSigint = () => {
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
saveDevState,
|
|
16
16
|
sessionHasMeaningfulContent,
|
|
17
17
|
setupProxy
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-IMSENBJ6.js";
|
|
19
19
|
import {
|
|
20
20
|
ToolExecutor,
|
|
21
21
|
ToolRegistry,
|
|
@@ -34,10 +34,10 @@ import {
|
|
|
34
34
|
spawnAgentContext,
|
|
35
35
|
theme,
|
|
36
36
|
undoStack
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-RQ7JVLFM.js";
|
|
38
38
|
import "./chunk-T2NL5ZIA.js";
|
|
39
39
|
import "./chunk-BXP6YZ2P.js";
|
|
40
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-HSQAKOYX.js";
|
|
41
41
|
import {
|
|
42
42
|
SessionManager,
|
|
43
43
|
getContentText
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
getConfigDirUsage,
|
|
55
55
|
listRecentCrashes,
|
|
56
56
|
writeCrashLog
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-TRV47UK4.js";
|
|
58
58
|
import {
|
|
59
59
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
60
60
|
ProviderRegistry,
|
|
@@ -65,24 +65,22 @@ import {
|
|
|
65
65
|
buildRoundBudgetHint,
|
|
66
66
|
buildWriteRoundReminder,
|
|
67
67
|
consumeToolCallStream,
|
|
68
|
-
|
|
69
|
-
detectPseudoToolCalls,
|
|
68
|
+
evaluateTeeContent,
|
|
70
69
|
extractWrittenFilePaths,
|
|
71
|
-
looksLikeDocumentBody,
|
|
72
70
|
runAgentLoop,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} from "./chunk-
|
|
71
|
+
stripToolCallReminder,
|
|
72
|
+
teeStreamErrorSummary
|
|
73
|
+
} from "./chunk-JTLPYPT3.js";
|
|
76
74
|
import {
|
|
77
75
|
getStatsSnapshot,
|
|
78
76
|
getTopFailingTools,
|
|
79
77
|
getTopUsedTools,
|
|
80
78
|
installFlushOnExit
|
|
81
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-Y3PNCW7A.js";
|
|
82
80
|
import "./chunk-HIU2SH4V.js";
|
|
83
81
|
import {
|
|
84
82
|
ConfigManager
|
|
85
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-XDH5EFWC.js";
|
|
86
84
|
import {
|
|
87
85
|
AuthError,
|
|
88
86
|
ProviderError,
|
|
@@ -109,7 +107,7 @@ import {
|
|
|
109
107
|
SKILLS_DIR_NAME,
|
|
110
108
|
VERSION,
|
|
111
109
|
buildUserIdentityPrompt
|
|
112
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-ASVBZIUE.js";
|
|
113
111
|
import {
|
|
114
112
|
formatGitContextForPrompt,
|
|
115
113
|
getGitContext,
|
|
@@ -1824,7 +1822,7 @@ No tools match "${filter}".
|
|
|
1824
1822
|
const { join: join5 } = await import("path");
|
|
1825
1823
|
const { existsSync: existsSync5 } = await import("fs");
|
|
1826
1824
|
const { getGitRoot: getGitRoot2 } = await import("./git-context-EXOEHQSF.js");
|
|
1827
|
-
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-
|
|
1825
|
+
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-3T5G34S5.js");
|
|
1828
1826
|
const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
|
|
1829
1827
|
const cwd = process.cwd();
|
|
1830
1828
|
const projectRoot = getGitRoot2(cwd) ?? cwd;
|
|
@@ -2885,7 +2883,7 @@ ${hint}` : "")
|
|
|
2885
2883
|
usage: "/test [command|filter]",
|
|
2886
2884
|
async execute(args, ctx) {
|
|
2887
2885
|
try {
|
|
2888
|
-
const { executeTests } = await import("./run-tests-
|
|
2886
|
+
const { executeTests } = await import("./run-tests-X2MCBIKN.js");
|
|
2889
2887
|
const argStr = args.join(" ").trim();
|
|
2890
2888
|
let testArgs = {};
|
|
2891
2889
|
if (argStr) {
|
|
@@ -6827,113 +6825,72 @@ Tip: You can continue the conversation by asking the AI to proceed.`
|
|
|
6827
6825
|
));
|
|
6828
6826
|
const errorResults = toolCalls.map((tc) => ({
|
|
6829
6827
|
callId: tc.id,
|
|
6830
|
-
content: tc.name === "save_last_response" ?
|
|
6828
|
+
content: tc.name === "save_last_response" ? teeStreamErrorSummary(saveToFile, errMsg) : `[skipped: save_last_response failed]`,
|
|
6831
6829
|
isError: tc.name === "save_last_response"
|
|
6832
6830
|
}));
|
|
6833
|
-
const
|
|
6834
|
-
extraMessages.push(...
|
|
6831
|
+
const newMsgs = provider.buildToolResultMessages(toolCalls, errorResults, reasoningContent);
|
|
6832
|
+
extraMessages.push(...newMsgs);
|
|
6835
6833
|
return "continue";
|
|
6836
6834
|
}
|
|
6837
|
-
|
|
6838
|
-
|
|
6835
|
+
if (genUsage) accumulateUsage(usage, genUsage);
|
|
6836
|
+
const verdict = evaluateTeeContent(genContent, saveToFile);
|
|
6837
|
+
if (verdict.kind === "reject") {
|
|
6839
6838
|
try {
|
|
6840
6839
|
unlinkSync2(saveToFile);
|
|
6841
6840
|
} catch {
|
|
6842
6841
|
}
|
|
6842
|
+
const label = verdict.reason === "meta-narration" ? "meta-narration / leaked reasoning, not document body" : "pseudo-tool-call markup with no usable document body";
|
|
6843
6843
|
process.stdout.write(theme.error(
|
|
6844
6844
|
`
|
|
6845
|
-
\u2717 Rejected save: response was
|
|
6845
|
+
\u2717 Rejected save: response was ${label} (matched: ${verdict.matched})
|
|
6846
6846
|
${saveToFile} was deleted; asking model to retry.
|
|
6847
6847
|
|
|
6848
6848
|
`
|
|
6849
6849
|
));
|
|
6850
6850
|
const errorResults = toolCalls.map((tc) => ({
|
|
6851
6851
|
callId: tc.id,
|
|
6852
|
-
content: tc.name === "save_last_response" ? `[save_last_response
|
|
6853
|
-
|
|
6854
|
-
This fresh stream has NO tools. Produce ONLY the document body: start with a markdown heading like "# \u5BA1\u8BA1\u62A5\u544A" / "# Audit Report" and write the full content. Do NOT narrate that you will produce the document \u2014 produce it.` : `[skipped: save_last_response was rejected and other parallel calls are abandoned]`,
|
|
6852
|
+
content: tc.name === "save_last_response" ? verdict.summary : `[skipped: save_last_response was rejected and other parallel calls are abandoned]`,
|
|
6855
6853
|
isError: tc.name === "save_last_response"
|
|
6856
6854
|
}));
|
|
6857
|
-
|
|
6858
|
-
extraMessages.push(...newMsgs2);
|
|
6859
|
-
if (genUsage) accumulateUsage(usage, genUsage);
|
|
6855
|
+
extraMessages.push(...provider.buildToolResultMessages(toolCalls, errorResults, reasoningContent));
|
|
6860
6856
|
return "continue";
|
|
6861
6857
|
}
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
`
|
|
6870
|
-
\u26A0 Salvaged save: stripped pseudo-tool-call markup (matched: ${pseudoMatch})
|
|
6871
|
-
${saveToFile} now contains the cleaned document (${cleaned.length} chars; was ${genContent.length}).
|
|
6858
|
+
if (verdict.kind === "salvaged") {
|
|
6859
|
+
try {
|
|
6860
|
+
writeFileSync2(saveToFile, verdict.content, "utf-8");
|
|
6861
|
+
process.stdout.write(theme.warning(
|
|
6862
|
+
`
|
|
6863
|
+
\u26A0 Salvaged save: stripped pseudo-tool-call markup (matched: ${verdict.matched})
|
|
6864
|
+
${saveToFile} now contains the cleaned document (${verdict.content.length} chars; was ${genContent.length}).
|
|
6872
6865
|
|
|
6873
6866
|
`
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
const lines2 = cleaned.split("\n").length;
|
|
6880
|
-
const bytes2 = Buffer.byteLength(cleaned, "utf-8");
|
|
6881
|
-
const okResults = toolCalls.map((tc) => ({
|
|
6882
|
-
callId: tc.id,
|
|
6883
|
-
content: tc.name === "save_last_response" ? `File saved (with cleanup): ${saveToFile} (${lines2} lines, ${bytes2} bytes; pseudo-tool-call markup was stripped before save)` : `[skipped: file already saved by tee streaming]`,
|
|
6884
|
-
isError: false
|
|
6885
|
-
}));
|
|
6886
|
-
const newMsgs3 = provider.buildToolResultMessages(toolCalls, okResults, reasoningContent);
|
|
6887
|
-
extraMessages.push(...newMsgs3);
|
|
6888
|
-
if (usage.inputTokens > 0 || usage.outputTokens > 0) {
|
|
6889
|
-
this.addSessionUsage(usage, effectiveModel);
|
|
6890
|
-
session.addTokenUsage(usage);
|
|
6891
|
-
if (teeShowTokens && !teeTokShown) {
|
|
6892
|
-
this.renderer.renderUsage(usage, this.sessionTokenUsage);
|
|
6893
|
-
}
|
|
6894
|
-
}
|
|
6895
|
-
return "stop";
|
|
6896
|
-
} catch (writeErr) {
|
|
6897
|
-
process.stderr.write(`[tee] salvage write failed: ${writeErr.message ?? writeErr}
|
|
6898
|
-
`);
|
|
6867
|
+
));
|
|
6868
|
+
} catch (writeErr) {
|
|
6869
|
+
try {
|
|
6870
|
+
unlinkSync2(saveToFile);
|
|
6871
|
+
} catch {
|
|
6899
6872
|
}
|
|
6873
|
+
process.stderr.write(`[tee] salvage write failed: ${writeErr.message ?? writeErr}
|
|
6874
|
+
`);
|
|
6875
|
+
const errorResults = toolCalls.map((tc) => ({
|
|
6876
|
+
callId: tc.id,
|
|
6877
|
+
content: tc.name === "save_last_response" ? `[save_last_response failed] could not write the cleaned document to ${saveToFile}: ${writeErr.message ?? writeErr}. Retry.` : `[skipped: save_last_response failed]`,
|
|
6878
|
+
isError: tc.name === "save_last_response"
|
|
6879
|
+
}));
|
|
6880
|
+
extraMessages.push(...provider.buildToolResultMessages(toolCalls, errorResults, reasoningContent));
|
|
6881
|
+
return "continue";
|
|
6900
6882
|
}
|
|
6901
|
-
try {
|
|
6902
|
-
unlinkSync2(saveToFile);
|
|
6903
|
-
} catch {
|
|
6904
|
-
}
|
|
6905
|
-
process.stdout.write(theme.error(
|
|
6906
|
-
`
|
|
6907
|
-
\u2717 Rejected save: response was pseudo-tool-call markup with no usable document body (matched: ${pseudoMatch})
|
|
6908
|
-
${saveToFile} was deleted; asking model to retry.
|
|
6909
|
-
|
|
6910
|
-
`
|
|
6911
|
-
));
|
|
6912
|
-
const errorResults = toolCalls.map((tc) => ({
|
|
6913
|
-
callId: tc.id,
|
|
6914
|
-
content: tc.name === "save_last_response" ? `[save_last_response REJECTED] Your output was tool-call XML/JSON with no document body. ${saveToFile} was NOT saved.
|
|
6915
|
-
|
|
6916
|
-
This fresh stream has NO tools \u2014 output is captured verbatim. STOP emitting <tool_call>, <function_calls>, <invoke>, <think>, or JSON tool blocks. Produce the document body NOW: start with a markdown heading like "# \u5BA1\u8BA1\u62A5\u544A" and write the full report.` : `[skipped: save_last_response was rejected and other parallel calls are abandoned]`,
|
|
6917
|
-
isError: tc.name === "save_last_response"
|
|
6918
|
-
}));
|
|
6919
|
-
const newMsgs2 = provider.buildToolResultMessages(toolCalls, errorResults, reasoningContent);
|
|
6920
|
-
extraMessages.push(...newMsgs2);
|
|
6921
|
-
if (genUsage) accumulateUsage(usage, genUsage);
|
|
6922
|
-
return "continue";
|
|
6923
6883
|
}
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
session.addMessage({ role: "assistant", content:
|
|
6927
|
-
this.events.emit("message.after", { content:
|
|
6928
|
-
const
|
|
6929
|
-
const bytes = Buffer.byteLength(genContent, "utf-8");
|
|
6930
|
-
const syntheticResults = toolCalls.map((tc) => ({
|
|
6884
|
+
const finalContent = verdict.content;
|
|
6885
|
+
lastResponseStore.content = finalContent;
|
|
6886
|
+
session.addMessage({ role: "assistant", content: finalContent, timestamp: /* @__PURE__ */ new Date() });
|
|
6887
|
+
this.events.emit("message.after", { content: finalContent });
|
|
6888
|
+
const okResults = toolCalls.map((tc) => ({
|
|
6931
6889
|
callId: tc.id,
|
|
6932
|
-
content: tc.name === "save_last_response" ?
|
|
6890
|
+
content: tc.name === "save_last_response" ? verdict.summary : `[skipped: file already saved by tee streaming]`,
|
|
6933
6891
|
isError: false
|
|
6934
6892
|
}));
|
|
6935
|
-
|
|
6936
|
-
extraMessages.push(...newMsgs);
|
|
6893
|
+
extraMessages.push(...provider.buildToolResultMessages(toolCalls, okResults, reasoningContent));
|
|
6937
6894
|
if (usage.inputTokens > 0 || usage.outputTokens > 0) {
|
|
6938
6895
|
this.addSessionUsage(usage, effectiveModel);
|
|
6939
6896
|
session.addTokenUsage(usage);
|
|
@@ -7256,7 +7213,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
7256
7213
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
7257
7214
|
process.exit(1);
|
|
7258
7215
|
}
|
|
7259
|
-
const { startWebServer } = await import("./server-
|
|
7216
|
+
const { startWebServer } = await import("./server-TJDKEECG.js");
|
|
7260
7217
|
await startWebServer({ port, host: options.host });
|
|
7261
7218
|
});
|
|
7262
7219
|
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) => {
|
|
@@ -7423,16 +7380,16 @@ program.command("sessions").description("List recent conversation sessions").opt
|
|
|
7423
7380
|
console.log(footer + "\n");
|
|
7424
7381
|
});
|
|
7425
7382
|
program.command("usage").description("Show token + cost usage grouped by provider/model (cross-session)").option("--days <n>", "Only the last N days (inclusive of today)").option("--month <ym>", "Only a specific month, format YYYY-MM (e.g. 2026-06)").option("--json", "Output as JSON (for scripting)").action(async (options) => {
|
|
7426
|
-
const { runUsageCli } = await import("./usage-
|
|
7383
|
+
const { runUsageCli } = await import("./usage-FYKIOPJI.js");
|
|
7427
7384
|
await runUsageCli(options);
|
|
7428
7385
|
});
|
|
7429
7386
|
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) => {
|
|
7430
|
-
const { runDoctorCli } = await import("./doctor-cli-
|
|
7387
|
+
const { runDoctorCli } = await import("./doctor-cli-3QE7FZKB.js");
|
|
7431
7388
|
await runDoctorCli({ json: !!options.json, resetStats: !!options.resetStats });
|
|
7432
7389
|
});
|
|
7433
7390
|
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) => {
|
|
7434
7391
|
try {
|
|
7435
|
-
const batch = await import("./batch-
|
|
7392
|
+
const batch = await import("./batch-4XSN4VF7.js");
|
|
7436
7393
|
switch (action) {
|
|
7437
7394
|
case "submit":
|
|
7438
7395
|
if (!arg) {
|
|
@@ -7475,7 +7432,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
|
|
|
7475
7432
|
}
|
|
7476
7433
|
});
|
|
7477
7434
|
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) => {
|
|
7478
|
-
const { startMcpServer } = await import("./server-
|
|
7435
|
+
const { startMcpServer } = await import("./server-FE7XTYVC.js");
|
|
7479
7436
|
await startMcpServer({
|
|
7480
7437
|
allowDestructive: !!options.allowDestructive,
|
|
7481
7438
|
allowOutsideCwd: !!options.allowOutsideCwd,
|
|
@@ -7484,7 +7441,7 @@ program.command("mcp-serve").description("Start an MCP server over STDIO, exposi
|
|
|
7484
7441
|
});
|
|
7485
7442
|
});
|
|
7486
7443
|
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) => {
|
|
7487
|
-
const { runCi } = await import("./ci-
|
|
7444
|
+
const { runCi } = await import("./ci-USJCTRP7.js");
|
|
7488
7445
|
const result = await runCi({
|
|
7489
7446
|
pr: options.pr,
|
|
7490
7447
|
base: options.base,
|
|
@@ -7630,7 +7587,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
7630
7587
|
}),
|
|
7631
7588
|
config.get("customProviders")
|
|
7632
7589
|
);
|
|
7633
|
-
const { startHub } = await import("./hub-
|
|
7590
|
+
const { startHub } = await import("./hub-LABDYMAE.js");
|
|
7634
7591
|
await startHub(
|
|
7635
7592
|
{
|
|
7636
7593
|
topic: topic ?? "",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ToolRegistry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RQ7JVLFM.js";
|
|
5
5
|
import "./chunk-T2NL5ZIA.js";
|
|
6
6
|
import "./chunk-BXP6YZ2P.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-HSQAKOYX.js";
|
|
8
8
|
import {
|
|
9
9
|
runTool
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-Y3PNCW7A.js";
|
|
11
11
|
import {
|
|
12
12
|
getDangerLevel,
|
|
13
13
|
schemaToJsonSchema
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import "./chunk-TZQHYZKT.js";
|
|
16
16
|
import {
|
|
17
17
|
VERSION
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ASVBZIUE.js";
|
|
19
19
|
import "./chunk-4BKXL7SM.js";
|
|
20
20
|
import "./chunk-TB4W4Y4T.js";
|
|
21
21
|
import "./chunk-KHYD3WXE.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
loadDevState,
|
|
20
20
|
persistToolRound,
|
|
21
21
|
setupProxy
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-IMSENBJ6.js";
|
|
23
23
|
import {
|
|
24
24
|
ToolExecutor,
|
|
25
25
|
ToolRegistry,
|
|
@@ -37,10 +37,10 @@ import {
|
|
|
37
37
|
spawnAgentContext,
|
|
38
38
|
truncateOutput,
|
|
39
39
|
undoStack
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-RQ7JVLFM.js";
|
|
41
41
|
import "./chunk-T2NL5ZIA.js";
|
|
42
42
|
import "./chunk-BXP6YZ2P.js";
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-HSQAKOYX.js";
|
|
44
44
|
import {
|
|
45
45
|
SessionManager,
|
|
46
46
|
getContentText
|
|
@@ -56,22 +56,20 @@ import {
|
|
|
56
56
|
TOOL_CALL_REMINDER,
|
|
57
57
|
buildRoundBudgetHint,
|
|
58
58
|
consumeToolCallStream,
|
|
59
|
-
|
|
60
|
-
detectPseudoToolCalls,
|
|
61
|
-
looksLikeDocumentBody,
|
|
59
|
+
evaluateTeeContent,
|
|
62
60
|
runAgentLoop,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
} from "./chunk-
|
|
61
|
+
stripToolCallReminder,
|
|
62
|
+
teeStreamErrorSummary
|
|
63
|
+
} from "./chunk-JTLPYPT3.js";
|
|
66
64
|
import {
|
|
67
65
|
runTool
|
|
68
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-Y3PNCW7A.js";
|
|
69
67
|
import {
|
|
70
68
|
getDangerLevel
|
|
71
69
|
} from "./chunk-HIU2SH4V.js";
|
|
72
70
|
import {
|
|
73
71
|
ConfigManager
|
|
74
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-XDH5EFWC.js";
|
|
75
73
|
import "./chunk-TZQHYZKT.js";
|
|
76
74
|
import {
|
|
77
75
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
@@ -91,7 +89,7 @@ import {
|
|
|
91
89
|
SKILLS_DIR_NAME,
|
|
92
90
|
VERSION,
|
|
93
91
|
buildUserIdentityPrompt
|
|
94
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-ASVBZIUE.js";
|
|
95
93
|
import {
|
|
96
94
|
formatGitContextForPrompt,
|
|
97
95
|
getGitContext,
|
|
@@ -1326,53 +1324,21 @@ ${summaryContent}`,
|
|
|
1326
1324
|
await new Promise((resolve3, reject) => {
|
|
1327
1325
|
fileStream.end((err) => err ? reject(err) : resolve3());
|
|
1328
1326
|
});
|
|
1329
|
-
const
|
|
1330
|
-
if (
|
|
1327
|
+
const verdict = evaluateTeeContent(fullContent, saveToFile);
|
|
1328
|
+
if (verdict.kind === "reject") {
|
|
1331
1329
|
try {
|
|
1332
1330
|
unlinkSync(saveToFile);
|
|
1333
1331
|
} catch {
|
|
1334
1332
|
}
|
|
1335
1333
|
isError = true;
|
|
1336
|
-
summary =
|
|
1337
|
-
|
|
1338
|
-
This fresh stream has NO tools. Produce ONLY the document body: start with a markdown heading and write the full content. Do NOT narrate that you will produce the document \u2014 produce it.`;
|
|
1339
|
-
if (teeUsage) {
|
|
1340
|
-
roundUsage.inputTokens += teeUsage.inputTokens;
|
|
1341
|
-
roundUsage.outputTokens += teeUsage.outputTokens;
|
|
1342
|
-
roundUsage.cacheCreationTokens += teeUsage.cacheCreationTokens ?? 0;
|
|
1343
|
-
roundUsage.cacheReadTokens += teeUsage.cacheReadTokens ?? 0;
|
|
1344
|
-
}
|
|
1345
|
-
this.send({
|
|
1346
|
-
type: "tool_call_result",
|
|
1347
|
-
callId: call.id,
|
|
1348
|
-
toolName: call.name,
|
|
1349
|
-
content: summary,
|
|
1350
|
-
isError: true
|
|
1351
|
-
});
|
|
1352
|
-
return { content: "", summary, isError: true };
|
|
1353
|
-
}
|
|
1354
|
-
const pseudoMatch = detectPseudoToolCalls(fullContent);
|
|
1355
|
-
if (pseudoMatch) {
|
|
1356
|
-
const cleaned = stripPseudoToolCalls(fullContent);
|
|
1357
|
-
if (looksLikeDocumentBody(cleaned)) {
|
|
1358
|
-
writeFileSync(saveToFile, cleaned, "utf-8");
|
|
1359
|
-
fullContent = cleaned;
|
|
1360
|
-
const lines = cleaned.split("\n").length;
|
|
1361
|
-
const bytes = Buffer.byteLength(cleaned, "utf-8");
|
|
1362
|
-
summary = `File saved (with cleanup): ${saveToFile} (${lines} lines, ${bytes} bytes; pseudo-tool-call markup matching ${pseudoMatch} was stripped before save)`;
|
|
1363
|
-
undoStack.push(saveToFile, `save_last_response: ${saveToFile}`);
|
|
1364
|
-
} else {
|
|
1365
|
-
try {
|
|
1366
|
-
unlinkSync(saveToFile);
|
|
1367
|
-
} catch {
|
|
1368
|
-
}
|
|
1369
|
-
isError = true;
|
|
1370
|
-
summary = `[save_last_response REJECTED] Your output was tool-call markup with no usable document body (matched: ${pseudoMatch}). ${saveToFile} was NOT saved. This fresh stream has NO tools \u2014 output is captured verbatim. STOP emitting <tool_call>, <function_calls>, <invoke>, <think>, or JSON tool blocks. Produce the document body NOW: start with a markdown heading and write the full content.`;
|
|
1371
|
-
}
|
|
1334
|
+
summary = verdict.summary;
|
|
1335
|
+
fullContent = "";
|
|
1372
1336
|
} else {
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1337
|
+
if (verdict.kind === "salvaged") {
|
|
1338
|
+
writeFileSync(saveToFile, verdict.content, "utf-8");
|
|
1339
|
+
fullContent = verdict.content;
|
|
1340
|
+
}
|
|
1341
|
+
summary = verdict.summary;
|
|
1376
1342
|
undoStack.push(saveToFile, `save_last_response: ${saveToFile}`);
|
|
1377
1343
|
}
|
|
1378
1344
|
if (teeUsage) {
|
|
@@ -1394,7 +1360,7 @@ This fresh stream has NO tools. Produce ONLY the document body: start with a mar
|
|
|
1394
1360
|
}
|
|
1395
1361
|
isError = true;
|
|
1396
1362
|
const msg = err instanceof Error ? err.message : String(err);
|
|
1397
|
-
summary =
|
|
1363
|
+
summary = teeStreamErrorSummary(saveToFile, msg);
|
|
1398
1364
|
}
|
|
1399
1365
|
this.send({
|
|
1400
1366
|
type: "tool_call_result",
|
|
@@ -2437,7 +2403,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
2437
2403
|
case "test": {
|
|
2438
2404
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
2439
2405
|
try {
|
|
2440
|
-
const { executeTests } = await import("./run-tests-
|
|
2406
|
+
const { executeTests } = await import("./run-tests-X2MCBIKN.js");
|
|
2441
2407
|
const argStr = args.join(" ").trim();
|
|
2442
2408
|
let testArgs = {};
|
|
2443
2409
|
if (argStr) {
|
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
ToolRegistry,
|
|
4
4
|
googleSearchContext,
|
|
5
5
|
truncateOutput
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RQ7JVLFM.js";
|
|
7
7
|
import "./chunk-T2NL5ZIA.js";
|
|
8
8
|
import "./chunk-BXP6YZ2P.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-HSQAKOYX.js";
|
|
10
10
|
import {
|
|
11
11
|
runTool
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Y3PNCW7A.js";
|
|
13
13
|
import {
|
|
14
14
|
getDangerLevel
|
|
15
15
|
} from "./chunk-HIU2SH4V.js";
|
|
16
16
|
import "./chunk-TZQHYZKT.js";
|
|
17
17
|
import {
|
|
18
18
|
SUBAGENT_ALLOWED_TOOLS
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ASVBZIUE.js";
|
|
20
20
|
import "./chunk-4BKXL7SM.js";
|
|
21
21
|
import "./chunk-TB4W4Y4T.js";
|
|
22
22
|
import "./chunk-KHYD3WXE.js";
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
} from "./chunk-V37XOYOE.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigManager
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-XDH5EFWC.js";
|
|
12
12
|
import "./chunk-TZQHYZKT.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-ASVBZIUE.js";
|
|
14
14
|
import "./chunk-IW3Q7AE5.js";
|
|
15
15
|
|
|
16
16
|
// src/cli/usage.ts
|