@poe-platform/safe-bash 0.1.726 → 0.1.727

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 (207) hide show
  1. package/dist/safe-bash/chunks/{chunk-6VZX7ESE.js → chunk-26N7BLXE.js} +3 -3
  2. package/dist/safe-bash/chunks/{chunk-ZZ7JQBPX.js → chunk-4A2OLEML.js} +2 -2
  3. package/dist/safe-bash/chunks/{chunk-LTREB3HX.js → chunk-54MC6XF5.js} +4 -4
  4. package/dist/safe-bash/chunks/{chunk-Z3CCN6Y2.js → chunk-6J5FUESH.js} +2 -2
  5. package/dist/safe-bash/chunks/{chunk-YR5RZBWS.js → chunk-6TBFZ5JE.js} +2 -2
  6. package/dist/safe-bash/chunks/{chunk-6HJNJ625.js → chunk-7MMYQG3P.js} +2 -2
  7. package/dist/safe-bash/chunks/{chunk-WTZZX4LV.js → chunk-A4MB2KXV.js} +2 -2
  8. package/dist/safe-bash/chunks/{chunk-EM2JW7ZH.js → chunk-ATYJKRBZ.js} +2 -2
  9. package/dist/safe-bash/chunks/{chunk-VV24PRPB.js → chunk-AZQOEGP3.js} +1050 -101
  10. package/dist/safe-bash/chunks/chunk-AZQOEGP3.js.map +7 -0
  11. package/dist/safe-bash/chunks/{chunk-EFMXWUYE.js → chunk-B6JEJ6AT.js} +2 -2
  12. package/dist/safe-bash/chunks/{chunk-JFGGQUYP.js → chunk-BFXGHT3R.js} +2 -2
  13. package/dist/safe-bash/chunks/{chunk-RP5IZOOR.js → chunk-BJYV5J65.js} +1050 -101
  14. package/dist/safe-bash/chunks/chunk-BJYV5J65.js.map +7 -0
  15. package/dist/safe-bash/chunks/{chunk-HNHOPD3P.js → chunk-DIEFWGXO.js} +46 -26
  16. package/dist/safe-bash/chunks/{chunk-HNHOPD3P.js.map → chunk-DIEFWGXO.js.map} +2 -2
  17. package/dist/safe-bash/chunks/{chunk-SME47P4B.js → chunk-DV6EZOKM.js} +46 -26
  18. package/dist/safe-bash/chunks/{chunk-SME47P4B.js.map → chunk-DV6EZOKM.js.map} +2 -2
  19. package/dist/safe-bash/chunks/{chunk-646RTREQ.js → chunk-EEDOYIPC.js} +2 -2
  20. package/dist/safe-bash/chunks/{chunk-OFAAHWL5.js → chunk-GCQ5A2T2.js} +2 -2
  21. package/dist/safe-bash/chunks/{chunk-MJW4KSKV.js → chunk-GLPJEDLY.js} +2 -2
  22. package/dist/safe-bash/chunks/{chunk-FOOJWH7J.js → chunk-GO5OKPBO.js} +4 -4
  23. package/dist/safe-bash/chunks/{chunk-5JANWFJ3.js → chunk-GWYXCCGO.js} +4 -4
  24. package/dist/safe-bash/chunks/{chunk-DPHRNHPT.js → chunk-H6KJ4L22.js} +2 -2
  25. package/dist/safe-bash/chunks/{chunk-FLX2BZBF.js → chunk-HGBYIDAK.js} +4 -4
  26. package/dist/safe-bash/chunks/{chunk-VGJIDLZM.js → chunk-KS5VSJYM.js} +15 -8
  27. package/dist/safe-bash/chunks/chunk-KS5VSJYM.js.map +7 -0
  28. package/dist/safe-bash/chunks/{chunk-PO3Z7W3A.js → chunk-MUHYGUFD.js} +4 -4
  29. package/dist/safe-bash/chunks/{chunk-5DLGYPGJ.js → chunk-PDSTXORC.js} +126 -58
  30. package/dist/safe-bash/chunks/chunk-PDSTXORC.js.map +7 -0
  31. package/dist/safe-bash/chunks/{chunk-TIHMU25L.js → chunk-PQ37GDJF.js} +3 -3
  32. package/dist/safe-bash/chunks/{chunk-OTM5RCWZ.js → chunk-QNEDWYC2.js} +15 -8
  33. package/dist/safe-bash/chunks/chunk-QNEDWYC2.js.map +7 -0
  34. package/dist/safe-bash/chunks/{chunk-LZ7FUN6K.js → chunk-RHHDOA67.js} +5 -5
  35. package/dist/safe-bash/chunks/{chunk-DSCL3VA2.js → chunk-SJ3B26XV.js} +4 -4
  36. package/dist/safe-bash/chunks/{chunk-6JBTVWHH.js → chunk-SWACYEIT.js} +5 -5
  37. package/dist/safe-bash/chunks/{chunk-7UJW7TYR.js → chunk-TD6NWAUK.js} +126 -58
  38. package/dist/safe-bash/chunks/chunk-TD6NWAUK.js.map +7 -0
  39. package/dist/safe-bash/chunks/{chunk-Q4I754TV.js → chunk-THOBFD5C.js} +2 -2
  40. package/dist/safe-bash/chunks/{chunk-XELW5O3R.js → chunk-U2STHT7S.js} +2 -2
  41. package/dist/safe-bash/chunks/{chunk-5X4SOSTT.js → chunk-UJHE5PTK.js} +2 -2
  42. package/dist/safe-bash/chunks/{chunk-B6YFFKYG.js → chunk-X4I3RHTC.js} +5 -1
  43. package/dist/safe-bash/chunks/chunk-X4I3RHTC.js.map +7 -0
  44. package/dist/safe-bash/chunks/{chunk-YOK5UHA7.js → chunk-XKXFX3RH.js} +5 -1
  45. package/dist/safe-bash/chunks/chunk-XKXFX3RH.js.map +7 -0
  46. package/dist/safe-bash/chunks/{chunk-PLCYP2E5.js → chunk-XV4K3UUF.js} +2 -2
  47. package/dist/safe-bash/commands/csplit/index.browser.js +2 -2
  48. package/dist/safe-bash/commands/factor/index.browser.js +2 -2
  49. package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
  50. package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
  51. package/dist/safe-bash/commands/iconv/index.browser.js +2 -2
  52. package/dist/safe-bash/commands/internal.d.ts.map +1 -1
  53. package/dist/safe-bash/commands/internal.js +4 -3
  54. package/dist/safe-bash/commands/internal.js.map +1 -1
  55. package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
  56. package/dist/safe-bash/commands/llm/index.browser.js +4 -4
  57. package/dist/safe-bash/commands/network/index.browser.js +4 -4
  58. package/dist/safe-bash/commands/node/index.browser.js +4 -4
  59. package/dist/safe-bash/commands/pandoc/index.js.map +1 -1
  60. package/dist/safe-bash/commands/pr/index.browser.js +3 -3
  61. package/dist/safe-bash/commands/python/index.browser.js +2 -2
  62. package/dist/safe-bash/commands/record-buffer.d.ts.map +1 -1
  63. package/dist/safe-bash/commands/record-buffer.js +12 -4
  64. package/dist/safe-bash/commands/record-buffer.js.map +1 -1
  65. package/dist/safe-bash/commands/regex-execution/bounded-provider.d.ts.map +1 -1
  66. package/dist/safe-bash/commands/regex-execution/bounded-provider.js +75 -8
  67. package/dist/safe-bash/commands/regex-execution/bounded-provider.js.map +1 -1
  68. package/dist/safe-bash/commands/regex-execution/ere/limits.d.ts +1 -1
  69. package/dist/safe-bash/commands/regex-execution/ere/limits.d.ts.map +1 -1
  70. package/dist/safe-bash/commands/regex-execution/ere/limits.js +6 -4
  71. package/dist/safe-bash/commands/regex-execution/ere/limits.js.map +1 -1
  72. package/dist/safe-bash/commands/regex-execution/portable.d.ts.map +1 -1
  73. package/dist/safe-bash/commands/regex-execution/portable.js +7 -2
  74. package/dist/safe-bash/commands/regex-execution/portable.js.map +1 -1
  75. package/dist/safe-bash/commands/regex-execution/protocol.d.ts +2 -0
  76. package/dist/safe-bash/commands/regex-execution/protocol.d.ts.map +1 -1
  77. package/dist/safe-bash/commands/regex-execution/protocol.js +26 -0
  78. package/dist/safe-bash/commands/regex-execution/protocol.js.map +1 -1
  79. package/dist/safe-bash/commands/regex-execution/utf8.d.ts +1 -1
  80. package/dist/safe-bash/commands/regex-execution/utf8.d.ts.map +1 -1
  81. package/dist/safe-bash/commands/regex-execution/utf8.js +26 -2
  82. package/dist/safe-bash/commands/regex-execution/utf8.js.map +1 -1
  83. package/dist/safe-bash/commands/search/grep.d.ts.map +1 -1
  84. package/dist/safe-bash/commands/search/grep.js +109 -15
  85. package/dist/safe-bash/commands/search/grep.js.map +1 -1
  86. package/dist/safe-bash/commands/search/matcher.d.ts +1 -1
  87. package/dist/safe-bash/commands/search/matcher.d.ts.map +1 -1
  88. package/dist/safe-bash/commands/search/matcher.js +2 -0
  89. package/dist/safe-bash/commands/search/matcher.js.map +1 -1
  90. package/dist/safe-bash/commands/search/shared.d.ts.map +1 -1
  91. package/dist/safe-bash/commands/search/shared.js +23 -12
  92. package/dist/safe-bash/commands/search/shared.js.map +1 -1
  93. package/dist/safe-bash/commands/standard.d.ts.map +1 -1
  94. package/dist/safe-bash/commands/standard.js +22 -0
  95. package/dist/safe-bash/commands/standard.js.map +1 -1
  96. package/dist/safe-bash/commands/streams.d.ts.map +1 -1
  97. package/dist/safe-bash/commands/streams.js +54 -10
  98. package/dist/safe-bash/commands/streams.js.map +1 -1
  99. package/dist/safe-bash/commands/structured/input.d.ts.map +1 -1
  100. package/dist/safe-bash/commands/structured/input.js +484 -55
  101. package/dist/safe-bash/commands/structured/input.js.map +1 -1
  102. package/dist/safe-bash/commands/structured/interpreter.d.ts +3 -0
  103. package/dist/safe-bash/commands/structured/interpreter.d.ts.map +1 -1
  104. package/dist/safe-bash/commands/structured/interpreter.js +157 -1
  105. package/dist/safe-bash/commands/structured/interpreter.js.map +1 -1
  106. package/dist/safe-bash/commands/structured/jq.d.ts.map +1 -1
  107. package/dist/safe-bash/commands/structured/jq.js +50 -24
  108. package/dist/safe-bash/commands/structured/jq.js.map +1 -1
  109. package/dist/safe-bash/commands/structured/limits.d.ts +5 -0
  110. package/dist/safe-bash/commands/structured/limits.d.ts.map +1 -1
  111. package/dist/safe-bash/commands/structured/limits.js +51 -36
  112. package/dist/safe-bash/commands/structured/limits.js.map +1 -1
  113. package/dist/safe-bash/commands/structured/numbers.d.ts +1 -0
  114. package/dist/safe-bash/commands/structured/numbers.d.ts.map +1 -1
  115. package/dist/safe-bash/commands/structured/numbers.js +32 -0
  116. package/dist/safe-bash/commands/structured/numbers.js.map +1 -1
  117. package/dist/safe-bash/commands/text-programs/awk-reader.d.ts +1 -0
  118. package/dist/safe-bash/commands/text-programs/awk-reader.d.ts.map +1 -1
  119. package/dist/safe-bash/commands/text-programs/awk-reader.js +41 -5
  120. package/dist/safe-bash/commands/text-programs/awk-reader.js.map +1 -1
  121. package/dist/safe-bash/commands/text-programs/awk-retention.d.ts +1 -0
  122. package/dist/safe-bash/commands/text-programs/awk-retention.d.ts.map +1 -1
  123. package/dist/safe-bash/commands/text-programs/awk-retention.js +9 -0
  124. package/dist/safe-bash/commands/text-programs/awk-retention.js.map +1 -1
  125. package/dist/safe-bash/commands/text-programs/awk-runtime.d.ts +13 -0
  126. package/dist/safe-bash/commands/text-programs/awk-runtime.d.ts.map +1 -1
  127. package/dist/safe-bash/commands/text-programs/awk-runtime.js +421 -83
  128. package/dist/safe-bash/commands/text-programs/awk-runtime.js.map +1 -1
  129. package/dist/safe-bash/commands/text-programs/awk-values.d.ts.map +1 -1
  130. package/dist/safe-bash/commands/text-programs/awk-values.js +21 -0
  131. package/dist/safe-bash/commands/text-programs/awk-values.js.map +1 -1
  132. package/dist/safe-bash/commands/text-programs/regex.d.ts +15 -2
  133. package/dist/safe-bash/commands/text-programs/regex.d.ts.map +1 -1
  134. package/dist/safe-bash/commands/text-programs/regex.js +501 -13
  135. package/dist/safe-bash/commands/text-programs/regex.js.map +1 -1
  136. package/dist/safe-bash/commands/text-programs/sed.d.ts.map +1 -1
  137. package/dist/safe-bash/commands/text-programs/sed.js +242 -102
  138. package/dist/safe-bash/commands/text-programs/sed.js.map +1 -1
  139. package/dist/safe-bash/commands/text-programs/shared.d.ts +2 -0
  140. package/dist/safe-bash/commands/text-programs/shared.d.ts.map +1 -1
  141. package/dist/safe-bash/commands/text-programs/shared.js +36 -0
  142. package/dist/safe-bash/commands/text-programs/shared.js.map +1 -1
  143. package/dist/safe-bash/commands/text.d.ts.map +1 -1
  144. package/dist/safe-bash/commands/text.js +136 -19
  145. package/dist/safe-bash/commands/text.js.map +1 -1
  146. package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
  147. package/dist/safe-bash/commands/xml/index.browser.js +5 -5
  148. package/dist/safe-bash/commands/yq/index.browser.js +5 -5
  149. package/dist/safe-bash/contracts/yield.d.ts +1 -0
  150. package/dist/safe-bash/contracts/yield.d.ts.map +1 -1
  151. package/dist/safe-bash/contracts/yield.js +3 -0
  152. package/dist/safe-bash/contracts/yield.js.map +1 -1
  153. package/dist/safe-bash/core.browser.js +1052 -256
  154. package/dist/safe-bash/core.browser.js.map +3 -3
  155. package/dist/safe-bash/plugins/composition.d.ts +1 -0
  156. package/dist/safe-bash/plugins/composition.d.ts.map +1 -1
  157. package/dist/safe-bash/plugins/composition.js +80 -2
  158. package/dist/safe-bash/plugins/composition.js.map +1 -1
  159. package/dist/safe-bash/plugins/index.d.ts.map +1 -1
  160. package/dist/safe-bash/plugins/index.js +2 -2
  161. package/dist/safe-bash/plugins/index.js.map +1 -1
  162. package/dist/safe-bash-command-fold/arguments.d.ts +1 -1
  163. package/dist/safe-bash-command-fold/contracts.d.ts +2 -1
  164. package/dist/safe-bash-command-fold/engine.d.ts +1 -1
  165. package/dist/safe-bash-command-fold/index.js +10 -8
  166. package/dist/safe-bash-command-fold/index.js.map +2 -2
  167. package/dist/safe-bash-command-sips/index.js +231 -67
  168. package/dist/safe-bash-command-sips/index.js.map +2 -2
  169. package/dist/safe-bash-command-unrtf/contracts.d.ts +5 -2
  170. package/dist/safe-bash-command-unrtf/index.js +6 -5
  171. package/dist/safe-bash-command-unrtf/index.js.map +2 -2
  172. package/dist/safe-playwright-cloudflare/browser-run-code.js +22 -6
  173. package/package.json +2 -2
  174. package/dist/safe-bash/chunks/chunk-5DLGYPGJ.js.map +0 -7
  175. package/dist/safe-bash/chunks/chunk-7UJW7TYR.js.map +0 -7
  176. package/dist/safe-bash/chunks/chunk-B6YFFKYG.js.map +0 -7
  177. package/dist/safe-bash/chunks/chunk-OTM5RCWZ.js.map +0 -7
  178. package/dist/safe-bash/chunks/chunk-RP5IZOOR.js.map +0 -7
  179. package/dist/safe-bash/chunks/chunk-VGJIDLZM.js.map +0 -7
  180. package/dist/safe-bash/chunks/chunk-VV24PRPB.js.map +0 -7
  181. package/dist/safe-bash/chunks/chunk-YOK5UHA7.js.map +0 -7
  182. /package/dist/safe-bash/chunks/{chunk-6VZX7ESE.js.map → chunk-26N7BLXE.js.map} +0 -0
  183. /package/dist/safe-bash/chunks/{chunk-ZZ7JQBPX.js.map → chunk-4A2OLEML.js.map} +0 -0
  184. /package/dist/safe-bash/chunks/{chunk-LTREB3HX.js.map → chunk-54MC6XF5.js.map} +0 -0
  185. /package/dist/safe-bash/chunks/{chunk-Z3CCN6Y2.js.map → chunk-6J5FUESH.js.map} +0 -0
  186. /package/dist/safe-bash/chunks/{chunk-YR5RZBWS.js.map → chunk-6TBFZ5JE.js.map} +0 -0
  187. /package/dist/safe-bash/chunks/{chunk-6HJNJ625.js.map → chunk-7MMYQG3P.js.map} +0 -0
  188. /package/dist/safe-bash/chunks/{chunk-WTZZX4LV.js.map → chunk-A4MB2KXV.js.map} +0 -0
  189. /package/dist/safe-bash/chunks/{chunk-EM2JW7ZH.js.map → chunk-ATYJKRBZ.js.map} +0 -0
  190. /package/dist/safe-bash/chunks/{chunk-EFMXWUYE.js.map → chunk-B6JEJ6AT.js.map} +0 -0
  191. /package/dist/safe-bash/chunks/{chunk-JFGGQUYP.js.map → chunk-BFXGHT3R.js.map} +0 -0
  192. /package/dist/safe-bash/chunks/{chunk-646RTREQ.js.map → chunk-EEDOYIPC.js.map} +0 -0
  193. /package/dist/safe-bash/chunks/{chunk-OFAAHWL5.js.map → chunk-GCQ5A2T2.js.map} +0 -0
  194. /package/dist/safe-bash/chunks/{chunk-MJW4KSKV.js.map → chunk-GLPJEDLY.js.map} +0 -0
  195. /package/dist/safe-bash/chunks/{chunk-FOOJWH7J.js.map → chunk-GO5OKPBO.js.map} +0 -0
  196. /package/dist/safe-bash/chunks/{chunk-5JANWFJ3.js.map → chunk-GWYXCCGO.js.map} +0 -0
  197. /package/dist/safe-bash/chunks/{chunk-DPHRNHPT.js.map → chunk-H6KJ4L22.js.map} +0 -0
  198. /package/dist/safe-bash/chunks/{chunk-FLX2BZBF.js.map → chunk-HGBYIDAK.js.map} +0 -0
  199. /package/dist/safe-bash/chunks/{chunk-PO3Z7W3A.js.map → chunk-MUHYGUFD.js.map} +0 -0
  200. /package/dist/safe-bash/chunks/{chunk-TIHMU25L.js.map → chunk-PQ37GDJF.js.map} +0 -0
  201. /package/dist/safe-bash/chunks/{chunk-LZ7FUN6K.js.map → chunk-RHHDOA67.js.map} +0 -0
  202. /package/dist/safe-bash/chunks/{chunk-DSCL3VA2.js.map → chunk-SJ3B26XV.js.map} +0 -0
  203. /package/dist/safe-bash/chunks/{chunk-6JBTVWHH.js.map → chunk-SWACYEIT.js.map} +0 -0
  204. /package/dist/safe-bash/chunks/{chunk-Q4I754TV.js.map → chunk-THOBFD5C.js.map} +0 -0
  205. /package/dist/safe-bash/chunks/{chunk-XELW5O3R.js.map → chunk-U2STHT7S.js.map} +0 -0
  206. /package/dist/safe-bash/chunks/{chunk-5X4SOSTT.js.map → chunk-UJHE5PTK.js.map} +0 -0
  207. /package/dist/safe-bash/chunks/{chunk-PLCYP2E5.js.map → chunk-XV4K3UUF.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-RA4KWAKW.js";
4
4
  import {
5
5
  writeDiagnostic
6
- } from "./chunk-WTZZX4LV.js";
6
+ } from "./chunk-A4MB2KXV.js";
7
7
  import {
8
8
  PublicDiagnostic,
9
9
  publicDiagnosticMessage
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-LV3A66Y2.js";
14
14
  import {
15
15
  yieldTurn
16
- } from "./chunk-B6YFFKYG.js";
16
+ } from "./chunk-X4I3RHTC.js";
17
17
  import {
18
18
  getCommandArguments,
19
19
  shellValueBytes
@@ -1858,4 +1858,4 @@ export {
1858
1858
  createPrCommands,
1859
1859
  prCommands
1860
1860
  };
1861
- //# sourceMappingURL=chunk-TIHMU25L.js.map
1861
+ //# sourceMappingURL=chunk-PQ37GDJF.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  writeDiagnostic
3
- } from "./chunk-ZZ7JQBPX.js";
3
+ } from "./chunk-4A2OLEML.js";
4
4
  import {
5
5
  PublicDiagnostic,
6
6
  publicDiagnosticMessage
@@ -79,12 +79,18 @@ var RecordBuffer = class {
79
79
  }
80
80
  }
