@poe-platform/safe-bash 0.1.788 → 0.1.790

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 (342) hide show
  1. package/README.md +1 -1
  2. package/dist/image-ast/index.browser.js +147 -80
  3. package/dist/image-ast/index.js +147 -80
  4. package/dist/mp4-ast/mp4.d.ts +2 -0
  5. package/dist/pdf-ast/cos/parser.d.ts +1 -0
  6. package/dist/pdf-ast/cos/security.d.ts +2 -0
  7. package/dist/pdf-ast/cos/writer.d.ts +1 -0
  8. package/dist/pdf-ast/document.d.ts +3 -0
  9. package/dist/pdf-ast/edit/forms.d.ts +1 -0
  10. package/dist/pdf-ast/index.js +171 -82
  11. package/dist/safe-bash/chunks/{chunk-L5QQLNTO.js → chunk-22PI65AH.js} +2 -2
  12. package/dist/safe-bash/chunks/{chunk-Q3E6C3DX.js → chunk-2TAGYMPK.js} +49 -34
  13. package/dist/safe-bash/chunks/{chunk-Z3HX3ZBA.js → chunk-2W4HTMEK.js} +52 -48
  14. package/dist/safe-bash/chunks/{chunk-FFZXP6ZC.js → chunk-3M7L7XU2.js} +2 -2
  15. package/dist/safe-bash/chunks/{chunk-XNODZRVD.js → chunk-3QAO6UYS.js} +2 -2
  16. package/dist/safe-bash/chunks/{chunk-YPETOVQU.js → chunk-3VKFK3NF.js} +2 -2
  17. package/dist/safe-bash/chunks/chunk-5OST7NOX.js +42 -0
  18. package/dist/safe-bash/chunks/{chunk-KEBSX2AX.js → chunk-6HLURHVU.js} +2 -2
  19. package/dist/safe-bash/chunks/chunk-DYEUZE6Z.js +19 -0
  20. package/dist/safe-bash/chunks/{chunk-T2TGCHKE.js → chunk-FM3WBSZT.js} +2 -2
  21. package/dist/safe-bash/chunks/chunk-GAYRKQM6.js +22 -0
  22. package/dist/safe-bash/chunks/{chunk-Q45QCA4J.js → chunk-I3KSESCR.js} +0 -7
  23. package/dist/safe-bash/chunks/{chunk-OSKDIBQS.js → chunk-JLIMK5TD.js} +1 -1
  24. package/dist/safe-bash/chunks/{chunk-2AYZCT5X.js → chunk-JQ2FAJJT.js} +27 -23
  25. package/dist/safe-bash/chunks/{chunk-QA3NVP43.js → chunk-JRE6Z3T7.js} +2 -2
  26. package/dist/safe-bash/chunks/{chunk-DC5EHLKS.js → chunk-NDIL6T7Y.js} +5 -5
  27. package/dist/safe-bash/chunks/{chunk-747G42FY.js → chunk-OPR4UAIT.js} +2 -2
  28. package/dist/safe-bash/chunks/chunk-OSMQCYSP.js +19 -0
  29. package/dist/safe-bash/chunks/chunk-OYB332PQ.js +17 -0
  30. package/dist/safe-bash/chunks/{chunk-ZMYVCRAF.js → chunk-QTIH2AFE.js} +77 -69
  31. package/dist/safe-bash/chunks/{chunk-PYTLIUST.js → chunk-SBESXWT2.js} +43 -44
  32. package/dist/safe-bash/chunks/{chunk-4FDQJUFW.js → chunk-SDEPGTOF.js} +1 -1
  33. package/dist/safe-bash/chunks/chunk-UZU5BIJI.js +32 -0
  34. package/dist/safe-bash/chunks/{chunk-BI6JV62X.js → chunk-VCCMROTL.js} +7 -10
  35. package/dist/safe-bash/chunks/chunk-W47GHRRF.js +13 -0
  36. package/dist/safe-bash/chunks/{chunk-NPMQWZUZ.js → chunk-WS7KZIUM.js} +2 -2
  37. package/dist/safe-bash/chunks/{chunk-3PZYHMGM.js → chunk-YYAERCWS.js} +7 -7
  38. package/dist/safe-bash/chunks/{chunk-5U7JECDB.js → chunk-ZPGVEUKF.js} +8 -7
  39. package/dist/safe-bash/chunks/{csvkit-K55OYAQC.js → csvkit-USUJG62I.js} +65 -11
  40. package/dist/safe-bash/chunks/{ffmpeg-BEFTQ6DZ.js → ffmpeg-KRGG5DLH.js} +21 -10
  41. package/dist/safe-bash/chunks/{gh-HQWOWLWE.js → gh-UCFDUZCX.js} +16 -8
  42. package/dist/safe-bash/chunks/{git-UFNPAOYZ.js → git-LPAF6KDG.js} +7 -9
  43. package/dist/safe-bash/chunks/{imagemagick-53BMHH6D.js → imagemagick-KGREKK4G.js} +38 -7
  44. package/dist/safe-bash/chunks/{implementation-QUTAAYMT.js → implementation-FXDRYS5A.js} +34 -8
  45. package/dist/safe-bash/chunks/{pdfimages-4OYI6FLG.js → pdfimages-UADCF4G4.js} +12 -8
  46. package/dist/safe-bash/chunks/{pdfinfo-I7U6TQPP.js → pdfinfo-O7UWPF4W.js} +38 -13
  47. package/dist/safe-bash/chunks/{pdftk-SUA6FMHI.js → pdftk-AERXIJTN.js} +13 -8
  48. package/dist/safe-bash/chunks/{pdftoppm-4C5DGEWX.js → pdftoppm-L466JQKI.js} +17 -10
  49. package/dist/safe-bash/chunks/{pdftotext-Y4WI225Y.js → pdftotext-SUSI4WXS.js} +19 -9
  50. package/dist/safe-bash/chunks/{qpdf-IORB4RV5.js → qpdf-YL24KVRH.js} +14 -8
  51. package/dist/safe-bash/chunks/{sips-WHAMJFEU.js → sips-QXEQZERX.js} +14 -7
  52. package/dist/safe-bash/chunks/{soffice-SYEK6WJS.js → soffice-TBITRML3.js} +16 -8
  53. package/dist/safe-bash/chunks/{wkhtmltopdf-ZIICWJLF.js → wkhtmltopdf-NJA2THRC.js} +27 -7
  54. package/dist/safe-bash/command-chunks/chunk-2C5BEBPY.js +1388 -0
  55. package/dist/safe-bash/command-chunks/{chunk-FXYWQ6S4.js → chunk-2EXV2ZLV.js} +2 -2
  56. package/dist/safe-bash/command-chunks/{chunk-PFBJR2PY.js → chunk-2KRKKW5S.js} +2 -2
  57. package/dist/safe-bash/command-chunks/{chunk-4DSJDVBM.js → chunk-32F3RBUW.js} +10 -749
  58. package/dist/safe-bash/command-chunks/{chunk-L3MLMXL4.js → chunk-3ZK5F23O.js} +1 -1
  59. package/dist/safe-bash/command-chunks/{chunk-4QX6XCDD.js → chunk-4RNIZ3RT.js} +79 -0
  60. package/dist/safe-bash/command-chunks/{chunk-D7TADAYG.js → chunk-64LG3EVJ.js} +17 -0
  61. package/dist/safe-bash/command-chunks/{chunk-TOSM3T3A.js → chunk-6EASC5EC.js} +20 -9
  62. package/dist/safe-bash/command-chunks/{chunk-ZF3ZVGQC.js → chunk-7JRITHKW.js} +150 -80
  63. package/dist/safe-bash/command-chunks/{chunk-IJ3FXP4Q.js → chunk-A3ZX6SCY.js} +1 -1
  64. package/dist/safe-bash/{chunks/chunk-LD76P7AG.js → command-chunks/chunk-AKDMCNX4.js} +74 -39
  65. package/dist/safe-bash/command-chunks/{chunk-KSIGF4AG.js → chunk-BK4CMEE6.js} +1 -1
  66. package/dist/safe-bash/command-chunks/{chunk-JUDOV5MJ.js → chunk-CBDVLMJB.js} +1 -1
  67. package/dist/safe-bash/command-chunks/{chunk-XGMWWUHV.js → chunk-CZ5DAK4K.js} +1 -1
  68. package/dist/safe-bash/command-chunks/{chunk-Z57TV6TC.js → chunk-EZ2DTOLI.js} +4 -2
  69. package/dist/safe-bash/command-chunks/{chunk-ADCGH6A7.js → chunk-FH3D75FC.js} +1 -1
  70. package/dist/safe-bash/command-chunks/{chunk-WYJTWJZ5.js → chunk-G3G6W5ZE.js} +1 -1
  71. package/dist/safe-bash/command-chunks/{chunk-3HDIDEUJ.js → chunk-GF54KE2M.js} +1 -1
  72. package/dist/safe-bash/command-chunks/chunk-H4LWTITX.js +169 -0
  73. package/dist/safe-bash/command-chunks/chunk-I2MQNBGR.js +145 -0
  74. package/dist/safe-bash/command-chunks/{chunk-Z7TYZG3A.js → chunk-IHHTTQX6.js} +5 -3
  75. package/dist/safe-bash/command-chunks/{chunk-5GRLAARV.js → chunk-IOXI5ZAJ.js} +1 -1
  76. package/dist/safe-bash/command-chunks/{chunk-INDIFLBW.js → chunk-JTAGNROA.js} +4 -0
  77. package/dist/safe-bash/command-chunks/{chunk-Y5IHIAY3.js → chunk-MDPIOQUD.js} +12 -8
  78. package/dist/safe-bash/command-chunks/chunk-PGEYORBZ.js +25 -0
  79. package/dist/safe-bash/command-chunks/chunk-QI4MGIN6.js +6 -0
  80. package/dist/safe-bash/command-chunks/chunk-QM4UZF3C.js +753 -0
  81. package/dist/safe-bash/command-chunks/chunk-QTYZAWSB.js +91 -0
  82. package/dist/safe-bash/command-chunks/chunk-SNK7K3XW.js +90 -0
  83. package/dist/safe-bash/command-chunks/chunk-T5OLGM43.js +314 -0
  84. package/dist/safe-bash/command-chunks/chunk-TB7IFMUZ.js +802 -0
  85. package/dist/safe-bash/command-chunks/{chunk-YNT4ZJHW.js → chunk-TPPBPIWL.js} +3 -3
  86. package/dist/safe-bash/command-chunks/chunk-VMK4XVKO.js +82 -0
  87. package/dist/safe-bash/command-chunks/chunk-VNSJKXDU.js +130 -0
  88. package/dist/safe-bash/command-chunks/{chunk-2LP3VMPA.js → chunk-WFDW4XXD.js} +1 -17
  89. package/dist/safe-bash/command-chunks/chunk-WR37IS4O.js +318 -0
  90. package/dist/safe-bash/command-chunks/chunk-YFNTMH6Z.js +6 -0
  91. package/dist/safe-bash/commands/basic.js +148 -48
  92. package/dist/safe-bash/commands/bytes/compression/index.js +5 -6
  93. package/dist/safe-bash/commands/cmp.d.ts +2 -3
  94. package/dist/safe-bash/commands/cmp.js +2 -689
  95. package/dist/safe-bash/commands/csplit/index.browser.js +2 -2
  96. package/dist/safe-bash/commands/docx/index.browser.js +4 -47
  97. package/dist/safe-bash/commands/docx/index.d.ts +2 -24
  98. package/dist/safe-bash/commands/docx/index.js +2 -41
  99. package/dist/safe-bash/commands/docx/io.d.ts +1 -14
  100. package/dist/safe-bash/commands/docx/io.js +1 -15
  101. package/dist/safe-bash/commands/factor/index.browser.js +2 -2
  102. package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
  103. package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
  104. package/dist/safe-bash/commands/iconv/index.browser.js +2 -2
  105. package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
  106. package/dist/safe-bash/commands/llm/command.d.ts +1 -4
  107. package/dist/safe-bash/commands/llm/command.js +1 -248
  108. package/dist/safe-bash/commands/llm/elevenlabs-stream.d.ts +1 -2
  109. package/dist/safe-bash/commands/llm/elevenlabs-stream.js +1 -117
  110. package/dist/safe-bash/commands/llm/elevenlabs.d.ts +1 -15
  111. package/dist/safe-bash/commands/llm/elevenlabs.js +1 -123
  112. package/dist/safe-bash/commands/llm/index.browser.js +20 -15
  113. package/dist/safe-bash/commands/llm/index.d.ts +1 -6
  114. package/dist/safe-bash/commands/llm/index.js +1 -4
  115. package/dist/safe-bash/commands/llm/mime.d.ts +1 -2
  116. package/dist/safe-bash/commands/llm/mime.js +1 -136
  117. package/dist/safe-bash/commands/llm/openai-http.d.ts +1 -8
  118. package/dist/safe-bash/commands/llm/openai-http.js +1 -143
  119. package/dist/safe-bash/commands/llm/openai-sse.d.ts +1 -3
  120. package/dist/safe-bash/commands/llm/openai-sse.js +1 -78
  121. package/dist/safe-bash/commands/llm/openai.d.ts +1 -14
  122. package/dist/safe-bash/commands/llm/openai.js +1 -288
  123. package/dist/safe-bash/commands/llm/providers/elevenlabs.d.ts +1 -1
  124. package/dist/safe-bash/commands/llm/providers/elevenlabs.js +1 -1
  125. package/dist/safe-bash/commands/llm/providers/index.browser.js +6 -6
  126. package/dist/safe-bash/commands/llm/providers/index.d.ts +1 -3
  127. package/dist/safe-bash/commands/llm/providers/index.js +1 -2
  128. package/dist/safe-bash/commands/llm/providers/openai.d.ts +1 -1
  129. package/dist/safe-bash/commands/llm/providers/openai.js +1 -1
  130. package/dist/safe-bash/commands/llm/providers/shared.d.ts +1 -23
  131. package/dist/safe-bash/commands/llm/providers/shared.js +1 -65
  132. package/dist/safe-bash/commands/llm/service.d.ts +1 -37
  133. package/dist/safe-bash/commands/llm/service.js +1 -151
  134. package/dist/safe-bash/commands/llm/types.d.ts +1 -52
  135. package/dist/safe-bash/commands/llm/types.js +1 -1
  136. package/dist/safe-bash/commands/mdq/index.browser.js +3 -3
  137. package/dist/safe-bash/commands/media/index.browser.js +1 -1
  138. package/dist/safe-bash/commands/network/index.browser.js +9 -9
  139. package/dist/safe-bash/commands/network/types.d.ts +2 -40
  140. package/dist/safe-bash/commands/node/index.browser.js +6 -8
  141. package/dist/safe-bash/commands/op/index.browser.js +3 -3
  142. package/dist/safe-bash/commands/op/index.js +12 -28
  143. package/dist/safe-bash/commands/pptx/index.d.ts +2 -28
  144. package/dist/safe-bash/commands/pptx/index.js +2 -152
  145. package/dist/safe-bash/commands/pr/index.browser.js +2 -2
  146. package/dist/safe-bash/commands/printf-float.d.ts +1 -0
  147. package/dist/safe-bash/commands/printf-float.js +48 -38
  148. package/dist/safe-bash/commands/printf-format.js +9 -6
  149. package/dist/safe-bash/commands/printf-quote.d.ts +3 -0
  150. package/dist/safe-bash/commands/printf-quote.js +62 -0
  151. package/dist/safe-bash/commands/printf-wide.d.ts +5 -0
  152. package/dist/safe-bash/commands/printf-wide.js +41 -0
  153. package/dist/safe-bash/commands/python/index.browser.js +8 -8
  154. package/dist/safe-bash/commands/python/worker.browser.js +2 -2
  155. package/dist/safe-bash/commands/truncate.d.ts +2 -3
  156. package/dist/safe-bash/commands/truncate.js +2 -686
  157. package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
  158. package/dist/safe-bash/commands/xml/index.browser.js +2 -2
  159. package/dist/safe-bash/commands/yq/index.browser.js +3 -3
  160. package/dist/safe-bash/contracts/diagnostics.d.ts +2 -0
  161. package/dist/safe-bash/contracts/diagnostics.js +2 -0
  162. package/dist/safe-bash/contracts/runtime-control.d.ts +2 -0
  163. package/dist/safe-bash/contracts/runtime-control.js +2 -0
  164. package/dist/safe-bash/core.browser.d.ts +1 -1
  165. package/dist/safe-bash/core.browser.js +10645 -14065
  166. package/dist/safe-bash/core.d.ts +10 -1
  167. package/dist/safe-bash/core.js +0 -1
  168. package/dist/safe-bash/jobs.browser.js +5 -4
  169. package/dist/safe-bash/opt-in/commands/cmp/index.d.ts +6 -2
  170. package/dist/safe-bash/opt-in/commands/cmp/index.js +776 -79
  171. package/dist/safe-bash/opt-in/commands/cmp/options.d.ts +0 -12
  172. package/dist/safe-bash/opt-in/commands/cmp/options.js +0 -153
  173. package/dist/safe-bash/opt-in/commands/truncate/index.d.ts +8 -3
  174. package/dist/safe-bash/opt-in/commands/truncate/index.js +790 -272
  175. package/dist/safe-bash/opt-in/commands/truncate/sync.d.ts +1 -0
  176. package/dist/safe-bash/opt-in/commands/truncate/sync.js +60 -0
  177. package/dist/safe-bash/optional-host.browser.js +61 -80
  178. package/dist/safe-bash/optional-host.d.ts +3 -1
  179. package/dist/safe-bash/optional-host.js +3 -1
  180. package/dist/safe-bash/shell/runtime.js +44 -18
  181. package/dist/safe-bash/yq-browser/index.js +1 -1
  182. package/dist/safe-bash-checksum-engine/index.d.ts +1 -1
  183. package/dist/safe-bash-checksum-engine/index.js +14 -2
  184. package/dist/safe-bash-command-bzip2/index.js +2 -1
  185. package/dist/safe-bash-command-cmp/index.d.ts +10 -0
  186. package/dist/safe-bash-command-cmp/index.js +796 -0
  187. package/dist/safe-bash-command-cmp/options.d.ts +12 -0
  188. package/dist/safe-bash-command-cmp/options.js +42 -0
  189. package/dist/safe-bash-command-csvcut/index.js +11 -8
  190. package/dist/safe-bash-command-csvgrep/index.js +35 -7
  191. package/dist/safe-bash-command-csvkit/codecs/python.js +4 -3
  192. package/dist/safe-bash-command-csvkit/codecs/utf8.js +3 -2
  193. package/dist/safe-bash-command-csvkit/index.js +80 -324
  194. package/dist/safe-bash-command-csvkit/python-regex.d.ts +5 -0
  195. package/dist/safe-bash-command-csvkit/python-regex.js +14 -0
  196. package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
  197. package/dist/safe-bash-command-csvkit/sync-support.js +4 -2
  198. package/dist/safe-bash-command-diff3/index.js +3 -0
  199. package/dist/safe-bash-command-docx/LICENSE +21 -0
  200. package/dist/safe-bash-command-docx/index.d.ts +30 -0
  201. package/dist/safe-bash-command-docx/index.js +67 -0
  202. package/dist/safe-bash-command-docx/io.d.ts +14 -0
  203. package/dist/safe-bash-command-docx/io.js +26 -0
  204. package/dist/safe-bash-command-envsubst/index.js +34 -3
  205. package/dist/safe-bash-command-exiftool/index.js +3 -0
  206. package/dist/safe-bash-command-ffmpeg/index.js +8073 -7940
  207. package/dist/safe-bash-command-fold/family.js +1 -1
  208. package/dist/safe-bash-command-fold/index.js +1 -1
  209. package/dist/safe-bash-command-git/git_rust.wasm +0 -0
  210. package/dist/safe-bash-command-git/wasm.generated.js +1 -1
  211. package/dist/safe-bash-command-htmlq/index.js +5 -0
  212. package/dist/safe-bash-command-imagemagick/index.d.ts +25 -21
  213. package/dist/safe-bash-command-imagemagick/index.js +671 -273
  214. package/dist/safe-bash-command-llm/LICENSE +21 -0
  215. package/dist/safe-bash-command-llm/command.d.ts +5 -0
  216. package/dist/safe-bash-command-llm/command.js +14 -0
  217. package/dist/safe-bash-command-llm/configuration.d.ts +18 -0
  218. package/dist/safe-bash-command-llm/elevenlabs-stream.d.ts +2 -0
  219. package/dist/safe-bash-command-llm/elevenlabs-stream.js +7 -0
  220. package/dist/safe-bash-command-llm/elevenlabs.d.ts +15 -0
  221. package/dist/safe-bash-command-llm/elevenlabs.js +10 -0
  222. package/dist/safe-bash-command-llm/index.d.ts +10 -0
  223. package/dist/safe-bash-command-llm/index.js +46 -0
  224. package/dist/safe-bash-command-llm/mime.d.ts +2 -0
  225. package/dist/safe-bash-command-llm/mime.js +9 -0
  226. package/dist/safe-bash-command-llm/model-options.d.ts +3 -0
  227. package/dist/safe-bash-command-llm/openai-http.d.ts +8 -0
  228. package/dist/safe-bash-command-llm/openai-http.js +17 -0
  229. package/dist/safe-bash-command-llm/openai-sse.d.ts +3 -0
  230. package/dist/safe-bash-command-llm/openai-sse.js +8 -0
  231. package/dist/safe-bash-command-llm/openai.d.ts +14 -0
  232. package/dist/safe-bash-command-llm/openai.js +12 -0
  233. package/dist/safe-bash-command-llm/providers/elevenlabs.d.ts +1 -0
  234. package/dist/safe-bash-command-llm/providers/elevenlabs.js +11 -0
  235. package/dist/safe-bash-command-llm/providers/index.d.ts +3 -0
  236. package/dist/safe-bash-command-llm/providers/index.js +24 -0
  237. package/dist/safe-bash-command-llm/providers/openai.d.ts +1 -0
  238. package/dist/safe-bash-command-llm/providers/openai.js +13 -0
  239. package/dist/safe-bash-command-llm/providers/shared.d.ts +23 -0
  240. package/dist/safe-bash-command-llm/providers/shared.js +13 -0
  241. package/dist/safe-bash-command-llm/schemas.d.ts +2 -0
  242. package/dist/safe-bash-command-llm/service.d.ts +42 -0
  243. package/dist/safe-bash-command-llm/service.js +9 -0
  244. package/dist/safe-bash-command-llm/templates.d.ts +27 -0
  245. package/dist/safe-bash-command-llm/types.d.ts +87 -0
  246. package/dist/safe-bash-command-llm/types.js +6 -0
  247. package/dist/safe-bash-command-mmdc/command.d.ts +4 -0
  248. package/dist/safe-bash-command-mmdc/index.d.ts +1 -1
  249. package/dist/safe-bash-command-mmdc/index.js +7134 -6699
  250. package/dist/safe-bash-command-mmdc/layout.d.ts +1 -0
  251. package/dist/safe-bash-command-mmdc/parser.d.ts +1 -0
  252. package/dist/safe-bash-command-mmdc/png.d.ts +3 -0
  253. package/dist/safe-bash-command-mmdc/raster.d.ts +1 -0
  254. package/dist/safe-bash-command-mmdc/svg.d.ts +1 -0
  255. package/dist/safe-bash-command-op/index.js +19 -14
  256. package/dist/safe-bash-command-pandoc/command.js +3 -3
  257. package/dist/safe-bash-command-pandoc/index.js +3 -3
  258. package/dist/safe-bash-command-pdfimages/index.d.ts +7 -1
  259. package/dist/safe-bash-command-pdfimages/index.js +210 -113
  260. package/dist/safe-bash-command-pdfinfo/index.d.ts +24 -20
  261. package/dist/safe-bash-command-pdfinfo/index.js +517 -241
  262. package/dist/safe-bash-command-pdftk/index.d.ts +7 -3
  263. package/dist/safe-bash-command-pdftk/index.js +261 -125
  264. package/dist/safe-bash-command-pdftoppm/index.d.ts +15 -7
  265. package/dist/safe-bash-command-pdftoppm/index.js +326 -189
  266. package/dist/safe-bash-command-pdftotext/index.d.ts +9 -5
  267. package/dist/safe-bash-command-pdftotext/index.js +237 -107
  268. package/dist/safe-bash-command-pptx/LICENSE +21 -0
  269. package/dist/safe-bash-command-pptx/index.d.ts +33 -0
  270. package/dist/safe-bash-command-pptx/index.js +168 -0
  271. package/dist/safe-bash-command-qpdf/index.d.ts +9 -3
  272. package/dist/safe-bash-command-qpdf/index.js +254 -130
  273. package/dist/safe-bash-command-sha512sum/index.js +12 -475
  274. package/dist/safe-bash-command-sips/index.d.ts +9 -5
  275. package/dist/safe-bash-command-sips/index.js +65 -46
  276. package/dist/safe-bash-command-soffice/index.d.ts +9 -3
  277. package/dist/safe-bash-command-soffice/index.js +66 -25
  278. package/dist/safe-bash-command-sqlite3/engine.d.ts +9 -0
  279. package/dist/safe-bash-command-sqlite3/index.d.ts +1 -0
  280. package/dist/safe-bash-command-sqlite3/index.js +851 -352
  281. package/dist/safe-bash-command-ssconvert/formats/xls.js +3 -3
  282. package/dist/safe-bash-command-ssconvert/index.js +147 -80
  283. package/dist/safe-bash-command-timeout/index.js +3 -3
  284. package/dist/safe-bash-command-truncate/index.d.ts +8 -3
  285. package/dist/safe-bash-command-truncate/index.js +790 -272
  286. package/dist/safe-bash-command-truncate/sync.d.ts +1 -0
  287. package/dist/safe-bash-command-truncate/sync.js +60 -0
  288. package/dist/safe-bash-command-wkhtmltopdf/index.js +239 -118
  289. package/dist/safe-bash-command-wkhtmltopdf/pdf-renderer.d.ts +1 -1
  290. package/dist/safe-bash-command-xxd/index.js +78 -20
  291. package/dist/safe-bash-command-xz/command.d.ts +4 -0
  292. package/dist/safe-bash-command-xz/index.d.ts +1 -1
  293. package/dist/safe-bash-command-xz/index.js +1 -1
  294. package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
  295. package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
  296. package/dist/safe-bash-compression-engine/files.js +6 -6
  297. package/dist/safe-bash-compression-engine/index.js +5 -5
  298. package/dist/safe-bash-compression-engine/operand.js +6 -6
  299. package/dist/safe-bash-compression-engine/stream.js +5 -5
  300. package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
  301. package/dist/safe-bash-contracts/command.js +3 -3
  302. package/dist/safe-bash-contracts/default-executor.d.ts +5 -0
  303. package/dist/safe-bash-contracts/default-executor.js +37 -0
  304. package/dist/safe-bash-contracts/diagnostics.js +3 -3
  305. package/dist/safe-bash-contracts/escaping.js +9 -9
  306. package/dist/safe-bash-contracts/filesystem-descriptor.js +3 -3
  307. package/dist/safe-bash-contracts/filesystem-output.js +8 -8
  308. package/dist/safe-bash-contracts/http.d.ts +41 -0
  309. package/dist/safe-bash-contracts/http.js +6 -0
  310. package/dist/safe-bash-contracts/index.js +21 -19
  311. package/dist/safe-bash-contracts/io.d.ts +12 -0
  312. package/dist/safe-bash-contracts/io.js +4 -1
  313. package/dist/safe-bash-contracts/output.js +3 -2
  314. package/dist/safe-bash-contracts/runtime-control.js +2 -2
  315. package/dist/safe-bash-contracts/signals.js +1 -1
  316. package/dist/safe-bash-contracts/yield.d.ts +1 -0
  317. package/dist/safe-bash-contracts/yield.js +3 -1
  318. package/dist/safe-bash-csv-engine/index.d.ts +10 -1
  319. package/dist/safe-bash-csv-engine/index.js +78 -6
  320. package/dist/safe-bash-io-engine/commands/search/requirements.js +3 -3
  321. package/dist/safe-bash-io-engine/commands/text-programs/shared.js +3 -3
  322. package/dist/safe-bash-io-engine/gnu-information.d.ts +1 -1
  323. package/dist/safe-bash-io-engine/gnu-information.js +1 -1
  324. package/dist/safe-bash-io-engine/internal.d.ts +1 -1
  325. package/dist/safe-bash-io-engine/internal.js +2 -2
  326. package/dist/safe-bash-query-engine/index.js +5 -5
  327. package/dist/safe-bash-query-engine/interpreter.js +3 -3
  328. package/dist/safe-bash-query-engine/query-core.js +5 -5
  329. package/package.json +2 -2
  330. package/dist/safe-bash/chunks/chunk-2G2T5MEM.js +0 -14
  331. package/dist/safe-bash/chunks/chunk-FJZNUUOQ.js +0 -81
  332. package/dist/safe-bash/chunks/chunk-GJWUEOT6.js +0 -14
  333. package/dist/safe-bash/chunks/chunk-LAPF2XE6.js +0 -14
  334. package/dist/safe-bash/chunks/chunk-O6356Z27.js +0 -37
  335. package/dist/safe-bash/chunks/chunk-S2LSZFZ6.js +0 -758
  336. package/dist/safe-bash/chunks/chunk-T3VDYWKZ.js +0 -21
  337. package/dist/safe-bash/chunks/chunk-VYW4Q6KF.js +0 -12
  338. package/dist/safe-bash/chunks/chunk-WHURJBET.js +0 -409
  339. package/dist/safe-bash/opt-in/commands/cmp/compare.js +0 -95
  340. package/dist/safe-bash/opt-in/commands/cmp/io.js +0 -218
  341. package/dist/safe-bash/command-chunks/{chunk-RTOJNFFL.js → chunk-KNI4GRXF.js} +7 -7
  342. package/dist/safe-bash/command-chunks/{chunk-DEH3CMGL.js → chunk-QJ3ONEBI.js} +3 -3
