@wrongstack/tools 0.319.1 → 1.0.0

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 (203) hide show
  1. package/dist/_danger-detect.d.ts +8 -0
  2. package/dist/_syntax-check.d.ts +1 -2
  3. package/dist/audit.d.ts +4 -5
  4. package/dist/audit.js +8 -8
  5. package/dist/auto-proceed-loop-guard.js +9 -160
  6. package/dist/bash-kill-guard.d.ts +2 -3
  7. package/dist/bash.d.ts +2 -3
  8. package/dist/bash.js +6 -6
  9. package/dist/batch-tool-use.d.ts +2 -3
  10. package/dist/batch-tool-use.js +1 -1
  11. package/dist/browser/index.d.ts +1 -1
  12. package/dist/browser/index.js +1 -1
  13. package/dist/browser/tools.d.ts +56 -45
  14. package/dist/builtin.js +55 -55
  15. package/dist/{chunk-RJZQWEMS.js → chunk-24T5XIJU.js} +3 -2
  16. package/dist/{chunk-DTQ75VBC.js → chunk-2CTZW6JQ.js} +2 -2
  17. package/dist/chunk-37QKUQ2Z.js +171 -0
  18. package/dist/{chunk-LOBRWKCR.js → chunk-3D5DJWOE.js} +3 -3
  19. package/dist/{chunk-YOKD4GWJ.js → chunk-4ERMPDHV.js} +14 -8
  20. package/dist/{chunk-5EUJF3WC.js → chunk-4WPBS45A.js} +4 -5
  21. package/dist/{chunk-42BHI7TN.js → chunk-5ITQPCLC.js} +2 -2
  22. package/dist/{chunk-B4HTSV6Z.js → chunk-5KS24LTS.js} +11 -11
  23. package/dist/{chunk-QPNYDH5B.js → chunk-62OAECEQ.js} +29 -7
  24. package/dist/{chunk-IYKXK356.js → chunk-6GOZTS6F.js} +4 -4
  25. package/dist/{chunk-OG2BEUBY.js → chunk-7HL23T3T.js} +73 -16
  26. package/dist/{chunk-HFXSNKCV.js → chunk-7JJFC6CT.js} +1 -1
  27. package/dist/{chunk-TTZOK6IY.js → chunk-7N5U2RAU.js} +2 -2
  28. package/dist/{chunk-QBV725YG.js → chunk-7ODZTPCU.js} +2 -2
  29. package/dist/{chunk-OTINMOKK.js → chunk-AB2CAUOP.js} +66 -55
  30. package/dist/{chunk-6AAOT4PW.js → chunk-AQ5YBURX.js} +16 -4
  31. package/dist/{chunk-JDPQOR7C.js → chunk-ASEXQRA7.js} +19 -19
  32. package/dist/{chunk-FRN7TIAA.js → chunk-B3MGJBFI.js} +1 -1
  33. package/dist/{chunk-IWS56OY7.js → chunk-CGXTR34H.js} +63 -4
  34. package/dist/{chunk-IU4DV2PA.js → chunk-CHEK3ASV.js} +6 -3
  35. package/dist/{chunk-GOIZNNOA.js → chunk-DJYLI7EW.js} +1 -1
  36. package/dist/{chunk-CFLJFDYV.js → chunk-DK4J2WMH.js} +14 -11
  37. package/dist/{chunk-ZHH3BEWU.js → chunk-DRRY6SCM.js} +49 -22
  38. package/dist/{chunk-BK732J7I.js → chunk-FBUP524S.js} +4 -4
  39. package/dist/{chunk-WHIIIREL.js → chunk-FVM3O4JQ.js} +7 -3
  40. package/dist/chunk-FYDBUVQD.js +244 -0
  41. package/dist/{chunk-UDVKRX5R.js → chunk-GDDXX27P.js} +50 -50
  42. package/dist/{chunk-O44IMQCN.js → chunk-GKSG5CPH.js} +6 -6
  43. package/dist/{chunk-3PVYQFRQ.js → chunk-HDYUBRMF.js} +5 -3
  44. package/dist/{chunk-ELRRTWNP.js → chunk-IXIS7RSG.js} +2 -2
  45. package/dist/{chunk-X5FOFGXX.js → chunk-IYH4OHBP.js} +6 -6
  46. package/dist/{chunk-MNP3GE7H.js → chunk-JDOO4P6Z.js} +21 -16
  47. package/dist/{chunk-BSJSNVGA.js → chunk-KDEXUQY7.js} +24 -11
  48. package/dist/{chunk-V43EQ6VR.js → chunk-KE7A76VC.js} +3 -2
  49. package/dist/{chunk-2OXHS3KZ.js → chunk-KLJZ4WV4.js} +4 -3
  50. package/dist/{chunk-3M7LLN7W.js → chunk-LQSOU63Z.js} +12 -11
  51. package/dist/{chunk-DC4KMPJO.js → chunk-M6UV67BH.js} +2 -2
  52. package/dist/{chunk-C2DQKVLO.js → chunk-MJSJWXBF.js} +1 -1
  53. package/dist/{chunk-RNWUCZ2U.js → chunk-MK2JK35J.js} +29 -12
  54. package/dist/{chunk-FQZOHLG3.js → chunk-MSOAX3GC.js} +3 -2
  55. package/dist/{chunk-KY4PXYSO.js → chunk-N3K2SFEI.js} +534 -494
  56. package/dist/{chunk-EADULOZV.js → chunk-NJX2RXKJ.js} +50 -7
  57. package/dist/{chunk-AKHYMB4V.js → chunk-NN2SNP2R.js} +6 -6
  58. package/dist/{chunk-CMOUCKGC.js → chunk-NU2IZ72J.js} +6 -6
  59. package/dist/{chunk-RLMX75EM.js → chunk-O6BY43ZB.js} +29 -8
  60. package/dist/{chunk-NKNOBUBU.js → chunk-PVCB7RUZ.js} +2 -2
  61. package/dist/{chunk-UQQS3VNT.js → chunk-QA6IASYX.js} +8 -8
  62. package/dist/{chunk-VPALDFYM.js → chunk-RV7BVTDG.js} +1 -1
  63. package/dist/chunk-S57CDR2H.js +288 -0
  64. package/dist/{chunk-2VSZC6QM.js → chunk-SCMRM6NL.js} +6 -4
  65. package/dist/{chunk-W2CECGTG.js → chunk-SMARDKAC.js} +1 -1
  66. package/dist/{chunk-45JPRMC2.js → chunk-SOR7OCYP.js} +7 -3
  67. package/dist/{chunk-ATSKPZUK.js → chunk-T3SMFF5Q.js} +11 -5
  68. package/dist/{chunk-4BHUSMNL.js → chunk-UI3ZJIG3.js} +1 -1
  69. package/dist/{chunk-WXJY3BKV.js → chunk-VBF2YXUW.js} +2 -2
  70. package/dist/{chunk-FQNXYA6W.js → chunk-VU3QBYL4.js} +36 -5
  71. package/dist/{chunk-IIF5HIVF.js → chunk-VVZPQPTY.js} +2 -2
  72. package/dist/{chunk-VD2LV5WO.js → chunk-VZGPASGD.js} +37 -12
  73. package/dist/{chunk-64VIJPFV.js → chunk-WEEVSWQB.js} +17 -6
  74. package/dist/chunk-XXRMF2BC.js +186 -0
  75. package/dist/{chunk-RTZWBNTY.js → chunk-YEISRT4S.js} +7 -12
  76. package/dist/{chunk-Q5JPPCZC.js → chunk-YJTXRH5Y.js} +3 -2
  77. package/dist/{chunk-GMZYW52L.js → chunk-YULVUTK5.js} +6 -3
  78. package/dist/{chunk-NWZ6XGBJ.js → chunk-ZBMANLYH.js} +5 -3
  79. package/dist/{chunk-DP6CXMJZ.js → chunk-ZTCJCYLN.js} +3 -3
  80. package/dist/circuit-breaker.d.ts +1 -0
  81. package/dist/circuit-breaker.js +1 -1
  82. package/dist/clarify.d.ts +1 -0
  83. package/dist/codebase-index/codebase-ast-replace-tool.d.ts +2 -3
  84. package/dist/codebase-index/codebase-impact-analysis-tool.d.ts +5 -4
  85. package/dist/codebase-index/codebase-incoming-calls-tool.d.ts +4 -3
  86. package/dist/codebase-index/codebase-index-tool.d.ts +2 -3
  87. package/dist/codebase-index/codebase-invariant-check-tool.d.ts +2 -3
  88. package/dist/codebase-index/codebase-outgoing-calls-tool.d.ts +4 -3
  89. package/dist/codebase-index/codebase-repo-map-tool.d.ts +2 -3
  90. package/dist/codebase-index/codebase-search-tool.d.ts +2 -3
  91. package/dist/codebase-index/codebase-skeleton-tool.d.ts +2 -3
  92. package/dist/codebase-index/codebase-stats-tool.d.ts +9 -3
  93. package/dist/codebase-index/codebase-targeted-test-tool.d.ts +4 -3
  94. package/dist/codebase-index/index.d.ts +11 -11
  95. package/dist/codebase-index/index.js +12 -12
  96. package/dist/codebase-index/parser-worker-script.js +3 -3
  97. package/dist/codebase-index/project-server-framing.d.ts +29 -0
  98. package/dist/codebase-index/project-server-lifecycle.d.ts +20 -0
  99. package/dist/codebase-index/project-server-operations.d.ts +37 -0
  100. package/dist/codebase-index/project-server-types.d.ts +30 -0
  101. package/dist/codebase-index/project-server-watcher.d.ts +25 -0
  102. package/dist/codebase-index/project-server.js +451 -394
  103. package/dist/codebase-index/worker.js +5 -5
  104. package/dist/codebase-index/writer-init.d.ts +13 -0
  105. package/dist/codebase-index/writer-maintenance.d.ts +14 -0
  106. package/dist/codebase-index/writer.d.ts +0 -15
  107. package/dist/design.d.ts +2 -2
  108. package/dist/design.js +1 -1
  109. package/dist/diff.d.ts +4 -4
  110. package/dist/diff.js +2 -2
  111. package/dist/document.d.ts +3 -4
  112. package/dist/document.js +1 -1
  113. package/dist/e2e.d.ts +1 -1
  114. package/dist/e2e.js +1 -1
  115. package/dist/edit.d.ts +3 -3
  116. package/dist/edit.js +9 -9
  117. package/dist/exec.d.ts +2 -3
  118. package/dist/exec.js +6 -6
  119. package/dist/fetch.d.ts +4 -3
  120. package/dist/fetch.js +1 -1
  121. package/dist/format.d.ts +17 -45
  122. package/dist/format.js +14 -10
  123. package/dist/git.d.ts +3 -3
  124. package/dist/git.js +1 -1
  125. package/dist/glob.d.ts +2 -3
  126. package/dist/glob.js +3 -3
  127. package/dist/{go-parser-IKHW67WE.js → go-parser-D7ELWQ7F.js} +2 -2
  128. package/dist/grep.d.ts +7 -5
  129. package/dist/grep.js +4 -4
  130. package/dist/index.d.ts +54 -45
  131. package/dist/index.js +122 -63
  132. package/dist/install.d.ts +7 -55
  133. package/dist/install.js +8 -8
  134. package/dist/{json-parser-2EOVP5MR.js → json-parser-34DHYCPW.js} +1 -18
  135. package/dist/json.d.ts +3 -4
  136. package/dist/json.js +2 -2
  137. package/dist/kanban-tool-types.d.ts +1 -2
  138. package/dist/kanban.d.ts +3 -19
  139. package/dist/kanban.js +1 -1
  140. package/dist/languages/execute-tool.d.ts +2 -3
  141. package/dist/languages/index.d.ts +2 -2
  142. package/dist/languages/index.js +6 -6
  143. package/dist/languages/tool.d.ts +3 -4
  144. package/dist/legacy-bridge-YXANP5QB.js +18 -0
  145. package/dist/lint.d.ts +5 -4
  146. package/dist/lint.js +8 -8
  147. package/dist/logs.d.ts +3 -4
  148. package/dist/logs.js +2 -2
  149. package/dist/memory.d.ts +7 -8
  150. package/dist/memory.js +1 -1
  151. package/dist/mode.d.ts +3 -4
  152. package/dist/mode.js +1 -1
  153. package/dist/next-steps-tool.d.ts +2 -3
  154. package/dist/next-steps.d.ts +11 -0
  155. package/dist/next-steps.js +10 -132
  156. package/dist/outdated.d.ts +5 -29
  157. package/dist/outdated.js +4 -4
  158. package/dist/pack.js +56 -56
  159. package/dist/{parser-dispatch-QGC4HSP5.js → parser-dispatch-BDVCJXTV.js} +4 -4
  160. package/dist/patch.d.ts +2 -3
  161. package/dist/patch.js +8 -8
  162. package/dist/plan.d.ts +4 -4
  163. package/dist/plan.js +3 -3
  164. package/dist/process-registry.js +2 -2
  165. package/dist/ps-slash.js +4 -4
  166. package/dist/pwsh.d.ts +1 -0
  167. package/dist/{py-parser-RFWG2HYI.js → py-parser-QC6MR4GB.js} +3 -3
  168. package/dist/read.d.ts +5 -5
  169. package/dist/read.js +8 -8
  170. package/dist/replace.d.ts +2 -3
  171. package/dist/replace.js +10 -10
  172. package/dist/scaffold.d.ts +7 -3
  173. package/dist/scaffold.js +3 -1
  174. package/dist/search.d.ts +17 -3
  175. package/dist/search.js +5 -1
  176. package/dist/set-working-dir.d.ts +2 -3
  177. package/dist/skill.d.ts +4 -5
  178. package/dist/skill.js +1 -1
  179. package/dist/task.d.ts +6 -6
  180. package/dist/task.js +3 -3
  181. package/dist/test.d.ts +5 -4
  182. package/dist/test.js +8 -8
  183. package/dist/todo.d.ts +8 -8
  184. package/dist/todo.js +2 -2
  185. package/dist/tool-diff.js +11 -230
  186. package/dist/tool-help.d.ts +2 -3
  187. package/dist/tool-help.js +1 -1
  188. package/dist/tool-search.d.ts +2 -3
  189. package/dist/tool-search.js +1 -1
  190. package/dist/tool-summary.js +5 -281
  191. package/dist/tool-tier.js +57 -57
  192. package/dist/tool-use.d.ts +2 -3
  193. package/dist/tool-use.js +1 -1
  194. package/dist/tree.d.ts +5 -3
  195. package/dist/tree.js +5 -1
  196. package/dist/typecheck.d.ts +3 -3
  197. package/dist/typecheck.js +8 -8
  198. package/dist/win32.js +1 -1
  199. package/dist/write.d.ts +2 -3
  200. package/dist/write.js +9 -9
  201. package/package.json +5 -5
  202. package/dist/legacy-bridge-3T7SR4SK.js +0 -18
  203. package/dist/spawn-background.d.ts +0 -80