81
81
  finish(admit, bytes, start = 0, end = bytes?.length ?? 0) {
82
- this.#admit(end - start);
83
- const size = this.#size + end - start;
82
+ const tailLength = end - start;
83
+ this.#admit(tailLength);
84
+ const size = this.#size + tailLength;
84
85
  admit?.(size);
85
86
  if (size > this.finalizationCapacity - this.#allocated) {
86
87
  throw new contracts_exports.FsError("EFBIG", { message: "line finalization buffer limit exceeded" });
87
88
  }
89
+ if (this.#size === 0) {
90
+ const result2 = new Uint8Array(tailLength);
91
+ if (bytes && tailLength > 0) result2.set(bytes.subarray(start, end));
92
+ return result2;
93
+ }
88
94
  const result = new Uint8Array(size);
89
95
  let offset = 0;
90
96
  for (const segment of this.#segments) {
@@ -92,12 +98,12 @@ var RecordBuffer = class {
92
98
  result.set(segment.subarray(0, length), offset);
93
99
  offset += length;
94
100
  }
95
- if (bytes && end > start) result.set(bytes.subarray(start, end), offset);
101
+ if (bytes && tailLength > 0) result.set(bytes.subarray(start, end), offset);
96
102
  this.clear();
97
103
  return result;
98
104
  }
99
105
  clear() {
100
- this.#segments = [];
106
+ if (this.#segments.length) this.#segments.length = 0;
101
107
  this.#size = 0;
102
108
  this.#allocated = 0;
103
109
  }
@@ -389,8 +395,9 @@ async function* lines(source, separator = 10, admit) {
389
395
  try {
390
396
  for await (const chunk of source) {
391
397
  let start = 0;
392
- for (let offset = 0; offset < chunk.length; offset++) {
393
- if (chunk[offset] !== separator) continue;
398
+ while (start < chunk.length) {
399
+ const offset = chunk.indexOf(separator, start);
400
+ if (offset < 0) break;
394
401
  yield { bytes: pending.finish(admit, chunk, start, offset), terminated: true };
395
402
  start = offset + 1;
396
403
  }
@@ -571,4 +578,4 @@ export {
571
578
  replaceArgument,
572
579
  escapeBytes
573
580
  };
574
- //# sourceMappingURL=chunk-OTM5RCWZ.js.map
581
+ //# sourceMappingURL=chunk-QNEDWYC2.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/commands/internal.ts", "../../src/commands/portable-requirements.ts", "../../src/commands/record-buffer.ts", "../../src/commands/gnu-information.ts"],
4
+ "sourcesContent": ["import { PublicDiagnostic, publicDiagnosticMessage } from \"../diagnostics.js\";\nimport { assertCommandRequirements } from \"../contracts/command-requirements.js\";\nimport { writeDiagnostic } from \"../escaping.js\";\nimport { inputRequirements } from \"./portable-requirements.js\";\nimport { RecordBuffer } from \"./record-buffer.js\";\nimport { gnuInformation } from \"./gnu-information.js\";\nimport {\n FsError, isAbsolutePath, readBytes, toByteSource, validatePath, writeBytes,\n type ByteSource, type CommandContext, type CommandDefinition, type CommandHandler,\n} from \"../contracts/index.js\";\n\nexport const encoder = new TextEncoder();\nexport const decoder = new TextDecoder();\nexport const bufferLimit = 32 * 1024 * 1024;\n\nexport class UsageError extends PublicDiagnostic {}\n\nexport interface ParsedOptions {\n readonly flags: Set<string>;\n readonly values: Map<string, string[]>;\n readonly operands: string[];\n}\n\nexport function options(\n args: readonly string[], short: string, long: Readonly<Record<string, string | false>> = {},\n stopAtOperand = false, onOperand?: (index: number) => void,\n onValue?: (key: string, index: number, offset: number) => void,\n onOption?: (key: string, value: string | undefined) => void,\n): ParsedOptions {\n const flags = new Set<string>();\n const values = new Map<string, string[]>();\n const operands: string[] = [];\n const specifications = new Map<string, boolean>();\n for (let index = 0; index < short.length; index++) {\n const key = short[index]!;\n specifications.set(key, short[index + 1] === \":\");\n if (short[index + 1] === \":\") index++;\n }\n let ended = false;\n for (let index = 0; index < args.length; index++) {\n const argument = args[index]!;\n if (ended || argument === \"-\" || !argument.startsWith(\"-\")) {\n operands.push(argument);\n onOperand?.(index);\n if (stopAtOperand) ended = true;\n continue;\n }\n if (argument === \"--\") { ended = true; continue; }\n if (argument.startsWith(\"--\")) {\n const equals = argument.indexOf(\"=\");\n const name = argument.slice(2, equals < 0 ? undefined : equals);\n const alias = long[name];\n const longValue = typeof alias === \"string\" && alias.endsWith(\":\");\n const key = alias === false ? name : longValue ? alias.slice(0, -1) : alias;\n if (!key || (alias !== false && !longValue && !specifications.has(key))) throw new UsageError(`unrecognized option '${argument}'`);\n if (longValue || specifications.get(key)) {\n const value = equals >= 0 ? argument.slice(equals + 1) : args[++index];\n if (value === undefined) throw new UsageError(`option '--${name}' requires an argument`);\n onValue?.(key, index, equals >= 0 ? equals + 1 : 0);\n values.set(key, [...values.get(key) ?? [], value]);\n } else if (equals >= 0) throw new UsageError(`option '--${name}' does not take an argument`);\n flags.add(key);\n onOption?.(key, values.get(key)?.at(-1));\n continue;\n }\n for (let offset = 1; offset < argument.length; offset++) {\n const key = argument[offset]!;\n if (!specifications.has(key)) throw new UsageError(`invalid option -- '${key}'`);\n if (specifications.get(key)) {\n const value = argument.slice(offset + 1) || args[++index];\n if (value === undefined) throw new UsageError(`option requires an argument -- '${key}'`);\n onValue?.(key, index, offset + 1 < argument.length ? offset + 1 : 0);\n values.set(key, [...values.get(key) ?? [], value]);\n offset = argument.length;\n }\n flags.add(key);\n onOption?.(key, values.get(key)?.at(-1));\n }\n }\n return { flags, values, operands };\n}\n\nexport function value(parsed: ParsedOptions, key: string): string | undefined {\n return parsed.values.get(key)?.at(-1);\n}\n\nexport function integer(text: string, minimum = 0): number {\n if (!/^[+]?[0-9]+$/u.test(text)) throw new UsageError(`invalid number '${text}'`);\n const number = Number(text);\n if (!Number.isSafeInteger(number) || number < minimum) throw new UsageError(`invalid number '${text}'`);\n return number;\n}\n\nexport function requireOperands(operands: readonly string[], minimum = 1, maximum = Infinity): void {\n if (operands.length < minimum) throw new UsageError(\"missing operand\");\n if (operands.length > maximum) throw new UsageError(`extra operand '${operands[maximum]}'`);\n}\n\nexport function pathOf(context: Pick<CommandContext, \"cwd\">, path: string): string {\n if (!path) throw new FsError(\"ENOENT\", { path });\n validatePath(path);\n validatePath(context.cwd);\n if (!isAbsolutePath(context.cwd)) throw new FsError(\"EINVAL\", { path: context.cwd, message: \"cwd must be absolute\" });\n return isAbsolutePath(path) ? path : `${context.cwd.replace(/\\/$/u, \"\")}/${path}`;\n}\n\nexport function codeOf(error: unknown): string | undefined {\n return error instanceof Error && \"code\" in error ? String(error.code) : undefined;\n}\n\nexport async function output(context: CommandContext, text: string | Uint8Array): Promise<void> {\n context.signal.throwIfAborted();\n await writeBytes(context.stdout, typeof text === \"string\" ? encoder.encode(text) : text, context.signal);\n}\n\nexport async function diagnostic(context: CommandContext, error: unknown): Promise<void> {\n context.signal.throwIfAborted();\n await writeDiagnostic(context.stderr, `${context.command}: ${publicDiagnosticMessage(error, context.onInternalError)}\\n`, context.signal);\n}\n\nexport function define(name: string, handler: CommandHandler, failureCode = 1): CommandDefinition {\n return {\n name,\n async execute(context) {\n context.signal.throwIfAborted();\n try { return await gnuInformation(name, context) ?? await handler(context); }\n catch (error) {\n context.signal.throwIfAborted();\n await diagnostic(context, error);\n return { exitCode: error instanceof UsageError ? 2 : failureCode };\n }\n },\n };\n}\n\nexport async function eachOperand(\n context: CommandContext, operands: readonly string[], operation: (operand: string) => Promise<void>,\n): Promise<{ exitCode: number }> {\n let exitCode = 0;\n for (const operand of operands) {\n context.signal.throwIfAborted();\n try { await operation(operand); }\n catch (error) { await diagnostic(context, error); exitCode = 1; }\n }\n return { exitCode };\n}\n\nexport async function* input(context: CommandContext, name = \"-\"): ByteSource {\n context.signal.throwIfAborted();\n if (name === \"-\") {\n yield* readBytes(context.stdin, context.signal);\n } else {\n await assertInputRequirements(context, [name]);\n const path = pathOf(context, name);\n const capabilities = await context.fs.capabilitiesFor?.(path, { signal: context.signal }) ?? context.fs.capabilities;\n if (context.fs.readStream && capabilities.streamingRead !== false) {\n let emitted = false;\n let reading = true;\n try {\n for await (const chunk of readBytes(context.fs.readStream(path, { signal: context.signal }), context.signal)) {\n reading = false;\n if (chunk.byteLength) emitted = true;\n yield chunk;\n reading = true;\n }\n return;\n } catch (error) {\n context.signal.throwIfAborted();\n if (!reading || emitted || !(error instanceof FsError) || error.code !== \"ENOTSUP\") throw error;\n }\n }\n if (capabilities.read === false) throw new FsError(\"ENOTSUP\", { syscall: \"readFile\", path });\n yield* readBytes({\n async *[Symbol.asyncIterator]() {\n const bytes = await context.fs.readFile(path, { signal: context.signal, maxBytes: bufferLimit });\n context.signal.throwIfAborted();\n if (bytes.byteLength > bufferLimit) throw new FsError(\"EFBIG\", { syscall: \"readFile\", path });\n yield bytes;\n },\n }, context.signal);\n }\n}\n\nexport async function assertInputRequirements(context: CommandContext, names: readonly string[]): Promise<void> {\n const files = names.filter(name => name !== \"-\");\n assertCommandRequirements(context, inputRequirements, [files.length ? \"file\" : \"stdin\"]);\n if (!context.fs.capabilitiesFor) return;\n for (const name of files) {\n try {\n const capabilities = await context.fs.capabilitiesFor(pathOf(context, name), { signal: context.signal });\n assertCommandRequirements(context, inputRequirements, [\"file\"], capabilities);\n } catch (error) {\n context.signal.throwIfAborted();\n if (codeOf(error) === \"ENOTSUP\" || codeOf(error) === \"EROFS\") throw error;\n }\n }\n}\n\nexport function concatenate(chunks: readonly Uint8Array[], size = chunks.reduce((sum, chunk) => sum + chunk.length, 0)): Uint8Array {\n const result = new Uint8Array(size);\n let offset = 0;\n for (const chunk of chunks) { result.set(chunk, offset); offset += chunk.length; }\n return result;\n}\n\nexport async function collect(source: ByteSource, signal: AbortSignal, limit = bufferLimit): Promise<Uint8Array> {\n const chunks: Uint8Array[] = [];\n let size = 0;\n for await (const chunk of source) {\n signal.throwIfAborted();\n size += chunk.length;\n if (size > limit) throw new FsError(\"EFBIG\", { message: `buffer limit exceeded (${limit} bytes)` });\n chunks.push(new Uint8Array(chunk));\n }\n return concatenate(chunks, size);\n}\n\nexport interface Line { readonly bytes: Uint8Array; readonly terminated: boolean }\n\nexport async function* lines(source: ByteSource, separator = 10, admit?: (size: number) => void): AsyncGenerator<Line> {\n const pending = new RecordBuffer(bufferLimit);\n try {\n for await (const chunk of source) {\n let start = 0;\n while (start < chunk.length) {\n const offset = chunk.indexOf(separator, start);\n if (offset < 0) break;\n yield { bytes: pending.finish(admit, chunk, start, offset), terminated: true };\n start = offset + 1;\n }\n pending.append(chunk, start);\n }\n if (pending.size) yield { bytes: pending.finish(admit), terminated: false };\n } finally { pending.clear(); }\n}\n\nexport function emptyInput(): ByteSource { return toByteSource(\"\"); }\n\nexport function replaceArgument(source: string | Uint8Array, pattern: string, replacement: string): string | Uint8Array {\n if (typeof source === \"string\") return source.split(pattern).join(replacement);\n const needle = encoder.encode(pattern);\n if (!needle.length) throw new UsageError(\"replacement string cannot be empty\");\n const substituted = encoder.encode(replacement);\n const chunks: Uint8Array[] = [];\n let start = 0;\n for (let offset = 0; offset <= source.length - needle.length;) {\n if (needle.every((byte, index) => source[offset + index] === byte)) {\n chunks.push(source.subarray(start, offset), substituted);\n offset += needle.length;\n start = offset;\n } else offset++;\n }\n chunks.push(source.subarray(start));\n return concatenate(chunks);\n}\n\nexport function escapeBytes(text: string | Uint8Array, zeroOctal = false, bareOctal = false,\n unicode?: { utf8: boolean; missingDigit: (escape: string) => void }): { bytes: Uint8Array; stop: boolean } {\n if (unicode && typeof text === \"string\") text = encoder.encode(text);\n if (typeof text === \"string\") {\n const chunks: Uint8Array[] = [];\n const control: Record<string, number> = { a: 7, b: 8, e: 27, E: 27, f: 12, n: 10, r: 13, t: 9, v: 11, \"\\\\\": 92 };\n for (let index = 0; index < text.length;) {\n if (text[index] !== \"\\\\\" || index + 1 === text.length) {\n const character = String.fromCodePoint(text.codePointAt(index)!);\n chunks.push(encoder.encode(character)); index += character.length; continue;\n }\n const next = text[index + 1]!;\n if (next === \"c\") return { bytes: concatenate(chunks), stop: true };\n if (control[next] !== undefined) { chunks.push(Uint8Array.of(control[next])); index += 2; continue; }\n const rest = text.slice(index + 1);\n const octal = zeroOctal ? (bareOctal ? /^(?:0([0-7]{0,3})|([1-7][0-7]{0,2}))/u : /^0([0-7]{0,3})/u).exec(rest) : /^([0-7]{1,3})/u.exec(rest);\n if (octal) { chunks.push(Uint8Array.of(parseInt(octal[1] || octal[2] || \"0\", 8) & 255)); index += 1 + octal[0].length; continue; }\n const hexadecimal = /^x([0-9a-fA-F]{1,2})/u.exec(rest);\n if (hexadecimal) { chunks.push(Uint8Array.of(parseInt(hexadecimal[1]!, 16))); index += 1 + hexadecimal[0].length; continue; }\n chunks.push(encoder.encode(`\\\\${next}`)); index += 2;\n }\n return { bytes: concatenate(chunks), stop: false };\n }\n const source = text;\n // C-locale fallback normalizes short escapes to four/eight uppercase digits.\n const bytes = new Uint8Array(source.length * (unicode && !unicode.utf8 ? 3 : 1));\n const control: Record<number, number> = { 97: 7, 98: 8, 101: 27, 69: 27, 102: 12, 110: 10, 114: 13, 116: 9, 118: 11, 92: 92 };\n let size = 0;\n for (let index = 0; index < source.length;) {\n if (source[index] !== 92 || index + 1 === source.length) { bytes[size++] = source[index++]!; continue; }\n const next = source[index + 1]!;\n if (next === 99) return { bytes: bytes.subarray(0, size), stop: true };\n if (control[next] !== undefined) { bytes[size++] = control[next]; index += 2; continue; }\n if (zeroOctal ? next === 48 || bareOctal && next >= 49 && next <= 55 : next >= 48 && next <= 55) {\n let offset = index + (zeroOctal && next === 48 ? 2 : 1);\n const end = Math.min(source.length, offset + 3);\n let value = 0;\n while (offset < end && source[offset]! >= 48 && source[offset]! <= 55) value = value * 8 + source[offset++]! - 48;\n bytes[size++] = value & 255;\n index = offset;\n continue;\n }\n if (unicode && (next === 117 || next === 85)) {\n const digits = next === 117 ? 4 : 8;\n let offset = index + 2;\n const end = Math.min(source.length, offset + digits);\n let value = 0;\n while (offset < end) {\n const digit = source[offset]!;\n const number = digit >= 48 && digit <= 57 ? digit - 48 : digit >= 65 && digit <= 70 ? digit - 55 : digit >= 97 && digit <= 102 ? digit - 87 : -1;\n if (number < 0) break;\n value = value * 16 + number;\n offset++;\n }\n if (offset === index + 2) unicode.missingDigit(String.fromCharCode(next));\n else {\n // Bash discards values outside its signed 32-bit wide-character range.\n if (value < 0x80000000) {\n if (!unicode.utf8 && value > 127) {\n const literal = encoder.encode(`\\\\${value <= 0xffff ? \"u\" : \"U\"}${value.toString(16).toUpperCase().padStart(value <= 0xffff ? 4 : 8, \"0\")}`);\n bytes.set(literal, size);\n size += literal.length;\n } else if (value < 128) bytes[size++] = value;\n else {\n // Match Bash's byte encoding, including surrogate and extended values.\n const length = value < 0x800 ? 2 : value < 0x10000 ? 3 : value < 0x200000 ? 4 : value < 0x4000000 ? 5 : 6;\n for (let position = length - 1; position > 0; position--) {\n bytes[size + position] = 0x80 | value & 0x3f;\n value = Math.floor(value / 64);\n }\n bytes[size] = (0xff << (8 - length) & 0xff) | value;\n size += length;\n }\n }\n index = offset;\n continue;\n }\n }\n if (next === 120) {\n let offset = index + 2;\n const end = Math.min(source.length, offset + 2);\n let value = 0;\n while (offset < end) {\n const digit = source[offset]!;\n const number = digit >= 48 && digit <= 57 ? digit - 48 : digit >= 65 && digit <= 70 ? digit - 55 : digit >= 97 && digit <= 102 ? digit - 87 : -1;\n if (number < 0) break;\n value = value * 16 + number;\n offset++;\n }\n if (offset > index + 2) { bytes[size++] = value; index = offset; continue; }\n unicode?.missingDigit(\"x\");\n }\n bytes[size++] = 92;\n bytes[size++] = next;\n index += 2;\n }\n return { bytes: bytes.subarray(0, size), stop: false };\n}\n", "import type { CommandFileSystemRequirement } from \"../contracts/command-requirements.js\";\n\nexport const inputRequirements: readonly CommandFileSystemRequirement[] = [\n { id: \"stdin\", description: \"Read standard input\", capabilities: [] },\n { id: \"file\", description: \"Read file operands\", capabilities: [], anyOf: [[\"streamingRead\"], [\"read\"]] },\n];\n\nexport const textOutputRequirements: readonly CommandFileSystemRequirement[] = [\n ...inputRequirements,\n { id: \"output\", description: \"Write or truncate an output file\", capabilities: [], anyOf: [[\"streamingWrite\"], [\"write\"]], mutates: true },\n];\n\nexport const pwdRequirements: readonly CommandFileSystemRequirement[] = [\n { id: \"logical\", description: \"Print the logical working directory\", capabilities: [] },\n { id: \"physical\", description: \"Resolve the physical working directory (-P)\", capabilities: [\"realpath\"] },\n];\n\nexport const predicateRequirements: readonly CommandFileSystemRequirement[] = [\n { id: \"expression\", description: \"Evaluate strings and integers\", capabilities: [] },\n { id: \"metadata\", description: \"Inspect file metadata\", capabilities: [\"stat\"] },\n { id: \"access\", description: \"Inspect path access permissions\", capabilities: [\"access\"] },\n];\n", "import { FsError } from \"../contracts/index.js\";\n\nconst segmentSize = 4096;\n\nexport class RecordBuffer {\n #segments: Uint8Array[] = [];\n #size = 0;\n #allocated = 0;\n\n constructor(readonly capacity: number, readonly finalizationCapacity = capacity * 2) {}\n\n get size(): number { return this.#size; }\n\n #admit(length: number): void {\n if (length > this.capacity - this.#size) {\n throw new FsError(\"EFBIG\", { message: \"line buffer limit exceeded\" });\n }\n }\n\n append(bytes: Uint8Array, start = 0, end = bytes.length): void {\n this.#admit(end - start);\n let offset = start;\n while (offset < end) {\n let segment = this.#segments.at(-1);\n const used = this.#size % segmentSize;\n if (!segment || used === 0) {\n segment = new Uint8Array(Math.min(segmentSize, this.capacity - this.#allocated));\n this.#segments.push(segment);\n this.#allocated += segment.length;\n }\n const length = Math.min(end - offset, segment.length - used);\n segment.set(bytes.subarray(offset, offset + length), used);\n this.#size += length;\n offset += length;\n }\n }\n\n finish(admit?: (size: number) => void, bytes?: Uint8Array, start = 0, end = bytes?.length ?? 0): Uint8Array {\n const tailLength = end - start;\n this.#admit(tailLength);\n const size = this.#size + tailLength;\n admit?.(size);\n if (size > this.finalizationCapacity - this.#allocated) {\n throw new FsError(\"EFBIG\", { message: \"line finalization buffer limit exceeded\" });\n }\n if (this.#size === 0) {\n const result = new Uint8Array(tailLength);\n if (bytes && tailLength > 0) result.set(bytes.subarray(start, end));\n return result;\n }\n const result = new Uint8Array(size);\n let offset = 0;\n for (const segment of this.#segments) {\n const length = Math.min(segment.length, this.#size - offset);\n result.set(segment.subarray(0, length), offset);\n offset += length;\n }\n if (bytes && tailLength > 0) result.set(bytes.subarray(start, end), offset);\n this.clear();\n return result;\n }\n\n clear(): void {\n if (this.#segments.length) this.#segments.length = 0;\n this.#size = 0;\n this.#allocated = 0;\n }\n}\n", "import { writeBytes, type CommandContext, type CommandResult } from \"../contracts/index.js\";\n\ninterface Information {\n readonly usage: string;\n readonly description: string;\n readonly options: readonly string[];\n readonly stopAtOperand?: boolean;\n readonly versionOnly?: boolean;\n}\n\n// These describe the virtual implementations, not the complete GNU option set.\nconst information: Readonly<Record<string, Information>> = {\n cat: { usage: \"[OPTION]... [FILE]...\", description: \"Concatenate input files.\", options: [\"-n, --number\", \"-b, --number-nonblank\", \"-s, --squeeze-blank\", \"-E, --show-ends\", \"-T, --show-tabs\", \"-v, --show-nonprinting\", \"-A, --show-all\"], versionOnly: true },\n du: { usage: \"[OPTION]... [FILE]...\", description: \"Report virtual file allocation.\", options: [\"-a, --all\", \"-s, --summarize\", \"-c, --total\", \"-h, --human-readable\", \"-B, --block-size=SIZE\", \"-b, --bytes\", \"--apparent-size\", \"-d, --max-depth=NUM\", \"-X, --exclude-from=FILE\", \"--exclude=PATTERN\", \"-t, --threshold=SIZE\"], versionOnly: true },\n base32: { usage: \"[OPTION]... [FILE]\", description: \"Encode or decode Base32 data.\", options: [\"-d, --decode\", \"-i, --ignore-garbage\", \"-w, --wrap=COLS\"] },\n base64: { usage: \"[OPTION]... [FILE]\", description: \"Encode or decode Base64 data.\", options: [\"-d, --decode\", \"-i, --ignore-garbage\", \"-w, --wrap=COLS\"] },\n basename: { usage: \"[OPTION]... NAME... [SUFFIX]\", description: \"Remove directory components and an optional suffix from names.\", options: [\"-a, --multiple\", \"-s, --suffix=SUFFIX\", \"-z, --zero\"] },\n dirname: { usage: \"[OPTION]... NAME...\", description: \"Print the directory component of each name.\", options: [\"-z, --zero\"] },\n chmod: { usage: \"[OPTION]... MODE FILE...\", description: \"Change virtual file permissions, subject to filesystem capabilities.\", options: [\"-R, --recursive\", \"-v, --verbose\", \"-c, --changes\", \"-f, --silent, --quiet\", \"--reference=FILE\"] },\n cksum: { usage: \"[OPTION]... [FILE]...\", description: \"Compute checksums of files or standard input.\", options: [\"-a, --algorithm=TYPE\", \"-b, --binary\", \"-z, --zero\", \"--tag\", \"--untagged\", \"--raw\", \"--base64\"] },\n comm: { usage: \"[OPTION]... FILE1 FILE2\", description: \"Compare sorted files in the C/POSIX byte locale.\", options: [\"-1\", \"-2\", \"-3\", \"--output-delimiter=STR\", \"--check-order\", \"--nocheck-order\"] },\n cp: { usage: \"[OPTION]... SOURCE... DEST\", description: \"Copy virtual files, subject to filesystem capabilities.\", options: [\"-a, --archive\", \"-r, -R, --recursive\", \"-f, --force\", \"-i, --interactive\", \"-n, --no-clobber\", \"-v, --verbose\", \"-t, --target-directory=DIR\", \"-T, --no-target-directory\", \"-S, --suffix=SUFFIX\"] },\n cut: { usage: \"[OPTION]... [FILE]...\", description: \"Select bytes, characters or fields from each input line.\", options: [\"-b, --bytes=LIST\", \"-c, --characters=LIST\", \"-f, --fields=LIST\", \"-d, --delimiter=CHAR\", \"-s, --only-delimited\", \"-z, --zero-terminated\", \"--output-delimiter=STR\", \"--complement\"] },\n env: { usage: \"[OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]\", description: \"Print the environment or run a registered command with a modified environment.\", options: [\"-i, --ignore-environment\", \"-u, --unset=NAME\", \"-C, --chdir=DIR\", \"-S, --split-string=STR\", \"-0, --null\"], stopAtOperand: true },\n expand: { usage: \"[OPTION]... [FILE]...\", description: \"Convert tabs to spaces.\", options: [\"-i, --initial\", \"-t, --tabs=LIST\"] },\n fold: { usage: \"[OPTION]... [FILE]...\", description: \"Wrap input lines to a selected width.\", options: [\"-b, --bytes\", \"-s, --spaces\", \"-w, --width=COLS\"] },\n head: { usage: \"[OPTION]... [FILE]...\", description: \"Print the first ten lines by default, or a selected line/byte count.\", options: [\"-n, --lines=NUM\", \"-c, --bytes=NUM\", \"-q, --quiet, --silent\", \"-v, --verbose\", \"-z, --zero-terminated\"] },\n tail: { usage: \"[OPTION]... [FILE]...\", description: \"Print the last ten lines by default, or a selected line/byte count.\", options: [\"-n, --lines=NUM\", \"-c, --bytes=NUM\", \"-q, --quiet, --silent\", \"-v, --verbose\", \"-z, --zero-terminated\"] },\n join: { usage: \"[OPTION]... FILE1 FILE2\", description: \"Join sorted files on a common field in the C/POSIX byte locale.\", options: [\"-1=FIELD\", \"-2=FIELD\", \"-j=FIELD\", \"-t=CHAR\", \"-a=FILENUM\", \"-v=FILENUM\", \"-e=STR\", \"-o=FORMAT\", \"-i\", \"--check-order\", \"--nocheck-order\"] },\n ln: { usage: \"[OPTION]... TARGET... LINK_NAME\", description: \"Create virtual hard or symbolic links when supported by the filesystem.\", options: [\"-s, --symbolic\", \"-r, --relative\", \"-f, --force\", \"-i, --interactive\", \"-n, --no-dereference\", \"-v, --verbose\", \"-t, --target-directory=DIR\", \"-T, --no-target-directory\", \"-S, --suffix=SUFFIX\"] },\n ls: { usage: \"[OPTION]... [FILE]...\", description: \"List virtual directory entries.\", options: [\"-a, --all\", \"-A, --almost-all\", \"-l\", \"-1\", \"-d, --directory\", \"-F, --classify\", \"-r, --reverse\", \"-R, --recursive\", \"-L, --dereference\", \"-h, --human-readable\"] },\n mkdir: { usage: \"[OPTION]... DIRECTORY...\", description: \"Create virtual directories.\", options: [\"-p, --parents\", \"-m, --mode=MODE\", \"-v, --verbose\"] },\n mktemp: { usage: \"[OPTION]... [TEMPLATE]\", description: \"Create a temporary virtual file or directory.\", options: [\"-d, --directory\", \"-q, --quiet\", \"-u, --dry-run\", \"-p=DIR\", \"--tmpdir[=DIR]\", \"--suffix=SUFFIX\"] },\n mv: { usage: \"[OPTION]... SOURCE... DEST\", description: \"Move virtual files, subject to filesystem capabilities.\", options: [\"-f, --force\", \"-i, --interactive\", \"-n, --no-clobber\", \"-u, --update\", \"-v, --verbose\", \"-t, --target-directory=DIR\", \"-T, --no-target-directory\", \"-S, --suffix=SUFFIX\"] },\n nl: { usage: \"[OPTION]... [FILE]...\", description: \"Number input lines by section and numbering style.\", options: [\"-b, --body-numbering=STYLE\", \"-h, --header-numbering=STYLE\", \"-f, --footer-numbering=STYLE\", \"-v, --starting-line-number=NUM\", \"-i, --line-increment=NUM\", \"-s, --number-separator=STR\", \"-w, --number-width=NUM\", \"-n, --number-format=FORMAT\", \"-d, --section-delimiter=STR\", \"-l, --join-blank-lines=NUM\", \"-p, --no-renumber\"] },\n od: { usage: \"[OPTION]... [FILE]...\", description: \"Print input bytes in selected numeric formats.\", options: [\"-A, --address-radix=RADIX\", \"-j, --skip-bytes=NUM\", \"-N, --read-bytes=NUM\", \"-t, --format=TYPE, --type=TYPE\", \"-w, --width=NUM\", \"--endian=ORDER\", \"-v, --output-duplicates\"] },\n paste: { usage: \"[OPTION]... [FILE]...\", description: \"Merge corresponding or serial input lines.\", options: [\"-s, --serial\", \"-d, --delimiters=LIST\", \"-z, --zero-terminated\"] },\n readlink: { usage: \"[OPTION]... FILE...\", description: \"Print symbolic link targets or canonical virtual paths.\", options: [\"-f, --canonicalize\", \"-e, --canonicalize-existing\", \"-m, --canonicalize-missing\", \"-n, --no-newline\", \"-z, --zero\"] },\n realpath: { usage: \"[OPTION]... FILE...\", description: \"Print canonical virtual paths.\", options: [\"-e, --canonicalize-existing\", \"-m, --canonicalize-missing\", \"-s, --strip, --no-symlinks\", \"-z, --zero\"] },\n rm: { usage: \"[OPTION]... FILE...\", description: \"Remove virtual files and directories.\", options: [\"-r, -R, --recursive\", \"-f, --force\", \"-d, --dir\", \"-v, --verbose\", \"-i\", \"-I\"] },\n rmdir: { usage: \"[OPTION]... DIRECTORY...\", description: \"Remove empty virtual directories.\", options: [\"-p, --parents\", \"-v, --verbose\", \"--ignore-fail-on-non-empty\"] },\n seq: { usage: \"[OPTION]... [FIRST [INCREMENT]] LAST\", description: \"Print a numeric sequence.\", options: [\"-s, --separator=STR\", \"-f, --format=FORMAT\", \"-w, --equal-width\"] },\n sort: { usage: \"[OPTION]... [FILE]...\", description: \"Sort input records using the supported byte-oriented ordering modes.\", options: [\"-n, --numeric-sort\", \"-g, --general-numeric-sort\", \"-h, --human-numeric-sort\", \"-V, --version-sort\", \"-r, --reverse\", \"-f, --ignore-case\", \"-u, --unique\", \"-s, --stable\", \"-m, --merge\", \"-k, --key=KEY\", \"-t, --field-separator=CHAR\", \"-o, --output=FILE\", \"--sort=MODE\", \"-z, --zero-terminated\"] },\n split: { usage: \"[OPTION]... [FILE [PREFIX]]\", description: \"Split input into virtual output files.\", options: [\"-l, --lines=NUM\", \"-b, --bytes=SIZE\", \"-C, --line-bytes=SIZE\", \"-a, --suffix-length=NUM\", \"--additional-suffix=SUFFIX\"] },\n stat: { usage: \"[OPTION]... FILE...\", description: \"Display virtual file metadata supplied by the filesystem.\", options: [\"-L, --dereference\", \"-c, --format=FORMAT\", \"--printf=FORMAT\", \"-t, --terse\"] },\n tac: { usage: \"[OPTION]... [FILE]...\", description: \"Print input records in reverse order.\", options: [\"-b, --before\", \"-r, --regex\", \"-s, --separator=STR\"] },\n tee: { usage: \"[OPTION]... [FILE]...\", description: \"Copy standard input to standard output and virtual files.\", options: [\"-a, --append\", \"-i, --ignore-interrupts\", \"--output-error=MODE\"] },\n touch: { usage: \"[OPTION]... FILE...\", description: \"Update virtual file timestamps, creating missing files by default.\", options: [\"-a\", \"-m\", \"-c, --no-create\", \"-h, --no-dereference\", \"-r, --reference=FILE\", \"-d, --date=STR\", \"-t=STAMP\"] },\n tr: { usage: \"[OPTION]... STRING1 [STRING2]\", description: \"Translate, delete or squeeze input bytes.\", options: [\"-d, --delete\", \"-s, --squeeze-repeats\", \"-c, -C, --complement\", \"-t, --truncate-set1\"] },\n unexpand: { usage: \"[OPTION]... [FILE]...\", description: \"Convert spaces to tabs.\", options: [\"-a, --all\", \"-t, --tabs=LIST\", \"--first-only\"] },\n uniq: { usage: \"[OPTION]... [INPUT [OUTPUT]]\", description: \"Filter adjacent repeated input records.\", options: [\"-c, --count\", \"-d, --repeated\", \"-u, --unique\", \"-i, --ignore-case\", \"-f, --skip-fields=NUM\", \"-s, --skip-chars=NUM\", \"-w, --check-chars=NUM\", \"-z, --zero-terminated\"] },\n wc: { usage: \"[OPTION]... [FILE]...\", description: \"Count input lines, words, bytes, characters or display width.\", options: [\"-l, --lines\", \"-w, --words\", \"-c, --bytes\", \"-m, --chars\", \"-L, --max-line-length\"] },\n};\n\nconst checksumInformation: Information = {\n usage: \"[OPTION]... [FILE]...\", description: \"Compute or verify file digests.\",\n options: [\"-b, --binary\", \"-c, --check\", \"-t, --text\", \"-z, --zero\", \"--tag\", \"--quiet\", \"--status\", \"--strict\", \"--warn\", \"--ignore-missing\"],\n};\n\nexport async function gnuInformation(name: string, context: CommandContext): Promise<CommandResult | undefined> {\n if (!context.args.includes(\"--help\") && !context.args.includes(\"--version\")) return undefined;\n const info = information[name] ?? ([\"md5sum\", \"sha1sum\", \"sha224sum\", \"sha256sum\", \"sha384sum\", \"sha512sum\"].includes(name) ? checksumInformation : undefined);\n if (!info) return undefined;\n const flags = new Map<string, \"none\" | \"required\" | \"optional\">();\n for (const option of info.options) {\n const takesValue = option.includes(\"[=\") ? \"optional\" : option.includes(\"=\") ? \"required\" : \"none\";\n for (const spelling of option.split(\", \")) flags.set(spelling.split(\"=\")[0]!.split(\"[\")[0]!, takesValue);\n }\n for (let index = 0; index < context.args.length; index++) {\n const arg = context.args[index]!;\n if (arg === \"--\") break;\n if (arg === \"--help\" || arg === \"--version\") {\n if (arg === \"--help\" && info.versionOnly) return undefined;\n const text = arg === \"--version\"\n ? `${name} (safe-bash virtual implementation)\\n`\n : `Usage: ${name} ${info.usage}\\n${info.description}\\n\\nCommon supported options (additional behavior is documented in the package):\\n${info.options.map(option => ` ${option.split(\", \").map(spelling => spelling.startsWith(\"--\") ? spelling : spelling.replace(\"=\", \" \")).join(\", \")}`).join(\"\\n\")}\\n --help display this help and exit\\n --version display implementation information and exit\\n\\nThis is the safe-bash virtual implementation; filesystem operations require backend capabilities.\\n`;\n await writeBytes(context.stdout, new TextEncoder().encode(text), context.signal);\n return { exitCode: 0 };\n }\n if (!arg.startsWith(\"-\") || arg === \"-\") {\n if (info.stopAtOperand) break;\n continue;\n }\n if (arg.startsWith(\"--\")) {\n const equal = arg.indexOf(\"=\");\n const spelling = equal < 0 ? arg : arg.slice(0, equal);\n if (!flags.has(spelling)) return undefined;\n if (flags.get(spelling) === \"required\" && equal < 0) index++;\n else if (flags.get(spelling) === \"none\" && equal >= 0) return undefined;\n } else {\n for (let offset = 1; offset < arg.length; offset++) {\n const spelling = `-${arg[offset]}`;\n if (!flags.has(spelling)) return undefined;\n if (flags.get(spelling) === \"required\") {\n if (offset + 1 === arg.length) index++;\n break;\n }\n }\n }\n }\n return undefined;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;AAEO,IAAM,oBAA6D;AAAA,EACxE,EAAE,IAAI,SAAS,aAAa,uBAAuB,cAAc,CAAC,EAAE;AAAA,EACpE,EAAE,IAAI,QAAQ,aAAa,sBAAsB,cAAc,CAAC,GAAG,OAAO,CAAC,CAAC,eAAe,GAAG,CAAC,MAAM,CAAC,EAAE;AAC1G;AAEO,IAAM,yBAAkE;AAAA,EAC7E,GAAG;AAAA,EACH,EAAE,IAAI,UAAU,aAAa,oCAAoC,cAAc,CAAC,GAAG,OAAO,CAAC,CAAC,gBAAgB,GAAG,CAAC,OAAO,CAAC,GAAG,SAAS,KAAK;AAC3I;AAEO,IAAM,kBAA2D;AAAA,EACtE,EAAE,IAAI,WAAW,aAAa,uCAAuC,cAAc,CAAC,EAAE;AAAA,EACtF,EAAE,IAAI,YAAY,aAAa,+CAA+C,cAAc,CAAC,UAAU,EAAE;AAC3G;AAEO,IAAM,wBAAiE;AAAA,EAC5E,EAAE,IAAI,cAAc,aAAa,iCAAiC,cAAc,CAAC,EAAE;AAAA,EACnF,EAAE,IAAI,YAAY,aAAa,yBAAyB,cAAc,CAAC,MAAM,EAAE;AAAA,EAC/E,EAAE,IAAI,UAAU,aAAa,mCAAmC,cAAc,CAAC,QAAQ,EAAE;AAC3F;;;ACrBA;AAEA,IAAM,cAAc;AAEb,IAAM,eAAN,MAAmB;AAAA,EAKxB,YAAqB,UAA2B,uBAAuB,WAAW,GAAG;AAAhE;AAA2B;AAAA,EAAsC;AAAA,EAAjE;AAAA,EAA2B;AAAA,EAJhD,YAA0B,CAA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xC,cAAAA,SAAQ,KAAK,MAAMA,SAAQ,EAAE;AAAA,YAC/B;AACA,kBAAM,IAAI,IAAK,OAAS,IAAI,SAAU,MAAQA;AAC9C,oBAAQ;AAAA,UACV;AAAA,QACF;AACA,gBAAQ;AACR;AAAA,MACF;AAAA,IACF;AACA,QAAI,SAAS,KAAK;AAChB,UAAI,SAAS,QAAQ;AACrB,YAAM,MAAM,KAAK,IAAI,OAAO,QAAQ,SAAS,CAAC;AAC9C,UAAIA,SAAQ;AACZ,aAAO,SAAS,KAAK;AACnB,cAAM,QAAQ,OAAO,MAAM;AAC3B,cAAM,SAAS,SAAS,MAAM,SAAS,KAAK,QAAQ,KAAK,SAAS,MAAM,SAAS,KAAK,QAAQ,KAAK,SAAS,MAAM,SAAS,MAAM,QAAQ,KAAK;AAC9I,YAAI,SAAS,EAAG;AAChB,QAAAA,SAAQA,SAAQ,KAAK;AACrB;AAAA,MACF;AACA,UAAI,SAAS,QAAQ,GAAG;AAAE,cAAM,MAAM,IAAIA;AAAO,gBAAQ;AAAQ;AAAA,MAAU;AAC3E,eAAS,aAAa,GAAG;AAAA,IAC3B;AACA,UAAM,MAAM,IAAI;AAChB,UAAM,MAAM,IAAI;AAChB,aAAS;AAAA,EACX;AACA,SAAO,EAAE,OAAO,MAAM,SAAS,GAAG,IAAI,GAAG,MAAM,MAAM;AACvD;",
6
+ "names": ["result", "value", "control", "value"]
7
+ }
@@ -14,20 +14,20 @@ import {
14
14
  parse,
15
15
  put,
16
16
  wellFormed
17
- } from "./chunk-VV24PRPB.js";
17
+ } from "./chunk-AZQOEGP3.js";
18
18
  import {
19
19
  shellValueByteLength,
20
20
  value_exports
21
21
  } from "./chunk-ZY243FWG.js";
22
22
  import {
23
23
  pathOf
24
- } from "./chunk-OTM5RCWZ.js";
24
+ } from "./chunk-QNEDWYC2.js";
25
25
  import {
26
26
  escapeText
27
- } from "./chunk-ZZ7JQBPX.js";
27
+ } from "./chunk-4A2OLEML.js";
28
28
  import {
29
29
  yieldTurn
30
- } from "./chunk-YOK5UHA7.js";
30
+ } from "./chunk-XKXFX3RH.js";
31
31
  import {
32
32
  contracts_exports
33
33
  } from "./chunk-J2E3MV3E.js";
@@ -3417,4 +3417,4 @@ export {
3417
3417
  createYqCommands,
3418
3418
  yqCommands
3419
3419
  };
3420
- //# sourceMappingURL=chunk-LZ7FUN6K.js.map
3420
+ //# sourceMappingURL=chunk-RHHDOA67.js.map
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  pathOf
3
- } from "./chunk-VGJIDLZM.js";
3
+ } from "./chunk-KS5VSJYM.js";
4
4
  import {
5
5
  writeDiagnostic
6
- } from "./chunk-WTZZX4LV.js";
6
+ } from "./chunk-A4MB2KXV.js";
7
7
  import {
8
8
  createOutputOperation
9
9
  } from "./chunk-LV3A66Y2.js";
