jinzd-ai-cli 0.4.269 → 0.4.270

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 (70) hide show
  1. package/dist/{batch-HUOYPVJQ.js → batch-IMLMUXJL.js} +2 -2
  2. package/dist/{chunk-3TOMHXDW.js → chunk-75SPJKDY.js} +1 -1
  3. package/dist/{chunk-KIHNZBEA.js → chunk-BOMB6XCF.js} +1 -1
  4. package/dist/{chunk-DJNGUPM3.js → chunk-DIJIYWQE.js} +4 -4
  5. package/dist/{chunk-5IUFUCIT.js → chunk-F26YTEMB.js} +9 -1
  6. package/dist/{chunk-XJAGGJVU.js → chunk-FXCDD7JS.js} +3 -3
  7. package/dist/{chunk-6PROC2JO.js → chunk-HOT76ATM.js} +3 -3
  8. package/dist/{chunk-4HTJMLFY.js → chunk-JJVVCWO4.js} +1 -1
  9. package/dist/{chunk-R7GERZDA.js → chunk-JT6UN5C6.js} +26 -5
  10. package/dist/{chunk-5PRWBJCI.js → chunk-M3GDYEUH.js} +1 -1
  11. package/dist/{chunk-AAERHPBN.js → chunk-PLFXDRNX.js} +1 -1
  12. package/dist/{chunk-V6KQ67VF.js → chunk-TG4PF7FZ.js} +1 -1
  13. package/dist/{chunk-NVN3FHXI.js → chunk-UDUE4DAE.js} +1 -1
  14. package/dist/{chunk-S3F5LOV3.js → chunk-X3JPBJ6C.js} +4 -4
  15. package/dist/{chunk-QPPUYCRF.js → chunk-YHLTSZVH.js} +1 -1
  16. package/dist/{ci-4QS2J7BG.js → ci-HQVXWJ53.js} +4 -4
  17. package/dist/{ci-format-6L6M67WC.js → ci-format-762IL4OM.js} +2 -2
  18. package/dist/{constants-IO5VJLEE.js → constants-4TPE3JSV.js} +1 -1
  19. package/dist/{doctor-cli-ZU4E2DDL.js → doctor-cli-3ES6NFVL.js} +4 -4
  20. package/dist/electron-server.js +61 -13
  21. package/dist/{hub-AMDWXSKZ.js → hub-QXRWPBJP.js} +1 -1
  22. package/dist/index.js +23 -21
  23. package/dist/{persistent-memory-H4DNDIOQ.js → persistent-memory-F4JPWYZJ.js} +2 -2
  24. package/dist/{persistent-memory-52SE5K44.js → persistent-memory-URIJJJ3N.js} +2 -2
  25. package/dist/{pr-Z4O5H6I3.js → pr-HVVHZOJ2.js} +4 -4
  26. package/dist/{run-tests-PYKKYMPA.js → run-tests-UZG6SVJ5.js} +2 -2
  27. package/dist/{run-tests-FZSYHWYX.js → run-tests-WM7TMO2N.js} +2 -2
  28. package/dist/{server-ZSTVYSYC.js → server-E5OBXT33.js} +5 -5
  29. package/dist/{server-WTJSM2MT.js → server-HPRLFLOI.js} +44 -15
  30. package/dist/{task-orchestrator-PNLI3V36.js → task-orchestrator-HJUUL55Y.js} +5 -5
  31. package/dist/{usage-GVFUVYUG.js → usage-L3DUPHD6.js} +11 -4
  32. package/dist/web/client/actions.js.br +0 -0
  33. package/dist/web/client/actions.js.gz +0 -0
  34. package/dist/web/client/api.js.br +0 -0
  35. package/dist/web/client/api.js.gz +0 -0
  36. package/dist/web/client/app.js +3 -6
  37. package/dist/web/client/app.js.br +0 -0
  38. package/dist/web/client/app.js.gz +0 -0
  39. package/dist/web/client/dom.js.br +0 -0
  40. package/dist/web/client/dom.js.gz +0 -0
  41. package/dist/web/client/icon.svg.br +0 -0
  42. package/dist/web/client/icon.svg.gz +0 -0
  43. package/dist/web/client/index.html.br +0 -0
  44. package/dist/web/client/index.html.gz +0 -0
  45. package/dist/web/client/sidebar-tabs.js.br +0 -0
  46. package/dist/web/client/sidebar-tabs.js.gz +0 -0
  47. package/dist/web/client/state.js.br +0 -0
  48. package/dist/web/client/state.js.gz +0 -0
  49. package/dist/web/client/style.css.br +0 -0
  50. package/dist/web/client/style.css.gz +0 -0
  51. package/dist/web/client/sw.js.br +0 -0
  52. package/dist/web/client/sw.js.gz +0 -0
  53. package/dist/web/client/templates.js.br +0 -0
  54. package/dist/web/client/templates.js.gz +0 -0
  55. package/dist/web/client/util.js +22 -0
  56. package/dist/web/client/util.js.br +0 -0
  57. package/dist/web/client/util.js.gz +0 -0
  58. package/dist/web/client/vendor/daisyui-full.min.css.br +0 -0
  59. package/dist/web/client/vendor/daisyui-full.min.css.gz +0 -0
  60. package/dist/web/client/vendor/github-dark.min.css.br +0 -0
  61. package/dist/web/client/vendor/github-dark.min.css.gz +0 -0
  62. package/dist/web/client/vendor/github.min.css.br +0 -0
  63. package/dist/web/client/vendor/github.min.css.gz +0 -0
  64. package/dist/web/client/vendor/highlight.min.js.br +0 -0
  65. package/dist/web/client/vendor/highlight.min.js.gz +0 -0
  66. package/dist/web/client/vendor/marked.min.js.br +0 -0
  67. package/dist/web/client/vendor/marked.min.js.gz +0 -0
  68. package/dist/web/client/vendor/tailwind.js.br +0 -0
  69. package/dist/web/client/vendor/tailwind.js.gz +0 -0
  70. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25,13 +25,14 @@ import {
25
25
  sessionHasMeaningfulContent,
26
26
  setupProxy,
27
27
  stripRoutingTags
28
- } from "./chunk-S3F5LOV3.js";
28
+ } from "./chunk-X3JPBJ6C.js";
29
29
  import {
30
30
  CostTracker,
31
31
  computeCost,
32
32
  formatCost,
33
- getPricing
34
- } from "./chunk-R7GERZDA.js";
33
+ getPricing,
34
+ setCostCurrency
35
+ } from "./chunk-JT6UN5C6.js";
35
36
  import {
36
37
  buildReviewPrompt,
37
38
  buildSecurityReviewPrompt
@@ -63,7 +64,7 @@ import {
63
64
  setMaxOutputCap,
64
65
  spawnAgentContext,
65
66
  undoStack
66
- } from "./chunk-DJNGUPM3.js";
67
+ } from "./chunk-DIJIYWQE.js";
67
68
  import {
68
69
  addMemoryEntry,
69
70
  backupMemoryStore,
@@ -88,7 +89,7 @@ import {
88
89
  touchMemoryReferences,
89
90
  updateMemoryApproval,
90
91
  updateMemoryEntry
91
- } from "./chunk-QPPUYCRF.js";
92
+ } from "./chunk-YHLTSZVH.js";
92
93
  import "./chunk-GLSR2NR3.js";
