jinzd-ai-cli 0.4.269 → 0.4.271

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 (72) hide show
  1. package/dist/{batch-HUOYPVJQ.js → batch-FPDT2USZ.js} +2 -2
  2. package/dist/{chunk-AAERHPBN.js → chunk-2RN4T4XD.js} +1 -1
  3. package/dist/{chunk-QPPUYCRF.js → chunk-4UNRDXZV.js} +8 -8
  4. package/dist/{chunk-4HTJMLFY.js → chunk-5JFRM47R.js} +1 -1
  5. package/dist/{chunk-S3F5LOV3.js → chunk-BFPF3JF2.js} +7 -7
  6. package/dist/{chunk-3TOMHXDW.js → chunk-FT3WS5PG.js} +1 -1
  7. package/dist/{chunk-R7GERZDA.js → chunk-JT6UN5C6.js} +26 -5
  8. package/dist/{chunk-V6KQ67VF.js → chunk-OSYK6D4G.js} +1 -1
  9. package/dist/{chunk-5PRWBJCI.js → chunk-PDRAOFGI.js} +4 -4
  10. package/dist/{chunk-6PROC2JO.js → chunk-PG7O7N7D.js} +8 -8
  11. package/dist/{chunk-5IUFUCIT.js → chunk-PMRU2CAF.js} +12 -4
  12. package/dist/{chunk-NVN3FHXI.js → chunk-RLAUMACS.js} +1 -1
  13. package/dist/{chunk-XJAGGJVU.js → chunk-RNDHIERN.js} +3 -3
  14. package/dist/{chunk-DJNGUPM3.js → chunk-V26ZMB3D.js} +11 -11
  15. package/dist/{chunk-KIHNZBEA.js → chunk-VPXNLE7E.js} +1 -1
  16. package/dist/chunk-XNFIYS7G.js +82 -0
  17. package/dist/{ci-4QS2J7BG.js → ci-VPN5RWCO.js} +4 -4
  18. package/dist/{ci-format-6L6M67WC.js → ci-format-GKXVCVME.js} +2 -2
  19. package/dist/config-command-E5DHADEV.js +11 -0
  20. package/dist/{constants-IO5VJLEE.js → constants-Y43DJFGV.js} +1 -1
  21. package/dist/{doctor-cli-ZU4E2DDL.js → doctor-cli-RZGZB2TF.js} +4 -4
  22. package/dist/electron-server.js +146 -30
  23. package/dist/{hub-AMDWXSKZ.js → hub-FJWP6SDG.js} +1 -1
  24. package/dist/index.js +85 -99
  25. package/dist/{persistent-memory-H4DNDIOQ.js → persistent-memory-IR47JCTF.js} +3 -3
  26. package/dist/{persistent-memory-52SE5K44.js → persistent-memory-KX2R67AT.js} +2 -2
  27. package/dist/{pr-Z4O5H6I3.js → pr-NTQ3N4B4.js} +5 -5
  28. package/dist/{run-tests-PYKKYMPA.js → run-tests-25CNXJ4N.js} +2 -2
  29. package/dist/{run-tests-FZSYHWYX.js → run-tests-UTES6HCT.js} +2 -2
  30. package/dist/{server-ZSTVYSYC.js → server-IGCCSX4B.js} +10 -10
  31. package/dist/{server-WTJSM2MT.js → server-R56CVHCM.js} +82 -56
  32. package/dist/{task-orchestrator-PNLI3V36.js → task-orchestrator-MFYEKR2I.js} +12 -12
  33. package/dist/{usage-GVFUVYUG.js → usage-FHX7PQQH.js} +11 -4
  34. package/dist/web/client/actions.js.br +0 -0
  35. package/dist/web/client/actions.js.gz +0 -0
  36. package/dist/web/client/api.js.br +0 -0
  37. package/dist/web/client/api.js.gz +0 -0
  38. package/dist/web/client/app.js +3 -6
  39. package/dist/web/client/app.js.br +0 -0
  40. package/dist/web/client/app.js.gz +0 -0
  41. package/dist/web/client/dom.js.br +0 -0
  42. package/dist/web/client/dom.js.gz +0 -0
  43. package/dist/web/client/icon.svg.br +0 -0
  44. package/dist/web/client/icon.svg.gz +0 -0
  45. package/dist/web/client/index.html.br +0 -0
  46. package/dist/web/client/index.html.gz +0 -0
  47. package/dist/web/client/sidebar-tabs.js.br +0 -0
  48. package/dist/web/client/sidebar-tabs.js.gz +0 -0
  49. package/dist/web/client/state.js.br +0 -0
  50. package/dist/web/client/state.js.gz +0 -0
  51. package/dist/web/client/style.css.br +0 -0
  52. package/dist/web/client/style.css.gz +0 -0
  53. package/dist/web/client/sw.js.br +0 -0
  54. package/dist/web/client/sw.js.gz +0 -0
  55. package/dist/web/client/templates.js.br +0 -0
  56. package/dist/web/client/templates.js.gz +0 -0
  57. package/dist/web/client/util.js +22 -0
  58. package/dist/web/client/util.js.br +0 -0
  59. package/dist/web/client/util.js.gz +0 -0
  60. package/dist/web/client/vendor/daisyui-full.min.css.br +0 -0
  61. package/dist/web/client/vendor/daisyui-full.min.css.gz +0 -0
  62. package/dist/web/client/vendor/github-dark.min.css.br +0 -0
  63. package/dist/web/client/vendor/github-dark.min.css.gz +0 -0
  64. package/dist/web/client/vendor/github.min.css.br +0 -0
  65. package/dist/web/client/vendor/github.min.css.gz +0 -0
  66. package/dist/web/client/vendor/highlight.min.js.br +0 -0
  67. package/dist/web/client/vendor/highlight.min.js.gz +0 -0
  68. package/dist/web/client/vendor/marked.min.js.br +0 -0
  69. package/dist/web/client/vendor/marked.min.js.gz +0 -0
  70. package/dist/web/client/vendor/tailwind.js.br +0 -0
  71. package/dist/web/client/vendor/tailwind.js.gz +0 -0
  72. package/package.json +1 -1