10
10
  import {
11
11
  inheritYieldCheckpoint,
12
12
  yieldTurn
13
- } from "./chunk-B6YFFKYG.js";
13
+ } from "./chunk-X4I3RHTC.js";
14
14
  import {
15
15
  getCommandArguments
16
16
  } from "./chunk-P7NFUYPJ.js";
@@ -293,4 +293,4 @@ export {
293
293
  createLlmCommands,
294
294
  llmCommands
295
295
  };
296
- //# sourceMappingURL=chunk-DSCL3VA2.js.map
296
+ //# sourceMappingURL=chunk-SJ3B26XV.js.map
@@ -14,22 +14,22 @@ import {
14
14
  parse,
15
15
  put,
16
16
  wellFormed
17
- } from "./chunk-RP5IZOOR.js";
17
+ } from "./chunk-BJYV5J65.js";
18
18
  import {
19
19
  shellValueByteLength
20
20
  } from "./chunk-RA4KWAKW.js";
21
21
  import {
22
22
  pathOf
23
- } from "./chunk-VGJIDLZM.js";
23
+ } from "./chunk-KS5VSJYM.js";
24
24
  import {
25
25
  escapeText
26
- } from "./chunk-WTZZX4LV.js";
26
+ } from "./chunk-A4MB2KXV.js";
27
27
  import {
28
28
  createOutputOperation
29
29
  } from "./chunk-LV3A66Y2.js";