@@ -0,0 +1 @@
1
+ export declare function evalSyncTruncate(opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined, writeFileSync?: (filePath: string, bytes: Uint8Array) => boolean): string | undefined;
@@ -0,0 +1,60 @@
1
+ import { parseArguments, helpText } from "./arguments.js";
2
+ import { syncCommandEvaluators } from "@poe-platform/safe-bash/optional-host";
3
+ export function evalSyncTruncate(opArgs, readFileSync, writeFileSync) {
4
+ try {
5
+ const args = parseArguments(opArgs, false);
6
+ if (args.display === "help")
7
+ return helpText;
8
+ if (args.display === "version")
9
+ return "truncate (safe-bash; GNU coreutils 9.7 semantics)\n";
10
+ if (!writeFileSync || args.files.length === 0)
11
+ return undefined;
12
+ const blockFactor = args.ioBlocks ? 4096n : 1n;
13
+ let refSize;
14
+ if (args.reference !== undefined) {
15
+ const refBytes = readFileSync?.(args.reference);
16
+ if (!refBytes)
17
+ return undefined;
18
+ refSize = BigInt(refBytes.length);
19
+ }
20
+ for (const file of args.files) {
21
+ const existing = readFileSync?.(file);
22
+ if (!existing && args.noCreate)
23
+ continue;
24
+ const curSize = BigInt(existing?.length ?? 0);
25
+ const base = refSize ?? curSize;
26
+ const scaledSize = args.size === undefined ? undefined : args.size * blockFactor;
27
+ let target;
28
+ if (scaledSize === undefined)
29
+ target = refSize;
30
+ else if (args.mode === "absolute")
31
+ target = scaledSize;
32
+ else if (args.mode === "relative")
33
+ target = base + scaledSize;
34
+ else if (args.mode === "<")
35
+ target = base < scaledSize ? base : scaledSize;
36
+ else if (args.mode === ">")
37
+ target = base > scaledSize ? base : scaledSize;
38
+ else if (args.mode === "/")
39
+ target = (base / scaledSize) * scaledSize;
40
+ else
41
+ target = ((base + scaledSize - 1n) / scaledSize) * scaledSize;
42
+ if (target < 0n)
43
+ target = 0n;
44
+ if (target > 1048576n)
45
+ return undefined;
46
+ const n = Number(target);
47
+ const out = new Uint8Array(n);
48
+ if (existing && existing.length > 0) {
49
+ out.set(existing.subarray(0, Math.min(existing.length, n)));
50
+ }
51
+ if (!writeFileSync(file, out))
52
+ return undefined;
53
+ }
54
+ return "";
55
+ }
56
+ catch {
57
+ return undefined;
58
+ }
59
+ }
60
+ syncCommandEvaluators.evalSyncTruncate = evalSyncTruncate;
@@ -1,110 +1,91 @@
1
1
  import {
2
- byte_encoding_exports,
2
+ ByteInputBudget,
3
+ EreLedger,
4
+ EreProfileLimitError,
5
+ EreSyntaxError,
6
+ EreUnsupportedError,
3
7
  compareCopyIdentity,
4
8
  compareObservedEntries,
5
- errors_exports,
6
- limits_exports,
7
- matcher_exports,
9
+ compileEre,
10
+ inputRequirements,
11
+ latin1Text,
8
12
  portableTrapExtension,
9
- syntax_exports,
10
- timeout_exports
11
- } from "./chunks/chunk-Q3E6C3DX.js";
13
+ prepareUtf8EreSubject,
14
+ signalName
15
+ } from "./chunks/chunk-2TAGYMPK.js";
12
16
  import {
13
17
  jobsExtension
14
- } from "./chunks/chunk-2AYZCT5X.js";
15
- import "./chunks/chunk-BI6JV62X.js";
16
- import "./chunks/chunk-T3VDYWKZ.js";
18
+ } from "./chunks/chunk-JQ2FAJJT.js";
19
+ import "./chunks/chunk-VCCMROTL.js";
20
+ import "./chunks/chunk-DYEUZE6Z.js";
21
+ import "./chunks/chunk-OSMQCYSP.js";
17
22
  import {
18
- internal_exports
19
- } from "./chunks/chunk-GJWUEOT6.js";
23
+ UsageError,
24
+ builtInDirectContextExecutors,
25
+ codeOf,
26
+ decoder,
27
+ isDefaultCommandOptions,
28
+ output,
29
+ pathOf,
30
+ registerDefaultExecutor,
31
+ registerDefaultExecutors,
32
+ syncCommandEvaluators
33
+ } from "./chunks/chunk-5OST7NOX.js";
20
34
  import {
21
- __reExport,
22
35
  init_platform
23
- } from "./chunks/chunk-Q45QCA4J.js";
36
+ } from "./chunks/chunk-I3KSESCR.js";
24
37
 
