jinzd-ai-cli 0.4.286 → 0.4.288

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-YAEXKK2C.js} +2 -2
  2. package/dist/{chunk-BRLLV3FX.js → chunk-37WBQV3E.js} +90 -127
  3. package/dist/{chunk-EYUCJBGS.js → chunk-5G6HX57U.js} +1 -1
  4. package/dist/{chunk-S7ABWTDV.js → chunk-6NEEFOVF.js} +1 -1
  5. package/dist/{chunk-7G7RZHJI.js → chunk-7RC7AN6V.js} +1 -1
  6. package/dist/{chunk-UGY5SVNX.js → chunk-ALSSNFNK.js} +94 -4
  7. package/dist/{chunk-6SCELZG6.js → chunk-C5UAM4X7.js} +4 -4
  8. package/dist/{chunk-L4FDTQ42.js → chunk-E66SCDTD.js} +1 -1
  9. package/dist/{chunk-D7HYLMCC.js → chunk-EYA4IXQJ.js} +1 -1
  10. package/dist/{chunk-2YDLBM3Z.js → chunk-G5QZS5TN.js} +1 -1
  11. package/dist/{chunk-UKITSNSH.js → chunk-JBNNJ32H.js} +1 -1
  12. package/dist/{chunk-53V3RQY5.js → chunk-NJDQCQ7P.js} +7 -7
  13. package/dist/{chunk-THUXZNJL.js → chunk-O4CZPTPU.js} +1 -1
  14. package/dist/{chunk-GIJL4EFA.js → chunk-U4NQ2IRE.js} +1 -1
  15. package/dist/{chunk-3ZQZO5F7.js → chunk-WQ2YQ5YC.js} +4 -4
  16. package/dist/{ci-JBUIVM7P.js → ci-RO2NLIRH.js} +5 -5
  17. package/dist/{ci-format-B4AHV5SI.js → ci-format-GBSRK2J4.js} +2 -2
  18. package/dist/{constants-P75MLFV7.js → constants-JQP6BENR.js} +1 -1
  19. package/dist/{constants-5FYUQLKN.js → constants-T2B3SBMR.js} +1 -1
  20. package/dist/{doctor-cli-VLFE46PX.js → doctor-cli-CVOE7FAE.js} +5 -5
  21. package/dist/electron-server.js +211 -239
  22. package/dist/{hub-CNORVRYW.js → hub-LFWL5PGH.js} +1 -1
  23. package/dist/index.js +18 -18
  24. package/dist/{persistent-memory-LVX2OT4L.js → persistent-memory-4UR27ACM.js} +2 -2
  25. package/dist/{persistent-memory-3KL4N27E.js → persistent-memory-LFE3YHZO.js} +2 -2
  26. package/dist/{pr-2YUV4KII.js → pr-3QAG7XO7.js} +5 -5
  27. package/dist/{run-tests-KZ2IUZHK.js → run-tests-GGNFI7CL.js} +2 -2
  28. package/dist/{run-tests-ERD6X534.js → run-tests-R3JB4UEI.js} +2 -2
  29. package/dist/{server-A3OX52UC.js → server-I6DXVJRO.js} +40 -115
  30. package/dist/{server-7VSLW446.js → server-THHSJRNI.js} +5 -5
  31. package/dist/{task-orchestrator-XAMKOFUE.js → task-orchestrator-6HH3KQUQ.js} +5 -5
  32. package/dist/{usage-ZXNYCAZB.js → usage-UB4ZT5PE.js} +2 -2
  33. package/package.json +1 -1
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-NJDQCQ7P.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-37WBQV3E.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-JBNNJ32H.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-C5UAM4X7.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-5G6HX57U.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-7RC7AN6V.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-6NEEFOVF.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-O4CZPTPU.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-I6DXVJRO.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-UB4ZT5PE.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-CVOE7FAE.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-YAEXKK2C.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-THHSJRNI.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-3QAG7XO7.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-RO2NLIRH.js");
4250
+ const { formatCiResult } = await import("./ci-format-GBSRK2J4.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-LFWL5PGH.js");
4409
4409
  await startHub(
4410
4410
  {
4411
4411
  topic: topic ?? "",
@@ -28,11 +28,11 @@ import {
28
28
  touchMemoryReferences,
29
29
  updateMemoryApproval,
30
30
  updateMemoryEntry
31
- } from "./chunk-UKITSNSH.js";
31
+ } from "./chunk-JBNNJ32H.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-O4CZPTPU.js";
36
36
  export {
37
37
  addMemoryEntry,
38
38
  backupMemoryStore,
@@ -27,11 +27,11 @@ import {
27
27
  touchMemoryReferences,
28
28
  updateMemoryApproval,
29
29
  updateMemoryEntry
30
- } from "./chunk-D7HYLMCC.js";
30
+ } from "./chunk-EYA4IXQJ.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-U4NQ2IRE.js";
35
35
  export {
36
36
  addMemoryEntry,
37
37
  backupMemoryStore,
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  countSeverity,
4
4
  runCi
5
- } from "./chunk-3ZQZO5F7.js";
6
- import "./chunk-2YDLBM3Z.js";
5
+ } from "./chunk-WQ2YQ5YC.js";
6
+ import "./chunk-G5QZS5TN.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-7RC7AN6V.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-O4CZPTPU.js";
27
27
 
