jinzd-ai-cli 0.4.261 → 0.4.263

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 (42) hide show
  1. package/README.md +29 -22
  2. package/README.zh-CN.md +32 -25
  3. package/THIRD_PARTY_NOTICES.md +88 -0
  4. package/dist/{batch-YUPAC4CK.js → batch-AN47AYCZ.js} +2 -2
  5. package/dist/{chunk-XZNRZGG2.js → chunk-3OBY7WSS.js} +1 -0
  6. package/dist/{chunk-R6DXWVVN.js → chunk-3RHY2HF7.js} +1 -1
  7. package/dist/{chunk-T7R7ILYT.js → chunk-5K2LFD7D.js} +1 -1
  8. package/dist/{chunk-KFNQESEG.js → chunk-7YCA2BD3.js} +1 -1
  9. package/dist/{chunk-NOB2OPQI.js → chunk-B27MLWFJ.js} +4 -4
  10. package/dist/{chunk-HU3IYBU5.js → chunk-GKI7B4BD.js} +7 -6
  11. package/dist/{chunk-Z5TCAE4L.js → chunk-GMZTY7DA.js} +4 -4
  12. package/dist/{chunk-GC4KA5LF.js → chunk-MJICIIBW.js} +1 -1
  13. package/dist/{chunk-YXMBP567.js → chunk-MTZ6XHJD.js} +2 -2
  14. package/dist/{chunk-DQY2DDGS.js → chunk-QG4NG7KJ.js} +1 -1
  15. package/dist/{chunk-W5XUZYQE.js → chunk-QMB7QYZC.js} +1 -1
  16. package/dist/{chunk-OIOTHBDB.js → chunk-TL5MD5XU.js} +49 -25
  17. package/dist/{chunk-323S2X5I.js → chunk-VKBGOFEO.js} +1 -1
  18. package/dist/{chunk-HGTDI5ME.js → chunk-VUZAKIZ5.js} +1 -1
  19. package/dist/{chunk-H6FND2UG.js → chunk-WM4VTGAF.js} +3 -1
  20. package/dist/{chunk-KQQHMGK7.js → chunk-XST4N2JM.js} +1 -1
  21. package/dist/{chunk-EZ6QLHOS.js → chunk-YRD6M5XI.js} +30 -5
  22. package/dist/{ci-FX26BNT2.js → ci-JTO7LN5S.js} +6 -6
  23. package/dist/{ci-format-GEWIAIZD.js → ci-format-2VGHOLBA.js} +2 -2
  24. package/dist/{constants-YN4B6C7B.js → constants-HLSJL5HQ.js} +1 -1
  25. package/dist/{doctor-cli-PXGXZYQB.js → doctor-cli-JML4FGH4.js} +6 -6
  26. package/dist/electron-server.js +112 -41
  27. package/dist/{hub-RCANK6SK.js → hub-6EYFGJRT.js} +1 -1
  28. package/dist/index.js +107 -58
  29. package/dist/{persistent-memory-P3COUZZM.js → persistent-memory-ANIMO5CF.js} +2 -2
  30. package/dist/{persistent-memory-UARSSYAA.js → persistent-memory-MPBPSZDN.js} +2 -2
  31. package/dist/{pr-7LQTAUFK.js → pr-XE7NGT6U.js} +6 -6
  32. package/dist/{run-tests-YNHESHYY.js → run-tests-ME5KED57.js} +2 -2
  33. package/dist/{run-tests-7RYU4BK5.js → run-tests-TF7UPUWW.js} +2 -2
  34. package/dist/{server-YZ37TL46.js → server-BIYJEJK3.js} +6 -6
  35. package/dist/{server-SSAWGNT7.js → server-VKA4FR2Z.js} +38 -19
  36. package/dist/{task-orchestrator-ZFL4E6NZ.js → task-orchestrator-2RAKLFWN.js} +6 -6
  37. package/dist/{usage-PDKM7J75.js → usage-5F5Q3GGR.js} +4 -4
  38. package/dist/web/client/actions.js +12 -7
  39. package/dist/web/client/app.js +5 -37
  40. package/dist/web/client/sidebar-tabs.js +48 -0
  41. package/dist/web/client/sw.js +1 -1
  42. package/package.json +13 -10