@@ -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-RNDHIERN.js";
6
+ import "./chunk-2RN4T4XD.js";
7
7
  import {
8
8
  buildReviewPrompt,
9
9
  buildSecurityReviewPrompt,
@@ -17,13 +17,13 @@ import {
17
17
  } from "./chunk-AUEX6RNY.js";
18
18
  import {
19
19
  ConfigManager
20
- } from "./chunk-5IUFUCIT.js";
20
+ } from "./chunk-PMRU2CAF.js";
21
21
  import "./chunk-3OBY7WSS.js";
22
22
  import "./chunk-TU3L3PW7.js";
23
+ import "./chunk-IW3Q7AE5.js";
23
24
  import {
24
25
  VERSION
25
- } from "./chunk-3TOMHXDW.js";
26
- import "./chunk-IW3Q7AE5.js";
26
+ } from "./chunk-FT3WS5PG.js";
27
27
 
28
28
  // src/cli/pr.ts
29
29
  import { execFileSync } from "child_process";
@@ -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-RLAUMACS.js";
5
+ import "./chunk-5JFRM47R.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-OSYK6D4G.js";
6
+ import "./chunk-FT3WS5PG.js";
7
7
  export {
8
8
  executeTests,
9
9
  runTestsTool
@@ -1,32 +1,32 @@
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-V26ZMB3D.js";
5
+ import "./chunk-6RPGQ5CG.js";
6
+ import "./chunk-4UNRDXZV.js";
6
7
  import "./chunk-GLSR2NR3.js";
7
8
  import "./chunk-UUSRWSSX.js";
8
9
  import "./chunk-CKH4KQ4E.js";
9
10
  import "./chunk-BXP6YZ2P.js";
11
+ import "./chunk-KHYD3WXE.js";
10
12
  import "./chunk-5C76XDDF.js";
13
+ import "./chunk-NYNSYLFY.js";
14
+ import "./chunk-B5TYJO7V.js";
11
15
  import {
12
16
  runTool
13
- } from "./chunk-5PRWBJCI.js";
17
+ } from "./chunk-PDRAOFGI.js";
14
18
  import {
15
19
  getDangerLevel,
16
20
  schemaToJsonSchema
17
21
  } from "./chunk-3OBY7WSS.js";