25
38
  // packages/safe-bash/src/optional-host.ts
26
39
  init_platform();
27
40
 
28
41
  // packages/safe-bash/src/commands/yq/toml.ts
29
- var toml_exports = {};
30
42
  init_platform();
31
- __reExport(toml_exports, toml_star);
32
- import * as toml_star from "../safe-bash-command-yq/toml.js";
43
+ import { parseTomlDocument } from "../safe-bash-command-yq/toml.js";
33
44
 
34
45
  // packages/safe-bash/src/commands/yq/accounting.ts
35
- var accounting_exports = {};
36
46
  init_platform();
37
- __reExport(accounting_exports, accounting_star);
38
- import * as accounting_star from "../safe-bash-command-yq/accounting.js";
47
+ import { YqLedger, aliasFailure, copyAlias, estimateAlias, resolveYqLimits, yqCaps } from "../safe-bash-command-yq/accounting.js";
39
48
 
40
49
  // packages/safe-bash/src/commands/structured/numbers.ts
41
- var numbers_exports = {};
42
50
  init_platform();
43
- __reExport(numbers_exports, numbers_star);
44
- import * as numbers_star from "../safe-bash-query-engine/numbers.js";
51
+ import { Decimal, SMALL_DECIMALS, compareNumbers, decimalNumber, isNumber, numberText, numberValue, numericToken } from "../safe-bash-query-engine/numbers.js";
45
52
 