@@ -3,7 +3,7 @@ import {
3
3
  detectsHallucinatedFileOp,
4
4
  parseToolCallArguments,
5
5
  schemaToJsonSchema
6
- } from "./chunk-XZNRZGG2.js";
6
+ } from "./chunk-3OBY7WSS.js";
7
7
  import {
8
8
  AuthError,
9
9
  ProviderError,
@@ -1079,6 +1079,14 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1079
1079
  }
1080
1080
  return msgs;
1081
1081
  }
1082
+ /** Provider-specific request fields shared by all four chat paths. */
1083
+ buildChatRequestParams(request) {
1084
+ return {
1085
+ temperature: request.temperature,
1086
+ max_tokens: request.maxTokens,
1087
+ ...request.thinking ? { thinking: { type: "enabled" } } : {}
1088
+ };
1089
+ }
1082
1090
  /**
1083
1091
  * 非流式请求必须把 `request.signal` 交给 SDK —— 否则 Ctrl+C 完全无效。
1084
1092
  *
@@ -1095,10 +1103,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1095
1103
  const response = await this.client.chat.completions.create({
1096
1104
  model: request.model,
1097
1105
  messages: this.buildMessages(request),
1098
- temperature: request.temperature,
1099
- max_tokens: request.maxTokens,
1100
- stream: false,
1101
- ...request.thinking ? { thinking: { type: "enabled" } } : {}
1106
+ ...this.buildChatRequestParams(request),
1107
+ stream: false
1102
1108
  }, {
1103
1109
  timeout: request.timeout ?? this.defaultTimeout,
1104
1110
  signal: request.signal
@@ -1121,12 +1127,10 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1121
1127
  const stream = await this.client.chat.completions.create({
1122
1128
  model: request.model,
1123
1129
  messages: this.buildMessages(request),
1124
- temperature: request.temperature,
1125
- max_tokens: request.maxTokens,
1130
+ ...this.buildChatRequestParams(request),
1126
1131
  stream: true,
1127
1132
  // 请求末尾 usage chunk,供 token 统计使用
1128
- stream_options: { include_usage: true },
1129
- ...request.thinking ? { thinking: { type: "enabled" } } : {}
1133
+ stream_options: { include_usage: true }
1130
1134
  }, {
1131
1135
  timeout: request.timeout ?? this.defaultTimeout,
1132
1136
  signal: request.signal
@@ -1202,10 +1206,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1202
1206
  messages: allMessages,
1203
1207
  tools: openaiTools,
1204
1208
  tool_choice: "auto",
1205
- temperature: request.temperature,
1206
- max_tokens: request.maxTokens,
1207
- stream: false,
1208
- ...request.thinking ? { thinking: { type: "enabled" } } : {}
1209
+ ...this.buildChatRequestParams(request),
1210
+ stream: false
1209
1211
  }, {
1210
1212
  timeout: request.timeout ?? this.defaultTimeout,
1211
1213
  // 非流式路径同样必须收 signal,否则 Ctrl+C 期间整个请求不可中断(见 chat() 上方注释)
@@ -1303,11 +1305,9 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1303
1305
  messages: allMessages,
1304
1306
  tools: openaiTools,
1305
1307
  tool_choice: "auto",
1306
- temperature: request.temperature,
1307
- max_tokens: request.maxTokens,
1308
+ ...this.buildChatRequestParams(request),
1308
1309
  stream: true,
1309
- stream_options: { include_usage: true },
1310
- ...request.thinking ? { thinking: { type: "enabled" } } : {}
1310
+ stream_options: { include_usage: true }
1311
1311
  }, {
1312
1312
  timeout: request.timeout ?? this.defaultTimeout,
1313
1313
  signal: request.signal
@@ -1501,6 +1501,18 @@ Rules you MUST follow:
1501
1501
  - The system will detect and reject phantom claims. Each failed detection wastes a round. Be honest.`;
1502
1502
  var DeepSeekProvider = class extends OpenAICompatibleProvider {
1503
1503
  defaultBaseUrl = "https://api.deepseek.com/v1";
1504
+ buildChatRequestParams(request) {
1505
+ const thinkingEnabled = request.thinking === true;
1506
+ return {
1507
+ // DeepSeek ignores sampling controls in thinking mode; omit them to keep the
1508
+ // wire request unambiguous. Explicitly disable thinking otherwise because
1509
+ // V4 defaults it to enabled server-side.
1510
+ temperature: thinkingEnabled ? void 0 : request.temperature,
1511
+ max_tokens: request.maxTokens,
1512
+ thinking: { type: thinkingEnabled ? "enabled" : "disabled" },
1513
+ ...thinkingEnabled ? { reasoning_effort: request.thinkingEffort ?? "high" } : {}
1514
+ };
1515
+ }
1504
1516
  /** 禁用流式工具调用,确保 chatWithTools 覆写(代码块检测)生效 */
