@poe-platform/safe-bash 0.1.798 → 0.1.800

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 (942) hide show
  1. package/README.md +34 -18
  2. package/dist/image-ast/index.browser.js +1384 -23
  3. package/dist/image-ast/index.js +1384 -23
  4. package/dist/mp4-ast/types.d.ts +1 -0
  5. package/dist/office-package/zip.d.ts +2 -0
  6. package/dist/office-package/zip.js +1 -1
  7. package/dist/pdf-ast/index.js +1 -1
  8. package/dist/safe-bash/chunks/{chunk-IUTD5FH5.js → chunk-46UISJCK.js} +1 -6
  9. package/dist/safe-bash/chunks/chunk-4SEW2Q6H.js +26 -0
  10. package/dist/safe-bash/chunks/{chunk-AKC46AF6.js → chunk-7YSRXFEG.js} +7 -40
  11. package/dist/safe-bash/chunks/{chunk-KTGR4U57.js → chunk-BHJE5LPZ.js} +1 -2
  12. package/dist/safe-bash/chunks/{chunk-AMTCC256.js → chunk-HHW7MGS2.js} +2 -2
  13. package/dist/safe-bash/chunks/{chunk-ZNAFMYIA.js → chunk-I7L3G3NX.js} +1 -1
  14. package/dist/safe-bash/chunks/{chunk-KMH2DF3I.js → chunk-JJSTTIEZ.js} +6 -1
  15. package/dist/safe-bash/chunks/{chunk-6IBTC4YL.js → chunk-JTLSUJ7V.js} +57 -20
  16. package/dist/safe-bash/chunks/chunk-K2VCOJ2B.js +111 -0
  17. package/dist/safe-bash/chunks/chunk-K4YMYFRJ.js +9802 -0
  18. package/dist/safe-bash/chunks/{chunk-CSNXID73.js → chunk-KW24TAIU.js} +446 -5543
  19. package/dist/safe-bash/chunks/{chunk-ENR3HB2B.js → chunk-NLAW7KDI.js} +0 -1
  20. package/dist/safe-bash/chunks/{chunk-B3DDEDH2.js → chunk-PPYM75Z3.js} +1 -1
  21. package/dist/safe-bash/chunks/{chunk-NX2SQVON.js → chunk-RKKRJ54E.js} +19 -7
  22. package/dist/safe-bash/chunks/{chunk-V3VEATEA.js → chunk-RMWLWH7Q.js} +870 -953
  23. package/dist/safe-bash/chunks/{chunk-JSVX4VIA.js → chunk-TFGRKY43.js} +2 -1
  24. package/dist/safe-bash/chunks/{chunk-T5KKDMYB.js → chunk-TYD7EVUJ.js} +6 -0
  25. package/dist/safe-bash/chunks/{csvkit-W2UEKH6P.js → csvkit-QGP3GAOB.js} +1 -1
  26. package/dist/safe-bash/chunks/{ffmpeg-42CGASMV.js → ffmpeg-JTVH26MK.js} +1 -1
  27. package/dist/safe-bash/chunks/{gh-26GYLH6D.js → gh-I7QX7N5C.js} +1 -1
  28. package/dist/safe-bash/chunks/{git-YREKMUVD.js → git-MA7NKYVP.js} +1 -1
  29. package/dist/safe-bash/chunks/{imagemagick-3YIX4XO2.js → imagemagick-Y4NPWX2Q.js} +1 -1
  30. package/dist/safe-bash/chunks/{implementation-E3YMKU3Z.js → implementation-BWDKOVQJ.js} +1 -1
  31. package/dist/safe-bash/chunks/mmdc-44PELHDG.js +118 -0
  32. package/dist/safe-bash/chunks/{pdfimages-UE2UISP2.js → pdfimages-635TRW4Q.js} +1 -1
  33. package/dist/safe-bash/chunks/{pdfinfo-RGARKLI5.js → pdfinfo-FSDAA2KY.js} +3 -11
  34. package/dist/safe-bash/chunks/{pdftk-JY3WVCCC.js → pdftk-GQ5UH3VG.js} +1 -1
  35. package/dist/safe-bash/chunks/{pdftoppm-GPD3BMPY.js → pdftoppm-YTXQCAYT.js} +1 -1
  36. package/dist/safe-bash/chunks/{pdftotext-K7GQ2QJZ.js → pdftotext-CVA2G7FY.js} +1 -1
  37. package/dist/safe-bash/chunks/{qpdf-F4U7WUSU.js → qpdf-HZMIFG4A.js} +1 -1
  38. package/dist/safe-bash/chunks/{sips-RWENS7X5.js → sips-E7UBDP33.js} +1 -1
  39. package/dist/safe-bash/chunks/{soffice-IT6W2C5F.js → soffice-ELASUWUK.js} +1 -1
  40. package/dist/safe-bash/chunks/{wkhtmltopdf-JYNDAHIZ.js → wkhtmltopdf-EPO6YCMG.js} +1 -1
  41. package/dist/safe-bash/command-chunks/chunk-2FGJYFWZ.js +44 -0
  42. package/dist/safe-bash/command-chunks/chunk-2H4JTFIL.js +53 -0
  43. package/dist/safe-bash/command-chunks/{chunk-THS4YAKG.js → chunk-2QHG43WJ.js} +2 -2
  44. package/dist/safe-bash/command-chunks/chunk-364TMWBT.js +946 -0
  45. package/dist/safe-bash/command-chunks/{chunk-JEPY4UY4.js → chunk-3DT2YOGW.js} +11 -6
  46. package/dist/safe-bash/command-chunks/chunk-3E2OIS2J.js +7037 -0
  47. package/dist/safe-bash/command-chunks/{chunk-AIRGA2SU.js → chunk-3HXDA5PT.js} +1 -1
  48. package/dist/safe-bash/command-chunks/chunk-3LSOYLNV.js +1091 -0
  49. package/dist/safe-bash/command-chunks/{chunk-OAJUAAWH.js → chunk-464RVBGB.js} +3 -3
  50. package/dist/safe-bash/command-chunks/chunk-4B7Y7S6E.js +61 -0
  51. package/dist/safe-bash/command-chunks/{chunk-HRLIAMXC.js → chunk-4C6QI5BQ.js} +3 -2
  52. package/dist/safe-bash/command-chunks/{chunk-25BLI6S6.js → chunk-4Y3WVMK4.js} +1 -14
  53. package/dist/safe-bash/command-chunks/chunk-4ZHMW6F5.js +104 -0
  54. package/dist/safe-bash/command-chunks/{chunk-YMQKVEIF.js → chunk-52PCQXD2.js} +2 -13
  55. package/dist/safe-bash/command-chunks/{chunk-SSBFTMVI.js → chunk-53P53XFM.js} +2 -2
  56. package/dist/safe-bash/command-chunks/{chunk-ZCKDQGKY.js → chunk-5HDSFHGW.js} +1 -1
  57. package/dist/safe-bash/command-chunks/chunk-5LSGEIZY.js +379 -0
  58. package/dist/safe-bash/command-chunks/{chunk-MKQVQMXO.js → chunk-5LU4UCBR.js} +1 -1
  59. package/dist/safe-bash/command-chunks/chunk-5T7CRJHW.js +560 -0
  60. package/dist/safe-bash/command-chunks/chunk-5TBUOBDE.js +346 -0
  61. package/dist/safe-bash/command-chunks/{chunk-AUAF5YBT.js → chunk-5WPI42ZW.js} +0 -7
  62. package/dist/safe-bash/command-chunks/chunk-5XY4DTNG.js +34 -0
  63. package/dist/safe-bash/command-chunks/chunk-5ZMZ573Q.js +140 -0
  64. package/dist/safe-bash/command-chunks/{chunk-2Q7UQ7R4.js → chunk-67IQF5GC.js} +200 -66
  65. package/dist/safe-bash/command-chunks/chunk-67QKREJK.js +347 -0
  66. package/dist/safe-bash/command-chunks/chunk-6EPHJGGF.js +23 -0
  67. package/dist/safe-bash/command-chunks/chunk-6F4XCVON.js +266 -0
  68. package/dist/safe-bash/command-chunks/{chunk-ESMCX3YV.js → chunk-6HMX4CQS.js} +669 -130
  69. package/dist/safe-bash/command-chunks/{chunk-RECJB2BO.js → chunk-7BS66BXN.js} +1 -1
  70. package/dist/safe-bash/command-chunks/{chunk-GRWOVSFK.js → chunk-7D7JRRML.js} +1 -1
  71. package/dist/safe-bash/command-chunks/chunk-7K6JYKPJ.js +422 -0
  72. package/dist/safe-bash/command-chunks/{chunk-E6IYUYVA.js → chunk-7L24L4UO.js} +2 -2
  73. package/dist/safe-bash/command-chunks/chunk-7N2LI2KO.js +206 -0
  74. package/dist/safe-bash/command-chunks/chunk-7RGB363W.js +362 -0
  75. package/dist/safe-bash/command-chunks/{chunk-HBXQWTJR.js → chunk-A5ZAV6DO.js} +1 -1
  76. package/dist/safe-bash/command-chunks/{chunk-LW34AKDM.js → chunk-AB4MXHVS.js} +4 -14
  77. package/dist/safe-bash/command-chunks/{pptx-GBPNWNEP-7EQEVXV5.js → chunk-AI5JAXQF.js} +34820 -18029
  78. package/dist/safe-bash/command-chunks/chunk-AMO3THU4.js +105 -0
  79. package/dist/safe-bash/command-chunks/{chunk-EELNLEEP.js → chunk-AXK3H4PX.js} +1 -1
  80. package/dist/safe-bash/command-chunks/{chunk-Y55OCH37.js → chunk-AYUTO323.js} +3 -10
  81. package/dist/safe-bash/command-chunks/{chunk-DY36FDDC.js → chunk-B5TAOCKD.js} +6 -6
  82. package/dist/safe-bash/command-chunks/chunk-BAGCY35S.js +231 -0
  83. package/dist/safe-bash/command-chunks/chunk-BAXU7B5Z.js +101 -0
  84. package/dist/safe-bash/command-chunks/{chunk-YB6KVU6H.js → chunk-BDBVVZY6.js} +4 -14
  85. package/dist/safe-bash/command-chunks/{chunk-2HOESGFJ.js → chunk-BKCNF5U3.js} +68 -7
  86. package/dist/safe-bash/command-chunks/chunk-BNOU5YQS.js +182 -0
  87. package/dist/safe-bash/command-chunks/{chunk-QAN7KKDZ.js → chunk-BZDDAPSV.js} +1 -1
  88. package/dist/safe-bash/command-chunks/{chunk-HZCPWYWA.js → chunk-BZPAWTUL.js} +1 -1
  89. package/dist/safe-bash/command-chunks/chunk-C7I25AAL.js +25 -0
  90. package/dist/safe-bash/command-chunks/chunk-CKXV2CLD.js +65 -0
  91. package/dist/safe-bash/command-chunks/{chunk-RT2J5ATD.js → chunk-CPPGTBZF.js} +1 -1
  92. package/dist/safe-bash/command-chunks/chunk-CQ5YGOGB.js +150 -0
  93. package/dist/safe-bash/command-chunks/{chunk-5UA3BEGA.js → chunk-D4OP2BR3.js} +72 -24
  94. package/dist/safe-bash/command-chunks/chunk-DB453IE6.js +122 -0
  95. package/dist/safe-bash/command-chunks/chunk-DOKKNRRM.js +87 -0
  96. package/dist/safe-bash/command-chunks/{chunk-2PX5B7T5.js → chunk-DQAVUDDX.js} +2 -2
  97. package/dist/safe-bash/command-chunks/chunk-DT7BCTWY.js +249 -0
  98. package/dist/safe-bash/command-chunks/chunk-E2LB7FRT.js +42 -0
  99. package/dist/safe-bash/command-chunks/chunk-EK6YNAXT.js +343 -0
  100. package/dist/safe-bash/command-chunks/chunk-EQ4HV54N.js +22 -0
  101. package/dist/safe-bash/command-chunks/chunk-ERYJLO6G.js +293 -0
  102. package/dist/safe-bash/command-chunks/{chunk-4ONEXMD3.js → chunk-EUSPTFAX.js} +1 -1
  103. package/dist/safe-bash/command-chunks/chunk-FKKB5X5V.js +97 -0
  104. package/dist/safe-bash/command-chunks/chunk-FXELCPFX.js +195 -0
  105. package/dist/safe-bash/command-chunks/{chunk-HLMUPSM6.js → chunk-GI4CJED2.js} +3 -2
  106. package/dist/safe-bash/command-chunks/{chunk-CU5RLO62.js → chunk-GLOZX57Y.js} +92 -18
  107. package/dist/safe-bash/command-chunks/chunk-GMIHJYDG.js +331 -0
  108. package/dist/safe-bash/command-chunks/chunk-H622NS6Z.js +11 -0
  109. package/dist/safe-bash/command-chunks/{chunk-QGVOS3EY.js → chunk-HFII3QYO.js} +1 -1
  110. package/dist/safe-bash/command-chunks/{chunk-5EWTQJSC.js → chunk-HHP343KT.js} +1 -1
  111. package/dist/safe-bash/command-chunks/{chunk-WBJKOTSP.js → chunk-HMOZ6XVJ.js} +1 -1
  112. package/dist/safe-bash/command-chunks/{chunk-AVSPNLWV.js → chunk-I237SNW5.js} +1 -1
  113. package/dist/safe-bash/command-chunks/{chunk-4MS5WZJC.js → chunk-IKS2YXZQ.js} +3 -3
  114. package/dist/safe-bash/command-chunks/{chunk-CZVBYCB5.js → chunk-IL53SJL4.js} +2 -12
  115. package/dist/safe-bash/command-chunks/{chunk-VZ64JXHC.js → chunk-IR2BY7EL.js} +21 -6
  116. package/dist/safe-bash/command-chunks/chunk-IYPAQ7PH.js +42 -0
  117. package/dist/safe-bash/command-chunks/chunk-JN7WIP6S.js +94 -0
  118. package/dist/safe-bash/command-chunks/chunk-JNZ3CVAE.js +147 -0
  119. package/dist/safe-bash/command-chunks/{chunk-HLBX5IRS.js → chunk-JQ74HC37.js} +24 -32
  120. package/dist/safe-bash/command-chunks/{chunk-2LLZBNLL.js → chunk-JWE54GHQ.js} +1 -1
  121. package/dist/safe-bash/command-chunks/{chunk-QLDIP3OP.js → chunk-JZSNU2MY.js} +2 -2
  122. package/dist/safe-bash/command-chunks/chunk-KFVV7ZJO.js +216 -0
  123. package/dist/safe-bash/command-chunks/{chunk-G4PNVO6Z.js → chunk-KP7AO66M.js} +1 -1
  124. package/dist/safe-bash/command-chunks/chunk-KWESKQHR.js +25 -0
  125. package/dist/safe-bash/command-chunks/chunk-KYSPGS33.js +41 -0
  126. package/dist/safe-bash/command-chunks/{chunk-C7IHMJEW.js → chunk-KZC5UWFF.js} +2 -2
  127. package/dist/safe-bash/command-chunks/chunk-L6DVEBW3.js +553 -0
  128. package/dist/safe-bash/command-chunks/chunk-LC2MFKT4.js +2489 -0
  129. package/dist/safe-bash/command-chunks/chunk-LE5LZNHE.js +204 -0
  130. package/dist/safe-bash/command-chunks/chunk-MDH5T4OS.js +41 -0
  131. package/dist/safe-bash/command-chunks/chunk-MM6HU6CX.js +20 -0
  132. package/dist/safe-bash/command-chunks/{chunk-MYJAZ3U2.js → chunk-MPL2466A.js} +2 -2
  133. package/dist/safe-bash/command-chunks/{chunk-3TANKHBX.js → chunk-MRW5HD2D.js} +1 -6
  134. package/dist/safe-bash/command-chunks/{chunk-3WKA57FA.js → chunk-N5FGCXQJ.js} +1 -9
  135. package/dist/safe-bash/command-chunks/{chunk-VZHRZMS7.js → chunk-NAY27PXB.js} +1 -1
  136. package/dist/safe-bash/command-chunks/chunk-NCD7PEWH.js +298 -0
  137. package/dist/safe-bash/command-chunks/chunk-NFGI5IGF.js +266 -0
  138. package/dist/safe-bash/command-chunks/{chunk-U3ONEICA.js → chunk-NXEQ3ESQ.js} +7 -11
  139. package/dist/safe-bash/command-chunks/{chunk-3VGGYEDH.js → chunk-ORYGZYKW.js} +4 -3
  140. package/dist/safe-bash/command-chunks/{chunk-OLQG7ZCN.js → chunk-PEF7K3UQ.js} +136 -75
  141. package/dist/safe-bash/command-chunks/{chunk-HVI6ALJF.js → chunk-PFAADCB5.js} +2 -4
  142. package/dist/safe-bash/command-chunks/chunk-PII4YEZW.js +123 -0
  143. package/dist/safe-bash/command-chunks/{chunk-JG5W2ENK.js → chunk-PJJUYO3R.js} +5 -5
  144. package/dist/safe-bash/command-chunks/{chunk-VKQCNX32.js → chunk-PTT3I223.js} +1 -1
  145. package/dist/safe-bash/command-chunks/chunk-Q3DII3Q7.js +174 -0
  146. package/dist/safe-bash/command-chunks/chunk-Q3EWDEUQ.js +185 -0
  147. package/dist/safe-bash/command-chunks/{chunk-JXU2N6GN.js → chunk-Q7Q5GM5S.js} +2 -2
  148. package/dist/safe-bash/command-chunks/{chunk-Z5TFSVNU.js → chunk-QAKKSRNV.js} +1 -1
  149. package/dist/safe-bash/command-chunks/{chunk-2FUAW6GO.js → chunk-QI7LGHJJ.js} +58 -9
  150. package/dist/safe-bash/command-chunks/{chunk-6BETHLXZ.js → chunk-QJAFJP2G.js} +1 -1
  151. package/dist/safe-bash/command-chunks/chunk-QNIMV57G.js +63 -0
  152. package/dist/safe-bash/command-chunks/{chunk-KAHH4XOU.js → chunk-QNXI2UP6.js} +1 -1
  153. package/dist/safe-bash/command-chunks/{chunk-AC6X7Q4I.js → chunk-QP4R6GLA.js} +6 -9
  154. package/dist/safe-bash/command-chunks/{chunk-LPORMIZS.js → chunk-QWIDNAAK.js} +8 -8
  155. package/dist/safe-bash/command-chunks/chunk-RVLO4DYT.js +35 -0
  156. package/dist/safe-bash/command-chunks/{chunk-X2YQLGKS.js → chunk-SAMH7SQE.js} +4 -4
  157. package/dist/safe-bash/command-chunks/chunk-SEM36PG5.js +11 -0
  158. package/dist/safe-bash/command-chunks/chunk-STC3LEWJ.js +634 -0
  159. package/dist/safe-bash/command-chunks/chunk-SVULUDOP.js +331 -0
  160. package/dist/safe-bash/command-chunks/{chunk-WYOL5JNT.js → chunk-SX2X3IH4.js} +4 -4
  161. package/dist/safe-bash/command-chunks/chunk-TEVJJPTC.js +1392 -0
  162. package/dist/safe-bash/command-chunks/{chunk-6N5V4VBN.js → chunk-TYCGMRLM.js} +2 -2
  163. package/dist/safe-bash/command-chunks/chunk-UG7SMZFF.js +178 -0
  164. package/dist/safe-bash/command-chunks/{chunk-PRCT7FKJ.js → chunk-UMDIOL3O.js} +3 -3
  165. package/dist/safe-bash/command-chunks/chunk-UXSR5BZH.js +136 -0
  166. package/dist/safe-bash/command-chunks/chunk-V6BEDRMQ.js +112 -0
  167. package/dist/safe-bash/command-chunks/chunk-V6MSPQLA.js +362 -0
  168. package/dist/safe-bash/command-chunks/{chunk-J4PEQWSF.js → chunk-VGG2DL5Q.js} +0 -1
  169. package/dist/safe-bash/command-chunks/{chunk-SG424QWS.js → chunk-VL67NWNS.js} +1 -1
  170. package/dist/safe-bash/command-chunks/chunk-WB5SVIG7.js +1034 -0
  171. package/dist/safe-bash/command-chunks/{src-UJOWAS2S.js → chunk-WD3ERGRY.js} +77 -277
  172. package/dist/safe-bash/command-chunks/{chunk-YFSDDFGV.js → chunk-WH627NJL.js} +446 -53
  173. package/dist/safe-bash/command-chunks/chunk-WNE7FPVR.js +236 -0
  174. package/dist/safe-bash/command-chunks/{chunk-UKS2XJZI.js → chunk-WPYIOKE3.js} +4 -4
  175. package/dist/safe-bash/command-chunks/chunk-XETLEHZP.js +1227 -0
  176. package/dist/safe-bash/command-chunks/chunk-XIIBTGC5.js +580 -0
  177. package/dist/safe-bash/command-chunks/chunk-XJXU3VVH.js +737 -0
  178. package/dist/safe-bash/command-chunks/{chunk-JCVXAX2G.js → chunk-XWZBMJ5B.js} +1 -1
  179. package/dist/safe-bash/command-chunks/chunk-Y5INTD6S.js +220 -0
  180. package/dist/safe-bash/command-chunks/{chunk-23XLM73P.js → chunk-YEOPI5SK.js} +1 -1
  181. package/dist/safe-bash/command-chunks/{chunk-PPOIPMY4.js → chunk-YGC6OS5O.js} +3 -56
  182. package/dist/safe-bash/command-chunks/chunk-YJDV76GL.js +262 -0
  183. package/dist/safe-bash/command-chunks/chunk-YOF7R4OY.js +80 -0
  184. package/dist/safe-bash/command-chunks/chunk-Z7RVSD5K.js +594 -0
  185. package/dist/safe-bash/command-chunks/chunk-ZHUWOUWB.js +618 -0
  186. package/dist/safe-bash/command-chunks/{chunk-OGUMMTTD.js → chunk-ZJBR5Q5I.js} +4 -4
  187. package/dist/safe-bash/command-chunks/{model-store-L35QTZMJ.js → model-store-WPKMRPV4.js} +2 -2
  188. package/dist/safe-bash/command-chunks/pptx-7G52EJ6L-4JACH5FB.js +625 -0
  189. package/dist/safe-bash/command-chunks/python-worker-source-TYOFJMCW.js +4 -0
  190. package/dist/safe-bash/command-chunks/src-ICMQISAA.js +501 -0
  191. package/dist/safe-bash/commands/archive/create.d.ts +1 -17
  192. package/dist/safe-bash/commands/archive/create.js +1 -252
  193. package/dist/safe-bash/commands/archive/extract.d.ts +1 -11
  194. package/dist/safe-bash/commands/archive/extract.js +1 -640
  195. package/dist/safe-bash/commands/archive/format.d.ts +1 -32
  196. package/dist/safe-bash/commands/archive/format.js +1 -225
  197. package/dist/safe-bash/commands/archive/index.d.ts +5 -10
  198. package/dist/safe-bash/commands/archive/index.js +6 -931
  199. package/dist/safe-bash/commands/archive/listing.d.ts +1 -2
  200. package/dist/safe-bash/commands/archive/listing.js +1 -21
  201. package/dist/safe-bash/commands/archive/modes.d.ts +1 -5
  202. package/dist/safe-bash/commands/archive/modes.js +1 -182
  203. package/dist/safe-bash/commands/archive/options.d.ts +1 -53
  204. package/dist/safe-bash/commands/archive/options.js +1 -462
  205. package/dist/safe-bash/commands/archive/stream.d.ts +1 -22
  206. package/dist/safe-bash/commands/archive/stream.js +1 -188
  207. package/dist/safe-bash/commands/archive/transform.d.ts +1 -16
  208. package/dist/safe-bash/commands/archive/transform.js +1 -85
  209. package/dist/safe-bash/commands/archive/unzip/arguments.d.ts +1 -53
  210. package/dist/safe-bash/commands/archive/unzip/arguments.js +1 -322
  211. package/dist/safe-bash/commands/archive/unzip/safety.d.ts +1 -32
  212. package/dist/safe-bash/commands/archive/unzip/safety.js +1 -295
  213. package/dist/safe-bash/commands/archive/unzip.d.ts +1 -3
  214. package/dist/safe-bash/commands/archive/unzip.js +1 -398
  215. package/dist/safe-bash/commands/archive/zip/aes.d.ts +1 -17
  216. package/dist/safe-bash/commands/archive/zip/aes.js +1 -156
  217. package/dist/safe-bash/commands/archive/zip/comments.d.ts +1 -17
  218. package/dist/safe-bash/commands/archive/zip/comments.js +1 -83
  219. package/dist/safe-bash/commands/archive/zip/crc.d.ts +1 -1
  220. package/dist/safe-bash/commands/archive/zip/crc.js +1 -1
  221. package/dist/safe-bash/commands/archive/zip/crypto.d.ts +1 -19
  222. package/dist/safe-bash/commands/archive/zip/crypto.js +1 -118
  223. package/dist/safe-bash/commands/archive/zip/dates.d.ts +1 -4
  224. package/dist/safe-bash/commands/archive/zip/dates.js +1 -66
  225. package/dist/safe-bash/commands/archive/zip/environment.d.ts +1 -2
  226. package/dist/safe-bash/commands/archive/zip/environment.js +1 -62
  227. package/dist/safe-bash/commands/archive/zip/grow.d.ts +1 -3
  228. package/dist/safe-bash/commands/archive/zip/grow.js +1 -2
  229. package/dist/safe-bash/commands/archive/zip/help.d.ts +1 -4
  230. package/dist/safe-bash/commands/archive/zip/help.js +1 -182
  231. package/dist/safe-bash/commands/archive/zip/line-endings.d.ts +1 -2
  232. package/dist/safe-bash/commands/archive/zip/line-endings.js +1 -194
  233. package/dist/safe-bash/commands/archive/zip/log.d.ts +1 -22
  234. package/dist/safe-bash/commands/archive/zip/log.js +1 -159
  235. package/dist/safe-bash/commands/archive/zip/lzma.d.ts +1 -9
  236. package/dist/safe-bash/commands/archive/zip/lzma.js +1 -40
  237. package/dist/safe-bash/commands/archive/zip/move.d.ts +1 -11
  238. package/dist/safe-bash/commands/archive/zip/move.js +1 -59
  239. package/dist/safe-bash/commands/archive/zip/names.d.ts +1 -2
  240. package/dist/safe-bash/commands/archive/zip/names.js +1 -33
  241. package/dist/safe-bash/commands/archive/zip/options.d.ts +1 -13
  242. package/dist/safe-bash/commands/archive/zip/options.js +1 -124
  243. package/dist/safe-bash/commands/archive/zip/repair.d.ts +1 -10
  244. package/dist/safe-bash/commands/archive/zip/repair.js +1 -392
  245. package/dist/safe-bash/commands/archive/zip/safety.d.ts +1 -54
  246. package/dist/safe-bash/commands/archive/zip/safety.js +1 -360
  247. package/dist/safe-bash/commands/archive/zip/sfx.d.ts +1 -4
  248. package/dist/safe-bash/commands/archive/zip/sfx.js +1 -52
  249. package/dist/safe-bash/commands/archive/zip/test-command.d.ts +1 -5
  250. package/dist/safe-bash/commands/archive/zip/test-command.js +1 -101
  251. package/dist/safe-bash/commands/archive/zip/volumes.d.ts +1 -21
  252. package/dist/safe-bash/commands/archive/zip/volumes.js +1 -281
  253. package/dist/safe-bash/commands/archive/zip/zip64.d.ts +1 -30
  254. package/dist/safe-bash/commands/archive/zip/zip64.js +1 -227
  255. package/dist/safe-bash/commands/archive/zip-format.d.ts +1 -68
  256. package/dist/safe-bash/commands/archive/zip-format.js +1 -1075
  257. package/dist/safe-bash/commands/archive/zip.d.ts +1 -3
  258. package/dist/safe-bash/commands/archive/zip.js +1 -1523
  259. package/dist/safe-bash/commands/awk/index.d.ts +2 -0
  260. package/dist/safe-bash/commands/awk/index.js +2 -0
  261. package/dist/safe-bash/commands/bytes/compression/index.js +2 -1
  262. package/dist/safe-bash/commands/curl/index.d.ts +2 -0
  263. package/dist/safe-bash/commands/curl/index.js +2 -0
  264. package/dist/safe-bash/commands/diff/index.d.ts +2 -0
  265. package/dist/safe-bash/commands/diff/index.js +2 -0
  266. package/dist/safe-bash/commands/diff-patch/diff-format.d.ts +1 -10
  267. package/dist/safe-bash/commands/diff-patch/diff-format.js +1 -237
  268. package/dist/safe-bash/commands/diff-patch/diff-options.d.ts +1 -38
  269. package/dist/safe-bash/commands/diff-patch/diff-options.js +1 -261
  270. package/dist/safe-bash/commands/diff-patch/diff-output.d.ts +1 -20
  271. package/dist/safe-bash/commands/diff-patch/diff-output.js +1 -290
  272. package/dist/safe-bash/commands/diff-patch/diff.d.ts +1 -2
  273. package/dist/safe-bash/commands/diff-patch/diff.js +1 -656
  274. package/dist/safe-bash/commands/diff-patch/index.d.ts +4 -5
  275. package/dist/safe-bash/commands/diff-patch/index.js +8 -333
  276. package/dist/safe-bash/commands/diff-patch/patch-envelope.d.ts +1 -2
  277. package/dist/safe-bash/commands/diff-patch/patch-envelope.js +1 -63
  278. package/dist/safe-bash/commands/diff-patch/patch-formats.d.ts +1 -7
  279. package/dist/safe-bash/commands/diff-patch/patch-formats.js +1 -264
  280. package/dist/safe-bash/commands/diff-patch/patch-gnu-paths.d.ts +1 -41
  281. package/dist/safe-bash/commands/diff-patch/patch-gnu-paths.js +1 -263
  282. package/dist/safe-bash/commands/diff-patch/patch-gnu-reject.d.ts +1 -3
  283. package/dist/safe-bash/commands/diff-patch/patch-gnu-reject.js +1 -100
  284. package/dist/safe-bash/commands/diff-patch/patch-path.d.ts +1 -3
  285. package/dist/safe-bash/commands/diff-patch/patch-path.js +1 -91
  286. package/dist/safe-bash/commands/diff-patch/patch-publication.d.ts +1 -13
  287. package/dist/safe-bash/commands/diff-patch/patch-publication.js +1 -107
  288. package/dist/safe-bash/commands/diff-patch/patch.d.ts +1 -2
  289. package/dist/safe-bash/commands/diff-patch/patch.js +1 -653
  290. package/dist/safe-bash/commands/diff-patch/shared.d.ts +1 -55
  291. package/dist/safe-bash/commands/diff-patch/shared.js +1 -276
  292. package/dist/safe-bash/commands/diff-patch/unified.d.ts +1 -52
  293. package/dist/safe-bash/commands/diff-patch/unified.js +1 -385
  294. package/dist/safe-bash/commands/directory-admission.d.ts +1 -3
  295. package/dist/safe-bash/commands/directory-admission.js +1 -26
  296. package/dist/safe-bash/commands/find/index.d.ts +2 -0
  297. package/dist/safe-bash/commands/find/index.js +2 -0
  298. package/dist/safe-bash/commands/find-format.d.ts +1 -20
  299. package/dist/safe-bash/commands/find-format.js +1 -161
  300. package/dist/safe-bash/commands/find.d.ts +2 -18
  301. package/dist/safe-bash/commands/find.js +2 -1236
  302. package/dist/safe-bash/commands/gzip/index.d.ts +2 -0
  303. package/dist/safe-bash/commands/gzip/index.js +2 -0
  304. package/dist/safe-bash/commands/line-endings/index.browser.js +1 -1
  305. package/dist/safe-bash/commands/line-endings/index.d.ts +1 -1
  306. package/dist/safe-bash/commands/line-endings/index.js +1 -262
  307. package/dist/safe-bash/commands/llm/index.browser.js +3 -1
  308. package/dist/safe-bash/commands/mdq/index.browser.js +2 -2
  309. package/dist/safe-bash/commands/metadata/chmod.d.ts +1 -4
  310. package/dist/safe-bash/commands/metadata/chmod.js +2 -63
  311. package/dist/safe-bash/commands/network/aggregate.d.ts +1 -4
  312. package/dist/safe-bash/commands/network/aggregate.js +1 -23
  313. package/dist/safe-bash/commands/network/args.d.ts +1 -68
  314. package/dist/safe-bash/commands/network/args.js +1 -321
  315. package/dist/safe-bash/commands/network/authorizer.d.ts +1 -6
  316. package/dist/safe-bash/commands/network/authorizer.js +1 -33
  317. package/dist/safe-bash/commands/network/body.d.ts +1 -9
  318. package/dist/safe-bash/commands/network/body.js +1 -393
  319. package/dist/safe-bash/commands/network/curl.d.ts +3 -13
  320. package/dist/safe-bash/commands/network/curl.js +6 -693
  321. package/dist/safe-bash/commands/network/deadline.d.ts +1 -2
  322. package/dist/safe-bash/commands/network/deadline.js +1 -14
  323. package/dist/safe-bash/commands/network/decode.d.ts +1 -2
  324. package/dist/safe-bash/commands/network/decode.js +1 -79
  325. package/dist/safe-bash/commands/network/fetch-transport.d.ts +1 -7
  326. package/dist/safe-bash/commands/network/fetch-transport.js +1 -94
  327. package/dist/safe-bash/commands/network/form-content-type.d.ts +1 -5
  328. package/dist/safe-bash/commands/network/form-content-type.js +1 -63
  329. package/dist/safe-bash/commands/network/form-headers.d.ts +1 -2
  330. package/dist/safe-bash/commands/network/form-headers.js +1 -35
  331. package/dist/safe-bash/commands/network/glob.d.ts +1 -7
  332. package/dist/safe-bash/commands/network/glob.js +1 -134
  333. package/dist/safe-bash/commands/network/index.browser.js +2 -10
  334. package/dist/safe-bash/commands/network/input.d.ts +1 -5
  335. package/dist/safe-bash/commands/network/input.js +1 -276
  336. package/dist/safe-bash/commands/network/output.d.ts +1 -6
  337. package/dist/safe-bash/commands/network/output.js +1 -131
  338. package/dist/safe-bash/commands/network/private-address.d.ts +1 -1
  339. package/dist/safe-bash/commands/network/private-address.js +1 -44
  340. package/dist/safe-bash/commands/network/shared.d.ts +1 -14
  341. package/dist/safe-bash/commands/network/shared.js +1 -71
  342. package/dist/safe-bash/commands/network/types.d.ts +1 -37
  343. package/dist/safe-bash/commands/network/types.js +1 -31
  344. package/dist/safe-bash/commands/network/url.d.ts +1 -2
  345. package/dist/safe-bash/commands/network/url.js +1 -30
  346. package/dist/safe-bash/commands/network/wget.d.ts +3 -3
  347. package/dist/safe-bash/commands/network/wget.js +10 -331
  348. package/dist/safe-bash/commands/node/index.browser.js +4 -5
  349. package/dist/safe-bash/commands/node/index.d.ts +3 -3
  350. package/dist/safe-bash/commands/node/index.js +5 -0
  351. package/dist/safe-bash/commands/node/safejs.d.ts +3 -3
  352. package/dist/safe-bash/commands/node/safejs.js +6 -1
  353. package/dist/safe-bash/commands/node/types.d.ts +1 -1
  354. package/dist/safe-bash/commands/node/unconfigured.d.ts +3 -0
  355. package/dist/safe-bash/commands/node/unconfigured.js +10 -0
  356. package/dist/safe-bash/commands/op/index.browser.js +2 -2
  357. package/dist/safe-bash/commands/patch/index.d.ts +2 -0
  358. package/dist/safe-bash/commands/patch/index.js +2 -0
  359. package/dist/safe-bash/commands/pdfinfo/index.js +2 -1
  360. package/dist/safe-bash/commands/predicates.js +3 -4
  361. package/dist/safe-bash/commands/python/index.browser.js +5 -5
  362. package/dist/safe-bash/commands/python/llm-capability.d.ts +1 -0
  363. package/dist/safe-bash/commands/python/llm-capability.js +27 -7
  364. package/dist/safe-bash/commands/python/llm-module.js +11 -0
  365. package/dist/safe-bash/commands/python/manifest.d.ts +1 -0
  366. package/dist/safe-bash/commands/python/manifest.js +9 -5
  367. package/dist/safe-bash/commands/python/provisioning.js +1 -1
  368. package/dist/safe-bash/commands/regex-execution/matching.js +1 -2
  369. package/dist/safe-bash/commands/regex-execution/public.browser.js +5 -5
  370. package/dist/safe-bash/commands/search/index.d.ts +1 -1
  371. package/dist/safe-bash/commands/search/index.js +1 -347
  372. package/dist/safe-bash/commands/search/portable.d.ts +2 -2
  373. package/dist/safe-bash/commands/search/portable.js +3 -2
  374. package/dist/safe-bash/commands/sed/index.d.ts +2 -0
  375. package/dist/safe-bash/commands/sed/index.js +2 -0
  376. package/dist/safe-bash/commands/tar/index.d.ts +2 -0
  377. package/dist/safe-bash/commands/tar/index.js +2 -0
  378. package/dist/safe-bash/commands/text-programs/awk-inspection.d.ts +1 -19
  379. package/dist/safe-bash/commands/text-programs/awk-inspection.js +1 -50
  380. package/dist/safe-bash/commands/text-programs/awk-pipes.d.ts +2 -0
  381. package/dist/safe-bash/commands/text-programs/awk-pipes.js +2 -0
  382. package/dist/safe-bash/commands/text-programs/awk-pretty.d.ts +1 -3
  383. package/dist/safe-bash/commands/text-programs/awk-pretty.js +1 -197
  384. package/dist/safe-bash/commands/text-programs/awk-quote.d.ts +1 -2
  385. package/dist/safe-bash/commands/text-programs/awk-quote.js +1 -15
  386. package/dist/safe-bash/commands/text-programs/awk-reader.d.ts +1 -42
  387. package/dist/safe-bash/commands/text-programs/awk-reader.js +1 -449
  388. package/dist/safe-bash/commands/text-programs/awk-retention.d.ts +1 -13
  389. package/dist/safe-bash/commands/text-programs/awk-retention.js +1 -51
  390. package/dist/safe-bash/commands/text-programs/awk-runtime.d.ts +1 -150
  391. package/dist/safe-bash/commands/text-programs/awk-runtime.js +1 -2627
  392. package/dist/safe-bash/commands/text-programs/awk-syntax.d.ts +1 -142
  393. package/dist/safe-bash/commands/text-programs/awk-syntax.js +1 -509
  394. package/dist/safe-bash/commands/text-programs/awk-values.d.ts +1 -32
  395. package/dist/safe-bash/commands/text-programs/awk-values.js +1 -386
  396. package/dist/safe-bash/commands/text-programs/awk.d.ts +1 -3
  397. package/dist/safe-bash/commands/text-programs/awk.js +1 -361
  398. package/dist/safe-bash/commands/text-programs/inplace.d.ts +1 -16
  399. package/dist/safe-bash/commands/text-programs/inplace.js +1 -155
  400. package/dist/safe-bash/commands/text-programs/sed.d.ts +1 -3
  401. package/dist/safe-bash/commands/text-programs/sed.js +1 -1647
  402. package/dist/safe-bash/commands/text.js +1 -25
  403. package/dist/safe-bash/commands/unzip/index.d.ts +2 -0
  404. package/dist/safe-bash/commands/unzip/index.js +2 -0
  405. package/dist/safe-bash/commands/wget/index.d.ts +2 -0
  406. package/dist/safe-bash/commands/wget/index.js +2 -0
  407. package/dist/safe-bash/commands/yq/index.browser.js +7 -2
  408. package/dist/safe-bash/commands/yq/index.d.ts +1 -6
  409. package/dist/safe-bash/commands/yq/index.js +1 -36
  410. package/dist/safe-bash/commands/zip/index.d.ts +2 -0
  411. package/dist/safe-bash/commands/zip/index.js +2 -0
  412. package/dist/safe-bash/core.browser.js +1 -1
  413. package/dist/safe-bash/core.d.ts +8 -1
  414. package/dist/safe-bash/core.js +7 -1
  415. package/dist/safe-bash/fs/s3/index.d.ts +2 -2
  416. package/dist/safe-bash/fs/s3/index.js +1 -1
  417. package/dist/safe-bash/full-core.browser.js +254 -223
  418. package/dist/safe-bash/jobs.browser.js +2 -2
  419. package/dist/safe-bash/lazy-mmdc.d.ts +6 -0
  420. package/dist/safe-bash/lazy-mmdc.js +23 -0
  421. package/dist/safe-bash/opt-in/commands/dd/index.js +4 -13
  422. package/dist/safe-bash/opt-in/commands/yq/mike.js +6 -13
  423. package/dist/safe-bash/opt-in/commands/yq/native-work.d.ts +1 -0
  424. package/dist/safe-bash/opt-in/commands/yq/native-work.js +19 -1
  425. package/dist/safe-bash/opt-in/optional/commands/shuf/input.js +3 -21
  426. package/dist/safe-bash/opt-in/optional/commands/shuf/shuf.js +4 -27
  427. package/dist/safe-bash/optional-host.browser.js +8 -4
  428. package/dist/safe-bash/optional-host.d.ts +1 -1
  429. package/dist/safe-bash/optional-host.js +1 -1
  430. package/dist/safe-bash/playwright/ability-execution.js +3 -2
  431. package/dist/safe-bash/playwright/adapter.js +1 -1
  432. package/dist/safe-bash/playwright/controller.js +9 -8
  433. package/dist/safe-bash/playwright/modal-capabilities.js +2 -1
  434. package/dist/safe-bash/playwright/native-json-snapshot.js +4 -3
  435. package/dist/safe-bash/playwright/native-snapshot.js +5 -4
  436. package/dist/safe-bash/playwright/open-options.js +3 -3
  437. package/dist/safe-bash/playwright/resource-limit.d.ts +2 -0
  438. package/dist/safe-bash/playwright/resource-limit.js +4 -0
  439. package/dist/safe-bash/playwright/session-configuration.js +8 -3
  440. package/dist/safe-bash/playwright/snapshot.js +8 -7
  441. package/dist/safe-bash/playwright/standard-capabilities.js +5 -4
  442. package/dist/safe-bash/plugins/index.browser.js +14 -16
  443. package/dist/safe-bash/registry-entry.browser.js +14 -16
  444. package/dist/safe-bash/shell/arrays/bindings.d.ts +3 -5
  445. package/dist/safe-bash/shell/arrays/bindings.js +6 -2
  446. package/dist/safe-bash/shell/input.js +16 -14
  447. package/dist/safe-bash/shell/runtime.d.ts +3 -0
  448. package/dist/safe-bash/shell/runtime.js +316 -64
  449. package/dist/safe-bash/shell/types.d.ts +2 -0
  450. package/dist/safe-bash/shell/value-state.js +17 -2
  451. package/dist/safe-bash/shell/worker-limits.js +1 -0
  452. package/dist/safe-bash/shell-entry.browser.js +13 -15
  453. package/dist/safe-bash/trap.browser.d.ts +3 -0
  454. package/dist/safe-bash/trap.browser.js +14 -0
  455. package/dist/safe-bash/worker/host.js +1 -1
  456. package/dist/safe-bash-command-apply-patch/apply.js +2 -2
  457. package/dist/safe-bash-command-apply-patch/index.js +3 -3
  458. package/dist/safe-bash-command-awk/LICENSE +21 -0
  459. package/dist/safe-bash-command-awk/awk-inspection.d.ts +19 -0
  460. package/dist/safe-bash-command-awk/awk-inspection.js +9 -0
  461. package/dist/safe-bash-command-awk/awk-pipes.d.ts +19 -0
  462. package/dist/safe-bash-command-awk/awk-pipes.js +8 -0
  463. package/dist/safe-bash-command-awk/awk-pretty.d.ts +3 -0
  464. package/dist/safe-bash-command-awk/awk-pretty.js +8 -0
  465. package/dist/safe-bash-command-awk/awk-quote.d.ts +2 -0
  466. package/dist/safe-bash-command-awk/awk-quote.js +7 -0
  467. package/dist/safe-bash-command-awk/awk-reader.d.ts +42 -0
  468. package/dist/safe-bash-command-awk/awk-reader.js +9 -0
  469. package/dist/safe-bash-command-awk/awk-retention.d.ts +13 -0
  470. package/dist/safe-bash-command-awk/awk-retention.js +7 -0
  471. package/dist/safe-bash-command-awk/awk-runtime.d.ts +151 -0
  472. package/dist/safe-bash-command-awk/awk-runtime.js +11 -0
  473. package/dist/safe-bash-command-awk/awk-syntax.d.ts +144 -0
  474. package/dist/safe-bash-command-awk/awk-syntax.js +14 -0
  475. package/dist/safe-bash-command-awk/awk-values.d.ts +32 -0
  476. package/dist/safe-bash-command-awk/awk-values.js +35 -0
  477. package/dist/safe-bash-command-awk/awk.d.ts +3 -0
  478. package/dist/safe-bash-command-awk/awk.js +16 -0
  479. package/dist/safe-bash-command-awk/index.d.ts +7 -0
  480. package/dist/safe-bash-command-awk/index.js +36 -0
  481. package/dist/safe-bash-command-bc/index.d.ts +4 -0
  482. package/dist/safe-bash-command-bc/index.js +15 -176
  483. package/dist/safe-bash-command-column/column.js +3 -3
  484. package/dist/safe-bash-command-column/index.js +3 -3
  485. package/dist/safe-bash-command-column/layout.js +2 -2
  486. package/dist/safe-bash-command-csplit/command.js +2 -2
  487. package/dist/safe-bash-command-csplit/index.js +2 -2
  488. package/dist/safe-bash-command-csvkit/contracts.d.ts +1 -0
  489. package/dist/safe-bash-command-csvkit/csvpy-interpreter.d.ts +2 -1
  490. package/dist/safe-bash-command-csvkit/default-csvpy.d.ts +11 -0
  491. package/dist/safe-bash-command-csvkit/errors.js +22 -0
  492. package/dist/safe-bash-command-csvkit/index.d.ts +1 -0
  493. package/dist/safe-bash-command-csvkit/index.js +172 -4
  494. package/dist/safe-bash-command-csvkit/python-worker-browser.d.ts +3 -0
  495. package/dist/safe-bash-command-csvkit/python-worker-browser.js +16 -0
  496. package/dist/safe-bash-command-csvkit/python-worker-contract.d.ts +20 -0
  497. package/dist/safe-bash-command-csvkit/python-worker-node.d.ts +3 -0
  498. package/dist/safe-bash-command-csvkit/python-worker-node.js +9 -0
  499. package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
  500. package/dist/safe-bash-command-curl/LICENSE +21 -0
  501. package/dist/safe-bash-command-curl/curl.d.ts +13 -0
  502. package/dist/safe-bash-command-curl/curl.js +9 -0
  503. package/dist/safe-bash-command-curl/index.d.ts +6 -0
  504. package/dist/safe-bash-command-curl/index.js +26 -0
  505. package/dist/safe-bash-command-dd/index.js +4 -13
  506. package/dist/safe-bash-command-diff/LICENSE +21 -0
  507. package/dist/safe-bash-command-diff/diff-format.d.ts +10 -0
  508. package/dist/safe-bash-command-diff/diff-format.js +10 -0
  509. package/dist/safe-bash-command-diff/diff-options.d.ts +38 -0
  510. package/dist/safe-bash-command-diff/diff-options.js +7 -0
  511. package/dist/safe-bash-command-diff/diff-output.d.ts +20 -0
  512. package/dist/safe-bash-command-diff/diff-output.js +19 -0
  513. package/dist/safe-bash-command-diff/diff.d.ts +2 -0
  514. package/dist/safe-bash-command-diff/diff.js +10 -0
  515. package/dist/safe-bash-command-diff/index.d.ts +8 -0
  516. package/dist/safe-bash-command-diff/index.js +34 -0
  517. package/dist/safe-bash-command-diff/sync.d.ts +2 -0
  518. package/dist/safe-bash-command-diff/sync.js +9 -0
  519. package/dist/safe-bash-command-diff3/index.js +5 -5
  520. package/dist/safe-bash-command-docx/index.d.ts +4 -4
  521. package/dist/safe-bash-command-docx/index.js +12 -5
  522. package/dist/safe-bash-command-dos2unix/index.d.ts +1 -0
  523. package/dist/safe-bash-command-dos2unix/index.js +225 -1
  524. package/dist/safe-bash-command-dos2unix/sync.d.ts +1 -0
  525. package/dist/safe-bash-command-du/budget.d.ts +0 -2
  526. package/dist/safe-bash-command-du/budget.js +1 -1
  527. package/dist/safe-bash-command-du/du.js +2 -2
  528. package/dist/safe-bash-command-du/index.js +2 -2
  529. package/dist/safe-bash-command-exiftool/index.js +2 -2
  530. package/dist/safe-bash-command-factor/command.js +2 -2
  531. package/dist/safe-bash-command-factor/index.js +2 -2
  532. package/dist/safe-bash-command-ffmpeg/index.js +86 -94
  533. package/dist/safe-bash-command-file/index.js +4 -4
  534. package/dist/safe-bash-command-file/shared.d.ts +0 -2
  535. package/dist/safe-bash-command-file/shared.js +1 -1
  536. package/dist/safe-bash-command-find/LICENSE +21 -0
  537. package/dist/safe-bash-command-find/find-format.d.ts +20 -0
  538. package/dist/safe-bash-command-find/find-format.js +9 -0
  539. package/dist/safe-bash-command-find/find.d.ts +18 -0
  540. package/dist/safe-bash-command-find/find.js +10 -0
  541. package/dist/safe-bash-command-find/index.d.ts +13 -0
  542. package/dist/safe-bash-command-find/index.js +45 -0
  543. package/dist/safe-bash-command-fmt/index.js +10 -19
  544. package/dist/safe-bash-command-git/git_rust.wasm +0 -0
  545. package/dist/safe-bash-command-git/index.js +5 -7
  546. package/dist/safe-bash-command-git/wasm.generated.js +1 -1
  547. package/dist/safe-bash-command-gzip/LICENSE +21 -0
  548. package/dist/safe-bash-command-gzip/index.d.ts +11 -0
  549. package/dist/safe-bash-command-gzip/index.js +94 -0
  550. package/dist/safe-bash-command-html-to-markdown/budget.d.ts +0 -3
  551. package/dist/safe-bash-command-html-to-markdown/budget.js +1 -1
  552. package/dist/safe-bash-command-html-to-markdown/entities.js +3 -3
  553. package/dist/safe-bash-command-html-to-markdown/index.js +11 -11
  554. package/dist/safe-bash-command-html-to-markdown/input.js +5 -5
  555. package/dist/safe-bash-command-html-to-markdown/parser.js +4 -4
  556. package/dist/safe-bash-command-html-to-markdown/render.js +5 -5
  557. package/dist/safe-bash-command-html-to-markdown/text.js +2 -2
  558. package/dist/safe-bash-command-htmlq/index.js +12 -8
  559. package/dist/safe-bash-command-iconv/command.js +5 -5
  560. package/dist/safe-bash-command-iconv/index.js +5 -5
  561. package/dist/safe-bash-command-iconv/internal.d.ts +0 -2
  562. package/dist/safe-bash-command-iconv/internal.js +1 -1
  563. package/dist/safe-bash-command-iconv/lifecycle.js +2 -2
  564. package/dist/safe-bash-command-iconv/options.js +2 -2
  565. package/dist/safe-bash-command-iconv/reader.js +2 -2
  566. package/dist/safe-bash-command-imagemagick/index.js +22 -30
  567. package/dist/safe-bash-command-jq/index.js +1 -1
  568. package/dist/safe-bash-command-jq/jq.js +1 -1
  569. package/dist/safe-bash-command-llm/command.js +1 -1
  570. package/dist/safe-bash-command-llm/index.d.ts +1 -0
  571. package/dist/safe-bash-command-llm/index.js +16 -14
  572. package/dist/safe-bash-command-llm/openai.js +3 -3
  573. package/dist/safe-bash-command-llm/providers/index.js +3 -3
  574. package/dist/safe-bash-command-llm/providers/openai.js +3 -3
  575. package/dist/safe-bash-command-llm/stored-schema.d.ts +10 -0
  576. package/dist/safe-bash-command-mmdc/index.js +13 -604
  577. package/dist/safe-bash-command-mmdc/settings.d.ts +2 -0
  578. package/dist/safe-bash-command-mmdc/settings.js +7 -0
  579. package/dist/safe-bash-command-numfmt/index.js +4 -18
  580. package/dist/safe-bash-command-pandoc/command.js +4 -3
  581. package/dist/safe-bash-command-pandoc/defaults.d.ts +1 -0
  582. package/dist/safe-bash-command-pandoc/index.js +4 -3
  583. package/dist/safe-bash-command-pandoc/lua-filters.js +1 -1
  584. package/dist/safe-bash-command-pandoc/types.d.ts +3 -1
  585. package/dist/safe-bash-command-patch/LICENSE +21 -0
  586. package/dist/safe-bash-command-patch/index.d.ts +8 -0
  587. package/dist/safe-bash-command-patch/index.js +38 -0
  588. package/dist/safe-bash-command-patch/patch-envelope.d.ts +2 -0
  589. package/dist/safe-bash-command-patch/patch-envelope.js +7 -0
  590. package/dist/safe-bash-command-patch/patch-formats.d.ts +7 -0
  591. package/dist/safe-bash-command-patch/patch-formats.js +9 -0
  592. package/dist/safe-bash-command-patch/patch-gnu-paths.d.ts +41 -0
  593. package/dist/safe-bash-command-patch/patch-gnu-paths.js +26 -0
  594. package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +3 -0
  595. package/dist/safe-bash-command-patch/patch-gnu-reject.js +7 -0
  596. package/dist/safe-bash-command-patch/patch-path.d.ts +3 -0
  597. package/dist/safe-bash-command-patch/patch-path.js +11 -0
  598. package/dist/safe-bash-command-patch/patch-publication.d.ts +13 -0
  599. package/dist/safe-bash-command-patch/patch-publication.js +7 -0
  600. package/dist/safe-bash-command-patch/patch.d.ts +2 -0
  601. package/dist/safe-bash-command-patch/patch.js +14 -0
  602. package/dist/safe-bash-command-patch/sync.d.ts +2 -0
  603. package/dist/safe-bash-command-patch/sync.js +7 -0
  604. package/dist/safe-bash-command-patch/unified.d.ts +52 -0
  605. package/dist/safe-bash-command-patch/unified.js +16 -0
  606. package/dist/safe-bash-command-pdfimages/index.js +37 -16
  607. package/dist/safe-bash-command-pdfinfo/index.d.ts +0 -23
  608. package/dist/safe-bash-command-pdfinfo/index.js +20 -772
  609. package/dist/safe-bash-command-pdftk/index.js +37 -9
  610. package/dist/safe-bash-command-pdftoppm/index.js +50 -20
  611. package/dist/safe-bash-command-pdftotext/index.js +10 -2
  612. package/dist/safe-bash-command-pptx/index.d.ts +4 -4
  613. package/dist/safe-bash-command-pptx/index.js +11 -5
  614. package/dist/safe-bash-command-pr/command.js +5 -5
  615. package/dist/safe-bash-command-pr/format.js +2 -2
  616. package/dist/safe-bash-command-pr/index.js +7 -7
  617. package/dist/safe-bash-command-pr/internal.d.ts +0 -2
  618. package/dist/safe-bash-command-pr/internal.js +1 -1
  619. package/dist/safe-bash-command-pr/io.js +2 -2
  620. package/dist/safe-bash-command-pr/options.js +2 -2
  621. package/dist/safe-bash-command-qpdf/index.js +26 -13
  622. package/dist/safe-bash-command-rg/index.d.ts +1 -0
  623. package/dist/safe-bash-command-rg/index.js +222 -1
  624. package/dist/safe-bash-command-rg/rg-command.js +1 -1
  625. package/dist/safe-bash-command-rg/sync.d.ts +1 -0
  626. package/dist/safe-bash-command-sed/LICENSE +21 -0
  627. package/dist/safe-bash-command-sed/index.d.ts +7 -0
  628. package/dist/safe-bash-command-sed/index.js +28 -0
  629. package/dist/safe-bash-command-sed/inplace.d.ts +16 -0
  630. package/dist/safe-bash-command-sed/inplace.js +9 -0
  631. package/dist/safe-bash-command-sed/sed.d.ts +3 -0
  632. package/dist/safe-bash-command-sed/sed.js +8 -0
  633. package/dist/safe-bash-command-shuf/input.js +3 -21
  634. package/dist/safe-bash-command-shuf/shuf.js +4 -27
  635. package/dist/safe-bash-command-sips/index.js +111 -35
  636. package/dist/safe-bash-command-soffice/index.js +4 -4
  637. package/dist/safe-bash-command-split/index.js +3 -3
  638. package/dist/safe-bash-command-split/io.d.ts +0 -2
  639. package/dist/safe-bash-command-split/io.js +1 -1
  640. package/dist/safe-bash-command-split/outputs.js +2 -2
  641. package/dist/safe-bash-command-split/split.js +3 -3
  642. package/dist/safe-bash-command-sqlite3/engine.d.ts +1 -2
  643. package/dist/safe-bash-command-sqlite3/index.js +152 -452
  644. package/dist/safe-bash-command-ssconvert/commands.js +1 -1
  645. package/dist/safe-bash-command-ssconvert/formats/ods.js +2 -2
  646. package/dist/safe-bash-command-ssconvert/formats/xlsx.js +3 -3
  647. package/dist/safe-bash-command-ssconvert/index.js +5 -5
  648. package/dist/safe-bash-command-tar/LICENSE +21 -0
  649. package/dist/safe-bash-command-tar/create.d.ts +17 -0
  650. package/dist/safe-bash-command-tar/create.js +14 -0
  651. package/dist/safe-bash-command-tar/extract.d.ts +11 -0
  652. package/dist/safe-bash-command-tar/extract.js +14 -0
  653. package/dist/safe-bash-command-tar/format.d.ts +32 -0
  654. package/dist/safe-bash-command-tar/format.js +19 -0
  655. package/dist/safe-bash-command-tar/index.d.ts +8 -0
  656. package/dist/safe-bash-command-tar/index.js +550 -0
  657. package/dist/safe-bash-command-tar/listing.d.ts +2 -0
  658. package/dist/safe-bash-command-tar/listing.js +7 -0
  659. package/dist/safe-bash-command-tar/modes.d.ts +5 -0
  660. package/dist/safe-bash-command-tar/modes.js +16 -0
  661. package/dist/safe-bash-command-tar/options.d.ts +53 -0
  662. package/dist/safe-bash-command-tar/options.js +10 -0
  663. package/dist/safe-bash-command-tar/stream.d.ts +22 -0
  664. package/dist/safe-bash-command-tar/stream.js +15 -0
  665. package/dist/safe-bash-command-tar/transform.d.ts +16 -0
  666. package/dist/safe-bash-command-tar/transform.js +9 -0
  667. package/dist/safe-bash-command-tree/arguments.js +3 -3
  668. package/dist/safe-bash-command-tree/charset.js +1 -1
  669. package/dist/safe-bash-command-tree/index.js +4 -4
  670. package/dist/safe-bash-command-tree/io.d.ts +0 -1
  671. package/dist/safe-bash-command-tree/io.js +1 -1
  672. package/dist/safe-bash-command-tree/pattern.js +2 -2
  673. package/dist/safe-bash-command-tree/tree.js +4 -4
  674. package/dist/safe-bash-command-tsort/command.js +4 -4
  675. package/dist/safe-bash-command-tsort/graph.js +2 -2
  676. package/dist/safe-bash-command-tsort/index.js +4 -4
  677. package/dist/safe-bash-command-tsort/internal.d.ts +0 -2
  678. package/dist/safe-bash-command-tsort/internal.js +1 -1
  679. package/dist/safe-bash-command-tsort/io.js +2 -2
  680. package/dist/safe-bash-command-unzip/LICENSE +21 -0
  681. package/dist/safe-bash-command-unzip/index.d.ts +7 -0
  682. package/dist/safe-bash-command-unzip/index.js +39 -0
  683. package/dist/safe-bash-command-unzip/sync.d.ts +3 -0
  684. package/dist/safe-bash-command-unzip/sync.js +9 -0
  685. package/dist/safe-bash-command-unzip/unzip/safety.d.ts +32 -0
  686. package/dist/safe-bash-command-unzip/unzip/safety.js +7 -0
  687. package/dist/safe-bash-command-unzip/unzip.d.ts +3 -0
  688. package/dist/safe-bash-command-unzip/unzip.js +8 -0
  689. package/dist/safe-bash-command-wget/LICENSE +21 -0
  690. package/dist/safe-bash-command-wget/index.d.ts +6 -0
  691. package/dist/safe-bash-command-wget/index.js +26 -0
  692. package/dist/safe-bash-command-wget/wget.d.ts +3 -0
  693. package/dist/safe-bash-command-wget/wget.js +7 -0
  694. package/dist/safe-bash-command-xan/argv.d.ts +4 -1
  695. package/dist/safe-bash-command-xan/argv.js +1 -1
  696. package/dist/safe-bash-command-xan/commands.js +4 -3
  697. package/dist/safe-bash-command-xan/index.js +15 -14
  698. package/dist/safe-bash-command-xan/io.js +2 -2
  699. package/dist/safe-bash-command-xmllint/index.js +189 -49
  700. package/dist/safe-bash-command-xz/index.js +3 -2
  701. package/dist/safe-bash-command-xz/options.d.ts +9 -1
  702. package/dist/safe-bash-command-xz/options.js +3 -1
  703. package/dist/safe-bash-command-yq/index.d.ts +4 -11
  704. package/dist/safe-bash-command-yq/index.js +3367 -670
  705. package/dist/safe-bash-command-yq/mike.js +6 -13
  706. package/dist/safe-bash-command-yq/native-work.d.ts +1 -0
  707. package/dist/safe-bash-command-yq/native-work.js +19 -1
  708. package/dist/safe-bash-command-yq/query.d.ts +11 -0
  709. package/dist/safe-bash-command-yq/query.js +735 -0
  710. package/dist/safe-bash-command-zip/LICENSE +21 -0
  711. package/dist/safe-bash-command-zip/index.d.ts +7 -0
  712. package/dist/safe-bash-command-zip/index.js +38 -0
  713. package/dist/safe-bash-command-zip/sync.d.ts +3 -0
  714. package/dist/safe-bash-command-zip/sync.js +9 -0
  715. package/dist/safe-bash-command-zip/zip.d.ts +3 -0
  716. package/dist/safe-bash-command-zip/zip.js +7 -0
  717. package/dist/safe-bash-compression-engine/files.js +4 -4
  718. package/dist/safe-bash-compression-engine/index.js +2 -2
  719. package/dist/safe-bash-compression-engine/operand.js +6 -6
  720. package/dist/safe-bash-compression-engine/stream.js +2 -2
  721. package/dist/safe-bash-compression-engine/zstd-decode.js +1 -1
  722. package/dist/safe-bash-contracts/command.js +1 -1
  723. package/dist/safe-bash-contracts/diagnostics.js +4 -4
  724. package/dist/safe-bash-contracts/escaping.js +11 -11
  725. package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
  726. package/dist/safe-bash-contracts/filesystem-output.js +8 -8
  727. package/dist/safe-bash-contracts/index.js +34 -34
  728. package/dist/safe-bash-contracts/io.js +2 -2
  729. package/dist/safe-bash-contracts/output.js +3 -3
  730. package/dist/safe-bash-diff-engine/LICENSE +21 -0
  731. package/dist/safe-bash-diff-engine/index.d.ts +1 -0
  732. package/dist/safe-bash-diff-engine/index.js +24 -0
  733. package/dist/safe-bash-diff-engine/shared.d.ts +53 -0
  734. package/dist/safe-bash-diff-engine/shared.js +19 -0
  735. package/dist/safe-bash-io-engine/commands/archive/internal.d.ts +0 -1
  736. package/dist/safe-bash-io-engine/commands/archive/internal.js +3 -7
  737. package/dist/safe-bash-io-engine/commands/directory-admission.d.ts +3 -0
  738. package/dist/safe-bash-io-engine/commands/directory-admission.js +34 -0
  739. package/dist/safe-bash-io-engine/commands/mode-change.d.ts +4 -0
  740. package/dist/safe-bash-io-engine/commands/mode-change.js +60 -0
  741. package/dist/safe-bash-io-engine/commands/text-programs/shared.js +20 -31
  742. package/dist/safe-bash-io-engine/shell/pattern.js +8 -13
  743. package/dist/safe-bash-io-engine/shell/string-operations.d.ts +0 -2
  744. package/dist/safe-bash-io-engine/shell/string-operations.js +1 -1
  745. package/dist/safe-bash-line-ending-engine/internal.d.ts +0 -2
  746. package/dist/safe-bash-line-ending-engine/internal.js +1 -9
  747. package/dist/safe-bash-markdown-engine/commonmark-blocks.js +4 -4
  748. package/dist/safe-bash-markdown-engine/commonmark-inlines.js +4 -4
  749. package/dist/safe-bash-markdown-engine/commonmark-syntax.js +2 -2
  750. package/dist/safe-bash-markdown-engine/gfm-syntax.js +3 -3
  751. package/dist/safe-bash-markdown-engine/index.js +7 -7
  752. package/dist/safe-bash-mcp/index.browser.d.ts +6 -0
  753. package/dist/safe-bash-mcp/index.browser.js +1 -0
  754. package/dist/safe-bash-mcp/index.d.ts +12 -0
  755. package/dist/safe-bash-mcp/index.js +1558 -36
  756. package/dist/safe-bash-network-engine/LICENSE +21 -0
  757. package/dist/safe-bash-network-engine/aggregate.d.ts +4 -0
  758. package/dist/safe-bash-network-engine/aggregate.js +37 -0
  759. package/dist/safe-bash-network-engine/args.d.ts +68 -0
  760. package/dist/safe-bash-network-engine/args.js +19 -0
  761. package/dist/safe-bash-network-engine/authorizer.d.ts +6 -0
  762. package/dist/safe-bash-network-engine/authorizer.js +8 -0
  763. package/dist/safe-bash-network-engine/body.d.ts +9 -0
  764. package/dist/safe-bash-network-engine/body.js +374 -0
  765. package/dist/safe-bash-network-engine/deadline.d.ts +2 -0
  766. package/dist/safe-bash-network-engine/deadline.js +7 -0
  767. package/dist/safe-bash-network-engine/decode.d.ts +2 -0
  768. package/dist/safe-bash-network-engine/decode.js +81 -0
  769. package/dist/safe-bash-network-engine/fetch-transport.d.ts +7 -0
  770. package/dist/safe-bash-network-engine/fetch-transport.js +9 -0
  771. package/dist/safe-bash-network-engine/form-content-type.d.ts +5 -0
  772. package/dist/safe-bash-network-engine/form-content-type.js +8 -0
  773. package/dist/safe-bash-network-engine/form-headers.d.ts +2 -0
  774. package/dist/safe-bash-network-engine/form-headers.js +10 -0
  775. package/dist/safe-bash-network-engine/glob.d.ts +7 -0
  776. package/dist/safe-bash-network-engine/glob.js +124 -0
  777. package/dist/safe-bash-network-engine/index.d.ts +3 -0
  778. package/dist/safe-bash-network-engine/index.js +26 -0
  779. package/dist/safe-bash-network-engine/input.d.ts +5 -0
  780. package/dist/safe-bash-network-engine/input.js +255 -0
  781. package/dist/safe-bash-network-engine/output.d.ts +6 -0
  782. package/dist/safe-bash-network-engine/output.js +132 -0
  783. package/dist/safe-bash-network-engine/platform-portable.d.ts +5 -0
  784. package/dist/safe-bash-network-engine/platform-portable.js +19 -0
  785. package/dist/safe-bash-network-engine/private-address.d.ts +1 -0
  786. package/dist/safe-bash-network-engine/private-address.js +7 -0
  787. package/dist/safe-bash-network-engine/shared.d.ts +14 -0
  788. package/dist/safe-bash-network-engine/shared.js +23 -0
  789. package/dist/safe-bash-network-engine/types.d.ts +37 -0
  790. package/dist/safe-bash-network-engine/types.js +11 -0
  791. package/dist/safe-bash-network-engine/url.d.ts +2 -0
  792. package/dist/safe-bash-network-engine/url.js +8 -0
  793. package/dist/safe-bash-query-engine/capture.d.ts +1 -0
  794. package/dist/safe-bash-query-engine/capture.js +9 -7
  795. package/dist/safe-bash-query-engine/dates.d.ts +5 -1
  796. package/dist/safe-bash-query-engine/dates.js +10 -2
  797. package/dist/safe-bash-query-engine/delpaths.js +5 -5
  798. package/dist/safe-bash-query-engine/formats.js +3 -3
  799. package/dist/safe-bash-query-engine/index.js +15 -15
  800. package/dist/safe-bash-query-engine/indices.js +5 -5
  801. package/dist/safe-bash-query-engine/input.d.ts +1 -2
  802. package/dist/safe-bash-query-engine/input.js +2 -4
  803. package/dist/safe-bash-query-engine/interpreter.d.ts +5 -0
  804. package/dist/safe-bash-query-engine/interpreter.js +13 -13
  805. package/dist/safe-bash-query-engine/limits.js +1 -1
  806. package/dist/safe-bash-query-engine/parser.d.ts +8 -1
  807. package/dist/safe-bash-query-engine/parser.js +2 -2
  808. package/dist/safe-bash-query-engine/query-core.js +15 -15
  809. package/dist/safe-bash-query-engine/recurse.js +2 -2
  810. package/dist/safe-bash-query-engine/regex.d.ts +4 -2
  811. package/dist/safe-bash-query-engine/regex.js +10 -5
  812. package/dist/safe-bash-query-engine/split.js +2 -2
  813. package/dist/safe-bash-query-engine/splits.d.ts +1 -1
  814. package/dist/safe-bash-query-engine/splits.js +7 -6
  815. package/dist/safe-bash-query-engine/values.js +4 -4
  816. package/dist/safe-bash-regex-engine/ere/limits.d.ts +0 -1
  817. package/dist/safe-bash-regex-engine/ere/limits.js +1 -1
  818. package/dist/safe-bash-regex-engine/ere/matcher.js +9 -9
  819. package/dist/safe-bash-regex-engine/ere/syntax.js +2 -2
  820. package/dist/safe-bash-regex-engine/execution/bounded-provider.js +2 -4
  821. package/dist/safe-bash-regex-engine/index.js +2 -2
  822. package/dist/safe-bash-regex-engine/text/regex.d.ts +1 -0
  823. package/dist/safe-bash-regex-engine/text/regex.js +2 -2
  824. package/dist/safe-bash-search-engine/ergonomic-regex.d.ts +12 -2
  825. package/dist/safe-bash-search-engine/ergonomic-regex.js +2 -2
  826. package/dist/safe-bash-search-engine/glob.js +2 -2
  827. package/dist/safe-bash-search-engine/grep.js +2 -2
  828. package/dist/safe-bash-search-engine/matcher.d.ts +6 -2
  829. package/dist/safe-bash-search-engine/matcher.js +30 -8
  830. package/dist/safe-bash-search-engine/options.js +1 -1
  831. package/dist/safe-bash-search-engine/output.d.ts +3 -2
  832. package/dist/safe-bash-search-engine/output.js +111 -30
  833. package/dist/safe-bash-search-engine/shared.d.ts +2 -0
  834. package/dist/safe-bash-search-engine/shared.js +2 -2
  835. package/dist/safe-bash-search-engine/walk.js +11 -10
  836. package/dist/safe-bash-text-stream-engine/stream-format/shared.d.ts +0 -2
  837. package/dist/safe-bash-text-stream-engine/stream-format/shared.js +1 -9
  838. package/dist/safe-bash-xml-engine/document.d.ts +1 -1
  839. package/dist/safe-bash-xml-engine/document.js +3 -3
  840. package/dist/safe-bash-xml-engine/evaluate.d.ts +1 -0
  841. package/dist/safe-bash-xml-engine/evaluate.js +4 -1
  842. package/dist/safe-bash-xml-engine/index.js +8 -6
  843. package/dist/safe-bash-xml-engine/io.js +1 -1
  844. package/dist/safe-bash-xml-engine/limits.d.ts +2 -2
  845. package/dist/safe-bash-xml-engine/limits.js +1 -1
  846. package/dist/safe-bash-xml-engine/predicate.d.ts +57 -0
  847. package/dist/safe-bash-xml-engine/query.d.ts +3 -15
  848. package/dist/safe-bash-xml-engine/query.js +3 -2
  849. package/dist/safe-bash-zip-engine/LICENSE +21 -0
  850. package/dist/safe-bash-zip-engine/index.d.ts +1 -0
  851. package/dist/safe-bash-zip-engine/index.js +32 -0
  852. package/dist/safe-bash-zip-engine/unzip/arguments.d.ts +53 -0
  853. package/dist/safe-bash-zip-engine/unzip/arguments.js +270 -0
  854. package/dist/safe-bash-zip-engine/zip/aes.d.ts +17 -0
  855. package/dist/safe-bash-zip-engine/zip/aes.js +15 -0
  856. package/dist/safe-bash-zip-engine/zip/comments.d.ts +17 -0
  857. package/dist/safe-bash-zip-engine/zip/comments.js +77 -0
  858. package/dist/safe-bash-zip-engine/zip/crc.d.ts +1 -0
  859. package/dist/safe-bash-zip-engine/zip/crc.js +7 -0
  860. package/dist/safe-bash-zip-engine/zip/crypto.d.ts +19 -0
  861. package/dist/safe-bash-zip-engine/zip/crypto.js +16 -0
  862. package/dist/safe-bash-zip-engine/zip/dates.d.ts +4 -0
  863. package/dist/safe-bash-zip-engine/zip/dates.js +68 -0
  864. package/dist/safe-bash-zip-engine/zip/environment.d.ts +2 -0
  865. package/dist/safe-bash-zip-engine/zip/environment.js +60 -0
  866. package/dist/safe-bash-zip-engine/zip/grow.d.ts +3 -0
  867. package/dist/safe-bash-zip-engine/zip/grow.js +7 -0
  868. package/dist/safe-bash-zip-engine/zip/help.d.ts +4 -0
  869. package/dist/safe-bash-zip-engine/zip/help.js +194 -0
  870. package/dist/safe-bash-zip-engine/zip/line-endings.d.ts +2 -0
  871. package/dist/safe-bash-zip-engine/zip/line-endings.js +165 -0
  872. package/dist/safe-bash-zip-engine/zip/log.d.ts +22 -0
  873. package/dist/safe-bash-zip-engine/zip/log.js +153 -0
  874. package/dist/safe-bash-zip-engine/zip/lzma.d.ts +9 -0
  875. package/dist/safe-bash-zip-engine/zip/lzma.js +7 -0
  876. package/dist/safe-bash-zip-engine/zip/move.d.ts +11 -0
  877. package/dist/safe-bash-zip-engine/zip/move.js +57 -0
  878. package/dist/safe-bash-zip-engine/zip/names.d.ts +2 -0
  879. package/dist/safe-bash-zip-engine/zip/names.js +37 -0
  880. package/dist/safe-bash-zip-engine/zip/options.d.ts +13 -0
  881. package/dist/safe-bash-zip-engine/zip/options.js +23 -0
  882. package/dist/safe-bash-zip-engine/zip/repair.d.ts +10 -0
  883. package/dist/safe-bash-zip-engine/zip/repair.js +348 -0
  884. package/dist/safe-bash-zip-engine/zip/safety.d.ts +54 -0
  885. package/dist/safe-bash-zip-engine/zip/safety.js +19 -0
  886. package/dist/safe-bash-zip-engine/zip/sfx.d.ts +4 -0
  887. package/dist/safe-bash-zip-engine/zip/sfx.js +58 -0
  888. package/dist/safe-bash-zip-engine/zip/test-command.d.ts +5 -0
  889. package/dist/safe-bash-zip-engine/zip/test-command.js +98 -0
  890. package/dist/safe-bash-zip-engine/zip/volumes.d.ts +21 -0
  891. package/dist/safe-bash-zip-engine/zip/volumes.js +255 -0
  892. package/dist/safe-bash-zip-engine/zip/zip64.d.ts +30 -0
  893. package/dist/safe-bash-zip-engine/zip/zip64.js +25 -0
  894. package/dist/safe-bash-zip-engine/zip-format.d.ts +68 -0
  895. package/dist/safe-bash-zip-engine/zip-format.js +27 -0
  896. package/dist/safe-playwright-cloudflare/browser-codegen.generated.d.ts +7 -7
  897. package/dist/safe-playwright-cloudflare/browser-codegen.generated.js +866 -8069
  898. package/dist/safe-playwright-cloudflare/browser-run-code-budget.d.ts +0 -1
  899. package/dist/safe-playwright-cloudflare/browser-run-code-budget.js +0 -2
  900. package/dist/safe-playwright-cloudflare/browser-trace-archive.d.ts +5 -1
  901. package/dist/safe-playwright-cloudflare/browser-trace-archive.js +2 -1
  902. package/dist/safe-playwright-cloudflare/browser-trace-budget.js +2 -2
  903. package/dist/safe-playwright-cloudflare/shell-browser-resource.d.ts +2 -0
  904. package/dist/safe-playwright-cloudflare/shell-browser-resource.js +3 -11
  905. package/dist/safe-playwright-cloudflare/shell-playwright.d.ts +2 -0
  906. package/dist/safe-playwright-cloudflare/shell-playwright.js +1 -1
  907. package/dist/spreadsheet-engine/io/publication.d.ts +1 -0
  908. package/package.json +163 -14
  909. package/dist/safe-bash/chunks/chunk-O4ZUCRGN.js +0 -13
  910. package/dist/safe-bash/chunks/chunk-S264DZO2.js +0 -243
  911. package/dist/safe-bash/chunks/chunk-WVG5SHHQ.js +0 -12
  912. package/dist/safe-bash/chunks/chunk-XH26YVGW.js +0 -23027
  913. package/dist/safe-bash/chunks/chunk-ZW6K2J7P.js +0 -2652
  914. package/dist/safe-bash/command-chunks/chunk-BIXLZ3OG.js +0 -14342
  915. package/dist/safe-bash/command-chunks/chunk-DUYJE2HY.js +0 -14
  916. package/dist/safe-bash/command-chunks/chunk-JHVZYB4R.js +0 -181
  917. package/dist/safe-bash/command-chunks/chunk-ULZ7HIZP.js +0 -40
  918. package/dist/safe-bash/command-chunks/chunk-XS3PGJU2.js +0 -343
  919. package/dist/safe-bash/command-chunks/chunk-XTZALMLR.js +0 -488
  920. package/dist/safe-bash/commands/archive/zip/aes-primitives-unavailable.d.ts +0 -2
  921. package/dist/safe-bash/commands/archive/zip/aes-primitives-unavailable.js +0 -3
  922. package/dist/safe-bash/commands/archive/zip/aes-primitives.d.ts +0 -2
  923. package/dist/safe-bash/commands/archive/zip/aes-primitives.js +0 -3
  924. package/dist/safe-bash/commands/xml/document.d.ts +0 -2
  925. package/dist/safe-bash/commands/xml/document.js +0 -2
  926. package/dist/safe-bash/commands/xml/evaluate.d.ts +0 -2
  927. package/dist/safe-bash/commands/xml/evaluate.js +0 -2
  928. package/dist/safe-bash/commands/xml/json.d.ts +0 -2
  929. package/dist/safe-bash/commands/xml/json.js +0 -2
  930. package/dist/safe-bash/commands/xml/limits.d.ts +0 -2
  931. package/dist/safe-bash/commands/xml/limits.js +0 -2
  932. package/dist/safe-bash/commands/xml/query.d.ts +0 -2
  933. package/dist/safe-bash/commands/xml/query.js +0 -2
  934. package/dist/safe-bash/chunks/{chunk-NHOXKQNE.js → chunk-QVSRRNZT.js} +3 -3
  935. package/dist/safe-bash/command-chunks/{chunk-FIUFIDAO.js → chunk-2JRBIDAD.js} +3 -3
  936. package/dist/safe-bash/command-chunks/{chunk-TYVCKQDH.js → chunk-J5SN3PZ3.js} +3 -3
  937. package/dist/safe-bash/command-chunks/{chunk-2ENZ6JGA.js → chunk-KEV7C3KH.js} +3 -3
  938. package/dist/safe-bash/command-chunks/{chunk-S62HELHU.js → chunk-PL6O4K6W.js} +3 -3
  939. package/dist/safe-bash/command-chunks/{chunk-2WRTLCGK.js → chunk-QZF3SINC.js} +4 -4
  940. package/dist/safe-bash/command-chunks/{chunk-X7TM3AKW.js → chunk-U6G67N23.js} +3 -3
  941. package/dist/safe-bash/command-chunks/{chunk-DDLQ5YDB.js → chunk-YHFXOX6U.js} +9 -9
  942. package/dist/safe-bash/command-chunks/{chunk-DQMOM72Z.js → chunk-ZRRBXU3M.js} +4 -4
