jinzd-ai-cli 0.4.330 → 0.4.333

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 (47) hide show
  1. package/dist/{batch-GXITPLER.js → batch-TYKULVIK.js} +2 -2
  2. package/dist/{chunk-LLXHA2LA.js → chunk-3JGBKYCN.js} +8 -8
  3. package/dist/{chunk-DX2U6QK4.js → chunk-4RVLGIK3.js} +1 -1
  4. package/dist/{chunk-DU44SD6A.js → chunk-4TKEA7RE.js} +1 -1
  5. package/dist/{chunk-GEC3MEVQ.js → chunk-5MUAJ742.js} +6 -4
  6. package/dist/{chunk-LUJ4JVMI.js → chunk-6WQCZTAJ.js} +4 -4
  7. package/dist/{chunk-M5B6G6AY.js → chunk-A4KKNBG3.js} +9 -7
  8. package/dist/{chunk-E2W2MI6H.js → chunk-C6GA7H5D.js} +1 -72
  9. package/dist/{chunk-C2Z77RTU.js → chunk-DAAR4XOY.js} +17 -4
  10. package/dist/{chunk-265M6ZLH.js → chunk-H4UIWMA5.js} +4 -4
  11. package/dist/{chunk-AJITHMRE.js → chunk-JTXHWIBO.js} +1 -1
  12. package/dist/{chunk-GWEBO4RF.js → chunk-K4AYNZF7.js} +1 -1
  13. package/dist/{chunk-72AR23R2.js → chunk-NP2GRK2N.js} +54 -2
  14. package/dist/{chunk-CCFCPAKN.js → chunk-NRDCQGAN.js} +1 -1
  15. package/dist/chunk-W4P2KJZN.js +75 -0
  16. package/dist/{chunk-HMQA2R3O.js → chunk-YIEOU7NG.js} +1 -1
  17. package/dist/{chunk-3YVZJHTF.js → chunk-YUQYVOY2.js} +1 -1
  18. package/dist/{chunk-2SYDIWRU.js → chunk-ZQ5HR7XN.js} +1 -1
  19. package/dist/{chunk-QU74ONFF.js → chunk-ZQFOY5FB.js} +1 -1
  20. package/dist/{ci-6K3JNHB4.js → ci-MYKIATCI.js} +7 -6
  21. package/dist/{ci-format-2L3RFJVH.js → ci-format-QOXT6E3A.js} +2 -2
  22. package/dist/{constants-J5SJ232X.js → constants-C55HE2E5.js} +1 -1
  23. package/dist/{constants-DLJECTGQ.js → constants-WK2I2UCZ.js} +1 -1
  24. package/dist/{doctor-cli-BHS7G2XY.js → doctor-cli-63GBR2D3.js} +7 -6
  25. package/dist/electron-server.js +195 -130
  26. package/dist/{hub-PPG4N6QQ.js → hub-J4FZ4GXX.js} +8 -18
  27. package/dist/{hub-server-JLC7CNP7.js → hub-server-HOQ6S3NK.js} +2 -1
  28. package/dist/index.js +20 -19
  29. package/dist/{persistent-memory-3XTSZ3QR.js → persistent-memory-6JN7AWD6.js} +2 -2
  30. package/dist/{persistent-memory-O4T2OTVV.js → persistent-memory-AEIRTKWX.js} +2 -2
  31. package/dist/{pr-M6ZY4CEK.js → pr-C53TJRXV.js} +7 -6
  32. package/dist/{run-tests-WQE3XTUL.js → run-tests-BKFV3HUZ.js} +2 -2
  33. package/dist/{run-tests-H3DIUCDB.js → run-tests-CZLZW5RL.js} +2 -2
  34. package/dist/{server-J2B26DZK.js → server-2GYX4CJC.js} +7 -6
  35. package/dist/{server-5NQSYQ2T.js → server-2UB74CEK.js} +29 -19
  36. package/dist/{task-orchestrator-CI7EDT25.js → task-orchestrator-EVONAO6V.js} +9 -7
  37. package/dist/{usage-AJYZ5A7P.js → usage-6Y7K2GNN.js} +2 -2
  38. package/dist/web/client/app.js +40 -16
  39. package/dist/web/client/app.js.br +0 -0
  40. package/dist/web/client/app.js.gz +0 -0
  41. package/dist/web/client/index.html +2 -1
  42. package/dist/web/client/index.html.br +0 -0
  43. package/dist/web/client/index.html.gz +0 -0
  44. package/dist/web/client/style.css +1 -0
  45. package/dist/web/client/style.css.br +0 -0
  46. package/dist/web/client/style.css.gz +0 -0
  47. 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-QU74ONFF.js";