1505
1517
  enableStreamingToolCalls = false;
1506
1518
  /**
@@ -1521,14 +1533,14 @@ var DeepSeekProvider = class extends OpenAICompatibleProvider {
1521
1533
  // ── V4 family (2026-04-23+):1M context,支持 Thinking / Non-Thinking 双模式 ──
1522
1534
  {
1523
1535
  id: "deepseek-v4-pro",
1524
- displayName: "DeepSeek V4 Pro (1.6T MoE, 49B active)",
1536
+ displayName: "DeepSeek V4 Pro (0813, 1.6T MoE, 49B active)",
1525
1537
  contextWindow: 1048576,
1526
1538
  supportsStreaming: true,
1527
1539
  supportsThinking: true
1528
1540
  },
1529
1541
  {
1530
1542
  id: "deepseek-v4-flash",
1531
- displayName: "DeepSeek V4 Flash (284B MoE, 13B active)",
1543
+ displayName: "DeepSeek V4 Flash (0731, 284B MoE, 13B active)",
1532
1544
  contextWindow: 1048576,
1533
1545
  supportsStreaming: true,
1534
1546
  supportsThinking: true
@@ -2116,6 +2128,18 @@ var BUILT_IN_PROVIDERS = [
2116
2128
  OpenRouterProvider,
2117
2129
  OllamaProvider
2118
2130
  ];
2131
+ function listBuiltInProviderMetadata() {
2132
+ return BUILT_IN_PROVIDERS.map((ProviderClass) => {
2133
+ const { info } = new ProviderClass();
2134
+ return {
2135
+ id: info.id,
2136
+ displayName: info.displayName,
2137
+ defaultModel: info.defaultModel,
2138
+ apiKeyEnvVar: info.apiKeyEnvVar,
2139
+ requiresApiKey: info.requiresApiKey
2140
+ };
2141
+ });
2142
+ }
2119
2143
  var ProviderRegistry = class {
2120
2144
  providers = /* @__PURE__ */ new Map();
2121
2145
  customConfigs = [];
@@ -2210,13 +2234,12 @@ var ProviderRegistry = class {
2210
2234
  return [...this.providers.values()];
2211
2235
  }
