@poe-platform/safe-bash 0.1.811 → 0.1.813

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 (351) hide show
  1. package/dist/audio-ast/id3-source.d.ts +27 -0
  2. package/dist/audio-ast/index.d.ts +5 -0
  3. package/dist/audio-ast/index.js +1001 -596
  4. package/dist/audio-ast/mp3-source.d.ts +18 -0
  5. package/dist/audio-ast/ogg-source.d.ts +25 -0
  6. package/dist/audio-ast/ogg-stream-source.d.ts +22 -0
  7. package/dist/audio-ast/vorbis.d.ts +14 -0
  8. package/dist/image-ast/index.js +139 -9
  9. package/dist/mp4-ast/containers/adapters.d.ts +7 -0
  10. package/dist/office-xml/retained-xml-document.d.ts +8 -0
  11. package/dist/pdf-ast/ast.d.ts +2 -0
  12. package/dist/pdf-ast/content/dictionary-cursor.d.ts +15 -0
  13. package/dist/pdf-ast/content/range-operator-parser.d.ts +4 -0
  14. package/dist/pdf-ast/content/stored-dictionary.d.ts +10 -0
  15. package/dist/pdf-ast/cos/lexer.d.ts +8 -5
  16. package/dist/pdf-ast/cos/object-reader.d.ts +4 -3
  17. package/dist/pdf-ast/cos/range-parser.d.ts +4 -0
  18. package/dist/pdf-ast/cos/retained-objects.d.ts +1 -0
  19. package/dist/pdf-ast/cos/retained-writer.d.ts +1 -0
  20. package/dist/pdf-ast/cos/value-parser.d.ts +32 -2
  21. package/dist/pdf-ast/edit/retained-append-attachments.d.ts +13 -0
  22. package/dist/pdf-ast/edit/retained-bookmarks.d.ts +13 -0
  23. package/dist/pdf-ast/edit/retained-graph.d.ts +6 -0
  24. package/dist/pdf-ast/edit/retained-save.d.ts +2 -0
  25. package/dist/pdf-ast/edit/retained-stamps.d.ts +9 -0
  26. package/dist/pdf-ast/extract/retained-form-field-details.d.ts +20 -0
  27. package/dist/pdf-ast/extract/retained-form-fields.d.ts +17 -4
  28. package/dist/pdf-ast/fonts/resolve.d.ts +3 -1
  29. package/dist/pdf-ast/index.d.ts +4 -1
  30. package/dist/pdf-ast/index.js +2127 -975
  31. package/dist/pdf-ast/retained-document.d.ts +4 -0
  32. package/dist/safe-bash/audio-ast.browser.js +7 -1
  33. package/dist/safe-bash/chunks/{chunk-HHSOUC3Z.js → chunk-HPQE675Q.js} +1 -1
  34. package/dist/safe-bash/chunks/{chunk-BUYRKFW2.js → chunk-I6ECNJMR.js} +1 -1
  35. package/dist/safe-bash/chunks/{pdftk-WRYEP3CA.js → pdftk-Y2TX74LY.js} +2 -1
  36. package/dist/safe-bash/command-chunks/biff-4ALVARRF-7SRX6R6N.js +5192 -0
  37. package/dist/safe-bash/command-chunks/{chunk-EHSM5ZQS.js → chunk-2DGJOOXM.js} +8 -8
  38. package/dist/safe-bash/command-chunks/{chunk-Q6S57NOQ.js → chunk-2E2H7MBH.js} +7 -7
  39. package/dist/safe-bash/command-chunks/{chunk-MMBZTYXO.js → chunk-2PQRZDNR.js} +221 -0
  40. package/dist/safe-bash/command-chunks/{chunk-5OO2P27R.js → chunk-2V6FOLXV.js} +78 -25
  41. package/dist/safe-bash/command-chunks/{chunk-56NYSX65.js → chunk-2Z3WRRFT.js} +9 -9
  42. package/dist/safe-bash/command-chunks/chunk-3D24WDND.js +63 -0
  43. package/dist/safe-bash/command-chunks/{chunk-47NEG4UO.js → chunk-3JST2Q7G.js} +219 -43
  44. package/dist/safe-bash/command-chunks/{chunk-WGG6G2KG.js → chunk-3LJAXFH5.js} +7 -7
  45. package/dist/safe-bash/command-chunks/{chunk-AHA6IWAJ.js → chunk-3TYDSGAH.js} +6 -6
  46. package/dist/safe-bash/command-chunks/{chunk-YSMNXMAO.js → chunk-3Y4XZB24.js} +4 -4
  47. package/dist/safe-bash/command-chunks/{chunk-ZIIO6GRY.js → chunk-4PBNMKAT.js} +7 -7
  48. package/dist/safe-bash/command-chunks/{chunk-JFYWVQ4V.js → chunk-4Z6W5EOC.js} +8 -8
  49. package/dist/safe-bash/command-chunks/{chunk-GEM47B2P.js → chunk-57DDYKE5.js} +7 -7
  50. package/dist/safe-bash/command-chunks/{chunk-HARUYHH7.js → chunk-5HUICAWD.js} +1 -1
  51. package/dist/safe-bash/command-chunks/{chunk-4CKFNXRN.js → chunk-5IFRAI7Y.js} +1 -1
  52. package/dist/safe-bash/command-chunks/{chunk-RHYJVTJO.js → chunk-5KGEZ3RW.js} +2 -2
  53. package/dist/safe-bash/command-chunks/{chunk-A5FZBR7X.js → chunk-5MFDRSGG.js} +4 -4
  54. package/dist/safe-bash/command-chunks/{chunk-7GKKMNL6.js → chunk-5P6I2T63.js} +8 -8
  55. package/dist/safe-bash/command-chunks/{chunk-6M6TM5Z5.js → chunk-5VQVZPP3.js} +3 -3
  56. package/dist/safe-bash/command-chunks/{chunk-MIRL7HTF.js → chunk-6244HYJY.js} +1 -1
  57. package/dist/safe-bash/command-chunks/chunk-63EMPQ7Z.js +115 -0
  58. package/dist/safe-bash/command-chunks/{chunk-XRVKWGVQ.js → chunk-6CY5BHBS.js} +6 -6
  59. package/dist/safe-bash/command-chunks/{chunk-XVP6V5K3.js → chunk-6IWE7PTK.js} +6 -6
  60. package/dist/safe-bash/command-chunks/{chunk-6QBMND4A.js → chunk-6SRHWVEB.js} +1 -1
  61. package/dist/safe-bash/command-chunks/chunk-6ZHQB453.js +35 -0
  62. package/dist/safe-bash/command-chunks/chunk-73NYFNAS.js +173 -0
  63. package/dist/safe-bash/command-chunks/{chunk-VU3EQF7F.js → chunk-7NXTEWPR.js} +229 -75
  64. package/dist/safe-bash/command-chunks/{chunk-554Z6IKP.js → chunk-7PRL6RJ6.js} +2 -2
  65. package/dist/safe-bash/command-chunks/{chunk-SDTPO2VV.js → chunk-7PZHWMK6.js} +7 -7
  66. package/dist/safe-bash/command-chunks/{chunk-XZ2FWFNV.js → chunk-7QZ2HP2F.js} +6 -6
  67. package/dist/safe-bash/command-chunks/{chunk-OEJM666F.js → chunk-7UC2Q6Z6.js} +5 -5
  68. package/dist/safe-bash/command-chunks/{chunk-COKYZUBW.js → chunk-AJI55RS7.js} +1 -1
  69. package/dist/safe-bash/command-chunks/{chunk-2VCKUNDZ.js → chunk-B2C3UPJS.js} +27 -17
  70. package/dist/safe-bash/command-chunks/{chunk-WXRYDALR.js → chunk-BBAB7LC4.js} +4 -4
  71. package/dist/safe-bash/command-chunks/{chunk-QYMEASQ6.js → chunk-BEHUSUOY.js} +4 -4
  72. package/dist/safe-bash/command-chunks/{chunk-Z2JW6M2D.js → chunk-BK7ISUJL.js} +3 -3
  73. package/dist/safe-bash/command-chunks/{chunk-33YCKZZX.js → chunk-C5KLFZGT.js} +6 -6
  74. package/dist/safe-bash/command-chunks/{chunk-TVH4JORU.js → chunk-C5QDEB3I.js} +3 -3
  75. package/dist/safe-bash/command-chunks/{chunk-N4R2SHSS.js → chunk-CCZZVCHX.js} +2 -2
  76. package/dist/safe-bash/command-chunks/{chunk-2VLAXKTS.js → chunk-CTDC4LJT.js} +121 -85
  77. package/dist/safe-bash/command-chunks/{chunk-S6R3IB36.js → chunk-D55REQA3.js} +1 -1
  78. package/dist/safe-bash/command-chunks/{chunk-Y4EYCZFT.js → chunk-D6WJY6QO.js} +10 -10
  79. package/dist/safe-bash/command-chunks/{chunk-2CORNDGF.js → chunk-DBLHCJJU.js} +2 -2
  80. package/dist/safe-bash/command-chunks/{chunk-SPW4GW4Z.js → chunk-DFI7QF3M.js} +2 -2
  81. package/dist/safe-bash/command-chunks/{chunk-456PHA3L.js → chunk-DMCI6T6N.js} +1 -1
  82. package/dist/safe-bash/command-chunks/{chunk-TW73OXPR.js → chunk-EJTNVXWF.js} +6 -6
  83. package/dist/safe-bash/command-chunks/{chunk-QD7ZRDUN.js → chunk-ET2VPDUA.js} +1 -1
  84. package/dist/safe-bash/command-chunks/{chunk-5LI2DLNZ.js → chunk-EXOQGXEU.js} +26 -26
  85. package/dist/safe-bash/command-chunks/{chunk-CRV2Q3PB.js → chunk-EZ4NQIPL.js} +1 -1
  86. package/dist/safe-bash/command-chunks/chunk-FWKLBDMK.js +0 -0
  87. package/dist/safe-bash/command-chunks/{chunk-22MOB45U.js → chunk-FWPVQGYK.js} +6 -6
  88. package/dist/safe-bash/command-chunks/{chunk-QC5RMGSA.js → chunk-G3RUXKVY.js} +3 -3
  89. package/dist/safe-bash/command-chunks/{chunk-JYUJAF4L.js → chunk-G7NENPYV.js} +4 -0
  90. package/dist/safe-bash/command-chunks/{chunk-KCOJA7EM.js → chunk-GKILM4HZ.js} +7 -7
  91. package/dist/safe-bash/command-chunks/{chunk-HTVIYLVB.js → chunk-GNXTMSYN.js} +4 -4
  92. package/dist/safe-bash/command-chunks/{chunk-D2ASPM7R.js → chunk-GOBUDKZ3.js} +3 -3
  93. package/dist/safe-bash/command-chunks/{chunk-RNSKXOG3.js → chunk-GVWVRPG6.js} +6 -6
  94. package/dist/safe-bash/command-chunks/{chunk-ZHRGYR7B.js → chunk-HCKYUQ3L.js} +7 -7
  95. package/dist/safe-bash/command-chunks/{chunk-AGLK7OJR.js → chunk-HDSIIQBS.js} +1 -1
  96. package/dist/safe-bash/command-chunks/{chunk-DM2CPMB4.js → chunk-HKOMXGJS.js} +2 -2
  97. package/dist/safe-bash/command-chunks/{chunk-IT7TAC3F.js → chunk-HVW53ARH.js} +16 -16
  98. package/dist/safe-bash/command-chunks/{chunk-M7QE2MN7.js → chunk-I4GMCWAT.js} +6 -6
  99. package/dist/safe-bash/command-chunks/{chunk-5MB64DWR.js → chunk-IHSOOSNC.js} +9 -9
  100. package/dist/safe-bash/command-chunks/{chunk-LCZDBW55.js → chunk-JAHJWVGF.js} +5 -5
  101. package/dist/safe-bash/command-chunks/{chunk-MOZD7RUY.js → chunk-JORIVUPM.js} +27 -11
  102. package/dist/safe-bash/command-chunks/{chunk-PMAM4N33.js → chunk-JUJHYPYL.js} +9 -9
  103. package/dist/safe-bash/command-chunks/{chunk-ENT3IV2G.js → chunk-KBUBSMCQ.js} +12 -12
  104. package/dist/safe-bash/command-chunks/{chunk-ZXR6LXV5.js → chunk-KCE5D4Z4.js} +48 -4
  105. package/dist/safe-bash/command-chunks/{chunk-FIIAYCWS.js → chunk-KZ5ODST6.js} +2 -2
  106. package/dist/safe-bash/command-chunks/{chunk-PNGDJA6M.js → chunk-LD7BONZY.js} +2 -2
  107. package/dist/safe-bash/command-chunks/{chunk-KJ4XXZIL.js → chunk-M3Z5PU2M.js} +582 -59
  108. package/dist/safe-bash/command-chunks/{chunk-LXLLA4PM.js → chunk-MKX4JAZ6.js} +17 -17
  109. package/dist/safe-bash/command-chunks/{chunk-RQIQ75W5.js → chunk-MNHBQBF6.js} +5 -5
  110. package/dist/safe-bash/command-chunks/{chunk-A2CLZMQZ.js → chunk-MPKY37QR.js} +1 -1
  111. package/dist/safe-bash/command-chunks/{chunk-K5GB2YMN.js → chunk-MUUWBZIC.js} +10 -10
  112. package/dist/safe-bash/command-chunks/{chunk-JOCFI7TG.js → chunk-N32GSM3J.js} +1 -1
  113. package/dist/safe-bash/command-chunks/{chunk-EUT24Y5Z.js → chunk-NKTULXVD.js} +8 -8
  114. package/dist/safe-bash/command-chunks/{chunk-5HPU7D36.js → chunk-NMPED6L5.js} +4 -4
  115. package/dist/safe-bash/command-chunks/{chunk-QZZ73J2O.js → chunk-NPFHUS4X.js} +6 -6
  116. package/dist/safe-bash/command-chunks/{chunk-X7FA7ZD5.js → chunk-O675URF4.js} +8 -8
  117. package/dist/safe-bash/command-chunks/{chunk-R6EGGK5M.js → chunk-P7EL2FWW.js} +7 -7
  118. package/dist/safe-bash/command-chunks/{chunk-YS25EI54.js → chunk-PCCFLPUQ.js} +2 -2
  119. package/dist/safe-bash/command-chunks/{chunk-RRL3Y562.js → chunk-PI6MOMHA.js} +11 -11
  120. package/dist/safe-bash/command-chunks/{chunk-26VCZHLJ.js → chunk-PIOQBOEK.js} +1 -1
  121. package/dist/safe-bash/command-chunks/chunk-PK36TVXB.js +175 -0
  122. package/dist/safe-bash/command-chunks/{chunk-72C3TZ2U.js → chunk-PKLJRB7W.js} +264 -129
  123. package/dist/safe-bash/command-chunks/{chunk-6CCQI6XZ.js → chunk-PSCOXGCA.js} +12 -12
  124. package/dist/safe-bash/command-chunks/{chunk-XPD636C4.js → chunk-PVGZMLC6.js} +3 -3
  125. package/dist/safe-bash/command-chunks/{chunk-JQVHUSDD.js → chunk-PXWS3Q7L.js} +5 -5
  126. package/dist/safe-bash/command-chunks/{chunk-HDJVJTCK.js → chunk-QFF5KBOM.js} +9 -9
  127. package/dist/safe-bash/command-chunks/{chunk-MPUHH2KR.js → chunk-QM2HZJSJ.js} +3 -3
  128. package/dist/safe-bash/command-chunks/{chunk-UAXSE3XE.js → chunk-R2BMZAHG.js} +5 -5
  129. package/dist/safe-bash/command-chunks/{chunk-KB7DUBVL.js → chunk-RGOQKIG6.js} +5 -5
  130. package/dist/safe-bash/command-chunks/{chunk-D2KZ66W4.js → chunk-RLCQ7BN3.js} +187 -39
  131. package/dist/safe-bash/command-chunks/{chunk-B5LDP7AA.js → chunk-S2N2V5U4.js} +2 -2
  132. package/dist/safe-bash/command-chunks/{chunk-OA75SGN2.js → chunk-SGPCXAG7.js} +7 -7
  133. package/dist/safe-bash/command-chunks/{chunk-Z5QOVRVH.js → chunk-SU26FZLJ.js} +1 -1
  134. package/dist/safe-bash/command-chunks/{chunk-QUM3SYAJ.js → chunk-SYSX46IV.js} +3 -3
  135. package/dist/safe-bash/command-chunks/chunk-T3E5RV3U.js +737 -0
  136. package/dist/safe-bash/command-chunks/{chunk-YORJDX4V.js → chunk-T5ERNELL.js} +4 -4
  137. package/dist/safe-bash/command-chunks/{chunk-KL3OIBKB.js → chunk-T6C5QP7T.js} +6495 -6343
  138. package/dist/safe-bash/command-chunks/{chunk-ATTWQVR2.js → chunk-TKRLZIFI.js} +17 -17
  139. package/dist/safe-bash/command-chunks/{chunk-ZMHEGDU2.js → chunk-TODWFDYB.js} +2 -2
  140. package/dist/safe-bash/command-chunks/{chunk-YSY6R6AS.js → chunk-TQEB4DH4.js} +703 -102
  141. package/dist/safe-bash/command-chunks/{chunk-36XGIPOG.js → chunk-U5TWQFZY.js} +1 -1
  142. package/dist/safe-bash/command-chunks/{chunk-APEWTWCC.js → chunk-UAF4IX5H.js} +6 -6
  143. package/dist/safe-bash/command-chunks/{chunk-6VPQ3CDZ.js → chunk-V37D6AHO.js} +5 -5
  144. package/dist/safe-bash/command-chunks/{chunk-RID6VYS3.js → chunk-V6XBEYPC.js} +8 -8
  145. package/dist/safe-bash/command-chunks/{chunk-WJCN2IXI.js → chunk-VQOINPVF.js} +2 -2
  146. package/dist/safe-bash/command-chunks/{chunk-W5YSINXC.js → chunk-VVWXY6IA.js} +6 -6
  147. package/dist/safe-bash/command-chunks/{chunk-HKATEVAP.js → chunk-WPVBUVFK.js} +6 -6
  148. package/dist/safe-bash/command-chunks/{chunk-UYWSIIUX.js → chunk-X53AEG36.js} +7 -7
  149. package/dist/safe-bash/command-chunks/{chunk-L5MCW6CM.js → chunk-X64XGIXZ.js} +9 -155
  150. package/dist/safe-bash/command-chunks/{chunk-Q73EMLLZ.js → chunk-X6RHJ6YN.js} +84 -5
  151. package/dist/safe-bash/command-chunks/{chunk-7PVHO47B.js → chunk-XG6UWQV5.js} +6 -6
  152. package/dist/safe-bash/command-chunks/{chunk-NQDIT667.js → chunk-XIDGHIGB.js} +5 -5
  153. package/dist/safe-bash/command-chunks/{chunk-DPR5CYQV.js → chunk-XITDDJFT.js} +2 -0
  154. package/dist/safe-bash/command-chunks/{chunk-CV7M2QJU.js → chunk-XLYIVBAR.js} +7 -7
  155. package/dist/safe-bash/command-chunks/{chunk-WVMHRNXZ.js → chunk-YUXTK3XA.js} +3 -3
  156. package/dist/safe-bash/command-chunks/{chunk-SPLOIABU.js → chunk-YXD6VGVG.js} +3 -3
  157. package/dist/safe-bash/command-chunks/{chunk-2ZFLMWOX.js → chunk-Z5BIM5B7.js} +1 -1
  158. package/dist/safe-bash/command-chunks/chunk-ZYLGNIGA.js +156 -0
  159. package/dist/safe-bash/command-chunks/{command-engine-BEWABZ75.js → command-engine-X3OLN7N6.js} +206 -86
  160. package/dist/safe-bash/command-chunks/{engine-AXXFTGCL-QBQNBI6K.js → engine-XUCIFZ7V-LJFGZM6O.js} +1 -1
  161. package/dist/safe-bash/command-chunks/paradox-4FCZE53D-LQPGVMEL.js +365 -0
  162. package/dist/safe-bash/commands/pandoc/index.browser.js +1 -1
  163. package/dist/safe-bash/full-core.browser.js +2 -2
  164. package/dist/safe-bash/plugins/index.browser.js +2 -2
  165. package/dist/safe-bash-command-apply-patch/apply.js +4 -4
  166. package/dist/safe-bash-command-apply-patch/index.js +4 -4
  167. package/dist/safe-bash-command-apply-patch/matcher.js +2 -2
  168. package/dist/safe-bash-command-apply-patch/parser.js +2 -2
  169. package/dist/safe-bash-command-apply-patch/shared.d.ts +2 -0
  170. package/dist/safe-bash-command-apply-patch/shared.js +1 -1
  171. package/dist/safe-bash-command-diff/diff.js +1 -1
  172. package/dist/safe-bash-command-diff/index.js +1 -1
  173. package/dist/safe-bash-command-ffmpeg/index.js +1 -1
  174. package/dist/safe-bash-command-ffprobe/index.js +2 -2
  175. package/dist/safe-bash-command-ffprobe/media.d.ts +3 -1
  176. package/dist/safe-bash-command-ffprobe/media.js +2 -2
  177. package/dist/safe-bash-command-html-to-markdown/budget.js +2 -1
  178. package/dist/safe-bash-command-html-to-markdown/entities.js +4 -3
  179. package/dist/safe-bash-command-html-to-markdown/index.js +564 -110
  180. package/dist/safe-bash-command-html-to-markdown/input.js +6 -5
  181. package/dist/safe-bash-command-html-to-markdown/options.js +2 -1
  182. package/dist/safe-bash-command-html-to-markdown/parser.js +5 -4
  183. package/dist/safe-bash-command-html-to-markdown/render.js +6 -5
  184. package/dist/safe-bash-command-html-to-markdown/text.js +3 -2
  185. package/dist/safe-bash-command-htmlq/index.js +361 -37
  186. package/dist/safe-bash-command-htmlq/tree.d.ts +3 -2
  187. package/dist/safe-bash-command-pandoc/command.js +7 -7
  188. package/dist/safe-bash-command-pandoc/index.js +55 -55
  189. package/dist/safe-bash-command-patch/index.js +6 -6
  190. package/dist/safe-bash-command-patch/patch-envelope.js +53 -3
  191. package/dist/safe-bash-command-patch/patch-formats.d.ts +2 -2
  192. package/dist/safe-bash-command-patch/patch-formats.js +2 -2
  193. package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +2 -1
  194. package/dist/safe-bash-command-patch/patch-gnu-reject.js +4 -3
  195. package/dist/safe-bash-command-patch/patch-publication.js +2 -1
  196. package/dist/safe-bash-command-patch/patch.js +6 -6
  197. package/dist/safe-bash-command-patch/unified.d.ts +10 -2
  198. package/dist/safe-bash-command-patch/unified.js +1 -1
  199. package/dist/safe-bash-command-pdftk/index.d.ts +6 -2
  200. package/dist/safe-bash-command-pdftk/index.js +835 -243
  201. package/dist/safe-bash-command-pptx/command-engine.d.ts +15 -3
  202. package/dist/safe-bash-command-pptx/engine.d.ts +2 -2
  203. package/dist/safe-bash-command-pptx/engine.js +1 -1
  204. package/dist/safe-bash-command-pptx/index.js +9 -2
  205. package/dist/safe-bash-command-soffice/index.js +1 -1
  206. package/dist/safe-bash-command-ssconvert/index.js +2 -2
  207. package/dist/safe-bash-command-xmllint/index.js +22 -31
  208. package/dist/safe-bash-diff-engine/document.d.ts +2 -1
  209. package/dist/safe-bash-diff-engine/document.js +7 -4
  210. package/dist/safe-bash-presentation-engine/accessibility.js +31 -30
  211. package/dist/safe-bash-presentation-engine/animation-editing.js +16 -15
  212. package/dist/safe-bash-presentation-engine/animations.js +16 -15
  213. package/dist/safe-bash-presentation-engine/backgrounds.js +17 -16
  214. package/dist/safe-bash-presentation-engine/bytes.js +3 -3
  215. package/dist/safe-bash-presentation-engine/chart-editing.js +34 -33
  216. package/dist/safe-bash-presentation-engine/chart-object-operations.js +25 -24
  217. package/dist/safe-bash-presentation-engine/charts.js +31 -30
  218. package/dist/safe-bash-presentation-engine/command-placeholder.js +59 -55
  219. package/dist/safe-bash-presentation-engine/comments.js +17 -16
  220. package/dist/safe-bash-presentation-engine/connector-operations.js +32 -31
  221. package/dist/safe-bash-presentation-engine/connectors.js +29 -28
  222. package/dist/safe-bash-presentation-engine/content-types.js +4 -4
  223. package/dist/safe-bash-presentation-engine/creation.js +6 -6
  224. package/dist/safe-bash-presentation-engine/diff.js +32 -31
  225. package/dist/safe-bash-presentation-engine/drawing-enums.d.ts +10 -10
  226. package/dist/safe-bash-presentation-engine/drawing-format.js +20 -19
  227. package/dist/safe-bash-presentation-engine/drawing-operations.js +31 -30
  228. package/dist/safe-bash-presentation-engine/drawing-schema.js +21 -20
  229. package/dist/safe-bash-presentation-engine/equations.js +17 -16
  230. package/dist/safe-bash-presentation-engine/errors.js +2 -2
  231. package/dist/safe-bash-presentation-engine/fields.js +17 -16
  232. package/dist/safe-bash-presentation-engine/font-metrics.js +3 -3
  233. package/dist/safe-bash-presentation-engine/image-extraction.js +20 -19
  234. package/dist/safe-bash-presentation-engine/image-formatting.js +32 -31
  235. package/dist/safe-bash-presentation-engine/image-insertion.js +18 -17
  236. package/dist/safe-bash-presentation-engine/image-replacement.js +21 -20
  237. package/dist/safe-bash-presentation-engine/image-value.js +4 -4
  238. package/dist/safe-bash-presentation-engine/images.js +19 -18
  239. package/dist/safe-bash-presentation-engine/index.d.ts +6 -2
  240. package/dist/safe-bash-presentation-engine/index.js +112 -97
  241. package/dist/safe-bash-presentation-engine/layouts.js +16 -15
  242. package/dist/safe-bash-presentation-engine/length.js +3 -3
  243. package/dist/safe-bash-presentation-engine/links.js +16 -15
  244. package/dist/safe-bash-presentation-engine/masters.js +15 -14
  245. package/dist/safe-bash-presentation-engine/media-editing.js +24 -23
  246. package/dist/safe-bash-presentation-engine/media-extraction.js +17 -16
  247. package/dist/safe-bash-presentation-engine/media.js +16 -15
  248. package/dist/safe-bash-presentation-engine/memberships.js +15 -14
  249. package/dist/safe-bash-presentation-engine/notes.js +16 -15
  250. package/dist/safe-bash-presentation-engine/ole-enum.js +4 -4
  251. package/dist/safe-bash-presentation-engine/ole-insertion.js +20 -19
  252. package/dist/safe-bash-presentation-engine/opaque-objects.js +9 -9
  253. package/dist/safe-bash-presentation-engine/package-reader.js +5 -5
  254. package/dist/safe-bash-presentation-engine/package-tools.d.ts +3 -0
  255. package/dist/safe-bash-presentation-engine/package-tools.js +27 -17
  256. package/dist/safe-bash-presentation-engine/package-uri.js +3 -3
  257. package/dist/safe-bash-presentation-engine/package-writer.js +4 -4
  258. package/dist/safe-bash-presentation-engine/presentation-model.js +58 -54
  259. package/dist/safe-bash-presentation-engine/presentation-settings.js +14 -13
  260. package/dist/safe-bash-presentation-engine/properties.js +16 -15
  261. package/dist/safe-bash-presentation-engine/relationships.js +4 -4
  262. package/dist/safe-bash-presentation-engine/resource-limits.js +1 -1
  263. package/dist/safe-bash-presentation-engine/retained-archive-staging.d.ts +19 -0
  264. package/dist/safe-bash-presentation-engine/retained-extraction-output.d.ts +18 -0
  265. package/dist/safe-bash-presentation-engine/retained-inspection.js +14 -12
  266. package/dist/safe-bash-presentation-engine/retained-package-extraction.d.ts +22 -0
  267. package/dist/safe-bash-presentation-engine/retained-package-packing.d.ts +19 -0
  268. package/dist/safe-bash-presentation-engine/retained-package.d.ts +2 -0
  269. package/dist/safe-bash-presentation-engine/retained-package.js +6 -4
  270. package/dist/safe-bash-presentation-engine/retained-slide-publication.d.ts +24 -0
  271. package/dist/safe-bash-presentation-engine/retained-text.js +19 -17
  272. package/dist/safe-bash-presentation-engine/retained-xml-parts.d.ts +5 -1
  273. package/dist/safe-bash-presentation-engine/retained-xml-publication.d.ts +18 -0
  274. package/dist/safe-bash-presentation-engine/retained-xml-replacement.d.ts +13 -0
  275. package/dist/safe-bash-presentation-engine/sanitize.js +17 -16
  276. package/dist/safe-bash-presentation-engine/selectors.js +10 -10
  277. package/dist/safe-bash-presentation-engine/shape-groups.js +31 -30
  278. package/dist/safe-bash-presentation-engine/shape-operations.js +30 -29
  279. package/dist/safe-bash-presentation-engine/shape-path-operations.js +32 -31
  280. package/dist/safe-bash-presentation-engine/shape-paths.js +16 -15
  281. package/dist/safe-bash-presentation-engine/shape-presets.js +3 -3
  282. package/dist/safe-bash-presentation-engine/shape-selection.js +31 -30
  283. package/dist/safe-bash-presentation-engine/shape-transforms.js +18 -17
  284. package/dist/safe-bash-presentation-engine/shapes.d.ts +1 -1
  285. package/dist/safe-bash-presentation-engine/shapes.js +27 -26
  286. package/dist/safe-bash-presentation-engine/slide-copy.js +17 -16
  287. package/dist/safe-bash-presentation-engine/slide-import.js +18 -17
  288. package/dist/safe-bash-presentation-engine/slide-merge-split.js +20 -19
  289. package/dist/safe-bash-presentation-engine/slide-model.js +43 -42
  290. package/dist/safe-bash-presentation-engine/slide-removal.js +18 -17
  291. package/dist/safe-bash-presentation-engine/slide-transfer-budget.js +9 -9
  292. package/dist/safe-bash-presentation-engine/slides.d.ts +1 -0
  293. package/dist/safe-bash-presentation-engine/slides.js +23 -17
  294. package/dist/safe-bash-presentation-engine/table-operations.js +33 -32
  295. package/dist/safe-bash-presentation-engine/table-spans.js +32 -31
  296. package/dist/safe-bash-presentation-engine/tables.js +31 -30
  297. package/dist/safe-bash-presentation-engine/tags.js +16 -15
  298. package/dist/safe-bash-presentation-engine/template-bindings.js +33 -32
  299. package/dist/safe-bash-presentation-engine/template-repeat.js +40 -39
  300. package/dist/safe-bash-presentation-engine/text-fitting.js +27 -26
  301. package/dist/safe-bash-presentation-engine/text-frames.js +27 -26
  302. package/dist/safe-bash-presentation-engine/text-paragraphs.js +27 -26
  303. package/dist/safe-bash-presentation-engine/text-reading.js +11 -11
  304. package/dist/safe-bash-presentation-engine/text-replacement.js +17 -16
  305. package/dist/safe-bash-presentation-engine/text-runs.js +20 -19
  306. package/dist/safe-bash-presentation-engine/themes.js +16 -15
  307. package/dist/safe-bash-presentation-engine/transitions.js +16 -15
  308. package/dist/safe-bash-presentation-engine/validation.js +10 -9
  309. package/dist/safe-bash-presentation-engine/xml-parts.d.ts +2 -0
  310. package/dist/safe-bash-presentation-engine/xml-parts.js +23 -15
  311. package/dist/safe-bash-presentation-engine/xml-view.js +3 -3
  312. package/dist/safe-bash-presentation-engine/xml.js +3 -3
  313. package/dist/safe-bash-regex-engine/index.js +1 -1
  314. package/dist/safe-bash-regex-engine/python-glob.js +1 -1
  315. package/dist/safe-bash-regex-engine/text/regex.d.ts +19 -0
  316. package/dist/safe-bash-regex-engine/text/regex.js +1 -1
  317. package/dist/safe-bash-xml-engine/document.js +3 -3
  318. package/dist/safe-bash-xml-engine/evaluate.js +1 -1
  319. package/dist/safe-bash-xml-engine/index.d.ts +1 -0
  320. package/dist/safe-bash-xml-engine/index.js +8 -4
  321. package/dist/safe-bash-xml-engine/query.js +2 -2
  322. package/dist/safe-bash-xml-engine/recovery.d.ts +10 -0
  323. package/dist/safe-bash-xml-engine/stored-document.d.ts +1 -1
  324. package/dist/safe-bash-xml-engine/stored-document.js +1 -1
  325. package/dist/safe-bash-xml-engine/stored-evaluate.js +1 -1
  326. package/dist/spreadsheet-engine/formulas/functions/python-printf.js +56 -33
  327. package/dist/spreadsheet-format-xls/biff-encrypted-properties.d.ts +2 -2
  328. package/dist/spreadsheet-format-xls/biff-encrypted-properties.js +86 -24
  329. package/dist/spreadsheet-format-xls/biff-metadata.d.ts +1 -0
  330. package/dist/spreadsheet-format-xls/biff-metadata.js +2 -2
  331. package/dist/spreadsheet-format-xls/biff-properties-merge.d.ts +6 -2
  332. package/dist/spreadsheet-format-xls/biff-properties-merge.js +413 -296
  333. package/dist/spreadsheet-format-xls/biff-properties-write.js +40 -23
  334. package/dist/spreadsheet-format-xls/biff-properties.js +3 -68
  335. package/dist/spreadsheet-format-xls/biff-property-index.d.ts +23 -0
  336. package/dist/spreadsheet-format-xls/biff-property-index.js +93 -0
  337. package/dist/spreadsheet-format-xls/biff-property-name.d.ts +4 -0
  338. package/dist/spreadsheet-format-xls/biff-property-name.js +114 -0
  339. package/dist/spreadsheet-format-xls/biff-property-text.d.ts +6 -0
  340. package/dist/spreadsheet-format-xls/biff-property-text.js +68 -0
  341. package/dist/spreadsheet-format-xls/biff-property-transcode.d.ts +5 -0
  342. package/dist/spreadsheet-format-xls/biff-property-transcode.js +45 -0
  343. package/dist/spreadsheet-format-xls/biff-write-metadata.js +10 -1
  344. package/package.json +6 -3
  345. package/dist/safe-bash/command-chunks/biff-3EFLKBAH-NYWZOYQS.js +0 -4942
  346. package/dist/safe-bash/command-chunks/chunk-5Q22ZLNC.js +0 -127
  347. package/dist/safe-bash/command-chunks/chunk-JKLOBSMP.js +0 -56
  348. package/dist/safe-bash/command-chunks/chunk-JYTESTBS.js +0 -99
  349. package/dist/safe-bash/command-chunks/chunk-WH3TIOTS.js +0 -326
  350. package/dist/safe-bash/command-chunks/paradox-ZWWXYY4J-JYOSWSBL.js +0 -362
  351. package/dist/spreadsheet-format-xls/biff-properties-layout.js +0 -56
