jinzd-ai-cli 0.4.291 → 0.4.293

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/{batch-3ADC4W3L.js → batch-3H2X3QHW.js} +2 -2
  2. package/dist/{chunk-EL3IUHQO.js → chunk-653JBZ6J.js} +1 -1
  3. package/dist/{chunk-3VV7EXLZ.js → chunk-7XSG2TIU.js} +1 -1
  4. package/dist/{chunk-T635CMLK.js → chunk-BDXS27DX.js} +1 -1
  5. package/dist/{chunk-TBR45SMC.js → chunk-C7DVLUZE.js} +1 -1
  6. package/dist/{chunk-6F3LPG3H.js → chunk-EU4IPUNW.js} +8 -8
  7. package/dist/{chunk-UVXYEQSL.js → chunk-IZJRDI5E.js} +1 -1
  8. package/dist/{chunk-OJYAUCYL.js → chunk-OP2GIZFU.js} +1 -1
  9. package/dist/{chunk-I3XKGEWJ.js → chunk-PL6EEP5B.js} +1 -1
  10. package/dist/{chunk-S7CZWIOW.js → chunk-QJ4QJUU3.js} +1 -1
  11. package/dist/{chunk-7R7DN5XE.js → chunk-QKZUWT3S.js} +15 -2
  12. package/dist/{chunk-6HBNRJVC.js → chunk-S2GDHXBI.js} +4 -4
  13. package/dist/{chunk-5DRJ3GDE.js → chunk-T56RAP6E.js} +4 -4
  14. package/dist/{chunk-CWQCAJQC.js → chunk-XFZTFEZZ.js} +5 -5
  15. package/dist/{chunk-VWNLJ4GL.js → chunk-XHCJJFYO.js} +1 -1
  16. package/dist/{chunk-TEXT4DAT.js → chunk-Y56UGZPX.js} +68 -68
  17. package/dist/{ci-K5LN4JKT.js → ci-BYYYDYYC.js} +6 -6
  18. package/dist/{ci-format-RCB5TGFB.js → ci-format-NXFB37WR.js} +2 -2
  19. package/dist/{constants-DFQ54TBO.js → constants-MCPEC2GB.js} +1 -1
  20. package/dist/{constants-VYHOOORA.js → constants-VHZTK4PO.js} +1 -1
  21. package/dist/{doctor-cli-XOELATBK.js → doctor-cli-4F7DBT5A.js} +6 -6
  22. package/dist/electron-server.js +24 -11
  23. package/dist/{hub-33WQ7VWX.js → hub-Y545G6KJ.js} +1 -1
  24. package/dist/index.js +54 -28
  25. package/dist/{persistent-memory-DXWLXKAR.js → persistent-memory-V5ZDLPNB.js} +2 -2
  26. package/dist/{persistent-memory-GJUEX7YU.js → persistent-memory-XTP7BD5C.js} +2 -2
  27. package/dist/{pr-DQH4NILB.js → pr-4OGJOG2P.js} +6 -6
  28. package/dist/{run-tests-TBGKOHMH.js → run-tests-5LNNPOSH.js} +2 -2
  29. package/dist/{run-tests-YA5SSTLH.js → run-tests-XQO4UZFN.js} +2 -2
  30. package/dist/{server-WNZM63CG.js → server-KXPO46PT.js} +6 -6
  31. package/dist/{server-SCCVV3AS.js → server-QAFBIQIU.js} +15 -15
  32. package/dist/{task-orchestrator-W27ZK4MO.js → task-orchestrator-V3F6JQQV.js} +6 -6
  33. package/dist/{usage-7NFO6LEY.js → usage-MHLWUUWZ.js} +2 -2
  34. 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-UVXYEQSL.js";
7
+ } from "./chunk-IZJRDI5E.js";
8
8
  import "./chunk-TU3L3PW7.js";
9
9
  import {
10
10
  atomicWriteFileSync
11
11
  } from "./chunk-IW3Q7AE5.js";
