@poe-platform/safe-bash 0.1.801 → 0.1.803

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 (198) hide show
  1. package/README.md +4 -2
  2. package/dist/image-ast/index.browser.js +16 -5
  3. package/dist/image-ast/index.js +16 -5
  4. package/dist/safe-bash/chunks/chunk-2LSAMQER.js +84 -0
  5. package/dist/safe-bash/chunks/chunk-3HQU4OJO.js +13 -0
  6. package/dist/safe-bash/chunks/chunk-4BSJLKNM.js +14 -0
  7. package/dist/safe-bash/chunks/chunk-4D4N7IU2.js +47 -0
  8. package/dist/safe-bash/chunks/chunk-55YJASTN.js +14 -0
  9. package/dist/safe-bash/chunks/{chunk-NZQXYWA3.js → chunk-5OHX7C2V.js} +0 -1
  10. package/dist/safe-bash/chunks/chunk-7ZBU7KYV.js +14 -0
  11. package/dist/safe-bash/chunks/{chunk-7VNF5BFF.js → chunk-B7PIL77G.js} +101 -415
  12. package/dist/safe-bash/chunks/chunk-DQP3VHSB.js +15 -0
  13. package/dist/safe-bash/chunks/{chunk-VQDD3G76.js → chunk-EEEWOYEG.js} +18 -18
  14. package/dist/safe-bash/chunks/chunk-FZE4HW6G.js +11 -0
  15. package/dist/safe-bash/chunks/{chunk-45PK3NWI.js → chunk-GDYNCWRV.js} +1 -1
  16. package/dist/safe-bash/chunks/chunk-GEG3BWGE.js +14 -0
  17. package/dist/safe-bash/chunks/chunk-HBCN24ZA.js +50 -0
  18. package/dist/safe-bash/chunks/chunk-HZ7BWKQ3.js +13 -0
  19. package/dist/safe-bash/chunks/{chunk-ICFDYV64.js → chunk-HZAMGT5I.js} +2 -2
  20. package/dist/safe-bash/chunks/{chunk-FNDNHAGE.js → chunk-JMMEIDPF.js} +2 -2
  21. package/dist/safe-bash/chunks/{chunk-IVRQ4BXL.js → chunk-PH63PLPZ.js} +7 -7
  22. package/dist/safe-bash/chunks/{chunk-SZH7EJLD.js → chunk-PNBBUWSM.js} +5529 -6547
  23. package/dist/safe-bash/chunks/chunk-QGUV42T5.js +44 -0
  24. package/dist/safe-bash/chunks/chunk-R3NAKOED.js +51 -0
  25. package/dist/safe-bash/chunks/chunk-RRR7AQ24.js +38 -0
  26. package/dist/safe-bash/chunks/{chunk-PQRAK7HU.js → chunk-RYFQ3LZG.js} +281 -476
  27. package/dist/safe-bash/chunks/chunk-VBTDHOWC.js +55 -0
  28. package/dist/safe-bash/chunks/{chunk-NR3EM4LS.js → chunk-VKNVHEX3.js} +1 -6
  29. package/dist/safe-bash/chunks/chunk-XAQMU6OY.js +14 -0
  30. package/dist/safe-bash/chunks/chunk-ZVD5IS4V.js +49 -0
  31. package/dist/safe-bash/command-chunks/{chunk-ORYGZYKW.js → chunk-4FEVBOL5.js} +1 -1
  32. package/dist/safe-bash/command-chunks/{chunk-VXSLJH7G.js → chunk-6JSIFWYT.js} +26 -6
  33. package/dist/safe-bash/command-chunks/chunk-A7MU7762.js +200 -0
  34. package/dist/safe-bash/command-chunks/{chunk-KJIMDLBB.js → chunk-BXCXRYVU.js} +1 -1
  35. package/dist/safe-bash/command-chunks/{chunk-F4TEEZTL.js → chunk-CQHP3I66.js} +1 -1
  36. package/dist/safe-bash/command-chunks/{chunk-PEF7K3UQ.js → chunk-EARHPPPJ.js} +1 -1
  37. package/dist/safe-bash/command-chunks/{chunk-QKFSRZGQ.js → chunk-GFC2NTDG.js} +2 -2
  38. package/dist/safe-bash/command-chunks/chunk-GIRNFXP3.js +466 -0
  39. package/dist/safe-bash/command-chunks/{chunk-EFANWIHL.js → chunk-GY3BWK7K.js} +1 -0
  40. package/dist/safe-bash/command-chunks/{chunk-FPVUD6TH.js → chunk-HDCNKOIX.js} +9 -7
  41. package/dist/safe-bash/command-chunks/{chunk-MQFIPHIQ.js → chunk-ILX2NOLF.js} +18 -15
  42. package/dist/safe-bash/command-chunks/{chunk-5E4WAO4O.js → chunk-JD5QNRNO.js} +3 -3
  43. package/dist/safe-bash/command-chunks/{chunk-I237SNW5.js → chunk-LFJJQQND.js} +1 -1
  44. package/dist/safe-bash/command-chunks/{chunk-W5DNF4JH.js → chunk-LOICUCHG.js} +1 -1
  45. package/dist/safe-bash/command-chunks/{chunk-7U7EXOXX.js → chunk-NASVPT6F.js} +2 -1
  46. package/dist/safe-bash/command-chunks/{chunk-WBNZ4PRE.js → chunk-NGG2XL56.js} +7 -4
  47. package/dist/safe-bash/command-chunks/{chunk-GLOZX57Y.js → chunk-NKIELG7Y.js} +45 -115
  48. package/dist/safe-bash/command-chunks/{chunk-WPYIOKE3.js → chunk-PICVQ6B5.js} +2 -2
  49. package/dist/safe-bash/command-chunks/{chunk-YOFC45RK.js → chunk-QVOS4YXL.js} +1 -1
  50. package/dist/safe-bash/command-chunks/{chunk-VGG2DL5Q.js → chunk-TRR4MYWF.js} +4 -0
  51. package/dist/safe-bash/command-chunks/{chunk-2JRBIDAD.js → chunk-V4K2JDYU.js} +2 -2
  52. package/dist/safe-bash/command-chunks/{chunk-CZ7EN3JG.js → chunk-VT6MJBEI.js} +1 -1
  53. package/dist/safe-bash/command-chunks/{chunk-PCEFOYA3.js → chunk-WWIBP2ET.js} +41 -114
  54. package/dist/safe-bash/command-chunks/{chunk-F6OYH562.js → chunk-X54L3DBL.js} +4 -9
  55. package/dist/safe-bash/command-chunks/{chunk-TNOA7FCQ.js → chunk-YVNGTIJO.js} +1 -1
  56. package/dist/safe-bash/command-chunks/chunk-ZDN7MJE6.js +168 -0
  57. package/dist/safe-bash/commands/apply-patch/index.browser.js +14 -0
  58. package/dist/safe-bash/commands/archive/index.browser.js +36 -0
  59. package/dist/safe-bash/commands/bytes/compression/index.js +54 -51
  60. package/dist/safe-bash/commands/chmod/index.browser.js +14 -0
  61. package/dist/safe-bash/commands/chmod/index.d.ts +2 -0
  62. package/dist/safe-bash/commands/chmod/index.js +2 -0
  63. package/dist/safe-bash/commands/column/index.browser.js +12 -0
  64. package/dist/safe-bash/commands/du/index.browser.js +14 -0
  65. package/dist/safe-bash/commands/expr/index.browser.js +12 -0
  66. package/dist/safe-bash/commands/file/index.browser.js +14 -0
  67. package/dist/safe-bash/commands/filesystem.js +9 -2
  68. package/dist/safe-bash/commands/grep-aliases/index.browser.js +14 -0
  69. package/dist/safe-bash/commands/html-to-markdown/index.browser.js +16 -0
  70. package/dist/safe-bash/commands/metadata/chmod.d.ts +1 -7
  71. package/dist/safe-bash/commands/metadata/chmod.js +1 -204
  72. package/dist/safe-bash/commands/metadata/index.browser.js +17 -0
  73. package/dist/safe-bash/commands/metadata/internal.d.ts +1 -30
  74. package/dist/safe-bash/commands/metadata/internal.js +1 -76
  75. package/dist/safe-bash/commands/metadata/mktemp.d.ts +1 -3
  76. package/dist/safe-bash/commands/metadata/mktemp.js +1 -202
  77. package/dist/safe-bash/commands/metadata/stat.d.ts +1 -7
  78. package/dist/safe-bash/commands/metadata/stat.js +1 -530
  79. package/dist/safe-bash/commands/mktemp/index.browser.js +13 -0
  80. package/dist/safe-bash/commands/mktemp/index.d.ts +2 -0
  81. package/dist/safe-bash/commands/mktemp/index.js +2 -0
  82. package/dist/safe-bash/commands/network/index.browser.js +1 -1
  83. package/dist/safe-bash/commands/node/index.browser.js +4 -4
  84. package/dist/safe-bash/commands/portable-random.d.ts +1 -1
  85. package/dist/safe-bash/commands/portable-random.js +1 -12
  86. package/dist/safe-bash/commands/python/index.browser.js +8 -8
  87. package/dist/safe-bash/commands/regex-execution/public.browser.js +5 -3
  88. package/dist/safe-bash/commands/split/index.browser.js +14 -0
  89. package/dist/safe-bash/commands/stat/index.browser.js +13 -0
  90. package/dist/safe-bash/commands/stat/index.d.ts +2 -0
  91. package/dist/safe-bash/commands/stat/index.js +2 -0
  92. package/dist/safe-bash/commands/stream-format/index.browser.js +11 -0
  93. package/dist/safe-bash/commands/stream-inspection/index.browser.js +11 -0
  94. package/dist/safe-bash/commands/streams.js +5 -5
  95. package/dist/safe-bash/commands/table-text/index.browser.js +11 -0
  96. package/dist/safe-bash/commands/text.js +48 -143
  97. package/dist/safe-bash/commands/time-env/index.browser.js +15 -0
  98. package/dist/safe-bash/commands/tree/index.browser.js +14 -0
  99. package/dist/safe-bash/full-core.browser.js +256 -247
  100. package/dist/safe-bash/opt-in/commands/yq/native-work.js +1 -0
  101. package/dist/safe-bash/optional-host.browser.js +12 -12
  102. package/dist/safe-bash/plugins/index.browser.js +25 -11
  103. package/dist/safe-bash/registry-entry.browser.js +28 -14
  104. package/dist/safe-bash/search.browser.js +48 -0
  105. package/dist/safe-bash/shell/runtime.d.ts +3 -9
  106. package/dist/safe-bash/shell/runtime.js +63 -311
  107. package/dist/safe-bash/shell/shell.js +0 -23
  108. package/dist/safe-bash/shell/types.d.ts +2 -0
  109. package/dist/safe-bash/shell/worker-limits.js +1 -0
  110. package/dist/safe-bash/shell-entry.browser.js +19 -10
  111. package/dist/safe-bash/worker/host.js +1 -1
  112. package/dist/safe-bash-command-bc/index.js +12 -5
  113. package/dist/safe-bash-command-bzip2/index.js +4 -3
  114. package/dist/safe-bash-command-chmod/LICENSE +21 -0
  115. package/dist/safe-bash-command-chmod/command.d.ts +7 -0
  116. package/dist/safe-bash-command-chmod/command.js +11 -0
  117. package/dist/safe-bash-command-chmod/index.d.ts +6 -0
  118. package/dist/safe-bash-command-chmod/index.js +27 -0
  119. package/dist/safe-bash-command-exiftool/index.js +5 -5
  120. package/dist/safe-bash-command-find/find.js +1 -1
  121. package/dist/safe-bash-command-find/index.js +1 -1
  122. package/dist/safe-bash-command-fmt/index.js +9 -2
  123. package/dist/safe-bash-command-gzip/index.js +45 -42
  124. package/dist/safe-bash-command-imagemagick/index.js +3 -1
  125. package/dist/safe-bash-command-jq/index.js +1 -1
  126. package/dist/safe-bash-command-jq/jq.js +1 -1
  127. package/dist/safe-bash-command-less/index.js +12 -3
  128. package/dist/safe-bash-command-mktemp/LICENSE +21 -0
  129. package/dist/safe-bash-command-mktemp/command.d.ts +3 -0
  130. package/dist/safe-bash-command-mktemp/command.js +9 -0
  131. package/dist/safe-bash-command-mktemp/index.d.ts +6 -0
  132. package/dist/safe-bash-command-mktemp/index.js +25 -0
  133. package/dist/safe-bash-command-nl/index.js +1 -1
  134. package/dist/safe-bash-command-nl/nl.js +1 -1
  135. package/dist/safe-bash-command-od/index.js +6 -2
  136. package/dist/safe-bash-command-op/index.js +25 -6
  137. package/dist/safe-bash-command-rg/index.js +1 -1
  138. package/dist/safe-bash-command-rg/rg-command.d.ts +0 -1
  139. package/dist/safe-bash-command-rg/rg-command.js +3 -5
  140. package/dist/safe-bash-command-sed/index.js +1 -1
  141. package/dist/safe-bash-command-sed/sed.js +1 -1
  142. package/dist/safe-bash-command-sips/index.js +13 -5
  143. package/dist/safe-bash-command-sponge/index.js +10 -3
  144. package/dist/safe-bash-command-stat/LICENSE +21 -0
  145. package/dist/safe-bash-command-stat/command.d.ts +7 -0
  146. package/dist/safe-bash-command-stat/command.js +9 -0
  147. package/dist/safe-bash-command-stat/index.d.ts +6 -0
  148. package/dist/safe-bash-command-stat/index.js +25 -0
  149. package/dist/safe-bash-command-unexpand/index.js +1 -1
  150. package/dist/safe-bash-command-unexpand/unexpand.js +1 -1
  151. package/dist/safe-bash-command-unrtf/index.js +11 -1
  152. package/dist/safe-bash-command-xxd/index.js +6 -2
  153. package/dist/safe-bash-command-xz/command.d.ts +1 -1
  154. package/dist/safe-bash-command-xz/index.js +3 -2
  155. package/dist/safe-bash-command-yq/index.js +1 -0
  156. package/dist/safe-bash-command-yq/native-work.js +1 -0
  157. package/dist/safe-bash-command-yq/query.js +3 -0
  158. package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
  159. package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
  160. package/dist/safe-bash-compression-engine/files.js +6 -6
  161. package/dist/safe-bash-compression-engine/index.js +5 -5
  162. package/dist/safe-bash-compression-engine/operand.js +6 -6
  163. package/dist/safe-bash-compression-engine/options.js +1 -1
  164. package/dist/safe-bash-compression-engine/stream.js +5 -5
  165. package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
  166. package/dist/safe-bash-contracts/escaping.js +2 -2
  167. package/dist/safe-bash-contracts/filesystem-output.js +2 -2
  168. package/dist/safe-bash-contracts/index.js +2 -2
  169. package/dist/safe-bash-contracts/io.d.ts +2 -0
  170. package/dist/safe-bash-contracts/io.js +1 -1
  171. package/dist/safe-bash-contracts/output.js +2 -2
  172. package/dist/safe-bash-io-engine/commands/search/requirements.js +1 -1
  173. package/dist/safe-bash-io-engine/commands/text-programs/shared.js +1 -1
  174. package/dist/safe-bash-mcp/index.browser.js +11 -1
  175. package/dist/safe-bash-mcp/index.js +38 -17
  176. package/dist/safe-bash-metadata-engine/LICENSE +21 -0
  177. package/dist/safe-bash-metadata-engine/index.d.ts +30 -0
  178. package/dist/safe-bash-metadata-engine/index.js +82 -0
  179. package/dist/safe-bash-metadata-engine/random.d.ts +1 -0
  180. package/dist/safe-bash-metadata-engine/random.js +21 -0
  181. package/dist/safe-bash-regex-engine/index.js +4 -4
  182. package/dist/safe-bash-regex-engine/text/budget.d.ts +0 -1
  183. package/dist/safe-bash-regex-engine/text/budget.js +1 -1
  184. package/dist/safe-bash-regex-engine/text/regex.js +4 -4
  185. package/dist/safe-bash-regex-engine/text/replacement-buffer.js +2 -2
  186. package/dist/safe-bash-regex-engine/text/rust-syntax.js +2 -2
  187. package/dist/safe-bash-search-engine/ergonomic-regex.js +2 -2
  188. package/dist/safe-bash-search-engine/glob.js +2 -2
  189. package/dist/safe-bash-search-engine/grep.js +2 -2
  190. package/dist/safe-bash-search-engine/matcher.js +2 -2
  191. package/dist/safe-bash-search-engine/options.d.ts +2 -0
  192. package/dist/safe-bash-search-engine/options.js +1 -1
  193. package/dist/safe-bash-search-engine/output.js +1 -1
  194. package/dist/safe-bash-search-engine/shared.js +2 -2
  195. package/dist/safe-bash-search-engine/walk.js +3 -3
  196. package/dist/safe-playwright-cloudflare/browser-snapshot-json.js +2 -2
  197. package/dist/safe-playwright-cloudflare/browser-snapshot-references.js +1 -1
  198. package/package.json +91 -10