@@ -1,127 +0,0 @@
1
- import {
2
- loadShared
3
- } from "./chunk-56NYSX65.js";
4
- import {
5
- writePackageArchive
6
- } from "./chunk-DM2CPMB4.js";
7
- import {
8
- readBinary
9
- } from "./chunk-PNGDJA6M.js";
10
- import {
11
- parseContentTypes
12
- } from "./chunk-WJCN2IXI.js";
13
- import {
14
- asciiKey,
15
- partName
16
- } from "./chunk-36XGIPOG.js";
17
- import {
18
- OfficeError
19
- } from "./chunk-Q73EMLLZ.js";
20
-
21
- // packages/safe-bash-presentation-engine/src/package-tools.ts
22
- import { sha256 } from "@noble/hashes/sha2.js";
23
- function record(value, allowed) {
24
- if (!value || typeof value !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(value)) || Reflect.ownKeys(value).some((key) => typeof key !== "string" || !allowed.includes(key) || !("value" in Object.getOwnPropertyDescriptor(value, key))))
25
- throw new OfficeError("invalid-value", "Expected a plain package record.", "usage");
26
- }
27
- function list(value, maximum) {
28
- if (!Array.isArray(value)) throw new OfficeError("invalid-value", "Expected package members.", "usage");
29
- if (value.length > maximum) throw new OfficeError("resource-limit", "Package member limit exceeded.", "usage");
30
- if (Object.getPrototypeOf(value) !== Array.prototype || Reflect.ownKeys(value).length !== value.length + 1 || Array.from({ length: value.length }, (_, index) => Object.getOwnPropertyDescriptor(value, String(index))).some((item) => !item || !("value" in item)))
31
- throw new OfficeError("invalid-value", "Expected a dense package array.", "usage");
32
- }
33
- function digest(bytes) {
34
- return Array.from(sha256(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
35
- }
36
- async function extractPackage(input, context, options = {}) {
37
- record(options, ["parts"]);
38
- if (!context?.archiveLimits) throw new OfficeError("invalid-value", "Explicit limits are required.", "usage");
39
- if (options.parts !== void 0) list(options.parts, context.archiveLimits.maxMembers);
40
- if (!options || Object.keys(options).some((key) => key !== "parts") || options.parts !== void 0 && (!Array.isArray(options.parts) || !options.parts.length))
41
- throw new OfficeError("invalid-value", "Invalid package extraction options.", "usage");
42
- const selected = options.parts?.map((part) => {
43
- const canonical = partName(part, false);
44
- if (canonical !== part) throw new OfficeError("unsafe-path", "A canonical package part is required.", "usage");
45
- return canonical;
46
- });
47
- if (selected && new Set(selected.map(asciiKey)).size !== selected.length)
48
- throw new OfficeError("invalid-value", "Duplicate extracted part.", "usage");
49
- const { reader } = await loadShared(input, context, false);
50
- const types = parseContentTypes(reader.get("/[Content_Types].xml"), {
51
- maxBytes: context.xmlLimits.maxBytes,
52
- maxEntries: context.archiveLimits.maxMembers
53
- });
54
- const names = selected ?? [...reader.names].sort();
55
- return Object.freeze(names.map((part, index) => {
56
- const bytes = reader.get(part);
57
- const contentType = part === "/[Content_Types].xml" ? "application/xml" : types.get(part);
58
- const essence = contentType.split(";", 1)[0].trim().toLowerCase();
59
- const extension = essence === "application/xml" || essence === "text/xml" || essence.endsWith("+xml") ? "xml" : { "image/png": "png", "image/jpeg": "jpg", "image/gif": "gif", "image/tiff": "tif", "image/bmp": "bmp", "audio/mpeg": "mp3", "video/mp4": "mp4" }[essence] ?? "bin";
60
- return Object.freeze({ part, name: `part-${String(index + 1).padStart(6, "0")}.${extension}`, contentType, sha256: digest(bytes), bytes });
61
- }));
62
- }
63
- async function packPackage(members, context, options = {}) {
64
- record(options, ["kind"]);
65
- if (!context?.limits || !context.archiveLimits || !Array.isArray(members) || !members.length || !options || Object.keys(options).some((key) => key !== "kind") || options.kind !== void 0 && !["pptx", "potx", "ppsx"].includes(options.kind))
66
- throw new OfficeError("invalid-value", "Explicit package members and limits are required.", "usage");
67
- if (context.signal?.aborted) throw new OfficeError("cancelled", "Operation cancelled.", "admit");
68
- if (members.length > context.archiveLimits.maxMembers)
69
- throw new OfficeError("resource-limit", "Package member limit exceeded.", "admit");
70
- list(members, context.archiveLimits.maxMembers);
71
- const names = /* @__PURE__ */ new Set();
72
- const parents = /* @__PURE__ */ new Set();
73
- let ownedTotal = 0;
74
- const admitted = members.map((member) => {
75
- record(member, ["part", "sha256", "bytes", "name", "contentType"]);
76
- if (!member || typeof member.sha256 !== "string" || member.sha256.length !== 64 || [...member.sha256].some((character) => !"0123456789abcdef".includes(character)))
77
- throw new OfficeError("invalid-value", "A lowercase SHA-256 digest is required.", "usage");
78
- const part = partName(member.part, false);
79
- if (part !== member.part || part.includes(":"))
80
- throw new OfficeError("unsafe-path", "A canonical package part is required.", "usage");
81
- const key = asciiKey(part);
82
- if (names.has(key) || parents.has(key))
83
- throw new OfficeError("invalid-opc", "Colliding package members.", "admit");
84
- let parent = key.slice(0, key.lastIndexOf("/"));
85
- while (parent) {
86
- if (names.has(parent)) throw new OfficeError("invalid-opc", "Colliding package members.", "admit");
87
- parents.add(parent);
88
- parent = parent.slice(0, parent.lastIndexOf("/"));
89
- }
90
- names.add(key);
91
- let input = member.bytes;
92
- if (input instanceof Uint8Array) {
93
- ownedTotal += input.length;
94
- if (input.length > context.archiveLimits.maxEntryBytes || input.length > context.limits.maxBytes || ownedTotal > context.archiveLimits.maxTotalBytes)
95
- throw new OfficeError("resource-limit", "Package byte limit exceeded.", "admit");
96
- input = new Uint8Array(input);
97
- }
98
- return { part, sha256: member.sha256, input };
99
- });
100
- let total = 0;
101
- const output = [];
102
- for (const member of admitted) {
103
- const remaining = context.archiveLimits.maxTotalBytes - total;
104
- const bytes2 = await readBinary(member.input, context, { maxBytes: Math.min(context.limits.maxBytes, context.archiveLimits.maxEntryBytes, Math.max(1, remaining)) });
105
- if (bytes2.length > remaining) throw new OfficeError("resource-limit", "Package byte limit exceeded.", "admit");
106
- total += bytes2.length;
107
- if (digest(bytes2) !== member.sha256)
108
- throw new OfficeError("invalid-value", "Package member digest does not match.", "admit");
109
- const name = [...member.part.slice(1)].map((character) => character.codePointAt(0) > 127 ? encodeURIComponent(character) : character).join("");
110
- output.push({ name, bytes: bytes2 });
111
- }
112
- const bytes = await writePackageArchive(output, context, { compression: "store" });
113
- const loaded = await loadShared(bytes, context);
114
- if (options.kind !== void 0) {
115
- const types = parseContentTypes(loaded.reader.get("/[Content_Types].xml"), {
116
- maxBytes: context.xmlLimits.maxBytes,
117
- maxEntries: context.archiveLimits.maxMembers
118
- });
119
- types.presentationKind(loaded.main, options.kind);
120
- }
121
- return bytes;
122
- }
123
-
124
- export {
125
- extractPackage,
126
- packPackage
127
- };
@@ -1,56 +0,0 @@
1
- // packages/safe-bash-command-patch/src/patch-envelope.ts
2
- import { ToolError } from "../../safe-bash-diff-engine/shared.js";
3
- async function normalizeTransport(text, budget) {
4
- const lines = [];
5
- let position = 0;
6
- while (position < text.length) {
7
- const end = text.indexOf("\n", position);
8
- budget.step(1 + end - position);
9
- {
10
- const c = budget.checkpoint();
11
- if (c) await c;
12
- }
13
- if (end <= position || text[end - 1] !== "\r") return text;
14
- lines.push(text.slice(position, end - 1), "\n");
15
- if (lines.length / 2 > budget.limits.maxLines) throw new ToolError("transport line limit exceeded");
16
- position = end + 1;
17
- }
18
- return lines.join("");
19
- }
20
- async function unwrapPatch(text, budget) {
21
- if (text && !text.endsWith("\n")) throw new ToolError("patch is truncated: missing final LF");
22
- text = await normalizeTransport(text, budget);
23
- let position = 0;
24
- let lines = 0;
25
- const mail = /^(?:From [0-9a-f]{40,64} |(?:From|Date|Subject|To|Cc|MIME-Version|Content-Type):)/u.test(text);
26
- if (mail) {
27
- while (position < text.length) {
28
- budget.step();
29
- {
30
- const c = budget.checkpoint();
31
- if (c) await c;
32
- }
33
- const end = text.indexOf("\n", position);
34
- const line = text.slice(position, end);
35
- if (/^(?:--- |\*\*\* |diff |\d+(?:,\d+)?[acd]\d)/u.test(line)) break;
36
- if (/^(?:old mode |new mode |new file mode |deleted file mode |rename |copy |similarity index |dissimilarity index |GIT binary patch|Binary files |index |@@|[+\\])/u.test(line)) throw new ToolError("unsupported or malformed mail patch metadata");
37
- position = end + 1;
38
- if (++lines > budget.limits.maxLines) throw new ToolError("mail preamble limit exceeded");
39
- }
40
- if (position === text.length) throw new ToolError("mail preamble without patch");
41
- }
42
- const body = text.slice(position);
43
- const signature = body.indexOf("\n-- \n");
44
- if (signature < 0) return body;
45
- const trailer = body.slice(signature + 5);
46
- if (trailer.split("\n").length > budget.limits.maxLines) throw new ToolError("mail signature limit exceeded");
47
- for (const line of trailer.split("\n")) {
48
- budget.step();
49
- if (/^(?:diff |---|\+\+\+|\*\*\*|@@|index |old mode |new mode |new file mode |deleted file mode |rename |copy |similarity index |dissimilarity index |GIT binary patch|Binary files |[+\\]|\d+(?:,\d+)?[acd]\d)/u.test(line)) throw new ToolError("patch data after mail signature");
50
- }
51
- return body.slice(0, signature + 1);
52
- }
53
-
54
- export {
55
- unwrapPatch
56
- };
@@ -1,99 +0,0 @@
1
- // packages/safe-bash-command-patch/src/patch-gnu-reject.ts
2
- function timestamp(header) {
3
- if (!header) return "";
4
- const separator = header.indexOf(" ");
5
- return separator < 0 ? "" : header.slice(separator);
6
- }
7
- function unifiedRange(start, count, offset) {
8
- return `${start + offset}${count === 1 ? "" : `,${count}`}`;
9
- }
10
- function contextRange(start, count, offset) {
11
- return count === 0 ? "0" : count === 1 ? `${start + offset}` : `${start + offset},${start + offset + count - 1}`;
12
- }
13
- async function rejectText(patch, outcomes, oldName, newName, indexName, reverse, budget, format) {
14
- const normal = patch.format === "normal";
15
- const context = format === void 0 ? patch.format === "context" || normal : format === "context";
16
- const names = [normal ? "/dev/null" : oldName ?? "/dev/null", normal ? "/dev/null" : newName ?? "/dev/null"];
17
- const times = normal ? ["", ""] : [timestamp(patch.oldHeader), timestamp(patch.newHeader)];
18
- if (reverse) {
19
- names.reverse();
20
- times.reverse();
21
- }
22
- const output = [];
23
- const add = (text) => {
24
- budget.output(text);
25
- output.push(text);
26
- };
27
- if (indexName !== void 0) add(`Index: ${indexName}
28
- `);
29
- add(`${context ? "***" : "---"} ${names[0]}${times[0]}
30
- ${context ? "---" : "+++"} ${names[1]}${times[1]}
31
- `);
32
- for (const outcome of outcomes) {
33
- if (!outcome.failed) continue;
34
- budget.step();
35
- {
36
- const c = budget.checkpoint();
37
- if (c) await c;
38
- }
39
- const { hunk, outputOffset } = outcome;
40
- if (!context) {
41
- add(`@@ -${unifiedRange(hunk.oldStart, hunk.oldCount, outputOffset)} +${unifiedRange(hunk.newStart, hunk.newCount, outputOffset)} @@${hunk.section ?? ""}
42
- `);
43
- let group = [];
44
- const flush = () => {
45
- for (const kind of ["-", "+"]) for (const line of group) if (line.kind === kind) add(`${kind}${line.text}`);
46
- group = [];
47
- };
48
- for (const line of hunk.lines) {
49
- budget.step();
50
- {
51
- const c = budget.checkpoint();
52
- if (c) await c;
53
- }
54
- if (line.kind === " ") {
55
- flush();
56
- add(` ${line.text}`);
57
- } else group.push(line);
58
- }
59
- flush();
60
- } else {
61
- add(`***************${hunk.section ?? ""}
62
- *** ${contextRange(hunk.oldStart, hunk.oldCount, outputOffset)}${normal ? "" : " ****"}
63
- `);
64
- const oldLines = [];
65
- const newLines = [];
66
- let group = [];
67
- const flush = () => {
68
- const changed = !normal && group.some((line) => line.kind === "-") && group.some((line) => line.kind === "+");
69
- for (const line of group) {
70
- const text = `${changed ? "!" : line.kind} ${line.text}`;
71
- (line.kind === "-" ? oldLines : newLines).push(text);
72
- }
73
- group = [];
74
- };
75
- for (const line of hunk.lines) {
76
- budget.step();
77
- {
78
- const c = budget.checkpoint();
79
- if (c) await c;
80
- }
81
- if (line.kind === " ") {
82
- flush();
83
- oldLines.push(` ${line.text}`);
84
- newLines.push(` ${line.text}`);
85
- } else group.push(line);
86
- }
87
- flush();
88
- for (const line of oldLines) add(line);
89
- add(`--- ${contextRange(hunk.newStart, hunk.newCount, outputOffset)}${normal ? " -----" : " ----"}
90
- `);
91
- for (const line of newLines) add(line);
92
- }
93
- }
94
- return output.join("");
95
- }
96
-
97
- export {
98
- rejectText
99
- };
@@ -1,326 +0,0 @@
1
- // packages/safe-bash-command-patch/src/patch-publication.ts
2
- import { compareCopyIdentity } from "../../safe-bash-contracts/filesystem-identity.js";
3
- import { retainFileSystemCleanup } from "@poe-platform/safe-fs/core";
4
- import { dirname, FsError, isFsError } from "../../safe-bash-contracts/index.js";
5
- import { host as host2, ToolError as ToolError2 } from "../../safe-bash-diff-engine/shared.js";
6
-
7
- // packages/safe-bash-command-patch/src/stored-target.ts
8
- import { PagedStorage } from "@poe-platform/safe-fs/storage";
9
- import { IndexedDocument, closeDocumentResources } from "../../safe-bash-diff-engine/document.js";
10
- import { ToolError, host } from "../../safe-bash-diff-engine/shared.js";
11
- async function* targetBytes(line) {
12
- if (typeof line !== "string") {
13
- const range = await line.document.line(line.index);
14
- yield* line.document.range(range.start, range.end);
15
- return;
16
- }
17
- for (let start = 0; start < line.length; ) {
18
- let end = Math.min(start + 4096, line.length);
19
- const last = line.charCodeAt(end - 1);
20
- if (end < line.length && last >= 55296 && last <= 56319) end--;
21
- yield new TextEncoder().encode(line.slice(start, end));
22
- start = end;
23
- }
24
- }
25
- async function* normalized(line, whitespace) {
26
- if (!whitespace) {
27
- yield* targetBytes(line);
28
- return;
29
- }
30
- let pending = false, cr = false;
31
- let output = [];
32
- for await (const block of targetBytes(line)) {
33
- for (const byte of block) {
34
- if (cr) {
35
- if (byte !== 10 && pending) output.push(32);
36
- output.push(13);
37
- cr = false;
38
- pending = false;
39
- }
40
- if (byte === 32 || byte === 9) pending = true;
41
- else if (byte === 13 && pending) cr = true;
42
- else {
43
- if (pending && byte !== 10) output.push(32);
44
- pending = false;
45
- output.push(byte);
46
- }
47
- if (output.length >= 4096) {
48
- yield Uint8Array.from(output);
49
- output = [];
50
- }
51
- }
52
- }
53
- if (cr) output.push(32, 13);
54
- if (output.length) yield Uint8Array.from(output);
55
- }
56
- async function equalTargetLines(left, right, budget, whitespace = false) {
57
- const a = normalized(left, whitespace)[Symbol.asyncIterator]();
58
- const b = normalized(right, whitespace)[Symbol.asyncIterator]();
59
- try {
60
- let x = await a.next(), y = await b.next(), i = 0, j = 0;
61
- while (!x.done && !y.done) {
62
- const count = Math.min(x.value.length - i, y.value.length - j);
63
- budget.step(count);
64
- for (let k = 0; k < count; k++) if (x.value[i + k] !== y.value[j + k]) return false;
65
- i += count;
66
- j += count;
67
- if (i === x.value.length) {
68
- x = await a.next();
69
- i = 0;
70
- }
71
- if (j === y.value.length) {
72
- y = await b.next();
73
- j = 0;
74
- }
75
- const checkpoint = budget.checkpoint();
76
- if (checkpoint) await checkpoint;
77
- }
78
- return !!x.done && !!y.done;
79
- } finally {
80
- await a.return?.();
81
- await b.return?.();
82
- }
83
- }
84
- var TargetDocuments = class {
85
- constructor(budget) {
86
- this.budget = budget;
87
- }
88
- budget;
89
- documents = /* @__PURE__ */ new Set();
90
- async load(source) {
91
- const document = new IndexedDocument(this.budget, 2);
92
- this.documents.add(document);
93
- await document.load(source);
94
- if (document.binary) throw new ToolError("binary input is unsupported (NUL byte)");
95
- if (!document.validUtf8) throw new ToolError("binary input is unsupported (invalid UTF-8)");
96
- return document;
97
- }
98
- async read(path) {
99
- const iterator = this.budget.diffSource(path);
100
- const context = this.budget.context;
101
- return this.load({ async *[Symbol.asyncIterator]() {
102
- try {
103
- for (; ; ) {
104
- const next = await host(context, () => iterator.next());
105
- if (next.done) break;
106
- yield next.value;
107
- }
108
- } finally {
109
- const closed = iterator.return(void 0);
110
- if (context.signal.aborted) void closed.catch(() => {
111
- });
112
- else await closed;
113
- }
114
- } });
115
- }
116
- async concat(left, right) {
117
- return this.load({ async *[Symbol.asyncIterator]() {
118
- yield* left.range(0, left.size);
119
- yield* right.range(0, right.size);
120
- } });
121
- }
122
- async release(document) {
123
- await document.close();
124
- this.documents.delete(document);
125
- }
126
- close() {
127
- return closeDocumentResources([...this.documents]);
128
- }
129
- };
130
- var TargetOutput = class {
131
- constructor(documents) {
132
- this.documents = documents;
133
- this.data = new PagedStorage(documents.budget.context, 2);
134
- }
135
- documents;
136
- data;
137
- size = 0;
138
- unterminated = false;
139
- length = 0;
140
- async append(line) {
141
- if (this.unterminated) await this.write(new Uint8Array([10]));
142
- this.unterminated = false;
143
- for await (const bytes of targetBytes(line)) {
144
- await this.write(bytes);
145
- this.unterminated = bytes.at(-1) !== 10;
146
- }
147
- this.length++;
148
- }
149
- async write(bytes) {
150
- this.size += bytes.length;
151
- if (this.size > this.documents.budget.limits.maxOutputBytes) throw new ToolError("output byte limit exceeded");
152
- await this.data.append(bytes);
153
- }
154
- async finish() {
155
- const data = this.data, size = this.size;
156
- this.documents.budget.outputLength(size);
157
- return this.documents.load({ async *[Symbol.asyncIterator]() {
158
- for (let offset = 0; offset < size; offset += 16384) yield await data.read(8 + offset, Math.min(16384, size - offset));
159
- } });
160
- }
161
- close() {
162
- return this.data.close();
163
- }
164
- };
165
-
166
- // packages/safe-bash-command-patch/src/patch-publication.ts
167
- import { readBytes } from "../../safe-bash-contracts/index.js";
168
- var PatchPublication = class {
169
- constructor(context, trusted = false) {
170
- this.context = context;
171
- this.trusted = trusted;
172
- }
173
- context;
174
- trusted;
175
- directories = /* @__PURE__ */ new Map();
176
- removals = /* @__PURE__ */ new Map();
177
- pruning = /* @__PURE__ */ new Map();
178
- async capture(path, prune = []) {
179
- const paths = [];
180
- for (let parent = dirname(path); ; parent = dirname(parent)) {
181
- paths.unshift(parent);
182
- if (parent === "/") break;
183
- }
184
- for (const parent of paths) {
185
- if (this.directories.has(parent)) continue;
186
- let stat;
187
- try {
188
- stat = await host2(this.context, () => this.context.fs.lstat(parent, { signal: this.context.signal }));
189
- } catch (error) {
190
- if (isFsError(error, "ENOENT")) break;
191
- throw error;
192
- }
193
- if (stat.type !== "directory") throw new ToolError2(`unsafe patch parent: ${parent}`);
194
- this.directories.set(parent, stat);
195
- }
196
- if (this.trusted) return;
197
- if (this.directories.has(dirname(path)) && !this.removals.has(path)) {
198
- this.removals.set(path, await host2(this.context, () => this.context.fs.confineExtraction([dirname(path)], { signal: this.context.signal })));
199
- }
200
- const parents = prune.filter((parent) => this.directories.has(parent) && !this.pruning.has(parent));
201
- if (this.directories.has(dirname(path)) && parents.length) {
202
- const view = await host2(this.context, () => this.context.fs.confineExtraction([dirname(path), parents.at(-1)], { signal: this.context.signal }));
203
- for (const parent of parents) this.pruning.set(parent, view);
204
- }
205
- }
206
- async validate(path) {
207
- const parents = [];
208
- for (let parent = dirname(path); ; parent = dirname(parent)) {
209
- parents.unshift(parent);
210
- if (parent === "/") break;
211
- }
212
- for (const parent of parents) {
213
- const expected = this.directories.get(parent);
214
- const current = await host2(this.context, () => this.context.fs.lstat(parent, { signal: this.context.signal }));
215
- if (current.type !== "directory" || compareCopyIdentity(current, expected) !== "same") {
216
- throw new FsError("EAGAIN", { syscall: "patch", path: parent });
217
- }
218
- }
219
- }
220
- async mkdir(path) {
221
- await this.capture(path);
222
- await this.validate(path);
223
- const stat = await host2(this.context, () => this.context.fs.prepareDirectory(path, {
224
- parent: this.directories.get(dirname(path)),
225
- expected: null,
226
- signal: this.context.signal
227
- }));
228
- this.directories.set(path, stat);
229
- }
230
- async write(path, source, destination, mode, mtimeMs) {
231
- await this.capture(path);
232
- const ancestors = [];
233
- for (let parent2 = dirname(path); ; parent2 = dirname(parent2)) {
234
- const stat = this.directories.get(parent2);
235
- if (!stat) throw new ToolError2(`patch parent does not exist: ${parent2}`);
236
- ancestors.unshift({ path: parent2, stat });
237
- if (parent2 === "/") break;
238
- }
239
- const context = this.context;
240
- const parent = ancestors[ancestors.length - 1].stat;
241
- let staging;
242
- let operation;
243
- let closed = false;
244
- const release = retainFileSystemCleanup(context.fs, async (view) => {
245
- await operation?.catch(() => {
246
- });
247
- if (staging?.cleanup) await staging.cleanup.remove();
248
- else if (staging) await view.removeStagedFile(staging);
249
- }, { maxOperations: 1 });
250
- const cleanup = () => {
251
- closed = true;
252
- return release();
253
- };
254
- context.registerCleanup?.(cleanup);
255
- try {
256
- operation = Promise.resolve().then(async () => {
257
- context.signal.throwIfAborted();
258
- if (closed) throw new ToolError2("patch publication is closed");
259
- if (this.trusted) await this.validate(path);
260
- staging = await context.fs.createStagedFile(`${dirname(path) === "/" ? "" : dirname(path)}/.patch-${globalThis.crypto.randomUUID()}`, "file", {
261
- type: "file",
262
- data: new Uint8Array()
263
- }, {
264
- parent,
265
- retainCleanup: true,
266
- signal: context.signal,
267
- ...mode === void 0 ? {} : { mode },
268
- ...mtimeMs === void 0 ? {} : { atimeMs: mtimeMs, mtimeMs }
269
- });
270
- if (!staging.writer || !staging.cleanup) throw new ToolError2("filesystem does not support retained staging writes");
271
- for await (const bytes of readBytes(typeof source === "string" ? targetBytes(source) : source, context.signal)) {
272
- if (closed) throw new ToolError2("patch publication is closed");
273
- await staging.writer.write(bytes, { signal: context.signal });
274
- }
275
- const stat = await staging.writer.finish({ signal: context.signal });
276
- context.signal.throwIfAborted();
277
- if (closed) throw new ToolError2("patch publication is closed");
278
- if (this.trusted) await this.validate(path);
279
- await context.fs.publishStagedFile({ ...staging, file: { ...staging.file, stat } }, path, {
280
- parent,
281
- destination: destination ?? null,
282
- ...this.trusted ? {} : { ancestors },
283
- signal: context.signal
284
- });
285
- });
286
- await host2(context, () => operation);
287
- } finally {
288
- await cleanup();
289
- }
290
- }
291
- async remove(path, expected) {
292
- if (this.trusted) {
293
- await this.validate(path);
294
- await host2(this.context, () => this.context.fs.removeFileConditional(path, {
295
- parent: this.directories.get(dirname(path)),
296
- expected,
297
- signal: this.context.signal
298
- }));
299
- return;
300
- }
301
- const fs = this.removals.get(path);
302
- if (!fs) throw new ToolError2(`patch removal was not admitted: ${path}`);
303
- await host2(this.context, () => fs.rm(path, { signal: this.context.signal }));
304
- }
305
- async prune(path) {
306
- if (this.trusted) {
307
- await this.validate(`${path}/.patch-prune`);
308
- if (!this.context.fs.rmdir) throw new FsError("ENOTSUP", { syscall: "rmdir", path });
309
- await host2(this.context, () => this.context.fs.rmdir(path, { signal: this.context.signal }));
310
- this.directories.delete(path);
311
- return;
312
- }
313
- const fs = this.pruning.get(path);
314
- if (!fs) throw new ToolError2(`patch directory pruning was not admitted: ${path}`);
315
- if (!fs.rmdir) throw new FsError("ENOTSUP", { syscall: "rmdir", path });
316
- await host2(this.context, () => fs.rmdir(path, { signal: this.context.signal }));
317
- }
318
- };
319
-
320
- export {
321
- targetBytes,
322
- equalTargetLines,
323
- TargetDocuments,
324
- TargetOutput,
325
- PatchPublication
326
- };