jinzd-ai-cli 0.4.290 → 0.4.292

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.
Files changed (34) hide show
  1. package/dist/{batch-3QQLJSYH.js → batch-CE6UCXLZ.js} +2 -2
  2. package/dist/{chunk-YITLNEX7.js → chunk-3YOMCCFP.js} +1 -1
  3. package/dist/{chunk-LWPWBRAC.js → chunk-4J6R2VFW.js} +6 -0
  4. package/dist/{chunk-GXNILAM5.js → chunk-622UJ463.js} +1 -1
  5. package/dist/{chunk-EGMQSUWD.js → chunk-CNLTYENQ.js} +4 -4
  6. package/dist/{chunk-KAVF7OJI.js → chunk-F4ZNXA2R.js} +1 -1
  7. package/dist/{chunk-3D7OXXJE.js → chunk-FFXTGDPY.js} +1 -1
  8. package/dist/{chunk-CLIKHJEM.js → chunk-GKIKDPQW.js} +1 -1
  9. package/dist/{chunk-K7PDUCU4.js → chunk-J6S2AHVT.js} +1 -1
  10. package/dist/{chunk-SH3WPZAK.js → chunk-MQPP52TH.js} +1 -1
  11. package/dist/{chunk-4SITZEDE.js → chunk-QE24GSD3.js} +4 -4
  12. package/dist/{chunk-ALSSNFNK.js → chunk-QMQFTZ7H.js} +15 -1
  13. package/dist/{chunk-EELSGSCB.js → chunk-RJ2UG2AE.js} +1 -1
  14. package/dist/{chunk-2ZN3PQN3.js → chunk-UPMEREEO.js} +4 -4
  15. package/dist/{chunk-PQLSZ5JZ.js → chunk-XMCIDG4I.js} +1 -1
  16. package/dist/{chunk-GS3D5JD5.js → chunk-XTZ5CYQ7.js} +8 -8
  17. package/dist/{ci-3RLPFWYH.js → ci-3W2GIZTH.js} +5 -5
  18. package/dist/{ci-format-LLCJQ5S7.js → ci-format-Z5N4I2I7.js} +2 -2
  19. package/dist/{constants-CVOYPAQ3.js → constants-7UM6N43C.js} +1 -1
  20. package/dist/{constants-SSEYI6LA.js → constants-PTLZWL6L.js} +1 -1
  21. package/dist/{doctor-cli-RPWM4TLA.js → doctor-cli-NUUXNPPD.js} +5 -5
  22. package/dist/electron-server.js +31 -11
  23. package/dist/{hub-FRUQE7P2.js → hub-TQ2KT3ET.js} +1 -1
  24. package/dist/index.js +35 -21
  25. package/dist/{persistent-memory-UXE5JSDX.js → persistent-memory-NX5TEFQ5.js} +2 -2
  26. package/dist/{persistent-memory-QYJLTJE5.js → persistent-memory-XFACQWXQ.js} +2 -2
  27. package/dist/{pr-HUPJIIWU.js → pr-5I7Y7542.js} +5 -5
  28. package/dist/{run-tests-APKDKVMR.js → run-tests-G5E6LLD4.js} +2 -2
  29. package/dist/{run-tests-UDVBDBDA.js → run-tests-QXIZ743O.js} +2 -2
  30. package/dist/{server-PMFOOLT7.js → server-7EX7ACXC.js} +15 -15
  31. package/dist/{server-LAMLLOEO.js → server-YU3BZM73.js} +5 -5
  32. package/dist/{task-orchestrator-OF2ZI62A.js → task-orchestrator-QXLUSBYZ.js} +5 -5
  33. package/dist/{usage-X4HEHN2T.js → usage-PMS676RM.js} +3 -3
  34. package/package.json +1 -1
@@ -4,12 +4,12 @@ import {
4
4
  } from "./chunk-RS7SKYTS.js";
5
5
  import {
6
6
  ConfigManager
7
- } from "./chunk-PQLSZ5JZ.js";
7
+ } from "./chunk-XMCIDG4I.js";
8
8
  import "./chunk-TU3L3PW7.js";
9
9
  import {
10
10
  atomicWriteFileSync
11
11
  } from "./chunk-IW3Q7AE5.js";
12
- import "./chunk-SH3WPZAK.js";
12
+ import "./chunk-MQPP52TH.js";
13
13
 
14
14
  // src/cli/batch.ts
15
15
  import Anthropic from "@anthropic-ai/sdk";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TEST_TIMEOUT
3
- } from "./chunk-CLIKHJEM.js";
3
+ } from "./chunk-GKIKDPQW.js";
4
4
 
5
5
  // src/tools/builtin/run-tests.ts
6
6
  import { execSync, spawnSync } from "child_process";
@@ -98,6 +98,12 @@ var PRICING_TABLE = {
98
98
  // GLM-5.3(2026-08-14 发布)官方公告口径「与 GLM-5.2 同价」,直连 API $1.40 / $4.40。
99
99
  // 注意它**始终思考**,思考 token 按输出价计费 —— 实际成本高度取决于 reasoning_effort。
100
100
  "glm-5.3": { input: 1.4, output: 4.4 },
101
+ // GLM-5.3-Flash:官方定价页(open.bigmodel.cn/pricing)一手数字——输入 0.8 元、
102
+ // 输出 2.8 元、缓存命中 0.23 元(每百万 token),按记账汇率 ¥6.9/$1 换算。
103
+ // **刻意记恢复价而非当前的 5 折限时价**(0.4/1.4/0.115 元):官方只说「限时两周」、
104
+ // 没公布截止日期,静态表表达不了这个时间维度;高估比低估安全——预算告警早触发
105
+ // 好过晚触发。折扣期内 `/cost` 会比实际偏高约一倍,这是刻意的取舍。
106
+ "glm-5.3-flash": { input: 0.116, output: 0.406, cacheRead: 0.033 },
101
107
  // GLM-5.2(2026-06)官方直连 API 定价 $1.40 / $4.40。
102
108
  "glm-5.2": { input: 1.4, output: 4.4 },
103
109
  // GLM-5V-Turbo(2026-04 视觉编程旗舰)官方直连 API 定价 $1.20 / $4.00。
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-SH3WPZAK.js";
4
+ } from "./chunk-MQPP52TH.js";
5
5
 
6
6
  // src/cli/ci-format.ts
7
7
  var DEFAULT_CI_THRESHOLDS = {
@@ -11,7 +11,7 @@ import {
11
11
  searchPersistentMemories,
12
12
  touchMemoryReferences,
13
13
  updateMemoryEntry
14
- } from "./chunk-EELSGSCB.js";
14
+ } from "./chunk-RJ2UG2AE.js";
15
15
  import {
16
16
  indexProject
17
17
  } from "./chunk-4DEMGCK4.js";
@@ -30,7 +30,7 @@ import {
30
30
  runHook,
31
31
  runLifecycleHooks,
32
32
  runTool
33
- } from "./chunk-KAVF7OJI.js";
33
+ } from "./chunk-F4ZNXA2R.js";
34
34
  import {
35
35
  buildTruncatedArgumentsError,
36
36
  getDangerLevel,
@@ -50,7 +50,7 @@ import {
50
50
  } from "./chunk-4BKXL7SM.js";
51
51
  import {
52
52
  runTestsTool
53
- } from "./chunk-K7PDUCU4.js";
53
+ } from "./chunk-J6S2AHVT.js";
54
54
  import {
55
55
  CONFIG_DIR_NAME,
56
56
  DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
@@ -58,7 +58,7 @@ import {
58
58
  SUBAGENT_ALLOWED_TOOLS,
59
59
  SUBAGENT_DEFAULT_MAX_ROUNDS,
60
60
  SUBAGENT_MAX_ROUNDS_LIMIT
61
- } from "./chunk-SH3WPZAK.js";
61
+ } from "./chunk-MQPP52TH.js";
62
62
 
