jinzd-ai-cli 0.4.286 → 0.4.287

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 (33) hide show
  1. package/dist/{batch-GY3I53DE.js → batch-6OH7D5YU.js} +2 -2
  2. package/dist/{chunk-L4FDTQ42.js → chunk-3BHJKMPQ.js} +1 -1
  3. package/dist/{chunk-2YDLBM3Z.js → chunk-3Y5BCGD2.js} +1 -1
  4. package/dist/{chunk-7G7RZHJI.js → chunk-5F7BGV72.js} +1 -1
  5. package/dist/{chunk-UGY5SVNX.js → chunk-ALSSNFNK.js} +94 -4
  6. package/dist/{chunk-BRLLV3FX.js → chunk-AXSWLNCU.js} +4 -4
  7. package/dist/{chunk-GIJL4EFA.js → chunk-CYUAHF6X.js} +1 -1
  8. package/dist/{chunk-UKITSNSH.js → chunk-ERDFOXYK.js} +1 -1
  9. package/dist/{chunk-6SCELZG6.js → chunk-EU6NMK7G.js} +4 -4
  10. package/dist/{chunk-EYUCJBGS.js → chunk-HEUB5PV6.js} +1 -1
  11. package/dist/{chunk-53V3RQY5.js → chunk-HNUT4STJ.js} +7 -7
  12. package/dist/{chunk-D7HYLMCC.js → chunk-L625B2XV.js} +1 -1
  13. package/dist/{chunk-S7ABWTDV.js → chunk-L7RAEUUN.js} +1 -1
  14. package/dist/{chunk-3ZQZO5F7.js → chunk-RZVGR3KD.js} +4 -4
  15. package/dist/{chunk-THUXZNJL.js → chunk-UDFK5Q52.js} +1 -1
  16. package/dist/{ci-JBUIVM7P.js → ci-WXCMI4ND.js} +5 -5
  17. package/dist/{ci-format-B4AHV5SI.js → ci-format-JXD2BQM6.js} +2 -2
  18. package/dist/{constants-5FYUQLKN.js → constants-2B7CN2ER.js} +1 -1
  19. package/dist/{constants-P75MLFV7.js → constants-SRRV3K5Y.js} +1 -1
  20. package/dist/{doctor-cli-VLFE46PX.js → doctor-cli-LQYTDJ74.js} +5 -5
  21. package/dist/electron-server.js +104 -14
  22. package/dist/{hub-CNORVRYW.js → hub-Y62P5MIA.js} +1 -1
  23. package/dist/index.js +18 -18
  24. package/dist/{persistent-memory-3KL4N27E.js → persistent-memory-3N2XQKJK.js} +2 -2
  25. package/dist/{persistent-memory-LVX2OT4L.js → persistent-memory-46JSUEYV.js} +2 -2
  26. package/dist/{pr-2YUV4KII.js → pr-L7Y3XHGL.js} +5 -5
  27. package/dist/{run-tests-ERD6X534.js → run-tests-3ZOMRFIX.js} +2 -2
  28. package/dist/{run-tests-KZ2IUZHK.js → run-tests-WC644BHH.js} +2 -2
  29. package/dist/{server-7VSLW446.js → server-L4QHJT2I.js} +5 -5
  30. package/dist/{server-A3OX52UC.js → server-XWURZCAF.js} +14 -14
  31. package/dist/{task-orchestrator-XAMKOFUE.js → task-orchestrator-6TVKJYKC.js} +5 -5
  32. package/dist/{usage-ZXNYCAZB.js → usage-L2PSI2KH.js} +2 -2
  33. package/package.json +1 -1
@@ -4,12 +4,12 @@ import {
4
4
  } from "./chunk-RS7SKYTS.js";
5
5
  import {
6
6
  ConfigManager
7
- } from "./chunk-7G7RZHJI.js";
7
+ } from "./chunk-5F7BGV72.js";
8
8
  import "./chunk-TU3L3PW7.js";
9
9
  import {
10
10
  atomicWriteFileSync
11
11
  } from "./chunk-IW3Q7AE5.js";
12
- import "./chunk-THUXZNJL.js";
12
+ import "./chunk-UDFK5Q52.js";
13
13
 
14
14
  // src/cli/batch.ts
15
15
  import Anthropic from "@anthropic-ai/sdk";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TEST_TIMEOUT
3
- } from "./chunk-GIJL4EFA.js";
3
+ } from "./chunk-CYUAHF6X.js";
4
4
 
5
5
  // src/tools/builtin/run-tests.ts
6
6
  import { execSync, spawnSync } from "child_process";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-THUXZNJL.js";
4
+ } from "./chunk-UDFK5Q52.js";
5
5
 
6
6
  // src/cli/ci-format.ts
7
7
  var DEFAULT_CI_THRESHOLDS = {
@@ -11,7 +11,7 @@ import {
11
11
  CONFIG_FILE_NAME,
12
12
  HISTORY_DIR_NAME,
13
13
  PLUGINS_DIR_NAME
14
- } from "./chunk-THUXZNJL.js";
14
+ } from "./chunk-UDFK5Q52.js";
15
15
 
16
16
  // src/config/config-manager.ts
17
17
  import { readFileSync, existsSync, mkdirSync } from "fs";
@@ -53,9 +53,76 @@ var BaseProvider = class {
53
53
  }
54
54
  };
55
55
 
56
+ // src/core/network-error.ts
57
+ var NETWORK_CODES = /* @__PURE__ */ new Set([
58
+ "ECONNREFUSED",
59
+ // 端口没人听(代理没起来最常见)
60
+ "ECONNRESET",
61
+ // 对端断开
62
+ "ENOTFOUND",
63
+ // DNS 查不到
64
+ "EAI_AGAIN",
65
+ // DNS 临时失败
66
+ "ETIMEDOUT",
67
+ // 连接超时
68
+ "EHOSTUNREACH",
69
+ "ENETUNREACH",
70
+ "EPIPE",
71
+ "UND_ERR_SOCKET",
72
+ // undici:socket 意外关闭
73
+ "UND_ERR_CONNECT_TIMEOUT"
74
+ ]);
75
+ var TRANSIENT_CODES = /* @__PURE__ */ new Set(["ECONNRESET", "UND_ERR_SOCKET", "EPIPE", "EAI_AGAIN"]);
76
+ function findCause(err, depth = 0) {
77
+ if (!err || depth > 4) return null;
78
+ const e = err;
79
+ if (typeof e.code === "string") {
80
+ return {
81
+ code: e.code,
82
+ address: e.address ? `${e.address}${e.port !== void 0 ? `:${e.port}` : ""}` : void 0,
83
+ message: e.message
84
+ };
85
+ }
86
+ if (Array.isArray(e.errors) && e.errors.length > 0) {
87
+ for (const inner of e.errors) {
88
+ const found = findCause(inner, depth + 1);
89
+ if (found) return found;
90
+ }
91
+ }
92
+ return findCause(e.cause, depth + 1);
93
+ }
94
+ function describeNetworkFailure(err, ctx = {}) {
95
+ const cause = findCause(err);
96
+ const topMessage = err instanceof Error ? err.message : String(err);
97
+ const looksNetwork = cause?.code && NETWORK_CODES.has(cause.code) || topMessage === "fetch failed" || topMessage.includes("Connection error");
98
+ if (!looksNetwork) return null;
99
+ const code = cause?.code;
100
+ const address = cause?.address;
101
+ const transient = !!code && TRANSIENT_CODES.has(code);
102
+ const what = code ? `${code}${address ? ` ${address}` : ""}` : cause?.message ?? "no further detail from the network layer";
103
+ const where = ctx.target ? ` while connecting to ${ctx.target}` : "";
104
+ const parts = [`Connection failed${where} (${what}).`];
105
+ if (ctx.proxyUrl) {
106
+ parts.push(`The request went through the proxy from config.proxy (${ctx.proxyUrl}).`);
107
+ if (code === "ECONNREFUSED") {
108
+ parts.push(`That address refused the connection \u2014 the proxy is probably not running. Start it, or unset config.proxy to connect directly.`);
109
+ }
110
+ }
111
+ if (transient) {
112
+ parts.push(`This usually means an idle connection was dropped by the other side \u2014 just send the message again.`);
113
+ } else if (code === "ENOTFOUND" || code === "EAI_AGAIN") {
114
+ parts.push(`DNS lookup failed \u2014 check the network connection${ctx.proxyUrl ? " and the proxy" : ""}.`);
115
+ } else if (code === "ETIMEDOUT" || code === "UND_ERR_CONNECT_TIMEOUT") {
116
+ parts.push(`The connection timed out before it was established${ctx.proxyUrl ? " \u2014 check whether the proxy can reach this host" : ""}.`);
117
+ }
118
+ return { code, address, transient, message: parts.join(" ") };
119
+ }
120
+
56
121
  // src/providers/claude.ts
