@poe-platform/safe-bash 0.1.799 → 0.1.801

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 (1076) hide show
  1. package/README.md +48 -22
  2. package/dist/image-ast/index.browser.js +1503 -98
  3. package/dist/image-ast/index.js +1503 -98
  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 +5 -4
  8. package/dist/safe-bash/chunks/{chunk-LUOFIVNI.js → chunk-3NDIFSNM.js} +3 -3
  9. package/dist/safe-bash/chunks/chunk-3R3AANOR.js +26 -0
  10. package/dist/safe-bash/chunks/{chunk-TRVGCN3U.js → chunk-45PK3NWI.js} +4 -4
  11. package/dist/safe-bash/chunks/{chunk-KHMGTPD6.js → chunk-46Z5E5EV.js} +2 -2
  12. package/dist/safe-bash/chunks/{chunk-XB3B7KMM.js → chunk-6O77NL2S.js} +1 -1
  13. package/dist/safe-bash/chunks/{chunk-T3JTVIEP.js → chunk-6PAVEFT3.js} +1 -1
  14. package/dist/safe-bash/chunks/{chunk-PYVEAFJM.js → chunk-74GHTNJA.js} +3 -2
  15. package/dist/safe-bash/chunks/{chunk-LQHGH25W.js → chunk-7R5BDCG7.js} +1 -1
  16. package/dist/safe-bash/chunks/{chunk-WUNK5NXJ.js → chunk-7VNF5BFF.js} +1140 -1660
  17. package/dist/safe-bash/chunks/{chunk-NHOXKQNE.js → chunk-A7XEHALN.js} +6 -6
  18. package/dist/safe-bash/chunks/{chunk-MHZ24KEI.js → chunk-AM5ESLPH.js} +1 -1
  19. package/dist/safe-bash/chunks/{chunk-3L3T6LYV.js → chunk-AUSNDQTJ.js} +1 -1
  20. package/dist/safe-bash/chunks/{chunk-YG5WAHK7.js → chunk-B7TAL7S5.js} +1 -3
  21. package/dist/safe-bash/chunks/{chunk-K7IQZE7D.js → chunk-C5OWC2TL.js} +1 -1
  22. package/dist/safe-bash/chunks/{chunk-F3RV2F72.js → chunk-CHYGPFVM.js} +1 -1
  23. package/dist/safe-bash/chunks/{chunk-M4CFCXHN.js → chunk-CS4MNM6I.js} +1 -1
  24. package/dist/safe-bash/chunks/{chunk-H6JW3E4F.js → chunk-CTVWDACF.js} +1 -1
  25. package/dist/safe-bash/chunks/{chunk-KTGR4U57.js → chunk-D3ANYGMC.js} +2 -3
  26. package/dist/safe-bash/chunks/{chunk-ENR3HB2B.js → chunk-E7OYNDGL.js} +1 -2
  27. package/dist/safe-bash/chunks/{chunk-SOZK5JVX.js → chunk-FBUCWVTE.js} +1 -1
  28. package/dist/safe-bash/chunks/{chunk-NX2SQVON.js → chunk-FNDNHAGE.js} +46 -27
  29. package/dist/safe-bash/chunks/{chunk-KCVSVD65.js → chunk-I5HZ4FGE.js} +1 -1
  30. package/dist/safe-bash/chunks/{chunk-KMH2DF3I.js → chunk-ICFDYV64.js} +7 -2
  31. package/dist/safe-bash/chunks/{chunk-T5KKDMYB.js → chunk-IVRQ4BXL.js} +7 -1
  32. package/dist/safe-bash/chunks/{chunk-KV7PKOHV.js → chunk-IWDICZVK.js} +1 -1
  33. package/dist/safe-bash/chunks/{chunk-I4OAEOP6.js → chunk-J42RIHHJ.js} +1 -1
  34. package/dist/safe-bash/chunks/chunk-K6VCD7IY.js +106 -0
  35. package/dist/safe-bash/chunks/{chunk-63FXVDGF.js → chunk-LVOBFF4D.js} +1 -1
  36. package/dist/safe-bash/chunks/{chunk-U5NUZPCC.js → chunk-MHMMRCYC.js} +1 -1
  37. package/dist/safe-bash/chunks/{chunk-6HZYFL3H.js → chunk-NR3EM4LS.js} +1 -1
  38. package/dist/safe-bash/chunks/{chunk-VYZTG3GV.js → chunk-NZQXYWA3.js} +1 -1
  39. package/dist/safe-bash/chunks/{chunk-JSVX4VIA.js → chunk-OQRVVGR6.js} +3 -2
  40. package/dist/safe-bash/chunks/{chunk-B3DDEDH2.js → chunk-OV6IHKO6.js} +2 -2
  41. package/dist/safe-bash/chunks/{chunk-SPYL72GN.js → chunk-PQRAK7HU.js} +1196 -5781
  42. package/dist/safe-bash/chunks/chunk-SZH7EJLD.js +9221 -0
  43. package/dist/safe-bash/chunks/{chunk-AKC46AF6.js → chunk-TFIBK2GI.js} +8 -41
  44. package/dist/safe-bash/chunks/{chunk-ZNAFMYIA.js → chunk-UE5KZDEK.js} +2 -2
  45. package/dist/safe-bash/chunks/{chunk-QU3BVQ53.js → chunk-UTBUUFDM.js} +1 -1
  46. package/dist/safe-bash/chunks/{chunk-6IBTC4YL.js → chunk-VQDD3G76.js} +93 -39
  47. package/dist/safe-bash/chunks/{chunk-IUTD5FH5.js → chunk-VTH3MLDU.js} +2 -7
  48. package/dist/safe-bash/chunks/{chunk-LLZCZ24K.js → chunk-XVOSKJE2.js} +1 -1
  49. package/dist/safe-bash/chunks/{csvkit-W2UEKH6P.js → csvkit-TACDU7FC.js} +3 -3
  50. package/dist/safe-bash/chunks/{ffmpeg-42CGASMV.js → ffmpeg-WTC3TEFI.js} +2 -2
  51. package/dist/safe-bash/chunks/{gh-26GYLH6D.js → gh-6WU6PXL4.js} +2 -2
  52. package/dist/safe-bash/chunks/{git-YREKMUVD.js → git-EFZIGJW4.js} +2 -2
  53. package/dist/safe-bash/chunks/{imagemagick-3YIX4XO2.js → imagemagick-EIEYGWPF.js} +2 -2
  54. package/dist/safe-bash/chunks/{implementation-E3YMKU3Z.js → implementation-MLFHUQ5M.js} +2 -2
  55. package/dist/safe-bash/chunks/mmdc-ROQJT5HQ.js +118 -0
  56. package/dist/safe-bash/chunks/{pdfimages-UE2UISP2.js → pdfimages-DW7LWXFI.js} +2 -2
  57. package/dist/safe-bash/chunks/{pdfinfo-RGARKLI5.js → pdfinfo-TIP6XLUQ.js} +4 -12
  58. package/dist/safe-bash/chunks/{pdftk-JY3WVCCC.js → pdftk-DMG22ITZ.js} +2 -2
  59. package/dist/safe-bash/chunks/{pdftoppm-GPD3BMPY.js → pdftoppm-WNDYR72T.js} +2 -2
  60. package/dist/safe-bash/chunks/{pdftotext-K7GQ2QJZ.js → pdftotext-5IPZ4NI7.js} +2 -2
  61. package/dist/safe-bash/chunks/{qpdf-F4U7WUSU.js → qpdf-TTX2DIUA.js} +2 -2
  62. package/dist/safe-bash/chunks/{sips-RWENS7X5.js → sips-XYS46JPJ.js} +2 -2
  63. package/dist/safe-bash/chunks/{soffice-IT6W2C5F.js → soffice-TU73E5KL.js} +2 -2
  64. package/dist/safe-bash/chunks/{wkhtmltopdf-JYNDAHIZ.js → wkhtmltopdf-FSZ2CHGE.js} +2 -2
  65. package/dist/safe-bash/command-chunks/{chunk-QBGA56UH.js → chunk-2ELYGJDD.js} +7 -7
  66. package/dist/safe-bash/command-chunks/chunk-2FGJYFWZ.js +44 -0
  67. package/dist/safe-bash/command-chunks/chunk-2H4JTFIL.js +53 -0
  68. package/dist/safe-bash/command-chunks/{chunk-52PCQXD2.js → chunk-2NHI5F5S.js} +2 -1
  69. package/dist/safe-bash/command-chunks/{chunk-HDKVO47G.js → chunk-2SQEIUGJ.js} +3 -3
  70. package/dist/safe-bash/command-chunks/chunk-364TMWBT.js +946 -0
  71. package/dist/safe-bash/command-chunks/chunk-3E2OIS2J.js +7037 -0
  72. package/dist/safe-bash/command-chunks/chunk-3HHCU5YU.js +380 -0
  73. package/dist/safe-bash/command-chunks/{chunk-TF6OA2GK.js → chunk-3NV3HYT2.js} +1 -1
  74. package/dist/safe-bash/command-chunks/chunk-4B7Y7S6E.js +61 -0
  75. package/dist/safe-bash/command-chunks/{chunk-LLCXZKZ6.js → chunk-4BB2SWJ5.js} +2 -2
  76. package/dist/safe-bash/command-chunks/{chunk-IEXHHNOF.js → chunk-4J5CZ2DP.js} +2 -7
  77. package/dist/safe-bash/command-chunks/{chunk-WDHI3S6Y.js → chunk-4OOUQTQO.js} +1 -1
  78. package/dist/safe-bash/command-chunks/chunk-4ZHMW6F5.js +104 -0
  79. package/dist/safe-bash/command-chunks/{chunk-YMONDXET.js → chunk-4ZQWGOZB.js} +2 -2
  80. package/dist/safe-bash/command-chunks/chunk-5BSTFCXG.js +553 -0
  81. package/dist/safe-bash/command-chunks/{chunk-MKQVQMXO.js → chunk-5LU4UCBR.js} +1 -1
  82. package/dist/safe-bash/command-chunks/chunk-5PWJG2UK.js +174 -0
  83. package/dist/safe-bash/command-chunks/chunk-5TBUOBDE.js +346 -0
  84. package/dist/safe-bash/command-chunks/{chunk-JMPP4TCW.js → chunk-5UBXNSFZ.js} +3 -2
  85. package/dist/safe-bash/command-chunks/chunk-5XY4DTNG.js +34 -0
  86. package/dist/safe-bash/command-chunks/chunk-5ZMZ573Q.js +140 -0
  87. package/dist/safe-bash/command-chunks/{chunk-3NG75MOB.js → chunk-67GQA75T.js} +1 -1
  88. package/dist/safe-bash/command-chunks/chunk-67QKREJK.js +347 -0
  89. package/dist/safe-bash/command-chunks/{chunk-L6SU4S26.js → chunk-6B7WQIKB.js} +0 -7
  90. package/dist/safe-bash/command-chunks/chunk-6BNTBWIK.js +327 -0
  91. package/dist/safe-bash/command-chunks/chunk-6EPHJGGF.js +23 -0
  92. package/dist/safe-bash/command-chunks/chunk-6F4XCVON.js +266 -0
  93. package/dist/safe-bash/command-chunks/chunk-6KJ3LPI2.js +94 -0
  94. package/dist/safe-bash/command-chunks/{chunk-HLDTOR7M.js → chunk-6ZVI7LUY.js} +1 -1
  95. package/dist/safe-bash/command-chunks/{chunk-X6NJC3IC.js → chunk-75OFBY5R.js} +1 -1
  96. package/dist/safe-bash/command-chunks/chunk-7K6JYKPJ.js +422 -0
  97. package/dist/safe-bash/command-chunks/chunk-7N2LI2KO.js +206 -0
  98. package/dist/safe-bash/command-chunks/{chunk-MRW5HD2D.js → chunk-7O3E4LPT.js} +4 -22
  99. package/dist/safe-bash/command-chunks/chunk-7U7EXOXX.js +1392 -0
  100. package/dist/safe-bash/command-chunks/{chunk-6CYTRQ24.js → chunk-7VTKQUA5.js} +20 -17
  101. package/dist/safe-bash/command-chunks/{chunk-BZPAWTUL.js → chunk-AEF5BA3D.js} +1 -1
  102. package/dist/safe-bash/command-chunks/{pptx-GBPNWNEP-7EQEVXV5.js → chunk-AI5JAXQF.js} +34820 -18029
  103. package/dist/safe-bash/command-chunks/{chunk-63R3FEZJ.js → chunk-AIV5BF5W.js} +1 -1
  104. package/dist/safe-bash/command-chunks/{chunk-AYUTO323.js → chunk-AKJG2XD3.js} +2 -18
  105. package/dist/safe-bash/command-chunks/{chunk-J34TZVMW.js → chunk-ALDC4XP4.js} +0 -5
  106. package/dist/safe-bash/command-chunks/chunk-AMO3THU4.js +105 -0
  107. package/dist/safe-bash/command-chunks/chunk-ARBYOQUZ.js +65 -0
  108. package/dist/safe-bash/command-chunks/chunk-BAGCY35S.js +231 -0
  109. package/dist/safe-bash/command-chunks/chunk-BAXU7B5Z.js +101 -0
  110. package/dist/safe-bash/command-chunks/{chunk-44AHAB5O.js → chunk-BDSMROQZ.js} +1 -4
  111. package/dist/safe-bash/command-chunks/chunk-BNOU5YQS.js +182 -0
  112. package/dist/safe-bash/command-chunks/{chunk-4ZALPDBV.js → chunk-BPE5INLI.js} +2 -2
  113. package/dist/safe-bash/command-chunks/{chunk-OT4LZMLB.js → chunk-BR73BIOW.js} +1 -1
  114. package/dist/safe-bash/command-chunks/chunk-C5YYCQHW.js +1444 -0
  115. package/dist/safe-bash/command-chunks/chunk-C7I25AAL.js +25 -0
  116. package/dist/safe-bash/command-chunks/{chunk-4ONEXMD3.js → chunk-CAP7ZJSY.js} +8 -8
  117. package/dist/safe-bash/command-chunks/{chunk-DWFLVJC6.js → chunk-CCRHMAU5.js} +2 -1
  118. package/dist/safe-bash/command-chunks/chunk-CQ5YGOGB.js +150 -0
  119. package/dist/safe-bash/command-chunks/{chunk-JCNNOMBV.js → chunk-CQTRW45K.js} +3 -2
  120. package/dist/safe-bash/command-chunks/{chunk-N2F74VRO.js → chunk-CZ7EN3JG.js} +1 -1
  121. package/dist/safe-bash/command-chunks/chunk-DB453IE6.js +122 -0
  122. package/dist/safe-bash/command-chunks/{chunk-KKG4BAFZ.js → chunk-DIEPXUM4.js} +6 -0
  123. package/dist/safe-bash/command-chunks/chunk-DOKKNRRM.js +87 -0
  124. package/dist/safe-bash/command-chunks/{chunk-2PX5B7T5.js → chunk-DQAVUDDX.js} +2 -2
  125. package/dist/safe-bash/command-chunks/chunk-DT7BCTWY.js +249 -0
  126. package/dist/safe-bash/command-chunks/{chunk-6BETHLXZ.js → chunk-DZCY63VJ.js} +13 -11
  127. package/dist/safe-bash/command-chunks/{chunk-QUENU6GM.js → chunk-E55UKBIE.js} +3 -3
  128. package/dist/safe-bash/command-chunks/chunk-EK6YNAXT.js +343 -0
  129. package/dist/safe-bash/command-chunks/chunk-EQ4HV54N.js +22 -0
  130. package/dist/safe-bash/command-chunks/{chunk-HLGKIZ25.js → chunk-F6OYH562.js} +2 -0
  131. package/dist/safe-bash/command-chunks/{chunk-MC3VWLIZ.js → chunk-FDBUV4HJ.js} +28 -19
  132. package/dist/safe-bash/command-chunks/{chunk-7FKUC34S.js → chunk-FPVUD6TH.js} +6 -3
  133. package/dist/safe-bash/command-chunks/chunk-FXELCPFX.js +195 -0
  134. package/dist/safe-bash/command-chunks/chunk-FXOA7RBK.js +42 -0
  135. package/dist/safe-bash/command-chunks/{chunk-LPORMIZS.js → chunk-FZTK4MFI.js} +9 -9
  136. package/dist/safe-bash/command-chunks/{chunk-K543PB3I.js → chunk-G66QUHIZ.js} +6 -35
  137. package/dist/safe-bash/command-chunks/chunk-GFQZCKO6.js +272 -0
  138. package/dist/safe-bash/command-chunks/{chunk-CU5RLO62.js → chunk-GLOZX57Y.js} +92 -18
  139. package/dist/safe-bash/command-chunks/chunk-GMIHJYDG.js +331 -0
  140. package/dist/safe-bash/command-chunks/chunk-GOB777HR.js +97 -0
  141. package/dist/safe-bash/command-chunks/chunk-GRBWW4SG.js +48 -0
  142. package/dist/safe-bash/command-chunks/{chunk-PPNBNFAU.js → chunk-GYQ2HAKQ.js} +8 -8
  143. package/dist/safe-bash/command-chunks/chunk-H622NS6Z.js +11 -0
  144. package/dist/safe-bash/command-chunks/{chunk-UI32HWGS.js → chunk-HMOZ6XVJ.js} +1 -1
  145. package/dist/safe-bash/command-chunks/{chunk-AVSPNLWV.js → chunk-I237SNW5.js} +1 -1
  146. package/dist/safe-bash/command-chunks/{chunk-43GSSUAY.js → chunk-II77KPZN.js} +5 -5
  147. package/dist/safe-bash/command-chunks/{chunk-ZS3QPNUL.js → chunk-IR2BY7EL.js} +21 -6
  148. package/dist/safe-bash/command-chunks/{chunk-SG424QWS.js → chunk-JDYXY44P.js} +2 -2
  149. package/dist/safe-bash/command-chunks/chunk-JNZ3CVAE.js +147 -0
  150. package/dist/safe-bash/command-chunks/{chunk-4QJOYXVB.js → chunk-JV7LBUTP.js} +1 -1
  151. package/dist/safe-bash/command-chunks/{chunk-IKS2YXZQ.js → chunk-K67MWWWH.js} +3 -3
  152. package/dist/safe-bash/command-chunks/chunk-KFVV7ZJO.js +216 -0
  153. package/dist/safe-bash/command-chunks/{chunk-G4PNVO6Z.js → chunk-KP7AO66M.js} +1 -1
  154. package/dist/safe-bash/command-chunks/{chunk-KMCZ6P4O.js → chunk-KQLD3AED.js} +68 -7
  155. package/dist/safe-bash/command-chunks/chunk-KWESKQHR.js +25 -0
  156. package/dist/safe-bash/command-chunks/{chunk-YZ5SVZFD.js → chunk-KXU3IRUO.js} +3 -3
  157. package/dist/safe-bash/command-chunks/{chunk-C7IHMJEW.js → chunk-KZC5UWFF.js} +2 -2
  158. package/dist/safe-bash/command-chunks/{chunk-2WRTLCGK.js → chunk-LAOM65EE.js} +5 -5
  159. package/dist/safe-bash/command-chunks/chunk-LE5LZNHE.js +204 -0
  160. package/dist/safe-bash/command-chunks/{chunk-HFII3QYO.js → chunk-LWS62ISU.js} +46 -32
  161. package/dist/safe-bash/command-chunks/{chunk-BZDDAPSV.js → chunk-LWSBAWLT.js} +1 -1
  162. package/dist/safe-bash/command-chunks/chunk-MDH5T4OS.js +41 -0
  163. package/dist/safe-bash/command-chunks/{chunk-X7TM3AKW.js → chunk-MIXBO6U7.js} +20 -7
  164. package/dist/safe-bash/command-chunks/chunk-MM6HU6CX.js +20 -0
  165. package/dist/safe-bash/command-chunks/{chunk-MYJAZ3U2.js → chunk-MPL2466A.js} +2 -2
  166. package/dist/safe-bash/command-chunks/{chunk-HLBX5IRS.js → chunk-MQFIPHIQ.js} +46 -81
  167. package/dist/safe-bash/command-chunks/{chunk-ZJBR5Q5I.js → chunk-MSFXC3OC.js} +4 -4
  168. package/dist/safe-bash/command-chunks/{chunk-NI7MKJPN.js → chunk-MTQH74CF.js} +3 -55
  169. package/dist/safe-bash/command-chunks/chunk-MWUZZWXK.js +354 -0
  170. package/dist/safe-bash/command-chunks/chunk-N4PFUSRM.js +35 -0
  171. package/dist/safe-bash/command-chunks/chunk-NCD7PEWH.js +298 -0
  172. package/dist/safe-bash/command-chunks/chunk-NFGI5IGF.js +266 -0
  173. package/dist/safe-bash/command-chunks/{chunk-I3K5RYU4.js → chunk-NKFYQSES.js} +73 -26
  174. package/dist/safe-bash/command-chunks/{chunk-KVFCSLKK.js → chunk-NXEQ3ESQ.js} +6 -0
  175. package/dist/safe-bash/command-chunks/{chunk-NGWB2YBL.js → chunk-O4JQSB7O.js} +1 -1
  176. package/dist/safe-bash/command-chunks/{chunk-7L24L4UO.js → chunk-OQU6UT6X.js} +2 -20
  177. package/dist/safe-bash/command-chunks/{chunk-3VGGYEDH.js → chunk-ORYGZYKW.js} +4 -3
  178. package/dist/safe-bash/command-chunks/{chunk-ZXKW7SJ2.js → chunk-OYYV7ZAF.js} +2 -2
  179. package/dist/safe-bash/command-chunks/chunk-P2N33UMN.js +270 -0
  180. package/dist/safe-bash/command-chunks/{chunk-Q7Q5GM5S.js → chunk-P5APDEFB.js} +2 -2
  181. package/dist/safe-bash/command-chunks/{chunk-X2YQLGKS.js → chunk-PCEFOYA3.js} +240 -148
  182. package/dist/safe-bash/command-chunks/{chunk-OLQG7ZCN.js → chunk-PEF7K3UQ.js} +136 -75
  183. package/dist/safe-bash/command-chunks/chunk-PII4YEZW.js +123 -0
  184. package/dist/safe-bash/command-chunks/{chunk-AIRGA2SU.js → chunk-PMBFZXTK.js} +1 -1
  185. package/dist/safe-bash/command-chunks/{chunk-ZT4KSS2V.js → chunk-PTT3I223.js} +1 -1
  186. package/dist/safe-bash/command-chunks/{chunk-4Y3WVMK4.js → chunk-PV66YWHB.js} +1 -0
  187. package/dist/safe-bash/command-chunks/chunk-Q3EWDEUQ.js +185 -0
  188. package/dist/safe-bash/command-chunks/{chunk-AXK3H4PX.js → chunk-QJ33BHI4.js} +1 -1
  189. package/dist/safe-bash/command-chunks/chunk-QKFSRZGQ.js +1091 -0
  190. package/dist/safe-bash/command-chunks/{chunk-JZSNU2MY.js → chunk-QKJLP53H.js} +2 -2
  191. package/dist/safe-bash/command-chunks/{chunk-VVI4Z73I.js → chunk-QP4R6GLA.js} +5 -1
  192. package/dist/safe-bash/command-chunks/chunk-RMWQAAO5.js +2488 -0
  193. package/dist/safe-bash/command-chunks/{chunk-QDTBMSBE.js → chunk-RO62EWX6.js} +2 -2
  194. package/dist/safe-bash/command-chunks/{chunk-HRLIAMXC.js → chunk-RZZI24ZE.js} +7 -6
  195. package/dist/safe-bash/command-chunks/{chunk-PFAADCB5.js → chunk-SDNBCQ3X.js} +10 -24
  196. package/dist/safe-bash/command-chunks/chunk-SEM36PG5.js +11 -0
  197. package/dist/safe-bash/command-chunks/{chunk-36O5OT7E.js → chunk-T35Y7YQD.js} +1 -1
  198. package/dist/safe-bash/command-chunks/{chunk-ESMCX3YV.js → chunk-TGSNCQSR.js} +710 -143
  199. package/dist/safe-bash/command-chunks/chunk-TIOCQVUQ.js +557 -0
  200. package/dist/safe-bash/command-chunks/{chunk-T5H5UJQ3.js → chunk-TNOA7FCQ.js} +1 -1
  201. package/dist/safe-bash/command-chunks/{chunk-GN2TKLE7.js → chunk-TS65BJHG.js} +5 -5
  202. package/dist/safe-bash/command-chunks/chunk-TSCGT46G.js +363 -0
  203. package/dist/safe-bash/command-chunks/chunk-UG7SMZFF.js +178 -0
  204. package/dist/safe-bash/command-chunks/{chunk-KBEURXFF.js → chunk-UN6WS55J.js} +3 -3
  205. package/dist/safe-bash/command-chunks/chunk-UXSR5BZH.js +136 -0
  206. package/dist/safe-bash/command-chunks/{chunk-SX2X3IH4.js → chunk-V2V5OCL3.js} +1 -1
  207. package/dist/safe-bash/command-chunks/chunk-V6BEDRMQ.js +112 -0
  208. package/dist/safe-bash/command-chunks/chunk-V7A7DRTU.js +293 -0
  209. package/dist/safe-bash/command-chunks/{chunk-5SHGJ7NO.js → chunk-VA5ZHYYA.js} +73 -33
  210. package/dist/safe-bash/command-chunks/{chunk-J4PEQWSF.js → chunk-VGG2DL5Q.js} +0 -1
  211. package/dist/safe-bash/command-chunks/chunk-VPR5LQYX.js +1228 -0
  212. package/dist/safe-bash/command-chunks/{chunk-EIVW3X3N.js → chunk-VSRGNQCP.js} +11 -6
  213. package/dist/safe-bash/command-chunks/{chunk-TYVCKQDH.js → chunk-VXSLJH7G.js} +56 -6
  214. package/dist/safe-bash/command-chunks/{chunk-PXYOWWMV.js → chunk-W7RAD4EW.js} +4 -3
  215. package/dist/safe-bash/command-chunks/{src-UJOWAS2S.js → chunk-WD3ERGRY.js} +77 -277
  216. package/dist/safe-bash/command-chunks/{chunk-5ZSM4UFN.js → chunk-WECIOOQB.js} +8 -64
  217. package/dist/safe-bash/command-chunks/{chunk-YFSDDFGV.js → chunk-WH627NJL.js} +446 -53
  218. package/dist/safe-bash/command-chunks/chunk-WNE7FPVR.js +236 -0
  219. package/dist/safe-bash/command-chunks/{chunk-UKS2XJZI.js → chunk-WPYIOKE3.js} +4 -4
  220. package/dist/safe-bash/command-chunks/{chunk-HHP343KT.js → chunk-WTECBRU4.js} +1 -1
  221. package/dist/safe-bash/command-chunks/{chunk-AO6Z5EQ7.js → chunk-WVE64WM2.js} +6 -5
  222. package/dist/safe-bash/command-chunks/chunk-WVHONVZ4.js +594 -0
  223. package/dist/safe-bash/command-chunks/chunk-XIIBTGC5.js +580 -0
  224. package/dist/safe-bash/command-chunks/chunk-XJXU3VVH.js +737 -0
  225. package/dist/safe-bash/command-chunks/chunk-XNLFHHOC.js +63 -0
  226. package/dist/safe-bash/command-chunks/{chunk-XAFSZDY2.js → chunk-XS72HTMA.js} +11 -0
  227. package/dist/safe-bash/command-chunks/chunk-Y5INTD6S.js +220 -0
  228. package/dist/safe-bash/command-chunks/chunk-YIQACGEW.js +43 -0
  229. package/dist/safe-bash/command-chunks/chunk-YOF7R4OY.js +80 -0
  230. package/dist/safe-bash/command-chunks/{chunk-VZHRZMS7.js → chunk-YOFC45RK.js} +1 -1
  231. package/dist/safe-bash/command-chunks/{chunk-2FUAW6GO.js → chunk-Z45N42QC.js} +75 -11
  232. package/dist/safe-bash/command-chunks/chunk-ZHUWOUWB.js +618 -0
  233. package/dist/safe-bash/command-chunks/{chunk-OPUJSTHS.js → chunk-ZYHTWNAE.js} +215 -67
  234. package/dist/safe-bash/command-chunks/chunk-ZYXH3B66.js +636 -0
  235. package/dist/safe-bash/command-chunks/{model-store-L35QTZMJ.js → model-store-WPKMRPV4.js} +2 -2
  236. package/dist/safe-bash/command-chunks/pptx-7G52EJ6L-4JACH5FB.js +625 -0
  237. package/dist/safe-bash/command-chunks/python-worker-source-TYOFJMCW.js +4 -0
  238. package/dist/safe-bash/command-chunks/src-ICMQISAA.js +501 -0
  239. package/dist/safe-bash/commands/archive/create.d.ts +1 -17
  240. package/dist/safe-bash/commands/archive/create.js +1 -252
  241. package/dist/safe-bash/commands/archive/extract.d.ts +1 -11
  242. package/dist/safe-bash/commands/archive/extract.js +1 -640
  243. package/dist/safe-bash/commands/archive/format.d.ts +1 -32
  244. package/dist/safe-bash/commands/archive/format.js +1 -225
  245. package/dist/safe-bash/commands/archive/index.d.ts +5 -10
  246. package/dist/safe-bash/commands/archive/index.js +6 -931
  247. package/dist/safe-bash/commands/archive/listing.d.ts +1 -2
  248. package/dist/safe-bash/commands/archive/listing.js +1 -21
  249. package/dist/safe-bash/commands/archive/modes.d.ts +1 -5
  250. package/dist/safe-bash/commands/archive/modes.js +1 -182
  251. package/dist/safe-bash/commands/archive/options.d.ts +1 -53
  252. package/dist/safe-bash/commands/archive/options.js +1 -462
  253. package/dist/safe-bash/commands/archive/stream.d.ts +1 -22
  254. package/dist/safe-bash/commands/archive/stream.js +1 -188
  255. package/dist/safe-bash/commands/archive/transform.d.ts +1 -16
  256. package/dist/safe-bash/commands/archive/transform.js +1 -85
  257. package/dist/safe-bash/commands/archive/unzip/arguments.d.ts +1 -53
  258. package/dist/safe-bash/commands/archive/unzip/arguments.js +1 -322
  259. package/dist/safe-bash/commands/archive/unzip/safety.d.ts +1 -32
  260. package/dist/safe-bash/commands/archive/unzip/safety.js +1 -295
  261. package/dist/safe-bash/commands/archive/unzip.d.ts +1 -3
  262. package/dist/safe-bash/commands/archive/unzip.js +1 -398
  263. package/dist/safe-bash/commands/archive/zip/aes.d.ts +1 -17
  264. package/dist/safe-bash/commands/archive/zip/aes.js +1 -156
  265. package/dist/safe-bash/commands/archive/zip/comments.d.ts +1 -17
  266. package/dist/safe-bash/commands/archive/zip/comments.js +1 -83
  267. package/dist/safe-bash/commands/archive/zip/crc.d.ts +1 -1
  268. package/dist/safe-bash/commands/archive/zip/crc.js +1 -1
  269. package/dist/safe-bash/commands/archive/zip/crypto.d.ts +1 -19
  270. package/dist/safe-bash/commands/archive/zip/crypto.js +1 -118
  271. package/dist/safe-bash/commands/archive/zip/dates.d.ts +1 -4
  272. package/dist/safe-bash/commands/archive/zip/dates.js +1 -66
  273. package/dist/safe-bash/commands/archive/zip/environment.d.ts +1 -2
  274. package/dist/safe-bash/commands/archive/zip/environment.js +1 -62
  275. package/dist/safe-bash/commands/archive/zip/grow.d.ts +1 -3
  276. package/dist/safe-bash/commands/archive/zip/grow.js +1 -2
  277. package/dist/safe-bash/commands/archive/zip/help.d.ts +1 -4
  278. package/dist/safe-bash/commands/archive/zip/help.js +1 -182
  279. package/dist/safe-bash/commands/archive/zip/line-endings.d.ts +1 -2
  280. package/dist/safe-bash/commands/archive/zip/line-endings.js +1 -194
  281. package/dist/safe-bash/commands/archive/zip/log.d.ts +1 -22
  282. package/dist/safe-bash/commands/archive/zip/log.js +1 -159
  283. package/dist/safe-bash/commands/archive/zip/lzma.d.ts +1 -9
  284. package/dist/safe-bash/commands/archive/zip/lzma.js +1 -40
  285. package/dist/safe-bash/commands/archive/zip/move.d.ts +1 -11
  286. package/dist/safe-bash/commands/archive/zip/move.js +1 -59
  287. package/dist/safe-bash/commands/archive/zip/names.d.ts +1 -2
  288. package/dist/safe-bash/commands/archive/zip/names.js +1 -33
  289. package/dist/safe-bash/commands/archive/zip/options.d.ts +1 -13
  290. package/dist/safe-bash/commands/archive/zip/options.js +1 -124
  291. package/dist/safe-bash/commands/archive/zip/repair.d.ts +1 -10
  292. package/dist/safe-bash/commands/archive/zip/repair.js +1 -392
  293. package/dist/safe-bash/commands/archive/zip/safety.d.ts +1 -54
  294. package/dist/safe-bash/commands/archive/zip/safety.js +1 -360
  295. package/dist/safe-bash/commands/archive/zip/sfx.d.ts +1 -4
  296. package/dist/safe-bash/commands/archive/zip/sfx.js +1 -52
  297. package/dist/safe-bash/commands/archive/zip/test-command.d.ts +1 -5
  298. package/dist/safe-bash/commands/archive/zip/test-command.js +1 -101
  299. package/dist/safe-bash/commands/archive/zip/volumes.d.ts +1 -21
  300. package/dist/safe-bash/commands/archive/zip/volumes.js +1 -281
  301. package/dist/safe-bash/commands/archive/zip/zip64.d.ts +1 -30
  302. package/dist/safe-bash/commands/archive/zip/zip64.js +1 -227
  303. package/dist/safe-bash/commands/archive/zip-format.d.ts +1 -68
  304. package/dist/safe-bash/commands/archive/zip-format.js +1 -1075
  305. package/dist/safe-bash/commands/archive/zip.d.ts +1 -3
  306. package/dist/safe-bash/commands/archive/zip.js +1 -1523
  307. package/dist/safe-bash/commands/awk/index.d.ts +2 -0
  308. package/dist/safe-bash/commands/awk/index.js +2 -0
  309. package/dist/safe-bash/commands/bytes/compression/index.js +4 -2
  310. package/dist/safe-bash/commands/copy-preserve.d.ts +1 -0
  311. package/dist/safe-bash/commands/csplit/index.browser.js +2 -2
  312. package/dist/safe-bash/commands/curl/index.d.ts +2 -0
  313. package/dist/safe-bash/commands/curl/index.js +2 -0
  314. package/dist/safe-bash/commands/diff/index.d.ts +2 -0
  315. package/dist/safe-bash/commands/diff/index.js +2 -0
  316. package/dist/safe-bash/commands/diff-patch/diff-format.d.ts +1 -10
  317. package/dist/safe-bash/commands/diff-patch/diff-format.js +1 -237
  318. package/dist/safe-bash/commands/diff-patch/diff-options.d.ts +1 -38
  319. package/dist/safe-bash/commands/diff-patch/diff-options.js +1 -261
  320. package/dist/safe-bash/commands/diff-patch/diff-output.d.ts +1 -20
  321. package/dist/safe-bash/commands/diff-patch/diff-output.js +1 -290
  322. package/dist/safe-bash/commands/diff-patch/diff.d.ts +1 -2
  323. package/dist/safe-bash/commands/diff-patch/diff.js +1 -656
  324. package/dist/safe-bash/commands/diff-patch/index.d.ts +4 -5
  325. package/dist/safe-bash/commands/diff-patch/index.js +8 -333
  326. package/dist/safe-bash/commands/diff-patch/patch-envelope.d.ts +1 -2
  327. package/dist/safe-bash/commands/diff-patch/patch-envelope.js +1 -63
  328. package/dist/safe-bash/commands/diff-patch/patch-formats.d.ts +1 -7
  329. package/dist/safe-bash/commands/diff-patch/patch-formats.js +1 -264
  330. package/dist/safe-bash/commands/diff-patch/patch-gnu-paths.d.ts +1 -41
  331. package/dist/safe-bash/commands/diff-patch/patch-gnu-paths.js +1 -263
  332. package/dist/safe-bash/commands/diff-patch/patch-gnu-reject.d.ts +1 -3
  333. package/dist/safe-bash/commands/diff-patch/patch-gnu-reject.js +1 -100
  334. package/dist/safe-bash/commands/diff-patch/patch-path.d.ts +1 -3
  335. package/dist/safe-bash/commands/diff-patch/patch-path.js +1 -91
  336. package/dist/safe-bash/commands/diff-patch/patch-publication.d.ts +1 -13
  337. package/dist/safe-bash/commands/diff-patch/patch-publication.js +1 -107
  338. package/dist/safe-bash/commands/diff-patch/patch.d.ts +1 -2
  339. package/dist/safe-bash/commands/diff-patch/patch.js +1 -653
  340. package/dist/safe-bash/commands/diff-patch/shared.d.ts +1 -53
  341. package/dist/safe-bash/commands/diff-patch/shared.js +1 -267
  342. package/dist/safe-bash/commands/diff-patch/unified.d.ts +1 -52
  343. package/dist/safe-bash/commands/diff-patch/unified.js +1 -385
  344. package/dist/safe-bash/commands/directory-admission.d.ts +1 -3
  345. package/dist/safe-bash/commands/directory-admission.js +1 -26
  346. package/dist/safe-bash/commands/docx/index.browser.js +1 -1
  347. package/dist/safe-bash/commands/execution.js +19 -13
  348. package/dist/safe-bash/commands/factor/index.browser.js +2 -2
  349. package/dist/safe-bash/commands/filesystem.d.ts +1 -1
  350. package/dist/safe-bash/commands/filesystem.js +17 -13
  351. package/dist/safe-bash/commands/find/index.d.ts +2 -0
  352. package/dist/safe-bash/commands/find/index.js +2 -0
  353. package/dist/safe-bash/commands/find-format.d.ts +1 -20
  354. package/dist/safe-bash/commands/find-format.js +1 -161
  355. package/dist/safe-bash/commands/find.d.ts +2 -18
  356. package/dist/safe-bash/commands/find.js +2 -1236
  357. package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
  358. package/dist/safe-bash/commands/gzip/index.d.ts +2 -0
  359. package/dist/safe-bash/commands/gzip/index.js +2 -0
  360. package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
  361. package/dist/safe-bash/commands/htmlq/index.d.ts +1 -1
  362. package/dist/safe-bash/commands/iconv/index.browser.js +2 -2
  363. package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
  364. package/dist/safe-bash/commands/line-endings/index.d.ts +1 -1
  365. package/dist/safe-bash/commands/line-endings/index.js +1 -262
  366. package/dist/safe-bash/commands/llm/index.browser.js +4 -2
  367. package/dist/safe-bash/commands/llm/providers/index.browser.js +1 -1
  368. package/dist/safe-bash/commands/mdq/index.browser.js +3 -3
  369. package/dist/safe-bash/commands/media/index.browser.js +1 -1
  370. package/dist/safe-bash/commands/metadata/chmod.d.ts +1 -4
  371. package/dist/safe-bash/commands/metadata/chmod.js +2 -63
  372. package/dist/safe-bash/commands/network/aggregate.d.ts +1 -4
  373. package/dist/safe-bash/commands/network/aggregate.js +1 -23
  374. package/dist/safe-bash/commands/network/args.d.ts +1 -68
  375. package/dist/safe-bash/commands/network/args.js +1 -321
  376. package/dist/safe-bash/commands/network/authorizer.d.ts +1 -6
  377. package/dist/safe-bash/commands/network/authorizer.js +1 -33
  378. package/dist/safe-bash/commands/network/body.d.ts +1 -9
  379. package/dist/safe-bash/commands/network/body.js +1 -393
  380. package/dist/safe-bash/commands/network/curl.d.ts +3 -13
  381. package/dist/safe-bash/commands/network/curl.js +6 -695
  382. package/dist/safe-bash/commands/network/deadline.d.ts +1 -2
  383. package/dist/safe-bash/commands/network/deadline.js +1 -14
  384. package/dist/safe-bash/commands/network/decode.d.ts +1 -2
  385. package/dist/safe-bash/commands/network/decode.js +1 -79
  386. package/dist/safe-bash/commands/network/fetch-transport.d.ts +1 -7
  387. package/dist/safe-bash/commands/network/fetch-transport.js +1 -94
  388. package/dist/safe-bash/commands/network/form-content-type.d.ts +1 -5
  389. package/dist/safe-bash/commands/network/form-content-type.js +1 -63
  390. package/dist/safe-bash/commands/network/form-headers.d.ts +1 -2
  391. package/dist/safe-bash/commands/network/form-headers.js +1 -35
  392. package/dist/safe-bash/commands/network/glob.d.ts +1 -7
  393. package/dist/safe-bash/commands/network/glob.js +1 -134
  394. package/dist/safe-bash/commands/network/index.browser.js +4 -12
  395. package/dist/safe-bash/commands/network/input.d.ts +1 -5
  396. package/dist/safe-bash/commands/network/input.js +1 -276
  397. package/dist/safe-bash/commands/network/output.d.ts +1 -6
  398. package/dist/safe-bash/commands/network/output.js +1 -131
  399. package/dist/safe-bash/commands/network/platform-portable.d.ts +1 -5
  400. package/dist/safe-bash/commands/network/platform-portable.js +1 -26
  401. package/dist/safe-bash/commands/network/private-address.d.ts +1 -1
  402. package/dist/safe-bash/commands/network/private-address.js +1 -44
  403. package/dist/safe-bash/commands/network/public.d.ts +2 -2
  404. package/dist/safe-bash/commands/network/public.js +2 -2
  405. package/dist/safe-bash/commands/network/shared.d.ts +1 -14
  406. package/dist/safe-bash/commands/network/shared.js +1 -71
  407. package/dist/safe-bash/commands/network/transport.js +2 -2
  408. package/dist/safe-bash/commands/network/types.d.ts +1 -37
  409. package/dist/safe-bash/commands/network/types.js +1 -31
  410. package/dist/safe-bash/commands/network/url.d.ts +1 -2
  411. package/dist/safe-bash/commands/network/url.js +1 -30
  412. package/dist/safe-bash/commands/network/wget.d.ts +3 -3
  413. package/dist/safe-bash/commands/network/wget.js +9 -332
  414. package/dist/safe-bash/commands/node/filesystem.js +3 -2
  415. package/dist/safe-bash/commands/node/index.browser.js +8 -9
  416. package/dist/safe-bash/commands/node/index.d.ts +3 -3
  417. package/dist/safe-bash/commands/node/index.js +5 -0
  418. package/dist/safe-bash/commands/node/safejs.d.ts +3 -3
  419. package/dist/safe-bash/commands/node/safejs.js +6 -1
  420. package/dist/safe-bash/commands/node/types.d.ts +1 -1
  421. package/dist/safe-bash/commands/node/types.js +1 -1
  422. package/dist/safe-bash/commands/node/unconfigured.d.ts +3 -0
  423. package/dist/safe-bash/commands/node/unconfigured.js +10 -0
  424. package/dist/safe-bash/commands/op/index.browser.js +3 -3
  425. package/dist/safe-bash/commands/patch/index.d.ts +2 -0
  426. package/dist/safe-bash/commands/patch/index.js +2 -0
  427. package/dist/safe-bash/commands/pdfinfo/index.js +2 -1
  428. package/dist/safe-bash/commands/pr/index.browser.js +2 -2
  429. package/dist/safe-bash/commands/predicates.js +3 -4
  430. package/dist/safe-bash/commands/python/host-capabilities.js +31 -14
  431. package/dist/safe-bash/commands/python/index.browser.js +11 -11
  432. package/dist/safe-bash/commands/python/llm-capability.d.ts +1 -0
  433. package/dist/safe-bash/commands/python/llm-capability.js +27 -7
  434. package/dist/safe-bash/commands/python/llm-module.js +11 -0
  435. package/dist/safe-bash/commands/python/manifest.d.ts +2 -0
  436. package/dist/safe-bash/commands/python/manifest.js +13 -6
  437. package/dist/safe-bash/commands/python/provisioning.js +1 -1
  438. package/dist/safe-bash/commands/python/shell-capability.d.ts +1 -0
  439. package/dist/safe-bash/commands/python/shell-capability.js +3 -2
  440. package/dist/safe-bash/commands/python/worker.browser.js +3 -3
  441. package/dist/safe-bash/commands/regex-execution/matching.js +1 -2
  442. package/dist/safe-bash/commands/regex-execution/public.browser.js +8 -8
  443. package/dist/safe-bash/commands/safejs/runtime.js +16 -7
  444. package/dist/safe-bash/commands/search/index.d.ts +1 -1
  445. package/dist/safe-bash/commands/search/index.js +1 -347
  446. package/dist/safe-bash/commands/search/portable.d.ts +2 -2
  447. package/dist/safe-bash/commands/search/portable.js +3 -2
  448. package/dist/safe-bash/commands/sed/index.d.ts +2 -0
  449. package/dist/safe-bash/commands/sed/index.js +2 -0
  450. package/dist/safe-bash/commands/standard.d.ts +1 -0
  451. package/dist/safe-bash/commands/standard.js +2 -1
  452. package/dist/safe-bash/commands/streams.js +6 -24
  453. package/dist/safe-bash/commands/tar/index.d.ts +2 -0
  454. package/dist/safe-bash/commands/tar/index.js +2 -0
  455. package/dist/safe-bash/commands/text-programs/awk-inspection.d.ts +1 -19
  456. package/dist/safe-bash/commands/text-programs/awk-inspection.js +1 -50
  457. package/dist/safe-bash/commands/text-programs/awk-pipes.d.ts +2 -0
  458. package/dist/safe-bash/commands/text-programs/awk-pipes.js +2 -0
  459. package/dist/safe-bash/commands/text-programs/awk-pretty.d.ts +1 -3
  460. package/dist/safe-bash/commands/text-programs/awk-pretty.js +1 -197
  461. package/dist/safe-bash/commands/text-programs/awk-quote.d.ts +1 -2
  462. package/dist/safe-bash/commands/text-programs/awk-quote.js +1 -15
  463. package/dist/safe-bash/commands/text-programs/awk-reader.d.ts +1 -42
  464. package/dist/safe-bash/commands/text-programs/awk-reader.js +1 -449
  465. package/dist/safe-bash/commands/text-programs/awk-retention.d.ts +1 -13
  466. package/dist/safe-bash/commands/text-programs/awk-retention.js +1 -51
  467. package/dist/safe-bash/commands/text-programs/awk-runtime.d.ts +1 -150
  468. package/dist/safe-bash/commands/text-programs/awk-runtime.js +1 -2627
  469. package/dist/safe-bash/commands/text-programs/awk-syntax.d.ts +1 -142
  470. package/dist/safe-bash/commands/text-programs/awk-syntax.js +1 -509
  471. package/dist/safe-bash/commands/text-programs/awk-values.d.ts +1 -32
  472. package/dist/safe-bash/commands/text-programs/awk-values.js +1 -386
  473. package/dist/safe-bash/commands/text-programs/awk.d.ts +1 -3
  474. package/dist/safe-bash/commands/text-programs/awk.js +1 -361
  475. package/dist/safe-bash/commands/text-programs/inplace.d.ts +1 -16
  476. package/dist/safe-bash/commands/text-programs/inplace.js +1 -155
  477. package/dist/safe-bash/commands/text-programs/sed.d.ts +1 -3
  478. package/dist/safe-bash/commands/text-programs/sed.js +1 -1647
  479. package/dist/safe-bash/commands/text.js +268 -364
  480. package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
  481. package/dist/safe-bash/commands/unzip/index.d.ts +2 -0
  482. package/dist/safe-bash/commands/unzip/index.js +2 -0
  483. package/dist/safe-bash/commands/wget/index.d.ts +2 -0
  484. package/dist/safe-bash/commands/wget/index.js +2 -0
  485. package/dist/safe-bash/commands/xml/index.browser.js +2 -2
  486. package/dist/safe-bash/commands/yq/index.browser.js +8 -3
  487. package/dist/safe-bash/commands/yq/index.d.ts +1 -6
  488. package/dist/safe-bash/commands/yq/index.js +1 -36
  489. package/dist/safe-bash/commands/zip/index.d.ts +2 -0
  490. package/dist/safe-bash/commands/zip/index.js +2 -0
  491. package/dist/safe-bash/core.browser.js +2 -2
  492. package/dist/safe-bash/core.d.ts +14 -2
  493. package/dist/safe-bash/core.js +8 -2
  494. package/dist/safe-bash/fs/s3/index.d.ts +2 -2
  495. package/dist/safe-bash/fs/s3/index.js +1 -1
  496. package/dist/safe-bash/full-core.browser.js +321 -286
  497. package/dist/safe-bash/jobs.browser.js +5 -5
  498. package/dist/safe-bash/lazy-mmdc.d.ts +6 -0
  499. package/dist/safe-bash/lazy-mmdc.js +23 -0
  500. package/dist/safe-bash/opt-in/commands/dd/index.js +2 -0
  501. package/dist/safe-bash/opt-in/commands/yq/mike.js +6 -13
  502. package/dist/safe-bash/opt-in/commands/yq/native-work.d.ts +1 -0
  503. package/dist/safe-bash/opt-in/commands/yq/native-work.js +17 -0
  504. package/dist/safe-bash/opt-in/optional/commands/shuf/options.d.ts +1 -0
  505. package/dist/safe-bash/opt-in/optional/commands/shuf/options.js +2 -4
  506. package/dist/safe-bash/opt-in/optional/commands/shuf/shuf.js +2 -1
  507. package/dist/safe-bash/optional-host.browser.js +15 -11
  508. package/dist/safe-bash/optional-host.d.ts +1 -1
  509. package/dist/safe-bash/optional-host.js +1 -1
  510. package/dist/safe-bash/playwright/ability-execution.js +3 -2
  511. package/dist/safe-bash/playwright/adapter.js +1 -1
  512. package/dist/safe-bash/playwright/controller.js +9 -8
  513. package/dist/safe-bash/playwright/modal-capabilities.js +2 -1
  514. package/dist/safe-bash/playwright/native-json-snapshot.js +4 -3
  515. package/dist/safe-bash/playwright/native-snapshot.js +5 -4
  516. package/dist/safe-bash/playwright/open-options.js +3 -3
  517. package/dist/safe-bash/playwright/resource-limit.d.ts +2 -0
  518. package/dist/safe-bash/playwright/resource-limit.js +4 -0
  519. package/dist/safe-bash/playwright/session-configuration.js +8 -3
  520. package/dist/safe-bash/playwright/snapshot.js +8 -7
  521. package/dist/safe-bash/playwright/standard-capabilities.js +5 -4
  522. package/dist/safe-bash/plugins/composition.d.ts +1 -0
  523. package/dist/safe-bash/plugins/composition.js +3 -8
  524. package/dist/safe-bash/plugins/index.browser.js +27 -29
  525. package/dist/safe-bash/registry-entry.browser.js +28 -30
  526. package/dist/safe-bash/shell/arrays/bindings.d.ts +3 -5
  527. package/dist/safe-bash/shell/arrays/bindings.js +7 -3
  528. package/dist/safe-bash/shell/arrays/state.js +4 -0
  529. package/dist/safe-bash/shell/brace-expansion.js +1 -1
  530. package/dist/safe-bash/shell/dynamic-variables.d.ts +10 -0
  531. package/dist/safe-bash/shell/dynamic-variables.js +25 -0
  532. package/dist/safe-bash/shell/input.js +16 -14
  533. package/dist/safe-bash/shell/parser.js +8 -1
  534. package/dist/safe-bash/shell/runtime.d.ts +7 -4
  535. package/dist/safe-bash/shell/runtime.js +604 -802
  536. package/dist/safe-bash/shell/shell.js +2 -31
  537. package/dist/safe-bash/shell/types.d.ts +2 -0
  538. package/dist/safe-bash/shell/value-state.js +17 -2
  539. package/dist/safe-bash/shell/worker-limits.js +1 -0
  540. package/dist/safe-bash/shell-entry.browser.js +25 -27
  541. package/dist/safe-bash/trap.browser.d.ts +3 -0
  542. package/dist/safe-bash/trap.browser.js +14 -0
  543. package/dist/safe-bash/worker/host.js +1 -1
  544. package/dist/safe-bash/yq-browser/index.js +1 -1
  545. package/dist/safe-bash-base-encoding-engine/base.js +2 -2
  546. package/dist/safe-bash-base-encoding-engine/shared.js +1 -1
  547. package/dist/safe-bash-byte-input-engine/index.d.ts +3 -2
  548. package/dist/safe-bash-byte-input-engine/index.js +4 -1
  549. package/dist/safe-bash-checksum-engine/index.js +13 -6
  550. package/dist/safe-bash-command-apply-patch/apply.d.ts +1 -1
  551. package/dist/safe-bash-command-apply-patch/apply.js +4 -3
  552. package/dist/safe-bash-command-apply-patch/index.js +4 -4
  553. package/dist/safe-bash-command-apply-patch/matcher.js +1 -1
  554. package/dist/safe-bash-command-apply-patch/parser.js +1 -1
  555. package/dist/safe-bash-command-awk/LICENSE +21 -0
  556. package/dist/safe-bash-command-awk/awk-inspection.d.ts +19 -0
  557. package/dist/safe-bash-command-awk/awk-inspection.js +9 -0
  558. package/dist/safe-bash-command-awk/awk-pipes.d.ts +19 -0
  559. package/dist/safe-bash-command-awk/awk-pipes.js +8 -0
  560. package/dist/safe-bash-command-awk/awk-pretty.d.ts +3 -0
  561. package/dist/safe-bash-command-awk/awk-pretty.js +8 -0
  562. package/dist/safe-bash-command-awk/awk-quote.d.ts +2 -0
  563. package/dist/safe-bash-command-awk/awk-quote.js +7 -0
  564. package/dist/safe-bash-command-awk/awk-reader.d.ts +42 -0
  565. package/dist/safe-bash-command-awk/awk-reader.js +9 -0
  566. package/dist/safe-bash-command-awk/awk-retention.d.ts +13 -0
  567. package/dist/safe-bash-command-awk/awk-retention.js +7 -0
  568. package/dist/safe-bash-command-awk/awk-runtime.d.ts +151 -0
  569. package/dist/safe-bash-command-awk/awk-runtime.js +11 -0
  570. package/dist/safe-bash-command-awk/awk-syntax.d.ts +144 -0
  571. package/dist/safe-bash-command-awk/awk-syntax.js +14 -0
  572. package/dist/safe-bash-command-awk/awk-values.d.ts +32 -0
  573. package/dist/safe-bash-command-awk/awk-values.js +35 -0
  574. package/dist/safe-bash-command-awk/awk.d.ts +3 -0
  575. package/dist/safe-bash-command-awk/awk.js +16 -0
  576. package/dist/safe-bash-command-awk/index.d.ts +7 -0
  577. package/dist/safe-bash-command-awk/index.js +36 -0
  578. package/dist/safe-bash-command-bc/index.d.ts +6 -0
  579. package/dist/safe-bash-command-bc/index.js +136 -266
  580. package/dist/safe-bash-command-column/column.js +5 -5
  581. package/dist/safe-bash-command-column/display.d.ts +1 -1
  582. package/dist/safe-bash-command-column/display.js +1 -1
  583. package/dist/safe-bash-command-column/index.js +5 -5
  584. package/dist/safe-bash-command-column/internal.d.ts +0 -2
  585. package/dist/safe-bash-command-column/internal.js +1 -1
  586. package/dist/safe-bash-command-column/layout.js +4 -4
  587. package/dist/safe-bash-command-column/table.js +2 -2
  588. package/dist/safe-bash-command-comm/comm.js +1 -1
  589. package/dist/safe-bash-command-comm/index.js +1 -1
  590. package/dist/safe-bash-command-csplit/command.js +2 -2
  591. package/dist/safe-bash-command-csplit/index.js +2 -2
  592. package/dist/safe-bash-command-csvcut/index.d.ts +1 -0
  593. package/dist/safe-bash-command-csvcut/index.js +1 -0
  594. package/dist/safe-bash-command-csvgrep/index.d.ts +1 -0
  595. package/dist/safe-bash-command-csvgrep/index.js +2 -2
  596. package/dist/safe-bash-command-csvkit/contracts.d.ts +1 -0
  597. package/dist/safe-bash-command-csvkit/csvpy-interpreter.d.ts +2 -1
  598. package/dist/safe-bash-command-csvkit/default-csvpy.d.ts +11 -0
  599. package/dist/safe-bash-command-csvkit/errors.js +22 -0
  600. package/dist/safe-bash-command-csvkit/index.d.ts +1 -0
  601. package/dist/safe-bash-command-csvkit/index.js +180 -12
  602. package/dist/safe-bash-command-csvkit/python-worker-browser.d.ts +3 -0
  603. package/dist/safe-bash-command-csvkit/python-worker-browser.js +16 -0
  604. package/dist/safe-bash-command-csvkit/python-worker-contract.d.ts +20 -0
  605. package/dist/safe-bash-command-csvkit/python-worker-node.d.ts +3 -0
  606. package/dist/safe-bash-command-csvkit/python-worker-node.js +9 -0
  607. package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
  608. package/dist/safe-bash-command-csvkit/sync-support.js +1 -1
  609. package/dist/safe-bash-command-curl/LICENSE +21 -0
  610. package/dist/safe-bash-command-curl/curl.d.ts +13 -0
  611. package/dist/safe-bash-command-curl/curl.js +9 -0
  612. package/dist/safe-bash-command-curl/index.d.ts +6 -0
  613. package/dist/safe-bash-command-curl/index.js +26 -0
  614. package/dist/safe-bash-command-dd/index.js +2 -0
  615. package/dist/safe-bash-command-diff/LICENSE +21 -0
  616. package/dist/safe-bash-command-diff/diff-format.d.ts +10 -0
  617. package/dist/safe-bash-command-diff/diff-format.js +10 -0
  618. package/dist/safe-bash-command-diff/diff-options.d.ts +38 -0
  619. package/dist/safe-bash-command-diff/diff-options.js +7 -0
  620. package/dist/safe-bash-command-diff/diff-output.d.ts +20 -0
  621. package/dist/safe-bash-command-diff/diff-output.js +19 -0
  622. package/dist/safe-bash-command-diff/diff.d.ts +2 -0
  623. package/dist/safe-bash-command-diff/diff.js +10 -0
  624. package/dist/safe-bash-command-diff/index.d.ts +8 -0
  625. package/dist/safe-bash-command-diff/index.js +34 -0
  626. package/dist/safe-bash-command-diff/sync.d.ts +2 -0
  627. package/dist/safe-bash-command-diff/sync.js +9 -0
  628. package/dist/safe-bash-command-diff3/index.js +5 -5
  629. package/dist/safe-bash-command-docx/index.d.ts +4 -4
  630. package/dist/safe-bash-command-docx/index.js +12 -5
  631. package/dist/safe-bash-command-dos2unix/index.d.ts +1 -0
  632. package/dist/safe-bash-command-dos2unix/index.js +225 -1
  633. package/dist/safe-bash-command-dos2unix/sync.d.ts +1 -0
  634. package/dist/safe-bash-command-exiftool/index.d.ts +1 -0
  635. package/dist/safe-bash-command-exiftool/index.js +2 -2
  636. package/dist/safe-bash-command-factor/command.js +2 -2
  637. package/dist/safe-bash-command-factor/index.js +2 -2
  638. package/dist/safe-bash-command-fd/index.js +9 -9
  639. package/dist/safe-bash-command-ffmpeg/index.js +117 -102
  640. package/dist/safe-bash-command-file/index.js +4 -4
  641. package/dist/safe-bash-command-file/shared.js +1 -1
  642. package/dist/safe-bash-command-find/LICENSE +21 -0
  643. package/dist/safe-bash-command-find/find-format.d.ts +20 -0
  644. package/dist/safe-bash-command-find/find-format.js +9 -0
  645. package/dist/safe-bash-command-find/find.d.ts +18 -0
  646. package/dist/safe-bash-command-find/find.js +10 -0
  647. package/dist/safe-bash-command-find/index.d.ts +13 -0
  648. package/dist/safe-bash-command-find/index.js +45 -0
  649. package/dist/safe-bash-command-fmt/index.js +7 -4
  650. package/dist/safe-bash-command-git/git_rust.wasm +0 -0
  651. package/dist/safe-bash-command-git/index.js +5 -7
  652. package/dist/safe-bash-command-git/wasm.generated.js +1 -1
  653. package/dist/safe-bash-command-gzip/LICENSE +21 -0
  654. package/dist/safe-bash-command-gzip/index.d.ts +11 -0
  655. package/dist/safe-bash-command-gzip/index.js +95 -0
  656. package/dist/safe-bash-command-hexdump/command.js +4 -4
  657. package/dist/safe-bash-command-hexdump/custom.d.ts +24 -0
  658. package/dist/safe-bash-command-hexdump/index.js +4 -4
  659. package/dist/safe-bash-command-hexdump/internal.d.ts +2 -0
  660. package/dist/safe-bash-command-hexdump/internal.js +1 -1
  661. package/dist/safe-bash-command-hexdump/io.js +2 -2
  662. package/dist/safe-bash-command-hexdump/options.d.ts +3 -0
  663. package/dist/safe-bash-command-hexdump/options.js +2 -2
  664. package/dist/safe-bash-command-hostname/index.js +1 -1
  665. package/dist/safe-bash-command-html-to-markdown/budget.js +1 -1
  666. package/dist/safe-bash-command-html-to-markdown/entities.js +3 -3
  667. package/dist/safe-bash-command-html-to-markdown/index.js +11 -11
  668. package/dist/safe-bash-command-html-to-markdown/input.js +5 -5
  669. package/dist/safe-bash-command-html-to-markdown/parser.d.ts +1 -0
  670. package/dist/safe-bash-command-html-to-markdown/parser.js +4 -4
  671. package/dist/safe-bash-command-html-to-markdown/render.js +5 -5
  672. package/dist/safe-bash-command-html-to-markdown/text.js +2 -2
  673. package/dist/safe-bash-command-htmlq/index.d.ts +1 -0
  674. package/dist/safe-bash-command-htmlq/index.js +39 -17
  675. package/dist/safe-bash-command-iconv/codec.js +1 -1
  676. package/dist/safe-bash-command-iconv/command.js +2 -2
  677. package/dist/safe-bash-command-iconv/index.js +2 -2
  678. package/dist/safe-bash-command-imagemagick/index.js +45 -35
  679. package/dist/safe-bash-command-join/index.js +1 -1
  680. package/dist/safe-bash-command-join/join.js +1 -1
  681. package/dist/safe-bash-command-jq/index.js +1 -1
  682. package/dist/safe-bash-command-jq/jq.js +1 -1
  683. package/dist/safe-bash-command-less/index.js +43 -28
  684. package/dist/safe-bash-command-llm/command.js +1 -1
  685. package/dist/safe-bash-command-llm/index.d.ts +1 -0
  686. package/dist/safe-bash-command-llm/index.js +16 -14
  687. package/dist/safe-bash-command-llm/openai.js +3 -3
  688. package/dist/safe-bash-command-llm/providers/index.js +3 -3
  689. package/dist/safe-bash-command-llm/providers/openai.js +3 -3
  690. package/dist/safe-bash-command-llm/stored-schema.d.ts +10 -0
  691. package/dist/safe-bash-command-mmdc/index.d.ts +1 -0
  692. package/dist/safe-bash-command-mmdc/index.js +13 -604
  693. package/dist/safe-bash-command-mmdc/settings.d.ts +2 -0
  694. package/dist/safe-bash-command-mmdc/settings.js +7 -0
  695. package/dist/safe-bash-command-numfmt/index.js +0 -11
  696. package/dist/safe-bash-command-od/index.js +101 -68
  697. package/dist/safe-bash-command-pandoc/command.js +4 -3
  698. package/dist/safe-bash-command-pandoc/defaults.d.ts +1 -0
  699. package/dist/safe-bash-command-pandoc/index.js +4 -3
  700. package/dist/safe-bash-command-pandoc/lua-filters.js +1 -1
  701. package/dist/safe-bash-command-pandoc/types.d.ts +3 -1
  702. package/dist/safe-bash-command-paste/index.js +1 -1
  703. package/dist/safe-bash-command-paste/paste.js +1 -1
  704. package/dist/safe-bash-command-patch/LICENSE +21 -0
  705. package/dist/safe-bash-command-patch/index.d.ts +8 -0
  706. package/dist/safe-bash-command-patch/index.js +38 -0
  707. package/dist/safe-bash-command-patch/patch-envelope.d.ts +2 -0
  708. package/dist/safe-bash-command-patch/patch-envelope.js +7 -0
  709. package/dist/safe-bash-command-patch/patch-formats.d.ts +7 -0
  710. package/dist/safe-bash-command-patch/patch-formats.js +9 -0
  711. package/dist/safe-bash-command-patch/patch-gnu-paths.d.ts +41 -0
  712. package/dist/safe-bash-command-patch/patch-gnu-paths.js +26 -0
  713. package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +3 -0
  714. package/dist/safe-bash-command-patch/patch-gnu-reject.js +7 -0
  715. package/dist/safe-bash-command-patch/patch-path.d.ts +3 -0
  716. package/dist/safe-bash-command-patch/patch-path.js +11 -0
  717. package/dist/safe-bash-command-patch/patch-publication.d.ts +13 -0
  718. package/dist/safe-bash-command-patch/patch-publication.js +7 -0
  719. package/dist/safe-bash-command-patch/patch.d.ts +2 -0
  720. package/dist/safe-bash-command-patch/patch.js +14 -0
  721. package/dist/safe-bash-command-patch/sync.d.ts +2 -0
  722. package/dist/safe-bash-command-patch/sync.js +7 -0
  723. package/dist/safe-bash-command-patch/unified.d.ts +52 -0
  724. package/dist/safe-bash-command-patch/unified.js +16 -0
  725. package/dist/safe-bash-command-pathchk/index.js +3 -13
  726. package/dist/safe-bash-command-pdfimages/index.js +62 -25
  727. package/dist/safe-bash-command-pdfinfo/index.d.ts +0 -23
  728. package/dist/safe-bash-command-pdfinfo/index.js +39 -782
  729. package/dist/safe-bash-command-pdftk/index.js +40 -12
  730. package/dist/safe-bash-command-pdftoppm/index.js +76 -30
  731. package/dist/safe-bash-command-pdftotext/index.js +37 -15
  732. package/dist/safe-bash-command-pptx/index.d.ts +4 -4
  733. package/dist/safe-bash-command-pptx/index.js +11 -5
  734. package/dist/safe-bash-command-pr/command.js +2 -2
  735. package/dist/safe-bash-command-pr/index.js +4 -4
  736. package/dist/safe-bash-command-qpdf/index.js +31 -18
  737. package/dist/safe-bash-command-rg/index.d.ts +1 -0
  738. package/dist/safe-bash-command-rg/index.js +222 -1
  739. package/dist/safe-bash-command-rg/rg-command.js +1 -1
  740. package/dist/safe-bash-command-rg/sync.d.ts +1 -0
  741. package/dist/safe-bash-command-sed/LICENSE +21 -0
  742. package/dist/safe-bash-command-sed/index.d.ts +7 -0
  743. package/dist/safe-bash-command-sed/index.js +28 -0
  744. package/dist/safe-bash-command-sed/inplace.d.ts +16 -0
  745. package/dist/safe-bash-command-sed/inplace.js +9 -0
  746. package/dist/safe-bash-command-sed/sed.d.ts +3 -0
  747. package/dist/safe-bash-command-sed/sed.js +8 -0
  748. package/dist/safe-bash-command-shuf/options.d.ts +1 -0
  749. package/dist/safe-bash-command-shuf/options.js +2 -4
  750. package/dist/safe-bash-command-shuf/shuf.js +2 -1
  751. package/dist/safe-bash-command-sips/index.js +111 -35
  752. package/dist/safe-bash-command-soffice/index.js +21 -17
  753. package/dist/safe-bash-command-split/index.js +3 -3
  754. package/dist/safe-bash-command-split/io.js +1 -1
  755. package/dist/safe-bash-command-split/outputs.js +2 -2
  756. package/dist/safe-bash-command-split/split.js +3 -3
  757. package/dist/safe-bash-command-sqlite3/btree.d.ts +1 -0
  758. package/dist/safe-bash-command-sqlite3/engine.d.ts +7 -2
  759. package/dist/safe-bash-command-sqlite3/index.js +436 -537
  760. package/dist/safe-bash-command-ssconvert/commands.js +9 -9
  761. package/dist/safe-bash-command-ssconvert/core.js +8 -8
  762. package/dist/safe-bash-command-ssconvert/formats/csv.js +9 -9
  763. package/dist/safe-bash-command-ssconvert/formats/ods.js +9 -9
  764. package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +2 -2
  765. package/dist/safe-bash-command-ssconvert/formats/xls.js +9 -9
  766. package/dist/safe-bash-command-ssconvert/formats/xlsx.js +9 -9
  767. package/dist/safe-bash-command-ssconvert/index.js +21 -21
  768. package/dist/safe-bash-command-tar/LICENSE +21 -0
  769. package/dist/safe-bash-command-tar/create.d.ts +17 -0
  770. package/dist/safe-bash-command-tar/create.js +14 -0
  771. package/dist/safe-bash-command-tar/extract.d.ts +11 -0
  772. package/dist/safe-bash-command-tar/extract.js +14 -0
  773. package/dist/safe-bash-command-tar/format.d.ts +32 -0
  774. package/dist/safe-bash-command-tar/format.js +19 -0
  775. package/dist/safe-bash-command-tar/index.d.ts +8 -0
  776. package/dist/safe-bash-command-tar/index.js +551 -0
  777. package/dist/safe-bash-command-tar/listing.d.ts +2 -0
  778. package/dist/safe-bash-command-tar/listing.js +7 -0
  779. package/dist/safe-bash-command-tar/modes.d.ts +5 -0
  780. package/dist/safe-bash-command-tar/modes.js +16 -0
  781. package/dist/safe-bash-command-tar/options.d.ts +53 -0
  782. package/dist/safe-bash-command-tar/options.js +10 -0
  783. package/dist/safe-bash-command-tar/stream.d.ts +22 -0
  784. package/dist/safe-bash-command-tar/stream.js +15 -0
  785. package/dist/safe-bash-command-tar/transform.d.ts +16 -0
  786. package/dist/safe-bash-command-tar/transform.js +9 -0
  787. package/dist/safe-bash-command-tree/arguments.js +3 -3
  788. package/dist/safe-bash-command-tree/charset.js +1 -1
  789. package/dist/safe-bash-command-tree/index.js +4 -4
  790. package/dist/safe-bash-command-tree/io.js +1 -1
  791. package/dist/safe-bash-command-tree/pattern.js +2 -2
  792. package/dist/safe-bash-command-tree/tree.js +4 -4
  793. package/dist/safe-bash-command-unrtf/index.js +14 -7
  794. package/dist/safe-bash-command-unzip/LICENSE +21 -0
  795. package/dist/safe-bash-command-unzip/index.d.ts +7 -0
  796. package/dist/safe-bash-command-unzip/index.js +39 -0
  797. package/dist/safe-bash-command-unzip/sync.d.ts +3 -0
  798. package/dist/safe-bash-command-unzip/sync.js +9 -0
  799. package/dist/safe-bash-command-unzip/unzip/safety.d.ts +32 -0
  800. package/dist/safe-bash-command-unzip/unzip/safety.js +7 -0
  801. package/dist/safe-bash-command-unzip/unzip.d.ts +3 -0
  802. package/dist/safe-bash-command-unzip/unzip.js +8 -0
  803. package/dist/safe-bash-command-wget/LICENSE +21 -0
  804. package/dist/safe-bash-command-wget/index.d.ts +6 -0
  805. package/dist/safe-bash-command-wget/index.js +26 -0
  806. package/dist/safe-bash-command-wget/wget.d.ts +3 -0
  807. package/dist/safe-bash-command-wget/wget.js +7 -0
  808. package/dist/safe-bash-command-xan/argv.d.ts +4 -1
  809. package/dist/safe-bash-command-xan/argv.js +1 -1
  810. package/dist/safe-bash-command-xan/commands.js +6 -3
  811. package/dist/safe-bash-command-xan/csv.d.ts +1 -1
  812. package/dist/safe-bash-command-xan/csv.js +1 -1
  813. package/dist/safe-bash-command-xan/index.js +18 -17
  814. package/dist/safe-bash-command-xan/io.js +3 -3
  815. package/dist/safe-bash-command-xmllint/index.js +190 -50
  816. package/dist/safe-bash-command-xxd/index.js +105 -91
  817. package/dist/safe-bash-command-xz/command.d.ts +2 -0
  818. package/dist/safe-bash-command-xz/index.d.ts +1 -1
  819. package/dist/safe-bash-command-xz/index.js +11 -2
  820. package/dist/safe-bash-command-xz/options.d.ts +9 -1
  821. package/dist/safe-bash-command-xz/options.js +3 -1
  822. package/dist/safe-bash-command-yq/index.d.ts +4 -11
  823. package/dist/safe-bash-command-yq/index.js +3367 -670
  824. package/dist/safe-bash-command-yq/mike.js +6 -13
  825. package/dist/safe-bash-command-yq/native-work.d.ts +1 -0
  826. package/dist/safe-bash-command-yq/native-work.js +17 -0
  827. package/dist/safe-bash-command-yq/query.d.ts +11 -0
  828. package/dist/safe-bash-command-yq/query.js +735 -0
  829. package/dist/safe-bash-command-zip/LICENSE +21 -0
  830. package/dist/safe-bash-command-zip/index.d.ts +7 -0
  831. package/dist/safe-bash-command-zip/index.js +38 -0
  832. package/dist/safe-bash-command-zip/sync.d.ts +3 -0
  833. package/dist/safe-bash-command-zip/sync.js +9 -0
  834. package/dist/safe-bash-command-zip/zip.d.ts +3 -0
  835. package/dist/safe-bash-command-zip/zip.js +7 -0
  836. package/dist/safe-bash-compression-engine/files.js +4 -4
  837. package/dist/safe-bash-compression-engine/index.js +2 -2
  838. package/dist/safe-bash-compression-engine/operand.js +6 -6
  839. package/dist/safe-bash-compression-engine/stream.js +2 -2
  840. package/dist/safe-bash-compression-engine/zstd-decode.js +1 -1
  841. package/dist/safe-bash-contracts/command.js +1 -1
  842. package/dist/safe-bash-contracts/diagnostics.js +4 -4
  843. package/dist/safe-bash-contracts/escaping.js +12 -12
  844. package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
  845. package/dist/safe-bash-contracts/filesystem-output.js +8 -8
  846. package/dist/safe-bash-contracts/index.d.ts +1 -0
  847. package/dist/safe-bash-contracts/index.js +39 -35
  848. package/dist/safe-bash-contracts/io.d.ts +4 -1
  849. package/dist/safe-bash-contracts/io.js +4 -2
  850. package/dist/safe-bash-contracts/managed-abort.d.ts +10 -0
  851. package/dist/safe-bash-contracts/output.js +3 -3
  852. package/dist/safe-bash-diff-engine/LICENSE +21 -0
  853. package/dist/safe-bash-diff-engine/index.d.ts +1 -0
  854. package/dist/safe-bash-diff-engine/index.js +24 -0
  855. package/dist/safe-bash-diff-engine/shared.d.ts +54 -0
  856. package/dist/safe-bash-diff-engine/shared.js +19 -0
  857. package/dist/safe-bash-io-engine/commands/archive/internal.js +5 -23
  858. package/dist/safe-bash-io-engine/commands/directory-admission.d.ts +3 -0
  859. package/dist/safe-bash-io-engine/commands/directory-admission.js +34 -0
  860. package/dist/safe-bash-io-engine/commands/mode-change.d.ts +4 -0
  861. package/dist/safe-bash-io-engine/commands/mode-change.js +60 -0
  862. package/dist/safe-bash-io-engine/commands/search/requirements.js +2 -2
  863. package/dist/safe-bash-io-engine/commands/text-programs/shared.js +44 -66
  864. package/dist/safe-bash-io-engine/internal.js +1 -1
  865. package/dist/safe-bash-io-engine/shell/pattern.js +8 -13
  866. package/dist/safe-bash-io-engine/shell/string-operations.js +1 -1
  867. package/dist/safe-bash-markdown-engine/commonmark-blocks.js +4 -4
  868. package/dist/safe-bash-markdown-engine/commonmark-inlines.js +4 -4
  869. package/dist/safe-bash-markdown-engine/commonmark-syntax.js +2 -2
  870. package/dist/safe-bash-markdown-engine/gfm-syntax.js +3 -3
  871. package/dist/safe-bash-markdown-engine/index.js +7 -7
  872. package/dist/safe-bash-mcp/index.browser.d.ts +161 -35
  873. package/dist/safe-bash-mcp/index.browser.js +417 -0
  874. package/dist/safe-bash-mcp/index.d.ts +66 -2
  875. package/dist/safe-bash-mcp/index.js +1838 -122
  876. package/dist/safe-bash-network-engine/LICENSE +21 -0
  877. package/dist/safe-bash-network-engine/aggregate.d.ts +4 -0
  878. package/dist/safe-bash-network-engine/aggregate.js +37 -0
  879. package/dist/safe-bash-network-engine/args.d.ts +68 -0
  880. package/dist/safe-bash-network-engine/args.js +19 -0
  881. package/dist/safe-bash-network-engine/authorizer.d.ts +6 -0
  882. package/dist/safe-bash-network-engine/authorizer.js +8 -0
  883. package/dist/safe-bash-network-engine/body.d.ts +9 -0
  884. package/dist/safe-bash-network-engine/body.js +374 -0
  885. package/dist/safe-bash-network-engine/deadline.d.ts +2 -0
  886. package/dist/safe-bash-network-engine/deadline.js +7 -0
  887. package/dist/safe-bash-network-engine/decode.d.ts +2 -0
  888. package/dist/safe-bash-network-engine/decode.js +80 -0
  889. package/dist/safe-bash-network-engine/fetch-transport.d.ts +7 -0
  890. package/dist/safe-bash-network-engine/fetch-transport.js +9 -0
  891. package/dist/safe-bash-network-engine/form-content-type.d.ts +5 -0
  892. package/dist/safe-bash-network-engine/form-content-type.js +8 -0
  893. package/dist/safe-bash-network-engine/form-headers.d.ts +2 -0
  894. package/dist/safe-bash-network-engine/form-headers.js +10 -0
  895. package/dist/safe-bash-network-engine/glob.d.ts +7 -0
  896. package/dist/safe-bash-network-engine/glob.js +124 -0
  897. package/dist/safe-bash-network-engine/index.d.ts +3 -0
  898. package/dist/safe-bash-network-engine/index.js +26 -0
  899. package/dist/safe-bash-network-engine/input.d.ts +5 -0
  900. package/dist/safe-bash-network-engine/input.js +255 -0
  901. package/dist/safe-bash-network-engine/output.d.ts +6 -0
  902. package/dist/safe-bash-network-engine/output.js +132 -0
  903. package/dist/safe-bash-network-engine/platform-portable.d.ts +5 -0
  904. package/dist/safe-bash-network-engine/platform-portable.js +19 -0
  905. package/dist/safe-bash-network-engine/private-address.d.ts +1 -0
  906. package/dist/safe-bash-network-engine/private-address.js +7 -0
  907. package/dist/safe-bash-network-engine/shared.d.ts +14 -0
  908. package/dist/safe-bash-network-engine/shared.js +23 -0
  909. package/dist/safe-bash-network-engine/types.d.ts +42 -0
  910. package/dist/safe-bash-network-engine/types.js +11 -0
  911. package/dist/safe-bash-network-engine/url.d.ts +2 -0
  912. package/dist/safe-bash-network-engine/url.js +8 -0
  913. package/dist/safe-bash-query-engine/capture.d.ts +1 -0
  914. package/dist/safe-bash-query-engine/capture.js +9 -7
  915. package/dist/safe-bash-query-engine/dates.d.ts +5 -1
  916. package/dist/safe-bash-query-engine/dates.js +10 -2
  917. package/dist/safe-bash-query-engine/delpaths.js +5 -5
  918. package/dist/safe-bash-query-engine/formats.js +3 -3
  919. package/dist/safe-bash-query-engine/index.js +15 -15
  920. package/dist/safe-bash-query-engine/indices.js +5 -5
  921. package/dist/safe-bash-query-engine/input.d.ts +1 -2
  922. package/dist/safe-bash-query-engine/input.js +2 -4
  923. package/dist/safe-bash-query-engine/interpreter.d.ts +5 -0
  924. package/dist/safe-bash-query-engine/interpreter.js +13 -13
  925. package/dist/safe-bash-query-engine/limits.js +1 -1
  926. package/dist/safe-bash-query-engine/parser.d.ts +8 -1
  927. package/dist/safe-bash-query-engine/parser.js +2 -2
  928. package/dist/safe-bash-query-engine/query-core.js +15 -15
  929. package/dist/safe-bash-query-engine/recurse.js +2 -2
  930. package/dist/safe-bash-query-engine/regex.d.ts +4 -2
  931. package/dist/safe-bash-query-engine/regex.js +10 -5
  932. package/dist/safe-bash-query-engine/split.js +2 -2
  933. package/dist/safe-bash-query-engine/splits.d.ts +1 -1
  934. package/dist/safe-bash-query-engine/splits.js +7 -6
  935. package/dist/safe-bash-query-engine/values.js +4 -4
  936. package/dist/safe-bash-regex-engine/ere/matcher.js +106 -34
  937. package/dist/safe-bash-regex-engine/execution/bounded-provider.js +55 -67
  938. package/dist/safe-bash-regex-engine/execution/portable.d.ts +0 -1
  939. package/dist/safe-bash-regex-engine/execution/portable.js +6 -10
  940. package/dist/safe-bash-regex-engine/execution/protocol.d.ts +0 -5
  941. package/dist/safe-bash-regex-engine/execution/protocol.js +1 -3
  942. package/dist/safe-bash-regex-engine/index.js +6 -4
  943. package/dist/safe-bash-regex-engine/text/budget.d.ts +1 -0
  944. package/dist/safe-bash-regex-engine/text/budget.js +1 -1
  945. package/dist/safe-bash-regex-engine/text/regex.d.ts +15 -0
  946. package/dist/safe-bash-regex-engine/text/regex.js +6 -4
  947. package/dist/safe-bash-regex-engine/text/replacement-buffer.js +2 -2
  948. package/dist/safe-bash-regex-engine/text/rust-syntax.js +2 -2
  949. package/dist/safe-bash-search-engine/ergonomic-regex.d.ts +12 -2
  950. package/dist/safe-bash-search-engine/ergonomic-regex.js +2 -2
  951. package/dist/safe-bash-search-engine/glob.js +2 -2
  952. package/dist/safe-bash-search-engine/grep.js +191 -229
  953. package/dist/safe-bash-search-engine/matcher.d.ts +6 -2
  954. package/dist/safe-bash-search-engine/matcher.js +30 -8
  955. package/dist/safe-bash-search-engine/options.js +1 -1
  956. package/dist/safe-bash-search-engine/output.d.ts +3 -2
  957. package/dist/safe-bash-search-engine/output.js +111 -30
  958. package/dist/safe-bash-search-engine/shared.d.ts +2 -0
  959. package/dist/safe-bash-search-engine/shared.js +2 -2
  960. package/dist/safe-bash-search-engine/walk.js +11 -10
  961. package/dist/safe-bash-table-text-engine/table-text/internal.d.ts +7 -5
  962. package/dist/safe-bash-table-text-engine/table-text/internal.js +39 -21
  963. package/dist/safe-bash-xml-engine/document.d.ts +1 -1
  964. package/dist/safe-bash-xml-engine/document.js +3 -3
  965. package/dist/safe-bash-xml-engine/evaluate.d.ts +1 -0
  966. package/dist/safe-bash-xml-engine/evaluate.js +4 -1
  967. package/dist/safe-bash-xml-engine/index.js +8 -6
  968. package/dist/safe-bash-xml-engine/io.js +1 -1
  969. package/dist/safe-bash-xml-engine/limits.d.ts +2 -0
  970. package/dist/safe-bash-xml-engine/limits.js +1 -1
  971. package/dist/safe-bash-xml-engine/predicate.d.ts +57 -0
  972. package/dist/safe-bash-xml-engine/query.d.ts +3 -15
  973. package/dist/safe-bash-xml-engine/query.js +3 -2
  974. package/dist/safe-bash-zip-engine/LICENSE +21 -0
  975. package/dist/safe-bash-zip-engine/index.d.ts +1 -0
  976. package/dist/safe-bash-zip-engine/index.js +32 -0
  977. package/dist/safe-bash-zip-engine/unzip/arguments.d.ts +53 -0
  978. package/dist/safe-bash-zip-engine/unzip/arguments.js +270 -0
  979. package/dist/safe-bash-zip-engine/zip/aes.d.ts +17 -0
  980. package/dist/safe-bash-zip-engine/zip/aes.js +15 -0
  981. package/dist/safe-bash-zip-engine/zip/comments.d.ts +17 -0
  982. package/dist/safe-bash-zip-engine/zip/comments.js +77 -0
  983. package/dist/safe-bash-zip-engine/zip/crc.d.ts +1 -0
  984. package/dist/safe-bash-zip-engine/zip/crc.js +7 -0
  985. package/dist/safe-bash-zip-engine/zip/crypto.d.ts +19 -0
  986. package/dist/safe-bash-zip-engine/zip/crypto.js +16 -0
  987. package/dist/safe-bash-zip-engine/zip/dates.d.ts +4 -0
  988. package/dist/safe-bash-zip-engine/zip/dates.js +68 -0
  989. package/dist/safe-bash-zip-engine/zip/environment.d.ts +2 -0
  990. package/dist/safe-bash-zip-engine/zip/environment.js +60 -0
  991. package/dist/safe-bash-zip-engine/zip/grow.d.ts +3 -0
  992. package/dist/safe-bash-zip-engine/zip/grow.js +7 -0
  993. package/dist/safe-bash-zip-engine/zip/help.d.ts +4 -0
  994. package/dist/safe-bash-zip-engine/zip/help.js +194 -0
  995. package/dist/safe-bash-zip-engine/zip/line-endings.d.ts +2 -0
  996. package/dist/safe-bash-zip-engine/zip/line-endings.js +165 -0
  997. package/dist/safe-bash-zip-engine/zip/log.d.ts +22 -0
  998. package/dist/safe-bash-zip-engine/zip/log.js +153 -0
  999. package/dist/safe-bash-zip-engine/zip/lzma.d.ts +9 -0
  1000. package/dist/safe-bash-zip-engine/zip/lzma.js +7 -0
  1001. package/dist/safe-bash-zip-engine/zip/move.d.ts +11 -0
  1002. package/dist/safe-bash-zip-engine/zip/move.js +57 -0
  1003. package/dist/safe-bash-zip-engine/zip/names.d.ts +2 -0
  1004. package/dist/safe-bash-zip-engine/zip/names.js +37 -0
  1005. package/dist/safe-bash-zip-engine/zip/options.d.ts +13 -0
  1006. package/dist/safe-bash-zip-engine/zip/options.js +23 -0
  1007. package/dist/safe-bash-zip-engine/zip/repair.d.ts +10 -0
  1008. package/dist/safe-bash-zip-engine/zip/repair.js +348 -0
  1009. package/dist/safe-bash-zip-engine/zip/safety.d.ts +54 -0
  1010. package/dist/safe-bash-zip-engine/zip/safety.js +19 -0
  1011. package/dist/safe-bash-zip-engine/zip/sfx.d.ts +4 -0
  1012. package/dist/safe-bash-zip-engine/zip/sfx.js +58 -0
  1013. package/dist/safe-bash-zip-engine/zip/test-command.d.ts +5 -0
  1014. package/dist/safe-bash-zip-engine/zip/test-command.js +98 -0
  1015. package/dist/safe-bash-zip-engine/zip/volumes.d.ts +21 -0
  1016. package/dist/safe-bash-zip-engine/zip/volumes.js +255 -0
  1017. package/dist/safe-bash-zip-engine/zip/zip64.d.ts +30 -0
  1018. package/dist/safe-bash-zip-engine/zip/zip64.js +25 -0
  1019. package/dist/safe-bash-zip-engine/zip-format.d.ts +68 -0
  1020. package/dist/safe-bash-zip-engine/zip-format.js +27 -0
  1021. package/dist/safe-playwright-cloudflare/browser-codegen.generated.d.ts +7 -7
  1022. package/dist/safe-playwright-cloudflare/browser-codegen.generated.js +866 -8069
  1023. package/dist/safe-playwright-cloudflare/browser-run-code-budget.d.ts +0 -1
  1024. package/dist/safe-playwright-cloudflare/browser-run-code-budget.js +0 -2
  1025. package/dist/safe-playwright-cloudflare/browser-trace-archive.d.ts +5 -1
  1026. package/dist/safe-playwright-cloudflare/browser-trace-archive.js +2 -1
  1027. package/dist/safe-playwright-cloudflare/browser-trace-budget.js +8 -4
  1028. package/dist/safe-playwright-cloudflare/shell-browser-resource.d.ts +2 -0
  1029. package/dist/safe-playwright-cloudflare/shell-browser-resource.js +3 -11
  1030. package/dist/safe-playwright-cloudflare/shell-playwright.d.ts +2 -0
  1031. package/dist/safe-playwright-cloudflare/shell-playwright.js +1 -1
  1032. package/dist/spreadsheet-engine/codecs/odf-hyperlinks.js +8 -2
  1033. package/dist/spreadsheet-engine/formulas/functions/captured-bessel-phase.js +2 -2
  1034. package/dist/spreadsheet-engine/formulas/label-references.js +54 -33
  1035. package/dist/spreadsheet-engine/formulas/parser.js +3 -1
  1036. package/dist/spreadsheet-engine/formulas/rewriting.js +13 -3
  1037. package/dist/spreadsheet-engine/io/publication.d.ts +1 -0
  1038. package/dist/spreadsheet-format-xls/biff-data-tables.js +4 -6
  1039. package/dist/spreadsheet-format-xls/biff-formulas.js +3 -0
  1040. package/dist/spreadsheet-format-xls/biff-label-ranges.js +9 -6
  1041. package/dist/spreadsheet-format-xls/biff.js +1 -1
  1042. package/dist/xlsx-ast/xlsx.js +8 -5
  1043. package/package.json +165 -15
  1044. package/dist/safe-bash/chunks/chunk-AZAJJVFX.js +0 -23017
  1045. package/dist/safe-bash/chunks/chunk-O4ZUCRGN.js +0 -13
  1046. package/dist/safe-bash/chunks/chunk-S264DZO2.js +0 -243
  1047. package/dist/safe-bash/chunks/chunk-WVG5SHHQ.js +0 -12
  1048. package/dist/safe-bash/chunks/chunk-ZW6K2J7P.js +0 -2652
  1049. package/dist/safe-bash/command-chunks/chunk-5MPOQ6V3.js +0 -181
  1050. package/dist/safe-bash/command-chunks/chunk-BIXLZ3OG.js +0 -14342
  1051. package/dist/safe-bash/command-chunks/chunk-DUYJE2HY.js +0 -14
  1052. package/dist/safe-bash/command-chunks/chunk-KAGBORIC.js +0 -88
  1053. package/dist/safe-bash/command-chunks/chunk-NETECMOF.js +0 -40
  1054. package/dist/safe-bash/command-chunks/chunk-XS3PGJU2.js +0 -343
  1055. package/dist/safe-bash/command-chunks/chunk-XTZALMLR.js +0 -488
  1056. package/dist/safe-bash/commands/archive/zip/aes-primitives-unavailable.d.ts +0 -2
  1057. package/dist/safe-bash/commands/archive/zip/aes-primitives-unavailable.js +0 -3
  1058. package/dist/safe-bash/commands/archive/zip/aes-primitives.d.ts +0 -2
  1059. package/dist/safe-bash/commands/archive/zip/aes-primitives.js +0 -3
  1060. package/dist/safe-bash/commands/xml/document.d.ts +0 -2
  1061. package/dist/safe-bash/commands/xml/document.js +0 -2
  1062. package/dist/safe-bash/commands/xml/evaluate.d.ts +0 -2
  1063. package/dist/safe-bash/commands/xml/evaluate.js +0 -2
  1064. package/dist/safe-bash/commands/xml/json.d.ts +0 -2
  1065. package/dist/safe-bash/commands/xml/json.js +0 -2
  1066. package/dist/safe-bash/commands/xml/limits.d.ts +0 -2
  1067. package/dist/safe-bash/commands/xml/limits.js +0 -2
  1068. package/dist/safe-bash/commands/xml/query.d.ts +0 -2
  1069. package/dist/safe-bash/commands/xml/query.js +0 -2
  1070. package/dist/safe-bash/command-chunks/{chunk-FIUFIDAO.js → chunk-2JRBIDAD.js} +3 -3
  1071. package/dist/safe-bash/command-chunks/{chunk-BWNXWI33.js → chunk-2LMZVE3I.js} +0 -0
  1072. package/dist/safe-bash/command-chunks/{chunk-B5BKA5WH.js → chunk-B5TAOCKD.js} +3 -3
  1073. package/dist/safe-bash/command-chunks/{chunk-2ENZ6JGA.js → chunk-KEV7C3KH.js} +3 -3
  1074. package/dist/safe-bash/command-chunks/{chunk-S62HELHU.js → chunk-PL6O4K6W.js} +3 -3
  1075. package/dist/safe-bash/command-chunks/{chunk-DDLQ5YDB.js → chunk-YHFXOX6U.js} +9 -9
  1076. 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);