12
- import "./chunk-I3XKGEWJ.js";
12
+ import "./chunk-PL6EEP5B.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-TBR45SMC.js";
3
+ } from "./chunk-C7DVLUZE.js";
4
4
 
5
5
  // src/tools/builtin/run-tests.ts
6
6
  import { execSync, spawnSync } from "child_process";
@@ -12,7 +12,7 @@ import {
12
12
  MEMORY_FILE_NAME,
13
13
  MEMORY_MAX_CHARS,
14
14
  MEMORY_STORE_FILE_NAME
15
- } from "./chunk-TBR45SMC.js";
15
+ } from "./chunk-C7DVLUZE.js";
16
16
 
17
17
  // src/memory/persistent-memory.ts
18
18
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -13,7 +13,7 @@ import {
13
13
  MEMORY_FILE_NAME,
14
14
  MEMORY_MAX_CHARS,
15
15
  MEMORY_STORE_FILE_NAME
16
- } from "./chunk-I3XKGEWJ.js";
16
+ } from "./chunk-PL6EEP5B.js";
17
17
 
18
18
  // src/memory/persistent-memory.ts
19
19
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -1,5 +1,5 @@
1
1
  // src/core/constants.ts
2
- var VERSION = "0.4.291";
2
+ var VERSION = "0.4.293";
3
3
  var APP_NAME = "ai-cli";
4
4
  var CONFIG_DIR_NAME = ".aicli";
5
5
  var CONFIG_FILE_NAME = "config.json";
@@ -16,7 +16,7 @@ import {
16
16
  setPreferredAgentName,
17
17
  truncateForPersist,
18
18
  undoStack
19
- } from "./chunk-CWQCAJQC.js";
19
+ } from "./chunk-XFZTFEZZ.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-T635CMLK.js";
54
+ } from "./chunk-BDXS27DX.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-5DRJ3GDE.js";
68
+ } from "./chunk-T56RAP6E.js";
69
69
  import {
70
70
  describePlugin,
71
71
  getActivePluginAssets,
@@ -80,11 +80,11 @@ import {
80
80
  trustHook,
81
81
  trustPlugin,
82
82
  untrustHook
83
- } from "./chunk-VWNLJ4GL.js";
83
+ } from "./chunk-XHCJJFYO.js";
84
84
  import {
85
85
  isCleanDocumentBody,
86
86
  stripOuterCodeFence
87
- } from "./chunk-TEXT4DAT.js";
87
+ } from "./chunk-Y56UGZPX.js";
88
88
  import {
89
89
  formatGitContextForPrompt,
90
90
  getGitContext
@@ -109,7 +109,7 @@ import {
109
109
  MCP_TOOL_PREFIX,
110
110
  REPO_URL,
111
111
  VERSION
112
- } from "./chunk-I3XKGEWJ.js";
112
+ } from "./chunk-PL6EEP5B.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-DFQ54TBO.js");
2396
+ const { MCP_PROJECT_CONFIG_NAME } = await import("./constants-MCPEC2GB.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-TBGKOHMH.js");
3500
+ const { executeTests } = await import("./run-tests-5LNNPOSH.js");
3501
3501
  const argStr = args.join(" ").trim();
3502
3502
  let testArgs = {};
3503
3503
  if (argStr) {
@@ -11,7 +11,7 @@ import {
11
11
  CONFIG_FILE_NAME,
12
12
  HISTORY_DIR_NAME,
13
13
  PLUGINS_DIR_NAME
14
- } from "./chunk-I3XKGEWJ.js";
14
+ } from "./chunk-PL6EEP5B.js";
15
15
 
16
16
  // src/config/config-manager.ts
17
17
  import { readFileSync, existsSync, mkdirSync } from "fs";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-I3XKGEWJ.js";
4
+ } from "./chunk-PL6EEP5B.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync, spawnSync } 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.291";
4
+ var VERSION = "0.4.293";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-I3XKGEWJ.js";
4
+ } from "./chunk-PL6EEP5B.js";
5
5
 