46
53
  // packages/safe-bash/src/commands/structured/bytes.ts
47
- var bytes_exports = {};
48
54
  init_platform();
49
- __reExport(bytes_exports, bytes_star);
50
- import * as bytes_star from "../safe-bash-query-engine/bytes.js";
51
- var export_Decimal = numbers_exports.Decimal;
52
- var export_EreLedger = limits_exports.EreLedger;
53
- var export_EreProfileLimitError = errors_exports.EreProfileLimitError;
54
- var export_EreSyntaxError = errors_exports.EreSyntaxError;
55
- var export_EreUnsupportedError = errors_exports.EreUnsupportedError;
56
- var export_YqLedger = accounting_exports.YqLedger;
57
- var export_builtInDirectContextExecutors = internal_exports.builtInDirectContextExecutors;
58
- var export_codeOf = internal_exports.codeOf;
59
- var export_compareBytes = bytes_exports.compareBytes;
60
- var export_compileEre = syntax_exports.compileEre;
61
- var export_decodeBase64 = bytes_exports.decodeBase64;
62
- var export_decoder = internal_exports.decoder;
63
- var export_encodeBase64 = bytes_exports.encodeBase64;
64
- var export_isDefaultCommandOptions = internal_exports.isDefaultCommandOptions;
65
- var export_latin1Text = byte_encoding_exports.latin1Text;
66
- var export_numberText = numbers_exports.numberText;
67
- var export_output = internal_exports.output;
68
- var export_parseTomlDocument = toml_exports.parseTomlDocument;
69
- var export_pathOf = internal_exports.pathOf;
70
- var export_prepareUtf8EreSubject = matcher_exports.prepareUtf8EreSubject;
71
- var export_registerDefaultExecutor = internal_exports.registerDefaultExecutor;
72
- var export_registerDefaultExecutors = internal_exports.registerDefaultExecutors;
73
- var export_signalName = timeout_exports.signalName;
74
- var export_syncCommandEvaluators = internal_exports.syncCommandEvaluators;
75
- var export_utf8ByteLength = bytes_exports.utf8ByteLength;
76
- var export_utf8Decoder = bytes_exports.utf8Decoder;
77
- var export_utf8Encoder = bytes_exports.utf8Encoder;
55
+ import { compareBytes, decodeBase64, decodeLatin1, encodeBase64, encodeLatin1, utf8ByteLength, utf8Decoder, utf8Encoder } from "../safe-bash-query-engine/bytes.js";
78
56
  export {
79
- export_Decimal as Decimal,
80
- export_EreLedger as EreLedger,
81
- export_EreProfileLimitError as EreProfileLimitError,
82
- export_EreSyntaxError as EreSyntaxError,
83
- export_EreUnsupportedError as EreUnsupportedError,
84
- export_YqLedger as YqLedger,
85
- export_builtInDirectContextExecutors as builtInDirectContextExecutors,
86
- export_codeOf as codeOf,
87
- export_compareBytes as compareBytes,
57
+ ByteInputBudget,
58
+ Decimal,
59
+ EreLedger,
60
+ EreProfileLimitError,
61
+ EreSyntaxError,
62
+ EreUnsupportedError,
63
+ UsageError,
64
+ YqLedger,
65
+ builtInDirectContextExecutors,
66
+ codeOf,
67
+ compareBytes,
88
68
  compareCopyIdentity,
89
69
  compareObservedEntries,
90
- export_compileEre as compileEre,
91
- export_decodeBase64 as decodeBase64,
92
- export_decoder as decoder,
93
- export_encodeBase64 as encodeBase64,
94
- export_isDefaultCommandOptions as isDefaultCommandOptions,
70
+ compileEre,
71
+ decodeBase64,
72
+ decoder,
73
+ encodeBase64,
74
+ inputRequirements,
75
+ isDefaultCommandOptions,
95
76
  jobsExtension,
96
- export_latin1Text as latin1Text,
97
- export_numberText as numberText,
98
- export_output as output,
99
- export_parseTomlDocument as parseTomlDocument,
100
- export_pathOf as pathOf,
77
+ latin1Text,
78
+ numberText,
79
+ output,
80
+ parseTomlDocument,
81
+ pathOf,
101
82
  portableTrapExtension,
102
- export_prepareUtf8EreSubject as prepareUtf8EreSubject,
103
- export_registerDefaultExecutor as registerDefaultExecutor,
104
- export_registerDefaultExecutors as registerDefaultExecutors,
105
- export_signalName as signalName,
106
- export_syncCommandEvaluators as syncCommandEvaluators,
107
- export_utf8ByteLength as utf8ByteLength,
108
- export_utf8Decoder as utf8Decoder,
109
- export_utf8Encoder as utf8Encoder
83
+ prepareUtf8EreSubject,
84
+ registerDefaultExecutor,
85
+ registerDefaultExecutors,
86
+ signalName,
87
+ syncCommandEvaluators,
88
+ utf8ByteLength,
89
+ utf8Decoder,
90
+ utf8Encoder
110
91
  };