18
22
  import "./chunk-TU3L3PW7.js";
19
23
  import "./chunk-HOSJZMQS.js";
24
+ import "./chunk-IW3Q7AE5.js";
20
25
  import "./chunk-4BKXL7SM.js";
21
- import "./chunk-V6KQ67VF.js";
26
+ import "./chunk-OSYK6D4G.js";
22
27
  import {
23
28
  VERSION
24
- } from "./chunk-3TOMHXDW.js";
25
- import "./chunk-6RPGQ5CG.js";
26
- import "./chunk-KHYD3WXE.js";
27
- import "./chunk-NYNSYLFY.js";
28
- import "./chunk-B5TYJO7V.js";
29
- import "./chunk-IW3Q7AE5.js";
29
+ } from "./chunk-FT3WS5PG.js";
30
30
 
31
31
  // src/mcp/server.ts
32
32
  import { createInterface } from "readline";
@@ -5,13 +5,13 @@ import {
5
5
  resolveRoleProviders
6
6
  } from "./chunk-23SJVOQD.js";
7
7
  import "./chunk-VOIOUJXI.js";
8
- import {
9
- persistDiscussion
10
- } from "./chunk-JQXXPTWL.js";
11
8
  import {
12
9
  AuthManager,
13
10
  TOKEN_EXPIRY_MS
14
11
  } from "./chunk-RYQBBEMM.js";
12
+ import {
13
+ persistDiscussion
14
+ } from "./chunk-JQXXPTWL.js";
15
15
  import {
16
16
  AUTO_COMPACT_INSTRUCTION,
17
17
  McpManager,
@@ -34,20 +34,16 @@ import {
34
34
  scanProject,
35
35
  setupProxy,
36
36
  stripRoutingTags
37
- } from "./chunk-S3F5LOV3.js";
37
+ } from "./chunk-BFPF3JF2.js";
38
38
  import {
39
+ CNY_PER_USD,
39
40
  CostTracker,
40
41
  computeCost,
41
42
  formatCost,
42
- getPricing
43
- } from "./chunk-R7GERZDA.js";
44
- import {
45
- buildReviewPrompt,
46
- buildSecurityReviewPrompt
47
- } from "./chunk-HLWUDRBO.js";
48
- import {
49
- thinkingParamsFor
50
- } from "./chunk-6YZEZFX5.js";
43
+ getCostCurrency,
44
+ getPricing,
45
+ setCostCurrency
46
+ } from "./chunk-JT6UN5C6.js";
51
47
  import {
52
48
  ToolExecutor,
53
49
  ToolRegistry,
@@ -79,7 +75,15 @@ import {
79
75
  spawnAgentContext,
80
76
  truncateOutput,
81
77
  undoStack
82
- } from "./chunk-DJNGUPM3.js";
78
+ } from "./chunk-V26ZMB3D.js";
79
+ import {
80
+ buildReviewPrompt,
81
+ buildSecurityReviewPrompt
82
+ } from "./chunk-HLWUDRBO.js";
83
+ import {
84
+ thinkingParamsFor
85
+ } from "./chunk-6YZEZFX5.js";
86
+ import "./chunk-6RPGQ5CG.js";
83
87
  import {
84
88
  addMemoryEntry,
85
89
  clearMemoryEntries,
@@ -94,27 +98,26 @@ import {
94
98
  parseWritableScope,
95
99
  updateMemoryApproval,
96
100
  updateMemoryEntry
97
- } from "./chunk-QPPUYCRF.js";
101
+ } from "./chunk-4UNRDXZV.js";
98
102
  import "./chunk-GLSR2NR3.js";
99
103
  import "./chunk-UUSRWSSX.js";
100
104
  import "./chunk-CKH4KQ4E.js";
101
105
  import "./chunk-BXP6YZ2P.js";
106
+ import "./chunk-KHYD3WXE.js";
102
107
  import "./chunk-5C76XDDF.js";
103
108
  import {
104
109
  SessionManager,
105
110
  getContentText
106
111
  } from "./chunk-OBULDJSU.js";