6
6
  // src/cli/ci-format.ts
7
7
  var DEFAULT_CI_THRESHOLDS = {
@@ -3,7 +3,7 @@ import {
3
3
  detectsHallucinatedFileOp,
4
4
  parseToolCallArguments,
5
5
  schemaToJsonSchema
6
- } from "./chunk-TEXT4DAT.js";
6
+ } from "./chunk-Y56UGZPX.js";
7
7
  import {
8
8
  AuthError,
9
9
  ProviderError,
@@ -1248,7 +1248,9 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1248
1248
  });
1249
1249
  let thinkingStarted = false;
1250
1250
  let reasoningAccumulator = "";
1251
+ let pendingUsage;
1251
1252
  for await (const chunk of stream) {
1253
+ if (chunk.usage) pendingUsage = toUsage(chunk.usage);
1252
1254
  const choice = chunk.choices[0];
1253
1255
  const done = choice?.finish_reason != null;
1254
1256
  if (!choice && chunk.usage) {
@@ -1276,7 +1278,14 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1276
1278
  yield { delta: "</think>", done: false };
1277
1279
  }
1278
1280
  if (done) {
1279
- yield { delta, done, ...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {} };
1281
+ yield {
1282
+ delta,
1283
+ done,
1284
+ // usage 与 finish_reason 同条时(智谱),必须在这里带出去——否则流就结束了,
1285
+ // 再也没有第二次机会。
1286
+ ...pendingUsage ? { usage: pendingUsage } : {},
1287
+ ...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {}
1288
+ };
1280
1289
  } else {
1281
1290
  yield { delta, done };
1282
1291
  }
@@ -1431,8 +1440,10 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1431
1440
  let reasoningAccumulator = "";
1432
1441
  let lastFinishReason;
1433
1442
  let doneEmitted = false;
1443
+ let pendingUsage;
1434
1444
  for await (const chunk of stream) {
1435
1445
  const choice = chunk.choices[0];
1446
+ if (chunk.usage) pendingUsage = toUsage(chunk.usage);
1436
1447
  if (choice?.finish_reason) lastFinishReason = choice.finish_reason;
1437
1448
  if (!choice && chunk.usage) {
1438
1449
  if (thinkingStarted) {
@@ -1513,6 +1524,8 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1513
1524
  }
1514
1525
  yield {
1515
1526
  type: "done",
1527
+ // usage 与 finish_reason 同条时(智谱),只有这里带得出去——流已经结束了,没有第二次机会。
1528
+ ...pendingUsage ? { usage: pendingUsage } : {},
1516
1529
  ...reasoningAccumulator ? { reasoningContent: reasoningAccumulator } : {},
1517
1530
  ...lastFinishReason && lastFinishReason !== "stop" ? { finishReason: lastFinishReason } : {}
1518
1531
  };
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  evaluateCiGate,
4
4
  normalizeCiThresholds
5
- } from "./chunk-S7CZWIOW.js";
5
+ } from "./chunk-QJ4QJUU3.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-7R7DN5XE.js";
16
+ } from "./chunk-QKZUWT3S.js";
17
17
  import {
18
18
  ConfigManager
19
- } from "./chunk-UVXYEQSL.js";
19
+ } from "./chunk-IZJRDI5E.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-I3XKGEWJ.js";
22
+ } from "./chunk-PL6EEP5B.js";
23
23
 
24
24
  // src/cli/ci.ts
25
25
  import { execFileSync } from "child_process";
@@ -8,13 +8,13 @@ import {
8
8
  listHooks,
9
9
  listInstalledPlugins,
10
10
  resetStats
11
- } from "./chunk-VWNLJ4GL.js";
11
+ } from "./chunk-XHCJJFYO.js";
12
12
  import {
13
13
  ProviderRegistry
14
- } from "./chunk-7R7DN5XE.js";
14
+ } from "./chunk-QKZUWT3S.js";
15
15
  import {
16
16
  ConfigManager
17
- } from "./chunk-UVXYEQSL.js";
17
+ } from "./chunk-IZJRDI5E.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-I3XKGEWJ.js";
29
+ } from "./chunk-PL6EEP5B.js";
30
30
 