57
122
  var CACHE_MIN_SYSTEM_CHARS = 2e3;
58
123
  var ClaudeProvider = class extends BaseProvider {
124
+ /** 生效的代理(网络失败时点名它,见 core/network-error.ts)。 */
125
+ activeProxyUrl;
59
126
  client;
60
127
  info = {
61
128
  id: "claude",
@@ -90,6 +157,7 @@ var ClaudeProvider = class extends BaseProvider {
90
157
  baseURL: options?.baseUrl
91
158
  };
92
159
  const proxyUrl = options?.proxy;
160
+ this.activeProxyUrl = proxyUrl;
93
161
  try {
94
162
  const { Agent, ProxyAgent, fetch: undiciFetch } = await import("undici");
95
163
  const STREAM_BODY_TIMEOUT = 30 * 60 * 1e3;
@@ -614,6 +682,8 @@ var ClaudeProvider = class extends BaseProvider {
614
682
  if (err instanceof Anthropic.RateLimitError) {
615
683
  return new RateLimitError("claude");
616
684
  }
685
+ const net = describeNetworkFailure(err, { target: "api.anthropic.com", proxyUrl: this.activeProxyUrl });
686
+ if (net) return new ProviderError("claude", net.message, err instanceof Error ? err : void 0);
617
687
  if (err instanceof Error) {
618
688
  return new ProviderError("claude", err.message, err);
619
689
  }
@@ -930,10 +1000,11 @@ var GeminiProvider = class extends BaseProvider {
930
1000
  err
931
1001
  );
932
1002
  }
933
- if (msg.includes("fetch failed") || msg.includes("ECONNREFUSED") || msg.includes("ETIMEDOUT") || msg.includes("ENOTFOUND") || msg.includes("socket hang up")) {
1003
+ const net = describeNetworkFailure(err, { target: "generativelanguage.googleapis.com" });
1004
+ if (net || msg.includes("socket hang up")) {
934
1005
  return new ProviderError(
935
1006
  "gemini",
936
- `Network connection failed: ${msg}
1007
+ `${net?.message ?? `Network connection failed: ${msg}`}
937
1008
  Node.js does not automatically use system proxies. Try one of the following:
938
1009
  1. Set environment variable: set HTTPS_PROXY=http://127.0.0.1:<proxy-port>
939
1010
  2. Configure an accessible Gemini API mirror URL in config.json under customBaseUrls.gemini`,
@@ -1002,6 +1073,8 @@ function readRetryCount(headers) {
1002
1073
  }
1003
1074
  var OpenAICompatibleProvider = class extends BaseProvider {
1004
1075
  client;
1076
+ /** 生效的代理(wrapError 要在网络失败时点名它);未配代理时为 undefined。 */
1077
+ activeProxyUrl;
1005
1078
  defaultTimeout = 6e4;
1006
1079
  // ms
1007
1080
  /**
@@ -1031,13 +1104,17 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1031
1104
  const { Agent, ProxyAgent, fetch: undiciFetch } = await import("undici");
1032
1105
  const STREAM_BODY_TIMEOUT = 30 * 60 * 1e3;
1033
1106
  const STREAM_HEADERS_TIMEOUT = 5 * 60 * 1e3;
1107
+ const KEEP_ALIVE_TIMEOUT = 2e3;
1108
+ this.activeProxyUrl = proxyUrl;
1034
1109
  const dispatcher = proxyUrl ? new ProxyAgent({
1035
1110
  uri: proxyUrl,
1036
1111
  bodyTimeout: STREAM_BODY_TIMEOUT,
1037
- headersTimeout: STREAM_HEADERS_TIMEOUT
1112
+ headersTimeout: STREAM_HEADERS_TIMEOUT,
1113
+ keepAliveTimeout: KEEP_ALIVE_TIMEOUT
1038
1114
  }) : new Agent({
1039
1115
  bodyTimeout: STREAM_BODY_TIMEOUT,
1040
- headersTimeout: STREAM_HEADERS_TIMEOUT
1116
+ headersTimeout: STREAM_HEADERS_TIMEOUT,
1117
+ keepAliveTimeout: KEEP_ALIVE_TIMEOUT
1041
1118
  });
1042
1119
  clientOptions.fetch = ((url, init) => {
1043
1120
  const retryCount = readRetryCount(init?.headers);
@@ -1511,11 +1588,24 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1511
1588
  if (err instanceof OpenAI.RateLimitError) {
1512
1589
  return new RateLimitError(this.info.id);
1513
1590
  }
1591
+ const net = describeNetworkFailure(err, {
1592
+ target: this.hostLabel(),
1593
+ proxyUrl: this.activeProxyUrl
1594
+ });
1595
+ if (net) return new ProviderError(this.info.id, net.message, err instanceof Error ? err : void 0);
1514
1596
  if (err instanceof Error) {
1515
1597
  return new ProviderError(this.info.id, err.message, err);
1516
1598
  }
1517
1599
  return new ProviderError(this.info.id, String(err));
1518
1600
  }
1601
+ /** 请求实际打向的主机,用于「连谁失败了」。 */
1602
+ hostLabel() {
1603
+ try {
1604
+ return new URL(this.info.baseUrl ?? this.defaultBaseUrl).host;
1605
+ } catch {
1606
+ return this.info.id;
1607
+ }
1608
+ }
1519
1609
  };
1520
1610
 
1521
1611
  // src/providers/deepseek.ts
@@ -11,7 +11,7 @@ import {
11
11
  searchPersistentMemories,
12
12
  touchMemoryReferences,
13
13
  updateMemoryEntry
14
- } from "./chunk-UKITSNSH.js";
14
+ } from "./chunk-ERDFOXYK.js";
15
15
  import {
16
16
  indexProject
17
17
  } from "./chunk-4DEMGCK4.js";
@@ -30,7 +30,7 @@ import {
30
30
  runHook,
31
31
  runLifecycleHooks,
32
32
  runTool
33
- } from "./chunk-EYUCJBGS.js";
33
+ } from "./chunk-HEUB5PV6.js";
34
34
  import {
35
35
  buildTruncatedArgumentsError,
36
36
  getDangerLevel,
@@ -50,14 +50,14 @@ import {
50
50
  } from "./chunk-4BKXL7SM.js";
51
51
  import {
52
52
  runTestsTool
53
- } from "./chunk-S7ABWTDV.js";
53
+ } from "./chunk-L7RAEUUN.js";
54
54
  import {
55
55
  CONFIG_DIR_NAME,
56
56
  DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
57
57
  SUBAGENT_ALLOWED_TOOLS,
58
58
  SUBAGENT_DEFAULT_MAX_ROUNDS,
59
59
  SUBAGENT_MAX_ROUNDS_LIMIT
60
- } from "./chunk-THUXZNJL.js";
60
+ } from "./chunk-UDFK5Q52.js";
61
61
 
62
62
  // src/tools/shell-pool.ts
63
63
  import { spawn as spawn2 } from "child_process";
@@ -1,5 +1,5 @@
1
1
  // src/core/constants.ts
2
- var VERSION = "0.4.286";
2
+ var VERSION = "0.4.287";
3
3
  var APP_NAME = "ai-cli";
4
4
  var CONFIG_DIR_NAME = ".aicli";
5
5
  var CONFIG_FILE_NAME = "config.json";
@@ -13,7 +13,7 @@ import {
13
13
  MEMORY_FILE_NAME,
14
14
  MEMORY_MAX_CHARS,
15
15
  MEMORY_STORE_FILE_NAME
16
- } from "./chunk-THUXZNJL.js";
16
+ } from "./chunk-UDFK5Q52.js";
17
17
 
18
18
  // src/memory/persistent-memory.ts
19
19
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -8,13 +8,13 @@ import {
8
8
  listHooks,
9
9
  listInstalledPlugins,
10
10
  resetStats
11
- } from "./chunk-EYUCJBGS.js";
11
+ } from "./chunk-HEUB5PV6.js";
12
12
  import {
13
13
  ProviderRegistry
14
- } from "./chunk-UGY5SVNX.js";
14
+ } from "./chunk-ALSSNFNK.js";
15
15
  import {
16
16
  ConfigManager
17
- } from "./chunk-7G7RZHJI.js";
17
+ } from "./chunk-5F7BGV72.js";
18
18
  import {
19
19
  getGitRoot
20
20
  } from "./chunk-HOSJZMQS.js";
@@ -26,7 +26,7 @@ import {
26
26
  MCP_PROJECT_CONFIG_NAME,
27
27
  MEMORY_FILE_NAME,
28
28
  VERSION
29
- } from "./chunk-THUXZNJL.js";
29
+ } from "./chunk-UDFK5Q52.js";
30
30
 
31
31
  // src/diagnostics/doctor-report.ts
32
32
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  CONFIG_DIR_NAME,
10
10
  PLUGINS_DIR_NAME
11
- } from "./chunk-THUXZNJL.js";
11
+ } from "./chunk-UDFK5Q52.js";
12
12
 
13
13
  // src/diagnostics/tool-stats.ts
14
14
  import { mkdirSync } from "fs";
@@ -16,7 +16,7 @@ import {
16
16
  setPreferredAgentName,
17
17
  truncateForPersist,
18
18
  undoStack
19
- } from "./chunk-BRLLV3FX.js";
19
+ } from "./chunk-AXSWLNCU.js";
20
20
  import {
21
21
  buildReviewPrompt,
22
22
  buildSecurityReviewPrompt
@@ -51,7 +51,7 @@ import {
51
51
  touchMemoryReferences,
52
52
  updateMemoryApproval,
53
53
  updateMemoryEntry
54
- } from "./chunk-UKITSNSH.js";
54
+ } from "./chunk-ERDFOXYK.js";
55
55
  import {
56
56
  theme
57
57
  } from "./chunk-5C76XDDF.js";
@@ -65,7 +65,7 @@ import {
65
65
  import {
66
66
  buildDoctorReport,
67
67
  formatDoctorReport
68
- } from "./chunk-6SCELZG6.js";
68
+ } from "./chunk-EU6NMK7G.js";
69
69
  import {
70
70
  describePlugin,
71
71
  getActivePluginAssets,
@@ -80,7 +80,7 @@ import {
80
80
  trustHook,
81
81
  trustPlugin,
82
82
  untrustHook
83
- } from "./chunk-EYUCJBGS.js";
83
+ } from "./chunk-HEUB5PV6.js";
84
84
  import {
85
85
  isCleanDocumentBody,
86
86
  stripOuterCodeFence
@@ -109,7 +109,7 @@ import {
109
109
  MCP_TOOL_PREFIX,
110
110
  REPO_URL,
111
111
  VERSION
112
- } from "./chunk-THUXZNJL.js";
112
+ } from "./chunk-UDFK5Q52.js";
113
113
 
114
114
  // src/mcp/client.ts
115
115
  import { spawn } from "child_process";
@@ -2393,7 +2393,7 @@ No tools match "${filter}".
2393
2393
  const { join: join6 } = await import("path");
2394
2394
  const { existsSync: existsSync6 } = await import("fs");
2395
2395
  const { getGitRoot } = await import("./git-context-EXOEHQSF.js");
2396
- const { MCP_PROJECT_CONFIG_NAME } = await import("./constants-5FYUQLKN.js");
2396
+ const { MCP_PROJECT_CONFIG_NAME } = await import("./constants-2B7CN2ER.js");
2397
2397
  const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
2398
2398
  const cwd = process.cwd();
2399
2399
  const projectRoot = getGitRoot(cwd) ?? cwd;
@@ -3497,7 +3497,7 @@ function createReviewCommands() {
3497
3497
  usage: "/test [command|filter]",
3498
3498
  async execute(args, ctx) {
3499
3499
  try {
3500
- const { executeTests } = await import("./run-tests-KZ2IUZHK.js");
3500
+ const { executeTests } = await import("./run-tests-WC644BHH.js");
3501
3501
  const argStr = args.join(" ").trim();
3502
3502
  let testArgs = {};
3503
3503
  if (argStr) {
@@ -12,7 +12,7 @@ import {
12
12
  MEMORY_FILE_NAME,
13
13
  MEMORY_MAX_CHARS,
14
14
  MEMORY_STORE_FILE_NAME
15
- } from "./chunk-GIJL4EFA.js";
15
+ } from "./chunk-CYUAHF6X.js";
16
16
 
17
17
  // src/memory/persistent-memory.ts
18
18
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-THUXZNJL.js";
4
+ } from "./chunk-UDFK5Q52.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync, spawnSync } from "child_process";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  evaluateCiGate,
4
4
  normalizeCiThresholds
5
- } from "./chunk-2YDLBM3Z.js";
5
+ } from "./chunk-3Y5BCGD2.js";
6
6
  import {
7
7
  buildReviewPrompt,
8
8
  buildSecurityReviewPrompt,
@@ -13,13 +13,13 @@ import {
13
13
  } from "./chunk-6YZEZFX5.js";
14
14
  import {
15
15
  ProviderRegistry
16
- } from "./chunk-UGY5SVNX.js";
16
+ } from "./chunk-ALSSNFNK.js";
17
17
  import {
18
18
  ConfigManager
19
- } from "./chunk-7G7RZHJI.js";
19
+ } from "./chunk-5F7BGV72.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-THUXZNJL.js";
22
+ } from "./chunk-UDFK5Q52.js";
23
23
 
24
24
  // src/cli/ci.ts
25
25
  import { execFileSync } from "child_process";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.286";
4
+ var VERSION = "0.4.287";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -3,16 +3,16 @@ import {
3
3
  CI_COMMENT_MARKER,
4
4
  countSeverity,
5
5
  runCi
6
- } from "./chunk-3ZQZO5F7.js";
7
- import "./chunk-2YDLBM3Z.js";
6
+ } from "./chunk-RZVGR3KD.js";
7
+ import "./chunk-3Y5BCGD2.js";
8
8
  import "./chunk-HLWUDRBO.js";
9
9
  import "./chunk-6YZEZFX5.js";
10
- import "./chunk-UGY5SVNX.js";
11
- import "./chunk-7G7RZHJI.js";
10
+ import "./chunk-ALSSNFNK.js";
11
+ import "./chunk-5F7BGV72.js";
12
12
  import "./chunk-TEXT4DAT.js";
13
13
  import "./chunk-TU3L3PW7.js";
14
14
  import "./chunk-IW3Q7AE5.js";
15
- import "./chunk-THUXZNJL.js";
15
+ import "./chunk-UDFK5Q52.js";
16
16
  export {
17
17
  CI_COMMENT_MARKER,
18
18
  countSeverity,
@@ -6,8 +6,8 @@ import {
6
6
  formatCiResult,
7
7
  formatCiSarif,
8
8
  normalizeCiThresholds
9
- } from "./chunk-2YDLBM3Z.js";
10
- import "./chunk-THUXZNJL.js";
9
+ } from "./chunk-3Y5BCGD2.js";
10
+ import "./chunk-UDFK5Q52.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-THUXZNJL.js";
41
+ } from "./chunk-UDFK5Q52.js";
42
42
  export {
43
43
  AGENTIC_BEHAVIOR_GUIDELINE,
44
44
  APP_NAME,
@@ -37,7 +37,7 @@ import {
37
37
  TEST_TIMEOUT,
38
38
  VERSION,
39
39
  buildUserIdentityPrompt
40
- } from "./chunk-GIJL4EFA.js";
40
+ } from "./chunk-CYUAHF6X.js";
41
41
  export {
42
42
  AGENTIC_BEHAVIOR_GUIDELINE,
43
43
  APP_NAME,
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  formatDoctorReport,
4
4
  runDoctorCli
5
- } from "./chunk-6SCELZG6.js";
6
- import "./chunk-EYUCJBGS.js";
5
+ } from "./chunk-EU6NMK7G.js";
6
+ import "./chunk-HEUB5PV6.js";
7
7
  import "./chunk-RS7SKYTS.js";
8
- import "./chunk-UGY5SVNX.js";
9
- import "./chunk-7G7RZHJI.js";
8
+ import "./chunk-ALSSNFNK.js";
9
+ import "./chunk-5F7BGV72.js";
10
10
  import "./chunk-TEXT4DAT.js";
11
11
  import "./chunk-TU3L3PW7.js";
12
12
  import "./chunk-HOSJZMQS.js";
13
13
  import "./chunk-IW3Q7AE5.js";
14
- import "./chunk-THUXZNJL.js";
14
+ import "./chunk-UDFK5Q52.js";
15
15
  export {
16
16
  formatDoctorReport,
17
17
  runDoctorCli
@@ -50,7 +50,7 @@ import {
50
50
  touchMemoryReferences,
51
51
  updateMemoryApproval,
52
52
  updateMemoryEntry
53
- } from "./chunk-D7HYLMCC.js";
53
+ } from "./chunk-L625B2XV.js";
54
54
  import {
55
55
  DEFAULT_PATTERNS,
56
56
  redactJson,
@@ -66,7 +66,7 @@ import {
66
66
  } from "./chunk-CGLYJRFA.js";
67
67
  import {
68
68
  runTestsTool
69
- } from "./chunk-L4FDTQ42.js";
69
+ } from "./chunk-3BHJKMPQ.js";
70
70
  import {
71
71
  AGENTIC_BEHAVIOR_GUIDELINE,
72
72
  APP_NAME,
@@ -100,7 +100,7 @@ import {
100
100
  SUBAGENT_MAX_ROUNDS_LIMIT,
101
101
  VERSION,
102
102
  buildUserIdentityPrompt
103
- } from "./chunk-GIJL4EFA.js";
103
+ } from "./chunk-CYUAHF6X.js";
104
104
 
105
105
  // src/web/server.ts
106
106
  import express from "express";
@@ -1288,9 +1288,76 @@ function schemaToJsonSchema(schema) {
1288
1288
  return result;
1289
1289
  }
1290
1290
 
1291
+ // src/core/network-error.ts
1292
+ var NETWORK_CODES = /* @__PURE__ */ new Set([
1293
+ "ECONNREFUSED",
1294
+ // 端口没人听(代理没起来最常见)
1295
+ "ECONNRESET",
1296
+ // 对端断开
1297
+ "ENOTFOUND",
1298
+ // DNS 查不到
1299
+ "EAI_AGAIN",
1300
+ // DNS 临时失败
1301
+ "ETIMEDOUT",
1302
+ // 连接超时
1303
+ "EHOSTUNREACH",
1304
+ "ENETUNREACH",
1305
+ "EPIPE",
1306
+ "UND_ERR_SOCKET",
1307
+ // undici:socket 意外关闭
1308
+ "UND_ERR_CONNECT_TIMEOUT"
1309
+ ]);
1310
+ var TRANSIENT_CODES = /* @__PURE__ */ new Set(["ECONNRESET", "UND_ERR_SOCKET", "EPIPE", "EAI_AGAIN"]);
1311
+ function findCause(err, depth = 0) {
1312
+ if (!err || depth > 4) return null;
1313
+ const e = err;
1314
+ if (typeof e.code === "string") {
1315
+ return {
1316
+ code: e.code,
1317
+ address: e.address ? `${e.address}${e.port !== void 0 ? `:${e.port}` : ""}` : void 0,
1318
+ message: e.message
1319
+ };
1320
+ }
1321
+ if (Array.isArray(e.errors) && e.errors.length > 0) {
1322
+ for (const inner of e.errors) {
1323
+ const found = findCause(inner, depth + 1);
1324
+ if (found) return found;
1325
+ }
1326
+ }
1327
+ return findCause(e.cause, depth + 1);
1328
+ }
1329
+ function describeNetworkFailure(err, ctx = {}) {
1330
+ const cause = findCause(err);
1331
+ const topMessage = err instanceof Error ? err.message : String(err);
1332
+ const looksNetwork = cause?.code && NETWORK_CODES.has(cause.code) || topMessage === "fetch failed" || topMessage.includes("Connection error");
1333
+ if (!looksNetwork) return null;
1334
+ const code = cause?.code;
1335
+ const address = cause?.address;
1336
+ const transient = !!code && TRANSIENT_CODES.has(code);
1337
+ const what = code ? `${code}${address ? ` ${address}` : ""}` : cause?.message ?? "no further detail from the network layer";
1338
+ const where = ctx.target ? ` while connecting to ${ctx.target}` : "";
1339
+ const parts = [`Connection failed${where} (${what}).`];
1340
+ if (ctx.proxyUrl) {
1341
+ parts.push(`The request went through the proxy from config.proxy (${ctx.proxyUrl}).`);
1342
+ if (code === "ECONNREFUSED") {
1343
+ parts.push(`That address refused the connection \u2014 the proxy is probably not running. Start it, or unset config.proxy to connect directly.`);
1344
+ }
1345
+ }
1346
+ if (transient) {
1347
+ parts.push(`This usually means an idle connection was dropped by the other side \u2014 just send the message again.`);
1348
+ } else if (code === "ENOTFOUND" || code === "EAI_AGAIN") {
1349
+ parts.push(`DNS lookup failed \u2014 check the network connection${ctx.proxyUrl ? " and the proxy" : ""}.`);
1350
+ } else if (code === "ETIMEDOUT" || code === "UND_ERR_CONNECT_TIMEOUT") {
1351
+ parts.push(`The connection timed out before it was established${ctx.proxyUrl ? " \u2014 check whether the proxy can reach this host" : ""}.`);
1352
+ }
1353
+ return { code, address, transient, message: parts.join(" ") };
1354
+ }
1355
+
1291
1356
  // src/providers/claude.ts
1292
1357
  var CACHE_MIN_SYSTEM_CHARS = 2e3;
1293
1358
  var ClaudeProvider = class extends BaseProvider {
1359
+ /** 生效的代理(网络失败时点名它,见 core/network-error.ts)。 */
1360
+ activeProxyUrl;
1294
1361
  client;
1295
1362
  info = {
1296
1363
  id: "claude",
@@ -1325,6 +1392,7 @@ var ClaudeProvider = class extends BaseProvider {
1325
1392
  baseURL: options?.baseUrl
1326
1393
  };
1327
1394
  const proxyUrl = options?.proxy;
1395
+ this.activeProxyUrl = proxyUrl;
1328
1396
  try {
1329
1397
  const { Agent: Agent2, ProxyAgent, fetch: undiciFetch } = await import("undici");
1330
1398
  const STREAM_BODY_TIMEOUT = 30 * 60 * 1e3;
@@ -1849,6 +1917,8 @@ var ClaudeProvider = class extends BaseProvider {
1849
1917
  if (err instanceof Anthropic.RateLimitError) {
1850
1918
  return new RateLimitError("claude");
1851
1919
  }
1920
+ const net2 = describeNetworkFailure(err, { target: "api.anthropic.com", proxyUrl: this.activeProxyUrl });
1921
+ if (net2) return new ProviderError("claude", net2.message, err instanceof Error ? err : void 0);
1852
1922
  if (err instanceof Error) {
1853
1923
  return new ProviderError("claude", err.message, err);
1854
1924
  }
@@ -2165,10 +2235,11 @@ var GeminiProvider = class extends BaseProvider {
2165
2235
  err
2166
2236
  );
2167
2237
  }
2168
- if (msg.includes("fetch failed") || msg.includes("ECONNREFUSED") || msg.includes("ETIMEDOUT") || msg.includes("ENOTFOUND") || msg.includes("socket hang up")) {
2238
+ const net2 = describeNetworkFailure(err, { target: "generativelanguage.googleapis.com" });
2239
+ if (net2 || msg.includes("socket hang up")) {
2169
2240
  return new ProviderError(
2170
2241
  "gemini",
2171
- `Network connection failed: ${msg}
2242
+ `${net2?.message ?? `Network connection failed: ${msg}`}
2172
2243
  Node.js does not automatically use system proxies. Try one of the following:
2173
2244
  1. Set environment variable: set HTTPS_PROXY=http://127.0.0.1:<proxy-port>
2174
2245
  2. Configure an accessible Gemini API mirror URL in config.json under customBaseUrls.gemini`,
@@ -3360,6 +3431,8 @@ function readRetryCount(headers) {
3360
3431
  }
3361
3432
  var OpenAICompatibleProvider = class extends BaseProvider {
3362
3433
  client;
3434
+ /** 生效的代理(wrapError 要在网络失败时点名它);未配代理时为 undefined。 */
3435
+ activeProxyUrl;
3363
3436
  defaultTimeout = 6e4;
3364
3437
  // ms
3365
3438
  /**
@@ -3389,13 +3462,17 @@ var OpenAICompatibleProvider = class extends BaseProvider {
3389
3462
  const { Agent: Agent2, ProxyAgent, fetch: undiciFetch } = await import("undici");
3390
3463
  const STREAM_BODY_TIMEOUT = 30 * 60 * 1e3;
3391
3464
  const STREAM_HEADERS_TIMEOUT = 5 * 60 * 1e3;
3465
+ const KEEP_ALIVE_TIMEOUT = 2e3;
3466
+ this.activeProxyUrl = proxyUrl;
3392
3467
  const dispatcher = proxyUrl ? new ProxyAgent({
3393
3468
  uri: proxyUrl,
3394
3469
  bodyTimeout: STREAM_BODY_TIMEOUT,
3395
- headersTimeout: STREAM_HEADERS_TIMEOUT
3470
+ headersTimeout: STREAM_HEADERS_TIMEOUT,
3471
+ keepAliveTimeout: KEEP_ALIVE_TIMEOUT
3396
3472
  }) : new Agent2({
3397
3473
  bodyTimeout: STREAM_BODY_TIMEOUT,
3398
- headersTimeout: STREAM_HEADERS_TIMEOUT
3474
+ headersTimeout: STREAM_HEADERS_TIMEOUT,
3475
+ keepAliveTimeout: KEEP_ALIVE_TIMEOUT
3399
3476
  });
3400
3477
  clientOptions.fetch = ((url, init) => {
3401
3478
  const retryCount = readRetryCount(init?.headers);
@@ -3869,11 +3946,24 @@ var OpenAICompatibleProvider = class extends BaseProvider {
3869
3946
  if (err instanceof OpenAI.RateLimitError) {
3870
3947
  return new RateLimitError(this.info.id);
3871
3948
  }
3949
+ const net2 = describeNetworkFailure(err, {
3950
+ target: this.hostLabel(),
3951
+ proxyUrl: this.activeProxyUrl
3952
+ });
3953
+ if (net2) return new ProviderError(this.info.id, net2.message, err instanceof Error ? err : void 0);
3872
3954
  if (err instanceof Error) {
3873
3955
  return new ProviderError(this.info.id, err.message, err);
3874
3956
  }
3875
3957
  return new ProviderError(this.info.id, String(err));
3876
3958
  }
3959
+ /** 请求实际打向的主机,用于「连谁失败了」。 */
3960
+ hostLabel() {
3961
+ try {
3962
+ return new URL(this.info.baseUrl ?? this.defaultBaseUrl).host;
3963
+ } catch {
3964
+ return this.info.id;
3965
+ }
3966
+ }
3877
3967
  };
3878
3968
 
3879
3969
  // src/providers/deepseek.ts
@@ -16907,7 +16997,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
16907
16997
  Cost: ${formatCost(cost)}` : "";
16908
16998
  let memoryLine = "";
16909
16999
  try {
16910
- const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-3KL4N27E.js");
17000
+ const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-3N2XQKJK.js");
16911
17001
  const pending = countPendingMemories2(ctx.config.getConfigDir());
16912
17002
  if (pending > 0) memoryLine = `
16913
17003
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -17890,7 +17980,7 @@ async function handleTest(args, ctx) {
17890
17980
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
17891
17981
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
17892
17982
  }
17893
- const runTests = ctx.runTests ?? (await import("./run-tests-ERD6X534.js")).executeTests;
17983
+ const runTests = ctx.runTests ?? (await import("./run-tests-3ZOMRFIX.js")).executeTests;
17894
17984
  const report = await runTests(testArgs);
17895
17985
  ctx.send({ type: "info", message: report });
17896
17986
  } catch (err) {
@@ -18280,7 +18370,7 @@ async function handleMemory(args, ctx) {
18280
18370
  }
18281
18371
  if (intent.kind === "status") {
18282
18372
  const { getChatIndexStatus: getChatIndexStatus2 } = await import("./chat-index-DGUOUUQW.js");
18283
- const { listMemoryEntries: listMemoryEntries2, isMemoryExpired: isMemoryExpired2, formatMemoryForPrompt: formatMemoryForPrompt2 } = await import("./persistent-memory-3KL4N27E.js");
18373
+ const { listMemoryEntries: listMemoryEntries2, isMemoryExpired: isMemoryExpired2, formatMemoryForPrompt: formatMemoryForPrompt2 } = await import("./persistent-memory-3N2XQKJK.js");
18284
18374
  const memories = listMemoryEntries2(configDir, { includeExpired: true, includeRejected: true });
18285
18375
  const injected = formatMemoryForPrompt2(configDir, process.cwd(), ctx.config.get("memory")?.maxChars);
18286
18376
  const view = buildMemoryStatusView({
@@ -18303,7 +18393,7 @@ async function handleMemory(args, ctx) {
18303
18393
  return;
18304
18394
  }
18305
18395
  if (intent.kind === "recall") {
18306
- const { searchPersistentMemories: searchPersistentMemories2, touchMemoryReferences: touchMemoryReferences2 } = await import("./persistent-memory-3KL4N27E.js");
18396
+ const { searchPersistentMemories: searchPersistentMemories2, touchMemoryReferences: touchMemoryReferences2 } = await import("./persistent-memory-3N2XQKJK.js");
18307
18397
  const { searchChatMemory: searchChatMemory2 } = await import("./chat-index-DGUOUUQW.js");
18308
18398
  const persistentHits = searchPersistentMemories2(configDir, intent.query, process.cwd(), 3);
18309
18399
  if (persistentHits.length > 0) {
@@ -18424,7 +18514,7 @@ async function handleMemory(args, ctx) {
18424
18514
  ctx.handleMemoryManage(intent.action, args[1], intent.action === "expire" ? args[2] : void 0);
18425
18515
  } else if (intent.kind === "export") {
18426
18516
  if (args[1] === "md") {
18427
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-3KL4N27E.js");
18517
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-3N2XQKJK.js");
18428
18518
  ctx.send({
18429
18519
  type: "export_data",
18430
18520
  format: "md",
@@ -19429,7 +19519,7 @@ No tools match "${filter}".
19429
19519
  const { join: join29 } = await import("path");
19430
19520
  const { existsSync: existsSync33 } = await import("fs");
19431
19521
  const { getGitRoot: getGitRoot2 } = await import("./git-context-VNCA2GU7.js");
19432
- const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-P75MLFV7.js");
19522
+ const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-SRRV3K5Y.js");
19433
19523
  const { approveProject, hashMcpFile } = await import("./project-trust-MUG325AW.js");
19434
19524
  const cwd = process.cwd();
19435
19525
  const projectRoot = getGitRoot2(cwd) ?? cwd;
@@ -20344,7 +20434,7 @@ function createReviewCommands() {
20344
20434
  usage: "/test [command|filter]",
20345
20435
  async execute(args, ctx) {
20346
20436
  try {
20347
- const { executeTests } = await import("./run-tests-ERD6X534.js");
20437
+ const { executeTests } = await import("./run-tests-3ZOMRFIX.js");
20348
20438
  const argStr = args.join(" ").trim();
20349
20439
  let testArgs = {};
20350
20440
  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-XAMKOFUE.js");
161
+ const { TaskOrchestrator } = await import("./task-orchestrator-6TVKJYKC.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-53V3RQY5.js";
27
+ } from "./chunk-HNUT4STJ.js";
28
28
  import {
29
29
  CostTracker,
30
30
  getPricing,
@@ -49,7 +49,7 @@ import {
49
49
  setMaxOutputCap,
50
50
  spawnAgentContext,
51
51
  undoStack
52
- } from "./chunk-BRLLV3FX.js";
52
+ } from "./chunk-AXSWLNCU.js";
53
53
  import "./chunk-HLWUDRBO.js";
54
54
  import {
55
55
  NO_THINKING,
@@ -62,7 +62,7 @@ import {
62
62
  countPendingMemories,
63
63
  detectStaleLegacyMarkdownEdit,
64
64
  formatMemoryForPrompt
65
- } from "./chunk-UKITSNSH.js";
65
+ } from "./chunk-ERDFOXYK.js";
66
66
  import "./chunk-4DEMGCK4.js";
67
67
  import "./chunk-UUSRWSSX.js";
68
68
  import "./chunk-CKH4KQ4E.js";
@@ -83,22 +83,22 @@ import {
83
83
  import {
84
84
  loadContextFiles,
85
85
  writeCrashLog
86
- } from "./chunk-6SCELZG6.js";
86
+ } from "./chunk-EU6NMK7G.js";
87
87
  import {
88
88
  getActivePluginAssets,
89
89
  getPendingHookTrust,
90
90
  installFlushOnExit,
91
91
  mergePluginHooks,
92
92
  runLifecycleHooks
93
- } from "./chunk-EYUCJBGS.js";
93
+ } from "./chunk-HEUB5PV6.js";
94
94
  import "./chunk-RS7SKYTS.js";
95
95
  import {
96
96
  ProviderRegistry,
97
97
  listBuiltInProviderMetadata
98
- } from "./chunk-UGY5SVNX.js";
98
+ } from "./chunk-ALSSNFNK.js";
99
99
  import {
100
100
  ConfigManager
101
- } from "./chunk-7G7RZHJI.js";
101
+ } from "./chunk-5F7BGV72.js";
102
102
  import {
103
103
  CONTENT_ONLY_STREAM_REMINDER,
104
104
  TEE_FINAL_USER_NUDGE,
@@ -132,7 +132,7 @@ import {
132
132
  } from "./chunk-IW3Q7AE5.js";
133
133
  import "./chunk-XNFIYS7G.js";
134
134
  import "./chunk-4BKXL7SM.js";
135
- import "./chunk-S7ABWTDV.js";
135
+ import "./chunk-L7RAEUUN.js";
136
136
  import {
137
137
  AGENTIC_BEHAVIOR_GUIDELINE,
138
138
  AUTHOR,
@@ -149,7 +149,7 @@ import {
149
149
  SKILLS_DIR_NAME,
150
150
  VERSION,
151
151
  buildUserIdentityPrompt
152
- } from "./chunk-THUXZNJL.js";
152
+ } from "./chunk-UDFK5Q52.js";
153
153
 
154
154
  // src/index.ts
155
155
  import { program } from "commander";
@@ -3990,7 +3990,7 @@ program.command("web").description("Start Web UI server with browser-based chat
3990
3990
  console.error("Error: Invalid port number. Must be between 1 and 65535.");
3991
3991
  process.exit(1);
3992
3992
  }
3993
- const { startWebServer } = await import("./server-A3OX52UC.js");
3993
+ const { startWebServer } = await import("./server-XWURZCAF.js");
3994
3994
  await startWebServer({ port, host: options.host });
3995
3995
  });
3996
3996
  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) => {
@@ -4157,11 +4157,11 @@ program.command("sessions").description("List recent conversation sessions").opt
4157
4157
  console.log(footer + "\n");
4158
4158
  });
4159
4159
  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) => {
4160
- const { runUsageCli } = await import("./usage-ZXNYCAZB.js");
4160
+ const { runUsageCli } = await import("./usage-L2PSI2KH.js");
4161
4161
  await runUsageCli(options);
4162
4162
  });
4163
4163
  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) => {
4164
- const { runDoctorCli } = await import("./doctor-cli-VLFE46PX.js");
4164
+ const { runDoctorCli } = await import("./doctor-cli-LQYTDJ74.js");
4165
4165
  const argv = process.argv.slice(2);
4166
4166
  await runDoctorCli({
4167
4167
  json: !!options.json || argv.includes("--json"),
@@ -4170,7 +4170,7 @@ program.command("doctor").description("Health check: API keys, config, MCP, rece
4170
4170
  });
4171
4171
  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) => {
4172
4172
  try {
4173
- const batch = await import("./batch-GY3I53DE.js");
4173
+ const batch = await import("./batch-6OH7D5YU.js");
4174
4174
  switch (action) {
4175
4175
  case "submit":
4176
4176
  if (!arg) {
@@ -4213,7 +4213,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
4213
4213
  }
4214
4214
  });
4215
4215
  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) => {
4216
- const { startMcpServer } = await import("./server-7VSLW446.js");
4216
+ const { startMcpServer } = await import("./server-L4QHJT2I.js");
4217
4217
  await startMcpServer({
4218
4218
  allowDestructive: !!options.allowDestructive,
4219
4219
  allowOutsideCwd: !!options.allowOutsideCwd,
@@ -4226,7 +4226,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
4226
4226
  console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
4227
4227
  process.exit(1);
4228
4228
  }
4229
- const { runPrCli } = await import("./pr-2YUV4KII.js");
4229
+ const { runPrCli } = await import("./pr-L7Y3XHGL.js");
4230
4230
  const result = await runPrCli({
4231
4231
  action,
4232
4232
  target,
@@ -4246,8 +4246,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
4246
4246
  process.exit(result.exitCode);
4247
4247
  });
4248
4248
  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) => {
4249
- const { runCi } = await import("./ci-JBUIVM7P.js");
4250
- const { formatCiResult } = await import("./ci-format-B4AHV5SI.js");
4249
+ const { runCi } = await import("./ci-WXCMI4ND.js");
4250
+ const { formatCiResult } = await import("./ci-format-JXD2BQM6.js");
4251
4251
  const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
4252
4252
  if (formats > 1) {
4253
4253
  console.error("Choose only one output format: --json, --markdown, or --sarif.");
@@ -4405,7 +4405,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
4405
4405
  config.get("customProviders"),
4406
4406
  config.getConfigDir()
4407
4407
  );
4408
- const { startHub } = await import("./hub-CNORVRYW.js");
4408
+ const { startHub } = await import("./hub-Y62P5MIA.js");
4409
4409
  await startHub(
4410
4410
  {
4411
4411
  topic: topic ?? "",
@@ -27,11 +27,11 @@ import {
27
27
  touchMemoryReferences,
28
28
  updateMemoryApproval,
29
29
  updateMemoryEntry
30
- } from "./chunk-D7HYLMCC.js";
30
+ } from "./chunk-L625B2XV.js";
31
31
  import "./chunk-FSC6KEWU.js";
32
32
  import "./chunk-6BUTA5VW.js";
33
33
  import "./chunk-CGLYJRFA.js";
34
- import "./chunk-GIJL4EFA.js";
34
+ import "./chunk-CYUAHF6X.js";
35
35
  export {
36
36
  addMemoryEntry,
37
37
  backupMemoryStore,
@@ -28,11 +28,11 @@ import {
28
28
  touchMemoryReferences,
29
29
  updateMemoryApproval,
30
30
  updateMemoryEntry
31
- } from "./chunk-UKITSNSH.js";
31
+ } from "./chunk-ERDFOXYK.js";
32
32
  import "./chunk-3FEZSLGI.js";
33
33
  import "./chunk-HOSJZMQS.js";
34
34
  import "./chunk-IW3Q7AE5.js";
35
- import "./chunk-THUXZNJL.js";
35
+ import "./chunk-UDFK5Q52.js";
36
36
  export {
37
37
  addMemoryEntry,
38
38
  backupMemoryStore,
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  countSeverity,
4
4
  runCi
5
- } from "./chunk-3ZQZO5F7.js";
6
- import "./chunk-2YDLBM3Z.js";
5
+ } from "./chunk-RZVGR3KD.js";
6
+ import "./chunk-3Y5BCGD2.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-UGY5SVNX.js";
17
+ } from "./chunk-ALSSNFNK.js";
18
18
  import {
19
19
  ConfigManager
20
- } from "./chunk-7G7RZHJI.js";
20
+ } from "./chunk-5F7BGV72.js";
21
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-THUXZNJL.js";
26
+ } from "./chunk-UDFK5Q52.js";
27
27
 
28
28
  // src/cli/pr.ts
29
29
  import { execFileSync } from "child_process";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  executeTests,
3
3
  runTestsTool
4
- } from "./chunk-L4FDTQ42.js";
5
- import "./chunk-GIJL4EFA.js";
4
+ } from "./chunk-3BHJKMPQ.js";
5
+ import "./chunk-CYUAHF6X.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-S7ABWTDV.js";
6
- import "./chunk-THUXZNJL.js";
5
+ } from "./chunk-L7RAEUUN.js";
6
+ import "./chunk-UDFK5Q52.js";
7
7
  export {
8
8
  executeTests,
9
9
  runTestsTool
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ToolRegistry
4
- } from "./chunk-BRLLV3FX.js";
4
+ } from "./chunk-AXSWLNCU.js";
5
5
  import "./chunk-GHWZVPUV.js";
6
- import "./chunk-UKITSNSH.js";
6
+ import "./chunk-ERDFOXYK.js";
7
7
  import "./chunk-4DEMGCK4.js";
8
8
  import "./chunk-UUSRWSSX.js";
9
9
  import "./chunk-CKH4KQ4E.js";
@@ -14,7 +14,7 @@ import "./chunk-NYNSYLFY.js";
14
14
  import "./chunk-3FEZSLGI.js";
15
15
  import {
16
16
  runTool
17
- } from "./chunk-EYUCJBGS.js";
17
+ } from "./chunk-HEUB5PV6.js";
18
18
  import "./chunk-RS7SKYTS.js";
19
19
  import {
20
20
  getDangerLevel,
@@ -24,10 +24,10 @@ import "./chunk-TU3L3PW7.js";
24
24
  import "./chunk-HOSJZMQS.js";
25
25
  import "./chunk-IW3Q7AE5.js";
26
26
  import "./chunk-4BKXL7SM.js";
27
- import "./chunk-S7ABWTDV.js";
27
+ import "./chunk-L7RAEUUN.js";
28
28
  import {
29
29
  VERSION
30
- } from "./chunk-THUXZNJL.js";
30
+ } from "./chunk-UDFK5Q52.js";
31
31
 
32
32
  // src/mcp/server.ts
33
33
  import { createInterface } from "readline";
@@ -81,7 +81,7 @@ import {
81
81
  skillHistoryNote,
82
82
  snapshotFile,
83
83
  stripRoutingTags
84
- } from "./chunk-53V3RQY5.js";
84
+ } from "./chunk-HNUT4STJ.js";
85
85
  import {
86
86
  CNY_PER_USD,
87
87
  CostTracker,
@@ -123,7 +123,7 @@ import {
123
123
  spawnAgentContext,
124
124
  truncateOutput,
125
125
  undoStack
126
- } from "./chunk-BRLLV3FX.js";
126
+ } from "./chunk-AXSWLNCU.js";
127
127
  import {
128
128
  buildReviewPrompt,
129
129
  buildSecurityReviewPrompt
@@ -150,7 +150,7 @@ import {
150
150
  restoreMemoryEntries,
151
151
  updateMemoryApproval,
152
152
  updateMemoryEntry
153
- } from "./chunk-UKITSNSH.js";
153
+ } from "./chunk-ERDFOXYK.js";
154
154
  import "./chunk-4DEMGCK4.js";
155
155
  import "./chunk-UUSRWSSX.js";
156
156
  import "./chunk-CKH4KQ4E.js";
@@ -169,7 +169,7 @@ import {
169
169
  buildDoctorReport,
170
170
  formatDoctorReport,
171
171
  loadContextFiles
172
- } from "./chunk-6SCELZG6.js";
172
+ } from "./chunk-EU6NMK7G.js";
173
173
  import {
174
174
  describePlugin,
175
175
  getActivePluginAssets,
@@ -184,14 +184,14 @@ import {
184
184
  runTool,
185
185
  setPluginEnabled,
186
186
  trustPlugin
187
- } from "./chunk-EYUCJBGS.js";
187
+ } from "./chunk-HEUB5PV6.js";
188
188
  import "./chunk-RS7SKYTS.js";
189
189
  import {
190
190
  ProviderRegistry
191
- } from "./chunk-UGY5SVNX.js";
191
+ } from "./chunk-ALSSNFNK.js";
192
192
  import {
193
193
  ConfigManager
194
- } from "./chunk-7G7RZHJI.js";
194
+ } from "./chunk-5F7BGV72.js";
195
195
  import {
196
196
  CONTENT_ONLY_STREAM_REMINDER,
197
197
  TEE_FINAL_USER_NUDGE,
@@ -221,7 +221,7 @@ import {
221
221
  maskConfigSecrets
222
222
  } from "./chunk-XNFIYS7G.js";
223
223
  import "./chunk-4BKXL7SM.js";
224
- import "./chunk-S7ABWTDV.js";
224
+ import "./chunk-L7RAEUUN.js";
225
225
  import {
226
226
  AGENTIC_BEHAVIOR_GUIDELINE,
227
227
  AUTHOR,
@@ -237,7 +237,7 @@ import {
237
237
  SKILLS_DIR_NAME,
238
238
  VERSION,
239
239
  buildUserIdentityPrompt
240
- } from "./chunk-THUXZNJL.js";
240
+ } from "./chunk-UDFK5Q52.js";
241
241
 
242
242
  // src/web/server.ts
243
243
  import express from "express";
@@ -995,7 +995,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
995
995
  Cost: ${formatCost(cost)}` : "";
996
996
  let memoryLine = "";
997
997
  try {
998
- const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-LVX2OT4L.js");
998
+ const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-46JSUEYV.js");
999
999
  const pending = countPendingMemories2(ctx.config.getConfigDir());
1000
1000
  if (pending > 0) memoryLine = `
1001
1001
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -1919,7 +1919,7 @@ async function handleTest(args, ctx) {
1919
1919
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
1920
1920
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
1921
1921
  }
1922
- const runTests = ctx.runTests ?? (await import("./run-tests-KZ2IUZHK.js")).executeTests;
1922
+ const runTests = ctx.runTests ?? (await import("./run-tests-WC644BHH.js")).executeTests;
1923
1923
  const report = await runTests(testArgs);
1924
1924
  ctx.send({ type: "info", message: report });
1925
1925
  } catch (err) {
@@ -2194,7 +2194,7 @@ async function handleMemory(args, ctx) {
2194
2194
  }
2195
2195
  if (intent.kind === "status") {
2196
2196
  const { getChatIndexStatus } = await import("./chat-index-2D5GK2DB.js");
2197
- const { listMemoryEntries: listMemoryEntries2, isMemoryExpired: isMemoryExpired2, formatMemoryForPrompt: formatMemoryForPrompt2 } = await import("./persistent-memory-LVX2OT4L.js");
2197
+ const { listMemoryEntries: listMemoryEntries2, isMemoryExpired: isMemoryExpired2, formatMemoryForPrompt: formatMemoryForPrompt2 } = await import("./persistent-memory-46JSUEYV.js");
2198
2198
  const memories = listMemoryEntries2(configDir, { includeExpired: true, includeRejected: true });
2199
2199
  const injected = formatMemoryForPrompt2(configDir, process.cwd(), ctx.config.get("memory")?.maxChars);
2200
2200
  const view = buildMemoryStatusView({
@@ -2217,7 +2217,7 @@ async function handleMemory(args, ctx) {
2217
2217
  return;
2218
2218
  }
2219
2219
  if (intent.kind === "recall") {
2220
- const { searchPersistentMemories, touchMemoryReferences } = await import("./persistent-memory-LVX2OT4L.js");
2220
+ const { searchPersistentMemories, touchMemoryReferences } = await import("./persistent-memory-46JSUEYV.js");
2221
2221
  const { searchChatMemory } = await import("./chat-index-2D5GK2DB.js");
2222
2222
  const persistentHits = searchPersistentMemories(configDir, intent.query, process.cwd(), 3);
2223
2223
  if (persistentHits.length > 0) {
@@ -2338,7 +2338,7 @@ async function handleMemory(args, ctx) {
2338
2338
  ctx.handleMemoryManage(intent.action, args[1], intent.action === "expire" ? args[2] : void 0);
2339
2339
  } else if (intent.kind === "export") {
2340
2340
  if (args[1] === "md") {
2341
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-LVX2OT4L.js");
2341
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-46JSUEYV.js");
2342
2342
  ctx.send({
2343
2343
  type: "export_data",
2344
2344
  format: "md",
@@ -4,9 +4,9 @@ import {
4
4
  googleSearchContext,
5
5
  isToolCapableProvider,
6
6
  truncateOutput
7
- } from "./chunk-BRLLV3FX.js";
7
+ } from "./chunk-AXSWLNCU.js";
8
8
  import "./chunk-GHWZVPUV.js";
9
- import "./chunk-UKITSNSH.js";
9
+ import "./chunk-ERDFOXYK.js";
10
10
  import "./chunk-4DEMGCK4.js";
11
11
  import "./chunk-UUSRWSSX.js";
12
12
  import "./chunk-CKH4KQ4E.js";
@@ -17,7 +17,7 @@ import "./chunk-NYNSYLFY.js";
17
17
  import "./chunk-3FEZSLGI.js";
18
18
  import {
19
19
  runTool
20
- } from "./chunk-EYUCJBGS.js";
20
+ } from "./chunk-HEUB5PV6.js";
21
21
  import "./chunk-RS7SKYTS.js";
22
22
  import {
23
23
  getDangerLevel,
@@ -29,10 +29,10 @@ import {
29
29
  atomicWriteFileSync
30
30
  } from "./chunk-IW3Q7AE5.js";
31
31
  import "./chunk-4BKXL7SM.js";
32
- import "./chunk-S7ABWTDV.js";
32
+ import "./chunk-L7RAEUUN.js";
33
33
  import {
34
34
  SUBAGENT_ALLOWED_TOOLS
35
- } from "./chunk-THUXZNJL.js";
35
+ } from "./chunk-UDFK5Q52.js";
36
36
 
37
37
  // src/hub/task-orchestrator.ts
38
38
  import { createInterface } from "readline";
@@ -9,10 +9,10 @@ import {
9
9
  import "./chunk-RS7SKYTS.js";
10
10
  import {
11
11
  ConfigManager
12
- } from "./chunk-7G7RZHJI.js";
12
+ } from "./chunk-5F7BGV72.js";
13
13
  import "./chunk-TU3L3PW7.js";
14
14
  import "./chunk-IW3Q7AE5.js";
15
- import "./chunk-THUXZNJL.js";
15
+ import "./chunk-UDFK5Q52.js";
16
16
 
17
17
  // src/cli/usage.ts
18
18
  function classifyRowCost(row) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.4.286",
3
+ "version": "0.4.287",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",