2212
2236
  listAll() {
2213
- const builtIn = BUILT_IN_PROVIDERS.map((P) => {
2214
- const p = new P();
2237
+ const builtIn = listBuiltInProviderMetadata().map((info) => {
2215
2238
  return {
2216
- id: p.info.id,
2217
- displayName: p.info.displayName,
2218
- configured: this.providers.has(p.info.id),
2219
- defaultModel: p.info.defaultModel,
2239
+ id: info.id,
2240
+ displayName: info.displayName,
2241
+ configured: this.providers.has(info.id),
2242
+ defaultModel: info.defaultModel,
2220
2243
  isCustom: false
2221
2244
  };
2222
2245
  });
@@ -2235,5 +2258,6 @@ var ProviderRegistry = class {
2235
2258
  };
2236
2259
 
2237
2260
  export {
2261
+ listBuiltInProviderMetadata,
2238
2262
  ProviderRegistry
2239
2263
  };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.261";
4
+ var VERSION = "0.4.263";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -6,7 +6,7 @@ import {
6
6
  MEMORY_FILE_NAME,
7
7
  MEMORY_MAX_CHARS,
8
8
  MEMORY_STORE_FILE_NAME
9
- } from "./chunk-323S2X5I.js";
9
+ } from "./chunk-VKBGOFEO.js";
10
10
  import {
11
11
  DEFAULT_PATTERNS,
12
12
  redactString
@@ -8,7 +8,7 @@ import {
8
8
  CONFIG_FILE_NAME,
9
9
  HISTORY_DIR_NAME,
10
10
  PLUGINS_DIR_NAME
11
- } from "./chunk-323S2X5I.js";
11
+ } from "./chunk-VKBGOFEO.js";
12
12
  import {
13
13
  atomicWriteFileSync
14
14
  } from "./chunk-IW3Q7AE5.js";
@@ -46,6 +46,8 @@ var ModelParamsSchema = z.object({
46
46
  timeout: z.number().int().positive().optional(),
47
47
  /** 是否启用深度思考(thinking)模式,Claude Sonnet/Opus、GLM-5 等 */
48
48
  thinking: z.boolean().optional(),
49
+ /** DeepSeek V4 reasoning effort. */
50
+ thinkingEffort: z.enum(["low", "high", "max"]).optional(),
49
51
  /** thinking 模式的 token 预算(最小 1024,仅 Claude Extended Thinking 使用) */
50
52
  thinkingBudget: z.number().int().min(1024).optional()
51
53
  });
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-323S2X5I.js";
4
+ } from "./chunk-VKBGOFEO.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync, spawnSync } from "child_process";
@@ -1,6 +1,29 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/pricing.ts
4
+ var DEEPSEEK_CNY_PER_USD = 6.9;
5
+ var DEEPSEEK_TIME_PRICING_EFFECTIVE_AT = /* @__PURE__ */ new Date("2026-08-16T16:00:00.000Z");
6
+ function deepSeekCnyPricing(cacheRead, input, output) {
7
+ return {
8
+ cacheRead: cacheRead / DEEPSEEK_CNY_PER_USD,
9
+ input: input / DEEPSEEK_CNY_PER_USD,
10
+ output: output / DEEPSEEK_CNY_PER_USD
11
+ };
12
+ }
13
+ function getDeepSeekV4Pricing(model, at) {
14
+ const isPro = model.startsWith("deepseek-v4-pro");
15
+ const isFlash = model.startsWith("deepseek-v4-flash");
16
+ if (!isPro && !isFlash) return null;
17
+ if (at < DEEPSEEK_TIME_PRICING_EFFECTIVE_AT) {
18
+ return isPro ? deepSeekCnyPricing(0.025, 3, 6) : deepSeekCnyPricing(0.02, 1, 2);
19
+ }
20
+ const beijingHour = (at.getUTCHours() + 8) % 24;
21
+ const isPeak = beijingHour >= 9 && beijingHour < 12 || beijingHour >= 14 && beijingHour < 18;
22
+ if (isPro) {
23
+ return isPeak ? deepSeekCnyPricing(0.3, 9, 27) : deepSeekCnyPricing(0.15, 4.5, 13.5);
24
+ }
25
+ return isPeak ? deepSeekCnyPricing(0.1, 3, 9) : deepSeekCnyPricing(0.05, 1.5, 4.5);
26
+ }
4
27
  var PRICING_TABLE = {
5
28
  // ── Anthropic Claude ──────────────────────────────────────────
6
29
  "claude-opus-4-8": { input: 15, output: 75, cacheWrite: 18.75, cacheRead: 1.5 },
@@ -44,8 +67,6 @@ var PRICING_TABLE = {
44
67
  // 20% 拍脑袋而非抄文档)——`aicli usage` 因此系统性高报 DeepSeek 成本。
45
68
  // 待办:官方已公告峰谷定价(北京时间 9-12 点、14-18 点为平时 2 倍),本表仍是单一费率,
46
69
  // 届时高峰时段会低报;等该策略实际生效后再决定是否引入时段维度。
47
- "deepseek-v4-pro": { input: 0.435, output: 0.87, cacheRead: 3625e-6 },
48
- "deepseek-v4-flash": { input: 0.14, output: 0.28, cacheRead: 28e-4 },
49
70
  // Legacy aliases:retires 2026-07-24 UTC 15:59,官方 route 到 V4 Flash。
50
71
  // 这几条只服务历史 session 的成本回算,保留当时的费率口径,不随现价改动。
51
72
  "deepseek-chat": { input: 0.14, output: 0.28, cacheRead: 0.028 },
@@ -89,11 +110,15 @@ var PRICING_TABLE = {
89
110
  // Handled via provider check below (FREE_PROVIDERS → genuine $0.00, not "unknown").
90
111
  };
91
112
  var FREE_PROVIDERS = /* @__PURE__ */ new Set(["ollama"]);
92
- function getPricing(provider, model) {
113
+ function getPricing(provider, model, at = /* @__PURE__ */ new Date()) {
93
114
  if (FREE_PROVIDERS.has(provider.toLowerCase())) {
94
115
  return { input: 0, output: 0 };
95
116
  }
96
117
  const key = model.toLowerCase();
118
+ if (provider.toLowerCase() === "deepseek") {
119
+ const dynamicPricing = getDeepSeekV4Pricing(key, at);
120
+ if (dynamicPricing) return dynamicPricing;
121
+ }
97
122
  if (PRICING_TABLE[key]) return PRICING_TABLE[key];
98
123
  const keys = Object.keys(PRICING_TABLE).sort((a, b) => b.length - a.length);
99
124
  for (const k of keys) {
@@ -101,8 +126,8 @@ function getPricing(provider, model) {
101
126
  }
102
127
  return null;
103
128
  }
104
- function computeCost(provider, model, usage) {
105
- const p = getPricing(provider, model);
129
+ function computeCost(provider, model, usage, at = /* @__PURE__ */ new Date()) {
130
+ const p = getPricing(provider, model, at);
106
131
  if (!p) return null;
107
132
  const input = usage.inputTokens * p.input;
108
133
  const output = usage.outputTokens * p.output;
@@ -3,14 +3,14 @@ import {
3
3
  CI_COMMENT_MARKER,
4
4
  countSeverity,
5
5
  runCi
6
- } from "./chunk-Z5TCAE4L.js";
7
- import "./chunk-GC4KA5LF.js";
6
+ } from "./chunk-GMZTY7DA.js";
7
+ import "./chunk-MJICIIBW.js";
8
8
  import "./chunk-HLWUDRBO.js";
9
- import "./chunk-OIOTHBDB.js";
10
- import "./chunk-H6FND2UG.js";
11
- import "./chunk-XZNRZGG2.js";
9
+ import "./chunk-TL5MD5XU.js";
10
+ import "./chunk-WM4VTGAF.js";
11
+ import "./chunk-3OBY7WSS.js";
12
12
  import "./chunk-TU3L3PW7.js";
13
- import "./chunk-323S2X5I.js";
13
+ import "./chunk-VKBGOFEO.js";
14
14
  import "./chunk-IW3Q7AE5.js";
15
15
  export {
16
16
  CI_COMMENT_MARKER,
@@ -6,8 +6,8 @@ import {
6
6
  formatCiResult,
7
7
  formatCiSarif,
8
8
  normalizeCiThresholds
9
- } from "./chunk-GC4KA5LF.js";
10
- import "./chunk-323S2X5I.js";
9
+ } from "./chunk-MJICIIBW.js";
10
+ import "./chunk-VKBGOFEO.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-323S2X5I.js";
41
+ } from "./chunk-VKBGOFEO.js";
42
42
  export {
43
43
  AGENTIC_BEHAVIOR_GUIDELINE,
44
44
  APP_NAME,
@@ -2,14 +2,14 @@
2
2
  import {
3
3
  formatDoctorReport,
4
4
  runDoctorCli
5
- } from "./chunk-NOB2OPQI.js";
6
- import "./chunk-OIOTHBDB.js";
7
- import "./chunk-H6FND2UG.js";
8
- import "./chunk-W5XUZYQE.js";
9
- import "./chunk-XZNRZGG2.js";
5
+ } from "./chunk-B27MLWFJ.js";
6
+ import "./chunk-TL5MD5XU.js";
7
+ import "./chunk-WM4VTGAF.js";
8
+ import "./chunk-QMB7QYZC.js";
9
+ import "./chunk-3OBY7WSS.js";
10
10
  import "./chunk-TU3L3PW7.js";
11
11
  import "./chunk-HOSJZMQS.js";
12
- import "./chunk-323S2X5I.js";
12
+ import "./chunk-VKBGOFEO.js";
13
13
  import "./chunk-IW3Q7AE5.js";
14
14
  export {
15
15
  formatDoctorReport,