112
+ import "./chunk-NYNSYLFY.js";
113
+ import {
114
+ scanString
115
+ } from "./chunk-B5TYJO7V.js";
107
116
  import {
108
117
  buildDoctorReport,
109
118
  formatDoctorReport,
110
119
  loadContextFiles
111
- } from "./chunk-6PROC2JO.js";
112
- import {
113
- ProviderRegistry
114
- } from "./chunk-AUEX6RNY.js";
115
- import {
116
- ConfigManager
117
- } from "./chunk-5IUFUCIT.js";
120
+ } from "./chunk-PG7O7N7D.js";
118
121
  import {
119
122
  describePlugin,
120
123
  getActivePluginAssets,
@@ -129,7 +132,13 @@ import {
129
132
  runTool,
130
133
  setPluginEnabled,
131
134
  trustPlugin
132
- } from "./chunk-5PRWBJCI.js";
135
+ } from "./chunk-PDRAOFGI.js";
136
+ import {
137
+ ProviderRegistry
138
+ } from "./chunk-AUEX6RNY.js";
139
+ import {
140
+ ConfigManager
141
+ } from "./chunk-PMRU2CAF.js";
133
142
  import {
134
143
  CONTENT_ONLY_STREAM_REMINDER,
135
144
  TEE_FINAL_USER_NUDGE,
@@ -153,8 +162,15 @@ import {
153
162
  getGitContext,
154
163
  getGitRoot
155
164
  } from "./chunk-HOSJZMQS.js";
165
+ import {
166
+ atomicWriteFileSync
167
+ } from "./chunk-IW3Q7AE5.js";
168
+ import {
169
+ applyConfigCommand,
170
+ maskConfigSecrets
171
+ } from "./chunk-XNFIYS7G.js";
156
172
  import "./chunk-4BKXL7SM.js";
157
- import "./chunk-V6KQ67VF.js";
173
+ import "./chunk-OSYK6D4G.js";
158
174
  import {
159
175
  AGENTIC_BEHAVIOR_GUIDELINE,
160
176
  AUTHOR,
@@ -170,23 +186,14 @@ import {
170
186
  SKILLS_DIR_NAME,
171
187
  VERSION,
172
188
  buildUserIdentityPrompt
173
- } from "./chunk-3TOMHXDW.js";
174
- import "./chunk-6RPGQ5CG.js";
175
- import "./chunk-KHYD3WXE.js";
176
- import "./chunk-NYNSYLFY.js";
177
- import {
178
- scanString
179
- } from "./chunk-B5TYJO7V.js";
180
- import {
181
- atomicWriteFileSync
182
- } from "./chunk-IW3Q7AE5.js";
189
+ } from "./chunk-FT3WS5PG.js";
183
190
 
184
191
  // src/web/server.ts
185
192
  import express from "express";
186
193
  import { createServer } from "http";
187
194
  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";
195
+ import { join as join2, dirname as dirname3, resolve as resolve2, relative, sep, extname, resolve as resolvePath } from "path";
196
+ import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2, realpathSync, createReadStream } from "fs";
190
197
  import { networkInterfaces } from "os";
191
198
 
192
199
  // src/web/tool-executor-web.ts
@@ -850,7 +857,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
850
857
  Cost: ${formatCost(cost)}` : "";
851
858
  let memoryLine = "";
852
859
  try {
853
- const { countPendingMemories } = await import("./persistent-memory-H4DNDIOQ.js");
860
+ const { countPendingMemories } = await import("./persistent-memory-IR47JCTF.js");
854
861
  const pending = countPendingMemories(ctx.config.getConfigDir());
855
862
  if (pending > 0) memoryLine = `
856
863
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -1663,7 +1670,7 @@ async function handleTest(args, ctx) {
1663
1670
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
1664
1671
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
1665
1672
  }
1666
- const runTests = ctx.runTests ?? (await import("./run-tests-FZSYHWYX.js")).executeTests;
1673
+ const runTests = ctx.runTests ?? (await import("./run-tests-UTES6HCT.js")).executeTests;
1667
1674
  const report = await runTests(testArgs);
1668
1675
  ctx.send({ type: "info", message: report });