63
63
  // src/tools/shell-pool.ts
64
64
  import { spawn as spawn2 } from "child_process";
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  CONFIG_DIR_NAME,
10
10
  PLUGINS_DIR_NAME
11
- } from "./chunk-SH3WPZAK.js";
11
+ } from "./chunk-MQPP52TH.js";
12
12
 
13
13
  // src/diagnostics/tool-stats.ts
14
14
  import { mkdirSync } from "fs";
@@ -12,7 +12,7 @@ import {
12
12
  MEMORY_FILE_NAME,
13
13
  MEMORY_MAX_CHARS,
14
14
  MEMORY_STORE_FILE_NAME
15
- } from "./chunk-CLIKHJEM.js";
15
+ } from "./chunk-GKIKDPQW.js";
16
16
 
17
17
  // src/memory/persistent-memory.ts
18
18
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -1,5 +1,5 @@
1
1
  // src/core/constants.ts
2
- var VERSION = "0.4.290";
2
+ var VERSION = "0.4.292";
3
3
  var APP_NAME = "ai-cli";
4
4
  var CONFIG_DIR_NAME = ".aicli";
5
5
  var CONFIG_FILE_NAME = "config.json";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-SH3WPZAK.js";
4
+ } from "./chunk-MQPP52TH.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync, spawnSync } from "child_process";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.290";
4
+ var VERSION = "0.4.292";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  evaluateCiGate,
4
4
  normalizeCiThresholds
5
- } from "./chunk-GXNILAM5.js";
5
+ } from "./chunk-622UJ463.js";
6
6
  import {
7
7
  buildReviewPrompt,
8
8
  buildSecurityReviewPrompt,
@@ -13,13 +13,13 @@ import {
13
13
  } from "./chunk-6YZEZFX5.js";
14
14
  import {
15
15
  ProviderRegistry
16
- } from "./chunk-ALSSNFNK.js";
16
+ } from "./chunk-QMQFTZ7H.js";
17
17
  import {
18
18
  ConfigManager
19
- } from "./chunk-PQLSZ5JZ.js";
19
+ } from "./chunk-XMCIDG4I.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-SH3WPZAK.js";
22
+ } from "./chunk-MQPP52TH.js";
23
23
 
24
24
  // src/cli/ci.ts
25
25
  import { execFileSync } from "child_process";
@@ -1248,7 +1248,9 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1248
1248
  });
1249
1249
  let thinkingStarted = false;
1250
1250
  let reasoningAccumulator = "";
1251
+ let pendingUsage;
1251
1252
  for await (const chunk of stream) {
1253
+ if (chunk.usage) pendingUsage = toUsage(chunk.usage);
1252
1254
  const choice = chunk.choices[0];
1253
1255
  const done = choice?.finish_reason != null;
1254
1256
  if (!choice && chunk.usage) {
@@ -1276,7 +1278,14 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1276
1278
  yield { delta: "</think>", done: false };
1277
1279
  }
1278
1280
  if (done) {
1279
- yield { delta, done, ...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {} };
1281
+ yield {
1282
+ delta,
1283
+ done,
1284
+ // usage 与 finish_reason 同条时(智谱),必须在这里带出去——否则流就结束了,
1285
+ // 再也没有第二次机会。
1286
+ ...pendingUsage ? { usage: pendingUsage } : {},
1287
+ ...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {}
1288
+ };
1280
1289
  } else {
1281
1290
  yield { delta, done };
1282
1291
  }
@@ -1431,8 +1440,10 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1431
1440
  let reasoningAccumulator = "";
1432
1441
  let lastFinishReason;
1433
1442
  let doneEmitted = false;
1443
+ let pendingUsage;
1434
1444
  for await (const chunk of stream) {
1435
1445
  const choice = chunk.choices[0];
1446
+ if (chunk.usage) pendingUsage = toUsage(chunk.usage);
1436
1447
  if (choice?.finish_reason) lastFinishReason = choice.finish_reason;
1437
1448
  if (!choice && chunk.usage) {
1438
1449
  if (thinkingStarted) {
@@ -1513,6 +1524,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1513
1524
  }
1514
1525
  yield {
1515
1526
  type: "done",
1527
+ // usage 与 finish_reason 同条时(智谱),只有这里带得出去——流已经结束了,没有第二次机会。
1528
+ ...pendingUsage ? { usage: pendingUsage } : {},
1516
1529
  ...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {},
1517
1530
  ...lastFinishReason && lastFinishReason !== "stop" ? { finishReason: lastFinishReason } : {}
1518
1531
  };
@@ -1736,6 +1749,7 @@ var ZHIPU_CONFIG = {
1736
1749
  defaultTimeout: 3e5,
1737
1750
  models: [
1738
1751
  { id: "glm-5.3", displayName: "GLM-5.3 (2026-08 Flagship, 1M, Coding/Security, \u59CB\u7EC8\u601D\u8003)", contextWindow: 1048576, supportsStreaming: true, supportsThinking: true },
1752
+ { id: "glm-5.3-flash", displayName: "GLM-5.3 Flash (\u539F\u751F\u591A\u6A21\u6001, 1M, \u8F93\u5165\u7EA6\u4E3A 5.3 \u7684 1/10, \u59CB\u7EC8\u601D\u8003)", contextWindow: 1048576, supportsStreaming: true, supportsThinking: true },
1739
1753
  { id: "glm-5.2", displayName: "GLM-5.2 (2026-06 Flagship, 1M, Coding)", contextWindow: 1048576, supportsStreaming: true, supportsThinking: true },
1740
1754
  { id: "glm-5v-turbo", displayName: "GLM-5V-Turbo (Multimodal Vision + Coding)", contextWindow: 202752, supportsStreaming: true },
1741
1755
  { id: "glm-5.1", displayName: "GLM-5.1 (2026 Flagship, 200K, Agent+Code)", contextWindow: 204800, supportsStreaming: true, supportsThinking: true },
@@ -13,7 +13,7 @@ import {
13
13
  MEMORY_FILE_NAME,
14
14
  MEMORY_MAX_CHARS,
15
15
  MEMORY_STORE_FILE_NAME
16
- } from "./chunk-SH3WPZAK.js";
16
+ } from "./chunk-MQPP52TH.js";
17
17
 
18
18
  // src/memory/persistent-memory.ts
19
19
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -8,13 +8,13 @@ import {
8
8
  listHooks,
9
9
  listInstalledPlugins,
10
10
  resetStats
11
- } from "./chunk-KAVF7OJI.js";
11
+ } from "./chunk-F4ZNXA2R.js";
12
12
  import {
13
13
  ProviderRegistry
14
- } from "./chunk-ALSSNFNK.js";
14
+ } from "./chunk-QMQFTZ7H.js";
15
15
  import {
16
16
  ConfigManager
17
- } from "./chunk-PQLSZ5JZ.js";
17
+ } from "./chunk-XMCIDG4I.js";
18
18
  import {
19
19
  getGitRoot
20
20
  } from "./chunk-HOSJZMQS.js";
@@ -26,7 +26,7 @@ import {
26
26
  MCP_PROJECT_CONFIG_NAME,
27
27
  MEMORY_FILE_NAME,
28
28
  VERSION
29
- } from "./chunk-SH3WPZAK.js";
29
+ } from "./chunk-MQPP52TH.js";
30
30
 