30
30
  import {
31
31
  yieldTurn
32
- } from "./chunk-B6YFFKYG.js";
32
+ } from "./chunk-X4I3RHTC.js";
33
33
  import {
34
34
  commandRuntimeIdentity,
35
35
  getCommandArguments
@@ -3424,4 +3424,4 @@ export {
3424
3424
  createYqCommands,
3425
3425
  yqCommands
3426
3426
  };
3427
- //# sourceMappingURL=chunk-6JBTVWHH.js.map
3427
+ //# sourceMappingURL=chunk-SWACYEIT.js.map
@@ -10,8 +10,9 @@ import {
10
10
  publicDiagnosticMessage
11
11
  } from "./chunk-ITX6SBN6.js";
12
12
  import {
13
+ hasYieldCheckpoint,
13
14
  yieldTurn
14
- } from "./chunk-YOK5UHA7.js";
15
+ } from "./chunk-XKXFX3RH.js";
15
16
  import {
16
17
  contracts_exports
17
18
  } from "./chunk-J2E3MV3E.js";
@@ -63,6 +64,8 @@ var RegexExecutionError = class extends PublicDiagnostic {
63
64
  };
64
65
  var matchRangeLimits = Object.freeze({ perRow: Infinity, perReply: Infinity });
65
66
  var trustedWorkerRequests = /* @__PURE__ */ new WeakSet();