@@ -236,6 +236,7 @@ function snapshotLoopbackAuthorizationOptions(options) {
236
236
  ...options,
237
237
  openBrowser: options.openBrowser?.bind(options),
238
238
  readLine: options.readLine?.bind(options),
239
+ waitForCallback: options.waitForCallback?.bind(options),
239
240
  createServer: options.createServer?.bind(options),
240
241
  callbackPath: options.callbackPath,
241
242
  redirectUri: options.redirectUri,
@@ -250,6 +251,8 @@ async function createLoopbackAuthorizationSession(options = {}) {
250
251
  const timeoutMs = options.timeoutMs ?? 12e4;
251
252
  if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 2147483647)
252
253
  throw new Error("OAuth authorization timeoutMs must be a positive supported timer interval");
254
+ if (options.waitForCallback !== void 0)
255
+ return createHostedAuthorizationSession(options, timeoutMs);
253
256
  const target = loopbackTarget(options);
254
257
  const server = options.createServer ? options.createServer() : http.createServer();
255
258
  const controller = new AbortController();
@@ -315,6 +318,79 @@ function loopbackTarget(options) {
315
318
  throw new Error("Invalid OAuth loopback callback path");
316
319
  return { port: 0, host: "127.0.0.1", callbackPath };
317
320
  }
321
+ function validateAuthorizationRedirect(options) {
322
+ if (options.waitForCallback === void 0) {
323
+ loopbackTarget(options);
324
+ return;
325
+ }
326
+ if (typeof options.waitForCallback !== "function" || options.redirectUri === void 0)
327
+ throw new Error("Hosted OAuth callbacks require redirectUri and waitForCallback");
328
+ validateHostedOAuthRedirect(options.redirectUri, options.callbackPath);
329
+ }
330
+ function validateHostedOAuthRedirect(redirectUri, callbackPath) {
331
+ const url = new URL(redirectUri);
332
+ if (url.protocol !== "https:" || url.username || url.password || url.href.includes("#") || url.port === "0" || oauthCallbackParameters.some((name) => url.searchParams.has(name)) || [...redirectUri].some((char) => char.codePointAt(0) <= 32) || callbackPath !== void 0 && callbackPath !== url.pathname)
333
+ throw new Error("Invalid hosted OAuth redirect URI");
334
+ }
335
+ function createHostedAuthorizationSession(options, timeoutMs) {
336
+ validateAuthorizationRedirect(options);
337
+ const redirectUri = options.redirectUri, controller = new AbortController();
338
+ let used = false;
339
+ const aborted = () => controller.abort(options.signal?.reason);
340
+ const timer = setTimeout(() => controller.abort(new Error("OAuth authorization timed out")), timeoutMs);
341
+ timer.unref?.();
342
+ const cleanup = () => {
343
+ clearTimeout(timer);
344
+ options.signal?.removeEventListener("abort", aborted);
345
+ };
346
+ controller.signal.addEventListener("abort", cleanup, { once: true });
347
+ options.signal?.addEventListener("abort", aborted, { once: true });
348
+ if (options.signal?.aborted)
349
+ aborted();
350
+ return {
351
+ redirectUri,
352
+ async waitForCode(authorizationUrl) {
353
+ controller.signal.throwIfAborted();
354
+ if (used)
355
+ throw new Error("OAuth authorization session has already been used");
356
+ used = true;
357
+ try {
358
+ const authorization = new URL(authorizationUrl);
359
+ if (authorization.searchParams.getAll("redirect_uri").length !== 1 || authorization.searchParams.get("redirect_uri") !== redirectUri)
360
+ throw new Error("OAuth authorization redirect mismatch");
361
+ const callback = await new Promise((resolve, reject) => {
362
+ const onAbort = () => reject(controller.signal.reason);
363
+ controller.signal.addEventListener("abort", onAbort, { once: true });
364
+ void Promise.resolve().then(() => {
365
+ controller.signal.throwIfAborted();
366
+ return options.waitForCallback({ authorizationUrl, redirectUri, signal: controller.signal });
367
+ }).then(resolve, reject).finally(() => controller.signal.removeEventListener("abort", onAbort));
368
+ });
369
+ controller.signal.throwIfAborted();
370
+ const url = new URL(callback), base = new URL(redirectUri);
371
+ if (url.origin !== base.origin || url.pathname !== base.pathname || url.username || url.password || url.href.includes("#") || [...callback].some((char) => char.codePointAt(0) <= 32))
372
+ throw new Error("OAuth callback redirect mismatch");
373
+ const params = readAuthorizationCallbackParameters(url);
374
+ for (const name of oauthCallbackParameters)
375
+ url.searchParams.delete(name);
376
+ if (url.searchParams.toString() !== base.searchParams.toString())
377
+ throw new Error("OAuth callback redirect mismatch");
378
+ const expected = readExpectedAuthorizationCallback(authorizationUrl);
379
+ if (expected.state === null)
380
+ throw new Error("OAuth authorization missing state");
381
+ validateAuthorizationCallbackBinding(params, expected);
382
+ if (params.error !== null)
383
+ throw new OAuthAuthorizationError(params.error, params.errorDescription ?? params.error);
384
+ return validateAuthorizationCallbackParameters(params, expected);
385
+ } finally {
386
+ controller.abort(new Error("OAuth authorization session closed"));
387
+ }
388
+ },
389
+ close() {
390
+ controller.abort(new Error("OAuth authorization session closed"));
391
+ }
392
+ };
393
+ }
318
394
  async function startServer(server, port, host, signal) {
319
395
  signal.throwIfAborted();
320
396
  return new Promise((resolve, reject) => {
@@ -574,7 +650,10 @@ function normalizeStoredOAuthClient(value) {
574
650
  try {
575
651
  if (typeof requestedRedirectUri !== "string")
576
652
  throw new Error("Invalid redirect identity");
577
- loopbackTarget({ redirectUri: requestedRedirectUri });
653
+ if (new URL(requestedRedirectUri).protocol === "https:")
654
+ validateHostedOAuthRedirect(requestedRedirectUri);
655
+ else
656
+ loopbackTarget({ redirectUri: requestedRedirectUri });
578
657
  } catch {
579
658
  throw new Error("Invalid stored OAuth registration redirect identity");
580
659
  }
@@ -1470,7 +1549,7 @@ function isStoredOAuthTokensOrMissing(value) {
1470
1549
  return false;
1471
1550
  }
1472
1551
  const scope = getOwnEntry4(value, "scope");
1473
- return scope === void 0 || typeof scope === "string" && scope.trim().length > 0;
1552
+ return scope === void 0 || scope === "" || typeof scope === "string" && scope.trim().length > 0;
1474
1553
  }
1475
1554
  function isNonBlankOwnString(record3, key2) {
1476
1555
  const value = getOwnString(record3, key2);
@@ -1891,7 +1970,7 @@ async function requestTokens(input) {
1891
1970
  throw new Error("OAuth token response has invalid refresh_token");
1892
1971
  const scope = getOwnEntry5(payload, "scope");
1893
1972
  const normalizedRefreshToken = typeof refreshToken === "string" && refreshToken.trim().length > 0 ? refreshToken.trim() : void 0;
1894
- const normalizedScope = normalizeOAuthScope(scope);
1973
+ const normalizedScope = scope === "" ? "" : normalizeOAuthScope(scope);
1895
1974
  if (scope !== void 0 && normalizedScope === void 0)
1896
1975
  throw new Error("Invalid OAuth scope syntax in token response");
1897
1976
  return {
@@ -2018,7 +2097,7 @@ function createDefaultOAuthClientProvider(options) {
2018
2097
  const clientMode = options.client.mode;
2019
2098
  const interactiveEnabled = options.allowInteractive !== false;
2020
2099
  const sessionLockTimeoutMs = options.sessionLockTimeoutMs;
2021
- loopbackTarget(browser);
2100
+ validateAuthorizationRedirect(browser);
2022
2101
  assertPersistenceNamespace(options.persistenceNamespace);
2023
2102
  const clientMetadata = getClientMetadata(options.client);
2024
2103
  const requestedScope = clientMetadata?.scope;
@@ -2612,7 +2691,7 @@ function normalizeStoredTokens(value) {
2612
2691
  const scope = getOwnEntry6(value, "scope");
2613
2692
  const normalizedAccessToken = accessToken?.trim();
2614
2693
  const normalizedRefreshToken = typeof refreshToken === "string" ? refreshToken.trim() : void 0;
2615
- const normalizedScope = normalizeOAuthScope(scope);
2694
+ const normalizedScope = scope === "" ? "" : normalizeOAuthScope(scope);
2616
2695
  if (accessToken === void 0 || normalizedAccessToken === void 0 || normalizedAccessToken.length === 0 || tokenType !== "Bearer" || !(expiresAt === null || typeof expiresAt === "number" && Number.isSafeInteger(expiresAt) && expiresAt <= MAX_JS_DATE_MS3 && Number.isFinite(new Date(expiresAt).getTime())) || refreshToken !== void 0 && (typeof refreshToken !== "string" || normalizedRefreshToken === void 0 || normalizedRefreshToken.length === 0)) {
2617
2696
  return void 0;
2618
2697
  }
@@ -2621,7 +2700,7 @@ function normalizeStoredTokens(value) {
2621
2700
  tokenType,
2622
2701
  expiresAt,
2623
2702
  ...normalizedRefreshToken === void 0 ? {} : { refreshToken: normalizedRefreshToken },
2624
- ...normalizedScope === void 0 || normalizedScope.length === 0 ? {} : { scope: normalizedScope }
2703
+ ...normalizedScope === void 0 ? {} : { scope: normalizedScope }
2625
2704
  };
2626
2705
  }
2627
2706
  function getClientMetadata(client) {
@@ -2841,6 +2920,7 @@ function snapshotOAuthBrowserOptions(browser) {
2841
2920
  ...browser,
2842
2921
  openBrowser: browser.openBrowser?.bind(browser),
2843
2922
  readLine: browser.readLine?.bind(browser),
2923
+ waitForCallback: browser.waitForCallback?.bind(browser),
2844
2924
  createServer: browser.createServer?.bind(browser),
2845
2925
  redirectUri: browser.redirectUri,
2846
2926
  signal: browser.signal,
@@ -6221,9 +6301,9 @@ var SubscriptionManager = class {
6221
6301
  let canceled = false;
6222
6302
  let acknowledge;
6223
6303
  let reject;
6224
- const acknowledged = new Promise((resolve, fail2) => {
6304
+ const acknowledged = new Promise((resolve, fail3) => {
6225
6305
  acknowledge = resolve;
6226
- reject = fail2;
6306
+ reject = fail3;
6227
6307
  });
6228
6308
  const cancel = () => {
6229
6309
  if (canceled) return;
@@ -6452,6 +6532,7 @@ function snapshotLoopbackAuthorizationOptions2(options) {
6452
6532
  ...options,
6453
6533
  openBrowser: options.openBrowser?.bind(options),
6454
6534
  readLine: options.readLine?.bind(options),
6535
+ waitForCallback: options.waitForCallback?.bind(options),
6455
6536
  createServer: options.createServer?.bind(options),
6456
6537
  callbackPath: options.callbackPath,
6457
6538
  redirectUri: options.redirectUri,
@@ -6466,6 +6547,8 @@ async function createLoopbackAuthorizationSession2(options = {}) {
6466
6547
  const timeoutMs = options.timeoutMs ?? 12e4;
6467
6548
  if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 2147483647)
6468
6549
  throw new Error("OAuth authorization timeoutMs must be a positive supported timer interval");
6550
+ if (options.waitForCallback !== void 0)
6551
+ return createHostedAuthorizationSession2(options, timeoutMs);
6469
6552
  const target = loopbackTarget2(options);
6470
6553
  const server = options.createServer ? options.createServer() : http2.createServer();
6471
6554
  const controller = new AbortController();
@@ -6531,6 +6614,79 @@ function loopbackTarget2(options) {
6531
6614
  throw new Error("Invalid OAuth loopback callback path");
6532
6615
  return { port: 0, host: "127.0.0.1", callbackPath };
6533
6616
  }
6617
+ function validateAuthorizationRedirect2(options) {
6618
+ if (options.waitForCallback === void 0) {
6619
+ loopbackTarget2(options);
6620
+ return;
6621
+ }
6622
+ if (typeof options.waitForCallback !== "function" || options.redirectUri === void 0)
6623
+ throw new Error("Hosted OAuth callbacks require redirectUri and waitForCallback");
6624
+ validateHostedOAuthRedirect2(options.redirectUri, options.callbackPath);
6625
+ }
6626
+ function validateHostedOAuthRedirect2(redirectUri, callbackPath) {
6627
+ const url = new URL(redirectUri);
6628
+ if (url.protocol !== "https:" || url.username || url.password || url.href.includes("#") || url.port === "0" || oauthCallbackParameters2.some((name) => url.searchParams.has(name)) || [...redirectUri].some((char) => char.codePointAt(0) <= 32) || callbackPath !== void 0 && callbackPath !== url.pathname)
6629
+ throw new Error("Invalid hosted OAuth redirect URI");
6630
+ }
6631
+ function createHostedAuthorizationSession2(options, timeoutMs) {
6632
+ validateAuthorizationRedirect2(options);
6633
+ const redirectUri = options.redirectUri, controller = new AbortController();
6634
+ let used = false;
6635
+ const aborted = () => controller.abort(options.signal?.reason);
6636
+ const timer = setTimeout(() => controller.abort(new Error("OAuth authorization timed out")), timeoutMs);
6637
+ timer.unref?.();
6638
+ const cleanup = () => {
6639
+ clearTimeout(timer);
6640
+ options.signal?.removeEventListener("abort", aborted);
6641
+ };
6642
+ controller.signal.addEventListener("abort", cleanup, { once: true });
6643
+ options.signal?.addEventListener("abort", aborted, { once: true });
6644
+ if (options.signal?.aborted)
6645
+ aborted();
6646
+ return {
6647
+ redirectUri,
6648
+ async waitForCode(authorizationUrl) {
6649
+ controller.signal.throwIfAborted();
6650
+ if (used)
6651
+ throw new Error("OAuth authorization session has already been used");
6652
+ used = true;
6653
+ try {
6654
+ const authorization = new URL(authorizationUrl);
6655
+ if (authorization.searchParams.getAll("redirect_uri").length !== 1 || authorization.searchParams.get("redirect_uri") !== redirectUri)
6656
+ throw new Error("OAuth authorization redirect mismatch");
6657
+ const callback = await new Promise((resolve, reject) => {
6658
+ const onAbort = () => reject(controller.signal.reason);
6659
+ controller.signal.addEventListener("abort", onAbort, { once: true });
6660
+ void Promise.resolve().then(() => {
6661
+ controller.signal.throwIfAborted();
6662
+ return options.waitForCallback({ authorizationUrl, redirectUri, signal: controller.signal });
6663
+ }).then(resolve, reject).finally(() => controller.signal.removeEventListener("abort", onAbort));
6664
+ });
6665
+ controller.signal.throwIfAborted();
6666
+ const url = new URL(callback), base = new URL(redirectUri);
6667
+ if (url.origin !== base.origin || url.pathname !== base.pathname || url.username || url.password || url.href.includes("#") || [...callback].some((char) => char.codePointAt(0) <= 32))
6668
+ throw new Error("OAuth callback redirect mismatch");
6669
+ const params = readAuthorizationCallbackParameters2(url);
6670
+ for (const name of oauthCallbackParameters2)
6671
+ url.searchParams.delete(name);
6672
+ if (url.searchParams.toString() !== base.searchParams.toString())
6673
+ throw new Error("OAuth callback redirect mismatch");
6674
+ const expected = readExpectedAuthorizationCallback2(authorizationUrl);
6675
+ if (expected.state === null)
6676
+ throw new Error("OAuth authorization missing state");
6677
+ validateAuthorizationCallbackBinding2(params, expected);
6678
+ if (params.error !== null)
6679
+ throw new OAuthAuthorizationError2(params.error, params.errorDescription ?? params.error);
6680
+ return validateAuthorizationCallbackParameters2(params, expected);
6681
+ } finally {
6682
+ controller.abort(new Error("OAuth authorization session closed"));
6683
+ }
6684
+ },
6685
+ close() {
6686
+ controller.abort(new Error("OAuth authorization session closed"));
6687
+ }
6688
+ };
6689
+ }
6534
6690
  async function startServer2(server, port, host, signal) {
6535
6691
  signal.throwIfAborted();
6536
6692
  return new Promise((resolve, reject) => {
@@ -6786,7 +6942,10 @@ function normalizeStoredOAuthClient2(value) {
6786
6942
  try {
6787
6943
  if (typeof requestedRedirectUri !== "string")
6788
6944
  throw new Error("Invalid redirect identity");
6789
- loopbackTarget2({ redirectUri: requestedRedirectUri });
6945
+ if (new URL(requestedRedirectUri).protocol === "https:")
6946
+ validateHostedOAuthRedirect2(requestedRedirectUri);
6947
+ else
6948
+ loopbackTarget2({ redirectUri: requestedRedirectUri });
6790
6949
  } catch {
6791
6950
  throw new Error("Invalid stored OAuth registration redirect identity");
6792
6951
  }
@@ -7651,7 +7810,7 @@ function isStoredOAuthTokensOrMissing2(value) {
7651
7810
  return false;
7652
7811
  }
7653
7812
  const scope = getOwnEntry42(value, "scope");
7654
- return scope === void 0 || typeof scope === "string" && scope.trim().length > 0;
7813
+ return scope === void 0 || scope === "" || typeof scope === "string" && scope.trim().length > 0;
7655
7814
  }
7656
7815
  function isNonBlankOwnString2(record22, key2) {
7657
7816
  const value = getOwnString3(record22, key2);
@@ -8055,7 +8214,7 @@ async function requestTokens2(input) {
8055
8214
  throw new Error("OAuth token response has invalid refresh_token");
8056
8215
  const scope = getOwnEntry52(payload, "scope");
8057
8216
  const normalizedRefreshToken = typeof refreshToken === "string" && refreshToken.trim().length > 0 ? refreshToken.trim() : void 0;
8058
- const normalizedScope = normalizeOAuthScope2(scope);
8217
+ const normalizedScope = scope === "" ? "" : normalizeOAuthScope2(scope);
8059
8218
  if (scope !== void 0 && normalizedScope === void 0)
8060
8219
  throw new Error("Invalid OAuth scope syntax in token response");
8061
8220
  return {
@@ -8184,7 +8343,7 @@ function createDefaultOAuthClientProvider2(options) {
8184
8343
  const clientMode = options.client.mode;
8185
8344
  const interactiveEnabled = options.allowInteractive !== false;
8186
8345
  const sessionLockTimeoutMs = options.sessionLockTimeoutMs;
8187
- loopbackTarget2(browser);
8346
+ validateAuthorizationRedirect2(browser);
8188
8347
  assertPersistenceNamespace2(options.persistenceNamespace);
8189
8348
  const clientMetadata = getClientMetadata2(options.client);
8190
8349
  const requestedScope = clientMetadata?.scope;
@@ -8781,7 +8940,7 @@ function normalizeStoredTokens2(value) {
8781
8940
  const scope = getOwnEntry62(value, "scope");
8782
8941
  const normalizedAccessToken = accessToken?.trim();
8783
8942
  const normalizedRefreshToken = typeof refreshToken === "string" ? refreshToken.trim() : void 0;
8784
- const normalizedScope = normalizeOAuthScope2(scope);
8943
+ const normalizedScope = scope === "" ? "" : normalizeOAuthScope2(scope);
8785
8944
  if (accessToken === void 0 || normalizedAccessToken === void 0 || normalizedAccessToken.length === 0 || tokenType !== "Bearer" || !(expiresAt === null || typeof expiresAt === "number" && Number.isSafeInteger(expiresAt) && expiresAt <= MAX_JS_DATE_MS32 && Number.isFinite(new Date(expiresAt).getTime())) || refreshToken !== void 0 && (typeof refreshToken !== "string" || normalizedRefreshToken === void 0 || normalizedRefreshToken.length === 0)) {
8786
8945
  return void 0;
8787
8946
  }
@@ -8790,7 +8949,7 @@ function normalizeStoredTokens2(value) {
8790
8949
  tokenType,
8791
8950
  expiresAt,
8792
8951
  ...normalizedRefreshToken === void 0 ? {} : { refreshToken: normalizedRefreshToken },
8793
- ...normalizedScope === void 0 || normalizedScope.length === 0 ? {} : { scope: normalizedScope }
8952
+ ...normalizedScope === void 0 ? {} : { scope: normalizedScope }
8794
8953
  };
8795
8954
  }
8796
8955
  function getClientMetadata2(client) {
@@ -14053,6 +14212,14 @@ import { AsyncLocalStorage } from "node:async_hooks";
14053
14212
  import { randomUUID as randomUUID4 } from "node:crypto";
14054
14213
  import * as util from "node:util";
14055
14214
  import { constants } from "node:os";
14215
+
14216
+ // ../safe-fs/dist/platform/transport-budget.js
14217
+ var hasRegisteredS3FileSystem = false;
14218
+ function enableS3TransportBudget() {
14219
+ hasRegisteredS3FileSystem = true;
14220
+ }
14221
+
14222
+ // ../safe-fs/dist/platform/node.js
14056
14223
  var systemErrnos = (() => {
14057
14224
  const fallback = new Map(Object.entries(constants.errno).map(([name, errno]) => [name, -Math.abs(errno)]));
14058
14225
  if (typeof util.getSystemErrorMap !== "function")
@@ -14085,6 +14252,19 @@ var comparisonContext = Object.freeze({
14085
14252
  }
14086
14253
  });
14087
14254
  var transportBudgets = new AsyncLocalStorage();
14255
+ function chargeScopedTransportCall(options) {
14256
+ if (!hasRegisteredS3FileSystem)
14257
+ return;
14258
+ const frames = transportBudgets.getStore();
14259
+ if (!frames)
14260
+ return;
14261
+ for (const frame of frames) {
14262
+ if (frame.credit > 0)
14263
+ frame.credit--;
14264
+ else
14265
+ frame.admit(options);
14266
+ }
14267
+ }
14088
14268
 
14089
14269
  // ../safe-fs/dist/contracts/errors.js
14090
14270
  var descriptions = {
@@ -14196,6 +14376,48 @@ var EMPTY_BYTE_SOURCE = Object.freeze({
14196
14376
  });
14197
14377
  var noop = () => {
14198
14378
  };
14379
+ async function collectBytes2(source, options) {
14380
+ if (options.maxBytes !== void 0 && options.maxBytes !== Infinity && (!Number.isSafeInteger(options.maxBytes) || options.maxBytes < 0)) {
14381
+ throw new RangeError("maxBytes must be a nonnegative safe integer");
14382
+ }
14383
+ if (options.maxMemoryBytes !== void 0 && options.maxMemoryBytes !== Infinity && (!Number.isSafeInteger(options.maxMemoryBytes) || options.maxMemoryBytes < 0)) {
14384
+ throw new RangeError("maxMemoryBytes must be a nonnegative safe integer or Infinity");
14385
+ }
14386
+ const memoryLimit = options.maxMemoryBytes ?? Infinity;
14387
+ let reserved = 0;
14388
+ let inputBytes = 0;
14389
+ let buffer = new Uint8Array(0);
14390
+ let size = 0;
14391
+ function reserve(bytes) {
14392
+ if (bytes > memoryLimit - reserved) {
14393
+ throw new FsError("EFBIG", { syscall: "collectBytes", message: "collection exceeds memory budget" });
14394
+ }
14395
+ reserved += bytes;
14396
+ }
14397
+ options.signal?.throwIfAborted();
14398
+ for await (const chunk of readBytes(source, options.signal)) {
14399
+ reserved -= inputBytes;
14400
+ inputBytes = 0;
14401
+ if (chunk.byteLength > (options.maxBytes ?? Infinity) - size) {
14402
+ throw new FsError("EFBIG", { syscall: "collectBytes", message: "output exceeds maxBytes" });
14403
+ }
14404
+ reserve(chunk.buffer.byteLength);
14405
+ inputBytes = chunk.buffer.byteLength;
14406
+ const nextSize = size + chunk.byteLength;
14407
+ if (nextSize > buffer.byteLength) {
14408
+ const capacity = Math.min(options.maxBytes ?? Infinity, Math.max(nextSize, buffer.byteLength * 2));
14409
+ reserve(capacity);
14410
+ const replacement = new Uint8Array(capacity);
14411
+ replacement.set(buffer.subarray(0, size));
14412
+ reserved -= buffer.byteLength;
14413
+ buffer = replacement;
14414
+ }
14415
+ buffer.set(chunk, size);
14416
+ size = nextSize;
14417
+ }
14418
+ options.signal?.throwIfAborted();
14419
+ return buffer.subarray(0, size);
14420
+ }
14199
14421
  async function abortable(operation, signal) {
14200
14422
  signal?.throwIfAborted();
14201
14423
  if (!signal)
@@ -14955,10 +15177,76 @@ async function compareEntries(filesystem, path6, peer, peerPath, options = {}) {
14955
15177
  }
14956
15178
 
14957
15179
  // ../safe-fs/dist/fs/s3/registry.js
15180
+ var observedStats = /* @__PURE__ */ new WeakMap();
14958
15181
  var entries = /* @__PURE__ */ new WeakMap();
15182
+ var comparisons = /* @__PURE__ */ new WeakMap();
15183
+ var configuredComparisons = /* @__PURE__ */ new WeakMap();
15184
+ function recordS3Observation(filesystem, path6, stat, entry) {
15185
+ observedStats.set(stat, { filesystem, path: path6, entry });
15186
+ }
15187
+ function registerS3EntryOwner(filesystem, normalize2, intact, baseComparison, comparison) {
15188
+ enableS3TransportBudget();
15189
+ comparisons.set(filesystem, baseComparison);
15190
+ if (comparison)
15191
+ configuredComparisons.set(filesystem, comparison);
15192
+ entries.set(filesystem, (view) => {
15193
+ if (!intact())
15194
+ return void 0;
15195
+ const observation = observedStats.get(view.stat);
15196
+ return observation?.filesystem === filesystem && observation.path === normalize2(view.path) ? observation.entry : void 0;
15197
+ });
15198
+ }
14959
15199
  function getOwnedS3Entry(view) {
14960
15200
  return entries.get(view.filesystem)?.(view);
14961
15201
  }
15202
+ async function compareOwnedS3Entries(own, peer, options) {
15203
+ options.signal?.throwIfAborted();
15204
+ let explicit = false;
15205
+ let answer = "unknown";
15206
+ const visited = /* @__PURE__ */ new Set();
15207
+ for (const [left2, right2] of [[own, peer], [peer, own]]) {
15208
+ const baseComparison = comparisons.get(left2.filesystem);
15209
+ if (!baseComparison || visited.has(left2.filesystem))
15210
+ continue;
15211
+ visited.add(left2.filesystem);
15212
+ const current = left2.filesystem.compareEntry;
15213
+ const comparison = current === baseComparison ? configuredComparisons.get(left2.filesystem) : current;
15214
+ if (current === baseComparison && comparison === void 0)
15215
+ continue;
15216
+ explicit = true;
15217
+ if (comparison === void 0)
15218
+ continue;
15219
+ options.signal?.throwIfAborted();
15220
+ if (typeof comparison !== "function") {
15221
+ throw new FsError("EIO", { path: own.path, dest: peer.path, message: "invalid explicit S3 comparison method" });
15222
+ }
15223
+ assertCallbackAuthorityAllowed();
15224
+ const result = await comparison.call(left2.filesystem, left2.path, right2.filesystem, right2.path, options);
15225
+ options.signal?.throwIfAborted();
15226
+ if (result !== "same" && result !== "distinct" && result !== "unknown") {
15227
+ throw new FsError("EIO", { path: own.path, dest: peer.path, message: "invalid explicit S3 comparison" });
15228
+ }
15229
+ if (result === "unknown")
15230
+ continue;
15231
+ if (answer !== "unknown" && answer !== result) {
15232
+ throw new FsError("EIO", { path: own.path, dest: peer.path, message: "conflicting explicit S3 comparisons" });
15233
+ }
15234
+ answer = result;
15235
+ }
15236
+ const left = getOwnedS3Entry(own);
15237
+ options.signal?.throwIfAborted();
15238
+ const right = getOwnedS3Entry(peer);
15239
+ options.signal?.throwIfAborted();
15240
+ const same = left && right && left.storage === right.storage && left.key === right.key;
15241
+ if (same && answer === "distinct") {
15242
+ throw new FsError("EIO", { path: own.path, dest: peer.path, message: "explicit S3 comparison contradicts a known alias" });
15243
+ }
15244
+ if (same)
15245
+ return "same";
15246
+ if (explicit)
15247
+ return answer;
15248
+ return left && right ? "distinct" : "unknown";
15249
+ }
14962
15250
 
14963
15251
  // ../safe-fs/dist/fs/webdav/resource-id.js
14964
15252
  var responses = /* @__PURE__ */ new WeakMap();
@@ -14976,10 +15264,10 @@ function ownedResponseIdentifier(response, path6) {
14976
15264
  return responses.get(response)?.get(path6)?.identifier;
14977
15265
  }
14978
15266
  var queries = /* @__PURE__ */ new WeakMap();
14979
- var comparisons = /* @__PURE__ */ new WeakMap();
15267
+ var comparisons2 = /* @__PURE__ */ new WeakMap();
14980
15268
  var callbacks = /* @__PURE__ */ new WeakMap();
14981
15269
  function registerResourceQuery(filesystem, query, baseComparison, callback) {
14982
- comparisons.set(filesystem, baseComparison);
15270
+ comparisons2.set(filesystem, baseComparison);
14983
15271
  if (callback)
14984
15272
  callbacks.set(filesystem, callback);
14985
15273
  queries.set(filesystem, async (path6, options) => {
@@ -15007,7 +15295,7 @@ var compareWebDavResources = async (own, peer, options) => {
15007
15295
  let answer = "unknown";
15008
15296
  const visited = /* @__PURE__ */ new Set();
15009
15297
  for (const [left, right] of [[own, peer], [peer, own]]) {
15010
- const baseComparison = comparisons.get(left.filesystem);
15298
+ const baseComparison = comparisons2.get(left.filesystem);
15011
15299
  if (!baseComparison)
15012
15300
  continue;
15013
15301
  const method = left.filesystem.compareEntry;
@@ -15249,7 +15537,7 @@ function components(path6, signal) {
15249
15537
  return result;
15250
15538
  }
15251
15539
  function resolveMissingTarget(root, path6, signal) {
15252
- const fail2 = (code, failedPath = path6) => {
15540
+ const fail3 = (code, failedPath = path6) => {
15253
15541
  throw new FsError(code, { syscall: "realpath", path: failedPath });
15254
15542
  };
15255
15543
  const origin = components(path6, signal);
@@ -15279,9 +15567,9 @@ function resolveMissingTarget(root, path6, signal) {
15279
15567
  }
15280
15568
  const current = position.node;
15281
15569
  if (current.type !== "directory")
15282
- return fail2("ENOTDIR");
15570
+ return fail3("ENOTDIR");
15283
15571
  if ((current.mode >> 6 & 1) !== 1)
15284
- return fail2("EACCES");
15572
+ return fail3("EACCES");
15285
15573
  const name = component.name;
15286
15574
  if (name === ".") {
15287
15575
  first = false;
@@ -15293,7 +15581,7 @@ function resolveMissingTarget(root, path6, signal) {
15293
15581
  continue;
15294
15582
  }
15295
15583
  if (exceedsComponentByteLimit(name))
15296
- return fail2("ENAMETOOLONG");
15584
+ return fail3("ENAMETOOLONG");
15297
15585
  const node = current.entries.get(name);
15298
15586
  if (!node) {
15299
15587
  found = false;
@@ -15304,7 +15592,7 @@ function resolveMissingTarget(root, path6, signal) {
15304
15592
  first = false;
15305
15593
  if (node.type === "symlink") {
15306
15594
  if (++links > 40)
15307
- return fail2("ELOOP");
15595
+ return fail3("ELOOP");
15308
15596
  const names2 = components(node.target, signal);
15309
15597
  if (node.target.endsWith("/"))
15310
15598
  names2.push({ name: ".", start: node.target.length });
@@ -15326,7 +15614,7 @@ function resolveMissingTarget(root, path6, signal) {
15326
15614
  for (let count = origin.length; count > missing; count--) {
15327
15615
  signal?.throwIfAborted();
15328
15616
  if (count === missing + 1 && path6[end - 1] !== "/")
15329
- return fail2("ENOENT", path6.slice(0, end));
15617
+ return fail3("ENOENT", path6.slice(0, end));
15330
15618
  const last = origin[count - 1];
15331
15619
  if (!last)
15332
15620
  break;
@@ -19245,7 +19533,7 @@ function qualifiedNameSync(name, cache) {
19245
19533
  }
19246
19534
  return parts;
19247
19535
  }
19248
- function* entities(text) {
19536
+ function* entities(text, recover) {
19249
19537
  let result = "";
19250
19538
  let offset = 0;
19251
19539
  while (offset < text.length) {
@@ -19254,8 +19542,12 @@ function* entities(text) {
19254
19542
  return result + text.slice(offset);
19255
19543
  result += text.slice(offset, start);
19256
19544
  const end = yield* find(text, ";", start + 1);
19257
- if (end < 0)
19258
- invalid("unterminated entity");
19545
+ if (end < 0) {
19546
+ if (!recover)
19547
+ invalid("unterminated entity");
19548
+ recover("unterminated entity");
19549
+ return result + text.slice(start + 1);
19550
+ }
19259
19551
  const entity = text.slice(start + 1, end);
19260
19552
  const predefined = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" };
19261
19553
  if (Object.hasOwn(predefined, entity))
@@ -19263,8 +19555,13 @@ function* entities(text) {
19263
19555
  else {
19264
19556
  const hexadecimal = entity.startsWith("#x");
19265
19557
  const digits = entity.slice(hexadecimal ? 2 : 1);
19266
- if (!entity.startsWith("#") || !digits.length)
19267
- invalid("undeclared entity");
19558
+ if (!entity.startsWith("#") || !digits.length) {
19559
+ if (!recover)
19560
+ invalid("undeclared entity");
19561
+ recover("undeclared entity");
19562
+ offset = end + 1;
19563
+ continue;
19564
+ }
19268
19565
  let point = 0;
19269
19566
  for (let index = 0; index < digits.length; index++) {
19270
19567
  const code = digits.charCodeAt(index);
@@ -19463,7 +19760,7 @@ function* parseXmlSteps(input, limits = {}) {
19463
19760
  }
19464
19761
  if (text.indexOf("]]>") >= 0)
19465
19762
  invalid("CDATA terminator in text");
19466
- const resolved = stack.length ? text.indexOf("&") < 0 ? (pendingWork += text.length, text) : yield* entities(text) : text;
19763
+ const resolved = stack.length ? text.indexOf("&") < 0 ? (pendingWork += text.length, text) : yield* entities(text, limits.recover) : text;
19467
19764
  while (pendingWork >= 512) {
19468
19765
  yield 512;
19469
19766
  pendingWork -= 512;
@@ -19571,8 +19868,11 @@ function* parseXmlSteps(input, limits = {}) {
19571
19868
  yield 512;
19572
19869
  pendingWork -= 512;
19573
19870
  }
19574
- if (source[offset++] !== ">" || stack.pop()?.name !== name)
19575
- invalid("mismatched closing tag");
19871
+ if (source[offset++] !== ">" || stack.pop()?.name !== name) {
19872
+ if (!limits.recover)
19873
+ invalid("mismatched closing tag");
19874
+ limits.recover("mismatched closing tag");
19875
+ }
19576
19876
  } else {
19577
19877
  offset++;
19578
19878
  const repeated = previousEmpty && source.startsWith(previousEmpty.suffix, offset) ? previousEmpty : void 0;
@@ -19596,7 +19896,7 @@ function* parseXmlSteps(input, limits = {}) {
19596
19896
  pendingWork -= 512;
19597
19897
  }
19598
19898
  const ch = source.charCodeAt(offset);
19599
- if (ch === 47 || ch === 62)
19899
+ if (ch === 47 || ch === 62 || limits.recover && offset === source.length)
19600
19900
  break;
19601
19901
  if (ws === 0)
19602
19902
  invalid("attributes require whitespace");
@@ -19637,7 +19937,7 @@ function* parseXmlSteps(input, limits = {}) {
19637
19937
  if (raw.indexOf("<") >= 0)
19638
19938
  invalid("less-than in attribute");
19639
19939
  const normalized = /[\t\n\r]/.test(raw) ? raw.replace(/[\t\n\r]/g, " ") : raw;
19640
- const value = normalized.indexOf("&") < 0 ? (pendingWork += normalized.length, normalized) : yield* entities(normalized);
19940
+ const value = normalized.indexOf("&") < 0 ? (pendingWork += normalized.length, normalized) : yield* entities(normalized, limits.recover);
19641
19941
  while (pendingWork >= 512) {
19642
19942
  yield 512;
19643
19943
  pendingWork -= 512;
@@ -19727,8 +20027,11 @@ function* parseXmlSteps(input, limits = {}) {
19727
20027
  const empty = source[offset] === "/";
19728
20028
  if (empty)
19729
20029
  offset++;
19730
- if (source[offset++] !== ">")
19731
- invalid("unterminated start tag");
20030
+ if (source[offset++] !== ">") {
20031
+ if (!limits.recover)
20032
+ invalid("unterminated start tag");
20033
+ limits.recover("unterminated start tag");
20034
+ }
19732
20035
  if (empty && !attributes && name.length <= 512 && source.slice(offset - name.length - 3, offset) === `<${name}/>`)
19733
20036
  previousEmpty = { suffix: name + "/>", name, prefix, localName };
19734
20037
  if (!empty)
@@ -19739,8 +20042,13 @@ function* parseXmlSteps(input, limits = {}) {
19739
20042
  yield pendingWork;
19740
20043
  pendingWork = 0;
19741
20044
  }
19742
- if (stack.length || !root)
20045
+ if (!root)
19743
20046
  invalid("incomplete document");
20047
+ if (stack.length) {
20048
+ if (!limits.recover)
20049
+ invalid("incomplete document");
20050
+ limits.recover("incomplete document");
20051
+ }
19744
20052
  return root;
19745
20053
  }
19746
20054
 
@@ -21225,6 +21533,1220 @@ var WebDavFileSystem = class {
21225
21533
  };
21226
21534
  var originalWebDavComparison = WebDavFileSystem.prototype.compareEntry;
21227
21535
 
21536
+ // ../safe-fs/dist/fs/s3/key-order.js
21537
+ function compareKeys(left, right) {
21538
+ const encoder = new TextEncoder();
21539
+ const a = encoder.encode(left), b = encoder.encode(right);
21540
+ for (let index = 0; index < Math.min(a.length, b.length); index++) {
21541
+ const difference = a[index] - b[index];
21542
+ if (difference)
21543
+ return difference;
21544
+ }
21545
+ return a.length - b.length;
21546
+ }
21547
+
21548
+ // ../safe-fs/dist/fs/s3/authority.js
21549
+ var queryKey = /* @__PURE__ */ Symbol("s3-head-query");
21550
+ var queries2 = /* @__PURE__ */ new WeakMap();
21551
+ var providerHeads = /* @__PURE__ */ new WeakMap();
21552
+ var acceptedHeads = /* @__PURE__ */ new WeakMap();
21553
+ async function queryS3Head(input, action) {
21554
+ const token = Object.freeze({});
21555
+ const query = Object.freeze({ ...input });
21556
+ const forwarded = { ...query, [queryKey]: token };
21557
+ queries2.set(token, query);
21558
+ try {
21559
+ const output = await action(forwarded);
21560
+ acceptedHeads.delete(output);
21561
+ const proof = providerHeads.get(output);
21562
+ if (proof?.query === query)
21563
+ acceptedHeads.set(output, proof.entry);
21564
+ return output;
21565
+ } finally {
21566
+ queries2.delete(token);
21567
+ }
21568
+ }
21569
+ function recordS3Stat(filesystem, path6, stat, metadata) {
21570
+ if (!metadata)
21571
+ return;
21572
+ const entry = acceptedHeads.get(metadata);
21573
+ acceptedHeads.delete(metadata);
21574
+ if (entry)
21575
+ recordS3Observation(filesystem, path6, stat, entry);
21576
+ }
21577
+
21578
+ // ../safe-fs/dist/fs/s3/transport.js
21579
+ function encodeCopySource(bucket, key2) {
21580
+ return [bucket, ...key2.split("/")].map((part) => encodeURIComponent(part).replace(/[!'()*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`)).join("/");
21581
+ }
21582
+
21583
+ // ../safe-fs/dist/fs/s3/filesystem.js
21584
+ var S3RenameError = class extends FsError {
21585
+ phase;
21586
+ copiedKeys;
21587
+ deletedKeys;
21588
+ constructor(source, destination, phase, copied, deleted, cause) {
21589
+ super(cause.code, {
21590
+ syscall: "rename",
21591
+ path: source,
21592
+ dest: destination,
21593
+ cause,
21594
+ message: `non-atomic S3 rename failed during ${phase}; destination copies or partial source deletions may remain`
21595
+ });
21596
+ this.name = "S3RenameError";
21597
+ this.phase = phase;
21598
+ this.copiedKeys = Object.freeze([...copied]);
21599
+ this.deletedKeys = Object.freeze([...deleted]);
21600
+ }
21601
+ };
21602
+ function serviceCode(error) {
21603
+ if (typeof error !== "object" || error === null)
21604
+ return void 0;
21605
+ const record3 = error;
21606
+ const value = record3.Code ?? record3.code ?? record3.name;
21607
+ return typeof value === "string" ? value : void 0;
21608
+ }
21609
+ function translate(error, syscall, path6, precondition = "EAGAIN") {
21610
+ if (error instanceof FsError)
21611
+ return error;
21612
+ const status = error?.$metadata?.httpStatusCode;
21613
+ const name = serviceCode(error);
21614
+ let code = "EIO";
21615
+ if (name === "AbortError" || status === 499)
21616
+ code = "ECANCELED";
21617
+ else if (name === "NoSuchKey" || name === "NotFound" || name === "NoSuchBucket" || status === 404)
21618
+ code = "ENOENT";
21619
+ else if (["AccessDenied", "InvalidAccessKeyId", "SignatureDoesNotMatch", "ExpiredToken"].includes(name ?? "") || status === 401 || status === 403)
21620
+ code = "EACCES";
21621
+ else if (name === "PreconditionFailed" || status === 412)
21622
+ code = precondition;
21623
+ else if (name === "ConditionalRequestConflict" || name === "SlowDown" || status === 409 || status === 429 || status === 503)
21624
+ code = "EAGAIN";
21625
+ else if (name === "NotImplemented" || status === 501)
21626
+ code = "ENOTSUP";
21627
+ else if (name === "EntityTooLarge")
21628
+ code = "EFBIG";
21629
+ else if (name === "InvalidArgument" || name === "InvalidRequest" || status === 400)
21630
+ code = "EINVAL";
21631
+ else if (name === "TimeoutError" || name === "RequestTimeout" || status === 408)
21632
+ code = "ETIMEDOUT";
21633
+ return new FsError(code, { syscall, path: path6, cause: error });
21634
+ }
21635
+ function fail2(code, syscall, path6, message) {
21636
+ throw new FsError(code, { syscall, path: path6, ...message === void 0 ? {} : { message } });
21637
+ }
21638
+ function validateLimit(value, name, minimum, maximum = Number.MAX_SAFE_INTEGER) {
21639
+ if ((value !== Infinity || maximum !== Infinity) && (!Number.isSafeInteger(value) || value < minimum || value > maximum)) {
21640
+ throw new FsError("EINVAL", { message: `${name} must be an integer from ${minimum} to ${maximum}` });
21641
+ }
21642
+ return value;
21643
+ }
21644
+ function utf8ByteLength3(value) {
21645
+ let bytes = 0;
21646
+ for (let i = 0; i < value.length; i++) {
21647
+ const code = value.charCodeAt(i);
21648
+ if (code < 128)
21649
+ bytes += 1;
21650
+ else if (code < 2048)
21651
+ bytes += 2;
21652
+ else if (code >= 55296 && code <= 56319 && i + 1 < value.length && value.charCodeAt(i + 1) >= 56320 && value.charCodeAt(i + 1) <= 57343) {
21653
+ bytes += 4;
21654
+ i++;
21655
+ } else
21656
+ bytes += 3;
21657
+ }
21658
+ return bytes;
21659
+ }
21660
+ function isWellFormed(value) {
21661
+ return !/[\uD800-\uDFFF]/u.test(value);
21662
+ }
21663
+ var S3FileSystem = class {
21664
+ async open(path6, options) {
21665
+ options.signal?.throwIfAborted();
21666
+ throw new FsError("ENOTSUP", { syscall: "open", path: path6 });
21667
+ }
21668
+ capabilities;
21669
+ readStream;
21670
+ writeStream;
21671
+ transport;
21672
+ bucket;
21673
+ prefix;
21674
+ allowRename;
21675
+ pageSize;
21676
+ maxReadBytes;
21677
+ maxStreamBytes;
21678
+ maxListEntries;
21679
+ maxRequests;
21680
+ requests = 0;
21681
+ removalLimits;
21682
+ removalBudgets = /* @__PURE__ */ new WeakMap();
21683
+ constructor(options) {
21684
+ if (!options?.transport || ["headObject", "getObject", "putObject", "deleteObject", "copyObject", "listObjectsV2"].some((method) => typeof options.transport[method] !== "function")) {
21685
+ throw new FsError("EINVAL", { message: "an explicit six-operation S3 transport is required; no default credentials or network client are created" });
21686
+ }
21687
+ if (options.compareEntry !== void 0 && typeof options.compareEntry !== "function") {
21688
+ throw new FsError("EINVAL", { message: "compareEntry must be a filesystem comparison callback" });
21689
+ }
21690
+ if (typeof options.bucket !== "string" || !options.bucket || /[/:\0]/.test(options.bucket)) {
21691
+ throw new FsError("EINVAL", { message: "bucket must be a nonempty bucket name, not a URL or ARN" });
21692
+ }
21693
+ const prefix = options.prefix ?? "";
21694
+ if (typeof prefix !== "string" || prefix.includes("\0") || !isWellFormed(prefix) || prefix !== "" && prefix.replace(/\/$/, "").split("/").some((part) => !part || part === "." || part === "..")) {
21695
+ throw new FsError("EINVAL", { message: "prefix must be a canonical relative object-key prefix" });
21696
+ }
21697
+ this.prefix = prefix === "" || prefix.endsWith("/") ? prefix : `${prefix}/`;
21698
+ if (utf8ByteLength3(this.prefix) > 1024)
21699
+ throw new FsError("ENAMETOOLONG", { message: "S3 prefix exceeds 1024 UTF-8 bytes" });
21700
+ this.transport = options.transport;
21701
+ this.bucket = options.bucket;
21702
+ this.allowRename = options.allowNonAtomicRename ?? true;
21703
+ this.pageSize = validateLimit(options.pageSize ?? 1e3, "pageSize", 1, 1e3);
21704
+ this.maxReadBytes = options.maxReadBytes === void 0 ? Infinity : validateLimit(options.maxReadBytes, "maxReadBytes", 0, Infinity);
21705
+ this.maxStreamBytes = options.maxStreamBytes === void 0 ? Infinity : validateLimit(options.maxStreamBytes, "maxStreamBytes", 0, Infinity);
21706
+ this.maxListEntries = options.maxListEntries === void 0 ? Infinity : validateLimit(options.maxListEntries, "maxListEntries", 1, Infinity);
21707
+ this.maxRequests = options.maxRequests === void 0 ? Infinity : validateLimit(options.maxRequests, "maxRequests", 1, Infinity);
21708
+ this.removalLimits = {
21709
+ maxRequests: validateLimit(options.removalLimits?.maxRequests ?? Infinity, "removalLimits.maxRequests", 1, Infinity),
21710
+ maxListEntries: validateLimit(options.removalLimits?.maxListEntries ?? Infinity, "removalLimits.maxListEntries", 1, Infinity),
21711
+ maxDeleteObjects: validateLimit(options.removalLimits?.maxDeleteObjects ?? Infinity, "removalLimits.maxDeleteObjects", 1, Infinity)
21712
+ };
21713
+ this.capabilities = Object.freeze({
21714
+ open: false,
21715
+ read: true,
21716
+ stat: true,
21717
+ readdir: true,
21718
+ realpath: true,
21719
+ access: true,
21720
+ write: true,
21721
+ explicitDirectories: true,
21722
+ implicitDirectories: true,
21723
+ mkdir: true,
21724
+ recursiveMkdir: true,
21725
+ remove: true,
21726
+ removeDirectory: true,
21727
+ recursiveRemove: true,
21728
+ copy: true,
21729
+ readlink: false,
21730
+ exclusiveCopy: options.transport.capabilities?.conditionalCopy === true,
21731
+ append: options.transport.capabilities?.conditionalPut === true,
21732
+ exclusiveCreate: options.transport.capabilities?.conditionalPut === true,
21733
+ truncate: options.transport.capabilities?.conditionalPut === true,
21734
+ atomicRenameNoReplace: false,
21735
+ rename: this.allowRename && options.transport.capabilities?.conditionalDelete === true && (options.transport.capabilities?.conditionalCopy === true || options.transport.capabilities?.conditionalPut === true),
21736
+ streamingAppend: options.transport.capabilities?.streamingWrite === true && options.transport.capabilities?.conditionalPut === true && typeof options.transport.putObjectStream === "function",
21737
+ randomAccessWrite: false,
21738
+ readOnly: options.readOnly ?? false,
21739
+ symlinks: false,
21740
+ hardlinks: false,
21741
+ permissions: false,
21742
+ timestamps: options.transport.capabilities?.conditionalCopy === true || options.transport.capabilities?.conditionalPut === true,
21743
+ atomicRename: false,
21744
+ snapshotRmdir: true,
21745
+ streamingRead: options.transport.capabilities?.streamingRead === true && typeof options.transport.getObjectStream === "function",
21746
+ streamingWrite: options.transport.capabilities?.streamingWrite === true && typeof options.transport.putObjectStream === "function"
21747
+ });
21748
+ if (this.capabilities.streamingRead)
21749
+ this.readStream = this.streamRead.bind(this);
21750
+ if (this.capabilities.streamingWrite)
21751
+ this.writeStream = this.streamWrite.bind(this);
21752
+ const transport = this.transport;
21753
+ const bucket = this.bucket;
21754
+ const registeredPrefix = this.prefix;
21755
+ registerS3EntryOwner(this, (path6) => this.path(path6), () => this.transport === transport && this.bucket === bucket && this.prefix === registeredPrefix, s3Comparison, options.compareEntry);
21756
+ registerEntryAuthority(this, compareOwnedS3Entries);
21757
+ }
21758
+ async compareEntry(path6, peer, peerPath, options = {}) {
21759
+ return compareEntries(this, path6, peer, peerPath, options);
21760
+ }
21761
+ path(input) {
21762
+ if (typeof input !== "string" || input.includes("\0") || !isWellFormed(input))
21763
+ fail2("EINVAL", "resolve", input, "invalid path string");
21764
+ const components2 = [];
21765
+ for (const part of input.split("/")) {
21766
+ if (!part || part === ".")
21767
+ continue;
21768
+ if (part === "..") {
21769
+ if (components2.length === 0)
21770
+ fail2("EACCES", "resolve", input, "path attempts to escape the configured prefix");
21771
+ components2.pop();
21772
+ } else
21773
+ components2.push(part);
21774
+ }
21775
+ const path6 = `/${components2.join("/")}`;
21776
+ if (utf8ByteLength3(this.key(path6)) > 1024)
21777
+ fail2("ENAMETOOLONG", "resolve", input);
21778
+ return path6;
21779
+ }
21780
+ key(path6) {
21781
+ return this.prefix + path6.slice(1);
21782
+ }
21783
+ directoryKey(path6) {
21784
+ const key2 = path6 === "/" ? this.prefix : `${this.key(path6)}/`;
21785
+ if (utf8ByteLength3(key2) > 1024)
21786
+ fail2("ENAMETOOLONG", "resolve", path6);
21787
+ return key2;
21788
+ }
21789
+ checkAbort(options, syscall, path6) {
21790
+ if (options.signal?.aborted)
21791
+ fail2("ECANCELED", syscall, path6);
21792
+ }
21793
+ requestOptions(options) {
21794
+ return options.signal === void 0 ? {} : { abortSignal: options.signal };
21795
+ }
21796
+ async call(syscall, path6, options, action, precondition) {
21797
+ this.checkAbort(options, syscall, path6);
21798
+ chargeScopedTransportCall(options);
21799
+ this.checkAbort(options, syscall, path6);
21800
+ const budget = this.removalBudgets.get(options);
21801
+ if (budget && ++budget.requests > this.removalLimits.maxRequests) {
21802
+ fail2("EFBIG", "rm", path6, "S3 removal request budget exceeded");
21803
+ }
21804
+ if (this.requests >= this.maxRequests) {
21805
+ fail2("EFBIG", syscall, path6, "S3 transport request budget exceeded");
21806
+ }
21807
+ this.requests++;
21808
+ let onAbort;
21809
+ try {
21810
+ const pending = action();
21811
+ const result = options.signal ? await new Promise((resolve, reject) => {
21812
+ const signal = options.signal;
21813
+ onAbort = () => reject(new FsError("ECANCELED", { syscall, path: path6, cause: signal.reason }));
21814
+ signal.addEventListener("abort", onAbort, { once: true });
21815
+ if (signal.aborted)
21816
+ onAbort();
21817
+ pending.then((value) => {
21818
+ if (signal.aborted && typeof value === "object" && value !== null && "Body" in value)
21819
+ this.dispose(value.Body);
21820
+ resolve(value);
21821
+ }, reject);
21822
+ }) : await pending;
21823
+ this.checkAbort(options, syscall, path6);
21824
+ return result;
21825
+ } catch (error) {
21826
+ if (options.signal?.aborted)
21827
+ fail2("ECANCELED", syscall, path6);
21828
+ throw translate(error, syscall, path6, precondition);
21829
+ } finally {
21830
+ if (onAbort)
21831
+ options.signal?.removeEventListener("abort", onAbort);
21832
+ }
21833
+ }
21834
+ writable(path6, mode) {
21835
+ if (this.capabilities.readOnly)
21836
+ fail2("EROFS", "write", path6);
21837
+ if (mode !== void 0)
21838
+ validateLimit(mode, "mode", 0, 4095);
21839
+ }
21840
+ unsupported(operation, path6) {
21841
+ return fail2("ENOTSUP", operation, path6, `S3 does not support ${operation} with the configured transport`);
21842
+ }
21843
+ async head(key2, path6, options) {
21844
+ try {
21845
+ const input = { Bucket: this.bucket, Key: key2 };
21846
+ return await this.call("headObject", path6, options, () => queryS3Head(input, (query) => this.transport.headObject(query, this.requestOptions(options))));
21847
+ } catch (error) {
21848
+ if (isFsError(error, "ENOENT") && serviceCode(error.cause) !== "NoSuchBucket")
21849
+ return void 0;
21850
+ throw error;
21851
+ }
21852
+ }
21853
+ makeStat(type, metadata) {
21854
+ const size = type === "directory" ? 0 : metadata?.ContentLength;
21855
+ if (size === void 0 || !Number.isSafeInteger(size) || size < 0)
21856
+ fail2("EIO", "stat", "", "transport omitted a valid object ContentLength");
21857
+ const modified = metadata?.LastModified?.getTime() ?? 0;
21858
+ if (!Number.isFinite(modified))
21859
+ fail2("EIO", "stat", "", "transport returned an invalid LastModified");
21860
+ const timestamp = (key2, fallback) => {
21861
+ const value = metadata?.Metadata?.[key2];
21862
+ if (value === void 0)
21863
+ return fallback;
21864
+ const parsed = Number(value);
21865
+ if (!value || !Number.isFinite(parsed))
21866
+ fail2("EIO", "stat", "", "invalid virtual timestamp metadata");
21867
+ return parsed;
21868
+ };
21869
+ const storedMode = metadata?.Metadata?.["virtual-bash-mode"];
21870
+ const mode = storedMode === void 0 ? type === "directory" ? 493 : 420 : Number(storedMode);
21871
+ if (!Number.isSafeInteger(mode) || mode < 0 || mode > 4095 || storedMode === "")
21872
+ fail2("EIO", "stat", "", "invalid virtual mode metadata");
21873
+ return {
21874
+ type,
21875
+ size,
21876
+ mode: (type === "directory" ? 16384 : 32768) | mode,
21877
+ mtimeMs: timestamp("virtual-bash-mtime", modified),
21878
+ atimeMs: timestamp("virtual-bash-atime", 0),
21879
+ ctimeMs: modified
21880
+ };
21881
+ }
21882
+ async page(prefix, path6, options, delimiter, token, maxKeys = this.pageSize) {
21883
+ const budget = this.removalBudgets.get(options);
21884
+ if (budget)
21885
+ maxKeys = Math.min(maxKeys, this.removalLimits.maxListEntries - budget.entries + 1);
21886
+ const result = await this.call("listObjectsV2", path6, options, () => this.transport.listObjectsV2({
21887
+ Bucket: this.bucket,
21888
+ Prefix: prefix,
21889
+ MaxKeys: maxKeys,
21890
+ ...delimiter === void 0 ? {} : { Delimiter: delimiter },
21891
+ ...token === void 0 ? {} : { ContinuationToken: token }
21892
+ }, this.requestOptions(options)));
21893
+ if (budget) {
21894
+ budget.entries += (result.Contents?.length ?? 0) + (result.CommonPrefixes?.length ?? 0);
21895
+ if (budget.entries > this.removalLimits.maxListEntries)
21896
+ fail2("EFBIG", "rm", path6, "S3 removal listing budget exceeded");
21897
+ }
21898
+ for (const item of result.Contents ?? []) {
21899
+ if (typeof item.Key !== "string" || !item.Key.startsWith(prefix))
21900
+ fail2("EIO", "listObjectsV2", path6, "transport returned an object outside the requested prefix");
21901
+ this.validateObject(item, path6);
21902
+ }
21903
+ for (const item of result.CommonPrefixes ?? []) {
21904
+ if (delimiter === void 0 || typeof item.Prefix !== "string" || !item.Prefix.startsWith(prefix) || !item.Prefix.endsWith("/") || item.Prefix === prefix)
21905
+ fail2("EIO", "listObjectsV2", path6, "invalid common prefix");
21906
+ this.validateKey(item.Prefix, path6);
21907
+ }
21908
+ if (result.IsTruncated !== void 0 && typeof result.IsTruncated !== "boolean")
21909
+ fail2("EIO", "listObjectsV2", path6, "invalid IsTruncated flag");
21910
+ return result;
21911
+ }
21912
+ validateKey(key2, path6) {
21913
+ if (!key2.startsWith(this.prefix))
21914
+ fail2("EIO", "listObjectsV2", path6, "key escapes the configured prefix");
21915
+ const relative = key2.slice(this.prefix.length).replace(/\/$/, "");
21916
+ if (!isWellFormed(key2) || key2.includes("\0") || utf8ByteLength3(key2) > 1024 || relative !== "" && relative.split("/").some((part) => !part || part === "." || part === "..")) {
21917
+ fail2("ENOTSUP", "listObjectsV2", path6, "object key cannot be represented as a canonical filesystem path");
21918
+ }
21919
+ }
21920
+ validateObject(object3, path6) {
21921
+ const key2 = object3.Key;
21922
+ this.validateKey(key2, path6);
21923
+ if (object3.Size === void 0 || !Number.isSafeInteger(object3.Size) || object3.Size < 0)
21924
+ fail2("EIO", "listObjectsV2", path6, "invalid object size");
21925
+ if (key2.endsWith("/") && object3.Size !== 0)
21926
+ fail2("ENOTSUP", "listObjectsV2", path6, "nonempty slash-suffixed objects cannot be treated as directories");
21927
+ }
21928
+ async *pages(prefix, path6, options, delimiter, maxKeys = this.pageSize) {
21929
+ const tokens = /* @__PURE__ */ new Set();
21930
+ let token;
21931
+ let entries2 = 0;
21932
+ do {
21933
+ const page = await this.page(prefix, path6, options, delimiter, token, maxKeys);
21934
+ entries2 += (page.Contents?.length ?? 0) + (page.CommonPrefixes?.length ?? 0);
21935
+ if (entries2 > this.maxListEntries || tokens.size >= this.maxListEntries)
21936
+ fail2("EFBIG", "listObjectsV2", path6, "listing exceeds maxListEntries");
21937
+ yield page;
21938
+ if (!page.IsTruncated)
21939
+ return;
21940
+ token = page.NextContinuationToken;
21941
+ if (typeof token !== "string" || !token || tokens.has(token))
21942
+ fail2("EIO", "listObjectsV2", path6, "missing or repeated continuation token");
21943
+ tokens.add(token);
21944
+ } while (true);
21945
+ }
21946
+ async inspect(path6, options) {
21947
+ if (path6 === "/") {
21948
+ const listing = await this.page(this.prefix, path6, options, void 0, void 0, 1);
21949
+ const marker2 = this.prefix && listing.Contents?.some((object3) => object3.Key === this.prefix) ? await this.head(this.prefix, path6, options) : void 0;
21950
+ if (marker2 && marker2.ContentLength !== 0)
21951
+ this.unsupported("nonempty directory markers", path6);
21952
+ return { stat: this.makeStat("directory", marker2), ...marker2 ? { metadata: marker2 } : {} };
21953
+ }
21954
+ const file = await this.head(this.key(path6), path6, options);
21955
+ if (utf8ByteLength3(this.key(path6)) === 1024) {
21956
+ return file ? { stat: this.makeStat("file", file), metadata: file } : void 0;
21957
+ }
21958
+ const directoryKey = this.directoryKey(path6);
21959
+ let directory = false;
21960
+ let hasMarker = false;
21961
+ for await (const children of this.pages(directoryKey, path6, options, void 0, 1)) {
21962
+ if ((children.Contents?.length ?? 0) > 0) {
21963
+ directory = true;
21964
+ hasMarker = children.Contents.some((object3) => object3.Key === directoryKey);
21965
+ break;
21966
+ }
21967
+ }
21968
+ const marker = hasMarker ? await this.head(directoryKey, path6, options) : void 0;
21969
+ if (marker && marker.ContentLength !== 0)
21970
+ this.unsupported("nonempty directory markers", path6);
21971
+ if (file && directory)
21972
+ this.unsupported("file/prefix collisions", path6);
21973
+ if (file)
21974
+ return { stat: this.makeStat("file", file), metadata: file };
21975
+ if (directory)
21976
+ return { stat: this.makeStat("directory", marker), ...marker ? { metadata: marker } : {} };
21977
+ return void 0;
21978
+ }
21979
+ async lookup(path6, options) {
21980
+ const ancestors = [];
21981
+ for (let parent = posixPath.dirname(path6); path6 !== "/"; parent = posixPath.dirname(parent)) {
21982
+ ancestors.unshift(parent);
21983
+ if (parent === "/")
21984
+ break;
21985
+ }
21986
+ for (const parent of ancestors) {
21987
+ if (parent === "/" && this.prefix === "")
21988
+ continue;
21989
+ const ancestor = await this.inspect(parent, options);
21990
+ if (!ancestor)
21991
+ fail2("ENOENT", "stat", parent);
21992
+ if (ancestor.stat.type !== "directory")
21993
+ fail2("ENOTDIR", "stat", parent);
21994
+ }
21995
+ return this.inspect(path6, options);
21996
+ }
21997
+ requireDirectorySuffix(input, info) {
21998
+ if (input.endsWith("/") && info?.stat.type === "file")
21999
+ fail2("ENOTDIR", "stat", input);
22000
+ }
22001
+ async stat(input, options = {}) {
22002
+ const path6 = this.path(input);
22003
+ const info = await this.lookup(path6, options);
22004
+ this.requireDirectorySuffix(input, info);
22005
+ if (!info)
22006
+ fail2("ENOENT", "stat", input);
22007
+ recordS3Stat(this, path6, info.stat, info.metadata);
22008
+ return info.stat;
22009
+ }
22010
+ async lstat(path6, options = {}) {
22011
+ return this.stat(path6, options);
22012
+ }
22013
+ async body(output, path6, options) {
22014
+ const limit = Math.min(this.maxReadBytes, options.maxBytes === void 0 ? this.maxReadBytes : validateLimit(options.maxBytes, "maxBytes", 0, Infinity));
22015
+ let iterator;
22016
+ return this.call("readFile", path6, options, async () => {
22017
+ if (output.Body && Symbol.asyncIterator in output.Body)
22018
+ iterator = output.Body[Symbol.asyncIterator]();
22019
+ if (output.ContentLength !== void 0 && output.ContentLength > limit)
22020
+ fail2("EFBIG", "readFile", path6);
22021
+ const body = output.Body;
22022
+ if (!body)
22023
+ fail2("EIO", "readFile", path6, "transport omitted the response body");
22024
+ let bytes;
22025
+ if (body instanceof Uint8Array) {
22026
+ if (body.byteLength > limit)
22027
+ fail2("EFBIG", "readFile", path6);
22028
+ bytes = new Uint8Array(body);
22029
+ } else if (Symbol.asyncIterator in body) {
22030
+ bytes = await collectBytes2({ [Symbol.asyncIterator]: () => iterator }, { ...limit === Infinity ? {} : { maxBytes: limit }, ...options.signal ? { signal: options.signal } : {} });
22031
+ } else if ("transformToByteArray" in body) {
22032
+ const converted = await body.transformToByteArray();
22033
+ if (!(converted instanceof Uint8Array))
22034
+ fail2("EIO", "readFile", path6, "transport body is not binary");
22035
+ if (converted.byteLength > limit)
22036
+ fail2("EFBIG", "readFile", path6);
22037
+ bytes = new Uint8Array(converted);
22038
+ } else
22039
+ fail2("EIO", "readFile", path6, "unsupported response body");
22040
+ this.checkAbort(options, "readFile", path6);
22041
+ if (output.ContentLength !== void 0 && output.ContentLength !== bytes.byteLength)
22042
+ fail2("EIO", "readFile", path6, "response body length does not match ContentLength");
22043
+ return bytes;
22044
+ }).catch((error) => {
22045
+ this.dispose(iterator);
22046
+ if (output.Body !== iterator)
22047
+ this.dispose(output.Body, iterator === void 0);
22048
+ throw error;
22049
+ });
22050
+ }
22051
+ async get(path6, options) {
22052
+ return this.call("getObject", path6, options, () => this.transport.getObject({ Bucket: this.bucket, Key: this.key(path6) }, this.requestOptions(options)));
22053
+ }
22054
+ async readFile(input, options = {}) {
22055
+ const path6 = this.path(input);
22056
+ if (options.maxBytes !== void 0)
22057
+ validateLimit(options.maxBytes, "maxBytes", 0, Infinity);
22058
+ const info = await this.stat(input, options);
22059
+ if (info.type === "directory")
22060
+ fail2("EISDIR", "readFile", path6);
22061
+ if (info.size > Math.min(this.maxReadBytes, options.maxBytes ?? this.maxReadBytes))
22062
+ fail2("EFBIG", "readFile", path6);
22063
+ const output = this.capabilities.streamingRead ? await this.call("getObject", path6, options, () => this.transport.getObjectStream({ Bucket: this.bucket, Key: this.key(path6) }, this.requestOptions(options))) : await this.get(path6, options);
22064
+ return this.body(output, path6, options);
22065
+ }
22066
+ etag(metadata, path6) {
22067
+ if (!metadata?.ETag)
22068
+ this.unsupported("conditional mutation without an ETag", path6);
22069
+ return metadata.ETag;
22070
+ }
22071
+ async writeFile(input, data, options = {}) {
22072
+ const path6 = this.path(input);
22073
+ this.writable(path6, options.mode);
22074
+ if (!(data instanceof Uint8Array))
22075
+ fail2("EINVAL", "writeFile", path6, "data must be Uint8Array");
22076
+ const bytes = new Uint8Array(data);
22077
+ if (bytes.byteLength > 5e9)
22078
+ fail2("EFBIG", "writeFile", path6, "multipart upload is not supported");
22079
+ const flag = options.flag ?? "w";
22080
+ if (!["w", "wx", "a", "ax"].includes(flag))
22081
+ fail2("EINVAL", "writeFile", path6, "invalid write flag");
22082
+ if (flag !== "w" && !this.transport.capabilities?.conditionalPut)
22083
+ this.unsupported("conditional writes", path6);
22084
+ const info = await this.lookup(path6, options);
22085
+ this.requireDirectorySuffix(input, info);
22086
+ if (info?.stat.type === "directory")
22087
+ fail2("EISDIR", "writeFile", path6);
22088
+ if (input.endsWith("/"))
22089
+ fail2("EISDIR", "writeFile", input);
22090
+ const exclusive = flag === "wx" || flag === "ax";
22091
+ if (exclusive && info)
22092
+ fail2("EEXIST", "writeFile", path6);
22093
+ let body = bytes;
22094
+ let match;
22095
+ let metadata = this.writeMetadata(info?.metadata, options.mode);
22096
+ if (flag === "a" && info) {
22097
+ const current = await this.get(path6, options);
22098
+ const previous = await this.body(current, path6, options);
22099
+ match = this.etag(current, path6);
22100
+ metadata = { ...current.Metadata };
22101
+ delete metadata["virtual-bash-mtime"];
22102
+ if (previous.length + bytes.length > this.maxReadBytes)
22103
+ fail2("EFBIG", "appendFile", path6);
22104
+ body = new Uint8Array(previous.length + bytes.length);
22105
+ body.set(previous);
22106
+ body.set(bytes, previous.length);
22107
+ }
22108
+ await this.call("putObject", path6, options, () => this.transport.putObject({
22109
+ Bucket: this.bucket,
22110
+ Key: this.key(path6),
22111
+ Body: body,
22112
+ ...match === void 0 ? {} : { IfMatch: match },
22113
+ ...exclusive || flag === "a" && !info ? { IfNoneMatch: "*" } : {},
22114
+ ...metadata === void 0 ? {} : { Metadata: metadata }
22115
+ }, this.requestOptions(options)), exclusive ? "EEXIST" : "EAGAIN");
22116
+ }
22117
+ writeMetadata(previous, mode) {
22118
+ const metadata = { ...previous?.Metadata };
22119
+ delete metadata["virtual-bash-mtime"];
22120
+ if (previous === void 0 && mode !== void 0)
22121
+ metadata["virtual-bash-mode"] = String(mode);
22122
+ return Object.keys(metadata).length === 0 ? void 0 : metadata;
22123
+ }
22124
+ async appendFile(path6, data, options = {}) {
22125
+ return this.writeFile(path6, data, { ...options, flag: "a" });
22126
+ }
22127
+ async mkdir(input, options = {}) {
22128
+ const path6 = this.path(input);
22129
+ this.writable(path6, options.mode);
22130
+ if (options.recursive && path6 !== "/") {
22131
+ await this.mkdir(posixPath.dirname(path6), { ...options, recursive: true });
22132
+ }
22133
+ const info = await this.lookup(path6, options);
22134
+ if (info) {
22135
+ if (options.recursive && info.stat.type === "directory")
22136
+ return;
22137
+ fail2("EEXIST", "mkdir", path6);
22138
+ }
22139
+ await this.call("putObject", path6, options, () => this.transport.putObject({
22140
+ Bucket: this.bucket,
22141
+ Key: this.directoryKey(path6),
22142
+ Body: new Uint8Array(),
22143
+ ...options.mode === void 0 ? {} : { Metadata: { "virtual-bash-mode": String(options.mode) } },
22144
+ ...this.transport.capabilities?.conditionalPut ? { IfNoneMatch: "*" } : {}
22145
+ }, this.requestOptions(options)), "EEXIST");
22146
+ }
22147
+ async readdir(input, options = {}) {
22148
+ let limit;
22149
+ if (options.maxEntries !== void 0) {
22150
+ this.checkAbort(options, "readdir", input);
22151
+ limit = directoryEntryLimit(options, input);
22152
+ }
22153
+ const path6 = this.path(input);
22154
+ if ((await this.stat(input, options)).type !== "directory")
22155
+ fail2("ENOTDIR", "readdir", path6);
22156
+ const prefix = this.directoryKey(path6);
22157
+ const entries2 = /* @__PURE__ */ new Map();
22158
+ const add = (name, type) => {
22159
+ this.checkAbort(options, "readdir", path6);
22160
+ if (!name || name.includes("/"))
22161
+ fail2("EIO", "readdir", path6, "invalid direct child in delimited listing");
22162
+ const existing = entries2.get(name);
22163
+ if (existing && existing.type !== type)
22164
+ this.unsupported("file/prefix collisions", path6);
22165
+ if (!existing)
22166
+ admitDirectoryEntries(entries2.size + 1, limit, path6);
22167
+ entries2.set(name, { name, type });
22168
+ };
22169
+ const maxKeys = limit === void 0 ? this.pageSize : Math.min(this.pageSize, limit + 1);
22170
+ for await (const page of this.pages(prefix, path6, options, "/", maxKeys)) {
22171
+ for (const item of page.Contents ?? []) {
22172
+ if (item.Key === prefix)
22173
+ continue;
22174
+ add(item.Key.slice(prefix.length), "file");
22175
+ }
22176
+ for (const item of page.CommonPrefixes ?? [])
22177
+ add(item.Prefix.slice(prefix.length, -1), "directory");
22178
+ }
22179
+ return [...entries2.values()].sort((left, right) => compareKeys(left.name, right.name));
22180
+ }
22181
+ async tree(path6, options) {
22182
+ const objects = /* @__PURE__ */ new Map();
22183
+ for await (const page of this.pages(this.directoryKey(path6), path6, options)) {
22184
+ for (const item of page.Contents ?? [])
22185
+ objects.set(item.Key, item);
22186
+ }
22187
+ for (const key2 of objects.keys()) {
22188
+ const withoutSlash = key2.replace(/\/$/, "");
22189
+ if (key2.endsWith("/") && objects.has(withoutSlash))
22190
+ this.unsupported("file/prefix collisions", path6);
22191
+ let parent = posixPath.dirname(withoutSlash);
22192
+ while (parent !== "." && parent !== "/") {
22193
+ if (objects.has(parent))
22194
+ this.unsupported("file/prefix collisions", path6);
22195
+ parent = posixPath.dirname(parent);
22196
+ }
22197
+ }
22198
+ return [...objects.values()];
22199
+ }
22200
+ async rmdir(input, options = {}) {
22201
+ try {
22202
+ const path6 = this.path(input);
22203
+ this.checkAbort(options, "rmdir", input);
22204
+ this.writable(path6);
22205
+ if (path6 === "/")
22206
+ fail2("EBUSY", "rmdir", input, "cannot remove the mounted root");
22207
+ const info = await this.lookup(path6, options);
22208
+ this.checkAbort(options, "rmdir", input);
22209
+ if (!info)
22210
+ fail2("ENOENT", "rmdir", input);
22211
+ if (info.stat.type !== "directory")
22212
+ fail2("ENOTDIR", "rmdir", input);
22213
+ const prefix = this.directoryKey(path6);
22214
+ let markerObserved = false;
22215
+ for await (const page of this.pages(prefix, path6, options, "/", Math.max(2, this.pageSize))) {
22216
+ this.checkAbort(options, "rmdir", input);
22217
+ if (page.Contents?.some((item) => item.Key !== prefix) || page.CommonPrefixes?.length) {
22218
+ fail2("ENOTEMPTY", "rmdir", input);
22219
+ }
22220
+ if (page.IsTruncated === void 0)
22221
+ fail2("EIO", "rmdir", input, "listing did not confirm completeness");
22222
+ if (page.Contents?.some((item) => item.Key === prefix))
22223
+ markerObserved = true;
22224
+ }
22225
+ this.checkAbort(options, "rmdir", input);
22226
+ if (!info.metadata)
22227
+ fail2("ENOTSUP", "rmdir", input, "snapshot removal requires an explicit directory marker");
22228
+ if (!markerObserved)
22229
+ fail2("ENOENT", "rmdir", input, "directory marker disappeared during inspection");
22230
+ await this.call("deleteObject", path6, options, () => this.transport.deleteObject({ Bucket: this.bucket, Key: prefix }, this.requestOptions(options)));
22231
+ } catch (error) {
22232
+ if (isFsError(error) && (error.syscall !== "rmdir" || error.path !== input)) {
22233
+ throw new FsError(error.code, { syscall: "rmdir", path: input, cause: error });
22234
+ }
22235
+ throw error;
22236
+ }
22237
+ }
22238
+ async rm(input, options = {}) {
22239
+ options = { ...options };
22240
+ const budget = { requests: 0, entries: 0 };
22241
+ this.removalBudgets.set(options, budget);
22242
+ const path6 = this.path(input);
22243
+ this.writable(path6);
22244
+ if (path6 === "/")
22245
+ fail2("EBUSY", "rm", path6, "cannot remove the mounted root");
22246
+ let info;
22247
+ try {
22248
+ info = await this.lookup(path6, options);
22249
+ } catch (error) {
22250
+ if (options.force && isFsError(error, "ENOENT") && serviceCode(error.cause) !== "NoSuchBucket")
22251
+ return;
22252
+ throw error;
22253
+ }
22254
+ this.requireDirectorySuffix(input, info);
22255
+ if (!info) {
22256
+ if (options.force)
22257
+ return;
22258
+ fail2("ENOENT", "rm", path6);
22259
+ }
22260
+ let objects;
22261
+ if (info.stat.type === "directory" && !options.recursive) {
22262
+ const prefix = this.directoryKey(path6);
22263
+ objects = [];
22264
+ for await (const page of this.pages(prefix, path6, options, void 0, 2)) {
22265
+ if (page.Contents?.some((item) => item.Key !== prefix))
22266
+ fail2("ENOTEMPTY", "rm", path6);
22267
+ if (page.Contents?.length)
22268
+ objects = [{ Key: prefix }];
22269
+ }
22270
+ } else {
22271
+ objects = info.stat.type === "directory" ? await this.tree(path6, options) : [{ Key: this.key(path6) }];
22272
+ }
22273
+ if (objects.length > this.removalLimits.maxDeleteObjects || budget.requests + objects.length > this.removalLimits.maxRequests) {
22274
+ fail2("EFBIG", "rm", path6, "S3 removal delete or request budget exceeded; use bounded batches");
22275
+ }
22276
+ for (const item of objects) {
22277
+ await this.call("deleteObject", path6, options, () => this.transport.deleteObject({ Bucket: this.bucket, Key: item.Key }, this.requestOptions(options)));
22278
+ }
22279
+ }
22280
+ async copy(sourceKey, destinationKey, source, metadata, options, destination) {
22281
+ if (metadata.ContentLength === void 0 || metadata.ContentLength > 5e9)
22282
+ this.unsupported("multipart copy", source);
22283
+ const etag = this.etag(metadata, source);
22284
+ const result = await this.call("copyObject", source, options, () => this.transport.copyObject({
22285
+ Bucket: this.bucket,
22286
+ Key: destinationKey,
22287
+ CopySource: encodeCopySource(this.bucket, sourceKey),
22288
+ CopySourceIfMatch: etag,
22289
+ MetadataDirective: "COPY",
22290
+ ...options.exclusive ? { IfNoneMatch: "*" } : {},
22291
+ ...destination === void 0 ? {} : destination === null ? { IfNoneMatch: "*" } : { IfMatch: this.etag(destination, source) }
22292
+ }, this.requestOptions(options)));
22293
+ if (!result.CopyObjectResult?.ETag)
22294
+ fail2("EIO", "copyObject", source, "transport did not confirm a completed CopyObject result");
22295
+ }
22296
+ async copyFile(sourceInput, destinationInput, options = {}) {
22297
+ const source = this.path(sourceInput);
22298
+ const destination = this.path(destinationInput);
22299
+ this.writable(destination);
22300
+ if (options.exclusive && !this.transport.capabilities?.conditionalCopy)
22301
+ this.unsupported("exclusive server-side copy", destination);
22302
+ const origin = await this.lookup(source, options);
22303
+ this.requireDirectorySuffix(sourceInput, origin);
22304
+ if (!origin)
22305
+ fail2("ENOENT", "copyFile", source);
22306
+ if (origin.stat.type === "directory")
22307
+ fail2("EISDIR", "copyFile", source);
22308
+ const target = await this.lookup(destination, options);
22309
+ this.requireDirectorySuffix(destinationInput, target);
22310
+ if (target?.stat.type === "directory" || destinationInput.endsWith("/"))
22311
+ fail2("EISDIR", "copyFile", destination);
22312
+ if (target && options.exclusive)
22313
+ fail2("EEXIST", "copyFile", destination);
22314
+ if (source === destination)
22315
+ return;
22316
+ try {
22317
+ await this.copy(this.key(source), this.key(destination), source, origin.metadata, options);
22318
+ } catch (error) {
22319
+ if (!options.exclusive || !isFsError(error, "EAGAIN"))
22320
+ throw error;
22321
+ const status = error.cause?.$metadata?.httpStatusCode;
22322
+ if (serviceCode(error.cause) !== "PreconditionFailed" && status !== 412)
22323
+ throw error;
22324
+ let destinationExists = false;
22325
+ try {
22326
+ const currentSource = await this.head(this.key(source), source, options);
22327
+ if (currentSource?.ETag === origin.metadata?.ETag) {
22328
+ destinationExists = await this.head(this.key(destination), destination, options) !== void 0;
22329
+ }
22330
+ } catch (diagnosticError) {
22331
+ if (isFsError(diagnosticError, "ECANCELED"))
22332
+ throw diagnosticError;
22333
+ }
22334
+ if (destinationExists) {
22335
+ throw new FsError("EEXIST", { syscall: "copyFile", path: source, dest: destination, cause: error });
22336
+ }
22337
+ throw error;
22338
+ }
22339
+ }
22340
+ async rename(sourceInput, destinationInput, options = {}) {
22341
+ if (options.noReplace) {
22342
+ options.signal?.throwIfAborted();
22343
+ this.unsupported("atomic no-replace rename", sourceInput);
22344
+ }
22345
+ const source = this.path(sourceInput);
22346
+ const destination = this.path(destinationInput);
22347
+ this.writable(destination);
22348
+ if (!this.allowRename)
22349
+ this.unsupported("atomic rename; explicitly enable allowNonAtomicRename for copy/delete semantics", source);
22350
+ if (!this.transport.capabilities?.conditionalDelete)
22351
+ this.unsupported("rename without conditional delete", source);
22352
+ const conditionalCopy = this.transport.capabilities?.conditionalCopy === true;
22353
+ if (!conditionalCopy && this.transport.capabilities?.conditionalPut !== true) {
22354
+ this.unsupported("rename requires conditional destination copy or conditional PUT, plus conditional delete", source);
22355
+ }
22356
+ const streamFallback = this.capabilities.streamingRead && this.capabilities.streamingWrite;
22357
+ if (source === "/" || destination === "/")
22358
+ fail2("EBUSY", "rename", source);
22359
+ const origin = await this.lookup(source, options);
22360
+ this.requireDirectorySuffix(sourceInput, origin);
22361
+ if (!origin)
22362
+ fail2("ENOENT", "rename", source);
22363
+ if (source === destination) {
22364
+ this.requireDirectorySuffix(destinationInput, origin);
22365
+ return;
22366
+ }
22367
+ if (destination.startsWith(`${source}/`))
22368
+ fail2("EINVAL", "rename", destination, "cannot move a path into itself");
22369
+ const target = await this.lookup(destination, options);
22370
+ this.requireDirectorySuffix(destinationInput, target);
22371
+ if (destinationInput.endsWith("/") && origin.stat.type !== "directory")
22372
+ fail2("ENOTDIR", "rename", destination);
22373
+ if (target && target.stat.type !== origin.stat.type)
22374
+ fail2(target.stat.type === "directory" ? "EISDIR" : "ENOTDIR", "rename", destination);
22375
+ if (target?.stat.type === "directory" && (await this.readdir(destination, options)).length > 0)
22376
+ fail2("ENOTEMPTY", "rename", destination);
22377
+ if (target?.metadata)
22378
+ this.etag(target.metadata, destination);
22379
+ const objects = origin.stat.type === "directory" ? await this.tree(source, options) : [{
22380
+ Key: this.key(source),
22381
+ Size: origin.stat.size,
22382
+ ETag: origin.metadata?.ETag
22383
+ }];
22384
+ for (const object3 of objects) {
22385
+ this.etag({ ETag: object3.ETag }, source);
22386
+ if (object3.Size === void 0 || object3.Size > 5e9)
22387
+ this.unsupported("multipart copy", source);
22388
+ if (!conditionalCopy && object3.Size > (streamFallback ? this.maxStreamBytes : this.maxReadBytes)) {
22389
+ fail2("EFBIG", "rename", source, "conditional PUT fallback exceeds its configured transfer or buffered read limit");
22390
+ }
22391
+ if (utf8ByteLength3(this.key(destination) + object3.Key.slice(this.key(source).length)) > 1024)
22392
+ fail2("ENAMETOOLONG", "rename", destination);
22393
+ }
22394
+ const copied = [];
22395
+ const deleted = [];
22396
+ let phase = "copy";
22397
+ try {
22398
+ for (const object3 of objects) {
22399
+ const destinationKey = this.key(destination) + object3.Key.slice(this.key(source).length);
22400
+ const destinationMetadata = origin.stat.type === "file" || object3.Key === this.directoryKey(source) ? target?.metadata ?? null : null;
22401
+ const metadata = { ContentLength: object3.Size, ETag: object3.ETag };
22402
+ if (conditionalCopy)
22403
+ await this.copy(object3.Key, destinationKey, source, metadata, options, destinationMetadata);
22404
+ else
22405
+ await this.copyWithPut(object3.Key, destinationKey, source, metadata, destinationMetadata, options, streamFallback);
22406
+ copied.push(destinationKey);
22407
+ }
22408
+ phase = "delete";
22409
+ for (const object3 of objects) {
22410
+ await this.call("deleteObject", source, options, () => this.transport.deleteObject({
22411
+ Bucket: this.bucket,
22412
+ Key: object3.Key,
22413
+ IfMatch: object3.ETag
22414
+ }, this.requestOptions(options)));
22415
+ deleted.push(object3.Key);
22416
+ }
22417
+ } catch (error) {
22418
+ throw new S3RenameError(source, destination, phase, copied, deleted, translate(error, "rename", source));
22419
+ }
22420
+ }
22421
+ async copyWithPut(sourceKey, destinationKey, source, expected, destination, options, streaming) {
22422
+ const etag = this.etag(expected, source);
22423
+ const condition = destination === null ? { IfNoneMatch: "*" } : { IfMatch: this.etag(destination, destinationKey) };
22424
+ const controller = new AbortController();
22425
+ const signalScope = options.signal ? composeAbortSignals([options.signal, controller.signal]) : void 0;
22426
+ const signal = signalScope?.signal ?? controller.signal;
22427
+ const operationOptions = { signal };
22428
+ let output;
22429
+ let upload;
22430
+ let reading = false;
22431
+ try {
22432
+ output = await this.call("getObject", source, operationOptions, () => streaming ? this.transport.getObjectStream({ Bucket: this.bucket, Key: sourceKey, IfMatch: etag }, { abortSignal: signal }) : this.transport.getObject({ Bucket: this.bucket, Key: sourceKey }, { abortSignal: signal }));
22433
+ if (this.etag(output, source) !== etag)
22434
+ fail2("EAGAIN", "rename", source, "source changed before conditional PUT copy");
22435
+ if (output.ContentLength !== void 0 && output.ContentLength !== expected.ContentLength) {
22436
+ fail2("EIO", "rename", source, "source response length differs from the enumerated object");
22437
+ }
22438
+ const input = {
22439
+ Bucket: this.bucket,
22440
+ Key: destinationKey,
22441
+ ...condition,
22442
+ ...output.Metadata === void 0 ? {} : { Metadata: { ...output.Metadata } }
22443
+ };
22444
+ if (!streaming) {
22445
+ const body2 = await this.body(output, source, operationOptions);
22446
+ if (body2.length !== expected.ContentLength)
22447
+ fail2("EIO", "rename", source, "source body length differs from the enumerated object");
22448
+ await this.call("putObject", source, operationOptions, () => this.transport.putObject({ ...input, Body: body2 }, { abortSignal: signal }));
22449
+ return;
22450
+ }
22451
+ const body = output.Body;
22452
+ if (!body || !(Symbol.asyncIterator in body))
22453
+ fail2("EIO", "rename", source, "streaming transport did not return an async binary body");
22454
+ let finished = false;
22455
+ upload = (async function* () {
22456
+ let count = 0;
22457
+ reading = true;
22458
+ for await (const chunk of readBytes(body, signal)) {
22459
+ if (chunk.length > expected.ContentLength - count)
22460
+ fail2("EIO", "rename", source, "source body exceeds its enumerated length");
22461
+ count += chunk.length;
22462
+ for (let offset = 0; offset < chunk.length; offset += 64 * 1024) {
22463
+ signal.throwIfAborted();
22464
+ yield new Uint8Array(chunk.subarray(offset, offset + 64 * 1024));
22465
+ }
22466
+ }
22467
+ if (count !== expected.ContentLength)
22468
+ fail2("EIO", "rename", source, "incomplete source body");
22469
+ finished = true;
22470
+ })();
22471
+ await this.call("putObject", source, operationOptions, () => this.transport.putObjectStream({ ...input, Body: upload }, { abortSignal: signal }));
22472
+ if (!finished)
22473
+ fail2("EIO", "rename", source, "transport completed without consuming the conditional copy body");
22474
+ } finally {
22475
+ controller.abort();
22476
+ signalScope?.dispose();
22477
+ this.dispose(upload);
22478
+ this.dispose(output?.Body, !reading);
22479
+ }
22480
+ }
22481
+ async realpath(input, options = {}) {
22482
+ await this.stat(input, options);
22483
+ return this.path(input);
22484
+ }
22485
+ async access(path6, mode = 0, options = {}) {
22486
+ if (!Number.isInteger(mode) || mode < 0 || mode > 7)
22487
+ fail2("EINVAL", "access", path6);
22488
+ const info = await this.stat(path6, options);
22489
+ if ((mode & 2) !== 0 && this.capabilities.readOnly)
22490
+ fail2("EROFS", "access", path6);
22491
+ if ((mode & 1) !== 0 && info.type !== "directory")
22492
+ fail2("EACCES", "access", path6);
22493
+ }
22494
+ async readlink(path6) {
22495
+ return this.unsupported("readlink", path6);
22496
+ }
22497
+ async symlink(_target, path6) {
22498
+ this.unsupported("symlink", path6);
22499
+ }
22500
+ async link(_existingPath, path6) {
22501
+ this.unsupported("link", path6);
22502
+ }
22503
+ async chmod(path6, _mode) {
22504
+ this.unsupported("chmod", path6);
22505
+ }
22506
+ async utimes(input, atimeMs, mtimeMs, options = {}) {
22507
+ const path6 = this.path(input);
22508
+ this.writable(path6);
22509
+ if (!Number.isFinite(atimeMs) || !Number.isFinite(mtimeMs))
22510
+ fail2("EINVAL", "utimes", path6);
22511
+ const info = await this.lookup(path6, options);
22512
+ this.requireDirectorySuffix(input, info);
22513
+ if (!info)
22514
+ fail2("ENOENT", "utimes", path6);
22515
+ if (!this.capabilities.timestamps)
22516
+ this.unsupported("conditional metadata mutation", path6);
22517
+ const key2 = info.stat.type === "directory" ? this.directoryKey(path6) : this.key(path6);
22518
+ if (!key2)
22519
+ this.unsupported("timestamps on an unprefixed bucket root", path6);
22520
+ const metadata = {
22521
+ ...info.metadata?.Metadata,
22522
+ "virtual-bash-atime": String(atimeMs),
22523
+ "virtual-bash-mtime": String(mtimeMs)
22524
+ };
22525
+ if (!info.metadata) {
22526
+ if (!this.transport.capabilities?.conditionalPut)
22527
+ this.unsupported("conditional directory marker creation", path6);
22528
+ await this.call("utimes", path6, options, () => this.transport.putObject({
22529
+ Bucket: this.bucket,
22530
+ Key: key2,
22531
+ Body: new Uint8Array(),
22532
+ Metadata: metadata,
22533
+ IfNoneMatch: "*"
22534
+ }, this.requestOptions(options)));
22535
+ return;
22536
+ }
22537
+ if (!this.transport.capabilities?.conditionalCopy) {
22538
+ const current = await this.call("getObject", path6, options, () => this.transport.getObject({
22539
+ Bucket: this.bucket,
22540
+ Key: key2
22541
+ }, this.requestOptions(options)));
22542
+ const body = await this.body(current, path6, options);
22543
+ await this.call("utimes", path6, options, () => this.transport.putObject({
22544
+ Bucket: this.bucket,
22545
+ Key: key2,
22546
+ Body: body,
22547
+ IfMatch: this.etag(current, path6),
22548
+ Metadata: { ...current.Metadata, "virtual-bash-atime": String(atimeMs), "virtual-bash-mtime": String(mtimeMs) }
22549
+ }, this.requestOptions(options)));
22550
+ return;
22551
+ }
22552
+ if (info.stat.size > 5e9)
22553
+ this.unsupported("multipart metadata copy", path6);
22554
+ const etag = this.etag(info.metadata, path6);
22555
+ const result = await this.call("utimes", path6, options, () => this.transport.copyObject({
22556
+ Bucket: this.bucket,
22557
+ Key: key2,
22558
+ CopySource: encodeCopySource(this.bucket, key2),
22559
+ CopySourceIfMatch: etag,
22560
+ IfMatch: etag,
22561
+ MetadataDirective: "REPLACE",
22562
+ Metadata: metadata
22563
+ }, this.requestOptions(options)));
22564
+ if (!result.CopyObjectResult?.ETag)
22565
+ fail2("EIO", "utimes", path6, "transport did not confirm a completed metadata copy");
22566
+ }
22567
+ async truncate(input, length = 0, options = {}) {
22568
+ const path6 = this.path(input);
22569
+ this.writable(path6);
22570
+ validateLimit(length, "length", 0);
22571
+ const info = await this.lookup(path6, options);
22572
+ this.requireDirectorySuffix(input, info);
22573
+ if (!info)
22574
+ fail2("ENOENT", "truncate", path6);
22575
+ if (info.stat.type === "directory")
22576
+ fail2("EISDIR", "truncate", path6);
22577
+ if (!this.transport.capabilities?.conditionalPut)
22578
+ this.unsupported("conditional truncate", path6);
22579
+ if (length > this.maxReadBytes)
22580
+ fail2("EFBIG", "truncate", path6);
22581
+ let current = info.metadata;
22582
+ const body = new Uint8Array(length);
22583
+ if (length !== 0 && info.stat.size !== 0) {
22584
+ if (this.readStream) {
22585
+ const previous = await this.call("truncate", path6, options, () => collectBytes2(this.readStream(input, { ...options, endExclusive: Math.min(length, info.stat.size) }), { ...options, maxBytes: length }));
22586
+ body.set(previous);
22587
+ } else {
22588
+ const output = await this.get(path6, options);
22589
+ const previous = await this.body(output, path6, options);
22590
+ current = output;
22591
+ body.set(previous.subarray(0, length));
22592
+ }
22593
+ }
22594
+ const metadata = { ...current.Metadata };
22595
+ delete metadata["virtual-bash-mtime"];
22596
+ await this.call("truncate", path6, options, () => this.transport.putObject({
22597
+ Bucket: this.bucket,
22598
+ Key: this.key(path6),
22599
+ Body: body,
22600
+ IfMatch: this.etag(current, path6),
22601
+ Metadata: metadata
22602
+ }, this.requestOptions(options)));
22603
+ }
22604
+ async *streamRead(input, options = {}) {
22605
+ const path6 = this.path(input);
22606
+ const start = validateLimit(options.start ?? 0, "start", 0);
22607
+ const end = options.endExclusive === void 0 ? void 0 : validateLimit(options.endExclusive, "endExclusive", start);
22608
+ const chunkSize = validateLimit(options.chunkSize ?? 64 * 1024, "chunkSize", 1);
22609
+ const info = await this.lookup(path6, options);
22610
+ this.requireDirectorySuffix(input, info);
22611
+ if (!info)
22612
+ fail2("ENOENT", "readStream", path6);
22613
+ if (info.stat.type === "directory")
22614
+ fail2("EISDIR", "readStream", path6);
22615
+ const stop = Math.min(end ?? info.stat.size, info.stat.size);
22616
+ const expected = Math.max(0, stop - start);
22617
+ if (expected > this.maxStreamBytes)
22618
+ fail2("EFBIG", "readStream", path6);
22619
+ if (expected === 0 && info.stat.size !== 0)
22620
+ return;
22621
+ let count = 0;
22622
+ let finished = false;
22623
+ const controller = new AbortController();
22624
+ const signalScope = options.signal ? composeAbortSignals([options.signal, controller.signal]) : void 0;
22625
+ const signal = signalScope?.signal ?? controller.signal;
22626
+ let output;
22627
+ let iterator;
22628
+ try {
22629
+ output = await this.call("getObject", path6, options, () => this.transport.getObjectStream({
22630
+ Bucket: this.bucket,
22631
+ Key: this.key(path6),
22632
+ IfMatch: this.etag(info.metadata, path6),
22633
+ ...expected === 0 || start === 0 && stop === info.stat.size ? {} : { Range: `bytes=${start}-${stop - 1}` }
22634
+ }, { abortSignal: signal }));
22635
+ if (output.ETag !== void 0 && output.ETag !== info.metadata?.ETag)
22636
+ fail2("EIO", "readStream", path6, "response ETag differs from requested snapshot");
22637
+ if (output.ContentLength !== void 0 && output.ContentLength !== expected)
22638
+ fail2("EIO", "readStream", path6, "response length differs from requested snapshot");
22639
+ iterator = readBytes(output.Body, signal)[Symbol.asyncIterator]();
22640
+ while (true) {
22641
+ const result = await iterator.next();
22642
+ if (result.done)
22643
+ break;
22644
+ const chunk = result.value;
22645
+ if (chunk.length > expected - count)
22646
+ fail2("EIO", "readStream", path6, "response exceeds requested length");
22647
+ count += chunk.length;
22648
+ for (let offset = 0; offset < chunk.length; offset += chunkSize) {
22649
+ this.checkAbort(options, "readStream", path6);
22650
+ yield new Uint8Array(chunk.subarray(offset, offset + chunkSize));
22651
+ }
22652
+ }
22653
+ if (count !== expected)
22654
+ fail2("EIO", "readStream", path6, "incomplete response body");
22655
+ finished = true;
22656
+ } catch (error) {
22657
+ this.checkAbort(options, "readStream", path6);
22658
+ throw translate(error, "readStream", path6);
22659
+ } finally {
22660
+ controller.abort();
22661
+ signalScope?.dispose();
22662
+ if (!finished && output) {
22663
+ this.dispose(iterator);
22664
+ this.dispose(output.Body, iterator === void 0);
22665
+ }
22666
+ }
22667
+ }
22668
+ dispose(body, returnIterator = true) {
22669
+ const disposable = body;
22670
+ try {
22671
+ const result = typeof disposable?.destroy === "function" ? disposable.destroy() : typeof disposable?.cancel === "function" ? disposable.cancel() : returnIterator ? disposable?.return?.() : void 0;
22672
+ void Promise.resolve(result).catch(() => {
22673
+ });
22674
+ } catch (ignoredError) {
22675
+ void ignoredError;
22676
+ }
22677
+ }
22678
+ async streamWrite(input, source, options = {}) {
22679
+ const path6 = this.path(input);
22680
+ this.writable(path6, options.mode);
22681
+ const flag = options.flag ?? "w";
22682
+ if (!["w", "wx", "a", "ax"].includes(flag))
22683
+ fail2("EINVAL", "writeStream", path6);
22684
+ if (flag !== "w" && !this.transport.capabilities?.conditionalPut)
22685
+ this.unsupported("conditional writes", path6);
22686
+ const info = await this.lookup(path6, options);
22687
+ this.requireDirectorySuffix(input, info);
22688
+ if (info?.stat.type === "directory" || input.endsWith("/"))
22689
+ fail2("EISDIR", "writeStream", path6);
22690
+ const exclusive = flag === "wx" || flag === "ax";
22691
+ if (exclusive && info)
22692
+ fail2("EEXIST", "writeStream", path6);
22693
+ if (flag === "a") {
22694
+ const current = info ? await this.get(path6, options) : void 0;
22695
+ const previous = current ? await this.body(current, path6, options) : new Uint8Array();
22696
+ const limit = Math.min(this.maxReadBytes, this.maxStreamBytes);
22697
+ if (previous.length > limit)
22698
+ fail2("EFBIG", "writeStream", path6);
22699
+ const bytes = await this.call("writeStream", path6, options, () => collectBytes2(source, { ...limit === Infinity ? {} : { maxBytes: limit - previous.length }, ...options }));
22700
+ const body2 = new Uint8Array(previous.length + bytes.length);
22701
+ body2.set(previous);
22702
+ body2.set(bytes, previous.length);
22703
+ const metadata = this.writeMetadata(current, options.mode);
22704
+ await this.call("putObject", path6, options, () => this.transport.putObject({
22705
+ Bucket: this.bucket,
22706
+ Key: this.key(path6),
22707
+ Body: body2,
22708
+ ...current ? { IfMatch: this.etag(current, path6) } : { IfNoneMatch: "*" },
22709
+ ...metadata ? { Metadata: metadata } : {}
22710
+ }, this.requestOptions(options)));
22711
+ return;
22712
+ }
22713
+ const controller = new AbortController();
22714
+ const signalScope = options.signal ? composeAbortSignals([options.signal, controller.signal]) : void 0;
22715
+ const signal = signalScope?.signal ?? controller.signal;
22716
+ let finished = false;
22717
+ const body = (async function* () {
22718
+ let total = 0;
22719
+ for await (const chunk of readBytes(source, signal)) {
22720
+ if (chunk.length > this.maxStreamBytes - total)
22721
+ fail2("EFBIG", "writeStream", path6);
22722
+ total += chunk.length;
22723
+ for (let offset = 0; offset < chunk.length; offset += 64 * 1024) {
22724
+ this.checkAbort({ signal }, "writeStream", path6);
22725
+ yield new Uint8Array(chunk.subarray(offset, offset + 64 * 1024));
22726
+ }
22727
+ }
22728
+ finished = true;
22729
+ }).call(this);
22730
+ try {
22731
+ const metadata = this.writeMetadata(info?.metadata, options.mode);
22732
+ await this.call("putObject", path6, options, () => this.transport.putObjectStream({
22733
+ Bucket: this.bucket,
22734
+ Key: this.key(path6),
22735
+ Body: body,
22736
+ ...exclusive ? { IfNoneMatch: "*" } : {},
22737
+ ...metadata === void 0 ? {} : { Metadata: metadata }
22738
+ }, { abortSignal: signal }), exclusive ? "EEXIST" : "EAGAIN");
22739
+ if (!finished)
22740
+ fail2("EIO", "writeStream", path6, "transport completed without consuming the request body");
22741
+ } finally {
22742
+ controller.abort();
22743
+ signalScope?.dispose();
22744
+ this.dispose(body);
22745
+ }
22746
+ }
22747
+ };
22748
+ var s3Comparison = S3FileSystem.prototype.compareEntry;
22749
+
21228
22750
  // src/management.ts
21229
22751
  import { commandRuntimeIdentity as commandRuntimeIdentity2, collectBytes as collectBytes3, toByteSource, createOutputOperation as createOutputOperation2 } from "@poe-platform/safe-bash/contracts";
21230
22752