93
94
  import "./chunk-UUSRWSSX.js";
94
95
  import "./chunk-CKH4KQ4E.js";
@@ -106,14 +107,14 @@ import {
106
107
  formatDoctorReport,
107
108
  loadContextFiles,
108
109
  writeCrashLog
109
- } from "./chunk-6PROC2JO.js";
110
+ } from "./chunk-HOT76ATM.js";
110
111
  import {
111
112
  ProviderRegistry,
112
113
  listBuiltInProviderMetadata
113
114
  } from "./chunk-AUEX6RNY.js";
114
115
  import {
115
116
  ConfigManager
116
- } from "./chunk-5IUFUCIT.js";
117
+ } from "./chunk-F26YTEMB.js";
117
118
  import {
118
119
  describePlugin,
119
120
  getActivePluginAssets,
@@ -130,7 +131,7 @@ import {
130
131
  trustHook,
131
132
  trustPlugin,
132
133
  untrustHook
133
- } from "./chunk-5PRWBJCI.js";
134
+ } from "./chunk-M3GDYEUH.js";
134
135
  import {
135
136
  CONTENT_ONLY_STREAM_REMINDER,
136
137
  TEE_FINAL_USER_NUDGE,
@@ -164,7 +165,7 @@ import {
164
165
  import {
165
166
  fileCheckpoints
166
167
  } from "./chunk-4BKXL7SM.js";
167
- import "./chunk-V6KQ67VF.js";
168
+ import "./chunk-TG4PF7FZ.js";
168
169
  import {
169
170
  AGENTIC_BEHAVIOR_GUIDELINE,
170
171
  AUTHOR,
@@ -182,7 +183,7 @@ import {
182
183
  SKILLS_DIR_NAME,
183
184
  VERSION,
184
185
  buildUserIdentityPrompt
185
- } from "./chunk-3TOMHXDW.js";
186
+ } from "./chunk-75SPJKDY.js";
186
187
  import {
187
188
  buildChatIndex,
188
189
  clearChatIndex,
@@ -1403,7 +1404,7 @@ No tools match "${filter}".
1403
1404
  const { join: join6 } = await import("path");
1404
1405
  const { existsSync: existsSync6 } = await import("fs");
1405
1406
  const { getGitRoot: getGitRoot2 } = await import("./git-context-EXOEHQSF.js");
1406
- const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-IO5VJLEE.js");
1407
+ const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-4TPE3JSV.js");
1407
1408
  const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
1408
1409
  const cwd = process.cwd();
1409
1410
  const projectRoot = getGitRoot2(cwd) ?? cwd;
@@ -2356,7 +2357,7 @@ function createReviewCommands() {
2356
2357
  usage: "/test [command|filter]",
2357
2358
  async execute(args, ctx) {
2358
2359
  try {
2359
- const { executeTests } = await import("./run-tests-FZSYHWYX.js");
2360
+ const { executeTests } = await import("./run-tests-WM7TMO2N.js");
2360
2361
  const argStr = args.join(" ").trim();
2361
2362
  let testArgs = {};
2362
2363
  if (argStr) {
@@ -5636,6 +5637,7 @@ Session '${this.resumeSessionId}' not found.
5636
5637
  }
5637
5638
  const cfgOutputCap = this.config.get("maxToolOutputChars");
5638
5639
  if (typeof cfgOutputCap === "number" && cfgOutputCap > 0) setMaxOutputCap(cfgOutputCap);
5640
+ setCostCurrency(this.config.get("ui").currency);
5639
5641
  if (welcomeModelInfo?.contextWindow) setContextWindow(welcomeModelInfo.contextWindow);
5640
5642
  if (this.resumeSessionId) {
5641
5643
  const session = this.sessions.current;
@@ -7560,7 +7562,7 @@ program.command("web").description("Start Web UI server with browser-based chat
7560
7562
  console.error("Error: Invalid port number. Must be between 1 and 65535.");
7561
7563
  process.exit(1);
7562
7564
  }
7563
- const { startWebServer } = await import("./server-WTJSM2MT.js");
7565
+ const { startWebServer } = await import("./server-HPRLFLOI.js");
7564
7566
  await startWebServer({ port, host: options.host });
7565
7567
  });
7566
7568
  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) => {
@@ -7727,11 +7729,11 @@ program.command("sessions").description("List recent conversation sessions").opt
7727
7729
  console.log(footer + "\n");
7728
7730
  });
7729
7731
  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) => {
7730
- const { runUsageCli } = await import("./usage-GVFUVYUG.js");
7732
+ const { runUsageCli } = await import("./usage-L3DUPHD6.js");
7731
7733
  await runUsageCli(options);
7732
7734
  });
7733
7735
  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) => {
7734
- const { runDoctorCli } = await import("./doctor-cli-ZU4E2DDL.js");
7736
+ const { runDoctorCli } = await import("./doctor-cli-3ES6NFVL.js");
7735
7737
  const argv = process.argv.slice(2);
7736
7738
  await runDoctorCli({
7737
7739
  json: !!options.json || argv.includes("--json"),
@@ -7740,7 +7742,7 @@ program.command("doctor").description("Health check: API keys, config, MCP, rece
7740
7742
  });
7741
7743
  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) => {
7742
7744
  try {
7743
- const batch = await import("./batch-HUOYPVJQ.js");
7745
+ const batch = await import("./batch-IMLMUXJL.js");
7744
7746
  switch (action) {
7745
7747
  case "submit":
7746
7748
  if (!arg) {
@@ -7783,7 +7785,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
7783
7785
  }
7784
7786
  });
7785
7787
  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) => {
7786
- const { startMcpServer } = await import("./server-ZSTVYSYC.js");
7788
+ const { startMcpServer } = await import("./server-E5OBXT33.js");
7787
7789
  await startMcpServer({
7788
7790
  allowDestructive: !!options.allowDestructive,
7789
7791
  allowOutsideCwd: !!options.allowOutsideCwd,
@@ -7796,7 +7798,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
7796
7798
  console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
7797
7799
  process.exit(1);
7798
7800
  }
7799
- const { runPrCli } = await import("./pr-Z4O5H6I3.js");
7801
+ const { runPrCli } = await import("./pr-HVVHZOJ2.js");
7800
7802
  const result = await runPrCli({
7801
7803
  action,
7802
7804
  target,
@@ -7816,8 +7818,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
7816
7818
  process.exit(result.exitCode);
7817
7819
  });
7818
7820
  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) => {
7819
- const { runCi } = await import("./ci-4QS2J7BG.js");
7820
- const { formatCiResult } = await import("./ci-format-6L6M67WC.js");
7821
+ const { runCi } = await import("./ci-HQVXWJ53.js");
7822
+ const { formatCiResult } = await import("./ci-format-762IL4OM.js");
7821
7823
  const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
7822
7824
  if (formats > 1) {
7823
7825
  console.error("Choose only one output format: --json, --markdown, or --sarif.");
@@ -7975,7 +7977,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
7975
7977
  config.get("customProviders"),
7976
7978
  config.getConfigDir()
7977
7979
  );
7978
- const { startHub } = await import("./hub-AMDWXSKZ.js");
7980
+ const { startHub } = await import("./hub-QXRWPBJP.js");
7979
7981
  await startHub(
7980
7982
  {
7981
7983
  topic: topic ?? "",
@@ -28,9 +28,9 @@ import {
28
28
  touchMemoryReferences,
29
29
  updateMemoryApproval,
30
30
  updateMemoryEntry
31
- } from "./chunk-QPPUYCRF.js";
31
+ } from "./chunk-YHLTSZVH.js";
32
32
  import "./chunk-HOSJZMQS.js";
33
- import "./chunk-3TOMHXDW.js";
33
+ import "./chunk-75SPJKDY.js";
34
34
  import "./chunk-B5TYJO7V.js";
35
35
  import "./chunk-IW3Q7AE5.js";
36
36
  export {
@@ -27,9 +27,9 @@ import {
27
27
  touchMemoryReferences,
28
28
  updateMemoryApproval,
29
29
  updateMemoryEntry
30
- } from "./chunk-KIHNZBEA.js";
30
+ } from "./chunk-BOMB6XCF.js";
31
31
  import "./chunk-YVTASHS5.js";
32
- import "./chunk-4HTJMLFY.js";
32
+ import "./chunk-JJVVCWO4.js";
33
33
  import "./chunk-6BUTA5VW.js";
34
34
  export {
35
35
  addMemoryEntry,
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  countSeverity,
4
4
  runCi
5
- } from "./chunk-XJAGGJVU.js";
6
- import "./chunk-AAERHPBN.js";
5
+ } from "./chunk-FXCDD7JS.js";
6
+ import "./chunk-PLFXDRNX.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-5IUFUCIT.js";
20
+ } from "./chunk-F26YTEMB.js";
21
21
  import "./chunk-3OBY7WSS.js";
22
22
  import "./chunk-TU3L3PW7.js";
23
23
  import {
24
24
  VERSION
25
- } from "./chunk-3TOMHXDW.js";
25
+ } from "./chunk-75SPJKDY.js";
26
26
  import "./chunk-IW3Q7AE5.js";
27
27
 
28
28
  // src/cli/pr.ts
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  executeTests,
3
3
  runTestsTool
4
- } from "./chunk-NVN3FHXI.js";
5
- import "./chunk-4HTJMLFY.js";
4
+ } from "./chunk-UDUE4DAE.js";
5
+ import "./chunk-JJVVCWO4.js";
6
6
  export {
7
7
  executeTests,
8
8
  runTestsTool
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  executeTests,
4
4
  runTestsTool
5
- } from "./chunk-V6KQ67VF.js";
6
- import "./chunk-3TOMHXDW.js";
5
+ } from "./chunk-TG4PF7FZ.js";
6
+ import "./chunk-75SPJKDY.js";
7
7
  export {
8
8
  executeTests,
9
9
  runTestsTool
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ToolRegistry
4
- } from "./chunk-DJNGUPM3.js";
5
- import "./chunk-QPPUYCRF.js";
4
+ } from "./chunk-DIJIYWQE.js";
5
+ import "./chunk-YHLTSZVH.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-5PRWBJCI.js";
13
+ } from "./chunk-M3GDYEUH.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-V6KQ67VF.js";
21
+ import "./chunk-TG4PF7FZ.js";
22
22
  import {
23
23
  VERSION
24
- } from "./chunk-3TOMHXDW.js";
24
+ } from "./chunk-75SPJKDY.js";
25
25
  import "./chunk-6RPGQ5CG.js";