31
31
  // src/diagnostics/doctor-report.ts
32
32
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
@@ -11,7 +11,7 @@ import {
11
11
  CONFIG_FILE_NAME,
12
12
  HISTORY_DIR_NAME,
13
13
  PLUGINS_DIR_NAME
14
- } from "./chunk-SH3WPZAK.js";
14
+ } from "./chunk-MQPP52TH.js";
15
15
 
16
16
  // src/config/config-manager.ts
17
17
  import { readFileSync, existsSync, mkdirSync } from "fs";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  computeCost,
4
4
  formatCost
5
- } from "./chunk-LWPWBRAC.js";
5
+ } from "./chunk-4J6R2VFW.js";
6
6
  import {
7
7
  clearRecentlyDeniedAutoActions,
8
8
  estimateTokens,
@@ -16,7 +16,7 @@ import {
16
16
  setPreferredAgentName,
17
17
  truncateForPersist,
18
18
  undoStack
19
- } from "./chunk-EGMQSUWD.js";
19
+ } from "./chunk-CNLTYENQ.js";
20
20
  import {
21
21
  buildReviewPrompt,
22
22
  buildSecurityReviewPrompt
@@ -51,7 +51,7 @@ import {
51
51
  touchMemoryReferences,
52
52
  updateMemoryApproval,
53
53
  updateMemoryEntry
54
- } from "./chunk-EELSGSCB.js";
54
+ } from "./chunk-RJ2UG2AE.js";
55
55
  import {
56
56
  theme
57
57
  } from "./chunk-5C76XDDF.js";
@@ -65,7 +65,7 @@ import {
65
65
  import {
66
66
  buildDoctorReport,
67
67
  formatDoctorReport
68
- } from "./chunk-2ZN3PQN3.js";
68
+ } from "./chunk-UPMEREEO.js";
69
69
  import {
70
70
  describePlugin,
71
71
  getActivePluginAssets,
@@ -80,7 +80,7 @@ import {
80
80
  trustHook,
81
81
  trustPlugin,
82
82
  untrustHook
83
- } from "./chunk-KAVF7OJI.js";
83
+ } from "./chunk-F4ZNXA2R.js";
84
84
  import {
85
85
  isCleanDocumentBody,
86
86
  stripOuterCodeFence
@@ -109,7 +109,7 @@ import {
109
109
  MCP_TOOL_PREFIX,
110
110
  REPO_URL,
111
111
  VERSION
112
- } from "./chunk-SH3WPZAK.js";
112
+ } from "./chunk-MQPP52TH.js";
113
113
 
114
114
  // src/mcp/client.ts
115
115
  import { spawn } from "child_process";
@@ -2393,7 +2393,7 @@ No tools match "${filter}".
2393
2393
  const { join: join6 } = await import("path");
2394
2394
  const { existsSync: existsSync6 } = await import("fs");
2395
2395
  const { getGitRoot } = await import("./git-context-EXOEHQSF.js");
2396
- const { MCP_PROJECT_CONFIG_NAME } = await import("./constants-CVOYPAQ3.js");
2396
+ const { MCP_PROJECT_CONFIG_NAME } = await import("./constants-7UM6N43C.js");
2397
2397
  const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
2398
2398
  const cwd = process.cwd();
2399
2399
  const projectRoot = getGitRoot(cwd) ?? cwd;