@@ -1,7 +1,7 @@
1
1
  export { signalName } from "./commands/timeout/index.js";
2
2
  export { latin1Text } from "./byte-encoding.js";
3
3
  export { jobsExtension } from "./shell/extensions/jobs/index.js";
4
- export { builtInDirectContextExecutors, codeOf, decoder, isDefaultCommandOptions, output, pathOf, registerDefaultExecutor, registerDefaultExecutors, syncCommandEvaluators, } from "./commands/internal.js";
4
+ export { builtInDirectContextExecutors, codeOf, decoder, isDefaultCommandOptions, output, pathOf, registerDefaultExecutor, registerDefaultExecutors, syncCommandEvaluators, UsageError, } from "./commands/internal.js";
5
5
  export { portableTrapExtension } from "./shell/trap.js";
6
6
  export type { TrapExtensionOptions, TrapSignalHost } from "./shell/trap.js";
7
7
  export { compareCopyIdentity, compareObservedEntries } from "./commands/copy-identity.js";
@@ -15,4 +15,6 @@ export { Decimal, numberText } from "./commands/structured/numbers.js";
15
15
  export { utf8ByteLength, utf8Encoder, utf8Decoder, encodeBase64, decodeBase64, compareBytes } from "./commands/structured/bytes.js";
16
16
  export type { PreparedShellChild, ShellBindingReference, ShellBindingResult, ShellChildPreparation, ShellExecutionCheckpoint, ShellExtension, ShellExtensionBuiltin, ShellExtensionContext, ShellExtensionEvent, ShellExtensionInstance, ShellExtensionOption, ShellExtensionScope, ShellIndexedWriter, ShellInputBorrow, ShellInputObserver, ShellListTerminatorContext, ShellListTerminatorHook, ShellSpecialParameterHook, } from "./shell/extensions.js";
