jinzd-ai-cli 0.4.227 → 0.4.229

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 (31) hide show
  1. package/dist/{batch-W2DJGST7.js → batch-XZHTNJXJ.js} +2 -2
  2. package/dist/{chunk-DKJ5EFKA.js → chunk-AEXWMIRE.js} +1 -1
  3. package/dist/{chunk-NBG2STGM.js → chunk-AXIMNQSY.js} +1 -1
  4. package/dist/{chunk-CYVVWFFO.js → chunk-B3POS7LB.js} +1 -1
  5. package/dist/{chunk-APBHCIPD.js → chunk-DMF6UHO6.js} +22 -17
  6. package/dist/{chunk-PUBCJF7E.js → chunk-EEQHP4GK.js} +19 -5
  7. package/dist/{chunk-6LQ6PUNZ.js → chunk-FEVOW3NQ.js} +31 -31
  8. package/dist/{chunk-2X2DOHA6.js → chunk-NR5U6LVG.js} +21 -3
  9. package/dist/{chunk-XPBEJB27.js → chunk-ODYTXQ26.js} +37 -0
  10. package/dist/{chunk-OMFVR2O7.js → chunk-PQLRX7US.js} +4 -4
  11. package/dist/{chunk-YK5DDJNH.js → chunk-QCGKCNBX.js} +1 -1
  12. package/dist/{chunk-WJJIP34H.js → chunk-QFOJ4GXC.js} +4 -4
  13. package/dist/{chunk-S4AKNVFK.js → chunk-SJ36SUG7.js} +2 -2
  14. package/dist/{chunk-7X5TVGVY.js → chunk-TEXAIWUJ.js} +1 -1
  15. package/dist/{chunk-CITDVXXM.js → chunk-YVMACMXW.js} +30 -1
  16. package/dist/{ci-PEOV2I3Z.js → ci-ZCVDKFXY.js} +6 -6
  17. package/dist/{ci-format-4O7SHP4F.js → ci-format-CKXDFTN3.js} +2 -2
  18. package/dist/{constants-HLNS4O5H.js → constants-J2MSGNFA.js} +1 -1
  19. package/dist/{doctor-cli-LA4AF6DK.js → doctor-cli-3VNTECP2.js} +6 -6
  20. package/dist/electron-server.js +110 -54
  21. package/dist/{hub-MAJE7GB7.js → hub-LIH5JEI7.js} +3 -3
  22. package/dist/{hub-server-XX36DX7O.js → hub-server-XA7HTVLD.js} +1 -1
  23. package/dist/index.js +21 -21
  24. package/dist/{pr-CDJFUPZX.js → pr-HY2QCVUY.js} +6 -6
  25. package/dist/{run-tests-DGV6D4L3.js → run-tests-QVXDTJ3O.js} +1 -1
  26. package/dist/{run-tests-QFYTNPSV.js → run-tests-WBGQI5V7.js} +2 -2
  27. package/dist/{server-GTIVGJ6S.js → server-5RXWIX4I.js} +5 -5
  28. package/dist/{server-ZQYQDQMT.js → server-LYTXYK6Y.js} +15 -15
  29. package/dist/{task-orchestrator-YSHHXWNT.js → task-orchestrator-FA4KOVD2.js} +7 -6
  30. package/dist/{usage-QDSXUKN7.js → usage-EHV6YVGH.js} +3 -3
  31. package/package.json +1 -1
@@ -2,14 +2,14 @@
2
2
  import {
3
3
  formatDoctorReport,
4
4
  runDoctorCli
5
- } from "./chunk-WJJIP34H.js";
6
- import "./chunk-PUBCJF7E.js";
7
- import "./chunk-7X5TVGVY.js";
8
- import "./chunk-XPBEJB27.js";
9
- import "./chunk-6LQ6PUNZ.js";
5
+ } from "./chunk-QFOJ4GXC.js";
6
+ import "./chunk-EEQHP4GK.js";
7
+ import "./chunk-TEXAIWUJ.js";
8
+ import "./chunk-ODYTXQ26.js";
9
+ import "./chunk-FEVOW3NQ.js";
10
10
  import "./chunk-5ULLIOVC.js";
11
11
  import "./chunk-HOSJZMQS.js";
12
- import "./chunk-CYVVWFFO.js";
12
+ import "./chunk-B3POS7LB.js";
13
13
  import "./chunk-IW3Q7AE5.js";
