@struktoai/mirage-node 0.0.3 → 0.0.5-alpha.1

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 (465) hide show
  1. package/README.md +2 -1
  2. package/dist/aliyun-S62BR3TB.js +11 -0
  3. package/dist/append.lua +17 -0
  4. package/dist/backblaze-4EKSW63F.js +11 -0
  5. package/dist/box-ZPLZAGMK.js +8 -0
  6. package/dist/cas.lua +15 -0
  7. package/dist/ceph-ALKLD3MO.js +11 -0
  8. package/dist/{chunk-QCZ2XUKH.js → chunk-2A4YGVBM.js} +16 -23
  9. package/dist/chunk-2A4YGVBM.js.map +1 -0
  10. package/dist/chunk-2HCYLVGY.js +28 -0
  11. package/dist/chunk-2HCYLVGY.js.map +1 -0
  12. package/dist/chunk-2VPZAH5Q.js +20 -0
  13. package/dist/chunk-2VPZAH5Q.js.map +1 -0
  14. package/dist/{chunk-UT2OPSN4.js → chunk-3JZQ6VSZ.js} +5 -5
  15. package/dist/chunk-3JZQ6VSZ.js.map +1 -0
  16. package/dist/chunk-4IF4TGAI.js +11 -0
  17. package/dist/chunk-4IF4TGAI.js.map +1 -0
  18. package/dist/{chunk-47AVIIOT.js → chunk-5H6KNEPP.js} +4 -5
  19. package/dist/{chunk-47AVIIOT.js.map → chunk-5H6KNEPP.js.map} +1 -1
  20. package/dist/{chunk-I5THIMPP.js → chunk-5K2MWDCE.js} +6 -7
  21. package/dist/{chunk-I5THIMPP.js.map → chunk-5K2MWDCE.js.map} +1 -1
  22. package/dist/{chunk-3WIO7NBR.js → chunk-6SVXWRKX.js} +4 -5
  23. package/dist/{chunk-3WIO7NBR.js.map → chunk-6SVXWRKX.js.map} +1 -1
  24. package/dist/{chunk-RQK5UPMP.js → chunk-6VOIUGAD.js} +25 -12
  25. package/dist/chunk-6VOIUGAD.js.map +1 -0
  26. package/dist/{chunk-NOHWIBRX.js → chunk-7JYHFXXC.js} +15 -20
  27. package/dist/chunk-7JYHFXXC.js.map +1 -0
  28. package/dist/chunk-7VQQFWV6.js +20 -0
  29. package/dist/chunk-7VQQFWV6.js.map +1 -0
  30. package/dist/chunk-7ZP6TPHX.js +87 -0
  31. package/dist/chunk-7ZP6TPHX.js.map +1 -0
  32. package/dist/{chunk-SWCDFEUK.js → chunk-ADEXNSYU.js} +20 -22
  33. package/dist/chunk-ADEXNSYU.js.map +1 -0
  34. package/dist/chunk-AQSYAXL4.js +16 -0
  35. package/dist/chunk-AQSYAXL4.js.map +1 -0
  36. package/dist/{chunk-RO5IQEDQ.js → chunk-ATLXMNKD.js} +8 -4
  37. package/dist/chunk-ATLXMNKD.js.map +1 -0
  38. package/dist/{chunk-MPCCRRE6.js → chunk-BYCUGFRF.js} +16 -16
  39. package/dist/chunk-BYCUGFRF.js.map +1 -0
  40. package/dist/{chunk-HJJMP6IX.js → chunk-BZTVYOES.js} +3 -3
  41. package/dist/{chunk-B2ZOKNN4.js → chunk-CRC4YWXB.js} +27 -9
  42. package/dist/chunk-CRC4YWXB.js.map +1 -0
  43. package/dist/chunk-CTGXJHO5.js +39 -0
  44. package/dist/chunk-CTGXJHO5.js.map +1 -0
  45. package/dist/{chunk-Q2IAILVC.js → chunk-DCDBIXVZ.js} +14 -5
  46. package/dist/chunk-DCDBIXVZ.js.map +1 -0
  47. package/dist/chunk-DDAFNROK.js +750 -0
  48. package/dist/chunk-DDAFNROK.js.map +1 -0
  49. package/dist/chunk-DQIEWEAW.js +85 -0
  50. package/dist/chunk-DQIEWEAW.js.map +1 -0
  51. package/dist/{chunk-QGRDPSAH.js → chunk-EBI4IHDC.js} +23 -12
  52. package/dist/chunk-EBI4IHDC.js.map +1 -0
  53. package/dist/{chunk-JAGJTM3Q.js → chunk-EIUTZ6N7.js} +19 -34
  54. package/dist/chunk-EIUTZ6N7.js.map +1 -0
  55. package/dist/{chunk-TA3WMOMU.js → chunk-EJZG5VUF.js} +38 -32
  56. package/dist/chunk-EJZG5VUF.js.map +1 -0
  57. package/dist/{chunk-X5HF2OFP.js → chunk-ENW5BVYN.js} +3 -3
  58. package/dist/{chunk-HGCRXJGP.js → chunk-ETIAW4YD.js} +3 -3
  59. package/dist/chunk-EUPXAYPB.js +20 -0
  60. package/dist/chunk-EUPXAYPB.js.map +1 -0
  61. package/dist/{chunk-YAHRT6MB.js → chunk-FA6YNU75.js} +4 -5
  62. package/dist/{chunk-YAHRT6MB.js.map → chunk-FA6YNU75.js.map} +1 -1
  63. package/dist/{chunk-TWGVQLG2.js → chunk-FFH6R5VQ.js} +7 -3
  64. package/dist/chunk-FFH6R5VQ.js.map +1 -0
  65. package/dist/{chunk-JCC4CU2I.js → chunk-GE6H2COM.js} +15 -23
  66. package/dist/chunk-GE6H2COM.js.map +1 -0
  67. package/dist/{chunk-DM4GSE26.js → chunk-GMMQ3ZK4.js} +3 -3
  68. package/dist/{chunk-ZEGAMJO2.js → chunk-GSGE3M5P.js} +15 -23
  69. package/dist/chunk-GSGE3M5P.js.map +1 -0
  70. package/dist/{chunk-GCFYZSVR.js → chunk-H64SB6VO.js} +32 -13
  71. package/dist/chunk-H64SB6VO.js.map +1 -0
  72. package/dist/{chunk-N5FSLVKO.js → chunk-HCRYAFBI.js} +3 -3
  73. package/dist/{chunk-IDYHQQOH.js → chunk-HOPUP6LA.js} +358 -471
  74. package/dist/chunk-HOPUP6LA.js.map +1 -0
  75. package/dist/chunk-HS24BL6W.js +160 -0
  76. package/dist/chunk-HS24BL6W.js.map +1 -0
  77. package/dist/chunk-HVYVG5KQ.js +16 -0
  78. package/dist/chunk-HVYVG5KQ.js.map +1 -0
  79. package/dist/{chunk-FQ33BYFR.js → chunk-I7CPLZNW.js} +4 -5
  80. package/dist/{chunk-FQ33BYFR.js.map → chunk-I7CPLZNW.js.map} +1 -1
  81. package/dist/{chunk-VGLHY6BK.js → chunk-IFUCGI4I.js} +7 -3
  82. package/dist/chunk-IFUCGI4I.js.map +1 -0
  83. package/dist/{chunk-RNQN2FOU.js → chunk-IFYXSSKR.js} +24 -13
  84. package/dist/chunk-IFYXSSKR.js.map +1 -0
  85. package/dist/chunk-IXA4DQE4.js +20 -0
  86. package/dist/chunk-IXA4DQE4.js.map +1 -0
  87. package/dist/chunk-IZMKMD3O.js +11 -0
  88. package/dist/chunk-IZMKMD3O.js.map +1 -0
  89. package/dist/{chunk-7CW3BMPH.js → chunk-JJERW2BI.js} +4 -5
  90. package/dist/{chunk-7CW3BMPH.js.map → chunk-JJERW2BI.js.map} +1 -1
  91. package/dist/{chunk-EM4J5EQS.js → chunk-JQR4HVUX.js} +13 -16
  92. package/dist/chunk-JQR4HVUX.js.map +1 -0
  93. package/dist/{chunk-VWKUT4CW.js → chunk-JXOMDLFS.js} +21 -26
  94. package/dist/chunk-JXOMDLFS.js.map +1 -0
  95. package/dist/chunk-KIX6N7NT.js +1001 -0
  96. package/dist/chunk-KIX6N7NT.js.map +1 -0
  97. package/dist/{chunk-OZAEWZZ3.js → chunk-L42UTDFK.js} +12 -3
  98. package/dist/chunk-L42UTDFK.js.map +1 -0
  99. package/dist/{chunk-54NTYJEO.js → chunk-LPDLPRPS.js} +1 -3
  100. package/dist/{chunk-54NTYJEO.js.map → chunk-LPDLPRPS.js.map} +1 -1
  101. package/dist/chunk-M2UF2JHJ.js +11 -0
  102. package/dist/chunk-M2UF2JHJ.js.map +1 -0
  103. package/dist/{chunk-UGK4TAVK.js → chunk-MONC734W.js} +7 -3
  104. package/dist/chunk-MONC734W.js.map +1 -0
  105. package/dist/{chunk-IK2L4EN3.js → chunk-N72RLCMU.js} +4 -5
  106. package/dist/{chunk-IK2L4EN3.js.map → chunk-N72RLCMU.js.map} +1 -1
  107. package/dist/{chunk-H3I2KZIY.js → chunk-ND4IWJ4V.js} +7 -3
  108. package/dist/chunk-ND4IWJ4V.js.map +1 -0
  109. package/dist/chunk-NZ3EKGW4.js +1312 -0
  110. package/dist/chunk-NZ3EKGW4.js.map +1 -0
  111. package/dist/{chunk-XGJ2QERC.js → chunk-OAE57MNL.js} +27 -11
  112. package/dist/chunk-OAE57MNL.js.map +1 -0
  113. package/dist/{chunk-EZQ5HBAC.js → chunk-OHKGIQB4.js} +12 -16
  114. package/dist/chunk-OHKGIQB4.js.map +1 -0
  115. package/dist/{chunk-E2ISWXLB.js → chunk-OQKNDS66.js} +1 -1
  116. package/dist/{chunk-E2ISWXLB.js.map → chunk-OQKNDS66.js.map} +1 -1
  117. package/dist/{chunk-UINQOUZR.js → chunk-OXEQSPND.js} +3 -3
  118. package/dist/{chunk-A7IVFIOP.js → chunk-PKNE5J2B.js} +15 -23
  119. package/dist/chunk-PKNE5J2B.js.map +1 -0
  120. package/dist/chunk-PSXXEGYQ.js +16 -0
  121. package/dist/chunk-PSXXEGYQ.js.map +1 -0
  122. package/dist/{chunk-EGB7V74Z.js → chunk-QAOVABCR.js} +7 -4
  123. package/dist/chunk-QAOVABCR.js.map +1 -0
  124. package/dist/{chunk-X3G37FXT.js → chunk-QQ7FP4GD.js} +4 -5
  125. package/dist/{chunk-X3G37FXT.js.map → chunk-QQ7FP4GD.js.map} +1 -1
  126. package/dist/{chunk-WAR4Q2NM.js → chunk-QYLVMC6B.js} +13 -15
  127. package/dist/chunk-QYLVMC6B.js.map +1 -0
  128. package/dist/{chunk-KPULTUOK.js → chunk-RX3XR65X.js} +4 -5
  129. package/dist/{chunk-KPULTUOK.js.map → chunk-RX3XR65X.js.map} +1 -1
  130. package/dist/chunk-RYQJJB4C.js +30 -0
  131. package/dist/chunk-RYQJJB4C.js.map +1 -0
  132. package/dist/{chunk-QQBJC2FQ.js → chunk-TUF7TCN7.js} +4 -5
  133. package/dist/{chunk-QQBJC2FQ.js.map → chunk-TUF7TCN7.js.map} +1 -1
  134. package/dist/{chunk-AUHSTJJ3.js → chunk-TUX36JY5.js} +4 -5
  135. package/dist/{chunk-AUHSTJJ3.js.map → chunk-TUX36JY5.js.map} +1 -1
  136. package/dist/chunk-TWRQCQWU.js +1153 -0
  137. package/dist/chunk-TWRQCQWU.js.map +1 -0
  138. package/dist/chunk-U6DFQRG3.js +20 -0
  139. package/dist/chunk-U6DFQRG3.js.map +1 -0
  140. package/dist/chunk-VI5YTKNY.js +20 -0
  141. package/dist/chunk-VI5YTKNY.js.map +1 -0
  142. package/dist/chunk-WG5YS6TC.js +872 -0
  143. package/dist/chunk-WG5YS6TC.js.map +1 -0
  144. package/dist/{chunk-ZGSER5TG.js → chunk-WMJJ4WGF.js} +4 -5
  145. package/dist/{chunk-ZGSER5TG.js.map → chunk-WMJJ4WGF.js.map} +1 -1
  146. package/dist/{chunk-LV2G7VHL.js → chunk-WY4FNH42.js} +21 -18
  147. package/dist/chunk-WY4FNH42.js.map +1 -0
  148. package/dist/{chunk-LAJJPLEV.js → chunk-XIG5BWWH.js} +25 -12
  149. package/dist/chunk-XIG5BWWH.js.map +1 -0
  150. package/dist/chunk-XJBC3OYX.js +11 -0
  151. package/dist/chunk-XJBC3OYX.js.map +1 -0
  152. package/dist/{chunk-G2WCEUQL.js → chunk-XPRDXWK7.js} +21 -20
  153. package/dist/chunk-XPRDXWK7.js.map +1 -0
  154. package/dist/chunk-YKRQSZS7.js +96 -0
  155. package/dist/chunk-YKRQSZS7.js.map +1 -0
  156. package/dist/{chunk-M5FVUIYP.js → chunk-YMBL3VJB.js} +21 -19
  157. package/dist/chunk-YMBL3VJB.js.map +1 -0
  158. package/dist/chunk-YUJBXFYK.js +1205 -0
  159. package/dist/chunk-YUJBXFYK.js.map +1 -0
  160. package/dist/{chunk-JALIYI6M.js → chunk-YZ4ZJNOL.js} +28 -11
  161. package/dist/chunk-YZ4ZJNOL.js.map +1 -0
  162. package/dist/chunk-ZTHVEXIV.js +11 -0
  163. package/dist/chunk-ZTHVEXIV.js.map +1 -0
  164. package/dist/{chunk-GS5AUKUO.js → chunk-ZVSYUCYS.js} +11 -7
  165. package/dist/chunk-ZVSYUCYS.js.map +1 -0
  166. package/dist/{config-QAA646XB.js → config-2YBCHU2W.js} +2 -4
  167. package/dist/{config-IVY5EQQ2.js → config-3YRGRW72.js} +3 -4
  168. package/dist/config-4GSOMUMF.js +9 -0
  169. package/dist/config-5YBUWFUP.js +9 -0
  170. package/dist/{config-34LHOGLM.js → config-5ZRKJTKG.js} +3 -4
  171. package/dist/config-A25LTL5W.js +11 -0
  172. package/dist/config-CLU7JABG.js +9 -0
  173. package/dist/config-D2RF7L3N.js +9 -0
  174. package/dist/{config-LHFFXVYI.js → config-E55TKM6K.js} +2 -4
  175. package/dist/config-ELDOFRJW.js +9 -0
  176. package/dist/{config-GE4W4ZJC.js → config-FPC3RBFD.js} +2 -4
  177. package/dist/config-FPM3LAW7.js +9 -0
  178. package/dist/{config-HKRMKD76.js → config-G3F54CS4.js} +3 -4
  179. package/dist/config-G43HRUI3.js +9 -0
  180. package/dist/{config-WDAZFXYD.js → config-GG3WO5PB.js} +3 -4
  181. package/dist/config-JUYBWAZE.js +9 -0
  182. package/dist/{config-CVZ2AGCO.js → config-LJ5T6TVA.js} +2 -6
  183. package/dist/config-MDSAE4O3.js +11 -0
  184. package/dist/{config-EIHSP5DZ.js → config-NRIOKK5T.js} +2 -4
  185. package/dist/config-OYK2BSJK.js +9 -0
  186. package/dist/config-PB3KA2CE.js +9 -0
  187. package/dist/{config-ZFJYQZCH.js → config-QY4IL3PH.js} +3 -4
  188. package/dist/config-R4LAOEDS.js +9 -0
  189. package/dist/{config-QNMKWJ4M.js → config-RIAAD6RW.js} +3 -4
  190. package/dist/config-SYNEQAUB.js +9 -0
  191. package/dist/{config-Q45Y46YT.js → config-TJKGYA2B.js} +3 -4
  192. package/dist/{config-NV5WXP64.js → config-UU27ALAA.js} +2 -4
  193. package/dist/{config-3IVQJBNW.js → config-UURRGA7U.js} +2 -2
  194. package/dist/{config-VM526IKB.js → config-VPLHQXVE.js} +2 -4
  195. package/dist/config-WRACCRPN.js +9 -0
  196. package/dist/{config-GHRUKEQ6.js → config-WVHKXEVE.js} +3 -4
  197. package/dist/{config-EO23EY62.js → config-XU7R36IE.js} +3 -4
  198. package/dist/config-Y2KOUYSS.js +9 -0
  199. package/dist/databricks_volume-CNCPTZHS.js +7 -0
  200. package/dist/digitalocean-DJZOUB6Q.js +11 -0
  201. package/dist/discord-ETB2CADR.js +7 -0
  202. package/dist/disk-WEHSTK3F.js +7 -0
  203. package/dist/dropbox-XN6PGLNE.js +8 -0
  204. package/dist/email-OV7XCP3T.js +8 -0
  205. package/dist/gcal-P56MRCGU.js +8 -0
  206. package/dist/gcs-HFBIAE2C.js +10 -0
  207. package/dist/gdocs-LQ3UXP3J.js +8 -0
  208. package/dist/gdrive-N6UBYLON.js +8 -0
  209. package/dist/github-BPZREGPI.js +8 -0
  210. package/dist/github_ci-7A4LUIZ7.js +8 -0
  211. package/dist/gmail-YED2MF6H.js +8 -0
  212. package/dist/gridfs-CPLQ4G62.js +9 -0
  213. package/dist/gsheets-4BNIJPQ6.js +8 -0
  214. package/dist/gslides-GDBYLO5A.js +8 -0
  215. package/dist/hf_buckets-FTJITQ3P.js +10 -0
  216. package/dist/hf_datasets-6GXVKQD7.js +10 -0
  217. package/dist/hf_models-PJPGZAC5.js +10 -0
  218. package/dist/hf_spaces-LFNFOLBF.js +10 -0
  219. package/dist/index.d.ts +1311 -569
  220. package/dist/index.js +3359 -964
  221. package/dist/index.js.map +1 -1
  222. package/dist/jaeger-GCA6MJ6E.js +8 -0
  223. package/dist/lancedb-TJ5YSJY5.js +7 -0
  224. package/dist/langfuse-RUMTUMXS.js +8 -0
  225. package/dist/linear-BCE4KEAC.js +7 -0
  226. package/dist/minio-5SO6KBTK.js +11 -0
  227. package/dist/mongodb-L5CMN2EE.js +7 -0
  228. package/dist/nextcloud-4O2LZVW2.js +9 -0
  229. package/dist/notion-RVKEAQ2M.js +7 -0
  230. package/dist/oci-OQXOIC62.js +10 -0
  231. package/dist/postgres-AV45GNRS.js +7 -0
  232. package/dist/qingstor-W277YA4K.js +11 -0
  233. package/dist/r2-FUA4IORE.js +10 -0
  234. package/dist/redis-LPS357NF.js +8 -0
  235. package/dist/s3-FPNWWIVM.js +8 -0
  236. package/dist/scaleway-BP3732U7.js +11 -0
  237. package/dist/seaweedfs-MC6HIEP4.js +11 -0
  238. package/dist/slack-JFGW7VLN.js +7 -0
  239. package/dist/ssh-UYPG42LM.js +8 -0
  240. package/dist/ssh-UYPG42LM.js.map +1 -0
  241. package/dist/supabase-A3KUFMDC.js +10 -0
  242. package/dist/supabase-A3KUFMDC.js.map +1 -0
  243. package/dist/tencent-5464UQ2X.js +11 -0
  244. package/dist/tencent-5464UQ2X.js.map +1 -0
  245. package/dist/trello-O2KB3FUO.js +8 -0
  246. package/dist/trello-O2KB3FUO.js.map +1 -0
  247. package/dist/wasabi-2IKBIWNO.js +10 -0
  248. package/dist/wasabi-2IKBIWNO.js.map +1 -0
  249. package/package.json +17 -3
  250. package/dist/aliyun-JMJ3PFYY.js +0 -10
  251. package/dist/backblaze-TDFD23QO.js +0 -10
  252. package/dist/box-GQ2U2R6R.js +0 -8
  253. package/dist/ceph-S2VOYO6G.js +0 -10
  254. package/dist/chunk-2CC5VW7K.js +0 -52
  255. package/dist/chunk-2CC5VW7K.js.map +0 -1
  256. package/dist/chunk-A7IVFIOP.js.map +0 -1
  257. package/dist/chunk-B2ZOKNN4.js.map +0 -1
  258. package/dist/chunk-DNBAMB5J.js +0 -18
  259. package/dist/chunk-DNBAMB5J.js.map +0 -1
  260. package/dist/chunk-DP2PP5V2.js +0 -26
  261. package/dist/chunk-DP2PP5V2.js.map +0 -1
  262. package/dist/chunk-DYXEITK3.js +0 -52
  263. package/dist/chunk-DYXEITK3.js.map +0 -1
  264. package/dist/chunk-EGB7V74Z.js.map +0 -1
  265. package/dist/chunk-EM4J5EQS.js.map +0 -1
  266. package/dist/chunk-EZQ5HBAC.js.map +0 -1
  267. package/dist/chunk-G2WCEUQL.js.map +0 -1
  268. package/dist/chunk-GCFYZSVR.js.map +0 -1
  269. package/dist/chunk-GS5AUKUO.js.map +0 -1
  270. package/dist/chunk-H3BST2LI.js +0 -26
  271. package/dist/chunk-H3BST2LI.js.map +0 -1
  272. package/dist/chunk-H3I2KZIY.js.map +0 -1
  273. package/dist/chunk-IDYHQQOH.js.map +0 -1
  274. package/dist/chunk-JAGJTM3Q.js.map +0 -1
  275. package/dist/chunk-JALIYI6M.js.map +0 -1
  276. package/dist/chunk-JCC4CU2I.js.map +0 -1
  277. package/dist/chunk-JZT4QGIP.js +0 -24
  278. package/dist/chunk-JZT4QGIP.js.map +0 -1
  279. package/dist/chunk-LAJJPLEV.js.map +0 -1
  280. package/dist/chunk-LV2G7VHL.js.map +0 -1
  281. package/dist/chunk-LW25LMIH.js +0 -26
  282. package/dist/chunk-LW25LMIH.js.map +0 -1
  283. package/dist/chunk-M5FVUIYP.js.map +0 -1
  284. package/dist/chunk-MPCCRRE6.js.map +0 -1
  285. package/dist/chunk-NJMGCT63.js +0 -54
  286. package/dist/chunk-NJMGCT63.js.map +0 -1
  287. package/dist/chunk-NOHWIBRX.js.map +0 -1
  288. package/dist/chunk-OHROA3FQ.js +0 -54
  289. package/dist/chunk-OHROA3FQ.js.map +0 -1
  290. package/dist/chunk-OPYQ5KIO.js +0 -52
  291. package/dist/chunk-OPYQ5KIO.js.map +0 -1
  292. package/dist/chunk-OZAEWZZ3.js.map +0 -1
  293. package/dist/chunk-Q2IAILVC.js.map +0 -1
  294. package/dist/chunk-QCZ2XUKH.js.map +0 -1
  295. package/dist/chunk-QGRDPSAH.js.map +0 -1
  296. package/dist/chunk-RNQN2FOU.js.map +0 -1
  297. package/dist/chunk-RO5IQEDQ.js.map +0 -1
  298. package/dist/chunk-RQK5UPMP.js.map +0 -1
  299. package/dist/chunk-S5OVP467.js +0 -1795
  300. package/dist/chunk-S5OVP467.js.map +0 -1
  301. package/dist/chunk-SFUCUARB.js +0 -21
  302. package/dist/chunk-SFUCUARB.js.map +0 -1
  303. package/dist/chunk-SWCDFEUK.js.map +0 -1
  304. package/dist/chunk-TA3WMOMU.js.map +0 -1
  305. package/dist/chunk-TURD42QO.js +0 -1782
  306. package/dist/chunk-TURD42QO.js.map +0 -1
  307. package/dist/chunk-TWGVQLG2.js.map +0 -1
  308. package/dist/chunk-U6QSXTUS.js +0 -7
  309. package/dist/chunk-U6QSXTUS.js.map +0 -1
  310. package/dist/chunk-UGK4TAVK.js.map +0 -1
  311. package/dist/chunk-UT2OPSN4.js.map +0 -1
  312. package/dist/chunk-VGLHY6BK.js.map +0 -1
  313. package/dist/chunk-VWKUT4CW.js.map +0 -1
  314. package/dist/chunk-W7FLHT65.js +0 -26
  315. package/dist/chunk-W7FLHT65.js.map +0 -1
  316. package/dist/chunk-WAR4Q2NM.js.map +0 -1
  317. package/dist/chunk-WHFUWWI6.js +0 -2097
  318. package/dist/chunk-WHFUWWI6.js.map +0 -1
  319. package/dist/chunk-XGJ2QERC.js.map +0 -1
  320. package/dist/chunk-XHCBHYN4.js +0 -54
  321. package/dist/chunk-XHCBHYN4.js.map +0 -1
  322. package/dist/chunk-XLQI4IT2.js +0 -54
  323. package/dist/chunk-XLQI4IT2.js.map +0 -1
  324. package/dist/chunk-XWVDS66D.js +0 -963
  325. package/dist/chunk-XWVDS66D.js.map +0 -1
  326. package/dist/chunk-YGZMVNN5.js +0 -54
  327. package/dist/chunk-YGZMVNN5.js.map +0 -1
  328. package/dist/chunk-YUK3X3B4.js +0 -27
  329. package/dist/chunk-YUK3X3B4.js.map +0 -1
  330. package/dist/chunk-ZEGAMJO2.js.map +0 -1
  331. package/dist/chunk-ZNWVJ6UW.js +0 -54
  332. package/dist/chunk-ZNWVJ6UW.js.map +0 -1
  333. package/dist/config-3BBWD5AB.js +0 -11
  334. package/dist/config-4UDVSUQJ.js +0 -11
  335. package/dist/config-CMDBAPDH.js +0 -11
  336. package/dist/config-D3RLSPNF.js +0 -11
  337. package/dist/config-DG65OEG3.js +0 -11
  338. package/dist/config-GCQK6NJY.js +0 -11
  339. package/dist/config-GVH27UPE.js +0 -11
  340. package/dist/config-HXVYIXP5.js +0 -11
  341. package/dist/config-IDZMEW73.js +0 -11
  342. package/dist/config-IJJXGLBQ.js +0 -11
  343. package/dist/config-KJOLGVB2.js +0 -11
  344. package/dist/config-KMVCVBYN.js +0 -15
  345. package/dist/config-KYTRXAB2.js +0 -15
  346. package/dist/config-OT2TQQCN.js +0 -11
  347. package/dist/config-QWCY3LBQ.js +0 -11
  348. package/dist/config-ZV6G2ZEC.js +0 -11
  349. package/dist/databricks_volume-7XOUYSTY.js +0 -7
  350. package/dist/digitalocean-3CQ4CPPZ.js +0 -10
  351. package/dist/discord-BG7OSRJG.js +0 -8
  352. package/dist/disk-XVLBCVKE.js +0 -8
  353. package/dist/dropbox-74GYLV3R.js +0 -8
  354. package/dist/email-5IZ7OBQ4.js +0 -8
  355. package/dist/gcs-EMEYU2XT.js +0 -10
  356. package/dist/gdocs-R67TDPON.js +0 -8
  357. package/dist/gdrive-PRN2ALRK.js +0 -8
  358. package/dist/github-DV7E6OFV.js +0 -8
  359. package/dist/github_ci-Q554V5PA.js +0 -8
  360. package/dist/gmail-OLN2LT4O.js +0 -8
  361. package/dist/gsheets-H4RYMQJ5.js +0 -8
  362. package/dist/gslides-YLCHKJOM.js +0 -8
  363. package/dist/hf_buckets-DTKXKKFF.js +0 -10
  364. package/dist/hf_datasets-55C4APKR.js +0 -10
  365. package/dist/hf_models-RO5JR36V.js +0 -10
  366. package/dist/hf_spaces-ZVZ3EDRX.js +0 -10
  367. package/dist/langfuse-ACASJZ7O.js +0 -8
  368. package/dist/linear-IC37LZV7.js +0 -8
  369. package/dist/minio-HZ576XFQ.js +0 -10
  370. package/dist/mongodb-JVR62OIO.js +0 -7
  371. package/dist/notion-HKRPQMJS.js +0 -8
  372. package/dist/oci-ZLVECXTW.js +0 -10
  373. package/dist/postgres-P36Z2YN4.js +0 -7
  374. package/dist/qingstor-YLP6K3L4.js +0 -10
  375. package/dist/r2-RPK25ANI.js +0 -10
  376. package/dist/redis-V5ULXULL.js +0 -8
  377. package/dist/s3-4OIOCAAT.js +0 -8
  378. package/dist/scaleway-CCWCLUHB.js +0 -10
  379. package/dist/seaweedfs-QSWKF2FN.js +0 -10
  380. package/dist/slack-YPS7PII3.js +0 -8
  381. package/dist/ssh-YFP3SMTJ.js +0 -9
  382. package/dist/supabase-6CFTOKGZ.js +0 -10
  383. package/dist/tencent-IWZZOSQ4.js +0 -10
  384. package/dist/trello-XYKWZD6P.js +0 -8
  385. package/dist/wasabi-6Z4DC5S5.js +0 -10
  386. /package/dist/{aliyun-JMJ3PFYY.js.map → aliyun-S62BR3TB.js.map} +0 -0
  387. /package/dist/{backblaze-TDFD23QO.js.map → backblaze-4EKSW63F.js.map} +0 -0
  388. /package/dist/{box-GQ2U2R6R.js.map → box-ZPLZAGMK.js.map} +0 -0
  389. /package/dist/{ceph-S2VOYO6G.js.map → ceph-ALKLD3MO.js.map} +0 -0
  390. /package/dist/{chunk-HJJMP6IX.js.map → chunk-BZTVYOES.js.map} +0 -0
  391. /package/dist/{chunk-X5HF2OFP.js.map → chunk-ENW5BVYN.js.map} +0 -0
  392. /package/dist/{chunk-HGCRXJGP.js.map → chunk-ETIAW4YD.js.map} +0 -0
  393. /package/dist/{chunk-DM4GSE26.js.map → chunk-GMMQ3ZK4.js.map} +0 -0
  394. /package/dist/{chunk-N5FSLVKO.js.map → chunk-HCRYAFBI.js.map} +0 -0
  395. /package/dist/{chunk-UINQOUZR.js.map → chunk-OXEQSPND.js.map} +0 -0
  396. /package/dist/{config-34LHOGLM.js.map → config-2YBCHU2W.js.map} +0 -0
  397. /package/dist/{config-3BBWD5AB.js.map → config-3YRGRW72.js.map} +0 -0
  398. /package/dist/{config-3IVQJBNW.js.map → config-4GSOMUMF.js.map} +0 -0
  399. /package/dist/{config-4UDVSUQJ.js.map → config-5YBUWFUP.js.map} +0 -0
  400. /package/dist/{config-CMDBAPDH.js.map → config-5ZRKJTKG.js.map} +0 -0
  401. /package/dist/{config-CVZ2AGCO.js.map → config-A25LTL5W.js.map} +0 -0
  402. /package/dist/{config-D3RLSPNF.js.map → config-CLU7JABG.js.map} +0 -0
  403. /package/dist/{config-DG65OEG3.js.map → config-D2RF7L3N.js.map} +0 -0
  404. /package/dist/{config-EIHSP5DZ.js.map → config-E55TKM6K.js.map} +0 -0
  405. /package/dist/{config-EO23EY62.js.map → config-ELDOFRJW.js.map} +0 -0
  406. /package/dist/{config-GCQK6NJY.js.map → config-FPC3RBFD.js.map} +0 -0
  407. /package/dist/{config-GE4W4ZJC.js.map → config-FPM3LAW7.js.map} +0 -0
  408. /package/dist/{config-GHRUKEQ6.js.map → config-G3F54CS4.js.map} +0 -0
  409. /package/dist/{config-GVH27UPE.js.map → config-G43HRUI3.js.map} +0 -0
  410. /package/dist/{config-HKRMKD76.js.map → config-GG3WO5PB.js.map} +0 -0
  411. /package/dist/{config-HXVYIXP5.js.map → config-JUYBWAZE.js.map} +0 -0
  412. /package/dist/{config-IDZMEW73.js.map → config-LJ5T6TVA.js.map} +0 -0
  413. /package/dist/{config-IJJXGLBQ.js.map → config-MDSAE4O3.js.map} +0 -0
  414. /package/dist/{config-IVY5EQQ2.js.map → config-NRIOKK5T.js.map} +0 -0
  415. /package/dist/{config-KJOLGVB2.js.map → config-OYK2BSJK.js.map} +0 -0
  416. /package/dist/{config-KMVCVBYN.js.map → config-PB3KA2CE.js.map} +0 -0
  417. /package/dist/{config-KYTRXAB2.js.map → config-QY4IL3PH.js.map} +0 -0
  418. /package/dist/{config-LHFFXVYI.js.map → config-R4LAOEDS.js.map} +0 -0
  419. /package/dist/{config-NV5WXP64.js.map → config-RIAAD6RW.js.map} +0 -0
  420. /package/dist/{config-OT2TQQCN.js.map → config-SYNEQAUB.js.map} +0 -0
  421. /package/dist/{config-Q45Y46YT.js.map → config-TJKGYA2B.js.map} +0 -0
  422. /package/dist/{config-QAA646XB.js.map → config-UU27ALAA.js.map} +0 -0
  423. /package/dist/{config-QNMKWJ4M.js.map → config-UURRGA7U.js.map} +0 -0
  424. /package/dist/{config-QWCY3LBQ.js.map → config-VPLHQXVE.js.map} +0 -0
  425. /package/dist/{config-VM526IKB.js.map → config-WRACCRPN.js.map} +0 -0
  426. /package/dist/{config-WDAZFXYD.js.map → config-WVHKXEVE.js.map} +0 -0
  427. /package/dist/{config-ZFJYQZCH.js.map → config-XU7R36IE.js.map} +0 -0
  428. /package/dist/{config-ZV6G2ZEC.js.map → config-Y2KOUYSS.js.map} +0 -0
  429. /package/dist/{databricks_volume-7XOUYSTY.js.map → databricks_volume-CNCPTZHS.js.map} +0 -0
  430. /package/dist/{digitalocean-3CQ4CPPZ.js.map → digitalocean-DJZOUB6Q.js.map} +0 -0
  431. /package/dist/{discord-BG7OSRJG.js.map → discord-ETB2CADR.js.map} +0 -0
  432. /package/dist/{disk-XVLBCVKE.js.map → disk-WEHSTK3F.js.map} +0 -0
  433. /package/dist/{dropbox-74GYLV3R.js.map → dropbox-XN6PGLNE.js.map} +0 -0
  434. /package/dist/{email-5IZ7OBQ4.js.map → email-OV7XCP3T.js.map} +0 -0
  435. /package/dist/{gcs-EMEYU2XT.js.map → gcal-P56MRCGU.js.map} +0 -0
  436. /package/dist/{gdocs-R67TDPON.js.map → gcs-HFBIAE2C.js.map} +0 -0
  437. /package/dist/{gdrive-PRN2ALRK.js.map → gdocs-LQ3UXP3J.js.map} +0 -0
  438. /package/dist/{github-DV7E6OFV.js.map → gdrive-N6UBYLON.js.map} +0 -0
  439. /package/dist/{github_ci-Q554V5PA.js.map → github-BPZREGPI.js.map} +0 -0
  440. /package/dist/{gmail-OLN2LT4O.js.map → github_ci-7A4LUIZ7.js.map} +0 -0
  441. /package/dist/{gsheets-H4RYMQJ5.js.map → gmail-YED2MF6H.js.map} +0 -0
  442. /package/dist/{gslides-YLCHKJOM.js.map → gridfs-CPLQ4G62.js.map} +0 -0
  443. /package/dist/{hf_buckets-DTKXKKFF.js.map → gsheets-4BNIJPQ6.js.map} +0 -0
  444. /package/dist/{hf_datasets-55C4APKR.js.map → gslides-GDBYLO5A.js.map} +0 -0
  445. /package/dist/{hf_models-RO5JR36V.js.map → hf_buckets-FTJITQ3P.js.map} +0 -0
  446. /package/dist/{hf_spaces-ZVZ3EDRX.js.map → hf_datasets-6GXVKQD7.js.map} +0 -0
  447. /package/dist/{langfuse-ACASJZ7O.js.map → hf_models-PJPGZAC5.js.map} +0 -0
  448. /package/dist/{linear-IC37LZV7.js.map → hf_spaces-LFNFOLBF.js.map} +0 -0
  449. /package/dist/{minio-HZ576XFQ.js.map → jaeger-GCA6MJ6E.js.map} +0 -0
  450. /package/dist/{mongodb-JVR62OIO.js.map → lancedb-TJ5YSJY5.js.map} +0 -0
  451. /package/dist/{notion-HKRPQMJS.js.map → langfuse-RUMTUMXS.js.map} +0 -0
  452. /package/dist/{oci-ZLVECXTW.js.map → linear-BCE4KEAC.js.map} +0 -0
  453. /package/dist/{postgres-P36Z2YN4.js.map → minio-5SO6KBTK.js.map} +0 -0
  454. /package/dist/{qingstor-YLP6K3L4.js.map → mongodb-L5CMN2EE.js.map} +0 -0
  455. /package/dist/{r2-RPK25ANI.js.map → nextcloud-4O2LZVW2.js.map} +0 -0
  456. /package/dist/{redis-V5ULXULL.js.map → notion-RVKEAQ2M.js.map} +0 -0
  457. /package/dist/{s3-4OIOCAAT.js.map → oci-OQXOIC62.js.map} +0 -0
  458. /package/dist/{scaleway-CCWCLUHB.js.map → postgres-AV45GNRS.js.map} +0 -0
  459. /package/dist/{seaweedfs-QSWKF2FN.js.map → qingstor-W277YA4K.js.map} +0 -0
  460. /package/dist/{slack-YPS7PII3.js.map → r2-FUA4IORE.js.map} +0 -0
  461. /package/dist/{ssh-YFP3SMTJ.js.map → redis-LPS357NF.js.map} +0 -0
  462. /package/dist/{supabase-6CFTOKGZ.js.map → s3-FPNWWIVM.js.map} +0 -0
  463. /package/dist/{tencent-IWZZOSQ4.js.map → scaleway-BP3732U7.js.map} +0 -0
  464. /package/dist/{trello-XYKWZD6P.js.map → seaweedfs-MC6HIEP4.js.map} +0 -0
  465. /package/dist/{wasabi-6Z4DC5S5.js.map → slack-JFGW7VLN.js.map} +0 -0