7
+ } from "./chunk-ZQFOY5FB.js";
8
8
  import "./chunk-TU3L3PW7.js";
9
9
  import {
10
10
  atomicWriteFileSync
11
11
  } from "./chunk-BMLQPSHP.js";
12
- import "./chunk-AJITHMRE.js";
12
+ import "./chunk-JTXHWIBO.js";
13
13
 
14
14
  // src/cli/batch.ts
15
15
  import Anthropic from "@anthropic-ai/sdk";
@@ -16,7 +16,7 @@ import {
16
16
  setPreferredAgentName,
17
17
  truncateForPersist,
18
18
  undoStack
19
- } from "./chunk-M5B6G6AY.js";
19
+ } from "./chunk-A4KKNBG3.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-DX2U6QK4.js";
54
+ } from "./chunk-4RVLGIK3.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-265M6ZLH.js";
68
+ } from "./chunk-H4UIWMA5.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-HMQA2R3O.js";
83
+ } from "./chunk-YIEOU7NG.js";
84
84
  import {
85
85
  isCleanDocumentBody,
86
86
  stripOuterCodeFence
87
- } from "./chunk-E2W2MI6H.js";
87
+ } from "./chunk-C6GA7H5D.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-AJITHMRE.js";
112
+ } from "./chunk-JTXHWIBO.js";
113
113
 
114
114
  // src/skills/manager.ts
115
115
  import { existsSync, readdirSync, mkdirSync, statSync } from "fs";
@@ -2445,7 +2445,7 @@ No tools match "${filter}".
2445
2445
  const { join: join6 } = await import("path");
2446
2446
  const { existsSync: existsSync6 } = await import("fs");
2447
2447
  const { getGitRoot } = await import("./git-context-EXOEHQSF.js");
2448
- const { MCP_PROJECT_CONFIG_NAME } = await import("./constants-DLJECTGQ.js");
2448
+ const { MCP_PROJECT_CONFIG_NAME } = await import("./constants-WK2I2UCZ.js");
2449
2449
  const { approveProject, hashMcpFile } = await import("./project-trust-KGG2BWKC.js");
2450
2450
  const cwd = process.cwd();
2451
2451
  const projectRoot = getGitRoot(cwd) ?? cwd;
@@ -3553,7 +3553,7 @@ function createReviewCommands() {
3553
3553
  usage: "/test [command|filter]",
3554
3554
  async execute(args, ctx) {
3555
3555
  try {
3556
- const { executeTests } = await import("./run-tests-H3DIUCDB.js");
3556
+ const { executeTests } = await import("./run-tests-CZLZW5RL.js");
3557
3557
  const argStr = args.join(" ").trim();
3558
3558
  let testArgs = {};
3559
3559
  if (argStr) {
@@ -13,7 +13,7 @@ import {
13
13
  MEMORY_FILE_NAME,
14
14
  MEMORY_MAX_CHARS,
15
15
  MEMORY_STORE_FILE_NAME
16
- } from "./chunk-AJITHMRE.js";
16
+ } from "./chunk-JTXHWIBO.js";
17
17
 
18
18
  // src/memory/persistent-memory.ts
19
19
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-QMFMST2T.js";
5
5
  import {
6
6
  TEST_TIMEOUT
7
- } from "./chunk-3YVZJHTF.js";
7
+ } from "./chunk-YUQYVOY2.js";
8
8
 
9
9
  // src/tools/builtin/run-tests.ts
10
10
  import { spawn as spawn2 } from "child_process";
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- detectsHallucinatedFileOp,
4
- parseToolCallArguments,
5
3
  schemaToJsonSchema
6
- } from "./chunk-E2W2MI6H.js";
4
+ } from "./chunk-W4P2KJZN.js";
5
+ import {
6
+ detectsHallucinatedFileOp,
7
+ parseToolCallArguments
8
+ } from "./chunk-C6GA7H5D.js";
7
9
  import {
8
10
  AuthError,
9
11
  ProviderError,
@@ -15,7 +17,7 @@ import {
15
17
  } from "./chunk-BMLQPSHP.js";
16
18
  import {
17
19
  DEFAULT_MAX_TOKENS
18
- } from "./chunk-AJITHMRE.js";
20
+ } from "./chunk-JTXHWIBO.js";
19
21
 