26
26
  import "./chunk-KHYD3WXE.js";
27
27
  import "./chunk-NYNSYLFY.js";
@@ -34,13 +34,16 @@ import {
34
34
  scanProject,
35
35
  setupProxy,
36
36
  stripRoutingTags
37
- } from "./chunk-S3F5LOV3.js";
37
+ } from "./chunk-X3JPBJ6C.js";
38
38
  import {
39
+ CNY_PER_USD,
39
40
  CostTracker,
40
41
  computeCost,
41
42
  formatCost,
42
- getPricing
43
- } from "./chunk-R7GERZDA.js";
43
+ getCostCurrency,
44
+ getPricing,
45
+ setCostCurrency
46
+ } from "./chunk-JT6UN5C6.js";
44
47
  import {
45
48
  buildReviewPrompt,
46
49
  buildSecurityReviewPrompt
@@ -79,7 +82,7 @@ import {
79
82
  spawnAgentContext,
80
83
  truncateOutput,
81
84
  undoStack
82
- } from "./chunk-DJNGUPM3.js";
85
+ } from "./chunk-DIJIYWQE.js";
83
86
  import {
84
87
  addMemoryEntry,
85
88
  clearMemoryEntries,
@@ -94,7 +97,7 @@ import {
94
97
  parseWritableScope,
95
98
  updateMemoryApproval,
96
99
  updateMemoryEntry
97
- } from "./chunk-QPPUYCRF.js";
100
+ } from "./chunk-YHLTSZVH.js";
98
101
  import "./chunk-GLSR2NR3.js";