@@ -1,2097 +0,0 @@
1
- import {
2
- redactSshConfig
3
- } from "./chunk-UGK4TAVK.js";
4
- import {
5
- SCOPE_ERROR
6
- } from "./chunk-U6QSXTUS.js";
7
-
8
- // src/resource/ssh/ssh.ts
9
- import {
10
- BaseResource,
11
- PathSpec as PathSpec2,
12
- ResourceName as ResourceName75
13
- } from "@struktoai/mirage-core";
14
-
15
- // src/accessor/ssh.ts
16
- import { Accessor } from "@struktoai/mirage-core";
17
- import { homedir } from "os";
18
- import { readFileSync } from "fs";
19
- import { resolve } from "path";
20
- function expandHome(p) {
21
- if (p === "~") return homedir();
22
- if (p.startsWith("~/")) return resolve(homedir(), p.slice(2));
23
- return p;
24
- }
25
- var SSHAccessor = class extends Accessor {
26
- constructor(config) {
27
- super();
28
- this.config = config;
29
- }
30
- config;
31
- client = null;
32
- sftpClient = null;
33
- connectPromise = null;
34
- async sftp() {
35
- if (this.sftpClient !== null) return this.sftpClient;
36
- if (this.connectPromise !== null) return this.connectPromise;
37
- this.connectPromise = this.connect();
38
- try {
39
- return await this.connectPromise;
40
- } finally {
41
- this.connectPromise = null;
42
- }
43
- }
44
- async connect() {
45
- let ssh2Mod;
46
- try {
47
- ssh2Mod = await import("ssh2");
48
- } catch (err) {
49
- const msg = err instanceof Error ? err.message : String(err);
50
- throw new Error(`ssh2 is required for the SSH resource \u2014 install it as a peer dep: ${msg}`);
51
- }
52
- const { Client: ClientCtor } = ssh2Mod;
53
- const c = new ClientCtor();
54
- const opts = {
55
- host: this.config.hostname ?? this.config.host,
56
- port: this.config.port ?? 22,
57
- readyTimeout: (this.config.timeout ?? 30) * 1e3
58
- };
59
- if (this.config.username !== void 0) opts.username = this.config.username;
60
- if (this.config.password !== void 0) opts.password = this.config.password;
61
- if (this.config.identityFile !== void 0) {
62
- opts.privateKey = readFileSync(expandHome(this.config.identityFile));
63
- if (this.config.passphrase !== void 0) opts.passphrase = this.config.passphrase;
64
- }
65
- return new Promise((resolveFn, rejectFn) => {
66
- c.on("ready", () => {
67
- c.sftp((err, sftp) => {
68
- if (err !== void 0) {
69
- rejectFn(err);
70
- return;
71
- }
72
- this.client = c;
73
- this.sftpClient = sftp;
74
- resolveFn(sftp);
75
- });
76
- });
77
- c.on("error", rejectFn);
78
- c.connect(opts);
79
- });
80
- }
81
- close() {
82
- if (this.client !== null) {
83
- this.client.end();
84
- this.client = null;
85
- this.sftpClient = null;
86
- }
87
- return Promise.resolve();
88
- }
89
- };
90
-
91
- // src/commands/builtin/ssh/basename.ts
92
- import { ResourceName, command, specOf, basenameFn } from "@struktoai/mirage-core";
93
- var SSH_BASENAME = command({
94
- name: "basename",
95
- resource: ResourceName.SSH,
96
- spec: specOf("basename"),
97
- fn: basenameFn
98
- });
99
-
100
- // src/commands/builtin/ssh/cat/cat.ts
101
- import {
102
- ResourceName as ResourceName2,
103
- catGeneric,
104
- catProvisionGeneric,
105
- command as command2,
106
- concatAggregate,
107
- specOf as specOf2
108
- } from "@struktoai/mirage-core";
109
-
110
- // src/core/ssh/glob.ts
111
- import { PathSpec } from "@struktoai/mirage-core";
112
-
113
- // src/core/ssh/utils.ts
114
- import { lstripSlash, rstripSlash } from "@struktoai/mirage-core";
115
- var S_IFMT = 61440;
116
- var S_IFDIR = 16384;
117
- var S_IFREG = 32768;
118
- function stripPrefix(p) {
119
- if (p.prefix && p.original.startsWith(p.prefix)) {
120
- return p.original.slice(p.prefix.length) || "/";
121
- }
122
- return p.original;
123
- }
124
- function joinRoot(root, rel) {
125
- const r = rstripSlash(root);
126
- const stripped = lstripSlash(rel);
127
- if (stripped === "") return r === "" ? "/" : r;
128
- if (r === "") return `/${stripped}`;
129
- return `${r}/${stripped}`;
130
- }
131
- function isNoSuchFile(err) {
132
- if (err === null || err === void 0) return false;
133
- if (typeof err !== "object") return false;
134
- const code = err.code;
135
- return code === 2;
136
- }
137
- function isDirectoryAttrs(attrs) {
138
- if (attrs.mode === void 0) return false;
139
- return (attrs.mode & S_IFMT) === S_IFDIR;
140
- }
141
- function isFileAttrs(attrs) {
142
- if (attrs.mode === void 0) return false;
143
- return (attrs.mode & S_IFMT) === S_IFREG;
144
- }
145
-
146
- // src/core/ssh/readdir.ts
147
- import { enoent, stripSlash } from "@struktoai/mirage-core";
148
- async function readdir(accessor, p) {
149
- const sftp = await accessor.sftp();
150
- const virtual = p.pattern !== null ? p.directory.slice(p.prefix.length) || "/" : stripPrefix(p);
151
- const remote = joinRoot(accessor.config.root ?? "/", virtual);
152
- const list = await new Promise((resolveFn, rejectFn) => {
153
- sftp.readdir(remote, (err, entries) => {
154
- if (err !== void 0) {
155
- if (isNoSuchFile(err)) rejectFn(enoent(p));
156
- else rejectFn(err);
157
- return;
158
- }
159
- resolveFn(entries);
160
- });
161
- });
162
- const base = `/${stripSlash(virtual)}`;
163
- const dirPrefix = base === "/" ? "/" : `${base}/`;
164
- const mountPrefix = p.prefix;
165
- const names = [];
166
- for (const entry of list) {
167
- if (entry.filename === "." || entry.filename === "..") continue;
168
- names.push(`${mountPrefix}${dirPrefix}${entry.filename}`);
169
- }
170
- names.sort();
171
- return names;
172
- }
173
-
174
- // src/core/ssh/glob.ts
175
- import { fnmatch } from "@struktoai/mirage-core";
176
- import { gnuBasename } from "@struktoai/mirage-core";
177
- async function resolveGlob(accessor, paths) {
178
- const result = [];
179
- for (const p of paths) {
180
- if (p.resolved) {
181
- result.push(p);
182
- } else if (p.pattern !== null && p.pattern !== "") {
183
- const dirSpec = new PathSpec({
184
- original: p.directory,
185
- directory: p.directory,
186
- resolved: true,
187
- prefix: p.prefix
188
- });
189
- const entries = await readdir(accessor, dirSpec);
190
- const matched = [];
191
- for (const e of entries) {
192
- if (fnmatch(gnuBasename(e), p.pattern)) {
193
- matched.push(
194
- new PathSpec({
195
- original: e,
196
- directory: p.directory,
197
- resolved: true,
198
- prefix: p.prefix
199
- })
200
- );
201
- }
202
- }
203
- if (matched.length > SCOPE_ERROR) matched.length = SCOPE_ERROR;
204
- result.push(...matched);
205
- } else {
206
- result.push(p);
207
- }
208
- }
209
- return result;
210
- }
211
-
212
- // src/core/ssh/stream.ts
213
- import { enoent as enoent2 } from "@struktoai/mirage-core";
214
- async function* stream(accessor, p) {
215
- const sftp = await accessor.sftp();
216
- const virtual = stripPrefix(p);
217
- const remote = joinRoot(accessor.config.root ?? "/", virtual);
218
- const rs = sftp.createReadStream(remote);
219
- try {
220
- for await (const chunk of rs) {
221
- const buf = chunk;
222
- yield new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
223
- }
224
- } catch (err) {
225
- if (isNoSuchFile(err)) throw enoent2(p);
226
- throw err;
227
- }
228
- }
229
- async function rangeRead(accessor, p, start, end) {
230
- const sftp = await accessor.sftp();
231
- const virtual = stripPrefix(p);
232
- const remote = joinRoot(accessor.config.root ?? "/", virtual);
233
- const rs = sftp.createReadStream(remote, { start, end: end - 1 });
234
- const chunks = [];
235
- let total = 0;
236
- try {
237
- for await (const chunk of rs) {
238
- const buf = chunk;
239
- const u8 = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
240
- chunks.push(u8);
241
- total += u8.byteLength;
242
- }
243
- } catch (err) {
244
- if (isNoSuchFile(err)) throw enoent2(p);
245
- throw err;
246
- }
247
- const out = new Uint8Array(total);
248
- let offset = 0;
249
- for (const c of chunks) {
250
- out.set(c, offset);
251
- offset += c.byteLength;
252
- }
253
- return out;
254
- }
255
-
256
- // src/core/ssh/entry.ts
257
- import { FileStat, FileType, guessType } from "@struktoai/mirage-core";
258
- function attrsToFileStat(name, attrs) {
259
- const modified = attrs.mtime !== void 0 ? new Date(attrs.mtime * 1e3).toISOString() : null;
260
- const extra = {};
261
- if (attrs.mode !== void 0) extra.mode = attrs.mode;
262
- if (attrs.uid !== void 0) extra.uid = attrs.uid;
263
- if (attrs.gid !== void 0) extra.gid = attrs.gid;
264
- if (isDirectoryAttrs(attrs)) {
265
- return new FileStat({
266
- name,
267
- size: null,
268
- modified,
269
- type: FileType.DIRECTORY,
270
- extra
271
- });
272
- }
273
- return new FileStat({
274
- name,
275
- size: attrs.size ?? null,
276
- modified,
277
- fingerprint: null,
278
- type: guessType(name),
279
- extra
280
- });
281
- }
282
-
283
- // src/core/ssh/stat.ts
284
- import { enoent as enoent3, rstripSlash as rstripSlash2 } from "@struktoai/mirage-core";
285
- async function stat(accessor, p) {
286
- const sftp = await accessor.sftp();
287
- const virtual = stripPrefix(p);
288
- const remote = joinRoot(accessor.config.root ?? "/", virtual);
289
- const attrs = await new Promise((resolveFn, rejectFn) => {
290
- sftp.lstat(remote, (err, stats) => {
291
- if (err !== void 0) {
292
- if (isNoSuchFile(err)) rejectFn(enoent3(p));
293
- else rejectFn(err);
294
- return;
295
- }
296
- resolveFn(stats);
297
- });
298
- });
299
- const cleaned = rstripSlash2(virtual);
300
- const name = cleaned.length === 0 ? "/" : cleaned.split("/").pop() ?? "/";
301
- return attrsToFileStat(name, attrs);
302
- }
303
-
304
- // src/commands/builtin/ssh/cat/cat.ts
305
- async function catCommand(accessor, paths, texts, opts) {
306
- const resolved = paths.length > 0 ? await resolveGlob(accessor, paths) : [];
307
- return catGeneric(
308
- resolved,
309
- texts,
310
- opts,
311
- (p) => stat(accessor, p),
312
- (p) => stream(accessor, p)
313
- );
314
- }
315
- var SSH_CAT = command2({
316
- name: "cat",
317
- resource: ResourceName2.SSH,
318
- spec: specOf2("cat"),
319
- fn: catCommand,
320
- provision: (accessor, paths) => catProvisionGeneric(paths, (p) => stat(accessor, p)),
321
- aggregate: concatAggregate
322
- });
323
-
324
- // src/commands/builtin/ssh/cp.ts
325
- import {
326
- IOResult,
327
- ResourceName as ResourceName3,
328
- command as command3,
329
- cpGeneric,
330
- specOf as specOf3
331
- } from "@struktoai/mirage-core";
332
-
333
- // src/core/ssh/read.ts
334
- import { enoent as enoent4 } from "@struktoai/mirage-core";
335
- async function read(accessor, p) {
336
- const sftp = await accessor.sftp();
337
- const virtual = stripPrefix(p);
338
- const remote = joinRoot(accessor.config.root ?? "/", virtual);
339
- return new Promise((resolveFn, rejectFn) => {
340
- sftp.readFile(remote, (err, buf) => {
341
- if (err !== void 0) {
342
- if (isNoSuchFile(err)) rejectFn(enoent4(p));
343
- else rejectFn(err);
344
- return;
345
- }
346
- resolveFn(new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength));
347
- });
348
- });
349
- }
350
-
351
- // src/core/ssh/write.ts
352
- import { invalidateAfterWrite } from "@struktoai/mirage-core";
353
- async function writeBytes(accessor, p, data) {
354
- const sftp = await accessor.sftp();
355
- const virtual = stripPrefix(p);
356
- const remote = joinRoot(accessor.config.root ?? "/", virtual);
357
- await new Promise((resolveFn, rejectFn) => {
358
- sftp.writeFile(remote, Buffer.from(data), (err) => {
359
- if (err) rejectFn(err);
360
- else resolveFn();
361
- });
362
- });
363
- await invalidateAfterWrite(p);
364
- }
365
-
366
- // src/core/ssh/copy.ts
367
- async function copy(accessor, src, dst) {
368
- const data = await read(accessor, src);
369
- await writeBytes(accessor, dst, data);
370
- }
371
-
372
- // src/core/ssh/find.ts
373
- import { norm } from "@struktoai/mirage-core";
374
- import {
375
- buildTree,
376
- emitStartPath,
377
- keep,
378
- startBasename
379
- } from "@struktoai/mirage-core";
380
- function isFileType(t) {
381
- return t === "f" || t === "file";
382
- }
383
- function isDirType(t) {
384
- return t === "d" || t === "directory";
385
- }
386
- function matches(entry, entryPath, isDir, depth, opts, tree) {
387
- if (opts.maxDepth !== null && opts.maxDepth !== void 0 && depth > opts.maxDepth) return false;
388
- const basename = entryPath.slice(entryPath.lastIndexOf("/") + 1);
389
- const isEmpty = isDir ? false : entry.attrs.size === 0;
390
- if (!keep(
391
- { key: entryPath, name: basename, kind: isDir ? "d" : "f", depth, isEmpty },
392
- tree,
393
- opts.minDepth
394
- )) {
395
- return false;
396
- }
397
- if (!isDir) {
398
- const size = entry.attrs.size;
399
- if (opts.minSize !== null && opts.minSize !== void 0 && size < opts.minSize) return false;
400
- if (opts.maxSize !== null && opts.maxSize !== void 0 && size > opts.maxSize) return false;
401
- }
402
- if (opts.mtimeMin !== null && opts.mtimeMin !== void 0 || opts.mtimeMax !== null && opts.mtimeMax !== void 0) {
403
- const mtime = entry.attrs.mtime;
404
- if (opts.mtimeMin !== null && opts.mtimeMin !== void 0 && mtime < opts.mtimeMin) return false;
405
- if (opts.mtimeMax !== null && opts.mtimeMax !== void 0 && mtime > opts.mtimeMax) return false;
406
- }
407
- return true;
408
- }
409
- async function readRemoteDir(accessor, remote) {
410
- const sftp = await accessor.sftp();
411
- return new Promise((resolveFn, rejectFn) => {
412
- sftp.readdir(remote, (err, entries) => {
413
- if (err !== void 0) {
414
- const code = err.code;
415
- if (code === 2) {
416
- resolveFn(null);
417
- return;
418
- }
419
- rejectFn(err);
420
- return;
421
- }
422
- resolveFn(entries);
423
- });
424
- });
425
- }
426
- async function statRemote(accessor, remote) {
427
- const sftp = await accessor.sftp();
428
- return new Promise((resolveFn, rejectFn) => {
429
- sftp.stat(remote, (err, stats) => {
430
- if (err !== void 0) {
431
- const code = err.code;
432
- if (code === 2) {
433
- resolveFn(null);
434
- return;
435
- }
436
- rejectFn(err);
437
- return;
438
- }
439
- resolveFn({ isDir: stats.isDirectory(), size: stats.size });
440
- });
441
- });
442
- }
443
- async function walk(ctx, virtual, depth) {
444
- const opts = ctx.options;
445
- if (opts.maxDepth !== null && opts.maxDepth !== void 0 && depth > opts.maxDepth) return;
446
- const remote = joinRoot(ctx.accessor.config.root ?? "/", virtual);
447
- const entries = await readRemoteDir(ctx.accessor, remote);
448
- if (entries === null) return;
449
- for (const entry of entries) {
450
- if (entry.filename === "." || entry.filename === "..") continue;
451
- const childPath = virtual === "/" ? `/${entry.filename}` : `${virtual}/${entry.filename}`;
452
- const isDir = isDirectoryAttrs(entry.attrs);
453
- if (matches(entry, childPath, isDir, depth + 1, opts, ctx.tree)) {
454
- ctx.results.push(childPath);
455
- }
456
- if (isDir) {
457
- await walk(ctx, childPath, depth + 1);
458
- }
459
- }
460
- }
461
- async function find(accessor, p, options = {}) {
462
- const virtual = norm(stripPrefix(p));
463
- const startName = startBasename(p.original);
464
- const results = [];
465
- const baseDepth = (virtual.match(/\//g) ?? []).length;
466
- const typeKind = isFileType(options.type) ? "f" : isDirType(options.type) ? "d" : null;
467
- const tree = options.tree ?? buildTree({
468
- name: options.name,
469
- iname: options.iname,
470
- pathPattern: options.pathPattern,
471
- type: typeKind,
472
- nameExclude: options.nameExclude,
473
- orNames: options.orNames
474
- });
475
- if (options.maxDepth == null || options.maxDepth >= 0) {
476
- const st = await statRemote(accessor, joinRoot(accessor.config.root ?? "/", virtual));
477
- emitStartPath(results, virtual, startName, {
478
- kind: st?.isDir ? "d" : "f",
479
- isEmpty: st === null ? null : st.isDir ? false : st.size === 0,
480
- exists: st !== null,
481
- tree,
482
- maxDepth: options.maxDepth,
483
- minDepth: options.minDepth
484
- });
485
- }
486
- await walk({ accessor, options, results, baseDepth, tree }, virtual, 0);
487
- results.sort();
488
- return results;
489
- }
490
-
491
- // src/commands/builtin/ssh/cp.ts
492
- function cpCommand(accessor, paths, _texts, opts) {
493
- if (paths.length < 2) {
494
- return Promise.resolve([
495
- null,
496
- new IOResult({ exitCode: 1, stderr: new TextEncoder().encode("cp: missing operand\n") })
497
- ]);
498
- }
499
- const recursive = opts.flags.r === true || opts.flags.R === true || opts.flags.a === true;
500
- return cpGeneric(
501
- paths,
502
- (src, target) => copy(accessor, src, target),
503
- (src, options) => find(accessor, src, options),
504
- (p) => stat(accessor, p),
505
- recursive,
506
- opts.flags.n === true,
507
- opts.flags.v === true,
508
- opts.index ?? void 0
509
- );
510
- }
511
- var SSH_CP = command3({
512
- name: "cp",
513
- resource: ResourceName3.SSH,
514
- spec: specOf3("cp"),
515
- fn: cpCommand,
516
- write: true
517
- });
518
-
519
- // src/commands/builtin/ssh/dirname.ts
520
- import { ResourceName as ResourceName4, command as command4, specOf as specOf4, dirnameFn } from "@struktoai/mirage-core";
521
- var SSH_DIRNAME = command4({
522
- name: "dirname",
523
- resource: ResourceName4.SSH,
524
- spec: specOf4("dirname"),
525
- fn: dirnameFn
526
- });
527
-
528
- // src/commands/builtin/ssh/du.ts
529
- import {
530
- ResourceName as ResourceName5,
531
- command as command5,
532
- duGeneric,
533
- specOf as specOf5
534
- } from "@struktoai/mirage-core";
535
-
536
- // src/core/ssh/du.ts
537
- import { norm as norm2 } from "@struktoai/mirage-core";
538
- async function readRemoteDir2(accessor, remote) {
539
- const sftp = await accessor.sftp();
540
- return new Promise((resolveFn, rejectFn) => {
541
- sftp.readdir(remote, (err, entries) => {
542
- if (err !== void 0) {
543
- const code = err.code;
544
- if (code === 2) {
545
- resolveFn(null);
546
- return;
547
- }
548
- rejectFn(err);
549
- return;
550
- }
551
- resolveFn(entries);
552
- });
553
- });
554
- }
555
- async function statRemote2(accessor, remote) {
556
- const sftp = await accessor.sftp();
557
- return new Promise((resolveFn, rejectFn) => {
558
- sftp.lstat(remote, (err, stats) => {
559
- if (err !== void 0) {
560
- const code = err.code;
561
- if (code === 2) {
562
- resolveFn(null);
563
- return;
564
- }
565
- rejectFn(err);
566
- return;
567
- }
568
- resolveFn({ mode: stats.mode, size: stats.size });
569
- });
570
- });
571
- }
572
- async function walkSizes(accessor, virtual) {
573
- const remote = joinRoot(accessor.config.root ?? "/", virtual);
574
- const st = await statRemote2(accessor, remote);
575
- if (st === null) return 0;
576
- if (isFileAttrs(st)) return st.size;
577
- if (!isDirectoryAttrs(st)) return 0;
578
- const entries = await readRemoteDir2(accessor, remote);
579
- if (entries === null) return 0;
580
- let total = 0;
581
- for (const entry of entries) {
582
- if (entry.filename === "." || entry.filename === "..") continue;
583
- const child = virtual === "/" ? `/${entry.filename}` : `${virtual}/${entry.filename}`;
584
- if (isDirectoryAttrs(entry.attrs)) {
585
- total += await walkSizes(accessor, child);
586
- } else {
587
- total += entry.attrs.size;
588
- }
589
- }
590
- return total;
591
- }
592
- async function walkAll(accessor, virtual, entries) {
593
- const remote = joinRoot(accessor.config.root ?? "/", virtual);
594
- const st = await statRemote2(accessor, remote);
595
- if (st === null) return 0;
596
- if (isFileAttrs(st)) {
597
- entries.push([virtual, st.size]);
598
- return st.size;
599
- }
600
- if (!isDirectoryAttrs(st)) return 0;
601
- const list = await readRemoteDir2(accessor, remote);
602
- if (list === null) return 0;
603
- let total = 0;
604
- for (const entry of list) {
605
- if (entry.filename === "." || entry.filename === "..") continue;
606
- const child = virtual === "/" ? `/${entry.filename}` : `${virtual}/${entry.filename}`;
607
- if (isDirectoryAttrs(entry.attrs)) {
608
- total += await walkAll(accessor, child, entries);
609
- } else {
610
- const size = entry.attrs.size;
611
- entries.push([child, size]);
612
- total += size;
613
- }
614
- }
615
- return total;
616
- }
617
- async function du(accessor, p) {
618
- const virtual = stripPrefix(p);
619
- return walkSizes(accessor, virtual);
620
- }
621
- async function duAll(accessor, p) {
622
- const virtual = norm2(stripPrefix(p));
623
- const entries = [];
624
- const total = await walkAll(accessor, virtual, entries);
625
- entries.sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0);
626
- return [entries, total];
627
- }
628
-
629
- // src/commands/builtin/ssh/du.ts
630
- async function duCommand(accessor, paths, _texts, opts) {
631
- const resolved = paths.length > 0 ? await resolveGlob(accessor, paths) : [];
632
- return duGeneric(
633
- resolved,
634
- opts,
635
- (p) => du(accessor, p),
636
- (p) => duAll(accessor, p)
637
- );
638
- }
639
- var SSH_DU = command5({
640
- name: "du",
641
- resource: ResourceName5.SSH,
642
- spec: specOf5("du"),
643
- fn: duCommand
644
- });
645
-
646
- // src/commands/builtin/ssh/file/file.ts
647
- import {
648
- ResourceName as ResourceName6,
649
- command as command6,
650
- fileGeneric,
651
- specOf as specOf6
652
- } from "@struktoai/mirage-core";
653
- async function fileCommand(accessor, paths, _texts, opts) {
654
- const resolved = paths.length > 0 ? await resolveGlob(accessor, paths) : [];
655
- return fileGeneric(
656
- resolved,
657
- opts,
658
- (p) => stat(accessor, p),
659
- (p) => read(accessor, p)
660
- );
661
- }
662
- var SSH_FILE = command6({
663
- name: "file",
664
- resource: ResourceName6.SSH,
665
- spec: specOf6("file"),
666
- fn: fileCommand
667
- });
668
-
669
- // src/commands/builtin/ssh/find.ts
670
- import { ResourceName as ResourceName7, command as command7, findGeneric, specOf as specOf7 } from "@struktoai/mirage-core";
671
- var SSH_FIND = command7({
672
- name: "find",
673
- resource: ResourceName7.SSH,
674
- spec: specOf7("find"),
675
- fn: (accessor, paths, texts, opts) => findGeneric(paths, texts, opts, (root, options) => find(accessor, root, options))
676
- });
677
-
678
- // src/commands/builtin/ssh/grep/grep.ts
679
- import {
680
- ResourceName as ResourceName8,
681
- command as command8,
682
- grepGeneric,
683
- prefixAggregate,
684
- specOf as specOf8
685
- } from "@struktoai/mirage-core";
686
- async function grepFn(accessor, paths, texts, opts) {
687
- const resolved = paths.length > 0 ? await resolveGlob(accessor, paths) : [];
688
- const stat2 = (p) => stat(accessor, p);
689
- const readdir2 = (p) => readdir(accessor, p);
690
- return grepGeneric("grep", resolved, texts, opts, stat2, readdir2, (p) => stream(accessor, p));
691
- }
692
- var SSH_GREP = command8({
693
- name: "grep",
694
- resource: ResourceName8.SSH,
695
- spec: specOf8("grep"),
696
- fn: grepFn,
697
- aggregate: prefixAggregate
698
- });
699
-
700
- // src/commands/builtin/ssh/head/head.ts
701
- import {
702
- ResourceName as ResourceName9,
703
- command as command9,
704
- headGeneric,
705
- headProvisionGeneric,
706
- headerAggregate,
707
- specOf as specOf9
708
- } from "@struktoai/mirage-core";
709
- var SSH_HEAD = command9({
710
- name: "head",
711
- resource: ResourceName9.SSH,
712
- spec: specOf9("head"),
713
- fn: (accessor, paths, texts, opts) => headGeneric(
714
- paths,
715
- texts,
716
- opts,
717
- (p) => stat(accessor, p),
718
- (p) => stream(accessor, p)
719
- ),
720
- provision: (accessor, paths, texts, opts) => headProvisionGeneric(paths, texts, opts, (p) => stat(accessor, p)),
721
- aggregate: headerAggregate
722
- });
723
-
724
- // src/commands/builtin/ssh/jq.ts
725
- import {
726
- ResourceName as ResourceName10,
727
- command as command10,
728
- jqGeneric,
729
- jqProvisionGeneric,
730
- specOf as specOf10
731
- } from "@struktoai/mirage-core";
732
- async function jqCommand(accessor, paths, texts, opts) {
733
- const resolved = paths.length > 0 ? await resolveGlob(accessor, paths) : [];
734
- return jqGeneric(resolved, texts, opts, (p) => stream(accessor, p));
735
- }
736
- var SSH_JQ = command10({
737
- name: "jq",
738
- resource: ResourceName10.SSH,
739
- spec: specOf10("jq"),
740
- fn: jqCommand,
741
- provision: (accessor, paths, texts) => jqProvisionGeneric(paths, texts, (p) => stat(accessor, p))
742
- });
743
-
744
- // src/commands/builtin/ssh/ls/ls.ts
745
- import { ResourceName as ResourceName11, command as command11, lsGeneric, specOf as specOf11 } from "@struktoai/mirage-core";
746
- var SSH_LS = command11({
747
- name: "ls",
748
- resource: ResourceName11.SSH,
749
- spec: specOf11("ls"),
750
- fn: (accessor, paths, _texts, opts) => lsGeneric(
751
- paths,
752
- opts,
753
- (p) => readdir(accessor, p),
754
- (p) => stat(accessor, p)
755
- )
756
- });
757
-
758
- // src/commands/builtin/ssh/mkdir.ts
759
- import {
760
- IOResult as IOResult2,
761
- ResourceName as ResourceName12,
762
- command as command12,
763
- specOf as specOf12
764
- } from "@struktoai/mirage-core";
765
-
766
- // src/core/ssh/mkdir.ts
767
- import { invalidateAfterWrite as invalidateAfterWrite2 } from "@struktoai/mirage-core";
768
- import { enoent as enoent5, stripSlash as stripSlash2 } from "@struktoai/mirage-core";
769
- async function statRemote3(sftp, remote) {
770
- return new Promise((resolveFn) => {
771
- sftp.lstat(remote, (err, stats) => {
772
- if (err) resolveFn(null);
773
- else resolveFn(stats);
774
- });
775
- });
776
- }
777
- async function mkdirOne(sftp, remote, ignoreExisting) {
778
- return new Promise((resolveFn, rejectFn) => {
779
- sftp.mkdir(remote, (err) => {
780
- if (!err) {
781
- resolveFn();
782
- return;
783
- }
784
- if (ignoreExisting) {
785
- resolveFn();
786
- return;
787
- }
788
- rejectFn(err);
789
- });
790
- });
791
- }
792
- async function mkdir(accessor, p, recursive) {
793
- const sftp = await accessor.sftp();
794
- const virtual = stripPrefix(p);
795
- const root = accessor.config.root ?? "/";
796
- const remote = joinRoot(root, virtual);
797
- if (!recursive) {
798
- try {
799
- await mkdirOne(sftp, remote, false);
800
- } catch (err) {
801
- if (isNoSuchFile(err)) throw enoent5(p);
802
- throw err;
803
- }
804
- return;
805
- }
806
- const cleaned = stripSlash2(virtual);
807
- if (cleaned.length === 0) return;
808
- const parts = cleaned.split("/");
809
- let cur = "";
810
- for (const part of parts) {
811
- cur = cur === "" ? `/${part}` : `${cur}/${part}`;
812
- const stepRemote = joinRoot(root, cur);
813
- const existing = await statRemote3(sftp, stepRemote);
814
- if (existing?.isDirectory()) continue;
815
- await mkdirOne(sftp, stepRemote, true);
816
- }
817
- await invalidateAfterWrite2(p);
818
- }
819
-
820
- // src/commands/builtin/ssh/mkdir.ts
821
- async function mkdirCommand(accessor, paths, _texts, opts) {
822
- const parents = opts.flags.p === true;
823
- const verbose = opts.flags.v === true;
824
- if (paths.length === 0) {
825
- return [
826
- null,
827
- new IOResult2({
828
- exitCode: 1,
829
- stderr: new TextEncoder().encode("mkdir: missing operand\n")
830
- })
831
- ];
832
- }
833
- const lines = [];
834
- for (const p of paths) {
835
- await mkdir(accessor, p, parents);
836
- if (verbose) lines.push(`mkdir: created directory '${p.original}'`);
837
- }
838
- const out = lines.length > 0 ? new TextEncoder().encode(lines.join("\n") + "\n") : null;
839
- return [out, new IOResult2()];
840
- }
841
- var SSH_MKDIR = command12({
842
- name: "mkdir",
843
- resource: ResourceName12.SSH,
844
- spec: specOf12("mkdir"),
845
- fn: mkdirCommand,
846
- write: true
847
- });
848
-
849
- // src/commands/builtin/ssh/mv.ts
850
- import {
851
- IOResult as IOResult3,
852
- ResourceName as ResourceName13,
853
- command as command13,
854
- mvGeneric,
855
- specOf as specOf13
856
- } from "@struktoai/mirage-core";
857
-
858
- // src/core/ssh/rename.ts
859
- import { invalidateAfterUnlink, invalidateAfterWrite as invalidateAfterWrite3 } from "@struktoai/mirage-core";
860
- import { enoent as enoent6 } from "@struktoai/mirage-core";
861
- async function rename(accessor, src, dst) {
862
- const sftp = await accessor.sftp();
863
- const root = accessor.config.root ?? "/";
864
- const srcVirtual = stripPrefix(src);
865
- const dstVirtual = stripPrefix(dst);
866
- const remoteSrc = joinRoot(root, srcVirtual);
867
- const remoteDst = joinRoot(root, dstVirtual);
868
- await new Promise((resolveFn, rejectFn) => {
869
- sftp.rename(remoteSrc, remoteDst, (err) => {
870
- if (!err) {
871
- resolveFn();
872
- return;
873
- }
874
- if (isNoSuchFile(err)) rejectFn(enoent6(src));
875
- else rejectFn(err);
876
- });
877
- });
878
- await invalidateAfterWrite3(dst);
879
- await invalidateAfterUnlink(src);
880
- }
881
-
882
- // src/commands/builtin/ssh/mv.ts
883
- function mvCommand(accessor, paths, _texts, opts) {
884
- if (paths.length < 2) {
885
- return Promise.resolve([
886
- null,
887
- new IOResult3({ exitCode: 1, stderr: new TextEncoder().encode("mv: missing operand\n") })
888
- ]);
889
- }
890
- return mvGeneric(
891
- paths,
892
- (src, target) => rename(accessor, src, target),
893
- (p) => stat(accessor, p),
894
- opts.flags.n === true,
895
- opts.flags.v === true,
896
- opts.index ?? void 0
897
- );
898
- }
899
- var SSH_MV = command13({
900
- name: "mv",
901
- resource: ResourceName13.SSH,
902
- spec: specOf13("mv"),
903
- fn: mvCommand,
904
- write: true
905
- });
906
-
907
- // src/commands/builtin/ssh/realpath.ts
908
- import { ResourceName as ResourceName14, command as command14, realpathGeneric, specOf as specOf14 } from "@struktoai/mirage-core";
909
- var SSH_REALPATH = command14({
910
- name: "realpath",
911
- resource: ResourceName14.SSH,
912
- spec: specOf14("realpath"),
913
- fn: (accessor, paths, texts, opts) => realpathGeneric(paths, texts, opts, (p) => stat(accessor, p))
914
- });
915
-
916
- // src/commands/builtin/ssh/rg.ts
917
- import {
918
- ResourceName as ResourceName15,
919
- command as command15,
920
- rgGeneric,
921
- specOf as specOf15
922
- } from "@struktoai/mirage-core";
923
- async function rgCommand(accessor, paths, texts, opts) {
924
- const resolved = paths.length > 0 ? await resolveGlob(accessor, paths) : [];
925
- const stat2 = (p) => stat(accessor, p);
926
- const readdir2 = (p) => readdir(accessor, p);
927
- return rgGeneric(resolved, texts, opts, stat2, readdir2, (p) => stream(accessor, p));
928
- }
929
- var SSH_RG = command15({
930
- name: "rg",
931
- resource: ResourceName15.SSH,
932
- spec: specOf15("rg"),
933
- fn: rgCommand
934
- });
935
-
936
- // src/commands/builtin/ssh/rm.ts
937
- import {
938
- FileType as FileType2,
939
- IOResult as IOResult4,
940
- ResourceName as ResourceName16,
941
- command as command16,
942
- specOf as specOf16,
943
- formatRecords
944
- } from "@struktoai/mirage-core";
945
-
946
- // src/core/ssh/rmdir.ts
947
- import { enoent as enoent7, invalidateAfterUnlink as invalidateAfterUnlink2 } from "@struktoai/mirage-core";
948
- async function rmdir(accessor, p) {
949
- const sftp = await accessor.sftp();
950
- const virtual = stripPrefix(p);
951
- const remote = joinRoot(accessor.config.root ?? "/", virtual);
952
- await new Promise((resolveFn, rejectFn) => {
953
- sftp.rmdir(remote, (err) => {
954
- if (!err) {
955
- resolveFn();
956
- return;
957
- }
958
- if (isNoSuchFile(err)) rejectFn(enoent7(p));
959
- else rejectFn(err);
960
- });
961
- });
962
- await invalidateAfterUnlink2(p);
963
- }
964
-
965
- // src/core/ssh/unlink.ts
966
- import { invalidateAfterUnlink as invalidateAfterUnlink3 } from "@struktoai/mirage-core";
967
- import { enoent as enoent8 } from "@struktoai/mirage-core";
968
- async function unlink(accessor, p) {
969
- const sftp = await accessor.sftp();
970
- const virtual = stripPrefix(p);
971
- const remote = joinRoot(accessor.config.root ?? "/", virtual);
972
- await new Promise((resolveFn, rejectFn) => {
973
- sftp.unlink(remote, (err) => {
974
- if (!err) {
975
- resolveFn();
976
- return;
977
- }
978
- if (isNoSuchFile(err)) rejectFn(enoent8(p));
979
- else rejectFn(err);
980
- });
981
- });
982
- await invalidateAfterUnlink3(p);
983
- }
984
-
985
- // src/core/ssh/rm.ts
986
- import { enoent as enoent9, invalidateAfterUnlink as invalidateAfterUnlink4 } from "@struktoai/mirage-core";
987
- async function statRemote4(sftp, remote) {
988
- return new Promise((resolveFn, rejectFn) => {
989
- sftp.lstat(remote, (err, stats) => {
990
- if (err !== void 0) rejectFn(err);
991
- else resolveFn(stats);
992
- });
993
- });
994
- }
995
- async function readdirRemote(sftp, remote) {
996
- return new Promise((resolveFn, rejectFn) => {
997
- sftp.readdir(remote, (err, list) => {
998
- if (err !== void 0) rejectFn(err);
999
- else resolveFn(list);
1000
- });
1001
- });
1002
- }
1003
- async function unlinkRemote(sftp, remote) {
1004
- return new Promise((resolveFn, rejectFn) => {
1005
- sftp.unlink(remote, (err) => {
1006
- if (err) rejectFn(err);
1007
- else resolveFn();
1008
- });
1009
- });
1010
- }
1011
- async function rmdirRemote(sftp, remote) {
1012
- return new Promise((resolveFn, rejectFn) => {
1013
- sftp.rmdir(remote, (err) => {
1014
- if (err) rejectFn(err);
1015
- else resolveFn();
1016
- });
1017
- });
1018
- }
1019
- async function rmRecurse(sftp, remote) {
1020
- const stats = await statRemote4(sftp, remote);
1021
- if (isDirectoryAttrs(stats)) {
1022
- const entries = await readdirRemote(sftp, remote);
1023
- for (const entry of entries) {
1024
- if (entry.filename === "." || entry.filename === "..") continue;
1025
- const child = remote === "/" ? `/${entry.filename}` : `${remote}/${entry.filename}`;
1026
- await rmRecurse(sftp, child);
1027
- }
1028
- await rmdirRemote(sftp, remote);
1029
- return;
1030
- }
1031
- await unlinkRemote(sftp, remote);
1032
- }
1033
- async function rmR(accessor, p) {
1034
- const sftp = await accessor.sftp();
1035
- const virtual = stripPrefix(p);
1036
- const remote = joinRoot(accessor.config.root ?? "/", virtual);
1037
- try {
1038
- await rmRecurse(sftp, remote);
1039
- } catch (err) {
1040
- if (isNoSuchFile(err)) throw enoent9(p);
1041
- throw err;
1042
- }
1043
- await invalidateAfterUnlink4(p);
1044
- }
1045
-
1046
- // src/commands/builtin/ssh/rm.ts
1047
- async function rmCommand(accessor, paths, _texts, opts) {
1048
- if (paths.length === 0) {
1049
- return [
1050
- null,
1051
- new IOResult4({
1052
- exitCode: 1,
1053
- stderr: new TextEncoder().encode("rm: missing operand\n")
1054
- })
1055
- ];
1056
- }
1057
- const recursive = opts.flags.r === true || opts.flags.R === true;
1058
- const force = opts.flags.f === true;
1059
- const verbose = opts.flags.v === true;
1060
- const lines = [];
1061
- for (const p of paths) {
1062
- let isDir = false;
1063
- try {
1064
- const st = await stat(accessor, p);
1065
- isDir = st.type === FileType2.DIRECTORY;
1066
- } catch {
1067
- if (force) continue;
1068
- throw new Error(`rm: cannot remove '${p.original}': No such file or directory`);
1069
- }
1070
- if (isDir) {
1071
- if (recursive) {
1072
- await rmR(accessor, p);
1073
- } else {
1074
- await rmdir(accessor, p);
1075
- }
1076
- } else {
1077
- await unlink(accessor, p);
1078
- }
1079
- if (verbose) lines.push(`removed '${p.original}'`);
1080
- }
1081
- const out = lines.length > 0 ? formatRecords(lines) : null;
1082
- return [out, new IOResult4()];
1083
- }
1084
- var SSH_RM = command16({
1085
- name: "rm",
1086
- resource: ResourceName16.SSH,
1087
- spec: specOf16("rm"),
1088
- fn: rmCommand,
1089
- write: true
1090
- });
1091
-
1092
- // src/commands/builtin/ssh/stat/stat.ts
1093
- import {
1094
- ResourceName as ResourceName17,
1095
- command as command17,
1096
- specOf as specOf17,
1097
- statGeneric,
1098
- statProvisionGeneric
1099
- } from "@struktoai/mirage-core";
1100
- async function statCommand(accessor, paths, _texts, opts) {
1101
- const resolved = paths.length > 0 ? await resolveGlob(accessor, paths) : [];
1102
- return statGeneric(resolved, opts, (p) => stat(accessor, p));
1103
- }
1104
- var SSH_STAT = command17({
1105
- name: "stat",
1106
- resource: ResourceName17.SSH,
1107
- spec: specOf17("stat"),
1108
- fn: statCommand,
1109
- provision: statProvisionGeneric
1110
- });
1111
-
1112
- // src/commands/builtin/ssh/tail/tail.ts
1113
- import { ResourceName as ResourceName18, command as command18, headerAggregate as headerAggregate2, specOf as specOf18, tailGeneric } from "@struktoai/mirage-core";
1114
- var SSH_TAIL = command18({
1115
- name: "tail",
1116
- resource: ResourceName18.SSH,
1117
- spec: specOf18("tail"),
1118
- fn: (accessor, paths, texts, opts) => tailGeneric(paths, texts, opts, (p) => stream(accessor, p)),
1119
- aggregate: headerAggregate2
1120
- });
1121
-
1122
- // src/commands/builtin/ssh/touch.ts
1123
- import {
1124
- IOResult as IOResult5,
1125
- ResourceName as ResourceName19,
1126
- command as command19,
1127
- specOf as specOf19
1128
- } from "@struktoai/mirage-core";
1129
-
1130
- // src/core/ssh/exists.ts
1131
- async function exists(accessor, p) {
1132
- const sftp = await accessor.sftp();
1133
- const remote = joinRoot(accessor.config.root ?? "/", stripPrefix(p));
1134
- return new Promise((resolveFn) => {
1135
- sftp.exists(remote, (yes) => {
1136
- resolveFn(yes);
1137
- });
1138
- });
1139
- }
1140
-
1141
- // src/commands/builtin/ssh/touch.ts
1142
- var ENC = new TextEncoder();
1143
- async function touchCommand(accessor, paths, texts, opts) {
1144
- if (paths.length === 0) {
1145
- return [null, new IOResult5({ exitCode: 1, stderr: ENC.encode("touch: missing operand\n") })];
1146
- }
1147
- const createOnly = opts.flags.c === true;
1148
- for (const p of paths) {
1149
- if (createOnly) continue;
1150
- if (!await exists(accessor, p)) {
1151
- await writeBytes(accessor, p, new Uint8Array(0));
1152
- }
1153
- }
1154
- return [null, new IOResult5()];
1155
- }
1156
- var SSH_TOUCH = command19({
1157
- name: "touch",
1158
- resource: ResourceName19.SSH,
1159
- spec: specOf19("touch"),
1160
- fn: touchCommand,
1161
- write: true
1162
- });
1163
-
1164
- // src/commands/builtin/ssh/tree.ts
1165
- import {
1166
- ResourceName as ResourceName20,
1167
- command as command20,
1168
- specOf as specOf20,
1169
- treeGeneric
1170
- } from "@struktoai/mirage-core";
1171
- async function treeCommand(accessor, paths, _texts, opts) {
1172
- const resolved = await resolveGlob(accessor, paths);
1173
- return treeGeneric(
1174
- resolved,
1175
- opts,
1176
- (p) => readdir(accessor, p),
1177
- (p) => stat(accessor, p)
1178
- );
1179
- }
1180
- var SSH_TREE = command20({
1181
- name: "tree",
1182
- resource: ResourceName20.SSH,
1183
- spec: specOf20("tree"),
1184
- fn: treeCommand
1185
- });
1186
-
1187
- // src/commands/builtin/ssh/wc/wc.ts
1188
- import { ResourceName as ResourceName21, command as command21, specOf as specOf21, wcAggregate, wcGeneric } from "@struktoai/mirage-core";
1189
- var SSH_WC = command21({
1190
- name: "wc",
1191
- resource: ResourceName21.SSH,
1192
- spec: specOf21("wc"),
1193
- fn: (accessor, paths, texts, opts) => wcGeneric(paths, texts, opts, (p) => stream(accessor, p)),
1194
- aggregate: wcAggregate
1195
- });
1196
-
1197
- // src/commands/builtin/ssh/awk.ts
1198
- import { ResourceName as ResourceName22, awkGeneric, command as command22, specOf as specOf22 } from "@struktoai/mirage-core";
1199
- var SSH_AWK = command22({
1200
- name: "awk",
1201
- resource: ResourceName22.SSH,
1202
- spec: specOf22("awk"),
1203
- fn: (accessor, paths, texts, opts) => awkGeneric(paths, texts, opts, (p) => stream(accessor, p))
1204
- });
1205
-
1206
- // src/commands/builtin/ssh/base64_cmd.ts
1207
- import { ResourceName as ResourceName23, command as command23, specOf as specOf23, base64Generic } from "@struktoai/mirage-core";
1208
- var SSH_BASE64 = command23({
1209
- name: "base64",
1210
- resource: ResourceName23.SSH,
1211
- spec: specOf23("base64"),
1212
- fn: (accessor, paths, _texts, opts) => base64Generic(paths, opts, (p) => stream(accessor, p))
1213
- });
1214
-
1215
- // src/commands/builtin/ssh/cmp.ts
1216
- import { ResourceName as ResourceName24, command as command24, specOf as specOf24, cmpGeneric } from "@struktoai/mirage-core";
1217
- var SSH_CMP = command24({
1218
- name: "cmp",
1219
- resource: ResourceName24.SSH,
1220
- spec: specOf24("cmp"),
1221
- fn: (accessor, paths, _texts, opts) => cmpGeneric(paths, opts, (p) => stream(accessor, p))
1222
- });
1223
-
1224
- // src/commands/builtin/ssh/column.ts
1225
- import { ResourceName as ResourceName25, command as command25, specOf as specOf25, columnGeneric } from "@struktoai/mirage-core";
1226
- var SSH_COLUMN = command25({
1227
- name: "column",
1228
- resource: ResourceName25.SSH,
1229
- spec: specOf25("column"),
1230
- fn: (accessor, paths, _texts, opts) => columnGeneric(paths, opts, (p) => stream(accessor, p))
1231
- });
1232
-
1233
- // src/commands/builtin/ssh/comm.ts
1234
- import { ResourceName as ResourceName26, command as command26, specOf as specOf26, commGeneric } from "@struktoai/mirage-core";
1235
- var SSH_COMM = command26({
1236
- name: "comm",
1237
- resource: ResourceName26.SSH,
1238
- spec: specOf26("comm"),
1239
- fn: (accessor, paths, _texts, opts) => commGeneric(paths, opts, (p) => stream(accessor, p))
1240
- });
1241
-
1242
- // src/commands/builtin/ssh/csplit.ts
1243
- import { ResourceName as ResourceName27, command as command27, specOf as specOf27, csplitGeneric } from "@struktoai/mirage-core";
1244
- var SSH_CSPLIT = command27({
1245
- name: "csplit",
1246
- resource: ResourceName27.SSH,
1247
- spec: specOf27("csplit"),
1248
- fn: (accessor, paths, texts, opts) => csplitGeneric(
1249
- paths,
1250
- texts,
1251
- opts,
1252
- (p) => stream(accessor, p),
1253
- (p, d) => writeBytes(accessor, p, d)
1254
- ),
1255
- write: true
1256
- });
1257
-
1258
- // src/commands/builtin/ssh/cut.ts
1259
- import { ResourceName as ResourceName28, command as command28, cutGeneric, specOf as specOf28 } from "@struktoai/mirage-core";
1260
- var SSH_CUT = command28({
1261
- name: "cut",
1262
- resource: ResourceName28.SSH,
1263
- spec: specOf28("cut"),
1264
- fn: (accessor, paths, _texts, opts) => cutGeneric(paths, opts, (p) => stream(accessor, p))
1265
- });
1266
-
1267
- // src/commands/builtin/ssh/diff.ts
1268
- import { ResourceName as ResourceName29, command as command29, diffGeneric, specOf as specOf29 } from "@struktoai/mirage-core";
1269
- var SSH_DIFF = command29({
1270
- name: "diff",
1271
- resource: ResourceName29.SSH,
1272
- spec: specOf29("diff"),
1273
- fn: (accessor, paths, _texts, opts) => diffGeneric(
1274
- paths,
1275
- opts,
1276
- (p) => stream(accessor, p),
1277
- (p) => readdir(accessor, p, opts.index ?? void 0),
1278
- (p) => stat(accessor, p)
1279
- )
1280
- });
1281
-
1282
- // src/commands/builtin/ssh/expand.ts
1283
- import { ResourceName as ResourceName30, command as command30, specOf as specOf30, expandGeneric } from "@struktoai/mirage-core";
1284
- var SSH_EXPAND = command30({
1285
- name: "expand",
1286
- resource: ResourceName30.SSH,
1287
- spec: specOf30("expand"),
1288
- fn: (accessor, paths, _texts, opts) => expandGeneric(paths, opts, (p) => stream(accessor, p))
1289
- });
1290
-
1291
- // src/commands/builtin/ssh/fmt.ts
1292
- import {
1293
- ResourceName as ResourceName31,
1294
- command as command31,
1295
- fmtGeneric,
1296
- specOf as specOf31
1297
- } from "@struktoai/mirage-core";
1298
- async function fmtCommand(accessor, paths, _texts, opts) {
1299
- return fmtGeneric(paths, opts, (p) => stream(accessor, p));
1300
- }
1301
- var SSH_FMT = command31({
1302
- name: "fmt",
1303
- resource: ResourceName31.SSH,
1304
- spec: specOf31("fmt"),
1305
- fn: fmtCommand
1306
- });
1307
-
1308
- // src/commands/builtin/ssh/fold.ts
1309
- import { ResourceName as ResourceName32, command as command32, specOf as specOf32, foldGeneric } from "@struktoai/mirage-core";
1310
- var SSH_FOLD = command32({
1311
- name: "fold",
1312
- resource: ResourceName32.SSH,
1313
- spec: specOf32("fold"),
1314
- fn: (accessor, paths, _texts, opts) => foldGeneric(paths, opts, (p) => stream(accessor, p))
1315
- });
1316
-
1317
- // src/commands/builtin/ssh/gunzip.ts
1318
- import { ResourceName as ResourceName33, command as command33, specOf as specOf33, gunzipGeneric } from "@struktoai/mirage-core";
1319
- var SSH_GUNZIP = command33({
1320
- name: "gunzip",
1321
- resource: ResourceName33.SSH,
1322
- spec: specOf33("gunzip"),
1323
- fn: (accessor, paths, _texts, opts) => gunzipGeneric(
1324
- paths,
1325
- opts,
1326
- (p) => stream(accessor, p),
1327
- (p, d) => writeBytes(accessor, p, d),
1328
- (p) => unlink(accessor, p)
1329
- ),
1330
- write: true
1331
- });
1332
-
1333
- // src/commands/builtin/ssh/gzip.ts
1334
- import { ResourceName as ResourceName34, command as command34, specOf as specOf34, gzipGeneric } from "@struktoai/mirage-core";
1335
- var SSH_GZIP = command34({
1336
- name: "gzip",
1337
- resource: ResourceName34.SSH,
1338
- spec: specOf34("gzip"),
1339
- fn: (accessor, paths, _texts, opts) => gzipGeneric(
1340
- paths,
1341
- opts,
1342
- (p) => stream(accessor, p),
1343
- (p, d) => writeBytes(accessor, p, d),
1344
- (p) => unlink(accessor, p)
1345
- ),
1346
- write: true
1347
- });
1348
-
1349
- // src/commands/builtin/ssh/iconv.ts
1350
- import { ResourceName as ResourceName35, command as command35, specOf as specOf35, iconvGeneric } from "@struktoai/mirage-core";
1351
- var SSH_ICONV = command35({
1352
- name: "iconv",
1353
- resource: ResourceName35.SSH,
1354
- spec: specOf35("iconv"),
1355
- fn: (accessor, paths, _texts, opts) => iconvGeneric(
1356
- paths,
1357
- opts,
1358
- (p) => stream(accessor, p),
1359
- (p, d) => writeBytes(accessor, p, d)
1360
- ),
1361
- write: true
1362
- });
1363
-
1364
- // src/commands/builtin/ssh/join.ts
1365
- import { ResourceName as ResourceName36, command as command36, specOf as specOf36, joinGeneric } from "@struktoai/mirage-core";
1366
- var SSH_JOIN = command36({
1367
- name: "join",
1368
- resource: ResourceName36.SSH,
1369
- spec: specOf36("join"),
1370
- fn: (accessor, paths, _texts, opts) => joinGeneric(paths, opts, (p) => stream(accessor, p))
1371
- });
1372
-
1373
- // src/commands/builtin/ssh/ln.ts
1374
- import {
1375
- IOResult as IOResult6,
1376
- ResourceName as ResourceName37,
1377
- command as command37,
1378
- materialize,
1379
- specOf as specOf37
1380
- } from "@struktoai/mirage-core";
1381
- var ENC2 = new TextEncoder();
1382
- async function lnCommand(accessor, paths, texts, opts) {
1383
- if (paths.length < 2) {
1384
- return [
1385
- null,
1386
- new IOResult6({ exitCode: 1, stderr: ENC2.encode("ln: usage: ln [-s] [-f] source dest\n") })
1387
- ];
1388
- }
1389
- const source = paths[0];
1390
- const dest = paths[1];
1391
- if (source === void 0 || dest === void 0) return [null, new IOResult6()];
1392
- if (opts.flags.n === true && await exists(accessor, dest)) {
1393
- return [null, new IOResult6()];
1394
- }
1395
- const data = await materialize(stream(accessor, source));
1396
- await writeBytes(accessor, dest, data);
1397
- const out = opts.flags.v === true ? ENC2.encode(`'${source.original}' -> '${dest.original}'
1398
- `) : null;
1399
- return [out, new IOResult6({ writes: { [dest.stripPrefix]: data } })];
1400
- }
1401
- var SSH_LN = command37({
1402
- name: "ln",
1403
- resource: ResourceName37.SSH,
1404
- spec: specOf37("ln"),
1405
- fn: lnCommand,
1406
- write: true
1407
- });
1408
-
1409
- // src/commands/builtin/ssh/look.ts
1410
- import { ResourceName as ResourceName38, command as command38, specOf as specOf38, lookGeneric } from "@struktoai/mirage-core";
1411
- var SSH_LOOK = command38({
1412
- name: "look",
1413
- resource: ResourceName38.SSH,
1414
- spec: specOf38("look"),
1415
- fn: (accessor, paths, texts, opts) => lookGeneric(paths, texts, opts, (p) => stream(accessor, p))
1416
- });
1417
-
1418
- // src/commands/builtin/ssh/md5.ts
1419
- import { ResourceName as ResourceName39, command as command39, specOf as specOf39, md5Generic } from "@struktoai/mirage-core";
1420
- var SSH_MD5 = command39({
1421
- name: "md5",
1422
- resource: ResourceName39.SSH,
1423
- spec: specOf39("md5"),
1424
- fn: (accessor, paths, _texts, opts) => md5Generic(paths, opts, (p) => stream(accessor, p))
1425
- });
1426
-
1427
- // src/commands/builtin/ssh/mktemp.ts
1428
- import { ResourceName as ResourceName40, command as command40, mktempGeneric, specOf as specOf40 } from "@struktoai/mirage-core";
1429
- var SSH_MKTEMP = command40({
1430
- name: "mktemp",
1431
- resource: ResourceName40.SSH,
1432
- spec: specOf40("mktemp"),
1433
- fn: (accessor, _paths, texts, opts) => mktempGeneric(
1434
- texts,
1435
- opts,
1436
- (p, parents) => mkdir(accessor, p, parents ?? false),
1437
- (p, d) => writeBytes(accessor, p, d)
1438
- ),
1439
- write: true
1440
- });
1441
-
1442
- // src/commands/builtin/ssh/nl.ts
1443
- import { ResourceName as ResourceName41, command as command41, specOf as specOf41, nlGeneric } from "@struktoai/mirage-core";
1444
- var SSH_NL = command41({
1445
- name: "nl",
1446
- resource: ResourceName41.SSH,
1447
- spec: specOf41("nl"),
1448
- fn: (accessor, paths, _texts, opts) => nlGeneric(paths, opts, (p) => stream(accessor, p))
1449
- });
1450
-
1451
- // src/commands/builtin/ssh/paste.ts
1452
- import { ResourceName as ResourceName42, command as command42, specOf as specOf42, pasteGeneric } from "@struktoai/mirage-core";
1453
- var SSH_PASTE = command42({
1454
- name: "paste",
1455
- resource: ResourceName42.SSH,
1456
- spec: specOf42("paste"),
1457
- fn: (accessor, paths, _texts, opts) => pasteGeneric(paths, opts, (p) => stream(accessor, p))
1458
- });
1459
-
1460
- // src/commands/builtin/ssh/patch.ts
1461
- import { ResourceName as ResourceName43, command as command43, specOf as specOf43, patchGeneric } from "@struktoai/mirage-core";
1462
- var SSH_PATCH = command43({
1463
- name: "patch",
1464
- resource: ResourceName43.SSH,
1465
- spec: specOf43("patch"),
1466
- fn: (accessor, paths, _texts, opts) => patchGeneric(
1467
- paths,
1468
- opts,
1469
- (p) => stream(accessor, p),
1470
- (p, d) => writeBytes(accessor, p, d)
1471
- ),
1472
- write: true
1473
- });
1474
-
1475
- // src/commands/builtin/ssh/readlink.ts
1476
- import {
1477
- ResourceName as ResourceName44,
1478
- command as command44,
1479
- readlinkGeneric,
1480
- specOf as specOf44
1481
- } from "@struktoai/mirage-core";
1482
- var SSH_READLINK = command44({
1483
- name: "readlink",
1484
- resource: ResourceName44.SSH,
1485
- spec: specOf44("readlink"),
1486
- fn: (_accessor, paths, texts, opts) => readlinkGeneric(paths, texts, opts)
1487
- });
1488
-
1489
- // src/commands/builtin/ssh/rev.ts
1490
- import { ResourceName as ResourceName45, command as command45, specOf as specOf45, revGeneric } from "@struktoai/mirage-core";
1491
- var SSH_REV = command45({
1492
- name: "rev",
1493
- resource: ResourceName45.SSH,
1494
- spec: specOf45("rev"),
1495
- fn: (accessor, paths, _texts, opts) => revGeneric(paths, opts, (p) => stream(accessor, p))
1496
- });
1497
-
1498
- // src/commands/builtin/ssh/sed.ts
1499
- import { ResourceName as ResourceName46, makeSed } from "@struktoai/mirage-core";
1500
- var SSH_SED = makeSed({
1501
- resource: ResourceName46.SSH,
1502
- stream: (a, p) => stream(a, p),
1503
- write: (a, p, d) => writeBytes(a, p, d)
1504
- });
1505
-
1506
- // src/commands/builtin/ssh/sha256sum.ts
1507
- import { ResourceName as ResourceName47, command as command46, sha256sumGeneric, specOf as specOf46 } from "@struktoai/mirage-core";
1508
- var SSH_SHA256SUM = command46({
1509
- name: "sha256sum",
1510
- resource: ResourceName47.SSH,
1511
- spec: specOf46("sha256sum"),
1512
- fn: (accessor, paths, _texts, opts) => sha256sumGeneric(paths, opts, (p) => stream(accessor, p))
1513
- });
1514
-
1515
- // src/commands/builtin/ssh/shuf.ts
1516
- import { ResourceName as ResourceName48, command as command47, specOf as specOf47, shufGeneric } from "@struktoai/mirage-core";
1517
- var SSH_SHUF = command47({
1518
- name: "shuf",
1519
- resource: ResourceName48.SSH,
1520
- spec: specOf47("shuf"),
1521
- fn: (accessor, paths, texts, opts) => shufGeneric(paths, texts, opts, (p) => stream(accessor, p))
1522
- });
1523
-
1524
- // src/commands/builtin/ssh/sort.ts
1525
- import { ResourceName as ResourceName49, command as command48, specOf as specOf48, sortGeneric } from "@struktoai/mirage-core";
1526
- var SSH_SORT = command48({
1527
- name: "sort",
1528
- resource: ResourceName49.SSH,
1529
- spec: specOf48("sort"),
1530
- fn: (accessor, paths, _texts, opts) => sortGeneric(paths, opts, (p) => stream(accessor, p))
1531
- });
1532
-
1533
- // src/commands/builtin/ssh/split.ts
1534
- import { ResourceName as ResourceName50, command as command49, specOf as specOf49, splitGeneric } from "@struktoai/mirage-core";
1535
- var SSH_SPLIT = command49({
1536
- name: "split",
1537
- resource: ResourceName50.SSH,
1538
- spec: specOf49("split"),
1539
- fn: (accessor, paths, _texts, opts) => splitGeneric(
1540
- paths,
1541
- opts,
1542
- (p) => stream(accessor, p),
1543
- (p, d) => writeBytes(accessor, p, d)
1544
- ),
1545
- write: true
1546
- });
1547
-
1548
- // src/commands/builtin/ssh/strings.ts
1549
- import { ResourceName as ResourceName51, command as command50, specOf as specOf50, stringsGeneric } from "@struktoai/mirage-core";
1550
- var SSH_STRINGS = command50({
1551
- name: "strings",
1552
- resource: ResourceName51.SSH,
1553
- spec: specOf50("strings"),
1554
- fn: (accessor, paths, _texts, opts) => stringsGeneric(paths, opts, (p) => stream(accessor, p))
1555
- });
1556
-
1557
- // src/commands/builtin/ssh/tac.ts
1558
- import { ResourceName as ResourceName52, command as command51, specOf as specOf51, tacGeneric } from "@struktoai/mirage-core";
1559
- var SSH_TAC = command51({
1560
- name: "tac",
1561
- resource: ResourceName52.SSH,
1562
- spec: specOf51("tac"),
1563
- fn: (accessor, paths, _texts, opts) => tacGeneric(paths, opts, (p) => stream(accessor, p))
1564
- });
1565
-
1566
- // src/commands/builtin/ssh/tar.ts
1567
- import { ResourceName as ResourceName53, command as command52, specOf as specOf52, tarGeneric } from "@struktoai/mirage-core";
1568
- var SSH_TAR = command52({
1569
- name: "tar",
1570
- resource: ResourceName53.SSH,
1571
- spec: specOf52("tar"),
1572
- fn: (accessor, paths, _texts, opts) => tarGeneric(
1573
- paths,
1574
- opts,
1575
- (p) => stream(accessor, p),
1576
- (p, data) => writeBytes(accessor, p, data),
1577
- (p) => mkdir(accessor, p, false)
1578
- ),
1579
- write: true
1580
- });
1581
-
1582
- // src/commands/builtin/ssh/tee.ts
1583
- import { ResourceName as ResourceName54, command as command53, specOf as specOf53, teeGeneric } from "@struktoai/mirage-core";
1584
- var SSH_TEE = command53({
1585
- name: "tee",
1586
- resource: ResourceName54.SSH,
1587
- spec: specOf53("tee"),
1588
- fn: (accessor, paths, texts, opts) => teeGeneric(
1589
- paths,
1590
- texts,
1591
- opts,
1592
- (p) => stream(accessor, p),
1593
- (p, d) => writeBytes(accessor, p, d)
1594
- ),
1595
- write: true
1596
- });
1597
-
1598
- // src/commands/builtin/ssh/tr.ts
1599
- import { ResourceName as ResourceName55, command as command54, specOf as specOf54, trGeneric } from "@struktoai/mirage-core";
1600
- var SSH_TR = command54({
1601
- name: "tr",
1602
- resource: ResourceName55.SSH,
1603
- spec: specOf54("tr"),
1604
- fn: (accessor, paths, texts, opts) => trGeneric(paths, texts, opts, (p) => stream(accessor, p))
1605
- });
1606
-
1607
- // src/commands/builtin/ssh/tsort.ts
1608
- import { ResourceName as ResourceName56, command as command55, specOf as specOf55, tsortGeneric } from "@struktoai/mirage-core";
1609
- var SSH_TSORT = command55({
1610
- name: "tsort",
1611
- resource: ResourceName56.SSH,
1612
- spec: specOf55("tsort"),
1613
- fn: (accessor, paths, _texts, opts) => tsortGeneric(paths, opts, (p) => stream(accessor, p))
1614
- });
1615
-
1616
- // src/commands/builtin/ssh/unexpand.ts
1617
- import { ResourceName as ResourceName57, command as command56, specOf as specOf56, unexpandGeneric } from "@struktoai/mirage-core";
1618
- var SSH_UNEXPAND = command56({
1619
- name: "unexpand",
1620
- resource: ResourceName57.SSH,
1621
- spec: specOf56("unexpand"),
1622
- fn: (accessor, paths, _texts, opts) => unexpandGeneric(paths, opts, (p) => stream(accessor, p))
1623
- });
1624
-
1625
- // src/commands/builtin/ssh/uniq.ts
1626
- import { ResourceName as ResourceName58, command as command57, specOf as specOf57, uniqGeneric } from "@struktoai/mirage-core";
1627
- var SSH_UNIQ = command57({
1628
- name: "uniq",
1629
- resource: ResourceName58.SSH,
1630
- spec: specOf57("uniq"),
1631
- fn: (accessor, paths, _texts, opts) => uniqGeneric(paths, opts, (p) => stream(accessor, p))
1632
- });
1633
-
1634
- // src/commands/builtin/ssh/unzip.ts
1635
- import { ResourceName as ResourceName59, command as command58, specOf as specOf58, unzipGeneric } from "@struktoai/mirage-core";
1636
- var SSH_UNZIP = command58({
1637
- name: "unzip",
1638
- resource: ResourceName59.SSH,
1639
- spec: specOf58("unzip"),
1640
- fn: (accessor, paths, _texts, opts) => unzipGeneric(
1641
- paths,
1642
- opts,
1643
- (p) => stream(accessor, p),
1644
- (p, d) => writeBytes(accessor, p, d),
1645
- (p, parents) => mkdir(accessor, p, parents ?? false)
1646
- ),
1647
- write: true
1648
- });
1649
-
1650
- // src/commands/builtin/ssh/xxd.ts
1651
- import { ResourceName as ResourceName60, command as command59, specOf as specOf59, xxdGeneric } from "@struktoai/mirage-core";
1652
- var SSH_XXD = command59({
1653
- name: "xxd",
1654
- resource: ResourceName60.SSH,
1655
- spec: specOf59("xxd"),
1656
- fn: (accessor, paths, _texts, opts) => xxdGeneric(paths, opts, (p) => stream(accessor, p))
1657
- });
1658
-
1659
- // src/commands/builtin/ssh/zcat.ts
1660
- import { ResourceName as ResourceName61, command as command60, specOf as specOf60, zcatGeneric } from "@struktoai/mirage-core";
1661
- var SSH_ZCAT = command60({
1662
- name: "zcat",
1663
- resource: ResourceName61.SSH,
1664
- spec: specOf60("zcat"),
1665
- fn: (accessor, paths, _texts, opts) => zcatGeneric(paths, opts, (p) => stream(accessor, p))
1666
- });
1667
-
1668
- // src/commands/builtin/ssh/zgrep.ts
1669
- import { ResourceName as ResourceName62, command as command61, specOf as specOf61, zgrepGeneric } from "@struktoai/mirage-core";
1670
- var SSH_ZGREP = command61({
1671
- name: "zgrep",
1672
- resource: ResourceName62.SSH,
1673
- spec: specOf61("zgrep"),
1674
- fn: (accessor, paths, texts, opts) => zgrepGeneric(paths, texts, opts, (p) => stream(accessor, p))
1675
- });
1676
-
1677
- // src/commands/builtin/ssh/zip_cmd.ts
1678
- import { ResourceName as ResourceName63, command as command62, specOf as specOf62, zipGeneric } from "@struktoai/mirage-core";
1679
- var SSH_ZIP = command62({
1680
- name: "zip",
1681
- resource: ResourceName63.SSH,
1682
- spec: specOf62("zip"),
1683
- fn: (accessor, paths, _texts, opts) => zipGeneric(
1684
- paths,
1685
- opts,
1686
- (p) => stream(accessor, p),
1687
- (p, d) => writeBytes(accessor, p, d)
1688
- ),
1689
- write: true
1690
- });
1691
-
1692
- // src/commands/builtin/ssh/index.ts
1693
- var SSH_COMMANDS = [
1694
- ...SSH_LS,
1695
- ...SSH_TREE,
1696
- ...SSH_CAT,
1697
- ...SSH_HEAD,
1698
- ...SSH_TAIL,
1699
- ...SSH_WC,
1700
- ...SSH_FIND,
1701
- ...SSH_GREP,
1702
- ...SSH_RG,
1703
- ...SSH_STAT,
1704
- ...SSH_JQ,
1705
- ...SSH_DU,
1706
- ...SSH_FILE,
1707
- ...SSH_BASENAME,
1708
- ...SSH_DIRNAME,
1709
- ...SSH_REALPATH,
1710
- ...SSH_CP,
1711
- ...SSH_MV,
1712
- ...SSH_RM,
1713
- ...SSH_MKDIR,
1714
- ...SSH_TOUCH,
1715
- ...SSH_AWK,
1716
- ...SSH_BASE64,
1717
- ...SSH_CMP,
1718
- ...SSH_COLUMN,
1719
- ...SSH_COMM,
1720
- ...SSH_CSPLIT,
1721
- ...SSH_CUT,
1722
- ...SSH_DIFF,
1723
- ...SSH_EXPAND,
1724
- ...SSH_FMT,
1725
- ...SSH_FOLD,
1726
- ...SSH_GUNZIP,
1727
- ...SSH_GZIP,
1728
- ...SSH_ICONV,
1729
- ...SSH_JOIN,
1730
- ...SSH_LN,
1731
- ...SSH_LOOK,
1732
- ...SSH_MD5,
1733
- ...SSH_MKTEMP,
1734
- ...SSH_NL,
1735
- ...SSH_PASTE,
1736
- ...SSH_PATCH,
1737
- ...SSH_READLINK,
1738
- ...SSH_REV,
1739
- ...SSH_SED,
1740
- ...SSH_SHA256SUM,
1741
- ...SSH_SHUF,
1742
- ...SSH_SORT,
1743
- ...SSH_SPLIT,
1744
- ...SSH_STRINGS,
1745
- ...SSH_TAC,
1746
- ...SSH_TAR,
1747
- ...SSH_TEE,
1748
- ...SSH_TR,
1749
- ...SSH_TSORT,
1750
- ...SSH_UNEXPAND,
1751
- ...SSH_UNIQ,
1752
- ...SSH_UNZIP,
1753
- ...SSH_XXD,
1754
- ...SSH_ZCAT,
1755
- ...SSH_ZGREP,
1756
- ...SSH_ZIP
1757
- ];
1758
-
1759
- // src/core/ssh/append.ts
1760
- async function appendBytes(accessor, p, data) {
1761
- const sftp = await accessor.sftp();
1762
- const virtual = stripPrefix(p);
1763
- const remote = joinRoot(accessor.config.root ?? "/", virtual);
1764
- await new Promise((resolveFn, rejectFn) => {
1765
- sftp.appendFile(remote, Buffer.from(data), (err) => {
1766
- if (err) rejectFn(err);
1767
- else resolveFn();
1768
- });
1769
- });
1770
- }
1771
-
1772
- // src/core/ssh/create.ts
1773
- function create(accessor, path) {
1774
- return writeBytes(accessor, path, new Uint8Array());
1775
- }
1776
-
1777
- // src/core/ssh/truncate.ts
1778
- async function truncate(accessor, p, length) {
1779
- let data;
1780
- try {
1781
- data = await read(accessor, p);
1782
- } catch (err) {
1783
- if (err.code === "ENOENT") {
1784
- data = new Uint8Array(0);
1785
- } else {
1786
- throw err;
1787
- }
1788
- }
1789
- const out = new Uint8Array(length);
1790
- out.set(data.subarray(0, Math.min(data.byteLength, length)));
1791
- await writeBytes(accessor, p, out);
1792
- }
1793
-
1794
- // src/ops/ssh/append.ts
1795
- import { ResourceName as ResourceName64 } from "@struktoai/mirage-core";
1796
- var appendOp = {
1797
- name: "append",
1798
- resource: ResourceName64.SSH,
1799
- filetype: null,
1800
- write: true,
1801
- fn: (accessor, path, args) => {
1802
- const data = args[0];
1803
- if (!(data instanceof Uint8Array)) {
1804
- throw new TypeError("append op requires a Uint8Array as the first arg");
1805
- }
1806
- return appendBytes(accessor, path, data);
1807
- }
1808
- };
1809
-
1810
- // src/ops/ssh/create.ts
1811
- import { ResourceName as ResourceName65 } from "@struktoai/mirage-core";
1812
- var createOp = {
1813
- name: "create",
1814
- resource: ResourceName65.SSH,
1815
- filetype: null,
1816
- write: true,
1817
- fn: (accessor, path) => {
1818
- return create(accessor, path);
1819
- }
1820
- };
1821
-
1822
- // src/ops/ssh/mkdir.ts
1823
- import { ResourceName as ResourceName66 } from "@struktoai/mirage-core";
1824
- var mkdirOp = {
1825
- name: "mkdir",
1826
- resource: ResourceName66.SSH,
1827
- filetype: null,
1828
- write: true,
1829
- fn: (accessor, path) => {
1830
- return mkdir(accessor, path, true);
1831
- }
1832
- };
1833
-
1834
- // src/ops/ssh/read.ts
1835
- import { ResourceName as ResourceName67 } from "@struktoai/mirage-core";
1836
- var readOp = {
1837
- name: "read",
1838
- resource: ResourceName67.SSH,
1839
- filetype: null,
1840
- write: false,
1841
- fn: (accessor, path) => {
1842
- return read(accessor, path);
1843
- }
1844
- };
1845
-
1846
- // src/ops/ssh/readdir.ts
1847
- import { ResourceName as ResourceName68 } from "@struktoai/mirage-core";
1848
- var readdirOp = {
1849
- name: "readdir",
1850
- resource: ResourceName68.SSH,
1851
- filetype: null,
1852
- write: false,
1853
- fn: (accessor, path) => {
1854
- return readdir(accessor, path);
1855
- }
1856
- };
1857
-
1858
- // src/ops/ssh/rename.ts
1859
- import { ResourceName as ResourceName69 } from "@struktoai/mirage-core";
1860
- var renameOp = {
1861
- name: "rename",
1862
- resource: ResourceName69.SSH,
1863
- filetype: null,
1864
- write: true,
1865
- fn: (accessor, path, args) => {
1866
- const dst = args[0];
1867
- if (dst === void 0 || dst === null || typeof dst !== "object" || !("original" in dst)) {
1868
- throw new TypeError("rename op requires a PathSpec destination as the first arg");
1869
- }
1870
- return rename(accessor, path, dst);
1871
- }
1872
- };
1873
-
1874
- // src/ops/ssh/rmdir.ts
1875
- import { ResourceName as ResourceName70 } from "@struktoai/mirage-core";
1876
- var rmdirOp = {
1877
- name: "rmdir",
1878
- resource: ResourceName70.SSH,
1879
- filetype: null,
1880
- write: true,
1881
- fn: (accessor, path) => {
1882
- return rmdir(accessor, path);
1883
- }
1884
- };
1885
-
1886
- // src/ops/ssh/stat.ts
1887
- import { ResourceName as ResourceName71 } from "@struktoai/mirage-core";
1888
- var statOp = {
1889
- name: "stat",
1890
- resource: ResourceName71.SSH,
1891
- filetype: null,
1892
- write: false,
1893
- fn: (accessor, path) => {
1894
- return stat(accessor, path);
1895
- }
1896
- };
1897
-
1898
- // src/ops/ssh/truncate.ts
1899
- import { ResourceName as ResourceName72 } from "@struktoai/mirage-core";
1900
- var truncateOp = {
1901
- name: "truncate",
1902
- resource: ResourceName72.SSH,
1903
- filetype: null,
1904
- write: true,
1905
- fn: (accessor, path, args) => {
1906
- const length = args[0];
1907
- if (typeof length !== "number") {
1908
- throw new TypeError("truncate op requires a number length as the first arg");
1909
- }
1910
- return truncate(accessor, path, length);
1911
- }
1912
- };
1913
-
1914
- // src/ops/ssh/unlink.ts
1915
- import { ResourceName as ResourceName73 } from "@struktoai/mirage-core";
1916
- var unlinkOp = {
1917
- name: "unlink",
1918
- resource: ResourceName73.SSH,
1919
- filetype: null,
1920
- write: true,
1921
- fn: (accessor, path) => {
1922
- return unlink(accessor, path);
1923
- }
1924
- };
1925
-
1926
- // src/ops/ssh/write.ts
1927
- import { extractWriteData } from "@struktoai/mirage-core";
1928
- import { ResourceName as ResourceName74 } from "@struktoai/mirage-core";
1929
- var writeOp = {
1930
- name: "write",
1931
- resource: ResourceName74.SSH,
1932
- filetype: null,
1933
- write: true,
1934
- fn: (accessor, path, args) => {
1935
- const data = extractWriteData(args);
1936
- return writeBytes(accessor, path, data);
1937
- }
1938
- };
1939
-
1940
- // src/ops/ssh/index.ts
1941
- var SSH_OPS = [
1942
- appendOp,
1943
- createOp,
1944
- mkdirOp,
1945
- readOp,
1946
- readdirOp,
1947
- renameOp,
1948
- rmdirOp,
1949
- statOp,
1950
- truncateOp,
1951
- unlinkOp,
1952
- writeOp
1953
- ];
1954
-
1955
- // src/resource/ssh/prompt.ts
1956
- var SSH_PROMPT = `{prefix}
1957
- Remote filesystem via SSH/SFTP.
1958
- IMPORTANT: This is a remote mount. Prefer targeted reads over full scans.
1959
- Supports: ls, cat, head, tail, grep, rg, wc, find, tree, stat, mkdir, touch, cp, mv, rm, tee.`;
1960
-
1961
- // src/resource/ssh/ssh.ts
1962
- var SSHResource = class extends BaseResource {
1963
- kind = ResourceName75.SSH;
1964
- cachesReads = true;
1965
- indexTtl = 60;
1966
- prompt = SSH_PROMPT;
1967
- config;
1968
- accessor;
1969
- opsMap = {
1970
- read_bytes: read,
1971
- write: writeBytes,
1972
- readdir,
1973
- stat,
1974
- unlink,
1975
- rmdir,
1976
- copy,
1977
- rename,
1978
- mkdir,
1979
- read_stream: stream,
1980
- range_read: rangeRead,
1981
- rm_recursive: rmR,
1982
- du_total: du,
1983
- du_all: duAll,
1984
- create,
1985
- truncate,
1986
- exists,
1987
- find_flat: find,
1988
- append: appendBytes
1989
- };
1990
- constructor(config) {
1991
- super();
1992
- this.config = config;
1993
- this.accessor = new SSHAccessor(config);
1994
- }
1995
- open() {
1996
- return Promise.resolve();
1997
- }
1998
- close() {
1999
- return this.accessor.close();
2000
- }
2001
- ops() {
2002
- return SSH_OPS;
2003
- }
2004
- commands() {
2005
- return SSH_COMMANDS;
2006
- }
2007
- streamPath(p) {
2008
- return stream(this.accessor, p);
2009
- }
2010
- readFile(p) {
2011
- return read(this.accessor, p);
2012
- }
2013
- writeFile(p, data) {
2014
- return writeBytes(this.accessor, p, data);
2015
- }
2016
- appendFile(p, data) {
2017
- return appendBytes(this.accessor, p, data);
2018
- }
2019
- readdir(p) {
2020
- return readdir(this.accessor, p);
2021
- }
2022
- stat(p) {
2023
- return stat(this.accessor, p);
2024
- }
2025
- exists(p) {
2026
- return exists(this.accessor, p);
2027
- }
2028
- mkdir(p, options) {
2029
- return mkdir(this.accessor, p, options?.recursive === true);
2030
- }
2031
- rmdir(p) {
2032
- return rmdir(this.accessor, p);
2033
- }
2034
- unlink(p) {
2035
- return unlink(this.accessor, p);
2036
- }
2037
- rename(src, dst) {
2038
- return rename(this.accessor, src, dst);
2039
- }
2040
- truncate(p, length) {
2041
- return truncate(this.accessor, p, length);
2042
- }
2043
- copy(src, dst) {
2044
- return copy(this.accessor, src, dst);
2045
- }
2046
- rmR(p) {
2047
- return rmR(this.accessor, p);
2048
- }
2049
- du(p) {
2050
- return du(this.accessor, p);
2051
- }
2052
- find(p, options = {}) {
2053
- return find(this.accessor, p, options);
2054
- }
2055
- async fingerprint(p) {
2056
- try {
2057
- const remote = await stat(this.accessor, p);
2058
- const mtime = remote.modified ?? "";
2059
- const size = String(remote.size ?? 0);
2060
- return `${mtime}:${size}`;
2061
- } catch (err) {
2062
- if (err.code === "ENOENT") return null;
2063
- throw err;
2064
- }
2065
- }
2066
- glob(paths, prefix = "") {
2067
- const effective = prefix ? paths.map(
2068
- (p) => p.prefix ? p : new PathSpec2({
2069
- original: p.original,
2070
- directory: p.directory,
2071
- ...p.pattern !== null ? { pattern: p.pattern } : {},
2072
- resolved: p.resolved,
2073
- prefix
2074
- })
2075
- ) : paths;
2076
- return resolveGlob(this.accessor, effective);
2077
- }
2078
- // eslint-disable-next-line @typescript-eslint/require-await
2079
- async getState() {
2080
- return {
2081
- type: this.kind,
2082
- config: redactSshConfig(this.config)
2083
- };
2084
- }
2085
- loadState(_state) {
2086
- return Promise.resolve();
2087
- }
2088
- };
2089
-
2090
- export {
2091
- SSHAccessor,
2092
- SSH_COMMANDS,
2093
- SSH_OPS,
2094
- SSH_PROMPT,
2095
- SSHResource
2096
- };
2097
- //# sourceMappingURL=chunk-WHFUWWI6.js.map