@struktoai/mirage-node 0.0.4 → 0.0.5
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.
- package/README.md +2 -1
- package/dist/aliyun-S62BR3TB.js +11 -0
- package/dist/append.lua +17 -0
- package/dist/backblaze-4EKSW63F.js +11 -0
- package/dist/box-ZPLZAGMK.js +8 -0
- package/dist/ceph-ALKLD3MO.js +11 -0
- package/dist/{chunk-VLRSOWHP.js → chunk-2A4YGVBM.js} +5 -14
- package/dist/chunk-2A4YGVBM.js.map +1 -0
- package/dist/chunk-2HCYLVGY.js +28 -0
- package/dist/chunk-2HCYLVGY.js.map +1 -0
- package/dist/chunk-2VPZAH5Q.js +20 -0
- package/dist/chunk-2VPZAH5Q.js.map +1 -0
- package/dist/{chunk-HCU3B6FW.js → chunk-3JZQ6VSZ.js} +5 -4
- package/dist/chunk-3JZQ6VSZ.js.map +1 -0
- package/dist/chunk-4IF4TGAI.js +11 -0
- package/dist/chunk-4IF4TGAI.js.map +1 -0
- package/dist/{chunk-L7FEZ7LU.js → chunk-5H6KNEPP.js} +4 -5
- package/dist/{chunk-L7FEZ7LU.js.map → chunk-5H6KNEPP.js.map} +1 -1
- package/dist/{chunk-25W4XQJZ.js → chunk-5K2MWDCE.js} +4 -5
- package/dist/{chunk-25W4XQJZ.js.map → chunk-5K2MWDCE.js.map} +1 -1
- package/dist/{chunk-L4GMDSMB.js → chunk-6SVXWRKX.js} +4 -5
- package/dist/{chunk-L4GMDSMB.js.map → chunk-6SVXWRKX.js.map} +1 -1
- package/dist/{chunk-H62XQZUM.js → chunk-6VOIUGAD.js} +22 -10
- package/dist/chunk-6VOIUGAD.js.map +1 -0
- package/dist/{chunk-SI4GMRXD.js → chunk-7JYHFXXC.js} +4 -8
- package/dist/chunk-7JYHFXXC.js.map +1 -0
- package/dist/chunk-7VQQFWV6.js +20 -0
- package/dist/chunk-7VQQFWV6.js.map +1 -0
- package/dist/chunk-7ZP6TPHX.js +87 -0
- package/dist/chunk-7ZP6TPHX.js.map +1 -0
- package/dist/{chunk-HWQPEBID.js → chunk-ADEXNSYU.js} +6 -12
- package/dist/chunk-ADEXNSYU.js.map +1 -0
- package/dist/chunk-AQSYAXL4.js +16 -0
- package/dist/chunk-AQSYAXL4.js.map +1 -0
- package/dist/{chunk-NJ42VNXG.js → chunk-ATLXMNKD.js} +8 -3
- package/dist/chunk-ATLXMNKD.js.map +1 -0
- package/dist/{chunk-CB76WPUS.js → chunk-BYCUGFRF.js} +5 -4
- package/dist/chunk-BYCUGFRF.js.map +1 -0
- package/dist/{chunk-4M73WHIE.js → chunk-BZTVYOES.js} +3 -3
- package/dist/{chunk-CQCTCW4S.js → chunk-CRC4YWXB.js} +28 -9
- package/dist/chunk-CRC4YWXB.js.map +1 -0
- package/dist/{chunk-C7TNKIK5.js → chunk-CTGXJHO5.js} +1 -1
- package/dist/chunk-CTGXJHO5.js.map +1 -0
- package/dist/{chunk-HSD24IP2.js → chunk-DCDBIXVZ.js} +7 -2
- package/dist/chunk-DCDBIXVZ.js.map +1 -0
- package/dist/{chunk-HEDE2377.js → chunk-DDAFNROK.js} +318 -322
- package/dist/chunk-DDAFNROK.js.map +1 -0
- package/dist/chunk-DQIEWEAW.js +85 -0
- package/dist/chunk-DQIEWEAW.js.map +1 -0
- package/dist/{chunk-2ERLWAGG.js → chunk-EBI4IHDC.js} +20 -11
- package/dist/chunk-EBI4IHDC.js.map +1 -0
- package/dist/{chunk-RHUEV4I7.js → chunk-EIUTZ6N7.js} +10 -24
- package/dist/chunk-EIUTZ6N7.js.map +1 -0
- package/dist/{chunk-IUXXZHY3.js → chunk-EJZG5VUF.js} +24 -12
- package/dist/chunk-EJZG5VUF.js.map +1 -0
- package/dist/{chunk-BWWU5T2D.js → chunk-ENW5BVYN.js} +3 -3
- package/dist/{chunk-F5NWRF32.js → chunk-ETIAW4YD.js} +3 -3
- package/dist/chunk-EUPXAYPB.js +20 -0
- package/dist/chunk-EUPXAYPB.js.map +1 -0
- package/dist/{chunk-EGZNOUMH.js → chunk-FA6YNU75.js} +4 -5
- package/dist/{chunk-EGZNOUMH.js.map → chunk-FA6YNU75.js.map} +1 -1
- package/dist/{chunk-XUUSWR4U.js → chunk-FFH6R5VQ.js} +7 -2
- package/dist/{chunk-XUUSWR4U.js.map → chunk-FFH6R5VQ.js.map} +1 -1
- package/dist/{chunk-JEBH5APX.js → chunk-GE6H2COM.js} +5 -13
- package/dist/chunk-GE6H2COM.js.map +1 -0
- package/dist/{chunk-TUNR4VUM.js → chunk-GMMQ3ZK4.js} +3 -3
- package/dist/{chunk-SAOQW6ZJ.js → chunk-GSGE3M5P.js} +5 -13
- package/dist/chunk-GSGE3M5P.js.map +1 -0
- package/dist/{chunk-DXU7NZPH.js → chunk-HCRYAFBI.js} +3 -3
- package/dist/{chunk-OSVZKYXS.js → chunk-HOPUP6LA.js} +192 -156
- package/dist/chunk-HOPUP6LA.js.map +1 -0
- package/dist/chunk-HS24BL6W.js +160 -0
- package/dist/chunk-HS24BL6W.js.map +1 -0
- package/dist/chunk-HVYVG5KQ.js +16 -0
- package/dist/chunk-HVYVG5KQ.js.map +1 -0
- package/dist/{chunk-XEMLYWHK.js → chunk-I7CPLZNW.js} +4 -5
- package/dist/{chunk-XEMLYWHK.js.map → chunk-I7CPLZNW.js.map} +1 -1
- package/dist/{chunk-AULFV3KY.js → chunk-IFUCGI4I.js} +7 -2
- package/dist/chunk-IFUCGI4I.js.map +1 -0
- package/dist/{chunk-HGIPWY5Y.js → chunk-IFYXSSKR.js} +6 -6
- package/dist/chunk-IFYXSSKR.js.map +1 -0
- package/dist/chunk-IXA4DQE4.js +20 -0
- package/dist/chunk-IXA4DQE4.js.map +1 -0
- package/dist/chunk-IZMKMD3O.js +11 -0
- package/dist/chunk-IZMKMD3O.js.map +1 -0
- package/dist/{chunk-4X6CLF4F.js → chunk-JJERW2BI.js} +4 -5
- package/dist/{chunk-4X6CLF4F.js.map → chunk-JJERW2BI.js.map} +1 -1
- package/dist/{chunk-M6E7VK4D.js → chunk-JQR4HVUX.js} +2 -5
- package/dist/chunk-JQR4HVUX.js.map +1 -0
- package/dist/{chunk-BWLUBJQG.js → chunk-JXOMDLFS.js} +6 -15
- package/dist/chunk-JXOMDLFS.js.map +1 -0
- package/dist/{chunk-5ZHNPNDD.js → chunk-KIX6N7NT.js} +198 -141
- package/dist/chunk-KIX6N7NT.js.map +1 -0
- package/dist/{chunk-XFSEADPC.js → chunk-L42UTDFK.js} +7 -2
- package/dist/chunk-L42UTDFK.js.map +1 -0
- package/dist/chunk-M2UF2JHJ.js +11 -0
- package/dist/chunk-M2UF2JHJ.js.map +1 -0
- package/dist/{chunk-LPLZLSMK.js → chunk-MONC734W.js} +7 -2
- package/dist/chunk-MONC734W.js.map +1 -0
- package/dist/{chunk-XADEMW6B.js → chunk-N72RLCMU.js} +4 -5
- package/dist/{chunk-XADEMW6B.js.map → chunk-N72RLCMU.js.map} +1 -1
- package/dist/{chunk-ZPB3SLPK.js → chunk-ND4IWJ4V.js} +7 -2
- package/dist/chunk-ND4IWJ4V.js.map +1 -0
- package/dist/{chunk-ZPZQXHW2.js → chunk-NZ3EKGW4.js} +260 -178
- package/dist/chunk-NZ3EKGW4.js.map +1 -0
- package/dist/{chunk-E3KXVEYI.js → chunk-OAE57MNL.js} +22 -10
- package/dist/chunk-OAE57MNL.js.map +1 -0
- package/dist/{chunk-JBDFYIN2.js → chunk-OHKGIQB4.js} +2 -5
- package/dist/chunk-OHKGIQB4.js.map +1 -0
- package/dist/{chunk-V7JVMG63.js → chunk-OXEQSPND.js} +3 -3
- package/dist/{chunk-YRJICL2Q.js → chunk-PKNE5J2B.js} +5 -13
- package/dist/chunk-PKNE5J2B.js.map +1 -0
- package/dist/chunk-PSXXEGYQ.js +16 -0
- package/dist/chunk-PSXXEGYQ.js.map +1 -0
- package/dist/{chunk-KAWDDS27.js → chunk-QAOVABCR.js} +7 -2
- package/dist/chunk-QAOVABCR.js.map +1 -0
- package/dist/{chunk-SYMNWNC3.js → chunk-QQ7FP4GD.js} +4 -5
- package/dist/{chunk-SYMNWNC3.js.map → chunk-QQ7FP4GD.js.map} +1 -1
- package/dist/{chunk-3JZN3GYO.js → chunk-QYLVMC6B.js} +2 -5
- package/dist/chunk-QYLVMC6B.js.map +1 -0
- package/dist/{chunk-CXQGMFI7.js → chunk-RX3XR65X.js} +4 -5
- package/dist/{chunk-CXQGMFI7.js.map → chunk-RX3XR65X.js.map} +1 -1
- package/dist/{chunk-MRXTUFBZ.js → chunk-RYQJJB4C.js} +1 -1
- package/dist/chunk-RYQJJB4C.js.map +1 -0
- package/dist/{chunk-5I7Q7RHW.js → chunk-TUF7TCN7.js} +4 -5
- package/dist/{chunk-5I7Q7RHW.js.map → chunk-TUF7TCN7.js.map} +1 -1
- package/dist/{chunk-NLXJMXVE.js → chunk-TUX36JY5.js} +4 -5
- package/dist/{chunk-NLXJMXVE.js.map → chunk-TUX36JY5.js.map} +1 -1
- package/dist/{chunk-4GYB7DGC.js → chunk-TWRQCQWU.js} +327 -558
- package/dist/chunk-TWRQCQWU.js.map +1 -0
- package/dist/chunk-U6DFQRG3.js +20 -0
- package/dist/chunk-U6DFQRG3.js.map +1 -0
- package/dist/chunk-VI5YTKNY.js +20 -0
- package/dist/chunk-VI5YTKNY.js.map +1 -0
- package/dist/{chunk-FRGTDZQT.js → chunk-VQDF2UH5.js} +19 -5
- package/dist/chunk-VQDF2UH5.js.map +1 -0
- package/dist/{chunk-W5ZLIQFR.js → chunk-WG5YS6TC.js} +308 -200
- package/dist/chunk-WG5YS6TC.js.map +1 -0
- package/dist/{chunk-ZM44MGC5.js → chunk-WMJJ4WGF.js} +4 -5
- package/dist/{chunk-ZM44MGC5.js.map → chunk-WMJJ4WGF.js.map} +1 -1
- package/dist/{chunk-5YRWF5RP.js → chunk-WY4FNH42.js} +6 -5
- package/dist/chunk-WY4FNH42.js.map +1 -0
- package/dist/{chunk-VBYIDRNU.js → chunk-XIG5BWWH.js} +19 -10
- package/dist/chunk-XIG5BWWH.js.map +1 -0
- package/dist/chunk-XJBC3OYX.js +11 -0
- package/dist/chunk-XJBC3OYX.js.map +1 -0
- package/dist/{chunk-ZMREYTHA.js → chunk-XPRDXWK7.js} +8 -8
- package/dist/chunk-XPRDXWK7.js.map +1 -0
- package/dist/chunk-YKRQSZS7.js +96 -0
- package/dist/chunk-YKRQSZS7.js.map +1 -0
- package/dist/{chunk-IEVLWEBO.js → chunk-YMBL3VJB.js} +9 -8
- package/dist/chunk-YMBL3VJB.js.map +1 -0
- package/dist/{chunk-CGGO5NKD.js → chunk-YUJBXFYK.js} +357 -346
- package/dist/chunk-YUJBXFYK.js.map +1 -0
- package/dist/{chunk-S4KVLPBR.js → chunk-YZ4ZJNOL.js} +22 -10
- package/dist/chunk-YZ4ZJNOL.js.map +1 -0
- package/dist/chunk-ZTHVEXIV.js +11 -0
- package/dist/chunk-ZTHVEXIV.js.map +1 -0
- package/dist/{chunk-VHED2STW.js → chunk-ZVSYUCYS.js} +2 -1
- package/dist/chunk-ZVSYUCYS.js.map +1 -0
- package/dist/{config-T2IUIU5C.js → config-2YBCHU2W.js} +2 -2
- package/dist/{config-M3Z47VYU.js → config-3YRGRW72.js} +3 -2
- package/dist/config-4GSOMUMF.js +9 -0
- package/dist/config-5YBUWFUP.js +9 -0
- package/dist/{config-2LASFFRD.js → config-5ZRKJTKG.js} +3 -2
- package/dist/{config-W7EVPJNK.js → config-A25LTL5W.js} +2 -2
- package/dist/{config-WKQ3FGTZ.js → config-CLU7JABG.js} +2 -2
- package/dist/{config-E22XAGYN.js → config-D2RF7L3N.js} +2 -2
- package/dist/{config-HQXNFQZS.js → config-E55TKM6K.js} +2 -2
- package/dist/config-ELDOFRJW.js +9 -0
- package/dist/{config-EX3ZJTZI.js → config-FPC3RBFD.js} +2 -2
- package/dist/config-FPM3LAW7.js +9 -0
- package/dist/{config-IPNWAJHH.js → config-G3F54CS4.js} +3 -2
- package/dist/{config-BBOLI7VE.js → config-G43HRUI3.js} +2 -2
- package/dist/{config-QO2XUME4.js → config-GG3WO5PB.js} +3 -2
- package/dist/{config-QWQGOXQ5.js → config-JUYBWAZE.js} +2 -2
- package/dist/{config-SPW6NESU.js → config-LJ5T6TVA.js} +2 -2
- package/dist/{config-WVILHDFV.js → config-MDSAE4O3.js} +2 -2
- package/dist/{config-MZM3IPFM.js → config-NRIOKK5T.js} +2 -2
- package/dist/{config-L7SBSH5L.js → config-OYK2BSJK.js} +2 -2
- package/dist/config-PB3KA2CE.js +9 -0
- package/dist/{config-54USUVSE.js → config-QY4IL3PH.js} +3 -2
- package/dist/{config-VKKZGC7V.js → config-R4LAOEDS.js} +2 -2
- package/dist/{config-FRK7ZL37.js → config-RIAAD6RW.js} +3 -2
- package/dist/{config-J2C53GOT.js → config-SYNEQAUB.js} +2 -2
- package/dist/{config-XU6D5C7E.js → config-TJKGYA2B.js} +3 -2
- package/dist/{config-DWSJL3NH.js → config-UURRGA7U.js} +4 -2
- package/dist/{config-BIBFLUIR.js → config-VPLHQXVE.js} +2 -2
- package/dist/config-WRACCRPN.js +9 -0
- package/dist/{config-OJ2BPESH.js → config-WVHKXEVE.js} +3 -2
- package/dist/{config-CPYFOUQO.js → config-XU7R36IE.js} +3 -2
- package/dist/{config-A2GQYJDB.js → config-Y2KOUYSS.js} +2 -2
- package/dist/databricks_volume-CNCPTZHS.js +7 -0
- package/dist/digitalocean-DJZOUB6Q.js +11 -0
- package/dist/discord-ETB2CADR.js +7 -0
- package/dist/disk-WEHSTK3F.js +7 -0
- package/dist/dropbox-XN6PGLNE.js +8 -0
- package/dist/email-OV7XCP3T.js +8 -0
- package/dist/gcal-P56MRCGU.js +8 -0
- package/dist/gcs-HFBIAE2C.js +10 -0
- package/dist/gdocs-LQ3UXP3J.js +8 -0
- package/dist/gdrive-N6UBYLON.js +8 -0
- package/dist/github-BPZREGPI.js +8 -0
- package/dist/github_ci-7A4LUIZ7.js +8 -0
- package/dist/{gmail-2TBT4CVH.js → gmail-YED2MF6H.js} +2 -2
- package/dist/gridfs-CPLQ4G62.js +9 -0
- package/dist/gsheets-4BNIJPQ6.js +8 -0
- package/dist/gslides-GDBYLO5A.js +8 -0
- package/dist/hf_buckets-FTJITQ3P.js +10 -0
- package/dist/hf_datasets-6GXVKQD7.js +10 -0
- package/dist/hf_models-PJPGZAC5.js +10 -0
- package/dist/hf_spaces-LFNFOLBF.js +10 -0
- package/dist/index.d.ts +897 -609
- package/dist/index.js +2371 -781
- package/dist/index.js.map +1 -1
- package/dist/jaeger-GCA6MJ6E.js +8 -0
- package/dist/lancedb-TJ5YSJY5.js +7 -0
- package/dist/langfuse-RUMTUMXS.js +8 -0
- package/dist/linear-BCE4KEAC.js +7 -0
- package/dist/minio-5SO6KBTK.js +11 -0
- package/dist/mongodb-7C5MBESV.js +7 -0
- package/dist/nextcloud-4O2LZVW2.js +9 -0
- package/dist/notion-RVKEAQ2M.js +7 -0
- package/dist/oci-OQXOIC62.js +10 -0
- package/dist/postgres-AV45GNRS.js +7 -0
- package/dist/qingstor-W277YA4K.js +11 -0
- package/dist/r2-FUA4IORE.js +10 -0
- package/dist/{redis-6D55Q2WB.js → redis-LPS357NF.js} +2 -2
- package/dist/s3-FPNWWIVM.js +8 -0
- package/dist/scaleway-BP3732U7.js +11 -0
- package/dist/seaweedfs-MC6HIEP4.js +11 -0
- package/dist/slack-JFGW7VLN.js +7 -0
- package/dist/ssh-UYPG42LM.js +8 -0
- package/dist/supabase-A3KUFMDC.js +10 -0
- package/dist/tencent-5464UQ2X.js +11 -0
- package/dist/trello-O2KB3FUO.js +8 -0
- package/dist/wasabi-2IKBIWNO.js +10 -0
- package/dist/wasabi-2IKBIWNO.js.map +1 -0
- package/package.json +15 -3
- package/dist/aliyun-PGI57A43.js +0 -10
- package/dist/backblaze-TSPL6Y56.js +0 -10
- package/dist/box-7XTZYDSO.js +0 -8
- package/dist/ceph-C265UI5T.js +0 -10
- package/dist/chunk-2ERLWAGG.js.map +0 -1
- package/dist/chunk-2QNPKPZZ.js +0 -59
- package/dist/chunk-2QNPKPZZ.js.map +0 -1
- package/dist/chunk-3ASOQTZB.js +0 -59
- package/dist/chunk-3ASOQTZB.js.map +0 -1
- package/dist/chunk-3JZN3GYO.js.map +0 -1
- package/dist/chunk-4GYB7DGC.js.map +0 -1
- package/dist/chunk-5YRWF5RP.js.map +0 -1
- package/dist/chunk-5ZHNPNDD.js.map +0 -1
- package/dist/chunk-AULFV3KY.js.map +0 -1
- package/dist/chunk-BWLUBJQG.js.map +0 -1
- package/dist/chunk-C7TNKIK5.js.map +0 -1
- package/dist/chunk-CB76WPUS.js.map +0 -1
- package/dist/chunk-CGGO5NKD.js.map +0 -1
- package/dist/chunk-CQCTCW4S.js.map +0 -1
- package/dist/chunk-D3U7VQCG.js +0 -25
- package/dist/chunk-D3U7VQCG.js.map +0 -1
- package/dist/chunk-E3KXVEYI.js.map +0 -1
- package/dist/chunk-EVK6HH6Z.js +0 -17
- package/dist/chunk-EVK6HH6Z.js.map +0 -1
- package/dist/chunk-FRGTDZQT.js.map +0 -1
- package/dist/chunk-GF75O2EN.js +0 -54
- package/dist/chunk-GF75O2EN.js.map +0 -1
- package/dist/chunk-GTAS3QVC.js +0 -25
- package/dist/chunk-GTAS3QVC.js.map +0 -1
- package/dist/chunk-H62XQZUM.js.map +0 -1
- package/dist/chunk-HCU3B6FW.js.map +0 -1
- package/dist/chunk-HEDE2377.js.map +0 -1
- package/dist/chunk-HGIPWY5Y.js.map +0 -1
- package/dist/chunk-HSD24IP2.js.map +0 -1
- package/dist/chunk-HWQPEBID.js.map +0 -1
- package/dist/chunk-IEHPTILN.js +0 -21
- package/dist/chunk-IEHPTILN.js.map +0 -1
- package/dist/chunk-IEVLWEBO.js.map +0 -1
- package/dist/chunk-IKJQOYI4.js +0 -26
- package/dist/chunk-IKJQOYI4.js.map +0 -1
- package/dist/chunk-IUXXZHY3.js.map +0 -1
- package/dist/chunk-JBDFYIN2.js.map +0 -1
- package/dist/chunk-JEBH5APX.js.map +0 -1
- package/dist/chunk-JHI2PHHD.js +0 -25
- package/dist/chunk-JHI2PHHD.js.map +0 -1
- package/dist/chunk-KAWDDS27.js.map +0 -1
- package/dist/chunk-KGC2OGXI.js +0 -27
- package/dist/chunk-KGC2OGXI.js.map +0 -1
- package/dist/chunk-LPLZLSMK.js.map +0 -1
- package/dist/chunk-M6E7VK4D.js.map +0 -1
- package/dist/chunk-MIQ3ECZM.js +0 -54
- package/dist/chunk-MIQ3ECZM.js.map +0 -1
- package/dist/chunk-MRXTUFBZ.js.map +0 -1
- package/dist/chunk-NJ42VNXG.js.map +0 -1
- package/dist/chunk-OSVZKYXS.js.map +0 -1
- package/dist/chunk-RHUEV4I7.js.map +0 -1
- package/dist/chunk-S4KVLPBR.js.map +0 -1
- package/dist/chunk-SAOQW6ZJ.js.map +0 -1
- package/dist/chunk-SI4GMRXD.js.map +0 -1
- package/dist/chunk-UAJYJP5C.js +0 -59
- package/dist/chunk-UAJYJP5C.js.map +0 -1
- package/dist/chunk-UYA3XL3J.js +0 -54
- package/dist/chunk-UYA3XL3J.js.map +0 -1
- package/dist/chunk-VBYIDRNU.js.map +0 -1
- package/dist/chunk-VHED2STW.js.map +0 -1
- package/dist/chunk-VIICUPWQ.js +0 -23
- package/dist/chunk-VIICUPWQ.js.map +0 -1
- package/dist/chunk-VLRSOWHP.js.map +0 -1
- package/dist/chunk-W5ZLIQFR.js.map +0 -1
- package/dist/chunk-WTSSEUOZ.js +0 -59
- package/dist/chunk-WTSSEUOZ.js.map +0 -1
- package/dist/chunk-WWP2STF5.js +0 -59
- package/dist/chunk-WWP2STF5.js.map +0 -1
- package/dist/chunk-XFSEADPC.js.map +0 -1
- package/dist/chunk-YBVMZ7SR.js +0 -59
- package/dist/chunk-YBVMZ7SR.js.map +0 -1
- package/dist/chunk-YRJICL2Q.js.map +0 -1
- package/dist/chunk-ZMREYTHA.js.map +0 -1
- package/dist/chunk-ZPB3SLPK.js.map +0 -1
- package/dist/chunk-ZPZQXHW2.js.map +0 -1
- package/dist/config-3WDIJPTG.js +0 -9
- package/dist/config-4QV4QYI5.js +0 -9
- package/dist/config-5ZXN2T2H.js +0 -9
- package/dist/config-EHE52ZTK.js +0 -9
- package/dist/config-HTXOOAOD.js +0 -9
- package/dist/config-K63RX6EU.js +0 -9
- package/dist/config-LEALEMKA.js +0 -9
- package/dist/config-RI7IEZUF.js +0 -9
- package/dist/databricks_volume-ETRDJVVQ.js +0 -7
- package/dist/digitalocean-QP72DR4J.js +0 -10
- package/dist/discord-BSN5RB3E.js +0 -8
- package/dist/disk-24NWTN2I.js +0 -7
- package/dist/dropbox-OSTZXSIE.js +0 -8
- package/dist/email-4ZFPSWIN.js +0 -8
- package/dist/gcs-PFWR6MIW.js +0 -10
- package/dist/gdocs-GPAZRQG5.js +0 -8
- package/dist/gdrive-XSX6A7B3.js +0 -8
- package/dist/github-EQ4NXUTA.js +0 -8
- package/dist/github_ci-QL5B2Q2N.js +0 -8
- package/dist/gridfs-KZRZ6SIB.js +0 -9
- package/dist/gsheets-N53WEXN2.js +0 -8
- package/dist/gslides-TATSARTH.js +0 -8
- package/dist/hf_buckets-BK7NGJWS.js +0 -10
- package/dist/hf_datasets-UQ5QGM4L.js +0 -10
- package/dist/hf_models-75LFCQCS.js +0 -10
- package/dist/hf_spaces-6T2KB3UC.js +0 -10
- package/dist/langfuse-AMQCQWNE.js +0 -8
- package/dist/linear-V3TXO6CV.js +0 -8
- package/dist/minio-IZRZY4C5.js +0 -10
- package/dist/mongodb-VMKPQCPX.js +0 -7
- package/dist/nextcloud-5RHQCGDO.js +0 -9
- package/dist/notion-6PPNTQFM.js +0 -8
- package/dist/oci-CKYBSFZJ.js +0 -10
- package/dist/postgres-WIQBVL5M.js +0 -7
- package/dist/qingstor-AP4IIPLY.js +0 -10
- package/dist/r2-C4XGEWQY.js +0 -10
- package/dist/s3-XQBI2CXN.js +0 -8
- package/dist/scaleway-SEZJVURB.js +0 -10
- package/dist/seaweedfs-3XYIAFU2.js +0 -10
- package/dist/slack-ZHXDJQY4.js +0 -8
- package/dist/ssh-X2MO7JOV.js +0 -8
- package/dist/supabase-BBM44UTM.js +0 -10
- package/dist/tencent-X72USLJ7.js +0 -10
- package/dist/trello-EER5NG7L.js +0 -8
- package/dist/wasabi-O4MVIUFG.js +0 -10
- /package/dist/{aliyun-PGI57A43.js.map → aliyun-S62BR3TB.js.map} +0 -0
- /package/dist/{backblaze-TSPL6Y56.js.map → backblaze-4EKSW63F.js.map} +0 -0
- /package/dist/{box-7XTZYDSO.js.map → box-ZPLZAGMK.js.map} +0 -0
- /package/dist/{ceph-C265UI5T.js.map → ceph-ALKLD3MO.js.map} +0 -0
- /package/dist/{chunk-4M73WHIE.js.map → chunk-BZTVYOES.js.map} +0 -0
- /package/dist/{chunk-BWWU5T2D.js.map → chunk-ENW5BVYN.js.map} +0 -0
- /package/dist/{chunk-F5NWRF32.js.map → chunk-ETIAW4YD.js.map} +0 -0
- /package/dist/{chunk-TUNR4VUM.js.map → chunk-GMMQ3ZK4.js.map} +0 -0
- /package/dist/{chunk-DXU7NZPH.js.map → chunk-HCRYAFBI.js.map} +0 -0
- /package/dist/{chunk-V7JVMG63.js.map → chunk-OXEQSPND.js.map} +0 -0
- /package/dist/{config-2LASFFRD.js.map → config-2YBCHU2W.js.map} +0 -0
- /package/dist/{config-3WDIJPTG.js.map → config-3YRGRW72.js.map} +0 -0
- /package/dist/{config-4QV4QYI5.js.map → config-4GSOMUMF.js.map} +0 -0
- /package/dist/{config-54USUVSE.js.map → config-5YBUWFUP.js.map} +0 -0
- /package/dist/{config-5ZXN2T2H.js.map → config-5ZRKJTKG.js.map} +0 -0
- /package/dist/{config-A2GQYJDB.js.map → config-A25LTL5W.js.map} +0 -0
- /package/dist/{config-BBOLI7VE.js.map → config-CLU7JABG.js.map} +0 -0
- /package/dist/{config-BIBFLUIR.js.map → config-D2RF7L3N.js.map} +0 -0
- /package/dist/{config-CPYFOUQO.js.map → config-E55TKM6K.js.map} +0 -0
- /package/dist/{config-DWSJL3NH.js.map → config-ELDOFRJW.js.map} +0 -0
- /package/dist/{config-E22XAGYN.js.map → config-FPC3RBFD.js.map} +0 -0
- /package/dist/{config-EHE52ZTK.js.map → config-FPM3LAW7.js.map} +0 -0
- /package/dist/{config-EX3ZJTZI.js.map → config-G3F54CS4.js.map} +0 -0
- /package/dist/{config-FRK7ZL37.js.map → config-G43HRUI3.js.map} +0 -0
- /package/dist/{config-HQXNFQZS.js.map → config-GG3WO5PB.js.map} +0 -0
- /package/dist/{config-HTXOOAOD.js.map → config-JUYBWAZE.js.map} +0 -0
- /package/dist/{config-IPNWAJHH.js.map → config-LJ5T6TVA.js.map} +0 -0
- /package/dist/{config-J2C53GOT.js.map → config-MDSAE4O3.js.map} +0 -0
- /package/dist/{config-K63RX6EU.js.map → config-NRIOKK5T.js.map} +0 -0
- /package/dist/{config-L7SBSH5L.js.map → config-OYK2BSJK.js.map} +0 -0
- /package/dist/{config-LEALEMKA.js.map → config-PB3KA2CE.js.map} +0 -0
- /package/dist/{config-M3Z47VYU.js.map → config-QY4IL3PH.js.map} +0 -0
- /package/dist/{config-MZM3IPFM.js.map → config-R4LAOEDS.js.map} +0 -0
- /package/dist/{config-OJ2BPESH.js.map → config-RIAAD6RW.js.map} +0 -0
- /package/dist/{config-QO2XUME4.js.map → config-SYNEQAUB.js.map} +0 -0
- /package/dist/{config-QWQGOXQ5.js.map → config-TJKGYA2B.js.map} +0 -0
- /package/dist/{config-RI7IEZUF.js.map → config-UURRGA7U.js.map} +0 -0
- /package/dist/{config-SPW6NESU.js.map → config-VPLHQXVE.js.map} +0 -0
- /package/dist/{config-T2IUIU5C.js.map → config-WRACCRPN.js.map} +0 -0
- /package/dist/{config-VKKZGC7V.js.map → config-WVHKXEVE.js.map} +0 -0
- /package/dist/{config-W7EVPJNK.js.map → config-XU7R36IE.js.map} +0 -0
- /package/dist/{config-WKQ3FGTZ.js.map → config-Y2KOUYSS.js.map} +0 -0
- /package/dist/{config-WVILHDFV.js.map → databricks_volume-CNCPTZHS.js.map} +0 -0
- /package/dist/{config-XU6D5C7E.js.map → digitalocean-DJZOUB6Q.js.map} +0 -0
- /package/dist/{databricks_volume-ETRDJVVQ.js.map → discord-ETB2CADR.js.map} +0 -0
- /package/dist/{digitalocean-QP72DR4J.js.map → disk-WEHSTK3F.js.map} +0 -0
- /package/dist/{discord-BSN5RB3E.js.map → dropbox-XN6PGLNE.js.map} +0 -0
- /package/dist/{disk-24NWTN2I.js.map → email-OV7XCP3T.js.map} +0 -0
- /package/dist/{dropbox-OSTZXSIE.js.map → gcal-P56MRCGU.js.map} +0 -0
- /package/dist/{email-4ZFPSWIN.js.map → gcs-HFBIAE2C.js.map} +0 -0
- /package/dist/{gcs-PFWR6MIW.js.map → gdocs-LQ3UXP3J.js.map} +0 -0
- /package/dist/{gdocs-GPAZRQG5.js.map → gdrive-N6UBYLON.js.map} +0 -0
- /package/dist/{gdrive-XSX6A7B3.js.map → github-BPZREGPI.js.map} +0 -0
- /package/dist/{github-EQ4NXUTA.js.map → github_ci-7A4LUIZ7.js.map} +0 -0
- /package/dist/{github_ci-QL5B2Q2N.js.map → gmail-YED2MF6H.js.map} +0 -0
- /package/dist/{gmail-2TBT4CVH.js.map → gridfs-CPLQ4G62.js.map} +0 -0
- /package/dist/{gridfs-KZRZ6SIB.js.map → gsheets-4BNIJPQ6.js.map} +0 -0
- /package/dist/{gsheets-N53WEXN2.js.map → gslides-GDBYLO5A.js.map} +0 -0
- /package/dist/{gslides-TATSARTH.js.map → hf_buckets-FTJITQ3P.js.map} +0 -0
- /package/dist/{hf_buckets-BK7NGJWS.js.map → hf_datasets-6GXVKQD7.js.map} +0 -0
- /package/dist/{hf_datasets-UQ5QGM4L.js.map → hf_models-PJPGZAC5.js.map} +0 -0
- /package/dist/{hf_models-75LFCQCS.js.map → hf_spaces-LFNFOLBF.js.map} +0 -0
- /package/dist/{hf_spaces-6T2KB3UC.js.map → jaeger-GCA6MJ6E.js.map} +0 -0
- /package/dist/{langfuse-AMQCQWNE.js.map → lancedb-TJ5YSJY5.js.map} +0 -0
- /package/dist/{linear-V3TXO6CV.js.map → langfuse-RUMTUMXS.js.map} +0 -0
- /package/dist/{minio-IZRZY4C5.js.map → linear-BCE4KEAC.js.map} +0 -0
- /package/dist/{mongodb-VMKPQCPX.js.map → minio-5SO6KBTK.js.map} +0 -0
- /package/dist/{nextcloud-5RHQCGDO.js.map → mongodb-7C5MBESV.js.map} +0 -0
- /package/dist/{notion-6PPNTQFM.js.map → nextcloud-4O2LZVW2.js.map} +0 -0
- /package/dist/{oci-CKYBSFZJ.js.map → notion-RVKEAQ2M.js.map} +0 -0
- /package/dist/{postgres-WIQBVL5M.js.map → oci-OQXOIC62.js.map} +0 -0
- /package/dist/{qingstor-AP4IIPLY.js.map → postgres-AV45GNRS.js.map} +0 -0
- /package/dist/{r2-C4XGEWQY.js.map → qingstor-W277YA4K.js.map} +0 -0
- /package/dist/{redis-6D55Q2WB.js.map → r2-FUA4IORE.js.map} +0 -0
- /package/dist/{s3-XQBI2CXN.js.map → redis-LPS357NF.js.map} +0 -0
- /package/dist/{scaleway-SEZJVURB.js.map → s3-FPNWWIVM.js.map} +0 -0
- /package/dist/{seaweedfs-3XYIAFU2.js.map → scaleway-BP3732U7.js.map} +0 -0
- /package/dist/{slack-ZHXDJQY4.js.map → seaweedfs-MC6HIEP4.js.map} +0 -0
- /package/dist/{ssh-X2MO7JOV.js.map → slack-JFGW7VLN.js.map} +0 -0
- /package/dist/{supabase-BBM44UTM.js.map → ssh-UYPG42LM.js.map} +0 -0
- /package/dist/{tencent-X72USLJ7.js.map → supabase-A3KUFMDC.js.map} +0 -0
- /package/dist/{trello-EER5NG7L.js.map → tencent-5464UQ2X.js.map} +0 -0
- /package/dist/{wasabi-O4MVIUFG.js.map → trello-O2KB3FUO.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,234 +1,244 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DropboxResource
|
|
3
|
-
} from "./chunk-HWQPEBID.js";
|
|
4
1
|
import {
|
|
5
2
|
BoxResource
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JXOMDLFS.js";
|
|
7
4
|
import {
|
|
8
5
|
normalizeBoxConfig,
|
|
9
6
|
redactBoxConfig
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-L42UTDFK.js";
|
|
11
8
|
import {
|
|
12
9
|
GmailResource
|
|
13
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BYCUGFRF.js";
|
|
14
11
|
import {
|
|
15
|
-
normalizeGoogleConfig,
|
|
16
|
-
redactGoogleConfig
|
|
12
|
+
normalizeGoogleConfig as normalizeGoogleConfig5,
|
|
13
|
+
redactGoogleConfig as redactGoogleConfig5
|
|
17
14
|
} from "./chunk-LPDLPRPS.js";
|
|
15
|
+
import {
|
|
16
|
+
GCalResource
|
|
17
|
+
} from "./chunk-DQIEWEAW.js";
|
|
18
|
+
import {
|
|
19
|
+
normalizeGoogleConfig as normalizeGoogleConfig6,
|
|
20
|
+
redactGoogleConfig as redactGoogleConfig6
|
|
21
|
+
} from "./chunk-ZTHVEXIV.js";
|
|
18
22
|
import {
|
|
19
23
|
EMAIL_COMMANDS,
|
|
20
24
|
EMAIL_OPS,
|
|
21
25
|
EMAIL_PROMPT,
|
|
22
26
|
EMAIL_WRITE_PROMPT,
|
|
23
27
|
EmailAccessor,
|
|
24
|
-
EmailResource
|
|
25
|
-
|
|
28
|
+
EmailResource,
|
|
29
|
+
fetchHeaders,
|
|
30
|
+
fetchMessage,
|
|
31
|
+
fetchRawMessage,
|
|
32
|
+
listFolderEntries,
|
|
33
|
+
listMessageUids,
|
|
34
|
+
messageJsonBytes,
|
|
35
|
+
messagesJsonBytes,
|
|
36
|
+
parseRfc822
|
|
37
|
+
} from "./chunk-TWRQCQWU.js";
|
|
26
38
|
import {
|
|
39
|
+
EmailConfigSchema,
|
|
27
40
|
buildEmailConfig,
|
|
28
41
|
normalizeEmailConfig,
|
|
29
42
|
redactEmailConfig
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import {
|
|
32
|
-
GDocsResource
|
|
33
|
-
} from "./chunk-JEBH5APX.js";
|
|
43
|
+
} from "./chunk-CRC4YWXB.js";
|
|
34
44
|
import {
|
|
35
45
|
GSheetsResource
|
|
36
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-GSGE3M5P.js";
|
|
37
47
|
import {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} from "./chunk-
|
|
48
|
+
normalizeGoogleConfig as normalizeGoogleConfig2,
|
|
49
|
+
redactGoogleConfig as redactGoogleConfig2
|
|
50
|
+
} from "./chunk-M2UF2JHJ.js";
|
|
41
51
|
import {
|
|
42
52
|
GSlidesResource
|
|
43
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-PKNE5J2B.js";
|
|
44
54
|
import {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} from "./chunk-
|
|
55
|
+
normalizeGoogleConfig as normalizeGoogleConfig3,
|
|
56
|
+
redactGoogleConfig as redactGoogleConfig3
|
|
57
|
+
} from "./chunk-4IF4TGAI.js";
|
|
48
58
|
import {
|
|
49
59
|
GDriveResource
|
|
50
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-2A4YGVBM.js";
|
|
61
|
+
import {
|
|
62
|
+
normalizeGoogleConfig as normalizeGoogleConfig4,
|
|
63
|
+
redactGoogleConfig as redactGoogleConfig4
|
|
64
|
+
} from "./chunk-IZMKMD3O.js";
|
|
51
65
|
import {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} from "./chunk-KGC2OGXI.js";
|
|
66
|
+
DropboxResource
|
|
67
|
+
} from "./chunk-ADEXNSYU.js";
|
|
55
68
|
import {
|
|
56
69
|
normalizeDropboxConfig,
|
|
57
70
|
redactDropboxConfig
|
|
58
|
-
} from "./chunk-
|
|
59
|
-
import {
|
|
60
|
-
NotionResource
|
|
61
|
-
} from "./chunk-SI4GMRXD.js";
|
|
71
|
+
} from "./chunk-DCDBIXVZ.js";
|
|
62
72
|
import {
|
|
63
|
-
|
|
64
|
-
} from "./chunk-
|
|
65
|
-
import
|
|
66
|
-
normalizeLangfuseConfig,
|
|
67
|
-
redactLangfuseConfig
|
|
68
|
-
} from "./chunk-AULFV3KY.js";
|
|
73
|
+
JaegerResource
|
|
74
|
+
} from "./chunk-YKRQSZS7.js";
|
|
75
|
+
import "./chunk-2HCYLVGY.js";
|
|
69
76
|
import {
|
|
70
77
|
GitHubResource
|
|
71
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-WY4FNH42.js";
|
|
72
79
|
import {
|
|
73
80
|
normalizeGitHubConfig,
|
|
74
81
|
redactGitHubConfig
|
|
75
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-FFH6R5VQ.js";
|
|
76
83
|
import {
|
|
77
84
|
GitHubCIResource
|
|
78
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-OHKGIQB4.js";
|
|
79
86
|
import {
|
|
80
87
|
normalizeGitHubCIConfig,
|
|
81
88
|
redactGitHubCIConfig
|
|
82
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-ND4IWJ4V.js";
|
|
90
|
+
import {
|
|
91
|
+
GDocsResource
|
|
92
|
+
} from "./chunk-GE6H2COM.js";
|
|
83
93
|
import {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
} from "./chunk-
|
|
94
|
+
normalizeGoogleConfig,
|
|
95
|
+
redactGoogleConfig
|
|
96
|
+
} from "./chunk-XJBC3OYX.js";
|
|
87
97
|
import {
|
|
88
98
|
NEXTCLOUD_COMMANDS,
|
|
89
99
|
NEXTCLOUD_OPS,
|
|
90
100
|
NEXTCLOUD_PROMPT,
|
|
91
101
|
NextcloudAccessor,
|
|
92
|
-
NextcloudResource
|
|
93
|
-
|
|
102
|
+
NextcloudResource,
|
|
103
|
+
NextcloudWalk,
|
|
104
|
+
buildDeltaHook
|
|
105
|
+
} from "./chunk-NZ3EKGW4.js";
|
|
94
106
|
import {
|
|
95
107
|
DiscordResource
|
|
96
|
-
} from "./chunk-
|
|
97
|
-
import {
|
|
98
|
-
normalizeDiscordConfig,
|
|
99
|
-
redactDiscordConfig
|
|
100
|
-
} from "./chunk-EVK6HH6Z.js";
|
|
108
|
+
} from "./chunk-EIUTZ6N7.js";
|
|
101
109
|
import {
|
|
102
110
|
TrelloResource
|
|
103
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-QYLVMC6B.js";
|
|
104
112
|
import {
|
|
105
113
|
normalizeTrelloConfig,
|
|
106
114
|
redactTrelloConfig
|
|
107
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-ATLXMNKD.js";
|
|
108
116
|
import {
|
|
109
117
|
LinearResource
|
|
110
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-XPRDXWK7.js";
|
|
111
119
|
import {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
} from "./chunk-IKJQOYI4.js";
|
|
120
|
+
NotionResource
|
|
121
|
+
} from "./chunk-7JYHFXXC.js";
|
|
115
122
|
import {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
123
|
+
LangfuseResource
|
|
124
|
+
} from "./chunk-JQR4HVUX.js";
|
|
125
|
+
import {
|
|
126
|
+
normalizeLangfuseConfig,
|
|
127
|
+
redactLangfuseConfig
|
|
128
|
+
} from "./chunk-IFUCGI4I.js";
|
|
119
129
|
import {
|
|
120
130
|
QINGSTOR_PROMPT,
|
|
121
131
|
QingStorResource
|
|
122
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-TUF7TCN7.js";
|
|
123
133
|
import {
|
|
124
134
|
PostgresResource,
|
|
125
135
|
PostgresStore
|
|
126
|
-
} from "./chunk-
|
|
136
|
+
} from "./chunk-ZVSYUCYS.js";
|
|
127
137
|
import {
|
|
128
138
|
MongoDBResource,
|
|
129
139
|
MongoDBStore
|
|
130
|
-
} from "./chunk-
|
|
140
|
+
} from "./chunk-VQDF2UH5.js";
|
|
131
141
|
import {
|
|
132
|
-
|
|
133
|
-
|
|
142
|
+
LanceDBResource,
|
|
143
|
+
LanceDBStore
|
|
144
|
+
} from "./chunk-HS24BL6W.js";
|
|
134
145
|
import {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
} from "./chunk-IEHPTILN.js";
|
|
146
|
+
SlackResource
|
|
147
|
+
} from "./chunk-YMBL3VJB.js";
|
|
138
148
|
import {
|
|
139
149
|
SSHAccessor,
|
|
140
150
|
SSHResource,
|
|
141
151
|
SSH_COMMANDS,
|
|
142
152
|
SSH_OPS,
|
|
143
153
|
SSH_PROMPT
|
|
144
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-KIX6N7NT.js";
|
|
145
155
|
import {
|
|
146
156
|
normalizeSshConfig,
|
|
147
157
|
redactSshConfig
|
|
148
|
-
} from "./chunk-
|
|
158
|
+
} from "./chunk-MONC734W.js";
|
|
149
159
|
import {
|
|
150
160
|
normalizeNextcloudConfig,
|
|
151
161
|
redactNextcloudConfig
|
|
152
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-RYQJJB4C.js";
|
|
153
163
|
import {
|
|
154
164
|
DIGITALOCEAN_PROMPT,
|
|
155
165
|
DigitalOceanResource
|
|
156
|
-
} from "./chunk-
|
|
166
|
+
} from "./chunk-RX3XR65X.js";
|
|
157
167
|
import {
|
|
158
168
|
TENCENT_PROMPT,
|
|
159
169
|
TencentResource
|
|
160
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-FA6YNU75.js";
|
|
161
171
|
import {
|
|
162
172
|
redactTencentConfig,
|
|
163
173
|
resolvedTencentEndpoint
|
|
164
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-2VPZAH5Q.js";
|
|
165
175
|
import {
|
|
166
176
|
ALIYUN_PROMPT,
|
|
167
177
|
AliyunResource
|
|
168
|
-
} from "./chunk-
|
|
178
|
+
} from "./chunk-I7CPLZNW.js";
|
|
169
179
|
import {
|
|
170
180
|
redactAliyunConfig,
|
|
171
181
|
resolvedAliyunEndpoint
|
|
172
|
-
} from "./chunk-
|
|
182
|
+
} from "./chunk-U6DFQRG3.js";
|
|
173
183
|
import {
|
|
174
184
|
SCALEWAY_PROMPT,
|
|
175
185
|
ScalewayResource
|
|
176
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-6SVXWRKX.js";
|
|
177
187
|
import {
|
|
178
188
|
redactScalewayConfig,
|
|
179
189
|
resolvedScalewayEndpoint
|
|
180
|
-
} from "./chunk-
|
|
190
|
+
} from "./chunk-7VQQFWV6.js";
|
|
181
191
|
import {
|
|
182
192
|
redactQingStorConfig,
|
|
183
193
|
resolvedQingStorEndpoint
|
|
184
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-IXA4DQE4.js";
|
|
185
195
|
import {
|
|
186
196
|
SEAWEEDFS_PROMPT,
|
|
187
197
|
SeaweedFSResource
|
|
188
|
-
} from "./chunk-
|
|
198
|
+
} from "./chunk-TUX36JY5.js";
|
|
189
199
|
import {
|
|
190
200
|
CEPH_PROMPT,
|
|
191
201
|
CephResource
|
|
192
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-N72RLCMU.js";
|
|
193
203
|
import {
|
|
194
204
|
redactCephConfig
|
|
195
|
-
} from "./chunk-
|
|
205
|
+
} from "./chunk-PSXXEGYQ.js";
|
|
196
206
|
import {
|
|
197
207
|
WASABI_PROMPT,
|
|
198
208
|
WasabiResource
|
|
199
|
-
} from "./chunk-
|
|
209
|
+
} from "./chunk-5H6KNEPP.js";
|
|
200
210
|
import {
|
|
201
211
|
redactWasabiConfig,
|
|
202
212
|
resolvedWasabiEndpoint
|
|
203
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-YZ4ZJNOL.js";
|
|
204
214
|
import {
|
|
205
215
|
BACKBLAZE_PROMPT,
|
|
206
216
|
BackblazeResource
|
|
207
|
-
} from "./chunk-
|
|
217
|
+
} from "./chunk-QQ7FP4GD.js";
|
|
208
218
|
import {
|
|
209
219
|
redactBackblazeConfig,
|
|
210
220
|
resolvedBackblazeEndpoint
|
|
211
|
-
} from "./chunk-
|
|
221
|
+
} from "./chunk-EUPXAYPB.js";
|
|
212
222
|
import {
|
|
213
223
|
redactDigitalOceanConfig,
|
|
214
224
|
resolvedDigitalOceanEndpoint
|
|
215
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-VI5YTKNY.js";
|
|
216
226
|
import {
|
|
217
227
|
HF_BUCKETS_PROMPT,
|
|
218
228
|
HfBucketsResource
|
|
219
|
-
} from "./chunk-
|
|
229
|
+
} from "./chunk-BZTVYOES.js";
|
|
220
230
|
import {
|
|
221
231
|
HF_DATASETS_PROMPT,
|
|
222
232
|
HfDatasetsResource
|
|
223
|
-
} from "./chunk-
|
|
233
|
+
} from "./chunk-HCRYAFBI.js";
|
|
224
234
|
import {
|
|
225
235
|
HF_MODELS_PROMPT,
|
|
226
236
|
HfModelsResource
|
|
227
|
-
} from "./chunk-
|
|
237
|
+
} from "./chunk-OXEQSPND.js";
|
|
228
238
|
import {
|
|
229
239
|
HF_SPACES_PROMPT,
|
|
230
240
|
HfSpacesResource
|
|
231
|
-
} from "./chunk-
|
|
241
|
+
} from "./chunk-ENW5BVYN.js";
|
|
232
242
|
import {
|
|
233
243
|
HF_COMMANDS,
|
|
234
244
|
HF_OPS,
|
|
@@ -238,7 +248,7 @@ import {
|
|
|
238
248
|
HfDatasetsAccessor,
|
|
239
249
|
HfModelsAccessor,
|
|
240
250
|
HfSpacesAccessor
|
|
241
|
-
} from "./chunk-
|
|
251
|
+
} from "./chunk-DDAFNROK.js";
|
|
242
252
|
import {
|
|
243
253
|
HF_ENDPOINT,
|
|
244
254
|
assertHfRepoId,
|
|
@@ -246,53 +256,54 @@ import {
|
|
|
246
256
|
normalizeHfRepoConfig,
|
|
247
257
|
redactHfBucketsConfig,
|
|
248
258
|
redactHfRepoConfig
|
|
249
|
-
} from "./chunk-
|
|
259
|
+
} from "./chunk-QAOVABCR.js";
|
|
250
260
|
import {
|
|
251
261
|
MINIO_PROMPT,
|
|
252
262
|
MinIOResource
|
|
253
|
-
} from "./chunk-
|
|
263
|
+
} from "./chunk-JJERW2BI.js";
|
|
254
264
|
import {
|
|
255
265
|
redactMinIOConfig
|
|
256
|
-
} from "./chunk-
|
|
266
|
+
} from "./chunk-HVYVG5KQ.js";
|
|
257
267
|
import {
|
|
258
268
|
redactSeaweedFSConfig
|
|
259
|
-
} from "./chunk-
|
|
269
|
+
} from "./chunk-AQSYAXL4.js";
|
|
270
|
+
import "./chunk-7ZP6TPHX.js";
|
|
260
271
|
import {
|
|
261
272
|
GCSResource,
|
|
262
273
|
GCS_PROMPT
|
|
263
|
-
} from "./chunk-
|
|
274
|
+
} from "./chunk-5K2MWDCE.js";
|
|
264
275
|
import {
|
|
265
276
|
GCS_ENDPOINT,
|
|
266
277
|
redactGcsConfig
|
|
267
|
-
} from "./chunk-
|
|
278
|
+
} from "./chunk-OAE57MNL.js";
|
|
268
279
|
import {
|
|
269
280
|
OCIResource,
|
|
270
281
|
OCI_PROMPT
|
|
271
|
-
} from "./chunk-
|
|
282
|
+
} from "./chunk-GMMQ3ZK4.js";
|
|
272
283
|
import {
|
|
273
284
|
redactOciConfig
|
|
274
|
-
} from "./chunk-
|
|
285
|
+
} from "./chunk-6VOIUGAD.js";
|
|
275
286
|
import {
|
|
276
287
|
R2Resource,
|
|
277
288
|
R2_PROMPT
|
|
278
|
-
} from "./chunk-
|
|
289
|
+
} from "./chunk-WMJJ4WGF.js";
|
|
279
290
|
import {
|
|
280
291
|
redactR2Config
|
|
281
|
-
} from "./chunk-
|
|
292
|
+
} from "./chunk-XIG5BWWH.js";
|
|
282
293
|
import {
|
|
283
294
|
SUPABASE_PROMPT,
|
|
284
295
|
SupabaseResource
|
|
285
|
-
} from "./chunk-
|
|
296
|
+
} from "./chunk-ETIAW4YD.js";
|
|
286
297
|
import {
|
|
287
298
|
redactSupabaseConfig,
|
|
288
299
|
resolvedSupabaseEndpoint
|
|
289
|
-
} from "./chunk-
|
|
300
|
+
} from "./chunk-EBI4IHDC.js";
|
|
290
301
|
import {
|
|
291
302
|
DISK_COMMANDS,
|
|
292
303
|
DISK_OPS,
|
|
293
304
|
DISK_PROMPT,
|
|
294
305
|
DiskResource
|
|
295
|
-
} from "./chunk-
|
|
306
|
+
} from "./chunk-WG5YS6TC.js";
|
|
296
307
|
import {
|
|
297
308
|
REDIS_COMMANDS,
|
|
298
309
|
REDIS_OPS,
|
|
@@ -301,28 +312,30 @@ import {
|
|
|
301
312
|
RedisResource,
|
|
302
313
|
RedisStore,
|
|
303
314
|
stat
|
|
304
|
-
} from "./chunk-
|
|
315
|
+
} from "./chunk-HOPUP6LA.js";
|
|
305
316
|
import {
|
|
306
317
|
S3Resource
|
|
307
|
-
} from "./chunk-
|
|
318
|
+
} from "./chunk-EJZG5VUF.js";
|
|
308
319
|
import {
|
|
320
|
+
normalizeS3Config,
|
|
309
321
|
redactConfig
|
|
310
|
-
} from "./chunk-
|
|
322
|
+
} from "./chunk-3JZQ6VSZ.js";
|
|
311
323
|
import {
|
|
324
|
+
GRIDFS_COMMANDS,
|
|
312
325
|
GridFSAccessor,
|
|
313
326
|
GridFSResource
|
|
314
|
-
} from "./chunk-
|
|
327
|
+
} from "./chunk-YUJBXFYK.js";
|
|
315
328
|
import {
|
|
316
329
|
loadOptionalPeer
|
|
317
330
|
} from "./chunk-OQKNDS66.js";
|
|
318
331
|
import {
|
|
319
332
|
normalizeGridFSConfig
|
|
320
|
-
} from "./chunk-
|
|
333
|
+
} from "./chunk-CTGXJHO5.js";
|
|
321
334
|
import {
|
|
322
335
|
DatabricksVolumeResource,
|
|
323
336
|
loadDatabricksProfile,
|
|
324
337
|
parseDatabricksCfg
|
|
325
|
-
} from "./chunk-
|
|
338
|
+
} from "./chunk-IFYXSSKR.js";
|
|
326
339
|
|
|
327
340
|
// src/index.ts
|
|
328
341
|
export * from "@struktoai/mirage-core";
|
|
@@ -332,6 +345,8 @@ import { readFileSync } from "fs";
|
|
|
332
345
|
import { createRequire as createRequire2 } from "module";
|
|
333
346
|
import {
|
|
334
347
|
createShellParser,
|
|
348
|
+
KERNEL_BACKENDS as KERNEL_BACKENDS2,
|
|
349
|
+
MountBackend as MountBackend3,
|
|
335
350
|
Workspace as CoreWorkspace
|
|
336
351
|
} from "@struktoai/mirage-core";
|
|
337
352
|
|
|
@@ -340,20 +355,191 @@ import { rmdirSync } from "fs";
|
|
|
340
355
|
|
|
341
356
|
// src/fuse/mount.ts
|
|
342
357
|
import { execSync } from "child_process";
|
|
358
|
+
import { randomBytes } from "crypto";
|
|
343
359
|
import { mkdirSync, mkdtempSync } from "fs";
|
|
344
360
|
import { tmpdir } from "os";
|
|
345
|
-
import { join } from "path";
|
|
361
|
+
import { basename, join } from "path";
|
|
362
|
+
import { MountBackend as MountBackend2 } from "@struktoai/mirage-core";
|
|
346
363
|
|
|
347
|
-
// src/fuse/
|
|
364
|
+
// src/fuse/backend.ts
|
|
348
365
|
import { posix } from "path";
|
|
349
366
|
import {
|
|
367
|
+
KERNEL_BACKENDS,
|
|
368
|
+
MountBackend,
|
|
369
|
+
MountMode,
|
|
370
|
+
rstripSlash,
|
|
371
|
+
sizesAlwaysKnown
|
|
372
|
+
} from "@struktoai/mirage-core";
|
|
373
|
+
var FSKIT_MOUNT_ROOT = "/Volumes";
|
|
374
|
+
function resolveBackend(value) {
|
|
375
|
+
if (value === void 0 || value === null || value === "") return MountBackend.VFS;
|
|
376
|
+
const lowered = value.toLowerCase();
|
|
377
|
+
if (!Object.values(MountBackend).includes(lowered)) {
|
|
378
|
+
throw new Error(
|
|
379
|
+
`unknown mount backend ${JSON.stringify(value)}; expected one of: ${Object.values(
|
|
380
|
+
MountBackend
|
|
381
|
+
).join(", ")}`
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
return lowered;
|
|
385
|
+
}
|
|
386
|
+
function requireKernelBackend(backend) {
|
|
387
|
+
if (!KERNEL_BACKENDS.includes(backend)) {
|
|
388
|
+
throw new Error(
|
|
389
|
+
`backend ${JSON.stringify(backend)} does not register a mountpoint; it is served inside mirage's own filesystem, so there is nothing to mount`
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
function checkPlatform(backend) {
|
|
394
|
+
if (backend !== MountBackend.FSKIT) return;
|
|
395
|
+
if (process.platform !== "darwin") {
|
|
396
|
+
throw new Error(
|
|
397
|
+
`the fskit mount backend is macOS-only (running on ${process.platform}); use backend 'fuse'`
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
function checkMountpoint(backend, mountpoint) {
|
|
402
|
+
if (backend !== MountBackend.FSKIT) return;
|
|
403
|
+
const resolved = posix.normalize(mountpoint);
|
|
404
|
+
if (resolved !== FSKIT_MOUNT_ROOT && !resolved.startsWith(FSKIT_MOUNT_ROOT + "/")) {
|
|
405
|
+
throw new Error(
|
|
406
|
+
`the fskit mount backend only mounts under ${FSKIT_MOUNT_ROOT}; got ${JSON.stringify(mountpoint)}`
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function unsizedMounts(ws, rootPrefix = "") {
|
|
411
|
+
const root = rstripSlash(rootPrefix);
|
|
412
|
+
const found = [];
|
|
413
|
+
for (const m of ws.mounts()) {
|
|
414
|
+
const bare = rstripSlash(m.prefix);
|
|
415
|
+
if (root !== "" && bare !== root && !m.prefix.startsWith(root + "/")) continue;
|
|
416
|
+
if (!sizesAlwaysKnown(m.resource)) found.push([m.prefix, m.resource.kind]);
|
|
417
|
+
}
|
|
418
|
+
return found;
|
|
419
|
+
}
|
|
420
|
+
function checkSizes(backend, ws, rootPrefix = "") {
|
|
421
|
+
if (backend !== MountBackend.FSKIT) return;
|
|
422
|
+
const offenders = unsizedMounts(ws, rootPrefix);
|
|
423
|
+
if (offenders.length === 0) return;
|
|
424
|
+
const listed = offenders.map(([prefix, kind]) => `${prefix} (${kind})`).join(", ");
|
|
425
|
+
console.warn(
|
|
426
|
+
`mirage: the fskit mount backend cannot serve resources whose file sizes are only known after a read; size-unknown files under these mounts will read as empty: ${listed}. Mount them with backend 'fuse', or scope the fskit mount to a byte-store resource (ram, disk, redis, s3, gridfs).`
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
function writableMounts(ws, rootPrefix = "") {
|
|
430
|
+
const root = rstripSlash(rootPrefix);
|
|
431
|
+
const found = [];
|
|
432
|
+
for (const m of ws.mounts()) {
|
|
433
|
+
const bare = rstripSlash(m.prefix);
|
|
434
|
+
if (root !== "" && bare !== root && !m.prefix.startsWith(root + "/")) continue;
|
|
435
|
+
if (m.mode !== MountMode.READ) found.push([m.prefix, m.resource.kind]);
|
|
436
|
+
}
|
|
437
|
+
return found;
|
|
438
|
+
}
|
|
439
|
+
function checkWrites(backend, ws, rootPrefix = "") {
|
|
440
|
+
if (backend !== MountBackend.FSKIT) return;
|
|
441
|
+
const offenders = writableMounts(ws, rootPrefix).filter(
|
|
442
|
+
([prefix]) => rstripSlash(prefix) !== "/dev"
|
|
443
|
+
);
|
|
444
|
+
if (offenders.length === 0) return;
|
|
445
|
+
const listed = offenders.map(([prefix, kind]) => `${prefix} (${kind})`).join(", ");
|
|
446
|
+
console.warn(
|
|
447
|
+
`mirage: file data written through an fskit mount may be flushed by the macFUSE FSKit shim as zeroed pages (metadata ops are reliable; the writer sees no error): ${listed}. Mount them read-only, or use backend 'fuse' for writes.`
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
function prepareBackend(value, ws, mountpoint, rootPrefix = "") {
|
|
451
|
+
const backend = resolveBackend(value);
|
|
452
|
+
requireKernelBackend(backend);
|
|
453
|
+
checkPlatform(backend);
|
|
454
|
+
if (mountpoint !== void 0) checkMountpoint(backend, mountpoint);
|
|
455
|
+
if (ws !== void 0) {
|
|
456
|
+
checkSizes(backend, ws, rootPrefix);
|
|
457
|
+
checkWrites(backend, ws, rootPrefix);
|
|
458
|
+
}
|
|
459
|
+
return backend;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// src/fuse/fs.ts
|
|
463
|
+
import { runWithSession } from "@struktoai/mirage-core";
|
|
464
|
+
|
|
465
|
+
// src/fuse/core.ts
|
|
466
|
+
import { posix as posix2 } from "path";
|
|
467
|
+
import {
|
|
468
|
+
DIR_MODE,
|
|
469
|
+
FILE_MODE,
|
|
470
|
+
FileTable,
|
|
350
471
|
FileType,
|
|
351
472
|
isMissingOp,
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
rstripSlash
|
|
473
|
+
mergeWrites,
|
|
474
|
+
mtimeMs,
|
|
475
|
+
rstripSlash as rstripSlash2,
|
|
476
|
+
compareCodePoints
|
|
355
477
|
} from "@struktoai/mirage-core";
|
|
356
478
|
|
|
479
|
+
// src/fuse/errors.ts
|
|
480
|
+
import { constants as osConstants } from "os";
|
|
481
|
+
import { classify } from "@struktoai/mirage-core";
|
|
482
|
+
var ENOENT = 2;
|
|
483
|
+
var EIO = 5;
|
|
484
|
+
var EACCES = 13;
|
|
485
|
+
var EEXIST = 17;
|
|
486
|
+
var EINVAL = 22;
|
|
487
|
+
var ENOTDIR = 20;
|
|
488
|
+
var EISDIR = 21;
|
|
489
|
+
var EROFS = 30;
|
|
490
|
+
var ENOTEMPTY = 66;
|
|
491
|
+
var EXDEV = 18;
|
|
492
|
+
var CONDITION_ERRNO = {
|
|
493
|
+
ENOENT,
|
|
494
|
+
ENOTDIR,
|
|
495
|
+
EISDIR,
|
|
496
|
+
EEXIST,
|
|
497
|
+
EACCES,
|
|
498
|
+
EPERM: osConstants.errno.EPERM,
|
|
499
|
+
ENOTEMPTY,
|
|
500
|
+
EXDEV,
|
|
501
|
+
CROSS_MOUNT: EXDEV,
|
|
502
|
+
ENOTSUP: osConstants.errno.ENOTSUP,
|
|
503
|
+
ELOOP: osConstants.errno.ELOOP,
|
|
504
|
+
EINVAL,
|
|
505
|
+
EIO,
|
|
506
|
+
EBUSY: osConstants.errno.EBUSY,
|
|
507
|
+
EROFS,
|
|
508
|
+
NO_XATTR: osConstants.errno.ENODATA
|
|
509
|
+
};
|
|
510
|
+
var MESSAGE_ERRNO = [
|
|
511
|
+
[["not empty", "enotempty"], ENOTEMPTY],
|
|
512
|
+
[["not a directory", "enotdir"], ENOTDIR],
|
|
513
|
+
[["is a directory", "eisdir"], EISDIR],
|
|
514
|
+
// A session capability rejection (MountNotAllowedError) is a permission
|
|
515
|
+
// failure, mirroring Python's PermissionError -> EACCES.
|
|
516
|
+
[["not allowed to access mount"], EACCES],
|
|
517
|
+
[["permission", "eacces", "read-only"], EACCES],
|
|
518
|
+
[["file exists", "eexist"], EEXIST],
|
|
519
|
+
[["not found", "no such", "enoent", "no mount"], ENOENT]
|
|
520
|
+
];
|
|
521
|
+
function classifyErrno(err) {
|
|
522
|
+
const condition = classify(err);
|
|
523
|
+
if (condition !== null) return CONDITION_ERRNO[condition];
|
|
524
|
+
const code = err.code;
|
|
525
|
+
if (code !== void 0) {
|
|
526
|
+
const errnos = osConstants.errno;
|
|
527
|
+
const passthrough = errnos[code];
|
|
528
|
+
if (passthrough !== void 0) return passthrough;
|
|
529
|
+
}
|
|
530
|
+
const msg = (err instanceof Error ? err.message : String(err)).toLowerCase();
|
|
531
|
+
for (const [needles, errno] of MESSAGE_ERRNO) {
|
|
532
|
+
if (needles.some((n) => msg.includes(n))) return errno;
|
|
533
|
+
}
|
|
534
|
+
return EIO;
|
|
535
|
+
}
|
|
536
|
+
function classifyError(err) {
|
|
537
|
+
return -classifyErrno(err);
|
|
538
|
+
}
|
|
539
|
+
function errnoError(code, message) {
|
|
540
|
+
return Object.assign(new Error(message), { code });
|
|
541
|
+
}
|
|
542
|
+
|
|
357
543
|
// src/fuse/platform/macos.ts
|
|
358
544
|
var MACOS_METADATA = /* @__PURE__ */ new Set([
|
|
359
545
|
".DS_Store",
|
|
@@ -365,54 +551,25 @@ function isMacosMetadata(name) {
|
|
|
365
551
|
return MACOS_METADATA.has(name) || name.startsWith("._");
|
|
366
552
|
}
|
|
367
553
|
|
|
368
|
-
// src/fuse/
|
|
369
|
-
var ENOENT = -2;
|
|
370
|
-
var EACCES = -13;
|
|
371
|
-
var ENOTDIR = -20;
|
|
372
|
-
var EEXIST = -17;
|
|
373
|
-
var ENOTEMPTY = -66;
|
|
374
|
-
var EIO = -5;
|
|
375
|
-
var EINVAL = -22;
|
|
376
|
-
var EROFS = -30;
|
|
554
|
+
// src/fuse/core.ts
|
|
377
555
|
var PREFETCH_TTL_MS = 3e4;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
if (code === "ENOTDIR") return ENOTDIR;
|
|
382
|
-
if (code === "EACCES") return EACCES;
|
|
383
|
-
if (code === "EEXIST") return EEXIST;
|
|
384
|
-
if (code === "ENOENT") return ENOENT;
|
|
385
|
-
const msg = (err instanceof Error ? err.message : String(err)).toLowerCase();
|
|
386
|
-
if (msg.includes("not empty") || msg.includes("enotempty")) return ENOTEMPTY;
|
|
387
|
-
if (msg.includes("not a directory") || msg.includes("enotdir")) return ENOTDIR;
|
|
388
|
-
if (msg.includes("not allowed to access mount")) return EACCES;
|
|
389
|
-
if (msg.includes("permission") || msg.includes("eacces") || msg.includes("read-only"))
|
|
390
|
-
return EACCES;
|
|
391
|
-
if (msg.includes("file exists") || msg.includes("eexist")) return EEXIST;
|
|
392
|
-
if (msg.includes("not found") || msg.includes("no such") || msg.includes("enoent") || msg.includes("no mount"))
|
|
393
|
-
return ENOENT;
|
|
394
|
-
return EIO;
|
|
395
|
-
}
|
|
396
|
-
var MirageFS = class {
|
|
397
|
-
ws;
|
|
556
|
+
var MountCore = class {
|
|
557
|
+
ops;
|
|
558
|
+
session;
|
|
398
559
|
now;
|
|
399
560
|
root;
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
// In-memory extended attributes, keyed by FUSE path. Backends have no POSIX
|
|
561
|
+
handles = new FileTable();
|
|
562
|
+
// In-memory extended attributes, keyed by path. Backends have no POSIX
|
|
403
563
|
// xattrs, so these are advisory and never persisted; see setxattr.
|
|
404
564
|
xattrs = /* @__PURE__ */ new Map();
|
|
405
565
|
prefetchCache = /* @__PURE__ */ new Map();
|
|
406
566
|
prefetchInflight = /* @__PURE__ */ new Map();
|
|
407
|
-
nextFh = 1;
|
|
408
567
|
uid;
|
|
409
568
|
gid;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
this.ws = ws;
|
|
569
|
+
constructor(ops, options = {}) {
|
|
570
|
+
this.ops = ops;
|
|
413
571
|
this.now = /* @__PURE__ */ new Date();
|
|
414
|
-
this.root = options.rootPrefix !== void 0 ?
|
|
415
|
-
this.prefixes = this.root === "" ? ws.mounts().map((m) => m.prefix) : [];
|
|
572
|
+
this.root = options.rootPrefix !== void 0 ? rstripSlash2(options.rootPrefix) : "";
|
|
416
573
|
this.uid = typeof process.getuid === "function" ? process.getuid() : 0;
|
|
417
574
|
this.gid = typeof process.getgid === "function" ? process.getgid() : 0;
|
|
418
575
|
this.session = options.session ?? null;
|
|
@@ -429,7 +586,7 @@ var MirageFS = class {
|
|
|
429
586
|
ctime: this.now,
|
|
430
587
|
nlink: 2,
|
|
431
588
|
size: 0,
|
|
432
|
-
mode:
|
|
589
|
+
mode: DIR_MODE,
|
|
433
590
|
uid: this.uid,
|
|
434
591
|
gid: this.gid
|
|
435
592
|
};
|
|
@@ -441,17 +598,17 @@ var MirageFS = class {
|
|
|
441
598
|
ctime: this.now,
|
|
442
599
|
nlink: 1,
|
|
443
600
|
size,
|
|
444
|
-
mode:
|
|
601
|
+
mode: FILE_MODE,
|
|
445
602
|
uid: this.uid,
|
|
446
603
|
gid: this.gid
|
|
447
604
|
};
|
|
448
605
|
}
|
|
449
606
|
/**
|
|
450
|
-
* Fold merged stat attributes into
|
|
607
|
+
* Fold merged stat attributes into an attr record. The workspace stat
|
|
451
608
|
* already carries the namespace overlay (chmod bits, chown ids, touched
|
|
452
609
|
* mtime), so honoring these fields here is what makes metadata ops
|
|
453
|
-
* visible
|
|
454
|
-
* numeric ids and there is no user db to map against.
|
|
610
|
+
* visible through a mount. String uid/gid (names) are skipped: the kernel
|
|
611
|
+
* wants numeric ids and there is no user db to map against.
|
|
455
612
|
*/
|
|
456
613
|
applyStatAttrs(entry, s) {
|
|
457
614
|
if (s.mode !== null) {
|
|
@@ -460,67 +617,46 @@ var MirageFS = class {
|
|
|
460
617
|
if (typeof s.uid === "number") entry.uid = s.uid;
|
|
461
618
|
if (typeof s.gid === "number") entry.gid = s.gid;
|
|
462
619
|
if (s.modified !== null) {
|
|
463
|
-
const
|
|
464
|
-
if (
|
|
465
|
-
entry.mtime =
|
|
466
|
-
entry.ctime =
|
|
620
|
+
const ms = mtimeMs(s);
|
|
621
|
+
if (ms !== null) {
|
|
622
|
+
entry.mtime = new Date(ms);
|
|
623
|
+
entry.ctime = new Date(ms);
|
|
467
624
|
}
|
|
468
625
|
}
|
|
469
626
|
return entry;
|
|
470
627
|
}
|
|
471
628
|
/**
|
|
472
|
-
* The target to present for a namespace link at a
|
|
629
|
+
* The target to present for a namespace link at a mount path, or null
|
|
473
630
|
* when not a link. Relative targets are stored verbatim and returned
|
|
474
631
|
* as-is. Absolute targets name virtual paths, so they are rewritten
|
|
475
632
|
* relative to the link's directory: returned raw, the kernel would
|
|
476
633
|
* resolve them against the host root and escape the mountpoint.
|
|
477
634
|
*/
|
|
478
635
|
linkTarget(path4) {
|
|
479
|
-
const links = this.
|
|
636
|
+
const links = this.ops.links;
|
|
480
637
|
if (links === null) return null;
|
|
481
638
|
const target = links.readlink(this.resolve(path4));
|
|
482
639
|
if (target === null) return null;
|
|
483
640
|
if (!target.startsWith("/")) return target;
|
|
484
|
-
let
|
|
641
|
+
let virtualTarget = target;
|
|
485
642
|
if (this.root !== "") {
|
|
486
643
|
if (target === this.root) {
|
|
487
|
-
|
|
644
|
+
virtualTarget = "/";
|
|
488
645
|
} else if (target.startsWith(this.root + "/")) {
|
|
489
|
-
|
|
646
|
+
virtualTarget = target.slice(this.root.length);
|
|
490
647
|
} else {
|
|
491
648
|
return target;
|
|
492
649
|
}
|
|
493
650
|
}
|
|
494
651
|
const slash = path4.lastIndexOf("/");
|
|
495
652
|
const parent = slash <= 0 ? "/" : path4.slice(0, slash);
|
|
496
|
-
return
|
|
653
|
+
return posix2.relative(parent, virtualTarget);
|
|
497
654
|
}
|
|
498
655
|
linkStat(target) {
|
|
499
656
|
const entry = this.fileStat(new TextEncoder().encode(target).byteLength);
|
|
500
657
|
entry.mode = 41471;
|
|
501
658
|
return entry;
|
|
502
659
|
}
|
|
503
|
-
isVirtualDir(path4) {
|
|
504
|
-
const bare = rstripSlash(path4);
|
|
505
|
-
const normalized = bare + "/";
|
|
506
|
-
for (const p of this.prefixes) {
|
|
507
|
-
const pBare = rstripSlash(p);
|
|
508
|
-
if (p.startsWith(normalized) || pBare === bare) return true;
|
|
509
|
-
}
|
|
510
|
-
return false;
|
|
511
|
-
}
|
|
512
|
-
virtualChildren(path4) {
|
|
513
|
-
const normalized = path4 === "/" ? "/" : rstripSlash(path4) + "/";
|
|
514
|
-
const children = /* @__PURE__ */ new Set();
|
|
515
|
-
for (const p of this.prefixes) {
|
|
516
|
-
if (p.startsWith(normalized) && p !== normalized) {
|
|
517
|
-
const rest = p.slice(normalized.length);
|
|
518
|
-
const child = rest.split("/")[0];
|
|
519
|
-
if (child !== void 0 && child !== "") children.add(child);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
return [...children].sort();
|
|
523
|
-
}
|
|
524
660
|
cachedSize(path4) {
|
|
525
661
|
for (const ctx of this.handles.values()) {
|
|
526
662
|
if (ctx.path === path4 && ctx.data !== void 0) return ctx.data.byteLength;
|
|
@@ -543,7 +679,7 @@ var MirageFS = class {
|
|
|
543
679
|
* fstat burst (and subsequent stats within the TTL) reuse the same fetch.
|
|
544
680
|
* With getattr reporting 0 pre-open, this hydration is what lets fgetattr
|
|
545
681
|
* answer with the real byte length after open (mirrors Python's
|
|
546
|
-
* `
|
|
682
|
+
* `prefetch_read`).
|
|
547
683
|
*/
|
|
548
684
|
async prefetch(path4) {
|
|
549
685
|
const cached = this.cachedData(path4);
|
|
@@ -552,7 +688,7 @@ var MirageFS = class {
|
|
|
552
688
|
if (inflight !== void 0) return inflight;
|
|
553
689
|
const promise = (async () => {
|
|
554
690
|
try {
|
|
555
|
-
const data = await this.
|
|
691
|
+
const data = await this.ops.readFile(this.resolve(path4));
|
|
556
692
|
this.prefetchCache.set(path4, { data, expires: Date.now() + PREFETCH_TTL_MS });
|
|
557
693
|
return data;
|
|
558
694
|
} catch {
|
|
@@ -564,14 +700,215 @@ var MirageFS = class {
|
|
|
564
700
|
this.prefetchInflight.set(path4, promise);
|
|
565
701
|
return promise;
|
|
566
702
|
}
|
|
567
|
-
/** Drain and return accumulated op records (mirrors Python's
|
|
703
|
+
/** Drain and return accumulated op records (mirrors Python's drainOps). */
|
|
568
704
|
drainOps() {
|
|
569
|
-
const records = [...this.
|
|
570
|
-
this.
|
|
705
|
+
const records = [...this.ops.records];
|
|
706
|
+
this.ops.records.length = 0;
|
|
571
707
|
return records;
|
|
572
708
|
}
|
|
573
709
|
async writeFile(path4, data) {
|
|
574
|
-
await this.
|
|
710
|
+
await this.ops.writeFile(this.resolve(path4), data);
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Merge buffered writes over the raw base and persist the result.
|
|
714
|
+
* The base is read raw so a flush never stores a rendered view back
|
|
715
|
+
* into the mount.
|
|
716
|
+
*/
|
|
717
|
+
async applyWrites(path4, writes) {
|
|
718
|
+
let existing = new Uint8Array(0);
|
|
719
|
+
try {
|
|
720
|
+
existing = await this.ops.readFile(this.resolve(path4), { raw: true });
|
|
721
|
+
} catch {
|
|
722
|
+
}
|
|
723
|
+
await this.writeFile(path4, mergeWrites(existing, writes));
|
|
724
|
+
}
|
|
725
|
+
// ── POSIX surface (throws; adapters classify) ────────────────────
|
|
726
|
+
async getattr(path4) {
|
|
727
|
+
if (path4 === "/") return this.dirStat();
|
|
728
|
+
const name = path4.slice(path4.lastIndexOf("/") + 1);
|
|
729
|
+
if (isMacosMetadata(name)) {
|
|
730
|
+
throw errnoError("ENOENT", `no such file or directory: ${path4}`);
|
|
731
|
+
}
|
|
732
|
+
const target = this.linkTarget(path4);
|
|
733
|
+
if (target !== null) return this.linkStat(target);
|
|
734
|
+
const s = await this.ops.stat(this.resolve(path4));
|
|
735
|
+
if (s.type === FileType.DIRECTORY) {
|
|
736
|
+
return this.applyStatAttrs(this.dirStat(), s);
|
|
737
|
+
}
|
|
738
|
+
let size = s.size;
|
|
739
|
+
size ??= this.cachedSize(path4) ?? 0;
|
|
740
|
+
return this.applyStatAttrs(this.fileStat(size), s);
|
|
741
|
+
}
|
|
742
|
+
/** Attributes through an open handle, or path-based when not hydrated. */
|
|
743
|
+
async fgetattr(path4, fd) {
|
|
744
|
+
const ctx = this.handles.get(fd);
|
|
745
|
+
if (ctx?.data !== void 0) return this.fileStat(ctx.data.byteLength);
|
|
746
|
+
return this.getattr(path4);
|
|
747
|
+
}
|
|
748
|
+
async readdir(path4) {
|
|
749
|
+
const names = /* @__PURE__ */ new Set();
|
|
750
|
+
const entries = await this.ops.readdir(this.resolve(path4));
|
|
751
|
+
for (const e of entries) {
|
|
752
|
+
const part = rstripSlash2(e).split("/").pop() ?? "";
|
|
753
|
+
if (part !== "" && !isMacosMetadata(part)) names.add(part);
|
|
754
|
+
}
|
|
755
|
+
return [".", "..", ...[...names].sort(compareCodePoints)];
|
|
756
|
+
}
|
|
757
|
+
async read(path4, fd, pos, len) {
|
|
758
|
+
const ctx = this.handles.get(fd);
|
|
759
|
+
if (ctx !== void 0 && ctx.data === void 0) {
|
|
760
|
+
const cached = this.cachedData(path4);
|
|
761
|
+
ctx.data = cached ?? await this.ops.readFile(this.resolve(path4));
|
|
762
|
+
}
|
|
763
|
+
const data = ctx?.data ?? this.cachedData(path4) ?? await this.ops.readFile(this.resolve(path4));
|
|
764
|
+
return data.subarray(pos, pos + len);
|
|
765
|
+
}
|
|
766
|
+
/** Buffer a write on its handle, or apply it directly when there is none. */
|
|
767
|
+
async write(path4, fd, data, pos) {
|
|
768
|
+
const ctx = this.handles.get(fd);
|
|
769
|
+
if (ctx !== void 0) {
|
|
770
|
+
ctx.writeBuf ??= [];
|
|
771
|
+
ctx.writeBuf.push([pos, data]);
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
await this.applyWrites(path4, [[pos, data]]);
|
|
775
|
+
}
|
|
776
|
+
async create(path4) {
|
|
777
|
+
try {
|
|
778
|
+
await this.ops.create(this.resolve(path4));
|
|
779
|
+
} catch (dispatchErr) {
|
|
780
|
+
if (!isMissingOp(dispatchErr, "create")) throw dispatchErr;
|
|
781
|
+
await this.writeFile(path4, new Uint8Array(0));
|
|
782
|
+
}
|
|
783
|
+
return this.handles.add({ path: path4 });
|
|
784
|
+
}
|
|
785
|
+
async mkdir(path4) {
|
|
786
|
+
await this.ops.mkdir(this.resolve(path4));
|
|
787
|
+
}
|
|
788
|
+
readlink(path4) {
|
|
789
|
+
const target = this.linkTarget(path4);
|
|
790
|
+
if (target === null) throw errnoError("EINVAL", `not a symbolic link: ${path4}`);
|
|
791
|
+
return target;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Create namespace link `dest -> src` (ln -s src dest; libfuse passes
|
|
795
|
+
* the pointee first). Relative sources are stored verbatim (resolved
|
|
796
|
+
* at follow time, exactly like the shell `ln -s`); absolute sources
|
|
797
|
+
* are mapped into virtual space so a scoped mount stores the path it
|
|
798
|
+
* will later follow.
|
|
799
|
+
*/
|
|
800
|
+
async symlink(src, dest) {
|
|
801
|
+
if (this.ops.links === null) throw errnoError("EROFS", "workspace has no namespace links");
|
|
802
|
+
const stored = src.startsWith("/") ? this.resolve(src) : src;
|
|
803
|
+
await this.ops.symlink(this.resolve(dest), stored);
|
|
804
|
+
}
|
|
805
|
+
async unlink(path4) {
|
|
806
|
+
const links = this.ops.links;
|
|
807
|
+
if (links?.isLink(this.resolve(path4)) === true) {
|
|
808
|
+
await links.unlink(this.resolve(path4));
|
|
809
|
+
this.xattrs.delete(path4);
|
|
810
|
+
this.prefetchCache.delete(path4);
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
await this.ops.unlink(this.resolve(path4));
|
|
814
|
+
this.xattrs.delete(path4);
|
|
815
|
+
}
|
|
816
|
+
async rename(src, dst) {
|
|
817
|
+
await this.ops.rename(this.resolve(src), this.resolve(dst));
|
|
818
|
+
const moved = this.xattrs.get(src);
|
|
819
|
+
if (moved !== void 0) {
|
|
820
|
+
this.xattrs.delete(src);
|
|
821
|
+
this.xattrs.set(dst, moved);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
async rmdir(path4) {
|
|
825
|
+
try {
|
|
826
|
+
const entries = await this.ops.readdir(this.resolve(path4));
|
|
827
|
+
if (entries.length > 0) {
|
|
828
|
+
throw errnoError("ENOTEMPTY", `directory not empty: ${path4}`);
|
|
829
|
+
}
|
|
830
|
+
} catch (err) {
|
|
831
|
+
if (err.code === "ENOTEMPTY") throw err;
|
|
832
|
+
}
|
|
833
|
+
await this.ops.rmdir(this.resolve(path4));
|
|
834
|
+
this.xattrs.delete(path4);
|
|
835
|
+
}
|
|
836
|
+
async truncate(path4, size) {
|
|
837
|
+
try {
|
|
838
|
+
await this.ops.truncate(this.resolve(path4), size);
|
|
839
|
+
} catch (dispatchErr) {
|
|
840
|
+
if (!isMissingOp(dispatchErr, "truncate")) throw dispatchErr;
|
|
841
|
+
const data = await this.ops.readFile(this.resolve(path4), { raw: true }).catch(() => new Uint8Array(0));
|
|
842
|
+
const out = new Uint8Array(size);
|
|
843
|
+
out.set(data.subarray(0, Math.min(data.byteLength, size)), 0);
|
|
844
|
+
await this.writeFile(path4, out);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
statfs() {
|
|
848
|
+
return {
|
|
849
|
+
bsize: 4096,
|
|
850
|
+
frsize: 4096,
|
|
851
|
+
blocks: 1024 * 1024,
|
|
852
|
+
bfree: 1024 * 1024,
|
|
853
|
+
bavail: 1024 * 1024,
|
|
854
|
+
files: 1e6,
|
|
855
|
+
ffree: 1e6,
|
|
856
|
+
favail: 1e6,
|
|
857
|
+
namemax: 255
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
setxattr(path4, name, value) {
|
|
861
|
+
let attrs = this.xattrs.get(path4);
|
|
862
|
+
if (attrs === void 0) {
|
|
863
|
+
attrs = /* @__PURE__ */ new Map();
|
|
864
|
+
this.xattrs.set(path4, attrs);
|
|
865
|
+
}
|
|
866
|
+
attrs.set(name, Buffer.from(value));
|
|
867
|
+
}
|
|
868
|
+
getxattr(path4, name) {
|
|
869
|
+
return this.xattrs.get(path4)?.get(name);
|
|
870
|
+
}
|
|
871
|
+
listxattr(path4) {
|
|
872
|
+
const attrs = this.xattrs.get(path4);
|
|
873
|
+
return attrs ? [...attrs.keys()] : [];
|
|
874
|
+
}
|
|
875
|
+
removexattr(path4, name) {
|
|
876
|
+
this.xattrs.get(path4)?.delete(name);
|
|
877
|
+
}
|
|
878
|
+
async open(path4) {
|
|
879
|
+
const s = await this.ops.stat(this.resolve(path4));
|
|
880
|
+
const ctx = { path: path4 };
|
|
881
|
+
if (s.size === null && s.type !== FileType.DIRECTORY) {
|
|
882
|
+
const data = await this.prefetch(path4);
|
|
883
|
+
if (data !== null) ctx.data = data;
|
|
884
|
+
}
|
|
885
|
+
return this.handles.add(ctx);
|
|
886
|
+
}
|
|
887
|
+
async release(fd) {
|
|
888
|
+
const ctx = this.handles.get(fd);
|
|
889
|
+
if (ctx?.writeBuf !== void 0 && ctx.writeBuf.length > 0) {
|
|
890
|
+
await this.flush(ctx.path, fd);
|
|
891
|
+
}
|
|
892
|
+
this.handles.pop(fd);
|
|
893
|
+
}
|
|
894
|
+
async flush(path4, fd) {
|
|
895
|
+
const ctx = this.handles.get(fd);
|
|
896
|
+
if (ctx?.writeBuf === void 0 || ctx.writeBuf.length === 0) return;
|
|
897
|
+
const writes = ctx.writeBuf;
|
|
898
|
+
ctx.writeBuf = [];
|
|
899
|
+
await this.applyWrites(path4, writes);
|
|
900
|
+
}
|
|
901
|
+
};
|
|
902
|
+
|
|
903
|
+
// src/fuse/fs.ts
|
|
904
|
+
var MirageFS = class {
|
|
905
|
+
core;
|
|
906
|
+
constructor(ops, options = {}) {
|
|
907
|
+
this.core = new MountCore(ops, options);
|
|
908
|
+
}
|
|
909
|
+
/** Drain and return accumulated op records (mirrors Python's drainOps). */
|
|
910
|
+
drainOps() {
|
|
911
|
+
return this.core.drainOps();
|
|
575
912
|
}
|
|
576
913
|
// ── FUSE op surface (mirrors mfusepy Operations) ─────────────────
|
|
577
914
|
ops() {
|
|
@@ -603,7 +940,7 @@ var MirageFS = class {
|
|
|
603
940
|
removexattr: this.removexattr.bind(this),
|
|
604
941
|
statfs: this.statfs.bind(this)
|
|
605
942
|
};
|
|
606
|
-
const session = this.session;
|
|
943
|
+
const session = this.core.session;
|
|
607
944
|
if (session === null) return table;
|
|
608
945
|
const bound = {};
|
|
609
946
|
for (const [name, fn] of Object.entries(table)) {
|
|
@@ -617,392 +954,232 @@ var MirageFS = class {
|
|
|
617
954
|
return bound;
|
|
618
955
|
}
|
|
619
956
|
getattr(path4, cb) {
|
|
620
|
-
void (
|
|
621
|
-
|
|
622
|
-
cb(0,
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
const name = path4.slice(path4.lastIndexOf("/") + 1);
|
|
626
|
-
if (isMacosMetadata(name)) {
|
|
627
|
-
cb(ENOENT);
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
630
|
-
const target = this.linkTarget(path4);
|
|
631
|
-
if (target !== null) {
|
|
632
|
-
cb(0, this.linkStat(target));
|
|
633
|
-
return;
|
|
634
|
-
}
|
|
635
|
-
if (this.isVirtualDir(path4)) {
|
|
636
|
-
cb(0, this.dirStat());
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
try {
|
|
640
|
-
const s = await this.ws.fs.stat(this.resolve(path4));
|
|
641
|
-
if (s.type === FileType.DIRECTORY) {
|
|
642
|
-
cb(0, this.applyStatAttrs(this.dirStat(), s));
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
|
-
let size = s.size;
|
|
646
|
-
size ??= this.cachedSize(path4) ?? 0;
|
|
647
|
-
cb(0, this.applyStatAttrs(this.fileStat(size), s));
|
|
648
|
-
} catch (err) {
|
|
957
|
+
void this.core.getattr(path4).then(
|
|
958
|
+
(attr) => {
|
|
959
|
+
cb(0, attr);
|
|
960
|
+
},
|
|
961
|
+
(err) => {
|
|
649
962
|
cb(classifyError(err));
|
|
650
963
|
}
|
|
651
|
-
|
|
964
|
+
);
|
|
652
965
|
}
|
|
653
966
|
fgetattr(path4, fd, cb) {
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
967
|
+
void this.core.fgetattr(path4, fd).then(
|
|
968
|
+
(attr) => {
|
|
969
|
+
cb(0, attr);
|
|
970
|
+
},
|
|
971
|
+
(err) => {
|
|
972
|
+
cb(classifyError(err));
|
|
973
|
+
}
|
|
974
|
+
);
|
|
660
975
|
}
|
|
661
976
|
readdir(path4, cb) {
|
|
662
|
-
void (
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
try {
|
|
671
|
-
const entries = await this.ws.fs.readdir(this.resolve(path4));
|
|
672
|
-
for (const e of entries) {
|
|
673
|
-
const part = rstripSlash(e).split("/").pop() ?? "";
|
|
674
|
-
if (part !== "" && !isMacosMetadata(part)) names.add(part);
|
|
675
|
-
}
|
|
676
|
-
} catch {
|
|
677
|
-
if (names.size === 0) {
|
|
678
|
-
cb(ENOENT);
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
977
|
+
void this.core.readdir(path4).then(
|
|
978
|
+
(names) => {
|
|
979
|
+
cb(0, names);
|
|
980
|
+
},
|
|
981
|
+
(err) => {
|
|
982
|
+
cb(classifyError(err));
|
|
681
983
|
}
|
|
682
|
-
|
|
683
|
-
})();
|
|
984
|
+
);
|
|
684
985
|
}
|
|
685
986
|
read(path4, fd, buf, len, pos, cb) {
|
|
686
|
-
void (
|
|
687
|
-
|
|
688
|
-
try {
|
|
689
|
-
if (ctx !== void 0 && ctx.data === void 0) {
|
|
690
|
-
const cached = this.cachedData(path4);
|
|
691
|
-
ctx.data = cached ?? await this.ws.fs.readFile(this.resolve(path4));
|
|
692
|
-
}
|
|
693
|
-
const data = ctx?.data ?? this.cachedData(path4) ?? await this.ws.fs.readFile(this.resolve(path4));
|
|
694
|
-
const slice = data.subarray(pos, pos + len);
|
|
987
|
+
void this.core.read(path4, fd, pos, len).then(
|
|
988
|
+
(slice) => {
|
|
695
989
|
buf.set(slice, 0);
|
|
696
990
|
cb(slice.byteLength);
|
|
697
|
-
}
|
|
991
|
+
},
|
|
992
|
+
(err) => {
|
|
993
|
+
if (err.code === "EACCES") {
|
|
994
|
+
cb(classifyError(err));
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
698
997
|
cb(0);
|
|
699
998
|
}
|
|
700
|
-
|
|
999
|
+
);
|
|
701
1000
|
}
|
|
702
1001
|
write(path4, fd, buf, len, pos, cb) {
|
|
703
|
-
const ctx = this.handles.get(fd);
|
|
704
1002
|
const data = new Uint8Array(buf.subarray(0, len));
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
ctx.writeBuf.push([pos, data]);
|
|
708
|
-
cb(len);
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
void (async () => {
|
|
712
|
-
try {
|
|
713
|
-
let existing = new Uint8Array(0);
|
|
714
|
-
try {
|
|
715
|
-
existing = await this.ws.fs.readFile(this.resolve(path4), { raw: true });
|
|
716
|
-
} catch {
|
|
717
|
-
}
|
|
718
|
-
let merged = existing;
|
|
719
|
-
if (pos > merged.byteLength) {
|
|
720
|
-
const padded = new Uint8Array(pos + data.byteLength);
|
|
721
|
-
padded.set(merged, 0);
|
|
722
|
-
padded.set(data, pos);
|
|
723
|
-
merged = padded;
|
|
724
|
-
} else {
|
|
725
|
-
const size = Math.max(merged.byteLength, pos + data.byteLength);
|
|
726
|
-
const out = new Uint8Array(size);
|
|
727
|
-
out.set(merged.subarray(0, pos), 0);
|
|
728
|
-
out.set(data, pos);
|
|
729
|
-
if (pos + data.byteLength < merged.byteLength) {
|
|
730
|
-
out.set(merged.subarray(pos + data.byteLength), pos + data.byteLength);
|
|
731
|
-
}
|
|
732
|
-
merged = out;
|
|
733
|
-
}
|
|
734
|
-
await this.writeFile(path4, merged);
|
|
1003
|
+
void this.core.write(path4, fd, data, pos).then(
|
|
1004
|
+
() => {
|
|
735
1005
|
cb(len);
|
|
736
|
-
}
|
|
1006
|
+
},
|
|
1007
|
+
(err) => {
|
|
1008
|
+
if (err.code === "EACCES") {
|
|
1009
|
+
cb(classifyError(err));
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
737
1012
|
cb(0);
|
|
738
1013
|
}
|
|
739
|
-
|
|
1014
|
+
);
|
|
740
1015
|
}
|
|
741
1016
|
create(path4, _mode, cb) {
|
|
742
|
-
void (
|
|
743
|
-
|
|
744
|
-
try {
|
|
745
|
-
await this.ws.dispatch("create", this.resolve(path4));
|
|
746
|
-
} catch (dispatchErr) {
|
|
747
|
-
if (!isMissingOp(dispatchErr, "create")) throw dispatchErr;
|
|
748
|
-
await this.writeFile(path4, new Uint8Array(0));
|
|
749
|
-
}
|
|
750
|
-
const fh = this.nextFh++;
|
|
751
|
-
this.handles.set(fh, { path: path4 });
|
|
1017
|
+
void this.core.create(path4).then(
|
|
1018
|
+
(fh) => {
|
|
752
1019
|
cb(0, fh);
|
|
753
|
-
}
|
|
1020
|
+
},
|
|
1021
|
+
(err) => {
|
|
754
1022
|
cb(classifyError(err));
|
|
755
1023
|
}
|
|
756
|
-
|
|
1024
|
+
);
|
|
757
1025
|
}
|
|
758
1026
|
mkdir(path4, _mode, cb) {
|
|
759
|
-
void (
|
|
760
|
-
|
|
761
|
-
await this.ws.dispatch("mkdir", this.resolve(path4));
|
|
1027
|
+
void this.core.mkdir(path4).then(
|
|
1028
|
+
() => {
|
|
762
1029
|
cb(0);
|
|
763
|
-
}
|
|
1030
|
+
},
|
|
1031
|
+
(err) => {
|
|
764
1032
|
cb(classifyError(err));
|
|
765
1033
|
}
|
|
766
|
-
|
|
1034
|
+
);
|
|
767
1035
|
}
|
|
768
1036
|
readlink(path4, cb) {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
1037
|
+
try {
|
|
1038
|
+
cb(0, this.core.readlink(path4));
|
|
1039
|
+
} catch (err) {
|
|
1040
|
+
cb(classifyError(err));
|
|
773
1041
|
}
|
|
774
|
-
cb(0, target);
|
|
775
1042
|
}
|
|
776
|
-
/**
|
|
777
|
-
* Create namespace link `dest -> src` (ln -s src dest; libfuse passes
|
|
778
|
-
* the pointee first). Relative sources are stored verbatim (resolved
|
|
779
|
-
* at follow time, exactly like the shell `ln -s`); absolute sources
|
|
780
|
-
* are mapped into virtual space so a scoped mount stores the path it
|
|
781
|
-
* will later follow.
|
|
782
|
-
*/
|
|
783
1043
|
symlink(src, dest, cb) {
|
|
784
|
-
void (
|
|
785
|
-
|
|
786
|
-
if (links === null) {
|
|
787
|
-
cb(EROFS);
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
const stored = src.startsWith("/") ? this.resolve(src) : src;
|
|
791
|
-
try {
|
|
792
|
-
await links.symlink(this.resolve(dest), stored, Date.now() / 1e3);
|
|
1044
|
+
void this.core.symlink(src, dest).then(
|
|
1045
|
+
() => {
|
|
793
1046
|
cb(0);
|
|
794
|
-
}
|
|
1047
|
+
},
|
|
1048
|
+
(err) => {
|
|
795
1049
|
cb(classifyError(err));
|
|
796
1050
|
}
|
|
797
|
-
|
|
1051
|
+
);
|
|
798
1052
|
}
|
|
799
1053
|
unlink(path4, cb) {
|
|
800
|
-
void (
|
|
801
|
-
|
|
802
|
-
if (links?.isLink(this.resolve(path4)) === true) {
|
|
803
|
-
await links.unlink(this.resolve(path4));
|
|
804
|
-
this.xattrs.delete(path4);
|
|
805
|
-
this.prefetchCache.delete(path4);
|
|
1054
|
+
void this.core.unlink(path4).then(
|
|
1055
|
+
() => {
|
|
806
1056
|
cb(0);
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
try {
|
|
810
|
-
await this.ws.dispatch("unlink", this.resolve(path4));
|
|
811
|
-
this.xattrs.delete(path4);
|
|
812
|
-
cb(0);
|
|
813
|
-
} catch (err) {
|
|
1057
|
+
},
|
|
1058
|
+
(err) => {
|
|
814
1059
|
cb(classifyError(err));
|
|
815
1060
|
}
|
|
816
|
-
|
|
1061
|
+
);
|
|
817
1062
|
}
|
|
818
1063
|
rename(src, dst, cb) {
|
|
819
|
-
void (
|
|
820
|
-
|
|
821
|
-
await this.ws.dispatch("rename", this.resolve(src), [
|
|
822
|
-
PathSpec.fromStrPath(this.resolve(dst))
|
|
823
|
-
]);
|
|
824
|
-
const moved = this.xattrs.get(src);
|
|
825
|
-
if (moved !== void 0) {
|
|
826
|
-
this.xattrs.delete(src);
|
|
827
|
-
this.xattrs.set(dst, moved);
|
|
828
|
-
}
|
|
1064
|
+
void this.core.rename(src, dst).then(
|
|
1065
|
+
() => {
|
|
829
1066
|
cb(0);
|
|
830
|
-
}
|
|
1067
|
+
},
|
|
1068
|
+
(err) => {
|
|
831
1069
|
cb(classifyError(err));
|
|
832
1070
|
}
|
|
833
|
-
|
|
1071
|
+
);
|
|
834
1072
|
}
|
|
835
1073
|
rmdir(path4, cb) {
|
|
836
|
-
void (
|
|
837
|
-
|
|
838
|
-
try {
|
|
839
|
-
const entries = await this.ws.fs.readdir(this.resolve(path4));
|
|
840
|
-
if (entries.length > 0) {
|
|
841
|
-
cb(ENOTEMPTY);
|
|
842
|
-
return;
|
|
843
|
-
}
|
|
844
|
-
} catch {
|
|
845
|
-
}
|
|
846
|
-
await this.ws.dispatch("rmdir", this.resolve(path4));
|
|
847
|
-
this.xattrs.delete(path4);
|
|
1074
|
+
void this.core.rmdir(path4).then(
|
|
1075
|
+
() => {
|
|
848
1076
|
cb(0);
|
|
849
|
-
}
|
|
1077
|
+
},
|
|
1078
|
+
(err) => {
|
|
850
1079
|
cb(classifyError(err));
|
|
851
1080
|
}
|
|
852
|
-
|
|
1081
|
+
);
|
|
853
1082
|
}
|
|
854
1083
|
truncate(path4, size, cb) {
|
|
855
|
-
void (
|
|
856
|
-
|
|
857
|
-
try {
|
|
858
|
-
await this.ws.dispatch("truncate", this.resolve(path4), [size]);
|
|
859
|
-
} catch (dispatchErr) {
|
|
860
|
-
if (!isMissingOp(dispatchErr, "truncate")) throw dispatchErr;
|
|
861
|
-
const data = await this.ws.fs.readFile(this.resolve(path4), { raw: true }).catch(() => new Uint8Array(0));
|
|
862
|
-
const out = new Uint8Array(size);
|
|
863
|
-
out.set(data.subarray(0, Math.min(data.byteLength, size)), 0);
|
|
864
|
-
await this.writeFile(path4, out);
|
|
865
|
-
}
|
|
1084
|
+
void this.core.truncate(path4, size).then(
|
|
1085
|
+
() => {
|
|
866
1086
|
cb(0);
|
|
867
|
-
}
|
|
1087
|
+
},
|
|
1088
|
+
(err) => {
|
|
868
1089
|
cb(classifyError(err));
|
|
869
1090
|
}
|
|
870
|
-
|
|
1091
|
+
);
|
|
871
1092
|
}
|
|
872
1093
|
statfs(_path, cb) {
|
|
873
|
-
cb(0,
|
|
874
|
-
bsize: 4096,
|
|
875
|
-
frsize: 4096,
|
|
876
|
-
blocks: 1024 * 1024,
|
|
877
|
-
bfree: 1024 * 1024,
|
|
878
|
-
bavail: 1024 * 1024,
|
|
879
|
-
files: 1e6,
|
|
880
|
-
ffree: 1e6,
|
|
881
|
-
favail: 1e6,
|
|
882
|
-
namemax: 255
|
|
883
|
-
});
|
|
1094
|
+
cb(0, this.core.statfs());
|
|
884
1095
|
}
|
|
885
1096
|
// chmod / chown / utimens / access are no-ops for the filesystem but must
|
|
886
1097
|
// validate path existence — callers like `touch`/`chmod` on a missing file
|
|
887
1098
|
// should fail with ENOENT, not silently succeed.
|
|
888
1099
|
chmod(path4, _mode, cb) {
|
|
889
|
-
this.
|
|
1100
|
+
this.validate(path4, cb);
|
|
890
1101
|
}
|
|
891
1102
|
chown(path4, _uid, _gid, cb) {
|
|
892
|
-
this.
|
|
1103
|
+
this.validate(path4, cb);
|
|
893
1104
|
}
|
|
894
1105
|
utimens(path4, _atime, _mtime, cb) {
|
|
895
|
-
this.
|
|
1106
|
+
this.validate(path4, cb);
|
|
896
1107
|
}
|
|
897
1108
|
access(path4, _amode, cb) {
|
|
898
|
-
this.
|
|
899
|
-
}
|
|
900
|
-
// Mirage backends (S3, etc.) have no POSIX extended attributes, so there is
|
|
901
|
-
// nothing to persist xattrs to. We keep them in memory per mount so tools that
|
|
902
|
-
// probe or set xattrs (sandbox runtimes, rsync -aX, tar --xattrs, cp -p, macOS
|
|
903
|
-
// Finder writing com.apple.*) succeed instead of failing with ENOTSUP. The
|
|
904
|
-
// values live only for the mount's lifetime and are never written to the
|
|
905
|
-
// backend.
|
|
1109
|
+
this.validate(path4, cb);
|
|
1110
|
+
}
|
|
906
1111
|
setxattr(path4, name, value, _position, _flags, cb) {
|
|
907
|
-
this.
|
|
1112
|
+
this.validate(path4, (code) => {
|
|
908
1113
|
if (code !== 0) {
|
|
909
1114
|
cb(code);
|
|
910
1115
|
return;
|
|
911
1116
|
}
|
|
912
|
-
|
|
913
|
-
if (attrs === void 0) {
|
|
914
|
-
attrs = /* @__PURE__ */ new Map();
|
|
915
|
-
this.xattrs.set(path4, attrs);
|
|
916
|
-
}
|
|
917
|
-
attrs.set(name, Buffer.from(value));
|
|
1117
|
+
this.core.setxattr(path4, name, value);
|
|
918
1118
|
cb(0);
|
|
919
1119
|
});
|
|
920
1120
|
}
|
|
921
1121
|
getxattr(path4, name, _position, cb) {
|
|
922
|
-
this.
|
|
1122
|
+
this.validate(path4, (code) => {
|
|
923
1123
|
if (code !== 0) {
|
|
924
1124
|
cb(code);
|
|
925
1125
|
return;
|
|
926
1126
|
}
|
|
927
|
-
cb(0, this.
|
|
1127
|
+
cb(0, this.core.getxattr(path4, name));
|
|
928
1128
|
});
|
|
929
1129
|
}
|
|
930
1130
|
listxattr(path4, cb) {
|
|
931
|
-
this.
|
|
1131
|
+
this.validate(path4, (code) => {
|
|
932
1132
|
if (code !== 0) {
|
|
933
1133
|
cb(code);
|
|
934
1134
|
return;
|
|
935
1135
|
}
|
|
936
|
-
|
|
937
|
-
cb(0, attrs ? [...attrs.keys()] : []);
|
|
1136
|
+
cb(0, this.core.listxattr(path4));
|
|
938
1137
|
});
|
|
939
1138
|
}
|
|
940
1139
|
removexattr(path4, name, cb) {
|
|
941
|
-
this.
|
|
1140
|
+
this.validate(path4, (code) => {
|
|
942
1141
|
if (code !== 0) {
|
|
943
1142
|
cb(code);
|
|
944
1143
|
return;
|
|
945
1144
|
}
|
|
946
|
-
this.
|
|
1145
|
+
this.core.removexattr(path4, name);
|
|
947
1146
|
cb(0);
|
|
948
1147
|
});
|
|
949
1148
|
}
|
|
950
|
-
|
|
1149
|
+
validate(path4, cb) {
|
|
951
1150
|
this.getattr(path4, (code) => {
|
|
952
1151
|
cb(code);
|
|
953
1152
|
});
|
|
954
1153
|
}
|
|
955
1154
|
open(path4, _flags, cb) {
|
|
956
|
-
void (
|
|
957
|
-
|
|
958
|
-
const s = await this.ws.fs.stat(this.resolve(path4));
|
|
959
|
-
const ctx = { path: path4 };
|
|
960
|
-
if (s.size === null && s.type !== FileType.DIRECTORY) {
|
|
961
|
-
const data = await this.prefetch(path4);
|
|
962
|
-
if (data !== null) ctx.data = data;
|
|
963
|
-
}
|
|
964
|
-
const fh = this.nextFh++;
|
|
965
|
-
this.handles.set(fh, ctx);
|
|
1155
|
+
void this.core.open(path4).then(
|
|
1156
|
+
(fh) => {
|
|
966
1157
|
cb(0, fh);
|
|
967
|
-
}
|
|
1158
|
+
},
|
|
1159
|
+
(err) => {
|
|
968
1160
|
cb(classifyError(err));
|
|
969
1161
|
}
|
|
970
|
-
|
|
1162
|
+
);
|
|
971
1163
|
}
|
|
972
1164
|
release(_path, fd, cb) {
|
|
973
|
-
this.
|
|
974
|
-
|
|
1165
|
+
void this.core.release(fd).then(
|
|
1166
|
+
() => {
|
|
1167
|
+
cb(0);
|
|
1168
|
+
},
|
|
1169
|
+
(err) => {
|
|
1170
|
+
cb(classifyError(err));
|
|
1171
|
+
}
|
|
1172
|
+
);
|
|
975
1173
|
}
|
|
976
1174
|
flush(path4, fd, cb) {
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
cb(0);
|
|
980
|
-
return;
|
|
981
|
-
}
|
|
982
|
-
const writes = ctx.writeBuf;
|
|
983
|
-
ctx.writeBuf = [];
|
|
984
|
-
void (async () => {
|
|
985
|
-
try {
|
|
986
|
-
let existing = new Uint8Array(0);
|
|
987
|
-
try {
|
|
988
|
-
existing = await this.ws.fs.readFile(this.resolve(path4), { raw: true });
|
|
989
|
-
} catch {
|
|
990
|
-
}
|
|
991
|
-
let total = existing.byteLength;
|
|
992
|
-
for (const [off, chunk] of writes) {
|
|
993
|
-
total = Math.max(total, off + chunk.byteLength);
|
|
994
|
-
}
|
|
995
|
-
const merged = new Uint8Array(total);
|
|
996
|
-
merged.set(existing, 0);
|
|
997
|
-
for (const [off, chunk] of writes) {
|
|
998
|
-
merged.set(chunk, off);
|
|
999
|
-
}
|
|
1000
|
-
await this.writeFile(path4, merged);
|
|
1175
|
+
void this.core.flush(path4, fd).then(
|
|
1176
|
+
() => {
|
|
1001
1177
|
cb(0);
|
|
1002
|
-
}
|
|
1178
|
+
},
|
|
1179
|
+
(err) => {
|
|
1003
1180
|
cb(classifyError(err));
|
|
1004
1181
|
}
|
|
1005
|
-
|
|
1182
|
+
);
|
|
1006
1183
|
}
|
|
1007
1184
|
fsync(path4, _datasync, fd, cb) {
|
|
1008
1185
|
this.flush(path4, fd, cb);
|
|
@@ -1010,19 +1187,24 @@ var MirageFS = class {
|
|
|
1010
1187
|
};
|
|
1011
1188
|
|
|
1012
1189
|
// src/fuse/mount.ts
|
|
1013
|
-
function
|
|
1190
|
+
function appendMountOptions(fuse, extras) {
|
|
1014
1191
|
const orig = fuse._fuseOptions?.bind(fuse);
|
|
1015
1192
|
if (orig === void 0) {
|
|
1016
1193
|
throw new Error(
|
|
1017
|
-
"@zkochan/fuse-native no longer exposes _fuseOptions();
|
|
1194
|
+
"@zkochan/fuse-native no longer exposes _fuseOptions(); extra mount options cannot be applied. Update appendMountOptions in mount.ts for the new fuse-native version."
|
|
1018
1195
|
);
|
|
1019
1196
|
}
|
|
1020
1197
|
fuse._fuseOptions = () => {
|
|
1021
1198
|
const serialized = orig();
|
|
1022
|
-
|
|
1023
|
-
|
|
1199
|
+
const missing = extras.filter((opt) => !serialized.includes(opt));
|
|
1200
|
+
if (missing.length === 0) return serialized;
|
|
1201
|
+
if (serialized === "") return `-o${missing.join(",")}`;
|
|
1202
|
+
return `${serialized},${missing.join(",")}`;
|
|
1024
1203
|
};
|
|
1025
1204
|
}
|
|
1205
|
+
function appendDirectIO(fuse) {
|
|
1206
|
+
appendMountOptions(fuse, ["direct_io"]);
|
|
1207
|
+
}
|
|
1026
1208
|
async function loadFuse() {
|
|
1027
1209
|
const mod = await loadOptionalPeer(
|
|
1028
1210
|
() => import("@zkochan/fuse-native"),
|
|
@@ -1049,17 +1231,27 @@ function forceUnmount(mountpoint) {
|
|
|
1049
1231
|
}
|
|
1050
1232
|
}
|
|
1051
1233
|
async function mount(ws, options = {}) {
|
|
1234
|
+
const backend = prepareBackend(
|
|
1235
|
+
options.backend ?? MountBackend2.FUSE,
|
|
1236
|
+
ws,
|
|
1237
|
+
void 0,
|
|
1238
|
+
options.rootPrefix ?? ""
|
|
1239
|
+
);
|
|
1052
1240
|
const Fuse = await loadFuse();
|
|
1241
|
+
const isFskit = backend === MountBackend2.FSKIT;
|
|
1053
1242
|
let mountpoint;
|
|
1054
1243
|
let ownsMountpoint = false;
|
|
1055
1244
|
if (options.mountpoint !== void 0) {
|
|
1056
|
-
|
|
1245
|
+
checkMountpoint(backend, options.mountpoint);
|
|
1246
|
+
if (!isFskit) mkdirSync(options.mountpoint, { recursive: true });
|
|
1057
1247
|
mountpoint = options.mountpoint;
|
|
1248
|
+
} else if (isFskit) {
|
|
1249
|
+
mountpoint = `${FSKIT_MOUNT_ROOT}/mirage-${randomBytes(4).toString("hex")}`;
|
|
1058
1250
|
} else {
|
|
1059
1251
|
mountpoint = mkdtempSync(join(tmpdir(), "mirage-fuse-"));
|
|
1060
1252
|
ownsMountpoint = true;
|
|
1061
1253
|
}
|
|
1062
|
-
const mfs = new MirageFS(ws, {
|
|
1254
|
+
const mfs = new MirageFS(ws.fs, {
|
|
1063
1255
|
...options.rootPrefix !== void 0 ? { rootPrefix: options.rootPrefix } : {},
|
|
1064
1256
|
...options.session !== void 0 ? { session: options.session } : {}
|
|
1065
1257
|
});
|
|
@@ -1072,19 +1264,23 @@ async function mount(ws, options = {}) {
|
|
|
1072
1264
|
...options.fuseOptions ?? {}
|
|
1073
1265
|
};
|
|
1074
1266
|
const fuse = new Fuse(mountpoint, mfs.ops(), fuseOpts);
|
|
1075
|
-
if (
|
|
1076
|
-
|
|
1267
|
+
if (isFskit) {
|
|
1268
|
+
appendMountOptions(fuse, ["backend=fskit", `volname=${basename(mountpoint)}`]);
|
|
1269
|
+
} else if (fuseOpts.directIO !== false) {
|
|
1270
|
+
appendDirectIO(fuse);
|
|
1271
|
+
}
|
|
1272
|
+
await new Promise((resolve2, reject) => {
|
|
1077
1273
|
fuse.mount((err) => {
|
|
1078
|
-
if (err === null)
|
|
1274
|
+
if (err === null) resolve2();
|
|
1079
1275
|
else reject(err);
|
|
1080
1276
|
});
|
|
1081
1277
|
});
|
|
1082
1278
|
return {
|
|
1083
1279
|
mountpoint,
|
|
1084
1280
|
ownsMountpoint,
|
|
1085
|
-
unmount: () => new Promise((
|
|
1281
|
+
unmount: () => new Promise((resolve2, reject) => {
|
|
1086
1282
|
fuse.unmount((err) => {
|
|
1087
|
-
if (err === null)
|
|
1283
|
+
if (err === null) resolve2();
|
|
1088
1284
|
else reject(err);
|
|
1089
1285
|
});
|
|
1090
1286
|
})
|
|
@@ -1202,17 +1398,89 @@ var Mount = class {
|
|
|
1202
1398
|
import { createRequire } from "module";
|
|
1203
1399
|
import { registerCompressionCodec } from "@struktoai/mirage-core";
|
|
1204
1400
|
var requireCjs = createRequire(import.meta.url);
|
|
1205
|
-
var
|
|
1401
|
+
var bunzip = requireCjs("seek-bzip");
|
|
1206
1402
|
var { xz } = requireCjs("@napi-rs/lzma");
|
|
1207
1403
|
registerCompressionCodec("bzip2", {
|
|
1208
|
-
|
|
1209
|
-
decompress: (bytes) => Promise.resolve(Uint8Array.from(Bzip2.decompressFile(bytes)))
|
|
1404
|
+
decompress: (bytes) => Promise.resolve(Uint8Array.from(bunzip.decode(bytes)))
|
|
1210
1405
|
});
|
|
1211
1406
|
registerCompressionCodec("xz", {
|
|
1212
1407
|
compress: async (bytes) => new Uint8Array(await xz.compress(Buffer.from(bytes))),
|
|
1213
1408
|
decompress: async (bytes) => new Uint8Array(await xz.decompress(Buffer.from(bytes)))
|
|
1214
1409
|
});
|
|
1215
1410
|
|
|
1411
|
+
// src/runtime/sandbox/daytona/runtime.ts
|
|
1412
|
+
import {
|
|
1413
|
+
loadOptionalPeer as loadOptionalPeer2,
|
|
1414
|
+
registerRuntime,
|
|
1415
|
+
RemoteSandbox,
|
|
1416
|
+
stdinPath,
|
|
1417
|
+
stdinRedirect
|
|
1418
|
+
} from "@struktoai/mirage-core";
|
|
1419
|
+
|
|
1420
|
+
// src/runtime/sandbox/daytona/config.ts
|
|
1421
|
+
var DAYTONA_CONFIG_KEYS = ["env", "sandboxId", "apiKey"];
|
|
1422
|
+
|
|
1423
|
+
// src/runtime/sandbox/daytona/runtime.ts
|
|
1424
|
+
var ENC = new TextEncoder();
|
|
1425
|
+
var DaytonaRuntime = class extends RemoteSandbox {
|
|
1426
|
+
name = "daytona";
|
|
1427
|
+
client = null;
|
|
1428
|
+
sandbox = null;
|
|
1429
|
+
constructor(options = {}) {
|
|
1430
|
+
super(options, DAYTONA_CONFIG_KEYS);
|
|
1431
|
+
if (!this.config.sandboxId) {
|
|
1432
|
+
throw new Error("daytona config needs sandboxId: the id of a live sandbox you created");
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
// The SDK loader as a seam: tests substitute a fake module here.
|
|
1436
|
+
loadSdk() {
|
|
1437
|
+
return loadOptionalPeer2(() => import("@daytonaio/sdk"), {
|
|
1438
|
+
feature: "the 'daytona' runtime",
|
|
1439
|
+
packageName: "@daytonaio/sdk"
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
async connect() {
|
|
1443
|
+
if (this.client === null) {
|
|
1444
|
+
const sdk = await this.loadSdk();
|
|
1445
|
+
this.client = new sdk.Daytona(
|
|
1446
|
+
this.config.apiKey !== void 0 ? { apiKey: this.config.apiKey } : void 0
|
|
1447
|
+
);
|
|
1448
|
+
}
|
|
1449
|
+
this.sandbox = await this.client.get(this.config.sandboxId);
|
|
1450
|
+
}
|
|
1451
|
+
async execLine(line, stdin, env, cwd) {
|
|
1452
|
+
if (this.sandbox === null) throw new Error("daytona sandbox not connected");
|
|
1453
|
+
let command = line;
|
|
1454
|
+
if (stdin !== null) {
|
|
1455
|
+
const path4 = stdinPath();
|
|
1456
|
+
await this.upload(path4, stdin);
|
|
1457
|
+
command = stdinRedirect(line, path4);
|
|
1458
|
+
}
|
|
1459
|
+
const response = await this.sandbox.process.executeCommand(command, cwd, env);
|
|
1460
|
+
return {
|
|
1461
|
+
stdout: ENC.encode(response.result),
|
|
1462
|
+
stderr: null,
|
|
1463
|
+
exitCode: response.exitCode
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
async upload(path4, data) {
|
|
1467
|
+
if (this.sandbox === null) throw new Error("daytona sandbox not connected");
|
|
1468
|
+
const slash = path4.lastIndexOf("/");
|
|
1469
|
+
const parent = slash > 0 ? path4.slice(0, slash) : "";
|
|
1470
|
+
if (parent !== "") await this.sandbox.fs.createFolder(parent, "755");
|
|
1471
|
+
await this.sandbox.fs.uploadFile(Buffer.from(data), path4);
|
|
1472
|
+
}
|
|
1473
|
+
/** Release the SDK client; the sandbox itself is the user's. */
|
|
1474
|
+
async close() {
|
|
1475
|
+
this.sandbox = null;
|
|
1476
|
+
if (this.client !== null) {
|
|
1477
|
+
await this.client[Symbol.asyncDispose]();
|
|
1478
|
+
this.client = null;
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
};
|
|
1482
|
+
registerRuntime("daytona", DaytonaRuntime);
|
|
1483
|
+
|
|
1216
1484
|
// src/workspace.ts
|
|
1217
1485
|
var requireCjs2 = createRequire2(import.meta.url);
|
|
1218
1486
|
var cachedParser = null;
|
|
@@ -1232,29 +1500,30 @@ var Workspace = class extends CoreWorkspace {
|
|
|
1232
1500
|
fuseManagers = /* @__PURE__ */ new Map();
|
|
1233
1501
|
constructor(resources, options = {}) {
|
|
1234
1502
|
const specs = {};
|
|
1235
|
-
const
|
|
1236
|
-
...options.
|
|
1503
|
+
const commandLimits = {
|
|
1504
|
+
...options.commandLimits ?? {}
|
|
1237
1505
|
};
|
|
1238
|
-
const
|
|
1506
|
+
const mountTargets = [];
|
|
1239
1507
|
for (const [prefix, value] of Object.entries(resources)) {
|
|
1240
1508
|
if (value instanceof Mount) {
|
|
1241
1509
|
specs[prefix] = value.options.mode !== void 0 ? [value.resource, value.options.mode] : value.resource;
|
|
1242
|
-
if (value.options.
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1510
|
+
if (value.options.commandLimits !== void 0)
|
|
1511
|
+
commandLimits[prefix] = value.options.commandLimits;
|
|
1512
|
+
const backend = value.options.backend ?? MountBackend3.VFS;
|
|
1513
|
+
if (KERNEL_BACKENDS2.includes(backend))
|
|
1514
|
+
mountTargets.push([prefix, backend, value.options.mountpoint]);
|
|
1246
1515
|
} else {
|
|
1247
1516
|
specs[prefix] = value;
|
|
1248
1517
|
}
|
|
1249
1518
|
}
|
|
1250
1519
|
super(specs, {
|
|
1251
1520
|
...options,
|
|
1252
|
-
...Object.keys(
|
|
1521
|
+
...Object.keys(commandLimits).length > 0 ? { commandLimits } : {},
|
|
1253
1522
|
shellParserFactory: options.shellParserFactory ?? loadShellParser
|
|
1254
1523
|
});
|
|
1255
|
-
if (
|
|
1256
|
-
const setups =
|
|
1257
|
-
([prefix,
|
|
1524
|
+
if (mountTargets.length > 0) {
|
|
1525
|
+
const setups = mountTargets.map(
|
|
1526
|
+
([prefix, backend, mountpoint]) => this.addFuseMount(prefix, mountpoint, void 0, backend).then(
|
|
1258
1527
|
() => void 0,
|
|
1259
1528
|
(err) => {
|
|
1260
1529
|
process.stderr.write(
|
|
@@ -1288,7 +1557,7 @@ var Workspace = class extends CoreWorkspace {
|
|
|
1288
1557
|
* into a container and the narrowing travels with it); it is keyed
|
|
1289
1558
|
* separately so the same prefix can also be exposed unbound.
|
|
1290
1559
|
*/
|
|
1291
|
-
async addFuseMount(prefix, mountpoint, sessionId) {
|
|
1560
|
+
async addFuseMount(prefix, mountpoint, sessionId, backend) {
|
|
1292
1561
|
const session = sessionId !== void 0 ? this.getSession(sessionId) : void 0;
|
|
1293
1562
|
const key = sessionId === void 0 ? prefix : `${prefix}@${sessionId}`;
|
|
1294
1563
|
if (mountpoint !== void 0) this.registerFuseMount(key, mountpoint);
|
|
@@ -1298,7 +1567,8 @@ var Workspace = class extends CoreWorkspace {
|
|
|
1298
1567
|
const mp = await fm.setup(this, {
|
|
1299
1568
|
rootPrefix: prefix,
|
|
1300
1569
|
...mountpoint !== void 0 ? { mountpoint } : {},
|
|
1301
|
-
...session !== void 0 ? { session } : {}
|
|
1570
|
+
...session !== void 0 ? { session } : {},
|
|
1571
|
+
...backend !== void 0 ? { backend } : {}
|
|
1302
1572
|
});
|
|
1303
1573
|
if (mountpoint === void 0) this.registerFuseMount(key, mp);
|
|
1304
1574
|
return mp;
|
|
@@ -1346,11 +1616,22 @@ var Workspace = class extends CoreWorkspace {
|
|
|
1346
1616
|
};
|
|
1347
1617
|
|
|
1348
1618
|
// src/observe/disk_store.ts
|
|
1349
|
-
import {
|
|
1619
|
+
import {
|
|
1620
|
+
appendFile,
|
|
1621
|
+
mkdir,
|
|
1622
|
+
readdir,
|
|
1623
|
+
readFile,
|
|
1624
|
+
rmdir,
|
|
1625
|
+
stat as stat2,
|
|
1626
|
+
unlink,
|
|
1627
|
+
writeFile
|
|
1628
|
+
} from "fs/promises";
|
|
1350
1629
|
import path from "path";
|
|
1351
|
-
|
|
1630
|
+
import { ObserverStoreBase } from "@struktoai/mirage-core";
|
|
1631
|
+
var DiskObserverStore = class extends ObserverStoreBase {
|
|
1352
1632
|
root;
|
|
1353
1633
|
constructor(root) {
|
|
1634
|
+
super();
|
|
1354
1635
|
this.root = root;
|
|
1355
1636
|
}
|
|
1356
1637
|
abs(key) {
|
|
@@ -1366,9 +1647,6 @@ var DiskObserverStore = class {
|
|
|
1366
1647
|
await mkdir(path.dirname(absPath), { recursive: true });
|
|
1367
1648
|
await writeFile(absPath, data);
|
|
1368
1649
|
}
|
|
1369
|
-
readAll() {
|
|
1370
|
-
return this.readMatching("");
|
|
1371
|
-
}
|
|
1372
1650
|
async readMatching(suffix) {
|
|
1373
1651
|
const out = /* @__PURE__ */ new Map();
|
|
1374
1652
|
const { files } = await this.walk();
|
|
@@ -1384,22 +1662,23 @@ var DiskObserverStore = class {
|
|
|
1384
1662
|
for (const absPath of files) await unlink(absPath);
|
|
1385
1663
|
for (const d of [...dirs].reverse()) await rmdir(d);
|
|
1386
1664
|
}
|
|
1387
|
-
|
|
1388
|
-
|
|
1665
|
+
async rootIsDir() {
|
|
1666
|
+
try {
|
|
1667
|
+
return (await stat2(this.root)).isDirectory();
|
|
1668
|
+
} catch (err) {
|
|
1669
|
+
if (err.code === "ENOENT") return false;
|
|
1670
|
+
throw err;
|
|
1671
|
+
}
|
|
1389
1672
|
}
|
|
1390
1673
|
async walk() {
|
|
1391
1674
|
const files = [];
|
|
1392
1675
|
const dirs = [];
|
|
1676
|
+
if (!await this.rootIsDir()) return { files, dirs };
|
|
1393
1677
|
const stack = [this.root];
|
|
1394
1678
|
while (stack.length > 0) {
|
|
1395
1679
|
const d = stack.pop();
|
|
1396
1680
|
if (d === void 0) break;
|
|
1397
|
-
|
|
1398
|
-
try {
|
|
1399
|
-
entries = await readdir(d, { withFileTypes: true });
|
|
1400
|
-
} catch {
|
|
1401
|
-
continue;
|
|
1402
|
-
}
|
|
1681
|
+
const entries = await readdir(d, { withFileTypes: true });
|
|
1403
1682
|
dirs.push(d);
|
|
1404
1683
|
for (const entry of entries) {
|
|
1405
1684
|
const full = path.join(d, entry.name);
|
|
@@ -1412,12 +1691,14 @@ var DiskObserverStore = class {
|
|
|
1412
1691
|
};
|
|
1413
1692
|
|
|
1414
1693
|
// src/observe/redis_store.ts
|
|
1415
|
-
|
|
1694
|
+
import { compareCodePoints as compareCodePoints2, ObserverStoreBase as ObserverStoreBase2 } from "@struktoai/mirage-core";
|
|
1695
|
+
var RedisObserverStore = class extends ObserverStoreBase2 {
|
|
1416
1696
|
url;
|
|
1417
1697
|
prefix;
|
|
1418
1698
|
indexKey;
|
|
1419
1699
|
clientPromise = null;
|
|
1420
1700
|
constructor(options = {}) {
|
|
1701
|
+
super();
|
|
1421
1702
|
this.url = options.url ?? "redis://localhost:6379/0";
|
|
1422
1703
|
this.prefix = options.keyPrefix ?? "mirage:observer:";
|
|
1423
1704
|
this.indexKey = `${this.prefix}keys`;
|
|
@@ -1447,9 +1728,6 @@ var RedisObserverStore = class {
|
|
|
1447
1728
|
const buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
1448
1729
|
await c.multi().set(`${this.prefix}${key}`, buf).sAdd(this.indexKey, key).exec();
|
|
1449
1730
|
}
|
|
1450
|
-
readAll() {
|
|
1451
|
-
return this.readMatching("");
|
|
1452
|
-
}
|
|
1453
1731
|
async readMatching(suffix) {
|
|
1454
1732
|
const paths = (await this.indexedPaths()).filter((p) => p.endsWith(suffix));
|
|
1455
1733
|
return this.readPaths(paths);
|
|
@@ -1457,7 +1735,7 @@ var RedisObserverStore = class {
|
|
|
1457
1735
|
async indexedPaths() {
|
|
1458
1736
|
const c = await this.client();
|
|
1459
1737
|
const members = await c.sMembers(this.indexKey);
|
|
1460
|
-
return [...members].sort();
|
|
1738
|
+
return [...members].sort(compareCodePoints2);
|
|
1461
1739
|
}
|
|
1462
1740
|
async readPaths(paths) {
|
|
1463
1741
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -1488,13 +1766,144 @@ var RedisObserverStore = class {
|
|
|
1488
1766
|
}
|
|
1489
1767
|
};
|
|
1490
1768
|
|
|
1769
|
+
// src/shell/console/redis/store.ts
|
|
1770
|
+
import {
|
|
1771
|
+
Channel
|
|
1772
|
+
} from "@struktoai/mirage-core";
|
|
1773
|
+
|
|
1774
|
+
// src/shell/console/redis/constants.ts
|
|
1775
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
1776
|
+
var APPEND_LUA = readFileSync2(new URL("./append.lua", import.meta.url), "utf8");
|
|
1777
|
+
var POLL_MS = 100;
|
|
1778
|
+
|
|
1779
|
+
// src/shell/console/redis/store.ts
|
|
1780
|
+
function sleep(ms) {
|
|
1781
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
1782
|
+
}
|
|
1783
|
+
var RedisConsoleStore = class {
|
|
1784
|
+
url;
|
|
1785
|
+
keyPrefix;
|
|
1786
|
+
streamKey;
|
|
1787
|
+
counterKey;
|
|
1788
|
+
endedKey;
|
|
1789
|
+
ttlSeconds;
|
|
1790
|
+
clientPromise = null;
|
|
1791
|
+
isClosed = false;
|
|
1792
|
+
constructor(options = {}) {
|
|
1793
|
+
this.url = options.url ?? "redis://localhost:6379/0";
|
|
1794
|
+
this.keyPrefix = options.keyPrefix ?? "mirage:console:";
|
|
1795
|
+
this.streamKey = `${this.keyPrefix}stream`;
|
|
1796
|
+
this.counterKey = `${this.keyPrefix}seq`;
|
|
1797
|
+
this.endedKey = `${this.keyPrefix}ended`;
|
|
1798
|
+
this.ttlSeconds = options.ttlSeconds ?? 0;
|
|
1799
|
+
}
|
|
1800
|
+
get closed() {
|
|
1801
|
+
return this.isClosed;
|
|
1802
|
+
}
|
|
1803
|
+
async client() {
|
|
1804
|
+
this.clientPromise ??= (async () => {
|
|
1805
|
+
const mod = await loadOptionalPeer(
|
|
1806
|
+
() => import("redis"),
|
|
1807
|
+
{ feature: "RedisConsoleStore", packageName: "redis" }
|
|
1808
|
+
);
|
|
1809
|
+
const c = mod.createClient({
|
|
1810
|
+
url: this.url,
|
|
1811
|
+
socket: { reconnectStrategy: false }
|
|
1812
|
+
});
|
|
1813
|
+
await c.connect();
|
|
1814
|
+
return c;
|
|
1815
|
+
})();
|
|
1816
|
+
return this.clientPromise;
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Append one chunk, atomically against the console's ending.
|
|
1820
|
+
*
|
|
1821
|
+
* A dropped append (the console already ended) reports the last real
|
|
1822
|
+
* chunk's seq; `JobConsole.emit` ignores the return and the drop is
|
|
1823
|
+
* exactly its documented after-the-ending semantics.
|
|
1824
|
+
*/
|
|
1825
|
+
async append(channel, data) {
|
|
1826
|
+
const c = await this.client();
|
|
1827
|
+
const ts = Date.now() / 1e3;
|
|
1828
|
+
const buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
1829
|
+
const count = await c.eval(APPEND_LUA, {
|
|
1830
|
+
keys: [this.streamKey, this.counterKey, this.endedKey],
|
|
1831
|
+
arguments: [
|
|
1832
|
+
channel,
|
|
1833
|
+
buf,
|
|
1834
|
+
String(ts),
|
|
1835
|
+
channel === Channel.CONTROL ? "1" : "0",
|
|
1836
|
+
String(this.ttlSeconds)
|
|
1837
|
+
]
|
|
1838
|
+
});
|
|
1839
|
+
return { seq: count - 1, ts, channel, data };
|
|
1840
|
+
}
|
|
1841
|
+
async readFrom(seq, limit) {
|
|
1842
|
+
const c = await this.client();
|
|
1843
|
+
const mod = await import("redis");
|
|
1844
|
+
const mapping = { [mod.RESP_TYPES.BLOB_STRING]: Buffer };
|
|
1845
|
+
const typed = c;
|
|
1846
|
+
const entries = await typed.withTypeMapping(mapping).xRange(
|
|
1847
|
+
this.streamKey,
|
|
1848
|
+
`${(seq + 1).toString()}-0`,
|
|
1849
|
+
"+",
|
|
1850
|
+
limit === void 0 ? void 0 : { COUNT: limit }
|
|
1851
|
+
);
|
|
1852
|
+
const chunks = entries.map((entry) => this.chunk(entry));
|
|
1853
|
+
const first = chunks[0];
|
|
1854
|
+
const last = chunks[chunks.length - 1];
|
|
1855
|
+
if (first !== void 0 && last !== void 0) {
|
|
1856
|
+
return [chunks, last.seq + 1, first.seq > seq];
|
|
1857
|
+
}
|
|
1858
|
+
const raw = await c.get(this.counterKey);
|
|
1859
|
+
const total = raw === null ? 0 : Number(raw);
|
|
1860
|
+
return [[], Math.min(seq, total), false];
|
|
1861
|
+
}
|
|
1862
|
+
async wait(seq) {
|
|
1863
|
+
if (this.isClosed) return;
|
|
1864
|
+
const c = await this.client();
|
|
1865
|
+
while (!this.isClosed) {
|
|
1866
|
+
let raw;
|
|
1867
|
+
try {
|
|
1868
|
+
raw = await c.get(this.counterKey);
|
|
1869
|
+
} catch (err) {
|
|
1870
|
+
if (this.isClosed) return;
|
|
1871
|
+
throw err;
|
|
1872
|
+
}
|
|
1873
|
+
if (raw !== null && Number(raw) > seq) return;
|
|
1874
|
+
await sleep(POLL_MS);
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
async close() {
|
|
1878
|
+
this.isClosed = true;
|
|
1879
|
+
if (this.clientPromise === null) return;
|
|
1880
|
+
const pending = this.clientPromise;
|
|
1881
|
+
this.clientPromise = null;
|
|
1882
|
+
const c = await pending;
|
|
1883
|
+
await c.quit();
|
|
1884
|
+
}
|
|
1885
|
+
/** Delete the console's keys (test and integ teardown only). */
|
|
1886
|
+
async clear() {
|
|
1887
|
+
const c = await this.client();
|
|
1888
|
+
await c.del([this.streamKey, this.counterKey, this.endedKey]);
|
|
1889
|
+
}
|
|
1890
|
+
chunk(entry) {
|
|
1891
|
+
return {
|
|
1892
|
+
seq: Number(entry.id.toString().split("-")[0]) - 1,
|
|
1893
|
+
ts: Number(entry.message.t?.toString() ?? "0"),
|
|
1894
|
+
channel: entry.message.c?.toString() ?? "stdout",
|
|
1895
|
+
data: new Uint8Array(entry.message.d ?? Buffer.alloc(0))
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1898
|
+
};
|
|
1899
|
+
|
|
1491
1900
|
// src/workspace/namespace/disk.ts
|
|
1492
1901
|
import { NamespaceStore } from "@struktoai/mirage-core";
|
|
1493
1902
|
|
|
1494
|
-
// src/workspace/
|
|
1495
|
-
import { mkdir as mkdir2, open, readFile as readFile2, readdir as readdir2, rename, stat as
|
|
1903
|
+
// src/workspace/record/disk.ts
|
|
1904
|
+
import { mkdir as mkdir2, open, readFile as readFile2, readdir as readdir2, rename, stat as stat3, unlink as unlink2, writeFile as writeFile2 } from "fs/promises";
|
|
1496
1905
|
import path2 from "path";
|
|
1497
|
-
import { generationOf
|
|
1906
|
+
import { generationOf } from "@struktoai/mirage-core";
|
|
1498
1907
|
var LOCK_STALE_SECONDS = 10;
|
|
1499
1908
|
var LOCK_RETRY_SLEEP_MS = 5;
|
|
1500
1909
|
var LOCK_RETRY_LIMIT = 2e3;
|
|
@@ -1632,14 +2041,14 @@ var DiskRecordClient = class {
|
|
|
1632
2041
|
// True when the lock is gone or was stale and removed; false when a
|
|
1633
2042
|
// live writer still holds it.
|
|
1634
2043
|
async reclaimStaleLock(lockPath) {
|
|
1635
|
-
let
|
|
2044
|
+
let mtimeMs2;
|
|
1636
2045
|
try {
|
|
1637
|
-
|
|
2046
|
+
mtimeMs2 = (await stat3(lockPath)).mtimeMs;
|
|
1638
2047
|
} catch (e) {
|
|
1639
2048
|
if (isMissing(e)) return true;
|
|
1640
2049
|
throw e;
|
|
1641
2050
|
}
|
|
1642
|
-
const age = (Date.now() -
|
|
2051
|
+
const age = (Date.now() - mtimeMs2) / 1e3;
|
|
1643
2052
|
if (age <= LOCK_STALE_SECONDS) return false;
|
|
1644
2053
|
console.warn(`mirage: reclaiming stale lock ${lockPath} (age ${age.toFixed(1)}s)`);
|
|
1645
2054
|
try {
|
|
@@ -1664,36 +2073,6 @@ var DiskRecordClient = class {
|
|
|
1664
2073
|
await rename(tmp, target);
|
|
1665
2074
|
}
|
|
1666
2075
|
};
|
|
1667
|
-
var DiskSessionStore = class extends SessionStore {
|
|
1668
|
-
records;
|
|
1669
|
-
constructor(root) {
|
|
1670
|
-
super();
|
|
1671
|
-
this.records = new DiskRecordClient(root, "sessions/");
|
|
1672
|
-
}
|
|
1673
|
-
async load() {
|
|
1674
|
-
return await this.records.loadAll();
|
|
1675
|
-
}
|
|
1676
|
-
async set(sessionId, fields) {
|
|
1677
|
-
await this.records.put(sessionId, fields);
|
|
1678
|
-
}
|
|
1679
|
-
async casSet(sessionId, fields, expectedGeneration) {
|
|
1680
|
-
return await this.records.casPut(sessionId, fields, expectedGeneration);
|
|
1681
|
-
}
|
|
1682
|
-
async delete(sessionIds) {
|
|
1683
|
-
await this.records.delete(sessionIds);
|
|
1684
|
-
}
|
|
1685
|
-
async replaceAll(entries) {
|
|
1686
|
-
const stale = (await this.records.listNames()).filter((n) => !entries.has(n));
|
|
1687
|
-
await this.records.delete(stale);
|
|
1688
|
-
await Promise.all([...entries].map(([sid, fields]) => this.records.put(sid, fields)));
|
|
1689
|
-
}
|
|
1690
|
-
async clear() {
|
|
1691
|
-
await this.records.clear();
|
|
1692
|
-
}
|
|
1693
|
-
async close() {
|
|
1694
|
-
await this.records.close();
|
|
1695
|
-
}
|
|
1696
|
-
};
|
|
1697
2076
|
|
|
1698
2077
|
// src/workspace/namespace/disk.ts
|
|
1699
2078
|
var NAMESPACE_RECORD = "namespace";
|
|
@@ -1852,10 +2231,43 @@ var RedisNamespaceStore = class extends NamespaceStore2 {
|
|
|
1852
2231
|
}
|
|
1853
2232
|
};
|
|
1854
2233
|
|
|
2234
|
+
// src/workspace/session/disk.ts
|
|
2235
|
+
import { SessionStore } from "@struktoai/mirage-core";
|
|
2236
|
+
var DiskSessionStore = class extends SessionStore {
|
|
2237
|
+
records;
|
|
2238
|
+
constructor(root) {
|
|
2239
|
+
super();
|
|
2240
|
+
this.records = new DiskRecordClient(root, "sessions/");
|
|
2241
|
+
}
|
|
2242
|
+
async load() {
|
|
2243
|
+
return await this.records.loadAll();
|
|
2244
|
+
}
|
|
2245
|
+
async set(sessionId, fields) {
|
|
2246
|
+
await this.records.put(sessionId, fields);
|
|
2247
|
+
}
|
|
2248
|
+
async casSet(sessionId, fields, expectedGeneration) {
|
|
2249
|
+
return await this.records.casPut(sessionId, fields, expectedGeneration);
|
|
2250
|
+
}
|
|
2251
|
+
async delete(sessionIds) {
|
|
2252
|
+
await this.records.delete(sessionIds);
|
|
2253
|
+
}
|
|
2254
|
+
async replaceAll(entries) {
|
|
2255
|
+
const stale = (await this.records.listNames()).filter((n) => !entries.has(n));
|
|
2256
|
+
await this.records.delete(stale);
|
|
2257
|
+
await Promise.all([...entries].map(([sid, fields]) => this.records.put(sid, fields)));
|
|
2258
|
+
}
|
|
2259
|
+
async clear() {
|
|
2260
|
+
await this.records.clear();
|
|
2261
|
+
}
|
|
2262
|
+
async close() {
|
|
2263
|
+
await this.records.close();
|
|
2264
|
+
}
|
|
2265
|
+
};
|
|
2266
|
+
|
|
1855
2267
|
// src/workspace/session/redis.ts
|
|
1856
|
-
import { readFileSync as
|
|
2268
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
1857
2269
|
import { SessionStore as SessionStore2 } from "@struktoai/mirage-core";
|
|
1858
|
-
var CAS_SCRIPT =
|
|
2270
|
+
var CAS_SCRIPT = readFileSync3(new URL("./cas.lua", import.meta.url), "utf8");
|
|
1859
2271
|
var RedisSessionStore = class extends SessionStore2 {
|
|
1860
2272
|
url;
|
|
1861
2273
|
key;
|
|
@@ -2118,14 +2530,10 @@ var fs = requireCjs3("node:fs");
|
|
|
2118
2530
|
var fsMonkey = requireCjs3("fs-monkey");
|
|
2119
2531
|
var { patchFs } = fsMonkey;
|
|
2120
2532
|
function mountedPath(ws, p) {
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
return true;
|
|
2126
|
-
} catch {
|
|
2127
|
-
return false;
|
|
2128
|
-
}
|
|
2533
|
+
const m = ws.registry.tryMountFor(p);
|
|
2534
|
+
if (m === null) return false;
|
|
2535
|
+
if (ws.syntheticRoot && m === ws.registry.rootMount) return false;
|
|
2536
|
+
return true;
|
|
2129
2537
|
}
|
|
2130
2538
|
async function mirageStat(ws, p) {
|
|
2131
2539
|
const s = await ws.fs.stat(p);
|
|
@@ -2336,8 +2744,11 @@ function metadataProvision(_accessor, paths, _texts, _opts) {
|
|
|
2336
2744
|
|
|
2337
2745
|
// src/cache/redis/file.ts
|
|
2338
2746
|
import {
|
|
2747
|
+
CacheType,
|
|
2339
2748
|
defaultFingerprint,
|
|
2749
|
+
globEscape,
|
|
2340
2750
|
parseLimit,
|
|
2751
|
+
registerFileCacheStore,
|
|
2341
2752
|
validateMaxDrainBytes
|
|
2342
2753
|
} from "@struktoai/mirage-core";
|
|
2343
2754
|
var RedisFileCacheStore = class extends RedisResource {
|
|
@@ -2426,6 +2837,23 @@ var RedisFileCacheStore = class extends RedisResource {
|
|
|
2426
2837
|
if (fp === null) return false;
|
|
2427
2838
|
return fp === remoteFingerprint;
|
|
2428
2839
|
}
|
|
2840
|
+
async evictPrefix(prefix) {
|
|
2841
|
+
for (const key of [...this.drainTasks.keys()]) {
|
|
2842
|
+
if (key.startsWith(prefix)) this.drainTasks.delete(key);
|
|
2843
|
+
}
|
|
2844
|
+
const escaped = globEscape(prefix);
|
|
2845
|
+
const c = await this.cacheClient();
|
|
2846
|
+
for (const base of [this.dataPrefix, this.metaPrefix]) {
|
|
2847
|
+
const batch = [];
|
|
2848
|
+
for await (const k of c.scanIterator({ MATCH: `${base}${escaped}*` })) {
|
|
2849
|
+
if (Array.isArray(k)) batch.push(...k);
|
|
2850
|
+
else batch.push(k);
|
|
2851
|
+
}
|
|
2852
|
+
if (batch.length > 0) await c.del(batch);
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
evictPaths(_paths) {
|
|
2856
|
+
}
|
|
2429
2857
|
async clear() {
|
|
2430
2858
|
this.drainTasks.clear();
|
|
2431
2859
|
const c = await this.cacheClient();
|
|
@@ -2450,387 +2878,1458 @@ var RedisFileCacheStore = class extends RedisResource {
|
|
|
2450
2878
|
return out;
|
|
2451
2879
|
}
|
|
2452
2880
|
};
|
|
2881
|
+
registerFileCacheStore(CacheType.REDIS, (config) => {
|
|
2882
|
+
return new RedisFileCacheStore({
|
|
2883
|
+
...config.limit !== void 0 ? { cacheLimit: config.limit } : {},
|
|
2884
|
+
...config.maxDrainBytes !== void 0 ? { maxDrainBytes: config.maxDrainBytes } : {},
|
|
2885
|
+
...config.url !== void 0 ? { url: config.url } : {},
|
|
2886
|
+
...config.keyPrefix !== void 0 ? { keyPrefix: config.keyPrefix } : {}
|
|
2887
|
+
});
|
|
2888
|
+
});
|
|
2453
2889
|
|
|
2454
2890
|
// src/resource/hf_models/config.ts
|
|
2455
2891
|
var normalizeHfModelsConfig = normalizeHfRepoConfig;
|
|
2456
2892
|
var redactHfModelsConfig = redactHfRepoConfig;
|
|
2457
2893
|
|
|
2458
|
-
// src/
|
|
2459
|
-
import {
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2894
|
+
// src/index.ts
|
|
2895
|
+
import {
|
|
2896
|
+
normalizeSlackConfig,
|
|
2897
|
+
redactSlackConfig
|
|
2898
|
+
} from "@struktoai/mirage-core";
|
|
2899
|
+
import {
|
|
2900
|
+
normalizeDiscordConfig,
|
|
2901
|
+
redactDiscordConfig
|
|
2902
|
+
} from "@struktoai/mirage-core";
|
|
2903
|
+
import {
|
|
2904
|
+
normalizeLinearConfig,
|
|
2905
|
+
redactLinearConfig
|
|
2906
|
+
} from "@struktoai/mirage-core";
|
|
2907
|
+
import {
|
|
2908
|
+
normalizeNotionConfig,
|
|
2909
|
+
redactNotionConfig
|
|
2910
|
+
} from "@struktoai/mirage-core";
|
|
2911
|
+
import {
|
|
2912
|
+
Mem0Resource,
|
|
2913
|
+
OneDriveResource,
|
|
2914
|
+
SharePointResource
|
|
2915
|
+
} from "@struktoai/mirage-core";
|
|
2916
|
+
|
|
2917
|
+
// src/commands/cli/builtin/himalaya/index.ts
|
|
2918
|
+
import { CLISpec, Operand, Option, registerCliSpec } from "@struktoai/mirage-core";
|
|
2919
|
+
|
|
2920
|
+
// src/commands/cli/builtin/himalaya/compose.ts
|
|
2921
|
+
import { FlagView } from "@struktoai/mirage-core";
|
|
2922
|
+
|
|
2923
|
+
// src/commands/cli/builtin/himalaya/util.ts
|
|
2924
|
+
import {
|
|
2925
|
+
mimeTypeFor,
|
|
2926
|
+
IOResult,
|
|
2927
|
+
PathSpec,
|
|
2928
|
+
isMissingPath
|
|
2929
|
+
} from "@struktoai/mirage-core";
|
|
2930
|
+
|
|
2931
|
+
// src/commands/cli/builtin/himalaya/builder.ts
|
|
2932
|
+
import { createHash } from "crypto";
|
|
2933
|
+
import {
|
|
2934
|
+
assertHeaderValue,
|
|
2935
|
+
encodeBase64Lines,
|
|
2936
|
+
encodeMimeText as encodeText,
|
|
2937
|
+
foldAddressList,
|
|
2938
|
+
foldContentDisposition,
|
|
2939
|
+
foldUnstructured,
|
|
2940
|
+
materialize
|
|
2470
2941
|
} from "@struktoai/mirage-core";
|
|
2942
|
+
var PREFIXES = { reply: "Re: ", forward: "Fwd: " };
|
|
2943
|
+
var ENC2 = new TextEncoder();
|
|
2944
|
+
function mixedBoundary(body, attachments) {
|
|
2945
|
+
const digest = createHash("sha256").update(Buffer.from(body, "utf8"));
|
|
2946
|
+
for (const attachment of attachments) {
|
|
2947
|
+
digest.update(Buffer.from(attachment.filename, "utf8"));
|
|
2948
|
+
digest.update(Buffer.from(attachment.contentType, "utf8"));
|
|
2949
|
+
digest.update(attachment.data);
|
|
2950
|
+
}
|
|
2951
|
+
return digest.digest("hex").slice(0, 32);
|
|
2952
|
+
}
|
|
2953
|
+
function splitAddresses(values) {
|
|
2954
|
+
return values.flatMap(
|
|
2955
|
+
(value) => value.split(",").map((part) => part.trim()).filter((part) => part !== "")
|
|
2956
|
+
);
|
|
2957
|
+
}
|
|
2958
|
+
function formatAddress(entry) {
|
|
2959
|
+
const email = entry.email.trim();
|
|
2960
|
+
const name = entry.name.trim();
|
|
2961
|
+
return name !== "" && email !== "" ? `${name} <${email}>` : email;
|
|
2962
|
+
}
|
|
2963
|
+
function hasPrefix(subject, prefix) {
|
|
2964
|
+
const head = subject.trimStart();
|
|
2965
|
+
const marker = prefix.trim();
|
|
2966
|
+
return head.slice(0, marker.length).toLowerCase() === marker.toLowerCase();
|
|
2967
|
+
}
|
|
2968
|
+
function replyRecipients(message) {
|
|
2969
|
+
if (message.reply_to.length > 0) return message.reply_to.map((entry) => formatAddress(entry));
|
|
2970
|
+
const rendered = formatAddress(message.from);
|
|
2971
|
+
return rendered === "" ? [] : [rendered];
|
|
2972
|
+
}
|
|
2973
|
+
function quoteText(sourceText, headline) {
|
|
2974
|
+
const trimmed = sourceText.trim();
|
|
2975
|
+
if (trimmed === "") return "";
|
|
2976
|
+
const lines = [];
|
|
2977
|
+
if (headline.trim() !== "") lines.push(headline.replace(/\n+$/, ""));
|
|
2978
|
+
for (const line of trimmed.split("\n")) {
|
|
2979
|
+
lines.push(line.startsWith(">") ? `>${line}` : `> ${line}`);
|
|
2980
|
+
}
|
|
2981
|
+
return lines.join("\n");
|
|
2982
|
+
}
|
|
2983
|
+
function composeBody(userBody, quote2, signature, style) {
|
|
2984
|
+
let body = userBody.replace(/\n+$/, "");
|
|
2985
|
+
if (quote2 !== "") {
|
|
2986
|
+
if (body === "") body = quote2;
|
|
2987
|
+
else if (style === "bottom") body = `${quote2}
|
|
2988
|
+
|
|
2989
|
+
${body}`;
|
|
2990
|
+
else body = `${body}
|
|
2991
|
+
|
|
2992
|
+
${quote2}`;
|
|
2993
|
+
}
|
|
2994
|
+
if (signature.trim() !== "") body = `${body}
|
|
2995
|
+
|
|
2996
|
+
--
|
|
2997
|
+
${signature.replace(/\n+$/, "")}`;
|
|
2998
|
+
return body;
|
|
2999
|
+
}
|
|
3000
|
+
function build(compose2, source = null) {
|
|
3001
|
+
let recipients = [...compose2.to];
|
|
3002
|
+
let subject = compose2.subject;
|
|
3003
|
+
let sourceText = "";
|
|
3004
|
+
const headLines = [foldAddressList("From", [compose2.sender])];
|
|
3005
|
+
if (source !== null) {
|
|
3006
|
+
const original = source.message;
|
|
3007
|
+
const prefix = PREFIXES[source.mode];
|
|
3008
|
+
subject ??= hasPrefix(original.subject, prefix) ? original.subject : `${prefix}${original.subject}`;
|
|
3009
|
+
if (source.mode === "reply" && recipients.length === 0) {
|
|
3010
|
+
recipients = replyRecipients(original);
|
|
3011
|
+
}
|
|
3012
|
+
if (original.message_id !== "") {
|
|
3013
|
+
if (source.mode === "reply") {
|
|
3014
|
+
headLines.push(foldUnstructured("In-Reply-To", original.message_id));
|
|
3015
|
+
}
|
|
3016
|
+
headLines.push(
|
|
3017
|
+
foldUnstructured("References", [...original.references, original.message_id].join(" "))
|
|
3018
|
+
);
|
|
3019
|
+
}
|
|
3020
|
+
sourceText = original.body_text;
|
|
3021
|
+
}
|
|
3022
|
+
if (recipients.length === 0) throw new Error("no recipient: pass --to");
|
|
3023
|
+
for (const value of [
|
|
3024
|
+
compose2.sender,
|
|
3025
|
+
...recipients,
|
|
3026
|
+
...compose2.cc,
|
|
3027
|
+
...compose2.bcc,
|
|
3028
|
+
subject ?? ""
|
|
3029
|
+
]) {
|
|
3030
|
+
assertHeaderValue(value);
|
|
3031
|
+
}
|
|
3032
|
+
headLines.push(foldAddressList("To", recipients));
|
|
3033
|
+
if (compose2.cc.length > 0) headLines.push(foldAddressList("Cc", compose2.cc));
|
|
3034
|
+
if (compose2.bcc.length > 0) headLines.push(foldAddressList("Bcc", compose2.bcc));
|
|
3035
|
+
headLines.push(foldUnstructured("Subject", subject ?? ""));
|
|
3036
|
+
const style = source !== null ? source.postingStyle : "top";
|
|
3037
|
+
const headline = source !== null ? source.quoteHeadline : "";
|
|
3038
|
+
const body = composeBody(
|
|
3039
|
+
compose2.body,
|
|
3040
|
+
quoteText(sourceText, headline),
|
|
3041
|
+
compose2.signature ?? "",
|
|
3042
|
+
style
|
|
3043
|
+
);
|
|
3044
|
+
const { cte, payload } = encodeText(body);
|
|
3045
|
+
const rendered = payload.replaceAll("\n", "\r\n");
|
|
3046
|
+
const attachments = compose2.attachments ?? [];
|
|
3047
|
+
if (attachments.length === 0) {
|
|
3048
|
+
headLines.push('Content-Type: text/plain; charset="utf-8"');
|
|
3049
|
+
headLines.push(`Content-Transfer-Encoding: ${cte}`);
|
|
3050
|
+
headLines.push("MIME-Version: 1.0");
|
|
3051
|
+
return ENC2.encode(`${headLines.join("\r\n")}\r
|
|
3052
|
+
\r
|
|
3053
|
+
${rendered}`);
|
|
3054
|
+
}
|
|
3055
|
+
const boundary = mixedBoundary(body, attachments);
|
|
3056
|
+
headLines.push("MIME-Version: 1.0");
|
|
3057
|
+
headLines.push(`Content-Type: multipart/mixed; boundary="${boundary}"`);
|
|
3058
|
+
const parts = [
|
|
3059
|
+
`Content-Type: text/plain; charset="utf-8"\r
|
|
3060
|
+
Content-Transfer-Encoding: ${cte}\r
|
|
3061
|
+
\r
|
|
3062
|
+
${rendered}`
|
|
3063
|
+
];
|
|
3064
|
+
for (const attachment of attachments) {
|
|
3065
|
+
const attachmentHead = `Content-Type: ${attachment.contentType}\r
|
|
3066
|
+
Content-Transfer-Encoding: base64\r
|
|
3067
|
+
${foldContentDisposition(attachment.filename)}\r
|
|
3068
|
+
MIME-Version: 1.0`;
|
|
3069
|
+
const encoded = encodeBase64Lines(attachment.data).replaceAll("\n", "\r\n");
|
|
3070
|
+
parts.push(`${attachmentHead}\r
|
|
3071
|
+
\r
|
|
3072
|
+
${encoded}`);
|
|
3073
|
+
}
|
|
3074
|
+
const head = headLines.join("\r\n");
|
|
3075
|
+
const joined = parts.join(`\r
|
|
3076
|
+
--${boundary}\r
|
|
3077
|
+
`);
|
|
3078
|
+
return ENC2.encode(`${head}\r
|
|
3079
|
+
\r
|
|
3080
|
+
--${boundary}\r
|
|
3081
|
+
${joined}\r
|
|
3082
|
+
--${boundary}--\r
|
|
3083
|
+
`);
|
|
3084
|
+
}
|
|
3085
|
+
async function readBody(fl, stdin) {
|
|
3086
|
+
const inline = fl.asStr("body");
|
|
3087
|
+
if (inline !== void 0) return inline;
|
|
3088
|
+
if (stdin === null) return "";
|
|
3089
|
+
return new TextDecoder().decode(await materialize(stdin));
|
|
3090
|
+
}
|
|
2471
3091
|
|
|
2472
|
-
// src/
|
|
3092
|
+
// src/commands/cli/builtin/himalaya/smtp.ts
|
|
3093
|
+
import { loadOptionalPeer as loadOptionalPeer3 } from "@struktoai/mirage-core";
|
|
3094
|
+
var transporterCache = /* @__PURE__ */ new WeakMap();
|
|
3095
|
+
async function getTransporter(config) {
|
|
3096
|
+
const existing = transporterCache.get(config);
|
|
3097
|
+
if (existing !== void 0) return existing;
|
|
3098
|
+
const mod = await loadOptionalPeer3(
|
|
3099
|
+
() => import("nodemailer"),
|
|
3100
|
+
{ feature: "himalaya message send", packageName: "nodemailer" }
|
|
3101
|
+
);
|
|
3102
|
+
const transporter = mod.createTransport({
|
|
3103
|
+
host: config.smtpHost,
|
|
3104
|
+
port: config.smtpPort,
|
|
3105
|
+
secure: config.smtpPort === 465,
|
|
3106
|
+
auth: { user: config.username, pass: config.password }
|
|
3107
|
+
});
|
|
3108
|
+
transporterCache.set(config, transporter);
|
|
3109
|
+
return transporter;
|
|
3110
|
+
}
|
|
3111
|
+
async function sendRaw(config, raw) {
|
|
3112
|
+
const transporter = await getTransporter(config);
|
|
3113
|
+
const parsed = await parseRfc822(raw);
|
|
3114
|
+
const recipients = [
|
|
3115
|
+
...parsed.to.map((entry) => entry.email),
|
|
3116
|
+
...parsed.cc.map((entry) => entry.email),
|
|
3117
|
+
...bccAddresses(raw)
|
|
3118
|
+
].filter((email) => email !== "");
|
|
3119
|
+
await transporter.sendMail({
|
|
3120
|
+
raw: Buffer.from(stripBcc(raw)),
|
|
3121
|
+
envelope: { from: parsed.from.email || config.username, to: recipients }
|
|
3122
|
+
});
|
|
3123
|
+
return parsed;
|
|
3124
|
+
}
|
|
3125
|
+
function bccAddresses(raw) {
|
|
3126
|
+
const addresses = [];
|
|
3127
|
+
for (const line of bccLines(raw)) {
|
|
3128
|
+
const value = line.replace(/^bcc:/i, "");
|
|
3129
|
+
for (const part of value.split(",")) {
|
|
3130
|
+
const angled = /<([^>]+)>/.exec(part);
|
|
3131
|
+
const email = (angled === null ? part : angled[1] ?? "").trim();
|
|
3132
|
+
if (email !== "") addresses.push(email);
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
return addresses;
|
|
3136
|
+
}
|
|
3137
|
+
function bccLines(raw) {
|
|
3138
|
+
const text = new TextDecoder().decode(raw);
|
|
3139
|
+
const split = text.search(/\r?\n\r?\n/);
|
|
3140
|
+
const head = split === -1 ? text : text.slice(0, split);
|
|
3141
|
+
const found = [];
|
|
3142
|
+
let collecting = false;
|
|
3143
|
+
for (const line of head.split(/\r?\n/)) {
|
|
3144
|
+
if (/^[ \t]/.test(line)) {
|
|
3145
|
+
if (collecting) {
|
|
3146
|
+
const last = found.pop() ?? "";
|
|
3147
|
+
found.push(`${last} ${line.trim()}`);
|
|
3148
|
+
}
|
|
3149
|
+
continue;
|
|
3150
|
+
}
|
|
3151
|
+
collecting = /^bcc:/i.test(line);
|
|
3152
|
+
if (collecting) found.push(line);
|
|
3153
|
+
}
|
|
3154
|
+
return found;
|
|
3155
|
+
}
|
|
3156
|
+
function stripBcc(raw) {
|
|
3157
|
+
const text = new TextDecoder().decode(raw);
|
|
3158
|
+
const split = text.search(/\r?\n\r?\n/);
|
|
3159
|
+
if (split === -1) return raw;
|
|
3160
|
+
const head = text.slice(0, split);
|
|
3161
|
+
const rest = text.slice(split);
|
|
3162
|
+
const kept = [];
|
|
3163
|
+
let dropping = false;
|
|
3164
|
+
for (const line of head.split(/\r?\n/)) {
|
|
3165
|
+
if (/^[ \t]/.test(line)) {
|
|
3166
|
+
if (!dropping) kept.push(line);
|
|
3167
|
+
continue;
|
|
3168
|
+
}
|
|
3169
|
+
dropping = /^bcc:/i.test(line);
|
|
3170
|
+
if (!dropping) kept.push(line);
|
|
3171
|
+
}
|
|
3172
|
+
return new TextEncoder().encode(kept.join("\r\n") + rest);
|
|
3173
|
+
}
|
|
3174
|
+
|
|
3175
|
+
// src/commands/cli/builtin/himalaya/deliver.ts
|
|
3176
|
+
var SENT_ATTRIBUTE = "\\sent";
|
|
3177
|
+
var DEFAULT_SENT_FOLDER = "Sent";
|
|
3178
|
+
var SEEN_FLAG = "\\Seen";
|
|
3179
|
+
async function resolveSentFolder(accessor, configured) {
|
|
3180
|
+
if (configured !== null && configured !== "") return configured;
|
|
3181
|
+
const entries = await listFolderEntries(accessor);
|
|
3182
|
+
const tagged = entries.find((entry) => entry.specialUse?.toLowerCase() === SENT_ATTRIBUTE);
|
|
3183
|
+
return tagged?.name ?? DEFAULT_SENT_FOLDER;
|
|
3184
|
+
}
|
|
3185
|
+
async function saveSentCopy(config, raw, named = null) {
|
|
3186
|
+
const accessor = new EmailAccessor(config);
|
|
3187
|
+
try {
|
|
3188
|
+
const folder = named ?? await resolveSentFolder(accessor, config.sentFolder);
|
|
3189
|
+
const imap = await accessor.getImap();
|
|
3190
|
+
const result = await imap.append(folder, Buffer.from(raw), [SEEN_FLAG]);
|
|
3191
|
+
if (result === false) throw new Error(`${folder}: the server refused the message`);
|
|
3192
|
+
return folder;
|
|
3193
|
+
} finally {
|
|
3194
|
+
await accessor.close();
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
async function deliver(config, raw, save = null) {
|
|
3198
|
+
const parsed = await sendRaw(config, raw);
|
|
3199
|
+
if (save === null && !config.saveCopy) return { parsed, warning: "" };
|
|
3200
|
+
try {
|
|
3201
|
+
await saveSentCopy(config, raw, save);
|
|
3202
|
+
} catch (error) {
|
|
3203
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
3204
|
+
return { parsed, warning: `himalaya: sent copy not saved: ${reason}
|
|
3205
|
+
` };
|
|
3206
|
+
}
|
|
3207
|
+
return { parsed, warning: "" };
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3210
|
+
// src/commands/cli/builtin/himalaya/util.ts
|
|
3211
|
+
var ENC3 = new TextEncoder();
|
|
3212
|
+
function addressList(addresses) {
|
|
3213
|
+
return addresses.map((entry) => entry.name === "" ? entry.email : `${entry.name} <${entry.email}>`).join(", ");
|
|
3214
|
+
}
|
|
3215
|
+
function firstText(texts, label) {
|
|
3216
|
+
const value = texts[0];
|
|
3217
|
+
if (value === void 0) throw new Error(`${label} is required`);
|
|
3218
|
+
return value;
|
|
3219
|
+
}
|
|
3220
|
+
async function loadAttachments(doors, paths) {
|
|
3221
|
+
if (paths.length === 0) return [];
|
|
3222
|
+
const dispatch = doors?.dispatch;
|
|
3223
|
+
if (dispatch === void 0) {
|
|
3224
|
+
throw new Error("--attach needs a workspace to read files from");
|
|
3225
|
+
}
|
|
3226
|
+
const attachments = [];
|
|
3227
|
+
for (const path4 of paths) {
|
|
3228
|
+
let data;
|
|
3229
|
+
try {
|
|
3230
|
+
;
|
|
3231
|
+
[data] = await dispatch("read", PathSpec.fromStrPath(path4));
|
|
3232
|
+
} catch (err) {
|
|
3233
|
+
if (isMissingPath(err)) {
|
|
3234
|
+
throw new Error(`read attachment ${path4}: No such file or directory`);
|
|
3235
|
+
}
|
|
3236
|
+
throw err;
|
|
3237
|
+
}
|
|
3238
|
+
const trimmed = path4.replace(/\/+$/, "");
|
|
3239
|
+
const filename = trimmed.slice(trimmed.lastIndexOf("/") + 1) || "attachment";
|
|
3240
|
+
attachments.push({
|
|
3241
|
+
filename,
|
|
3242
|
+
contentType: mimeTypeFor(filename),
|
|
3243
|
+
data: data instanceof Uint8Array ? data : new Uint8Array(data)
|
|
3244
|
+
});
|
|
3245
|
+
}
|
|
3246
|
+
return attachments;
|
|
3247
|
+
}
|
|
3248
|
+
async function route(config, fl, stdin, source, doors) {
|
|
3249
|
+
const raw = build(
|
|
3250
|
+
{
|
|
3251
|
+
sender: fl.asStr("from") ?? config.username,
|
|
3252
|
+
to: splitAddresses(fl.asList("to")),
|
|
3253
|
+
cc: splitAddresses(fl.asList("cc")),
|
|
3254
|
+
bcc: splitAddresses(fl.asList("bcc")),
|
|
3255
|
+
subject: fl.asStr("subject") ?? null,
|
|
3256
|
+
body: await readBody(fl, stdin),
|
|
3257
|
+
signature: fl.asStr("signature") ?? null,
|
|
3258
|
+
attachments: await loadAttachments(doors, fl.asList("attach"))
|
|
3259
|
+
},
|
|
3260
|
+
source
|
|
3261
|
+
);
|
|
3262
|
+
const save = fl.asStr("save") ?? null;
|
|
3263
|
+
if (!fl.asBool("send")) {
|
|
3264
|
+
if (save === null) return [raw, new IOResult()];
|
|
3265
|
+
const folder = await saveSentCopy(config, raw, save);
|
|
3266
|
+
const filed = await parseRfc822(raw);
|
|
3267
|
+
const saved = {
|
|
3268
|
+
status: "saved",
|
|
3269
|
+
mailbox: folder,
|
|
3270
|
+
to: addressList(filed.to),
|
|
3271
|
+
subject: filed.subject
|
|
3272
|
+
};
|
|
3273
|
+
return [ENC3.encode(JSON.stringify(saved)), new IOResult()];
|
|
3274
|
+
}
|
|
3275
|
+
const { parsed, warning } = await deliver(config, raw, save);
|
|
3276
|
+
const result = {
|
|
3277
|
+
status: "sent",
|
|
3278
|
+
to: addressList(parsed.to),
|
|
3279
|
+
subject: parsed.subject
|
|
3280
|
+
};
|
|
3281
|
+
return [
|
|
3282
|
+
ENC3.encode(JSON.stringify(result)),
|
|
3283
|
+
new IOResult({ stderr: warning === "" ? null : ENC3.encode(warning) })
|
|
3284
|
+
];
|
|
3285
|
+
}
|
|
3286
|
+
|
|
3287
|
+
// src/commands/cli/builtin/himalaya/compose.ts
|
|
3288
|
+
async function compose(inv) {
|
|
3289
|
+
return route(inv.config, new FlagView(inv.flags), inv.stdin, null, inv.doors);
|
|
3290
|
+
}
|
|
3291
|
+
|
|
3292
|
+
// src/commands/cli/builtin/himalaya/forward.ts
|
|
3293
|
+
import { FlagView as FlagView2 } from "@struktoai/mirage-core";
|
|
3294
|
+
async function forward(inv) {
|
|
3295
|
+
const fl = new FlagView2(inv.flags);
|
|
3296
|
+
const uid = firstText(inv.texts, "message id");
|
|
3297
|
+
const mailbox = fl.asStr("mailbox") ?? "INBOX";
|
|
3298
|
+
const accessor = new EmailAccessor(inv.config);
|
|
3299
|
+
let original;
|
|
3300
|
+
try {
|
|
3301
|
+
original = await fetchMessage(accessor, mailbox, uid);
|
|
3302
|
+
} finally {
|
|
3303
|
+
await accessor.close();
|
|
3304
|
+
}
|
|
3305
|
+
return route(
|
|
3306
|
+
inv.config,
|
|
3307
|
+
fl,
|
|
3308
|
+
inv.stdin,
|
|
3309
|
+
{
|
|
3310
|
+
message: original,
|
|
3311
|
+
mode: "forward",
|
|
3312
|
+
postingStyle: fl.asStr("posting_style") === "bottom" ? "bottom" : "top",
|
|
3313
|
+
quoteHeadline: fl.asStr("quote_headline") ?? ""
|
|
3314
|
+
},
|
|
3315
|
+
inv.doors
|
|
3316
|
+
);
|
|
3317
|
+
}
|
|
3318
|
+
|
|
3319
|
+
// src/commands/cli/builtin/himalaya/list.ts
|
|
2473
3320
|
import {
|
|
2474
|
-
|
|
3321
|
+
FlagView as FlagView3,
|
|
3322
|
+
IOResult as IOResult2
|
|
2475
3323
|
} from "@struktoai/mirage-core";
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
}
|
|
2488
|
-
var
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
3324
|
+
|
|
3325
|
+
// src/commands/cli/builtin/himalaya/query.ts
|
|
3326
|
+
import { compareCodePoints as compareCodePoints3 } from "@struktoai/mirage-core";
|
|
3327
|
+
var CONDITIONS = ["date", "before", "after", "from", "to", "subject", "body", "flag"];
|
|
3328
|
+
var SORT_KINDS = ["date", "from", "to", "subject"];
|
|
3329
|
+
var FLAGS = {
|
|
3330
|
+
seen: "SEEN",
|
|
3331
|
+
answered: "ANSWERED",
|
|
3332
|
+
flagged: "FLAGGED",
|
|
3333
|
+
draft: "DRAFT",
|
|
3334
|
+
deleted: "DELETED"
|
|
3335
|
+
};
|
|
3336
|
+
var IMAP_MONTHS = [
|
|
3337
|
+
"Jan",
|
|
3338
|
+
"Feb",
|
|
3339
|
+
"Mar",
|
|
3340
|
+
"Apr",
|
|
3341
|
+
"May",
|
|
3342
|
+
"Jun",
|
|
3343
|
+
"Jul",
|
|
3344
|
+
"Aug",
|
|
3345
|
+
"Sep",
|
|
3346
|
+
"Oct",
|
|
3347
|
+
"Nov",
|
|
3348
|
+
"Dec"
|
|
3349
|
+
];
|
|
3350
|
+
var QueryError = class extends Error {
|
|
3351
|
+
};
|
|
3352
|
+
function tokenize(source) {
|
|
3353
|
+
const tokens = [];
|
|
3354
|
+
let index = 0;
|
|
3355
|
+
while (index < source.length) {
|
|
3356
|
+
const char = source.charAt(index);
|
|
3357
|
+
if (/\s/.test(char)) {
|
|
3358
|
+
index += 1;
|
|
3359
|
+
continue;
|
|
3360
|
+
}
|
|
3361
|
+
if (char === "(" || char === ")") {
|
|
3362
|
+
tokens.push({ text: char, quoted: false });
|
|
3363
|
+
index += 1;
|
|
3364
|
+
continue;
|
|
3365
|
+
}
|
|
3366
|
+
if (char === '"') {
|
|
3367
|
+
index += 1;
|
|
3368
|
+
const chars = [];
|
|
3369
|
+
while (index < source.length && source.charAt(index) !== '"') {
|
|
3370
|
+
if (source.charAt(index) === "\\" && index + 1 < source.length) index += 1;
|
|
3371
|
+
chars.push(source.charAt(index));
|
|
3372
|
+
index += 1;
|
|
3373
|
+
}
|
|
3374
|
+
if (index >= source.length) throw new QueryError("unterminated quoted pattern");
|
|
3375
|
+
index += 1;
|
|
3376
|
+
tokens.push({ text: chars.join(""), quoted: true });
|
|
3377
|
+
continue;
|
|
3378
|
+
}
|
|
3379
|
+
const start = index;
|
|
3380
|
+
while (index < source.length && !/[\s()]/.test(source.charAt(index))) index += 1;
|
|
3381
|
+
tokens.push({ text: source.slice(start, index), quoted: false });
|
|
3382
|
+
}
|
|
3383
|
+
return tokens;
|
|
3384
|
+
}
|
|
3385
|
+
function keyword(token) {
|
|
3386
|
+
if (token === void 0 || token.quoted) return null;
|
|
3387
|
+
return token.text.toLowerCase();
|
|
3388
|
+
}
|
|
3389
|
+
function quote(value) {
|
|
3390
|
+
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
|
3391
|
+
}
|
|
3392
|
+
function imapDate(text) {
|
|
3393
|
+
const parts = text.split("-");
|
|
3394
|
+
if (parts.length !== 3) {
|
|
3395
|
+
throw new QueryError(`invalid date '${text}', expected yyyy-mm-dd`);
|
|
3396
|
+
}
|
|
3397
|
+
const year = Number(parts[0]);
|
|
3398
|
+
const month = Number(parts[1]);
|
|
3399
|
+
const day = Number(parts[2]);
|
|
3400
|
+
const value = new Date(Date.UTC(year, month - 1, day));
|
|
3401
|
+
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day) || Number.isNaN(value.getTime()) || value.getUTCMonth() !== month - 1 || value.getUTCDate() !== day) {
|
|
3402
|
+
throw new QueryError(`invalid date '${text}'`);
|
|
3403
|
+
}
|
|
3404
|
+
return value;
|
|
3405
|
+
}
|
|
3406
|
+
function formatDate(value) {
|
|
3407
|
+
const day = String(value.getUTCDate()).padStart(2, "0");
|
|
3408
|
+
const month = IMAP_MONTHS[value.getUTCMonth()] ?? "Jan";
|
|
3409
|
+
return `${day}-${month}-${String(value.getUTCFullYear())}`;
|
|
3410
|
+
}
|
|
3411
|
+
var Parser = class {
|
|
3412
|
+
constructor(tokens) {
|
|
3413
|
+
this.tokens = tokens;
|
|
3414
|
+
}
|
|
3415
|
+
tokens;
|
|
3416
|
+
index = 0;
|
|
3417
|
+
peek() {
|
|
3418
|
+
return this.tokens[this.index];
|
|
3419
|
+
}
|
|
3420
|
+
take() {
|
|
3421
|
+
const token = this.peek();
|
|
3422
|
+
if (token === void 0) throw new QueryError("unexpected end of query");
|
|
3423
|
+
this.index += 1;
|
|
3424
|
+
return token;
|
|
3425
|
+
}
|
|
3426
|
+
parseOr() {
|
|
3427
|
+
let left = this.parseAnd();
|
|
3428
|
+
while (keyword(this.peek()) === "or") {
|
|
3429
|
+
this.take();
|
|
3430
|
+
left = `OR ${left} ${this.parseAnd()}`;
|
|
3431
|
+
}
|
|
3432
|
+
return left;
|
|
3433
|
+
}
|
|
3434
|
+
parseAnd() {
|
|
3435
|
+
let left = this.parseUnary();
|
|
3436
|
+
while (keyword(this.peek()) === "and") {
|
|
3437
|
+
this.take();
|
|
3438
|
+
left = `(${left} ${this.parseUnary()})`;
|
|
3439
|
+
}
|
|
3440
|
+
return left;
|
|
3441
|
+
}
|
|
3442
|
+
parseUnary() {
|
|
3443
|
+
const word = keyword(this.peek());
|
|
3444
|
+
if (word === "not") {
|
|
3445
|
+
this.take();
|
|
3446
|
+
return `NOT ${this.parseUnary()}`;
|
|
3447
|
+
}
|
|
3448
|
+
if (word === "(") {
|
|
3449
|
+
this.take();
|
|
3450
|
+
const inner = this.parseOr();
|
|
3451
|
+
if (keyword(this.peek()) !== ")") throw new QueryError("missing closing ')'");
|
|
3452
|
+
this.take();
|
|
3453
|
+
return inner;
|
|
3454
|
+
}
|
|
3455
|
+
return this.parseCondition();
|
|
3456
|
+
}
|
|
3457
|
+
parseCondition() {
|
|
3458
|
+
const token = this.take();
|
|
3459
|
+
const word = keyword(token);
|
|
3460
|
+
if (word === null || !CONDITIONS.includes(word)) {
|
|
3461
|
+
throw new QueryError(
|
|
3462
|
+
`expected a condition (${CONDITIONS.join(", ")}) but found '${token.text}'`
|
|
3463
|
+
);
|
|
3464
|
+
}
|
|
3465
|
+
const value = this.take().text;
|
|
3466
|
+
if (word === "date") return `SENTON ${formatDate(imapDate(value))}`;
|
|
3467
|
+
if (word === "before") return `SENTBEFORE ${formatDate(imapDate(value))}`;
|
|
3468
|
+
if (word === "after") {
|
|
3469
|
+
const next = new Date(imapDate(value).getTime() + 864e5);
|
|
3470
|
+
return `SENTSINCE ${formatDate(next)}`;
|
|
3471
|
+
}
|
|
3472
|
+
if (word === "flag") {
|
|
3473
|
+
const key = FLAGS[value.toLowerCase()];
|
|
3474
|
+
if (key === void 0) {
|
|
3475
|
+
throw new QueryError(
|
|
3476
|
+
`unknown flag '${value}', expected one of ${Object.keys(FLAGS).sort(compareCodePoints3).join(", ")}`
|
|
3477
|
+
);
|
|
3478
|
+
}
|
|
3479
|
+
return key;
|
|
3480
|
+
}
|
|
3481
|
+
return `${word.toUpperCase()} ${quote(value)}`;
|
|
3482
|
+
}
|
|
3483
|
+
parseSorters() {
|
|
3484
|
+
this.take();
|
|
3485
|
+
if (keyword(this.peek()) !== "by") throw new QueryError("expected 'by' after 'order'");
|
|
3486
|
+
this.take();
|
|
3487
|
+
const sorters = [];
|
|
3488
|
+
for (; ; ) {
|
|
3489
|
+
const kind = keyword(this.peek());
|
|
3490
|
+
if (kind === null || !SORT_KINDS.includes(kind)) break;
|
|
3491
|
+
this.take();
|
|
3492
|
+
let descending = false;
|
|
3493
|
+
const order = keyword(this.peek());
|
|
3494
|
+
if (order === "asc" || order === "desc") {
|
|
3495
|
+
this.take();
|
|
3496
|
+
descending = order === "desc";
|
|
2503
3497
|
}
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
3498
|
+
sorters.push({ kind, descending });
|
|
3499
|
+
}
|
|
3500
|
+
if (sorters.length === 0) {
|
|
3501
|
+
throw new QueryError(`expected a sort key (${SORT_KINDS.join(", ")}) after 'order by'`);
|
|
3502
|
+
}
|
|
3503
|
+
return sorters;
|
|
3504
|
+
}
|
|
3505
|
+
};
|
|
3506
|
+
function parseQuery(source) {
|
|
3507
|
+
const parser = new Parser(tokenize(source));
|
|
3508
|
+
let criteria = "ALL";
|
|
3509
|
+
const head = keyword(parser.peek());
|
|
3510
|
+
if (head !== null && head !== "order") criteria = parser.parseOr();
|
|
3511
|
+
let sorters = [];
|
|
3512
|
+
if (keyword(parser.peek()) === "order") sorters = parser.parseSorters();
|
|
3513
|
+
const leftover = parser.peek();
|
|
3514
|
+
if (leftover !== void 0) {
|
|
3515
|
+
throw new QueryError(`unexpected '${leftover.text}' at end of query`);
|
|
3516
|
+
}
|
|
3517
|
+
return { criteria, sorters };
|
|
3518
|
+
}
|
|
3519
|
+
function sentAt(header) {
|
|
3520
|
+
const value = Date.parse(header.date);
|
|
3521
|
+
return Number.isNaN(value) ? 0 : value;
|
|
3522
|
+
}
|
|
3523
|
+
var SORT_KEYS = {
|
|
3524
|
+
date: sentAt,
|
|
3525
|
+
from: (header) => header.from.email,
|
|
3526
|
+
to: (header) => header.to[0]?.email ?? "",
|
|
3527
|
+
subject: (header) => header.subject
|
|
3528
|
+
};
|
|
3529
|
+
function compare(a, b) {
|
|
3530
|
+
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
3531
|
+
return String(a) < String(b) ? -1 : String(a) > String(b) ? 1 : 0;
|
|
3532
|
+
}
|
|
3533
|
+
function sortHeaders(headers, sorters) {
|
|
3534
|
+
const ordered = [...headers];
|
|
3535
|
+
if (sorters.length === 0) {
|
|
3536
|
+
ordered.sort((a, b) => sentAt(b) - sentAt(a));
|
|
3537
|
+
return ordered;
|
|
3538
|
+
}
|
|
3539
|
+
for (const sorter of [...sorters].reverse()) {
|
|
3540
|
+
const key = SORT_KEYS[sorter.kind];
|
|
3541
|
+
ordered.sort((a, b) => sorter.descending ? compare(key(b), key(a)) : compare(key(a), key(b)));
|
|
3542
|
+
}
|
|
3543
|
+
return ordered;
|
|
3544
|
+
}
|
|
3545
|
+
function uidBudget(page, pageSize, sorters, maxMessages) {
|
|
3546
|
+
if (sorters.length > 0) return maxMessages;
|
|
3547
|
+
return Math.min(Math.max(page, 1) * pageSize, maxMessages);
|
|
3548
|
+
}
|
|
3549
|
+
function pageSlice(items, page, pageSize) {
|
|
3550
|
+
const start = Math.max(page - 1, 0) * pageSize;
|
|
3551
|
+
return items.slice(start, start + pageSize);
|
|
3552
|
+
}
|
|
3553
|
+
|
|
3554
|
+
// src/commands/cli/builtin/himalaya/list.ts
|
|
3555
|
+
var DEFAULT_PAGE_SIZE = 25;
|
|
3556
|
+
async function listEnvelopes(inv) {
|
|
3557
|
+
const fl = new FlagView3(inv.flags);
|
|
3558
|
+
const mailbox = fl.asStr("mailbox") ?? "INBOX";
|
|
3559
|
+
const page = fl.asInt("page") ?? 1;
|
|
3560
|
+
const pageSize = fl.asInt("page_size") ?? DEFAULT_PAGE_SIZE;
|
|
3561
|
+
const account = inv.config;
|
|
3562
|
+
const budget = uidBudget(page, pageSize, [], account.maxMessages);
|
|
3563
|
+
const accessor = new EmailAccessor(account);
|
|
3564
|
+
let headers;
|
|
3565
|
+
try {
|
|
3566
|
+
const uids = await listMessageUids(accessor, mailbox, "ALL", budget);
|
|
3567
|
+
headers = uids.length > 0 ? await fetchHeaders(accessor, mailbox, uids) : [];
|
|
3568
|
+
} finally {
|
|
3569
|
+
await accessor.close();
|
|
3570
|
+
}
|
|
3571
|
+
const pageOf = pageSlice(sortHeaders(headers, []), page, pageSize);
|
|
3572
|
+
const out = messagesJsonBytes(pageOf);
|
|
3573
|
+
return [out, new IOResult2()];
|
|
3574
|
+
}
|
|
3575
|
+
|
|
3576
|
+
// src/commands/cli/builtin/himalaya/read.ts
|
|
3577
|
+
import {
|
|
3578
|
+
FlagView as FlagView4,
|
|
3579
|
+
IOResult as IOResult3
|
|
3580
|
+
} from "@struktoai/mirage-core";
|
|
3581
|
+
async function read(inv) {
|
|
3582
|
+
const fl = new FlagView4(inv.flags);
|
|
3583
|
+
const uid = firstText(inv.texts, "message id");
|
|
3584
|
+
const mailbox = fl.asStr("mailbox") ?? "INBOX";
|
|
3585
|
+
const accessor = new EmailAccessor(inv.config);
|
|
3586
|
+
try {
|
|
3587
|
+
if (fl.asBool("raw")) {
|
|
3588
|
+
const raw = await fetchRawMessage(accessor, mailbox, uid);
|
|
3589
|
+
return [raw, new IOResult3()];
|
|
3590
|
+
}
|
|
3591
|
+
const processed = await fetchMessage(accessor, mailbox, uid);
|
|
3592
|
+
const out = messageJsonBytes(processed);
|
|
3593
|
+
return [out, new IOResult3()];
|
|
3594
|
+
} finally {
|
|
3595
|
+
await accessor.close();
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
|
|
3599
|
+
// src/commands/cli/builtin/himalaya/reply.ts
|
|
3600
|
+
import { FlagView as FlagView5 } from "@struktoai/mirage-core";
|
|
3601
|
+
async function reply(inv) {
|
|
3602
|
+
const fl = new FlagView5(inv.flags);
|
|
3603
|
+
const uid = firstText(inv.texts, "message id");
|
|
3604
|
+
const mailbox = fl.asStr("mailbox") ?? "INBOX";
|
|
3605
|
+
const accessor = new EmailAccessor(inv.config);
|
|
3606
|
+
let original;
|
|
3607
|
+
try {
|
|
3608
|
+
original = await fetchMessage(accessor, mailbox, uid);
|
|
3609
|
+
} finally {
|
|
3610
|
+
await accessor.close();
|
|
3611
|
+
}
|
|
3612
|
+
return route(
|
|
3613
|
+
inv.config,
|
|
3614
|
+
fl,
|
|
3615
|
+
inv.stdin,
|
|
3616
|
+
{
|
|
3617
|
+
message: original,
|
|
3618
|
+
mode: "reply",
|
|
3619
|
+
postingStyle: fl.asStr("posting_style") === "bottom" ? "bottom" : "top",
|
|
3620
|
+
quoteHeadline: fl.asStr("quote_headline") ?? ""
|
|
3621
|
+
},
|
|
3622
|
+
inv.doors
|
|
3623
|
+
);
|
|
3624
|
+
}
|
|
3625
|
+
|
|
3626
|
+
// src/commands/cli/builtin/himalaya/search.ts
|
|
3627
|
+
import {
|
|
3628
|
+
FlagView as FlagView6,
|
|
3629
|
+
IOResult as IOResult4
|
|
3630
|
+
} from "@struktoai/mirage-core";
|
|
3631
|
+
async function searchEnvelopes(inv) {
|
|
3632
|
+
const fl = new FlagView6(inv.flags);
|
|
3633
|
+
const mailbox = fl.asStr("mailbox") ?? "INBOX";
|
|
3634
|
+
const page = fl.asInt("page") ?? 1;
|
|
3635
|
+
const pageSize = fl.asInt("page_size") ?? DEFAULT_PAGE_SIZE;
|
|
3636
|
+
const query = parseQuery(inv.texts.join(" "));
|
|
3637
|
+
const account = inv.config;
|
|
3638
|
+
const budget = uidBudget(page, pageSize, query.sorters, account.maxMessages);
|
|
3639
|
+
const accessor = new EmailAccessor(account);
|
|
3640
|
+
let headers;
|
|
3641
|
+
try {
|
|
3642
|
+
const uids = await listMessageUids(accessor, mailbox, query.criteria, budget);
|
|
3643
|
+
headers = uids.length > 0 ? await fetchHeaders(accessor, mailbox, uids) : [];
|
|
3644
|
+
} finally {
|
|
3645
|
+
await accessor.close();
|
|
3646
|
+
}
|
|
3647
|
+
const pageOf = pageSlice(sortHeaders(headers, query.sorters), page, pageSize);
|
|
3648
|
+
const out = messagesJsonBytes(pageOf);
|
|
3649
|
+
return [out, new IOResult4()];
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3652
|
+
// src/commands/cli/builtin/himalaya/send.ts
|
|
3653
|
+
import {
|
|
3654
|
+
FlagView as FlagView7,
|
|
3655
|
+
IOResult as IOResult5,
|
|
3656
|
+
materialize as materialize2
|
|
3657
|
+
} from "@struktoai/mirage-core";
|
|
3658
|
+
var ENC4 = new TextEncoder();
|
|
3659
|
+
async function send(inv) {
|
|
3660
|
+
const inline = inv.texts.join(" ").replaceAll("\\r", "").replaceAll("\\n", "\n");
|
|
3661
|
+
const raw = inline !== "" ? ENC4.encode(inline) : inv.stdin !== null ? await materialize2(inv.stdin) : new Uint8Array();
|
|
3662
|
+
if (new TextDecoder().decode(raw).trim() === "") {
|
|
3663
|
+
throw new Error("no message provided: pass it as an argument or pipe it via standard input");
|
|
3664
|
+
}
|
|
3665
|
+
const fl = new FlagView7(inv.flags);
|
|
3666
|
+
const { parsed, warning } = await deliver(
|
|
3667
|
+
inv.config,
|
|
3668
|
+
raw,
|
|
3669
|
+
fl.asStr("save") ?? null
|
|
3670
|
+
);
|
|
3671
|
+
const result = {
|
|
3672
|
+
status: "sent",
|
|
3673
|
+
to: parsed.to.map((entry) => entry.name === "" ? entry.email : `${entry.name} <${entry.email}>`).join(", "),
|
|
3674
|
+
subject: parsed.subject
|
|
3675
|
+
};
|
|
3676
|
+
const out = ENC4.encode(JSON.stringify(result));
|
|
3677
|
+
return [out, new IOResult5({ stderr: warning === "" ? null : ENC4.encode(warning) })];
|
|
3678
|
+
}
|
|
3679
|
+
|
|
3680
|
+
// src/commands/cli/builtin/himalaya/index.ts
|
|
3681
|
+
var ID = new Operand({ type: "str" });
|
|
3682
|
+
var MAILBOX = new Option({
|
|
3683
|
+
short: "-m",
|
|
3684
|
+
long: "--mailbox",
|
|
3685
|
+
type: "str",
|
|
3686
|
+
description: "Mailbox name (default: INBOX)"
|
|
3687
|
+
});
|
|
3688
|
+
var PAGE = new Option({
|
|
3689
|
+
short: "-p",
|
|
3690
|
+
long: "--page",
|
|
3691
|
+
type: "int",
|
|
3692
|
+
description: "Page number, starting from 1"
|
|
3693
|
+
});
|
|
3694
|
+
var PAGE_SIZE = new Option({
|
|
3695
|
+
short: "-s",
|
|
3696
|
+
long: "--page-size",
|
|
3697
|
+
type: "int",
|
|
3698
|
+
description: "Maximum envelopes per page"
|
|
3699
|
+
});
|
|
3700
|
+
var SAVE = new Option({
|
|
3701
|
+
long: "--save",
|
|
3702
|
+
type: "str",
|
|
3703
|
+
metavar: "MAILBOX",
|
|
3704
|
+
description: "Append a copy of the message to this mailbox"
|
|
3705
|
+
});
|
|
3706
|
+
var COMPOSER = [
|
|
3707
|
+
new Option({ long: "--from", type: "str", description: "Sender address" }),
|
|
3708
|
+
new Option({
|
|
3709
|
+
short: "-t",
|
|
3710
|
+
long: "--to",
|
|
3711
|
+
type: "str",
|
|
3712
|
+
multiple: true,
|
|
3713
|
+
description: "Recipient address(es), repeatable or comma-separated"
|
|
3714
|
+
}),
|
|
3715
|
+
new Option({
|
|
3716
|
+
long: "--cc",
|
|
3717
|
+
type: "str",
|
|
3718
|
+
multiple: true,
|
|
3719
|
+
description: "Carbon-copy recipient(s)"
|
|
3720
|
+
}),
|
|
3721
|
+
new Option({
|
|
3722
|
+
long: "--bcc",
|
|
3723
|
+
type: "str",
|
|
3724
|
+
multiple: true,
|
|
3725
|
+
description: "Blind carbon-copy recipient(s)"
|
|
3726
|
+
}),
|
|
3727
|
+
new Option({ short: "-s", long: "--subject", type: "str", description: "Subject line" }),
|
|
3728
|
+
new Option({ long: "--body", type: "str", description: "Inline body (or pipe via stdin)" }),
|
|
3729
|
+
new Option({
|
|
3730
|
+
long: "--attach",
|
|
3731
|
+
type: "path",
|
|
3732
|
+
multiple: true,
|
|
3733
|
+
description: "Attachment file(s), repeatable"
|
|
3734
|
+
}),
|
|
3735
|
+
new Option({
|
|
3736
|
+
long: "--signature",
|
|
3737
|
+
type: "str",
|
|
3738
|
+
description: "Signature appended after a '-- ' line"
|
|
3739
|
+
}),
|
|
3740
|
+
new Option({
|
|
3741
|
+
long: "--send",
|
|
3742
|
+
description: "Send through SMTP instead of writing MIME to stdout"
|
|
3743
|
+
}),
|
|
3744
|
+
SAVE
|
|
3745
|
+
];
|
|
3746
|
+
var QUOTING = [
|
|
3747
|
+
new Option({
|
|
3748
|
+
short: "-P",
|
|
3749
|
+
long: "--posting-style",
|
|
3750
|
+
type: "str",
|
|
3751
|
+
choices: ["top", "bottom"],
|
|
3752
|
+
default: "top",
|
|
3753
|
+
description: "Quoted source above or below your body"
|
|
3754
|
+
}),
|
|
3755
|
+
new Option({
|
|
3756
|
+
short: "-Q",
|
|
3757
|
+
long: "--quote-headline",
|
|
3758
|
+
type: "str",
|
|
3759
|
+
description: "Literal line placed before the quoted body"
|
|
3760
|
+
})
|
|
3761
|
+
];
|
|
3762
|
+
var HIMALAYA = new CLISpec({
|
|
3763
|
+
name: "himalaya",
|
|
3764
|
+
description: "IMAP/SMTP mail client",
|
|
3765
|
+
configModel: EmailConfigSchema,
|
|
3766
|
+
subcommands: [
|
|
3767
|
+
new CLISpec({
|
|
3768
|
+
name: "envelope",
|
|
3769
|
+
description: "Manage envelopes",
|
|
3770
|
+
subcommands: [
|
|
3771
|
+
new CLISpec({
|
|
3772
|
+
name: "list",
|
|
3773
|
+
aliases: ["ls"],
|
|
3774
|
+
description: "List envelopes as JSON headers",
|
|
3775
|
+
fn: listEnvelopes,
|
|
3776
|
+
options: [MAILBOX, PAGE, PAGE_SIZE]
|
|
3777
|
+
}),
|
|
3778
|
+
new CLISpec({
|
|
3779
|
+
name: "search",
|
|
3780
|
+
aliases: ["sr"],
|
|
3781
|
+
description: "Search envelopes with the query DSL",
|
|
3782
|
+
fn: searchEnvelopes,
|
|
3783
|
+
options: [MAILBOX, PAGE, PAGE_SIZE],
|
|
3784
|
+
rest: ID,
|
|
3785
|
+
epilog: "Conditions: date <yyyy-mm-dd>, before <yyyy-mm-dd>, after <yyyy-mm-dd>, from <pattern>, to <pattern>, subject <pattern>, body <pattern>, flag <seen|answered|flagged|draft|deleted>. Combine with and, or, not; group with parentheses. Sort with order by <date|from|to|subject> [asc|desc]."
|
|
3786
|
+
})
|
|
3787
|
+
]
|
|
3788
|
+
}),
|
|
3789
|
+
new CLISpec({
|
|
3790
|
+
name: "message",
|
|
3791
|
+
description: "Manage messages",
|
|
3792
|
+
subcommands: [
|
|
3793
|
+
new CLISpec({
|
|
3794
|
+
name: "read",
|
|
3795
|
+
description: "Read one message as JSON",
|
|
3796
|
+
fn: read,
|
|
3797
|
+
options: [
|
|
3798
|
+
MAILBOX,
|
|
3799
|
+
new Option({ long: "--raw", description: "Write the RFC 5322 bytes instead" })
|
|
3800
|
+
],
|
|
3801
|
+
rest: ID
|
|
3802
|
+
}),
|
|
3803
|
+
new CLISpec({
|
|
3804
|
+
name: "compose",
|
|
3805
|
+
aliases: ["write", "new"],
|
|
3806
|
+
description: "Compose a new message from flags",
|
|
3807
|
+
fn: compose,
|
|
3808
|
+
write: true,
|
|
3809
|
+
options: COMPOSER
|
|
3810
|
+
}),
|
|
3811
|
+
new CLISpec({
|
|
3812
|
+
name: "send",
|
|
3813
|
+
description: "Send a raw RFC 5322 message",
|
|
3814
|
+
fn: send,
|
|
3815
|
+
write: true,
|
|
3816
|
+
options: [SAVE],
|
|
3817
|
+
rest: ID
|
|
3818
|
+
}),
|
|
3819
|
+
new CLISpec({
|
|
3820
|
+
name: "reply",
|
|
3821
|
+
description: "Reply to a message",
|
|
3822
|
+
fn: reply,
|
|
3823
|
+
write: true,
|
|
3824
|
+
options: [MAILBOX, ...COMPOSER, ...QUOTING],
|
|
3825
|
+
rest: ID
|
|
3826
|
+
}),
|
|
3827
|
+
new CLISpec({
|
|
3828
|
+
name: "forward",
|
|
3829
|
+
aliases: ["fwd"],
|
|
3830
|
+
description: "Forward a message",
|
|
3831
|
+
fn: forward,
|
|
3832
|
+
write: true,
|
|
3833
|
+
options: [MAILBOX, ...COMPOSER, ...QUOTING],
|
|
3834
|
+
rest: ID
|
|
3835
|
+
})
|
|
3836
|
+
]
|
|
3837
|
+
})
|
|
3838
|
+
]
|
|
3839
|
+
});
|
|
3840
|
+
registerCliSpec(HIMALAYA);
|
|
3841
|
+
|
|
3842
|
+
// src/runtime/python/local.ts
|
|
3843
|
+
import { spawn } from "child_process";
|
|
3844
|
+
import {
|
|
3845
|
+
HOME_CONFIG_KEYS,
|
|
3846
|
+
PythonRuntime,
|
|
3847
|
+
registerRuntime as registerRuntime2
|
|
3848
|
+
} from "@struktoai/mirage-core";
|
|
3849
|
+
var LOCAL_HOME_ENV = "MIRAGE_LOCAL_HOME";
|
|
3850
|
+
var LocalRuntime = class extends PythonRuntime {
|
|
3851
|
+
name = "local";
|
|
3852
|
+
// Spawns the host interpreter: a real process with the user's own
|
|
3853
|
+
// filesystem and network, doors the workspace gate never sees. This
|
|
3854
|
+
// is the base default; declared here so the claim is explicit at the
|
|
3855
|
+
// one builtin runtime that voids a world's sandbox claim.
|
|
3856
|
+
reach = "process";
|
|
3857
|
+
python;
|
|
3858
|
+
children = /* @__PURE__ */ new Set();
|
|
3859
|
+
constructor(options = {}) {
|
|
3860
|
+
super(options, HOME_CONFIG_KEYS);
|
|
3861
|
+
const home = this.config.home;
|
|
3862
|
+
const chosen = home !== void 0 && home !== "" ? home : process.env[LOCAL_HOME_ENV];
|
|
3863
|
+
this.python = chosen !== void 0 && chosen !== "" ? chosen : "python3";
|
|
3864
|
+
}
|
|
3865
|
+
run(args) {
|
|
3866
|
+
return new Promise((resolve2, reject) => {
|
|
3867
|
+
const child = spawn(this.python, ["-c", args.code, ...args.args], {
|
|
3868
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
3869
|
+
env: { ...process.env, ...args.env },
|
|
3870
|
+
...args.signal !== void 0 ? { signal: args.signal, killSignal: "SIGKILL" } : {}
|
|
3871
|
+
});
|
|
3872
|
+
this.children.add(child);
|
|
3873
|
+
const out = [];
|
|
3874
|
+
const err = [];
|
|
3875
|
+
child.stdout.on("data", (chunk) => out.push(chunk));
|
|
3876
|
+
child.stderr.on("data", (chunk) => err.push(chunk));
|
|
3877
|
+
child.on("error", (error) => {
|
|
3878
|
+
if (error.name === "AbortError") return;
|
|
3879
|
+
this.children.delete(child);
|
|
3880
|
+
reject(
|
|
3881
|
+
error.code === "ENOENT" ? new Error(
|
|
3882
|
+
`local python interpreter not found: '${this.python}' (set the runtime entry's config home or ${LOCAL_HOME_ENV})`
|
|
3883
|
+
) : error
|
|
3884
|
+
);
|
|
2507
3885
|
});
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
return [...names].sort();
|
|
2524
|
-
}
|
|
2525
|
-
async distinct(table, column, filters, limit) {
|
|
2526
|
-
const tbl = await this.table(table);
|
|
2527
|
-
let query = tbl.query().select([column]).limit(limit);
|
|
2528
|
-
if (Object.keys(filters).length > 0) query = query.where(whereClause(filters));
|
|
2529
|
-
const rows = await query.toArray();
|
|
2530
|
-
const values = /* @__PURE__ */ new Set();
|
|
2531
|
-
for (const row of rows) {
|
|
2532
|
-
const v = row[column];
|
|
2533
|
-
if (v !== null && v !== void 0) values.add(toStr(v));
|
|
2534
|
-
}
|
|
2535
|
-
return [...values].sort();
|
|
2536
|
-
}
|
|
2537
|
-
async rowsMatching(table, filters, columns, limit) {
|
|
2538
|
-
const tbl = await this.table(table);
|
|
2539
|
-
let query = tbl.query().select(columns).limit(limit);
|
|
2540
|
-
if (Object.keys(filters).length > 0) query = query.where(whereClause(filters));
|
|
2541
|
-
return await query.toArray();
|
|
2542
|
-
}
|
|
2543
|
-
async rowRecord(table, idColumn, rowId) {
|
|
2544
|
-
const tbl = await this.table(table);
|
|
2545
|
-
const rows = await tbl.query().where(eqClause(idColumn, rowId)).limit(1).toArray();
|
|
2546
|
-
return rows[0] ?? null;
|
|
2547
|
-
}
|
|
2548
|
-
async search(table, query, limit) {
|
|
2549
|
-
const tbl = await this.table(table);
|
|
2550
|
-
return await tbl.search(query).limit(limit).toArray();
|
|
3886
|
+
child.on("close", (code) => {
|
|
3887
|
+
this.children.delete(child);
|
|
3888
|
+
const stderr = Buffer.concat(err);
|
|
3889
|
+
resolve2({
|
|
3890
|
+
stdout: new Uint8Array(Buffer.concat(out)),
|
|
3891
|
+
stderr: stderr.length > 0 ? new Uint8Array(stderr) : null,
|
|
3892
|
+
exitCode: code ?? 1
|
|
3893
|
+
});
|
|
3894
|
+
});
|
|
3895
|
+
child.stdin.on("error", (error) => {
|
|
3896
|
+
if (error.code !== "EPIPE") reject(error);
|
|
3897
|
+
});
|
|
3898
|
+
if (args.stdin !== null) child.stdin.write(args.stdin);
|
|
3899
|
+
child.stdin.end();
|
|
3900
|
+
});
|
|
2551
3901
|
}
|
|
2552
3902
|
close() {
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
this.db = null;
|
|
2556
|
-
}
|
|
2557
|
-
this.tables.clear();
|
|
3903
|
+
for (const child of this.children) child.kill("SIGKILL");
|
|
3904
|
+
this.children.clear();
|
|
2558
3905
|
return Promise.resolve();
|
|
2559
3906
|
}
|
|
2560
3907
|
};
|
|
3908
|
+
registerRuntime2("local", LocalRuntime);
|
|
2561
3909
|
|
|
2562
|
-
// src/
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
3910
|
+
// src/runtime/sandbox/e2b/runtime.ts
|
|
3911
|
+
import {
|
|
3912
|
+
loadOptionalPeer as loadOptionalPeer4,
|
|
3913
|
+
registerRuntime as registerRuntime3,
|
|
3914
|
+
RemoteSandbox as RemoteSandbox2,
|
|
3915
|
+
stdinPath as stdinPath2,
|
|
3916
|
+
stdinRedirect as stdinRedirect2
|
|
3917
|
+
} from "@struktoai/mirage-core";
|
|
3918
|
+
|
|
3919
|
+
// src/runtime/sandbox/e2b/config.ts
|
|
3920
|
+
var E2B_CONFIG_KEYS = ["env", "sandboxId", "apiKey"];
|
|
3921
|
+
|
|
3922
|
+
// src/runtime/sandbox/e2b/runtime.ts
|
|
3923
|
+
var ENC5 = new TextEncoder();
|
|
3924
|
+
var E2BRuntime = class extends RemoteSandbox2 {
|
|
3925
|
+
name = "e2b";
|
|
3926
|
+
sdk = null;
|
|
3927
|
+
sandbox = null;
|
|
3928
|
+
constructor(options = {}) {
|
|
3929
|
+
super(options, E2B_CONFIG_KEYS);
|
|
3930
|
+
if (!this.config.sandboxId) {
|
|
3931
|
+
throw new Error("e2b config needs sandboxId: the id of a live sandbox you created");
|
|
3932
|
+
}
|
|
2579
3933
|
}
|
|
2580
|
-
|
|
2581
|
-
|
|
3934
|
+
// The SDK loader as a seam: tests substitute a fake module here.
|
|
3935
|
+
loadSdk() {
|
|
3936
|
+
return loadOptionalPeer4(() => import("e2b"), {
|
|
3937
|
+
feature: "the 'e2b' runtime",
|
|
3938
|
+
packageName: "e2b"
|
|
3939
|
+
});
|
|
2582
3940
|
}
|
|
2583
|
-
async
|
|
2584
|
-
await this.
|
|
3941
|
+
async ensureSdk() {
|
|
3942
|
+
this.sdk ??= await this.loadSdk();
|
|
3943
|
+
return this.sdk;
|
|
3944
|
+
}
|
|
3945
|
+
apiParams() {
|
|
3946
|
+
return this.config.apiKey !== void 0 ? { apiKey: this.config.apiKey } : {};
|
|
3947
|
+
}
|
|
3948
|
+
async connect() {
|
|
3949
|
+
const sdk = await this.ensureSdk();
|
|
3950
|
+
this.sandbox = await sdk.Sandbox.connect(this.config.sandboxId, this.apiParams());
|
|
3951
|
+
}
|
|
3952
|
+
async execLine(line, stdin, env, cwd) {
|
|
3953
|
+
if (this.sandbox === null) throw new Error("e2b sandbox not connected");
|
|
3954
|
+
const sdk = await this.ensureSdk();
|
|
3955
|
+
let command = line;
|
|
3956
|
+
if (stdin !== null) {
|
|
3957
|
+
const path4 = stdinPath2();
|
|
3958
|
+
await this.upload(path4, stdin);
|
|
3959
|
+
command = stdinRedirect2(line, path4);
|
|
3960
|
+
}
|
|
3961
|
+
let result;
|
|
3962
|
+
try {
|
|
3963
|
+
result = await this.sandbox.commands.run(command, { envs: env, cwd });
|
|
3964
|
+
} catch (error) {
|
|
3965
|
+
if (!(error instanceof sdk.CommandExitError)) throw error;
|
|
3966
|
+
result = error;
|
|
3967
|
+
}
|
|
3968
|
+
return {
|
|
3969
|
+
stdout: ENC5.encode(result.stdout),
|
|
3970
|
+
stderr: ENC5.encode(result.stderr),
|
|
3971
|
+
exitCode: result.exitCode
|
|
3972
|
+
};
|
|
2585
3973
|
}
|
|
2586
|
-
|
|
2587
|
-
|
|
3974
|
+
async upload(path4, data) {
|
|
3975
|
+
if (this.sandbox === null) throw new Error("e2b sandbox not connected");
|
|
3976
|
+
const slash = path4.lastIndexOf("/");
|
|
3977
|
+
const parent = slash > 0 ? path4.slice(0, slash) : "";
|
|
3978
|
+
if (parent !== "") await this.sandbox.files.makeDir(parent);
|
|
3979
|
+
await this.sandbox.files.write(path4, new Blob([data]));
|
|
2588
3980
|
}
|
|
2589
|
-
|
|
2590
|
-
|
|
3981
|
+
};
|
|
3982
|
+
registerRuntime3("e2b", E2BRuntime);
|
|
3983
|
+
|
|
3984
|
+
// src/runtime/sandbox/docker/runtime.ts
|
|
3985
|
+
import { spawn as spawn2 } from "child_process";
|
|
3986
|
+
import {
|
|
3987
|
+
registerRuntime as registerRuntime4,
|
|
3988
|
+
RemoteSandbox as RemoteSandbox3
|
|
3989
|
+
} from "@struktoai/mirage-core";
|
|
3990
|
+
|
|
3991
|
+
// src/runtime/sandbox/docker/config.ts
|
|
3992
|
+
var DOCKER_CONFIG_KEYS = ["env", "container"];
|
|
3993
|
+
|
|
3994
|
+
// src/runtime/sandbox/docker/constants.ts
|
|
3995
|
+
var DOCKER_CLI_HINT = "the docker runtime needs the docker CLI on PATH (Docker Desktop, colima, or a podman alias)";
|
|
3996
|
+
|
|
3997
|
+
// src/runtime/sandbox/docker/runtime.ts
|
|
3998
|
+
var DockerRuntime = class extends RemoteSandbox3 {
|
|
3999
|
+
name = "docker";
|
|
4000
|
+
constructor(options = {}) {
|
|
4001
|
+
super(options, DOCKER_CONFIG_KEYS);
|
|
4002
|
+
if (!this.config.container) {
|
|
4003
|
+
throw new Error("docker config needs container: the id or name of a running container");
|
|
4004
|
+
}
|
|
2591
4005
|
}
|
|
2592
|
-
|
|
2593
|
-
|
|
4006
|
+
// One docker CLI invocation; the seam tests override.
|
|
4007
|
+
docker(args, stdin = null) {
|
|
4008
|
+
return new Promise((resolve2, reject) => {
|
|
4009
|
+
const child = spawn2("docker", args, { stdio: ["pipe", "pipe", "pipe"] });
|
|
4010
|
+
const out = [];
|
|
4011
|
+
const err = [];
|
|
4012
|
+
child.stdout.on("data", (chunk) => out.push(chunk));
|
|
4013
|
+
child.stderr.on("data", (chunk) => err.push(chunk));
|
|
4014
|
+
child.on("error", (error) => {
|
|
4015
|
+
reject(error.code === "ENOENT" ? new Error(DOCKER_CLI_HINT) : error);
|
|
4016
|
+
});
|
|
4017
|
+
child.on("close", (code) => {
|
|
4018
|
+
resolve2({
|
|
4019
|
+
stdout: new Uint8Array(Buffer.concat(out)),
|
|
4020
|
+
stderr: new Uint8Array(Buffer.concat(err)),
|
|
4021
|
+
code: code ?? 1
|
|
4022
|
+
});
|
|
4023
|
+
});
|
|
4024
|
+
child.stdin.on("error", (error) => {
|
|
4025
|
+
if (error.code !== "EPIPE") reject(error);
|
|
4026
|
+
});
|
|
4027
|
+
if (stdin !== null) child.stdin.write(stdin);
|
|
4028
|
+
child.stdin.end();
|
|
4029
|
+
});
|
|
2594
4030
|
}
|
|
2595
|
-
|
|
2596
|
-
|
|
4031
|
+
async connect() {
|
|
4032
|
+
const result = await this.docker([
|
|
4033
|
+
"inspect",
|
|
4034
|
+
"--format",
|
|
4035
|
+
"{{.State.Running}}",
|
|
4036
|
+
this.config.container
|
|
4037
|
+
]);
|
|
4038
|
+
if (result.code !== 0) {
|
|
4039
|
+
throw new Error(`docker inspect failed: ${decode(result.stderr).trim()}`);
|
|
4040
|
+
}
|
|
4041
|
+
if (decode(result.stdout).trim() !== "true") {
|
|
4042
|
+
throw new Error(`container ${this.config.container} is not running`);
|
|
4043
|
+
}
|
|
2597
4044
|
}
|
|
2598
|
-
|
|
2599
|
-
|
|
4045
|
+
async execLine(line, stdin, env, cwd) {
|
|
4046
|
+
const args = ["exec", "-i", "-w", cwd];
|
|
4047
|
+
for (const [key, value] of Object.entries(env)) args.push("-e", `${key}=${value}`);
|
|
4048
|
+
args.push(this.config.container, "sh", "-c", line);
|
|
4049
|
+
const result = await this.docker(args, stdin);
|
|
4050
|
+
return { stdout: result.stdout, stderr: result.stderr, exitCode: result.code };
|
|
2600
4051
|
}
|
|
2601
4052
|
};
|
|
4053
|
+
var DECODER = new TextDecoder();
|
|
4054
|
+
function decode(bytes) {
|
|
4055
|
+
return DECODER.decode(bytes);
|
|
4056
|
+
}
|
|
4057
|
+
registerRuntime4("docker", DockerRuntime);
|
|
2602
4058
|
|
|
2603
4059
|
// src/resource/registry.ts
|
|
2604
|
-
import {
|
|
4060
|
+
import {
|
|
4061
|
+
normalizeFields,
|
|
4062
|
+
compareCodePoints as compareCodePoints4
|
|
4063
|
+
} from "@struktoai/mirage-core";
|
|
2605
4064
|
var REGISTRY = {
|
|
2606
4065
|
ram: async (_config) => {
|
|
2607
4066
|
const { RAMResource } = await import("@struktoai/mirage-core");
|
|
2608
4067
|
return new RAMResource();
|
|
2609
4068
|
},
|
|
2610
4069
|
disk: async (config) => {
|
|
2611
|
-
const { DiskResource: DiskResource2 } = await import("./disk-
|
|
4070
|
+
const { DiskResource: DiskResource2 } = await import("./disk-WEHSTK3F.js");
|
|
2612
4071
|
const norm = normalizeFields(config);
|
|
2613
4072
|
return new DiskResource2(norm);
|
|
2614
4073
|
},
|
|
2615
4074
|
redis: async (config) => {
|
|
2616
|
-
const { RedisResource: RedisResource2 } = await import("./redis-
|
|
4075
|
+
const { RedisResource: RedisResource2 } = await import("./redis-LPS357NF.js");
|
|
2617
4076
|
const norm = normalizeFields(config);
|
|
2618
4077
|
return new RedisResource2(norm);
|
|
2619
4078
|
},
|
|
2620
4079
|
s3: async (config) => {
|
|
2621
|
-
const { S3Resource: S3Resource2 } = await import("./s3-
|
|
2622
|
-
const { normalizeS3Config } = await import("./config-
|
|
2623
|
-
return new S3Resource2(
|
|
4080
|
+
const { S3Resource: S3Resource2 } = await import("./s3-FPNWWIVM.js");
|
|
4081
|
+
const { normalizeS3Config: normalizeS3Config2 } = await import("./config-G43HRUI3.js");
|
|
4082
|
+
return new S3Resource2(normalizeS3Config2(config));
|
|
2624
4083
|
},
|
|
2625
4084
|
gridfs: async (config) => {
|
|
2626
|
-
const { GridFSResource: GridFSResource2 } = await import("./gridfs-
|
|
2627
|
-
const { normalizeGridFSConfig: normalizeGridFSConfig2 } = await import("./config-
|
|
4085
|
+
const { GridFSResource: GridFSResource2 } = await import("./gridfs-CPLQ4G62.js");
|
|
4086
|
+
const { normalizeGridFSConfig: normalizeGridFSConfig2 } = await import("./config-SYNEQAUB.js");
|
|
2628
4087
|
return new GridFSResource2(normalizeGridFSConfig2(config));
|
|
2629
4088
|
},
|
|
2630
4089
|
gcs: async (config) => {
|
|
2631
|
-
const { GCSResource: GCSResource2 } = await import("./gcs-
|
|
2632
|
-
const { normalizeGcsConfig } = await import("./config-
|
|
4090
|
+
const { GCSResource: GCSResource2 } = await import("./gcs-HFBIAE2C.js");
|
|
4091
|
+
const { normalizeGcsConfig } = await import("./config-VPLHQXVE.js");
|
|
2633
4092
|
return new GCSResource2(normalizeGcsConfig(config));
|
|
2634
4093
|
},
|
|
2635
4094
|
oci: async (config) => {
|
|
2636
|
-
const { OCIResource: OCIResource2 } = await import("./oci-
|
|
2637
|
-
const { normalizeOciConfig } = await import("./config-
|
|
4095
|
+
const { OCIResource: OCIResource2 } = await import("./oci-OQXOIC62.js");
|
|
4096
|
+
const { normalizeOciConfig } = await import("./config-A25LTL5W.js");
|
|
2638
4097
|
return new OCIResource2(normalizeOciConfig(config));
|
|
2639
4098
|
},
|
|
2640
4099
|
r2: async (config) => {
|
|
2641
|
-
const { R2Resource: R2Resource2 } = await import("./r2-
|
|
2642
|
-
const { normalizeR2Config } = await import("./config-
|
|
4100
|
+
const { R2Resource: R2Resource2 } = await import("./r2-FUA4IORE.js");
|
|
4101
|
+
const { normalizeR2Config } = await import("./config-MDSAE4O3.js");
|
|
2643
4102
|
return new R2Resource2(normalizeR2Config(config));
|
|
2644
4103
|
},
|
|
2645
4104
|
hf_buckets: async (config) => {
|
|
2646
|
-
const { HfBucketsResource: HfBucketsResource2 } = await import("./hf_buckets-
|
|
2647
|
-
const { normalizeHfBucketsConfig: normalizeHfBucketsConfig2 } = await import("./config-
|
|
4105
|
+
const { HfBucketsResource: HfBucketsResource2 } = await import("./hf_buckets-FTJITQ3P.js");
|
|
4106
|
+
const { normalizeHfBucketsConfig: normalizeHfBucketsConfig2 } = await import("./config-LJ5T6TVA.js");
|
|
2648
4107
|
return new HfBucketsResource2(normalizeHfBucketsConfig2(config));
|
|
2649
4108
|
},
|
|
2650
4109
|
hf_datasets: async (config) => {
|
|
2651
|
-
const { HfDatasetsResource: HfDatasetsResource2 } = await import("./hf_datasets-
|
|
2652
|
-
const { normalizeHfRepoConfig: normalizeHfRepoConfig2 } = await import("./config-
|
|
4110
|
+
const { HfDatasetsResource: HfDatasetsResource2 } = await import("./hf_datasets-6GXVKQD7.js");
|
|
4111
|
+
const { normalizeHfRepoConfig: normalizeHfRepoConfig2 } = await import("./config-LJ5T6TVA.js");
|
|
2653
4112
|
return new HfDatasetsResource2(normalizeHfRepoConfig2(config));
|
|
2654
4113
|
},
|
|
2655
4114
|
hf_models: async (config) => {
|
|
2656
|
-
const { HfModelsResource: HfModelsResource2 } = await import("./hf_models-
|
|
2657
|
-
const { normalizeHfRepoConfig: normalizeHfRepoConfig2 } = await import("./config-
|
|
4115
|
+
const { HfModelsResource: HfModelsResource2 } = await import("./hf_models-PJPGZAC5.js");
|
|
4116
|
+
const { normalizeHfRepoConfig: normalizeHfRepoConfig2 } = await import("./config-LJ5T6TVA.js");
|
|
2658
4117
|
return new HfModelsResource2(normalizeHfRepoConfig2(config));
|
|
2659
4118
|
},
|
|
2660
4119
|
hf_spaces: async (config) => {
|
|
2661
|
-
const { HfSpacesResource: HfSpacesResource2 } = await import("./hf_spaces-
|
|
2662
|
-
const { normalizeHfRepoConfig: normalizeHfRepoConfig2 } = await import("./config-
|
|
4120
|
+
const { HfSpacesResource: HfSpacesResource2 } = await import("./hf_spaces-LFNFOLBF.js");
|
|
4121
|
+
const { normalizeHfRepoConfig: normalizeHfRepoConfig2 } = await import("./config-LJ5T6TVA.js");
|
|
2663
4122
|
return new HfSpacesResource2(normalizeHfRepoConfig2(config));
|
|
2664
4123
|
},
|
|
2665
4124
|
supabase: async (config) => {
|
|
2666
|
-
const { SupabaseResource: SupabaseResource2 } = await import("./supabase-
|
|
2667
|
-
const { normalizeSupabaseConfig } = await import("./config-
|
|
4125
|
+
const { SupabaseResource: SupabaseResource2 } = await import("./supabase-A3KUFMDC.js");
|
|
4126
|
+
const { normalizeSupabaseConfig } = await import("./config-FPC3RBFD.js");
|
|
2668
4127
|
return new SupabaseResource2(normalizeSupabaseConfig(config));
|
|
2669
4128
|
},
|
|
2670
4129
|
databricks_volume: async (config) => {
|
|
2671
|
-
const { DatabricksVolumeResource: DatabricksVolumeResource2 } = await import("./databricks_volume-
|
|
4130
|
+
const { DatabricksVolumeResource: DatabricksVolumeResource2 } = await import("./databricks_volume-CNCPTZHS.js");
|
|
2672
4131
|
const { normalizeDatabricksVolumeConfig } = await import("@struktoai/mirage-core");
|
|
2673
4132
|
return DatabricksVolumeResource2.create(normalizeDatabricksVolumeConfig(config));
|
|
2674
4133
|
},
|
|
2675
4134
|
minio: async (config) => {
|
|
2676
|
-
const { MinIOResource: MinIOResource2 } = await import("./minio-
|
|
2677
|
-
const { normalizeMinIOConfig } = await import("./config-
|
|
4135
|
+
const { MinIOResource: MinIOResource2 } = await import("./minio-5SO6KBTK.js");
|
|
4136
|
+
const { normalizeMinIOConfig } = await import("./config-5ZRKJTKG.js");
|
|
2678
4137
|
return new MinIOResource2(normalizeMinIOConfig(config));
|
|
2679
4138
|
},
|
|
2680
4139
|
ceph: async (config) => {
|
|
2681
|
-
const { CephResource: CephResource2 } = await import("./ceph-
|
|
2682
|
-
const { normalizeCephConfig } = await import("./config-
|
|
4140
|
+
const { CephResource: CephResource2 } = await import("./ceph-ALKLD3MO.js");
|
|
4141
|
+
const { normalizeCephConfig } = await import("./config-QY4IL3PH.js");
|
|
2683
4142
|
return new CephResource2(normalizeCephConfig(config));
|
|
2684
4143
|
},
|
|
2685
4144
|
seaweedfs: async (config) => {
|
|
2686
|
-
const { SeaweedFSResource: SeaweedFSResource2 } = await import("./seaweedfs-
|
|
2687
|
-
const { normalizeSeaweedFSConfig } = await import("./config-
|
|
4145
|
+
const { SeaweedFSResource: SeaweedFSResource2 } = await import("./seaweedfs-MC6HIEP4.js");
|
|
4146
|
+
const { normalizeSeaweedFSConfig } = await import("./config-WVHKXEVE.js");
|
|
2688
4147
|
return new SeaweedFSResource2(normalizeSeaweedFSConfig(config));
|
|
2689
4148
|
},
|
|
2690
4149
|
wasabi: async (config) => {
|
|
2691
|
-
const { WasabiResource: WasabiResource2 } = await import("./wasabi-
|
|
2692
|
-
const { normalizeWasabiConfig } = await import("./config-
|
|
4150
|
+
const { WasabiResource: WasabiResource2 } = await import("./wasabi-2IKBIWNO.js");
|
|
4151
|
+
const { normalizeWasabiConfig } = await import("./config-2YBCHU2W.js");
|
|
2693
4152
|
return new WasabiResource2(normalizeWasabiConfig(config));
|
|
2694
4153
|
},
|
|
2695
4154
|
backblaze: async (config) => {
|
|
2696
|
-
const { BackblazeResource: BackblazeResource2 } = await import("./backblaze-
|
|
2697
|
-
const { normalizeBackblazeConfig } = await import("./config-
|
|
4155
|
+
const { BackblazeResource: BackblazeResource2 } = await import("./backblaze-4EKSW63F.js");
|
|
4156
|
+
const { normalizeBackblazeConfig } = await import("./config-GG3WO5PB.js");
|
|
2698
4157
|
return new BackblazeResource2(normalizeBackblazeConfig(config));
|
|
2699
4158
|
},
|
|
2700
4159
|
digitalocean: async (config) => {
|
|
2701
|
-
const { DigitalOceanResource: DigitalOceanResource2 } = await import("./digitalocean-
|
|
2702
|
-
const { normalizeDigitalOceanConfig } = await import("./config-
|
|
4160
|
+
const { DigitalOceanResource: DigitalOceanResource2 } = await import("./digitalocean-DJZOUB6Q.js");
|
|
4161
|
+
const { normalizeDigitalOceanConfig } = await import("./config-TJKGYA2B.js");
|
|
2703
4162
|
return new DigitalOceanResource2(normalizeDigitalOceanConfig(config));
|
|
2704
4163
|
},
|
|
2705
4164
|
tencent: async (config) => {
|
|
2706
|
-
const { TencentResource: TencentResource2 } = await import("./tencent-
|
|
2707
|
-
const { normalizeTencentConfig } = await import("./config-
|
|
4165
|
+
const { TencentResource: TencentResource2 } = await import("./tencent-5464UQ2X.js");
|
|
4166
|
+
const { normalizeTencentConfig } = await import("./config-RIAAD6RW.js");
|
|
2708
4167
|
return new TencentResource2(normalizeTencentConfig(config));
|
|
2709
4168
|
},
|
|
2710
4169
|
aliyun: async (config) => {
|
|
2711
|
-
const { AliyunResource: AliyunResource2 } = await import("./aliyun-
|
|
2712
|
-
const { normalizeAliyunConfig } = await import("./config-
|
|
4170
|
+
const { AliyunResource: AliyunResource2 } = await import("./aliyun-S62BR3TB.js");
|
|
4171
|
+
const { normalizeAliyunConfig } = await import("./config-G3F54CS4.js");
|
|
2713
4172
|
return new AliyunResource2(normalizeAliyunConfig(config));
|
|
2714
4173
|
},
|
|
2715
4174
|
scaleway: async (config) => {
|
|
2716
|
-
const { ScalewayResource: ScalewayResource2 } = await import("./scaleway-
|
|
2717
|
-
const { normalizeScalewayConfig } = await import("./config-
|
|
4175
|
+
const { ScalewayResource: ScalewayResource2 } = await import("./scaleway-BP3732U7.js");
|
|
4176
|
+
const { normalizeScalewayConfig } = await import("./config-XU7R36IE.js");
|
|
2718
4177
|
return new ScalewayResource2(normalizeScalewayConfig(config));
|
|
2719
4178
|
},
|
|
2720
4179
|
qingstor: async (config) => {
|
|
2721
|
-
const { QingStorResource: QingStorResource2 } = await import("./qingstor-
|
|
2722
|
-
const { normalizeQingStorConfig } = await import("./config-
|
|
4180
|
+
const { QingStorResource: QingStorResource2 } = await import("./qingstor-W277YA4K.js");
|
|
4181
|
+
const { normalizeQingStorConfig } = await import("./config-3YRGRW72.js");
|
|
2723
4182
|
return new QingStorResource2(normalizeQingStorConfig(config));
|
|
2724
4183
|
},
|
|
2725
4184
|
postgres: async (config) => {
|
|
2726
|
-
const { PostgresResource: PostgresResource2 } = await import("./postgres-
|
|
4185
|
+
const { PostgresResource: PostgresResource2 } = await import("./postgres-AV45GNRS.js");
|
|
2727
4186
|
const { normalizePostgresConfig } = await import("@struktoai/mirage-core");
|
|
2728
4187
|
return new PostgresResource2(normalizePostgresConfig(config));
|
|
2729
4188
|
},
|
|
2730
4189
|
mongodb: async (config) => {
|
|
2731
|
-
const { MongoDBResource: MongoDBResource2 } = await import("./mongodb-
|
|
4190
|
+
const { MongoDBResource: MongoDBResource2 } = await import("./mongodb-7C5MBESV.js");
|
|
2732
4191
|
const { normalizeMongoDBConfig } = await import("@struktoai/mirage-core");
|
|
2733
4192
|
return new MongoDBResource2(normalizeMongoDBConfig(config));
|
|
2734
4193
|
},
|
|
4194
|
+
chroma: async (config) => {
|
|
4195
|
+
const { ChromaResource } = await import("@struktoai/mirage-core");
|
|
4196
|
+
return new ChromaResource(normalizeFields(config));
|
|
4197
|
+
},
|
|
4198
|
+
dify: async (config) => {
|
|
4199
|
+
const { DifyResource } = await import("@struktoai/mirage-core");
|
|
4200
|
+
return new DifyResource(normalizeFields(config));
|
|
4201
|
+
},
|
|
4202
|
+
qdrant: async (config) => {
|
|
4203
|
+
const { QdrantResource } = await import("@struktoai/mirage-core");
|
|
4204
|
+
return new QdrantResource(normalizeFields(config));
|
|
4205
|
+
},
|
|
4206
|
+
lancedb: async (config) => {
|
|
4207
|
+
const { LanceDBResource: LanceDBResource2 } = await import("./lancedb-TJ5YSJY5.js");
|
|
4208
|
+
return new LanceDBResource2(normalizeFields(config));
|
|
4209
|
+
},
|
|
2735
4210
|
slack: async (config) => {
|
|
2736
|
-
const { SlackResource: SlackResource2 } = await import("./slack-
|
|
2737
|
-
const { normalizeSlackConfig: normalizeSlackConfig2 } = await import("
|
|
4211
|
+
const { SlackResource: SlackResource2 } = await import("./slack-JFGW7VLN.js");
|
|
4212
|
+
const { normalizeSlackConfig: normalizeSlackConfig2 } = await import("@struktoai/mirage-core");
|
|
2738
4213
|
return new SlackResource2(normalizeSlackConfig2(config));
|
|
2739
4214
|
},
|
|
2740
4215
|
ssh: async (config) => {
|
|
2741
|
-
const { SSHResource: SSHResource2 } = await import("./ssh-
|
|
2742
|
-
const { normalizeSshConfig: normalizeSshConfig2 } = await import("./config-
|
|
4216
|
+
const { SSHResource: SSHResource2 } = await import("./ssh-UYPG42LM.js");
|
|
4217
|
+
const { normalizeSshConfig: normalizeSshConfig2 } = await import("./config-R4LAOEDS.js");
|
|
2743
4218
|
return new SSHResource2(normalizeSshConfig2(config));
|
|
2744
4219
|
},
|
|
2745
4220
|
nextcloud: async (config) => {
|
|
2746
|
-
const { NextcloudResource: NextcloudResource2 } = await import("./nextcloud-
|
|
2747
|
-
const { normalizeNextcloudConfig: normalizeNextcloudConfig2 } = await import("./config-
|
|
4221
|
+
const { NextcloudResource: NextcloudResource2 } = await import("./nextcloud-4O2LZVW2.js");
|
|
4222
|
+
const { normalizeNextcloudConfig: normalizeNextcloudConfig2 } = await import("./config-D2RF7L3N.js");
|
|
2748
4223
|
return new NextcloudResource2(normalizeNextcloudConfig2(config));
|
|
2749
4224
|
},
|
|
2750
4225
|
discord: async (config) => {
|
|
2751
|
-
const { DiscordResource: DiscordResource2 } = await import("./discord-
|
|
2752
|
-
const { normalizeDiscordConfig: normalizeDiscordConfig2 } = await import("
|
|
4226
|
+
const { DiscordResource: DiscordResource2 } = await import("./discord-ETB2CADR.js");
|
|
4227
|
+
const { normalizeDiscordConfig: normalizeDiscordConfig2 } = await import("@struktoai/mirage-core");
|
|
2753
4228
|
return new DiscordResource2(normalizeDiscordConfig2(config));
|
|
2754
4229
|
},
|
|
2755
4230
|
trello: async (config) => {
|
|
2756
|
-
const { TrelloResource: TrelloResource2 } = await import("./trello-
|
|
2757
|
-
const { normalizeTrelloConfig: normalizeTrelloConfig2 } = await import("./config-
|
|
4231
|
+
const { TrelloResource: TrelloResource2 } = await import("./trello-O2KB3FUO.js");
|
|
4232
|
+
const { normalizeTrelloConfig: normalizeTrelloConfig2 } = await import("./config-JUYBWAZE.js");
|
|
2758
4233
|
return new TrelloResource2(normalizeTrelloConfig2(config));
|
|
2759
4234
|
},
|
|
2760
4235
|
linear: async (config) => {
|
|
2761
|
-
const { LinearResource: LinearResource2 } = await import("./linear-
|
|
2762
|
-
const { normalizeLinearConfig: normalizeLinearConfig2 } = await import("
|
|
4236
|
+
const { LinearResource: LinearResource2 } = await import("./linear-BCE4KEAC.js");
|
|
4237
|
+
const { normalizeLinearConfig: normalizeLinearConfig2 } = await import("@struktoai/mirage-core");
|
|
2763
4238
|
return new LinearResource2(normalizeLinearConfig2(config));
|
|
2764
4239
|
},
|
|
2765
4240
|
notion: async (config) => {
|
|
2766
|
-
const { NotionResource: NotionResource2 } = await import("./notion-
|
|
2767
|
-
const { normalizeNotionConfig: normalizeNotionConfig2 } = await import("
|
|
4241
|
+
const { NotionResource: NotionResource2 } = await import("./notion-RVKEAQ2M.js");
|
|
4242
|
+
const { normalizeNotionConfig: normalizeNotionConfig2 } = await import("@struktoai/mirage-core");
|
|
2768
4243
|
return new NotionResource2(normalizeNotionConfig2(config));
|
|
2769
4244
|
},
|
|
2770
4245
|
langfuse: async (config) => {
|
|
2771
|
-
const { LangfuseResource: LangfuseResource2 } = await import("./langfuse-
|
|
2772
|
-
const { normalizeLangfuseConfig: normalizeLangfuseConfig2 } = await import("./config-
|
|
4246
|
+
const { LangfuseResource: LangfuseResource2 } = await import("./langfuse-RUMTUMXS.js");
|
|
4247
|
+
const { normalizeLangfuseConfig: normalizeLangfuseConfig2 } = await import("./config-E55TKM6K.js");
|
|
2773
4248
|
return new LangfuseResource2(normalizeLangfuseConfig2(config));
|
|
2774
4249
|
},
|
|
4250
|
+
jaeger: async (config) => {
|
|
4251
|
+
const { JaegerResource: JaegerResource2 } = await import("./jaeger-GCA6MJ6E.js");
|
|
4252
|
+
const { normalizeJaegerConfig } = await import("./config-PB3KA2CE.js");
|
|
4253
|
+
return new JaegerResource2(normalizeJaegerConfig(config));
|
|
4254
|
+
},
|
|
2775
4255
|
github: async (config) => {
|
|
2776
|
-
const { GitHubResource: GitHubResource2 } = await import("./github-
|
|
2777
|
-
const { normalizeGitHubConfig: normalizeGitHubConfig2 } = await import("./config-
|
|
4256
|
+
const { GitHubResource: GitHubResource2 } = await import("./github-BPZREGPI.js");
|
|
4257
|
+
const { normalizeGitHubConfig: normalizeGitHubConfig2 } = await import("./config-CLU7JABG.js");
|
|
2778
4258
|
return GitHubResource2.create(normalizeGitHubConfig2(config));
|
|
2779
4259
|
},
|
|
2780
4260
|
github_ci: async (config) => {
|
|
2781
|
-
const { GitHubCIResource: GitHubCIResource2 } = await import("./github_ci-
|
|
2782
|
-
const { normalizeGitHubCIConfig: normalizeGitHubCIConfig2 } = await import("./config-
|
|
4261
|
+
const { GitHubCIResource: GitHubCIResource2 } = await import("./github_ci-7A4LUIZ7.js");
|
|
4262
|
+
const { normalizeGitHubCIConfig: normalizeGitHubCIConfig2 } = await import("./config-NRIOKK5T.js");
|
|
2783
4263
|
return new GitHubCIResource2(normalizeGitHubCIConfig2(config));
|
|
2784
4264
|
},
|
|
4265
|
+
gcal: async (config) => {
|
|
4266
|
+
const { GCalResource: GCalResource2 } = await import("./gcal-P56MRCGU.js");
|
|
4267
|
+
const { normalizeGCalConfig } = await import("./config-4GSOMUMF.js");
|
|
4268
|
+
return new GCalResource2(normalizeGCalConfig(config));
|
|
4269
|
+
},
|
|
2785
4270
|
gdocs: async (config) => {
|
|
2786
|
-
const { GDocsResource: GDocsResource2 } = await import("./gdocs-
|
|
2787
|
-
const { normalizeGDocsConfig
|
|
2788
|
-
return new GDocsResource2(
|
|
4271
|
+
const { GDocsResource: GDocsResource2 } = await import("./gdocs-LQ3UXP3J.js");
|
|
4272
|
+
const { normalizeGDocsConfig } = await import("./config-WRACCRPN.js");
|
|
4273
|
+
return new GDocsResource2(normalizeGDocsConfig(config));
|
|
2789
4274
|
},
|
|
2790
4275
|
gsheets: async (config) => {
|
|
2791
|
-
const { GSheetsResource: GSheetsResource2 } = await import("./gsheets-
|
|
2792
|
-
const { normalizeGSheetsConfig
|
|
2793
|
-
return new GSheetsResource2(
|
|
4276
|
+
const { GSheetsResource: GSheetsResource2 } = await import("./gsheets-4BNIJPQ6.js");
|
|
4277
|
+
const { normalizeGSheetsConfig } = await import("./config-5YBUWFUP.js");
|
|
4278
|
+
return new GSheetsResource2(normalizeGSheetsConfig(config));
|
|
2794
4279
|
},
|
|
2795
4280
|
gslides: async (config) => {
|
|
2796
|
-
const { GSlidesResource: GSlidesResource2 } = await import("./gslides-
|
|
2797
|
-
const { normalizeGSlidesConfig
|
|
2798
|
-
return new GSlidesResource2(
|
|
4281
|
+
const { GSlidesResource: GSlidesResource2 } = await import("./gslides-GDBYLO5A.js");
|
|
4282
|
+
const { normalizeGSlidesConfig } = await import("./config-ELDOFRJW.js");
|
|
4283
|
+
return new GSlidesResource2(normalizeGSlidesConfig(config));
|
|
2799
4284
|
},
|
|
2800
4285
|
gdrive: async (config) => {
|
|
2801
|
-
const { GDriveResource: GDriveResource2 } = await import("./gdrive-
|
|
2802
|
-
const { normalizeGDriveConfig
|
|
2803
|
-
return new GDriveResource2(
|
|
4286
|
+
const { GDriveResource: GDriveResource2 } = await import("./gdrive-N6UBYLON.js");
|
|
4287
|
+
const { normalizeGDriveConfig } = await import("./config-FPM3LAW7.js");
|
|
4288
|
+
return new GDriveResource2(normalizeGDriveConfig(config));
|
|
4289
|
+
},
|
|
4290
|
+
onedrive: async (config) => {
|
|
4291
|
+
const { OneDriveResource: OneDriveResource2, normalizeOneDriveConfig } = await import("@struktoai/mirage-core");
|
|
4292
|
+
return new OneDriveResource2(normalizeOneDriveConfig(config));
|
|
4293
|
+
},
|
|
4294
|
+
sharepoint: async (config) => {
|
|
4295
|
+
const { SharePointResource: SharePointResource2, normalizeSharePointConfig } = await import("@struktoai/mirage-core");
|
|
4296
|
+
return new SharePointResource2(normalizeSharePointConfig(config));
|
|
4297
|
+
},
|
|
4298
|
+
mem0: async (config) => {
|
|
4299
|
+
const { Mem0Resource: Mem0Resource2, normalizeMem0Config } = await import("@struktoai/mirage-core");
|
|
4300
|
+
return new Mem0Resource2(normalizeMem0Config(config));
|
|
2804
4301
|
},
|
|
2805
4302
|
dropbox: async (config) => {
|
|
2806
|
-
const { DropboxResource: DropboxResource2 } = await import("./dropbox-
|
|
2807
|
-
const { normalizeDropboxConfig: normalizeDropboxConfig2 } = await import("./config-
|
|
4303
|
+
const { DropboxResource: DropboxResource2 } = await import("./dropbox-XN6PGLNE.js");
|
|
4304
|
+
const { normalizeDropboxConfig: normalizeDropboxConfig2 } = await import("./config-OYK2BSJK.js");
|
|
2808
4305
|
return new DropboxResource2(normalizeDropboxConfig2(config));
|
|
2809
4306
|
},
|
|
2810
4307
|
box: async (config) => {
|
|
2811
|
-
const { BoxResource: BoxResource2 } = await import("./box-
|
|
2812
|
-
const { normalizeBoxConfig: normalizeBoxConfig2 } = await import("./config-
|
|
4308
|
+
const { BoxResource: BoxResource2 } = await import("./box-ZPLZAGMK.js");
|
|
4309
|
+
const { normalizeBoxConfig: normalizeBoxConfig2 } = await import("./config-Y2KOUYSS.js");
|
|
2813
4310
|
return new BoxResource2(normalizeBoxConfig2(config));
|
|
2814
4311
|
},
|
|
2815
4312
|
gmail: async (config) => {
|
|
2816
|
-
const { GmailResource: GmailResource2 } = await import("./gmail-
|
|
4313
|
+
const { GmailResource: GmailResource2 } = await import("./gmail-YED2MF6H.js");
|
|
2817
4314
|
const { normalizeGmailConfig } = await import("./config-UU27ALAA.js");
|
|
2818
4315
|
return new GmailResource2(normalizeGmailConfig(config));
|
|
2819
4316
|
},
|
|
2820
4317
|
email: async (config) => {
|
|
2821
|
-
const { EmailResource: EmailResource2 } = await import("./email-
|
|
2822
|
-
const { normalizeEmailConfig: normalizeEmailConfig2 } = await import("./config-
|
|
4318
|
+
const { EmailResource: EmailResource2 } = await import("./email-OV7XCP3T.js");
|
|
4319
|
+
const { normalizeEmailConfig: normalizeEmailConfig2 } = await import("./config-UURRGA7U.js");
|
|
2823
4320
|
return new EmailResource2(normalizeEmailConfig2(config));
|
|
2824
4321
|
}
|
|
2825
4322
|
};
|
|
4323
|
+
var CUSTOM = {};
|
|
2826
4324
|
function knownResources() {
|
|
2827
|
-
return Object.keys(REGISTRY).sort();
|
|
4325
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(REGISTRY), ...Object.keys(CUSTOM)])].sort(compareCodePoints4);
|
|
2828
4326
|
}
|
|
2829
4327
|
function register(name, factory) {
|
|
2830
|
-
REGISTRY
|
|
4328
|
+
if (name in REGISTRY) throw new Error(`cannot register '${name}': shadows a builtin`);
|
|
4329
|
+
CUSTOM[name] = factory;
|
|
2831
4330
|
}
|
|
2832
4331
|
async function buildResource(name, config = {}) {
|
|
2833
|
-
const factory = REGISTRY[name];
|
|
4332
|
+
const factory = REGISTRY[name] ?? CUSTOM[name];
|
|
2834
4333
|
if (factory === void 0) {
|
|
2835
4334
|
throw new Error(
|
|
2836
4335
|
`unknown resource ${JSON.stringify(name)}; known: ${knownResources().join(", ")}`
|
|
@@ -2838,6 +4337,62 @@ async function buildResource(name, config = {}) {
|
|
|
2838
4337
|
}
|
|
2839
4338
|
return factory(config);
|
|
2840
4339
|
}
|
|
4340
|
+
|
|
4341
|
+
// src/resource/loader.ts
|
|
4342
|
+
import { existsSync } from "fs";
|
|
4343
|
+
import { isAbsolute, resolve } from "path";
|
|
4344
|
+
import { pathToFileURL } from "url";
|
|
4345
|
+
var MODULE_SUFFIXES = [".mjs", ".cjs", ".mts", ".cts", ".js", ".ts"];
|
|
4346
|
+
function isModulePath(source) {
|
|
4347
|
+
if (source.startsWith("./") || source.startsWith("../")) return true;
|
|
4348
|
+
if (source.startsWith("/") || isAbsolute(source)) return true;
|
|
4349
|
+
if (source.includes("/")) return false;
|
|
4350
|
+
return MODULE_SUFFIXES.some((suffix) => source.endsWith(suffix));
|
|
4351
|
+
}
|
|
4352
|
+
function splitRef(spec) {
|
|
4353
|
+
const cut = spec.lastIndexOf(":");
|
|
4354
|
+
if (cut < 0) {
|
|
4355
|
+
throw new Error(`invalid ref ${JSON.stringify(spec)}, expected 'source:ExportName'`);
|
|
4356
|
+
}
|
|
4357
|
+
return [spec.slice(0, cut), spec.slice(cut + 1)];
|
|
4358
|
+
}
|
|
4359
|
+
function isRecord(value) {
|
|
4360
|
+
return typeof value === "object" && value !== null;
|
|
4361
|
+
}
|
|
4362
|
+
function isNotFound(error) {
|
|
4363
|
+
if (!isRecord(error)) return false;
|
|
4364
|
+
return error.code === "ERR_MODULE_NOT_FOUND" || error.code === "ENOENT";
|
|
4365
|
+
}
|
|
4366
|
+
function isUnsupportedTypeScript(error) {
|
|
4367
|
+
return isRecord(error) && error.code === "ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX";
|
|
4368
|
+
}
|
|
4369
|
+
async function loadAttr(spec) {
|
|
4370
|
+
const [source, attr] = splitRef(spec);
|
|
4371
|
+
const path4 = isModulePath(source) ? isAbsolute(source) ? source : resolve(source) : null;
|
|
4372
|
+
if (path4 !== null && !existsSync(path4)) {
|
|
4373
|
+
throw new Error(`cannot load script ${JSON.stringify(source)}`);
|
|
4374
|
+
}
|
|
4375
|
+
const target = path4 !== null ? pathToFileURL(path4).href : source;
|
|
4376
|
+
let mod;
|
|
4377
|
+
try {
|
|
4378
|
+
mod = await import(target);
|
|
4379
|
+
} catch (error) {
|
|
4380
|
+
if (path4 === null && isNotFound(error)) {
|
|
4381
|
+
throw new Error(`cannot load script ${JSON.stringify(source)}`);
|
|
4382
|
+
}
|
|
4383
|
+
if (isUnsupportedTypeScript(error)) {
|
|
4384
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
4385
|
+
throw new Error(
|
|
4386
|
+
`cannot load script ${JSON.stringify(source)}: ${detail}. Node strips types without compiling them; precompile the file or ship it as .mjs.`
|
|
4387
|
+
);
|
|
4388
|
+
}
|
|
4389
|
+
throw error;
|
|
4390
|
+
}
|
|
4391
|
+
if (attr in mod) return mod[attr];
|
|
4392
|
+
const fallback = mod.default;
|
|
4393
|
+
if (isRecord(fallback) && attr in fallback) return fallback[attr];
|
|
4394
|
+
throw new Error(`${JSON.stringify(attr)} not found in ${JSON.stringify(source)}`);
|
|
4395
|
+
}
|
|
2841
4396
|
export {
|
|
2842
4397
|
ALIYUN_PROMPT,
|
|
2843
4398
|
AliyunResource,
|
|
@@ -2846,12 +4401,15 @@ export {
|
|
|
2846
4401
|
BoxResource,
|
|
2847
4402
|
CEPH_PROMPT,
|
|
2848
4403
|
CephResource,
|
|
4404
|
+
DAYTONA_CONFIG_KEYS,
|
|
2849
4405
|
DEFAULT_STATE_ROOT,
|
|
2850
4406
|
DIGITALOCEAN_PROMPT,
|
|
2851
4407
|
DISK_COMMANDS,
|
|
2852
4408
|
DISK_OPS,
|
|
2853
4409
|
DISK_PROMPT,
|
|
4410
|
+
DOCKER_CONFIG_KEYS,
|
|
2854
4411
|
DatabricksVolumeResource,
|
|
4412
|
+
DaytonaRuntime,
|
|
2855
4413
|
DigitalOceanResource,
|
|
2856
4414
|
DiscordResource,
|
|
2857
4415
|
DiskNamespaceStore,
|
|
@@ -2860,19 +4418,25 @@ export {
|
|
|
2860
4418
|
DiskResource,
|
|
2861
4419
|
DiskSessionStore,
|
|
2862
4420
|
DiskWorkspaceStateStore,
|
|
4421
|
+
DockerRuntime,
|
|
2863
4422
|
DropboxResource,
|
|
4423
|
+
E2BRuntime,
|
|
4424
|
+
E2B_CONFIG_KEYS,
|
|
2864
4425
|
EMAIL_COMMANDS,
|
|
2865
4426
|
EMAIL_OPS,
|
|
2866
4427
|
EMAIL_PROMPT,
|
|
2867
4428
|
EMAIL_WRITE_PROMPT,
|
|
2868
4429
|
EmailAccessor,
|
|
2869
4430
|
EmailResource,
|
|
4431
|
+
FSKIT_MOUNT_ROOT,
|
|
2870
4432
|
FuseManager,
|
|
2871
4433
|
GCSResource,
|
|
2872
4434
|
GCS_ENDPOINT,
|
|
2873
4435
|
GCS_PROMPT,
|
|
4436
|
+
GCalResource,
|
|
2874
4437
|
GDocsResource,
|
|
2875
4438
|
GDriveResource,
|
|
4439
|
+
GRIDFS_COMMANDS,
|
|
2876
4440
|
GSheetsResource,
|
|
2877
4441
|
GSlidesResource,
|
|
2878
4442
|
GitHubCIResource,
|
|
@@ -2888,6 +4452,7 @@ export {
|
|
|
2888
4452
|
HF_OPS,
|
|
2889
4453
|
HF_RESOURCES,
|
|
2890
4454
|
HF_SPACES_PROMPT,
|
|
4455
|
+
HIMALAYA,
|
|
2891
4456
|
HfAccessor,
|
|
2892
4457
|
HfBucketsAccessor,
|
|
2893
4458
|
HfBucketsResource,
|
|
@@ -2897,24 +4462,31 @@ export {
|
|
|
2897
4462
|
HfModelsResource,
|
|
2898
4463
|
HfSpacesAccessor,
|
|
2899
4464
|
HfSpacesResource,
|
|
4465
|
+
JaegerResource,
|
|
2900
4466
|
LanceDBResource,
|
|
2901
4467
|
LanceDBStore,
|
|
2902
4468
|
LangfuseResource,
|
|
2903
4469
|
LinearResource,
|
|
4470
|
+
LocalRuntime,
|
|
2904
4471
|
MINIO_PROMPT,
|
|
4472
|
+
MODULE_SUFFIXES,
|
|
4473
|
+
Mem0Resource,
|
|
2905
4474
|
MinIOResource,
|
|
2906
4475
|
MirageFS,
|
|
2907
4476
|
MongoDBResource,
|
|
2908
4477
|
MongoDBStore,
|
|
2909
4478
|
Mount,
|
|
4479
|
+
MountCore,
|
|
2910
4480
|
NEXTCLOUD_COMMANDS,
|
|
2911
4481
|
NEXTCLOUD_OPS,
|
|
2912
4482
|
NEXTCLOUD_PROMPT,
|
|
2913
4483
|
NextcloudAccessor,
|
|
2914
4484
|
NextcloudResource,
|
|
4485
|
+
NextcloudWalk,
|
|
2915
4486
|
NotionResource,
|
|
2916
4487
|
OCIResource,
|
|
2917
4488
|
OCI_PROMPT,
|
|
4489
|
+
OneDriveResource,
|
|
2918
4490
|
PostgresResource,
|
|
2919
4491
|
PostgresStore,
|
|
2920
4492
|
QINGSTOR_PROMPT,
|
|
@@ -2925,6 +4497,7 @@ export {
|
|
|
2925
4497
|
REDIS_OPS,
|
|
2926
4498
|
REDIS_PROMPT,
|
|
2927
4499
|
RedisAccessor,
|
|
4500
|
+
RedisConsoleStore,
|
|
2928
4501
|
RedisFileCacheStore,
|
|
2929
4502
|
RedisNamespaceStore,
|
|
2930
4503
|
RedisObserverStore,
|
|
@@ -2943,6 +4516,7 @@ export {
|
|
|
2943
4516
|
SUPABASE_PROMPT,
|
|
2944
4517
|
ScalewayResource,
|
|
2945
4518
|
SeaweedFSResource,
|
|
4519
|
+
SharePointResource,
|
|
2946
4520
|
SlackResource,
|
|
2947
4521
|
SupabaseResource,
|
|
2948
4522
|
TENCENT_PROMPT,
|
|
@@ -2953,26 +4527,35 @@ export {
|
|
|
2953
4527
|
Workspace,
|
|
2954
4528
|
assertHfRepoId,
|
|
2955
4529
|
buildEmailConfig,
|
|
4530
|
+
buildDeltaHook as buildNextcloudDeltaHook,
|
|
2956
4531
|
buildResource,
|
|
4532
|
+
checkMountpoint,
|
|
4533
|
+
checkPlatform,
|
|
4534
|
+
checkSizes,
|
|
4535
|
+
classifyErrno,
|
|
4536
|
+
classifyError,
|
|
2957
4537
|
fileReadProvision,
|
|
2958
4538
|
mount as fuseMount,
|
|
2959
4539
|
mountBackground as fuseMountBackground,
|
|
2960
4540
|
headTailProvision,
|
|
2961
4541
|
isMacosMetadata,
|
|
4542
|
+
isModulePath,
|
|
2962
4543
|
knownResources,
|
|
4544
|
+
loadAttr,
|
|
2963
4545
|
loadDatabricksProfile,
|
|
2964
4546
|
metadataProvision,
|
|
2965
4547
|
normalizeBoxConfig,
|
|
2966
4548
|
normalizeDiscordConfig,
|
|
2967
4549
|
normalizeDropboxConfig,
|
|
2968
4550
|
normalizeEmailConfig,
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
4551
|
+
normalizeGoogleConfig6 as normalizeGCalConfig,
|
|
4552
|
+
normalizeGoogleConfig as normalizeGDocsConfig,
|
|
4553
|
+
normalizeGoogleConfig4 as normalizeGDriveConfig,
|
|
4554
|
+
normalizeGoogleConfig2 as normalizeGSheetsConfig,
|
|
4555
|
+
normalizeGoogleConfig3 as normalizeGSlidesConfig,
|
|
2973
4556
|
normalizeGitHubCIConfig,
|
|
2974
4557
|
normalizeGitHubConfig,
|
|
2975
|
-
|
|
4558
|
+
normalizeGoogleConfig5 as normalizeGmailConfig,
|
|
2976
4559
|
normalizeGridFSConfig,
|
|
2977
4560
|
normalizeHfBucketsConfig,
|
|
2978
4561
|
normalizeHfModelsConfig,
|
|
@@ -2981,11 +4564,13 @@ export {
|
|
|
2981
4564
|
normalizeLinearConfig,
|
|
2982
4565
|
normalizeNextcloudConfig,
|
|
2983
4566
|
normalizeNotionConfig,
|
|
4567
|
+
normalizeS3Config,
|
|
2984
4568
|
normalizeSlackConfig,
|
|
2985
4569
|
normalizeSshConfig,
|
|
2986
4570
|
normalizeTrelloConfig,
|
|
2987
4571
|
parseDatabricksCfg,
|
|
2988
4572
|
patchNodeFs,
|
|
4573
|
+
prepareBackend,
|
|
2989
4574
|
redactAliyunConfig,
|
|
2990
4575
|
redactBackblazeConfig,
|
|
2991
4576
|
redactBoxConfig,
|
|
@@ -2994,14 +4579,15 @@ export {
|
|
|
2994
4579
|
redactDiscordConfig,
|
|
2995
4580
|
redactDropboxConfig,
|
|
2996
4581
|
redactEmailConfig,
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
4582
|
+
redactGoogleConfig6 as redactGCalConfig,
|
|
4583
|
+
redactGoogleConfig as redactGDocsConfig,
|
|
4584
|
+
redactGoogleConfig4 as redactGDriveConfig,
|
|
4585
|
+
redactGoogleConfig2 as redactGSheetsConfig,
|
|
4586
|
+
redactGoogleConfig3 as redactGSlidesConfig,
|
|
3001
4587
|
redactGcsConfig,
|
|
3002
4588
|
redactGitHubCIConfig,
|
|
3003
4589
|
redactGitHubConfig,
|
|
3004
|
-
|
|
4590
|
+
redactGoogleConfig5 as redactGmailConfig,
|
|
3005
4591
|
redactHfBucketsConfig,
|
|
3006
4592
|
redactHfModelsConfig,
|
|
3007
4593
|
redactHfRepoConfig,
|
|
@@ -3023,6 +4609,8 @@ export {
|
|
|
3023
4609
|
redactTrelloConfig,
|
|
3024
4610
|
redactWasabiConfig,
|
|
3025
4611
|
register as registerResourceFactory,
|
|
4612
|
+
requireKernelBackend,
|
|
4613
|
+
resolveBackend,
|
|
3026
4614
|
resolvedAliyunEndpoint,
|
|
3027
4615
|
resolvedBackblazeEndpoint,
|
|
3028
4616
|
resolvedDigitalOceanEndpoint,
|
|
@@ -3030,6 +4618,8 @@ export {
|
|
|
3030
4618
|
resolvedScalewayEndpoint,
|
|
3031
4619
|
resolvedSupabaseEndpoint,
|
|
3032
4620
|
resolvedTencentEndpoint,
|
|
3033
|
-
resolvedWasabiEndpoint
|
|
4621
|
+
resolvedWasabiEndpoint,
|
|
4622
|
+
splitRef,
|
|
4623
|
+
unsizedMounts
|
|
3034
4624
|
};
|
|
3035
4625
|
//# sourceMappingURL=index.js.map
|