jinzd-ai-cli 0.4.264 → 0.4.266

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 (41) hide show
  1. package/README.md +59 -37
  2. package/README.zh-CN.md +63 -41
  3. package/dist/{batch-Q22M55UP.js → batch-FQU6HK3Z.js} +2 -2
  4. package/dist/{chunk-VT6NRDD2.js → chunk-23SJVOQD.js} +6 -2
  5. package/dist/{chunk-K7HQLXXQ.js → chunk-3O4VLKD4.js} +1 -1
  6. package/dist/chunk-5C76XDDF.js +78 -0
  7. package/dist/chunk-6YZEZFX5.js +40 -0
  8. package/dist/{chunk-TL5MD5XU.js → chunk-AUEX6RNY.js} +17 -1
  9. package/dist/{chunk-IAIUXBB5.js → chunk-CEJUB4YV.js} +1 -1
  10. package/dist/{chunk-4T4KHPRD.js → chunk-FA3HGXXM.js} +1 -1
  11. package/dist/{chunk-BMSBFK7J.js → chunk-FIDEG2PG.js} +4 -4
  12. package/dist/{chunk-UQP2BNQT.js → chunk-GWOZET2E.js} +1 -1
  13. package/dist/{chunk-JVUYKO4V.js → chunk-LGJ7EX2F.js} +1 -1
  14. package/dist/{chunk-TANTNIGP.js → chunk-LHY7ST6X.js} +1 -1
  15. package/dist/{chunk-QCZFHQHY.js → chunk-N2E6GFLZ.js} +1 -1
  16. package/dist/{chunk-U4XQIP7Z.js → chunk-QW76RX6G.js} +1 -1
  17. package/dist/{chunk-UGJIRJ4H.js → chunk-TJNBSR3I.js} +1 -1
  18. package/dist/{chunk-IEYR2BGG.js → chunk-UCHND2K6.js} +65 -2
  19. package/dist/{chunk-QG4NG7KJ.js → chunk-V4D7YD24.js} +9 -2
  20. package/dist/{chunk-3ARPAVNV.js → chunk-VOIOUJXI.js} +11 -3
  21. package/dist/{chunk-DYONT23T.js → chunk-XEVURCAM.js} +13 -8
  22. package/dist/{chunk-53SOOMYG.js → chunk-Y2X24VYB.js} +24 -95
  23. package/dist/{ci-RMEIHZJL.js → ci-GZH3QMME.js} +6 -5
  24. package/dist/{ci-format-UCFSWVG5.js → ci-format-VKP2MGYJ.js} +2 -2
  25. package/dist/{constants-Z2R2BKUY.js → constants-ICAF6I3J.js} +1 -1
  26. package/dist/{doctor-cli-64L7BBK7.js → doctor-cli-CO6BJWRW.js} +5 -5
  27. package/dist/electron-server.js +127 -26
  28. package/dist/{hub-P7D6VDCK.js → hub-4APIRQ73.js} +8 -4
  29. package/dist/{hub-server-QGUSMN22.js → hub-server-RF6LURXY.js} +3 -1
  30. package/dist/index.js +125 -582
  31. package/dist/{persistent-memory-CELKJM4U.js → persistent-memory-YD3SHSUH.js} +2 -2
  32. package/dist/{persistent-memory-QX6C2JAR.js → persistent-memory-YPO25MOP.js} +2 -2
  33. package/dist/{pr-DJP53EZV.js → pr-CDOPCAPK.js} +15 -10
  34. package/dist/{run-tests-CK44KRY3.js → run-tests-4XRHKHN5.js} +2 -2
  35. package/dist/{run-tests-A2YM4U2U.js → run-tests-QNNP2HCD.js} +2 -2
  36. package/dist/{server-XYVL7A33.js → server-53GM3CRH.js} +34 -29
  37. package/dist/{server-GUV2HZ7N.js → server-B4A7LHZ5.js} +6 -5
  38. package/dist/setup-wizard-S55ICNHH.js +483 -0
  39. package/dist/{task-orchestrator-5RT5EH2J.js → task-orchestrator-WNV6PT6Z.js} +10 -7
  40. package/dist/{usage-LGPJ4UAW.js → usage-E3FEYSBU.js} +3 -3
  41. package/package.json +1 -1
@@ -34,14 +34,14 @@ import {
34
34
  touchMemoryReferences,
35
35
  updateMemoryApproval,
36
36
  updateMemoryEntry
37
- } from "./chunk-UQP2BNQT.js";
37
+ } from "./chunk-GWOZET2E.js";
38
38
  import {
39
39
  redactJson,
40
40
  scanString
41
41
  } from "./chunk-YVTASHS5.js";