28
28
  // src/cli/pr.ts
29
29
  import { execFileSync } from "child_process";
@@ -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-6NEEFOVF.js";
6
+ import "./chunk-O4CZPTPU.js";
7
7
  export {
8
8
  executeTests,
9
9
  runTestsTool
@@ -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-E66SCDTD.js";
5
+ import "./chunk-U4NQ2IRE.js";
6
6
  export {
7
7
  executeTests,
8
8
  runTestsTool
@@ -81,7 +81,7 @@ import {
81
81
  skillHistoryNote,
82
82
  snapshotFile,
83
83
  stripRoutingTags
84
- } from "./chunk-53V3RQY5.js";
84
+ } from "./chunk-NJDQCQ7P.js";
85
85
  import {
86
86
  CNY_PER_USD,
87
87
  CostTracker,
@@ -100,9 +100,11 @@ import {
100
100
  cleanupRejectedTeeFile,
101
101
  clearBashSession,
102
102
  clearRecentlyDeniedAutoActions,
103
+ decideToolGate,
103
104
  defaultActionClassifier,
104
105
  estimateTokens,
105
106
  formatPermissionProfileWarning,
107
+ gateMessages,
106
108
  getPreferredAgentName,
107
109
  getRecentlyDeniedAutoActions,
108
110
  googleSearchContext,
@@ -110,6 +112,7 @@ import {
110
112
  isToolCapableProvider,
111
113
  listAgentConfigs,
112
114
  listAgentRuns,
115
+ needsPermissionRequestHook,
113
116
  recordRecentlyDeniedAutoAction,
114
117
  renderDiff,
115
118
  requestAgentStop,
@@ -123,7 +126,7 @@ import {
123
126
  spawnAgentContext,
124
127
  truncateOutput,
125
128
  undoStack
126
- } from "./chunk-BRLLV3FX.js";
129
+ } from "./chunk-37WBQV3E.js";
127
130
  import {
128
131
  buildReviewPrompt,
129
132
  buildSecurityReviewPrompt
@@ -150,7 +153,7 @@ import {
150
153
  restoreMemoryEntries,
151
154
  updateMemoryApproval,
152
155
  updateMemoryEntry
153
- } from "./chunk-UKITSNSH.js";
156
+ } from "./chunk-JBNNJ32H.js";
154
157
  import "./chunk-4DEMGCK4.js";
155
158
  import "./chunk-UUSRWSSX.js";
156
159
  import "./chunk-CKH4KQ4E.js";
@@ -169,7 +172,7 @@ import {
169
172
  buildDoctorReport,
170
173
  formatDoctorReport,
171
174
  loadContextFiles
172
- } from "./chunk-6SCELZG6.js";
175
+ } from "./chunk-C5UAM4X7.js";
173
176
  import {
174
177
  describePlugin,
175
178
  getActivePluginAssets,
@@ -184,14 +187,14 @@ import {
184
187
  runTool,
185
188
  setPluginEnabled,
186
189
  trustPlugin
187
- } from "./chunk-EYUCJBGS.js";
190
+ } from "./chunk-5G6HX57U.js";
188
191
  import "./chunk-RS7SKYTS.js";
189
192
  import {
190
193
  ProviderRegistry
191
- } from "./chunk-UGY5SVNX.js";
194
+ } from "./chunk-ALSSNFNK.js";
192
195
  import {
193
196
  ConfigManager
194
- } from "./chunk-7G7RZHJI.js";
197
+ } from "./chunk-7RC7AN6V.js";
195
198
  import {
196
199
  CONTENT_ONLY_STREAM_REMINDER,
197
200
  TEE_FINAL_USER_NUDGE,
@@ -221,7 +224,7 @@ import {
221
224
  maskConfigSecrets
222
225
  } from "./chunk-XNFIYS7G.js";
223
226
  import "./chunk-4BKXL7SM.js";
224
- import "./chunk-S7ABWTDV.js";
227
+ import "./chunk-6NEEFOVF.js";
225
228
  import {
226
229
  AGENTIC_BEHAVIOR_GUIDELINE,
227
230
  AUTHOR,
@@ -237,7 +240,7 @@ import {
237
240
  SKILLS_DIR_NAME,
238
241
  VERSION,
239
242
  buildUserIdentityPrompt
240
- } from "./chunk-THUXZNJL.js";
243
+ } from "./chunk-O4CZPTPU.js";
241
244
 
242
245
  // src/web/server.ts
243
246
  import express from "express";
@@ -488,15 +491,6 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
488
491
  { configDir: this.hookConfigDir, onSummary: (message) => this.send({ type: "info", message: `[hook] ${message}` }) }
489
492
  );