99
102
  import "./chunk-UUSRWSSX.js";
100
103
  import "./chunk-CKH4KQ4E.js";
@@ -108,13 +111,13 @@ import {
108
111
  buildDoctorReport,
109
112
  formatDoctorReport,
110
113
  loadContextFiles
111
- } from "./chunk-6PROC2JO.js";
114
+ } from "./chunk-HOT76ATM.js";
112
115
  import {
113
116
  ProviderRegistry
114
117
  } from "./chunk-AUEX6RNY.js";
115
118
  import {
116
119
  ConfigManager
117
- } from "./chunk-5IUFUCIT.js";
120
+ } from "./chunk-F26YTEMB.js";
118
121
  import {
119
122
  describePlugin,
120
123
  getActivePluginAssets,
@@ -129,7 +132,7 @@ import {
129
132
  runTool,
130
133
  setPluginEnabled,
131
134
  trustPlugin
132
- } from "./chunk-5PRWBJCI.js";
135
+ } from "./chunk-M3GDYEUH.js";
133
136
  import {
134
137
  CONTENT_ONLY_STREAM_REMINDER,
135
138
  TEE_FINAL_USER_NUDGE,
@@ -154,7 +157,7 @@ import {
154
157
  getGitRoot
155
158
  } from "./chunk-HOSJZMQS.js";
156
159
  import "./chunk-4BKXL7SM.js";
157
- import "./chunk-V6KQ67VF.js";
160
+ import "./chunk-TG4PF7FZ.js";
158
161
  import {
159
162
  AGENTIC_BEHAVIOR_GUIDELINE,
160
163
  AUTHOR,
@@ -170,7 +173,7 @@ import {
170
173
  SKILLS_DIR_NAME,
171
174
  VERSION,
172
175
  buildUserIdentityPrompt
173
- } from "./chunk-3TOMHXDW.js";
176
+ } from "./chunk-75SPJKDY.js";
174
177
  import "./chunk-6RPGQ5CG.js";
175
178
  import "./chunk-KHYD3WXE.js";
176
179
  import "./chunk-NYNSYLFY.js";
@@ -185,8 +188,8 @@ import {
185
188
  import express from "express";
186
189
  import { createServer } from "http";
187
190
  import { WebSocketServer } from "ws";
188
- import { join as join2, dirname as dirname3, resolve as resolve2, relative, sep } from "path";
189
- import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2, realpathSync } from "fs";
191
+ import { join as join2, dirname as dirname3, resolve as resolve2, relative, sep, extname, resolve as resolvePath } from "path";
192
+ import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2, realpathSync, createReadStream } from "fs";
190
193
  import { networkInterfaces } from "os";