14
14
  export {
15
15
  formatDoctorReport,
@@ -38,7 +38,7 @@ import {
38
38
  VERSION,
39
39
  buildUserIdentityPrompt,
40
40
  runTestsTool
41
- } from "./chunk-YK5DDJNH.js";
41
+ } from "./chunk-QCGKCNBX.js";
42
42
  import {
43
43
  hasSemanticIndex,
44
44
  semanticSearch
@@ -76,22 +76,22 @@ import { homedir } from "os";
76
76
  // src/config/schema.ts
77
77
  import { z } from "zod";
78
78
  var CustomModelSchema = z.object({
79
- id: z.string(),
80
- displayName: z.string().optional(),
79
+ id: z.string().max(100),
80
+ displayName: z.string().max(200).optional(),
81
81
  contextWindow: z.number().optional()
82
82
  });
83
83
  var CustomProviderConfigSchema = z.object({
84
- id: z.string(),
84
+ id: z.string().max(100),
85
85
  // 唯一 ID,不能与内置 provider 重名
86
- displayName: z.string(),
86
+ displayName: z.string().max(200),
87
87
  // 显示名称
88
- apiKey: z.string().optional(),
88
+ apiKey: z.string().max(4e3).optional(),
89
89
  // 可选:直接在此写 key(也可通过 apiKeys 字段或环境变量提供)
90
- baseUrl: z.string(),
90
+ baseUrl: z.string().max(2e3),
91
91
  // OpenAI 兼容 API 的 base URL(必填)
92
- defaultModel: z.string(),
92
+ defaultModel: z.string().max(200),
93
93
  // 默认使用的模型 ID
94
- models: z.array(CustomModelSchema).default([]),
94
+ models: z.array(CustomModelSchema).max(100).default([]),
95
95
  timeout: z.number().optional()
96
96
  // 请求超时(ms),覆盖全局默认值
97
97
  });
@@ -106,19 +106,19 @@ var ModelParamsSchema = z.object({
106
106
  });
107
107
  var UserProfileSchema = z.object({
108
108
  /** 真实姓名(如 "Jin Zhengdong") */
109
- name: z.string().optional(),
109
+ name: z.string().max(100).optional(),
110
110
  /** 昵称/称呼偏好(如 "东叔"),AI 会以此称呼你 */
111
- nickname: z.string().optional(),
111
+ nickname: z.string().max(100).optional(),
112
112
  /** 职业角色(如 "Full-stack developer"、"Data scientist") */
113
- role: z.string().optional(),
113
+ role: z.string().max(200).optional(),
114
114
  /** 个人简介 / 专长描述(1-3 句话) */
115
- bio: z.string().optional(),
115
+ bio: z.string().max(1e4).optional(),
116
116
  /** 兴趣领域或技术栈(如 ["TypeScript", "Rust", "AI/ML"]) */
117
- interests: z.array(z.string()).default([]),
117
+ interests: z.array(z.string()).max(100).default([]),
118
118
  /** 语言偏好(如 "zh-CN"、"en"),AI 将据此选择交流语言 */
119
- locale: z.string().optional(),
119
+ locale: z.string().max(20).optional(),
120
120
  /** 自定义人设补充(自由格式,直接注入 system prompt) */
121
- extra: z.string().optional()
121
+ extra: z.string().max(5e3).optional()
122
122
  }).default({});
123
123
  var ConfigSchema = z.object({
124
124
  version: z.string().default("1.0.0"),
@@ -140,7 +140,7 @@ var ConfigSchema = z.object({
140
140
  // HTTP/HTTPS 代理地址(Node.js 不自动使用系统代理,需显式配置)
141
141
  // 例:http://127.0.0.1:10809
142
142
  // 也可通过环境变量 HTTPS_PROXY / HTTP_PROXY 覆盖
143
- proxy: z.string().optional(),
143
+ proxy: z.string().max(500).optional(),
144
144
  // 自定义 Provider 列表(OpenAI 兼容接口,无需改代码)
145
145
  customProviders: z.array(CustomProviderConfigSchema).default([]),
146
146
  // 按模型 ID 存储的推理参数(key 为模型 ID,如 "deepseek-chat")
@@ -174,7 +174,7 @@ var ConfigSchema = z.object({
174
174
  session: z.object({
175
175
  autoSave: z.boolean().default(true),
176
176
  maxHistoryDays: z.number().default(30),
177
- systemPrompt: z.string().optional()
177
+ systemPrompt: z.string().max(1e5).optional()
178
178
  }).default({}),
179
179
  // 项目上下文文件配置
180
180
  // 启动时自动读取并注入 system prompt,类似 Claude Code 的 CLAUDE.md / Codex AGENTS.md 机制
@@ -182,14 +182,14 @@ var ConfigSchema = z.object({
182
182
  // 设为 false 可禁用此功能;指定字符串时仅加载 cwd 下的该文件
183
183
  contextFile: z.union([z.string(), z.literal(false)]).default("auto"),
184
184
  context: z.object({
185
- projectDocFallbackFilenames: z.array(z.string()).default([]),
185
+ projectDocFallbackFilenames: z.array(z.string().max(500)).max(20).default([]),
186
186
  projectDocMaxBytes: z.number().int().positive().default(32 * 1024),
187
187
  showLoadedContextSources: z.boolean().default(false)
188
188
  }).default({}),
189
189
  // Google Custom Search API 的 Search Engine ID (cx 参数)
190
190
  // API Key 通过 apiKeys['google-search'] 或 AICLI_API_KEY_GOOGLESEARCH 环境变量配置
191
191
  // CX 也可通过 AICLI_GOOGLE_CX 环境变量覆盖
192
- googleSearchEngineId: z.string().optional(),
192
+ googleSearchEngineId: z.string().max(200).optional(),
193
193
  // google_search 工具的安全开关(v0.4.135+)
194
194
  // 默认 disabled。这个工具调用 Google Custom Search API,没有原生 daily-spend cap——
195
195
  // 业内有多起 key 被盗后产生数万美元账单的真实案例。现在内置 web_search 工具走 Bing/Google
@@ -207,10 +207,10 @@ var ConfigSchema = z.object({
207
207
  // 配置格式兼容 Claude Desktop(command + args + env)
208
208
  // 示例:{ "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path"] } }
209
209
  mcpServers: z.record(z.object({
210
- command: z.string(),
211
- args: z.array(z.string()).default([]),
210
+ command: z.string().max(500),
211
+ args: z.array(z.string()).max(100).default([]),
212
212
  env: z.record(z.string()).optional(),
213
- timeout: z.number().default(3e4)
213
+ timeout: z.number().int().min(100).max(3e5).default(3e4)
214
214
  })).default({}),
215
215
  // Hooks 生命周期(v0.4.212+):兼容旧 pre/post 字符串,同时支持 events.<EventName> 结构化 JSON hook。
216
216
  hooks: z.object({
@@ -244,8 +244,8 @@ var ConfigSchema = z.object({
244
244
  networkPolicy: z.object({
245
245
  enabled: z.boolean().default(false),
246
246
  defaultAction: z.enum(["allow", "confirm", "deny"]).default("confirm"),
247
- allowDomains: z.array(z.string()).default([]),
248
- denyDomains: z.array(z.string()).default([]),
247
+ allowDomains: z.array(z.string().max(500)).max(100).default([]),
248
+ denyDomains: z.array(z.string().max(500)).max(100).default([]),
249
249
  allowPorts: z.array(z.number().int().min(1).max(65535)).default([]),
250
250
  denyPorts: z.array(z.number().int().min(1).max(65535)).default([]),
251
251
  allowPrivateNetwork: z.boolean().default(false),
@@ -259,7 +259,7 @@ var ConfigSchema = z.object({
259
259
  }).default({ enabled: false, defaultAction: "confirm", allowDomains: [], denyDomains: [], allowPorts: [], denyPorts: [], allowPrivateNetwork: false, tools: {} }),
260
260
  // 权限 Profile(v0.4.211+):legacy 保持旧行为;其余 profile 提供更清晰的安全边界。
261
261
  defaultPermissionProfile: z.enum(["legacy", "read-only", "workspace-write", "danger-full-access"]).default("legacy"),
262
- allowedPermissionProfiles: z.array(z.string()).default(["legacy", "read-only", "workspace-write", "danger-full-access"]),
262
+ allowedPermissionProfiles: z.array(z.string().max(50)).max(20).default(["legacy", "read-only", "workspace-write", "danger-full-access"]),
263
263
  permissionProfiles: z.record(z.object({
264
264
  extends: z.enum(["legacy", "read-only", "workspace-write", "danger-full-access"]).optional(),
265
265
  defaultAction: z.enum(["auto-approve", "deny", "confirm"]).optional(),
@@ -276,7 +276,7 @@ var ConfigSchema = z.object({
276
276
  })).default({}),
277
277
  // 工具权限规则(按顺序匹配第一个生效;作为当前权限 Profile 内的细粒度规则)
278
278
  permissionRules: z.array(z.object({
279
- tool: z.string(),
279
+ tool: z.string().max(100),
280
280
  action: z.enum(["auto-approve", "deny", "confirm"]),
281
281
  when: z.object({
282
282
  dangerLevel: z.enum(["safe", "write", "destructive"]).optional(),
@@ -334,7 +334,7 @@ var ConfigSchema = z.object({
334
334
  redactOnSave: z.boolean().default(true),
335
335
  redactOnSend: z.boolean().default(false),
336
336
  mode: z.enum(["default", "strict", "off"]).default("default"),
337
- customPatterns: z.array(z.string()).default([])
337
+ customPatterns: z.array(z.string().max(200)).max(50).default([])
338
338
  }).default({}),
339
339
  // 智能模型路由(v0.4.68+)
340
340
  // 按用户每轮输入的内容/标签/长度动态选择模型,在同一 provider 内切换,
@@ -346,13 +346,13 @@ var ConfigSchema = z.object({
346
346
  enabled: z.boolean().default(false),
347
347
  rules: z.array(z.object({
348
348
  match: z.object({
349
- contains: z.array(z.string()).optional(),
349
+ contains: z.array(z.string().max(200)).max(50).optional(),
350
350
  maxLength: z.number().int().positive().optional(),
351
351
  minLength: z.number().int().positive().optional(),
352
352
  tag: z.string().optional()
353
353
  }),
354
354
  model: z.string(),
355
- name: z.string().optional()
355
+ name: z.string().max(100).optional()
356
356
  })).default([]),
357
357
  fallback: z.string().optional()
358
358
  }).default({ enabled: false, rules: [] }),
@@ -372,7 +372,7 @@ var ConfigSchema = z.object({
372
372
  maxBackoffMs: z.number().int().positive().default(8e3),
373
373
  /** 兜底 provider 链,每个 entry 仅尝试 1 次。model 省略则使用 provider 的 defaultModel。 */
374
374
  chain: z.array(z.object({
375
- provider: z.string(),
375
+ provider: z.string().max(100),
376
376
  model: z.string().optional()
377
377
  })).default([])
378
378
  }).default({ enabled: false, retries: 2, initialBackoffMs: 500, maxBackoffMs: 8e3, chain: [] })
@@ -1692,7 +1692,44 @@ var HALLUCINATION_PATTERNS = [
1692
1692
  // “以下是图片的内容:”“以下是修改后的内容:”这类描述/对话。
1693
1693
  /以下是[^\n。.!!??]*?(?:教案|试卷|讲义|课件|课程|文件|文档|脚本|配置|程序|报告|表格|清单)[^\n。.!!??]{0,8}(?:内容)?[::]/
1694
1694
  ];
1695
+ var QUICK_WRITE_KEYWORDS = [
1696
+ // 中文写入动作
1697
+ "\u5DF2\u4FDD\u5B58",
1698
+ "\u5DF2\u5199\u5165",
1699
+ "\u5DF2\u521B\u5EFA",
1700
+ "\u5DF2\u751F\u6210",
1701
+ "\u751F\u6210\u5B8C\u6210",
1702
+ "\u4FDD\u5B58",
1703
+ "\u5199\u5165",
1704
+ "\u521B\u5EFA",
1705
+ "\u751F\u6210",
1706
+ // 中文文档名
1707
+ "\u6587\u4EF6",
1708
+ "\u6559\u6848",
1709
+ "\u8BD5\u5377",
1710
+ "\u8BB2\u4E49",
1711
+ "\u8BFE\u4EF6",
1712
+ "\u6587\u6863",
1713
+ "\u811A\u672C",
1714
+ "\u914D\u7F6E",
1715
+ "\u7A0B\u5E8F",
1716
+ "\u62A5\u544A",
1717
+ "\u8868\u683C",
1718
+ "\u6E05\u5355",
1719
+ "\u7B14\u8BB0",
1720
+ // 英文写入动作
1721
+ "saved",
1722
+ "written",
1723
+ "created",
1724
+ "File",
1725
+ "file",
1726
+ // emoji 勾选标记
1727
+ "\u2705"
1728
+ ];
1695
1729
  function detectsHallucinatedFileOp(content) {
1730
+ if (!QUICK_WRITE_KEYWORDS.some((kw) => content.includes(kw))) {
1731
+ return false;
1732
+ }
1696
1733
  return HALLUCINATION_PATTERNS.some((pattern) => pattern.test(content));
1697
1734
  }
1698
1735
  function hadPreviousWriteToolCalls(extraMessages) {
@@ -3966,18 +4003,32 @@ var ProviderRegistry = class {
3966
4003
  configDir;
3967
4004
  async initialize(getApiKey, getOptions, customProviderConfigs, configDir) {
3968
4005
  this.configDir = configDir;
3969
- for (const ProviderClass of BUILT_IN_PROVIDERS) {
4006
+ const initTasks = BUILT_IN_PROVIDERS.map(async (ProviderClass) => {
3970
4007
  const provider = new ProviderClass();
3971
4008
  const apiKey = getApiKey(provider.info.id);
3972
4009
  if (apiKey || !provider.info.requiresApiKey) {
3973
4010
  const options = getOptions?.(provider.info.id) ?? {};
4011
+ const pInit = provider.initialize(apiKey ?? "", options);
4012
+ return { provider, pInit, requiresApiKey: !!provider.info.requiresApiKey };
4013
+ }
4014
+ return null;
4015
+ });
4016
+ const settled = await Promise.allSettled(
4017
+ initTasks.map(async (task) => {
4018
+ const result = await task;
4019
+ if (!result) return;
4020
+ const { provider, pInit, requiresApiKey } = result;
3974
4021
  try {
3975
- await provider.initialize(apiKey ?? "", options);
4022
+ await pInit;
3976
4023
  this.providers.set(provider.info.id, provider);
3977
4024
  } catch (err) {
3978
- if (provider.info.requiresApiKey) throw err;
4025
+ if (requiresApiKey) throw err;
3979
4026
  }
3980
- }
4027
+ })
4028
+ );
4029
+ const keyErrors = settled.filter((r) => r.status === "rejected").map((r) => r.reason);
4030
+ if (keyErrors.length > 0) {
4031
+ throw keyErrors[0];
3981
4032
  }
3982
4033
  this.customConfigs = customProviderConfigs ?? [];
3983
4034
  for (const cfg of this.customConfigs) {
@@ -5331,14 +5382,19 @@ Important rules:
5331
5382
  );
5332
5383
  }
5333
5384
  if (status !== 0 || timedOut) {
5334
- throw {
5335
- status,
5336
- signal: null,
5337
- code: timedOut ? "ETIMEDOUT" : void 0,
5338
- stdout: Buffer.from(stdout, "utf-8"),
5339
- stderr: Buffer.from(stderr, "utf-8"),
5340
- message: timedOut ? "ETIMEDOUT" : `exit ${status}`
5341
- };
5385
+ const poolStdout = (stdout ?? "").trim();
5386
+ const poolStderr = (stderr ?? "").trim();
5387
+ const combined = [poolStdout, poolStderr].filter(Boolean).join("\n");
5388
+ const hint = buildErrorHint(command, combined);
5389
+ throw new ToolError(
5390
+ "bash",
5391
+ `Exit code ${status}:
5392
+ ${combined || `exit ${status}`}
5393
+
5394
+ ` + (hint ? `${hint}
5395
+
5396
+ ` : "") + `[Command failed. Report this error to the user. Do not retry with variant commands.]`
5397
+ );
5342
5398
  }
5343
5399
  pushBashUndoEntries(beforeSnapshot, parsedTargetsBefore, effectiveCwd);
5344
5400
  updateCwdFromCommand(command, effectiveCwd);
@@ -7262,7 +7318,7 @@ var ToolExecutor = class {
7262
7318
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
7263
7319
  return { callId: call.id, content, isError: false };
7264
7320
  } catch (err) {
7265
- const message = err instanceof Error ? err.message : String(err);
7321
+ const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
7266
7322
  this.printToolResult(call.name, message, true, false);
7267
7323
  runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
7268
7324
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
@@ -7307,7 +7363,7 @@ var ToolExecutor = class {
7307
7363
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
7308
7364
  return { callId: call.id, content, isError: false };
7309
7365
  } catch (err) {
7310
- const message = err instanceof Error ? err.message : String(err);
7366
+ const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
7311
7367
  this.printToolResult(call.name, message, true, false);
7312
7368
  runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
7313
7369
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
@@ -7328,7 +7384,7 @@ var ToolExecutor = class {
7328
7384
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
7329
7385
  return { callId: call.id, content, isError: false };
7330
7386
  } catch (err) {
7331
- const message = err instanceof Error ? err.message : String(err);
7387
+ const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
7332
7388
  this.printToolResult(call.name, message, true, false);
7333
7389
  runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
7334
7390
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
@@ -7368,7 +7424,7 @@ var ToolExecutor = class {
7368
7424
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
7369
7425
  return { callId: call.id, content, isError: false };
7370
7426
  } catch (err) {
7371
- const message = err instanceof Error ? err.message : String(err);
7427
+ const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
7372
7428
  this.printToolResult(call.name, message, true, false);
7373
7429
  runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
7374
7430
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
@@ -7454,7 +7510,7 @@ var ToolExecutor = class {
7454
7510
  this.printToolResult(call.name, rawContent, false, wasTruncated);
7455
7511
  results[i] = { callId: call.id, content, isError: false };
7456
7512
  } catch (err) {
7457
- const message = err instanceof Error ? err.message : String(err);
7513
+ const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
7458
7514
  this.printToolResult(call.name, message, true, false);
7459
7515
  results[i] = { callId: call.id, content: message, isError: true };
7460
7516
  }
@@ -13309,7 +13365,7 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
13309
13365
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
13310
13366
  return { callId: call.id, content, isError: false };
13311
13367
  } catch (err) {
13312
- const message = err instanceof Error ? err.message : String(err);
13368
+ const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
13313
13369
  this.sendToolCallResult(call, message, true);
13314
13370
  runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
13315
13371
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
@@ -13348,7 +13404,7 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
13348
13404
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
13349
13405
  return { callId: call.id, content, isError: false };
13350
13406
  } catch (err) {
13351
- const message = err instanceof Error ? err.message : String(err);
13407
+ const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
13352
13408
  this.sendToolCallResult(call, message, true);
13353
13409
  runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
13354
13410
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
@@ -13365,7 +13421,7 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
13365
13421
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
13366
13422
  return { callId: call.id, content, isError: false };
13367
13423
  } catch (err) {
13368
- const message = err instanceof Error ? err.message : String(err);
13424
+ const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
13369
13425
  this.sendToolCallResult(call, message, true);
13370
13426
  runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
13371
13427
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
@@ -13389,7 +13445,7 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
13389
13445
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
13390
13446
  return { callId: call.id, content, isError: false };
13391
13447
  } catch (err) {
13392
- const message = err instanceof Error ? err.message : String(err);
13448
+ const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
13393
13449
  this.sendToolCallResult(call, message, true);
13394
13450
  runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
13395
13451
  runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
@@ -13452,7 +13508,7 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
13452
13508
  this.sendToolCallResult(call, rawContent, false);
13453
13509
  results[i] = { callId: call.id, content, isError: false };
13454
13510
  } catch (err) {
13455
- const message = err instanceof Error ? err.message : String(err);
13511
+ const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
13456
13512
  this.sendToolCallResult(call, message, true);
13457
13513
  results[i] = { callId: call.id, content: message, isError: true };
13458
13514
  }
@@ -16017,7 +16073,7 @@ async function handleSecurityReview(args, ctx) {
16017
16073
  async function handleTest(args, ctx) {
16018
16074
  ctx.send({ type: "info", message: "\u{1F9EA} Running tests..." });
16019
16075
  try {
16020
- const { executeTests } = await import("./run-tests-DGV6D4L3.js");
16076
+ const { executeTests } = await import("./run-tests-QVXDTJ3O.js");
16021
16077
  const argStr = args.join(" ").trim();
16022
16078
  let testArgs = {};
16023
16079
  if (argStr) {
@@ -3,7 +3,7 @@ import {
3
3
  assignRoleColors,
4
4
  renderHubBanner,
5
5
  renderHubEvent
6
- } from "./chunk-2X2DOHA6.js";
6
+ } from "./chunk-NR5U6LVG.js";
7
7
  import {
8
8
  DiscussionOrchestrator,
9
9
  getPreset,
@@ -154,7 +154,7 @@ ${content}`);
154
154
  }
155
155
  }
156
156
  async function runTaskMode(config, providers, configManager, topic) {
157
- const { TaskOrchestrator } = await import("./task-orchestrator-YSHHXWNT.js");
157
+ const { TaskOrchestrator } = await import("./task-orchestrator-FA4KOVD2.js");
158
158
  const orchestrator = new TaskOrchestrator(config, providers, configManager);
159
159
  let interrupted = false;
160
160
  const onSigint = () => {
@@ -190,7 +190,7 @@ async function runTaskMode(config, providers, configManager, topic) {
190
190
  }
191
191
  }
192
192
  async function runDistributedDiscussion(config, providers, topic, port) {
193
- const { HubServer } = await import("./hub-server-XX36DX7O.js");
193
+ const { HubServer } = await import("./hub-server-XA7HTVLD.js");
194
194
  const hub = new HubServer(config, providers, port);
195
195
  let interrupted = false;
196
196
  const onSigint = () => {
@@ -10,7 +10,7 @@ import {
10
10
  renderRoundHeader,
11
11
  renderSummary,
12
12
  renderUserInterrupt
13
- } from "./chunk-2X2DOHA6.js";
13
+ } from "./chunk-NR5U6LVG.js";
14
14
  import {
15
15
  HubAgent
16
16
  } from "./chunk-3ARPAVNV.js";
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  scanProject,
15
15
  sessionHasMeaningfulContent,
16
16
  setupProxy
17
- } from "./chunk-S4AKNVFK.js";
17
+ } from "./chunk-SJ36SUG7.js";
18
18
  import {
19
19
  buildReviewPrompt,
20
20
  buildSecurityReviewPrompt
@@ -52,7 +52,7 @@ import {
52
52
  theme,
53
53
  undoStack,
54
54
  updateMemoryApproval
55
- } from "./chunk-APBHCIPD.js";
55
+ } from "./chunk-DMF6UHO6.js";
56
56
  import "./chunk-K3CF65QH.js";
57
57
  import "./chunk-UUSRWSSX.js";
58
58
  import "./chunk-CKH4KQ4E.js";
@@ -63,7 +63,7 @@ import {
63
63
  } from "./chunk-QYQCCIBT.js";
64
64
  import {
65
65
  CostTracker
66
- } from "./chunk-CITDVXXM.js";
66
+ } from "./chunk-YVMACMXW.js";
67
67
  import {
68
68
  computeCost,
69
69
  formatCost,
@@ -74,10 +74,10 @@ import {
74
74
  formatDoctorReport,
75
75
  loadContextFiles,
76
76
  writeCrashLog
77
- } from "./chunk-WJJIP34H.js";
77
+ } from "./chunk-QFOJ4GXC.js";
78
78
  import {
79
79
  ProviderRegistry
80
- } from "./chunk-PUBCJF7E.js";
80
+ } from "./chunk-EEQHP4GK.js";
81
81
  import {
82
82
  describePlugin,
83
83
  getActivePluginAssets,
@@ -94,7 +94,7 @@ import {
94
94
  trustHook,
95
95
  trustPlugin,
96
96
  untrustHook
97
- } from "./chunk-7X5TVGVY.js";
97
+ } from "./chunk-TEXAIWUJ.js";
98
98
  import {
99
99
  CONTENT_ONLY_STREAM_REMINDER,
100
100
  TEE_FINAL_USER_NUDGE,
@@ -113,10 +113,10 @@ import {
113
113
  stripOuterCodeFence,
114
114
  stripToolCallReminder,
115
115
  teeStreamErrorSummary
116
- } from "./chunk-XPBEJB27.js";
116
+ } from "./chunk-ODYTXQ26.js";
117
117
  import {
118
118
  ConfigManager
119
- } from "./chunk-6LQ6PUNZ.js";
119
+ } from "./chunk-FEVOW3NQ.js";
120
120
  import {
121
121
  AuthError,
122
122
  ProviderError,
@@ -130,7 +130,7 @@ import {
130
130
  import {
131
131
  fileCheckpoints
132
132
  } from "./chunk-4BKXL7SM.js";
133
- import "./chunk-DKJ5EFKA.js";
133
+ import "./chunk-AEXWMIRE.js";
134
134
  import {
135
135
  AGENTIC_BEHAVIOR_GUIDELINE,
136
136
  AUTHOR,
@@ -149,7 +149,7 @@ import {
149
149
  SKILLS_DIR_NAME,
150
150
  VERSION,
151
151
  buildUserIdentityPrompt
152
- } from "./chunk-CYVVWFFO.js";
152
+ } from "./chunk-B3POS7LB.js";
153
153
  import {
154
154
  buildChatIndex,
155
155
  clearChatIndex,
@@ -1834,7 +1834,7 @@ No tools match "${filter}".
1834
1834
  const { join: join7 } = await import("path");
1835
1835
  const { existsSync: existsSync6 } = await import("fs");
1836
1836
  const { getGitRoot: getGitRoot2 } = await import("./git-context-EXOEHQSF.js");
1837
- const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-HLNS4O5H.js");
1837
+ const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-J2MSGNFA.js");
1838
1838
  const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
1839
1839
  const cwd = process.cwd();
1840
1840
  const projectRoot = getGitRoot2(cwd) ?? cwd;
@@ -2813,7 +2813,7 @@ function createReviewCommands() {
2813
2813
  usage: "/test [command|filter]",
2814
2814
  async execute(args, ctx) {
2815
2815
  try {
2816
- const { executeTests } = await import("./run-tests-QFYTNPSV.js");
2816
+ const { executeTests } = await import("./run-tests-WBGQI5V7.js");
2817
2817
  const argStr = args.join(" ").trim();
2818
2818
  let testArgs = {};
2819
2819
  if (argStr) {
@@ -7758,7 +7758,7 @@ program.command("web").description("Start Web UI server with browser-based chat
7758
7758
  console.error("Error: Invalid port number. Must be between 1 and 65535.");
7759
7759
  process.exit(1);
7760
7760
  }
7761
- const { startWebServer } = await import("./server-ZQYQDQMT.js");
7761
+ const { startWebServer } = await import("./server-LYTXYK6Y.js");
7762
7762
  await startWebServer({ port, host: options.host });
7763
7763
  });
7764
7764
  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) => {
@@ -7925,11 +7925,11 @@ program.command("sessions").description("List recent conversation sessions").opt
7925
7925
  console.log(footer + "\n");
7926
7926
  });
7927
7927
  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) => {
7928
- const { runUsageCli } = await import("./usage-QDSXUKN7.js");
7928
+ const { runUsageCli } = await import("./usage-EHV6YVGH.js");
7929
7929
  await runUsageCli(options);
7930
7930
  });
7931
7931
  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) => {
7932
- const { runDoctorCli } = await import("./doctor-cli-LA4AF6DK.js");
7932
+ const { runDoctorCli } = await import("./doctor-cli-3VNTECP2.js");
7933
7933
  const argv = process.argv.slice(2);
7934
7934
  await runDoctorCli({
7935
7935
  json: !!options.json || argv.includes("--json"),
@@ -7938,7 +7938,7 @@ program.command("doctor").description("Health check: API keys, config, MCP, rece
7938
7938
  });
7939
7939
  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) => {
7940
7940
  try {
7941
- const batch = await import("./batch-W2DJGST7.js");
7941
+ const batch = await import("./batch-XZHTNJXJ.js");
7942
7942
  switch (action) {
7943
7943
  case "submit":
7944
7944
  if (!arg) {
@@ -7981,7 +7981,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
7981
7981
  }
7982
7982
  });
7983
7983
  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) => {
7984
- const { startMcpServer } = await import("./server-GTIVGJ6S.js");
7984
+ const { startMcpServer } = await import("./server-5RXWIX4I.js");
7985
7985
  await startMcpServer({
7986
7986
  allowDestructive: !!options.allowDestructive,
7987
7987
  allowOutsideCwd: !!options.allowOutsideCwd,
@@ -7994,7 +7994,7 @@ program.command("pr <action> [target]").description("PR review helpers: review |
7994
7994
  console.error(`Unknown pr action: ${action}. Use review | security-review | summarize.`);
7995
7995
  process.exit(1);
7996
7996
  }
7997
- const { runPrCli } = await import("./pr-CDJFUPZX.js");
7997
+ const { runPrCli } = await import("./pr-HY2QCVUY.js");
7998
7998
  const result = await runPrCli({
7999
7999
  action,
8000
8000
  target,
@@ -8014,8 +8014,8 @@ program.command("pr <action> [target]").description("PR review helpers: review |
8014
8014
  process.exit(result.exitCode);
8015
8015
  });
8016
8016
  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) => {
8017
- const { runCi } = await import("./ci-PEOV2I3Z.js");
8018
- const { formatCiResult } = await import("./ci-format-4O7SHP4F.js");
8017
+ const { runCi } = await import("./ci-ZCVDKFXY.js");
8018
+ const { formatCiResult } = await import("./ci-format-CKXDFTN3.js");
8019
8019
  const formats = [options.json, options.markdown, options.sarif].filter(Boolean).length;
8020
8020
  if (formats > 1) {
8021
8021
  console.error("Choose only one output format: --json, --markdown, or --sarif.");
@@ -8173,7 +8173,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
8173
8173
  config.get("customProviders"),
8174
8174
  config.getConfigDir()
8175
8175
  );
8176
- const { startHub } = await import("./hub-MAJE7GB7.js");
8176
+ const { startHub } = await import("./hub-LIH5JEI7.js");
8177
8177
  await startHub(
8178
8178
  {
8179
8179
  topic: topic ?? "",
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  countSeverity,
4
4
  runCi
5
- } from "./chunk-OMFVR2O7.js";
6
- import "./chunk-NBG2STGM.js";
5
+ } from "./chunk-PQLRX7US.js";
6
+ import "./chunk-AXIMNQSY.js";
7
7
  import {
8
8
  buildReviewPrompt,
9
9
  buildSecurityReviewPrompt,
@@ -11,15 +11,15 @@ import {
11
11
  } from "./chunk-HLWUDRBO.js";
12
12
  import {
13
13
  ProviderRegistry
14
- } from "./chunk-PUBCJF7E.js";
15
- import "./chunk-XPBEJB27.js";
14
+ } from "./chunk-EEQHP4GK.js";
15
+ import "./chunk-ODYTXQ26.js";
16
16
  import {
17
17
  ConfigManager
18
- } from "./chunk-6LQ6PUNZ.js";
18
+ } from "./chunk-FEVOW3NQ.js";
19
19
  import "./chunk-5ULLIOVC.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-CYVVWFFO.js";
22
+ } from "./chunk-B3POS7LB.js";
23
23
  import "./chunk-IW3Q7AE5.js";
24
24
 
25
25
  // src/cli/pr.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeTests,
3
3
  runTestsTool
4
- } from "./chunk-YK5DDJNH.js";
4
+ } from "./chunk-QCGKCNBX.js";
5
5
  export {
6
6
  executeTests,
7
7
  runTestsTool