jinzd-ai-cli 0.4.273 → 0.4.276

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 (103) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +610 -610
  3. package/README.zh-CN.md +559 -559
  4. package/dist/agent-client-6GX6QQDU.js +0 -0
  5. package/dist/auth-PE3Z5OHS.js +0 -0
  6. package/dist/{batch-LOW3GM26.js → batch-F7SKIBI3.js} +2 -2
  7. package/dist/chat-index-2D5GK2DB.js +0 -0
  8. package/dist/chunk-23SJVOQD.js +0 -0
  9. package/dist/chunk-3FEZSLGI.js +0 -0
  10. package/dist/chunk-4BKXL7SM.js +0 -0
  11. package/dist/{chunk-AUEX6RNY.js → chunk-4KTK2OYU.js} +54 -21
  12. package/dist/{chunk-M3NXF4GD.js → chunk-4NH4Q7QK.js} +1 -1
  13. package/dist/chunk-5C76XDDF.js +0 -0
  14. package/dist/chunk-6YZEZFX5.js +0 -0
  15. package/dist/{chunk-FHXLAJJG.js → chunk-AOISQVXS.js} +1 -1
  16. package/dist/{chunk-FNLWPYP5.js → chunk-ATD2Y3PB.js} +1 -1
  17. package/dist/chunk-BXP6YZ2P.js +0 -0
  18. package/dist/chunk-CGDYO52A.js +0 -0
  19. package/dist/chunk-CKH4KQ4E.js +0 -0
  20. package/dist/{chunk-JT6UN5C6.js → chunk-DPTEC6AQ.js} +3 -0
  21. package/dist/{chunk-EDAUDILT.js → chunk-FLDYAXJR.js} +1 -1
  22. package/dist/chunk-GHWZVPUV.js +0 -0
  23. package/dist/chunk-GLSR2NR3.js +0 -0
  24. package/dist/chunk-HLWUDRBO.js +0 -0
  25. package/dist/chunk-HOSJZMQS.js +0 -0
  26. package/dist/chunk-IW3Q7AE5.js +0 -0
  27. package/dist/chunk-KHYD3WXE.js +0 -0
  28. package/dist/{chunk-Z3UXZ5EI.js → chunk-KWSGSSWN.js} +1 -1
  29. package/dist/{chunk-4FIDMC2K.js → chunk-MCKUGWOY.js} +69 -4
  30. package/dist/chunk-MX75TNE5.js +0 -0
  31. package/dist/{chunk-FN7DE4HA.js → chunk-MXPUOF5K.js} +4 -4
  32. package/dist/chunk-NR5U6LVG.js +0 -0
  33. package/dist/{chunk-ZWCQQZT5.js → chunk-NXAHXWPF.js} +1 -1
  34. package/dist/{chunk-R4YGDJPL.js → chunk-NXNXWM6H.js} +5 -5
  35. package/dist/chunk-NYNSYLFY.js +0 -0
  36. package/dist/{chunk-WSCZRQDR.js → chunk-OMBKLWLJ.js} +1 -1
  37. package/dist/chunk-RYQBBEMM.js +0 -0
  38. package/dist/{chunk-3OBY7WSS.js → chunk-TEXT4DAT.js} +7 -1
  39. package/dist/chunk-TU3L3PW7.js +0 -0
  40. package/dist/{chunk-LEK5WGKV.js → chunk-UNL7NR55.js} +1 -1
  41. package/dist/chunk-UUSRWSSX.js +0 -0
  42. package/dist/{chunk-T65VFCID.js → chunk-VF7DMSKF.js} +1 -1
  43. package/dist/chunk-VOIOUJXI.js +0 -0
  44. package/dist/{chunk-MTQBSOZW.js → chunk-WYDP2WEQ.js} +4 -4
  45. package/dist/chunk-XNFIYS7G.js +0 -0
  46. package/dist/{ci-C5YMQXCS.js → ci-VURFRMWQ.js} +6 -6
  47. package/dist/{ci-format-R6EMNOGZ.js → ci-format-AFJJIURF.js} +2 -2
  48. package/dist/config-command-E5DHADEV.js +0 -0
  49. package/dist/{constants-QJCNMBPJ.js → constants-WO7ERENL.js} +1 -1
  50. package/dist/{doctor-cli-5CM2I6OF.js → doctor-cli-BGGILTHE.js} +6 -6
  51. package/dist/electron-server.js +167 -57
  52. package/dist/file-checkpoint-NKBHGC7L.js +0 -0
  53. package/dist/git-context-EXOEHQSF.js +0 -0
  54. package/dist/{hub-7JBSZOSD.js → hub-Z73RLNJI.js} +1 -1
  55. package/dist/hub-server-RF6LURXY.js +0 -0
  56. package/dist/index.js +57 -43
  57. package/dist/indexer-VZETNE4H.js +0 -0
  58. package/dist/persist-PQM4BRI4.js +0 -0
  59. package/dist/{persistent-memory-4E53HW3U.js → persistent-memory-5QMARQJF.js} +2 -2
  60. package/dist/{persistent-memory-KYRY56PG.js → persistent-memory-CI544RLT.js} +2 -2
  61. package/dist/{pr-NPUGZSXB.js → pr-24REDMGV.js} +6 -6
  62. package/dist/project-trust-NKYHL3VZ.js +0 -0
  63. package/dist/{run-tests-5FHQ5IBX.js → run-tests-72VNZXNT.js} +2 -2
  64. package/dist/{run-tests-SU5CDQKF.js → run-tests-JJ3KOY5E.js} +2 -2
  65. package/dist/semantic-HLAE2O4F.js +0 -0
  66. package/dist/{server-ER36M7TR.js → server-JMXC2N3F.js} +40 -29
  67. package/dist/{server-77YS5NNN.js → server-QJHCJDA7.js} +6 -6
  68. package/dist/setup-wizard-S55ICNHH.js +0 -0
  69. package/dist/store-MWNHVGJT.js +0 -0
  70. package/dist/{task-orchestrator-56PQ7LGV.js → task-orchestrator-DJN36HP5.js} +6 -6
  71. package/dist/{usage-3YATXRFZ.js → usage-HXJVDETY.js} +3 -3
  72. package/dist/vector-store-BBDXB5IQ.js +0 -0
  73. package/dist/wasm/web-tree-sitter.wasm +0 -0
  74. package/dist/web/client/actions.js +104 -104
  75. package/dist/web/client/actions.js.br +0 -0
  76. package/dist/web/client/actions.js.gz +0 -0
  77. package/dist/web/client/api.js.gz +0 -0
  78. package/dist/web/client/app.js.gz +0 -0
  79. package/dist/web/client/dom.js.gz +0 -0
  80. package/dist/web/client/icon.svg +22 -22
  81. package/dist/web/client/icon.svg.br +0 -0
  82. package/dist/web/client/icon.svg.gz +0 -0
  83. package/dist/web/client/index.html +388 -388
  84. package/dist/web/client/index.html.br +0 -0
  85. package/dist/web/client/index.html.gz +0 -0
  86. package/dist/web/client/manifest.json +15 -15
  87. package/dist/web/client/sidebar-tabs.js.gz +0 -0
  88. package/dist/web/client/state.js.gz +0 -0
  89. package/dist/web/client/style.css +991 -991
  90. package/dist/web/client/style.css.br +0 -0
  91. package/dist/web/client/style.css.gz +0 -0
  92. package/dist/web/client/sw.js +85 -85
  93. package/dist/web/client/sw.js.br +0 -0
  94. package/dist/web/client/sw.js.gz +0 -0
  95. package/dist/web/client/templates.js.gz +0 -0
  96. package/dist/web/client/util.js.gz +0 -0
  97. package/dist/web/client/vendor/daisyui-full.min.css.gz +0 -0
  98. package/dist/web/client/vendor/github-dark.min.css.gz +0 -0
  99. package/dist/web/client/vendor/github.min.css.gz +0 -0
  100. package/dist/web/client/vendor/highlight.min.js.gz +0 -0
  101. package/dist/web/client/vendor/marked.min.js.gz +0 -0
  102. package/dist/web/client/vendor/tailwind.js.gz +0 -0
  103. package/package.json +178 -178