1669
1676
  } catch (err) {
@@ -1921,7 +1928,7 @@ async function handleMemory(args, ctx) {
1921
1928
  ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
1922
1929
  } else if (sub === "export") {
1923
1930
  if (args[1] === "md") {
1924
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-H4DNDIOQ.js");
1931
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-IR47JCTF.js");
1925
1932
  ctx.send({
1926
1933
  type: "export_data",
1927
1934
  format: "md",
@@ -1975,26 +1982,19 @@ It will be included in AI context for subsequent messages.` });
1975
1982
 
1976
1983
  // src/web/commands/security-commands.ts
1977
1984
  async function handleConfig(args, ctx) {
1978
- const sub = args[0];
1979
- if (sub === "show" || !sub) {
1980
- ctx.send({ type: "info", message: `\u2699\uFE0F Configuration:
1985
+ const outcome = applyConfigCommand(args, ctx.config);
1986
+ if (outcome.action === "show" || outcome.action === "wizard") {
1987
+ const json = outcome.json ?? JSON.stringify(maskConfigSecrets(ctx.config.toJSON()), null, 2);
1988
+ ctx.send({ type: "info", message: `\u2699\uFE0F Configuration (secrets masked):
1981
1989
  \`\`\`json
1982
- ${ctx.config.toFormattedJSON()}
1990
+ ${json}
1983
1991
  \`\`\`` });
1984
- } else if (sub === "get" && args[1]) {
1985
- const val = ctx.config.getByPath(args[1]);
1986
- const display = typeof val === "object" ? JSON.stringify(val, null, 2) : String(val ?? "undefined");
1987
- ctx.send({ type: "info", message: `${args[1]} = ${display}` });
1988
- } else if (sub === "set" && args[1] && args[2] !== void 0) {
1989
- try {
1990
- ctx.config.setByPath(args[1], args.slice(2).join(" "));
1991
- ctx.send({ type: "info", message: `\u2713 ${args[1]} = ${args.slice(2).join(" ")}` });
1992
- } catch (err) {
1993
- ctx.send({ type: "error", message: `Config error: ${err.message}` });
1994
- }
1995
- } else {
1996
- ctx.send({ type: "info", message: "Usage: /config [show] | /config get <key> | /config set <key> <value>" });
1992
+ return;
1997
1993
  }
1994
+ ctx.send({
1995
+ type: outcome.isError ? "error" : "info",
1996
+ message: (outcome.changed ? "\u2713 " : "") + (outcome.summary ?? "")
1997
+ });
1998
1998
  }
1999
1999
  async function handleDoctor(_args, ctx) {
2000
2000
  const report = buildDoctorReport({
@@ -2539,6 +2539,8 @@ var SessionHandler = class {
2539
2539
  permissionProfile: this.config.get("defaultPermissionProfile") ?? "legacy",
2540
2540
  tokenUsage: { ...this.sessionTokenUsage },
2541
2541
  costUsd,
2542
+ costCurrency: getCostCurrency(),
2543
+ costCnyPerUsd: CNY_PER_USD,
2542
2544
  costPricingUnknown,
2543
2545
  providers: providerList,
2544
2546
  branches,
@@ -4021,6 +4023,7 @@ async function startWebServer(options = {}) {
4021
4023
  console.log(` Skills: ${count} available`);
4022
4024
  }
4023
4025
  }
4026
+ setCostCurrency(config.get("ui").currency);
4024
4027
  const shared = {
4025
4028
  config,
4026
4029
  costTracker: new CostTracker(config.getConfigDir()),
@@ -4100,6 +4103,29 @@ async function startWebServer(options = {}) {
4100
4103
  clientDir = join2(process.cwd(), "src", "web", "client");
4101
4104
  }
4102
4105
  console.log(` Static files: ${clientDir}`);
4106
+ const PRECOMPRESSED_TYPES = {
4107
+ ".js": "text/javascript; charset=utf-8",
4108
+ ".css": "text/css; charset=utf-8",
4109
+ ".html": "text/html; charset=utf-8",
4110
+ ".json": "application/json; charset=utf-8",
4111
+ ".svg": "image/svg+xml",
4112
+ ".map": "application/json; charset=utf-8"
4113
+ };
4114
+ app.get(/.*/, (req, res, next) => {
4115
+ const ext = extname(req.path).toLowerCase();
4116
+ const contentType = PRECOMPRESSED_TYPES[ext];
4117
+ if (!contentType) return next();
4118
+ const accept = String(req.headers["accept-encoding"] ?? "");
4119
+ const encoding = /\bbr\b/.test(accept) ? "br" : /\bgzip\b/.test(accept) ? "gzip" : null;
4120
+ if (!encoding) return next();
4121
+ const target = resolvePath(clientDir, `.${req.path}`) + (encoding === "br" ? ".br" : ".gz");
4122
+ if (!target.startsWith(clientDir) || !existsSync3(target)) return next();
4123
+ res.setHeader("Content-Type", contentType);
4124
+ res.setHeader("Content-Encoding", encoding);
4125
+ res.setHeader("Vary", "Accept-Encoding");
4126
+ if (req.path.startsWith("/vendor/")) res.setHeader("Cache-Control", "public, max-age=31536000, immutable");
4127
+ createReadStream(target).pipe(res);
4128
+ });
4103
4129
  app.use("/vendor", express.static(join2(clientDir, "vendor"), { maxAge: "1y", immutable: true }));
4104
4130
  app.use(express.static(clientDir));
4105
4131
  app.get("/api/status", (_req, res) => {
@@ -3,34 +3,34 @@ import {
3
3
  ToolRegistry,
4
4
  googleSearchContext,
5
5
  truncateOutput
6
- } from "./chunk-DJNGUPM3.js";
7
- import "./chunk-QPPUYCRF.js";
6
+ } from "./chunk-V26ZMB3D.js";
7
+ import "./chunk-6RPGQ5CG.js";
8
+ import "./chunk-4UNRDXZV.js";
8
9
  import "./chunk-GLSR2NR3.js";
9
10
  import "./chunk-UUSRWSSX.js";
10
11
  import "./chunk-CKH4KQ4E.js";
11
12
  import "./chunk-BXP6YZ2P.js";
13
+ import "./chunk-KHYD3WXE.js";
12
14
  import "./chunk-5C76XDDF.js";
15
+ import "./chunk-NYNSYLFY.js";
16
+ import "./chunk-B5TYJO7V.js";
13
17
  import {
14
18
  runTool
15
- } from "./chunk-5PRWBJCI.js";
19
+ } from "./chunk-PDRAOFGI.js";
16
20
  import {
17
21
  getDangerLevel,
18
22
  runLeanAgentLoop
19
23
  } from "./chunk-3OBY7WSS.js";
20
24
  import "./chunk-TU3L3PW7.js";
21
25
  import "./chunk-HOSJZMQS.js";
22
- import "./chunk-4BKXL7SM.js";
23
- import "./chunk-V6KQ67VF.js";
24
- import {
25
- SUBAGENT_ALLOWED_TOOLS
26
- } from "./chunk-3TOMHXDW.js";
27
- import "./chunk-6RPGQ5CG.js";
28
- import "./chunk-KHYD3WXE.js";
29
- import "./chunk-NYNSYLFY.js";
30
- import "./chunk-B5TYJO7V.js";
31
26
  import {
32
27
  atomicWriteFileSync
33
28
  } from "./chunk-IW3Q7AE5.js";
29
+ import "./chunk-4BKXL7SM.js";
30
+ import "./chunk-OSYK6D4G.js";
31
+ import {
32
+ SUBAGENT_ALLOWED_TOOLS
33
+ } from "./chunk-FT3WS5PG.js";
34
34
 
35
35
  // src/hub/task-orchestrator.ts
36
36
  import { createInterface } from "readline";
@@ -1,15 +1,17 @@
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-PMRU2CAF.js";
10
12
  import "./chunk-TU3L3PW7.js";
11
- import "./chunk-3TOMHXDW.js";
12
13
  import "./chunk-IW3Q7AE5.js";
14
+ import "./chunk-FT3WS5PG.js";
13
15
 
14
16
  // src/cli/usage.ts
15
17
  function classifyRowCost(row) {
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.4.269",
3
+ "version": "0.4.271",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",