@@ -214,6 +214,7 @@ function unbracket(hostname) {
214
214
  function safeBrowserUrl(rawUrl) {
215
215
  try {
216
216
  const url = new URL(rawUrl);
217
+ if (url.protocol !== "http:" && url.protocol !== "https:") return "about:blank";
217
218
  url.username = "";
218
219
  url.password = "";
219
220
  url.search = "";
@@ -224,8 +225,11 @@ function safeBrowserUrl(rawUrl) {
224
225
  }
225
226
  }
226
227
  function redactBrowserText(text) {
227
- return text.replace(/\bBearer\s+[A-Za-z0-9._~+/-]+=*/gi, "Bearer [REDACTED]").replace(
228
- /\b(api[-_ ]?key|access[-_ ]?token|auth[-_ ]?token|token|password|secret)\b\s*[:=]\s*[^\s,;]+/gi,
228
+ return text.replace(/\bauthorization\b\s*[:=]\s*[^\r\n]+/gi, "Authorization=[REDACTED]").replace(
229
+ /\bauthorization\b\s*[:=]\s*(?:Basic|Bearer)\s+[^\s,;]+/gi,
230
+ "Authorization=[REDACTED]"
231
+ ).replace(/\bBearer\s+[A-Za-z0-9._~+/-]+=*/gi, "Bearer [REDACTED]").replace(
232
+ /\b(authorization|set[-_ ]?cookie|cookie|api[-_ ]?key|private[-_ ]?key|client[-_ ]?secret|access[-_ ]?token|refresh[-_ ]?token|session[-_ ]?token|auth[-_ ]?token|token|password|secret)\b\s*[:=]\s*[^\s,;]+/gi,
229
233
  "$1=[REDACTED]"
230
234
  );
231
235
  }
@@ -1394,4 +1398,4 @@ export {
1394
1398
  browserTools,
1395
1399
  shutdownBrowserTools
1396
1400
  };
1397
- //# sourceMappingURL=chunk-45JPRMC2.js.map
1401
+ //# sourceMappingURL=chunk-SOR7OCYP.js.map
@@ -2,7 +2,7 @@ import {
2
2
  executeLanguagePlan,
3
3
  executePackagePlan,
4
4
  planLanguageOperation
5
- } from "./chunk-TTZOK6IY.js";
5
+ } from "./chunk-7N5U2RAU.js";
6
6
 
7
7
  // src/languages/legacy-bridge.ts
8
8
  import * as fs from "node:fs/promises";
@@ -21,7 +21,11 @@ async function detectNonJsEcosystem(cwd, projectRoot) {
21
21
  try {
22
22
  let dir = path.resolve(cwd);
23
23
  const root = path.resolve(projectRoot);
24
- for (let depth = 0; depth <= 4 && dir.startsWith(root); depth++) {
24
+ const isInsideOrSame = (d, r) => {
25
+ const rel = path.relative(r, d);
26
+ return rel === "" || !rel.startsWith("..") && !path.isAbsolute(rel);
27
+ };
28
+ for (let depth = 0; depth <= 4 && isInsideOrSame(dir, root); depth++) {
25
29
  for (const marker of NON_JS_MARKERS) {
26
30
  try {
27
31
  const s = await fs.stat(path.join(dir, marker.filename));
@@ -38,8 +42,10 @@ async function detectNonJsEcosystem(cwd, projectRoot) {
38
42
  }
39
43
  } catch {
40
44
  }
41
- if (dir === root) break;
42
- dir = path.dirname(dir);
45
+ if (path.relative(root, dir) === "") break;
46
+ const parent = path.dirname(dir);
47
+ if (parent === dir) break;
48
+ dir = parent;
43
49
  }
44
50
  } catch {
45
51
  }
@@ -98,4 +104,4 @@ export {
98
104
  tryLegacyCodeOperation,
99
105
  tryLegacyPackageOperation
100
106
  };
101
- //# sourceMappingURL=chunk-ATSKPZUK.js.map
107
+ //# sourceMappingURL=chunk-T3SMFF5Q.js.map
@@ -101,4 +101,4 @@ ${mode.description}`
101
101
  export {
102
102
  createModeTool
103
103
  };
104
- //# sourceMappingURL=chunk-4BHUSMNL.js.map
104
+ //# sourceMappingURL=chunk-UI3ZJIG3.js.map
@@ -80,7 +80,7 @@ var batchToolUseTool = {
80
80
  if (input.calls.length > MAX_BATCH_CALLS) {
81
81
  throw new Error(`batch_tool_use: calls must contain at most ${MAX_BATCH_CALLS} items`);
82
82
  }
83
- const governedExecute = ctx.meta[GOVERNED_TOOL_EXECUTOR_META_KEY];
83
+ const governedExecute = ctx.meta?.[GOVERNED_TOOL_EXECUTOR_META_KEY];
84
84
  if (typeof governedExecute !== "function") {
85
85
  return {
86
86
  results: input.calls.map((call) => ({
@@ -200,4 +200,4 @@ async function executeSingle(call, ctx, governedExecute) {
200
200
  export {
201
201
  batchToolUseTool
202
202
  };
203
- //# sourceMappingURL=chunk-WXJY3BKV.js.map
203
+ //# sourceMappingURL=chunk-VBF2YXUW.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  compileUserRegex
3
- } from "./chunk-Q5JPPCZC.js";
3
+ } from "./chunk-YJTXRH5Y.js";
4
4
  import {
5
5
  safeResolveReal
6
6
  } from "./chunk-ZUFHAHTE.js";
@@ -8,8 +8,9 @@ import {
8
8
  // src/logs.ts
9
9
  import { spawn } from "node:child_process";
10
10
  import { StringDecoder } from "node:string_decoder";
11
- import { buildChildEnv } from "@wrongstack/core/utils";
12
- import { ToolValidationError } from "@wrongstack/core/types";
11
+ import * as fs from "node:fs/promises";
12
+ import { buildChildEnv, toErrorMessage } from "@wrongstack/core/utils";
13
+ import { FsError, ToolValidationError } from "@wrongstack/core/types";
13
14
  var logsTool = {
14
15
  name: "logs",
15
16
  category: "Logs",
@@ -86,7 +87,37 @@ var logsTool = {
86
87
  return await dockerLogs(input.service, lines, filterRe, cwd, signal, input.since);
87
88
  }
88
89
  if (input.path) {
89
- return await fileLogs(await safeResolveReal(input.path, ctx), lines, filterRe);
90
+ const resolved = await safeResolveReal(input.path, ctx);
91
+ let stat2;
92
+ try {
93
+ stat2 = await fs.stat(resolved);
94
+ } catch (err) {
95
+ const code = err.code;
96
+ if (code === "ENOENT") {
97
+ throw new FsError({
98
+ message: `logs: file not found "${input.path}"`,
99
+ code: "FS_READ_FAILED",
100
+ path: resolved,
101
+ context: { errno: "ENOENT" }
102
+ });
103
+ }
104
+ throw new FsError({
105
+ message: `logs: failed to stat "${input.path}": ${toErrorMessage(err)}`,
106
+ code: "FS_READ_FAILED",
107
+ path: resolved,
108
+ context: { errno: code },
109
+ cause: err
110
+ });
111
+ }
112
+ if (!stat2.isFile()) {
113
+ throw new FsError({
114
+ message: `logs: "${input.path}" is not a regular file`,
115
+ code: "FS_READ_FAILED",
116
+ path: resolved,
117
+ context: { reason: "not-a-regular-file" }
118
+ });
119
+ }
120
+ return await fileLogs(resolved, lines, filterRe);
90
121
  }
91
122
  return {
92
123
  source: "none",
@@ -268,4 +299,4 @@ function parseLine(line) {
268
299
  export {
269
300
  logsTool
270
301
  };
271
- //# sourceMappingURL=chunk-FQNXYA6W.js.map
302
+ //# sourceMappingURL=chunk-VU3QBYL4.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-UCYQTZ7F.js";
8
8
  import {
9
9
  resolveWin32Command
10
- } from "./chunk-V43EQ6VR.js";
10
+ } from "./chunk-KE7A76VC.js";
11
11
 
12
12
  // src/codebase-index/py-parser.ts
13
13
  import { spawn } from "node:child_process";
@@ -382,4 +382,4 @@ export {
382
382
  parseSymbols,
383
383
  resolvePythonBinary
384
384
  };
385
- //# sourceMappingURL=chunk-IIF5HIVF.js.map
385
+ //# sourceMappingURL=chunk-VVZPQPTY.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  capSubject,
3
3
  compileUserRegex
4
- } from "./chunk-Q5JPPCZC.js";
4
+ } from "./chunk-YJTXRH5Y.js";
5
5
  import {
6
6
  safeResolveReal
7
7
  } from "./chunk-ZUFHAHTE.js";
@@ -39,7 +39,7 @@ async function readJsonFileBounded(filePath, ctx) {
39
39
  var jsonTool = {
40
40
  name: "json",
41
41
  category: "Data",
42
- description: "Parse, pretty-print, query, validate, transform, and merge JSON/JSON5/YAML. Use `action` to select the operation: parse (default), query, validate, transform, or merge.",
42
+ description: "Parse, pretty-print, query, validate, transform, and merge JSON/JSON5/YAML (read-only \u2014 does not write files). Use `action` to select the operation: parse (default), query, validate, transform, or merge.",
43
43
  usageHint: 'VERY USEFUL FOR DATA INSPECTION:\n\n- `action: "parse"` (default): read/pretty-print/convert JSON, JSON5, or YAML from `file` or `data`.\n- `action: "query"`: JMESPath-like query (`a.b[0].c`, `items[*].name`, filters, functions).\n- `action: "validate"`: validate data against a JSON Schema (`schema` param).\n- `action: "transform"`: chain multiple JMESPath transforms (`transforms` param).\n- `action: "merge"`: deep merge `base` and `patch` objects (`conflictResolution` param).\nPrefer this over raw `read` + manual parsing when dealing with configuration or data files.',
44
44
  permission: "auto",
45
45
  mutating: false,
@@ -444,20 +444,35 @@ function jmespathSearch(data, query) {
444
444
  if (rest === void 0) return val;
445
445
  return jmespathSearch(val, rest);
446
446
  }
447
- const arrMatch = query.match(/^\[(\d+)\](?:\.(.+))?$/);
447
+ const propIdxMatch = query.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(\d+)\](?:\.?(.*))?$/);
448
+ if (propIdxMatch) {
449
+ const key = propIdxMatch[1];
450
+ if (key === "__proto__" || key === "prototype" || key === "constructor") {
451
+ return void 0;
452
+ }
453
+ const idx = Number.parseInt(propIdxMatch[2], 10);
454
+ const rest = propIdxMatch[3] ? propIdxMatch[3] : void 0;
455
+ const arr = data?.[key];
456
+ if (!Array.isArray(arr)) return void 0;
457
+ const val = arr[idx];
458
+ if (rest === void 0) return val;
459
+ return jmespathSearch(val, rest);
460
+ }
461
+ const arrMatch = query.match(/^\[(\d+)\](?:\.?(.*))?$/);
448
462
  if (arrMatch) {
449
463
  const idx = Number.parseInt(arrMatch[1], 10);
450
- const rest = arrMatch[2];
464
+ const rest = arrMatch[2] ? arrMatch[2] : void 0;
451
465
  const arr = data;
452
466
  const val = arr?.[idx];
453
467
  if (rest === void 0) return val;
454
468
  return jmespathSearch(val, rest);
455
469
  }
456
- if (query === "[*]") {
457
- if (Array.isArray(data)) {
458
- return data;
459
- }
460
- return data;
470
+ const wildcardMatch = query.match(/^\[\*\](?:\.(.+))?$/);
471
+ if (wildcardMatch) {
472
+ if (!Array.isArray(data)) return [];
473
+ const rest = wildcardMatch[1];
474
+ if (rest === void 0) return data;
475
+ return data.map((item) => jmespathSearch(item, rest));
461
476
  }
462
477
  const multiMatch = query.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\*\](?:\.(.+))?$/);
463
478
  if (multiMatch) {
@@ -469,14 +484,24 @@ function jmespathSearch(data, query) {
469
484
  return arr.map((item) => jmespathSearch(item, rest));
470
485
  }
471
486
  const filterMatch = query.match(
472
- /^\[\\?([a-zA-Z_][a-zA-Z0-9_]*)(==|!=|<|>|<=|>=)(`[^`]+`|'[^']*')\](?:\.(.+))?$/
487
+ /^\[\??([a-zA-Z_][a-zA-Z0-9_]*)(==|!=|<|>|<=|>=)(`[^`]+`|'[^']*')\](?:\.(.+))?$/
473
488
  );
474
489
  if (filterMatch) {
475
490
  const field = filterMatch[1];
476
491
  const op = filterMatch[2];
477
492
  const rawVal = filterMatch[3];
478
493
  const rest = filterMatch[4];
479
- const cmpVal = JSON.parse(rawVal.slice(1, -1));
494
+ let cmpVal;
495
+ if (rawVal.startsWith("'") && rawVal.endsWith("'")) {
496
+ cmpVal = rawVal.slice(1, -1);
497
+ } else {
498
+ const inner = rawVal.slice(1, -1);
499
+ try {
500
+ cmpVal = JSON.parse(inner);
501
+ } catch {
502
+ cmpVal = inner;
503
+ }
504
+ }
480
505
  const arr = data;
481
506
  if (!Array.isArray(arr)) return [];
482
507
  const filtered = arr.filter((item) => {
@@ -676,4 +701,4 @@ ${toYaml(v, indent + 1)}`;
676
701
  export {
677
702
  jsonTool
678
703
  };
679
- //# sourceMappingURL=chunk-VD2LV5WO.js.map
704
+ //# sourceMappingURL=chunk-VZGPASGD.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  tryLegacyPackageOperation
3
- } from "./chunk-ATSKPZUK.js";
3
+ } from "./chunk-T3SMFF5Q.js";
4
4
  import {
5
5
  spawnStream
6
- } from "./chunk-ZHH3BEWU.js";
6
+ } from "./chunk-DRRY6SCM.js";
7
7
  import {
8
8
  COMMAND_OUTPUT_MAX_BYTES,
9
9
  detectPackageManager,
@@ -117,7 +117,8 @@ var auditTool = {
117
117
  type: "final",
118
118
  output: parseAuditOutput(result.stdout, result.exitCode, {
119
119
  level: input.level,
120
- spawnTruncated: result.truncated
120
+ spawnTruncated: result.truncated,
121
+ rawError: result.stderr || result.error || ""
121
122
  })
122
123
  };
123
124
  }
@@ -129,7 +130,7 @@ function parseAuditOutput(json, exitCode, opts = {}) {
129
130
  vulnerabilities: [],
130
131
  total: 0,
131
132
  summary: exitCode === 0 ? "No vulnerabilities found" : "Audit failed",
132
- output: "",
133
+ output: normalizeCommandOutput(opts.rawError || ""),
133
134
  truncated: false
134
135
  };
135
136
  }
@@ -143,7 +144,17 @@ function parseAuditOutput(json, exitCode, opts = {}) {
143
144
  advisories = advisories.filter((a) => (SEVERITY_RANK[a.severity] ?? 0) >= minRank);
144
145
  }
145
146
  const total = advisories.length;
146
- const summary = total === 0 ? "No vulnerabilities found" : `Found ${total} vulnerabilities: ${advisories.filter((a) => a.severity === "critical").length} critical, ${advisories.filter((a) => a.severity === "high").length} high`;
147
+ let summary;
148
+ if (total === 0) {
149
+ if (exitCode !== 0) {
150
+ const errObj = data.error;
151
+ summary = typeof errObj?.summary === "string" ? errObj.summary : typeof errObj?.code === "string" ? `Audit failed (${errObj.code})` : "Audit failed";
152
+ } else {
153
+ summary = "No vulnerabilities found";
154
+ }
155
+ } else {
156
+ summary = `Found ${total} vulnerabilities: ${advisories.filter((a) => a.severity === "critical").length} critical, ${advisories.filter((a) => a.severity === "high").length} high`;
157
+ }
147
158
  return {
148
159
  exit_code: exitCode,
149
160
  vulnerabilities: advisories,
@@ -209,4 +220,4 @@ function extractAdvisories(data) {
209
220
  export {
210
221
  auditTool
211
222
  };
212
- //# sourceMappingURL=chunk-64VIJPFV.js.map
223
+ //# sourceMappingURL=chunk-WEEVSWQB.js.map
@@ -0,0 +1,186 @@
1
+ // src/next-steps.ts
2
+ function projectNextStepsToolInput(input) {
3
+ if (!input || typeof input !== "object" || Array.isArray(input)) return [];
4
+ const rawSteps = input["steps"];
5
+ if (!Array.isArray(rawSteps)) return [];
6
+ const steps = [];
7
+ for (const candidate of rawSteps) {
8
+ if (!candidate || typeof candidate !== "object" || Array.isArray(candidate)) continue;
9
+ const text = candidate["text"];
10
+ if (typeof text !== "string" || !text.trim()) continue;
11
+ const auto = steps.length === 0 && candidate["auto"] === true;
12
+ steps.push(
13
+ auto ? { index: steps.length + 1, text: text.trim(), auto: true } : { index: steps.length + 1, text: text.trim() }
14
+ );
15
+ if (steps.length >= MAX_STEPS) break;
16
+ }
17
+ return steps;
18
+ }
19
+ function isFinalTurnStopReason(stopReason) {
20
+ return stopReason !== "tool_use" && stopReason !== "tool_call";
21
+ }
22
+ function fenceSpans(content) {
23
+ const spans = [];
24
+ const lines = content.split("\n");
25
+ let offset = 0;
26
+ let open = null;
27
+ for (const line of lines) {
28
+ const lineStart = offset;
29
+ offset += line.length + 1;
30
+ const trimmed = line.trim();
31
+ const marker = /^(`{3,}|~{3,})/.exec(trimmed)?.[1];
32
+ if (marker === void 0) continue;
33
+ if (open === null) {
34
+ open = { markerChar: marker[0], markerLength: marker.length, start: lineStart };
35
+ continue;
36
+ }
37
+ if (marker[0] === open.markerChar && marker.length >= open.markerLength && trimmed === marker) {
38
+ spans.push([open.start, offset]);
39
+ open = null;
40
+ }
41
+ }
42
+ if (open !== null) spans.push([open.start, content.length]);
43
+ return spans;
44
+ }
45
+ function indexInsideCodeFence(content, index) {
46
+ return fenceSpans(content).some(([start, end]) => index >= start && index < end);
47
+ }
48
+ function nonFencedIndexOf(content, needle, fromIndex, spans) {
49
+ let at = fromIndex;
50
+ for (; ; ) {
51
+ const found = content.indexOf(needle, at);
52
+ if (found === -1) return -1;
53
+ if (!spans.some(([start, end]) => found >= start && found < end)) return found;
54
+ at = found + 1;
55
+ }
56
+ }
57
+ var ITEM_RE = /^(?:(\d+)[.)]\s*|[-*•]\s*)(.+?)(\s+auto="true")?$/;
58
+ var MAX_STEPS = 6;
59
+ function parseNextSteps(content, requireHeading = true) {
60
+ if (requireHeading) {
61
+ return parseWithHeading(content);
62
+ }
63
+ return parseRawNumbered(content);
64
+ }
65
+ function pushStep(steps, index, text, hasAuto) {
66
+ steps.push(hasAuto ? { index, text, auto: true } : { index, text });
67
+ }
68
+ function parseRawNumbered(content) {
69
+ const lines = content.split("\n");
70
+ const steps = [];
71
+ const seenNumbers = /* @__PURE__ */ new Set();
72
+ for (const rawLine of lines) {
73
+ const line = rawLine.trim();
74
+ if (!line) continue;
75
+ const m = ITEM_RE.exec(line);
76
+ if (!m) continue;
77
+ const numPart = m[1];
78
+ const text = m[2].trim();
79
+ let index;
80
+ if (numPart !== void 0) {
81
+ index = Number.parseInt(numPart, 10);
82
+ } else {
83
+ index = steps.length + 1;
84
+ }
85
+ if (seenNumbers.has(index)) continue;
86
+ seenNumbers.add(index);
87
+ const hasAuto = !!m[3] && steps.length === 0 && index === 1;
88
+ pushStep(steps, index, text, hasAuto);
89
+ if (steps.length >= MAX_STEPS) break;
90
+ }
91
+ return {
92
+ steps,
93
+ texts: steps.map((s) => s.text),
94
+ stripped: content,
95
+ autoTexts: steps.filter((s) => s.auto).map((s) => s.text)
96
+ };
97
+ }
98
+ function parseWithHeading(content) {
99
+ const empty = { steps: [], texts: [], stripped: content, autoTexts: [] };
100
+ const spans = fenceSpans(content);
101
+ const outsideFences = (index) => !spans.some(([start, end]) => index >= start && index < end);
102
+ const headingScan = /<nextsteps\b[^>]*>\s*\n+/gi;
103
+ let heading = null;
104
+ for (let m = headingScan.exec(content); m !== null; m = headingScan.exec(content)) {
105
+ if (outsideFences(m.index)) {
106
+ heading = { index: m.index, length: m[0].length };
107
+ break;
108
+ }
109
+ }
110
+ if (heading === null) return empty;
111
+ const headingEnd = heading.index + heading.length;
112
+ const afterHeading = content.slice(headingEnd);
113
+ const lines = afterHeading.split("\n");
114
+ const steps = [];
115
+ const seenNumbers = /* @__PURE__ */ new Set();
116
+ for (const rawLine of lines) {
117
+ const line = rawLine.trim();
118
+ if (!line) continue;
119
+ const m = ITEM_RE.exec(line);
120
+ if (!m) break;
121
+ const numPart = m[1];
122
+ const text = m[2].trim();
123
+ let index;
124
+ if (numPart !== void 0) {
125
+ index = Number.parseInt(numPart, 10);
126
+ } else {
127
+ index = steps.length + 1;
128
+ }
129
+ if (seenNumbers.has(index)) continue;
130
+ seenNumbers.add(index);
131
+ const hasAuto = !!m[3] && steps.length === 0 && index === 1;
132
+ pushStep(steps, index, text, hasAuto);
133
+ if (steps.length >= MAX_STEPS) break;
134
+ }
135
+ if (steps.length === 0) return empty;
136
+ const closeAbs = nonFencedIndexOf(content, "</nextsteps>", headingEnd, spans);
137
+ if (closeAbs === -1) return empty;
138
+ const texts = steps.map((s) => s.text);
139
+ const autoTexts = steps.filter((s) => s.auto).map((s) => s.text);
140
+ let blockEndAbs = closeAbs + "</nextsteps>".length;
141
+ if (content[blockEndAbs] === "\n") blockEndAbs += 1;
142
+ const stripped = (content.slice(0, heading.index) + content.slice(blockEndAbs)).replace(/\n{3,}/g, "\n\n").trim();
143
+ return { steps, texts, stripped, autoTexts };
144
+ }
145
+ function stripNextStepsBlock(text) {
146
+ const spans = fenceSpans(text);
147
+ const outsideFences = (index) => !spans.some(([start, end]) => index >= start && index < end);
148
+ let result = "";
149
+ let cursor = 0;
150
+ const openTagRe = /<next_?steps\b[^>]*>/gi;
151
+ for (let match = openTagRe.exec(text); match !== null; match = openTagRe.exec(text)) {
152
+ if (!outsideFences(match.index)) continue;
153
+ let removed;
154
+ if (match[0].endsWith("/>")) {
155
+ removed = match[0].length;
156
+ } else {
157
+ const closeRe = /<\/next_?steps\s*>/gi;
158
+ closeRe.lastIndex = match.index + match[0].length;
159
+ removed = -1;
160
+ for (let close = closeRe.exec(text); close !== null; close = closeRe.exec(text)) {
161
+ if (!outsideFences(close.index)) continue;
162
+ removed = close.index + close[0].length - match.index;
163
+ break;
164
+ }
165
+ if (removed === -1) {
166
+ removed = match[0].length;
167
+ }
168
+ }
169
+ result += text.slice(cursor, match.index);
170
+ cursor = match.index + removed;
171
+ openTagRe.lastIndex = cursor;
172
+ }
173
+ result += text.slice(cursor);
174
+ return result.replace(/\n{3,}/g, "\n\n").trim();
175
+ }
176
+ var stripNextSteps = stripNextStepsBlock;
177
+
178
+ export {
179
+ projectNextStepsToolInput,
180
+ isFinalTurnStopReason,
181
+ indexInsideCodeFence,
182
+ parseNextSteps,
183
+ stripNextStepsBlock,
184
+ stripNextSteps
185
+ };
186
+ //# sourceMappingURL=chunk-XXRMF2BC.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-XRNN44QY.js";
4
4
  import {
5
5
  spawnStream
6
- } from "./chunk-ZHH3BEWU.js";
6
+ } from "./chunk-DRRY6SCM.js";
7
7
  import {
8
8
  codebaseIndexStats,
9
9
  enqueueReindex,
@@ -13,7 +13,7 @@ import {
13
13
  outgoingCallsService,
14
14
  runStartupIndex,
15
15
  searchCodebaseIndex
16
- } from "./chunk-DP6CXMJZ.js";
16
+ } from "./chunk-ZTCJCYLN.js";
17
17
  import {
18
18
  IndexTimeoutError,
19
19
  SCHEMA_VERSION,
@@ -21,7 +21,7 @@ import {
21
21
  indexCircuitBreaker,
22
22
  indexStorePool,
23
23
  resolveIndexDir
24
- } from "./chunk-KY4PXYSO.js";
24
+ } from "./chunk-N3K2SFEI.js";
25
25
  import {
26
26
  EXT_TO_LANG,
27
27
  detectLang,
@@ -254,12 +254,6 @@ var PolyglotInvariantEngine = class {
254
254
  params,
255
255
  returnType
256
256
  });
257
- functions.set(methodName, {
258
- name: methodName,
259
- isExported: isExp,
260
- params,
261
- returnType
262
- });
263
257
  }
264
258
  }
265
259
  }
@@ -1643,12 +1637,13 @@ function collapseTsImports(code) {
1643
1637
  let importGroupCount = 0;
1644
1638
  for (let i = 0; i < lines.length; i++) {
1645
1639
  const line = lines[i] ?? "";
1646
- const trimmed = line.trim();
1640
+ let trimmed = line.trim();
1647
1641
  if (trimmed.startsWith("import ") || trimmed.startsWith("import{")) {
1648
1642
  inImportGroup = true;
1649
1643
  importGroupCount++;
1650
1644
  while (!trimmed.includes(";") && !trimmed.includes("from '") && !trimmed.includes('from "') && i + 1 < lines.length) {
1651
1645
  i++;
1646
+ trimmed = (lines[i] ?? "").trim();
1652
1647
  }
1653
1648
  } else {
1654
1649
  if (inImportGroup) {
@@ -1989,7 +1984,7 @@ var codebaseRepoMapTool = {
1989
1984
  permission: "auto",
1990
1985
  mutating: false,
1991
1986
  capabilities: ["fs.read"],
1992
- description: "Generate a reference-weighted, token-budgeted Repository Map (Repo Map) of the codebase. Extracts the most architecturally central types, interfaces, classes, and function signatures across the repository into a compact outline (~800-1500 tokens). Use this at the beginning of tasks or when navigating unfamiliar repositories to get a bird-eye view of the architecture.",
1987
+ description: "Generate a reference-weighted, token-budgeted Repository Map of the codebase (~1200 token default). Use it for orientation before a cross-file change. Extracts the most architecturally central types, interfaces, classes, and function signatures across the repository into a compact outline (~800-1500 tokens). Use this at the beginning of tasks or when navigating unfamiliar repositories to get a bird-eye view of the architecture.",
1993
1988
  usageHint: 'USE AT THE START OF COMPLEX OR REPOSITORY-WIDE TASKS:\n\n- Call with default parameters to get a global architecture map within ~1200 tokens.\n- Pass `focusFiles: ["src/auth.ts"]` to ensure candidate files are guaranteed to be mapped alongside related entry-points.\n- Use the returned line numbers (e.g. `/* L32-L45 */`) to navigate or partially read only the functions you need.',
1994
1989
  inputSchema: {
1995
1990
  type: "object",
@@ -2865,4 +2860,4 @@ export {
2865
2860
  deadCodeScanTool,
2866
2861
  runDeadCodeScan
2867
2862
  };
2868
- //# sourceMappingURL=chunk-RTZWBNTY.js.map
2863
+ //# sourceMappingURL=chunk-YEISRT4S.js.map
@@ -7,6 +7,7 @@ import {
7
7
 
8
8
  export {
9
9
  capSubject,
10
- compileUserRegex
10
+ compileUserRegex,
11
+ MAX_SUBJECT_LEN
11
12
  };
12
- //# sourceMappingURL=chunk-Q5JPPCZC.js.map
13
+ //# sourceMappingURL=chunk-YJTXRH5Y.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  builtinToolsPack
3
- } from "./chunk-DC4KMPJO.js";
3
+ } from "./chunk-M6UV67BH.js";
4
4
  import {
5
5
  TIER1_TOOLS,
6
6
  TIER2_TOOLS
7
- } from "./chunk-OTINMOKK.js";
7
+ } from "./chunk-AB2CAUOP.js";
8
8
 
9
9
  // src/tool-tier.ts
10
10
  function toolNameSet(tools) {
@@ -18,6 +18,7 @@ var BUILTIN_TIER_COUNTS = {
18
18
  aggressive: TIER1_TOOLS.length
19
19
  };
20
20
  function selectBuiltinToolsForTier(tier, allTools) {
21
+ if (!Array.isArray(allTools)) return [];
21
22
  switch (tier) {
22
23
  case "off":
23
24
  return [...allTools];
@@ -35,6 +36,8 @@ function selectBuiltinToolsForTier(tier, allTools) {
35
36
  const tier1Names = toolNameSet(TIER1_TOOLS);
36
37
  return allTools.filter((tool) => tier1Names.has(tool.name));
37
38
  }
39
+ default:
40
+ return [...allTools];
38
41
  }
39
42
  }
40
43
  function registerBuiltinToolTier(options) {
@@ -51,4 +54,4 @@ export {
51
54
  selectBuiltinToolsForTier,
52
55
  registerBuiltinToolTier
53
56
  };
54
- //# sourceMappingURL=chunk-GMZYW52L.js.map
57
+ //# sourceMappingURL=chunk-YULVUTK5.js.map
@@ -1,8 +1,10 @@
1
1
  // src/_concurrency.ts
2
2
  async function mapWithConcurrency(items, limit, fn) {
3
- if (items.length === 0) return [];
3
+ if (!Array.isArray(items) || items.length === 0) return [];
4
+ if (typeof fn !== "function") return [];
4
5
  if (items.length === 1) return [await fn(items[0])];
5
- const effectiveLimit = Math.max(1, Math.min(limit | 0, items.length));
6
+ const parsedLimit = Number.isFinite(limit) ? Math.floor(limit) : items.length;
7
+ const effectiveLimit = Math.max(1, Math.min(parsedLimit, items.length));
6
8
  const results = new Array(items.length);
7
9
  let nextIndex = 0;
8
10
  const worker = async () => {
@@ -19,4 +21,4 @@ async function mapWithConcurrency(items, limit, fn) {
19
21
  export {
20
22
  mapWithConcurrency
21
23
  };
22
- //# sourceMappingURL=chunk-NWZ6XGBJ.js.map
24
+ //# sourceMappingURL=chunk-ZBMANLYH.js.map
@@ -9,7 +9,7 @@ import {
9
9
  projectIndexServerBuildId,
10
10
  projectIndexServerEndpoint,
11
11
  projectIndexServerMetadataPath
12
- } from "./chunk-UDVKRX5R.js";
12
+ } from "./chunk-GDDXX27P.js";
13
13
  import {
14
14
  CircuitOpenError,
15
15
  IndexTimeoutError,
@@ -24,7 +24,7 @@ import {
24
24
  searchService,
25
25
  statsService,
26
26
  symbolGraphService
27
- } from "./chunk-KY4PXYSO.js";
27
+ } from "./chunk-N3K2SFEI.js";
28
28
  import {
29
29
  isIndexablePath
30
30
  } from "./chunk-YOHO4DVT.js";
@@ -1269,4 +1269,4 @@ export {
1269
1269
  checkCodebaseIndexServerHealth,
1270
1270
  ensureCodebaseIndexServer
1271
1271
  };
1272
- //# sourceMappingURL=chunk-DP6CXMJZ.js.map
1272
+ //# sourceMappingURL=chunk-ZTCJCYLN.js.map
@@ -47,6 +47,7 @@ export interface CircuitBreakerConfig {
47
47
  */
48
48
  cooldownMs?: number | undefined;
49
49
  }
50
+ export type BreakerState = 'closed' | 'open' | 'half-open';
50
51
  export interface CircuitBreakerSnapshot {
51
52
  state: 'closed' | 'open' | 'half-open';
52
53
  consecutiveFailures: number;