@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
@@ -1,15 +1,17 @@
1
1
  import {
2
2
  tryLegacyCodeOperation
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
+ ensureInsideRoot,
8
9
  normalizeCommandOutput,
9
10
  safeResolveReal
10
11
  } from "./chunk-ZUFHAHTE.js";
11
12
 
12
13
  // src/format.ts
14
+ import * as path from "node:path";
13
15
  import { ToolValidationError } from "@wrongstack/core/types";
14
16
  var formatTool = {
15
17
  name: "format",
@@ -43,18 +45,43 @@ var formatTool = {
43
45
  cwd: { type: "string", description: "Working directory (default: cwd)" }
44
46
  }
45
47
  },
48
+ writeTargets(input) {
49
+ if (input?.check) return [];
50
+ if (!input?.files) return [];
51
+ const rawFiles = Array.isArray(input.files) ? input.files : input.files.split(",");
52
+ return [
53
+ ...new Set(
54
+ rawFiles.filter((f) => typeof f === "string").map((f) => f.trim().replace(/\\/g, "/")).filter(Boolean)
55
+ )
56
+ ];
57
+ },
46
58
  async execute(input, ctx, opts) {
47
59
  let final;
48
60
  const executeStream = formatTool.executeStream;
49
61
  if (!executeStream) throw new Error("formatTool: stream execution unavailable");
50
- for await (const ev of executeStream(input, ctx, opts)) {
62
+ const signal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
63
+ for await (const ev of executeStream(input, ctx, { signal })) {
51
64
  if (ev.type === "final") final = ev.output;
52
65
  }
53
66
  if (!final) throw new Error("format: stream ended without final event");
54
67
  return final;
55
68
  },
56
69
  async *executeStream(input, ctx, opts) {
57
- const cwd = input.cwd ? await safeResolveReal(input.cwd, ctx) : ctx.cwd;
70
+ if (input.cwd !== void 0 && (typeof input.cwd !== "string" || !input.cwd.trim())) {
71
+ throw new ToolValidationError({
72
+ message: "format: cwd must be a non-empty string when provided.",
73
+ field: "cwd"
74
+ });
75
+ }
76
+ let cwd;
77
+ try {
78
+ cwd = input.cwd ? await safeResolveReal(input.cwd, ctx) : ctx.cwd;
79
+ } catch (err) {
80
+ throw new ToolValidationError({
81
+ message: `format: ${err.message}`,
82
+ field: "cwd"
83
+ });
84
+ }
58
85
  const signal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
59
86
  signal.throwIfAborted();
60
87
  const VALID_FIXERS = /* @__PURE__ */ new Set(["biome", "prettier", "auto"]);
@@ -107,7 +134,21 @@ var formatTool = {
107
134
  text: `Running ${detected}\u2026`,
108
135
  data: { fixer: detected, check: !!input.check }
109
136
  };
110
- const fileList = input.files ? (Array.isArray(input.files) ? input.files : input.files.split(",")).map((f) => f.trim().replace(/\\/g, "/")).filter(Boolean) : [];
137
+ const fileList = input.files ? [
138
+ ...new Set(
139
+ (Array.isArray(input.files) ? input.files : input.files.split(",")).filter((f) => typeof f === "string").map((f) => f.trim().replace(/\\/g, "/")).filter(Boolean)
140
+ )
141
+ ] : [];
142
+ for (const f of fileList) {
143
+ try {
144
+ ensureInsideRoot(path.resolve(cwd, f), ctx);
145
+ } catch (err) {
146
+ throw new ToolValidationError({
147
+ message: `format: file "${f}" ${err.message}`,
148
+ field: "files"
149
+ });
150
+ }
151
+ }
111
152
  let args;
112
153
  if (detected === "prettier") {
113
154
  args = [input.check ? "--check" : "--write"];
@@ -198,6 +239,8 @@ async function detectFixer(cwd) {
198
239
  }
199
240
 
200
241
  export {
201
- formatTool
242
+ formatTool,
243
+ parseFormatterCounts,
244
+ detectFixer
202
245
  };
203
- //# sourceMappingURL=chunk-EADULOZV.js.map
246
+ //# sourceMappingURL=chunk-NJX2RXKJ.js.map
@@ -3,18 +3,18 @@ import {
3
3
  } from "./chunk-BTSFTGIL.js";
4
4
  import {
5
5
  getPersistentProcessRegistry
6
- } from "./chunk-NKNOBUBU.js";
6
+ } from "./chunk-PVCB7RUZ.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-HDYUBRMF.js";
15
15
  import {
16
16
  resolvePowerShell
17
- } from "./chunk-V43EQ6VR.js";
17
+ } from "./chunk-KE7A76VC.js";
18
18
  import {
19
19
  normalizeCommandOutput
20
20
  } from "./chunk-ZUFHAHTE.js";
@@ -903,7 +903,7 @@ ${hint}` : "") + pipeToShellNote,
903
903
  exit_code: timedOut || isAborted ? 124 : c.code,
904
904
  timed_out: timedOut || isAborted,
905
905
  pid: pid ?? null,
906
- error: isAborted ? "Command aborted by user or signal" : void 0
906
+ error: timedOut ? "Command timed out" : isAborted ? "Command aborted by user or signal" : void 0
907
907
  }
908
908
  };
909
909
  ctx.recordSideEffect?.({
@@ -977,4 +977,4 @@ export {
977
977
  checkAndBlockKillCommand,
978
978
  bashTool
979
979
  };
980
- //# sourceMappingURL=chunk-AKHYMB4V.js.map
980
+ //# sourceMappingURL=chunk-NN2SNP2R.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
@@ -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
  detectPackageManager,
9
9
  normalizeCommandOutput,
@@ -66,16 +66,37 @@ var installTool = {
66
66
  let final;
67
67
  const executeStream = installTool.executeStream;
68
68
  if (!executeStream) throw new Error("installTool: stream execution unavailable");
69
- for await (const ev of executeStream(input, ctx, opts)) {
69
+ const signal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
70
+ for await (const ev of executeStream(input, ctx, { signal })) {
70
71
  if (ev.type === "final") final = ev.output;
71
72
  }
72
73
  if (!final) throw new Error("install: stream ended without final event");
73
74
  return final;
74
75
  },
75
76
  async *executeStream(input, ctx, opts) {
76
- const cwd = input.cwd ? await safeResolveReal(input.cwd, ctx) : ctx.cwd;
77
+ if (input.cwd !== void 0 && (typeof input.cwd !== "string" || !input.cwd.trim())) {
78
+ throw new ToolValidationError({
79
+ message: "install: cwd must be a non-empty string when provided.",
80
+ field: "cwd"
81
+ });
82
+ }
83
+ let cwd;
84
+ try {
85
+ cwd = input.cwd ? await safeResolveReal(input.cwd, ctx) : ctx.cwd;
86
+ } catch (err) {
87
+ throw new ToolValidationError({
88
+ message: `install: ${err.message}`,
89
+ field: "cwd"
90
+ });
91
+ }
77
92
  const signal = opts?.signal ?? ctx.signal ?? new AbortController().signal;
78
93
  signal.throwIfAborted();
94
+ if (input.packages !== void 0 && typeof input.packages !== "string" && !Array.isArray(input.packages)) {
95
+ throw new ToolValidationError({
96
+ message: "install: packages must be a string or array of strings",
97
+ field: "packages"
98
+ });
99
+ }
79
100
  const VALID_SAVES = /* @__PURE__ */ new Set(["dependency", "dev", "optional"]);
80
101
  if (input.save !== void 0 && !VALID_SAVES.has(input.save)) {
81
102
  throw new ToolValidationError({
@@ -84,7 +105,7 @@ var installTool = {
84
105
  });
85
106
  }
86
107
  if (!input.global) {
87
- const rawList2 = input.packages ? (Array.isArray(input.packages) ? input.packages : input.packages.split(",")).map((p) => p.trim()).filter(Boolean) : [];
108
+ const rawList2 = input.packages ? (Array.isArray(input.packages) ? input.packages : input.packages.split(",")).filter((p) => typeof p === "string").map((p) => p.trim()).filter(Boolean) : [];
88
109
  const pkgList2 = Array.from(new Set(rawList2));
89
110
  const bridge = await tryLegacyPackageOperation(
90
111
  "package-install",
@@ -102,7 +123,7 @@ var installTool = {
102
123
  type: "final",
103
124
  output: {
104
125
  exit_code: run?.exitCode ?? 0,
105
- packages: [],
126
+ packages: pkgList2,
106
127
  output: normalizeCommandOutput(
107
128
  run?.output || outcome.manifestsChanged.join(", ") || "ok"
108
129
  ),
@@ -117,7 +138,7 @@ var installTool = {
117
138
  yield { type: "log", text: `Resolving with ${pkgManager}\u2026`, data: { phase: "resolve" } };
118
139
  const globalFlag = input.global ? ["-g"] : [];
119
140
  const ignoreScripts = input.lifecycleScripts !== true;
120
- const rawList = input.packages ? (Array.isArray(input.packages) ? input.packages : input.packages.split(",")).map((p) => p.trim()).filter(Boolean) : [];
141
+ const rawList = input.packages ? (Array.isArray(input.packages) ? input.packages : input.packages.split(",")).filter((p) => typeof p === "string").map((p) => p.trim()).filter(Boolean) : [];
121
142
  const pkgList = Array.from(new Set(rawList));
122
143
  const PKG_NAME_RE = /^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+(?:@[a-z0-9^~><=*.+-]+)?$/i;
123
144
  for (const pkg of pkgList) {
@@ -232,4 +253,4 @@ function resolveManifestPath(cwd, pkgManager) {
232
253
  export {
233
254
  installTool
234
255
  };
235
- //# sourceMappingURL=chunk-RLMX75EM.js.map
256
+ //# sourceMappingURL=chunk-O6BY43ZB.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getProcessRegistry
3
- } from "./chunk-3PVYQFRQ.js";
3
+ } from "./chunk-HDYUBRMF.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-PVCB7RUZ.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  tryLegacyCodeOperation
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
  normalizeCommandOutput,
9
9
  safeResolveReal
@@ -166,7 +166,7 @@ function buildArgs(runner, input) {
166
166
  if (input.verbose) args.push("--verbose");
167
167
  if (input.watch) args.push("--watch");
168
168
  if (input.coverage) args.push("--coverage");
169
- if (input.grep) args.push("--testPathPattern", input.grep);
169
+ if (input.grep) args.push("--testNamePattern", input.grep);
170
170
  args.push("--testTimeout", String(timeout));
171
171
  break;
172
172
  case "mocha":
@@ -195,12 +195,12 @@ function parseResult(runner, result, duration) {
195
195
  if (failedMatch?.[1]) failed = Number.parseInt(failedMatch[1], 10);
196
196
  tests_run = passed + failed;
197
197
  } else if (runner === "jest") {
198
- const suitesMatch = out.match(/Test Suites:\s+(\d+)\s+total/);
199
- const passedMatch = out.match(/Tests:\s+(\d+)\s+passed/);
200
- const failedMatch = out.match(/Tests:\s+(\d+)\s+failed/);
201
- tests_run = Number.parseInt(suitesMatch?.[1] ?? "0", 10);
198
+ const totalMatch = out.match(/Tests:\s+(?:.*,\s+)?(\d+)\s+total/);
199
+ const passedMatch = out.match(/Tests:\s+.*?(\d+)\s+passed/);
200
+ const failedMatch = out.match(/Tests:\s+.*?(\d+)\s+failed/);
202
201
  passed = Number.parseInt(passedMatch?.[1] ?? "0", 10);
203
202
  failed = Number.parseInt(failedMatch?.[1] ?? "0", 10);
203
+ tests_run = totalMatch?.[1] ? Number.parseInt(totalMatch[1], 10) : passed + failed;
204
204
  } else if (runner === "mocha") {
205
205
  const passedMatch = out.match(/(\d+)\s+passing/);
206
206
  const failedMatch = out.match(/(\d+)\s+failing/);
@@ -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-QA6IASYX.js.map
@@ -422,4 +422,4 @@ export {
422
422
  discoverE2EProjects,
423
423
  e2ePlanTool
424
424
  };
425
- //# sourceMappingURL=chunk-VPALDFYM.js.map
425
+ //# sourceMappingURL=chunk-RV7BVTDG.js.map
@@ -0,0 +1,288 @@
1
+ // src/tool-summary.ts
2
+ var FALLBACK_HEAD_FIELDS = [
3
+ "path",
4
+ "file_path",
5
+ "pattern",
6
+ "symbol",
7
+ "command",
8
+ "cmd",
9
+ "url",
10
+ "query",
11
+ "description",
12
+ "content"
13
+ ];
14
+ function clip(s, n) {
15
+ return s.length > n ? `${s.slice(0, n - 1)}\u2026` : s;
16
+ }
17
+ function pickPath(obj) {
18
+ const p = obj.file_path ?? obj.path ?? obj.filepath;
19
+ return typeof p === "string" ? p : "";
20
+ }
21
+ function safeJson(v) {
22
+ try {
23
+ return JSON.stringify(v);
24
+ } catch {
25
+ return String(v);
26
+ }
27
+ }
28
+ function coerceInput(input) {
29
+ if (typeof input === "string") {
30
+ const s = input.trim();
31
+ if (s.startsWith("{") || s.startsWith("[")) {
32
+ try {
33
+ const parsed = JSON.parse(s);
34
+ if (parsed && typeof parsed === "object")
35
+ return { obj: parsed, raw: parsed };
36
+ } catch {
37
+ }
38
+ }
39
+ return { obj: null, raw: input };
40
+ }
41
+ if (input && typeof input === "object")
42
+ return { obj: input, raw: input };
43
+ return { obj: null, raw: input };
44
+ }
45
+ function summarizeToolInput(toolName, input) {
46
+ if (input === null || input === void 0 || input === "") return "";
47
+ const { obj, raw } = coerceInput(input);
48
+ if (!obj) return clip(String(raw), 120);
49
+ const name = (toolName ?? "").toLowerCase();
50
+ if (/^todo(_?write)?$|^todos$/.test(name) || Array.isArray(obj.todos)) {
51
+ const todos = obj.todos ?? [];
52
+ if (Array.isArray(todos)) {
53
+ const done = todos.filter((t) => t?.status === "completed").length;
54
+ const wip = todos.filter((t) => t?.status === "in_progress").length;
55
+ const parts = [`${todos.length} todo${todos.length === 1 ? "" : "s"}`];
56
+ if (done > 0) parts.push(`${done} done`);
57
+ if (wip > 0) parts.push(`${wip} in-progress`);
58
+ return parts.join(" \xB7 ");
59
+ }
60
+ }
61
+ if (/batch|parallel/.test(name) || Array.isArray(obj.tool_uses) || Array.isArray(obj.calls)) {
62
+ const list = obj.tool_uses ?? obj.calls ?? obj.batch;
63
+ if (Array.isArray(list)) {
64
+ const subNames = /* @__PURE__ */ new Set();
65
+ for (const item of list) {
66
+ if (item && typeof item === "object" && "name" in item) {
67
+ subNames.add(String(item.name));
68
+ } else if (item && typeof item === "object" && "tool" in item) {
69
+ subNames.add(String(item.tool));
70
+ }
71
+ }
72
+ const preview = [...subNames].slice(0, 3).join(", ");
73
+ const more = subNames.size > 3 ? ` +${subNames.size - 3}` : "";
74
+ return `${list.length} sub-tool${list.length === 1 ? "" : "s"}${preview ? ` \xB7 ${preview}${more}` : ""}`;
75
+ }
76
+ }
77
+ if (name === "patch" && typeof obj.patch === "string" && obj.patch) {
78
+ const fileCount = (obj.patch.match(/^\+\+\+ /gm) ?? []).length;
79
+ if (fileCount > 0) return `patch \xB7 ${fileCount} file${fileCount === 1 ? "" : "s"}`;
80
+ return `patch \xB7 ${obj.patch.split("\n").length} lines`;
81
+ }
82
+ if (/^(edit|str_replace|edit_file|patch)$/.test(name)) {
83
+ const fp = pickPath(obj);
84
+ const oldS = typeof obj.old_string === "string" ? obj.old_string : "";
85
+ const newS = typeof obj.new_string === "string" ? obj.new_string : "";
86
+ const oldLines = oldS ? oldS.split("\n").length : 0;
87
+ const newLines = newS ? newS.split("\n").length : 0;
88
+ return `edit ${fp || "(file)"}${oldLines || newLines ? ` (${oldLines} \u2192 ${newLines} lines)` : ""}`;
89
+ }
90
+ if (/^(write|write_file|create_file|new_file)$/.test(name)) {
91
+ const fp = pickPath(obj);
92
+ const c = typeof obj.content === "string" ? obj.content : "";
93
+ const lines = c ? c.split("\n").length : 0;
94
+ return `write ${fp || "(file)"}${lines ? ` \xB7 ${lines} lines` : ""}`;
95
+ }
96
+ if (/^(bash|shell|sh|exec|run|run_command|run_shell|command)$/.test(name)) {
97
+ const cmd = obj.command ?? obj.cmd ?? obj.script;
98
+ if (typeof cmd === "string") return `$ ${clip(cmd, 110)}`;
99
+ }
100
+ if (/^(fetch|http|web|web_fetch|web_search|webfetch|curl|request)$/.test(name)) {
101
+ const url = obj.url;
102
+ if (typeof url === "string") {
103
+ const method = obj.method ?? "GET";
104
+ return `${method.toUpperCase()} ${clip(url, 100)}`;
105
+ }
106
+ }
107
+ if (/^(grep|search|ripgrep|rg)$/.test(name)) {
108
+ const pattern = obj.pattern;
109
+ const scope = obj.path ?? obj.glob ?? obj.type;
110
+ if (typeof pattern === "string") {
111
+ return scope ? `grep ${clip(pattern, 60)} in ${scope}` : `grep ${clip(pattern, 100)}`;
112
+ }
113
+ }
114
+ if (/^(glob|find)$/.test(name)) {
115
+ const p = obj.pattern ?? obj.glob;
116
+ if (typeof p === "string") return `glob ${clip(p, 80)}`;
117
+ }
118
+ if (/^tree$/.test(name)) {
119
+ const p = typeof obj.path === "string" ? obj.path : "";
120
+ const d = typeof obj.depth === "number" ? obj.depth : null;
121
+ return `tree ${p || "."}${d !== null ? ` (depth ${d})` : ""}`;
122
+ }
123
+ if (/^diff$/.test(name)) {
124
+ const a = typeof obj.a === "string" ? obj.a : "";
125
+ const b = typeof obj.b === "string" ? obj.b : "";
126
+ if (a || b) return `diff ${a && b ? `${a}..${b}` : a || b}`;
127
+ const fl = [];
128
+ if (Array.isArray(obj.files)) {
129
+ for (const f of obj.files) if (typeof f === "string") fl.push(f);
130
+ } else if (typeof obj.files === "string") {
131
+ for (const part of obj.files.split(",")) {
132
+ const t = part.trim();
133
+ if (t) fl.push(t);
134
+ }
135
+ }
136
+ if (fl.length === 1) return `diff ${clip(String(fl[0]), 80)}`;
137
+ if (fl.length > 1) return `diff ${fl.length} files`;
138
+ }
139
+ if (/^replace$/.test(name)) {
140
+ const pattern = typeof obj.pattern === "string" ? obj.pattern : "";
141
+ if (pattern) {
142
+ let scope = "";
143
+ if (typeof obj.files === "string") {
144
+ const parts = obj.files.split(",").map((s) => s.trim()).filter(Boolean);
145
+ scope = parts.length > 1 ? `${parts.length} files` : parts[0] ?? "";
146
+ } else if (Array.isArray(obj.files) && obj.files.length > 0) {
147
+ scope = obj.files.length === 1 ? String(obj.files[0]) : `${obj.files.length} files`;
148
+ }
149
+ return `replace ${clip(pattern, 60)}${scope ? ` in ${clip(scope, 50)}` : ""}`;
150
+ }
151
+ }
152
+ if (/^(read|read_file|cat|view)$/.test(name)) {
153
+ const fp = pickPath(obj);
154
+ const offset = obj.offset;
155
+ const limit = obj.limit;
156
+ if (fp && (typeof offset === "number" || typeof limit === "number")) {
157
+ const start = offset ?? 0;
158
+ const end = typeof limit === "number" ? start + limit : "";
159
+ return `read ${fp} (${start}\u2026${end})`;
160
+ }
161
+ if (fp) return `read ${fp}`;
162
+ }
163
+ for (const k of FALLBACK_HEAD_FIELDS) {
164
+ const v = obj[k];
165
+ if (typeof v === "string" && v.length > 0) {
166
+ return `${k}: ${clip(v, 100)}`;
167
+ }
168
+ }
169
+ return clip(safeJson(raw), 120);
170
+ }
171
+ var SUMMARIZE_TOOL_INPUT_BROWSER_SRC = [
172
+ 'function __clip(s,n){ s=String(s==null?"":s); return s.length>n ? s.slice(0,n-1)+"\\u2026" : s; }',
173
+ "function toolInputSummary(name, rawInput){",
174
+ ' if(rawInput==null || rawInput==="") return "";',
175
+ " var obj=null, raw=rawInput;",
176
+ ' if(typeof rawInput==="string"){',
177
+ " var s=rawInput.trim();",
178
+ ' if(s.charAt(0)==="{" || s.charAt(0)==="["){ try{ var pj=JSON.parse(s); if(pj && typeof pj==="object"){ obj=pj; raw=pj; } }catch(_e){} }',
179
+ ' } else if(rawInput && typeof rawInput==="object"){ obj=rawInput; raw=rawInput; }',
180
+ " if(!obj) return __clip(String(raw),120);",
181
+ ' var n=String(name==null?"":name).toLowerCase();',
182
+ " if(/^todo(_?write)?$|^todos$/.test(n) || Array.isArray(obj.todos)){",
183
+ " var todos=obj.todos||[];",
184
+ " if(Array.isArray(todos)){",
185
+ " var done=0, wip=0, ti;",
186
+ ' for(ti=0; ti<todos.length; ti++){ var st=todos[ti]&&todos[ti].status; if(st==="completed") done++; else if(st==="in_progress") wip++; }',
187
+ ' var tp=[todos.length+" todo"+(todos.length===1?"":"s")];',
188
+ ' if(done>0) tp.push(done+" done"); if(wip>0) tp.push(wip+" in-progress");',
189
+ ' return tp.join(" \\u00b7 ");',
190
+ " }",
191
+ " }",
192
+ " if(/batch|parallel/.test(n) || Array.isArray(obj.tool_uses) || Array.isArray(obj.calls)){",
193
+ " var list=obj.tool_uses||obj.calls||obj.batch;",
194
+ " if(Array.isArray(list)){",
195
+ " var names={}, ord=[], li, it, nm;",
196
+ ' for(li=0; li<list.length; li++){ it=list[li]; if(it && typeof it==="object"){ nm=("name" in it)?it.name:(("tool" in it)?it.tool:null); if(nm!=null){ nm=String(nm); if(!names[nm]){ names[nm]=1; ord.push(nm); } } } }',
197
+ ' var preview=ord.slice(0,3).join(", ");',
198
+ ' var more=ord.length>3 ? " +"+(ord.length-3) : "";',
199
+ ' return list.length+" sub-tool"+(list.length===1?"":"s")+(preview?(" \\u00b7 "+preview+more):"");',
200
+ " }",
201
+ " }",
202
+ " var fp;",
203
+ ' if(n==="patch" && typeof obj.patch==="string" && obj.patch){',
204
+ " var pfm=obj.patch.match(/^\\+\\+\\+ /gm);",
205
+ " var pfc=pfm?pfm.length:0;",
206
+ ' if(pfc>0) return "patch \\u00b7 "+pfc+" file"+(pfc===1?"":"s");',
207
+ ' return "patch \\u00b7 "+obj.patch.split("\\n").length+" lines";',
208
+ " }",
209
+ " if(/^(edit|str_replace|edit_file|patch)$/.test(n)){",
210
+ " fp=(obj.file_path!=null?obj.file_path:(obj.path!=null?obj.path:obj.filepath));",
211
+ ' var oldS=typeof obj.old_string==="string"?obj.old_string:"";',
212
+ ' var newS=typeof obj.new_string==="string"?obj.new_string:"";',
213
+ ' var ol=oldS?oldS.split("\\n").length:0, nl=newS?newS.split("\\n").length:0;',
214
+ ' var efp=typeof fp==="string"?fp:"";',
215
+ ' return "edit "+(efp||"(file)")+((ol||nl)?(" ("+ol+" \\u2192 "+nl+" lines)"):"");',
216
+ " }",
217
+ " if(/^(write|write_file|create_file|new_file)$/.test(n)){",
218
+ " fp=(obj.file_path!=null?obj.file_path:(obj.path!=null?obj.path:obj.filepath));",
219
+ ' var wc=typeof obj.content==="string"?obj.content:"";',
220
+ ' var wl=wc?wc.split("\\n").length:0;',
221
+ ' var wfp=typeof fp==="string"?fp:"";',
222
+ ' return "write "+(wfp||"(file)")+(wl?(" \\u00b7 "+wl+" lines"):"");',
223
+ " }",
224
+ " if(/^(bash|shell|sh|exec|run|run_command|run_shell|command)$/.test(n)){",
225
+ " var cmd=(obj.command!=null?obj.command:(obj.cmd!=null?obj.cmd:obj.script));",
226
+ ' if(typeof cmd==="string") return "$ "+__clip(cmd,110);',
227
+ " }",
228
+ " if(/^(fetch|http|web|web_fetch|web_search|webfetch|curl|request)$/.test(n)){",
229
+ ' if(typeof obj.url==="string"){ var mth=(typeof obj.method==="string"?obj.method:"GET"); return mth.toUpperCase()+" "+__clip(obj.url,100); }',
230
+ " }",
231
+ " if(/^(grep|search|ripgrep|rg)$/.test(n)){",
232
+ " var pat=obj.pattern, scope=(obj.path!=null?obj.path:(obj.glob!=null?obj.glob:obj.type));",
233
+ ' if(typeof pat==="string"){ return scope ? ("grep "+__clip(pat,60)+" in "+scope) : ("grep "+__clip(pat,100)); }',
234
+ " }",
235
+ " if(/^(glob|find)$/.test(n)){",
236
+ " var gp=(obj.pattern!=null?obj.pattern:obj.glob);",
237
+ ' if(typeof gp==="string") return "glob "+__clip(gp,80);',
238
+ " }",
239
+ " if(/^tree$/.test(n)){",
240
+ ' var trp=typeof obj.path==="string"?obj.path:"";',
241
+ ' var trd=typeof obj.depth==="number"?obj.depth:null;',
242
+ ' return "tree "+(trp||".")+(trd!==null?(" (depth "+trd+")"):"");',
243
+ " }",
244
+ " if(/^diff$/.test(n)){",
245
+ ' var da=typeof obj.a==="string"?obj.a:"", db=typeof obj.b==="string"?obj.b:"";',
246
+ ' if(da||db) return "diff "+((da&&db)?(da+".."+db):(da||db));',
247
+ " var dfl=[], dfi, dpi;",
248
+ ' if(Array.isArray(obj.files)){ for(dfi=0; dfi<obj.files.length; dfi++){ if(typeof obj.files[dfi]==="string") dfl.push(obj.files[dfi]); } }',
249
+ ' else if(typeof obj.files==="string"){ var dparts=obj.files.split(","); for(dpi=0; dpi<dparts.length; dpi++){ var dt=dparts[dpi].trim(); if(dt) dfl.push(dt); } }',
250
+ ' if(dfl.length===1) return "diff "+__clip(String(dfl[0]),80);',
251
+ ' if(dfl.length>1) return "diff "+dfl.length+" files";',
252
+ " }",
253
+ " if(/^replace$/.test(n)){",
254
+ ' var rpat=typeof obj.pattern==="string"?obj.pattern:"";',
255
+ " if(rpat){",
256
+ ' var rscope="";',
257
+ ' if(typeof obj.files==="string"){',
258
+ " var rparts=[], rsi;",
259
+ ' var rraw=obj.files.split(",");',
260
+ " for(rsi=0; rsi<rraw.length; rsi++){ var rt=rraw[rsi].trim(); if(rt) rparts.push(rt); }",
261
+ ' rscope=rparts.length>1?(rparts.length+" files"):(rparts.length===1?rparts[0]:"");',
262
+ " } else if(Array.isArray(obj.files) && obj.files.length>0){",
263
+ ' rscope=obj.files.length===1?String(obj.files[0]):(obj.files.length+" files");',
264
+ " }",
265
+ ' return "replace "+__clip(rpat,60)+(rscope?(" in "+__clip(rscope,50)):"");',
266
+ " }",
267
+ " }",
268
+ " if(/^(read|read_file|cat|view)$/.test(n)){",
269
+ " fp=(obj.file_path!=null?obj.file_path:(obj.path!=null?obj.path:obj.filepath));",
270
+ ' if(typeof fp==="string" && fp){',
271
+ " var off=obj.offset, lim=obj.limit;",
272
+ ' if(typeof off==="number" || typeof lim==="number"){ var start=(typeof off==="number"?off:0); var end=(typeof lim==="number"?(start+lim):""); return "read "+fp+" ("+start+"\\u2026"+end+")"; }',
273
+ ' return "read "+fp;',
274
+ " }",
275
+ " }",
276
+ ' var HEAD=["path","file_path","pattern","symbol","command","cmd","url","query","description","content"], hi;',
277
+ ' for(hi=0; hi<HEAD.length; hi++){ var hv=obj[HEAD[hi]]; if(typeof hv==="string" && hv.length>0){ return HEAD[hi]+": "+__clip(hv,100); } }',
278
+ " var jsonStr; try{ jsonStr=JSON.stringify(raw); }catch(_e2){ jsonStr=String(raw); }",
279
+ " return __clip(jsonStr,120);",
280
+ "}"
281
+ ].join("\n");
282
+
283
+ export {
284
+ FALLBACK_HEAD_FIELDS,
285
+ summarizeToolInput,
286
+ SUMMARIZE_TOOL_INPUT_BROWSER_SRC
287
+ };
288
+ //# sourceMappingURL=chunk-S57CDR2H.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
@@ -2118,4 +2118,4 @@ export {
2118
2118
  recordKanbanVerificationEvidence,
2119
2119
  kanbanTool
2120
2120
  };
2121
- //# sourceMappingURL=chunk-W2CECGTG.js.map
2121
+ //# sourceMappingURL=chunk-SMARDKAC.js.map