@@ -3497,7 +3497,7 @@ function createReviewCommands() {
3497
3497
  usage: "/test [command|filter]",
3498
3498
  async execute(args, ctx) {
3499
3499
  try {
3500
- const { executeTests } = await import("./run-tests-APKDKVMR.js");
3500
+ const { executeTests } = await import("./run-tests-G5E6LLD4.js");
3501
3501
  const argStr = args.join(" ").trim();
3502
3502
  let testArgs = {};
3503
3503
  if (argStr) {
@@ -3,16 +3,16 @@ import {
3
3
  CI_COMMENT_MARKER,
4
4
  countSeverity,
5
5
  runCi
6
- } from "./chunk-4SITZEDE.js";
7
- import "./chunk-GXNILAM5.js";
6
+ } from "./chunk-QE24GSD3.js";
7
+ import "./chunk-622UJ463.js";
8
8
  import "./chunk-HLWUDRBO.js";
9
9
  import "./chunk-6YZEZFX5.js";
10
- import "./chunk-ALSSNFNK.js";
11
- import "./chunk-PQLSZ5JZ.js";
10
+ import "./chunk-QMQFTZ7H.js";
11
+ import "./chunk-XMCIDG4I.js";
12
12
  import "./chunk-TEXT4DAT.js";
13
13
  import "./chunk-TU3L3PW7.js";
14
14
  import "./chunk-IW3Q7AE5.js";
15
- import "./chunk-SH3WPZAK.js";
15
+ import "./chunk-MQPP52TH.js";
16
16
  export {
17
17
  CI_COMMENT_MARKER,
18
18
  countSeverity,
@@ -6,8 +6,8 @@ import {
6
6
  formatCiResult,
7
7
  formatCiSarif,
8
8
  normalizeCiThresholds
9
- } from "./chunk-GXNILAM5.js";
10
- import "./chunk-SH3WPZAK.js";
9
+ } from "./chunk-622UJ463.js";
10
+ import "./chunk-MQPP52TH.js";
11
11
  export {
12
12
  DEFAULT_CI_THRESHOLDS,
13
13
  detectCiGateSignals,
@@ -38,7 +38,7 @@ import {
38
38
  TEST_TIMEOUT,
39
39
  VERSION,
40
40
  buildUserIdentityPrompt
41
- } from "./chunk-SH3WPZAK.js";
41
+ } from "./chunk-MQPP52TH.js";
42
42
  export {
43
43
  AGENTIC_BEHAVIOR_GUIDELINE,
44
44
  APP_NAME,
@@ -37,7 +37,7 @@ import {
37
37
  TEST_TIMEOUT,
38
38
  VERSION,
39
39
  buildUserIdentityPrompt
40
- } from "./chunk-CLIKHJEM.js";
40
+ } from "./chunk-GKIKDPQW.js";
41
41
  export {
42
42
  AGENTIC_BEHAVIOR_GUIDELINE,
43
43
  APP_NAME,
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  formatDoctorReport,
4
4
  runDoctorCli
5
- } from "./chunk-2ZN3PQN3.js";
6
- import "./chunk-KAVF7OJI.js";
5
+ } from "./chunk-UPMEREEO.js";
6
+ import "./chunk-F4ZNXA2R.js";
7
7
  import "./chunk-RS7SKYTS.js";
8
- import "./chunk-ALSSNFNK.js";
9
- import "./chunk-PQLSZ5JZ.js";
8
+ import "./chunk-QMQFTZ7H.js";
9
+ import "./chunk-XMCIDG4I.js";
10
10
  import "./chunk-TEXT4DAT.js";
11
11
  import "./chunk-TU3L3PW7.js";
12
12
  import "./chunk-HOSJZMQS.js";
13
13
  import "./chunk-IW3Q7AE5.js";
14
- import "./chunk-SH3WPZAK.js";
14
+ import "./chunk-MQPP52TH.js";
15
15
  export {
16
16
  formatDoctorReport,
17
17
  runDoctorCli
@@ -50,7 +50,7 @@ import {
50
50
  touchMemoryReferences,
51
51
  updateMemoryApproval,
52
52
  updateMemoryEntry
53
- } from "./chunk-3D7OXXJE.js";
53
+ } from "./chunk-FFXTGDPY.js";
54
54
  import {
55
55
  DEFAULT_PATTERNS,
56
56
  redactJson,
@@ -66,7 +66,7 @@ import {
66
66
  } from "./chunk-CGLYJRFA.js";
67
67
  import {
68
68
  runTestsTool
69
- } from "./chunk-YITLNEX7.js";
69
+ } from "./chunk-3YOMCCFP.js";
70
70
  import {
71
71
  AGENTIC_BEHAVIOR_GUIDELINE,
72
72
  APP_NAME,
@@ -100,7 +100,7 @@ import {
100
100
  SUBAGENT_MAX_ROUNDS_LIMIT,
101
101
  VERSION,
102
102
  buildUserIdentityPrompt
103
- } from "./chunk-CLIKHJEM.js";
103
+ } from "./chunk-GKIKDPQW.js";
104
104
 
105
105
  // src/web/server.ts
106
106
  import express from "express";
@@ -867,6 +867,12 @@ var PRICING_TABLE = {
867
867
  // GLM-5.3(2026-08-14 发布)官方公告口径「与 GLM-5.2 同价」,直连 API $1.40 / $4.40。
868
868
  // 注意它**始终思考**,思考 token 按输出价计费 —— 实际成本高度取决于 reasoning_effort。
869
869
  "glm-5.3": { input: 1.4, output: 4.4 },
870
+ // GLM-5.3-Flash:官方定价页(open.bigmodel.cn/pricing)一手数字——输入 0.8 元、
871
+ // 输出 2.8 元、缓存命中 0.23 元(每百万 token),按记账汇率 ¥6.9/$1 换算。
872
+ // **刻意记恢复价而非当前的 5 折限时价**(0.4/1.4/0.115 元):官方只说「限时两周」、
873
+ // 没公布截止日期,静态表表达不了这个时间维度;高估比低估安全——预算告警早触发
874
+ // 好过晚触发。折扣期内 `/cost` 会比实际偏高约一倍,这是刻意的取舍。
875
+ "glm-5.3-flash": { input: 0.116, output: 0.406, cacheRead: 0.033 },
870
876
  // GLM-5.2(2026-06)官方直连 API 定价 $1.40 / $4.40。
871
877
  "glm-5.2": { input: 1.4, output: 4.4 },
872
878
  // GLM-5V-Turbo(2026-04 视觉编程旗舰)官方直连 API 定价 $1.20 / $4.00。
@@ -3606,7 +3612,9 @@ var OpenAICompatibleProvider = class extends BaseProvider {
3606
3612
  });
3607
3613
  let thinkingStarted = false;
3608
3614
  let reasoningAccumulator = "";
3615
+ let pendingUsage;
3609
3616
  for await (const chunk of stream) {
3617
+ if (chunk.usage) pendingUsage = toUsage(chunk.usage);
3610
3618
  const choice = chunk.choices[0];
3611
3619
  const done = choice?.finish_reason != null;
3612
3620
  if (!choice && chunk.usage) {
@@ -3634,7 +3642,14 @@ var OpenAICompatibleProvider = class extends BaseProvider {
3634
3642
  yield { delta: "</think>", done: false };
3635
3643
  }
3636
3644
  if (done) {
3637
- yield { delta, done, ...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {} };
3645
+ yield {
3646
+ delta,
3647
+ done,
3648
+ // usage 与 finish_reason 同条时(智谱),必须在这里带出去——否则流就结束了,
3649
+ // 再也没有第二次机会。
3650
+ ...pendingUsage ? { usage: pendingUsage } : {},
3651
+ ...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {}
3652
+ };
3638
3653
  } else {
3639
3654
  yield { delta, done };
3640
3655
  }
@@ -3789,8 +3804,10 @@ var OpenAICompatibleProvider = class extends BaseProvider {
3789
3804
  let reasoningAccumulator = "";
3790
3805
  let lastFinishReason;
3791
3806
  let doneEmitted = false;
3807
+ let pendingUsage;
3792
3808
  for await (const chunk of stream) {
3793
3809
  const choice = chunk.choices[0];
3810
+ if (chunk.usage) pendingUsage = toUsage(chunk.usage);
3794
3811
  if (choice?.finish_reason) lastFinishReason = choice.finish_reason;
3795
3812
  if (!choice && chunk.usage) {
3796
3813
  if (thinkingStarted) {
@@ -3871,6 +3888,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
3871
3888
  }
3872
3889
  yield {
3873
3890
  type: "done",
3891
+ // usage 与 finish_reason 同条时(智谱),只有这里带得出去——流已经结束了,没有第二次机会。
3892
+ ...pendingUsage ? { usage: pendingUsage } : {},
3874
3893
  ...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {},
3875
3894
  ...lastFinishReason && lastFinishReason !== "stop" ? { finishReason: lastFinishReason } : {}
3876
3895
  };
@@ -4094,6 +4113,7 @@ var ZHIPU_CONFIG = {
4094
4113
  defaultTimeout: 3e5,
4095
4114
  models: [
4096
4115
  { id: "glm-5.3", displayName: "GLM-5.3 (2026-08 Flagship, 1M, Coding/Security, \u59CB\u7EC8\u601D\u8003)", contextWindow: 1048576, supportsStreaming: true, supportsThinking: true },
4116
+ { id: "glm-5.3-flash", displayName: "GLM-5.3 Flash (\u539F\u751F\u591A\u6A21\u6001, 1M, \u8F93\u5165\u7EA6\u4E3A 5.3 \u7684 1/10, \u59CB\u7EC8\u601D\u8003)", contextWindow: 1048576, supportsStreaming: true, supportsThinking: true },
4097
4117
  { id: "glm-5.2", displayName: "GLM-5.2 (2026-06 Flagship, 1M, Coding)", contextWindow: 1048576, supportsStreaming: true, supportsThinking: true },
4098
4118
  { id: "glm-5v-turbo", displayName: "GLM-5V-Turbo (Multimodal Vision + Coding)", contextWindow: 202752, supportsStreaming: true },
4099
4119
  { id: "glm-5.1", displayName: "GLM-5.1 (2026 Flagship, 200K, Agent+Code)", contextWindow: 204800, supportsStreaming: true, supportsThinking: true },
@@ -16901,7 +16921,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
16901
16921
  Cost: ${formatCost(cost)}` : "";
16902
16922
  let memoryLine = "";
16903
16923
  try {
16904
- const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-QYJLTJE5.js");
16924
+ const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-XFACQWXQ.js");
16905
16925
  const pending = countPendingMemories2(ctx.config.getConfigDir());
16906
16926
  if (pending > 0) memoryLine = `
16907
16927
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -17884,7 +17904,7 @@ async function handleTest(args, ctx) {
17884
17904
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
17885
17905
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
17886
17906
  }
17887
- const runTests = ctx.runTests ?? (await import("./run-tests-UDVBDBDA.js")).executeTests;
17907
+ const runTests = ctx.runTests ?? (await import("./run-tests-QXIZ743O.js")).executeTests;
17888
17908
  const report = await runTests(testArgs);
17889
17909
  ctx.send({ type: "info", message: report });
17890
17910
  } catch (err) {
@@ -18274,7 +18294,7 @@ async function handleMemory(args, ctx) {
18274
18294
  }
18275
18295
  if (intent.kind === "status") {
18276
18296
  const { getChatIndexStatus: getChatIndexStatus2 } = await import("./chat-index-DGUOUUQW.js");
18277
- const { listMemoryEntries: listMemoryEntries2, isMemoryExpired: isMemoryExpired2, formatMemoryForPrompt: formatMemoryForPrompt2 } = await import("./persistent-memory-QYJLTJE5.js");
18297
+ const { listMemoryEntries: listMemoryEntries2, isMemoryExpired: isMemoryExpired2, formatMemoryForPrompt: formatMemoryForPrompt2 } = await import("./persistent-memory-XFACQWXQ.js");
18278
18298
  const memories = listMemoryEntries2(configDir, { includeExpired: true, includeRejected: true });
18279
18299
  const injected = formatMemoryForPrompt2(configDir, process.cwd(), ctx.config.get("memory")?.maxChars);
18280
18300
  const view = buildMemoryStatusView({
@@ -18297,7 +18317,7 @@ async function handleMemory(args, ctx) {
18297
18317
  return;
18298
18318
  }
18299
18319
  if (intent.kind === "recall") {
18300
- const { searchPersistentMemories: searchPersistentMemories2, touchMemoryReferences: touchMemoryReferences2 } = await import("./persistent-memory-QYJLTJE5.js");
18320
+ const { searchPersistentMemories: searchPersistentMemories2, touchMemoryReferences: touchMemoryReferences2 } = await import("./persistent-memory-XFACQWXQ.js");
18301
18321
  const { searchChatMemory: searchChatMemory2 } = await import("./chat-index-DGUOUUQW.js");
18302
18322
  const persistentHits = searchPersistentMemories2(configDir, intent.query, process.cwd(), 3);
18303
18323
  if (persistentHits.length > 0) {
@@ -18418,7 +18438,7 @@ async function handleMemory(args, ctx) {
18418
18438
  ctx.handleMemoryManage(intent.action, args[1], intent.action === "expire" ? args[2] : void 0);
18419
18439
  } else if (intent.kind === "export") {
18420
18440
  if (args[1] === "md") {
18421
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-QYJLTJE5.js");
18441
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-XFACQWXQ.js");
18422
18442
  ctx.send({
18423
18443
  type: "export_data",
18424
18444
  format: "md",
@@ -19423,7 +19443,7 @@ No tools match "${filter}".
19423
19443
  const { join: join29 } = await import("path");
19424
19444
  const { existsSync: existsSync33 } = await import("fs");
19425
19445
  const { getGitRoot: getGitRoot2 } = await import("./git-context-VNCA2GU7.js");
19426
- const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-SSEYI6LA.js");
19446
+ const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-PTLZWL6L.js");
19427
19447
  const { approveProject, hashMcpFile } = await import("./project-trust-MUG325AW.js");
19428
19448
  const cwd = process.cwd();
19429
19449
  const projectRoot = getGitRoot2(cwd) ?? cwd;
@@ -20338,7 +20358,7 @@ function createReviewCommands() {
20338
20358
  usage: "/test [command|filter]",
20339
20359
  async execute(args, ctx) {
20340
20360
  try {
20341
- const { executeTests } = await import("./run-tests-UDVBDBDA.js");
20361
+ const { executeTests } = await import("./run-tests-QXIZ743O.js");
20342
20362
  const argStr = args.join(" ").trim();
20343
20363
  let testArgs = {};
20344
20364
  if (argStr) {
@@ -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-OF2ZI62A.js");
161
+ const { TaskOrchestrator } = await import("./task-orchestrator-QXLUSBYZ.js");
162
162
  const orchestrator = new TaskOrchestrator(config, providers, configManager);
163
163
  let interrupted = false;
164
164
  const onSigint = () => {
package/dist/index.js CHANGED
@@ -24,12 +24,12 @@ import {
24
24
  setupProxy,
25
25
  snapshotFile,
26
26
  stripRoutingTags
27
- } from "./chunk-GS3D5JD5.js";
27
+ } from "./chunk-XTZ5CYQ7.js";
28
28
  import {
29
29
  CostTracker,
30
30
  getPricing,
31
31
  setCostCurrency
32
- } from "./chunk-LWPWBRAC.js";
32
+ } from "./chunk-4J6R2VFW.js";
33
33
  import {
34
34
  ToolExecutor,
35
35
  ToolRegistry,
@@ -49,7 +49,7 @@ import {
49
49
  setMaxOutputCap,
50
50
  spawnAgentContext,
51
51
  undoStack
52
- } from "./chunk-EGMQSUWD.js";
52
+ } from "./chunk-CNLTYENQ.js";
53
53
  import "./chunk-HLWUDRBO.js";
54
54
  import {
55
55
  NO_THINKING,
@@ -62,7 +62,7 @@ import {
62
62
  countPendingMemories,
63
63
  detectStaleLegacyMarkdownEdit,
64
64
  formatMemoryForPrompt
65
- } from "./chunk-EELSGSCB.js";
65
+ } from "./chunk-RJ2UG2AE.js";
66
66
  import "./chunk-4DEMGCK4.js";
67
67
  import "./chunk-UUSRWSSX.js";
68
68
  import "./chunk-CKH4KQ4E.js";
@@ -83,22 +83,22 @@ import {
83
83
  import {
84
84
  loadContextFiles,
85
85
  writeCrashLog
86
- } from "./chunk-2ZN3PQN3.js";
86
+ } from "./chunk-UPMEREEO.js";
87
87
  import {
88
88
  getActivePluginAssets,
89
89
  getPendingHookTrust,
90
90
  installFlushOnExit,
91
91
  mergePluginHooks,
92
92
  runLifecycleHooks
93
- } from "./chunk-KAVF7OJI.js";
93
+ } from "./chunk-F4ZNXA2R.js";
94
94
  import "./chunk-RS7SKYTS.js";
95
95
  import {
96
96
  ProviderRegistry,
97
97
  listBuiltInProviderMetadata
98
- } from "./chunk-ALSSNFNK.js";
98
+ } from "./chunk-QMQFTZ7H.js";
99
99
  import {
100
100
  ConfigManager
101
- } from "./chunk-PQLSZ5JZ.js";
101
+ } from "./chunk-XMCIDG4I.js";
102
102
  import {
103
103
  CONTENT_ONLY_STREAM_REMINDER,
104
104
  TEE_FINAL_USER_NUDGE,
@@ -132,7 +132,7 @@ import {
132
132
  } from "./chunk-IW3Q7AE5.js";
133
133
  import "./chunk-XNFIYS7G.js";
134
134
  import "./chunk-4BKXL7SM.js";
135
- import "./chunk-K7PDUCU4.js";
135
+ import "./chunk-J6S2AHVT.js";
136
136
  import {
137
137
  AGENTIC_BEHAVIOR_GUIDELINE,
138
138
  AUTHOR,
@@ -149,7 +149,7 @@ import {
149
149
  SKILLS_DIR_NAME,
150
150
  VERSION,
151
151
  buildUserIdentityPrompt
152
- } from "./chunk-SH3WPZAK.js";
152
+ } from "./chunk-MQPP52TH.js";
153
153
 
154
154
  // src/index.ts
155
155
  import { program } from "commander";
@@ -1071,6 +1071,7 @@ function getVisionModelHint(model, provider) {
1071
1071
  if (provider === "gemini") return null;
1072
1072
  if (model.includes("vision") || model.includes("vl") || model.includes("5v") || // glm-5v-turbo
1073
1073
  model.endsWith(".6v") || // glm-4.6v
1074
+ model === "glm-5.3-flash" || // GLM-5 系列首个原生多模态(名字里没有 v,得单独认)
1074
1075
  model.endsWith("-v")) return null;
1075
1076
  if (provider === "kimi") {
1076
1077
  if (model.startsWith("moonshot-v1-")) {
@@ -1080,7 +1081,7 @@ function getVisionModelHint(model, provider) {
1080
1081
  return null;
1081
1082
  }
1082
1083
  if (provider === "zhipu") {
1083
- return `model "${model}" does not support images. Use /model glm-4.6v`;
1084
+ return `model "${model}" does not support images. Use /model glm-5.3-flash (or glm-4.6v)`;
1084
1085
  }
1085
1086
  if (provider === "deepseek") {
1086
1087
  return `model "${model}" does not support vision. DeepSeek standard models are text-only.`;
@@ -3991,7 +3992,7 @@ program.command("web").description("Start Web UI server with browser-based chat
3991
3992
  console.error("Error: Invalid port number. Must be between 1 and 65535.");
3992
3993
  process.exit(1);
3993
3994
  }
3994
- const { startWebServer } = await import("./server-PMFOOLT7.js");
3995
+ const { startWebServer } = await import("./server-7EX7ACXC.js");
3995
3996
  await startWebServer({ port, host: options.host });
3996
3997
  });
3997
3998
  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) => {
@@ -4158,11 +4159,11 @@ program.command("sessions").description("List recent conversation sessions").opt
4158
4159
  console.log(footer + "\n");
4159
4160
  });
4160
4161
  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) => {
4161
- const { runUsageCli } = await import("./usage-X4HEHN2T.js");
4162
+ const { runUsageCli } = await import("./usage-PMS676RM.js");
4162
4163
  await runUsageCli(options);
4163
4164
  });
4164
4165
  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) => {
4165
- const { runDoctorCli } = await import("./doctor-cli-RPWM4TLA.js");
4166
+ const { runDoctorCli } = await import("./doctor-cli-NUUXNPPD.js");
4166
4167
  const argv = process.argv.slice(2);
4167
4168
  await runDoctorCli({
4168
4169
  json: !!options.json || argv.includes("--json"),
@@ -4171,7 +4172,7 @@ program.command("doctor").description("Health check: API keys, config, MCP, rece
4171
4172
  });
4172
4173
  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) => {
4173
4174
  try {
4174
- const batch = await import("./batch-3QQLJSYH.js");
4175
+ const batch = await import("./batch-CE6UCXLZ.js");
4175
4176
  switch (action) {
4176
4177
  case "submit":
4177
4178
  if (!arg) {
@@ -4214,7 +4215,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
4214
4215
  }
4215
4216
  });
4216
4217
  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) => {
4217
- const { startMcpServer } = await import("./server-LAMLLOEO.js");
4218
+ const { startMcpServer } = await import("./server-YU3BZM73.js");
4218
4219
  await startMcpServer({
4219
4220
  allowDestructive: !!options.allowDestructive,
4220
4221
  allowOutsideCwd: !!options.allowOutsideCwd,
@@ -4227,7 +4228,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
4227
4228
  console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
4228
4229
  process.exit(1);
4229
4230
  }
4230
- const { runPrCli } = await import("./pr-HUPJIIWU.js");
4231
+ const { runPrCli } = await import("./pr-5I7Y7542.js");
4231
4232
  const result = await runPrCli({
4232
4233
  action,
4233
4234
  target,
@@ -4247,8 +4248,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
4247
4248
  process.exit(result.exitCode);
4248
4249
  });
4249
4250
  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) => {
4250
- const { runCi } = await import("./ci-3RLPFWYH.js");
4251
- const { formatCiResult } = await import("./ci-format-LLCJQ5S7.js");
4251
+ const { runCi } = await import("./ci-3W2GIZTH.js");
4252
+ const { formatCiResult } = await import("./ci-format-Z5N4I2I7.js");
4252
4253
  const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
4253
4254
  if (formats > 1) {
4254
4255
  console.error("Choose only one output format: --json, --markdown, or --sarif.");
@@ -4406,7 +4407,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
4406
4407
  config.get("customProviders"),
4407
4408
  config.getConfigDir()
4408
4409
  );
4409
- const { startHub } = await import("./hub-FRUQE7P2.js");
4410
+ const { startHub } = await import("./hub-TQ2KT3ET.js");
4410
4411
  await startHub(
4411
4412
  {
4412
4413
  topic: topic ?? "",
@@ -4535,6 +4536,12 @@ ${loaded.mergedContent}` : void 0
4535
4536
  }
4536
4537
  const isStreamingJson = options.outputFormat === "streaming-json";
4537
4538
  const useStream = options.stream !== false && !options.json && !isStreamingJson;
4539
+ const costTracker = new CostTracker(config.getConfigDir());
4540
+ const recordUsage = (u) => {
4541
+ if (!u) return;
4542
+ if (u.inputTokens === 0 && u.outputTokens === 0) return;
4543
+ costTracker.addCost(providerId, model, u);
4544
+ };
4538
4545
  try {
4539
4546
  if (isStreamingJson) {
4540
4547
  const stream = provider.chatStream({
@@ -4566,6 +4573,7 @@ ${loaded.mergedContent}` : void 0
4566
4573
  model
4567
4574
  };
4568
4575
  if (finalUsage) doneOut["usage"] = finalUsage;
4576
+ recordUsage(finalUsage);
4569
4577
  process.stdout.write(JSON.stringify(doneOut) + "\n");
4570
4578
  } else if (options.json) {
4571
4579
  const response = await provider.chat({
@@ -4584,6 +4592,7 @@ ${loaded.mergedContent}` : void 0
4584
4592
  model: response.model ?? model,
4585
4593
  usage: response.usage ?? null
4586
4594
  };
4595
+ recordUsage(response.usage);
4587
4596
  process.stdout.write(JSON.stringify(out, null, 2) + "\n");
4588
4597
  } else if (useStream) {
4589
4598
  const stream = provider.chatStream({
@@ -4596,10 +4605,12 @@ ${loaded.mergedContent}` : void 0
4596
4605
  timeout,
4597
4606
  ...thinkingParams
4598
4607
  });
4608
+ let streamUsage;
4599
4609
  for await (const chunk of stream) {
4600
- if (chunk.done) break;
4610
+ if (chunk.usage) streamUsage = chunk.usage;
4601
4611
  if (chunk.delta) process.stdout.write(chunk.delta);
4602
4612
  }
4613
+ recordUsage(streamUsage);
4603
4614
  process.stdout.write("\n");
4604
4615
  } else {
4605
4616
  const response = await provider.chat({
@@ -4612,10 +4623,13 @@ ${loaded.mergedContent}` : void 0
4612
4623
  timeout,
4613
4624
  ...thinkingParams
4614
4625
  });
4626
+ recordUsage(response.usage);
4615
4627
  process.stdout.write(response.content + "\n");
4616
4628
  }
4629
+ costTracker.flush();
4617
4630
  process.exit(0);
4618
4631
  } catch (err) {
4632
+ costTracker.flush();
4619
4633
  const msg = err instanceof Error ? err.message : String(err);
4620
4634
  process.stderr.write(`Error: ${msg}
4621
4635
  `);
@@ -28,11 +28,11 @@ import {
28
28
  touchMemoryReferences,
29
29
  updateMemoryApproval,
30
30
  updateMemoryEntry
31
- } from "./chunk-EELSGSCB.js";
31
+ } from "./chunk-RJ2UG2AE.js";
32
32
  import "./chunk-3FEZSLGI.js";
33
33
  import "./chunk-HOSJZMQS.js";
34
34
  import "./chunk-IW3Q7AE5.js";
35
- import "./chunk-SH3WPZAK.js";
35
+ import "./chunk-MQPP52TH.js";
36
36
  export {
37
37
  addMemoryEntry,
38
38
  backupMemoryStore,
@@ -27,11 +27,11 @@ import {
27
27
  touchMemoryReferences,
28
28
  updateMemoryApproval,
29
29
  updateMemoryEntry
30
- } from "./chunk-3D7OXXJE.js";
30
+ } from "./chunk-FFXTGDPY.js";
31
31
  import "./chunk-FSC6KEWU.js";
32
32
  import "./chunk-6BUTA5VW.js";
33
33
  import "./chunk-CGLYJRFA.js";
34
- import "./chunk-CLIKHJEM.js";
34
+ import "./chunk-GKIKDPQW.js";
35
35
  export {
36
36
  addMemoryEntry,
37
37
  backupMemoryStore,
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  countSeverity,
4
4
  runCi
5
- } from "./chunk-4SITZEDE.js";
6
- import "./chunk-GXNILAM5.js";
5
+ } from "./chunk-QE24GSD3.js";
6
+ import "./chunk-622UJ463.js";
7
7
  import {
8
8
  buildReviewPrompt,
9
9
  buildSecurityReviewPrompt,
@@ -14,16 +14,16 @@ import {
14
14
  } from "./chunk-6YZEZFX5.js";
15
15
  import {
16
16
  ProviderRegistry
17
- } from "./chunk-ALSSNFNK.js";
17
+ } from "./chunk-QMQFTZ7H.js";
18
18
  import {
19
19
  ConfigManager
20
- } from "./chunk-PQLSZ5JZ.js";
20
+ } from "./chunk-XMCIDG4I.js";
21
21
  import "./chunk-TEXT4DAT.js";
22
22
  import "./chunk-TU3L3PW7.js";
23
23
  import "./chunk-IW3Q7AE5.js";
24
24
  import {
25
25
  VERSION
26
- } from "./chunk-SH3WPZAK.js";
26
+ } from "./chunk-MQPP52TH.js";
27
27
 
28
28
  // src/cli/pr.ts
29
29
  import { execFileSync } from "child_process";
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  executeTests,
4
4
  runTestsTool
5
- } from "./chunk-K7PDUCU4.js";
6
- import "./chunk-SH3WPZAK.js";
5
+ } from "./chunk-J6S2AHVT.js";
6
+ import "./chunk-MQPP52TH.js";
7
7
  export {
8
8
  executeTests,
9
9
  runTestsTool
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  executeTests,
3
3
  runTestsTool
4
- } from "./chunk-YITLNEX7.js";
5
- import "./chunk-CLIKHJEM.js";
4
+ } from "./chunk-3YOMCCFP.js";
5
+ import "./chunk-GKIKDPQW.js";
6
6
  export {
7
7
  executeTests,
8
8
  runTestsTool
@@ -81,7 +81,7 @@ import {
81
81
  skillHistoryNote,
82
82
  snapshotFile,
83
83
  stripRoutingTags
84
- } from "./chunk-GS3D5JD5.js";
84
+ } from "./chunk-XTZ5CYQ7.js";
85
85
  import {
86
86
  CNY_PER_USD,
87
87
  CostTracker,
@@ -90,7 +90,7 @@ import {
90
90
  getCostCurrency,
91
91
  getPricing,
92
92
  setCostCurrency
93
- } from "./chunk-LWPWBRAC.js";
93
+ } from "./chunk-4J6R2VFW.js";
94
94
  import {
95
95
  ToolExecutor,
96
96
  ToolRegistry,
@@ -126,7 +126,7 @@ import {
126
126
  spawnAgentContext,
127
127
  truncateOutput,
128
128
  undoStack
129
- } from "./chunk-EGMQSUWD.js";
129
+ } from "./chunk-CNLTYENQ.js";
130
130
  import {
131
131
  buildReviewPrompt,
132
132
  buildSecurityReviewPrompt
@@ -153,7 +153,7 @@ import {
153
153
  restoreMemoryEntries,
154
154
  updateMemoryApproval,
155
155
  updateMemoryEntry
156
- } from "./chunk-EELSGSCB.js";
156
+ } from "./chunk-RJ2UG2AE.js";
157
157
  import "./chunk-4DEMGCK4.js";
158
158
  import "./chunk-UUSRWSSX.js";
159
159
  import "./chunk-CKH4KQ4E.js";
@@ -172,7 +172,7 @@ import {
172
172
  buildDoctorReport,
173
173
  formatDoctorReport,
174
174
  loadContextFiles
175
- } from "./chunk-2ZN3PQN3.js";
175
+ } from "./chunk-UPMEREEO.js";
176
176
  import {
177
177
  describePlugin,
178
178
  getActivePluginAssets,
@@ -187,14 +187,14 @@ import {
187
187
  runTool,
188
188
  setPluginEnabled,
189
189
  trustPlugin
190
- } from "./chunk-KAVF7OJI.js";
190
+ } from "./chunk-F4ZNXA2R.js";
191
191
  import "./chunk-RS7SKYTS.js";
192
192
  import {
193
193
  ProviderRegistry
194
- } from "./chunk-ALSSNFNK.js";
194
+ } from "./chunk-QMQFTZ7H.js";
195
195
  import {
196
196
  ConfigManager
197
- } from "./chunk-PQLSZ5JZ.js";
197
+ } from "./chunk-XMCIDG4I.js";
198
198
  import {
199
199
  CONTENT_ONLY_STREAM_REMINDER,
200
200
  TEE_FINAL_USER_NUDGE,
@@ -225,7 +225,7 @@ import {
225
225
  maskConfigSecrets
226
226
  } from "./chunk-XNFIYS7G.js";
227
227
  import "./chunk-4BKXL7SM.js";
228
- import "./chunk-K7PDUCU4.js";
228
+ import "./chunk-J6S2AHVT.js";
229
229
  import {
230
230
  AGENTIC_BEHAVIOR_GUIDELINE,
231
231
  AUTHOR,
@@ -241,7 +241,7 @@ import {
241
241
  SKILLS_DIR_NAME,
242
242
  VERSION,
243
243
  buildUserIdentityPrompt
244
- } from "./chunk-SH3WPZAK.js";
244
+ } from "./chunk-MQPP52TH.js";
245
245
 
246
246
  // src/web/server.ts
247
247
  import express from "express";
@@ -930,7 +930,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
930
930
  Cost: ${formatCost(cost)}` : "";
931
931
  let memoryLine = "";
932
932
  try {
933
- const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-UXE5JSDX.js");
933
+ const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-NX5TEFQ5.js");
934
934
  const pending = countPendingMemories2(ctx.config.getConfigDir());
935
935
  if (pending > 0) memoryLine = `
936
936
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -1854,7 +1854,7 @@ async function handleTest(args, ctx) {
1854
1854
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
1855
1855
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
1856
1856
  }
1857
- const runTests = ctx.runTests ?? (await import("./run-tests-APKDKVMR.js")).executeTests;
1857
+ const runTests = ctx.runTests ?? (await import("./run-tests-G5E6LLD4.js")).executeTests;
1858
1858
  const report = await runTests(testArgs);
1859
1859
  ctx.send({ type: "info", message: report });
1860
1860
  } catch (err) {
@@ -2129,7 +2129,7 @@ async function handleMemory(args, ctx) {
2129
2129
  }
2130
2130
  if (intent.kind === "status") {
2131
2131
  const { getChatIndexStatus } = await import("./chat-index-2D5GK2DB.js");
2132
- const { listMemoryEntries: listMemoryEntries2, isMemoryExpired: isMemoryExpired2, formatMemoryForPrompt: formatMemoryForPrompt2 } = await import("./persistent-memory-UXE5JSDX.js");
2132
+ const { listMemoryEntries: listMemoryEntries2, isMemoryExpired: isMemoryExpired2, formatMemoryForPrompt: formatMemoryForPrompt2 } = await import("./persistent-memory-NX5TEFQ5.js");
2133
2133
  const memories = listMemoryEntries2(configDir, { includeExpired: true, includeRejected: true });
2134
2134
  const injected = formatMemoryForPrompt2(configDir, process.cwd(), ctx.config.get("memory")?.maxChars);
2135
2135
  const view = buildMemoryStatusView({
@@ -2152,7 +2152,7 @@ async function handleMemory(args, ctx) {
2152
2152
  return;
2153
2153
  }
2154
2154
  if (intent.kind === "recall") {
2155
- const { searchPersistentMemories, touchMemoryReferences } = await import("./persistent-memory-UXE5JSDX.js");
2155
+ const { searchPersistentMemories, touchMemoryReferences } = await import("./persistent-memory-NX5TEFQ5.js");
2156
2156
  const { searchChatMemory } = await import("./chat-index-2D5GK2DB.js");
2157
2157
  const persistentHits = searchPersistentMemories(configDir, intent.query, process.cwd(), 3);
2158
2158
  if (persistentHits.length > 0) {
@@ -2273,7 +2273,7 @@ async function handleMemory(args, ctx) {
2273
2273
  ctx.handleMemoryManage(intent.action, args[1], intent.action === "expire" ? args[2] : void 0);
2274
2274
  } else if (intent.kind === "export") {
2275
2275
  if (args[1] === "md") {
2276
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-UXE5JSDX.js");
2276
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-NX5TEFQ5.js");
2277
2277
  ctx.send({
2278
2278
  type: "export_data",
2279
2279
  format: "md",
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ToolRegistry
4
- } from "./chunk-EGMQSUWD.js";
4
+ } from "./chunk-CNLTYENQ.js";
5
5
  import "./chunk-GHWZVPUV.js";
6
- import "./chunk-EELSGSCB.js";
6
+ import "./chunk-RJ2UG2AE.js";
7
7
  import "./chunk-4DEMGCK4.js";
8
8
  import "./chunk-UUSRWSSX.js";
9
9
  import "./chunk-CKH4KQ4E.js";
@@ -14,7 +14,7 @@ import "./chunk-NYNSYLFY.js";
14
14
  import "./chunk-3FEZSLGI.js";
15
15
  import {
16
16
  runTool
17
- } from "./chunk-KAVF7OJI.js";
17
+ } from "./chunk-F4ZNXA2R.js";
18
18
  import "./chunk-RS7SKYTS.js";
19
19
  import {
20
20
  getDangerLevel,
@@ -24,10 +24,10 @@ import "./chunk-TU3L3PW7.js";
24
24
  import "./chunk-HOSJZMQS.js";
25
25
  import "./chunk-IW3Q7AE5.js";
26
26
  import "./chunk-4BKXL7SM.js";
27
- import "./chunk-K7PDUCU4.js";
27
+ import "./chunk-J6S2AHVT.js";
28
28
  import {
29
29
  VERSION
30
- } from "./chunk-SH3WPZAK.js";
30
+ } from "./chunk-MQPP52TH.js";
31
31
 
32
32
  // src/mcp/server.ts
33
33
  import { createInterface } from "readline";
@@ -4,9 +4,9 @@ import {
4
4
  googleSearchContext,
5
5
  isToolCapableProvider,
6
6
  truncateOutput
7
- } from "./chunk-EGMQSUWD.js";
7
+ } from "./chunk-CNLTYENQ.js";
8
8
  import "./chunk-GHWZVPUV.js";
9
- import "./chunk-EELSGSCB.js";
9
+ import "./chunk-RJ2UG2AE.js";
10
10
  import "./chunk-4DEMGCK4.js";
11
11
  import "./chunk-UUSRWSSX.js";
12
12
  import "./chunk-CKH4KQ4E.js";
@@ -17,7 +17,7 @@ import "./chunk-NYNSYLFY.js";
17
17
  import "./chunk-3FEZSLGI.js";
18
18
  import {
19
19
  runTool
20
- } from "./chunk-KAVF7OJI.js";
20
+ } from "./chunk-F4ZNXA2R.js";
21
21
  import "./chunk-RS7SKYTS.js";
22
22
  import {
23
23
  getDangerLevel,
@@ -29,10 +29,10 @@ import {
29
29
  atomicWriteFileSync
30
30
  } from "./chunk-IW3Q7AE5.js";
31
31
  import "./chunk-4BKXL7SM.js";
32
- import "./chunk-K7PDUCU4.js";
32
+ import "./chunk-J6S2AHVT.js";
33
33
  import {
34
34
  SUBAGENT_ALLOWED_TOOLS
35
- } from "./chunk-SH3WPZAK.js";
35
+ } from "./chunk-MQPP52TH.js";
36
36
 
37
37
  // src/hub/task-orchestrator.ts
38
38
  import { createInterface } from "readline";
@@ -5,14 +5,14 @@ import {
5
5
  formatCost,
6
6
  getPricing,
7
7
  setCostCurrency
8
- } from "./chunk-LWPWBRAC.js";
8
+ } from "./chunk-4J6R2VFW.js";
9
9
  import "./chunk-RS7SKYTS.js";
10
10
  import {
11
11
  ConfigManager
12
- } from "./chunk-PQLSZ5JZ.js";
12
+ } from "./chunk-XMCIDG4I.js";
13
13
  import "./chunk-TU3L3PW7.js";
14
14
  import "./chunk-IW3Q7AE5.js";
15
- import "./chunk-SH3WPZAK.js";
15
+ import "./chunk-MQPP52TH.js";
16
16
 
17
17
  // src/cli/usage.ts
18
18
  function classifyRowCost(row) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.4.290",
3
+ "version": "0.4.292",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",