42
42
  import {
43
43
  runTestsTool
44
- } from "./chunk-TANTNIGP.js";
44
+ } from "./chunk-LHY7ST6X.js";
45
45
  import {
46
46
  AGENTIC_BEHAVIOR_GUIDELINE,
47
47
  APP_NAME,
@@ -73,7 +73,7 @@ import {
73
73
  SUBAGENT_MAX_ROUNDS_LIMIT,
74
74
  VERSION,
75
75
  buildUserIdentityPrompt
76
- } from "./chunk-4T4KHPRD.js";
76
+ } from "./chunk-FA3HGXXM.js";
77
77
  import {
78
78
  hasSemanticIndex,
79
79
  semanticSearch
@@ -725,6 +725,16 @@ var BaseProvider = class {
725
725
  get supportsContentOnlyTee() {
726
726
  return this.reliableContentOnlyTee;
727
727
  }
728
+ /**
729
+ * 该 provider 是否支持 `reasoning_effort` 档位(low/high/max)。目前只有 DeepSeek V4。
730
+ *
731
+ * 2026-08-14 审计 P2-03:提示符标签此前无条件渲染成 `[THINK:high]`,于是 Claude
732
+ * (用 thinkingBudget 计 token 预算)和 GLM(根本没有 effort 概念)也显示一个
733
+ * 既不生效、也无从设置的档位——屏幕上的假信息比没有信息更坏。
734
+ */
735
+ get supportsReasoningEffort() {
736
+ return false;
737
+ }
728
738
  /**
729
739
  * 将 Message[] 转换为 OpenAI API 格式的消息数组。
730
740
  * content 为 string 时直接传递;为 MessageContentPart[] 时保留数组格式(vision 请求)。
@@ -2991,10 +3001,12 @@ var OpenAICompatibleProvider = class extends BaseProvider {
2991
3001
  if (!firstChoice) {
2992
3002
  return { content: "", model: response.model, usage: void 0 };
2993
3003
  }
3004
+ const reasoningContent = firstChoice.message.reasoning_content;
2994
3005
  return {
2995
3006
  content: firstChoice.message.content ?? "",
2996
3007
  model: response.model,
2997
- usage: toUsage(response.usage)
3008
+ usage: toUsage(response.usage),
3009
+ ...reasoningContent ? { reasoningContent } : {}
2998
3010
  };
2999
3011
  } catch (err) {
3000
3012
  throw this.wrapError(err);
@@ -3391,6 +3403,10 @@ var DeepSeekProvider = class extends OpenAICompatibleProvider {
3391
3403
  ...thinkingEnabled ? { reasoning_effort: request.thinkingEffort ?? "high" } : {}
3392
3404
  };
3393
3405
  }
3406
+ /** V4 支持 low/high/max 三档 reasoning_effort(官方 2026-08 更新公告)。 */
3407
+ get supportsReasoningEffort() {
3408
+ return true;
3409
+ }
3394
3410
  /** 禁用流式工具调用,确保 chatWithTools 覆写(代码块检测)生效 */
3395
3411
  enableStreamingToolCalls = false;
3396
3412
  /**
@@ -13792,6 +13808,17 @@ function formatCost(amount) {
13792
13808
  return `$${amount.toFixed(2)}`;
13793
13809
  }
13794
13810
 
13811
+ // src/core/chat-params.ts
13812
+ function thinkingParamsFor(allModelParams, model) {
13813
+ const params = allModelParams?.[model];
13814
+ if (!params) return {};
13815
+ const out = {};
13816
+ if (params.thinking !== void 0) out.thinking = params.thinking;
13817
+ if (params.thinkingEffort !== void 0) out.thinkingEffort = params.thinkingEffort;
13818
+ if (params.thinkingBudget !== void 0) out.thinkingBudget = params.thinkingBudget;
13819
+ return out;
13820
+ }
13821
+
13795
13822
  // src/session/tool-history.ts
13796
13823
  var SESSION_SIZE_LIMIT = 2 * 1024 * 1024;
13797
13824
  function persistToolRound(session, toolCalls, toolResults, opts) {
@@ -14264,6 +14291,11 @@ var HubAgent = class {
14264
14291
  defaultModel;
14265
14292
  /** External context documents injected into system prompt */
14266
14293
  context;
14294
+ /**
14295
+ * 该 agent 模型的思考参数(审计 P0-01)。HubAgent 自己拿不到 ConfigManager,
14296
+ * 由构造方(hub-server / discuss)按 modelId 解析后注入;不注入则沿用产品默认(不思考)。
14297
+ */
14298
+ thinking;
14267
14299
  constructor(role, providers, defaultProvider, defaultModel, context) {
14268
14300
  this.role = role;
14269
14301
  this.providers = providers;
@@ -14295,7 +14327,8 @@ var HubAgent = class {
14295
14327
  systemPrompt,
14296
14328
  stream: false,
14297
14329
  temperature: 0.7,
14298
- maxTokens: 4096
14330
+ maxTokens: 4096,
14331
+ ...this.thinking ?? {}
14299
14332
  });
14300
14333
  const { content, passed, converged } = parseTurn(response.content);
14301
14334
  return {
@@ -14328,7 +14361,8 @@ var HubAgent = class {
14328
14361
  systemPrompt,
14329
14362
  stream: true,
14330
14363
  temperature: 0.7,
14331
- maxTokens: 4096
14364
+ maxTokens: 4096,
14365
+ ...this.thinking ?? {}
14332
14366
  });
14333
14367
  for await (const chunk of stream) {
14334
14368
  if (chunk.delta) {
@@ -14366,7 +14400,8 @@ var HubAgent = class {
14366
14400
  model: this.modelId,
14367
14401
  stream: false,
14368
14402
  temperature: 0.3,
14369
- maxTokens: 4096
14403
+ maxTokens: 4096,
14404
+ ...this.thinking ?? {}
14370
14405
  });
14371
14406
  return response.content.trim();
14372
14407
  }
@@ -14470,7 +14505,11 @@ var DiscussionOrchestrator = class {
14470
14505
  onRoundReview;
14471
14506
  constructor(config, providers) {
14472
14507
  this.agents = config.roles.map(
14473
- (role) => new HubAgent(role, providers, config.defaultProvider, config.defaultModel, config.context)
14508
+ (role) => {
14509
+ const agent = new HubAgent(role, providers, config.defaultProvider, config.defaultModel, config.context);
14510
+ agent.thinking = config.thinking;
14511
+ return agent;
14512
+ }
14474
14513
  );
14475
14514
  this.humanSteer = config.humanSteer ?? false;
14476
14515
  this.voteConverge = config.voteConverge ?? false;
@@ -14842,6 +14881,68 @@ async function persistDiscussion(state2, config, defaultProvider, defaultModel)
14842
14881
  return { id: session.id, path: join20(config.getHistoryDir(), `${session.id}.json`) };
14843
14882
  }
14844
14883
 
14884
+ // src/core/think-command.ts
14885
+ var EFFORTS = /* @__PURE__ */ new Set(["low", "high", "max"]);
14886
+ function resolveEffective(state2) {
14887
+ if (state2.runtimeThinking !== null) return { effective: state2.runtimeThinking, origin: "runtime override" };
14888
+ if (state2.configuredThinking !== void 0) return { effective: state2.configuredThinking, origin: "config" };
14889
+ return { effective: false, origin: "default" };
14890
+ }
14891
+ function effortLine(state2, effort) {
14892
+ if (!state2.supportsEffort) return `Reasoning effort: n/a for ${state2.provider}`;
14893
+ const resolved = effort ?? state2.runtimeEffort ?? state2.configuredEffort;
14894
+ return `Reasoning effort: ${resolved ?? "high (provider default)"}`;
14895
+ }
14896
+ function applyThinkCommand(sub, state2) {
14897
+ const key = (sub ?? "toggle").toLowerCase();
14898
+ const current = resolveEffective(state2);
14899
+ const stay = (summary, details = []) => ({
14900
+ runtimeThinking: state2.runtimeThinking,
14901
+ runtimeEffort: state2.runtimeEffort,
14902
+ effective: current.effective,
14903
+ origin: current.origin,
14904
+ summary,
14905
+ details,
14906
+ changed: false
14907
+ });
14908
+ const enable = (effort) => ({
14909
+ runtimeThinking: true,
14910
+ runtimeEffort: effort ?? state2.runtimeEffort,
14911
+ effective: true,
14912
+ origin: "runtime override",
14913
+ summary: effort && state2.supportsEffort ? `Extended Thinking: ON (effort: ${effort})` : "Extended Thinking: ON",
14914
+ details: effort && !state2.supportsEffort ? [`Note: ${state2.provider} has no reasoning-effort levels \u2014 the level is ignored.`] : [],
14915
+ changed: true
14916
+ });
14917
+ const disable = () => ({
14918
+ runtimeThinking: false,
14919
+ // 刻意保留档位:重新开启时不该丢掉用户选过的档
14920
+ runtimeEffort: state2.runtimeEffort,
14921
+ effective: false,
14922
+ origin: "runtime override",
14923
+ summary: "Extended Thinking: OFF",
14924
+ details: [],
14925
+ changed: true
14926
+ });
14927
+ if (key === "status") {
14928
+ const details = current.effective ? [effortLine(state2, null)] : [
14929
+ "Enable with /think on | low | high | max, or set",
14930
+ "modelParams.<model>.thinking in ~/.aicli/config.json"
14931
+ ];
14932
+ return stay(
14933
+ `Extended Thinking: ${current.effective ? "ON" : "OFF"} (${current.origin})`,
14934
+ details
14935
+ );
14936
+ }
14937
+ if (key === "on") return enable(null);
14938
+ if (key === "off") return disable();
14939
+ if (EFFORTS.has(key)) return enable(key);
14940
+ if (key === "toggle") {
14941
+ return current.effective ? disable() : enable(null);
14942
+ }
14943
+ return stay(`Unknown /think option "${sub}" \u2014 expected on | off | low | high | max | status`);
14944
+ }
14945
+
14845
14946
  // src/web/commands/provider-commands.ts
14846
14947
  async function handleProvider(args, ctx) {
14847
14948
  const id = args[0];
@@ -14904,25 +15005,24 @@ async function handleModel(args, ctx) {
14904
15005
  ctx.sendStatus();
14905
15006
  }
14906
15007
  async function handleThink(args, ctx) {
14907
- const sub = args[0]?.toLowerCase() ?? "toggle";
14908
- if (sub === "status") {
14909
- ctx.send({
14910
- type: "info",
14911
- message: `Thinking mode: ${ctx.runtimeThinking === null ? "CONFIG" : ctx.runtimeThinking ? "ON" : "OFF"}; effort: ${ctx.runtimeThinkingEffort ?? "config/default (high for DeepSeek V4)"}`
14912
- });
14913
- return;
15008
+ const modelParams = ctx.config.get("modelParams")[ctx.currentModel];
15009
+ const outcome = applyThinkCommand(args[0], {
15010
+ runtimeThinking: ctx.runtimeThinking,
15011
+ runtimeEffort: ctx.runtimeThinkingEffort,
15012
+ configuredThinking: modelParams?.thinking,
15013
+ configuredEffort: modelParams?.thinkingEffort,
15014
+ supportsEffort: ctx.providers.get(ctx.currentProvider)?.supportsReasoningEffort ?? false,
15015
+ provider: ctx.currentProvider
15016
+ });
15017
+ if (outcome.changed) {
15018
+ ctx.runtimeThinking = outcome.runtimeThinking;
15019
+ ctx.runtimeThinkingEffort = outcome.runtimeEffort;
14914
15020
  }
14915
- if (sub === "on") ctx.runtimeThinking = true;
14916
- else if (sub === "off") ctx.runtimeThinking = false;
14917
- else if (sub === "low" || sub === "high" || sub === "max") {
14918
- ctx.runtimeThinking = true;
14919
- ctx.runtimeThinkingEffort = sub;
14920
- } else ctx.runtimeThinking = ctx.runtimeThinking !== true;
14921
15021
  ctx.send({
14922
15022
  type: "info",
14923
- message: `Thinking mode: ${ctx.runtimeThinking ? "ON" : "OFF"}${ctx.runtimeThinking ? ` (${ctx.runtimeThinkingEffort ?? "high"})` : ""}`
15023
+ message: [outcome.summary, ...outcome.details].join(" \u2014 ")
14924
15024
  });
14925
- ctx.sendStatus();
15025
+ if (outcome.changed) ctx.sendStatus();
14926
15026
  }
14927
15027
  async function handlePlan(args, ctx) {
14928
15028
  const sub = args[0];
@@ -15434,7 +15534,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
15434
15534
  Cost: ${formatCost(cost)}` : "";
15435
15535
  let memoryLine = "";
15436
15536
  try {
15437
- const { countPendingMemories } = await import("./persistent-memory-QX6C2JAR.js");
15537
+ const { countPendingMemories } = await import("./persistent-memory-YPO25MOP.js");
15438
15538
  const pending = countPendingMemories(ctx.config.getConfigDir());
15439
15539
  if (pending > 0) memoryLine = `
15440
15540
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -16249,7 +16349,7 @@ async function handleTest(args, ctx) {
16249
16349
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
16250
16350
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
16251
16351
  }
16252
- const runTests = ctx.runTests ?? (await import("./run-tests-CK44KRY3.js")).executeTests;
16352
+ const runTests = ctx.runTests ?? (await import("./run-tests-4XRHKHN5.js")).executeTests;
16253
16353
  const report = await runTests(testArgs);
16254
16354
  ctx.send({ type: "info", message: report });
16255
16355
  } catch (err) {
@@ -16507,7 +16607,7 @@ async function handleMemory(args, ctx) {
16507
16607
  ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
16508
16608
  } else if (sub === "export") {
16509
16609
  if (args[1] === "md") {
16510
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-QX6C2JAR.js");
16610
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-YPO25MOP.js");
16511
16611
  ctx.send({
16512
16612
  type: "export_data",
16513
16613
  format: "md",
@@ -17290,6 +17390,7 @@ var SessionHandler = class {
17290
17390
  const roles = resolution.roles;
17291
17391
  for (const w of resolution.warnings) this.send({ type: "info", message: w });
17292
17392
  const config = {
17393
+ thinking: thinkingParamsFor(this.config.get("modelParams"), this.currentModel),
17293
17394
  mode: "discuss",
17294
17395
  roles,
17295
17396
  defaultProvider,
@@ -9,8 +9,11 @@ import {
9
9
  getPreset,
10
10
  listPresets,
11
11
  resolveRoleProviders
12
- } from "./chunk-VT6NRDD2.js";
13
- import "./chunk-3ARPAVNV.js";
12
+ } from "./chunk-23SJVOQD.js";
13
+ import "./chunk-VOIOUJXI.js";
14
+ import {
15
+ thinkingParamsFor
16
+ } from "./chunk-6YZEZFX5.js";
14
17
 
15
18
  // src/hub/index.ts
16
19
  import { readFileSync, existsSync } from "fs";
@@ -129,6 +132,7 @@ ${content}`);
129
132
  maxToolRoundsPerTurn: mode === "task" ? options.taskRounds ?? 30 : void 0,
130
133
  context,
131
134
  contextFiles: contextFileNames.length > 0 ? contextFileNames : void 0,
135
+ thinking: thinkingParamsFor(configManager.get("modelParams"), defaultModel),
132
136
  humanSteer: options.steer === true,
133
137
  voteConverge: options.vote === true
134
138
  };
@@ -154,7 +158,7 @@ ${content}`);
154
158
  }
155
159
  }
156
160
  async function runTaskMode(config, providers, configManager, topic) {
157
- const { TaskOrchestrator } = await import("./task-orchestrator-5RT5EH2J.js");
161
+ const { TaskOrchestrator } = await import("./task-orchestrator-WNV6PT6Z.js");
158
162
  const orchestrator = new TaskOrchestrator(config, providers, configManager);
159
163
  let interrupted = false;
160
164
  const onSigint = () => {
@@ -190,7 +194,7 @@ async function runTaskMode(config, providers, configManager, topic) {
190
194
  }
191
195
  }
192
196
  async function runDistributedDiscussion(config, providers, topic, port) {
193
- const { HubServer } = await import("./hub-server-QGUSMN22.js");
197
+ const { HubServer } = await import("./hub-server-RF6LURXY.js");
194
198
  const hub = new HubServer(config, providers, port);
195
199
  let interrupted = false;
196
200
  const onSigint = () => {
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-NR5U6LVG.js";
14
14
  import {
15
15
  HubAgent
16
- } from "./chunk-3ARPAVNV.js";
16
+ } from "./chunk-VOIOUJXI.js";
17
17
 
18
18
  // src/hub/hub-server.ts
19
19
  import { WebSocketServer } from "ws";
@@ -261,6 +261,7 @@ var HubServer = class {
261
261
  }
262
262
  async getBuiltinResponse(role, topic, round, maxRounds) {
263
263
  const agent = new HubAgent(role, this.providers, this.config.defaultProvider, this.config.defaultModel, this.config.context);
264
+ agent.thinking = this.config.thinking;
264
265
  return agent.speak(topic, this.history, round, maxRounds);
265
266
  }
266
267
  async generateSummary(topic) {
@@ -274,6 +275,7 @@ var HubServer = class {
274
275
  this.config.defaultModel,
275
276
  this.config.context
276
277
  );
278
+ summarizer.thinking = this.config.thinking;
277
279
  try {
278
280
  console.log(chalk.dim(" Generating summary..."));
279
281
  const summary = await summarizer.summarize(topic, this.history);