191
194
 
192
195
  // src/web/tool-executor-web.ts
@@ -850,7 +853,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
850
853
  Cost: ${formatCost(cost)}` : "";
851
854
  let memoryLine = "";
852
855
  try {
853
- const { countPendingMemories } = await import("./persistent-memory-H4DNDIOQ.js");
856
+ const { countPendingMemories } = await import("./persistent-memory-F4JPWYZJ.js");
854
857
  const pending = countPendingMemories(ctx.config.getConfigDir());
855
858
  if (pending > 0) memoryLine = `
856
859
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -1663,7 +1666,7 @@ async function handleTest(args, ctx) {
1663
1666
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
1664
1667
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
1665
1668
  }
1666
- const runTests = ctx.runTests ?? (await import("./run-tests-FZSYHWYX.js")).executeTests;
1669
+ const runTests = ctx.runTests ?? (await import("./run-tests-WM7TMO2N.js")).executeTests;
1667
1670
  const report = await runTests(testArgs);
1668
1671
  ctx.send({ type: "info", message: report });
1669
1672
  } catch (err) {
@@ -1921,7 +1924,7 @@ async function handleMemory(args, ctx) {
1921
1924
  ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
1922
1925
  } else if (sub === "export") {
1923
1926
  if (args[1] === "md") {
1924
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-H4DNDIOQ.js");
1927
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-F4JPWYZJ.js");
1925
1928
  ctx.send({
1926
1929
  type: "export_data",
1927
1930
  format: "md",
@@ -2539,6 +2542,8 @@ var SessionHandler = class {
2539
2542
  permissionProfile: this.config.get("defaultPermissionProfile") ?? "legacy",
2540
2543
  tokenUsage: { ...this.sessionTokenUsage },
2541
2544
  costUsd,
2545
+ costCurrency: getCostCurrency(),
2546
+ costCnyPerUsd: CNY_PER_USD,
2542
2547
  costPricingUnknown,
2543
2548
  providers: providerList,
2544
2549
  branches,
@@ -4021,6 +4026,7 @@ async function startWebServer(options = {}) {
4021
4026
  console.log(` Skills: ${count} available`);
4022
4027
  }
4023
4028
  }
4029
+ setCostCurrency(config.get("ui").currency);
4024
4030
  const shared = {
4025
4031
  config,
4026
4032
  costTracker: new CostTracker(config.getConfigDir()),
@@ -4100,6 +4106,29 @@ async function startWebServer(options = {}) {
4100
4106
  clientDir = join2(process.cwd(), "src", "web", "client");
4101
4107
  }
4102
4108
  console.log(` Static files: ${clientDir}`);
4109
+ const PRECOMPRESSED_TYPES = {
4110
+ ".js": "text/javascript; charset=utf-8",
4111
+ ".css": "text/css; charset=utf-8",
4112
+ ".html": "text/html; charset=utf-8",
4113
+ ".json": "application/json; charset=utf-8",
4114
+ ".svg": "image/svg+xml",
4115
+ ".map": "application/json; charset=utf-8"
4116
+ };
4117
+ app.get(/.*/, (req, res, next) => {
4118
+ const ext = extname(req.path).toLowerCase();
4119
+ const contentType = PRECOMPRESSED_TYPES[ext];
4120
+ if (!contentType) return next();
4121
+ const accept = String(req.headers["accept-encoding"] ?? "");
4122
+ const encoding = /\bbr\b/.test(accept) ? "br" : /\bgzip\b/.test(accept) ? "gzip" : null;
4123
+ if (!encoding) return next();
4124
+ const target = resolvePath(clientDir, `.${req.path}`) + (encoding === "br" ? ".br" : ".gz");
4125
+ if (!target.startsWith(clientDir) || !existsSync3(target)) return next();
4126
+ res.setHeader("Content-Type", contentType);
4127
+ res.setHeader("Content-Encoding", encoding);
4128
+ res.setHeader("Vary", "Accept-Encoding");
4129
+ if (req.path.startsWith("/vendor/")) res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
4130
+ createReadStream(target).pipe(res);
4131
+ });
4103
4132
  app.use("/vendor", express.static(join2(clientDir, "vendor"), { maxAge: "1y", immutable: true }));
4104
4133
  app.use(express.static(clientDir));
4105
4134
  app.get("/api/status", (_req, res) => {
@@ -3,8 +3,8 @@ import {
3
3
  ToolRegistry,
4
4
  googleSearchContext,
5
5
  truncateOutput
6
- } from "./chunk-DJNGUPM3.js";
7
- import "./chunk-QPPUYCRF.js";
6
+ } from "./chunk-DIJIYWQE.js";
7
+ import "./chunk-YHLTSZVH.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-5PRWBJCI.js";
15
+ } from "./chunk-M3GDYEUH.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-V6KQ67VF.js";
23
+ import "./chunk-TG4PF7FZ.js";
24
24
  import {
25
25
  SUBAGENT_ALLOWED_TOOLS
26
- } from "./chunk-3TOMHXDW.js";
26
+ } from "./chunk-75SPJKDY.js";
27
27
  import "./chunk-6RPGQ5CG.js";
28
28
  import "./chunk-KHYD3WXE.js";
29
29
  import "./chunk-NYNSYLFY.js";
@@ -1,14 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CostTracker,
4
+ currencyNote,
4
5
  formatCost,
5
- getPricing
6
- } from "./chunk-R7GERZDA.js";
6
+ getPricing,
7
+ setCostCurrency
8
+ } from "./chunk-JT6UN5C6.js";
7
9
  import {
8
10
  ConfigManager
9
- } from "./chunk-5IUFUCIT.js";
11
+ } from "./chunk-F26YTEMB.js";
10
12
  import "./chunk-TU3L3PW7.js";
11
- import "./chunk-3TOMHXDW.js";
13
+ import "./chunk-75SPJKDY.js";
12
14
  import "./chunk-IW3Q7AE5.js";
13
15
 
14
16
  // src/cli/usage.ts
@@ -23,6 +25,7 @@ function num(n) {
23
25
  async function runUsageCli(options = {}) {
24
26
  const chalk = (await import("chalk")).default;
25
27
  const config = new ConfigManager();
28
+ setCostCurrency(config.get("ui").currency);
26
29
  const tracker = new CostTracker(config.getConfigDir());
27
30
  const sinceDays = options.days ? Math.max(1, parseInt(options.days, 10) || 0) : void 0;
28
31
  const month = options.month?.trim();
@@ -80,6 +83,10 @@ async function runUsageCli(options = {}) {
80
83
  if (unknownCount > 0) {
81
84
  console.log(chalk.yellow(` \u2014 = no pricing data for ${unknownCount} model(s); their tokens are tracked but cost is excluded from the total.`));
82
85
  }
86
+ const rateNote = currencyNote();
87
+ if (rateNote) {
88
+ console.log(chalk.dim(` ${rateNote}`));
89
+ }
83
90
  console.log();
84
91
  }
85
92
  function label(r) {
Binary file
Binary file
Binary file
Binary file
@@ -7,7 +7,7 @@
7
7
  * global lexical environment and are read/reassigned here as free variables.
8
8
  */
9
9
 
10
- import { escapeHtml, formatToolArgs, formatDuration, sanitizeHtml } from './util.js';
10
+ import { escapeHtml, formatToolArgs, formatDuration, sanitizeHtml, formatCostDisplay } from './util.js';
11
11
  import { fetchSessionReplay, fetchStatus, logoutAuth, registerFirstUser, submitAuth } from './api.js';
12
12
 
13
13
  // ── State ──────────────────────────────────────────────────────────
@@ -523,8 +523,7 @@ function handleStatus(msg) {
523
523
  let line = `📊 in: ${u.inputTokens.toLocaleString()} out: ${u.outputTokens.toLocaleString()}`;
524
524
  if (cacheRead > 0) line += ` cache: ${cacheRead.toLocaleString()}`;
525
525
  if (msg.costUsd != null) {
526
- const cost = msg.costUsd;
527
- const costStr = cost === 0 ? '$0' : cost < 0.01 ? `$${cost.toFixed(4)}` : cost < 1 ? `$${cost.toFixed(3)}` : `$${cost.toFixed(2)}`;
526
+ const costStr = formatCostDisplay(msg.costUsd, msg.costCurrency, msg.costCnyPerUsd);
528
527
  line += ` 💰 ${costStr}`;
529
528
  }
530
529
  else if (msg.costPricingUnknown) {
@@ -559,9 +558,7 @@ function renderDashboard() {
559
558
  const pending = [...pendingApprovals.values()];
560
559
  const tokens = s.tokenUsage || {};
561
560
  const totalTokens = (tokens.inputTokens || 0) + (tokens.outputTokens || 0) + (tokens.cacheCreationTokens || 0) + (tokens.cacheReadTokens || 0);
562
- const cost = typeof s.costUsd === 'number'
563
- ? (s.costUsd === 0 ? '$0' : s.costUsd < 0.01 ? `$${s.costUsd.toFixed(4)}` : s.costUsd < 1 ? `$${s.costUsd.toFixed(3)}` : `$${s.costUsd.toFixed(2)}`)
564
- : 'unknown';
561
+ const cost = formatCostDisplay(s.costUsd, s.costCurrency, s.costCnyPerUsd);
565
562
  const recentTests = lastToolResults.filter(r => r.toolName === 'run_tests').slice(-3).reverse();
566
563
  const recentToolErrors = lastToolResults.filter(r => r.isError).slice(-3).reverse();
567
564
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -85,3 +85,25 @@ export function sanitizeHtml(html) {
85
85
 
86
86
  return safe;
87
87
  }
88
+
89
+ /**
90
+ * 成本显示(2026-08-14 审计 P3-02)。
91
+ *
92
+ * 客户端此前有两处各自写死 `$` 的格式化(状态栏与 Dashboard),与服务端的
93
+ * `formatCost` 是第三、第四份实现。币种由 status 消息带下来,这里只负责排版;
94
+ * 人民币按服务端给的记账换算率折算——**不是实时汇率**,调用方需在附近标注。
95
+ *
96
+ * @param {number} usd 美元金额(存储与传输恒为美元)
97
+ * @param {'usd'|'cny'} [currency]
98
+ * @param {number} [cnyPerUsd] 记账换算率,缺省时退回美元显示
99
+ */
100
+ export function formatCostDisplay(usd, currency, cnyPerUsd) {
101
+ if (typeof usd !== 'number' || !isFinite(usd)) return 'unknown';
102
+ const useCny = currency === 'cny' && typeof cnyPerUsd === 'number' && cnyPerUsd > 0;
103
+ const amount = useCny ? usd * cnyPerUsd : usd;
104
+ const sym = useCny ? '¥' : '$';
105
+ if (amount === 0) return `${sym}0`;
106
+ if (amount < 0.01) return `${sym}${amount.toFixed(4)}`;
107
+ if (amount < 1) return `${sym}${amount.toFixed(3)}`;
108
+ return `${sym}${amount.toFixed(2)}`;
109
+ }
Binary file
Binary file