jinzd-ai-cli 0.4.54 → 0.4.56
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/{chunk-6FYFVPVE.js → chunk-2DC5ABAM.js} +220 -67
- package/dist/{chunk-NP5KZVP6.js → chunk-7FOGK5TM.js} +1 -1
- package/dist/{chunk-TAR67QTH.js → chunk-FJSEFQ54.js} +1 -1
- package/dist/{chunk-FOFQAEU6.js → chunk-REWBXK2G.js} +1 -1
- package/dist/{hub-6V54V4O3.js → hub-HQ5QX7CV.js} +1 -1
- package/dist/index.js +112 -42
- package/dist/{run-tests-6G65OGSL.js → run-tests-FRHDE3VB.js} +1 -1
- package/dist/{run-tests-P53FNUJY.js → run-tests-GISOOQZC.js} +1 -1
- package/dist/{server-BQHIMEBH.js → server-MOTFJN6L.js} +128 -29
- package/dist/{task-orchestrator-TSY7CJE6.js → task-orchestrator-6RGRKSTU.js} +2 -2
- package/dist/web/client/app.js +63 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,20 +11,23 @@ import {
|
|
|
11
11
|
buildPhantomCorrectionMessage,
|
|
12
12
|
buildWriteRoundReminder,
|
|
13
13
|
clearDevState,
|
|
14
|
+
computeCost,
|
|
14
15
|
detectsHallucinatedFileOp,
|
|
15
16
|
extractWrittenFilePaths,
|
|
16
17
|
findPhantomClaims,
|
|
18
|
+
formatCost,
|
|
17
19
|
formatGitContextForPrompt,
|
|
18
20
|
getContentText,
|
|
19
21
|
getGitContext,
|
|
20
22
|
getGitRoot,
|
|
23
|
+
getPricing,
|
|
21
24
|
hadPreviousWriteToolCalls,
|
|
22
25
|
loadDevState,
|
|
23
26
|
parseSimpleYaml,
|
|
24
27
|
saveDevState,
|
|
25
28
|
sessionHasMeaningfulContent,
|
|
26
29
|
setupProxy
|
|
27
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-2DC5ABAM.js";
|
|
28
31
|
import {
|
|
29
32
|
ToolExecutor,
|
|
30
33
|
ToolRegistry,
|
|
@@ -38,7 +41,7 @@ import {
|
|
|
38
41
|
spawnAgentContext,
|
|
39
42
|
theme,
|
|
40
43
|
undoStack
|
|
41
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-FJSEFQ54.js";
|
|
42
45
|
import {
|
|
43
46
|
fileCheckpoints
|
|
44
47
|
} from "./chunk-4BKXL7SM.js";
|
|
@@ -63,7 +66,7 @@ import {
|
|
|
63
66
|
SKILLS_DIR_NAME,
|
|
64
67
|
VERSION,
|
|
65
68
|
buildUserIdentityPrompt
|
|
66
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-7FOGK5TM.js";
|
|
67
70
|
|
|
68
71
|
// src/index.ts
|
|
69
72
|
import { program } from "commander";
|
|
@@ -487,8 +490,12 @@ Error${typeName}: ${lines.join("\n")}
|
|
|
487
490
|
renderUsage(usage, sessionTotal) {
|
|
488
491
|
const total = usage.inputTokens + usage.outputTokens;
|
|
489
492
|
let line = theme.dim("\u{1F4CA} ") + theme.dim(`in ${usage.inputTokens.toLocaleString()}`) + theme.dim(" + ") + theme.dim(`out ${usage.outputTokens.toLocaleString()}`) + theme.dim(` = ${total.toLocaleString()} tokens`);
|
|
493
|
+
const cacheRead = usage.cacheReadTokens ?? 0;
|
|
494
|
+
if (cacheRead > 0) {
|
|
495
|
+
line += theme.dim(` \u2502 cache: ${cacheRead.toLocaleString()}`);
|
|
496
|
+
}
|
|
490
497
|
if (sessionTotal) {
|
|
491
|
-
const sessionSum = sessionTotal.inputTokens + sessionTotal.outputTokens;
|
|
498
|
+
const sessionSum = sessionTotal.inputTokens + sessionTotal.outputTokens + (sessionTotal.cacheCreationTokens ?? 0) + (sessionTotal.cacheReadTokens ?? 0);
|
|
492
499
|
line += theme.dim(` \u2502 session total: ${sessionSum.toLocaleString()}`);
|
|
493
500
|
}
|
|
494
501
|
process.stdout.write(line + "\n\n");
|
|
@@ -1217,11 +1224,18 @@ function createDefaultCommands() {
|
|
|
1217
1224
|
if (sys) {
|
|
1218
1225
|
console.log(` System : ${sys.slice(0, 60)}...`);
|
|
1219
1226
|
}
|
|
1220
|
-
const
|
|
1227
|
+
const cacheRead = tokenUsage.cacheReadTokens ?? 0;
|
|
1228
|
+
const cacheCreate = tokenUsage.cacheCreationTokens ?? 0;
|
|
1229
|
+
const totalTokens = tokenUsage.inputTokens + tokenUsage.outputTokens + cacheRead + cacheCreate;
|
|
1221
1230
|
if (totalTokens > 0) {
|
|
1231
|
+
const cacheSuffix = cacheRead > 0 || cacheCreate > 0 ? ` [cache: +${cacheCreate.toLocaleString()} / -${cacheRead.toLocaleString()}]` : "";
|
|
1222
1232
|
console.log(
|
|
1223
|
-
` Tokens : in ${tokenUsage.inputTokens.toLocaleString()} + out ${tokenUsage.outputTokens.toLocaleString()} = ${totalTokens.toLocaleString()}
|
|
1233
|
+
` Tokens : in ${tokenUsage.inputTokens.toLocaleString()} + out ${tokenUsage.outputTokens.toLocaleString()} = ${totalTokens.toLocaleString()}${cacheSuffix}`
|
|
1224
1234
|
);
|
|
1235
|
+
const cost = computeCost(ctx.getCurrentProvider(), ctx.getCurrentModel(), tokenUsage);
|
|
1236
|
+
if (cost != null) {
|
|
1237
|
+
console.log(` Cost : ${formatCost(cost)} (session total)`);
|
|
1238
|
+
}
|
|
1225
1239
|
}
|
|
1226
1240
|
const ctxWindowSize = ctx.getContextWindowSize();
|
|
1227
1241
|
if (ctxWindowSize > 0) {
|
|
@@ -1823,7 +1837,7 @@ ${hint}` : "")
|
|
|
1823
1837
|
},
|
|
1824
1838
|
{
|
|
1825
1839
|
name: "cost",
|
|
1826
|
-
description: "Show session token usage
|
|
1840
|
+
description: "Show session token usage, prompt-cache hits, and USD cost",
|
|
1827
1841
|
usage: "/cost [reset]",
|
|
1828
1842
|
execute(args, ctx) {
|
|
1829
1843
|
const sub = args[0]?.toLowerCase();
|
|
@@ -1832,24 +1846,65 @@ ${hint}` : "")
|
|
|
1832
1846
|
ctx.renderer.printSuccess("Session token counters reset.");
|
|
1833
1847
|
return;
|
|
1834
1848
|
}
|
|
1835
|
-
const
|
|
1836
|
-
const
|
|
1849
|
+
const session = ctx.sessions.current;
|
|
1850
|
+
const usage = session?.tokenUsage ?? {
|
|
1851
|
+
inputTokens: 0,
|
|
1852
|
+
outputTokens: 0,
|
|
1853
|
+
cacheCreationTokens: 0,
|
|
1854
|
+
cacheReadTokens: 0
|
|
1855
|
+
};
|
|
1856
|
+
const cacheCreate = usage.cacheCreationTokens ?? 0;
|
|
1857
|
+
const cacheRead = usage.cacheReadTokens ?? 0;
|
|
1858
|
+
const totalTokens = usage.inputTokens + usage.outputTokens + cacheCreate + cacheRead;
|
|
1837
1859
|
if (totalTokens === 0) {
|
|
1838
1860
|
ctx.renderer.printInfo("No token usage recorded this session.");
|
|
1839
1861
|
return;
|
|
1840
1862
|
}
|
|
1863
|
+
const provider = ctx.getCurrentProvider();
|
|
1864
|
+
const model = ctx.getCurrentModel();
|
|
1865
|
+
const cost = computeCost(provider, model, usage);
|
|
1866
|
+
const pricing = getPricing(provider, model);
|
|
1867
|
+
let savings = null;
|
|
1868
|
+
if (cost != null && pricing && cacheRead > 0) {
|
|
1869
|
+
const costWithoutCache = computeCost(provider, model, {
|
|
1870
|
+
inputTokens: usage.inputTokens + cacheRead,
|
|
1871
|
+
outputTokens: usage.outputTokens,
|
|
1872
|
+
cacheCreationTokens: cacheCreate,
|
|
1873
|
+
cacheReadTokens: 0
|
|
1874
|
+
});
|
|
1875
|
+
if (costWithoutCache != null) savings = costWithoutCache - cost;
|
|
1876
|
+
}
|
|
1841
1877
|
console.log();
|
|
1842
|
-
console.log(theme.heading(" \u{
|
|
1843
|
-
console.log(theme.dim(" " + "\u2500".repeat(
|
|
1844
|
-
console.log(theme.dim(" Input
|
|
1845
|
-
console.log(theme.dim(" Output
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1878
|
+
console.log(theme.heading(" \u{1F4B0} Session Cost & Token Usage"));
|
|
1879
|
+
console.log(theme.dim(" " + "\u2500".repeat(48)));
|
|
1880
|
+
console.log(theme.dim(" Input (uncached) : ") + chalk2.white(usage.inputTokens.toLocaleString().padStart(12)));
|
|
1881
|
+
console.log(theme.dim(" Output : ") + chalk2.white(usage.outputTokens.toLocaleString().padStart(12)));
|
|
1882
|
+
if (cacheCreate > 0) {
|
|
1883
|
+
console.log(theme.dim(" Cache write : ") + chalk2.yellow(cacheCreate.toLocaleString().padStart(12)));
|
|
1884
|
+
}
|
|
1885
|
+
if (cacheRead > 0) {
|
|
1886
|
+
const pct = Math.round(cacheRead / (cacheRead + usage.inputTokens) * 100);
|
|
1887
|
+
console.log(
|
|
1888
|
+
theme.dim(" Cache read : ") + chalk2.green(cacheRead.toLocaleString().padStart(12)) + theme.dim(` (${pct}% hit rate)`)
|
|
1889
|
+
);
|
|
1890
|
+
}
|
|
1891
|
+
console.log(theme.dim(" Total tokens : ") + chalk2.bold.white(totalTokens.toLocaleString().padStart(12)));
|
|
1892
|
+
console.log(theme.dim(" " + "\u2500".repeat(48)));
|
|
1893
|
+
if (cost != null) {
|
|
1894
|
+
console.log(theme.dim(" Cost : ") + chalk2.bold.cyan(formatCost(cost).padStart(12)));
|
|
1895
|
+
if (savings != null && savings > 0) {
|
|
1896
|
+
console.log(
|
|
1897
|
+
theme.dim(" Cache savings : ") + chalk2.green(`-${formatCost(savings)}`.padStart(12)) + theme.dim(` (vs no cache)`)
|
|
1898
|
+
);
|
|
1899
|
+
}
|
|
1900
|
+
} else {
|
|
1901
|
+
console.log(theme.dim(" Cost : ") + theme.dim(" \u2014 (pricing unknown)"));
|
|
1902
|
+
}
|
|
1903
|
+
console.log(theme.dim(" " + "\u2500".repeat(48)));
|
|
1849
1904
|
if (session) {
|
|
1850
|
-
console.log(theme.dim(" Provider
|
|
1851
|
-
console.log(theme.dim(" Model
|
|
1852
|
-
console.log(theme.dim(" Messages
|
|
1905
|
+
console.log(theme.dim(" Provider : ") + theme.dim(provider));
|
|
1906
|
+
console.log(theme.dim(" Model : ") + theme.dim(model));
|
|
1907
|
+
console.log(theme.dim(" Messages : ") + theme.dim(String(session.messages.length)));
|
|
1853
1908
|
}
|
|
1854
1909
|
console.log();
|
|
1855
1910
|
}
|
|
@@ -2106,7 +2161,7 @@ ${hint}` : "")
|
|
|
2106
2161
|
usage: "/test [command|filter]",
|
|
2107
2162
|
async execute(args, ctx) {
|
|
2108
2163
|
try {
|
|
2109
|
-
const { executeTests } = await import("./run-tests-
|
|
2164
|
+
const { executeTests } = await import("./run-tests-GISOOQZC.js");
|
|
2110
2165
|
const argStr = args.join(" ").trim();
|
|
2111
2166
|
let testArgs = {};
|
|
2112
2167
|
if (argStr) {
|
|
@@ -3282,7 +3337,7 @@ ${content}
|
|
|
3282
3337
|
var FREE_ROUND_TOOLS = /* @__PURE__ */ new Set(["write_todos"]);
|
|
3283
3338
|
var MAX_CONSECUTIVE_FREE_ROUNDS = 3;
|
|
3284
3339
|
var MAX_REPEATED_TOOL_CALLS = 2;
|
|
3285
|
-
var
|
|
3340
|
+
var DEFAULT_AUTO_PAUSE_INTERVAL = 50;
|
|
3286
3341
|
function fmtTokens(n) {
|
|
3287
3342
|
if (n >= 1e6) return `${Math.round(n / 1e5) / 10}M`;
|
|
3288
3343
|
if (n >= 1e3) return `${Math.round(n / 1024)}K`;
|
|
@@ -3344,7 +3399,14 @@ var Repl = class {
|
|
|
3344
3399
|
/** 当前加载的层级上下文(全局/项目/子目录) */
|
|
3345
3400
|
contextLayers = [];
|
|
3346
3401
|
/** 本次会话累计 token 用量 */
|
|
3347
|
-
sessionTokenUsage = { inputTokens: 0, outputTokens: 0 };
|
|
3402
|
+
sessionTokenUsage = { inputTokens: 0, outputTokens: 0, cacheCreationTokens: 0, cacheReadTokens: 0 };
|
|
3403
|
+
/** Fold a single-request TokenUsage (with optional cache fields) into sessionTokenUsage. */
|
|
3404
|
+
addSessionUsage(u) {
|
|
3405
|
+
this.sessionTokenUsage.inputTokens += u.inputTokens;
|
|
3406
|
+
this.sessionTokenUsage.outputTokens += u.outputTokens;
|
|
3407
|
+
this.sessionTokenUsage.cacheCreationTokens += u.cacheCreationTokens ?? 0;
|
|
3408
|
+
this.sessionTokenUsage.cacheReadTokens += u.cacheReadTokens ?? 0;
|
|
3409
|
+
}
|
|
3348
3410
|
/** 启动时检测到的 Git 分支(无 git 仓库时为 null) */
|
|
3349
3411
|
gitBranch = null;
|
|
3350
3412
|
/** MCP 多服务器管理器(无 MCP 配置时为 null) */
|
|
@@ -4607,8 +4669,7 @@ Session '${this.resumeSessionId}' not found.
|
|
|
4607
4669
|
session.addMessage({ role: "assistant", content, timestamp: /* @__PURE__ */ new Date() });
|
|
4608
4670
|
this.events.emit("message.after", { content });
|
|
4609
4671
|
if (usage) {
|
|
4610
|
-
this.
|
|
4611
|
-
this.sessionTokenUsage.outputTokens += usage.outputTokens;
|
|
4672
|
+
this.addSessionUsage(usage);
|
|
4612
4673
|
session.addTokenUsage(usage);
|
|
4613
4674
|
if (showTokens && !tokensShown) {
|
|
4614
4675
|
this.renderer.renderUsage(usage, this.sessionTokenUsage);
|
|
@@ -4637,8 +4698,7 @@ Session '${this.resumeSessionId}' not found.
|
|
|
4637
4698
|
session.addMessage({ role: "assistant", content: response.content, timestamp: /* @__PURE__ */ new Date() });
|
|
4638
4699
|
this.events.emit("message.after", { content: response.content });
|
|
4639
4700
|
if (response.usage) {
|
|
4640
|
-
this.
|
|
4641
|
-
this.sessionTokenUsage.outputTokens += response.usage.outputTokens;
|
|
4701
|
+
this.addSessionUsage(response.usage);
|
|
4642
4702
|
session.addTokenUsage(response.usage);
|
|
4643
4703
|
if (this.shouldShowTokens()) {
|
|
4644
4704
|
this.renderer.renderUsage(response.usage, this.sessionTokenUsage);
|
|
@@ -4773,7 +4833,11 @@ Session '${this.resumeSessionId}' not found.
|
|
|
4773
4833
|
const apiMessages = [...messages];
|
|
4774
4834
|
const extraMessages = [];
|
|
4775
4835
|
const maxToolRounds = this.maxToolRoundsOverride ?? this.config.get("maxToolRounds") ?? DEFAULT_MAX_TOOL_ROUNDS;
|
|
4836
|
+
const autoPauseIntervalRaw = this.config.get("autoPauseInterval");
|
|
4837
|
+
const autoPauseInterval = typeof autoPauseIntervalRaw === "number" ? autoPauseIntervalRaw : DEFAULT_AUTO_PAUSE_INTERVAL;
|
|
4776
4838
|
const baseSystemPrompt = (this.buildCurrentSystemPrompt() ?? "") + TOOL_CALL_REMINDER;
|
|
4839
|
+
const pauseHint = autoPauseInterval > 0 ? `
|
|
4840
|
+
- Every ${autoPauseInterval} rounds the user will be asked whether to continue \u2014 use this as a natural checkpoint to report progress.` : "";
|
|
4777
4841
|
const roundBudgetHint = this.planMode ? `
|
|
4778
4842
|
|
|
4779
4843
|
[Tool Round Budget \u2014 Plan Mode]
|
|
@@ -4783,21 +4847,19 @@ You have a maximum of ${maxToolRounds} tool call rounds. You are in READ-ONLY Pl
|
|
|
4783
4847
|
- Do NOT write shell commands or code blocks as a substitute for tool calls
|
|
4784
4848
|
- Do NOT read the same file more than once
|
|
4785
4849
|
- Call write_todos ONCE to present your plan, then give a text summary
|
|
4786
|
-
- If the user asks you to execute anything, respond: "Please type /plan execute to switch to execute mode."
|
|
4787
|
-
- Every ${AUTO_PAUSE_INTERVAL} rounds the user will be asked whether to continue.` : `
|
|
4850
|
+
- If the user asks you to execute anything, respond: "Please type /plan execute to switch to execute mode."${pauseHint}` : `
|
|
4788
4851
|
|
|
4789
4852
|
[Tool Round Budget]
|
|
4790
4853
|
You have a maximum of ${maxToolRounds} tool call rounds for this task. Plan efficiently:
|
|
4791
4854
|
- Prefer batch operations (e.g. global find-and-replace) over repetitive single edits.
|
|
4792
4855
|
- Do NOT read the same file more than once \u2014 use the content from previous reads.
|
|
4793
4856
|
- Prioritize the most critical tasks first in case rounds run out.
|
|
4794
|
-
- When remaining rounds are low, focus on completing the current task and summarizing
|
|
4795
|
-
- Every ${AUTO_PAUSE_INTERVAL} rounds the user will be asked whether to continue \u2014 use this as a natural checkpoint to report progress.`;
|
|
4857
|
+
- When remaining rounds are low, focus on completing the current task and summarizing.${pauseHint}`;
|
|
4796
4858
|
const systemPrompt = baseSystemPrompt + roundBudgetHint;
|
|
4797
4859
|
const modelParams = this.getModelParams();
|
|
4798
4860
|
const useStreaming = this.config.get("ui").streaming;
|
|
4799
4861
|
const spinner = this.renderer.showSpinner("Thinking...");
|
|
4800
|
-
const roundUsage = { inputTokens: 0, outputTokens: 0 };
|
|
4862
|
+
const roundUsage = { inputTokens: 0, outputTokens: 0, cacheCreationTokens: 0, cacheReadTokens: 0 };
|
|
4801
4863
|
const supportsStreamingTools = useStreaming && typeof provider.chatWithToolsStream === "function";
|
|
4802
4864
|
let consecutiveFreeRounds = 0;
|
|
4803
4865
|
let lastToolCallSignature = "";
|
|
@@ -4904,6 +4966,8 @@ You have a maximum of ${maxToolRounds} tool call rounds for this task. Plan effi
|
|
|
4904
4966
|
if (result.usage) {
|
|
4905
4967
|
roundUsage.inputTokens += result.usage.inputTokens;
|
|
4906
4968
|
roundUsage.outputTokens += result.usage.outputTokens;
|
|
4969
|
+
roundUsage.cacheCreationTokens += result.usage.cacheCreationTokens ?? 0;
|
|
4970
|
+
roundUsage.cacheReadTokens += result.usage.cacheReadTokens ?? 0;
|
|
4907
4971
|
}
|
|
4908
4972
|
if ("content" in result) {
|
|
4909
4973
|
const hasWriteTools = toolDefs.some((t) => t.name === "write_file" || t.name === "edit_file");
|
|
@@ -4954,8 +5018,7 @@ You have a maximum of ${maxToolRounds} tool call rounds for this task. Plan effi
|
|
|
4954
5018
|
});
|
|
4955
5019
|
this.events.emit("message.after", { content: finalContent });
|
|
4956
5020
|
if (roundUsage.inputTokens > 0 || roundUsage.outputTokens > 0) {
|
|
4957
|
-
this.
|
|
4958
|
-
this.sessionTokenUsage.outputTokens += roundUsage.outputTokens;
|
|
5021
|
+
this.addSessionUsage(roundUsage);
|
|
4959
5022
|
session.addTokenUsage(roundUsage);
|
|
4960
5023
|
if (this.shouldShowTokens()) {
|
|
4961
5024
|
this.renderer.renderUsage(roundUsage, this.sessionTokenUsage);
|
|
@@ -4993,6 +5056,8 @@ You have a maximum of ${maxToolRounds} tool call rounds for this task. Plan effi
|
|
|
4993
5056
|
if (genUsage) {
|
|
4994
5057
|
roundUsage.inputTokens += genUsage.inputTokens;
|
|
4995
5058
|
roundUsage.outputTokens += genUsage.outputTokens;
|
|
5059
|
+
roundUsage.cacheCreationTokens += genUsage.cacheCreationTokens ?? 0;
|
|
5060
|
+
roundUsage.cacheReadTokens += genUsage.cacheReadTokens ?? 0;
|
|
4996
5061
|
}
|
|
4997
5062
|
session.addMessage({ role: "assistant", content: genContent, timestamp: /* @__PURE__ */ new Date() });
|
|
4998
5063
|
this.events.emit("message.after", { content: genContent });
|
|
@@ -5007,8 +5072,7 @@ You have a maximum of ${maxToolRounds} tool call rounds for this task. Plan effi
|
|
|
5007
5072
|
const newMsgs2 = provider.buildToolResultMessages(result.toolCalls, syntheticResults, reasoningContent2);
|
|
5008
5073
|
extraMessages.push(...newMsgs2);
|
|
5009
5074
|
if (roundUsage.inputTokens > 0 || roundUsage.outputTokens > 0) {
|
|
5010
|
-
this.
|
|
5011
|
-
this.sessionTokenUsage.outputTokens += roundUsage.outputTokens;
|
|
5075
|
+
this.addSessionUsage(roundUsage);
|
|
5012
5076
|
session.addTokenUsage(roundUsage);
|
|
5013
5077
|
if (teeShowTokens && !teeTokShown) {
|
|
5014
5078
|
this.renderer.renderUsage(roundUsage, this.sessionTokenUsage);
|
|
@@ -5116,12 +5180,12 @@ You have a maximum of ${maxToolRounds} tool call rounds for this task. Plan effi
|
|
|
5116
5180
|
}
|
|
5117
5181
|
const effectiveRound = round + 1;
|
|
5118
5182
|
const remaining = maxToolRounds - effectiveRound;
|
|
5119
|
-
if (
|
|
5183
|
+
if (autoPauseInterval > 0 && effectiveRound > 0 && effectiveRound % autoPauseInterval === 0 && remaining > 0) {
|
|
5120
5184
|
spinner.stop();
|
|
5121
5185
|
process.stdout.write("\n");
|
|
5122
5186
|
process.stdout.write(theme.warning(`\u23F8 Auto-pause: ${effectiveRound}/${maxToolRounds} rounds used, ${remaining} remaining
|
|
5123
5187
|
`));
|
|
5124
|
-
const recentHistory = roundToolHistory.slice(-
|
|
5188
|
+
const recentHistory = roundToolHistory.slice(-autoPauseInterval);
|
|
5125
5189
|
if (recentHistory.length > 0) {
|
|
5126
5190
|
const toolCounts = /* @__PURE__ */ new Map();
|
|
5127
5191
|
for (const rh of recentHistory) {
|
|
@@ -5204,6 +5268,8 @@ You have a maximum of ${maxToolRounds} tool call rounds for this task. Plan effi
|
|
|
5204
5268
|
if (summaryResult.usage) {
|
|
5205
5269
|
roundUsage.inputTokens += summaryResult.usage.inputTokens;
|
|
5206
5270
|
roundUsage.outputTokens += summaryResult.usage.outputTokens;
|
|
5271
|
+
roundUsage.cacheCreationTokens += summaryResult.usage.cacheCreationTokens ?? 0;
|
|
5272
|
+
roundUsage.cacheReadTokens += summaryResult.usage.cacheReadTokens ?? 0;
|
|
5207
5273
|
}
|
|
5208
5274
|
} else {
|
|
5209
5275
|
this.renderer.renderError(
|
|
@@ -5218,8 +5284,7 @@ Tip: You can continue the conversation by asking the AI to proceed.`
|
|
|
5218
5284
|
);
|
|
5219
5285
|
}
|
|
5220
5286
|
if (roundUsage.inputTokens > 0 || roundUsage.outputTokens > 0) {
|
|
5221
|
-
this.
|
|
5222
|
-
this.sessionTokenUsage.outputTokens += roundUsage.outputTokens;
|
|
5287
|
+
this.addSessionUsage(roundUsage);
|
|
5223
5288
|
session.addTokenUsage(roundUsage);
|
|
5224
5289
|
if (this.shouldShowTokens()) {
|
|
5225
5290
|
this.renderer.renderUsage(roundUsage, this.sessionTokenUsage);
|
|
@@ -5316,7 +5381,12 @@ Tip: You can continue the conversation by asking the AI to proceed.`
|
|
|
5316
5381
|
},
|
|
5317
5382
|
getSessionTokenUsage: () => ({ ...this.sessionTokenUsage }),
|
|
5318
5383
|
resetSessionTokenUsage: () => {
|
|
5319
|
-
this.sessionTokenUsage = {
|
|
5384
|
+
this.sessionTokenUsage = {
|
|
5385
|
+
inputTokens: 0,
|
|
5386
|
+
outputTokens: 0,
|
|
5387
|
+
cacheCreationTokens: 0,
|
|
5388
|
+
cacheReadTokens: 0
|
|
5389
|
+
};
|
|
5320
5390
|
},
|
|
5321
5391
|
getGitBranch: () => this.gitBranch,
|
|
5322
5392
|
getLastResponse: () => lastResponseStore.content,
|
|
@@ -5493,7 +5563,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
5493
5563
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
5494
5564
|
process.exit(1);
|
|
5495
5565
|
}
|
|
5496
|
-
const { startWebServer } = await import("./server-
|
|
5566
|
+
const { startWebServer } = await import("./server-MOTFJN6L.js");
|
|
5497
5567
|
await startWebServer({ port, host: options.host });
|
|
5498
5568
|
});
|
|
5499
5569
|
program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | migrate <name>)").action(async (action, username) => {
|
|
@@ -5726,7 +5796,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
5726
5796
|
}),
|
|
5727
5797
|
config.get("customProviders")
|
|
5728
5798
|
);
|
|
5729
|
-
const { startHub } = await import("./hub-
|
|
5799
|
+
const { startHub } = await import("./hub-HQ5QX7CV.js");
|
|
5730
5800
|
await startHub(
|
|
5731
5801
|
{
|
|
5732
5802
|
topic: topic ?? "",
|