@@ -1842,7 +1921,7 @@ async function requestTokens(input) {
1842
1921
  if (method === "client_secret_basic") {
1843
1922
  const encoded = new URLSearchParams({ credential: input.clientId }).toString().slice("credential=".length);
1844
1923
  const encodedSecret = new URLSearchParams({ credential: input.clientSecret }).toString().slice("credential=".length);
1845
- headers.set("Authorization", `Basic ${Buffer.from(`${encoded}:${encodedSecret}`).toString("base64")}`);
1924
+ headers.set("Authorization", `Basic ${btoa(`${encoded}:${encodedSecret}`)}`);
1846
1925
  } else {
1847
1926
  body.set("client_id", input.clientId);
1848
1927
  if (method === "client_secret_post")
@@ -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;
@@ -2032,10 +2111,10 @@ function createDefaultOAuthClientProvider(options) {
2032
2111
  if (resourceIdentity !== void 0 && selectedSessionStore !== void 0)
2033
2112
  throw new Error("OAuth resourceIdentity requires native-owned persistence; custom stores own their resource trust policy");
2034
2113
  const now = () => {
2035
- const timestamp = clock();
2036
- if (!Number.isSafeInteger(timestamp) || Math.abs(timestamp) > MAX_JS_DATE_MS3)
2114
+ const timestamp2 = clock();
2115
+ if (!Number.isSafeInteger(timestamp2) || Math.abs(timestamp2) > MAX_JS_DATE_MS3)
2037
2116
  throw new Error("OAuth clock must return valid epoch milliseconds");
2038
- return timestamp;
2117
+ return timestamp2;
2039
2118
  };
2040
2119
  const registeredClients = /* @__PURE__ */ new Map();
2041
2120
  const resourceStores = resourceIdentity === void 0 ? void 0 : createResourceBoundOAuthStores(authStore ?? {}, persistenceNamespace, resourceIdentity);
@@ -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) {
@@ -2822,6 +2901,155 @@ function shouldReRegisterStoredDynamicClient(error, client, alreadyAttempted) {
2822
2901
  return client.registrationOwnership !== "caller";
2823
2902
  }
2824
2903
 
2904
+ // ../mcp-oauth/dist/client/resumable.js
2905
+ var responseParameters = ["code", "state", "iss", "error", "error_description", "error_uri"];
2906
+ function httpsUrl(value) {
2907
+ const url = new URL(value);
2908
+ if (url.protocol !== "https:" || url.username || url.password || url.href.includes("#"))
2909
+ throw new Error();
2910
+ return url;
2911
+ }
2912
+ function base64url(bytes) {
2913
+ return btoa(String.fromCharCode(...bytes)).split("+").join("-").split("/").join("_").split("=").join("");
2914
+ }
2915
+ function timestamp(now) {
2916
+ const value = now();
2917
+ if (!Number.isSafeInteger(value) || value < 0 || value > 864e13 - 6e5)
2918
+ throw new Error();
2919
+ return value;
2920
+ }
2921
+ async function beginRemoteMcpAuthorization(options) {
2922
+ try {
2923
+ const { store, signal, discover } = options;
2924
+ const now = options.now?.bind(options) ?? Date.now;
2925
+ const resource = httpsUrl(options.resource).href;
2926
+ const redirect = httpsUrl(options.redirectUri);
2927
+ if (responseParameters.some((key2) => redirect.searchParams.has(key2)))
2928
+ throw new Error();
2929
+ const client = structuredClone(options.client);
2930
+ if (typeof client.clientId !== "string" || !client.clientId.trim())
2931
+ throw new Error();
2932
+ const method = normalizeOAuthTokenEndpointAuthMethod(client.tokenEndpointAuthMethod) ?? (client.clientSecret === void 0 ? "none" : "client_secret_post");
2933
+ if (client.clientSecret !== void 0 && (typeof client.clientSecret !== "string" || !client.clientSecret.trim()))
2934
+ throw new Error();
2935
+ if (method !== "none" && client.clientSecret === void 0)
2936
+ throw new Error();
2937
+ if (client.registration !== void 0 && (client.registration.client_id !== client.clientId || client.registration.client_secret != null && client.registration.client_secret !== client.clientSecret || client.registration.token_endpoint_auth_method != null && client.registration.token_endpoint_auth_method !== method))
2938
+ throw new Error();
2939
+ client.tokenEndpointAuthMethod = method;
2940
+ if (client.requestedRedirectUri !== void 0 && client.requestedRedirectUri !== redirect.href)
2941
+ throw new Error();
2942
+ if (client.registration?.redirect_uris != null && !client.registration.redirect_uris.includes(redirect.href))
2943
+ throw new Error();
2944
+ const scope = normalizeOAuthScope(options.scope);
2945
+ const ttl = options.ttlMs ?? 6e5;
2946
+ if (!Number.isSafeInteger(ttl) || ttl < 1 || ttl > 6e5)
2947
+ throw new Error();
2948
+ signal?.throwIfAborted();
2949
+ const metadata = structuredClone(await discover(resource, signal));
2950
+ signal?.throwIfAborted();
2951
+ const server = metadata.authorizationServerMetadata;
2952
+ if (httpsUrl(metadata.resource).href !== resource || httpsUrl(metadata.resourceMetadata.resource).href !== resource || server.issuer !== metadata.authorizationServer || !metadata.resourceMetadata.authorization_servers.includes(server.issuer) || !server.response_types_supported.includes("code") || !server.code_challenge_methods_supported.includes("S256"))
2953
+ throw new Error();
2954
+ httpsUrl(server.issuer);
2955
+ httpsUrl(server.token_endpoint);
2956
+ const authorization = httpsUrl(server.authorization_endpoint);
2957
+ const state = base64url(crypto.getRandomValues(new Uint8Array(32)));
2958
+ const codeVerifier = base64url(crypto.getRandomValues(new Uint8Array(32)));
2959
+ const challenge = base64url(new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(codeVerifier))));
2960
+ const expiresAt = timestamp(now) + ttl;
2961
+ const session = {
2962
+ resource,
2963
+ authorizationServer: server.issuer,
2964
+ client: { ...client, registrationOwnership: "caller", requestedRedirectUri: redirect.href },
2965
+ ...scope === void 0 ? {} : { requestedScope: scope },
2966
+ discovery: { resourceMetadataUrl: metadata.resourceMetadataUrl, resourceMetadata: metadata.resourceMetadata, authorizationServerMetadata: server }
2967
+ };
2968
+ for (const [key2, value] of Object.entries({
2969
+ response_type: "code",
2970
+ client_id: client.clientId,
2971
+ redirect_uri: redirect.href,
2972
+ resource,
2973
+ state,
2974
+ code_challenge: challenge,
2975
+ code_challenge_method: "S256"
2976
+ }))
2977
+ authorization.searchParams.set(key2, value);
2978
+ authorization.searchParams.delete("scope");
2979
+ if (scope !== void 0)
2980
+ authorization.searchParams.set("scope", scope);
2981
+ signal?.throwIfAborted();
2982
+ await store.create({
2983
+ state,
2984
+ expiresAt,
2985
+ redirectUri: redirect.href,
2986
+ codeVerifier,
2987
+ requireIssuer: server.authorization_response_iss_parameter_supported === true,
2988
+ session
2989
+ });
2990
+ signal?.throwIfAborted();
2991
+ return { authorizationUrl: authorization.href, expiresAt };
2992
+ } catch {
2993
+ throw new Error("Unable to begin MCP authorization");
2994
+ }
2995
+ }
2996
+ async function completeRemoteMcpAuthorization(options) {
2997
+ try {
2998
+ const { store, fetch: fetch2, signal } = options;
2999
+ const now = options.now?.bind(options) ?? Date.now;
3000
+ const callback = httpsUrl(options.callbackUrl);
3001
+ for (const key2 of responseParameters)
3002
+ if (callback.searchParams.getAll(key2).length > 1)
3003
+ throw new Error();
3004
+ const state = callback.searchParams.get("state");
3005
+ if (!state || state.length > 256)
3006
+ throw new Error();
3007
+ signal?.throwIfAborted();
3008
+ const stored = await store.consume(state);
3009
+ if (stored === null)
3010
+ throw new Error();
3011
+ const transaction = structuredClone(stored);
3012
+ if (transaction.state !== state || !Number.isSafeInteger(transaction.expiresAt) || transaction.expiresAt <= timestamp(now))
3013
+ throw new Error();
3014
+ const expected = httpsUrl(transaction.redirectUri);
3015
+ const issuer = callback.searchParams.get("iss");
3016
+ if (transaction.requireIssuer && issuer === null || issuer !== null && issuer !== transaction.session.authorizationServer)
3017
+ throw new Error();
3018
+ const code = callback.searchParams.get("code");
3019
+ if (!code || callback.searchParams.has("error"))
3020
+ throw new Error();
3021
+ for (const key2 of responseParameters)
3022
+ callback.searchParams.delete(key2);
3023
+ const actualPairs = [...callback.searchParams].sort(), expectedPairs = [...expected.searchParams].sort();
3024
+ if (callback.origin !== expected.origin || callback.pathname !== expected.pathname || JSON.stringify(actualPairs) !== JSON.stringify(expectedPairs))
3025
+ throw new Error();
3026
+ const session = structuredClone(transaction.session);
3027
+ const tokenEndpoint = httpsUrl(String(session.discovery.authorizationServerMetadata.token_endpoint)).href;
3028
+ signal?.throwIfAborted();
3029
+ session.tokens = await exchangeAuthorizationCode({
3030
+ tokenEndpoint,
3031
+ clientId: session.client.clientId,
3032
+ clientSecret: session.client.clientSecret,
3033
+ tokenEndpointAuthMethod: session.client.tokenEndpointAuthMethod,
3034
+ code,
3035
+ codeVerifier: transaction.codeVerifier,
3036
+ redirectUri: transaction.redirectUri,
3037
+ resource: session.resource,
3038
+ fetch: fetch2,
3039
+ signal,
3040
+ now
3041
+ });
3042
+ if (session.tokens.scope === void 0 && session.requestedScope !== void 0)
3043
+ session.tokens.scope = session.requestedScope;
3044
+ signal?.throwIfAborted();
3045
+ if (transaction.expiresAt <= timestamp(now) || !await store.commit(transaction, session))
3046
+ throw new Error();
3047
+ return { resource: session.resource };
3048
+ } catch {
3049
+ throw new Error("Unable to complete MCP authorization");
3050
+ }
3051
+ }
3052
+
2825
3053
  // src/oauth-policy.ts
2826
3054
  function snapshotOAuthBindingOptions(oauth) {
2827
3055
  return {
@@ -2841,6 +3069,7 @@ function snapshotOAuthBrowserOptions(browser) {
2841
3069
  ...browser,
2842
3070
  openBrowser: browser.openBrowser?.bind(browser),
2843
3071
  readLine: browser.readLine?.bind(browser),
3072
+ waitForCallback: browser.waitForCallback?.bind(browser),
2844
3073
  createServer: browser.createServer?.bind(browser),
2845
3074
  redirectUri: browser.redirectUri,
2846
3075
  signal: browser.signal,
@@ -2852,8 +3081,8 @@ function snapshotOAuthBrowserOptions(browser) {
2852
3081
  // ../tiny-mcp-client/dist/index.js
2853
3082
  import { PassThrough } from "node:stream";
2854
3083
  import http2 from "node:http";
2855
- import crypto5 from "node:crypto";
2856
3084
  import crypto22 from "node:crypto";
3085
+ import crypto32 from "node:crypto";
2857
3086
  import path42 from "node:path";
2858
3087
  import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2, randomBytes as randomBytes2, randomUUID as randomUUID22, scrypt as scrypt2 } from "node:crypto";
2859
3088
  import { promises as fs2 } from "node:fs";
@@ -2868,7 +3097,7 @@ import { homedir as homedir22 } from "node:os";
2868
3097
  import path32 from "node:path";
2869
3098
  import { isIP as isIP2 } from "node:net";
2870
3099
  import { URL as URL22 } from "node:url";
2871
- import crypto32 from "node:crypto";
3100
+ import crypto42 from "node:crypto";
2872
3101
  var __defProp = Object.defineProperty;
2873
3102
  var __getOwnPropNames = Object.getOwnPropertyNames;
2874
3103
  var __esm = (fn, res, err) => function __init() {
@@ -6221,9 +6450,9 @@ var SubscriptionManager = class {
6221
6450
  let canceled = false;
6222
6451
  let acknowledge;
6223
6452
  let reject;
6224
- const acknowledged = new Promise((resolve, fail2) => {
6453
+ const acknowledged = new Promise((resolve, fail3) => {
6225
6454
  acknowledge = resolve;
6226
- reject = fail2;
6455
+ reject = fail3;
6227
6456
  });
6228
6457
  const cancel = () => {
6229
6458
  if (canceled) return;
@@ -6393,7 +6622,7 @@ function copyBoundedOAuthJson2(value, message) {
6393
6622
  function createAuthorizationState2(input) {
6394
6623
  const payload = {
6395
6624
  v: 1,
6396
- n: crypto5.randomBytes(16).toString("base64url"),
6625
+ n: crypto22.randomBytes(16).toString("base64url"),
6397
6626
  i: input.issuer,
6398
6627
  r: input.requireIssuer
6399
6628
  };
@@ -6452,6 +6681,7 @@ function snapshotLoopbackAuthorizationOptions2(options) {
6452
6681
  ...options,
6453
6682
  openBrowser: options.openBrowser?.bind(options),
6454
6683
  readLine: options.readLine?.bind(options),
6684
+ waitForCallback: options.waitForCallback?.bind(options),
6455
6685
  createServer: options.createServer?.bind(options),
6456
6686
  callbackPath: options.callbackPath,
6457
6687
  redirectUri: options.redirectUri,
@@ -6466,6 +6696,8 @@ async function createLoopbackAuthorizationSession2(options = {}) {
6466
6696
  const timeoutMs = options.timeoutMs ?? 12e4;
6467
6697
  if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 2147483647)
6468
6698
  throw new Error("OAuth authorization timeoutMs must be a positive supported timer interval");
6699
+ if (options.waitForCallback !== void 0)
6700
+ return createHostedAuthorizationSession2(options, timeoutMs);
6469
6701
  const target = loopbackTarget2(options);
6470
6702
  const server = options.createServer ? options.createServer() : http2.createServer();
6471
6703
  const controller = new AbortController();
@@ -6531,6 +6763,79 @@ function loopbackTarget2(options) {
6531
6763
  throw new Error("Invalid OAuth loopback callback path");
6532
6764
  return { port: 0, host: "127.0.0.1", callbackPath };
6533
6765
  }
6766
+ function validateAuthorizationRedirect2(options) {
6767
+ if (options.waitForCallback === void 0) {
6768
+ loopbackTarget2(options);
6769
+ return;
6770
+ }
6771
+ if (typeof options.waitForCallback !== "function" || options.redirectUri === void 0)
6772
+ throw new Error("Hosted OAuth callbacks require redirectUri and waitForCallback");
6773
+ validateHostedOAuthRedirect2(options.redirectUri, options.callbackPath);
6774
+ }
6775
+ function validateHostedOAuthRedirect2(redirectUri, callbackPath) {
6776
+ const url = new URL(redirectUri);
6777
+ 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)
6778
+ throw new Error("Invalid hosted OAuth redirect URI");
6779
+ }
6780
+ function createHostedAuthorizationSession2(options, timeoutMs) {
6781
+ validateAuthorizationRedirect2(options);
6782
+ const redirectUri = options.redirectUri, controller = new AbortController();
6783
+ let used = false;
6784
+ const aborted = () => controller.abort(options.signal?.reason);
6785
+ const timer = setTimeout(() => controller.abort(new Error("OAuth authorization timed out")), timeoutMs);
6786
+ timer.unref?.();
6787
+ const cleanup = () => {
6788
+ clearTimeout(timer);
6789
+ options.signal?.removeEventListener("abort", aborted);
6790
+ };
6791
+ controller.signal.addEventListener("abort", cleanup, { once: true });
6792
+ options.signal?.addEventListener("abort", aborted, { once: true });
6793
+ if (options.signal?.aborted)
6794
+ aborted();
6795
+ return {
6796
+ redirectUri,
6797
+ async waitForCode(authorizationUrl) {
6798
+ controller.signal.throwIfAborted();
6799
+ if (used)
6800
+ throw new Error("OAuth authorization session has already been used");
6801
+ used = true;
6802
+ try {
6803
+ const authorization = new URL(authorizationUrl);
6804
+ if (authorization.searchParams.getAll("redirect_uri").length !== 1 || authorization.searchParams.get("redirect_uri") !== redirectUri)
6805
+ throw new Error("OAuth authorization redirect mismatch");
6806
+ const callback = await new Promise((resolve, reject) => {
6807
+ const onAbort = () => reject(controller.signal.reason);
6808
+ controller.signal.addEventListener("abort", onAbort, { once: true });
6809
+ void Promise.resolve().then(() => {
6810
+ controller.signal.throwIfAborted();
6811
+ return options.waitForCallback({ authorizationUrl, redirectUri, signal: controller.signal });
6812
+ }).then(resolve, reject).finally(() => controller.signal.removeEventListener("abort", onAbort));
6813
+ });
6814
+ controller.signal.throwIfAborted();
6815
+ const url = new URL(callback), base = new URL(redirectUri);
6816
+ if (url.origin !== base.origin || url.pathname !== base.pathname || url.username || url.password || url.href.includes("#") || [...callback].some((char) => char.codePointAt(0) <= 32))
6817
+ throw new Error("OAuth callback redirect mismatch");
6818
+ const params = readAuthorizationCallbackParameters2(url);
6819
+ for (const name of oauthCallbackParameters2)
6820
+ url.searchParams.delete(name);
6821
+ if (url.searchParams.toString() !== base.searchParams.toString())
6822
+ throw new Error("OAuth callback redirect mismatch");
6823
+ const expected = readExpectedAuthorizationCallback2(authorizationUrl);
6824
+ if (expected.state === null)
6825
+ throw new Error("OAuth authorization missing state");
6826
+ validateAuthorizationCallbackBinding2(params, expected);
6827
+ if (params.error !== null)
6828
+ throw new OAuthAuthorizationError2(params.error, params.errorDescription ?? params.error);
6829
+ return validateAuthorizationCallbackParameters2(params, expected);
6830
+ } finally {
6831
+ controller.abort(new Error("OAuth authorization session closed"));
6832
+ }
6833
+ },
6834
+ close() {
6835
+ controller.abort(new Error("OAuth authorization session closed"));
6836
+ }
6837
+ };
6838
+ }
6534
6839
  async function startServer2(server, port, host, signal) {
6535
6840
  signal.throwIfAborted();
6536
6841
  return new Promise((resolve, reject) => {
@@ -6786,7 +7091,10 @@ function normalizeStoredOAuthClient2(value) {
6786
7091
  try {
6787
7092
  if (typeof requestedRedirectUri !== "string")
6788
7093
  throw new Error("Invalid redirect identity");
6789
- loopbackTarget2({ redirectUri: requestedRedirectUri });
7094
+ if (new URL(requestedRedirectUri).protocol === "https:")
7095
+ validateHostedOAuthRedirect2(requestedRedirectUri);
7096
+ else
7097
+ loopbackTarget2({ redirectUri: requestedRedirectUri });
6790
7098
  } catch {
6791
7099
  throw new Error("Invalid stored OAuth registration redirect identity");
6792
7100
  }
@@ -7572,7 +7880,7 @@ function snapshotPersistenceOptions2(options) {
7572
7880
  }
7573
7881
  function createNamedSecretStore2(key2, options, defaults, namespace) {
7574
7882
  options = snapshotOAuthPersistenceOptions2(options);
7575
- const hash = crypto22.createHash("sha256").update(namespace === void 0 ? key2 : JSON.stringify([namespace, key2])).digest("hex");
7883
+ const hash = crypto32.createHash("sha256").update(namespace === void 0 ? key2 : JSON.stringify([namespace, key2])).digest("hex");
7576
7884
  const configuredFilePath = options.fileStore?.filePath;
7577
7885
  const parsedFilePath = configuredFilePath === void 0 ? null : path42.parse(configuredFilePath);
7578
7886
  const fileStore = {
@@ -7651,7 +7959,7 @@ function isStoredOAuthTokensOrMissing2(value) {
7651
7959
  return false;
7652
7960
  }
7653
7961
  const scope = getOwnEntry42(value, "scope");
7654
- return scope === void 0 || typeof scope === "string" && scope.trim().length > 0;
7962
+ return scope === void 0 || scope === "" || typeof scope === "string" && scope.trim().length > 0;
7655
7963
  }
7656
7964
  function isNonBlankOwnString2(record22, key2) {
7657
7965
  const value = getOwnString3(record22, key2);
@@ -7874,10 +8182,10 @@ async function fetchMcpResponse2(fetchImplementation, input, init = {}) {
7874
8182
  });
7875
8183
  }
7876
8184
  function generateCodeVerifier2() {
7877
- return crypto32.randomBytes(32).toString("base64url");
8185
+ return crypto42.randomBytes(32).toString("base64url");
7878
8186
  }
7879
8187
  function generateCodeChallenge2(verifier) {
7880
- return crypto32.createHash("sha256").update(verifier).digest("base64url");
8188
+ return crypto42.createHash("sha256").update(verifier).digest("base64url");
7881
8189
  }
7882
8190
  async function readBoundedResponseText2(response, maxBytes, readers, signal) {
7883
8191
  if (maxBytes !== Infinity && (!Number.isSafeInteger(maxBytes) || maxBytes < 1))
@@ -8006,7 +8314,7 @@ async function requestTokens2(input) {
8006
8314
  if (method === "client_secret_basic") {
8007
8315
  const encoded = new URLSearchParams({ credential: input.clientId }).toString().slice("credential=".length);
8008
8316
  const encodedSecret = new URLSearchParams({ credential: input.clientSecret }).toString().slice("credential=".length);
8009
- headers.set("Authorization", `Basic ${Buffer.from(`${encoded}:${encodedSecret}`).toString("base64")}`);
8317
+ headers.set("Authorization", `Basic ${btoa(`${encoded}:${encodedSecret}`)}`);
8010
8318
  } else {
8011
8319
  body.set("client_id", input.clientId);
8012
8320
  if (method === "client_secret_post")
@@ -8055,7 +8363,7 @@ async function requestTokens2(input) {
8055
8363
  throw new Error("OAuth token response has invalid refresh_token");
8056
8364
  const scope = getOwnEntry52(payload, "scope");
8057
8365
  const normalizedRefreshToken = typeof refreshToken === "string" && refreshToken.trim().length > 0 ? refreshToken.trim() : void 0;
8058
- const normalizedScope = normalizeOAuthScope2(scope);
8366
+ const normalizedScope = scope === "" ? "" : normalizeOAuthScope2(scope);
8059
8367
  if (scope !== void 0 && normalizedScope === void 0)
8060
8368
  throw new Error("Invalid OAuth scope syntax in token response");
8061
8369
  return {
@@ -8184,7 +8492,7 @@ function createDefaultOAuthClientProvider2(options) {
8184
8492
  const clientMode = options.client.mode;
8185
8493
  const interactiveEnabled = options.allowInteractive !== false;
8186
8494
  const sessionLockTimeoutMs = options.sessionLockTimeoutMs;
8187
- loopbackTarget2(browser);
8495
+ validateAuthorizationRedirect2(browser);
8188
8496
  assertPersistenceNamespace2(options.persistenceNamespace);
8189
8497
  const clientMetadata = getClientMetadata2(options.client);
8190
8498
  const requestedScope = clientMetadata?.scope;
@@ -8198,10 +8506,10 @@ function createDefaultOAuthClientProvider2(options) {
8198
8506
  if (resourceIdentity !== void 0 && selectedSessionStore !== void 0)
8199
8507
  throw new Error("OAuth resourceIdentity requires native-owned persistence; custom stores own their resource trust policy");
8200
8508
  const now = () => {
8201
- const timestamp = clock();
8202
- if (!Number.isSafeInteger(timestamp) || Math.abs(timestamp) > MAX_JS_DATE_MS32)
8509
+ const timestamp2 = clock();
8510
+ if (!Number.isSafeInteger(timestamp2) || Math.abs(timestamp2) > MAX_JS_DATE_MS32)
8203
8511
  throw new Error("OAuth clock must return valid epoch milliseconds");
8204
- return timestamp;
8512
+ return timestamp2;
8205
8513
  };
8206
8514
  const registeredClients = /* @__PURE__ */ new Map();
8207
8515
  const resourceStores = resourceIdentity === void 0 ? void 0 : createResourceBoundOAuthStores2(authStore ?? {}, persistenceNamespace, resourceIdentity);
@@ -8781,7 +9089,7 @@ function normalizeStoredTokens2(value) {
8781
9089
  const scope = getOwnEntry62(value, "scope");
8782
9090
  const normalizedAccessToken = accessToken?.trim();
8783
9091
  const normalizedRefreshToken = typeof refreshToken === "string" ? refreshToken.trim() : void 0;
8784
- const normalizedScope = normalizeOAuthScope2(scope);
9092
+ const normalizedScope = scope === "" ? "" : normalizeOAuthScope2(scope);
8785
9093
  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
9094
  return void 0;
8787
9095
  }
@@ -8790,7 +9098,7 @@ function normalizeStoredTokens2(value) {
8790
9098
  tokenType,
8791
9099
  expiresAt,
8792
9100
  ...normalizedRefreshToken === void 0 ? {} : { refreshToken: normalizedRefreshToken },
8793
- ...normalizedScope === void 0 || normalizedScope.length === 0 ? {} : { scope: normalizedScope }
9101
+ ...normalizedScope === void 0 ? {} : { scope: normalizedScope }
8794
9102
  };
8795
9103
  }
8796
9104
  function getClientMetadata2(client) {
@@ -14053,6 +14361,14 @@ import { AsyncLocalStorage } from "node:async_hooks";
14053
14361
  import { randomUUID as randomUUID4 } from "node:crypto";
14054
14362
  import * as util from "node:util";
14055
14363
  import { constants } from "node:os";
14364
+
14365
+ // ../safe-fs/dist/platform/transport-budget.js
14366
+ var hasRegisteredS3FileSystem = false;
14367
+ function enableS3TransportBudget() {
14368
+ hasRegisteredS3FileSystem = true;
14369
+ }
14370
+
14371
+ // ../safe-fs/dist/platform/node.js
14056
14372
  var systemErrnos = (() => {
14057
14373
  const fallback = new Map(Object.entries(constants.errno).map(([name, errno]) => [name, -Math.abs(errno)]));
14058
14374
  if (typeof util.getSystemErrorMap !== "function")
@@ -14085,6 +14401,19 @@ var comparisonContext = Object.freeze({
14085
14401
  }
14086
14402
  });
14087
14403
  var transportBudgets = new AsyncLocalStorage();
14404
+ function chargeScopedTransportCall(options) {
14405
+ if (!hasRegisteredS3FileSystem)
14406
+ return;
14407
+ const frames = transportBudgets.getStore();
14408
+ if (!frames)
14409
+ return;
14410
+ for (const frame of frames) {
14411
+ if (frame.credit > 0)
14412
+ frame.credit--;
14413
+ else
14414
+ frame.admit(options);
14415
+ }
14416
+ }
14088
14417
 
14089
14418
  // ../safe-fs/dist/contracts/errors.js
14090
14419
  var descriptions = {
@@ -14196,6 +14525,48 @@ var EMPTY_BYTE_SOURCE = Object.freeze({
14196
14525
  });
14197
14526
  var noop = () => {
14198
14527
  };
14528
+ async function collectBytes2(source, options) {
14529
+ if (options.maxBytes !== void 0 && options.maxBytes !== Infinity && (!Number.isSafeInteger(options.maxBytes) || options.maxBytes < 0)) {
14530
+ throw new RangeError("maxBytes must be a nonnegative safe integer");
14531
+ }
14532
+ if (options.maxMemoryBytes !== void 0 && options.maxMemoryBytes !== Infinity && (!Number.isSafeInteger(options.maxMemoryBytes) || options.maxMemoryBytes < 0)) {
14533
+ throw new RangeError("maxMemoryBytes must be a nonnegative safe integer or Infinity");
14534
+ }
14535
+ const memoryLimit = options.maxMemoryBytes ?? Infinity;
14536
+ let reserved = 0;
14537
+ let inputBytes = 0;
14538
+ let buffer = new Uint8Array(0);
14539
+ let size = 0;
14540
+ function reserve(bytes) {
14541
+ if (bytes > memoryLimit - reserved) {
14542
+ throw new FsError("EFBIG", { syscall: "collectBytes", message: "collection exceeds memory budget" });
14543
+ }
14544
+ reserved += bytes;
14545
+ }
14546
+ options.signal?.throwIfAborted();
14547
+ for await (const chunk of readBytes(source, options.signal)) {
14548
+ reserved -= inputBytes;
14549
+ inputBytes = 0;
14550
+ if (chunk.byteLength > (options.maxBytes ?? Infinity) - size) {
14551
+ throw new FsError("EFBIG", { syscall: "collectBytes", message: "output exceeds maxBytes" });
14552
+ }
14553
+ reserve(chunk.buffer.byteLength);
14554
+ inputBytes = chunk.buffer.byteLength;
14555
+ const nextSize = size + chunk.byteLength;
14556
+ if (nextSize > buffer.byteLength) {
14557
+ const capacity = Math.min(options.maxBytes ?? Infinity, Math.max(nextSize, buffer.byteLength * 2));
14558
+ reserve(capacity);
14559
+ const replacement = new Uint8Array(capacity);
14560
+ replacement.set(buffer.subarray(0, size));
14561
+ reserved -= buffer.byteLength;
14562
+ buffer = replacement;
14563
+ }
14564
+ buffer.set(chunk, size);
14565
+ size = nextSize;
14566
+ }
14567
+ options.signal?.throwIfAborted();
14568
+ return buffer.subarray(0, size);
14569
+ }
14199
14570
  async function abortable(operation, signal) {
14200
14571
  signal?.throwIfAborted();
14201
14572
  if (!signal)
@@ -14641,16 +15012,31 @@ async function openFileDescriptor(path6, options, capabilities, acquire) {
14641
15012
  }
14642
15013
 
14643
15014
  // ../safe-fs/dist/contracts/virtual-path.js
14644
- var MAX_PATH_BYTES = 65536;
14645
- var MAX_PATH_COMPONENTS = 2048;
14646
- function validatePath(path6, maxComponents = MAX_PATH_COMPONENTS) {
15015
+ function pathByteLength(path6) {
15016
+ let bytes = 0;
15017
+ for (const point of path6) {
15018
+ const code = point.codePointAt(0);
15019
+ bytes += code <= 127 ? 1 : code <= 2047 ? 2 : code <= 65535 ? 3 : 4;
15020
+ }
15021
+ return bytes;
15022
+ }
15023
+ function validatePath(path6, limits = {}) {
15024
+ const maxBytes = typeof limits === "number" ? Infinity : limits.maxPathBytes ?? Infinity;
15025
+ const maxComponents = typeof limits === "number" ? limits : limits.maxPathComponents ?? Infinity;
15026
+ for (const value of [maxBytes, maxComponents]) {
15027
+ if (value !== Infinity && (!Number.isSafeInteger(value) || value < 0)) {
15028
+ throw new RangeError("Path limits must be nonnegative safe integers or Infinity");
15029
+ }
15030
+ }
14647
15031
  if (typeof path6 !== "string" || path6.includes("\0")) {
14648
15032
  throw new FsError("EINVAL", { syscall: "resolve", message: "paths must be strings without NUL bytes" });
14649
15033
  }
14650
- if (path6.length > MAX_PATH_BYTES) {
15034
+ if (maxBytes !== Infinity && pathByteLength(path6) > maxBytes) {
14651
15035
  throw new FsError("ENAMETOOLONG", { syscall: "resolve", path: path6 });
14652
15036
  }
14653
- const limit = Math.min(maxComponents, MAX_PATH_COMPONENTS);
15037
+ if (maxComponents === Infinity)
15038
+ return;
15039
+ const limit = maxComponents;
14654
15040
  let components2 = 0;
14655
15041
  let inComponent = false;
14656
15042
  for (let i = 0; i < path6.length; i++) {
@@ -14955,10 +15341,76 @@ async function compareEntries(filesystem, path6, peer, peerPath, options = {}) {
14955
15341
  }
14956
15342
 
14957
15343
  // ../safe-fs/dist/fs/s3/registry.js
15344
+ var observedStats = /* @__PURE__ */ new WeakMap();
14958
15345
  var entries = /* @__PURE__ */ new WeakMap();
15346
+ var comparisons = /* @__PURE__ */ new WeakMap();
15347
+ var configuredComparisons = /* @__PURE__ */ new WeakMap();
15348
+ function recordS3Observation(filesystem, path6, stat, entry) {
15349
+ observedStats.set(stat, { filesystem, path: path6, entry });
15350
+ }
15351
+ function registerS3EntryOwner(filesystem, normalize2, intact, baseComparison, comparison) {
15352
+ enableS3TransportBudget();
15353
+ comparisons.set(filesystem, baseComparison);
15354
+ if (comparison)
15355
+ configuredComparisons.set(filesystem, comparison);
15356
+ entries.set(filesystem, (view) => {
15357
+ if (!intact())
15358
+ return void 0;
15359
+ const observation = observedStats.get(view.stat);
15360
+ return observation?.filesystem === filesystem && observation.path === normalize2(view.path) ? observation.entry : void 0;
15361
+ });
15362
+ }
14959
15363
  function getOwnedS3Entry(view) {
14960
15364
  return entries.get(view.filesystem)?.(view);
14961
15365
  }
15366
+ async function compareOwnedS3Entries(own, peer, options) {
15367
+ options.signal?.throwIfAborted();
15368
+ let explicit = false;
15369
+ let answer = "unknown";
15370
+ const visited = /* @__PURE__ */ new Set();
15371
+ for (const [left2, right2] of [[own, peer], [peer, own]]) {
15372
+ const baseComparison = comparisons.get(left2.filesystem);
15373
+ if (!baseComparison || visited.has(left2.filesystem))
15374
+ continue;
15375
+ visited.add(left2.filesystem);
15376
+ const current = left2.filesystem.compareEntry;
15377
+ const comparison = current === baseComparison ? configuredComparisons.get(left2.filesystem) : current;
15378
+ if (current === baseComparison && comparison === void 0)
15379
+ continue;
15380
+ explicit = true;
15381
+ if (comparison === void 0)
15382
+ continue;
15383
+ options.signal?.throwIfAborted();
15384
+ if (typeof comparison !== "function") {
15385
+ throw new FsError("EIO", { path: own.path, dest: peer.path, message: "invalid explicit S3 comparison method" });
15386
+ }
15387
+ assertCallbackAuthorityAllowed();
15388
+ const result = await comparison.call(left2.filesystem, left2.path, right2.filesystem, right2.path, options);
15389
+ options.signal?.throwIfAborted();
15390
+ if (result !== "same" && result !== "distinct" && result !== "unknown") {
15391
+ throw new FsError("EIO", { path: own.path, dest: peer.path, message: "invalid explicit S3 comparison" });
15392
+ }
15393
+ if (result === "unknown")
15394
+ continue;
15395
+ if (answer !== "unknown" && answer !== result) {
15396
+ throw new FsError("EIO", { path: own.path, dest: peer.path, message: "conflicting explicit S3 comparisons" });
15397
+ }
15398
+ answer = result;
15399
+ }
15400
+ const left = getOwnedS3Entry(own);
15401
+ options.signal?.throwIfAborted();
15402
+ const right = getOwnedS3Entry(peer);
15403
+ options.signal?.throwIfAborted();
15404
+ const same = left && right && left.storage === right.storage && left.key === right.key;
15405
+ if (same && answer === "distinct") {
15406
+ throw new FsError("EIO", { path: own.path, dest: peer.path, message: "explicit S3 comparison contradicts a known alias" });
15407
+ }
15408
+ if (same)
15409
+ return "same";
15410
+ if (explicit)
15411
+ return answer;
15412
+ return left && right ? "distinct" : "unknown";
15413
+ }
14962
15414
 
14963
15415
  // ../safe-fs/dist/fs/webdav/resource-id.js
14964
15416
  var responses = /* @__PURE__ */ new WeakMap();
@@ -14976,10 +15428,10 @@ function ownedResponseIdentifier(response, path6) {
14976
15428
  return responses.get(response)?.get(path6)?.identifier;
14977
15429
  }
14978
15430
  var queries = /* @__PURE__ */ new WeakMap();
14979
- var comparisons = /* @__PURE__ */ new WeakMap();
15431
+ var comparisons2 = /* @__PURE__ */ new WeakMap();
14980
15432
  var callbacks = /* @__PURE__ */ new WeakMap();
14981
15433
  function registerResourceQuery(filesystem, query, baseComparison, callback) {
14982
- comparisons.set(filesystem, baseComparison);
15434
+ comparisons2.set(filesystem, baseComparison);
14983
15435
  if (callback)
14984
15436
  callbacks.set(filesystem, callback);
14985
15437
  queries.set(filesystem, async (path6, options) => {
@@ -15007,7 +15459,7 @@ var compareWebDavResources = async (own, peer, options) => {
15007
15459
  let answer = "unknown";
15008
15460
  const visited = /* @__PURE__ */ new Set();
15009
15461
  for (const [left, right] of [[own, peer], [peer, own]]) {
15010
- const baseComparison = comparisons.get(left.filesystem);
15462
+ const baseComparison = comparisons2.get(left.filesystem);
15011
15463
  if (!baseComparison)
15012
15464
  continue;
15013
15465
  const method = left.filesystem.compareEntry;
@@ -15248,11 +15700,14 @@ function components(path6, signal) {
15248
15700
  }
15249
15701
  return result;
15250
15702
  }
15251
- function resolveMissingTarget(root, path6, signal) {
15252
- const fail2 = (code, failedPath = path6) => {
15703
+ function resolveMissingTarget(root, path6, signal, limits = {}) {
15704
+ validatePath(path6, limits);
15705
+ const fail3 = (code, failedPath = path6) => {
15253
15706
  throw new FsError(code, { syscall: "realpath", path: failedPath });
15254
15707
  };
15255
15708
  const origin = components(path6, signal);
15709
+ let remainingBytes = (limits.maxPathBytes ?? Infinity) - pathByteLength(path6);
15710
+ let remainingComponents = (limits.maxPathComponents ?? Infinity) - origin.length;
15256
15711
  const initial = { node: root, name: "" };
15257
15712
  let position = initial;
15258
15713
  let links = 0;
@@ -15279,9 +15734,9 @@ function resolveMissingTarget(root, path6, signal) {
15279
15734
  }
15280
15735
  const current = position.node;
15281
15736
  if (current.type !== "directory")
15282
- return fail2("ENOTDIR");
15737
+ return fail3("ENOTDIR");
15283
15738
  if ((current.mode >> 6 & 1) !== 1)
15284
- return fail2("EACCES");
15739
+ return fail3("EACCES");
15285
15740
  const name = component.name;
15286
15741
  if (name === ".") {
15287
15742
  first = false;
@@ -15293,7 +15748,7 @@ function resolveMissingTarget(root, path6, signal) {
15293
15748
  continue;
15294
15749
  }
15295
15750
  if (exceedsComponentByteLimit(name))
15296
- return fail2("ENAMETOOLONG");
15751
+ return fail3("ENAMETOOLONG");
15297
15752
  const node = current.entries.get(name);
15298
15753
  if (!node) {
15299
15754
  found = false;
@@ -15304,8 +15759,11 @@ function resolveMissingTarget(root, path6, signal) {
15304
15759
  first = false;
15305
15760
  if (node.type === "symlink") {
15306
15761
  if (++links > 40)
15307
- return fail2("ELOOP");
15762
+ return fail3("ELOOP");
15763
+ validatePath(node.target, { maxPathBytes: remainingBytes, maxPathComponents: remainingComponents });
15308
15764
  const names2 = components(node.target, signal);
15765
+ remainingBytes -= pathByteLength(node.target);
15766
+ remainingComponents -= names2.length;
15309
15767
  if (node.target.endsWith("/"))
15310
15768
  names2.push({ name: ".", start: node.target.length });
15311
15769
  if (node.target.startsWith("/"))
@@ -15326,7 +15784,7 @@ function resolveMissingTarget(root, path6, signal) {
15326
15784
  for (let count = origin.length; count > missing; count--) {
15327
15785
  signal?.throwIfAborted();
15328
15786
  if (count === missing + 1 && path6[end - 1] !== "/")
15329
- return fail2("ENOENT", path6.slice(0, end));
15787
+ return fail3("ENOENT", path6.slice(0, end));
15330
15788
  const last = origin[count - 1];
15331
15789
  if (!last)
15332
15790
  break;
@@ -15509,26 +15967,22 @@ function readConfigRecord(value, label, keys) {
15509
15967
 
15510
15968
  // ../safe-fs/dist/fs/memory/limits.js
15511
15969
  var defaultMemoryFileSystemLimits = Object.freeze({
15970
+ maxPathBytes: Infinity,
15971
+ maxPathComponents: Infinity,
15512
15972
  maxFileBytes: Infinity,
15513
15973
  maxRetainedBytes: Infinity,
15514
15974
  maxMetadataUnits: Infinity
15515
15975
  });
15516
15976
  function normalizeMemoryFileSystemLimits(options) {
15517
- const keys = ["maxFileBytes", "maxRetainedBytes", "maxMetadataUnits"];
15977
+ const keys = ["maxPathBytes", "maxPathComponents", "maxFileBytes", "maxRetainedBytes", "maxMetadataUnits"];
15518
15978
  const record3 = readConfigRecord(options, "memory option", [...keys, "maxBytes"]);
15519
15979
  const limits = { ...defaultMemoryFileSystemLimits };
15520
- if (Object.hasOwn(record3, "maxBytes") && record3.maxBytes !== void 0) {
15521
- if (typeof record3.maxBytes !== "number" || !Number.isSafeInteger(record3.maxBytes) || record3.maxBytes < 0) {
15522
- throw new RangeError("maxBytes must be a nonnegative safe integer");
15523
- }
15524
- limits.maxBytes = record3.maxBytes;
15525
- }
15526
- for (const key2 of keys) {
15527
- if (!Object.hasOwn(record3, key2))
15528
- continue;
15980
+ for (const key2 of [...keys, "maxBytes"]) {
15529
15981
  const value = record3[key2];
15982
+ if (value === void 0 || value === Infinity)
15983
+ continue;
15530
15984
  if (typeof value !== "number" || !Number.isSafeInteger(value) || value < (key2 === "maxMetadataUnits" ? 1 : 0)) {
15531
- throw new RangeError(`${key2} must be a ${key2 === "maxMetadataUnits" ? "positive" : "nonnegative"} safe integer`);
15985
+ throw new RangeError(`${key2} must be a ${key2 === "maxMetadataUnits" ? "positive" : "nonnegative"} safe integer or Infinity`);
15532
15986
  }
15533
15987
  limits[key2] = value;
15534
15988
  }
@@ -15577,12 +16031,10 @@ var DUMMY_POOL_FILE_NODE = new MemoryFileNode(0, 0, null, 0, DUMMY_POOL_ALLOCATI
15577
16031
  DUMMY_POOL_FILE_NODE.atimeMs = DUMMY_POOL_FILE_NODE.mtimeMs = DUMMY_POOL_FILE_NODE.ctimeMs = DUMMY_POOL_FILE_NODE.birthtimeMs = 17e11;
15578
16032
  var defaultDateNow = Date.now;
15579
16033
  var fastWriteCachedNow = Date.now();
15580
- var lastFastMapMiss = {
15581
- map: void 0,
15582
- key: "",
15583
- slot: -1
15584
- };
15585
16034
  var FastDirectoryEntriesMap = class {
16035
+ // Keep speculative slots local so a failed write cannot pin a tenant globally.
16036
+ _missKey = "";
16037
+ _missSlot = -1;
15586
16038
  _table = new Int16Array(128).fill(-1);
15587
16039
  _mask = 127;
15588
16040
  _keys = new Array(64).fill("");
@@ -15619,9 +16071,8 @@ var FastDirectoryEntriesMap = class {
15619
16071
  getForWriteWithHash(k, h) {
15620
16072
  let slot = h & this._mask;
15621
16073
  if (this.size === 0) {
15622
- lastFastMapMiss.map = this;
15623
- lastFastMapMiss.key = k;
15624
- lastFastMapMiss.slot = slot;
16074
+ this._missKey = k;
16075
+ this._missSlot = slot;
15625
16076
  return void 0;
15626
16077
  }
15627
16078
  const mask = this._mask;
@@ -15631,9 +16082,8 @@ var FastDirectoryEntriesMap = class {
15631
16082
  while (true) {
15632
16083
  const idx = table[slot];
15633
16084
  if (idx === -1) {
15634
- lastFastMapMiss.map = this;
15635
- lastFastMapMiss.key = k;
15636
- lastFastMapMiss.slot = firstDeleted !== -1 ? firstDeleted : slot;
16085
+ this._missKey = k;
16086
+ this._missSlot = firstDeleted !== -1 ? firstDeleted : slot;
15637
16087
  return void 0;
15638
16088
  }
15639
16089
  if (idx === -2) {
@@ -15682,6 +16132,7 @@ var FastDirectoryEntriesMap = class {
15682
16132
  return this.get(k) !== void 0;
15683
16133
  }
15684
16134
  _rebuild(newCap) {
16135
+ this._missKey = "";
15685
16136
  const newTableLen = newCap * 2;
15686
16137
  const newMask = newTableLen - 1;
15687
16138
  const newTable = newCap <= 16384 ? new Int16Array(newTableLen).fill(-1) : new Int32Array(newTableLen).fill(-1);
@@ -15721,15 +16172,16 @@ var FastDirectoryEntriesMap = class {
15721
16172
  this._next = writeIdx;
15722
16173
  }
15723
16174
  set(k, v) {
15724
- if (this === lastFastMapMiss.map && k === lastFastMapMiss.key && this._next < this._keys.length) {
16175
+ if (k === this._missKey && this._next < this._keys.length) {
15725
16176
  const entryIdx = this._next++;
15726
- this._table[lastFastMapMiss.slot] = entryIdx;
16177
+ this._table[this._missSlot] = entryIdx;
15727
16178
  this._keys[entryIdx] = k;
15728
16179
  this._vals[entryIdx] = v;
15729
16180
  this.size++;
15730
- lastFastMapMiss.map = void 0;
16181
+ this._missKey = "";
15731
16182
  return this;
15732
16183
  }
16184
+ this._missKey = "";
15733
16185
  if (this._next >= this._keys.length) {
15734
16186
  this._rebuild(this.size * 2 <= this._keys.length ? this._keys.length : this._keys.length * 2);
15735
16187
  }
@@ -15760,6 +16212,7 @@ var FastDirectoryEntriesMap = class {
15760
16212
  }
15761
16213
  }
15762
16214
  delete(k) {
16215
+ this._missKey = "";
15763
16216
  if (this.size === 0)
15764
16217
  return false;
15765
16218
  let slot = this._hash(k);
@@ -15785,6 +16238,7 @@ var FastDirectoryEntriesMap = class {
15785
16238
  }
15786
16239
  }
15787
16240
  clear() {
16241
+ this._missKey = "";
15788
16242
  if (this._next > 0) {
15789
16243
  this._table.fill(-1);
15790
16244
  for (let i = 0; i < this._next; i++) {
@@ -16237,7 +16691,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
16237
16691
  const owner = ownedStores.get(this);
16238
16692
  if (path6 !== "")
16239
16693
  this.validatePath(path6, "realpath");
16240
- return resolveMissingTarget(owner.root, path6 || ".", options.signal);
16694
+ return resolveMissingTarget(owner.root, path6 || ".", options.signal, this.ledger.limits);
16241
16695
  }
16242
16696
  async confineExtraction(roots, options = {}) {
16243
16697
  options.signal?.throwIfAborted();
@@ -16490,6 +16944,8 @@ var MemoryFileSystem = class _MemoryFileSystem {
16490
16944
  this.fail("EINVAL", syscall, path6);
16491
16945
  if (path6.length === 0)
16492
16946
  this.fail("ENOENT", syscall, path6);
16947
+ if (this.ledger.limits.maxPathBytes !== Infinity || this.ledger.limits.maxPathComponents !== Infinity)
16948
+ validatePath(path6, this.ledger.limits);
16493
16949
  }
16494
16950
  permission(node, mask, syscall, path6) {
16495
16951
  if ((node.mode >> 6 & mask) !== mask)
@@ -16511,6 +16967,8 @@ var MemoryFileSystem = class _MemoryFileSystem {
16511
16967
  node.mtimeMs = node.ctimeMs = now;
16512
16968
  }
16513
16969
  resolveNode(path6, syscall, followFinal = true) {
16970
+ if (this.ledger.limits.maxPathBytes !== Infinity || this.ledger.limits.maxPathComponents !== Infinity)
16971
+ validatePath(path6, this.ledger.limits);
16514
16972
  const cache = memoryCaches.get(this.ledger);
16515
16973
  if (this.symlinkCount === 0 && isCleanAbsolutePath(path6)) {
16516
16974
  const fastDir = cache.lastFastDirNode;
@@ -16595,7 +17053,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
16595
17053
  start = slash + 1;
16596
17054
  }
16597
17055
  }
16598
- let remainingPathUnits = 65536 - path6.length;
17056
+ let remainingPathUnits = this.ledger.limits.maxPathBytes - pathByteLength(path6);
16599
17057
  if (remainingPathUnits < 0)
16600
17058
  this.fail("ENAMETOOLONG", syscall, path6);
16601
17059
  let initialComponents = 0;
@@ -16605,12 +17063,12 @@ var MemoryFileSystem = class _MemoryFileSystem {
16605
17063
  inComp = false;
16606
17064
  else if (!inComp) {
16607
17065
  inComp = true;
16608
- if (++initialComponents > 256)
17066
+ if (++initialComponents > this.ledger.limits.maxPathComponents)
16609
17067
  this.fail("ENAMETOOLONG", syscall, path6);
16610
17068
  }
16611
17069
  }
16612
- const pending = path6.split("/").filter(Boolean);
16613
- let remainingComponents = 256 - pending.length;
17070
+ let pending = path6.split("/").filter(Boolean);
17071
+ let remainingComponents = this.ledger.limits.maxPathComponents - pending.length;
16614
17072
  if (path6.endsWith("/"))
16615
17073
  pending.push("");
16616
17074
  const stack = [{ node: this.root, name: "" }];
@@ -16660,9 +17118,9 @@ var MemoryFileSystem = class _MemoryFileSystem {
16660
17118
  if (node.type === "symlink" && (options.followFinal !== false || pending.length > 0)) {
16661
17119
  if (++links > 40)
16662
17120
  this.fail("ELOOP", syscall, path6);
16663
- if (node.target.length > remainingPathUnits)
17121
+ if (pathByteLength(node.target) > remainingPathUnits)
16664
17122
  this.fail("ENAMETOOLONG", syscall, path6);
16665
- remainingPathUnits -= node.target.length;
17123
+ remainingPathUnits -= pathByteLength(node.target);
16666
17124
  const target = node.target.split("/").filter(Boolean);
16667
17125
  if (target.length > remainingComponents)
16668
17126
  this.fail("ENAMETOOLONG", syscall, path6);
@@ -16671,7 +17129,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
16671
17129
  target.push("");
16672
17130
  if (options.resizeCreate !== void 0 && target.at(-1) === "" && pending[0] === "")
16673
17131
  target.pop();
16674
- pending.unshift(...target);
17132
+ pending = target.concat(pending);
16675
17133
  if (node.target.startsWith("/"))
16676
17134
  stack.splice(1);
16677
17135
  continue;
@@ -16687,6 +17145,8 @@ var MemoryFileSystem = class _MemoryFileSystem {
16687
17145
  };
16688
17146
  }
16689
17147
  file(path6, syscall) {
17148
+ if (this.ledger.limits.maxPathBytes !== Infinity || this.ledger.limits.maxPathComponents !== Infinity)
17149
+ validatePath(path6, this.ledger.limits);
16690
17150
  if (this.symlinkCount === 0 && path6.charCodeAt(0) === 47 && path6.length > 1 && path6.indexOf("/", 1) === -1 && !path6.includes("\0")) {
16691
17151
  const name = path6 === _lastFileSlice1Path ? _lastFileSlice1Name : (_lastFileSlice1Path = path6, _lastFileSlice1Name = path6.slice(1));
16692
17152
  if (name !== "." && name !== "..") {
@@ -16961,6 +17421,8 @@ var MemoryFileSystem = class _MemoryFileSystem {
16961
17421
  }, syscall, path6);
16962
17422
  }
16963
17423
  writeData(path6, data, options, syscall) {
17424
+ if (this.ledger.limits.maxPathBytes !== Infinity || this.ledger.limits.maxPathComponents !== Infinity)
17425
+ validatePath(path6, this.ledger.limits);
16964
17426
  if (!(data instanceof Uint8Array))
16965
17427
  throw new TypeError("Memory files require Uint8Array data");
16966
17428
  const target = this.prepareWrite(path6, options, syscall);
@@ -17077,9 +17539,11 @@ var MemoryFileSystem = class _MemoryFileSystem {
17077
17539
  this.changed(node, now);
17078
17540
  }
17079
17541
  writeMemoryFileFast(path6, data, append, mode) {
17542
+ if (this.ledger.limits.maxPathBytes !== Infinity || this.ledger.limits.maxPathComponents !== Infinity)
17543
+ validatePath(path6, this.ledger.limits);
17080
17544
  const cache = memoryCaches.get(this.ledger);
17081
17545
  const syscall = append ? "appendFile" : "writeFile";
17082
- if (append && path6 === cache.lastFastFilePath && cache.lastFastFileNode !== void 0 && cache.lastFastFileNode.nlink !== 0 && cache.lastFastDirNode !== void 0 && cache.lastFastDirNode.nlink !== 0 && (cache.lastFastDirNode.mode & 1) !== 0 && (cache.lastFastFileNode.mode & 2) !== 0) {
17546
+ if (append && path6 === cache.lastFastFilePath && cache.lastFastFileNode !== void 0 && cache.lastFastFileNode.nlink !== 0 && cache.lastFastDirNode !== void 0 && cache.lastFastDirNode.nlink !== 0 && (cache.lastFastDirNode.mode & 64) !== 0 && (cache.lastFastFileNode.mode & 128) !== 0) {
17083
17547
  const current2 = cache.lastFastFileNode;
17084
17548
  const length2 = current2.byteLength + data.byteLength;
17085
17549
  this.admitSize(current2, length2, syscall, path6);
@@ -17093,7 +17557,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
17093
17557
  let name = "";
17094
17558
  const cachedPrefix = cache.lastFastDirPrefix;
17095
17559
  const cachedDir = cache.lastFastDirNode;
17096
- if (cachedDir !== void 0 && cachedDir.nlink !== 0 && (cachedDir.mode & 1) !== 0 && cachedPrefix.length > 1 && path6.startsWith(cachedPrefix) && path6.indexOf("/", cachedPrefix.length) === -1) {
17560
+ if (cachedDir !== void 0 && cachedDir.nlink !== 0 && (cachedDir.mode & 64) !== 0 && cachedPrefix.length > 1 && path6.startsWith(cachedPrefix) && path6.indexOf("/", cachedPrefix.length) === -1) {
17097
17561
  parent = cachedDir;
17098
17562
  name = path6.slice(cachedPrefix.length);
17099
17563
  if (exceedsComponentByteLimit2(name))
@@ -17106,7 +17570,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
17106
17570
  name = path6.slice(start);
17107
17571
  if (exceedsComponentByteLimit2(name))
17108
17572
  this.fail("ENAMETOOLONG", syscall, path6);
17109
- if (start > 1 && (parent.mode & 1) !== 0) {
17573
+ if (start > 1 && (parent.mode & 64) !== 0) {
17110
17574
  cache.lastFastDirPrefix = path6.slice(0, start);
17111
17575
  cache.lastFastDirNode = parent;
17112
17576
  }
@@ -17226,6 +17690,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
17226
17690
  let ino = this.nextInode;
17227
17691
  this.nextInode = ino + batchCount;
17228
17692
  let nextIdx = 1;
17693
+ entries2._missKey = "";
17229
17694
  entries2._next = 1 + batchCount;
17230
17695
  entries2.size = 1 + batchCount;
17231
17696
  const table = entries2._table;
@@ -17275,6 +17740,8 @@ var MemoryFileSystem = class _MemoryFileSystem {
17275
17740
  }
17276
17741
  }
17277
17742
  writeMemoryFileInDirFast(dirPrefix, name, data, append, mode, nameHash) {
17743
+ if (this.ledger.limits.maxPathBytes !== Infinity || this.ledger.limits.maxPathComponents !== Infinity)
17744
+ validatePath(dirPrefix + name, this.ledger.limits);
17278
17745
  const cache = this._cache;
17279
17746
  if (!append && dirPrefix === cache.lastFastDirPrefix && cache.lastFastDirNode !== void 0 && cache.lastFastDirNode.nlink !== 0 && (cache.lastFastDirNode.mode & 192) === 192 && name.length <= 85 && this.ledger.hasInfiniteRetained && this.ledger.hasInfiniteFileBytes && this.ledger.limits.maxBytes === void 0 && sharedFileNodePoolLen > 0) {
17280
17747
  const parent = cache.lastFastDirNode;
@@ -17302,12 +17769,11 @@ var MemoryFileSystem = class _MemoryFileSystem {
17302
17769
  node.allocation = DUMMY_POOL_ALLOCATION;
17303
17770
  node.sourceRef = node.data.subarray(0);
17304
17771
  const entryIdx = entries2._next++;
17305
- entries2._table[lastFastMapMiss.slot] = entryIdx;
17772
+ entries2._table[entries2._missSlot] = entryIdx;
17306
17773
  entries2._keys[entryIdx] = name;
17307
17774
  entries2._vals[entryIdx] = node;
17308
17775
  entries2.size++;
17309
- lastFastMapMiss.map = void 0;
17310
- lastFastMapMiss.key = "";
17776
+ entries2._missKey = "";
17311
17777
  this.ledger.reserve(name.length * 2, 2, "writeFile", name);
17312
17778
  this.totalBytes += length;
17313
17779
  this.mutationTick = this.mutationTick + 1 | 0;
@@ -17321,7 +17787,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
17321
17787
  }
17322
17788
  const syscall = append ? "appendFile" : "writeFile";
17323
17789
  try {
17324
- if (append && dirPrefix === cache.lastFastDirPrefix && name === cache.lastFastFileName && cache.lastFastFileNode !== void 0 && cache.lastFastFileNode.nlink !== 0 && cache.lastFastDirNode !== void 0 && cache.lastFastDirNode.nlink !== 0 && (cache.lastFastDirNode.mode & 1) !== 0 && (cache.lastFastFileNode.mode & 2) !== 0) {
17790
+ if (append && dirPrefix === cache.lastFastDirPrefix && name === cache.lastFastFileName && cache.lastFastFileNode !== void 0 && cache.lastFastFileNode.nlink !== 0 && cache.lastFastDirNode !== void 0 && cache.lastFastDirNode.nlink !== 0 && (cache.lastFastDirNode.mode & 64) !== 0 && (cache.lastFastFileNode.mode & 128) !== 0) {
17325
17791
  const current2 = cache.lastFastFileNode;
17326
17792
  const length2 = current2.byteLength + data.byteLength;
17327
17793
  this.admitSize(current2, length2, syscall, name);
@@ -17332,7 +17798,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
17332
17798
  }
17333
17799
  let parent = this.root;
17334
17800
  const cachedDir = cache.lastFastDirNode;
17335
- if (cachedDir !== void 0 && cachedDir.nlink !== 0 && (cachedDir.mode & 1) !== 0 && dirPrefix === cache.lastFastDirPrefix) {
17801
+ if (cachedDir !== void 0 && cachedDir.nlink !== 0 && (cachedDir.mode & 64) !== 0 && dirPrefix === cache.lastFastDirPrefix) {
17336
17802
  parent = cachedDir;
17337
17803
  if (exceedsComponentByteLimit2(name))
17338
17804
  this.fail("ENAMETOOLONG", syscall, name);
@@ -17357,7 +17823,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
17357
17823
  this.permission(parent, 1, syscall, name);
17358
17824
  if (exceedsComponentByteLimit2(name))
17359
17825
  this.fail("ENAMETOOLONG", syscall, name);
17360
- if (dirPrefix.length > 1 && (parent.mode & 1) !== 0) {
17826
+ if (dirPrefix.length > 1 && (parent.mode & 64) !== 0) {
17361
17827
  cache.lastFastDirPrefix = dirPrefix;
17362
17828
  cache.lastFastDirNode = parent;
17363
17829
  }
@@ -17433,11 +17899,7 @@ var MemoryFileSystem = class _MemoryFileSystem {
17433
17899
  cache.lastFastFilePath = "";
17434
17900
  cache.lastFastFileName = name;
17435
17901
  cache.lastFastFileNode = node;
17436
- lastFastMapMiss.map = void 0;
17437
- lastFastMapMiss.key = "";
17438
17902
  } catch (error) {
17439
- lastFastMapMiss.map = void 0;
17440
- lastFastMapMiss.key = "";
17441
17903
  this.ledger.release(nameBytes, 2);
17442
17904
  throw error;
17443
17905
  }
@@ -19245,7 +19707,7 @@ function qualifiedNameSync(name, cache) {
19245
19707
  }
19246
19708
  return parts;
19247
19709
  }
19248
- function* entities(text) {
19710
+ function* entities(text, recover) {
19249
19711
  let result = "";
19250
19712
  let offset = 0;
19251
19713
  while (offset < text.length) {
@@ -19254,8 +19716,12 @@ function* entities(text) {
19254
19716
  return result + text.slice(offset);
19255
19717
  result += text.slice(offset, start);
19256
19718
  const end = yield* find(text, ";", start + 1);
19257
- if (end < 0)
19258
- invalid("unterminated entity");
19719
+ if (end < 0) {
19720
+ if (!recover)
19721
+ invalid("unterminated entity");
19722
+ recover("unterminated entity");
19723
+ return result + text.slice(start + 1);
19724
+ }
19259
19725
  const entity = text.slice(start + 1, end);
19260
19726
  const predefined = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" };
19261
19727
  if (Object.hasOwn(predefined, entity))
@@ -19263,8 +19729,13 @@ function* entities(text) {
19263
19729
  else {
19264
19730
  const hexadecimal = entity.startsWith("#x");
19265
19731
  const digits = entity.slice(hexadecimal ? 2 : 1);
19266
- if (!entity.startsWith("#") || !digits.length)
19267
- invalid("undeclared entity");
19732
+ if (!entity.startsWith("#") || !digits.length) {
19733
+ if (!recover)
19734
+ invalid("undeclared entity");
19735
+ recover("undeclared entity");
19736
+ offset = end + 1;
19737
+ continue;
19738
+ }
19268
19739
  let point = 0;
19269
19740
  for (let index = 0; index < digits.length; index++) {
19270
19741
  const code = digits.charCodeAt(index);
@@ -19422,27 +19893,42 @@ function* parseXmlSteps(input, limits = {}) {
19422
19893
  throw new XmlLimitError("maxContentNodes", "XML content node limit exceeded");
19423
19894
  };
19424
19895
  let pendingWork = 0;
19425
- const skipWhitespace = () => {
19896
+ const skipWhitespace = function* () {
19426
19897
  const start2 = offset;
19427
19898
  while (offset < source.length) {
19428
19899
  const c = source.charCodeAt(offset);
19429
19900
  if (c !== 32 && c !== 9 && c !== 10 && c !== 13)
19430
19901
  break;
19431
19902
  offset++;
19903
+ pendingWork++;
19904
+ if (pendingWork >= 512) {
19905
+ yield 512;
19906
+ pendingWork -= 512;
19907
+ }
19432
19908
  }
19433
19909
  return offset - start2;
19434
19910
  };
19435
- const scanName = () => {
19911
+ const scanName = function* () {
19436
19912
  const start2 = offset;
19437
19913
  while (offset < source.length) {
19438
19914
  const c = source.charCodeAt(offset);
19439
19915
  if (c === 32 || c === 9 || c === 13 || c === 10 || c === 47 || c === 61 || c === 62 || c === 63)
19440
19916
  break;
19441
19917
  offset++;
19918
+ pendingWork++;
19919
+ if (pendingWork >= 512) {
19920
+ yield 512;
19921
+ pendingWork -= 512;
19922
+ }
19442
19923
  }
19443
19924
  const name = source.slice(start2, offset);
19925
+ pendingWork += offset - start2;
19926
+ while (pendingWork >= 512) {
19927
+ yield 512;
19928
+ pendingWork -= 512;
19929
+ }
19444
19930
  const [prefix, localName] = qualifiedNameSync(name, qualifiedNames);
19445
- return [name, prefix, localName, (offset - start2) * 2];
19931
+ return [name, prefix, localName];
19446
19932
  };
19447
19933
  while (offset < source.length) {
19448
19934
  pendingWork += 1;
@@ -19463,7 +19949,7 @@ function* parseXmlSteps(input, limits = {}) {
19463
19949
  }
19464
19950
  if (text.indexOf("]]>") >= 0)
19465
19951
  invalid("CDATA terminator in text");
19466
- const resolved = stack.length ? text.indexOf("&") < 0 ? (pendingWork += text.length, text) : yield* entities(text) : text;
19952
+ const resolved = stack.length ? text.indexOf("&") < 0 ? (pendingWork += text.length, text) : yield* entities(text, limits.recover) : text;
19467
19953
  while (pendingWork >= 512) {
19468
19954
  yield 512;
19469
19955
  pendingWork -= 512;
@@ -19479,11 +19965,15 @@ function* parseXmlSteps(input, limits = {}) {
19479
19965
  }
19480
19966
  } else {
19481
19967
  for (let index = 0; index < resolved.length; index++) {
19968
+ pendingWork++;
19969
+ if (pendingWork >= 512) {
19970
+ yield 512;
19971
+ pendingWork -= 512;
19972
+ }
19482
19973
  const c = resolved.charCodeAt(index);
19483
19974
  if (c !== 32 && c !== 9 && c !== 13 && c !== 10)
19484
19975
  invalid("text outside the root");
19485
19976
  }
19486
- pendingWork += resolved.length;
19487
19977
  while (pendingWork >= 512) {
19488
19978
  yield 512;
19489
19979
  pendingWork -= 512;
@@ -19525,8 +20015,7 @@ function* parseXmlSteps(input, limits = {}) {
19525
20015
  } else if (source.startsWith("<?", offset)) {
19526
20016
  const start2 = offset;
19527
20017
  offset += 2;
19528
- const [target, , , wName] = scanName();
19529
- pendingWork += wName;
20018
+ const [target] = yield* scanName();
19530
20019
  while (pendingWork >= 512) {
19531
20020
  yield 512;
19532
20021
  pendingWork -= 512;
@@ -19565,21 +20054,25 @@ function* parseXmlSteps(input, limits = {}) {
19565
20054
  invalid("DTD and entity declarations are forbidden");
19566
20055
  } else if (source.charCodeAt(offset + 1) === 47) {
19567
20056
  offset += 2;
19568
- const [name, , , wName] = scanName();
19569
- pendingWork += wName + skipWhitespace();
20057
+ const [name] = yield* scanName();
20058
+ yield* skipWhitespace();
19570
20059
  while (pendingWork >= 512) {
19571
20060
  yield 512;
19572
20061
  pendingWork -= 512;
19573
20062
  }
19574
- if (source[offset++] !== ">" || stack.pop()?.name !== name)
19575
- invalid("mismatched closing tag");
20063
+ if (source[offset++] !== ">" || stack.pop()?.name !== name) {
20064
+ if (!limits.recover)
20065
+ invalid("mismatched closing tag");
20066
+ limits.recover("mismatched closing tag");
20067
+ }
19576
20068
  } else {
19577
20069
  offset++;
19578
20070
  const repeated = previousEmpty && source.startsWith(previousEmpty.suffix, offset) ? previousEmpty : void 0;
19579
- const [name, prefix, localName, wName] = repeated ? [repeated.name, repeated.prefix, repeated.localName, repeated.name.length * 2] : scanName();
20071
+ const [name, prefix, localName] = repeated ? [repeated.name, repeated.prefix, repeated.localName] : yield* scanName();
19580
20072
  if (repeated)
19581
20073
  offset += name.length;
19582
- pendingWork += wName;
20074
+ if (repeated)
20075
+ pendingWork += name.length * 2;
19583
20076
  while (pendingWork >= 512) {
19584
20077
  yield 512;
19585
20078
  pendingWork -= 512;
@@ -19589,19 +20082,17 @@ function* parseXmlSteps(input, limits = {}) {
19589
20082
  let namespaces = stack.at(-1)?.namespaces ?? /* @__PURE__ */ new Map([["xml", xmlNamespace]]);
19590
20083
  let ownsNamespaces = stack.length === 0;
19591
20084
  while (!repeated) {
19592
- const ws = skipWhitespace();
19593
- pendingWork += ws;
20085
+ const ws = yield* skipWhitespace();
19594
20086
  while (pendingWork >= 512) {
19595
20087
  yield 512;
19596
20088
  pendingWork -= 512;
19597
20089
  }
19598
20090
  const ch = source.charCodeAt(offset);
19599
- if (ch === 47 || ch === 62)
20091
+ if (ch === 47 || ch === 62 || limits.recover && offset === source.length)
19600
20092
  break;
19601
20093
  if (ws === 0)
19602
20094
  invalid("attributes require whitespace");
19603
- const [attribute, attrPrefix, attrLocal, wAttr] = scanName();
19604
- pendingWork += wAttr;
20095
+ const [attribute, attrPrefix, attrLocal] = yield* scanName();
19605
20096
  while (pendingWork >= 512) {
19606
20097
  yield 512;
19607
20098
  pendingWork -= 512;
@@ -19612,10 +20103,10 @@ function* parseXmlSteps(input, limits = {}) {
19612
20103
  throw new XmlLimitError("maxAttributes", "XML attribute limit exceeded");
19613
20104
  if ((attributes?.size ?? 0) >= maxAttributesPerElement)
19614
20105
  throw new XmlLimitError("maxAttributesPerElement", "XML attribute limit exceeded");
19615
- pendingWork += skipWhitespace();
20106
+ yield* skipWhitespace();
19616
20107
  if (source[offset++] !== "=")
19617
20108
  invalid("missing attribute equals");
19618
- pendingWork += skipWhitespace();
20109
+ yield* skipWhitespace();
19619
20110
  const quote = source[offset++];
19620
20111
  if (quote !== '"' && quote !== "'")
19621
20112
  invalid("unquoted attribute");
@@ -19637,7 +20128,7 @@ function* parseXmlSteps(input, limits = {}) {
19637
20128
  if (raw.indexOf("<") >= 0)
19638
20129
  invalid("less-than in attribute");
19639
20130
  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);
20131
+ const value = normalized.indexOf("&") < 0 ? (pendingWork += normalized.length, normalized) : yield* entities(normalized, limits.recover);
19641
20132
  while (pendingWork >= 512) {
19642
20133
  yield 512;
19643
20134
  pendingWork -= 512;
@@ -19727,8 +20218,11 @@ function* parseXmlSteps(input, limits = {}) {
19727
20218
  const empty = source[offset] === "/";
19728
20219
  if (empty)
19729
20220
  offset++;
19730
- if (source[offset++] !== ">")
19731
- invalid("unterminated start tag");
20221
+ if (source[offset++] !== ">") {
20222
+ if (!limits.recover)
20223
+ invalid("unterminated start tag");
20224
+ limits.recover("unterminated start tag");
20225
+ }
19732
20226
  if (empty && !attributes && name.length <= 512 && source.slice(offset - name.length - 3, offset) === `<${name}/>`)
19733
20227
  previousEmpty = { suffix: name + "/>", name, prefix, localName };
19734
20228
  if (!empty)
@@ -19739,8 +20233,13 @@ function* parseXmlSteps(input, limits = {}) {
19739
20233
  yield pendingWork;
19740
20234
  pendingWork = 0;
19741
20235
  }
19742
- if (stack.length || !root)
20236
+ if (!root)
19743
20237
  invalid("incomplete document");
20238
+ if (stack.length) {
20239
+ if (!limits.recover)
20240
+ invalid("incomplete document");
20241
+ limits.recover("incomplete document");
20242
+ }
19744
20243
  return root;
19745
20244
  }
19746
20245
 
@@ -19794,14 +20293,13 @@ function scalar(element) {
19794
20293
 
19795
20294
  // ../safe-fs/dist/fs/webdav/webdav.js
19796
20295
  var timestampNamespace = "urn:virtual-bash:metadata";
19797
- var maxTimestampPropertyBytes = 4096;
19798
- function preflightTimestamps(property) {
20296
+ function preflightTimestamps(property, maxTimestampPropertyBytes) {
19799
20297
  let bytes = 0;
19800
20298
  for (const point of property.text) {
19801
20299
  const code = point.codePointAt(0);
19802
20300
  bytes += code <= 127 ? 1 : code <= 2047 ? 2 : code <= 65535 ? 3 : 4;
19803
20301
  if (bytes > maxTimestampPropertyBytes)
19804
- throw new Error("timestamp property exceeds 4KiB limit");
20302
+ throw new Error("timestamp property exceeds byte limit");
19805
20303
  }
19806
20304
  const text = scalar(property);
19807
20305
  let offset = 0;
@@ -20042,6 +20540,7 @@ var WebDavFileSystem = class {
20042
20540
  headers;
20043
20541
  maxResponseBytes;
20044
20542
  maxXmlBytes;
20543
+ maxTimestampPropertyBytes;
20045
20544
  maxEntries;
20046
20545
  xmlLimits;
20047
20546
  timeoutMs;
@@ -20111,6 +20610,7 @@ var WebDavFileSystem = class {
20111
20610
  streamingAppend: this.requestStreamSupport !== false
20112
20611
  });
20113
20612
  this.maxResponseBytes = options.maxResponseBytes === void 0 ? Infinity : positive(options.maxResponseBytes, "maxResponseBytes", false, true);
20613
+ this.maxTimestampPropertyBytes = positive(options.maxTimestampPropertyBytes ?? Infinity, "maxTimestampPropertyBytes", true, true);
20114
20614
  this.maxXmlBytes = options.maxXmlBytes === void 0 ? Infinity : positive(options.maxXmlBytes, "maxXmlBytes", false, true);
20115
20615
  this.xmlLimits = Object.freeze({ ...options.xmlLimits });
20116
20616
  for (const [name, value] of Object.entries(this.xmlLimits))
@@ -20546,7 +21046,7 @@ var WebDavFileSystem = class {
20546
21046
  let mtimeMs = date("getlastmodified") ?? 0;
20547
21047
  let atimeMs = 0;
20548
21048
  if (timestampProperty) {
20549
- const timestamps = JSON.parse(preflightTimestamps(timestampProperty));
21049
+ const timestamps = JSON.parse(preflightTimestamps(timestampProperty, this.maxTimestampPropertyBytes));
20550
21050
  if (typeof timestamps !== "object" || timestamps === null || !("version" in timestamps) || timestamps.version !== 1 || !("etag" in timestamps) || typeof timestamps.etag !== "string" || !/^"[\x21\x23-\x7e\x80-\xff]*"$/.test(timestamps.etag) || !("type" in timestamps) || timestamps.type !== "file" && timestamps.type !== "directory" || !("atimeMs" in timestamps) || typeof timestamps.atimeMs !== "number" || !Number.isFinite(timestamps.atimeMs) || Math.abs(timestamps.atimeMs) > 864e13 || !("mtimeMs" in timestamps) || typeof timestamps.mtimeMs !== "number" || !Number.isFinite(timestamps.mtimeMs) || Math.abs(timestamps.mtimeMs) > 864e13)
20551
21051
  throw new Error("invalid timestamp property");
20552
21052
  if (timestamps.etag === validator && timestamps.type === (directory ? "directory" : "file")) {
@@ -21225,6 +21725,1220 @@ var WebDavFileSystem = class {
21225
21725
  };
21226
21726
  var originalWebDavComparison = WebDavFileSystem.prototype.compareEntry;
21227
21727
 
21728
+ // ../safe-fs/dist/fs/s3/key-order.js
21729
+ function compareKeys(left, right) {
21730
+ const encoder = new TextEncoder();
21731
+ const a = encoder.encode(left), b = encoder.encode(right);
21732
+ for (let index = 0; index < Math.min(a.length, b.length); index++) {
21733
+ const difference = a[index] - b[index];
21734
+ if (difference)
21735
+ return difference;
21736
+ }
21737
+ return a.length - b.length;
21738
+ }
21739
+
21740
+ // ../safe-fs/dist/fs/s3/authority.js
21741
+ var queryKey = /* @__PURE__ */ Symbol("s3-head-query");
21742
+ var queries2 = /* @__PURE__ */ new WeakMap();
21743
+ var providerHeads = /* @__PURE__ */ new WeakMap();
21744
+ var acceptedHeads = /* @__PURE__ */ new WeakMap();
21745
+ async function queryS3Head(input, action) {
21746
+ const token = Object.freeze({});
21747
+ const query = Object.freeze({ ...input });
21748
+ const forwarded = { ...query, [queryKey]: token };
21749
+ queries2.set(token, query);
21750
+ try {
21751
+ const output = await action(forwarded);
21752
+ acceptedHeads.delete(output);
21753
+ const proof = providerHeads.get(output);
21754
+ if (proof?.query === query)
21755
+ acceptedHeads.set(output, proof.entry);
21756
+ return output;
21757
+ } finally {
21758
+ queries2.delete(token);
21759
+ }
21760
+ }
21761
+ function recordS3Stat(filesystem, path6, stat, metadata) {
21762
+ if (!metadata)
21763
+ return;
21764
+ const entry = acceptedHeads.get(metadata);
21765
+ acceptedHeads.delete(metadata);
21766
+ if (entry)
21767
+ recordS3Observation(filesystem, path6, stat, entry);
21768
+ }
21769
+
21770
+ // ../safe-fs/dist/fs/s3/transport.js
21771
+ function encodeCopySource(bucket, key2) {
21772
+ return [bucket, ...key2.split("/")].map((part) => encodeURIComponent(part).replace(/[!'()*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`)).join("/");
21773
+ }
21774
+
21775
+ // ../safe-fs/dist/fs/s3/filesystem.js
21776
+ var S3RenameError = class extends FsError {
21777
+ phase;
21778
+ copiedKeys;
21779
+ deletedKeys;
21780
+ constructor(source, destination, phase, copied, deleted, cause) {
21781
+ super(cause.code, {
21782
+ syscall: "rename",
21783
+ path: source,
21784
+ dest: destination,
21785
+ cause,
21786
+ message: `non-atomic S3 rename failed during ${phase}; destination copies or partial source deletions may remain`
21787
+ });
21788
+ this.name = "S3RenameError";
21789
+ this.phase = phase;
21790
+ this.copiedKeys = Object.freeze([...copied]);
21791
+ this.deletedKeys = Object.freeze([...deleted]);
21792
+ }
21793
+ };
21794
+ function serviceCode(error) {
21795
+ if (typeof error !== "object" || error === null)
21796
+ return void 0;
21797
+ const record3 = error;
21798
+ const value = record3.Code ?? record3.code ?? record3.name;
21799
+ return typeof value === "string" ? value : void 0;
21800
+ }
21801
+ function translate(error, syscall, path6, precondition = "EAGAIN") {
21802
+ if (error instanceof FsError)
21803
+ return error;
21804
+ const status = error?.$metadata?.httpStatusCode;
21805
+ const name = serviceCode(error);
21806
+ let code = "EIO";
21807
+ if (name === "AbortError" || status === 499)
21808
+ code = "ECANCELED";
21809
+ else if (name === "NoSuchKey" || name === "NotFound" || name === "NoSuchBucket" || status === 404)
21810
+ code = "ENOENT";
21811
+ else if (["AccessDenied", "InvalidAccessKeyId", "SignatureDoesNotMatch", "ExpiredToken"].includes(name ?? "") || status === 401 || status === 403)
21812
+ code = "EACCES";
21813
+ else if (name === "PreconditionFailed" || status === 412)
21814
+ code = precondition;
21815
+ else if (name === "ConditionalRequestConflict" || name === "SlowDown" || status === 409 || status === 429 || status === 503)
21816
+ code = "EAGAIN";
21817
+ else if (name === "NotImplemented" || status === 501)
21818
+ code = "ENOTSUP";
21819
+ else if (name === "EntityTooLarge")
21820
+ code = "EFBIG";
21821
+ else if (name === "InvalidArgument" || name === "InvalidRequest" || status === 400)
21822
+ code = "EINVAL";
21823
+ else if (name === "TimeoutError" || name === "RequestTimeout" || status === 408)
21824
+ code = "ETIMEDOUT";
21825
+ return new FsError(code, { syscall, path: path6, cause: error });
21826
+ }
21827
+ function fail2(code, syscall, path6, message) {
21828
+ throw new FsError(code, { syscall, path: path6, ...message === void 0 ? {} : { message } });
21829
+ }
21830
+ function validateLimit(value, name, minimum, maximum = Number.MAX_SAFE_INTEGER) {
21831
+ if ((value !== Infinity || maximum !== Infinity) && (!Number.isSafeInteger(value) || value < minimum || value > maximum)) {
21832
+ throw new FsError("EINVAL", { message: `${name} must be an integer from ${minimum} to ${maximum}` });
21833
+ }
21834
+ return value;
21835
+ }
21836
+ function utf8ByteLength3(value) {
21837
+ let bytes = 0;
21838
+ for (let i = 0; i < value.length; i++) {
21839
+ const code = value.charCodeAt(i);
21840
+ if (code < 128)
21841
+ bytes += 1;
21842
+ else if (code < 2048)
21843
+ bytes += 2;
21844
+ else if (code >= 55296 && code <= 56319 && i + 1 < value.length && value.charCodeAt(i + 1) >= 56320 && value.charCodeAt(i + 1) <= 57343) {
21845
+ bytes += 4;
21846
+ i++;
21847
+ } else
21848
+ bytes += 3;
21849
+ }
21850
+ return bytes;
21851
+ }
21852
+ function isWellFormed(value) {
21853
+ return !/[\uD800-\uDFFF]/u.test(value);
21854
+ }
21855
+ var S3FileSystem = class {
21856
+ async open(path6, options) {
21857
+ options.signal?.throwIfAborted();
21858
+ throw new FsError("ENOTSUP", { syscall: "open", path: path6 });
21859
+ }
21860
+ capabilities;
21861
+ readStream;
21862
+ writeStream;
21863
+ transport;
21864
+ bucket;
21865
+ prefix;
21866
+ allowRename;
21867
+ pageSize;
21868
+ maxReadBytes;
21869
+ maxStreamBytes;
21870
+ maxListEntries;
21871
+ maxRequests;
21872
+ requests = 0;
21873
+ removalLimits;
21874
+ removalBudgets = /* @__PURE__ */ new WeakMap();
21875
+ constructor(options) {
21876
+ if (!options?.transport || ["headObject", "getObject", "putObject", "deleteObject", "copyObject", "listObjectsV2"].some((method) => typeof options.transport[method] !== "function")) {
21877
+ throw new FsError("EINVAL", { message: "an explicit six-operation S3 transport is required; no default credentials or network client are created" });
21878
+ }
21879
+ if (options.compareEntry !== void 0 && typeof options.compareEntry !== "function") {
21880
+ throw new FsError("EINVAL", { message: "compareEntry must be a filesystem comparison callback" });
21881
+ }
21882
+ if (typeof options.bucket !== "string" || !options.bucket || /[/:\0]/.test(options.bucket)) {
21883
+ throw new FsError("EINVAL", { message: "bucket must be a nonempty bucket name, not a URL or ARN" });
21884
+ }
21885
+ const prefix = options.prefix ?? "";
21886
+ if (typeof prefix !== "string" || prefix.includes("\0") || !isWellFormed(prefix) || prefix !== "" && prefix.replace(/\/$/, "").split("/").some((part) => !part || part === "." || part === "..")) {
21887
+ throw new FsError("EINVAL", { message: "prefix must be a canonical relative object-key prefix" });
21888
+ }
21889
+ this.prefix = prefix === "" || prefix.endsWith("/") ? prefix : `${prefix}/`;
21890
+ if (utf8ByteLength3(this.prefix) > 1024)
21891
+ throw new FsError("ENAMETOOLONG", { message: "S3 prefix exceeds 1024 UTF-8 bytes" });
21892
+ this.transport = options.transport;
21893
+ this.bucket = options.bucket;
21894
+ this.allowRename = options.allowNonAtomicRename ?? true;
21895
+ this.pageSize = validateLimit(options.pageSize ?? 1e3, "pageSize", 1, 1e3);
21896
+ this.maxReadBytes = options.maxReadBytes === void 0 ? Infinity : validateLimit(options.maxReadBytes, "maxReadBytes", 0, Infinity);
21897
+ this.maxStreamBytes = options.maxStreamBytes === void 0 ? Infinity : validateLimit(options.maxStreamBytes, "maxStreamBytes", 0, Infinity);
21898
+ this.maxListEntries = options.maxListEntries === void 0 ? Infinity : validateLimit(options.maxListEntries, "maxListEntries", 1, Infinity);
21899
+ this.maxRequests = options.maxRequests === void 0 ? Infinity : validateLimit(options.maxRequests, "maxRequests", 1, Infinity);
21900
+ this.removalLimits = {
21901
+ maxRequests: validateLimit(options.removalLimits?.maxRequests ?? Infinity, "removalLimits.maxRequests", 1, Infinity),
21902
+ maxListEntries: validateLimit(options.removalLimits?.maxListEntries ?? Infinity, "removalLimits.maxListEntries", 1, Infinity),
21903
+ maxDeleteObjects: validateLimit(options.removalLimits?.maxDeleteObjects ?? Infinity, "removalLimits.maxDeleteObjects", 1, Infinity)
21904
+ };
21905
+ this.capabilities = Object.freeze({
21906
+ open: false,
21907
+ read: true,
21908
+ stat: true,
21909
+ readdir: true,
21910
+ realpath: true,
21911
+ access: true,
21912
+ write: true,
21913
+ explicitDirectories: true,
21914
+ implicitDirectories: true,
21915
+ mkdir: true,
21916
+ recursiveMkdir: true,
21917
+ remove: true,
21918
+ removeDirectory: true,
21919
+ recursiveRemove: true,
21920
+ copy: true,
21921
+ readlink: false,
21922
+ exclusiveCopy: options.transport.capabilities?.conditionalCopy === true,
21923
+ append: options.transport.capabilities?.conditionalPut === true,
21924
+ exclusiveCreate: options.transport.capabilities?.conditionalPut === true,
21925
+ truncate: options.transport.capabilities?.conditionalPut === true,
21926
+ atomicRenameNoReplace: false,
21927
+ rename: this.allowRename && options.transport.capabilities?.conditionalDelete === true && (options.transport.capabilities?.conditionalCopy === true || options.transport.capabilities?.conditionalPut === true),
21928
+ streamingAppend: options.transport.capabilities?.streamingWrite === true && options.transport.capabilities?.conditionalPut === true && typeof options.transport.putObjectStream === "function",
21929
+ randomAccessWrite: false,
21930
+ readOnly: options.readOnly ?? false,
21931
+ symlinks: false,
21932
+ hardlinks: false,
21933
+ permissions: false,
21934
+ timestamps: options.transport.capabilities?.conditionalCopy === true || options.transport.capabilities?.conditionalPut === true,
21935
+ atomicRename: false,
21936
+ snapshotRmdir: true,
21937
+ streamingRead: options.transport.capabilities?.streamingRead === true && typeof options.transport.getObjectStream === "function",
21938
+ streamingWrite: options.transport.capabilities?.streamingWrite === true && typeof options.transport.putObjectStream === "function"
21939
+ });
21940
+ if (this.capabilities.streamingRead)
21941
+ this.readStream = this.streamRead.bind(this);
21942
+ if (this.capabilities.streamingWrite)
21943
+ this.writeStream = this.streamWrite.bind(this);
21944
+ const transport = this.transport;
21945
+ const bucket = this.bucket;
21946
+ const registeredPrefix = this.prefix;
21947
+ registerS3EntryOwner(this, (path6) => this.path(path6), () => this.transport === transport && this.bucket === bucket && this.prefix === registeredPrefix, s3Comparison, options.compareEntry);
21948
+ registerEntryAuthority(this, compareOwnedS3Entries);
21949
+ }
21950
+ async compareEntry(path6, peer, peerPath, options = {}) {
21951
+ return compareEntries(this, path6, peer, peerPath, options);
21952
+ }
21953
+ path(input) {
21954
+ if (typeof input !== "string" || input.includes("\0") || !isWellFormed(input))
21955
+ fail2("EINVAL", "resolve", input, "invalid path string");
21956
+ const components2 = [];
21957
+ for (const part of input.split("/")) {
21958
+ if (!part || part === ".")
21959
+ continue;
21960
+ if (part === "..") {
21961
+ if (components2.length === 0)
21962
+ fail2("EACCES", "resolve", input, "path attempts to escape the configured prefix");
21963
+ components2.pop();
21964
+ } else
21965
+ components2.push(part);
21966
+ }
21967
+ const path6 = `/${components2.join("/")}`;
21968
+ if (utf8ByteLength3(this.key(path6)) > 1024)
21969
+ fail2("ENAMETOOLONG", "resolve", input);
21970
+ return path6;
21971
+ }
21972
+ key(path6) {
21973
+ return this.prefix + path6.slice(1);
21974
+ }
21975
+ directoryKey(path6) {
21976
+ const key2 = path6 === "/" ? this.prefix : `${this.key(path6)}/`;
21977
+ if (utf8ByteLength3(key2) > 1024)
21978
+ fail2("ENAMETOOLONG", "resolve", path6);
21979
+ return key2;
21980
+ }
21981
+ checkAbort(options, syscall, path6) {
21982
+ if (options.signal?.aborted)
21983
+ fail2("ECANCELED", syscall, path6);
21984
+ }
21985
+ requestOptions(options) {
21986
+ return options.signal === void 0 ? {} : { abortSignal: options.signal };
21987
+ }
21988
+ async call(syscall, path6, options, action, precondition) {
21989
+ this.checkAbort(options, syscall, path6);
21990
+ chargeScopedTransportCall(options);
21991
+ this.checkAbort(options, syscall, path6);
21992
+ const budget = this.removalBudgets.get(options);
21993
+ if (budget && ++budget.requests > this.removalLimits.maxRequests) {
21994
+ fail2("EFBIG", "rm", path6, "S3 removal request budget exceeded");
21995
+ }
21996
+ if (this.requests >= this.maxRequests) {
21997
+ fail2("EFBIG", syscall, path6, "S3 transport request budget exceeded");
21998
+ }
21999
+ this.requests++;
22000
+ let onAbort;
22001
+ try {
22002
+ const pending = action();
22003
+ const result = options.signal ? await new Promise((resolve, reject) => {
22004
+ const signal = options.signal;
22005
+ onAbort = () => reject(new FsError("ECANCELED", { syscall, path: path6, cause: signal.reason }));
22006
+ signal.addEventListener("abort", onAbort, { once: true });
22007
+ if (signal.aborted)
22008
+ onAbort();
22009
+ pending.then((value) => {
22010
+ if (signal.aborted && typeof value === "object" && value !== null && "Body" in value)
22011
+ this.dispose(value.Body);
22012
+ resolve(value);
22013
+ }, reject);
22014
+ }) : await pending;
22015
+ this.checkAbort(options, syscall, path6);
22016
+ return result;
22017
+ } catch (error) {
22018
+ if (options.signal?.aborted)
22019
+ fail2("ECANCELED", syscall, path6);
22020
+ throw translate(error, syscall, path6, precondition);
22021
+ } finally {
22022
+ if (onAbort)
22023
+ options.signal?.removeEventListener("abort", onAbort);
22024
+ }
22025
+ }
22026
+ writable(path6, mode) {
22027
+ if (this.capabilities.readOnly)
22028
+ fail2("EROFS", "write", path6);
22029
+ if (mode !== void 0)
22030
+ validateLimit(mode, "mode", 0, 4095);
22031
+ }
22032
+ unsupported(operation, path6) {
22033
+ return fail2("ENOTSUP", operation, path6, `S3 does not support ${operation} with the configured transport`);
22034
+ }
22035
+ async head(key2, path6, options) {
22036
+ try {
22037
+ const input = { Bucket: this.bucket, Key: key2 };
22038
+ return await this.call("headObject", path6, options, () => queryS3Head(input, (query) => this.transport.headObject(query, this.requestOptions(options))));
22039
+ } catch (error) {
22040
+ if (isFsError(error, "ENOENT") && serviceCode(error.cause) !== "NoSuchBucket")
22041
+ return void 0;
22042
+ throw error;
22043
+ }
22044
+ }
22045
+ makeStat(type, metadata) {
22046
+ const size = type === "directory" ? 0 : metadata?.ContentLength;
22047
+ if (size === void 0 || !Number.isSafeInteger(size) || size < 0)
22048
+ fail2("EIO", "stat", "", "transport omitted a valid object ContentLength");
22049
+ const modified = metadata?.LastModified?.getTime() ?? 0;
22050
+ if (!Number.isFinite(modified))
22051
+ fail2("EIO", "stat", "", "transport returned an invalid LastModified");
22052
+ const timestamp2 = (key2, fallback) => {
22053
+ const value = metadata?.Metadata?.[key2];
22054
+ if (value === void 0)
22055
+ return fallback;
22056
+ const parsed = Number(value);
22057
+ if (!value || !Number.isFinite(parsed))
22058
+ fail2("EIO", "stat", "", "invalid virtual timestamp metadata");
22059
+ return parsed;
22060
+ };
22061
+ const storedMode = metadata?.Metadata?.["virtual-bash-mode"];
22062
+ const mode = storedMode === void 0 ? type === "directory" ? 493 : 420 : Number(storedMode);
22063
+ if (!Number.isSafeInteger(mode) || mode < 0 || mode > 4095 || storedMode === "")
22064
+ fail2("EIO", "stat", "", "invalid virtual mode metadata");
22065
+ return {
22066
+ type,
22067
+ size,
22068
+ mode: (type === "directory" ? 16384 : 32768) | mode,
22069
+ mtimeMs: timestamp2("virtual-bash-mtime", modified),
22070
+ atimeMs: timestamp2("virtual-bash-atime", 0),
22071
+ ctimeMs: modified
22072
+ };
22073
+ }
22074
+ async page(prefix, path6, options, delimiter, token, maxKeys = this.pageSize) {
22075
+ const budget = this.removalBudgets.get(options);
22076
+ if (budget)
22077
+ maxKeys = Math.min(maxKeys, this.removalLimits.maxListEntries - budget.entries + 1);
22078
+ const result = await this.call("listObjectsV2", path6, options, () => this.transport.listObjectsV2({
22079
+ Bucket: this.bucket,
22080
+ Prefix: prefix,
22081
+ MaxKeys: maxKeys,
22082
+ ...delimiter === void 0 ? {} : { Delimiter: delimiter },
22083
+ ...token === void 0 ? {} : { ContinuationToken: token }
22084
+ }, this.requestOptions(options)));
22085
+ if (budget) {
22086
+ budget.entries += (result.Contents?.length ?? 0) + (result.CommonPrefixes?.length ?? 0);
22087
+ if (budget.entries > this.removalLimits.maxListEntries)
22088
+ fail2("EFBIG", "rm", path6, "S3 removal listing budget exceeded");
22089
+ }
22090
+ for (const item of result.Contents ?? []) {
22091
+ if (typeof item.Key !== "string" || !item.Key.startsWith(prefix))
22092
+ fail2("EIO", "listObjectsV2", path6, "transport returned an object outside the requested prefix");
22093
+ this.validateObject(item, path6);
22094
+ }
22095
+ for (const item of result.CommonPrefixes ?? []) {
22096
+ if (delimiter === void 0 || typeof item.Prefix !== "string" || !item.Prefix.startsWith(prefix) || !item.Prefix.endsWith("/") || item.Prefix === prefix)
22097
+ fail2("EIO", "listObjectsV2", path6, "invalid common prefix");
22098
+ this.validateKey(item.Prefix, path6);
22099
+ }
22100
+ if (result.IsTruncated !== void 0 && typeof result.IsTruncated !== "boolean")
22101
+ fail2("EIO", "listObjectsV2", path6, "invalid IsTruncated flag");
22102
+ return result;
22103
+ }
22104
+ validateKey(key2, path6) {
22105
+ if (!key2.startsWith(this.prefix))
22106
+ fail2("EIO", "listObjectsV2", path6, "key escapes the configured prefix");
22107
+ const relative = key2.slice(this.prefix.length).replace(/\/$/, "");
22108
+ if (!isWellFormed(key2) || key2.includes("\0") || utf8ByteLength3(key2) > 1024 || relative !== "" && relative.split("/").some((part) => !part || part === "." || part === "..")) {
22109
+ fail2("ENOTSUP", "listObjectsV2", path6, "object key cannot be represented as a canonical filesystem path");
22110
+ }
22111
+ }
22112
+ validateObject(object3, path6) {
22113
+ const key2 = object3.Key;
22114
+ this.validateKey(key2, path6);
22115
+ if (object3.Size === void 0 || !Number.isSafeInteger(object3.Size) || object3.Size < 0)
22116
+ fail2("EIO", "listObjectsV2", path6, "invalid object size");
22117
+ if (key2.endsWith("/") && object3.Size !== 0)
22118
+ fail2("ENOTSUP", "listObjectsV2", path6, "nonempty slash-suffixed objects cannot be treated as directories");
22119
+ }
22120
+ async *pages(prefix, path6, options, delimiter, maxKeys = this.pageSize) {
22121
+ const tokens = /* @__PURE__ */ new Set();
22122
+ let token;
22123
+ let entries2 = 0;
22124
+ do {
22125
+ const page = await this.page(prefix, path6, options, delimiter, token, maxKeys);
22126
+ entries2 += (page.Contents?.length ?? 0) + (page.CommonPrefixes?.length ?? 0);
22127
+ if (entries2 > this.maxListEntries || tokens.size >= this.maxListEntries)
22128
+ fail2("EFBIG", "listObjectsV2", path6, "listing exceeds maxListEntries");
22129
+ yield page;
22130
+ if (!page.IsTruncated)
22131
+ return;
22132
+ token = page.NextContinuationToken;
22133
+ if (typeof token !== "string" || !token || tokens.has(token))
22134
+ fail2("EIO", "listObjectsV2", path6, "missing or repeated continuation token");
22135
+ tokens.add(token);
22136
+ } while (true);
22137
+ }
22138
+ async inspect(path6, options) {
22139
+ if (path6 === "/") {
22140
+ const listing = await this.page(this.prefix, path6, options, void 0, void 0, 1);
22141
+ const marker2 = this.prefix && listing.Contents?.some((object3) => object3.Key === this.prefix) ? await this.head(this.prefix, path6, options) : void 0;
22142
+ if (marker2 && marker2.ContentLength !== 0)
22143
+ this.unsupported("nonempty directory markers", path6);
22144
+ return { stat: this.makeStat("directory", marker2), ...marker2 ? { metadata: marker2 } : {} };
22145
+ }
22146
+ const file = await this.head(this.key(path6), path6, options);
22147
+ if (utf8ByteLength3(this.key(path6)) === 1024) {
22148
+ return file ? { stat: this.makeStat("file", file), metadata: file } : void 0;
22149
+ }
22150
+ const directoryKey = this.directoryKey(path6);
22151
+ let directory = false;
22152
+ let hasMarker = false;
22153
+ for await (const children of this.pages(directoryKey, path6, options, void 0, 1)) {
22154
+ if ((children.Contents?.length ?? 0) > 0) {
22155
+ directory = true;
22156
+ hasMarker = children.Contents.some((object3) => object3.Key === directoryKey);
22157
+ break;
22158
+ }
22159
+ }
22160
+ const marker = hasMarker ? await this.head(directoryKey, path6, options) : void 0;
22161
+ if (marker && marker.ContentLength !== 0)
22162
+ this.unsupported("nonempty directory markers", path6);
22163
+ if (file && directory)
22164
+ this.unsupported("file/prefix collisions", path6);
22165
+ if (file)
22166
+ return { stat: this.makeStat("file", file), metadata: file };
22167
+ if (directory)
22168
+ return { stat: this.makeStat("directory", marker), ...marker ? { metadata: marker } : {} };
22169
+ return void 0;
22170
+ }
22171
+ async lookup(path6, options) {
22172
+ const ancestors = [];
22173
+ for (let parent = posixPath.dirname(path6); path6 !== "/"; parent = posixPath.dirname(parent)) {
22174
+ ancestors.unshift(parent);
22175
+ if (parent === "/")
22176
+ break;
22177
+ }
22178
+ for (const parent of ancestors) {
22179
+ if (parent === "/" && this.prefix === "")
22180
+ continue;
22181
+ const ancestor = await this.inspect(parent, options);
22182
+ if (!ancestor)
22183
+ fail2("ENOENT", "stat", parent);
22184
+ if (ancestor.stat.type !== "directory")
22185
+ fail2("ENOTDIR", "stat", parent);
22186
+ }
22187
+ return this.inspect(path6, options);
22188
+ }
22189
+ requireDirectorySuffix(input, info) {
22190
+ if (input.endsWith("/") && info?.stat.type === "file")
22191
+ fail2("ENOTDIR", "stat", input);
22192
+ }
22193
+ async stat(input, options = {}) {
22194
+ const path6 = this.path(input);
22195
+ const info = await this.lookup(path6, options);
22196
+ this.requireDirectorySuffix(input, info);
22197
+ if (!info)
22198
+ fail2("ENOENT", "stat", input);
22199
+ recordS3Stat(this, path6, info.stat, info.metadata);
22200
+ return info.stat;
22201
+ }
22202
+ async lstat(path6, options = {}) {
22203
+ return this.stat(path6, options);
22204
+ }
22205
+ async body(output, path6, options) {
22206
+ const limit = Math.min(this.maxReadBytes, options.maxBytes === void 0 ? this.maxReadBytes : validateLimit(options.maxBytes, "maxBytes", 0, Infinity));
22207
+ let iterator;
22208
+ return this.call("readFile", path6, options, async () => {
22209
+ if (output.Body && Symbol.asyncIterator in output.Body)
22210
+ iterator = output.Body[Symbol.asyncIterator]();
22211
+ if (output.ContentLength !== void 0 && output.ContentLength > limit)
22212
+ fail2("EFBIG", "readFile", path6);
22213
+ const body = output.Body;
22214
+ if (!body)
22215
+ fail2("EIO", "readFile", path6, "transport omitted the response body");
22216
+ let bytes;
22217
+ if (body instanceof Uint8Array) {
22218
+ if (body.byteLength > limit)
22219
+ fail2("EFBIG", "readFile", path6);
22220
+ bytes = new Uint8Array(body);
22221
+ } else if (Symbol.asyncIterator in body) {
22222
+ bytes = await collectBytes2({ [Symbol.asyncIterator]: () => iterator }, { ...limit === Infinity ? {} : { maxBytes: limit }, ...options.signal ? { signal: options.signal } : {} });
22223
+ } else if ("transformToByteArray" in body) {
22224
+ const converted = await body.transformToByteArray();
22225
+ if (!(converted instanceof Uint8Array))
22226
+ fail2("EIO", "readFile", path6, "transport body is not binary");
22227
+ if (converted.byteLength > limit)
22228
+ fail2("EFBIG", "readFile", path6);
22229
+ bytes = new Uint8Array(converted);
22230
+ } else
22231
+ fail2("EIO", "readFile", path6, "unsupported response body");
22232
+ this.checkAbort(options, "readFile", path6);
22233
+ if (output.ContentLength !== void 0 && output.ContentLength !== bytes.byteLength)
22234
+ fail2("EIO", "readFile", path6, "response body length does not match ContentLength");
22235
+ return bytes;
22236
+ }).catch((error) => {
22237
+ this.dispose(iterator);
22238
+ if (output.Body !== iterator)
22239
+ this.dispose(output.Body, iterator === void 0);
22240
+ throw error;
22241
+ });
22242
+ }
22243
+ async get(path6, options) {
22244
+ return this.call("getObject", path6, options, () => this.transport.getObject({ Bucket: this.bucket, Key: this.key(path6) }, this.requestOptions(options)));
22245
+ }
22246
+ async readFile(input, options = {}) {
22247
+ const path6 = this.path(input);
22248
+ if (options.maxBytes !== void 0)
22249
+ validateLimit(options.maxBytes, "maxBytes", 0, Infinity);
22250
+ const info = await this.stat(input, options);
22251
+ if (info.type === "directory")
22252
+ fail2("EISDIR", "readFile", path6);
22253
+ if (info.size > Math.min(this.maxReadBytes, options.maxBytes ?? this.maxReadBytes))
22254
+ fail2("EFBIG", "readFile", path6);
22255
+ 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);
22256
+ return this.body(output, path6, options);
22257
+ }
22258
+ etag(metadata, path6) {
22259
+ if (!metadata?.ETag)
22260
+ this.unsupported("conditional mutation without an ETag", path6);
22261
+ return metadata.ETag;
22262
+ }
22263
+ async writeFile(input, data, options = {}) {
22264
+ const path6 = this.path(input);
22265
+ this.writable(path6, options.mode);
22266
+ if (!(data instanceof Uint8Array))
22267
+ fail2("EINVAL", "writeFile", path6, "data must be Uint8Array");
22268
+ const bytes = new Uint8Array(data);
22269
+ if (bytes.byteLength > 5e9)
22270
+ fail2("EFBIG", "writeFile", path6, "multipart upload is not supported");
22271
+ const flag = options.flag ?? "w";
22272
+ if (!["w", "wx", "a", "ax"].includes(flag))
22273
+ fail2("EINVAL", "writeFile", path6, "invalid write flag");
22274
+ if (flag !== "w" && !this.transport.capabilities?.conditionalPut)
22275
+ this.unsupported("conditional writes", path6);
22276
+ const info = await this.lookup(path6, options);
22277
+ this.requireDirectorySuffix(input, info);
22278
+ if (info?.stat.type === "directory")
22279
+ fail2("EISDIR", "writeFile", path6);
22280
+ if (input.endsWith("/"))
22281
+ fail2("EISDIR", "writeFile", input);
22282
+ const exclusive = flag === "wx" || flag === "ax";
22283
+ if (exclusive && info)
22284
+ fail2("EEXIST", "writeFile", path6);
22285
+ let body = bytes;
22286
+ let match;
22287
+ let metadata = this.writeMetadata(info?.metadata, options.mode);
22288
+ if (flag === "a" && info) {
22289
+ const current = await this.get(path6, options);
22290
+ const previous = await this.body(current, path6, options);
22291
+ match = this.etag(current, path6);
22292
+ metadata = { ...current.Metadata };
22293
+ delete metadata["virtual-bash-mtime"];
22294
+ if (previous.length + bytes.length > this.maxReadBytes)
22295
+ fail2("EFBIG", "appendFile", path6);
22296
+ body = new Uint8Array(previous.length + bytes.length);
22297
+ body.set(previous);
22298
+ body.set(bytes, previous.length);
22299
+ }
22300
+ await this.call("putObject", path6, options, () => this.transport.putObject({
22301
+ Bucket: this.bucket,
22302
+ Key: this.key(path6),
22303
+ Body: body,
22304
+ ...match === void 0 ? {} : { IfMatch: match },
22305
+ ...exclusive || flag === "a" && !info ? { IfNoneMatch: "*" } : {},
22306
+ ...metadata === void 0 ? {} : { Metadata: metadata }
22307
+ }, this.requestOptions(options)), exclusive ? "EEXIST" : "EAGAIN");
22308
+ }
22309
+ writeMetadata(previous, mode) {
22310
+ const metadata = { ...previous?.Metadata };
22311
+ delete metadata["virtual-bash-mtime"];
22312
+ if (previous === void 0 && mode !== void 0)
22313
+ metadata["virtual-bash-mode"] = String(mode);
22314
+ return Object.keys(metadata).length === 0 ? void 0 : metadata;
22315
+ }
22316
+ async appendFile(path6, data, options = {}) {
22317
+ return this.writeFile(path6, data, { ...options, flag: "a" });
22318
+ }
22319
+ async mkdir(input, options = {}) {
22320
+ const path6 = this.path(input);
22321
+ this.writable(path6, options.mode);
22322
+ if (options.recursive && path6 !== "/") {
22323
+ await this.mkdir(posixPath.dirname(path6), { ...options, recursive: true });
22324
+ }
22325
+ const info = await this.lookup(path6, options);
22326
+ if (info) {
22327
+ if (options.recursive && info.stat.type === "directory")
22328
+ return;
22329
+ fail2("EEXIST", "mkdir", path6);
22330
+ }
22331
+ await this.call("putObject", path6, options, () => this.transport.putObject({
22332
+ Bucket: this.bucket,
22333
+ Key: this.directoryKey(path6),
22334
+ Body: new Uint8Array(),
22335
+ ...options.mode === void 0 ? {} : { Metadata: { "virtual-bash-mode": String(options.mode) } },
22336
+ ...this.transport.capabilities?.conditionalPut ? { IfNoneMatch: "*" } : {}
22337
+ }, this.requestOptions(options)), "EEXIST");
22338
+ }
22339
+ async readdir(input, options = {}) {
22340
+ let limit;
22341
+ if (options.maxEntries !== void 0) {
22342
+ this.checkAbort(options, "readdir", input);
22343
+ limit = directoryEntryLimit(options, input);
22344
+ }
22345
+ const path6 = this.path(input);
22346
+ if ((await this.stat(input, options)).type !== "directory")
22347
+ fail2("ENOTDIR", "readdir", path6);
22348
+ const prefix = this.directoryKey(path6);
22349
+ const entries2 = /* @__PURE__ */ new Map();
22350
+ const add = (name, type) => {
22351
+ this.checkAbort(options, "readdir", path6);
22352
+ if (!name || name.includes("/"))
22353
+ fail2("EIO", "readdir", path6, "invalid direct child in delimited listing");
22354
+ const existing = entries2.get(name);
22355
+ if (existing && existing.type !== type)
22356
+ this.unsupported("file/prefix collisions", path6);
22357
+ if (!existing)
22358
+ admitDirectoryEntries(entries2.size + 1, limit, path6);
22359
+ entries2.set(name, { name, type });
22360
+ };
22361
+ const maxKeys = limit === void 0 ? this.pageSize : Math.min(this.pageSize, limit + 1);
22362
+ for await (const page of this.pages(prefix, path6, options, "/", maxKeys)) {
22363
+ for (const item of page.Contents ?? []) {
22364
+ if (item.Key === prefix)
22365
+ continue;
22366
+ add(item.Key.slice(prefix.length), "file");
22367
+ }
22368
+ for (const item of page.CommonPrefixes ?? [])
22369
+ add(item.Prefix.slice(prefix.length, -1), "directory");
22370
+ }
22371
+ return [...entries2.values()].sort((left, right) => compareKeys(left.name, right.name));
22372
+ }
22373
+ async tree(path6, options) {
22374
+ const objects = /* @__PURE__ */ new Map();
22375
+ for await (const page of this.pages(this.directoryKey(path6), path6, options)) {
22376
+ for (const item of page.Contents ?? [])
22377
+ objects.set(item.Key, item);
22378
+ }
22379
+ for (const key2 of objects.keys()) {
22380
+ const withoutSlash = key2.replace(/\/$/, "");
22381
+ if (key2.endsWith("/") && objects.has(withoutSlash))
22382
+ this.unsupported("file/prefix collisions", path6);
22383
+ let parent = posixPath.dirname(withoutSlash);
22384
+ while (parent !== "." && parent !== "/") {
22385
+ if (objects.has(parent))
22386
+ this.unsupported("file/prefix collisions", path6);
22387
+ parent = posixPath.dirname(parent);
22388
+ }
22389
+ }
22390
+ return [...objects.values()];
22391
+ }
22392
+ async rmdir(input, options = {}) {
22393
+ try {
22394
+ const path6 = this.path(input);
22395
+ this.checkAbort(options, "rmdir", input);
22396
+ this.writable(path6);
22397
+ if (path6 === "/")
22398
+ fail2("EBUSY", "rmdir", input, "cannot remove the mounted root");
22399
+ const info = await this.lookup(path6, options);
22400
+ this.checkAbort(options, "rmdir", input);
22401
+ if (!info)
22402
+ fail2("ENOENT", "rmdir", input);
22403
+ if (info.stat.type !== "directory")
22404
+ fail2("ENOTDIR", "rmdir", input);
22405
+ const prefix = this.directoryKey(path6);
22406
+ let markerObserved = false;
22407
+ for await (const page of this.pages(prefix, path6, options, "/", Math.max(2, this.pageSize))) {
22408
+ this.checkAbort(options, "rmdir", input);
22409
+ if (page.Contents?.some((item) => item.Key !== prefix) || page.CommonPrefixes?.length) {
22410
+ fail2("ENOTEMPTY", "rmdir", input);
22411
+ }
22412
+ if (page.IsTruncated === void 0)
22413
+ fail2("EIO", "rmdir", input, "listing did not confirm completeness");
22414
+ if (page.Contents?.some((item) => item.Key === prefix))
22415
+ markerObserved = true;
22416
+ }
22417
+ this.checkAbort(options, "rmdir", input);
22418
+ if (!info.metadata)
22419
+ fail2("ENOTSUP", "rmdir", input, "snapshot removal requires an explicit directory marker");
22420
+ if (!markerObserved)
22421
+ fail2("ENOENT", "rmdir", input, "directory marker disappeared during inspection");
22422
+ await this.call("deleteObject", path6, options, () => this.transport.deleteObject({ Bucket: this.bucket, Key: prefix }, this.requestOptions(options)));
22423
+ } catch (error) {
22424
+ if (isFsError(error) && (error.syscall !== "rmdir" || error.path !== input)) {
22425
+ throw new FsError(error.code, { syscall: "rmdir", path: input, cause: error });
22426
+ }
22427
+ throw error;
22428
+ }
22429
+ }
22430
+ async rm(input, options = {}) {
22431
+ options = { ...options };
22432
+ const budget = { requests: 0, entries: 0 };
22433
+ this.removalBudgets.set(options, budget);
22434
+ const path6 = this.path(input);
22435
+ this.writable(path6);
22436
+ if (path6 === "/")
22437
+ fail2("EBUSY", "rm", path6, "cannot remove the mounted root");
22438
+ let info;
22439
+ try {
22440
+ info = await this.lookup(path6, options);
22441
+ } catch (error) {
22442
+ if (options.force && isFsError(error, "ENOENT") && serviceCode(error.cause) !== "NoSuchBucket")
22443
+ return;
22444
+ throw error;
22445
+ }
22446
+ this.requireDirectorySuffix(input, info);
22447
+ if (!info) {
22448
+ if (options.force)
22449
+ return;
22450
+ fail2("ENOENT", "rm", path6);
22451
+ }
22452
+ let objects;
22453
+ if (info.stat.type === "directory" && !options.recursive) {
22454
+ const prefix = this.directoryKey(path6);
22455
+ objects = [];
22456
+ for await (const page of this.pages(prefix, path6, options, void 0, 2)) {
22457
+ if (page.Contents?.some((item) => item.Key !== prefix))
22458
+ fail2("ENOTEMPTY", "rm", path6);
22459
+ if (page.Contents?.length)
22460
+ objects = [{ Key: prefix }];
22461
+ }
22462
+ } else {
22463
+ objects = info.stat.type === "directory" ? await this.tree(path6, options) : [{ Key: this.key(path6) }];
22464
+ }
22465
+ if (objects.length > this.removalLimits.maxDeleteObjects || budget.requests + objects.length > this.removalLimits.maxRequests) {
22466
+ fail2("EFBIG", "rm", path6, "S3 removal delete or request budget exceeded; use bounded batches");
22467
+ }
22468
+ for (const item of objects) {
22469
+ await this.call("deleteObject", path6, options, () => this.transport.deleteObject({ Bucket: this.bucket, Key: item.Key }, this.requestOptions(options)));
22470
+ }
22471
+ }
22472
+ async copy(sourceKey, destinationKey, source, metadata, options, destination) {
22473
+ if (metadata.ContentLength === void 0 || metadata.ContentLength > 5e9)
22474
+ this.unsupported("multipart copy", source);
22475
+ const etag = this.etag(metadata, source);
22476
+ const result = await this.call("copyObject", source, options, () => this.transport.copyObject({
22477
+ Bucket: this.bucket,
22478
+ Key: destinationKey,
22479
+ CopySource: encodeCopySource(this.bucket, sourceKey),
22480
+ CopySourceIfMatch: etag,
22481
+ MetadataDirective: "COPY",
22482
+ ...options.exclusive ? { IfNoneMatch: "*" } : {},
22483
+ ...destination === void 0 ? {} : destination === null ? { IfNoneMatch: "*" } : { IfMatch: this.etag(destination, source) }
22484
+ }, this.requestOptions(options)));
22485
+ if (!result.CopyObjectResult?.ETag)
22486
+ fail2("EIO", "copyObject", source, "transport did not confirm a completed CopyObject result");
22487
+ }
22488
+ async copyFile(sourceInput, destinationInput, options = {}) {
22489
+ const source = this.path(sourceInput);
22490
+ const destination = this.path(destinationInput);
22491
+ this.writable(destination);
22492
+ if (options.exclusive && !this.transport.capabilities?.conditionalCopy)
22493
+ this.unsupported("exclusive server-side copy", destination);
22494
+ const origin = await this.lookup(source, options);
22495
+ this.requireDirectorySuffix(sourceInput, origin);
22496
+ if (!origin)
22497
+ fail2("ENOENT", "copyFile", source);
22498
+ if (origin.stat.type === "directory")
22499
+ fail2("EISDIR", "copyFile", source);
22500
+ const target = await this.lookup(destination, options);
22501
+ this.requireDirectorySuffix(destinationInput, target);
22502
+ if (target?.stat.type === "directory" || destinationInput.endsWith("/"))
22503
+ fail2("EISDIR", "copyFile", destination);
22504
+ if (target && options.exclusive)
22505
+ fail2("EEXIST", "copyFile", destination);
22506
+ if (source === destination)
22507
+ return;
22508
+ try {
22509
+ await this.copy(this.key(source), this.key(destination), source, origin.metadata, options);
22510
+ } catch (error) {
22511
+ if (!options.exclusive || !isFsError(error, "EAGAIN"))
22512
+ throw error;
22513
+ const status = error.cause?.$metadata?.httpStatusCode;
22514
+ if (serviceCode(error.cause) !== "PreconditionFailed" && status !== 412)
22515
+ throw error;
22516
+ let destinationExists = false;
22517
+ try {
22518
+ const currentSource = await this.head(this.key(source), source, options);
22519
+ if (currentSource?.ETag === origin.metadata?.ETag) {
22520
+ destinationExists = await this.head(this.key(destination), destination, options) !== void 0;
22521
+ }
22522
+ } catch (diagnosticError) {
22523
+ if (isFsError(diagnosticError, "ECANCELED"))
22524
+ throw diagnosticError;
22525
+ }
22526
+ if (destinationExists) {
22527
+ throw new FsError("EEXIST", { syscall: "copyFile", path: source, dest: destination, cause: error });
22528
+ }
22529
+ throw error;
22530
+ }
22531
+ }
22532
+ async rename(sourceInput, destinationInput, options = {}) {
22533
+ if (options.noReplace) {
22534
+ options.signal?.throwIfAborted();
22535
+ this.unsupported("atomic no-replace rename", sourceInput);
22536
+ }
22537
+ const source = this.path(sourceInput);
22538
+ const destination = this.path(destinationInput);
22539
+ this.writable(destination);
22540
+ if (!this.allowRename)
22541
+ this.unsupported("atomic rename; explicitly enable allowNonAtomicRename for copy/delete semantics", source);
22542
+ if (!this.transport.capabilities?.conditionalDelete)
22543
+ this.unsupported("rename without conditional delete", source);
22544
+ const conditionalCopy = this.transport.capabilities?.conditionalCopy === true;
22545
+ if (!conditionalCopy && this.transport.capabilities?.conditionalPut !== true) {
22546
+ this.unsupported("rename requires conditional destination copy or conditional PUT, plus conditional delete", source);
22547
+ }
22548
+ const streamFallback = this.capabilities.streamingRead && this.capabilities.streamingWrite;
22549
+ if (source === "/" || destination === "/")
22550
+ fail2("EBUSY", "rename", source);
22551
+ const origin = await this.lookup(source, options);
22552
+ this.requireDirectorySuffix(sourceInput, origin);
22553
+ if (!origin)
22554
+ fail2("ENOENT", "rename", source);
22555
+ if (source === destination) {
22556
+ this.requireDirectorySuffix(destinationInput, origin);
22557
+ return;
22558
+ }
22559
+ if (destination.startsWith(`${source}/`))
22560
+ fail2("EINVAL", "rename", destination, "cannot move a path into itself");
22561
+ const target = await this.lookup(destination, options);
22562
+ this.requireDirectorySuffix(destinationInput, target);
22563
+ if (destinationInput.endsWith("/") && origin.stat.type !== "directory")
22564
+ fail2("ENOTDIR", "rename", destination);
22565
+ if (target && target.stat.type !== origin.stat.type)
22566
+ fail2(target.stat.type === "directory" ? "EISDIR" : "ENOTDIR", "rename", destination);
22567
+ if (target?.stat.type === "directory" && (await this.readdir(destination, options)).length > 0)
22568
+ fail2("ENOTEMPTY", "rename", destination);
22569
+ if (target?.metadata)
22570
+ this.etag(target.metadata, destination);
22571
+ const objects = origin.stat.type === "directory" ? await this.tree(source, options) : [{
22572
+ Key: this.key(source),
22573
+ Size: origin.stat.size,
22574
+ ETag: origin.metadata?.ETag
22575
+ }];
22576
+ for (const object3 of objects) {
22577
+ this.etag({ ETag: object3.ETag }, source);
22578
+ if (object3.Size === void 0 || object3.Size > 5e9)
22579
+ this.unsupported("multipart copy", source);
22580
+ if (!conditionalCopy && object3.Size > (streamFallback ? this.maxStreamBytes : this.maxReadBytes)) {
22581
+ fail2("EFBIG", "rename", source, "conditional PUT fallback exceeds its configured transfer or buffered read limit");
22582
+ }
22583
+ if (utf8ByteLength3(this.key(destination) + object3.Key.slice(this.key(source).length)) > 1024)
22584
+ fail2("ENAMETOOLONG", "rename", destination);
22585
+ }
22586
+ const copied = [];
22587
+ const deleted = [];
22588
+ let phase = "copy";
22589
+ try {
22590
+ for (const object3 of objects) {
22591
+ const destinationKey = this.key(destination) + object3.Key.slice(this.key(source).length);
22592
+ const destinationMetadata = origin.stat.type === "file" || object3.Key === this.directoryKey(source) ? target?.metadata ?? null : null;
22593
+ const metadata = { ContentLength: object3.Size, ETag: object3.ETag };
22594
+ if (conditionalCopy)
22595
+ await this.copy(object3.Key, destinationKey, source, metadata, options, destinationMetadata);
22596
+ else
22597
+ await this.copyWithPut(object3.Key, destinationKey, source, metadata, destinationMetadata, options, streamFallback);
22598
+ copied.push(destinationKey);
22599
+ }
22600
+ phase = "delete";
22601
+ for (const object3 of objects) {
22602
+ await this.call("deleteObject", source, options, () => this.transport.deleteObject({
22603
+ Bucket: this.bucket,
22604
+ Key: object3.Key,
22605
+ IfMatch: object3.ETag
22606
+ }, this.requestOptions(options)));
22607
+ deleted.push(object3.Key);
22608
+ }
22609
+ } catch (error) {
22610
+ throw new S3RenameError(source, destination, phase, copied, deleted, translate(error, "rename", source));
22611
+ }
22612
+ }
22613
+ async copyWithPut(sourceKey, destinationKey, source, expected, destination, options, streaming) {
22614
+ const etag = this.etag(expected, source);
22615
+ const condition = destination === null ? { IfNoneMatch: "*" } : { IfMatch: this.etag(destination, destinationKey) };
22616
+ const controller = new AbortController();
22617
+ const signalScope = options.signal ? composeAbortSignals([options.signal, controller.signal]) : void 0;
22618
+ const signal = signalScope?.signal ?? controller.signal;
22619
+ const operationOptions = { signal };
22620
+ let output;
22621
+ let upload;
22622
+ let reading = false;
22623
+ try {
22624
+ 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 }));
22625
+ if (this.etag(output, source) !== etag)
22626
+ fail2("EAGAIN", "rename", source, "source changed before conditional PUT copy");
22627
+ if (output.ContentLength !== void 0 && output.ContentLength !== expected.ContentLength) {
22628
+ fail2("EIO", "rename", source, "source response length differs from the enumerated object");
22629
+ }
22630
+ const input = {
22631
+ Bucket: this.bucket,
22632
+ Key: destinationKey,
22633
+ ...condition,
22634
+ ...output.Metadata === void 0 ? {} : { Metadata: { ...output.Metadata } }
22635
+ };
22636
+ if (!streaming) {
22637
+ const body2 = await this.body(output, source, operationOptions);
22638
+ if (body2.length !== expected.ContentLength)
22639
+ fail2("EIO", "rename", source, "source body length differs from the enumerated object");
22640
+ await this.call("putObject", source, operationOptions, () => this.transport.putObject({ ...input, Body: body2 }, { abortSignal: signal }));
22641
+ return;
22642
+ }
22643
+ const body = output.Body;
22644
+ if (!body || !(Symbol.asyncIterator in body))
22645
+ fail2("EIO", "rename", source, "streaming transport did not return an async binary body");
22646
+ let finished = false;
22647
+ upload = (async function* () {
22648
+ let count = 0;
22649
+ reading = true;
22650
+ for await (const chunk of readBytes(body, signal)) {
22651
+ if (chunk.length > expected.ContentLength - count)
22652
+ fail2("EIO", "rename", source, "source body exceeds its enumerated length");
22653
+ count += chunk.length;
22654
+ for (let offset = 0; offset < chunk.length; offset += 64 * 1024) {
22655
+ signal.throwIfAborted();
22656
+ yield new Uint8Array(chunk.subarray(offset, offset + 64 * 1024));
22657
+ }
22658
+ }
22659
+ if (count !== expected.ContentLength)
22660
+ fail2("EIO", "rename", source, "incomplete source body");
22661
+ finished = true;
22662
+ })();
22663
+ await this.call("putObject", source, operationOptions, () => this.transport.putObjectStream({ ...input, Body: upload }, { abortSignal: signal }));
22664
+ if (!finished)
22665
+ fail2("EIO", "rename", source, "transport completed without consuming the conditional copy body");
22666
+ } finally {
22667
+ controller.abort();
22668
+ signalScope?.dispose();
22669
+ this.dispose(upload);
22670
+ this.dispose(output?.Body, !reading);
22671
+ }
22672
+ }
22673
+ async realpath(input, options = {}) {
22674
+ await this.stat(input, options);
22675
+ return this.path(input);
22676
+ }
22677
+ async access(path6, mode = 0, options = {}) {
22678
+ if (!Number.isInteger(mode) || mode < 0 || mode > 7)
22679
+ fail2("EINVAL", "access", path6);
22680
+ const info = await this.stat(path6, options);
22681
+ if ((mode & 2) !== 0 && this.capabilities.readOnly)
22682
+ fail2("EROFS", "access", path6);
22683
+ if ((mode & 1) !== 0 && info.type !== "directory")
22684
+ fail2("EACCES", "access", path6);
22685
+ }
22686
+ async readlink(path6) {
22687
+ return this.unsupported("readlink", path6);
22688
+ }
22689
+ async symlink(_target, path6) {
22690
+ this.unsupported("symlink", path6);
22691
+ }
22692
+ async link(_existingPath, path6) {
22693
+ this.unsupported("link", path6);
22694
+ }
22695
+ async chmod(path6, _mode) {
22696
+ this.unsupported("chmod", path6);
22697
+ }
22698
+ async utimes(input, atimeMs, mtimeMs, options = {}) {
22699
+ const path6 = this.path(input);
22700
+ this.writable(path6);
22701
+ if (!Number.isFinite(atimeMs) || !Number.isFinite(mtimeMs))
22702
+ fail2("EINVAL", "utimes", path6);
22703
+ const info = await this.lookup(path6, options);
22704
+ this.requireDirectorySuffix(input, info);
22705
+ if (!info)
22706
+ fail2("ENOENT", "utimes", path6);
22707
+ if (!this.capabilities.timestamps)
22708
+ this.unsupported("conditional metadata mutation", path6);
22709
+ const key2 = info.stat.type === "directory" ? this.directoryKey(path6) : this.key(path6);
22710
+ if (!key2)
22711
+ this.unsupported("timestamps on an unprefixed bucket root", path6);
22712
+ const metadata = {
22713
+ ...info.metadata?.Metadata,
22714
+ "virtual-bash-atime": String(atimeMs),
22715
+ "virtual-bash-mtime": String(mtimeMs)
22716
+ };
22717
+ if (!info.metadata) {
22718
+ if (!this.transport.capabilities?.conditionalPut)
22719
+ this.unsupported("conditional directory marker creation", path6);
22720
+ await this.call("utimes", path6, options, () => this.transport.putObject({
22721
+ Bucket: this.bucket,
22722
+ Key: key2,
22723
+ Body: new Uint8Array(),
22724
+ Metadata: metadata,
22725
+ IfNoneMatch: "*"
22726
+ }, this.requestOptions(options)));
22727
+ return;
22728
+ }
22729
+ if (!this.transport.capabilities?.conditionalCopy) {
22730
+ const current = await this.call("getObject", path6, options, () => this.transport.getObject({
22731
+ Bucket: this.bucket,
22732
+ Key: key2
22733
+ }, this.requestOptions(options)));
22734
+ const body = await this.body(current, path6, options);
22735
+ await this.call("utimes", path6, options, () => this.transport.putObject({
22736
+ Bucket: this.bucket,
22737
+ Key: key2,
22738
+ Body: body,
22739
+ IfMatch: this.etag(current, path6),
22740
+ Metadata: { ...current.Metadata, "virtual-bash-atime": String(atimeMs), "virtual-bash-mtime": String(mtimeMs) }
22741
+ }, this.requestOptions(options)));
22742
+ return;
22743
+ }
22744
+ if (info.stat.size > 5e9)
22745
+ this.unsupported("multipart metadata copy", path6);
22746
+ const etag = this.etag(info.metadata, path6);
22747
+ const result = await this.call("utimes", path6, options, () => this.transport.copyObject({
22748
+ Bucket: this.bucket,
22749
+ Key: key2,
22750
+ CopySource: encodeCopySource(this.bucket, key2),
22751
+ CopySourceIfMatch: etag,
22752
+ IfMatch: etag,
22753
+ MetadataDirective: "REPLACE",
22754
+ Metadata: metadata
22755
+ }, this.requestOptions(options)));
22756
+ if (!result.CopyObjectResult?.ETag)
22757
+ fail2("EIO", "utimes", path6, "transport did not confirm a completed metadata copy");
22758
+ }
22759
+ async truncate(input, length = 0, options = {}) {
22760
+ const path6 = this.path(input);
22761
+ this.writable(path6);
22762
+ validateLimit(length, "length", 0);
22763
+ const info = await this.lookup(path6, options);
22764
+ this.requireDirectorySuffix(input, info);
22765
+ if (!info)
22766
+ fail2("ENOENT", "truncate", path6);
22767
+ if (info.stat.type === "directory")
22768
+ fail2("EISDIR", "truncate", path6);
22769
+ if (!this.transport.capabilities?.conditionalPut)
22770
+ this.unsupported("conditional truncate", path6);
22771
+ if (length > this.maxReadBytes)
22772
+ fail2("EFBIG", "truncate", path6);
22773
+ let current = info.metadata;
22774
+ const body = new Uint8Array(length);
22775
+ if (length !== 0 && info.stat.size !== 0) {
22776
+ if (this.readStream) {
22777
+ const previous = await this.call("truncate", path6, options, () => collectBytes2(this.readStream(input, { ...options, endExclusive: Math.min(length, info.stat.size) }), { ...options, maxBytes: length }));
22778
+ body.set(previous);
22779
+ } else {
22780
+ const output = await this.get(path6, options);
22781
+ const previous = await this.body(output, path6, options);
22782
+ current = output;
22783
+ body.set(previous.subarray(0, length));
22784
+ }
22785
+ }
22786
+ const metadata = { ...current.Metadata };
22787
+ delete metadata["virtual-bash-mtime"];
22788
+ await this.call("truncate", path6, options, () => this.transport.putObject({
22789
+ Bucket: this.bucket,
22790
+ Key: this.key(path6),
22791
+ Body: body,
22792
+ IfMatch: this.etag(current, path6),
22793
+ Metadata: metadata
22794
+ }, this.requestOptions(options)));
22795
+ }
22796
+ async *streamRead(input, options = {}) {
22797
+ const path6 = this.path(input);
22798
+ const start = validateLimit(options.start ?? 0, "start", 0);
22799
+ const end = options.endExclusive === void 0 ? void 0 : validateLimit(options.endExclusive, "endExclusive", start);
22800
+ const chunkSize = validateLimit(options.chunkSize ?? 64 * 1024, "chunkSize", 1);
22801
+ const info = await this.lookup(path6, options);
22802
+ this.requireDirectorySuffix(input, info);
22803
+ if (!info)
22804
+ fail2("ENOENT", "readStream", path6);
22805
+ if (info.stat.type === "directory")
22806
+ fail2("EISDIR", "readStream", path6);
22807
+ const stop = Math.min(end ?? info.stat.size, info.stat.size);
22808
+ const expected = Math.max(0, stop - start);
22809
+ if (expected > this.maxStreamBytes)
22810
+ fail2("EFBIG", "readStream", path6);
22811
+ if (expected === 0 && info.stat.size !== 0)
22812
+ return;
22813
+ let count = 0;
22814
+ let finished = false;
22815
+ const controller = new AbortController();
22816
+ const signalScope = options.signal ? composeAbortSignals([options.signal, controller.signal]) : void 0;
22817
+ const signal = signalScope?.signal ?? controller.signal;
22818
+ let output;
22819
+ let iterator;
22820
+ try {
22821
+ output = await this.call("getObject", path6, options, () => this.transport.getObjectStream({
22822
+ Bucket: this.bucket,
22823
+ Key: this.key(path6),
22824
+ IfMatch: this.etag(info.metadata, path6),
22825
+ ...expected === 0 || start === 0 && stop === info.stat.size ? {} : { Range: `bytes=${start}-${stop - 1}` }
22826
+ }, { abortSignal: signal }));
22827
+ if (output.ETag !== void 0 && output.ETag !== info.metadata?.ETag)
22828
+ fail2("EIO", "readStream", path6, "response ETag differs from requested snapshot");
22829
+ if (output.ContentLength !== void 0 && output.ContentLength !== expected)
22830
+ fail2("EIO", "readStream", path6, "response length differs from requested snapshot");
22831
+ iterator = readBytes(output.Body, signal)[Symbol.asyncIterator]();
22832
+ while (true) {
22833
+ const result = await iterator.next();
22834
+ if (result.done)
22835
+ break;
22836
+ const chunk = result.value;
22837
+ if (chunk.length > expected - count)
22838
+ fail2("EIO", "readStream", path6, "response exceeds requested length");
22839
+ count += chunk.length;
22840
+ for (let offset = 0; offset < chunk.length; offset += chunkSize) {
22841
+ this.checkAbort(options, "readStream", path6);
22842
+ yield new Uint8Array(chunk.subarray(offset, offset + chunkSize));
22843
+ }
22844
+ }
22845
+ if (count !== expected)
22846
+ fail2("EIO", "readStream", path6, "incomplete response body");
22847
+ finished = true;
22848
+ } catch (error) {
22849
+ this.checkAbort(options, "readStream", path6);
22850
+ throw translate(error, "readStream", path6);
22851
+ } finally {
22852
+ controller.abort();
22853
+ signalScope?.dispose();
22854
+ if (!finished && output) {
22855
+ this.dispose(iterator);
22856
+ this.dispose(output.Body, iterator === void 0);
22857
+ }
22858
+ }
22859
+ }
22860
+ dispose(body, returnIterator = true) {
22861
+ const disposable = body;
22862
+ try {
22863
+ const result = typeof disposable?.destroy === "function" ? disposable.destroy() : typeof disposable?.cancel === "function" ? disposable.cancel() : returnIterator ? disposable?.return?.() : void 0;
22864
+ void Promise.resolve(result).catch(() => {
22865
+ });
22866
+ } catch (ignoredError) {
22867
+ void ignoredError;
22868
+ }
22869
+ }
22870
+ async streamWrite(input, source, options = {}) {
22871
+ const path6 = this.path(input);
22872
+ this.writable(path6, options.mode);
22873
+ const flag = options.flag ?? "w";
22874
+ if (!["w", "wx", "a", "ax"].includes(flag))
22875
+ fail2("EINVAL", "writeStream", path6);
22876
+ if (flag !== "w" && !this.transport.capabilities?.conditionalPut)
22877
+ this.unsupported("conditional writes", path6);
22878
+ const info = await this.lookup(path6, options);
22879
+ this.requireDirectorySuffix(input, info);
22880
+ if (info?.stat.type === "directory" || input.endsWith("/"))
22881
+ fail2("EISDIR", "writeStream", path6);
22882
+ const exclusive = flag === "wx" || flag === "ax";
22883
+ if (exclusive && info)
22884
+ fail2("EEXIST", "writeStream", path6);
22885
+ if (flag === "a") {
22886
+ const current = info ? await this.get(path6, options) : void 0;
22887
+ const previous = current ? await this.body(current, path6, options) : new Uint8Array();
22888
+ const limit = Math.min(this.maxReadBytes, this.maxStreamBytes);
22889
+ if (previous.length > limit)
22890
+ fail2("EFBIG", "writeStream", path6);
22891
+ const bytes = await this.call("writeStream", path6, options, () => collectBytes2(source, { ...limit === Infinity ? {} : { maxBytes: limit - previous.length }, ...options }));
22892
+ const body2 = new Uint8Array(previous.length + bytes.length);
22893
+ body2.set(previous);
22894
+ body2.set(bytes, previous.length);
22895
+ const metadata = this.writeMetadata(current, options.mode);
22896
+ await this.call("putObject", path6, options, () => this.transport.putObject({
22897
+ Bucket: this.bucket,
22898
+ Key: this.key(path6),
22899
+ Body: body2,
22900
+ ...current ? { IfMatch: this.etag(current, path6) } : { IfNoneMatch: "*" },
22901
+ ...metadata ? { Metadata: metadata } : {}
22902
+ }, this.requestOptions(options)));
22903
+ return;
22904
+ }
22905
+ const controller = new AbortController();
22906
+ const signalScope = options.signal ? composeAbortSignals([options.signal, controller.signal]) : void 0;
22907
+ const signal = signalScope?.signal ?? controller.signal;
22908
+ let finished = false;
22909
+ const body = (async function* () {
22910
+ let total = 0;
22911
+ for await (const chunk of readBytes(source, signal)) {
22912
+ if (chunk.length > this.maxStreamBytes - total)
22913
+ fail2("EFBIG", "writeStream", path6);
22914
+ total += chunk.length;
22915
+ for (let offset = 0; offset < chunk.length; offset += 64 * 1024) {
22916
+ this.checkAbort({ signal }, "writeStream", path6);
22917
+ yield new Uint8Array(chunk.subarray(offset, offset + 64 * 1024));
22918
+ }
22919
+ }
22920
+ finished = true;
22921
+ }).call(this);
22922
+ try {
22923
+ const metadata = this.writeMetadata(info?.metadata, options.mode);
22924
+ await this.call("putObject", path6, options, () => this.transport.putObjectStream({
22925
+ Bucket: this.bucket,
22926
+ Key: this.key(path6),
22927
+ Body: body,
22928
+ ...exclusive ? { IfNoneMatch: "*" } : {},
22929
+ ...metadata === void 0 ? {} : { Metadata: metadata }
22930
+ }, { abortSignal: signal }), exclusive ? "EEXIST" : "EAGAIN");
22931
+ if (!finished)
22932
+ fail2("EIO", "writeStream", path6, "transport completed without consuming the request body");
22933
+ } finally {
22934
+ controller.abort();
22935
+ signalScope?.dispose();
22936
+ this.dispose(body);
22937
+ }
22938
+ }
22939
+ };
22940
+ var s3Comparison = S3FileSystem.prototype.compareEntry;
22941
+
21228
22942
  // src/management.ts
21229
22943
  import { commandRuntimeIdentity as commandRuntimeIdentity2, collectBytes as collectBytes3, toByteSource, createOutputOperation as createOutputOperation2 } from "@poe-platform/safe-bash/contracts";
21230
22944
 
@@ -22258,8 +23972,10 @@ Redirect URI: ${textLine(request.redirectUri)}
22258
23972
  export {
22259
23973
  accessRemoteMcpResources,
22260
23974
  authenticateRemoteMcpServer,
23975
+ beginRemoteMcpAuthorization,
22261
23976
  bindRemoteMcpConfiguration,
22262
23977
  compileToolArguments,
23978
+ completeRemoteMcpAuthorization,
22263
23979
  createRemoteMcpCommands,
22264
23980
  createRemoteMcpManagementCommand,
22265
23981
  fetchRemoteMcpSchema,