@@ -1,3 +1,6 @@
1
+ import {
2
+ jobsExtension
3
+ } from "./chunk-A7XEHALN.js";
1
4
  import {
2
5
  evalSyncYqPrep,
3
6
  formatSyncYqYamlLines
@@ -7,6 +10,16 @@ import {
7
10
  defaultPortableTrapExtension,
8
11
  isIdlePortableTrapInstance
9
12
  } from "./chunk-3NDIFSNM.js";
13
+ import {
14
+ EreLedger,
15
+ EreProfileLimitError,
16
+ EreSyntaxError,
17
+ EreUnsupportedError,
18
+ compileEre,
19
+ matchEre,
20
+ tryCompileEreSync,
21
+ tryMatchEreSync
22
+ } from "./chunk-6O77NL2S.js";
10
23
  import {
11
24
  abortManagedController,
12
25
  addAbortSignalWaiter,
@@ -24,40 +37,28 @@ import {
24
37
  evalSyncChecksum,
25
38
  evalSyncCmp,
26
39
  evalSyncCompression,
27
- evalSyncDate,
28
40
  evalSyncDf,
29
41
  evalSyncDiff,
30
- evalSyncDu,
31
42
  evalSyncEnv,
32
43
  evalSyncFd,
33
- evalSyncFile,
34
44
  evalSyncFind,
35
- evalSyncHtmlToMarkdown,
36
45
  evalSyncLess,
37
46
  evalSyncLs,
38
47
  evalSyncPathchk,
39
- evalSyncPrintenv,
40
48
  evalSyncReadlink,
41
49
  evalSyncRealpath,
42
- evalSyncStat,
43
- evalSyncTar,
44
- evalSyncTree,
45
- evalSyncUnzip,
46
50
  evalSyncWhich,
47
51
  evalSyncXargs,
48
- evalSyncZip,
49
52
  evaluateFilePredicate,
50
53
  executionCommands,
51
54
  extractFastPrintfSpecifiers,
52
55
  formatPrintf,
53
56
  getRuntimeBackingFileSystem,
54
- gnuInformationSync,
55
57
  interruptible,
56
58
  isManagedAbortSignal,
57
59
  isSyncResolved,
58
60
  openFileOutput,
59
61
  parseFmtArguments,
60
- preverifyMemoryRgTree,
61
62
  printfCommand,
62
63
  registerManagedAbortSignal,
63
64
  removeAbortSignalWaiter,
@@ -66,7 +67,13 @@ import {
66
67
  tryFastPrintf,
67
68
  variablePresence,
68
69
  wcDisplayWidth
69
- } from "./chunk-SZH7EJLD.js";
70
+ } from "./chunk-PNBBUWSM.js";
71
+ import {
72
+ evalSyncMdq
73
+ } from "./chunk-OV6IHKO6.js";
74
+ import {
75
+ evalSyncPr
76
+ } from "./chunk-CHYGPFVM.js";
70
77
  import {
71
78
  evalSyncGetopt
72
79
  } from "./chunk-AUSNDQTJ.js";
@@ -76,9 +83,6 @@ import {
76
83
  import {
77
84
  evalSyncLineEndings
78
85
  } from "./chunk-3R3AANOR.js";
79
- import {
80
- evalSyncMdq
81
- } from "./chunk-OV6IHKO6.js";
82
86
  import {
83
87
  evalSyncXmllint,
84
88
  evalSyncXq
@@ -87,29 +91,13 @@ import {
87
91
  PublicDiagnostic,
88
92
  publicDiagnosticMessage,
89
93
  writeDiagnostic
90
- } from "./chunk-IVRQ4BXL.js";
94
+ } from "./chunk-PH63PLPZ.js";
91
95
  import {
92
96
  bytesToHex,
93
97
  compareUtf8,
94
98
  latin1Bytes,
95
99
  latin1Text
96
100
  } from "./chunk-D3ANYGMC.js";
97
- import {
98
- evalSyncPr
99
- } from "./chunk-CHYGPFVM.js";
100
- import {
101
- EreLedger,
102
- EreProfileLimitError,
103
- EreSyntaxError,
104
- EreUnsupportedError,
105
- compileEre,
106
- matchEre,
107
- tryCompileEreSync,
108
- tryMatchEreSync
109
- } from "./chunk-6O77NL2S.js";
110
- import {
111
- jobsExtension
112
- } from "./chunk-A7XEHALN.js";
113
101
  import {
114
102
  concatShellValues,
115
103
  shellValueByteLength,
@@ -139,7 +127,7 @@ import {
139
127
  runYieldCheckpoint,
140
128
  scheduleTurn,
141
129
  yieldTurn
142
- } from "./chunk-NZQXYWA3.js";
130
+ } from "./chunk-5OHX7C2V.js";
143
131
  import {
144
132
  createBytePipe,
145
133
  outputFailure,
@@ -155,6 +143,30 @@ import {
155
143
  getCommandArguments,
156
144
  validateExitCode
157
145
  } from "./chunk-7R5BDCG7.js";
146
+ import {
147
+ evalSyncTree
148
+ } from "./chunk-55YJASTN.js";
149
+ import {
150
+ evalSyncFile
151
+ } from "./chunk-4BSJLKNM.js";
152
+ import {
153
+ evalSyncHtmlToMarkdown
154
+ } from "./chunk-DQP3VHSB.js";
155
+ import {
156
+ evalSyncDu
157
+ } from "./chunk-GEG3BWGE.js";
158
+ import {
159
+ evalSyncStat
160
+ } from "./chunk-VBTDHOWC.js";
161
+ import {
162
+ evalSyncTar,
163
+ evalSyncUnzip,
164
+ evalSyncZip
165
+ } from "./chunk-QGUV42T5.js";
166
+ import {
167
+ evalSyncDate,
168
+ evalSyncPrintenv
169
+ } from "./chunk-ZVD5IS4V.js";
158
170
  import {
159
171
  RESOLVED_EXIT_ONE,
160
172
  RESOLVED_EXIT_ZERO,
@@ -9415,6 +9427,12 @@ import { createBaseCommand, evalSyncBase32 } from "../../safe-bash-base-encoding
9415
9427
 
9416
9428
  // packages/safe-bash/src/shell/runtime.ts
9417
9429
  import { evalSyncShuf } from "../../safe-bash-command-shuf/index.js";
9430
+
9431
+ // packages/safe-bash/src/commands/gnu-information.ts
9432
+ init_platform();
9433
+ import { gnuInformation, gnuInformationSync } from "../../safe-bash-io-engine/gnu-information.js";
9434
+
9435
+ // packages/safe-bash/src/shell/runtime.ts
9418
9436
  import { evalSyncDd } from "../../safe-bash-command-dd/index.js";
9419
9437
  import { evalSyncXan } from "../../safe-bash-command-xan/index.js";
9420
9438
 
@@ -13427,6 +13445,7 @@ var defaultLimits = {
13427
13445
  maxPathnameComponents: Infinity,
13428
13446
  maxRedirects: Infinity,
13429
13447
  maxPipelineStages: Infinity,
13448
+ maxPipelineBytes: Infinity,
13430
13449
  maxLoopIterations: Infinity,
13431
13450
  maxSubstitutionDepth: Infinity,
13432
13451
  maxFunctionDepth: Infinity,
@@ -13747,6 +13766,7 @@ function tickSharedWallClockBudgets() {
13747
13766
  }
13748
13767
  }
13749
13768
  var Budget2 = class {
13769
+ pipelineBytes = 0;
13750
13770
  get fileSystemOperations() {
13751
13771
  return this._fileSystemOperations;
13752
13772
  }
@@ -13781,7 +13801,7 @@ var Budget2 = class {
13781
13801
  if (limits.maxRedirects < 1) this.canRedirect1 = false;
13782
13802
  if (limits.maxSourceBytes < 1073741823) this.maxSourceBytesSmi = limits.maxSourceBytes | 0;
13783
13803
  if (limits.maxPipelineStages < 1073741823) this.maxPipelineStagesSmi = limits.maxPipelineStages | 0;
13784
- if (limits.pipeHighWaterMark < 65536) this.canSyncPurePipe = false;
13804
+ if (limits.pipeHighWaterMark < 65536 || limits.maxPipelineBytes !== Infinity) this.canSyncPurePipe = false;
13785
13805
  this.signal = signal ? combineManagedSignals2(signal, this.controller.signal) : this.controller.signal;
13786
13806
  if (signal) inheritYieldCheckpoint(signal, this.signal);
13787
13807
  this.parsing = new ParseBudget(limits.maxParseUnits === Infinity ? void 0 : limits.maxParseUnits, this.signal, this, limits.maxSyntaxDepth);
@@ -13920,6 +13940,14 @@ var Budget2 = class {
13920
13940
  set fsOperations(value) {
13921
13941
  this._fileSystemOperations = value;
13922
13942
  }
13943
+ pipelineInput = (bytes) => {
13944
+ if (this.limits.maxPipelineBytes === Infinity) return;
13945
+ this.assertPipelineInput(bytes);
13946
+ this.pipelineBytes += bytes;
13947
+ };
13948
+ assertPipelineInput(bytes) {
13949
+ if (bytes > this.limits.maxPipelineBytes - this.pipelineBytes) this.fail("maxPipelineBytes");
13950
+ }
13923
13951
  reservePipelineStages(count) {
13924
13952
  this.signal.throwIfAborted();
13925
13953
  if (count > this.limits.maxPipelineStages - this._pipelineStages) this.fail("maxPipelineStages");
@@ -14716,6 +14744,7 @@ var BudgetedPipeStageSink = class {
14716
14744
  return Boolean(w.open && pipe && !pipe.failed && !pipe.signal?.aborted && pipe.readerReferences && (!pipe.writes || pipe.writes.size === 0) && (pipe.availableBytes ?? 0) < (pipe.highWaterMark ?? 0));
14717
14745
  }
14718
14746
  writeSync(chunk) {
14747
+ this.budget.assertPipelineInput(chunk.byteLength);
14719
14748
  this.budget.bytes += chunk.byteLength;
14720
14749
  this.writable.write(chunk);
14721
14750
  if (chunk.byteLength && this.written) this.written.add(this.index);
@@ -19991,260 +20020,6 @@ var Runtime = class _Runtime {
19991
20020
  }
19992
20021
  }
19993
20022
  }
19994
- tryRunFastConstEchoBatch(entryCachedUnit, sourceLength, state, io) {
19995
- if (state.noexec) return void 0;
19996
- let leadingMkdirUnit;
19997
- let leadingMkdirPaths;
19998
- let firstCachedUnit = entryCachedUnit;
19999
- let firstCc = firstCachedUnit.unit.script._fastConstEcho;
20000
- if (!firstCc) {
20001
- const nextU = entryCachedUnit.nextCached;
20002
- if (!nextU || entryCachedUnit.locale !== false || nextU.locale !== false || entryCachedUnit.unit.script.warnings && entryCachedUnit.unit.script.warnings.length > 0) return void 0;
20003
- firstCc = nextU.unit.script._fastConstEcho;
20004
- if (!firstCc) return void 0;
20005
- const mScript = entryCachedUnit.unit.script;
20006
- let mPaths = mScript._cachedMkdirPPaths;
20007
- if (mPaths === void 0) {
20008
- mPaths = null;
20009
- if (mScript.lists.length === 1 && !mScript.lists[0].terminator && mScript.lists[0].pipelines.length === 1 && !mScript.lists[0].pipelines[0].negate && mScript.lists[0].pipelines[0].commands.length === 1) {
20010
- const mCmd = mScript.lists[0].pipelines[0].commands[0];
20011
- if (mCmd.kind === "simple" && mCmd.redirects.length === 0 && mCmd.words.length >= 3 && mCmd.words[0].plain === "mkdir" && mCmd.words[1].plain === "-p") {
20012
- const arr = [];
20013
- let ok = true;
20014
- for (let wi = 2; wi < mCmd.words.length; wi++) {
20015
- const wp = mCmd.words[wi].plain;
20016
- if (!wp || !isCleanAbsolutePath(wp) || wp === "/" || wp === "/dev" || wp.startsWith("/dev/")) {
20017
- ok = false;
20018
- break;
20019
- }
20020
- arr.push(wp);
20021
- }
20022
- if (ok) mPaths = arr;
20023
- }
20024
- }
20025
- mScript._cachedMkdirPPaths = mPaths;
20026
- }
20027
- if (!mPaths) return void 0;
20028
- leadingMkdirUnit = entryCachedUnit;
20029
- leadingMkdirPaths = mPaths;
20030
- firstCachedUnit = nextU;
20031
- }
20032
- if (this.middleware.length > 0 || io.terminal !== void 0 || io.asyncDefaultInput !== void 0 || io.admittedHandles !== void 0 || this._fileWrites !== void 0 && this._fileWrites.size > 0 || !this._isMemoryBackingFs || !this.backingFs || !this.budget.canRedirect1 || !this.budget.hasInfiniteFsOps || io.descriptors && (io.descriptors.size > 3 || io.descriptors.get(0)?.closed || io.descriptors.get(1)?.closed || io.descriptors.get(2)?.closed)) {
20033
- return void 0;
20034
- }
20035
- const monitor = ensureStateMonitor(state, this.budget, io[invocationScope]);
20036
- const rawState = monitor.raw;
20037
- if (!this.tryStartExtensionsSync(state) || hasActiveExtensions(rawState) || rawState.externalInvocation || hasActiveVariableAttributes(rawState) || guestArrays(state) || rawState.noclobber || rawState.readonlyVariables?.has("PIPESTATUS") || hasShellFunction(rawState, "echo") || rawState.extensions?.builtins.has("echo")) {
20038
- return void 0;
20039
- }
20040
- const def = this.commands.get("echo");
20041
- if (!def || !defaultEchoExecutors.has(def.execute)) return void 0;
20042
- const store = monitor.store;
20043
- const existing = store?.get("PIPESTATUS");
20044
- const psTarget = existing ? "indexed" : pipelineStatusTarget(rawState);
20045
- if (psTarget !== "indexed" && psTarget !== "absent" || store?.watches.has("PIPESTATUS") || monitor.hasOverlay("PIPESTATUS")) return void 0;
20046
- if (existing && (existing.associative || existing.values.size !== 1 || existing.maximum !== 0)) return void 0;
20047
- const elem0 = existing?.values.get(0);
20048
- if (existing && (!elem0 || elem0.text.bytes !== 1 || existing.references !== 1 || elem0.text.references !== 1)) return void 0;
20049
- const byteLength0 = firstCc.encoded.byteLength;
20050
- if (this.budget.bytes + byteLength0 > this.budget.maxOutputBytesSmi && byteLength0 > this.budget.limits.maxOutputBytes - this.budget.bytes || !this.budget.canFileSystemOperation() || this.budget.commands + 1 > this.budget.maxCommandsSmi && this.budget.commands + 1 > this.budget.limits.maxCommands) {
20051
- return void 0;
20052
- }
20053
- const umask = rawState.umask ?? 18;
20054
- if (leadingMkdirUnit !== void 0 && leadingMkdirPaths !== void 0) {
20055
- if ((umask & 192) !== 0 || this._outputFiles !== void 0 && this._outputFiles.size > 0 || hasShellFunction(rawState, "mkdir") || rawState.extensions?.builtins.has("mkdir")) return void 0;
20056
- const mkdirDef = this.commands.get("mkdir");
20057
- if (!mkdirDef || !defaultMkdirExecutors.has(mkdirDef.execute)) return void 0;
20058
- const dirMode = 511 & ~umask;
20059
- try {
20060
- for (let mi = 0; mi < leadingMkdirPaths.length; mi++) {
20061
- const mp = leadingMkdirPaths[mi];
20062
- if (!tryMkdirMemorySync(this.backingFs, mp, true, dirMode, this.commandSignal, firstCc.dirPrefix.startsWith(mp) && firstCc.dirPrefix.length === mp.length + 1 ? firstCc.dirPrefix : void 0)) return void 0;
20063
- this.budget.fileSystemOperation();
20064
- }
20065
- } catch {
20066
- this.signal.throwIfAborted();
20067
- return void 0;
20068
- }
20069
- this.budget.commands++;
20070
- this.budget.parsing.admit(firstCachedUnit.unitsCharged);
20071
- }
20072
- const mode = 438 & ~umask;
20073
- try {
20074
- if (!tryWriteMemoryFileInDirSync(this.backingFs, firstCc.dirPrefix, firstCc.fileName, firstCc.encoded, firstCc.append, mode, this.commandSignal)) return void 0;
20075
- } catch {
20076
- this.signal.throwIfAborted();
20077
- return void 0;
20078
- }
20079
- this.budget.tick();
20080
- this.budget.fileSystemOperation();
20081
- this.budget.bytes += byteLength0;
20082
- let lastArg = firstCc.arg0;
20083
- let cur = firstCachedUnit;
20084
- const vars = rawState.variables;
20085
- const curLocale = vars.LC_ALL || vars.LC_CTYPE || vars.LANG ? byteLocale(vars) : false;
20086
- const mem = this.backingFs;
20087
- let deadRmTarget;
20088
- let deadRmTargetLen = 0;
20089
- const rmDef = this.commands.get("rm");
20090
- if (mem.symlinkCount === 0 && curLocale === false && rmDef && defaultRmExecutors.has(rmDef.execute) && !hasShellFunction(rawState, "rm") && !rawState.extensions?.builtins.has("rm")) {
20091
- const cachedCc = firstCc;
20092
- let target = cachedCc._cachedRmTarget;
20093
- let scanCount = cachedCc._cachedScanCount ?? 0;
20094
- if (target === void 0) {
20095
- let scan = firstCachedUnit;
20096
- scanCount = 1;
20097
- while (scan.nextCached !== void 0 && scan.nextCached.locale === false && (!scan.nextCached.unit.script.warnings || scan.nextCached.unit.script.warnings.length === 0) && scan.nextCached.unit.script._fastConstEcho !== void 0) {
20098
- scan = scan.nextCached;
20099
- scanCount++;
20100
- }
20101
- target = null;
20102
- const after = scan.nextCached;
20103
- if (after !== void 0 && after.locale === false && (!after.unit.script.warnings || after.unit.script.warnings.length === 0) && after.unit.script.lists.length === 1) {
20104
- const list0 = after.unit.script.lists[0];
20105
- if (!list0.terminator && list0.pipelines.length === 1 && !list0.pipelines[0].negate && list0.pipelines[0].commands.length === 1) {
20106
- const cmd0 = list0.pipelines[0].commands[0];
20107
- if (cmd0.kind === "simple" && cmd0.redirects.length === 0 && cmd0.words.length === 3 && cmd0.words[0].plain === "rm" && (cmd0.words[1].plain === "-rf" || cmd0.words[1].plain === "-fr")) {
20108
- const t = cmd0.words[2].plain;
20109
- if (t && t.length > 1 && t.charCodeAt(0) === 47 && t.charCodeAt(t.length - 1) !== 47 && !t.includes("/.")) target = t;
20110
- }
20111
- }
20112
- }
20113
- cachedCc._cachedRmTarget = target;
20114
- cachedCc._cachedScanCount = scanCount;
20115
- }
20116
- if (target !== null && this.budget.commands + scanCount + 1 <= this.budget.maxCommandsSmi && tryGetMemoryDirectoryEntryNamesSync(this.backingFs, target)?.size === 0) {
20117
- deadRmTarget = target;
20118
- deadRmTargetLen = target.length;
20119
- }
20120
- }
20121
- const cachedBatchPlan = deadRmTarget !== void 0 ? firstCc._cachedEchoBatch : void 0;
20122
- if (cachedBatchPlan !== void 0 && cachedBatchPlan !== null && mem.symlinkCount === 0 && !this.signal.aborted && this.budget.bytes + cachedBatchPlan.totalBytes <= this.budget.maxOutputBytesSmi && this.budget._fileSystemOperations + cachedBatchPlan.totalCount <= this.budget.maxFileSystemOperationsSmi && this.budget.commands + cachedBatchPlan.totalCount <= this.budget.maxCommandsSmi) {
20123
- this.budget.parsing.admit(cachedBatchPlan.totalUnitsCharged);
20124
- try {
20125
- mem.writeMemoryFilesInDirBatchFast(firstCc.fileName, firstCc.dirPrefix, cachedBatchPlan.fileNames, cachedBatchPlan.nameHashes, cachedBatchPlan.payloads, cachedBatchPlan.totalNameBytes, cachedBatchPlan.payloadBytesSum, mode);
20126
- this.budget.commands += cachedBatchPlan.totalCount;
20127
- this.budget._fileSystemOperations += cachedBatchPlan.totalCount;
20128
- this.budget.bytes += cachedBatchPlan.totalBytes;
20129
- lastArg = cachedBatchPlan.lastArg;
20130
- cur = cachedBatchPlan.endUnit;
20131
- } catch {
20132
- this.signal.throwIfAborted();
20133
- }
20134
- }
20135
- if (cur !== cachedBatchPlan?.endUnit && cur.unit.next < sourceLength && mem.symlinkCount === 0 && !this.signal.aborted) {
20136
- const buildBatchStart = cur === firstCachedUnit && deadRmTarget !== void 0 && cachedBatchPlan === void 0;
20137
- let bTotalCount = 0;
20138
- let bTotalBytes = 0;
20139
- let bTotalUnits = 0;
20140
- let bTotalNameBytes = 0;
20141
- let bPayloadBytesSum = 0;
20142
- let bCanCache = buildBatchStart && !firstCc.append;
20143
- const bFileNames = bCanCache ? [] : void 0;
20144
- const bHashes = bCanCache ? [] : void 0;
20145
- const bPayloads = bCanCache ? [] : void 0;
20146
- const bSeenNames = bCanCache ? /* @__PURE__ */ new Set([firstCc.fileName]) : void 0;
20147
- while (cur.unit.next < sourceLength && mem.symlinkCount === 0 && !this.signal.aborted) {
20148
- const next = cur.nextCached;
20149
- if (!next || next.locale !== curLocale || next.unit.script.warnings && next.unit.script.warnings.length > 0) break;
20150
- const nextCc = next.unit.script._fastConstEcho;
20151
- if (!nextCc) break;
20152
- const bLen = nextCc.encoded.byteLength;
20153
- if (this.budget.bytes + bLen > this.budget.maxOutputBytesSmi || this.budget._fileSystemOperations + 1 > this.budget.maxFileSystemOperationsSmi || this.budget.commands + 1 > this.budget.maxCommandsSmi) {
20154
- break;
20155
- }
20156
- this.budget.parsing.admit(next.unitsCharged);
20157
- if (!(deadRmTarget !== void 0 && nextCc.dirPrefix.length === deadRmTargetLen + 1 && nextCc.dirPrefix.charCodeAt(deadRmTargetLen) === 47 && nextCc.dirPrefix.startsWith(deadRmTarget))) {
20158
- let nameHash = nextCc._nameHash;
20159
- if (nameHash === void 0) {
20160
- const fn = nextCc.fileName;
20161
- let h = 5381;
20162
- for (let ci = 0; ci < fn.length; ci++) h = ((h & 2097151) * 33 ^ fn.charCodeAt(ci)) & 1073741823;
20163
- nextCc._nameHash = nameHash = h;
20164
- }
20165
- try {
20166
- mem.writeMemoryFileInDirFast(nextCc.dirPrefix, nextCc.fileName, nextCc.encoded, nextCc.append, mode, nameHash);
20167
- } catch {
20168
- this.signal.throwIfAborted();
20169
- break;
20170
- }
20171
- }
20172
- if (bCanCache) {
20173
- const isDeadRm = deadRmTarget !== void 0 && nextCc.dirPrefix.length === deadRmTargetLen + 1 && nextCc.dirPrefix.charCodeAt(deadRmTargetLen) === 47 && nextCc.dirPrefix.startsWith(deadRmTarget);
20174
- if (isDeadRm) {
20175
- bTotalCount++;
20176
- bTotalBytes += bLen;
20177
- bTotalUnits += next.unitsCharged;
20178
- } else if (!nextCc.append && nextCc.dirPrefix === firstCc.dirPrefix && nextCc.fileName.length <= 85 && !bSeenNames.has(nextCc.fileName)) {
20179
- bSeenNames.add(nextCc.fileName);
20180
- bFileNames.push(nextCc.fileName);
20181
- bHashes.push(nextCc._nameHash);
20182
- bPayloads.push(nextCc.encoded);
20183
- bTotalNameBytes += nextCc.fileName.length * 2;
20184
- bPayloadBytesSum += bLen;
20185
- bTotalCount++;
20186
- bTotalBytes += bLen;
20187
- bTotalUnits += next.unitsCharged;
20188
- } else bCanCache = false;
20189
- }
20190
- this.budget.commands++;
20191
- this.budget._fileSystemOperations++;
20192
- this.budget.bytes += bLen;
20193
- lastArg = nextCc.arg0;
20194
- cur = next;
20195
- }
20196
- if (buildBatchStart) {
20197
- firstCc._cachedEchoBatch = bCanCache && bTotalCount > 0 ? {
20198
- endUnit: cur,
20199
- totalCount: bTotalCount,
20200
- totalBytes: bTotalBytes,
20201
- totalUnitsCharged: bTotalUnits,
20202
- lastArg,
20203
- fileNames: bFileNames,
20204
- nameHashes: new Int32Array(bHashes),
20205
- payloads: bPayloads,
20206
- totalNameBytes: bTotalNameBytes,
20207
- payloadBytesSum: bPayloadBytesSum
20208
- } : null;
20209
- }
20210
- }
20211
- if (deadRmTarget !== void 0 && cur.nextCached !== void 0 && !this.signal.aborted && mem.symlinkCount === 0 && (this._outputFiles === void 0 || this._outputFiles.size === 0) && !hasShellFunction(rawState, "rm") && !rawState.extensions?.builtins.has("rm")) {
20212
- const rmDef2 = this.commands.get("rm");
20213
- const rmUnit = cur.nextCached;
20214
- const rmCmd0 = rmUnit.unit.script.lists[0]?.pipelines[0]?.commands[0];
20215
- if (rmDef2 && defaultRmExecutors.has(rmDef2.execute) && rmCmd0 && rmCmd0.kind === "simple" && rmCmd0.words[0]?.plain === "rm" && rmCmd0.words[2]?.plain === deadRmTarget) {
20216
- let rmOk = false;
20217
- try {
20218
- rmOk = tryRmRfMemorySync(this.backingFs, deadRmTarget, this.commandSignal);
20219
- } catch {
20220
- this.signal.throwIfAborted();
20221
- }
20222
- if (rmOk) {
20223
- this.budget.parsing.admit(rmUnit.unitsCharged);
20224
- this.budget.commands++;
20225
- this.budget._fileSystemOperations++;
20226
- lastArg = deadRmTarget;
20227
- cur = rmUnit;
20228
- }
20229
- }
20230
- }
20231
- const restEpoch = monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets).epoch;
20232
- rawState.substitutionStatus = 0;
20233
- if (rawState.variables._ !== void 0) delete rawState.variables._;
20234
- rawState.lastArgument = lastArg;
20235
- if (io.assignmentDiagnosticContext) io.assignmentDiagnosticContext.name = void 0;
20236
- if (!existing) {
20237
- monitor.lazyPipeStatus = singleStatusZero;
20238
- monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets);
20239
- } else {
20240
- elem0.text.shellValue = "0";
20241
- store.changed(monitor.chargeInternal(syncPipeStatusCharge, syncPipeStatusTickets), "PIPESTATUS");
20242
- }
20243
- rawState.status = 0;
20244
- monitor.epoch = restEpoch;
20245
- if (store) store.epoch = restEpoch;
20246
- return cur;
20247
- }
20248
20023
  tryRunCachedSyncForScript(script, monitor, io) {
20249
20024
  const rawScript = script;
20250
20025
  let plan = rawScript._cachedSyncForScriptPlan;
@@ -20329,10 +20104,12 @@ var Runtime = class _Runtime {
20329
20104
  rawScript._cachedSyncForScriptPlan = plan;
20330
20105
  }
20331
20106
  const forPlan = plan.forCmd._cachedForPlan;
20107
+ if (plan.echoVar !== void 0 && (!forPlan.touchedIntNamesList.includes(plan.echoVar) || forPlan.touchedIntNamesList.includes("IFS") || rawState.variables.IFS !== void 0 && rawState.variables.IFS !== " \n" || plan.initAssigns.some((assignment) => assignment.name === "IFS"))) return void 0;
20332
20108
  const fastSyncSink = plan.echoVar !== void 0 ? io.stdout instanceof BudgetedSyncSink && io.stdout.write === BudgetedSyncSink.prototype.write || io.stdout instanceof Capture && io.stdout.write === Capture.prototype.write ? io.stdout : void 0 : void 0;
20333
20109
  if (plan.echoVar !== void 0) {
20334
20110
  const def = this.commands.get("echo");
20335
20111
  if (!fastSyncSink || !def || !defaultEchoExecutors.has(def.execute) || hasShellFunction(rawState, "echo") || rawState.extensions?.builtins.has("echo") || io.descriptors && io.descriptors.get(1)?.output !== io.stdout) return void 0;
20112
+ if (this.budget.maxOutputBytesSmi - this.budget.bytes < 12) return void 0;
20336
20113
  }
20337
20114
  const store = monitor.store;
20338
20115
  const existing = store?.get("PIPESTATUS");
@@ -20353,28 +20130,32 @@ var Runtime = class _Runtime {
20353
20130
  const finalValues = /* @__PURE__ */ new Map();
20354
20131
  for (const assignment of plan.initAssigns) finalValues.set(assignment.name, assignment.strVal);
20355
20132
  const regNames = forPlan.regNames;
20356
- for (let r = 1; r < regNames.length; r++) {
20357
- const refName = regNames[r];
20358
- const parsed = fastSafeInt(finalValues.get(refName) ?? rawState.variables[refName], this.budget.parsing);
20359
- if (parsed === void 0) return void 0;
20360
- sharedLoopIntRegs[r] = parsed | 0;
20361
- }
20362
- const { ok } = runIntForLoop(forPlan.fastLoopWords, forPlan.bodyStepCount, forPlan.intSteps, this.budget.parsing);
20363
- if (!ok) return void 0;
20364
- for (let r = 0; r < regNames.length; r++) finalValues.set(regNames[r], intToStr(sharedLoopIntRegs[r]));
20133
+ const savedParseBudget = this.budget.parsing.snapshot();
20134
+ let admitted = false;
20365
20135
  let lastArg = "";
20366
- if (plan.echoVar !== void 0) {
20367
- const echoVal = finalValues.get(plan.echoVar) ?? rawState.variables[plan.echoVar] ?? "";
20368
- const ifs = finalValues.get("IFS") ?? rawState.variables.IFS;
20369
- if (ifs !== void 0 && ifs !== " \n") return void 0;
20370
- if (echoVal.startsWith("-") || echoVal.includes("\0")) return void 0;
20371
- const encoded = encodeRedirectTextWithNewlineToScratch(echoVal);
20372
- if (!encoded) return void 0;
20373
- const bLen = encoded.byteLength;
20374
- if (this.budget.bytes + bLen > this.budget.maxOutputBytesSmi) return void 0;
20375
- if (!fastSyncSink.writeSync(encoded)) return void 0;
20376
- this.budget.bytes += bLen;
20377
- lastArg = echoVal;
20136
+ try {
20137
+ for (let r = 1; r < regNames.length; r++) {
20138
+ const refName = regNames[r];
20139
+ const parsed = fastSafeInt(finalValues.get(refName) ?? rawState.variables[refName], this.budget.parsing);
20140
+ if (parsed === void 0) return void 0;
20141
+ sharedLoopIntRegs[r] = parsed | 0;
20142
+ }
20143
+ const { ok } = runIntForLoop(forPlan.fastLoopWords, forPlan.bodyStepCount, forPlan.intSteps, this.budget.parsing);
20144
+ if (!ok) return void 0;
20145
+ for (const name2 of forPlan.touchedIntNamesList) finalValues.set(name2, intToStr(sharedLoopIntRegs[regNames.indexOf(name2)]));
20146
+ if (plan.echoVar !== void 0) {
20147
+ const echoVal = finalValues.get(plan.echoVar);
20148
+ const encoded = encodeRedirectTextWithNewlineToScratch(echoVal);
20149
+ if (!encoded) return void 0;
20150
+ const bLen = encoded.byteLength;
20151
+ if (this.budget.bytes + bLen > this.budget.maxOutputBytesSmi) return void 0;
20152
+ if (!fastSyncSink.writeSync(encoded)) return void 0;
20153
+ this.budget.bytes += bLen;
20154
+ lastArg = echoVal;
20155
+ }
20156
+ admitted = true;
20157
+ } finally {
20158
+ if (!admitted) this.budget.parsing.restore(savedParseBudget);
20378
20159
  }
20379
20160
  for (const [name2, value] of finalValues) rawState.variables[name2] = value;
20380
20161
  for (const name2 of publishNames) {
@@ -20925,7 +20706,7 @@ var Runtime = class _Runtime {
20925
20706
  const n = pipeline.commands.length;
20926
20707
  this.budget.enterPipelineStages(n);
20927
20708
  this.budget.commands += n;
20928
- const pipeOptions = { highWaterMark: this.budget.limits.pipeHighWaterMark, signal: this.signal };
20709
+ const pipeOptions = { highWaterMark: this.budget.limits.pipeHighWaterMark, signal: this.signal, admitWrite: this.budget.pipelineInput };
20929
20710
  const pipes = new Array(n - 1);
20930
20711
  for (let i = 0; i < n - 1; i++) {
20931
20712
  pipes[i] = createBytePipe(pipeOptions);
@@ -26591,8 +26372,8 @@ var Runtime = class _Runtime {
26591
26372
  this.budget.tick();
26592
26373
  this.budget.iterations += wordCount;
26593
26374
  this.budget.commands += wordCount * forPlan.bodyStepCount;
26594
- for (let r = 0; r < regNames.length; r++) {
26595
- rawState.variables[regNames[r]] = intToStr(sharedLoopIntRegs[r]);
26375
+ for (const name2 of forPlan.touchedIntNamesList) {
26376
+ rawState.variables[name2] = intToStr(sharedLoopIntRegs[regNames.indexOf(name2)]);
26596
26377
  }
26597
26378
  const touchedList = forPlan.touchedIntNamesList;
26598
26379
  for (let t = 0; t < touchedList.length; t++) {
@@ -27752,8 +27533,8 @@ var Runtime = class _Runtime {
27752
27533
  rawState.status = 0;
27753
27534
  }
27754
27535
  runYieldCheckpoint(this.signal);
27755
- for (let r = 0; r < regNames.length; r++) {
27756
- rawState.variables[regNames[r]] = intToStr(sharedLoopIntRegs[r]);
27536
+ for (const name2 of forPlan.touchedIntNamesList) {
27537
+ rawState.variables[name2] = intToStr(sharedLoopIntRegs[regNames.indexOf(name2)]);
27757
27538
  }
27758
27539
  regNames.length = 0;
27759
27540
  }
@@ -29000,7 +28781,8 @@ ${s1}
29000
28781
  }
29001
28782
  for (let index = 1; index < pipeline.commands.length; index++) pipes.push(createBytePipe({
29002
28783
  highWaterMark: this.budget.limits.pipeHighWaterMark,
29003
- signal: this.signal
28784
+ signal: this.signal,
28785
+ admitWrite: this.budget.pipelineInput
29004
28786
  }));
29005
28787
  for (let index = 0; index < pipeline.commands.length; index++) {
29006
28788
  controllers.push(createManagedControlController2());
@@ -43346,6 +43128,8 @@ unsigned int ${ident}_len = ${view.byteLength};
43346
43128
  return true;
43347
43129
  }
43348
43130
  tryFastPureSubstitution(part, state, rawState, io) {
43131
+ if (!cCollation(rawState.variables.LC_ALL || rawState.variables.LC_COLLATE || rawState.variables.LANG || "C")) return void 0;
43132
+ if (this.budget.limits.maxPipelineBytes !== Infinity) return void 0;
43349
43133
  if (this.budget.limits.maxInputBytes !== Infinity) return void 0;
43350
43134
  const cachedInv = this._syncLoopInvariantSubMap?.get(part);
43351
43135
  if (cachedInv !== void 0 && !cachedInv.dynamic) {
@@ -47706,26 +47490,6 @@ var Shell = class _Shell {
47706
47490
  let unit = firstCached.unit;
47707
47491
  let exitCode = 0;
47708
47492
  while (true) {
47709
- if (currentCachedUnit !== void 0 && (unit.script._fastConstEcho !== void 0 || currentCachedUnit.nextCached !== void 0 && currentCachedUnit.nextCached.unit.script._fastConstEcho !== void 0)) {
47710
- const batchEnd = runtime.tryRunFastConstEchoBatch(currentCachedUnit, source.length, currentState, io);
47711
- if (batchEnd !== void 0) {
47712
- currentCachedUnit = batchEnd;
47713
- unit = batchEnd.unit;
47714
- exitCode = 0;
47715
- if (unit.next >= source.length) break;
47716
- budget.signal.throwIfAborted();
47717
- const vars2 = currentState.variables;
47718
- const nextLocale2 = vars2.LC_ALL || vars2.LC_CTYPE || vars2.LANG ? byteLocale(vars2) : false;
47719
- const nextCached2 = currentCachedUnit.locale === nextLocale2 ? currentCachedUnit.nextCached : void 0;
47720
- if (nextCached2 !== void 0 && (!nextCached2.unit.script.warnings || nextCached2.unit.script.warnings.length === 0)) {
47721
- currentCachedUnit = nextCached2;
47722
- budget.parsing.admit(nextCached2.unitsCharged);
47723
- unit = nextCached2.unit;
47724
- continue;
47725
- }
47726
- return this.#continueWarmAsync(source, options, warm, sourceCache, void 0, unit, currentCachedUnit, exitCode);
47727
- }
47728
- }
47729
47493
  if (unit.script.lists.length) {
47730
47494
  const unitResult = runtime.runUnit(unit.script, currentState, io);
47731
47495
  if (unitResult instanceof Promise) {
@@ -48223,7 +47987,6 @@ shell: -c: line ${line}: \`${source.split("\n")[line - 1] ?? ""}'
48223
47987
  stdout.enableScratchBuffer();
48224
47988
  stderr.enableScratchBuffer();
48225
47989
  void runtime.canFastMemoryRedirect;
48226
- preverifyMemoryRgTree(runtime.backingFs);
48227
47990
  this.#warmedInvocation = {
48228
47991
  budget,
48229
47992
  scope,
@@ -48328,82 +48091,6 @@ shell: -c: line ${line}: \`${source.split("\n")[line - 1] ?? ""}'
48328
48091
  }
48329
48092
  };
48330
48093
 
48331
- // packages/safe-bash/src/shell/worker-limits.ts
48332
- init_platform();
48333
- var cloudflareWorkerLimits = Object.freeze({
48334
- maxEnvSplitBytes: 131072,
48335
- maxEnvSplitArguments: 1e4,
48336
- maxEnvSplitExpansions: 32,
48337
- maxEnvSplitWork: 1048576,
48338
- maxDirectoryStackBytes: 4194304,
48339
- maxDirectoryDiagnosticBytes: 65792,
48340
- commandLimits: Object.freeze({ archive: Object.freeze({
48341
- maxArchiveBytes: 4 * 1024 * 1024,
48342
- maxInputMemoryBytes: 8 * 1024 * 1024,
48343
- maxEntryBytes: 4 * 1024 * 1024,
48344
- maxTotalBytes: 8 * 1024 * 1024,
48345
- maxMembers: 1e3,
48346
- maxPathBytes: 4 * 1024,
48347
- maxDepth: 64,
48348
- maxPaxBytes: 64 * 1024,
48349
- maxFilesFromBytes: 256 * 1024,
48350
- maxArgumentBytes: 256 * 1024,
48351
- maxTextBytes: 4 * 1024 * 1024,
48352
- maxDiagnosticBytes: 4 * 1024,
48353
- maxPatternSteps: 1e6,
48354
- maxBufferedFileBytes: 4 * 1024 * 1024,
48355
- chunkSize: 16 * 1024
48356
- }), htmlToMarkdown: Object.freeze({
48357
- maxInputBytes: 4 * 1024 * 1024,
48358
- maxOutputBytes: 4 * 1024 * 1024,
48359
- maxTokenBytes: 64 * 1024,
48360
- maxTokens: 3e4,
48361
- maxNodes: 1e4,
48362
- maxDepth: 64,
48363
- maxAttributes: 64,
48364
- maxTableCells: 1e4,
48365
- maxTableCellBytes: 64 * 1024,
48366
- maxFiles: 64,
48367
- maxArgumentBytes: 256 * 1024,
48368
- maxDiagnosticBytes: 4 * 1024,
48369
- maxWorkUnits: 32 * 1024 * 1024
48370
- }), split: Object.freeze({ maxSuffixLength: 255 }) }),
48371
- maxSyntaxDepth: 64,
48372
- maxAdmittedHandles: 64,
48373
- maxDescriptorOperations: 16,
48374
- maxDescriptorReadBytes: 65536,
48375
- maxCdWork: 8388608,
48376
- maxCdPathBytes: 65536,
48377
- maxCdProbes: 4097,
48378
- maxCdPathComponents: 4096,
48379
- maxDirectoryStackEntries: 4096,
48380
- maxDirectoryStackOutputBytes: 65536,
48381
- maxGlobstarStates: 1e5,
48382
- maxGlobstarDepth: 128,
48383
- maxGlobstarEntries: 1e5,
48384
- maxParseUnits: 65536,
48385
- maxInputBytes: 4 * 1024 * 1024,
48386
- maxOutputBytes: 4 * 1024 * 1024,
48387
- maxCommands: 1e3,
48388
- maxFileSystemOperations: 1e4,
48389
- maxPathComponents: 64,
48390
- maxPathnameComponents: 64,
48391
- maxRedirects: 64,
48392
- maxPipelineStages: 64,
48393
- maxLoopIterations: 1e3,
48394
- maxSubstitutionDepth: 16,
48395
- maxFunctionDepth: 16,
48396
- maxSourceBytes: 256 * 1024,
48397
- maxExpansionFields: 1e3,
48398
- maxExpansionBytes: 4 * 1024 * 1024,
48399
- maxWallClockMs: 1e4,
48400
- maxCpuMs: 1e4,
48401
- pipeHighWaterMark: 16 * 1024
48402
- });
48403
-
48404
- // packages/safe-bash/src/shell/index.ts
48405
- init_platform();
48406
-
48407
48094
  export {
48408
48095
  createMemoryFileSystem,
48409
48096
  defaultMemoryFileSystemLimits,
@@ -48429,6 +48116,5 @@ export {
48429
48116
  createSearchCommands,
48430
48117
  searchCommands,
48431
48118
  evalSyncRg,
48432
- Shell,
48433
- cloudflareWorkerLimits
48119
+ Shell
48434
48120
  };