package/dist/index.js CHANGED
@@ -6,11 +6,13 @@ import {
6
6
  SkillManager,
7
7
  applyProfileCommand,
8
8
  applyThinkCommand,
9
+ armDeferredSave,
9
10
  autoTrimSessionIfNeeded,
10
11
  buildInitPrompt,
11
12
  buildSessionCostReport,
12
13
  clearDevState,
13
14
  costSourceNote,
15
+ decideDeferredSave,
14
16
  decideModel,
15
17
  estimateConversationTokens,
16
18
  evaluateContextPressure,
@@ -24,15 +26,16 @@ import {
24
26
  scanProject,
25
27
  sessionHasMeaningfulContent,
26
28
  setupProxy,
29
+ snapshotFile,
27
30
  stripRoutingTags
28
- } from "./chunk-4FIDMC2K.js";
31
+ } from "./chunk-MCKUGWOY.js";
29
32
  import {
30
33
  CostTracker,
31
34
  computeCost,
32
35
  formatCost,
33
36
  getPricing,
34
37
  setCostCurrency
35
- } from "./chunk-JT6UN5C6.js";
38
+ } from "./chunk-DPTEC6AQ.js";
36
39
  import {
37
40
  ToolExecutor,
38
41
  ToolRegistry,
@@ -54,7 +57,7 @@ import {
54
57
  setMaxOutputCap,
55
58
  spawnAgentContext,
56
59
  undoStack
57
- } from "./chunk-R4YGDJPL.js";
60
+ } from "./chunk-NXNXWM6H.js";
58
61
  import {
59
62
  buildReviewPrompt,
60
63
  buildSecurityReviewPrompt
@@ -95,7 +98,7 @@ import {
95
98
  touchMemoryReferences,
96
99
  updateMemoryApproval,
97
100
  updateMemoryEntry
98
- } from "./chunk-Z3UXZ5EI.js";
101
+ } from "./chunk-KWSGSSWN.js";
99
102
  import "./chunk-GLSR2NR3.js";