31
31
  // src/diagnostics/doctor-report.ts
32
32
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
@@ -11,7 +11,7 @@ import {
11
11
  searchPersistentMemories,
12
12
  touchMemoryReferences,
13
13
  updateMemoryEntry
14
- } from "./chunk-T635CMLK.js";
14
+ } from "./chunk-BDXS27DX.js";
15
15
  import {
16
16
  indexProject
17
17
  } from "./chunk-4DEMGCK4.js";
@@ -30,13 +30,13 @@ import {
30
30
  runHook,
31
31
  runLifecycleHooks,
32
32
  runTool
33
- } from "./chunk-VWNLJ4GL.js";
33
+ } from "./chunk-XHCJJFYO.js";
34
34
  import {
35
35
  buildTruncatedArgumentsError,
36
36
  getDangerLevel,
37
37
  isFileWriteTool,
38
38
  runLeanAgentLoop
39
- } from "./chunk-TEXT4DAT.js";
39
+ } from "./chunk-Y56UGZPX.js";
40
40
  import {
41
41
  EnvLoader,
42
42
  NetworkError,
@@ -50,7 +50,7 @@ import {
50
50
  } from "./chunk-4BKXL7SM.js";
51
51
  import {
52
52
  runTestsTool
53
- } from "./chunk-OJYAUCYL.js";
53
+ } from "./chunk-OP2GIZFU.js";
54
54
  import {
55
55
  CONFIG_DIR_NAME,
56
56
  DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
@@ -58,7 +58,7 @@ import {
58
58
  SUBAGENT_ALLOWED_TOOLS,
59
59
  SUBAGENT_DEFAULT_MAX_ROUNDS,
60
60
  SUBAGENT_MAX_ROUNDS_LIMIT
61
- } from "./chunk-I3XKGEWJ.js";
61
+ } from "./chunk-PL6EEP5B.js";
62
62
 
63
63
  // src/tools/shell-pool.ts
64
64
  import { spawn as spawn2 } from "child_process";
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  CONFIG_DIR_NAME,
10
10
  PLUGINS_DIR_NAME
11
- } from "./chunk-I3XKGEWJ.js";
11
+ } from "./chunk-PL6EEP5B.js";
12
12
 
13
13
  // src/diagnostics/tool-stats.ts
14
14
  import { mkdirSync } from "fs";