67
+ var trustedWorkerReplies = /* @__PURE__ */ new WeakSet();
68
+ var trustedInputRows = /* @__PURE__ */ new WeakSet();
66
69
  var exprMatchCeilings = Object.freeze({
67
70
  maxPatternBytes: Infinity,
68
71
  maxSubjectBytes: Infinity,
@@ -225,6 +228,30 @@ function validateReply(value, id, rows, signal) {
225
228
  throw new RegexExecutionError("MATCH", reply.error);
226
229
  }
227
230
  if (!("results" in reply) || !Array.isArray(reply.results) || reply.results.length !== rows.length) throw new RegexExecutionError("PROTOCOL", "invalid reply rows");
231
+ if (trustedWorkerReplies.has(reply)) {
232
+ const resultCount2 = reply.results.length;
233
+ const results2 = new Array(resultCount2);
234
+ let total2 = 0;
235
+ for (let index = 0; index < resultCount2; index++) {
236
+ const ranges = reply.results[index];
237
+ const length = ranges.length;
238
+ if (length === 0) {
239
+ results2[index] = emptyMatches;
240
+ continue;
241
+ }
242
+ const count = length >> 1;
243
+ if (count > matchRangeLimits.perRow || count > matchRangeLimits.perReply - total2) {
244
+ throw new RegexExecutionError("PROTOCOL", "match range limit exceeded");
245
+ }
246
+ total2 += count;
247
+ const result = new Array(count);
248
+ for (let offset = 0, out = 0; offset < length; offset += 2, out++) {
249
+ result[out] = { start: ranges[offset], end: ranges[offset + 1] };
250
+ }
251
+ results2[index] = result;
252
+ }
253
+ return results2;
254
+ }
228
255
  let total = 0;
229
256
  const resultCount = reply.results.length;
230
257
  const lengths = new Array(resultCount);
@@ -8438,9 +8465,10 @@ var EreLedger = class {
8438
8465
  }
8439
8466
  this.#usage.work += amount;
8440
8467
  }
8441
- workAllowanceUntilCheckpoint() {
8468
+ workAllowanceUntilCheckpoint(signal) {
8442
8469
  const untilLimit = this.limits.work - this.#usage.work;
8443
- const untilYield = 256 - (this.#usage.work - this.#lastYield);
8470
+ const interval = hasYieldCheckpoint(signal) ? 256 : 16384;
8471
+ const untilYield = interval - (this.#usage.work - this.#lastYield);
8444
8472
  const min = untilLimit < untilYield ? untilLimit : untilYield;
8445
8473
  return min > 0 ? min : 0;
8446
8474
  }
@@ -8452,7 +8480,8 @@ var EreLedger = class {
8452
8480
  }
8453
8481
  checkpoint(signal) {
8454
8482
  this.check(signal);
8455
- if (this.#usage.work - this.#lastYield >= 256) {
8483
+ const interval = hasYieldCheckpoint(signal) ? 256 : 16384;
8484
+ if (this.#usage.work - this.#lastYield >= interval) {
8456
8485
  this.#lastYield = this.#usage.work;
8457
8486
  return yieldTurn(signal).then(() => {
8458
8487
  this.check(signal);
@@ -8747,10 +8776,34 @@ init_platform();
8747
8776
  function invalidUtf8() {
8748
8777
  throw new PublicDiagnostic("bounded regex unsupported: literal patterns and subjects require valid non-NUL UTF-8 bytes");
8749
8778
  }
8750
- async function validateUtf8(input, ledger, signal) {
8779
+ function validateUtf8(input, ledger, signal) {
8780
+ if (typeof input !== "string") {
8781
+ const len = input.length;
8782
+ if (len === 0) {
8783
+ ledger.check(signal);
8784
+ return void 0;
8785
+ }
8786
+ if (ledger.workAllowanceUntilCheckpoint(signal) >= len) {
8787
+ let ascii = true;
8788
+ for (let i = 0; i < len; i++) {
8789
+ const b = input[i];
8790
+ if (b === 0 || b >= 128) {
8791
+ ascii = false;
8792
+ break;
8793
+ }
8794
+ }
8795
+ if (ascii) {
8796
+ ledger.chargeWork(len, signal);
8797
+ return ledger.checkpoint(signal);
8798
+ }
8799
+ }
8800
+ }
8801
+ return validateUtf8Async(input, ledger, signal);
8802
+ }
8803
+ async function validateUtf8Async(input, ledger, signal) {
8751
8804
  for (let index = 0; index < input.length; ) {
8752
8805
  if (typeof input !== "string") {
8753
- const allowance = ledger.workAllowanceUntilCheckpoint();
8806
+ const allowance = ledger.workAllowanceUntilCheckpoint(signal);
8754
8807
  if (allowance > 1) {
8755
8808
  const maxRun = Math.min(input.length, index + allowance);
8756
8809
  let scan = index;
@@ -9293,7 +9346,20 @@ function options(input) {
9293
9346
  }
9294
9347
  return Object.freeze(result);
9295
9348
  }
9296
- function descriptor(value, limits) {
9349
+ function descriptor(value, limits, trusted = false) {
9350
+ if (trusted && value !== null && typeof value === "object") {
9351
+ const d = value;
9352
+ if (d.kind === "rg" || d.kind === "grep") {
9353
+ if (d.patterns.length > limits.maxPatterns) fail("limit", "pattern count limit exceeded");
9354
+ let bytes3 = 0;
9355
+ for (let index = 0; index < d.patterns.length; index++) {
9356
+ const pattern = d.patterns[index];
9357
+ if (pattern.length > limits.maxPatternBytes - bytes3) fail("limit", "aggregate pattern byte limit exceeded");
9358
+ bytes3 += pattern.length;
9359
+ }
9360
+ return d;
9361
+ }
9362
+ }
9297
9363
  if (value === null || typeof value !== "object") fail("protocol", "invalid descriptor");
9298
9364
  const kind = Object.getOwnPropertyDescriptor(value, "kind");
9299
9365
  if (!kind || !("value" in kind)) fail("protocol", "invalid descriptor kind");
@@ -9332,7 +9398,7 @@ function descriptor(value, limits) {
9332
9398
  function admit(input, limits, signal) {
9333
9399
  const trusted = trustedWorkerRequests.has(input);
9334
9400
  if (!trusted) record(input, ["id", "descriptor", "rows"]);
9335
- const selected = descriptor(input.descriptor, limits);
9401
+ const selected = descriptor(input.descriptor, limits, trusted);
9336
9402
  if (trusted && Array.isArray(input.rows)) {
9337
9403
  if (input.rows.length > limits.maxRows) fail("limit", "row count limit exceeded");
9338
9404
  } else {
@@ -9551,7 +9617,43 @@ async function compileLiteral(bytes2, ledger, signal, insensitive2 = false) {
9551
9617
  }
9552
9618
  return { bytes: bytes2, fallback, insensitive: insensitive2 };
9553
9619
  }
9554
- async function literalStart(program, subject, whole, word, ledger, signal, from = 0) {
9620
+ function literalStart(program, subject, whole, word, ledger, signal, from = 0) {
9621
+ const { bytes: bytes2, fallback } = program;
9622
+ const patLen = bytes2.length;
9623
+ const subLen = subject.length;
9624
+ if (!program.insensitive && patLen > 0 && ledger.workAllowanceUntilCheckpoint(signal) >= (subLen - from) * 2 + 2) {
9625
+ ledger.chargeWork(1, signal);
9626
+ if (whole && (from !== 0 || patLen !== subLen) || patLen > subLen - from) return -1;
9627
+ const firstByte = bytes2[0];
9628
+ for (let index = from, prefix = 0; index < subLen; ) {
9629
+ if (prefix === 0) {
9630
+ let scan = index;
9631
+ while (scan < subLen && subject[scan] !== firstByte) scan++;
9632
+ if (scan > index) {
9633
+ ledger.chargeWork(scan - index, signal);
9634
+ index = scan;
9635
+ if (index >= subLen) break;
9636
+ }
9637
+ }
9638
+ ledger.chargeWork(1, signal);
9639
+ if (subject[index] === bytes2[prefix]) {
9640
+ index++;
9641
+ if (++prefix === patLen) {
9642
+ const start = index - prefix;
9643
+ if (!word || !isAsciiWord(subject[start - 1] ?? -1) && !isAsciiWord(subject[index] ?? -1)) return start;
9644
+ prefix = fallback[prefix - 1];
9645
+ }
9646
+ } else if (prefix > 0) {
9647
+ prefix = fallback[prefix - 1];
9648
+ } else {
9649
+ index++;
9650
+ }
9651
+ }
9652
+ return -1;
9653
+ }
9654
+ return literalStartAsync(program, subject, whole, word, ledger, signal, from);
9655
+ }
9656
+ async function literalStartAsync(program, subject, whole, word, ledger, signal, from = 0) {
9555
9657
  const { bytes: bytes2, fallback } = program;
9556
9658
  ledger.charge("work", 1, signal);
9557
9659
  await ledger.checkpoint(signal);
@@ -9566,7 +9668,7 @@ async function literalStart(program, subject, whole, word, ledger, signal, from
9566
9668
  }
9567
9669
  for (let index = from, prefix = 0; index < subject.length; ) {
9568
9670
  if (prefix === 0 && !program.insensitive) {
9569
- const allowance = ledger.workAllowanceUntilCheckpoint();
9671
+ const allowance = ledger.workAllowanceUntilCheckpoint(signal);
9570
9672
  if (allowance > 1) {
9571
9673
  const firstByte = bytes2[0];
9572
9674
  const maxRun = Math.min(subject.length, index + allowance);
@@ -9655,8 +9757,12 @@ async function executeLiteral(input, signal, fold) {
9655
9757
  const results = [];
9656
9758
  const usage = { count: 0 };
9657
9759
  for (const row of rows) {
9658
- if (selected.kind === "rg") await validateUtf8(row.bytes, ledger, signal);
9659
- else {
9760
+ if (selected.kind === "rg") {
9761
+ const pendingUtf8 = validateUtf8(row.bytes, ledger, signal);
9762
+ if (pendingUtf8) await pendingUtf8;
9763
+ } else if (ledger.workAllowanceUntilCheckpoint(signal) >= row.bytes.length) {
9764
+ ledger.charge("work", row.bytes.length, signal);
9765
+ } else {
9660
9766
  for (let index = 0; index < row.bytes.length; index++) {
9661
9767
  ledger.charge("work", 1, signal);
9662
9768
  await ledger.checkpoint(signal);
@@ -9677,7 +9783,8 @@ async function executeLiteral(input, signal, fold) {
9677
9783
  let start = -1;
9678
9784
  let end = -1;
9679
9785
  for (const program of programs2) {
9680
- const candidate = await literalStart(program, row.bytes, selected.whole, selected.word, ledger, signal);
9786
+ const candidateOrPromise = literalStart(program, row.bytes, selected.whole, selected.word, ledger, signal);
9787
+ const candidate = typeof candidateOrPromise === "number" ? candidateOrPromise : await candidateOrPromise;
9681
9788
  if (candidate < 0) continue;
9682
9789
  if (start < 0 || candidate < start) {
9683
9790
  start = candidate;
@@ -9822,6 +9929,9 @@ var CooperativeWorker = class {
9822
9929
  try {
9823
9930
  this.#controller.signal.throwIfAborted();
9824
9931
  reply = owned ? "subject" in owned ? await executeExpr(owned, this.#controller.signal) : owned.descriptor.kind === "glob" ? await executeBoundedGlobs(owned, this.#controller.signal) : await execute(owned, this.#controller.signal) : { id, error: failure };
9932
+ if (owned && !("subject" in owned) && !("error" in reply)) {
9933
+ trustedWorkerReplies.add(reply);
9934
+ }
9825
9935
  } catch (error) {
9826
9936
  if (!(error instanceof ExprMatchError || error instanceof PublicDiagnostic || error instanceof EreSyntaxError || error instanceof EreUnsupportedError || error instanceof EreProfileLimitError || error instanceof EreUsageUnknownError)) {
9827
9937
  owned = void 0;
@@ -10041,7 +10151,7 @@ var RegexExecutor = class {
10041
10151
  });
10042
10152
  Object.assign(ownedDescriptor, { globOptions });
10043
10153
  }
10044
- const ownedRows = rows.map((row) => {
10154
+ const ownedRows = trustedInputRows.has(rows) ? rows : rows.map((row) => {
10045
10155
  signal.throwIfAborted();
10046
10156
  return { ...row, bytes: new Uint8Array(row.bytes) };
10047
10157
  });
@@ -10192,48 +10302,6 @@ var RegexSession = class {
10192
10302
  });
10193
10303
  }
10194
10304
  };
10195
- var AvailableRecords = class {
10196
- constructor(delimiter, maxLineBytes, extraDelimiter = -1) {
10197
- this.delimiter = delimiter;
10198
- this.maxLineBytes = maxLineBytes;
10199
- this.extraDelimiter = extraDelimiter;
10200
- }
10201
- delimiter;
10202
- maxLineBytes;
10203
- extraDelimiter;
10204
- chunk = new Uint8Array(0);
10205
- offset = 0;
10206
- async *source(source) {
10207
- for await (const chunk of source) {
10208
- this.chunk = Uint8Array.from(chunk);
10209
- this.offset = 0;
10210
- yield this.chunk;
10211
- }
10212
- }
10213
- end() {
10214
- for (let offset = this.offset; offset < this.chunk.length; offset++) {
10215
- if (this.chunk[offset] === this.delimiter || this.chunk[offset] === this.extraDelimiter) return offset;
10216
- }
10217
- return -1;
10218
- }
10219
- async *batches(source, size, maxRecords = () => 128) {
10220
- let batch = [];
10221
- let bytes2 = 0;
10222
- for await (const line of source) {
10223
- const end = this.end();
10224
- this.offset = end < 0 ? this.chunk.length : end + 1;
10225
- batch.push(line);
10226
- bytes2 += size(line);
10227
- const next = this.end();
10228
- if (batch.length >= maxRecords() || bytes2 >= 64 * 1024 || next < 0 || bytes2 + next - this.offset > 64 * 1024 || next - this.offset > this.maxLineBytes) {
10229
- yield batch;
10230
- batch = [];
10231
- bytes2 = 0;
10232
- }
10233
- }
10234
- if (batch.length) yield batch;
10235
- }
10236
- };
10237
10305
 
10238
10306
  // packages/safe-bash/src/commands/csplit/command.ts
10239
10307
  init_platform();
@@ -12487,12 +12555,12 @@ function csplitCommands(options2 = {}) {
12487
12555
 
12488
12556
  export {
12489
12557
  RegexExecutionError,
12558
+ trustedInputRows,
12490
12559
  exprMatchCeilings,
12491
12560
  ExprMatchError,
12492
12561
  withRegexSession,
12493
12562
  RegexExecutor,
12494
12563
  RegexSession,
12495
- AvailableRecords,
12496
12564
  reverseEmacsSteps,
12497
12565
  EreSyntaxError,
12498
12566
  EreUnsupportedError,
@@ -12507,4 +12575,4 @@ export {
12507
12575
  createCsplitCommands,
12508
12576
  csplitCommands
12509
12577
  };
12510
- //# sourceMappingURL=chunk-7UJW7TYR.js.map
12578
+ //# sourceMappingURL=chunk-TD6NWAUK.js.map