490
493
  const preDeny = preToolDecisions.find((d) => d.action === "deny");
491
- if (preDeny) {
492
- const result = {
493
- callId: call.id,
494
- content: `[Hook denied] ${preDeny.reason ?? `PreToolUse blocked ${call.name}`}. Do not retry without asking.`,
495
- isError: true
496
- };
497
- this.sendToolCallResult(call, result.content, true);
498
- return result;
499
- }
500
494
  for (const d of preToolDecisions) {
501
495
  const warnings = [d.warning, ...d.warnings ?? []].filter(Boolean);
502
496
  for (const warning of warnings) this.send({ type: "info", message: `[hook] ${warning}` });
@@ -516,7 +510,19 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
516
510
  }
517
511
  );
518
512
  const networkPermission = checkNetworkPolicy(call.name, call.arguments, this.networkPolicy);
519
- if (networkPermission?.action === "confirm" || permission.action === "confirm") {
513
+ const gate = decideToolGate(call, {
514
+ dangerLevel,
515
+ permission,
516
+ networkPermission,
517
+ hookDeny: preDeny ? { reason: preDeny.reason } : void 0,
518
+ sessionAutoMode: this.sessionAutoMode,
519
+ sessionAutoApprove: this.sessionAutoApprove,
520
+ classify: () => defaultActionClassifier.classify(call, dangerLevel, {
521
+ workspaceRoot: this.workspaceRoot,
522
+ tempDirs: [tmpdir()]
523
+ })
524
+ });
525
+ if (needsPermissionRequestHook({ permission, networkPermission })) {
520
526
  runLifecycleHooks(
521
527
  this.hookConfig,
522
528
  "PermissionRequest",
@@ -524,105 +530,24 @@ var ToolExecutorWeb = class _ToolExecutorWeb {
524
530
  { configDir: this.hookConfigDir, onSummary: (message) => this.send({ type: "info", message: "[hook] " + message }) }
525
531
  );
526
532
  }
527
- if (networkPermission?.action === "deny") {
528
- const reason = networkPermission.reason ? ` (${networkPermission.reason})` : "";
529
- return {
530
- callId: call.id,
531
- content: `[Permission denied] Tool ${call.name} is blocked by networkPolicy${reason}. Do not retry.`,
532
- isError: true
533
- };
533
+ if (gate.kind === "denied") {
534
+ if (gate.source === "auto-mode") recordRecentlyDeniedAutoAction(call, gate.classification);
535
+ this.sendToolCallResult(call, gate.message, true);
536
+ return { callId: call.id, content: gate.message, isError: true };
534
537
  }
535
- if (permission.action === "deny") {
536
- const reason = permission.reason ? ` (${permission.reason})` : "";
537
- return {
538
- callId: call.id,
539
- content: `[Permission denied] Tool ${call.name} is blocked by permission profile "${permission.profileName}"${reason}. Do not retry.`,
540
- isError: true
541
- };
542
- }
543
- if (permission.action === "auto-approve" && networkPermission?.action !== "confirm") {
544
- this.sendToolCallStart(call);
545
- try {
546
- const rawContent = await runTool(tool, call.arguments, call.name);
547
- const content = truncateOutput(rawContent, call.name);
548
- this.sendToolCallResult(call, rawContent, false);
549
- runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "ok" });
550
- runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
551
- return { callId: call.id, content, isError: false };
552
- } catch (err) {
553
- const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
554
- this.sendToolCallResult(call, message, true);
555
- runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
556
- runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
557
- return { callId: call.id, content: message, isError: true };
538
+ if (gate.kind === "confirm") {
539
+ if (!toolCallStarted) {
540
+ this.sendToolCallStart(call);
541
+ toolCallStarted = true;
558
542
  }
559
- }
560
- const requiresHardConfirmation = permission.action === "confirm" && permission.hardBoundary === true;
561
- if ((networkPermission?.action === "confirm" || requiresHardConfirmation) && dangerLevel === "safe") {
562
- this.sendToolCallStart(call);
563
- toolCallStarted = true;
564
- const confirmed = await this.confirm(call, "write");
543
+ const confirmed = await this.confirm(call, gate.level);
565
544
  if (!confirmed) {
566
- const rejectionMsg = `[User cancelled] The user declined permission for ${call.name}. Do not retry without asking.`;
545
+ const rejectionMsg = gate.source === "permission" ? gateMessages.permissionCancelled(call.name) : gateMessages.operationCancelled(call.name, gate.level);
567
546
  this.sendToolCallResult(call, rejectionMsg, true);
568
547
  return { callId: call.id, content: rejectionMsg, isError: true };
569
548
  }
570
549
  }
571
550
  if (!toolCallStarted) this.sendToolCallStart(call);
572
- if (this.sessionAutoMode && networkPermission?.action !== "confirm") {
573
- const classification = defaultActionClassifier.classify(call, dangerLevel, {
574
- workspaceRoot: this.workspaceRoot,
575
- tempDirs: [tmpdir()]
576
- });
577
- if (classification.decision === "deny") {
578
- recordRecentlyDeniedAutoAction(call, classification);
579
- const rejectionMsg = `[Auto denied] ${classification.reason}. Do not retry without asking.`;
580
- this.sendToolCallResult(call, rejectionMsg, true);
581
- return { callId: call.id, content: rejectionMsg, isError: true };
582
- }
583
- if (classification.decision === "auto-approve" && !requiresHardConfirmation) {
584
- this.send({ type: "info", message: `\u26A1 Auto-approved (/auto: ${classification.ruleId})` });
585
- try {
586
- const rawContent = await runTool(tool, call.arguments, call.name);
587
- const content = truncateOutput(rawContent, call.name);
588
- this.sendToolCallResult(call, rawContent, false);
589
- runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "ok" });
590
- runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
591
- return { callId: call.id, content, isError: false };
592
- } catch (err) {
593
- const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
594
- this.sendToolCallResult(call, message, true);
595
- runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
596
- runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
597
- return { callId: call.id, content: message, isError: true };
598
- }
599
- }
600
- }
601
- if (this.sessionAutoApprove && dangerLevel === "write" && !requiresHardConfirmation) {
602
- try {
603
- const rawContent = await runTool(tool, call.arguments, call.name);
604
- const content = truncateOutput(rawContent, call.name);
605
- this.sendToolCallResult(call, rawContent, false);
606
- runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "ok" });
607
- runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "ok" }, { configDir: this.hookConfigDir });
608
- return { callId: call.id, content, isError: false };
609
- } catch (err) {
610
- const message = err instanceof Error ? err.message : err && typeof err === "object" && "message" in err ? String(err.message) : String(err);
611
- this.sendToolCallResult(call, message, true);
612
- runHook(this.hookConfig?.postToolExecution, { tool: call.name, status: "error" });
613
- runLifecycleHooks(this.hookConfig, "PostToolUse", { tool: call.name, status: "error", error: message }, { configDir: this.hookConfigDir });
614
- return { callId: call.id, content: message, isError: true };
615
- }
616
- }
617
- if (dangerLevel === "write" || dangerLevel === "destructive") {
618
- const confirmed = await this.confirm(call, dangerLevel);
619
- if (!confirmed) {
620
- const label = dangerLevel === "destructive" ? "destructive " : "";
621
- const rejectionMsg = `[User cancelled] The user declined the ${label}${call.name} operation. Do not retry without asking.`;
622
- this.sendToolCallResult(call, rejectionMsg, true);
623
- return { callId: call.id, content: rejectionMsg, isError: true };
624
- }
625
- }
626
551
  try {
627
552
  const rawContent = await runTool(tool, call.arguments, call.name);
628
553
  const content = truncateOutput(rawContent, call.name);
@@ -995,7 +920,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
995
920
  Cost: ${formatCost(cost)}` : "";
996
921
  let memoryLine = "";
997
922
  try {
998
- const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-LVX2OT4L.js");
923
+ const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-4UR27ACM.js");
999
924
  const pending = countPendingMemories2(ctx.config.getConfigDir());
1000
925
  if (pending > 0) memoryLine = `
1001
926
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -1919,7 +1844,7 @@ async function handleTest(args, ctx) {
1919
1844
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
1920
1845
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
1921
1846
  }
1922
- const runTests = ctx.runTests ?? (await import("./run-tests-KZ2IUZHK.js")).executeTests;
1847
+ const runTests = ctx.runTests ?? (await import("./run-tests-GGNFI7CL.js")).executeTests;
1923
1848
  const report = await runTests(testArgs);
1924
1849
  ctx.send({ type: "info", message: report });
1925
1850
  } catch (err) {
@@ -2194,7 +2119,7 @@ async function handleMemory(args, ctx) {
2194
2119
  }
2195
2120
  if (intent.kind === "status") {
2196
2121
  const { getChatIndexStatus } = await import("./chat-index-2D5GK2DB.js");
2197
- const { listMemoryEntries: listMemoryEntries2, isMemoryExpired: isMemoryExpired2, formatMemoryForPrompt: formatMemoryForPrompt2 } = await import("./persistent-memory-LVX2OT4L.js");
2122
+ const { listMemoryEntries: listMemoryEntries2, isMemoryExpired: isMemoryExpired2, formatMemoryForPrompt: formatMemoryForPrompt2 } = await import("./persistent-memory-4UR27ACM.js");
2198
2123
  const memories = listMemoryEntries2(configDir, { includeExpired: true, includeRejected: true });
2199
2124
  const injected = formatMemoryForPrompt2(configDir, process.cwd(), ctx.config.get("memory")?.maxChars);
2200
2125
  const view = buildMemoryStatusView({
@@ -2217,7 +2142,7 @@ async function handleMemory(args, ctx) {
2217
2142
  return;
2218
2143
  }
2219
2144
  if (intent.kind === "recall") {
2220
- const { searchPersistentMemories, touchMemoryReferences } = await import("./persistent-memory-LVX2OT4L.js");
2145
+ const { searchPersistentMemories, touchMemoryReferences } = await import("./persistent-memory-4UR27ACM.js");
2221
2146
  const { searchChatMemory } = await import("./chat-index-2D5GK2DB.js");
2222
2147
  const persistentHits = searchPersistentMemories(configDir, intent.query, process.cwd(), 3);
2223
2148
  if (persistentHits.length > 0) {
@@ -2338,7 +2263,7 @@ async function handleMemory(args, ctx) {
2338
2263
  ctx.handleMemoryManage(intent.action, args[1], intent.action === "expire" ? args[2] : void 0);
2339
2264
  } else if (intent.kind === "export") {
2340
2265
  if (args[1] === "md") {
2341
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-LVX2OT4L.js");
2266
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-4UR27ACM.js");
2342
2267
  ctx.send({
2343
2268
  type: "export_data",
2344
2269
  format: "md",
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ToolRegistry
4
- } from "./chunk-BRLLV3FX.js";
4
+ } from "./chunk-37WBQV3E.js";
5
5
  import "./chunk-GHWZVPUV.js";
6
- import "./chunk-UKITSNSH.js";
6
+ import "./chunk-JBNNJ32H.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-5G6HX57U.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-6NEEFOVF.js";
28
28
  import {
29
29
  VERSION
30
- } from "./chunk-THUXZNJL.js";
30
+ } from "./chunk-O4CZPTPU.js";
31
31
 
32
32
  // src/mcp/server.ts
33
33
  import { createInterface } from "readline";
@@ -4,9 +4,9 @@ import {
4
4
  googleSearchContext,
5
5
  isToolCapableProvider,
6
6
  truncateOutput
7
- } from "./chunk-BRLLV3FX.js";
7
+ } from "./chunk-37WBQV3E.js";
8
8
  import "./chunk-GHWZVPUV.js";
9
- import "./chunk-UKITSNSH.js";
9
+ import "./chunk-JBNNJ32H.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-5G6HX57U.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-6NEEFOVF.js";
33
33
  import {
34
34
  SUBAGENT_ALLOWED_TOOLS
35
- } from "./chunk-THUXZNJL.js";
35
+ } from "./chunk-O4CZPTPU.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-7RC7AN6V.js";
13
13
  import "./chunk-TU3L3PW7.js";
14
14
  import "./chunk-IW3Q7AE5.js";
15
- import "./chunk-THUXZNJL.js";
15
+ import "./chunk-O4CZPTPU.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.288",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",