@@ -1,69 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // src/tools/types.ts
4
- function isFileWriteTool(name) {
5
- return name === "write_file" || name === "edit_file" || name === "notebook_edit";
6
- }
7
- function getDangerLevel(toolName, args) {
8
- if (toolName.startsWith("mcp__")) {
9
- const rawName = toolName.split("__").pop() ?? "";
10
- const normalized = rawName.toLowerCase().replace(/[^a-z0-9]+/g, "_");
11
- if (/^(read|get|list|search|find|query|fetch|status|describe|inspect|show|lookup)(?:_|$)/.test(normalized)) {
12
- return "safe";
13
- }
14
- return "write";
15
- }
16
- if (toolName === "bash") {
17
- const cmd = String(args["command"] ?? "");
18
- if (/\brm\s+[^\n]*(?:-\w*[rRfF]\w*|--recursive|--force)\b/.test(cmd)) return "destructive";
19
- if (/\brm\s+\S/.test(cmd)) return "destructive";
20
- if (/\brmdir\b|\bformat\b|\bmkfs\b|\bdd\s+if=|\bshred\b|\bfdisk\b|\bparted\b/.test(cmd)) return "destructive";
21
- if (/\bshutdown\b|\breboot\b|\bhalt\b|\bpoweroff\b/.test(cmd)) return "destructive";
22
- if (/\bkill\s+-9\b|\bkillall\b/.test(cmd)) return "destructive";
23
- if (/\bRemove-Item\b|\bri\s+\S/i.test(cmd)) return "destructive";
24
- if (/\brd\s+\/s\b|\brmdir\s+\/s\b/i.test(cmd)) return "destructive";
25
- if (/\bdel\s+\S/.test(cmd)) return "destructive";
26
- if (/\bShutdown(-Computer)?\b|\bRestart-Computer\b/i.test(cmd)) return "destructive";
27
- if (/(?:^|[\s|;&])>>?\s*\S/.test(cmd)) return "write";
28
- if (/\btee\b|\bcp\b|\bmv\b|\bln\s+-s/.test(cmd)) return "write";
29
- if (/\bchmod\b|\bchown\b/.test(cmd)) return "write";
30
- if (/\bSet-Content\b|\bOut-File\b|\bAdd-Content\b|\bCopy-Item\b|\bMove-Item\b|\bSet-ItemProperty\b|\bNew-ItemProperty\b/i.test(cmd)) return "write";
31
- if (/\b(python3?|node|deno|bun|perl|ruby|php|bash|sh|zsh|pwsh|powershell)(\.exe)?\b[^\n]*?\s-(?:Command|EncodedCommand|c|e|p|r)\b/i.test(cmd)) return "write";
32
- if (/\bcmd(\.exe)?\s+\/[ck]\b/i.test(cmd)) return "write";
33
- return "safe";
34
- }
35
- if (toolName === "write_file") return "write";
36
- if (toolName === "edit_file") return "write";
37
- if (toolName === "save_last_response") return "write";
38
- if (toolName === "run_interactive") {
39
- const exe = String(args["executable"] ?? "").toLowerCase();
40
- if (/\b(rm|rmdir|del|format|mkfs|Remove-Item)\b/i.test(exe)) return "destructive";
41
- if (/\b(bash|sh|zsh|cmd|powershell|pwsh|python|node|ruby|perl)\b/i.test(exe)) return "write";
42
- return "write";
43
- }
44
- if (toolName === "task_create" || toolName === "task_stop") return "write";
45
- if (toolName === "task_list") return "safe";
46
- if (toolName === "git_commit") return "write";
47
- if (toolName === "git_status" || toolName === "git_diff" || toolName === "git_log") return "safe";
48
- if (toolName === "notebook_edit") return "write";
49
- if (toolName === "read_file" || toolName === "list_dir" || toolName === "grep_files" || toolName === "glob_files" || toolName === "web_fetch" || toolName === "save_memory" || toolName === "ask_user" || toolName === "write_todos" || toolName === "google_search" || toolName === "spawn_agent" || toolName === "run_tests") return "safe";
50
- return "write";
51
- }
52
- function schemaToJsonSchema(schema) {
53
- const result = {
54
- type: schema.type,
55
- description: schema.description
56
- };
57
- if (schema.enum) result["enum"] = schema.enum;
58
- if (schema.items) result["items"] = schemaToJsonSchema(schema.items);
59
- if (schema.properties) {
60
- result["properties"] = Object.fromEntries(
61
- Object.entries(schema.properties).map(([k, v]) => [k, schemaToJsonSchema(v)])
62
- );
63
- }
64
- return result;
65
- }
66
-
67
3
  // src/tools/hallucination.ts
68
4
  var HALLUCINATION_PATTERNS = [
69
5
  /文件路径[::]\s*`?[^\s`]+\.\w{1,5}/,
@@ -1193,10 +1129,71 @@ async function runLeanAgentLoop(opts) {
1193
1129
  return { content, usage, roundsUsed, toolCallCount };
1194
1130
  }
1195
1131
 