100
103
  import "./chunk-UUSRWSSX.js";
101
104
  import "./chunk-CKH4KQ4E.js";
@@ -119,7 +122,7 @@ import {
119
122
  formatDoctorReport,
120
123
  loadContextFiles,
121
124
  writeCrashLog
122
- } from "./chunk-MTQBSOZW.js";
125
+ } from "./chunk-WYDP2WEQ.js";
123
126
  import {
124
127
  describePlugin,
125
128
  getActivePluginAssets,
@@ -136,14 +139,14 @@ import {
136
139
  trustHook,
137
140
  trustPlugin,
138
141
  untrustHook
139
- } from "./chunk-FHXLAJJG.js";
142
+ } from "./chunk-AOISQVXS.js";
140
143
  import {
141
144
  ProviderRegistry,
142
145
  listBuiltInProviderMetadata
143
- } from "./chunk-AUEX6RNY.js";
146
+ } from "./chunk-4KTK2OYU.js";
144
147
  import {
145
148
  ConfigManager
146
- } from "./chunk-T65VFCID.js";
149
+ } from "./chunk-VF7DMSKF.js";
147
150
  import {
148
151
  CONTENT_ONLY_STREAM_REMINDER,
149
152
  TEE_FINAL_USER_NUDGE,
@@ -158,12 +161,10 @@ import {
158
161
  extractWrittenFilePaths,
159
162
  freshPriorContent,
160
163
  isAbortError,
161
- isCleanDocumentBody,
162
164
  runAgentLoop,
163
- stripOuterCodeFence,
164
165
  stripToolCallReminder,
165
166
  teeStreamErrorSummary
166
- } from "./chunk-3OBY7WSS.js";
167
+ } from "./chunk-TEXT4DAT.js";
167
168
  import {
168
169
  AuthError,
169
170
  ProviderError,
@@ -183,7 +184,7 @@ import {
183
184
  import {
184
185
  fileCheckpoints
185
186
  } from "./chunk-4BKXL7SM.js";
186
- import "./chunk-WSCZRQDR.js";
187
+ import "./chunk-OMBKLWLJ.js";
187
188
  import {
188
189
  AGENTIC_BEHAVIOR_GUIDELINE,
189
190
  AUTHOR,
@@ -201,7 +202,7 @@ import {
201
202
  SKILLS_DIR_NAME,
202
203
  VERSION,
203
204
  buildUserIdentityPrompt
204
- } from "./chunk-EDAUDILT.js";
205
+ } from "./chunk-FLDYAXJR.js";
205
206
 
206
207
  // src/index.ts
207
208
  import { program } from "commander";
@@ -1407,7 +1408,7 @@ No tools match "${filter}".
1407
1408
  const { join: join6 } = await import("path");
1408
1409
  const { existsSync: existsSync6 } = await import("fs");
1409
1410
  const { getGitRoot: getGitRoot2 } = await import("./git-context-EXOEHQSF.js");
1410
- const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-QJCNMBPJ.js");
1411
+ const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-WO7ERENL.js");
1411
1412
  const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
1412
1413
  const cwd = process.cwd();
1413
1414
  const projectRoot = getGitRoot2(cwd) ?? cwd;
@@ -2327,7 +2328,7 @@ function createReviewCommands() {
2327
2328
  usage: "/test [command|filter]",
2328
2329
  async execute(args, ctx) {
2329
2330
  try {
2330
- const { executeTests } = await import("./run-tests-SU5CDQKF.js");
2331
+ const { executeTests } = await import("./run-tests-JJ3KOY5E.js");
2331
2332
  const argStr = args.join(" ").trim();
2332
2333
  let testArgs = {};
2333
2334
  if (argStr) {
@@ -6885,26 +6886,39 @@ ${decision.displayMessage}
6885
6886
  process.stdout.write("\n\n");
6886
6887
  }
6887
6888
  lastResponseStore.content = content;
6888
- if (pendingTeeSave && isCleanDocumentBody(content)) {
6889
- try {
6890
- mkdirSync4(dirname3(pendingTeeSave), { recursive: true });
6891
- const bodyToSave = stripOuterCodeFence(content);
6892
- atomicWriteFileSync(pendingTeeSave, bodyToSave);
6893
- undoStack.push(pendingTeeSave, `save_last_response (deferred): ${pendingTeeSave}`);
6894
- const lines = bodyToSave.split("\n").length;
6895
- process.stdout.write(theme.success(
6896
- `
6897
- \u2705 Saved (from your reply): ${pendingTeeSave} (${lines} lines, ${bodyToSave.length} chars)
6889
+ if (pendingTeeSave) {
6890
+ const target = pendingTeeSave.path;
6891
+ const decision = decideDeferredSave({
6892
+ content,
6893
+ path: target,
6894
+ armedSnapshot: pendingTeeSave.armedSnapshot,
6895
+ currentSnapshot: snapshotFile(target)
6896
+ });
6897
+ if (decision.kind === "save") {
6898
+ try {
6899
+ mkdirSync4(dirname3(target), { recursive: true });
6900
+ atomicWriteFileSync(target, decision.body);
6901
+ undoStack.push(target, `save_last_response (deferred): ${target}`);
6902
+ const lines = decision.body.split("\n").length;
6903
+ process.stdout.write(theme.success(
6904
+ `
6905
+ \u2705 Saved (from your reply): ${target} (${lines} lines, ${decision.body.length} chars)
6898
6906
 
6899
6907
  `
6900
- ));
6901
- } catch (saveErr) {
6902
- process.stdout.write(theme.error(
6903
- `
6904
- \u2717 Could not save to ${pendingTeeSave}: ${saveErr.message ?? saveErr}
6908
+ ));
6909
+ } catch (saveErr) {
6910
+ process.stdout.write(theme.error(
6911
+ `
6912
+ \u2717 Could not save to ${target}: ${saveErr.message ?? saveErr}
6905
6913
 
6906
6914
  `
6907
- ));
6915
+ ));
6916
+ }
6917
+ } else {
6918
+ process.stdout.write(theme.dim(`
6919
+ ${decision.message}
6920
+
6921
+ `));
6908
6922
  }
6909
6923
  pendingTeeSave = null;
6910
6924
  }
@@ -7057,7 +7071,7 @@ Tip: You can continue the conversation by asking the AI to proceed.`
7057
7071
  // 'continue' 让模型重试
7058
7072
  runSaveLastResponseTee: async ({ toolCalls, saveToFile, extraMessages, reasoningContent }) => {
7059
7073
  spinner.stop();
7060
- if (pendingTeeSave === saveToFile) {
7074
+ if (pendingTeeSave?.path === saveToFile) {
7061
7075
  const results = toolCalls.map((tc) => ({
7062
7076
  callId: tc.id,
7063
7077
  content: tc.name === "save_last_response" ? buildDeferredSaveInstruction(saveToFile) : `[skipped: write the document as plain text, not via tools]`,
@@ -7067,7 +7081,7 @@ Tip: You can continue the conversation by asking the AI to proceed.`
7067
7081
  return "continue";
7068
7082
  }
7069
7083
  if (provider.supportsContentOnlyTee === false && !freshPriorContent(lastResponseStore.content, lastResponseAtTurnStart)) {
7070
- pendingTeeSave = saveToFile;
7084
+ pendingTeeSave = armDeferredSave(saveToFile);
7071
7085
  process.stdout.write(theme.dim(
7072
7086
  `
7073
7087
  \u21AA ${this.currentProvider} \u4E0D\u64C5\u957F content-only \u751F\u6210\uFF0C\u8DF3\u8FC7 tee\uFF0C\u6539\u7528\u666E\u901A\u6587\u672C\u5199\u62A5\u544A\uFF08\u5C06\u81EA\u52A8\u4FDD\u5B58\u5230 ${saveToFile}\uFF09
@@ -7136,7 +7150,7 @@ Tip: You can continue the conversation by asking the AI to proceed.`
7136
7150
  if (verdict.kind === "reject") {
7137
7151
  cleanupRejectedTeeFile(saveToFile);
7138
7152
  const label = verdict.reason === "meta-narration" ? "meta-narration / leaked reasoning, not document body" : "pseudo-tool-call markup with no usable document body";
7139
- pendingTeeSave = saveToFile;
7153
+ pendingTeeSave = armDeferredSave(saveToFile);
7140
7154
  process.stdout.write(theme.warning(
7141
7155
  `
7142
7156
  \u26A0 Rejected save: response was ${label} (matched: ${verdict.matched})
@@ -7546,7 +7560,7 @@ program.command("web").description("Start Web UI server with browser-based chat
7546
7560
  console.error("Error: Invalid port number. Must be between 1 and 65535.");
7547
7561
  process.exit(1);
7548
7562
  }
7549
- const { startWebServer } = await import("./server-ER36M7TR.js");
7563
+ const { startWebServer } = await import("./server-JMXC2N3F.js");
7550
7564
  await startWebServer({ port, host: options.host });
7551
7565
  });
7552
7566
  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) => {
@@ -7713,11 +7727,11 @@ program.command("sessions").description("List recent conversation sessions").opt
7713
7727
  console.log(footer + "\n");
7714
7728
  });
7715
7729
  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) => {
7716
- const { runUsageCli } = await import("./usage-3YATXRFZ.js");
7730
+ const { runUsageCli } = await import("./usage-HXJVDETY.js");
7717
7731
  await runUsageCli(options);
7718
7732
  });
7719
7733
  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) => {
7720
- const { runDoctorCli } = await import("./doctor-cli-5CM2I6OF.js");
7734
+ const { runDoctorCli } = await import("./doctor-cli-BGGILTHE.js");
7721
7735
  const argv = process.argv.slice(2);
7722
7736
  await runDoctorCli({
7723
7737
  json: !!options.json || argv.includes("--json"),
@@ -7726,7 +7740,7 @@ program.command("doctor").description("Health check: API keys, config, MCP, rece
7726
7740
  });
7727
7741
  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) => {
7728
7742
  try {
7729
- const batch = await import("./batch-LOW3GM26.js");
7743
+ const batch = await import("./batch-F7SKIBI3.js");
7730
7744
  switch (action) {
7731
7745
  case "submit":
7732
7746
  if (!arg) {
@@ -7769,7 +7783,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
7769
7783
  }
7770
7784
  });
7771
7785
  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) => {
7772
- const { startMcpServer } = await import("./server-77YS5NNN.js");
7786
+ const { startMcpServer } = await import("./server-QJHCJDA7.js");
7773
7787
  await startMcpServer({
7774
7788
  allowDestructive: !!options.allowDestructive,
7775
7789
  allowOutsideCwd: !!options.allowOutsideCwd,
@@ -7782,7 +7796,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
7782
7796
  console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
7783
7797
  process.exit(1);
7784
7798
  }
7785
- const { runPrCli } = await import("./pr-NPUGZSXB.js");
7799
+ const { runPrCli } = await import("./pr-24REDMGV.js");
7786
7800
  const result = await runPrCli({
7787
7801
  action,
7788
7802
  target,
@@ -7802,8 +7816,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
7802
7816
  process.exit(result.exitCode);
7803
7817
  });
7804
7818
  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) => {
7805
- const { runCi } = await import("./ci-C5YMQXCS.js");
7806
- const { formatCiResult } = await import("./ci-format-R6EMNOGZ.js");
7819
+ const { runCi } = await import("./ci-VURFRMWQ.js");
7820
+ const { formatCiResult } = await import("./ci-format-AFJJIURF.js");
7807
7821
  const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
7808
7822
  if (formats > 1) {
7809
7823
  console.error("Choose only one output format: --json, --markdown, or --sarif.");
@@ -7961,7 +7975,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
7961
7975
  config.get("customProviders"),
7962
7976
  config.getConfigDir()
7963
7977
  );
7964
- const { startHub } = await import("./hub-7JBSZOSD.js");
7978
+ const { startHub } = await import("./hub-Z73RLNJI.js");
7965
7979
  await startHub(
7966
7980
  {
7967
7981
  topic: topic ?? "",
File without changes
File without changes
@@ -28,11 +28,11 @@ import {
28
28
  touchMemoryReferences,
29
29
  updateMemoryApproval,
30
30
  updateMemoryEntry
31
- } from "./chunk-Z3UXZ5EI.js";
31
+ } from "./chunk-KWSGSSWN.js";
32
32
  import "./chunk-3FEZSLGI.js";
33
33
  import "./chunk-HOSJZMQS.js";
34
34
  import "./chunk-IW3Q7AE5.js";
35
- import "./chunk-EDAUDILT.js";
35
+ import "./chunk-FLDYAXJR.js";
36
36
  export {
37
37
  addMemoryEntry,
38
38
  backupMemoryStore,
@@ -27,9 +27,9 @@ import {
27
27
  touchMemoryReferences,
28
28
  updateMemoryApproval,
29
29
  updateMemoryEntry
30
- } from "./chunk-M3NXF4GD.js";
30
+ } from "./chunk-4NH4Q7QK.js";
31
31
  import "./chunk-FSC6KEWU.js";
32
- import "./chunk-LEK5WGKV.js";
32
+ import "./chunk-UNL7NR55.js";
33
33
  import "./chunk-6BUTA5VW.js";
34
34
  export {
35
35
  addMemoryEntry,
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  countSeverity,
4
4
  runCi
5
- } from "./chunk-FN7DE4HA.js";
6
- import "./chunk-ZWCQQZT5.js";
5
+ } from "./chunk-MXPUOF5K.js";
6
+ import "./chunk-NXAHXWPF.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-AUEX6RNY.js";
17
+ } from "./chunk-4KTK2OYU.js";
18
18
  import {
19
19
  ConfigManager
20
- } from "./chunk-T65VFCID.js";
21
- import "./chunk-3OBY7WSS.js";
20
+ } from "./chunk-VF7DMSKF.js";
21
+ import "./chunk-TEXT4DAT.js";
22
22
  import "./chunk-TU3L3PW7.js";
23
23
  import "./chunk-IW3Q7AE5.js";
24
24
  import {
25
25
  VERSION
26
- } from "./chunk-EDAUDILT.js";
26
+ } from "./chunk-FLDYAXJR.js";
27
27
 
28
28
  // src/cli/pr.ts
29
29
  import { execFileSync } from "child_process";
File without changes
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  executeTests,
3
3
  runTestsTool
4
- } from "./chunk-FNLWPYP5.js";
5
- import "./chunk-LEK5WGKV.js";
4
+ } from "./chunk-ATD2Y3PB.js";
5
+ import "./chunk-UNL7NR55.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-WSCZRQDR.js";
6
- import "./chunk-EDAUDILT.js";
5
+ } from "./chunk-OMBKLWLJ.js";
6
+ import "./chunk-FLDYAXJR.js";
7
7
  export {
8
8
  executeTests,
9
9
  runTestsTool
File without changes
@@ -18,10 +18,12 @@ import {
18
18
  SkillManager,
19
19
  applyProfileCommand,
20
20
  applyThinkCommand,
21
+ armDeferredSave,
21
22
  autoTrimSessionIfNeeded,
22
23
  buildInitPrompt,
23
24
  buildSessionCostReport,
24
25
  costSourceNote,
26
+ decideDeferredSave,
25
27
  decideModel,
26
28
  estimateConversationTokens,
27
29
  evaluateContextPressure,
@@ -33,8 +35,9 @@ import {
33
35
  scanDirTree,
34
36
  scanProject,
35
37
  setupProxy,
38
+ snapshotFile,
36
39
  stripRoutingTags
37
- } from "./chunk-4FIDMC2K.js";
40
+ } from "./chunk-MCKUGWOY.js";
38
41
  import {
39
42
  CNY_PER_USD,
40
43
  CostTracker,
@@ -43,7 +46,7 @@ import {
43
46
  getCostCurrency,
44
47
  getPricing,
45
48
  setCostCurrency
46
- } from "./chunk-JT6UN5C6.js";
49
+ } from "./chunk-DPTEC6AQ.js";
47
50
  import {
48
51
  ToolExecutor,
49
52
  ToolRegistry,
@@ -75,7 +78,7 @@ import {
75
78
  spawnAgentContext,
76
79
  truncateOutput,
77
80
  undoStack
78
- } from "./chunk-R4YGDJPL.js";
81
+ } from "./chunk-NXNXWM6H.js";
79
82
  import {
80
83
  buildReviewPrompt,
81
84
  buildSecurityReviewPrompt
@@ -102,7 +105,7 @@ import {
102
105
  restoreMemoryEntries,
103
106
  updateMemoryApproval,
104
107
  updateMemoryEntry
105
- } from "./chunk-Z3UXZ5EI.js";
108
+ } from "./chunk-KWSGSSWN.js";
106
109
  import "./chunk-GLSR2NR3.js";
107
110
  import "./chunk-UUSRWSSX.js";
108
111
  import "./chunk-CKH4KQ4E.js";
@@ -121,7 +124,7 @@ import {
121
124
  buildDoctorReport,
122
125
  formatDoctorReport,
123
126
  loadContextFiles
124
- } from "./chunk-MTQBSOZW.js";
127
+ } from "./chunk-WYDP2WEQ.js";
125
128
  import {
126
129
  describePlugin,
127
130
  getActivePluginAssets,
@@ -136,13 +139,13 @@ import {
136
139
  runTool,
137
140
  setPluginEnabled,
138
141
  trustPlugin
139
- } from "./chunk-FHXLAJJG.js";
142
+ } from "./chunk-AOISQVXS.js";
140
143
  import {
141
144
  ProviderRegistry
142
- } from "./chunk-AUEX6RNY.js";
145
+ } from "./chunk-4KTK2OYU.js";
143
146
  import {
144
147
  ConfigManager
145
- } from "./chunk-T65VFCID.js";
148
+ } from "./chunk-VF7DMSKF.js";
146
149
  import {
147
150
  CONTENT_ONLY_STREAM_REMINDER,
148
151
  TEE_FINAL_USER_NUDGE,
@@ -154,12 +157,10 @@ import {
154
157
  evaluateTeeContent,
155
158
  freshPriorContent,
156
159
  getDangerLevel,
157
- isCleanDocumentBody,
158
160
  runAgentLoop,
159
- stripOuterCodeFence,
160
161
  stripToolCallReminder,
161
162
  teeStreamErrorSummary
162
- } from "./chunk-3OBY7WSS.js";
163
+ } from "./chunk-TEXT4DAT.js";
163
164
  import "./chunk-TU3L3PW7.js";
164
165
  import {
165
166
  formatGitContextForPrompt,
@@ -174,7 +175,7 @@ import {
174
175
  maskConfigSecrets
175
176
  } from "./chunk-XNFIYS7G.js";
176
177
  import "./chunk-4BKXL7SM.js";
177
- import "./chunk-WSCZRQDR.js";
178
+ import "./chunk-OMBKLWLJ.js";
178
179
  import {
179
180
  AGENTIC_BEHAVIOR_GUIDELINE,
180
181
  AUTHOR,
@@ -190,7 +191,7 @@ import {
190
191
  SKILLS_DIR_NAME,
191
192
  VERSION,
192
193
  buildUserIdentityPrompt
193
- } from "./chunk-EDAUDILT.js";
194
+ } from "./chunk-FLDYAXJR.js";
194
195
 
195
196
  // src/web/server.ts
196
197
  import express from "express";
@@ -861,7 +862,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
861
862
  Cost: ${formatCost(cost)}` : "";
862
863
  let memoryLine = "";
863
864
  try {
864
- const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-4E53HW3U.js");
865
+ const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-5QMARQJF.js");
865
866
  const pending = countPendingMemories2(ctx.config.getConfigDir());
866
867
  if (pending > 0) memoryLine = `
867
868
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -1674,7 +1675,7 @@ async function handleTest(args, ctx) {
1674
1675
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
1675
1676
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
1676
1677
  }
1677
- const runTests = ctx.runTests ?? (await import("./run-tests-SU5CDQKF.js")).executeTests;
1678
+ const runTests = ctx.runTests ?? (await import("./run-tests-JJ3KOY5E.js")).executeTests;
1678
1679
  const report = await runTests(testArgs);
1679
1680
  ctx.send({ type: "info", message: report });
1680
1681
  } catch (err) {
@@ -2010,7 +2011,7 @@ async function handleMemory(args, ctx) {
2010
2011
  ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
2011
2012
  } else if (sub === "export") {
2012
2013
  if (args[1] === "md") {
2013
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-4E53HW3U.js");
2014
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-5QMARQJF.js");
2014
2015
  ctx.send({
2015
2016
  type: "export_data",
2016
2017
  format: "md",
@@ -3200,16 +3201,26 @@ Try: /compact to reduce context, /clear to reset, or switch to a larger-context
3200
3201
  },
3201
3202
  onFinalContent: (content, { reasoningContent }) => {
3202
3203
  this.send({ type: "response_done", content, usage });
3203
- if (pendingTeeSave && isCleanDocumentBody(content)) {
3204
- try {
3205
- mkdirSync2(dirname2(pendingTeeSave), { recursive: true });
3206
- const bodyToSave = stripOuterCodeFence(content);
3207
- atomicWriteFileSync(pendingTeeSave, bodyToSave);
3208
- undoStack.push(pendingTeeSave, `save_last_response (deferred): ${pendingTeeSave}`);
3209
- const lines = bodyToSave.split("\n").length;
3210
- this.send({ type: "info", message: `\u2705 Saved (from reply): ${pendingTeeSave} (${lines} lines, ${bodyToSave.length} chars)` });
3211
- } catch (saveErr) {
3212
- this.send({ type: "info", message: `\u2717 Could not save to ${pendingTeeSave}: ${saveErr.message ?? saveErr}` });
3204
+ if (pendingTeeSave) {
3205
+ const target = pendingTeeSave.path;
3206
+ const decision = decideDeferredSave({
3207
+ content,
3208
+ path: target,
3209
+ armedSnapshot: pendingTeeSave.armedSnapshot,
3210
+ currentSnapshot: snapshotFile(target)
3211
+ });
3212
+ if (decision.kind === "save") {
3213
+ try {
3214
+ mkdirSync2(dirname2(target), { recursive: true });
3215
+ atomicWriteFileSync(target, decision.body);
3216
+ undoStack.push(target, `save_last_response (deferred): ${target}`);
3217
+ const lines = decision.body.split("\n").length;
3218
+ this.send({ type: "info", message: `\u2705 Saved (from reply): ${target} (${lines} lines, ${decision.body.length} chars)` });
3219
+ } catch (saveErr) {
3220
+ this.send({ type: "info", message: `\u2717 Could not save to ${target}: ${saveErr.message ?? saveErr}` });
3221
+ }
3222
+ } else {
3223
+ this.send({ type: "info", message: decision.message });
3213
3224
  }
3214
3225
  pendingTeeSave = null;
3215
3226
  }
@@ -3270,7 +3281,7 @@ ${summaryContent}`,
3270
3281
  // 与 REPL 不同:Web 端 tee 成功后继续 agentic 循环(返回 'continue'),
3271
3282
  // 让模型基于工具结果给出最终文本。
3272
3283
  runSaveLastResponseTee: async ({ toolCalls, call, saveToFile, extraMessages, reasoningContent }) => {
3273
- if (pendingTeeSave === saveToFile) {
3284
+ if (pendingTeeSave?.path === saveToFile) {
3274
3285
  const results = toolCalls.map((tc) => ({
3275
3286
  callId: tc.id,
3276
3287
  content: tc.id === call.id ? buildDeferredSaveInstruction(saveToFile) : "[skipped: write the document as plain text, not via tools]",
@@ -3281,7 +3292,7 @@ ${summaryContent}`,
3281
3292
  }
3282
3293
  const freshPrior = freshPriorContent(lastAssistantText(apiMessages), lastAssistantAtTurnStart);
3283
3294
  if (provider.supportsContentOnlyTee === false && !freshPrior) {
3284
- pendingTeeSave = saveToFile;
3295
+ pendingTeeSave = armDeferredSave(saveToFile);
3285
3296
  this.send({ type: "info", message: `\u21AA \u8DF3\u8FC7 tee\uFF08${this.currentProvider} \u4E0D\u64C5\u957F content-only \u751F\u6210\uFF09\uFF0C\u6539\u7528\u666E\u901A\u6587\u672C\u5199\u62A5\u544A\uFF0C\u5C06\u81EA\u52A8\u4FDD\u5B58\u5230 ${saveToFile}` });
3286
3297
  const results = toolCalls.map((tc) => ({
3287
3298
  callId: tc.id,
@@ -3304,7 +3315,7 @@ ${summaryContent}`,
3304
3315
  usage,
3305
3316
  freshPrior
3306
3317
  );
3307
- if (teeResult.deferred) pendingTeeSave = saveToFile;
3318
+ if (teeResult.deferred) pendingTeeSave = armDeferredSave(saveToFile);
3308
3319
  const teeToolResults = toolCalls.map((tc) => {
3309
3320
  if (tc.id === call.id) {
3310
3321
  return {
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ToolRegistry
4
- } from "./chunk-R4YGDJPL.js";
4
+ } from "./chunk-NXNXWM6H.js";
5
5
  import "./chunk-GHWZVPUV.js";
6
- import "./chunk-Z3UXZ5EI.js";
6
+ import "./chunk-KWSGSSWN.js";
7
7
  import "./chunk-GLSR2NR3.js";
8
8
  import "./chunk-UUSRWSSX.js";
9
9
  import "./chunk-CKH4KQ4E.js";
@@ -14,19 +14,19 @@ import "./chunk-NYNSYLFY.js";
14
14
  import "./chunk-3FEZSLGI.js";
15
15
  import {
16
16
  runTool
17
- } from "./chunk-FHXLAJJG.js";
17
+ } from "./chunk-AOISQVXS.js";
18
18
  import {
19
19
  getDangerLevel,
20
20
  schemaToJsonSchema
21
- } from "./chunk-3OBY7WSS.js";
21
+ } from "./chunk-TEXT4DAT.js";
22
22
  import "./chunk-TU3L3PW7.js";
23
23
  import "./chunk-HOSJZMQS.js";
24
24
  import "./chunk-IW3Q7AE5.js";
25
25
  import "./chunk-4BKXL7SM.js";
26
- import "./chunk-WSCZRQDR.js";
26
+ import "./chunk-OMBKLWLJ.js";
27
27
  import {
28
28
  VERSION
29
- } from "./chunk-EDAUDILT.js";
29
+ } from "./chunk-FLDYAXJR.js";
30
30
 
31
31
  // src/mcp/server.ts
32
32
  import { createInterface } from "readline";
File without changes
File without changes
@@ -3,9 +3,9 @@ import {
3
3
  ToolRegistry,
4
4
  googleSearchContext,
5
5
  truncateOutput
6
- } from "./chunk-R4YGDJPL.js";
6
+ } from "./chunk-NXNXWM6H.js";
7
7
  import "./chunk-GHWZVPUV.js";
8
- import "./chunk-Z3UXZ5EI.js";
8
+ import "./chunk-KWSGSSWN.js";
9
9
  import "./chunk-GLSR2NR3.js";
10
10
  import "./chunk-UUSRWSSX.js";
11
11
  import "./chunk-CKH4KQ4E.js";
@@ -16,21 +16,21 @@ import "./chunk-NYNSYLFY.js";
16
16
  import "./chunk-3FEZSLGI.js";
17
17
  import {
18
18
  runTool
19
- } from "./chunk-FHXLAJJG.js";
19
+ } from "./chunk-AOISQVXS.js";
20
20
  import {
21
21
  getDangerLevel,
22
22
  runLeanAgentLoop
23
- } from "./chunk-3OBY7WSS.js";
23
+ } from "./chunk-TEXT4DAT.js";
24
24
  import "./chunk-TU3L3PW7.js";
25
25
  import "./chunk-HOSJZMQS.js";
26
26
  import {
27
27
  atomicWriteFileSync
28
28
  } from "./chunk-IW3Q7AE5.js";
29
29
  import "./chunk-4BKXL7SM.js";
30
- import "./chunk-WSCZRQDR.js";
30
+ import "./chunk-OMBKLWLJ.js";
31
31
  import {
32
32
  SUBAGENT_ALLOWED_TOOLS
33
- } from "./chunk-EDAUDILT.js";
33
+ } from "./chunk-FLDYAXJR.js";
34
34
 
35
35
  // src/hub/task-orchestrator.ts
36
36
  import { createInterface } from "readline";
@@ -5,13 +5,13 @@ import {
5
5
  formatCost,
6
6
  getPricing,
7
7
  setCostCurrency
8
- } from "./chunk-JT6UN5C6.js";
8
+ } from "./chunk-DPTEC6AQ.js";
9
9
  import {
10
10
  ConfigManager
11
- } from "./chunk-T65VFCID.js";
11
+ } from "./chunk-VF7DMSKF.js";
12
12
  import "./chunk-TU3L3PW7.js";
13
13
  import "./chunk-IW3Q7AE5.js";
14
- import "./chunk-EDAUDILT.js";
14
+ import "./chunk-FLDYAXJR.js";
15
15
 
16
16
  // src/cli/usage.ts
17
17
  function classifyRowCost(row) {