17
17
  export type { RawRecord, ReadLine } from "./shell/input.js";
18
+ export { ByteInputBudget } from "./commands/bytes/input-budget.js";
19
+ export { inputRequirements } from "./commands/portable-requirements.js";
18
20
  //# sourceMappingURL=optional-host.d.ts.map
@@ -1,7 +1,7 @@
1
1
  export { signalName } from "./commands/timeout/index.js";
2
2
  export { latin1Text } from "./byte-encoding.js";
3
3
  export { jobsExtension } from "./shell/extensions/jobs/index.js";
4
- export { builtInDirectContextExecutors, codeOf, decoder, isDefaultCommandOptions, output, pathOf, registerDefaultExecutor, registerDefaultExecutors, syncCommandEvaluators, } from "./commands/internal.js";
4
+ export { builtInDirectContextExecutors, codeOf, decoder, isDefaultCommandOptions, output, pathOf, registerDefaultExecutor, registerDefaultExecutors, syncCommandEvaluators, UsageError, } from "./commands/internal.js";
5
5
  export { portableTrapExtension } from "./shell/trap.js";
6
6
  export { compareCopyIdentity, compareObservedEntries } from "./commands/copy-identity.js";
7
7
  export { EreLedger } from "./commands/regex-execution/ere/limits.js";
@@ -12,4 +12,6 @@ export { parseTomlDocument } from "./commands/yq/toml.js";
12
12
  export { YqLedger } from "./commands/yq/accounting.js";
13
13
  export { Decimal, numberText } from "./commands/structured/numbers.js";
14
14
  export { utf8ByteLength, utf8Encoder, utf8Decoder, encodeBase64, decodeBase64, compareBytes } from "./commands/structured/bytes.js";
15
+ export { ByteInputBudget } from "./commands/bytes/input-budget.js";
16
+ export { inputRequirements } from "./commands/portable-requirements.js";
15
17
  //# sourceMappingURL=optional-host.js.map
@@ -3057,6 +3057,29 @@ function sameRedirectTargetWord(a, b) {
3057
3057
  }
3058
3058
  return true;
3059
3059
  }
3060
+ // Arbitrary writes to arithmetic references need the general evaluator.
3061
+ function syncStepsMayWriteName(steps, name) {
3062
+ return steps.some(step => step.name === name || step.arithStmt !== undefined || (step.printfVArgs !== undefined && step.cmd.words[1]?.plain === "-v") ||
3063
+ (step.readHereString && (step.readHereString.varNames.includes(name) || (step.readHereString.isBareReply && name === "REPLY"))) || step.unsetVars?.includes(name) ||
3064
+ step.ifBranches?.some(branch => branch.cond !== undefined || syncStepsMayWriteName(branch.steps, name)) ||
3065
+ (step.elseSteps && syncStepsMayWriteName(step.elseSteps, name)) ||
3066
+ step.caseClauses?.some(clause => syncStepsMayWriteName(clause.steps, name)) ||
3067
+ (step.fnCall && (step.fnCall.locals.some(local => local.name === name) || syncStepsMayWriteName(step.fnCall.steps, name))) ||
3068
+ (step.nestedLoop && (step.nestedLoop.loopCmd.kind !== "for" || step.nestedLoop.loopCmd.name === name || syncStepsMayWriteName(step.nestedLoop.steps, name))));
3069
+ }
3070
+ function arithmeticReadsOtherName(node, inductionName) {
3071
+ if (!node)
3072
+ return false;
3073
+ if (node.kind === "name")
3074
+ return node.name !== inductionName;
3075
+ if (node.kind === "unary")
3076
+ return arithmeticReadsOtherName(node.operand, inductionName);
3077
+ if (node.kind === "binary")
3078
+ return arithmeticReadsOtherName(node.left, inductionName) || arithmeticReadsOtherName(node.right, inductionName);
3079
+ if (node.kind === "conditional")
3080
+ return arithmeticReadsOtherName(node.condition, inductionName) || arithmeticReadsOtherName(node.yes, inductionName) || arithmeticReadsOtherName(node.no, inductionName);
3081
+ return false;
3082
+ }
3060
3083
  const intLoopStepCache = new WeakMap();
3061
3084
  const sharedSyncLoopTouched = new Set();
3062
3085
  const sharedSyncLoopArithNames = new Set();
