@wrongstack/tools 0.319.1 → 0.320.1

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 (81) hide show
  1. package/dist/audit.js +7 -7
  2. package/dist/bash.js +5 -5
  3. package/dist/browser/index.js +1 -1
  4. package/dist/builtin.js +36 -36
  5. package/dist/{chunk-GMZYW52L.js → chunk-23EX5WDO.js} +6 -3
  6. package/dist/{chunk-OG2BEUBY.js → chunk-34VLZ35Z.js} +13 -9
  7. package/dist/{chunk-O44IMQCN.js → chunk-3GIKYHLA.js} +3 -3
  8. package/dist/{chunk-OTINMOKK.js → chunk-4BABEJC2.js} +26 -26
  9. package/dist/{chunk-42BHI7TN.js → chunk-4CQWNZ62.js} +2 -2
  10. package/dist/{chunk-AKHYMB4V.js → chunk-5UFVCIUB.js} +5 -5
  11. package/dist/{chunk-IYKXK356.js → chunk-DFQDJT22.js} +4 -4
  12. package/dist/{chunk-3PVYQFRQ.js → chunk-ESLPBT5A.js} +2 -1
  13. package/dist/{chunk-X5FOFGXX.js → chunk-HR67OWEP.js} +3 -3
  14. package/dist/{chunk-ATSKPZUK.js → chunk-I7FBZOEP.js} +2 -2
  15. package/dist/{chunk-KY4PXYSO.js → chunk-J43O3BOX.js} +3 -3
  16. package/dist/{chunk-EADULOZV.js → chunk-J74TMK4M.js} +3 -3
  17. package/dist/{chunk-IWS56OY7.js → chunk-JLYA4X7K.js} +47 -3
  18. package/dist/{chunk-FQZOHLG3.js → chunk-JSNSMG5R.js} +3 -2
  19. package/dist/{chunk-DC4KMPJO.js → chunk-JVRLTEO7.js} +2 -2
  20. package/dist/{chunk-V43EQ6VR.js → chunk-KE7A76VC.js} +3 -2
  21. package/dist/{chunk-LOBRWKCR.js → chunk-KWXIKGE3.js} +3 -3
  22. package/dist/{chunk-RTZWBNTY.js → chunk-LRDIRJJL.js} +6 -5
  23. package/dist/{chunk-TTZOK6IY.js → chunk-NDIT3SBZ.js} +2 -2
  24. package/dist/{chunk-RNWUCZ2U.js → chunk-NSPNFOJ7.js} +7 -5
  25. package/dist/{chunk-CMOUCKGC.js → chunk-NU2IZ72J.js} +6 -6
  26. package/dist/{chunk-WHIIIREL.js → chunk-NYRLWDT5.js} +7 -3
  27. package/dist/{chunk-BSJSNVGA.js → chunk-OTPTQBYE.js} +8 -6
  28. package/dist/{chunk-ZHH3BEWU.js → chunk-OYP27E3I.js} +4 -4
  29. package/dist/{chunk-UDVKRX5R.js → chunk-PV6HIZQD.js} +2 -2
  30. package/dist/{chunk-NKNOBUBU.js → chunk-QGF2C7TF.js} +2 -2
  31. package/dist/{chunk-5EUJF3WC.js → chunk-QSNVDHOZ.js} +3 -3
  32. package/dist/{chunk-45JPRMC2.js → chunk-QWKSKFKZ.js} +7 -3
  33. package/dist/{chunk-2VSZC6QM.js → chunk-SCMRM6NL.js} +6 -4
  34. package/dist/{chunk-RJZQWEMS.js → chunk-T77XOX7E.js} +3 -2
  35. package/dist/{chunk-64VIJPFV.js → chunk-UZFY3CKD.js} +3 -3
  36. package/dist/{chunk-IIF5HIVF.js → chunk-VVZPQPTY.js} +2 -2
  37. package/dist/{chunk-MNP3GE7H.js → chunk-W232EFEM.js} +15 -13
  38. package/dist/{chunk-RLMX75EM.js → chunk-WAQASTXB.js} +3 -3
  39. package/dist/{chunk-YOKD4GWJ.js → chunk-XSSFBS5I.js} +4 -3
  40. package/dist/{chunk-UQQS3VNT.js → chunk-YTKSNTT4.js} +3 -3
  41. package/dist/{chunk-DP6CXMJZ.js → chunk-Z5Q3TXRY.js} +3 -3
  42. package/dist/{chunk-CFLJFDYV.js → chunk-Z6IHMJMC.js} +6 -3
  43. package/dist/{chunk-NWZ6XGBJ.js → chunk-ZBMANLYH.js} +5 -3
  44. package/dist/{chunk-JDPQOR7C.js → chunk-ZMW6WJFT.js} +17 -17
  45. package/dist/codebase-index/index.js +10 -10
  46. package/dist/codebase-index/parser-worker-script.js +3 -3
  47. package/dist/codebase-index/project-server.js +5 -5
  48. package/dist/codebase-index/worker.js +4 -4
  49. package/dist/diff.js +2 -2
  50. package/dist/edit.js +8 -8
  51. package/dist/exec.js +5 -5
  52. package/dist/format.js +7 -7
  53. package/dist/glob.js +2 -2
  54. package/dist/{go-parser-IKHW67WE.js → go-parser-D7ELWQ7F.js} +2 -2
  55. package/dist/grep.js +2 -2
  56. package/dist/index.js +40 -40
  57. package/dist/install.js +7 -7
  58. package/dist/{json-parser-2EOVP5MR.js → json-parser-34DHYCPW.js} +1 -18
  59. package/dist/languages/index.js +5 -5
  60. package/dist/{legacy-bridge-3T7SR4SK.js → legacy-bridge-FOV5ODDI.js} +7 -7
  61. package/dist/lint.js +7 -7
  62. package/dist/memory.js +1 -1
  63. package/dist/next-steps.d.ts +7 -0
  64. package/dist/next-steps.js +82 -38
  65. package/dist/outdated.js +3 -3
  66. package/dist/pack.js +37 -37
  67. package/dist/{parser-dispatch-QGC4HSP5.js → parser-dispatch-BDVCJXTV.js} +4 -4
  68. package/dist/patch.js +7 -7
  69. package/dist/process-registry.js +1 -1
  70. package/dist/ps-slash.js +3 -3
  71. package/dist/{py-parser-RFWG2HYI.js → py-parser-QC6MR4GB.js} +3 -3
  72. package/dist/read.js +7 -7
  73. package/dist/replace.js +8 -8
  74. package/dist/test.js +7 -7
  75. package/dist/tool-search.js +1 -1
  76. package/dist/tool-tier.js +38 -38
  77. package/dist/tree.js +1 -1
  78. package/dist/typecheck.js +7 -7
  79. package/dist/win32.js +1 -1
  80. package/dist/write.js +8 -8
  81. package/package.json +5 -5
