jinzd-ai-cli 0.4.266 → 0.4.267
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-FQU6HK3Z.js → batch-GY5MAN5F.js} +2 -2
- package/dist/{chunk-Y2X24VYB.js → chunk-5AEOIETL.js} +4 -4
- package/dist/{chunk-XEVURCAM.js → chunk-5CU72V6P.js} +3 -3
- package/dist/{chunk-TJNBSR3I.js → chunk-6C6FLDGH.js} +1 -1
- package/dist/{chunk-FA3HGXXM.js → chunk-7HECI3U5.js} +1 -1
- package/dist/{chunk-LHY7ST6X.js → chunk-ARYCWJN6.js} +1 -1
- package/dist/{chunk-CEJUB4YV.js → chunk-EWRZMIQE.js} +1 -1
- package/dist/{chunk-GWOZET2E.js → chunk-FI6IWUXW.js} +1 -1
- package/dist/{chunk-UCHND2K6.js → chunk-JH343BDI.js} +42 -2
- package/dist/{chunk-FIDEG2PG.js → chunk-QN7WD2SM.js} +3 -3
- package/dist/{chunk-V4D7YD24.js → chunk-R7GERZDA.js} +145 -4
- package/dist/{chunk-3O4VLKD4.js → chunk-RVNL7MQG.js} +1 -1
- package/dist/{chunk-LGJ7EX2F.js → chunk-THHPKZJ3.js} +1 -1
- package/dist/{chunk-QW76RX6G.js → chunk-WPN7LDLM.js} +1 -1
- package/dist/{chunk-N2E6GFLZ.js → chunk-XLLUQEGO.js} +1 -1
- package/dist/{ci-GZH3QMME.js → ci-MUEQSNKU.js} +4 -4
- package/dist/{ci-format-VKP2MGYJ.js → ci-format-2ZGGSOFK.js} +2 -2
- package/dist/{constants-ICAF6I3J.js → constants-SZTJESDF.js} +1 -1
- package/dist/{doctor-cli-CO6BJWRW.js → doctor-cli-Z272364P.js} +4 -4
- package/dist/electron-server.js +705 -400
- package/dist/{hub-4APIRQ73.js → hub-MRLGKMRI.js} +1 -1
- package/dist/index.js +34 -42
- package/dist/{persistent-memory-YPO25MOP.js → persistent-memory-3FTOC7QT.js} +2 -2
- package/dist/{persistent-memory-YD3SHSUH.js → persistent-memory-HZASMDJQ.js} +2 -2
- package/dist/{pr-CDOPCAPK.js → pr-VLLIALRK.js} +4 -4
- package/dist/{run-tests-4XRHKHN5.js → run-tests-6MWE6D5S.js} +2 -2
- package/dist/{run-tests-QNNP2HCD.js → run-tests-NTDZ6DDU.js} +2 -2
- package/dist/{server-53GM3CRH.js → server-IALCWKSU.js} +46 -28
- package/dist/{server-B4A7LHZ5.js → server-SP3AEHRQ.js} +5 -5
- package/dist/{task-orchestrator-WNV6PT6Z.js → task-orchestrator-Q6WFFI4J.js} +5 -5
- package/dist/{usage-E3FEYSBU.js → usage-DJDLHICZ.js} +4 -6
- package/package.json +1 -1
- package/dist/chunk-YRD6M5XI.js +0 -149
|
@@ -158,7 +158,7 @@ ${content}`);
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
async function runTaskMode(config, providers, configManager, topic) {
|
|
161
|
-
const { TaskOrchestrator } = await import("./task-orchestrator-
|
|
161
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-Q6WFFI4J.js");
|
|
162
162
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
163
163
|
let interrupted = false;
|
|
164
164
|
const onSigint = () => {
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,9 @@ import {
|
|
|
6
6
|
applyThinkCommand,
|
|
7
7
|
autoTrimSessionIfNeeded,
|
|
8
8
|
buildInitPrompt,
|
|
9
|
+
buildSessionCostReport,
|
|
9
10
|
clearDevState,
|
|
11
|
+
costSourceNote,
|
|
10
12
|
loadDevState,
|
|
11
13
|
parseSimpleYaml,
|
|
12
14
|
persistToolRound,
|
|
@@ -15,15 +17,13 @@ import {
|
|
|
15
17
|
scanProject,
|
|
16
18
|
sessionHasMeaningfulContent,
|
|
17
19
|
setupProxy
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import {
|
|
20
|
-
CostTracker
|
|
21
|
-
} from "./chunk-V4D7YD24.js";
|
|
20
|
+
} from "./chunk-JH343BDI.js";
|
|
22
21
|
import {
|
|
22
|
+
CostTracker,
|
|
23
23
|
computeCost,
|
|
24
24
|
formatCost,
|
|
25
25
|
getPricing
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-R7GERZDA.js";
|
|
27
27
|
import {
|
|
28
28
|
buildReviewPrompt,
|
|
29
29
|
buildSecurityReviewPrompt
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
setMaxOutputCap,
|
|
56
56
|
spawnAgentContext,
|
|
57
57
|
undoStack
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-5AEOIETL.js";
|
|
59
59
|
import {
|
|
60
60
|
addMemoryEntry,
|
|
61
61
|
backupMemoryStore,
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
touchMemoryReferences,
|
|
82
82
|
updateMemoryApproval,
|
|
83
83
|
updateMemoryEntry
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-RVNL7MQG.js";
|
|
85
85
|
import "./chunk-GLSR2NR3.js";
|
|
86
86
|
import "./chunk-UUSRWSSX.js";
|
|
87
87
|
import "./chunk-CKH4KQ4E.js";
|
|
@@ -99,14 +99,14 @@ import {
|
|
|
99
99
|
formatDoctorReport,
|
|
100
100
|
loadContextFiles,
|
|
101
101
|
writeCrashLog
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-QN7WD2SM.js";
|
|
103
103
|
import {
|
|
104
104
|
ProviderRegistry,
|
|
105
105
|
listBuiltInProviderMetadata
|
|
106
106
|
} from "./chunk-AUEX6RNY.js";
|
|
107
107
|
import {
|
|
108
108
|
ConfigManager
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-EWRZMIQE.js";
|
|
110
110
|
import {
|
|
111
111
|
describePlugin,
|
|
112
112
|
getActivePluginAssets,
|
|
@@ -123,7 +123,7 @@ import {
|
|
|
123
123
|
trustHook,
|
|
124
124
|
trustPlugin,
|
|
125
125
|
untrustHook
|
|
126
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-WPN7LDLM.js";
|
|
127
127
|
import {
|
|
128
128
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
129
129
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -157,7 +157,7 @@ import {
|
|
|
157
157
|
import {
|
|
158
158
|
fileCheckpoints
|
|
159
159
|
} from "./chunk-4BKXL7SM.js";
|
|
160
|
-
import "./chunk-
|
|
160
|
+
import "./chunk-XLLUQEGO.js";
|
|
161
161
|
import {
|
|
162
162
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
163
163
|
AUTHOR,
|
|
@@ -176,7 +176,7 @@ import {
|
|
|
176
176
|
SKILLS_DIR_NAME,
|
|
177
177
|
VERSION,
|
|
178
178
|
buildUserIdentityPrompt
|
|
179
|
-
} from "./chunk-
|
|
179
|
+
} from "./chunk-THHPKZJ3.js";
|
|
180
180
|
import {
|
|
181
181
|
buildChatIndex,
|
|
182
182
|
clearChatIndex,
|
|
@@ -1397,7 +1397,7 @@ No tools match "${filter}".
|
|
|
1397
1397
|
const { join: join6 } = await import("path");
|
|
1398
1398
|
const { existsSync: existsSync6 } = await import("fs");
|
|
1399
1399
|
const { getGitRoot: getGitRoot2 } = await import("./git-context-EXOEHQSF.js");
|
|
1400
|
-
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-
|
|
1400
|
+
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-SZTJESDF.js");
|
|
1401
1401
|
const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
|
|
1402
1402
|
const cwd = process.cwd();
|
|
1403
1403
|
const projectRoot = getGitRoot2(cwd) ?? cwd;
|
|
@@ -2385,7 +2385,7 @@ function createReviewCommands() {
|
|
|
2385
2385
|
usage: "/test [command|filter]",
|
|
2386
2386
|
async execute(args, ctx) {
|
|
2387
2387
|
try {
|
|
2388
|
-
const { executeTests } = await import("./run-tests-
|
|
2388
|
+
const { executeTests } = await import("./run-tests-NTDZ6DDU.js");
|
|
2389
2389
|
const argStr = args.join(" ").trim();
|
|
2390
2390
|
let testArgs = {};
|
|
2391
2391
|
if (argStr) {
|
|
@@ -3772,21 +3772,16 @@ ${text}
|
|
|
3772
3772
|
}
|
|
3773
3773
|
const provider = ctx.getCurrentProvider();
|
|
3774
3774
|
const model = ctx.getCurrentModel();
|
|
3775
|
-
const pricing = getPricing(provider, model);
|
|
3776
3775
|
const accrued = ctx.getSessionAccruedCost();
|
|
3777
|
-
const
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
cacheReadTokens: 0
|
|
3787
|
-
});
|
|
3788
|
-
if (costWithoutCache != null) savings = costWithoutCache - liveCost;
|
|
3789
|
-
}
|
|
3776
|
+
const report = buildSessionCostReport({
|
|
3777
|
+
provider,
|
|
3778
|
+
model,
|
|
3779
|
+
usage: { ...usage, cacheCreationTokens: cacheCreate, cacheReadTokens: cacheRead },
|
|
3780
|
+
accruedUsd: accrued.usd,
|
|
3781
|
+
accrualIncomplete: accrued.incomplete
|
|
3782
|
+
});
|
|
3783
|
+
const cost = report.cost;
|
|
3784
|
+
const savings = report.savings;
|
|
3790
3785
|
console.log();
|
|
3791
3786
|
console.log(theme.heading(" \u{1F4B0} Session Cost & Token Usage"));
|
|
3792
3787
|
console.log(theme.dim(" " + "\u2500".repeat(48)));
|
|
@@ -3805,11 +3800,8 @@ ${text}
|
|
|
3805
3800
|
console.log(theme.dim(" " + "\u2500".repeat(48)));
|
|
3806
3801
|
if (cost != null) {
|
|
3807
3802
|
console.log(theme.dim(" Cost : ") + chalk3.bold.cyan(formatCost(cost).padStart(12)));
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
} else if (!usedAccrual) {
|
|
3811
|
-
console.log(theme.dim(" (estimated at current rates)"));
|
|
3812
|
-
}
|
|
3803
|
+
const note = costSourceNote(report.costSource);
|
|
3804
|
+
if (note) console.log(theme.dim(` ${note}`));
|
|
3813
3805
|
if (savings != null && savings > 0) {
|
|
3814
3806
|
console.log(
|
|
3815
3807
|
theme.dim(" Cache savings : ") + chalk3.green(`-${formatCost(savings)}`.padStart(12)) + theme.dim(` (vs no cache)`)
|
|
@@ -7696,7 +7688,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
7696
7688
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
7697
7689
|
process.exit(1);
|
|
7698
7690
|
}
|
|
7699
|
-
const { startWebServer } = await import("./server-
|
|
7691
|
+
const { startWebServer } = await import("./server-IALCWKSU.js");
|
|
7700
7692
|
await startWebServer({ port, host: options.host });
|
|
7701
7693
|
});
|
|
7702
7694
|
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) => {
|
|
@@ -7863,11 +7855,11 @@ program.command("sessions").description("List recent conversation sessions").opt
|
|
|
7863
7855
|
console.log(footer + "\n");
|
|
7864
7856
|
});
|
|
7865
7857
|
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) => {
|
|
7866
|
-
const { runUsageCli } = await import("./usage-
|
|
7858
|
+
const { runUsageCli } = await import("./usage-DJDLHICZ.js");
|
|
7867
7859
|
await runUsageCli(options);
|
|
7868
7860
|
});
|
|
7869
7861
|
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) => {
|
|
7870
|
-
const { runDoctorCli } = await import("./doctor-cli-
|
|
7862
|
+
const { runDoctorCli } = await import("./doctor-cli-Z272364P.js");
|
|
7871
7863
|
const argv = process.argv.slice(2);
|
|
7872
7864
|
await runDoctorCli({
|
|
7873
7865
|
json: !!options.json || argv.includes("--json"),
|
|
@@ -7876,7 +7868,7 @@ program.command("doctor").description("Health check: API keys, config, MCP, rece
|
|
|
7876
7868
|
});
|
|
7877
7869
|
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) => {
|
|
7878
7870
|
try {
|
|
7879
|
-
const batch = await import("./batch-
|
|
7871
|
+
const batch = await import("./batch-GY5MAN5F.js");
|
|
7880
7872
|
switch (action) {
|
|
7881
7873
|
case "submit":
|
|
7882
7874
|
if (!arg) {
|
|
@@ -7919,7 +7911,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
|
|
|
7919
7911
|
}
|
|
7920
7912
|
});
|
|
7921
7913
|
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) => {
|
|
7922
|
-
const { startMcpServer } = await import("./server-
|
|
7914
|
+
const { startMcpServer } = await import("./server-SP3AEHRQ.js");
|
|
7923
7915
|
await startMcpServer({
|
|
7924
7916
|
allowDestructive: !!options.allowDestructive,
|
|
7925
7917
|
allowOutsideCwd: !!options.allowOutsideCwd,
|
|
@@ -7932,7 +7924,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
|
|
|
7932
7924
|
console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
|
|
7933
7925
|
process.exit(1);
|
|
7934
7926
|
}
|
|
7935
|
-
const { runPrCli } = await import("./pr-
|
|
7927
|
+
const { runPrCli } = await import("./pr-VLLIALRK.js");
|
|
7936
7928
|
const result = await runPrCli({
|
|
7937
7929
|
action,
|
|
7938
7930
|
target,
|
|
@@ -7952,8 +7944,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
|
|
|
7952
7944
|
process.exit(result.exitCode);
|
|
7953
7945
|
});
|
|
7954
7946
|
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 or URL; diff fetched via gh pr diff <value>", (v) => /^#?\d+$/.test(v) ? parseInt(v.replace(/^#/, ""), 10) : v).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)").option("--json", "Output a structured JSON report").option("--markdown", "Output Markdown report (default)").option("--sarif", "Output SARIF 2.1.0 for code scanning artifacts").option("--fail-on-security-high", "Fail when the security review contains HIGH/CRITICAL findings (default)").option("--no-fail-on-security-high", "Do not fail on security HIGH/CRITICAL findings").option("--fail-on-test-failure", "Fail when the report mentions test failures (default)").option("--no-fail-on-test-failure", "Do not fail on test failure findings").option("--fail-on-lint-failure", "Fail when the report mentions lint/typecheck failures (default)").option("--no-fail-on-lint-failure", "Do not fail on lint/typecheck failure findings").action(async (options) => {
|
|
7955
|
-
const { runCi } = await import("./ci-
|
|
7956
|
-
const { formatCiResult } = await import("./ci-format-
|
|
7947
|
+
const { runCi } = await import("./ci-MUEQSNKU.js");
|
|
7948
|
+
const { formatCiResult } = await import("./ci-format-2ZGGSOFK.js");
|
|
7957
7949
|
const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
|
|
7958
7950
|
if (formats > 1) {
|
|
7959
7951
|
console.error("Choose only one output format: --json, --markdown, or --sarif.");
|
|
@@ -8111,7 +8103,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
8111
8103
|
config.get("customProviders"),
|
|
8112
8104
|
config.getConfigDir()
|
|
8113
8105
|
);
|
|
8114
|
-
const { startHub } = await import("./hub-
|
|
8106
|
+
const { startHub } = await import("./hub-MRLGKMRI.js");
|
|
8115
8107
|
await startHub(
|
|
8116
8108
|
{
|
|
8117
8109
|
topic: topic ?? "",
|
|
@@ -27,9 +27,9 @@ import {
|
|
|
27
27
|
touchMemoryReferences,
|
|
28
28
|
updateMemoryApproval,
|
|
29
29
|
updateMemoryEntry
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-FI6IWUXW.js";
|
|
31
31
|
import "./chunk-YVTASHS5.js";
|
|
32
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-7HECI3U5.js";
|
|
33
33
|
import "./chunk-6BUTA5VW.js";
|
|
34
34
|
export {
|
|
35
35
|
addMemoryEntry,
|
|
@@ -28,9 +28,9 @@ import {
|
|
|
28
28
|
touchMemoryReferences,
|
|
29
29
|
updateMemoryApproval,
|
|
30
30
|
updateMemoryEntry
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-RVNL7MQG.js";
|
|
32
32
|
import "./chunk-HOSJZMQS.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-THHPKZJ3.js";
|
|
34
34
|
import "./chunk-B5TYJO7V.js";
|
|
35
35
|
import "./chunk-IW3Q7AE5.js";
|
|
36
36
|
export {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import {
|
|
3
3
|
countSeverity,
|
|
4
4
|
runCi
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-5CU72V6P.js";
|
|
6
|
+
import "./chunk-6C6FLDGH.js";
|
|
7
7
|
import {
|
|
8
8
|
buildReviewPrompt,
|
|
9
9
|
buildSecurityReviewPrompt,
|
|
@@ -17,12 +17,12 @@ import {
|
|
|
17
17
|
} from "./chunk-AUEX6RNY.js";
|
|
18
18
|
import {
|
|
19
19
|
ConfigManager
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-EWRZMIQE.js";
|
|
21
21
|
import "./chunk-3OBY7WSS.js";
|
|
22
22
|
import "./chunk-TU3L3PW7.js";
|
|
23
23
|
import {
|
|
24
24
|
VERSION
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-THHPKZJ3.js";
|
|
26
26
|
import "./chunk-IW3Q7AE5.js";
|
|
27
27
|
|
|
28
28
|
// src/cli/pr.ts
|
|
@@ -18,18 +18,21 @@ import {
|
|
|
18
18
|
applyThinkCommand,
|
|
19
19
|
autoTrimSessionIfNeeded,
|
|
20
20
|
buildInitPrompt,
|
|
21
|
+
buildSessionCostReport,
|
|
22
|
+
costSourceNote,
|
|
21
23
|
loadDevState,
|
|
22
24
|
persistToolRound,
|
|
23
25
|
readGitDiff,
|
|
24
26
|
scanDirTree,
|
|
25
27
|
scanProject,
|
|
26
28
|
setupProxy
|
|
27
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-JH343BDI.js";
|
|
28
30
|
import {
|
|
31
|
+
CostTracker,
|
|
29
32
|
computeCost,
|
|
30
33
|
formatCost,
|
|
31
34
|
getPricing
|
|
32
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-R7GERZDA.js";
|
|
33
36
|
import {
|
|
34
37
|
buildReviewPrompt,
|
|
35
38
|
buildSecurityReviewPrompt
|
|
@@ -68,7 +71,7 @@ import {
|
|
|
68
71
|
spawnAgentContext,
|
|
69
72
|
truncateOutput,
|
|
70
73
|
undoStack
|
|
71
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-5AEOIETL.js";
|
|
72
75
|
import {
|
|
73
76
|
addMemoryEntry,
|
|
74
77
|
clearMemoryEntries,
|
|
@@ -82,7 +85,7 @@ import {
|
|
|
82
85
|
parseWritableScope,
|
|
83
86
|
updateMemoryApproval,
|
|
84
87
|
updateMemoryEntry
|
|
85
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-RVNL7MQG.js";
|
|
86
89
|
import "./chunk-GLSR2NR3.js";
|
|
87
90
|
import "./chunk-UUSRWSSX.js";
|
|
88
91
|
import "./chunk-CKH4KQ4E.js";
|
|
@@ -96,13 +99,13 @@ import {
|
|
|
96
99
|
buildDoctorReport,
|
|
97
100
|
formatDoctorReport,
|
|
98
101
|
loadContextFiles
|
|
99
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-QN7WD2SM.js";
|
|
100
103
|
import {
|
|
101
104
|
ProviderRegistry
|
|
102
105
|
} from "./chunk-AUEX6RNY.js";
|
|
103
106
|
import {
|
|
104
107
|
ConfigManager
|
|
105
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-EWRZMIQE.js";
|
|
106
109
|
import {
|
|
107
110
|
describePlugin,
|
|
108
111
|
getActivePluginAssets,
|
|
@@ -117,7 +120,7 @@ import {
|
|
|
117
120
|
runTool,
|
|
118
121
|
setPluginEnabled,
|
|
119
122
|
trustPlugin
|
|
120
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-WPN7LDLM.js";
|
|
121
124
|
import {
|
|
122
125
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
123
126
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -142,7 +145,7 @@ import {
|
|
|
142
145
|
getGitRoot
|
|
143
146
|
} from "./chunk-HOSJZMQS.js";
|
|
144
147
|
import "./chunk-4BKXL7SM.js";
|
|
145
|
-
import "./chunk-
|
|
148
|
+
import "./chunk-XLLUQEGO.js";
|
|
146
149
|
import {
|
|
147
150
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
148
151
|
AUTHOR,
|
|
@@ -158,7 +161,7 @@ import {
|
|
|
158
161
|
SKILLS_DIR_NAME,
|
|
159
162
|
VERSION,
|
|
160
163
|
buildUserIdentityPrompt
|
|
161
|
-
} from "./chunk-
|
|
164
|
+
} from "./chunk-THHPKZJ3.js";
|
|
162
165
|
import "./chunk-6RPGQ5CG.js";
|
|
163
166
|
import "./chunk-KHYD3WXE.js";
|
|
164
167
|
import "./chunk-NYNSYLFY.js";
|
|
@@ -832,7 +835,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
|
|
|
832
835
|
Cost: ${formatCost(cost)}` : "";
|
|
833
836
|
let memoryLine = "";
|
|
834
837
|
try {
|
|
835
|
-
const { countPendingMemories } = await import("./persistent-memory-
|
|
838
|
+
const { countPendingMemories } = await import("./persistent-memory-HZASMDJQ.js");
|
|
836
839
|
const pending = countPendingMemories(ctx.config.getConfigDir());
|
|
837
840
|
if (pending > 0) memoryLine = `
|
|
838
841
|
Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
|
|
@@ -1040,18 +1043,16 @@ async function handleExport(args, ctx) {
|
|
|
1040
1043
|
}
|
|
1041
1044
|
async function handleCost(_args, ctx) {
|
|
1042
1045
|
const u = ctx.sessionTokenUsage;
|
|
1043
|
-
const
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
if (withoutCache != null) savings = withoutCache - cost;
|
|
1054
|
-
}
|
|
1046
|
+
const report = buildSessionCostReport({
|
|
1047
|
+
provider: ctx.currentProvider,
|
|
1048
|
+
model: ctx.currentModel,
|
|
1049
|
+
usage: u,
|
|
1050
|
+
accruedUsd: ctx.sessionAccruedCostUsd,
|
|
1051
|
+
accrualIncomplete: ctx.sessionCostIncomplete
|
|
1052
|
+
});
|
|
1053
|
+
const total = report.totalTokens;
|
|
1054
|
+
const cost = report.cost;
|
|
1055
|
+
const savings = report.savings;
|
|
1055
1056
|
const lines = [
|
|
1056
1057
|
"\u{1F4B0} Session Cost & Token Usage",
|
|
1057
1058
|
` Provider : ${ctx.currentProvider}`,
|
|
@@ -1060,13 +1061,13 @@ async function handleCost(_args, ctx) {
|
|
|
1060
1061
|
` Output : ${u.outputTokens.toLocaleString()}`
|
|
1061
1062
|
];
|
|
1062
1063
|
if (u.cacheCreationTokens > 0) lines.push(` Cache write : ${u.cacheCreationTokens.toLocaleString()}`);
|
|
1063
|
-
if (
|
|
1064
|
-
|
|
1065
|
-
lines.push(` Cache read : ${u.cacheReadTokens.toLocaleString()} (${pct}% hit rate)`);
|
|
1064
|
+
if (report.cacheHitPct != null) {
|
|
1065
|
+
lines.push(` Cache read : ${u.cacheReadTokens.toLocaleString()} (${report.cacheHitPct}% hit rate)`);
|
|
1066
1066
|
}
|
|
1067
1067
|
lines.push(` Total tokens : ${total.toLocaleString()}`);
|
|
1068
1068
|
if (cost != null) {
|
|
1069
|
-
|
|
1069
|
+
const note = costSourceNote(report.costSource);
|
|
1070
|
+
lines.push(` Cost : ${formatCost(cost)}${note ? ` ${note}` : ""}`);
|
|
1070
1071
|
if (savings != null && savings > 0) {
|
|
1071
1072
|
lines.push(` Cache savings : -${formatCost(savings)} (vs no cache)`);
|
|
1072
1073
|
}
|
|
@@ -1647,7 +1648,7 @@ async function handleTest(args, ctx) {
|
|
|
1647
1648
|
const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
|
|
1648
1649
|
testArgs = isCommand ? { command: argStr } : { filter: argStr };
|
|
1649
1650
|
}
|
|
1650
|
-
const runTests = ctx.runTests ?? (await import("./run-tests-
|
|
1651
|
+
const runTests = ctx.runTests ?? (await import("./run-tests-NTDZ6DDU.js")).executeTests;
|
|
1651
1652
|
const report = await runTests(testArgs);
|
|
1652
1653
|
ctx.send({ type: "info", message: report });
|
|
1653
1654
|
} catch (err) {
|
|
@@ -1905,7 +1906,7 @@ async function handleMemory(args, ctx) {
|
|
|
1905
1906
|
ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
|
|
1906
1907
|
} else if (sub === "export") {
|
|
1907
1908
|
if (args[1] === "md") {
|
|
1908
|
-
const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-
|
|
1909
|
+
const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-HZASMDJQ.js");
|
|
1909
1910
|
ctx.send({
|
|
1910
1911
|
type: "export_data",
|
|
1911
1912
|
format: "md",
|
|
@@ -2326,6 +2327,7 @@ var webCommandHandlers = {
|
|
|
2326
2327
|
var SessionHandler = class {
|
|
2327
2328
|
ws;
|
|
2328
2329
|
config;
|
|
2330
|
+
costTracker;
|
|
2329
2331
|
providers;
|
|
2330
2332
|
sessions;
|
|
2331
2333
|
toolRegistry;
|
|
@@ -2339,12 +2341,22 @@ var SessionHandler = class {
|
|
|
2339
2341
|
runtimeThinkingEffort = null;
|
|
2340
2342
|
sessionTokenUsage = { inputTokens: 0, outputTokens: 0, cacheCreationTokens: 0, cacheReadTokens: 0 };
|
|
2341
2343
|
unknownPricingWarnings = /* @__PURE__ */ new Set();
|
|
2344
|
+
/**
|
|
2345
|
+
* 本会话按**调用时刻**费率累计的花费(美元)。
|
|
2346
|
+
* 审计 P2-02 第二批:Web 端此前根本不给 CostTracker 记账,aicli usage 与
|
|
2347
|
+
* monthlyBudget 完全看不到 Web UI 的开销;顺带补上 P3-01 的记账口径。
|
|
2348
|
+
*/
|
|
2349
|
+
sessionAccruedCostUsd = 0;
|
|
2350
|
+
sessionCostIncomplete = false;
|
|
2342
2351
|
/** Accumulate a TokenUsage (with optional cache fields) into sessionTokenUsage. */
|
|
2343
2352
|
addWebSessionUsage(u) {
|
|
2344
2353
|
this.sessionTokenUsage.inputTokens += u.inputTokens;
|
|
2345
2354
|
this.sessionTokenUsage.outputTokens += u.outputTokens;
|
|
2346
2355
|
this.sessionTokenUsage.cacheCreationTokens += u.cacheCreationTokens ?? 0;
|
|
2347
2356
|
this.sessionTokenUsage.cacheReadTokens += u.cacheReadTokens ?? 0;
|
|
2357
|
+
const priced = this.costTracker.addCost(this.currentProvider, this.currentModel, u);
|
|
2358
|
+
if (priced === null) this.sessionCostIncomplete = true;
|
|
2359
|
+
else this.sessionAccruedCostUsd += priced;
|
|
2348
2360
|
const totalTokens = u.inputTokens + u.outputTokens + (u.cacheCreationTokens ?? 0) + (u.cacheReadTokens ?? 0);
|
|
2349
2361
|
if (totalTokens > 0 && !getPricing(this.currentProvider, this.currentModel)) {
|
|
2350
2362
|
const key = `${this.currentProvider}/${this.currentModel}`;
|
|
@@ -2356,6 +2368,8 @@ var SessionHandler = class {
|
|
|
2356
2368
|
}
|
|
2357
2369
|
resetWebSessionUsage() {
|
|
2358
2370
|
this.sessionTokenUsage = { inputTokens: 0, outputTokens: 0, cacheCreationTokens: 0, cacheReadTokens: 0 };
|
|
2371
|
+
this.sessionAccruedCostUsd = 0;
|
|
2372
|
+
this.sessionCostIncomplete = false;
|
|
2359
2373
|
}
|
|
2360
2374
|
abortController = null;
|
|
2361
2375
|
userInterjection = null;
|
|
@@ -2389,6 +2403,7 @@ var SessionHandler = class {
|
|
|
2389
2403
|
constructor(ws, shared) {
|
|
2390
2404
|
this.ws = ws;
|
|
2391
2405
|
this.config = shared.config;
|
|
2406
|
+
this.costTracker = shared.costTracker;
|
|
2392
2407
|
this.providers = shared.providers;
|
|
2393
2408
|
this.sessions = shared.sessions;
|
|
2394
2409
|
this.toolRegistry = shared.toolRegistry;
|
|
@@ -3902,6 +3917,7 @@ async function startWebServer(options = {}) {
|
|
|
3902
3917
|
}
|
|
3903
3918
|
const shared = {
|
|
3904
3919
|
config,
|
|
3920
|
+
costTracker: new CostTracker(config.getConfigDir()),
|
|
3905
3921
|
providers,
|
|
3906
3922
|
sessions,
|
|
3907
3923
|
toolRegistry,
|
|
@@ -4168,6 +4184,8 @@ async function startWebServer(options = {}) {
|
|
|
4168
4184
|
const userSessions = new SessionManager(userConfig);
|
|
4169
4185
|
const userShared = {
|
|
4170
4186
|
config: userConfig,
|
|
4187
|
+
// 每用户各自的 config 目录 → 各自的 cost-history.json
|
|
4188
|
+
costTracker: new CostTracker(userConfig.getConfigDir()),
|
|
4171
4189
|
providers,
|
|
4172
4190
|
// Shared — providers re-read API keys per call
|
|
4173
4191
|
sessions: userSessions,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ToolRegistry
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-5AEOIETL.js";
|
|
5
|
+
import "./chunk-RVNL7MQG.js";
|
|
6
6
|
import "./chunk-GLSR2NR3.js";
|
|
7
7
|
import "./chunk-UUSRWSSX.js";
|
|
8
8
|
import "./chunk-CKH4KQ4E.js";
|
|
@@ -10,7 +10,7 @@ import "./chunk-BXP6YZ2P.js";
|
|
|
10
10
|
import "./chunk-5C76XDDF.js";
|
|
11
11
|
import {
|
|
12
12
|
runTool
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WPN7LDLM.js";
|
|
14
14
|
import {
|
|
15
15
|
getDangerLevel,
|
|
16
16
|
schemaToJsonSchema
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
import "./chunk-TU3L3PW7.js";
|
|
19
19
|
import "./chunk-HOSJZMQS.js";
|
|
20
20
|
import "./chunk-4BKXL7SM.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-XLLUQEGO.js";
|
|
22
22
|
import {
|
|
23
23
|
VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-THHPKZJ3.js";
|
|
25
25
|
import "./chunk-6RPGQ5CG.js";
|
|
26
26
|
import "./chunk-KHYD3WXE.js";
|
|
27
27
|
import "./chunk-NYNSYLFY.js";
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
ToolRegistry,
|
|
4
4
|
googleSearchContext,
|
|
5
5
|
truncateOutput
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-5AEOIETL.js";
|
|
7
|
+
import "./chunk-RVNL7MQG.js";
|
|
8
8
|
import "./chunk-GLSR2NR3.js";
|
|
9
9
|
import "./chunk-UUSRWSSX.js";
|
|
10
10
|
import "./chunk-CKH4KQ4E.js";
|
|
@@ -12,7 +12,7 @@ import "./chunk-BXP6YZ2P.js";
|
|
|
12
12
|
import "./chunk-5C76XDDF.js";
|
|
13
13
|
import {
|
|
14
14
|
runTool
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-WPN7LDLM.js";
|
|
16
16
|
import {
|
|
17
17
|
getDangerLevel,
|
|
18
18
|
runLeanAgentLoop
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
import "./chunk-TU3L3PW7.js";
|
|
21
21
|
import "./chunk-HOSJZMQS.js";
|
|
22
22
|
import "./chunk-4BKXL7SM.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-XLLUQEGO.js";
|
|
24
24
|
import {
|
|
25
25
|
SUBAGENT_ALLOWED_TOOLS
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-THHPKZJ3.js";
|
|
27
27
|
import "./chunk-6RPGQ5CG.js";
|
|
28
28
|
import "./chunk-KHYD3WXE.js";
|
|
29
29
|
import "./chunk-NYNSYLFY.js";
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
CostTracker
|
|
4
|
-
} from "./chunk-V4D7YD24.js";
|
|
5
|
-
import {
|
|
3
|
+
CostTracker,
|
|
6
4
|
formatCost,
|
|
7
5
|
getPricing
|
|
8
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-R7GERZDA.js";
|
|
9
7
|
import {
|
|
10
8
|
ConfigManager
|
|
11
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EWRZMIQE.js";
|
|
12
10
|
import "./chunk-TU3L3PW7.js";
|
|
13
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-THHPKZJ3.js";
|
|
14
12
|
import "./chunk-IW3Q7AE5.js";
|
|
15
13
|
|
|
16
14
|
// src/cli/usage.ts
|