@@ -3933,7 +3956,9 @@ export class Runtime {
3933
3956
  !pat.text.includes("[.") &&
3934
3957
  !pat.text.includes("[=") &&
3935
3958
  !pat.text.includes("()") &&
3959
+ !pat.text.includes("(?") &&
3936
3960
  !pat.text.includes("[]") &&
3961
+ !pat.text.includes("[^]") &&
3937
3962
  !pat.text.includes("][") &&
3938
3963
  !/\([^)]*[*+?][^)]*\)[*+?]/.test(pat.text)) {
3939
3964
  try {
@@ -14498,6 +14523,8 @@ export class Runtime {
14498
14523
  const p0 = w.parts[0];
14499
14524
  if (!p0 || !this.isPureSyncValueWord(w, rawState))
14500
14525
  return false;
14526
+ if (w.parts.some(part => part.kind === "substitution" || (part.kind === "text" && !part.quoted && part.value.includes("~"))))
14527
+ return false;
14501
14528
  if (p0.kind === "text" && !p0.quoted && p0.value.startsWith("~"))
14502
14529
  return false;
14503
14530
  if (inOptions) {
@@ -14881,6 +14908,7 @@ export class Runtime {
14881
14908
  const nInd = ne0?.tree?.kind === "binary" && ne0.tree.operator === "=" && ne0.tree.left.kind === "name" ? ne0.tree.left.name : undefined;
14882
14909
  if (nInd &&
14883
14910
  ne0 && ne1 && ne2 &&
14911
+ ![ne0, ne1, ne2].some(expression => arithmeticReadsOtherName(expression.tree, nInd)) &&
14884
14912
  !ne0.error && !ne0.hasSubscript && isSafeSmiProgram(ne0) &&
14885
14913
  !ne1.error && !ne1.hasSubscript && isSafeSmiProgram(ne1) &&
14886
14914
  !ne2.error && !ne2.hasSubscript && isSafeSmiProgram(ne2) &&
@@ -15972,14 +16000,8 @@ export class Runtime {
15972
16000
  const initial = rawState.variables[refName];
15973
16001
  if (initial !== undefined && initial !== "" && !/^-?[0-9]+$/.test(initial))
15974
16002
  return undefined;
15975
- for (let b = 0; b < bodyAssignments.length; b++) {
15976
- const step = bodyAssignments[b];
15977
- if (step.name === refName && !intSteps[b] && (!step.value || !step.value.parts.some(p => p.kind === "arithmetic") || step.value.parts.some(p => p.kind !== "arithmetic" && (p.kind !== "text" || p.value !== "")))) {
15978
- const isArrDefaultZero = step.value?.parts.length === 1 && step.value.parts[0].kind === "variable" && getArraySelector(step.value.parts[0])?.kind === "element" && step.value.parts[0].operator === ":-" && step.value.parts[0].alternate?.plain === "0";
15979
- if (!isArrDefaultZero)
15980
- return undefined;
15981
- }
15982
- }
16003
+ if (syncStepsMayWriteName(bodyAssignments, refName))
16004
+ return undefined;
15983
16005
  }
15984
16006
  }
15985
16007
  monitor.chargeInternal(syncRestorationCharge, syncRestorationTickets);
@@ -16311,7 +16333,9 @@ export class Runtime {
16311
16333
  !hasShellFunction(rawState, "getopts") &&
16312
16334
  !rawState.extensions?.builtins.has("getopts") &&
16313
16335
  !hasActiveVariableAttributes(rawState)) {
16314
- const optstring = condCmd.words[1].plain ?? this.fastValueWord(condCmd.words[1], rawState, io, true, false, false, true, undefined, diagnosticLine);
16336
+ // Expanded optstrings can change after each body execution. Keep them
16337
+ // on the normal path, which expands each getopts invocation.
16338
+ const optstring = condCmd.words[1].plain;
16315
16339
  const optVar = condCmd.words[2].plain;
16316
16340
  if (typeof optstring !== "string" ||
16317
16341
  !optVar ||
@@ -16559,6 +16583,7 @@ export class Runtime {
16559
16583
  lastCmd = condCmd;
16560
16584
  lastArg = this.fastValueWord(condCmd.words[condCmd.words.length - 1], rawState, io, false, false, false, true);
16561
16585
  }
16586
+ rawState.status = condNonZero ? 0 : 1;
16562
16587
  if (condNonZero !== (command.kind === "while"))
16563
16588
  break;
16564
16589
  ++iterCount;
@@ -18123,8 +18148,9 @@ export class Runtime {
18123
18148
  : this.evalSyncLoopArithStmt(nl.condArith, rawState, io, touched, nl.condLine);
18124
18149
  if (nl.condCmd?.kind === "simple") {
18125
18150
  innerLastCmd = nl.condCmd;
18126
- innerLastArg = "]";
18151
+ innerLastArg = this.fastValueWord(nl.condCmd.words[nl.condCmd.words.length - 1], rawState, io, false, false, false, true);
18127
18152
  }
18153
+ rawState.status = condOk ? 0 : 1;
18128
18154
  if (condOk !== (lc.kind === "while"))
18129
18155
  break;
18130
18156
  this.budget.loop();
@@ -18258,11 +18284,11 @@ export class Runtime {
18258
18284
  }
18259
18285
  else if (step.condStmt !== undefined) {
18260
18286
  const cStatus = this.tryEvalConditionalSync(step.condStmt, rawState, monitor, arrayStore(rawState), io, step.line) ?? 1;
18261
- rawState.status = cStatus;
18262
18287
  if (step.cmd.kind === "simple") {
18263
18288
  lastArg = this.fastValueWord(step.cmd.words[step.cmd.words.length - 1], rawState, io, false, false, false, true);
18264
18289
  onUpdate({ lastCmd, lastArg });
18265
18290
  }
18291
+ rawState.status = cStatus;
18266
18292
  continue;
18267
18293
  }
18268
18294
  else if (step.arithStmt !== undefined) {
@@ -21050,7 +21076,7 @@ export class Runtime {
21050
21076
  }
21051
21077
  const def = this.commands.get(name);
21052
21078
  let fastOut;
21053
- if (name === "echo" && def && defaultEchoExecutors.has(def.execute) && (args.length === 0 || !args[0].startsWith("-"))) {
21079
+ if (name === "echo" && (options.env ?? context.env).POSIXLY_CORRECT === undefined && def && defaultEchoExecutors.has(def.execute) && (args.length === 0 || !args[0].startsWith("-"))) {
21054
21080
  fastOut = args.join(" ") + "\n";
21055
21081
  }
21056
21082
  else if (name === "printf" && def?.execute === printfCommand.execute && args.length >= 1 && !args[0].startsWith("-"))
@@ -24845,8 +24871,8 @@ export class Runtime {
24845
24871
  this.signal.throwIfAborted();
24846
24872
  if (error instanceof ShellLimitError)
24847
24873
  throw error;
24848
- await this.diagnostic(context, "indexed array: unsupported subscript");
24849
- status = 2;
24874
+ await this.diagnostic(context, `unset: ${name}: bad array subscript`);
24875
+ status = 1;
24850
24876
  continue;
24851
24877
  }
24852
24878
  if (index === undefined) {
@@ -36845,7 +36871,7 @@ export class Runtime {
36845
36871
  firstName === "head" || firstName === "tail" || firstName === "wc" || firstName === "cat" || firstName === "date" || firstName === "cal" || firstName === "ncal" || firstName === "getopt" || firstName === "pathchk" || firstName === "printenv" || firstName === "env" || firstName === "mktemp" || firstName === "tee" || firstName === "touch" || firstName === "cp" || firstName === "mv" || firstName === "rmdir" || firstName === "sleep" || firstName === "chmod" || firstName === "patch" || firstName === "mkdir" || firstName === "rm" || firstName === "ln" || ((stageArgs.includes("--help") || stageArgs.includes("--version")) && gnuInformationSync(firstName, stageArgs) !== undefined)) {
36846
36872
  const rawBytes = prevBuf.subarray(0, prevLen);
36847
36873
  const readFile = (p) => this.tryReadMemoryFileViewSync(resolvePath(rawState.cwd, p), true, true);
36848
- const outStr = ((stageArgs.includes("--help") || stageArgs.includes("--version")) ? gnuInformationSync(firstName, stageArgs) : undefined) ?? (firstName === "envsubst"
36874
+ const outStr = ((stageArgs.includes("--help") || stageArgs.includes("--version")) ? gnuInformationSync(firstName, stageArgs, false, (rawState.exported.has("POSIXLY_CORRECT") || rawState.allexport) && rawState.variables.POSIXLY_CORRECT !== undefined) : undefined) ?? (firstName === "envsubst"
36849
36875
  ? this.evalSyncEnvsubst(inStr, stageArgs, rawState)
36850
36876
  : firstName === "fmt"
36851
36877
  ? this.evalSyncFmt(rawBytes, stageArgs, readFile)
@@ -37563,7 +37589,7 @@ export class Runtime {
37563
37589
  return undefined;
37564
37590
  }
37565
37591
  if (cmd.words.length === 2 && cmd.redirects.length === 0 && (cmd.words[1]?.plain === "--help" || cmd.words[1]?.plain === "--version")) {
37566
- const gnuInfo = gnuInformationSync(w0Plain, [cmd.words[1].plain]);
37592
+ const gnuInfo = gnuInformationSync(w0Plain, [cmd.words[1].plain], false, (rawState.exported.has("POSIXLY_CORRECT") || rawState.allexport) && rawState.variables.POSIXLY_CORRECT !== undefined);
37567
37593
  if (gnuInfo !== undefined) {
37568
37594
  const extDef = this.getExternalCommand(w0Plain);
37569
37595
  if (!extDef || !builtInDirectContextExecutors.has(extDef.execute))
@@ -38353,8 +38379,8 @@ export class Runtime {
38353
38379
  catch {
38354
38380
  return false;
38355
38381
  } }, (s, d, sym) => this.tryLinkMemoryNodeSync(sym ? s : resolvePath(rawState.cwd, s), resolvePath(rawState.cwd, d), sym))
38356
- : (allArgs.includes("--help") || allArgs.includes("--version")) && gnuInformationSync(w0Plain, allArgs) !== undefined
38357
- ? gnuInformationSync(w0Plain, allArgs)
38382
+ : (allArgs.includes("--help") || allArgs.includes("--version")) && gnuInformationSync(w0Plain, allArgs, false, (rawState.exported.has("POSIXLY_CORRECT") || rawState.allexport) && rawState.variables.POSIXLY_CORRECT !== undefined) !== undefined
38383
+ ? gnuInformationSync(w0Plain, allArgs, false, (rawState.exported.has("POSIXLY_CORRECT") || rawState.allexport) && rawState.variables.POSIXLY_CORRECT !== undefined)
38358
38384
  : w0Plain === "mdq"
38359
38385
  ? evalSyncMdq(inBytes, allArgs, readFile)
38360
38386
  : w0Plain === "shuf"
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_platform
3
- } from "../chunks/chunk-Q45QCA4J.js";
3
+ } from "../chunks/chunk-I3KSESCR.js";
4
4
 
5
5
  // packages/safe-bash/src/yq.browser.ts
6
6
  init_platform();
@@ -1,5 +1,5 @@
1
1
  import { type CommandDefinition } from "../safe-bash-contracts/index.js";
2
2
  type Algorithm = "sha512" | "sha384" | "sha256" | "sha224" | "sha1" | "md5" | "crc" | "bsd" | "sysv" | "crc32b" | "sm3" | "blake2b" | "sha3";
3
- export declare function command(name: string, algorithm: Algorithm, maxInputBytes: number): CommandDefinition;
3
+ export declare function command(name: string, algorithm: Algorithm, maxInputBytes: number, maxArgumentBytes?: number): CommandDefinition;
4
4
  export declare function evalSyncChecksum(name: string, inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (p: string) => Uint8Array | undefined, fileOperandName?: string): string | undefined;
5
5
  export {};
@@ -7,6 +7,7 @@ import {
7
7
 
8
8
  // packages/safe-bash-checksum-engine/dist/index.js
9
9
  init_buffer();
10
+ import { shellValueByteLength } from "../safe-bash-contracts/value.js";
10
11
  import { yieldTurn } from "../safe-bash-contracts/yield.js";
11
12
  import { blake2b } from "@noble/hashes/blake2.js";
12
13
  import { sha3_224, sha3_256, sha3_384, sha3_512 } from "@noble/hashes/sha3.js";
@@ -14,7 +15,7 @@ import { PublicDiagnostic } from "../safe-bash-contracts/diagnostics.js";
14
15
  import { md5, sha1 } from "@noble/hashes/legacy.js";
15
16
  import { sha224, sha256, sha384, sha512 } from "@noble/hashes/sha2.js";
16
17
  import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js";
17
- import { FsError, readBytes, toByteSource } from "../safe-bash-contracts/index.js";
18
+ import { FsError, getCommandArguments, readBytes, toByteSource } from "../safe-bash-contracts/index.js";
18
19
  import { codeOf, define, diagnostic, encoder, options, output, pathOf, UsageError, value } from "../safe-bash-io-engine/internal.js";
19
20
  import { ByteInputBudget } from "../safe-bash-byte-input-engine/index.js";
20
21
  var blockBytes = 64 * 1024;
@@ -423,14 +424,25 @@ async function verify(context, manifest, algorithm, settings, state) {
423
424
  }
424
425
  return valid && matched && !failures && !mismatched && (!settings.strict || !malformed);
425
426
  }
426
- function command(name, algorithm, maxInputBytes) {
427
+ function command(name, algorithm, maxInputBytes, maxArgumentBytes = Infinity) {
427
428
  return define(name, async (context) => {
429
+ if (maxArgumentBytes !== Infinity) {
430
+ const arguments_ = getCommandArguments(context);
431
+ let argumentBytes = 0;
432
+ for (let index = 0; index < arguments_.args.length; index++) {
433
+ const bytes = shellValueByteLength(arguments_.values[index]);
434
+ if (bytes > maxArgumentBytes - argumentBytes)
435
+ throw new FsError("EFBIG", { message: "checksum argument limit exceeded" });
436
+ argumentBytes += bytes;
437
+ }
438
+ }
428
439
  const selected = name === "cksum" ? parseCksum(context.args) : { algorithm, settings: parse(context.args, algorithm) };
429
440
  const selectedAlgorithm = selected.algorithm;
430
441
  const settings = selected.settings;
431
442
  const state = { stdinUsed: false, budget: new ByteInputBudget(maxInputBytes) };
432
443
  let failed = false;
433
444
  for (const filename of settings.operands.length ? settings.operands : ["-"]) {
445
+ await yieldTurn(context.signal);
434
446
  context.signal.throwIfAborted();
435
447
  if (settings.check) {
436
448
  try {
@@ -10,6 +10,7 @@ import { codeOf, diagnostic, output } from "../safe-bash-compression-engine/inte
10
10
  import { runOperand } from "../safe-bash-compression-engine/operand.js";
11
11
  import { planOperands, verifyOperandDestinations } from "../safe-bash-compression-engine/files.js";
12
12
  import { parseOptions, profiles } from "../safe-bash-compression-engine/options.js";
13
+ import { CompressedDataError } from "../safe-bash-compression-engine/errors.js";
13
14
  import { DecodedBudget } from "../safe-bash-compression-engine/stream.js";
14
15
  function settings(options = {}) {
15
16
  const maxDecodedBytes = options.limits?.maxDecodedBytes ?? options.maxDecodedBytes ?? Infinity;
@@ -95,7 +96,7 @@ No FILE or FILE '-' uses stdin; file output uses private VFS staging.
95
96
  context.signal.throwIfAborted();
96
97
  if (parsed.quiet < 2)
97
98
  await diagnostic(context, error);
98
- exitCode = 1;
99
+ exitCode = Math.max(exitCode, error instanceof CompressedDataError ? 2 : 1);
99
100
  if (decodedBudget.exceeded)
100
101
  break;
101
102
  }
@@ -0,0 +1,10 @@
1
+ import { type CommandDefinition, type VirtualShellPlugin } from "../safe-bash-contracts/index.js";
2
+ import { type CmpCommandsOptions } from "./options.js";
3
+ export type { CmpLimits, CmpCommandsOptions } from "./options.js";
4
+ export declare function evalSyncCmp(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (path: string) => Uint8Array | undefined): string | undefined;
5
+ /** Opt-in GNU comparison-block behavior; producer fragments do not define blocks. */
6
+ export declare const createCmpCommand: (options?: CmpCommandsOptions | undefined) => CommandDefinition;
7
+ /** Existing default-shell behavior, sharing the same retained-input engine. */
8
+ export declare const cmpCommand: (options?: CmpCommandsOptions | undefined) => CommandDefinition;
9
+ export declare function createCmpCommands(options?: CmpCommandsOptions): readonly CommandDefinition[];
10
+ export declare function cmpCommands(options?: CmpCommandsOptions): VirtualShellPlugin;