1132
+ // src/tools/types.ts
1133
+ function isFileWriteTool(name) {
1134
+ return name === "write_file" || name === "edit_file" || name === "notebook_edit";
1135
+ }
1136
+ function getDangerLevel(toolName, args) {
1137
+ if (toolName.startsWith("mcp__")) {
1138
+ const rawName = toolName.split("__").pop() ?? "";
1139
+ const normalized = rawName.toLowerCase().replace(/[^a-z0-9]+/g, "_");
1140
+ if (/^(read|get|list|search|find|query|fetch|status|describe|inspect|show|lookup)(?:_|$)/.test(normalized)) {
1141
+ return "safe";
1142
+ }
1143
+ return "write";
1144
+ }
1145
+ if (toolName === "bash") {
1146
+ const cmd = String(args["command"] ?? "");
1147
+ if (/\brm\s+[^\n]*(?:-\w*[rRfF]\w*|--recursive|--force)\b/.test(cmd)) return "destructive";
1148
+ if (/\brm\s+\S/.test(cmd)) return "destructive";
1149
+ if (/\brmdir\b|\bformat\b|\bmkfs\b|\bdd\s+if=|\bshred\b|\bfdisk\b|\bparted\b/.test(cmd)) return "destructive";
1150
+ if (/\bshutdown\b|\breboot\b|\bhalt\b|\bpoweroff\b/.test(cmd)) return "destructive";
1151
+ if (/\bkill\s+-9\b|\bkillall\b/.test(cmd)) return "destructive";
1152
+ if (/\bRemove-Item\b|\bri\s+\S/i.test(cmd)) return "destructive";
1153
+ if (/\brd\s+\/s\b|\brmdir\s+\/s\b/i.test(cmd)) return "destructive";
1154
+ if (/\bdel\s+\S/.test(cmd)) return "destructive";
1155
+ if (/\bShutdown(-Computer)?\b|\bRestart-Computer\b/i.test(cmd)) return "destructive";
1156
+ if (/(?:^|[\s|;&])>>?\s*\S/.test(cmd)) return "write";
1157
+ if (/\btee\b|\bcp\b|\bmv\b|\bln\s+-s/.test(cmd)) return "write";
1158
+ if (/\bchmod\b|\bchown\b/.test(cmd)) return "write";
1159
+ if (/\bSet-Content\b|\bOut-File\b|\bAdd-Content\b|\bCopy-Item\b|\bMove-Item\b|\bSet-ItemProperty\b|\bNew-ItemProperty\b/i.test(cmd)) return "write";
1160
+ if (/\b(python3?|node|deno|bun|perl|ruby|php|bash|sh|zsh|pwsh|powershell)(\.exe)?\b[^\n]*?\s-(?:Command|EncodedCommand|c|e|p|r)\b/i.test(cmd)) return "write";
1161
+ if (/\bcmd(\.exe)?\s+\/[ck]\b/i.test(cmd)) return "write";
1162
+ return "safe";
1163
+ }
1164
+ if (toolName === "write_file") return "write";
1165
+ if (toolName === "edit_file") return "write";
1166
+ if (toolName === "save_last_response") return "write";
1167
+ if (toolName === "run_interactive") {
1168
+ const exe = String(args["executable"] ?? "").toLowerCase();
1169
+ if (/\b(rm|rmdir|del|format|mkfs|Remove-Item)\b/i.test(exe)) return "destructive";
1170
+ if (/\b(bash|sh|zsh|cmd|powershell|pwsh|python|node|ruby|perl)\b/i.test(exe)) return "write";
1171
+ return "write";
1172
+ }
1173
+ if (toolName === "task_create" || toolName === "task_stop") return "write";
1174
+ if (toolName === "task_list") return "safe";
1175
+ if (toolName === "git_commit") return "write";
1176
+ if (toolName === "git_status" || toolName === "git_diff" || toolName === "git_log") return "safe";
1177
+ if (toolName === "notebook_edit") return "write";
1178
+ if (toolName === "read_file" || toolName === "list_dir" || toolName === "grep_files" || toolName === "glob_files" || toolName === "web_fetch" || toolName === "save_memory" || toolName === "ask_user" || toolName === "write_todos" || toolName === "google_search" || toolName === "spawn_agent" || toolName === "run_tests") return "safe";
1179
+ return "write";
1180
+ }
1181
+ function schemaToJsonSchema(schema) {
1182
+ const result = {
1183
+ type: schema.type,
1184
+ description: schema.description
1185
+ };
1186
+ if (schema.enum) result["enum"] = schema.enum;
1187
+ if (schema.items) result["items"] = schemaToJsonSchema(schema.items);
1188
+ if (schema.properties) {
1189
+ result["properties"] = Object.fromEntries(
1190
+ Object.entries(schema.properties).map(([k, v]) => [k, schemaToJsonSchema(v)])
1191
+ );
1192
+ }
1193
+ return result;
1194
+ }
1195
+
1196
1196
  export {
1197
- isFileWriteTool,
1198
- getDangerLevel,
1199
- schemaToJsonSchema,
1200
1197
  detectsHallucinatedFileOp,
1201
1198
  TOOL_CALL_REMINDER,
1202
1199
  buildWriteRoundReminder,
@@ -1218,5 +1215,8 @@ export {
1218
1215
  accumulateUsage,
1219
1216
  buildRoundBudgetHint,
1220
1217
  runAgentLoop,
1221
- runLeanAgentLoop
1218
+ runLeanAgentLoop,
1219
+ isFileWriteTool,
1220
+ getDangerLevel,
1221
+ schemaToJsonSchema
1222
1222
  };
@@ -3,16 +3,16 @@ import {
3
3
  CI_COMMENT_MARKER,
4
4
  countSeverity,
5
5
  runCi
6
- } from "./chunk-6HBNRJVC.js";
7
- import "./chunk-S7CZWIOW.js";
6
+ } from "./chunk-S2GDHXBI.js";
7
+ import "./chunk-QJ4QJUU3.js";
8
8
  import "./chunk-HLWUDRBO.js";