20
22
  // src/providers/claude.ts
21
23
  import Anthropic from "@anthropic-ai/sdk";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  evaluateCiGate,
4
4
  normalizeCiThresholds
5
- } from "./chunk-CCFCPAKN.js";
5
+ } from "./chunk-NRDCQGAN.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-GEC3MEVQ.js";
16
+ } from "./chunk-5MUAJ742.js";
17
17
  import {
18
18
  ConfigManager
19
- } from "./chunk-QU74ONFF.js";
19
+ } from "./chunk-ZQFOY5FB.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-AJITHMRE.js";
22
+ } from "./chunk-JTXHWIBO.js";
23
23
 
24
24
  // src/cli/ci.ts
25
25
  import { execFileSync } from "child_process";
@@ -11,7 +11,7 @@ import {
11
11
  searchPersistentMemories,
12
12
  touchMemoryReferences,
13
13
  updateMemoryEntry
14
- } from "./chunk-DX2U6QK4.js";
14
+ } from "./chunk-4RVLGIK3.js";
15
15
  import {
16
16
  indexProject
17
17
  } from "./chunk-RWRZVQCB.js";
@@ -30,13 +30,15 @@ import {
30
30
  runHook,
31
31
  runLifecycleHooks,
32
32
  runTool
33
- } from "./chunk-HMQA2R3O.js";
33
+ } from "./chunk-YIEOU7NG.js";
34
34
  import {
35
- buildTruncatedArgumentsError,
36
35
  getDangerLevel,
37
- isFileWriteTool,
36
+ isFileWriteTool
37
+ } from "./chunk-W4P2KJZN.js";
38
+ import {
39
+ buildTruncatedArgumentsError,
38
40
  runLeanAgentLoop
39
- } from "./chunk-E2W2MI6H.js";
41
+ } from "./chunk-C6GA7H5D.js";
40
42
  import {
41
43
  EnvLoader,
42
44
  NetworkError,
@@ -64,7 +66,7 @@ import {
64
66
  recoverGbkMojibake,
65
67
  runTestsTool,
66
68
  shellInvocation
67
- } from "./chunk-GWEBO4RF.js";
69
+ } from "./chunk-K4AYNZF7.js";
68
70
  import {
69
71
  CONFIG_DIR_NAME,
70
72
  DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
@@ -73,7 +75,7 @@ import {
73
75
  SUBAGENT_ALLOWED_TOOLS,
74
76
  SUBAGENT_DEFAULT_MAX_ROUNDS,
75
77
  SUBAGENT_MAX_ROUNDS_LIMIT
76
- } from "./chunk-AJITHMRE.js";
78
+ } from "./chunk-JTXHWIBO.js";
77
79
  import {
78
80
  getCurrentSessionKey,
79
81
  getExecutionConfigDir,
@@ -1270,74 +1270,6 @@ async function runLeanAgentLoop(opts) {
1270
1270
  return { content, usage, roundsUsed, toolCallCount };
1271
1271
  }
1272
1272
 
1273
- // src/tools/types.ts
1274
- function isFileWriteTool(name) {
1275
- return name === "write_file" || name === "edit_file" || name === "notebook_edit";
1276
- }
1277
- function getDangerLevel(toolName, args) {
1278
- if (toolName.startsWith("mcp__")) {
1279
- const rawName = toolName.split("__").pop() ?? "";
1280
- const normalized = rawName.toLowerCase().replace(/[^a-z0-9]+/g, "_");
1281
- if (/^(read|get|list|search|find|query|fetch|status|describe|inspect|show|lookup)(?:_|$)/.test(normalized)) {
1282
- return "safe";
1283
- }
1284
- return "write";
1285
- }
1286
- if (toolName === "bash") {
1287
- const cmd = String(args["command"] ?? "");
1288
- if (/\bgit\s+(?:clean\b|reset\s+--hard\b|push\b[^\n]*(?:--force\b|\s-f\b))/i.test(cmd)) return "destructive";
1289
- if (/\brm\s+[^\n]*(?:-\w*[rRfF]\w*|--recursive|--force)\b/.test(cmd)) return "destructive";
1290
- if (/\brm\s+\S/.test(cmd)) return "destructive";
1291
- if (/\brmdir\b|\bmkfs\b|\bdd\s+if=|\bshred\b|\bfdisk\b|\bparted\b/.test(cmd)) return "destructive";
1292
- if (/(?:^|[;&|(\n]\s*)format(?:\.com)?\s+[A-Za-z]:/im.test(cmd)) return "destructive";
1293
- if (/\bshutdown\b|\breboot\b|\bhalt\b|\bpoweroff\b/.test(cmd)) return "destructive";
1294
- if (/\bkill\s+-9\b|\bkillall\b/.test(cmd)) return "destructive";
1295
- if (/\bRemove-Item\b|\bri\s+\S/i.test(cmd)) return "destructive";
1296
- if (/\brd\s+\/s\b|\brmdir\s+\/s\b/i.test(cmd)) return "destructive";
1297
- if (/\bdel\s+\S/.test(cmd)) return "destructive";
1298
- if (/\bShutdown(-Computer)?\b|\bRestart-Computer\b/i.test(cmd)) return "destructive";
1299
- if (/(?:^|[\s|;&])>>?\s*\S/.test(cmd)) return "write";
1300
- if (/\btee\b|\bcp\b|\bmv\b|\bln\s+-s/.test(cmd)) return "write";
1301
- if (/\bchmod\b|\bchown\b/.test(cmd)) return "write";
1302
- 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";
1303
- 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";
1304
- if (/\bcmd(\.exe)?\s+\/[ck]\b/i.test(cmd)) return "write";
1305
- if (!/[;&|`$<>\n\r(){}]/.test(cmd) && (/^(?:pwd|ls|cat|head|tail|wc|Get-ChildItem|Get-Location|Get-Content)(?:\s+[\w ./\\:*?=,@'"-]+)?\s*$/i.test(cmd.trim()) || /^echo(?:\s+[\w .,'"-]+)?\s*$/.test(cmd.trim()) || /^(?:node|python3?)\s+(?:-v|--version)\s*$/.test(cmd.trim()) || /^git\s+(?:status|log)(?:\s+(?:--short|--porcelain|--oneline|-\d+))*\s*$/.test(cmd.trim()))) return "safe";
1306
- return "write";
1307
- }
1308
- if (toolName === "run_tests") return "write";
1309
- if (toolName === "write_file") return "write";
1310
- if (toolName === "edit_file") return "write";
1311
- if (toolName === "save_last_response") return "write";
1312
- if (toolName === "run_interactive") {
1313
- const exe = String(args["executable"] ?? "").toLowerCase();
1314
- if (/\b(rm|rmdir|del|format|mkfs|Remove-Item)\b/i.test(exe)) return "destructive";
1315
- if (/\b(bash|sh|zsh|cmd|powershell|pwsh|python|node|ruby|perl)\b/i.test(exe)) return "write";
1316
- return "write";
1317
- }
1318
- if (toolName === "task_create" || toolName === "task_stop") return "write";
1319
- if (toolName === "task_list") return "safe";
1320
- if (toolName === "git_commit") return "write";
1321
- if (toolName === "git_status" || toolName === "git_diff" || toolName === "git_log") return "safe";
1322
- if (toolName === "notebook_edit") return "write";
1323
- 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") return "safe";
1324
- return "write";
1325
- }
1326
- function schemaToJsonSchema(schema) {
1327
- const result = {
1328
- type: schema.type,
1329
- description: schema.description
1330
- };
1331
- if (schema.enum) result["enum"] = schema.enum;
1332
- if (schema.items) result["items"] = schemaToJsonSchema(schema.items);
1333
- if (schema.properties) {
1334
- result["properties"] = Object.fromEntries(
1335
- Object.entries(schema.properties).map(([k, v]) => [k, schemaToJsonSchema(v)])
1336
- );
1337
- }
1338
- return result;
1339
- }
1340
-
1341
1273
  export {
1342
1274
  detectsHallucinatedFileOp,
1343
1275
  TOOL_CALL_REMINDER,
@@ -1360,8 +1292,5 @@ export {
1360
1292
  accumulateUsage,
1361
1293
  buildRoundBudgetHint,
1362
1294
  runAgentLoop,
1363
- runLeanAgentLoop,
1364
- isFileWriteTool,
1365
- getDangerLevel,
1366
- schemaToJsonSchema
1295
+ runLeanAgentLoop
1367
1296
  };
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ ThinkTagFilter
4
+ } from "./chunk-C6GA7H5D.js";
2
5
 
3
6
  // src/hub/convergence.ts
4
7
  function convergenceThreshold(total) {
@@ -19,8 +22,14 @@ function stripConvergedMarker(content) {
19
22
 
20
23
  // src/hub/agent.ts
21
24
  var PASS_MARKER = "[PASS]";
25
+ function stripThinkBlocks(raw) {
26
+ const filter = new ThinkTagFilter();
27
+ return filter.push(raw) + filter.flush();
28
+ }
29
+ var REASONING_ONLY_NOTICE = "(no reply this round \u2014 reasoning ran past the output limit)";
22
30
  function parseTurn(raw) {
23
- const trimmed = raw.trim();
31
+ let trimmed = stripThinkBlocks(raw).trim();
32
+ if (!trimmed && /<think>/i.test(raw)) trimmed = REASONING_ONLY_NOTICE;
24
33
  const upper = trimmed.toUpperCase();
25
34
  if (upper.startsWith(PASS_MARKER) || upper === PASS_MARKER) {
26
35
  return { content: "", passed: true, converged: false };
@@ -100,6 +109,7 @@ var HubAgent = class {
100
109
  const systemPrompt = this.buildSystemPrompt(topic, round, maxRounds, opts?.voteConverge);
101
110
  const messages = this.buildMessages(history);
102
111
  let raw = "";
112
+ const thinkFilter = new ThinkTagFilter();
103
113
  const stream = provider.chatStream({
104
114
  messages,
105
115
  model: this.modelId,
@@ -114,13 +124,16 @@ var HubAgent = class {
114
124
  for await (const chunk of stream) {
115
125
  if (chunk.delta) {
116
126
  raw += chunk.delta;
117
- onToken?.(chunk.delta);
127
+ const visible = thinkFilter.push(chunk.delta);
128
+ if (visible) onToken?.(visible);
118
129
  }
119
130
  if (opts?.signal?.aborted) break;
120
131
  }
121
132
  } catch (error) {
122
133
  if (!opts?.signal?.aborted) throw error;
123
134
  }
135
+ const tail = thinkFilter.flush();
136
+ if (tail) onToken?.(tail);
124
137
  const { content, passed, converged } = parseTurn(raw);
125
138
  return {
126
139
  speaker: this.role.id,
@@ -155,7 +168,7 @@ var HubAgent = class {
155
168
  maxTokens: 4096,
156
169
  ...this.thinking ?? {}
157
170
  });
158
- return response.content.trim();
171
+ return stripThinkBlocks(response.content).trim();
159
172
  }
160
173
  // ── Private ──────────────────────────────────────────────────────
161
174
  buildSystemPrompt(topic, round, maxRounds, voteConverge) {
@@ -236,7 +249,7 @@ Produce a structured, decision-oriented synthesis with these exact sections:
236
249
  4. **Action Items** \u2014 concrete next steps as a checklist. For each, suggest which role/expertise should own it, e.g. "- [ ] (\u67B6\u6784\u5E08) \u8BC4\u4F30\u670D\u52A1\u62C6\u5206\u8FB9\u754C".
237
250
  5. **Risks & Open Questions** \u2014 unresolved issues and what to watch.
238
251
 
239
- Keep it tight (within ~600 words). Use the same language as the discussion.`;
252
+ Keep it tight (within ~600 words). Use the same language as the discussion \u2014 including the section headings (translate them, e.g. \u51B3\u7B56 / \u5EFA\u8BAE\u3001\u5173\u952E\u5171\u8BC6\u3001\u5206\u6B67\u70B9\u3001\u884C\u52A8\u9879\u3001\u98CE\u9669\u4E0E\u5F00\u653E\u95EE\u9898 for a Chinese discussion).`;
240
253
  }
241
254
  };
242
255
 
@@ -8,13 +8,13 @@ import {
8
8
  listHooks,
9
9
  listInstalledPlugins,
10
10
  resetStats
11
- } from "./chunk-HMQA2R3O.js";
11
+ } from "./chunk-YIEOU7NG.js";
12
12
  import {
13
13
  ProviderRegistry
14
- } from "./chunk-GEC3MEVQ.js";
14
+ } from "./chunk-5MUAJ742.js";
15
15
  import {
16
16
  ConfigManager
17
- } from "./chunk-QU74ONFF.js";
17
+ } from "./chunk-ZQFOY5FB.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-AJITHMRE.js";
29
+ } from "./chunk-JTXHWIBO.js";
30
30
 
31
31
  // src/diagnostics/doctor-report.ts
32
32
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.330";
4
+ var VERSION = "0.4.333";
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
  TEST_TIMEOUT
4
- } from "./chunk-AJITHMRE.js";
4
+ } from "./chunk-JTXHWIBO.js";
5
5
  import {
6
6
  getExecutionConfigDir,
7
7
  getExecutionSignal
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  HubAgent,
4
4
  isConverged
5
- } from "./chunk-C2Z77RTU.js";
5
+ } from "./chunk-DAAR4XOY.js";
6
6
 
7
7
  // src/hub/discuss.ts
8
8
  var DiscussionOrchestrator = class {
@@ -379,9 +379,61 @@ function resolveRoleProviders(roles, lookup, defaultProvider, defaultModel, avai
379
379
  return { roles: outRoles, assignments, warnings };
380
380
  }
381
381
 
382
+ // src/hub/custom-presets.ts
383
+ import { existsSync, readdirSync, readFileSync } from "fs";
384
+ import { join, basename } from "path";
385
+ var CUSTOM_PRESET_PREFIX = "custom:";
386
+ var HUB_ROLES_DIRNAME = "hub-roles";
387
+ function parseRolesJson(parsed) {
388
+ const rawRoles = Array.isArray(parsed) ? parsed : parsed?.roles;
389
+ if (!Array.isArray(rawRoles) || rawRoles.length === 0) {
390
+ throw new Error("roles must be a non-empty array");
391
+ }
392
+ return rawRoles.map((r) => ({
393
+ id: r.id ?? r.name?.toLowerCase().replace(/\s+/g, "-") ?? "agent",
394
+ name: r.name ?? r.id ?? "Agent",
395
+ persona: r.persona ?? r.description ?? `You are ${r.name ?? "an AI assistant"}.`,
396
+ ...r.provider && { provider: r.provider },
397
+ ...r.model && { model: r.model },
398
+ ...r.color && { color: r.color }
399
+ }));
400
+ }
401
+ function loadCustomPresets(configDir) {
402
+ const dir = join(configDir, HUB_ROLES_DIRNAME);
403
+ const presets = [];
404
+ const warnings = [];
405
+ if (!existsSync(dir)) return { presets, warnings };
406
+ let files;
407
+ try {
408
+ files = readdirSync(dir).filter((f) => f.toLowerCase().endsWith(".json")).sort();
409
+ } catch (err) {
410
+ return { presets, warnings: [`${dir}: ${err.message}`] };
411
+ }
412
+ for (const file of files) {
413
+ const stem = basename(file, file.slice(file.lastIndexOf(".")));
414
+ try {
415
+ const parsed = JSON.parse(readFileSync(join(dir, file), "utf-8").replace(/^/, ""));
416
+ const roles = parseRolesJson(parsed);
417
+ const meta = Array.isArray(parsed) ? {} : parsed;
418
+ presets.push({
419
+ id: `${CUSTOM_PRESET_PREFIX}${stem}`,
420
+ name: typeof meta.name === "string" && meta.name.trim() ? meta.name.trim() : stem,
421
+ description: typeof meta.description === "string" && meta.description.trim() ? meta.description.trim() : roles.map((r) => r.name).join("\xB7"),
422
+ roles
423
+ });
424
+ } catch (err) {
425
+ warnings.push(`${HUB_ROLES_DIRNAME}/${file}: ${err.message}`);
426
+ }
427
+ }
428
+ return { presets, warnings };
429
+ }
430
+
382
431
  export {
383
432
  DiscussionOrchestrator,
384
433
  getPreset,
385
434
  listPresets,
386
- resolveRoleProviders
435
+ resolveRoleProviders,
436
+ CUSTOM_PRESET_PREFIX,
437
+ parseRolesJson,
438
+ loadCustomPresets
387
439
  };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-AJITHMRE.js";
4
+ } from "./chunk-JTXHWIBO.js";
5
5
 
6
6
  // src/cli/ci-format.ts
7
7
  var DEFAULT_CI_THRESHOLDS = {
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
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 (/\bgit\s+(?:clean\b|reset\s+--hard\b|push\b[^\n]*(?:--force\b|\s-f\b))/i.test(cmd)) return "destructive";
19
+ if (/\brm\s+[^\n]*(?:-\w*[rRfF]\w*|--recursive|--force)\b/.test(cmd)) return "destructive";
20
+ if (/\brm\s+\S/.test(cmd)) return "destructive";
21
+ if (/\brmdir\b|\bmkfs\b|\bdd\s+if=|\bshred\b|\bfdisk\b|\bparted\b/.test(cmd)) return "destructive";
22
+ if (/(?:^|[;&|(\n]\s*)format(?:\.com)?\s+[A-Za-z]:/im.test(cmd)) return "destructive";
23
+ if (/\bshutdown\b|\breboot\b|\bhalt\b|\bpoweroff\b/.test(cmd)) return "destructive";
24
+ if (/\bkill\s+-9\b|\bkillall\b/.test(cmd)) return "destructive";
25
+ if (/\bRemove-Item\b|\bri\s+\S/i.test(cmd)) return "destructive";
26
+ if (/\brd\s+\/s\b|\brmdir\s+\/s\b/i.test(cmd)) return "destructive";
27
+ if (/\bdel\s+\S/.test(cmd)) return "destructive";
28
+ if (/\bShutdown(-Computer)?\b|\bRestart-Computer\b/i.test(cmd)) return "destructive";
29
+ if (/(?:^|[\s|;&])>>?\s*\S/.test(cmd)) return "write";
30
+ if (/\btee\b|\bcp\b|\bmv\b|\bln\s+-s/.test(cmd)) return "write";
31
+ if (/\bchmod\b|\bchown\b/.test(cmd)) return "write";
32
+ 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";
33
+ 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";
34
+ if (/\bcmd(\.exe)?\s+\/[ck]\b/i.test(cmd)) return "write";
35
+ if (!/[;&|`$<>\n\r(){}]/.test(cmd) && (/^(?:pwd|ls|cat|head|tail|wc|Get-ChildItem|Get-Location|Get-Content)(?:\s+[\w ./\\:*?=,@'"-]+)?\s*$/i.test(cmd.trim()) || /^echo(?:\s+[\w .,'"-]+)?\s*$/.test(cmd.trim()) || /^(?:node|python3?)\s+(?:-v|--version)\s*$/.test(cmd.trim()) || /^git\s+(?:status|log)(?:\s+(?:--short|--porcelain|--oneline|-\d+))*\s*$/.test(cmd.trim()))) return "safe";
36
+ return "write";
37
+ }
38
+ if (toolName === "run_tests") return "write";
39
+ if (toolName === "write_file") return "write";
40
+ if (toolName === "edit_file") return "write";
41
+ if (toolName === "save_last_response") return "write";
42
+ if (toolName === "run_interactive") {
43
+ const exe = String(args["executable"] ?? "").toLowerCase();
44
+ if (/\b(rm|rmdir|del|format|mkfs|Remove-Item)\b/i.test(exe)) return "destructive";
45
+ if (/\b(bash|sh|zsh|cmd|powershell|pwsh|python|node|ruby|perl)\b/i.test(exe)) return "write";
46
+ return "write";
47
+ }
48
+ if (toolName === "task_create" || toolName === "task_stop") return "write";
49
+ if (toolName === "task_list") return "safe";
50
+ if (toolName === "git_commit") return "write";
51
+ if (toolName === "git_status" || toolName === "git_diff" || toolName === "git_log") return "safe";
52
+ if (toolName === "notebook_edit") return "write";
53
+ 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") return "safe";
54
+ return "write";
55
+ }
56
+ function schemaToJsonSchema(schema) {
57
+ const result = {
58
+ type: schema.type,
59
+ description: schema.description
60
+ };
61
+ if (schema.enum) result["enum"] = schema.enum;
62
+ if (schema.items) result["items"] = schemaToJsonSchema(schema.items);
63
+ if (schema.properties) {
64
+ result["properties"] = Object.fromEntries(
65
+ Object.entries(schema.properties).map(([k, v]) => [k, schemaToJsonSchema(v)])
66
+ );
67
+ }
68
+ return result;
69
+ }
70
+
71
+ export {
72
+ isFileWriteTool,
73
+ getDangerLevel,
74
+ schemaToJsonSchema
75
+ };
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  CONFIG_DIR_NAME,
10
10
  PLUGINS_DIR_NAME
11
- } from "./chunk-AJITHMRE.js";
11
+ } from "./chunk-JTXHWIBO.js";
12
12
 
13
13
  // src/diagnostics/tool-stats.ts
14
14
  import { mkdirSync } from "fs";
@@ -1,5 +1,5 @@
1
1
  // src/core/constants.ts
2
- var VERSION = "0.4.330";
2
+ var VERSION = "0.4.333";
3
3
  var APP_NAME = "ai-cli";
4
4
  var CONFIG_DIR_NAME = ".aicli";
5
5
  var CONFIG_FILE_NAME = "config.json";
@@ -12,7 +12,7 @@ import {
12
12
  MEMORY_FILE_NAME,
13
13
  MEMORY_MAX_CHARS,
14
14
  MEMORY_STORE_FILE_NAME
15
- } from "./chunk-3YVZJHTF.js";
15
+ } from "./chunk-YUQYVOY2.js";
16
16
 
17
17
  // src/memory/persistent-memory.ts
18
18
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -11,7 +11,7 @@ import {
11
11
  CONFIG_FILE_NAME,
12
12
  HISTORY_DIR_NAME,
13
13
  PLUGINS_DIR_NAME
14
- } from "./chunk-AJITHMRE.js";
14
+ } from "./chunk-JTXHWIBO.js";
15
15
 
16
16
  // src/config/config-manager.ts
17
17
  import { readFileSync, existsSync, mkdirSync } from "fs";
@@ -3,16 +3,17 @@ import {
3
3
  CI_COMMENT_MARKER,
4
4
  countSeverity,
5
5
  runCi
6
- } from "./chunk-LUJ4JVMI.js";
7
- import "./chunk-CCFCPAKN.js";
6
+ } from "./chunk-6WQCZTAJ.js";
7
+ import "./chunk-NRDCQGAN.js";
8
8
  import "./chunk-HLWUDRBO.js";
9
9
  import "./chunk-6YZEZFX5.js";
10
- import "./chunk-GEC3MEVQ.js";
11
- import "./chunk-QU74ONFF.js";
12
- import "./chunk-E2W2MI6H.js";
10
+ import "./chunk-5MUAJ742.js";
11
+ import "./chunk-ZQFOY5FB.js";
12
+ import "./chunk-W4P2KJZN.js";
13
+ import "./chunk-C6GA7H5D.js";
13
14
  import "./chunk-TU3L3PW7.js";
14
15
  import "./chunk-BMLQPSHP.js";
15
- import "./chunk-AJITHMRE.js";
16
+ import "./chunk-JTXHWIBO.js";
16
17
  export {
17
18
  CI_COMMENT_MARKER,
18
19
  countSeverity,
@@ -6,8 +6,8 @@ import {
6
6
  formatCiResult,
7
7
  formatCiSarif,
8
8
  normalizeCiThresholds
9
- } from "./chunk-CCFCPAKN.js";
10
- import "./chunk-AJITHMRE.js";
9
+ } from "./chunk-NRDCQGAN.js";
10
+ import "./chunk-JTXHWIBO.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-3YVZJHTF.js";
41
+ } from "./chunk-YUQYVOY2.js";
42
42
  export {
43
43
  AGENTIC_BEHAVIOR_GUIDELINE,
44
44
  APP_NAME,
@@ -39,7 +39,7 @@ import {
39
39
  TEST_TIMEOUT,
40
40
  VERSION,
41
41
  buildUserIdentityPrompt
42
- } from "./chunk-AJITHMRE.js";
42
+ } from "./chunk-JTXHWIBO.js";
43
43
  export {
44
44
  AGENTIC_BEHAVIOR_GUIDELINE,
45
45
  APP_NAME,