jinzd-ai-cli 0.4.319 → 0.4.320

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-CQ542WJF.js → batch-LRYDPB6F.js} +2 -2
  2. package/dist/{chunk-YHMQMP2I.js → chunk-46M65JDN.js} +5 -5
  3. package/dist/{chunk-D6BLSFYD.js → chunk-4S2XD3M2.js} +4 -4
  4. package/dist/{chunk-662ZJPJE.js → chunk-5VZHSSLW.js} +1 -1
  5. package/dist/{chunk-KEOMNFBH.js → chunk-DB4HVUPI.js} +1 -1
  6. package/dist/{chunk-GVAAGBHX.js → chunk-E2W2MI6H.js} +74 -5
  7. package/dist/{chunk-A7YZLLWN.js → chunk-J7IPNING.js} +1 -1
  8. package/dist/{chunk-AC44E4CV.js → chunk-N6YFBRQV.js} +1 -1
  9. package/dist/{chunk-Y3SEC5EC.js → chunk-NOAWUEJJ.js} +1 -1
  10. package/dist/{chunk-OQZIP4LU.js → chunk-P4FJBD2H.js} +1 -1
  11. package/dist/{chunk-2PAQOR2X.js → chunk-QB3MECZJ.js} +8 -8
  12. package/dist/{chunk-DCQDFQDW.js → chunk-SKQUWDRM.js} +1 -1
  13. package/dist/{chunk-SZBSTSG4.js → chunk-TKBWA3XJ.js} +4 -4
  14. package/dist/{chunk-GP24X3KJ.js → chunk-WW2LFOWE.js} +1 -1
  15. package/dist/{chunk-PGQ5OV3P.js → chunk-WY4IWCQ5.js} +1 -1
  16. package/dist/{chunk-N2MHUA4B.js → chunk-YAMPLTYO.js} +1 -1
  17. package/dist/{ci-HAPWBC37.js → ci-7TSOMDHV.js} +6 -6
  18. package/dist/{ci-format-NGWP4GTQ.js → ci-format-6A2RFYZS.js} +2 -2
  19. package/dist/{constants-CPHZLOCQ.js → constants-EHYM2NS5.js} +1 -1
  20. package/dist/{constants-GSUK6ILC.js → constants-P33UDQVS.js} +1 -1
  21. package/dist/{doctor-cli-L6AK2GJ7.js → doctor-cli-2B72UMZO.js} +6 -6
  22. package/dist/electron-server.js +84 -15
  23. package/dist/{hub-TCZFG2ZG.js → hub-JACLTKYY.js} +1 -1
  24. package/dist/index.js +45 -24
  25. package/dist/{persistent-memory-E3UYP7RJ.js → persistent-memory-5ICLP275.js} +2 -2
  26. package/dist/{persistent-memory-IPNMYXU4.js → persistent-memory-ZIM6ICIR.js} +2 -2
  27. package/dist/{pr-J5TSU5P6.js → pr-UBGLNROK.js} +6 -6
  28. package/dist/{run-tests-PDD4KUQL.js → run-tests-HCID73KE.js} +2 -2
  29. package/dist/{run-tests-FLGSE63O.js → run-tests-SYJG4S3N.js} +2 -2
  30. package/dist/{server-XQ3IQUZ5.js → server-3UEEPEUD.js} +15 -15
  31. package/dist/{server-3C6IK3JE.js → server-BVTFIPB2.js} +6 -6
  32. package/dist/{task-orchestrator-544JETWF.js → task-orchestrator-6NRCGF5V.js} +9 -7
  33. package/dist/{usage-MQTA7HHZ.js → usage-6V64TTRE.js} +2 -2
  34. package/package.json +1 -1
@@ -55,7 +55,7 @@ import {
55
55
  touchMemoryReferences,
56
56
  updateMemoryApproval,
57
57
  updateMemoryEntry
58
- } from "./chunk-GP24X3KJ.js";
58
+ } from "./chunk-WW2LFOWE.js";
59
59
  import {
60
60
  DEFAULT_PATTERNS,
61
61
  redactJson,
@@ -81,7 +81,7 @@ import {
81
81
  recoverGbkMojibake,
82
82
  runTestsTool,
83
83
  shellInvocation
84
- } from "./chunk-AC44E4CV.js";
84
+ } from "./chunk-N6YFBRQV.js";
85
85
  import {
86
86
  getCurrentSessionKey,
87
87
  getExecutionConfigDir,
@@ -123,7 +123,7 @@ import {
123
123
  SUBAGENT_MAX_ROUNDS_LIMIT,
124
124
  VERSION,
125
125
  buildUserIdentityPrompt
126
- } from "./chunk-DCQDFQDW.js";
126
+ } from "./chunk-SKQUWDRM.js";
127
127
 
128
128
  // src/web/access.ts
129
129
  import { randomBytes, timingSafeEqual } from "crypto";