9
9
  import "./chunk-6YZEZFX5.js";
10
- import "./chunk-7R7DN5XE.js";
11
- import "./chunk-UVXYEQSL.js";
12
- import "./chunk-TEXT4DAT.js";
10
+ import "./chunk-QKZUWT3S.js";
11
+ import "./chunk-IZJRDI5E.js";
12
+ import "./chunk-Y56UGZPX.js";
13
13
  import "./chunk-TU3L3PW7.js";
14
14
  import "./chunk-IW3Q7AE5.js";
15
- import "./chunk-I3XKGEWJ.js";
15
+ import "./chunk-PL6EEP5B.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-S7CZWIOW.js";
10
- import "./chunk-I3XKGEWJ.js";
9
+ } from "./chunk-QJ4QJUU3.js";
10
+ import "./chunk-PL6EEP5B.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-I3XKGEWJ.js";
41
+ } from "./chunk-PL6EEP5B.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-TBR45SMC.js";
40
+ } from "./chunk-C7DVLUZE.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-5DRJ3GDE.js";
6
- import "./chunk-VWNLJ4GL.js";
5
+ } from "./chunk-T56RAP6E.js";
6
+ import "./chunk-XHCJJFYO.js";
7
7
  import "./chunk-RS7SKYTS.js";
8
- import "./chunk-7R7DN5XE.js";
9
- import "./chunk-UVXYEQSL.js";
10
- import "./chunk-TEXT4DAT.js";
8
+ import "./chunk-QKZUWT3S.js";
9
+ import "./chunk-IZJRDI5E.js";
10
+ import "./chunk-Y56UGZPX.js";
11
11
  import "./chunk-TU3L3PW7.js";
12
12
  import "./chunk-HOSJZMQS.js";
13
13
  import "./chunk-IW3Q7AE5.js";
14
- import "./chunk-I3XKGEWJ.js";
14
+ import "./chunk-PL6EEP5B.js";
15
15
  export {
16
16
  formatDoctorReport,
17
17
  runDoctorCli