@@ -12,11 +12,12 @@ function loadTypescript() {
12
12
  return tsLoad;
13
13
  }
14
14
  async function checkSyntax(filePath, content, previousContent) {
15
+ if (typeof filePath !== "string" || typeof content !== "string") return void 0;
15
16
  const errors = await parseErrors(filePath, content);
16
17
  if (errors === void 0) return void 0;
17
18
  if (errors.length === 0) return { errors, preExisting: false };
18
19
  let preExisting = false;
19
- if (previousContent !== void 0) {
20
+ if (typeof previousContent === "string") {
20
21
  const prevErrors = await parseErrors(filePath, previousContent);
21
22
  preExisting = prevErrors !== void 0 && prevErrors.length > 0;
22
23
  }
@@ -86,4 +87,4 @@ function formatDiag(ts, diag, content, sourceFile) {
86
87
  export {
87
88
  checkSyntax
88
89
  };
89
- //# sourceMappingURL=chunk-FQZOHLG3.js.map
90
+ //# sourceMappingURL=chunk-JSNSMG5R.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  builtinTools
3
- } from "./chunk-OTINMOKK.js";
3
+ } from "./chunk-4BABEJC2.js";
4
4
 
5
5
  // src/pack.ts
6
6
  var builtinToolsPack = {
@@ -12,4 +12,4 @@ var builtinToolsPack = {
12
12
  export {
13
13
  builtinToolsPack
14
14
  };
15
- //# sourceMappingURL=chunk-DC4KMPJO.js.map
15
+ //# sourceMappingURL=chunk-JVRLTEO7.js.map
@@ -56,7 +56,8 @@ function buildWin32CmdShimInvocation(command, args = []) {
56
56
  };
57
57
  }
58
58
  function quoteWin32CmdArg(arg) {
59
- return `"${arg}"`;
59
+ const escaped = arg.replace(/(\\+)$/, "$1$1");
60
+ return `"${escaped}"`;
60
61
  }
61
62
 
62
63
  export {
@@ -65,4 +66,4 @@ export {
65
66
  assertSafeWin32ShellArgs,
66
67
  buildWin32CmdShimInvocation
67
68
  };
68
- //# sourceMappingURL=chunk-V43EQ6VR.js.map
69
+ //# sourceMappingURL=chunk-KE7A76VC.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  tryLegacyCodeOperation
3
- } from "./chunk-ATSKPZUK.js";
3
+ } from "./chunk-I7FBZOEP.js";
4
4
  import {
5
5
  spawnStream
6
- } from "./chunk-ZHH3BEWU.js";
6
+ } from "./chunk-OYP27E3I.js";
7
7
  import {
8
8
  normalizeCommandOutput,
9
9
  safeResolveReal
@@ -181,4 +181,4 @@ async function detectLinter(cwd) {
181
181
  export {
182
182
  lintTool
183
183
  };
184
- //# sourceMappingURL=chunk-LOBRWKCR.js.map
184
+ //# sourceMappingURL=chunk-KWXIKGE3.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-OYP27E3I.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-Z5Q3TXRY.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-J43O3BOX.js";
25
25
  import {
26
26
  EXT_TO_LANG,
27
27
  detectLang,
@@ -1643,12 +1643,13 @@ function collapseTsImports(code) {
1643
1643
  let importGroupCount = 0;
1644
1644
  for (let i = 0; i < lines.length; i++) {
1645
1645
  const line = lines[i] ?? "";
1646
- const trimmed = line.trim();
1646
+ let trimmed = line.trim();
1647
1647
  if (trimmed.startsWith("import ") || trimmed.startsWith("import{")) {
1648
1648
  inImportGroup = true;
1649
1649
  importGroupCount++;
1650
1650
  while (!trimmed.includes(";") && !trimmed.includes("from '") && !trimmed.includes('from "') && i + 1 < lines.length) {
1651
1651
  i++;
1652
+ trimmed = (lines[i] ?? "").trim();
1652
1653
  }
1653
1654
  } else {
1654
1655
  if (inImportGroup) {
@@ -2865,4 +2866,4 @@ export {
2865
2866
  deadCodeScanTool,
2866
2867
  runDeadCodeScan
2867
2868
  };
2868
- //# sourceMappingURL=chunk-RTZWBNTY.js.map
2869
+ //# sourceMappingURL=chunk-LRDIRJJL.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  spawnStream
3
- } from "./chunk-ZHH3BEWU.js";
3
+ } from "./chunk-OYP27E3I.js";
4
4
  import {
5
5
  normalizeCommandOutput,
6
6
  safeResolveReal
@@ -3515,4 +3515,4 @@ export {
3515
3515
  languagePackageTool,
3516
3516
  languageInfoTool
3517
3517
  };
3518
- //# sourceMappingURL=chunk-TTZOK6IY.js.map
3518
+ //# sourceMappingURL=chunk-NDIT3SBZ.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getIndexState,
3
3
  searchCodebaseIndex
4
- } from "./chunk-DP6CXMJZ.js";
4
+ } from "./chunk-Z5Q3TXRY.js";
5
5
  import {
6
6
  codebaseIndexDirOverride
7
- } from "./chunk-KY4PXYSO.js";
7
+ } from "./chunk-J43O3BOX.js";
8
8
  import {
9
9
  isBinaryBuffer,
10
10
  safeResolveReal,
@@ -109,8 +109,10 @@ var readTool = {
109
109
  context: { size: stat2.size, limit: MAX_BYTES, reason: "too-large" }
110
110
  });
111
111
  }
112
- const offset = Math.max(1, input.offset ?? 1);
113
- const limit = Math.max(0, Math.min(input.limit ?? 2e3, 5e3));
112
+ const rawOffset = typeof input.offset === "number" && Number.isFinite(input.offset) ? input.offset : 1;
113
+ const offset = Math.max(1, Math.floor(rawOffset));
114
+ const rawLimit = typeof input.limit === "number" && Number.isFinite(input.limit) ? input.limit : 2e3;
115
+ const limit = Math.max(0, Math.min(Math.floor(rawLimit), 5e3));
114
116
  const prior = getReadRangeRecord(ctx, absPath);
115
117
  const requestedEnd = prior ? Math.min(offset + limit - 1, prior.totalLines) : offset + limit - 1;
116
118
  if (input.mode !== "summary" && limit > 0 && prior && offset <= requestedEnd && coversRange(prior, stat2.mtimeMs, stat2.size, offset, requestedEnd)) {
@@ -323,4 +325,4 @@ ${interesting.join("\n")}` : "symbols/imports: (none detected)"
323
325
  export {
324
326
  readTool
325
327
  };
326
- //# sourceMappingURL=chunk-RNWUCZ2U.js.map
328
+ //# sourceMappingURL=chunk-NSPNFOJ7.js.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  resolvePythonBinary
3
- } from "./chunk-IIF5HIVF.js";
3
+ } from "./chunk-VVZPQPTY.js";
4
4
  import {
5
5
  parseParserBatchOutput,
6
6
  withSpawnGate
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/import-extractor.ts
13
13
  var IMPORT_MAX_FILE_CHARS = 512 * 1024;
@@ -828,11 +828,11 @@ async function dispatch(file, content, lang) {
828
828
  return parseSymbols({ file, content, lang });
829
829
  }
830
830
  case "go": {
831
- const { parseSymbols } = await import("./go-parser-IKHW67WE.js");
831
+ const { parseSymbols } = await import("./go-parser-D7ELWQ7F.js");
832
832
  return parseSymbols({ file, content, lang: "go" });
833
833
  }
834
834
  case "py": {
835
- const { parseSymbols } = await import("./py-parser-RFWG2HYI.js");
835
+ const { parseSymbols } = await import("./py-parser-QC6MR4GB.js");
836
836
  return parseSymbols({ file, content, lang: "py" });
837
837
  }
838
838
  case "rs": {
@@ -840,7 +840,7 @@ async function dispatch(file, content, lang) {
840
840
  return parseSymbols({ file, content, lang: "rs" });
841
841
  }
842
842
  case "json": {
843
- const { parseSymbols } = await import("./json-parser-2EOVP5MR.js");
843
+ const { parseSymbols } = await import("./json-parser-34DHYCPW.js");
844
844
  return parseSymbols({ file, content, lang: "json" });
845
845
  }
846
846
  case "yaml": {
@@ -889,4 +889,4 @@ export {
889
889
  parseFileContent,
890
890
  parseFilesContent
891
891
  };
892
- //# sourceMappingURL=chunk-CMOUCKGC.js.map
892
+ //# sourceMappingURL=chunk-NU2IZ72J.js.map
@@ -109,6 +109,10 @@ function forgetTool(memory) {
109
109
  }
110
110
  };
111
111
  }
112
+ function normalizeMemoryLimit(value) {
113
+ const raw = typeof value === "number" && Number.isFinite(value) ? value : 5;
114
+ return Math.max(1, Math.min(Math.floor(raw), 20));
115
+ }
112
116
  function searchMemoryTool(memory) {
113
117
  return {
114
118
  name: "search_memory",
@@ -146,7 +150,7 @@ function searchMemoryTool(memory) {
146
150
  });
147
151
  }
148
152
  const scope = input.scope ?? "project-memory";
149
- const limit = Math.min(input.limit ?? 5, 20);
153
+ const limit = normalizeMemoryLimit(input.limit);
150
154
  const entries = await memory.search(input.query, scope, limit);
151
155
  return {
152
156
  results: entries.map((e) => ({
@@ -198,7 +202,7 @@ function relatedMemoryTool(memory) {
198
202
  });
199
203
  }
200
204
  const scope = input.scope ?? "project-memory";
201
- const limit = Math.min(input.limit ?? 5, 20);
205
+ const limit = normalizeMemoryLimit(input.limit);
202
206
  const entries = memory.findRelated ? await memory.findRelated(input.text, scope, limit) : await memory.search(input.text, scope, limit);
203
207
  return {
204
208
  results: entries.map((e) => ({
@@ -220,4 +224,4 @@ export {
220
224
  searchMemoryTool,
221
225
  relatedMemoryTool
222
226
  };
223
- //# sourceMappingURL=chunk-WHIIIREL.js.map
227
+ //# sourceMappingURL=chunk-NYRLWDT5.js.map
@@ -3,19 +3,19 @@ import {
3
3
  } from "./chunk-BTSFTGIL.js";
4
4
  import {
5
5
  getPersistentProcessRegistry
6
- } from "./chunk-NKNOBUBU.js";
6
+ } from "./chunk-QGF2C7TF.js";
7
7
  import {
8
8
  createOutputSpool,
9
9
  spoolNote
10
- } from "./chunk-2VSZC6QM.js";
10
+ } from "./chunk-SCMRM6NL.js";
11
11
  import {
12
12
  getProcessRegistry,
13
13
  redactCommand
14
- } from "./chunk-3PVYQFRQ.js";
14
+ } from "./chunk-ESLPBT5A.js";
15
15
  import {
16
16
  buildWin32CmdShimInvocation,
17
17
  resolveWin32Command
18
- } from "./chunk-V43EQ6VR.js";
18
+ } from "./chunk-KE7A76VC.js";
19
19
  import {
20
20
  COMMAND_OUTPUT_MAX_BYTES,
21
21
  normalizeCommandOutput,
@@ -428,12 +428,14 @@ var RULES = [
428
428
  }
429
429
  ];
430
430
  function detectDanger(cmd, args, bypass) {
431
+ if (typeof cmd !== "string") return { level: "safe", reasons: [] };
432
+ const safeArgs = Array.isArray(args) ? args : [];
431
433
  const reasons = [];
432
434
  let level = "safe";
433
435
  let matchedRule;
434
436
  for (const rule of RULES) {
435
437
  if (bypass?.has(rule.id)) continue;
436
- if (!rule.test(cmd, args)) continue;
438
+ if (!rule.test(cmd, safeArgs)) continue;
437
439
  reasons.push(rule.reason);
438
440
  if (matchedRule === void 0 || levelRank(rule.level) >= levelRank(level)) {
439
441
  matchedRule = rule.id;
@@ -1819,4 +1821,4 @@ export {
1819
1821
  getExecAllowlist,
1820
1822
  execTool
1821
1823
  };
1822
- //# sourceMappingURL=chunk-BSJSNVGA.js.map
1824
+ //# sourceMappingURL=chunk-OTPTQBYE.js.map
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  createOutputSpool,
3
3
  spoolNote
4
- } from "./chunk-2VSZC6QM.js";
4
+ } from "./chunk-SCMRM6NL.js";
5
5
  import {
6
6
  getProcessRegistry,
7
7
  redactCommand
8
- } from "./chunk-3PVYQFRQ.js";
8
+ } from "./chunk-ESLPBT5A.js";
9
9
  import {
10
10
  buildWin32CmdShimInvocation,
11
11
  resolveWin32Command
12
- } from "./chunk-V43EQ6VR.js";
12
+ } from "./chunk-KE7A76VC.js";
13
13
 
14
14
  // src/_spawn-stream.ts
15
15
  import { spawn } from "node:child_process";
@@ -258,4 +258,4 @@ function utf8Prefix(text, maxBytes) {
258
258
  export {
259
259
  spawnStream
260
260
  };
261
- //# sourceMappingURL=chunk-ZHH3BEWU.js.map
261
+ //# sourceMappingURL=chunk-OYP27E3I.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveIndexDir
3
- } from "./chunk-KY4PXYSO.js";
3
+ } from "./chunk-J43O3BOX.js";
4
4
 
5
5
  // src/codebase-index/binary-frame.ts
6
6
  import { decode, encode } from "@msgpack/msgpack";
@@ -120,4 +120,4 @@ export {
120
120
  PROJECT_INDEX_SERVER_MAX_FRAME_CHARS,
121
121
  encodeProjectServerMessage
122
122
  };
123
- //# sourceMappingURL=chunk-UDVKRX5R.js.map
123
+ //# sourceMappingURL=chunk-PV6HIZQD.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getProcessRegistry
3
- } from "./chunk-3PVYQFRQ.js";
3
+ } from "./chunk-ESLPBT5A.js";
4
4
 
5
5
  // src/process-registry-persistent.ts
6
6
  import * as fs from "node:fs/promises";
@@ -519,4 +519,4 @@ export {
519
519
  getPersistentProcessRegistry,
520
520
  resetPersistentProcessRegistry
521
521
  };
522
- //# sourceMappingURL=chunk-NKNOBUBU.js.map
522
+ //# sourceMappingURL=chunk-QGF2C7TF.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  tryLegacyCodeOperation
3
- } from "./chunk-ATSKPZUK.js";
3
+ } from "./chunk-I7FBZOEP.js";
4
4
  import {
5
5
  spawnStream
6
- } from "./chunk-ZHH3BEWU.js";
6
+ } from "./chunk-OYP27E3I.js";
7
7
  import {
8
8
  detectPackageManager,
9
9
  normalizeCommandOutput,
@@ -163,4 +163,4 @@ async function findTsConfig(cwd) {
163
163
  export {
164
164
  typecheckTool
165
165
  };
166
- //# sourceMappingURL=chunk-5EUJF3WC.js.map
166
+ //# sourceMappingURL=chunk-QSNVDHOZ.js.map
@@ -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-QWKSKFKZ.js.map
@@ -29,13 +29,15 @@ function sweepOldSpoolFiles(dir) {
29
29
  })();
30
30
  }
31
31
  function spoolNote(info) {
32
+ if (!info) return "";
32
33
  const dropped = info.droppedBytes > 0 ? `, ~${info.droppedBytes} bytes dropped under backpressure` : "";
33
34
  return `
34
35
  [output truncated \u2014 full ${info.bytes} bytes at ${info.path}${dropped}; read/grep that file selectively instead of re-running with more output]`;
35
36
  }
36
37
  function createOutputSpool(opts) {
37
- const threshold = opts.thresholdBytes ?? 32768;
38
- const safeTool = opts.tool.replace(/[^a-zA-Z0-9._-]+/g, "_").slice(0, 40) || "tool";
38
+ const threshold = opts?.thresholdBytes ?? 32768;
39
+ const toolName = typeof opts?.tool === "string" ? opts.tool : "tool";
40
+ const safeTool = toolName.replace(/[^a-zA-Z0-9._-]+/g, "_").slice(0, 40) || "tool";
39
41
  let head = "";
40
42
  let headBytes = 0;
41
43
  let totalBytes = 0;
@@ -68,7 +70,7 @@ function createOutputSpool(opts) {
68
70
  };
69
71
  return {
70
72
  write(text) {
71
- if (finalized || !text) return;
73
+ if (finalized || typeof text !== "string" || !text) return;
72
74
  const textBytes = Buffer.byteLength(text, "utf8");
73
75
  totalBytes += textBytes;
74
76
  if (!stream && !failed) {
@@ -110,4 +112,4 @@ export {
110
112
  spoolNote,
111
113
  createOutputSpool
112
114
  };
113
- //# sourceMappingURL=chunk-2VSZC6QM.js.map
115
+ //# sourceMappingURL=chunk-SCMRM6NL.js.map
@@ -39,7 +39,8 @@ var toolSearchTool = {
39
39
  }
40
40
  },
41
41
  async execute(input, ctx) {
42
- const limit = Math.min(input.limit ?? 20, 100);
42
+ const rawLimit = typeof input.limit === "number" && Number.isFinite(input.limit) ? input.limit : 20;
43
+ const limit = Math.max(1, Math.min(Math.floor(rawLimit), 100));
43
44
  const tools = ctx.catalogTools ?? ctx.tools;
44
45
  const query = input.query?.toLowerCase() ?? "";
45
46
  const filtered = tools.filter((t) => {
@@ -81,4 +82,4 @@ var toolSearchTool = {
81
82
  export {
82
83
  toolSearchTool
83
84
  };
84
- //# sourceMappingURL=chunk-RJZQWEMS.js.map
85
+ //# sourceMappingURL=chunk-T77XOX7E.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  tryLegacyPackageOperation
3
- } from "./chunk-ATSKPZUK.js";
3
+ } from "./chunk-I7FBZOEP.js";
4
4
  import {
5
5
  spawnStream
6
- } from "./chunk-ZHH3BEWU.js";
6
+ } from "./chunk-OYP27E3I.js";
7
7
  import {
8
8
  COMMAND_OUTPUT_MAX_BYTES,
9
9
  detectPackageManager,
@@ -209,4 +209,4 @@ function extractAdvisories(data) {
209
209
  export {
210
210
  auditTool
211
211
  };
212
- //# sourceMappingURL=chunk-64VIJPFV.js.map
212
+ //# sourceMappingURL=chunk-UZFY3CKD.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
@@ -84,9 +84,10 @@ var treeTool = {
84
84
  const showFiles = input.show_files ?? true;
85
85
  const showDirs = input.show_dirs ?? true;
86
86
  const showHidden = input.show_hidden ?? false;
87
+ const rawExclude = Array.isArray(input.exclude) ? input.exclude : typeof input.exclude === "string" ? [input.exclude] : [];
87
88
  const exclude = /* @__PURE__ */ new Set([
88
89
  ...DEFAULT_IGNORE,
89
- ...(input.exclude ?? []).map(
90
+ ...rawExclude.filter((s) => typeof s === "string").map(
90
91
  (s) => s.trim().replace(/[\\/]+$/, "").replace(/^\.\//, "")
91
92
  ).filter(Boolean)
92
93
  ]);
@@ -218,19 +219,20 @@ async function walkDir(dir, depth, opts) {
218
219
  const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
219
220
  const displayName = entry.name + (entry.isDirectory() ? "/" : "");
220
221
  const isDir = entry.isDirectory();
221
- if (!opts.showDirs && isDir) continue;
222
- if (!opts.showFiles && !isDir) continue;
223
- const line = opts.prefix + branch + displayName;
224
- const lineBytes = Buffer.byteLength(line, "utf8") + 1;
225
- if (opts.retention.entries >= opts.retention.maxEntries || opts.retention.outputBytes + lineBytes > opts.retention.maxOutputBytes) {
226
- opts.retention.truncated = true;
227
- return;
222
+ const showEntry = isDir && opts.showDirs || !isDir && opts.showFiles;
223
+ if (showEntry) {
224
+ const line = opts.prefix + branch + displayName;
225
+ const lineBytes = Buffer.byteLength(line, "utf8") + 1;
226
+ if (opts.retention.entries >= opts.retention.maxEntries || opts.retention.outputBytes + lineBytes > opts.retention.maxOutputBytes) {
227
+ opts.retention.truncated = true;
228
+ return;
229
+ }
230
+ opts.lines.push(line);
231
+ opts.retention.entries++;
232
+ opts.retention.outputBytes += lineBytes;
228
233
  }
229
- opts.lines.push(line);
230
- opts.retention.entries++;
231
- opts.retention.outputBytes += lineBytes;
232
234
  if (entry.isDirectory() && (opts.maxDepth === 0 || depth < opts.maxDepth)) {
233
- const childPrefix = opts.prefix + connector;
235
+ const childPrefix = showEntry ? opts.prefix + connector : opts.prefix;
234
236
  await walkDir(path.join(dir, entry.name), depth + 1, {
235
237
  ...opts,
236
238
  prefix: childPrefix,
@@ -243,4 +245,4 @@ async function walkDir(dir, depth, opts) {
243
245
  export {
244
246
  treeTool
245
247
  };
246
- //# sourceMappingURL=chunk-MNP3GE7H.js.map
248
+ //# sourceMappingURL=chunk-W232EFEM.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  tryLegacyPackageOperation
3
- } from "./chunk-ATSKPZUK.js";
3
+ } from "./chunk-I7FBZOEP.js";
4
4
  import {
5
5
  spawnStream
6
- } from "./chunk-ZHH3BEWU.js";
6
+ } from "./chunk-OYP27E3I.js";
7
7
  import {
8
8
  detectPackageManager,
9
9
  normalizeCommandOutput,
@@ -232,4 +232,4 @@ function resolveManifestPath(cwd, pkgManager) {
232
232
  export {
233
233
  installTool
234
234
  };
235
- //# sourceMappingURL=chunk-RLMX75EM.js.map
235
+ //# sourceMappingURL=chunk-WAQASTXB.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-Q5JPPCZC.js";
5
5
  import {
6
6
  mapWithConcurrency
7
- } from "./chunk-NWZ6XGBJ.js";
7
+ } from "./chunk-ZBMANLYH.js";
8
8
  import {
9
9
  loadGitignoreMatcher
10
10
  } from "./chunk-DTQ75VBC.js";
@@ -99,7 +99,8 @@ var grepTool = {
99
99
  }
100
100
  const base = input.path ? await safeResolveReal(input.path, ctx) : ctx.cwd;
101
101
  const mode = input.output_mode ?? "content";
102
- const limit = Math.max(1, Math.min(input.limit ?? 200, 2e3));
102
+ const rawLimit = typeof input.limit === "number" && Number.isFinite(input.limit) ? input.limit : 200;
103
+ const limit = Math.max(1, Math.min(Math.floor(rawLimit), 2e3));
103
104
  const validation = compileUserRegex(input.pattern, input.case_insensitive ? "i" : "");
104
105
  if (!validation.ok) {
105
106
  throw new ToolValidationError({
@@ -516,4 +517,4 @@ export {
516
517
  __resetRgDetectionForTests,
517
518
  __setRgAvailableForTests
518
519
  };
519
- //# sourceMappingURL=chunk-YOKD4GWJ.js.map
520
+ //# sourceMappingURL=chunk-XSSFBS5I.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  tryLegacyCodeOperation
3
- } from "./chunk-ATSKPZUK.js";
3
+ } from "./chunk-I7FBZOEP.js";
4
4
  import {
5
5
  spawnStream
6
- } from "./chunk-ZHH3BEWU.js";
6
+ } from "./chunk-OYP27E3I.js";
7
7
  import {
8
8
  normalizeCommandOutput,
9
9
  safeResolveReal
@@ -231,4 +231,4 @@ ${result.stderr}` : result.stdout || result.stderr || result.error || "";
231
231
  export {
232
232
  testTool
233
233
  };
234
- //# sourceMappingURL=chunk-UQQS3VNT.js.map
234
+ //# sourceMappingURL=chunk-YTKSNTT4.js.map
@@ -9,7 +9,7 @@ import {
9
9
  projectIndexServerBuildId,
10
10
  projectIndexServerEndpoint,
11
11
  projectIndexServerMetadataPath
12
- } from "./chunk-UDVKRX5R.js";
12
+ } from "./chunk-PV6HIZQD.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-J43O3BOX.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-Z5Q3TXRY.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  checkSyntax
3
- } from "./chunk-FQZOHLG3.js";
3
+ } from "./chunk-JSNSMG5R.js";
4
4
  import {
5
5
  enqueueReindex
6
- } from "./chunk-DP6CXMJZ.js";
6
+ } from "./chunk-Z5Q3TXRY.js";
7
7
  import {
8
8
  safeResolveReal,
9
9
  sha256hex,
@@ -39,6 +39,9 @@ var FUZZY_MIN_SIMILARITY = 0.9;
39
39
  var FUZZY_AMBIGUITY_MARGIN = 0.05;
40
40
  var FUZZY_MAX_INTERIOR_CHARS = 2e3;
41
41
  function findLadderMatches(fileLf, oldLf) {
42
+ if (typeof fileLf !== "string" || typeof oldLf !== "string" || oldLf.length === 0) {
43
+ return void 0;
44
+ }
42
45
  const exact = [];
43
46
  let idx = fileLf.indexOf(oldLf);
44
47
  let currentLine = 1;
@@ -515,4 +518,4 @@ Compare this against your old_string and retry with the file's actual text.` : "
515
518
  export {
516
519
  editTool
517
520
  };
518
- //# sourceMappingURL=chunk-CFLJFDYV.js.map
521
+ //# sourceMappingURL=chunk-Z6IHMJMC.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