@@ -2433,6 +2433,14 @@ var HALLUCINATION_PATTERNS = [
2433
2433
  // 已创建!
2434
2434
  /File\s+(?:written|saved|created)\s+(?:to|as|at)/i,
2435
2435
  // File written to / saved as(要求介词)
2436
+ // 2026-10-07 审计 B-02:中英文判据不对称。中文「已保存到」要求引号、英文只认 `File saved to`,
2437
+ // 于是「已保存到 report.md。」「I saved the changes to src/index.ts.」双双漏检。
2438
+ // 改为「后面跟一个带扩展名的文件名」——同样挡得住「已保存到数据库」「saved my time」这类误报。
2439
+ /已(?:保存|写入)到?\s*[^\s,,。;;::]{1,120}\.\w{1,6}(?![\w/])/,
2440
+ // 动词后直接跟文件名(中间只许冠词 / both / the file 之类),或「动词 … to/into 文件名」。
2441
+ // 刻意不放宽成「同句任意文件名」:「I saved you some time by checking README.md」不是写入声明。
2442
+ /\b(?:I|We)(?:'ve| have)?\s+(?:now\s+|just\s+|also\s+|successfully\s+)?(?:created|written|wrote|saved|generated)\s+(?:(?:the|a|an|both|all|two|three|new|following)\s+)*(?:(?:files?|documents?|reports?|scripts?)\s+)?[`'"]?[\w./-]+\.(?:md|txt|json|ya?ml|csv|html?|css|[jt]sx?|py|sh|go|rs|java|sql|xml|toml|ini|cfg|pdf|docx?|xlsx?|pptx?)\b/i,
2443
+ /\b(?:I|We)(?:'ve| have)?\s+(?:now\s+|just\s+|also\s+|successfully\s+)?(?:created|written|wrote|saved|generated)\b[^.\n]{0,40}?\b(?:to|into)\s+[`'"]?[\w./-]+\.(?:md|txt|json|ya?ml|csv|html?|css|[jt]sx?|py|sh|go|rs|java|sql|xml|toml|ini|cfg|pdf|docx?|xlsx?|pptx?)\b/i,
2436
2444
  /生成完成[!!]/,
2437
2445
  // 生成完成!
2438
2446
  /✅\s*(?:文件|已[生保写创]|第)\S*\.\w{1,5}/,
@@ -2483,6 +2491,8 @@ var QUICK_WRITE_KEYWORDS = [
2483
2491
  "saved",
2484
2492
  "written",
2485
2493
  "created",
2494
+ "wrote",
2495
+ "generated",
2486
2496
  "File",
2487
2497
  "file",
2488
2498
  // emoji 勾选标记
@@ -2599,8 +2609,13 @@ function extractClaimedFilePaths(content) {
2599
2609
  }
2600
2610
  const zhRe = /(?:已保存(?:到)?|已写入(?:到)?|已创建|已生成|文件路径[::]|保存为|写入到)\s*[`'”””]?([^\s`'”””,,。\n]+\.\w{1,6})/g;
2601
2611
  while ((m = zhRe.exec(content)) !== null) add(m[1]);
2602
- const enRe = /(?:saved|written|created)\s+(?:to|as|at)\s+[`'”]?([^\s`'”\n,]+\.\w{1,6})/gi;
2612
+ const enRe = /\b(?:saved|written|wrote|created)\b[^.\n]{0,40}?\b(?:to|as|at|into)\s+[`'”]?([^\s`'”\n,]+\.\w{1,6})/gi;
2603
2613
  while ((m = enRe.exec(content)) !== null) add(m[1]);
2614
+ const enClaimRe = /\b(?:I|We)(?:'ve| have)?\s+(?:now\s+|just\s+|also\s+|successfully\s+)?(?:created|written|wrote|saved|generated)\b([^\n;]*)/gi;
2615
+ while ((m = enClaimRe.exec(content)) !== null) {
2616
+ const clause = m[1].split(/[.!?](?:\s|$)|\b(?:based on|from|using|per|according to|referencing|following|after|by|while|when|checking|reading|reviewing)\b/i)[0] ?? "";
2617
+ for (const f of clause.matchAll(/[`'"]?([\w./-]+\.\w{1,6})\b/g)) add(f[1]);
2618
+ }
2604
2619
  const checkRe = /✅[^\n`]*?[`'”]?([^\s`'”\n,,。]+?\.\w{1,6})/g;
2605
2620
  while ((m = checkRe.exec(content)) !== null) {
2606
2621
  const pathStart = m.index + m[0].lastIndexOf(m[1]);
@@ -2875,8 +2890,27 @@ var META_NARRATION_HEURISTICS = [
2875
2890
  /(?:我来|让我|容我)\s*(?:整理|梳理|归纳|想想|看看|重新|检查|核实)/u,
2876
2891
  // 过渡语(需要 2+ hits):"以下是:" / "如下:" 作为独立行。文档中可作小节标题,
2877
2892
  // 但配合另一个对话模式(如"好的")时是典型的 AI 内容包装。
2878
- /^.{0,60}(?:以下是|下面是|如下)\s*[::,,]\s*$/mu
2893
+ /^.{0,60}(?:以下是|下面是|如下)\s*[::,,]\s*$/mu,
2894
+ // 叙述自己要调用工具(2026-10-07 审计 B-05):文档正文不会这样写自己。
2895
+ /(?:让我|我来|我将|我会|接下来)\s*(?:调用|使用|用)\s*`?\w+`?\s*工具/u,
2896
+ /\bI(?:'ll| will| am going to)\s+(?:now\s+)?(?:use|call|invoke)\s+the\s+`?\w+`?\s+tool\b/i
2897
+ ];
2898
+ var ANNOUNCEMENT_PATTERNS = [
2899
+ /^\s*(?:好的|好|收到|明白|了解|嗯|OK|Okay|Sure|Certainly)[,,。.!!\s]/iu,
2900
+ /(?:我(?:这就|马上|现在|立即|立刻|来|将|会)|让我|下面我|接下来我)\s*(?:为[您你])?\s*(?:开始|着手|撰写|写|生成|整理|输出|编写|准备|调用|使用)/u,
2901
+ /(?:请稍[候等]|稍等|马上就好|这就开始)/u,
2902
+ /\b(?:let me|I(?:'ll| will| am going to)|I'm going to)\s+(?:now\s+)?(?:write|draft|generate|create|start|prepare|produce|compose|use|call)\b/i,
2903
+ /\b(?:please wait|one moment|stand by)\b/i
2879
2904
  ];
2905
+ function looksLikeAnnouncementOnly(content) {
2906
+ const text = content.trim();
2907
+ if (!text || text.length > 300 || text.split("\n").length > 4) return null;
2908
+ if (/^#{1,6}\s+\S/m.test(text)) return null;
2909
+ for (const re of ANNOUNCEMENT_PATTERNS) {
2910
+ if (re.test(text)) return re.source;
2911
+ }
2912
+ return null;
2913
+ }
2880
2914
  var CHINESE_TAIL_CLOSING_MARKERS = [
2881
2915
  /(?:需要你|请你|麻烦你|你看)\s*(?:确认|决定|选择|帮忙|看[一看下]|过目|觉得|认为)/u,
2882
2916
  /(?:随时|有问题|有需要|需要调整|需要修改)\s*(?:联系|找我|告诉|沟通|调整|修改)/u,
@@ -3013,6 +3047,15 @@ This fresh stream has NO tools \u2014 output is captured verbatim. STOP emitting
3013
3047
  summary: `[save_last_response REJECTED] The content-only stream produced NO text at all (output budget likely spent on reasoning). ${saveToFile} was NOT saved.`
3014
3048
  };
3015
3049
  }
3050
+ const announced = looksLikeAnnouncementOnly(rawContent);
3051
+ if (announced) {
3052
+ return fallback(`announcement only: ${announced}`) ?? {
3053
+ kind: "reject",
3054
+ reason: "not-a-document",
3055
+ matched: announced,
3056
+ summary: `[save_last_response REJECTED] The content-only stream produced only an announcement (e.g. "OK, I'll write the report now\u2026"), not the document itself. ${saveToFile} was NOT saved.`
3057
+ };
3058
+ }
3016
3059
  const { lines, bytes } = teeFileStats(rawContent);
3017
3060
  return {
3018
3061
  kind: "ok",
@@ -3034,6 +3077,7 @@ function teeStreamErrorSummary(saveToFile, errMsg) {
3034
3077
  // src/core/stalled-intent.ts
3035
3078
  var WAITING_FOR_USER_RE = /[??]\s*$|是否|要不要|需不需要|需要我|要我|可以吗|好吗|行吗|您看|你看看|请确认|确认后|同意后|如果(?:你|您)|若(?:你|您)|如(?:你|您)需要|等你|等待(?:你|您)|待(?:你|您)|我可以|我也可以|还可以|(?:你|您)可以|告诉我|或者(?:让我|我)|可以为(?:你|您)|可以帮|随时|\bwould you\b|\bshall i\b|\bshould i\b|\bdo you want\b|\blet me know\b|\bif you(?:'d| would)? like\b|\bonce you confirm\b|\byour (?:approval|confirmation)\b|\bif you want\b|\bi can also\b/i;
3036
3079
  var COMPLETED_RE = /已|完成|好了|完毕|写好|搞定|\b(?:done|finished|completed|have (?:written|created|generated))\b/i;
3080
+ var NEGATION_RE = /没有?|未|无法|不(?:会|能|再|打算|需要|用|必|要)|n't\b|\b(?:not|never|no longer|cannot)\b/i;
3037
3081
  var CN_VERBS = "\u5F00\u5199|\u52A8\u624B|\u7F16\u5199|\u5199\u5165|\u5199|\u751F\u6210|\u521B\u5EFA|\u5236\u4F5C|\u6267\u884C|\u8FD0\u884C|\u5B89\u88C5|\u4FEE\u6539|\u66F4\u65B0|\u4FEE\u590D|\u5B9E\u73B0|\u6784\u5EFA|\u8F93\u51FA|\u4FDD\u5B58|\u8BFB\u53D6|\u67E5\u770B|\u68C0\u67E5|\u8C03\u7528|\u5904\u7406|\u6574\u7406|\u8865\u5145|\u5B8C\u5584|\u91CD\u5199|\u6539\u5199|\u843D\u76D8";
3038
3082
  var CN_FIRST_PERSON_INTENT_RE = new RegExp(
3039
3083
  `(?:\u6211|\u54B1\u4EEC|\u6211\u4EEC|\u8BA9\u6211)(?:\u73B0\u5728|\u8FD9\u5C31|\u9A6C\u4E0A|\u7ACB\u5373|\u7ACB\u523B|\u76F4\u63A5|\u63A5\u4E0B\u6765|\u4E0B\u9762|\u5148|\u518D|\u968F\u540E|\u7136\u540E|\u5C31)*(?:\u5C06|\u4F1A|\u8981|\u6765|\u53BB|\u5F00\u59CB|\u7740\u624B|\u51C6\u5907)?(?:[^\uFF0C,\u3002\uFF01!\uFF1B;\uFF1A:\\n]{0,4})?(?:${CN_VERBS})`
@@ -3055,11 +3099,11 @@ function detectStalledIntent(content) {
3055
3099
  if (WAITING_FOR_USER_RE.test(tail)) return null;
3056
3100
  const clauses = tail.split(/[,,;;。!!::\n]/).map((c) => c.trim()).filter(Boolean);
3057
3101
  for (const clause of clauses) {
3058
- if (COMPLETED_RE.test(clause)) continue;
3102
+ if (COMPLETED_RE.test(clause) || NEGATION_RE.test(clause)) continue;
3059
3103
  if (CN_FIRST_PERSON_INTENT_RE.test(clause) || CN_BARE_INTENT_RE.test(clause)) return clause;
3060
3104
  }
3061
3105
  for (const sentence of tail.split(/(?<=[.!])\s+|\n/)) {
3062
- if (COMPLETED_RE.test(sentence)) continue;
3106
+ if (COMPLETED_RE.test(sentence) || NEGATION_RE.test(sentence)) continue;
3063
3107
  const m = EN_INTENT_RE.exec(sentence);
3064
3108
  if (m) return sentence.trim();
3065
3109
  }
@@ -3507,7 +3551,12 @@ async function runAgentLoop(host) {
3507
3551
  if (tc.name.startsWith("mcp__")) host.onMcpToolUsed?.(tc.name);
3508
3552
  }
3509
3553
  host.persistRound?.(toolCalls, toolResults, {
3510
- assistantContent: outcome.content,
3554
+ // 工具调用前模型说的话("A 方向汇报:…"、"先看一下配置")挂在 _streamedText 上:
3555
+ // 本轮上下文里有(buildToolResultMessages 会带上),但此前存档只取 outcome.content,
3556
+ // 而工具调用轮次的 outcome 没有 content——2026-10-07 审计会话 157 条带工具调用的
3557
+ // assistant 消息正文**全部为空**:下一条用户消息时模型看不到自己之前的阶段性汇报,
3558
+ // /session show、导出、回放也全缺这部分(审计 X-01)。
3559
+ assistantContent: outcome.content ?? toolCalls._streamedText,
3511
3560
  reasoningContent: outcome.reasoningContent
3512
3561
  });
3513
3562
  host.afterToolRoundPersist?.(toolCalls, toolResults, extraMessages);
@@ -3562,6 +3611,7 @@ async function runLeanAgentLoop(opts) {
3562
3611
  let roundsUsed = 0;
3563
3612
  let toolCallCount = 0;
3564
3613
  let stalledIntentNudges = 0;
3614
+ let hallucinationRetries = 0;
3565
3615
  try {
3566
3616
  for (let round = 0; round < opts.maxRounds; round++) {
3567
3617
  roundsUsed = round + 1;
@@ -3577,6 +3627,7 @@ async function runLeanAgentLoop(opts) {
3577
3627
  timeout: opts.chatParams?.timeout,
3578
3628
  thinking: opts.chatParams?.thinking,
3579
3629
  thinkingEffort: opts.chatParams?.thinkingEffort,
3630
+ thinkingBudget: opts.chatParams?.thinkingBudget,
3580
3631
  ...extraMessages.length > 0 ? { _extraMessages: extraMessages } : {}
3581
3632
  },
3582
3633
  opts.toolDefsForRound(round)
@@ -3596,6 +3647,24 @@ async function runLeanAgentLoop(opts) {
3596
3647
  );
3597
3648
  continue;
3598
3649
  }
3650
+ const nextTools = round < opts.maxRounds - 1 ? opts.toolDefsForRound(round + 1) : [];
3651
+ const canWrite = nextTools.some((t) => t.name === "write_file" || t.name === "edit_file");
3652
+ if (canWrite && hallucinationRetries < 1 && result.content) {
3653
+ const alreadyWrote = hadPreviousWriteToolCalls(extraMessages);
3654
+ const coarse = !alreadyWrote && detectsHallucinatedFileOp(result.content) && extractBashCommands(extraMessages).length === 0;
3655
+ const phantom = coarse || alreadyWrote ? findPhantomClaims(result.content, extraMessages) : [];
3656
+ if (phantom.length > 0 || coarse) {
3657
+ hallucinationRetries++;
3658
+ extraMessages.push(
3659
+ { role: "assistant", content: result.content },
3660
+ {
3661
+ role: "user",
3662
+ content: phantom.length > 0 ? buildPhantomCorrectionMessage(phantom) : HALLUCINATION_CORRECTION_MESSAGE
3663
+ }
3664
+ );
3665
+ continue;
3666
+ }
3667
+ }
3599
3668
  content = result.content;
3600
3669
  break;
3601
3670
  }
@@ -17526,7 +17595,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
17526
17595
  Cost: ${formatCost(cost)}` : "";
17527
17596
  let memoryLine = "";
17528
17597
  try {
17529
- const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-IPNMYXU4.js");
17598
+ const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-ZIM6ICIR.js");
17530
17599
  const pending = countPendingMemories2(ctx.config.getConfigDir());
17531
17600
  if (pending > 0) memoryLine = `
17532
17601
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -18514,7 +18583,7 @@ async function handleTest(args, ctx) {
18514
18583
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
18515
18584
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
18516
18585
  }
18517
- const runTests = ctx.runTests ?? (await import("./run-tests-PDD4KUQL.js")).executeTests;
18586
+ const runTests = ctx.runTests ?? (await import("./run-tests-HCID73KE.js")).executeTests;
18518
18587
  const report = await runTests(testArgs);
18519
18588
  ctx.send({ type: "info", message: report });
18520
18589
  } catch (err) {
@@ -18905,7 +18974,7 @@ async function handleMemory(args, ctx) {
18905
18974
  }
18906
18975
  if (intent.kind === "status") {
18907
18976
  const { getChatIndexStatus: getChatIndexStatus2 } = await import("./chat-index-RLVLQRRC.js");
18908
- const { listMemoryEntries: listMemoryEntries2, isMemoryExpired: isMemoryExpired2, formatMemoryForPrompt: formatMemoryForPrompt2 } = await import("./persistent-memory-IPNMYXU4.js");
18977
+ const { listMemoryEntries: listMemoryEntries2, isMemoryExpired: isMemoryExpired2, formatMemoryForPrompt: formatMemoryForPrompt2 } = await import("./persistent-memory-ZIM6ICIR.js");
18909
18978
  const memories = listMemoryEntries2(configDir, { includeExpired: true, includeRejected: true });
18910
18979
  const injected = formatMemoryForPrompt2(configDir, process.cwd(), ctx.config.get("memory")?.maxChars);
18911
18980
  const view = buildMemoryStatusView({
@@ -18928,7 +18997,7 @@ async function handleMemory(args, ctx) {
18928
18997
  return;
18929
18998
  }
18930
18999
  if (intent.kind === "recall") {
18931
- const { searchPersistentMemories: searchPersistentMemories2, touchMemoryReferences: touchMemoryReferences2 } = await import("./persistent-memory-IPNMYXU4.js");
19000
+ const { searchPersistentMemories: searchPersistentMemories2, touchMemoryReferences: touchMemoryReferences2 } = await import("./persistent-memory-ZIM6ICIR.js");
18932
19001
  const { searchChatMemory: searchChatMemory2 } = await import("./chat-index-RLVLQRRC.js");
18933
19002
  const persistentHits = searchPersistentMemories2(configDir, intent.query, process.cwd(), 3);
18934
19003
  if (persistentHits.length > 0) {
@@ -19049,7 +19118,7 @@ async function handleMemory(args, ctx) {
19049
19118
  ctx.handleMemoryManage(intent.action, args[1], intent.action === "expire" ? args[2] : void 0);
19050
19119
  } else if (intent.kind === "export") {
19051
19120
  if (args[1] === "md") {
19052
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-IPNMYXU4.js");
19121
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-ZIM6ICIR.js");
19053
19122
  ctx.send({
19054
19123
  type: "export_data",
19055
19124
  format: "md",
@@ -20054,7 +20123,7 @@ No tools match "${filter}".
20054
20123
  const { join: join26 } = await import("path");
20055
20124
  const { existsSync: existsSync32 } = await import("fs");
20056
20125
  const { getGitRoot: getGitRoot2 } = await import("./git-context-VNCA2GU7.js");
20057
- const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-CPHZLOCQ.js");
20126
+ const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-EHYM2NS5.js");
20058
20127
  const { approveProject, hashMcpFile } = await import("./project-trust-6CJB5ZMX.js");
20059
20128
  const cwd = process.cwd();
20060
20129
  const projectRoot = getGitRoot2(cwd) ?? cwd;
@@ -20973,7 +21042,7 @@ function createReviewCommands() {
20973
21042
  usage: "/test [command|filter]",
20974
21043
  async execute(args, ctx) {
20975
21044
  try {
20976
- const { executeTests } = await import("./run-tests-PDD4KUQL.js");
21045
+ const { executeTests } = await import("./run-tests-HCID73KE.js");
20977
21046
  const argStr = args.join(" ").trim();
20978
21047
  let testArgs = {};
20979
21048
  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-544JETWF.js");
161
+ const { TaskOrchestrator } = await import("./task-orchestrator-6NRCGF5V.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,7 +24,7 @@ import {
24
24
  setupProxy,
25
25
  snapshotFile,
26
26
  stripRoutingTags
27
- } from "./chunk-2PAQOR2X.js";
27
+ } from "./chunk-QB3MECZJ.js";
28
28
  import {
29
29
  CostTracker,
30
30
  getPricing,
@@ -47,7 +47,7 @@ import {
47
47
  setMaxOutputCap,
48
48
  spawnAgentContext,
49
49
  undoStack
50
- } from "./chunk-YHMQMP2I.js";
50
+ } from "./chunk-46M65JDN.js";
51
51
  import "./chunk-HLWUDRBO.js";
52
52
  import {
53
53
  NO_THINKING,
@@ -60,7 +60,7 @@ import {
60
60
  countPendingMemories,
61
61
  detectStaleLegacyMarkdownEdit,
62
62
  formatMemoryForPrompt
63
- } from "./chunk-PGQ5OV3P.js";
63
+ } from "./chunk-WY4IWCQ5.js";
64
64
  import "./chunk-RWRZVQCB.js";
65
65
  import "./chunk-B3MPYI4E.js";
66
66
  import "./chunk-M6HLYG33.js";
@@ -81,22 +81,22 @@ import {
81
81
  import {
82
82
  loadContextFiles,
83
83
  writeCrashLog
84
- } from "./chunk-D6BLSFYD.js";
84
+ } from "./chunk-4S2XD3M2.js";
85
85
  import {
86
86
  getActivePluginAssets,
87
87
  getPendingHookTrust,
88
88
  installFlushOnExit,
89
89
  mergePluginHooks,
90
90
  runLifecycleHooks
91
- } from "./chunk-662ZJPJE.js";
91
+ } from "./chunk-5VZHSSLW.js";
92
92
  import "./chunk-RS7SKYTS.js";
93
93
  import {
94
94
  ProviderRegistry,
95
95
  listBuiltInProviderMetadata
96
- } from "./chunk-N2MHUA4B.js";
96
+ } from "./chunk-YAMPLTYO.js";
97
97
  import {
98
98
  ConfigManager
99
- } from "./chunk-KEOMNFBH.js";
99
+ } from "./chunk-DB4HVUPI.js";
100
100
  import {
101
101
  CONTENT_ONLY_STREAM_REMINDER,
102
102
  TEE_FINAL_USER_NUDGE,
@@ -114,7 +114,7 @@ import {
114
114
  runAgentLoop,
115
115
  stripToolCallReminder,
116
116
  teeStreamErrorSummary
117
- } from "./chunk-GVAAGBHX.js";
117
+ } from "./chunk-E2W2MI6H.js";
118
118
  import {
119
119
  AuthError,
120
120
  ProviderError,
@@ -134,7 +134,7 @@ import {
134
134
  isInterrupted,
135
135
  requestInterrupt,
136
136
  resetInterrupt
137
- } from "./chunk-Y3SEC5EC.js";
137
+ } from "./chunk-NOAWUEJJ.js";
138
138
  import {
139
139
  AGENTIC_BEHAVIOR_GUIDELINE,
140
140
  AUTHOR,
@@ -152,7 +152,7 @@ import {
152
152
  SKILLS_DIR_NAME,
153
153
  VERSION,
154
154
  buildUserIdentityPrompt
155
- } from "./chunk-A7YZLLWN.js";
155
+ } from "./chunk-J7IPNING.js";
156
156
  import "./chunk-SXIJLSVF.js";
157
157
 
158
158
  // src/index.ts
@@ -3697,7 +3697,7 @@ Tip: You can continue the conversation by asking the AI to proceed.`
3697
3697
  );
3698
3698
  if (verdict.kind === "reject") {
3699
3699
  cleanupRejectedTeeFile(saveToFile);
3700
- const label = verdict.reason === "meta-narration" ? "meta-narration / leaked reasoning, not document body" : verdict.reason === "empty" ? "an empty stream (no text produced)" : "pseudo-tool-call markup with no usable document body";
3700
+ const label = verdict.reason === "meta-narration" ? "meta-narration / leaked reasoning, not document body" : verdict.reason === "empty" ? "an empty stream (no text produced)" : verdict.reason === "not-a-document" ? `only an announcement ("I'll write it now\u2026"), not the document` : "pseudo-tool-call markup with no usable document body";
3701
3701
  pendingTeeSave = armDeferredSave(saveToFile);
3702
3702
  process.stdout.write(theme.warning(
3703
3703
  `
@@ -4107,7 +4107,7 @@ program.command("web").description("Start Web UI server with browser-based chat
4107
4107
  console.error("Error: Invalid port number. Must be between 1 and 65535.");
4108
4108
  process.exit(1);
4109
4109
  }
4110
- const { startWebServer } = await import("./server-XQ3IQUZ5.js");
4110
+ const { startWebServer } = await import("./server-3UEEPEUD.js");
4111
4111
  await startWebServer({ port, host: options.host, externalOrigin: options.externalOrigin });
4112
4112
  });
4113
4113
  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) => {
@@ -4274,11 +4274,11 @@ program.command("sessions").description("List recent conversation sessions").opt
4274
4274
  console.log(footer + "\n");
4275
4275
  });
4276
4276
  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) => {
4277
- const { runUsageCli } = await import("./usage-MQTA7HHZ.js");
4277
+ const { runUsageCli } = await import("./usage-6V64TTRE.js");
4278
4278
  await runUsageCli(options);
4279
4279
  });
4280
4280
  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) => {
4281
- const { runDoctorCli } = await import("./doctor-cli-L6AK2GJ7.js");
4281
+ const { runDoctorCli } = await import("./doctor-cli-2B72UMZO.js");
4282
4282
  const argv = process.argv.slice(2);
4283
4283
  await runDoctorCli({
4284
4284
  json: !!options.json || argv.includes("--json"),
@@ -4287,7 +4287,7 @@ program.command("doctor").description("Health check: API keys, config, MCP, rece
4287
4287
  });
4288
4288
  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) => {
4289
4289
  try {
4290
- const batch = await import("./batch-CQ542WJF.js");
4290
+ const batch = await import("./batch-LRYDPB6F.js");
4291
4291
  switch (action) {
4292
4292
  case "submit":
4293
4293
  if (!arg) {
@@ -4330,7 +4330,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
4330
4330
  }
4331
4331
  });
4332
4332
  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) => {
4333
- const { startMcpServer } = await import("./server-3C6IK3JE.js");
4333
+ const { startMcpServer } = await import("./server-BVTFIPB2.js");
4334
4334
  await startMcpServer({
4335
4335
  allowDestructive: !!options.allowDestructive,
4336
4336
  allowOutsideCwd: !!options.allowOutsideCwd,
@@ -4343,7 +4343,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
4343
4343
  console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
4344
4344
  process.exit(1);
4345
4345
  }
4346
- const { runPrCli } = await import("./pr-J5TSU5P6.js");
4346
+ const { runPrCli } = await import("./pr-UBGLNROK.js");
4347
4347
  const result = await runPrCli({
4348
4348
  action,
4349
4349
  target,
@@ -4363,8 +4363,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
4363
4363
  process.exit(result.exitCode);
4364
4364
  });
4365
4365
  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) => {
4366
- const { runCi } = await import("./ci-HAPWBC37.js");
4367
- const { formatCiResult } = await import("./ci-format-NGWP4GTQ.js");
4366
+ const { runCi } = await import("./ci-7TSOMDHV.js");
4367
+ const { formatCiResult } = await import("./ci-format-6A2RFYZS.js");
4368
4368
  const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
4369
4369
  if (formats > 1) {
4370
4370
  console.error("Choose only one output format: --json, --markdown, or --sarif.");
@@ -4523,7 +4523,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
4523
4523
  config.get("customProviders"),
4524
4524
  config.getConfigDir()
4525
4525
  );
4526
- const { startHub } = await import("./hub-TCZFG2ZG.js");
4526
+ const { startHub } = await import("./hub-JACLTKYY.js");
4527
4527
  await startHub(
4528
4528
  {
4529
4529
  topic: topic ?? "",
@@ -4664,6 +4664,17 @@ ${loaded.mergedContent}` : void 0
4664
4664
  const f = new ThinkTagFilter();
4665
4665
  return f.push(text) + f.flush();
4666
4666
  };
4667
+ let emptyResult = false;
4668
+ const checkEmpty = (content, usage) => {
4669
+ if (content.trim()) return;
4670
+ emptyResult = true;
4671
+ const spent = usage?.outputTokens ?? 0;
4672
+ process.stderr.write(
4673
+ `[aicli] empty response from ${providerId}/${model}` + (spent > 0 ? ` (${spent} output tokens were spent, most likely on reasoning). Try --think off, or raise modelParams.<model>.maxTokens.
4674
+ ` : `. The model returned no text.
4675
+ `)
4676
+ );
4677
+ };
4667
4678
  try {
4668
4679
  if (isStreamingJson) {
4669
4680
  const stream = provider.chatStream({
@@ -4701,6 +4712,7 @@ ${loaded.mergedContent}` : void 0
4701
4712
  if (finalUsage) doneOut["usage"] = finalUsage;
4702
4713
  recordUsage(finalUsage);
4703
4714
  process.stdout.write(JSON.stringify(doneOut) + "\n");
4715
+ checkEmpty(fullContent, finalUsage);
4704
4716
  } else if (options.json) {
4705
4717
  const response = await provider.chat({
4706
4718
  messages,
@@ -4720,6 +4732,7 @@ ${loaded.mergedContent}` : void 0
4720
4732
  };
4721
4733
  recordUsage(response.usage);
4722
4734
  process.stdout.write(JSON.stringify(out, null, 2) + "\n");
4735
+ checkEmpty(out.content, response.usage);
4723
4736
  } else if (useStream) {
4724
4737
  const stream = provider.chatStream({
4725
4738
  messages,
@@ -4733,13 +4746,19 @@ ${loaded.mergedContent}` : void 0
4733
4746
  });
4734
4747
  const textFilter = new ThinkTagFilter();
4735
4748
  let streamUsage;
4749
+ let streamedText = "";
4750
+ const emitText = (text) => {
4751
+ streamedText += text;
4752
+ process.stdout.write(text);
4753
+ };
4736
4754
  for await (const chunk of stream) {
4737
4755
  if (chunk.usage) streamUsage = chunk.usage;
4738
- if (chunk.delta) process.stdout.write(keepThinking ? chunk.delta : textFilter.push(chunk.delta));
4756
+ if (chunk.delta) emitText(keepThinking ? chunk.delta : textFilter.push(chunk.delta));
4739
4757
  }
4740
- if (!keepThinking) process.stdout.write(textFilter.flush());
4758
+ if (!keepThinking) emitText(textFilter.flush());
4741
4759
  recordUsage(streamUsage);
4742
4760
  process.stdout.write("\n");
4761
+ checkEmpty(streamedText, streamUsage);
4743
4762
  } else {
4744
4763
  const response = await provider.chat({
4745
4764
  messages,
@@ -4752,10 +4771,12 @@ ${loaded.mergedContent}` : void 0
4752
4771
  ...thinkingParams
4753
4772
  });
4754
4773
  recordUsage(response.usage);
4755
- process.stdout.write(stripThinking(response.content) + "\n");
4774
+ const text = stripThinking(response.content);
4775
+ process.stdout.write(text + "\n");
4776
+ checkEmpty(text, response.usage);
4756
4777
  }
4757
4778
  costTracker.flush();
4758
- process.exit(0);
4779
+ process.exit(emptyResult ? 2 : 0);
4759
4780
  } catch (err) {
4760
4781
  costTracker.flush();
4761
4782
  const msg = err instanceof Error ? err.message : String(err);
@@ -28,11 +28,11 @@ import {
28
28
  touchMemoryReferences,
29
29
  updateMemoryApproval,
30
30
  updateMemoryEntry
31
- } from "./chunk-PGQ5OV3P.js";
31
+ } from "./chunk-WY4IWCQ5.js";
32
32
  import "./chunk-3FEZSLGI.js";
33
33
  import "./chunk-HOSJZMQS.js";
34
34
  import "./chunk-BMLQPSHP.js";
35
- import "./chunk-A7YZLLWN.js";
35
+ import "./chunk-J7IPNING.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-GP24X3KJ.js";
30
+ } from "./chunk-WW2LFOWE.js";
31
31
  import "./chunk-FSC6KEWU.js";
32
32
  import "./chunk-2XMUCC42.js";
33
33
  import "./chunk-CGLYJRFA.js";
34
- import "./chunk-DCQDFQDW.js";
34
+ import "./chunk-SKQUWDRM.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-SZBSTSG4.js";
6
- import "./chunk-OQZIP4LU.js";
5
+ } from "./chunk-TKBWA3XJ.js";
6
+ import "./chunk-P4FJBD2H.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-N2MHUA4B.js";
17
+ } from "./chunk-YAMPLTYO.js";
18
18
  import {
19
19
  ConfigManager
20
- } from "./chunk-KEOMNFBH.js";
21
- import "./chunk-GVAAGBHX.js";
20
+ } from "./chunk-DB4HVUPI.js";
21
+ import "./chunk-E2W2MI6H.js";
22
22
  import "./chunk-TU3L3PW7.js";
23
23
  import "./chunk-BMLQPSHP.js";
24
24
  import {
25
25
  VERSION
26
- } from "./chunk-A7YZLLWN.js";
26
+ } from "./chunk-J7IPNING.js";
27
27
 
28
28
  // src/cli/pr.ts
29
29
  import { execFileSync } from "child_process";
@@ -2,9 +2,9 @@ import {
2
2
  executeTests,
3
3
  runTestProcess,
4
4
  runTestsTool
5
- } from "./chunk-AC44E4CV.js";
5
+ } from "./chunk-N6YFBRQV.js";
6
6
  import "./chunk-QMFMST2T.js";
7
- import "./chunk-DCQDFQDW.js";
7
+ import "./chunk-SKQUWDRM.js";
8
8
  export {
9
9
  executeTests,
10
10
  runTestProcess,
@@ -3,8 +3,8 @@ import {
3
3
  executeTests,
4
4
  runTestProcess,
5
5
  runTestsTool
6
- } from "./chunk-Y3SEC5EC.js";
7
- import "./chunk-A7YZLLWN.js";
6
+ } from "./chunk-NOAWUEJJ.js";
7
+ import "./chunk-J7IPNING.js";
8
8
  import "./chunk-SXIJLSVF.js";
9
9
  export {
10
10
  executeTests,