@struktoai/mirage-node 0.0.3 → 0.0.5-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/cas.lua +15 -0
- package/dist/ceph-ALKLD3MO.js +11 -0
- package/dist/{chunk-QCZ2XUKH.js → chunk-2A4YGVBM.js} +16 -23
- 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-UT2OPSN4.js → chunk-3JZQ6VSZ.js} +5 -5
- 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-47AVIIOT.js → chunk-5H6KNEPP.js} +4 -5
- package/dist/{chunk-47AVIIOT.js.map → chunk-5H6KNEPP.js.map} +1 -1
- package/dist/{chunk-I5THIMPP.js → chunk-5K2MWDCE.js} +6 -7
- package/dist/{chunk-I5THIMPP.js.map → chunk-5K2MWDCE.js.map} +1 -1
- package/dist/{chunk-3WIO7NBR.js → chunk-6SVXWRKX.js} +4 -5
- package/dist/{chunk-3WIO7NBR.js.map → chunk-6SVXWRKX.js.map} +1 -1
- package/dist/{chunk-RQK5UPMP.js → chunk-6VOIUGAD.js} +25 -12
- package/dist/chunk-6VOIUGAD.js.map +1 -0
- package/dist/{chunk-NOHWIBRX.js → chunk-7JYHFXXC.js} +15 -20
- 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-SWCDFEUK.js → chunk-ADEXNSYU.js} +20 -22
- 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-RO5IQEDQ.js → chunk-ATLXMNKD.js} +8 -4
- package/dist/chunk-ATLXMNKD.js.map +1 -0
- package/dist/{chunk-MPCCRRE6.js → chunk-BYCUGFRF.js} +16 -16
- package/dist/chunk-BYCUGFRF.js.map +1 -0
- package/dist/{chunk-HJJMP6IX.js → chunk-BZTVYOES.js} +3 -3
- package/dist/{chunk-B2ZOKNN4.js → chunk-CRC4YWXB.js} +27 -9
- package/dist/chunk-CRC4YWXB.js.map +1 -0
- package/dist/chunk-CTGXJHO5.js +39 -0
- package/dist/chunk-CTGXJHO5.js.map +1 -0
- package/dist/{chunk-Q2IAILVC.js → chunk-DCDBIXVZ.js} +14 -5
- package/dist/chunk-DCDBIXVZ.js.map +1 -0
- package/dist/chunk-DDAFNROK.js +750 -0
- 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-QGRDPSAH.js → chunk-EBI4IHDC.js} +23 -12
- package/dist/chunk-EBI4IHDC.js.map +1 -0
- package/dist/{chunk-JAGJTM3Q.js → chunk-EIUTZ6N7.js} +19 -34
- package/dist/chunk-EIUTZ6N7.js.map +1 -0
- package/dist/{chunk-TA3WMOMU.js → chunk-EJZG5VUF.js} +38 -32
- package/dist/chunk-EJZG5VUF.js.map +1 -0
- package/dist/{chunk-X5HF2OFP.js → chunk-ENW5BVYN.js} +3 -3
- package/dist/{chunk-HGCRXJGP.js → chunk-ETIAW4YD.js} +3 -3
- package/dist/chunk-EUPXAYPB.js +20 -0
- package/dist/chunk-EUPXAYPB.js.map +1 -0
- package/dist/{chunk-YAHRT6MB.js → chunk-FA6YNU75.js} +4 -5
- package/dist/{chunk-YAHRT6MB.js.map → chunk-FA6YNU75.js.map} +1 -1
- package/dist/{chunk-TWGVQLG2.js → chunk-FFH6R5VQ.js} +7 -3
- package/dist/chunk-FFH6R5VQ.js.map +1 -0
- package/dist/{chunk-JCC4CU2I.js → chunk-GE6H2COM.js} +15 -23
- package/dist/chunk-GE6H2COM.js.map +1 -0
- package/dist/{chunk-DM4GSE26.js → chunk-GMMQ3ZK4.js} +3 -3
- package/dist/{chunk-ZEGAMJO2.js → chunk-GSGE3M5P.js} +15 -23
- package/dist/chunk-GSGE3M5P.js.map +1 -0
- package/dist/{chunk-GCFYZSVR.js → chunk-H64SB6VO.js} +32 -13
- package/dist/chunk-H64SB6VO.js.map +1 -0
- package/dist/{chunk-N5FSLVKO.js → chunk-HCRYAFBI.js} +3 -3
- package/dist/{chunk-IDYHQQOH.js → chunk-HOPUP6LA.js} +358 -471
- 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-FQ33BYFR.js → chunk-I7CPLZNW.js} +4 -5
- package/dist/{chunk-FQ33BYFR.js.map → chunk-I7CPLZNW.js.map} +1 -1
- package/dist/{chunk-VGLHY6BK.js → chunk-IFUCGI4I.js} +7 -3
- package/dist/chunk-IFUCGI4I.js.map +1 -0
- package/dist/{chunk-RNQN2FOU.js → chunk-IFYXSSKR.js} +24 -13
- 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-7CW3BMPH.js → chunk-JJERW2BI.js} +4 -5
- package/dist/{chunk-7CW3BMPH.js.map → chunk-JJERW2BI.js.map} +1 -1
- package/dist/{chunk-EM4J5EQS.js → chunk-JQR4HVUX.js} +13 -16
- package/dist/chunk-JQR4HVUX.js.map +1 -0
- package/dist/{chunk-VWKUT4CW.js → chunk-JXOMDLFS.js} +21 -26
- package/dist/chunk-JXOMDLFS.js.map +1 -0
- package/dist/chunk-KIX6N7NT.js +1001 -0
- package/dist/chunk-KIX6N7NT.js.map +1 -0
- package/dist/{chunk-OZAEWZZ3.js → chunk-L42UTDFK.js} +12 -3
- package/dist/chunk-L42UTDFK.js.map +1 -0
- package/dist/{chunk-54NTYJEO.js → chunk-LPDLPRPS.js} +1 -3
- package/dist/{chunk-54NTYJEO.js.map → chunk-LPDLPRPS.js.map} +1 -1
- package/dist/chunk-M2UF2JHJ.js +11 -0
- package/dist/chunk-M2UF2JHJ.js.map +1 -0
- package/dist/{chunk-UGK4TAVK.js → chunk-MONC734W.js} +7 -3
- package/dist/chunk-MONC734W.js.map +1 -0
- package/dist/{chunk-IK2L4EN3.js → chunk-N72RLCMU.js} +4 -5
- package/dist/{chunk-IK2L4EN3.js.map → chunk-N72RLCMU.js.map} +1 -1
- package/dist/{chunk-H3I2KZIY.js → chunk-ND4IWJ4V.js} +7 -3
- package/dist/chunk-ND4IWJ4V.js.map +1 -0
- package/dist/chunk-NZ3EKGW4.js +1312 -0
- package/dist/chunk-NZ3EKGW4.js.map +1 -0
- package/dist/{chunk-XGJ2QERC.js → chunk-OAE57MNL.js} +27 -11
- package/dist/chunk-OAE57MNL.js.map +1 -0
- package/dist/{chunk-EZQ5HBAC.js → chunk-OHKGIQB4.js} +12 -16
- package/dist/chunk-OHKGIQB4.js.map +1 -0
- package/dist/{chunk-E2ISWXLB.js → chunk-OQKNDS66.js} +1 -1
- package/dist/{chunk-E2ISWXLB.js.map → chunk-OQKNDS66.js.map} +1 -1
- package/dist/{chunk-UINQOUZR.js → chunk-OXEQSPND.js} +3 -3
- package/dist/{chunk-A7IVFIOP.js → chunk-PKNE5J2B.js} +15 -23
- 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-EGB7V74Z.js → chunk-QAOVABCR.js} +7 -4
- package/dist/chunk-QAOVABCR.js.map +1 -0
- package/dist/{chunk-X3G37FXT.js → chunk-QQ7FP4GD.js} +4 -5
- package/dist/{chunk-X3G37FXT.js.map → chunk-QQ7FP4GD.js.map} +1 -1
- package/dist/{chunk-WAR4Q2NM.js → chunk-QYLVMC6B.js} +13 -15
- package/dist/chunk-QYLVMC6B.js.map +1 -0
- package/dist/{chunk-KPULTUOK.js → chunk-RX3XR65X.js} +4 -5
- package/dist/{chunk-KPULTUOK.js.map → chunk-RX3XR65X.js.map} +1 -1
- package/dist/chunk-RYQJJB4C.js +30 -0
- package/dist/chunk-RYQJJB4C.js.map +1 -0
- package/dist/{chunk-QQBJC2FQ.js → chunk-TUF7TCN7.js} +4 -5
- package/dist/{chunk-QQBJC2FQ.js.map → chunk-TUF7TCN7.js.map} +1 -1
- package/dist/{chunk-AUHSTJJ3.js → chunk-TUX36JY5.js} +4 -5
- package/dist/{chunk-AUHSTJJ3.js.map → chunk-TUX36JY5.js.map} +1 -1
- package/dist/chunk-TWRQCQWU.js +1153 -0
- 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-WG5YS6TC.js +872 -0
- package/dist/chunk-WG5YS6TC.js.map +1 -0
- package/dist/{chunk-ZGSER5TG.js → chunk-WMJJ4WGF.js} +4 -5
- package/dist/{chunk-ZGSER5TG.js.map → chunk-WMJJ4WGF.js.map} +1 -1
- package/dist/{chunk-LV2G7VHL.js → chunk-WY4FNH42.js} +21 -18
- package/dist/chunk-WY4FNH42.js.map +1 -0
- package/dist/{chunk-LAJJPLEV.js → chunk-XIG5BWWH.js} +25 -12
- 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-G2WCEUQL.js → chunk-XPRDXWK7.js} +21 -20
- 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-M5FVUIYP.js → chunk-YMBL3VJB.js} +21 -19
- package/dist/chunk-YMBL3VJB.js.map +1 -0
- package/dist/chunk-YUJBXFYK.js +1205 -0
- package/dist/chunk-YUJBXFYK.js.map +1 -0
- package/dist/{chunk-JALIYI6M.js → chunk-YZ4ZJNOL.js} +28 -11
- 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-GS5AUKUO.js → chunk-ZVSYUCYS.js} +11 -7
- package/dist/chunk-ZVSYUCYS.js.map +1 -0
- package/dist/{config-QAA646XB.js → config-2YBCHU2W.js} +2 -4
- package/dist/{config-IVY5EQQ2.js → config-3YRGRW72.js} +3 -4
- package/dist/config-4GSOMUMF.js +9 -0
- package/dist/config-5YBUWFUP.js +9 -0
- package/dist/{config-34LHOGLM.js → config-5ZRKJTKG.js} +3 -4
- package/dist/config-A25LTL5W.js +11 -0
- package/dist/config-CLU7JABG.js +9 -0
- package/dist/config-D2RF7L3N.js +9 -0
- package/dist/{config-LHFFXVYI.js → config-E55TKM6K.js} +2 -4
- package/dist/config-ELDOFRJW.js +9 -0
- package/dist/{config-GE4W4ZJC.js → config-FPC3RBFD.js} +2 -4
- package/dist/config-FPM3LAW7.js +9 -0
- package/dist/{config-HKRMKD76.js → config-G3F54CS4.js} +3 -4
- package/dist/config-G43HRUI3.js +9 -0
- package/dist/{config-WDAZFXYD.js → config-GG3WO5PB.js} +3 -4
- package/dist/config-JUYBWAZE.js +9 -0
- package/dist/{config-CVZ2AGCO.js → config-LJ5T6TVA.js} +2 -6
- package/dist/config-MDSAE4O3.js +11 -0
- package/dist/{config-EIHSP5DZ.js → config-NRIOKK5T.js} +2 -4
- package/dist/config-OYK2BSJK.js +9 -0
- package/dist/config-PB3KA2CE.js +9 -0
- package/dist/{config-ZFJYQZCH.js → config-QY4IL3PH.js} +3 -4
- package/dist/config-R4LAOEDS.js +9 -0
- package/dist/{config-QNMKWJ4M.js → config-RIAAD6RW.js} +3 -4
- package/dist/config-SYNEQAUB.js +9 -0
- package/dist/{config-Q45Y46YT.js → config-TJKGYA2B.js} +3 -4
- package/dist/{config-NV5WXP64.js → config-UU27ALAA.js} +2 -4
- package/dist/{config-3IVQJBNW.js → config-UURRGA7U.js} +2 -2
- package/dist/{config-VM526IKB.js → config-VPLHQXVE.js} +2 -4
- package/dist/config-WRACCRPN.js +9 -0
- package/dist/{config-GHRUKEQ6.js → config-WVHKXEVE.js} +3 -4
- package/dist/{config-EO23EY62.js → config-XU7R36IE.js} +3 -4
- package/dist/config-Y2KOUYSS.js +9 -0
- 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-YED2MF6H.js +8 -0
- 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 +1311 -569
- package/dist/index.js +3359 -964
- 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-L5CMN2EE.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-LPS357NF.js +8 -0
- 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/ssh-UYPG42LM.js.map +1 -0
- package/dist/supabase-A3KUFMDC.js +10 -0
- package/dist/supabase-A3KUFMDC.js.map +1 -0
- package/dist/tencent-5464UQ2X.js +11 -0
- package/dist/tencent-5464UQ2X.js.map +1 -0
- package/dist/trello-O2KB3FUO.js +8 -0
- package/dist/trello-O2KB3FUO.js.map +1 -0
- package/dist/wasabi-2IKBIWNO.js +10 -0
- package/dist/wasabi-2IKBIWNO.js.map +1 -0
- package/package.json +17 -3
- package/dist/aliyun-JMJ3PFYY.js +0 -10
- package/dist/backblaze-TDFD23QO.js +0 -10
- package/dist/box-GQ2U2R6R.js +0 -8
- package/dist/ceph-S2VOYO6G.js +0 -10
- package/dist/chunk-2CC5VW7K.js +0 -52
- package/dist/chunk-2CC5VW7K.js.map +0 -1
- package/dist/chunk-A7IVFIOP.js.map +0 -1
- package/dist/chunk-B2ZOKNN4.js.map +0 -1
- package/dist/chunk-DNBAMB5J.js +0 -18
- package/dist/chunk-DNBAMB5J.js.map +0 -1
- package/dist/chunk-DP2PP5V2.js +0 -26
- package/dist/chunk-DP2PP5V2.js.map +0 -1
- package/dist/chunk-DYXEITK3.js +0 -52
- package/dist/chunk-DYXEITK3.js.map +0 -1
- package/dist/chunk-EGB7V74Z.js.map +0 -1
- package/dist/chunk-EM4J5EQS.js.map +0 -1
- package/dist/chunk-EZQ5HBAC.js.map +0 -1
- package/dist/chunk-G2WCEUQL.js.map +0 -1
- package/dist/chunk-GCFYZSVR.js.map +0 -1
- package/dist/chunk-GS5AUKUO.js.map +0 -1
- package/dist/chunk-H3BST2LI.js +0 -26
- package/dist/chunk-H3BST2LI.js.map +0 -1
- package/dist/chunk-H3I2KZIY.js.map +0 -1
- package/dist/chunk-IDYHQQOH.js.map +0 -1
- package/dist/chunk-JAGJTM3Q.js.map +0 -1
- package/dist/chunk-JALIYI6M.js.map +0 -1
- package/dist/chunk-JCC4CU2I.js.map +0 -1
- package/dist/chunk-JZT4QGIP.js +0 -24
- package/dist/chunk-JZT4QGIP.js.map +0 -1
- package/dist/chunk-LAJJPLEV.js.map +0 -1
- package/dist/chunk-LV2G7VHL.js.map +0 -1
- package/dist/chunk-LW25LMIH.js +0 -26
- package/dist/chunk-LW25LMIH.js.map +0 -1
- package/dist/chunk-M5FVUIYP.js.map +0 -1
- package/dist/chunk-MPCCRRE6.js.map +0 -1
- package/dist/chunk-NJMGCT63.js +0 -54
- package/dist/chunk-NJMGCT63.js.map +0 -1
- package/dist/chunk-NOHWIBRX.js.map +0 -1
- package/dist/chunk-OHROA3FQ.js +0 -54
- package/dist/chunk-OHROA3FQ.js.map +0 -1
- package/dist/chunk-OPYQ5KIO.js +0 -52
- package/dist/chunk-OPYQ5KIO.js.map +0 -1
- package/dist/chunk-OZAEWZZ3.js.map +0 -1
- package/dist/chunk-Q2IAILVC.js.map +0 -1
- package/dist/chunk-QCZ2XUKH.js.map +0 -1
- package/dist/chunk-QGRDPSAH.js.map +0 -1
- package/dist/chunk-RNQN2FOU.js.map +0 -1
- package/dist/chunk-RO5IQEDQ.js.map +0 -1
- package/dist/chunk-RQK5UPMP.js.map +0 -1
- package/dist/chunk-S5OVP467.js +0 -1795
- package/dist/chunk-S5OVP467.js.map +0 -1
- package/dist/chunk-SFUCUARB.js +0 -21
- package/dist/chunk-SFUCUARB.js.map +0 -1
- package/dist/chunk-SWCDFEUK.js.map +0 -1
- package/dist/chunk-TA3WMOMU.js.map +0 -1
- package/dist/chunk-TURD42QO.js +0 -1782
- package/dist/chunk-TURD42QO.js.map +0 -1
- package/dist/chunk-TWGVQLG2.js.map +0 -1
- package/dist/chunk-U6QSXTUS.js +0 -7
- package/dist/chunk-U6QSXTUS.js.map +0 -1
- package/dist/chunk-UGK4TAVK.js.map +0 -1
- package/dist/chunk-UT2OPSN4.js.map +0 -1
- package/dist/chunk-VGLHY6BK.js.map +0 -1
- package/dist/chunk-VWKUT4CW.js.map +0 -1
- package/dist/chunk-W7FLHT65.js +0 -26
- package/dist/chunk-W7FLHT65.js.map +0 -1
- package/dist/chunk-WAR4Q2NM.js.map +0 -1
- package/dist/chunk-WHFUWWI6.js +0 -2097
- package/dist/chunk-WHFUWWI6.js.map +0 -1
- package/dist/chunk-XGJ2QERC.js.map +0 -1
- package/dist/chunk-XHCBHYN4.js +0 -54
- package/dist/chunk-XHCBHYN4.js.map +0 -1
- package/dist/chunk-XLQI4IT2.js +0 -54
- package/dist/chunk-XLQI4IT2.js.map +0 -1
- package/dist/chunk-XWVDS66D.js +0 -963
- package/dist/chunk-XWVDS66D.js.map +0 -1
- package/dist/chunk-YGZMVNN5.js +0 -54
- package/dist/chunk-YGZMVNN5.js.map +0 -1
- package/dist/chunk-YUK3X3B4.js +0 -27
- package/dist/chunk-YUK3X3B4.js.map +0 -1
- package/dist/chunk-ZEGAMJO2.js.map +0 -1
- package/dist/chunk-ZNWVJ6UW.js +0 -54
- package/dist/chunk-ZNWVJ6UW.js.map +0 -1
- package/dist/config-3BBWD5AB.js +0 -11
- package/dist/config-4UDVSUQJ.js +0 -11
- package/dist/config-CMDBAPDH.js +0 -11
- package/dist/config-D3RLSPNF.js +0 -11
- package/dist/config-DG65OEG3.js +0 -11
- package/dist/config-GCQK6NJY.js +0 -11
- package/dist/config-GVH27UPE.js +0 -11
- package/dist/config-HXVYIXP5.js +0 -11
- package/dist/config-IDZMEW73.js +0 -11
- package/dist/config-IJJXGLBQ.js +0 -11
- package/dist/config-KJOLGVB2.js +0 -11
- package/dist/config-KMVCVBYN.js +0 -15
- package/dist/config-KYTRXAB2.js +0 -15
- package/dist/config-OT2TQQCN.js +0 -11
- package/dist/config-QWCY3LBQ.js +0 -11
- package/dist/config-ZV6G2ZEC.js +0 -11
- package/dist/databricks_volume-7XOUYSTY.js +0 -7
- package/dist/digitalocean-3CQ4CPPZ.js +0 -10
- package/dist/discord-BG7OSRJG.js +0 -8
- package/dist/disk-XVLBCVKE.js +0 -8
- package/dist/dropbox-74GYLV3R.js +0 -8
- package/dist/email-5IZ7OBQ4.js +0 -8
- package/dist/gcs-EMEYU2XT.js +0 -10
- package/dist/gdocs-R67TDPON.js +0 -8
- package/dist/gdrive-PRN2ALRK.js +0 -8
- package/dist/github-DV7E6OFV.js +0 -8
- package/dist/github_ci-Q554V5PA.js +0 -8
- package/dist/gmail-OLN2LT4O.js +0 -8
- package/dist/gsheets-H4RYMQJ5.js +0 -8
- package/dist/gslides-YLCHKJOM.js +0 -8
- package/dist/hf_buckets-DTKXKKFF.js +0 -10
- package/dist/hf_datasets-55C4APKR.js +0 -10
- package/dist/hf_models-RO5JR36V.js +0 -10
- package/dist/hf_spaces-ZVZ3EDRX.js +0 -10
- package/dist/langfuse-ACASJZ7O.js +0 -8
- package/dist/linear-IC37LZV7.js +0 -8
- package/dist/minio-HZ576XFQ.js +0 -10
- package/dist/mongodb-JVR62OIO.js +0 -7
- package/dist/notion-HKRPQMJS.js +0 -8
- package/dist/oci-ZLVECXTW.js +0 -10
- package/dist/postgres-P36Z2YN4.js +0 -7
- package/dist/qingstor-YLP6K3L4.js +0 -10
- package/dist/r2-RPK25ANI.js +0 -10
- package/dist/redis-V5ULXULL.js +0 -8
- package/dist/s3-4OIOCAAT.js +0 -8
- package/dist/scaleway-CCWCLUHB.js +0 -10
- package/dist/seaweedfs-QSWKF2FN.js +0 -10
- package/dist/slack-YPS7PII3.js +0 -8
- package/dist/ssh-YFP3SMTJ.js +0 -9
- package/dist/supabase-6CFTOKGZ.js +0 -10
- package/dist/tencent-IWZZOSQ4.js +0 -10
- package/dist/trello-XYKWZD6P.js +0 -8
- package/dist/wasabi-6Z4DC5S5.js +0 -10
- /package/dist/{aliyun-JMJ3PFYY.js.map → aliyun-S62BR3TB.js.map} +0 -0
- /package/dist/{backblaze-TDFD23QO.js.map → backblaze-4EKSW63F.js.map} +0 -0
- /package/dist/{box-GQ2U2R6R.js.map → box-ZPLZAGMK.js.map} +0 -0
- /package/dist/{ceph-S2VOYO6G.js.map → ceph-ALKLD3MO.js.map} +0 -0
- /package/dist/{chunk-HJJMP6IX.js.map → chunk-BZTVYOES.js.map} +0 -0
- /package/dist/{chunk-X5HF2OFP.js.map → chunk-ENW5BVYN.js.map} +0 -0
- /package/dist/{chunk-HGCRXJGP.js.map → chunk-ETIAW4YD.js.map} +0 -0
- /package/dist/{chunk-DM4GSE26.js.map → chunk-GMMQ3ZK4.js.map} +0 -0
- /package/dist/{chunk-N5FSLVKO.js.map → chunk-HCRYAFBI.js.map} +0 -0
- /package/dist/{chunk-UINQOUZR.js.map → chunk-OXEQSPND.js.map} +0 -0
- /package/dist/{config-34LHOGLM.js.map → config-2YBCHU2W.js.map} +0 -0
- /package/dist/{config-3BBWD5AB.js.map → config-3YRGRW72.js.map} +0 -0
- /package/dist/{config-3IVQJBNW.js.map → config-4GSOMUMF.js.map} +0 -0
- /package/dist/{config-4UDVSUQJ.js.map → config-5YBUWFUP.js.map} +0 -0
- /package/dist/{config-CMDBAPDH.js.map → config-5ZRKJTKG.js.map} +0 -0
- /package/dist/{config-CVZ2AGCO.js.map → config-A25LTL5W.js.map} +0 -0
- /package/dist/{config-D3RLSPNF.js.map → config-CLU7JABG.js.map} +0 -0
- /package/dist/{config-DG65OEG3.js.map → config-D2RF7L3N.js.map} +0 -0
- /package/dist/{config-EIHSP5DZ.js.map → config-E55TKM6K.js.map} +0 -0
- /package/dist/{config-EO23EY62.js.map → config-ELDOFRJW.js.map} +0 -0
- /package/dist/{config-GCQK6NJY.js.map → config-FPC3RBFD.js.map} +0 -0
- /package/dist/{config-GE4W4ZJC.js.map → config-FPM3LAW7.js.map} +0 -0
- /package/dist/{config-GHRUKEQ6.js.map → config-G3F54CS4.js.map} +0 -0
- /package/dist/{config-GVH27UPE.js.map → config-G43HRUI3.js.map} +0 -0
- /package/dist/{config-HKRMKD76.js.map → config-GG3WO5PB.js.map} +0 -0
- /package/dist/{config-HXVYIXP5.js.map → config-JUYBWAZE.js.map} +0 -0
- /package/dist/{config-IDZMEW73.js.map → config-LJ5T6TVA.js.map} +0 -0
- /package/dist/{config-IJJXGLBQ.js.map → config-MDSAE4O3.js.map} +0 -0
- /package/dist/{config-IVY5EQQ2.js.map → config-NRIOKK5T.js.map} +0 -0
- /package/dist/{config-KJOLGVB2.js.map → config-OYK2BSJK.js.map} +0 -0
- /package/dist/{config-KMVCVBYN.js.map → config-PB3KA2CE.js.map} +0 -0
- /package/dist/{config-KYTRXAB2.js.map → config-QY4IL3PH.js.map} +0 -0
- /package/dist/{config-LHFFXVYI.js.map → config-R4LAOEDS.js.map} +0 -0
- /package/dist/{config-NV5WXP64.js.map → config-RIAAD6RW.js.map} +0 -0
- /package/dist/{config-OT2TQQCN.js.map → config-SYNEQAUB.js.map} +0 -0
- /package/dist/{config-Q45Y46YT.js.map → config-TJKGYA2B.js.map} +0 -0
- /package/dist/{config-QAA646XB.js.map → config-UU27ALAA.js.map} +0 -0
- /package/dist/{config-QNMKWJ4M.js.map → config-UURRGA7U.js.map} +0 -0
- /package/dist/{config-QWCY3LBQ.js.map → config-VPLHQXVE.js.map} +0 -0
- /package/dist/{config-VM526IKB.js.map → config-WRACCRPN.js.map} +0 -0
- /package/dist/{config-WDAZFXYD.js.map → config-WVHKXEVE.js.map} +0 -0
- /package/dist/{config-ZFJYQZCH.js.map → config-XU7R36IE.js.map} +0 -0
- /package/dist/{config-ZV6G2ZEC.js.map → config-Y2KOUYSS.js.map} +0 -0
- /package/dist/{databricks_volume-7XOUYSTY.js.map → databricks_volume-CNCPTZHS.js.map} +0 -0
- /package/dist/{digitalocean-3CQ4CPPZ.js.map → digitalocean-DJZOUB6Q.js.map} +0 -0
- /package/dist/{discord-BG7OSRJG.js.map → discord-ETB2CADR.js.map} +0 -0
- /package/dist/{disk-XVLBCVKE.js.map → disk-WEHSTK3F.js.map} +0 -0
- /package/dist/{dropbox-74GYLV3R.js.map → dropbox-XN6PGLNE.js.map} +0 -0
- /package/dist/{email-5IZ7OBQ4.js.map → email-OV7XCP3T.js.map} +0 -0
- /package/dist/{gcs-EMEYU2XT.js.map → gcal-P56MRCGU.js.map} +0 -0
- /package/dist/{gdocs-R67TDPON.js.map → gcs-HFBIAE2C.js.map} +0 -0
- /package/dist/{gdrive-PRN2ALRK.js.map → gdocs-LQ3UXP3J.js.map} +0 -0
- /package/dist/{github-DV7E6OFV.js.map → gdrive-N6UBYLON.js.map} +0 -0
- /package/dist/{github_ci-Q554V5PA.js.map → github-BPZREGPI.js.map} +0 -0
- /package/dist/{gmail-OLN2LT4O.js.map → github_ci-7A4LUIZ7.js.map} +0 -0
- /package/dist/{gsheets-H4RYMQJ5.js.map → gmail-YED2MF6H.js.map} +0 -0
- /package/dist/{gslides-YLCHKJOM.js.map → gridfs-CPLQ4G62.js.map} +0 -0
- /package/dist/{hf_buckets-DTKXKKFF.js.map → gsheets-4BNIJPQ6.js.map} +0 -0
- /package/dist/{hf_datasets-55C4APKR.js.map → gslides-GDBYLO5A.js.map} +0 -0
- /package/dist/{hf_models-RO5JR36V.js.map → hf_buckets-FTJITQ3P.js.map} +0 -0
- /package/dist/{hf_spaces-ZVZ3EDRX.js.map → hf_datasets-6GXVKQD7.js.map} +0 -0
- /package/dist/{langfuse-ACASJZ7O.js.map → hf_models-PJPGZAC5.js.map} +0 -0
- /package/dist/{linear-IC37LZV7.js.map → hf_spaces-LFNFOLBF.js.map} +0 -0
- /package/dist/{minio-HZ576XFQ.js.map → jaeger-GCA6MJ6E.js.map} +0 -0
- /package/dist/{mongodb-JVR62OIO.js.map → lancedb-TJ5YSJY5.js.map} +0 -0
- /package/dist/{notion-HKRPQMJS.js.map → langfuse-RUMTUMXS.js.map} +0 -0
- /package/dist/{oci-ZLVECXTW.js.map → linear-BCE4KEAC.js.map} +0 -0
- /package/dist/{postgres-P36Z2YN4.js.map → minio-5SO6KBTK.js.map} +0 -0
- /package/dist/{qingstor-YLP6K3L4.js.map → mongodb-L5CMN2EE.js.map} +0 -0
- /package/dist/{r2-RPK25ANI.js.map → nextcloud-4O2LZVW2.js.map} +0 -0
- /package/dist/{redis-V5ULXULL.js.map → notion-RVKEAQ2M.js.map} +0 -0
- /package/dist/{s3-4OIOCAAT.js.map → oci-OQXOIC62.js.map} +0 -0
- /package/dist/{scaleway-CCWCLUHB.js.map → postgres-AV45GNRS.js.map} +0 -0
- /package/dist/{seaweedfs-QSWKF2FN.js.map → qingstor-W277YA4K.js.map} +0 -0
- /package/dist/{slack-YPS7PII3.js.map → r2-FUA4IORE.js.map} +0 -0
- /package/dist/{ssh-YFP3SMTJ.js.map → redis-LPS357NF.js.map} +0 -0
- /package/dist/{supabase-6CFTOKGZ.js.map → s3-FPNWWIVM.js.map} +0 -0
- /package/dist/{tencent-IWZZOSQ4.js.map → scaleway-BP3732U7.js.map} +0 -0
- /package/dist/{trello-XYKWZD6P.js.map → seaweedfs-MC6HIEP4.js.map} +0 -0
- /package/dist/{wasabi-6Z4DC5S5.js.map → slack-JFGW7VLN.js.map} +0 -0
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/workspace.ts","../src/workspace/fuse.ts","../src/fuse/mount.ts","../src/fuse/fs.ts","../src/fuse/platform/macos.ts","../src/workspace/mount_spec.ts","../src/compression_codecs.ts","../src/observe/disk_store.ts","../src/observe/redis_store.ts","../src/fs_monkey.ts","../src/commands/builtin/redis/provision.ts","../src/cache/redis/file.ts","../src/resource/hf_models/config.ts","../src/resource/lancedb/lancedb.ts","../src/resource/lancedb/store.ts","../src/resource/registry.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport * from '@struktoai/mirage-core'\nexport { Workspace, type NodeWorkspaceOptions } from './workspace.ts'\nexport { Mount, type MountSpecOptions } from './workspace/mount_spec.ts'\nexport {\n DiskResource,\n type DiskResourceOptions,\n type DiskResourceState,\n} from './resource/disk/disk.ts'\nexport { DISK_PROMPT } from './resource/disk/prompt.ts'\nexport { DISK_OPS } from './ops/disk/index.ts'\nexport { DiskObserverStore } from './observe/disk_store.ts'\nexport { RedisObserverStore, type RedisObserverStoreOptions } from './observe/redis_store.ts'\nexport { patchNodeFs } from './fs_monkey.ts'\nexport {\n RedisResource,\n type RedisResourceOptions,\n type RedisResourceState,\n} from './resource/redis/redis.ts'\nexport { REDIS_PROMPT } from './resource/redis/prompt.ts'\nexport { RedisStore, type RedisStoreOptions } from './resource/redis/store.ts'\nexport { RedisAccessor } from './accessor/redis.ts'\nexport { REDIS_OPS } from './ops/redis/index.ts'\nexport {\n fileReadProvision,\n headTailProvision,\n metadataProvision,\n type RedisResourceLike,\n} from './commands/builtin/redis/provision.ts'\nexport { RedisFileCacheStore, type RedisFileCacheOptions } from './cache/redis/file.ts'\nexport { FuseManager } from './workspace/fuse.ts'\nexport { MirageFS, type MirageFSOptions, type FuseAttr } from './fuse/fs.ts'\nexport {\n mount as fuseMount,\n mountBackground as fuseMountBackground,\n type FuseHandle,\n type MountOptions as FuseMountOptions,\n} from './fuse/mount.ts'\nexport { isMacosMetadata } from './fuse/platform/macos.ts'\nexport { S3Resource, type S3ResourceState } from './resource/s3/s3.ts'\nexport {\n DatabricksVolumeResource,\n type DatabricksVolumeResourceState,\n} from './resource/databricks_volume/databricks_volume.ts'\nexport {\n loadDatabricksProfile,\n parseDatabricksCfg,\n type DatabricksProfile,\n} from './resource/databricks_volume/profile.ts'\nexport {\n redactConfig as redactS3Config,\n type S3Config,\n type S3ConfigRedacted,\n} from './resource/s3/config.ts'\nexport { GCSResource, type GCSResourceState } from './resource/gcs/gcs.ts'\nexport {\n GCS_ENDPOINT,\n redactGcsConfig,\n type GCSConfig,\n type GCSConfigRedacted,\n} from './resource/gcs/config.ts'\nexport { GCS_PROMPT } from './resource/gcs/prompt.ts'\nexport { OCIResource, type OCIResourceState } from './resource/oci/oci.ts'\nexport { redactOciConfig, type OCIConfig, type OCIConfigRedacted } from './resource/oci/config.ts'\nexport { OCI_PROMPT } from './resource/oci/prompt.ts'\nexport { R2Resource, type R2ResourceState } from './resource/r2/r2.ts'\nexport { redactR2Config, type R2Config, type R2ConfigRedacted } from './resource/r2/config.ts'\nexport { R2_PROMPT } from './resource/r2/prompt.ts'\nexport { SupabaseResource, type SupabaseResourceState } from './resource/supabase/supabase.ts'\nexport {\n redactSupabaseConfig,\n resolvedSupabaseEndpoint,\n type SupabaseConfig,\n type SupabaseConfigRedacted,\n} from './resource/supabase/config.ts'\nexport { SUPABASE_PROMPT } from './resource/supabase/prompt.ts'\nexport {\n HF_RESOURCES,\n HfAccessor,\n HfBucketsAccessor,\n HfDatasetsAccessor,\n HfModelsAccessor,\n HfSpacesAccessor,\n} from './accessor/hf.ts'\nexport { HfBucketsResource, type HfBucketsResourceState } from './resource/hf_buckets/hf_buckets.ts'\nexport {\n assertHfRepoId,\n HF_ENDPOINT,\n normalizeHfBucketsConfig,\n normalizeHfRepoConfig,\n redactHfBucketsConfig,\n redactHfRepoConfig,\n type HfBucketsConfig,\n type HfBucketsConfigRedacted,\n type HfRepoConfig,\n type HfRepoConfigRedacted,\n} from './resource/hf_buckets/config.ts'\nexport { HF_BUCKETS_PROMPT } from './resource/hf_buckets/prompt.ts'\nexport {\n HfDatasetsResource,\n type HfDatasetsResourceState,\n} from './resource/hf_datasets/hf_datasets.ts'\nexport { HF_DATASETS_PROMPT } from './resource/hf_datasets/prompt.ts'\nexport { HfModelsResource, type HfModelsResourceState } from './resource/hf_models/hf_models.ts'\nexport {\n normalizeHfModelsConfig,\n redactHfModelsConfig,\n type HfModelsConfig,\n type HfModelsConfigRedacted,\n} from './resource/hf_models/config.ts'\nexport { HF_MODELS_PROMPT } from './resource/hf_models/prompt.ts'\nexport { HfSpacesResource, type HfSpacesResourceState } from './resource/hf_spaces/hf_spaces.ts'\nexport { HF_SPACES_PROMPT } from './resource/hf_spaces/prompt.ts'\nexport { HF_COMMANDS } from './commands/builtin/hf/index.ts'\nexport { HF_OPS } from './ops/hf/index.ts'\nexport { MinIOResource, type MinIOResourceState } from './resource/minio/minio.ts'\nexport {\n redactMinIOConfig,\n type MinIOConfig,\n type MinIOConfigRedacted,\n} from './resource/minio/config.ts'\nexport { MINIO_PROMPT } from './resource/minio/prompt.ts'\nexport { SeaweedFSResource, type SeaweedFSResourceState } from './resource/seaweedfs/seaweedfs.ts'\nexport {\n redactSeaweedFSConfig,\n type SeaweedFSConfig,\n type SeaweedFSConfigRedacted,\n} from './resource/seaweedfs/config.ts'\nexport { SEAWEEDFS_PROMPT } from './resource/seaweedfs/prompt.ts'\nexport { CephResource, type CephResourceState } from './resource/ceph/ceph.ts'\nexport {\n redactCephConfig,\n type CephConfig,\n type CephConfigRedacted,\n} from './resource/ceph/config.ts'\nexport { CEPH_PROMPT } from './resource/ceph/prompt.ts'\nexport { WasabiResource, type WasabiResourceState } from './resource/wasabi/wasabi.ts'\nexport {\n redactWasabiConfig,\n resolvedWasabiEndpoint,\n type WasabiConfig,\n type WasabiConfigRedacted,\n} from './resource/wasabi/config.ts'\nexport { WASABI_PROMPT } from './resource/wasabi/prompt.ts'\nexport { BackblazeResource, type BackblazeResourceState } from './resource/backblaze/backblaze.ts'\nexport {\n redactBackblazeConfig,\n resolvedBackblazeEndpoint,\n type BackblazeConfig,\n type BackblazeConfigRedacted,\n} from './resource/backblaze/config.ts'\nexport { BACKBLAZE_PROMPT } from './resource/backblaze/prompt.ts'\nexport {\n DigitalOceanResource,\n type DigitalOceanResourceState,\n} from './resource/digitalocean/digitalocean.ts'\nexport {\n redactDigitalOceanConfig,\n resolvedDigitalOceanEndpoint,\n type DigitalOceanConfig,\n type DigitalOceanConfigRedacted,\n} from './resource/digitalocean/config.ts'\nexport { DIGITALOCEAN_PROMPT } from './resource/digitalocean/prompt.ts'\nexport { TencentResource, type TencentResourceState } from './resource/tencent/tencent.ts'\nexport {\n redactTencentConfig,\n resolvedTencentEndpoint,\n type TencentConfig,\n type TencentConfigRedacted,\n} from './resource/tencent/config.ts'\nexport { TENCENT_PROMPT } from './resource/tencent/prompt.ts'\nexport { AliyunResource, type AliyunResourceState } from './resource/aliyun/aliyun.ts'\nexport {\n redactAliyunConfig,\n resolvedAliyunEndpoint,\n type AliyunConfig,\n type AliyunConfigRedacted,\n} from './resource/aliyun/config.ts'\nexport { ALIYUN_PROMPT } from './resource/aliyun/prompt.ts'\nexport { ScalewayResource, type ScalewayResourceState } from './resource/scaleway/scaleway.ts'\nexport {\n redactScalewayConfig,\n resolvedScalewayEndpoint,\n type ScalewayConfig,\n type ScalewayConfigRedacted,\n} from './resource/scaleway/config.ts'\nexport { SCALEWAY_PROMPT } from './resource/scaleway/prompt.ts'\nexport { QingStorResource, type QingStorResourceState } from './resource/qingstor/qingstor.ts'\nexport {\n redactQingStorConfig,\n resolvedQingStorEndpoint,\n type QingStorConfig,\n type QingStorConfigRedacted,\n} from './resource/qingstor/config.ts'\nexport { QINGSTOR_PROMPT } from './resource/qingstor/prompt.ts'\nexport { PostgresResource, type PostgresResourceOptions } from './resource/postgres/postgres.ts'\nexport { PostgresStore } from './resource/postgres/store.ts'\nexport { MongoDBResource, type MongoDBResourceOptions } from './resource/mongodb/mongodb.ts'\nexport { MongoDBStore } from './resource/mongodb/store.ts'\nexport { LanceDBResource, type LanceDBResourceOptions } from './resource/lancedb/lancedb.ts'\nexport { LanceDBStore } from './resource/lancedb/store.ts'\nexport { SlackResource, type SlackResourceState } from './resource/slack/slack.ts'\nexport {\n normalizeSlackConfig,\n redactSlackConfig,\n type SlackConfig,\n type SlackConfigRedacted,\n} from './resource/slack/config.ts'\nexport { SSHResource, type SSHResourceState } from './resource/ssh/ssh.ts'\nexport {\n normalizeSshConfig,\n redactSshConfig,\n type SSHConfig,\n type SSHConfigRedacted,\n} from './resource/ssh/config.ts'\nexport { SSHAccessor } from './accessor/ssh.ts'\nexport { SSH_PROMPT } from './resource/ssh/prompt.ts'\nexport { SSH_COMMANDS } from './commands/builtin/ssh/index.ts'\nexport { SSH_OPS } from './ops/ssh/index.ts'\nexport { DiscordResource, type DiscordResourceState } from './resource/discord/discord.ts'\nexport {\n normalizeDiscordConfig,\n redactDiscordConfig,\n type DiscordConfig,\n type DiscordConfigRedacted,\n} from './resource/discord/config.ts'\nexport { TrelloResource, type TrelloResourceState } from './resource/trello/trello.ts'\nexport {\n normalizeTrelloConfig,\n redactTrelloConfig,\n type TrelloConfig,\n type TrelloConfigRedacted,\n} from './resource/trello/config.ts'\nexport { LinearResource, type LinearResourceState } from './resource/linear/linear.ts'\nexport {\n normalizeLinearConfig,\n redactLinearConfig,\n type LinearConfig,\n type LinearConfigRedacted,\n} from './resource/linear/config.ts'\nexport { NotionResource, type NotionResourceState } from './resource/notion/notion.ts'\nexport {\n normalizeNotionConfig,\n redactNotionConfig,\n type NotionConfig,\n type NotionConfigRedacted,\n} from './resource/notion/config.ts'\nexport { LangfuseResource, type LangfuseResourceState } from './resource/langfuse/langfuse.ts'\nexport {\n normalizeLangfuseConfig,\n redactLangfuseConfig,\n type LangfuseConfig,\n type LangfuseConfigRedacted,\n} from './resource/langfuse/config.ts'\nexport { GitHubResource, type GitHubResourceState } from './resource/github/github.ts'\nexport {\n normalizeGitHubConfig,\n redactGitHubConfig,\n type GitHubConfig,\n type GitHubConfigRedacted,\n} from './resource/github/config.ts'\nexport { GitHubCIResource, type GitHubCIResourceState } from './resource/github_ci/github_ci.ts'\nexport {\n normalizeGitHubCIConfig,\n redactGitHubCIConfig,\n type GitHubCIConfig,\n type GitHubCIConfigRedacted,\n} from './resource/github_ci/config.ts'\nexport { GDocsResource, type GDocsResourceState } from './resource/gdocs/gdocs.ts'\nexport {\n normalizeGDocsConfig,\n redactGDocsConfig,\n type GDocsConfig,\n type GDocsConfigRedacted,\n} from './resource/gdocs/config.ts'\nexport { GSheetsResource, type GSheetsResourceState } from './resource/gsheets/gsheets.ts'\nexport {\n normalizeGSheetsConfig,\n redactGSheetsConfig,\n type GSheetsConfig,\n type GSheetsConfigRedacted,\n} from './resource/gsheets/config.ts'\nexport { GSlidesResource, type GSlidesResourceState } from './resource/gslides/gslides.ts'\nexport {\n normalizeGSlidesConfig,\n redactGSlidesConfig,\n type GSlidesConfig,\n type GSlidesConfigRedacted,\n} from './resource/gslides/config.ts'\nexport { GDriveResource, type GDriveResourceState } from './resource/gdrive/gdrive.ts'\nexport {\n normalizeGDriveConfig,\n redactGDriveConfig,\n type GDriveConfig,\n type GDriveConfigRedacted,\n} from './resource/gdrive/config.ts'\nexport { DropboxResource, type DropboxResourceState } from './resource/dropbox/dropbox.ts'\nexport {\n normalizeDropboxConfig,\n redactDropboxConfig,\n type DropboxConfig,\n type DropboxConfigRedacted,\n} from './resource/dropbox/config.ts'\nexport { BoxResource, type BoxResourceState } from './resource/box/box.ts'\nexport {\n normalizeBoxConfig,\n redactBoxConfig,\n type BoxConfig,\n type BoxConfigRedacted,\n} from './resource/box/config.ts'\nexport { GmailResource, type GmailResourceState } from './resource/gmail/gmail.ts'\nexport {\n normalizeGmailConfig,\n redactGmailConfig,\n type GmailConfig,\n type GmailConfigRedacted,\n} from './resource/gmail/config.ts'\nexport { EmailResource, type EmailResourceState } from './resource/email/email.ts'\nexport {\n buildEmailConfig,\n normalizeEmailConfig,\n redactEmailConfig,\n type EmailConfig,\n type EmailConfigInput,\n type EmailConfigRedacted,\n EMAIL_PROMPT,\n EMAIL_WRITE_PROMPT,\n} from './resource/email/index.ts'\nexport { EmailAccessor } from './accessor/email.ts'\nexport { EMAIL_COMMANDS } from './commands/builtin/email/index.ts'\nexport { EMAIL_OPS } from './ops/email/index.ts'\nexport {\n buildResource,\n knownResources,\n register as registerResourceFactory,\n type ResourceFactory,\n} from './resource/registry.ts'\nexport { DISK_COMMANDS } from './commands/builtin/disk/index.ts'\nexport { REDIS_COMMANDS } from './commands/builtin/redis/index.ts'\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport {\n type CommandSafeguard,\n createShellParser,\n type ExecuteOptions,\n type ExecuteResult,\n type MountMode,\n type ProvisionResult,\n type Resource,\n type ShellParser,\n Workspace as CoreWorkspace,\n type WorkspaceOptions,\n} from '@struktoai/mirage-core'\nimport { FuseManager } from './workspace/fuse.ts'\nimport { Mount } from './workspace/mount_spec.ts'\nimport './compression_codecs.ts'\n\nconst requireCjs = createRequire(import.meta.url)\n\nlet cachedParser: Promise<ShellParser> | null = null\n\nfunction loadShellParser(): Promise<ShellParser> {\n if (cachedParser !== null) return cachedParser\n const enginePath = requireCjs.resolve('web-tree-sitter/web-tree-sitter.wasm')\n const grammarPath = requireCjs.resolve('tree-sitter-bash/tree-sitter-bash.wasm')\n cachedParser = createShellParser({\n engineWasm: readFileSync(enginePath),\n grammarWasm: readFileSync(grammarPath),\n })\n return cachedParser\n}\n\nexport type NodeWorkspaceOptions = WorkspaceOptions\n\nexport class Workspace extends CoreWorkspace {\n private fuseSetupPromise: Promise<void> | null = null\n private readonly fuseMountpointsMap = new Map<string, string>()\n private readonly fuseManagers = new Map<string, FuseManager>()\n\n constructor(resources: Record<string, Resource | Mount>, options: NodeWorkspaceOptions = {}) {\n const bareResources: Record<string, Resource> = {}\n const modeOverrides: Record<string, MountMode> = { ...(options.modeOverrides ?? {}) }\n const commandSafeguards: Record<string, Record<string, CommandSafeguard>> = {\n ...(options.commandSafeguards ?? {}),\n }\n const fuseTargets: [string, boolean | string][] = []\n for (const [prefix, value] of Object.entries(resources)) {\n if (value instanceof Mount) {\n bareResources[prefix] = value.resource\n if (value.options.mode !== undefined) modeOverrides[prefix] = value.options.mode\n if (value.options.commandSafeguards !== undefined)\n commandSafeguards[prefix] = value.options.commandSafeguards\n if (value.options.fuse !== undefined && value.options.fuse !== false)\n fuseTargets.push([prefix, value.options.fuse])\n } else {\n bareResources[prefix] = value\n }\n }\n super(bareResources, {\n ...options,\n ...(Object.keys(modeOverrides).length > 0 ? { modeOverrides } : {}),\n ...(Object.keys(commandSafeguards).length > 0 ? { commandSafeguards } : {}),\n shellParserFactory: options.shellParserFactory ?? loadShellParser,\n })\n if (fuseTargets.length > 0) {\n // Kick off mounts eagerly; await inside fuseReady() / execute() / close()\n // so callers don't need to await the constructor (Python mirrors this).\n //\n // A failed auto-mount (e.g. libfuse absent on the host) degrades to an\n // unmounted but fully usable workspace, mirroring Python: there the mount\n // runs on a daemon thread so its failure never reaches the main process.\n // On Node's single event loop we swallow it here, otherwise the unhandled\n // rejection would terminate the process under Node's default policy.\n const setups = fuseTargets.map(([prefix, target]) =>\n this.addFuseMount(prefix, typeof target === 'string' ? target : undefined).then(\n () => undefined,\n (err: unknown) => {\n process.stderr.write(\n `mirage: FUSE auto-mount failed for ${prefix}, continuing without it: ${\n err instanceof Error ? err.message : String(err)\n }\\n`,\n )\n },\n ),\n )\n this.fuseSetupPromise = Promise.all(setups).then(() => undefined)\n }\n }\n\n private registerFuseMount(prefix: string, mountpoint: string): void {\n for (const [otherPrefix, otherMp] of this.fuseMountpointsMap) {\n if (otherMp === mountpoint && otherPrefix !== prefix) {\n throw new Error(\n `FUSE mountpoint ${mountpoint} already used by prefix ${otherPrefix}; mounts need distinct paths`,\n )\n }\n }\n this.fuseMountpointsMap.set(prefix, mountpoint)\n }\n\n /**\n * Mount a workspace subtree under FUSE and own its lifecycle. Each mount gets\n * its own {@link FuseManager}, so a workspace can expose any number of FUSE\n * subtrees at once. A pinned mountpoint is collision-checked BEFORE mounting,\n * so a clash never leaves a partial kernel mount.\n */\n async addFuseMount(prefix: string, mountpoint?: string): Promise<string> {\n if (mountpoint !== undefined) this.registerFuseMount(prefix, mountpoint)\n const fm = new FuseManager()\n this.fuseManagers.set(prefix, fm)\n try {\n const mp = await fm.setup(this, {\n rootPrefix: prefix,\n ...(mountpoint !== undefined ? { mountpoint } : {}),\n })\n if (mountpoint === undefined) this.registerFuseMount(prefix, mp)\n return mp\n } catch (err) {\n // The mount never came up; drop the manager and any registered path so\n // fuseMountpoints does not misreport it as live.\n this.fuseManagers.delete(prefix)\n this.fuseMountpointsMap.delete(prefix)\n throw err\n }\n }\n\n async removeFuseMount(prefix: string): Promise<void> {\n const fm = this.fuseManagers.get(prefix)\n this.fuseManagers.delete(prefix)\n if (fm !== undefined) await fm.unmount()\n this.fuseMountpointsMap.delete(prefix)\n }\n\n get fuseMountpoints(): Record<string, string> {\n return Object.fromEntries(this.fuseMountpointsMap)\n }\n\n get fuseMountpoint(): string | null {\n if (this.fuseMountpointsMap.size === 0) return null\n if (this.fuseMountpointsMap.size > 1) {\n throw new Error('multiple FUSE mounts active; use fuseMountpoints to select one by prefix')\n }\n return this.fuseMountpointsMap.values().next().value ?? null\n }\n\n /** Await the eager per-mount fuse mounts started in the constructor. */\n async fuseReady(): Promise<void> {\n if (this.fuseSetupPromise !== null) {\n await this.fuseSetupPromise\n this.fuseSetupPromise = null\n }\n }\n\n override execute(\n command: string,\n options?: ExecuteOptions & { provision?: false | undefined },\n ): Promise<ExecuteResult>\n override execute(\n command: string,\n options: ExecuteOptions & { provision: true },\n ): Promise<ProvisionResult>\n override execute(\n command: string,\n options: ExecuteOptions,\n ): Promise<ExecuteResult | ProvisionResult>\n override async execute(\n command: string,\n options: ExecuteOptions = {},\n ): Promise<ExecuteResult | ProvisionResult> {\n await this.fuseReady()\n return super.execute(command, options)\n }\n\n override async close(): Promise<void> {\n await this.fuseReady().catch(() => undefined)\n for (const fm of this.fuseManagers.values()) await fm.unmount()\n this.fuseManagers.clear()\n this.fuseMountpointsMap.clear()\n await super.close()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { rmdirSync } from 'node:fs'\nimport type { Workspace } from '@struktoai/mirage-core'\nimport { forceUnmount, mount, type FuseHandle, type MountOptions } from '../fuse/mount.ts'\n\nconst SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP'] as const\ntype Signal = (typeof SIGNALS)[number]\ninterface CleanupEntry {\n mountpoint: string\n handle: FuseHandle\n // Cleanup owns only generated temp directories, never explicit mountpoints.\n ownsMountpoint: boolean\n}\n\nfunction removeMountpointIfOwned(entry: { mountpoint: string; ownsMountpoint: boolean }): void {\n if (!entry.ownsMountpoint) return\n try {\n // Empty-directory cleanup only. Recursive removal is unsafe because a\n // still-mounted FUSE path can make deletes hit the mounted backend.\n rmdirSync(entry.mountpoint)\n } catch {\n // mountpoint may still be busy, non-empty, or already gone; caller can retry\n }\n}\n\n/**\n * Tracks auto-mounted FUSE handles and installs a single process-wide cleanup\n * path on SIGINT / SIGTERM / SIGHUP / `process.exit` so the kernel never ends\n * up with a stale mountpoint after the node process dies. Mirrors Python's\n * KeyboardInterrupt → `diskutil unmount force` / `fusermount -u` in mount.py.\n */\nclass FuseCleanupRegistry {\n private readonly mounts = new Set<CleanupEntry>()\n private installed = false\n private exiting = false\n\n register(entry: CleanupEntry): void {\n this.mounts.add(entry)\n this.install()\n }\n\n unregister(entry: CleanupEntry): void {\n this.mounts.delete(entry)\n }\n\n private install(): void {\n if (this.installed) return\n this.installed = true\n for (const sig of SIGNALS) {\n process.on(sig, this.onSignal)\n }\n process.on('beforeExit', this.onExit)\n process.on('exit', this.onExit)\n }\n\n private readonly onSignal = (sig: Signal): void => {\n if (this.exiting) return\n this.exiting = true\n this.drainSync()\n // Re-raise the signal so the default termination action runs after we've\n // unmounted. Node suppresses the default when a listener is attached.\n process.kill(process.pid, sig)\n }\n\n private readonly onExit = (): void => {\n if (this.exiting) return\n this.exiting = true\n this.drainSync()\n }\n\n private drainSync(): void {\n for (const entry of this.mounts) {\n forceUnmount(entry.mountpoint)\n removeMountpointIfOwned(entry)\n }\n this.mounts.clear()\n }\n}\n\nconst CLEANUP = new FuseCleanupRegistry()\n\n// Passive mounting primitive: it mounts a workspace subtree and tears it down.\n// Registry/lifecycle ownership lives on the node Workspace (addFuseMount /\n// removeFuseMount), mirroring Python's FuseManager.\nexport class FuseManager {\n private handle: FuseHandle | null = null\n private cleanupEntry: CleanupEntry | null = null\n\n get mountpoint(): string | null {\n return this.handle?.mountpoint ?? null\n }\n\n async setup(ws: Workspace, options: MountOptions = {}): Promise<string> {\n if (this.handle !== null) return this.handle.mountpoint\n const handle = await mount(ws, options)\n this.handle = handle\n this.cleanupEntry = {\n mountpoint: handle.mountpoint,\n handle,\n // Preserve the ownership decision made by mount(); unmount cleanup must\n // not infer ownership from path shape or whether the directory exists.\n ownsMountpoint: handle.ownsMountpoint,\n }\n CLEANUP.register(this.cleanupEntry)\n return handle.mountpoint\n }\n\n async unmount(): Promise<void> {\n if (this.handle === null) {\n return\n }\n const mp = this.handle.mountpoint\n try {\n await this.handle.unmount()\n } finally {\n const cleanupEntry = this.cleanupEntry\n if (cleanupEntry !== null) {\n CLEANUP.unregister(cleanupEntry)\n this.cleanupEntry = null\n }\n this.handle = null\n removeMountpointIfOwned({\n mountpoint: mp,\n ownsMountpoint: cleanupEntry?.ownsMountpoint ?? false,\n })\n }\n }\n\n async close(): Promise<void> {\n await this.unmount()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { execSync } from 'node:child_process'\nimport { mkdirSync, mkdtempSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { join } from 'node:path'\nimport type { Workspace } from '@struktoai/mirage-core'\nimport { loadOptionalPeer } from '../optional_peer.ts'\nimport { MirageFS } from './fs.ts'\n\nexport interface FuseHandle {\n mountpoint: string\n /** Whether Mirage created this mountpoint directory and may remove it later. */\n ownsMountpoint: boolean\n unmount: () => Promise<void>\n}\n\nexport interface MountOptions {\n /** Caller/deployment-owned mountpoint. Mirage mounts here but does not delete it. */\n mountpoint?: string\n agentId?: string\n /** Scope the mount to a single workspace mount prefix (subtree exposure). */\n rootPrefix?: string\n /**\n * When true, `@zkochan/fuse-native`'s `autoUnmount` flag is set so the\n * kernel releases the mount if the process exits abnormally. Defaults to\n * `true` on Linux, `false` on darwin — macFUSE rejects the option with\n * \"unknown option `auto_unmount'\". On darwin the SIGINT cleanup in\n * FuseManager runs `diskutil unmount force` instead.\n */\n autoUnmount?: boolean\n /** Extra options forwarded verbatim to `@zkochan/fuse-native`. */\n fuseOptions?: Record<string, unknown>\n}\n\ntype FuseConstructor = new (\n mountpoint: string,\n ops: Record<string, unknown>,\n options?: Record<string, unknown>,\n) => {\n mount: (cb: (err: Error | null) => void) => void\n unmount: (cb: (err: Error | null) => void) => void\n}\n\nasync function loadFuse(): Promise<FuseConstructor> {\n const mod = await loadOptionalPeer(\n () => import('@zkochan/fuse-native') as unknown as Promise<{ default?: FuseConstructor }>,\n {\n feature: 'FUSE support',\n packageName: '@zkochan/fuse-native',\n docsUrl: 'https://mirage.dev/typescript/setup/fuse',\n },\n )\n const Fuse = (mod.default ?? mod) as unknown as FuseConstructor\n if (typeof Fuse !== 'function') {\n throw new Error('@zkochan/fuse-native did not export a constructor')\n }\n return Fuse\n}\n\n/** Fallback unmount via platform tools — mirrors Python's SIGINT handler. */\nexport function forceUnmount(mountpoint: string): void {\n try {\n if (process.platform === 'darwin') {\n execSync(`diskutil unmount force ${JSON.stringify(mountpoint)}`, { stdio: 'ignore' })\n } else {\n execSync(`fusermount -u ${JSON.stringify(mountpoint)}`, { stdio: 'ignore' })\n }\n } catch {\n // best-effort; caller already tried the clean path\n }\n}\n\nexport async function mount(ws: Workspace, options: MountOptions = {}): Promise<FuseHandle> {\n const Fuse = await loadFuse()\n let mountpoint: string\n let ownsMountpoint = false\n if (options.mountpoint !== undefined) {\n // Pinned path: create if missing, but keep ownership with the caller.\n mkdirSync(options.mountpoint, { recursive: true })\n mountpoint = options.mountpoint\n } else {\n mountpoint = mkdtempSync(join(tmpdir(), 'mirage-fuse-'))\n ownsMountpoint = true\n }\n const agentId = options.agentId\n const mfs = new MirageFS(ws, {\n ...(agentId !== undefined ? { agentId } : {}),\n ...(options.rootPrefix !== undefined ? { rootPrefix: options.rootPrefix } : {}),\n })\n const autoUnmount = options.autoUnmount ?? process.platform === 'linux'\n // attr_timeout=0 (string: the option serializer drops falsy values) keeps\n // the kernel from caching the UNKNOWN_SIZE_SENTINEL that getattr reports\n // for size-unknown API files; the post-open fstat then reaches fgetattr,\n // which answers with the prefetched real size.\n const fuseOpts: Record<string, unknown> = {\n force: true,\n mkdir: true,\n attrTimeout: '0',\n ...(autoUnmount ? { autoUnmount: true } : {}),\n ...(options.fuseOptions ?? {}),\n }\n const fuse = new Fuse(mountpoint, mfs.ops(), fuseOpts)\n await new Promise<void>((resolve, reject) => {\n fuse.mount((err) => {\n if (err === null) resolve()\n else reject(err)\n })\n })\n return {\n mountpoint,\n ownsMountpoint,\n unmount: () =>\n new Promise<void>((resolve, reject) => {\n fuse.unmount((err) => {\n if (err === null) resolve()\n else reject(err)\n })\n }),\n }\n}\n\nexport function mountBackground(ws: Workspace, options: MountOptions = {}): Promise<FuseHandle> {\n return mount(ws, options)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { FileType, type OpRecord, type Workspace, rstripSlash } from '@struktoai/mirage-core'\nimport { isMacosMetadata } from './platform/macos.ts'\n\nconst ENV_AGENT_ID = 'MIRAGE_AGENT_ID'\nconst MIRAGE_DIR = '/.mirage'\nconst MIRAGE_WHOAMI = '/.mirage/whoami'\n\n// FUSE errno values (negative for fuse-native callbacks; positive for errors thrown).\nconst ENOENT = -2\nconst EACCES = -13\nconst ENOTDIR = -20\nconst EEXIST = -17\nconst ENOTEMPTY = -66 // macOS; Linux is -39 — fuse-native normalizes.\nconst EIO = -5\n\nexport interface FuseAttr {\n mtime: Date\n atime: Date\n ctime: Date\n nlink: number\n size: number\n mode: number\n uid: number\n gid: number\n}\n\ninterface Handle {\n path: string\n data?: Uint8Array\n writeBuf?: [number, Uint8Array][]\n}\n\ninterface PrefetchEntry {\n data: Uint8Array\n expires: number\n}\n\nconst PREFETCH_TTL_MS = 30_000\n\n/**\n * Sentinel size reported by getattr for API-backed files where the resource\n * returns size=null up front (Trello, Linear, Slack…). Python uses libfuse's\n * `direct_io` flag to make the kernel ignore reported size and issue read()\n * regardless; @zkochan/fuse-native doesn't expose direct_io, so we instead\n * report a deliberately-large size. The read handler returns 0 once the\n * actual bytes are exhausted, which surfaces as EOF to userspace.\n *\n * Reporting a real size requires fetching the bytes — fine for `cat`, but\n * disastrous for `ls`/`ls -l` because macOS's FUSE layer calls getattr per\n * directory entry. Using a sentinel keeps `ls` cheap (no API calls) while\n * still letting `cat` work. Once a file has been opened (and its bytes\n * cached), subsequent getattrs return the real size via cachedSize().\n *\n * The cap is bounded by Node's `fs/promises` readFile path: it allocates a\n * buffer of the reported size and converts it to a utf-8 string at the end,\n * which fails with `RangeError: Invalid string length` past V8's ~512 MiB\n * string limit. 100 MiB sits well under that, covers very busy Slack\n * channels' daily history, and bounds Buffer allocation per stat.\n */\nconst UNKNOWN_SIZE_SENTINEL = 100 * 1024 * 1024 // 100 MiB\n\ntype Cb<T> = (code: number, result?: T) => void\n\nfunction classifyError(err: unknown): number {\n const code = (err as { code?: string }).code\n if (code === 'ENOTEMPTY') return ENOTEMPTY\n if (code === 'ENOTDIR') return ENOTDIR\n if (code === 'EACCES') return EACCES\n if (code === 'EEXIST') return EEXIST\n if (code === 'ENOENT') return ENOENT\n const msg = (err instanceof Error ? err.message : String(err)).toLowerCase()\n if (msg.includes('not empty') || msg.includes('enotempty')) return ENOTEMPTY\n if (msg.includes('not a directory') || msg.includes('enotdir')) return ENOTDIR\n if (msg.includes('permission') || msg.includes('eacces') || msg.includes('read-only'))\n return EACCES\n if (msg.includes('file exists') || msg.includes('eexist')) return EEXIST\n if (\n msg.includes('not found') ||\n msg.includes('no such') ||\n msg.includes('enoent') ||\n msg.includes('no mount')\n )\n return ENOENT\n return EIO\n}\n\nexport interface MirageFSOptions {\n agentId?: string\n rootPrefix?: string\n}\n\nexport class MirageFS {\n private readonly ws: Workspace\n readonly agentId: string\n private readonly now: Date\n private readonly root: string\n private readonly prefixes: string[]\n private readonly handles = new Map<number, Handle>()\n // In-memory extended attributes, keyed by FUSE path. Backends have no POSIX\n // xattrs, so these are advisory and never persisted; see setxattr.\n private readonly xattrs = new Map<string, Map<string, Buffer>>()\n private readonly prefetchCache = new Map<string, PrefetchEntry>()\n private readonly prefetchInflight = new Map<string, Promise<Uint8Array | null>>()\n private nextFh = 1\n private readonly uid: number\n private readonly gid: number\n\n constructor(ws: Workspace, options: MirageFSOptions = {}) {\n this.ws = ws\n this.agentId =\n options.agentId ??\n process.env[ENV_AGENT_ID] ??\n `agent-${Math.random().toString(36).slice(2, 10)}`\n this.now = new Date()\n this.root = options.rootPrefix !== undefined ? rstripSlash(options.rootPrefix) : ''\n // When scoped to a single mount, the FUSE root maps onto that mount and\n // there are no virtual intermediate directories to synthesize.\n this.prefixes = this.root === '' ? ws.mounts().map((m) => m.prefix) : []\n this.uid = typeof process.getuid === 'function' ? process.getuid() : 0\n this.gid = typeof process.getgid === 'function' ? process.getgid() : 0\n }\n\n // ── helpers ──────────────────────────────────────────────────────\n\n private resolve(path: string): string {\n if (this.root === '') return path\n return path === '/' ? this.root : this.root + path\n }\n\n private whoamiContent(): Uint8Array {\n const lines = [`agent: ${this.agentId}`, 'cwd: /', `mounts: ${this.prefixes.join(', ')}`]\n return new TextEncoder().encode(lines.join('\\n') + '\\n')\n }\n\n private dirStat(): FuseAttr {\n return {\n mtime: this.now,\n atime: this.now,\n ctime: this.now,\n nlink: 2,\n size: 0,\n mode: 0o040755,\n uid: this.uid,\n gid: this.gid,\n }\n }\n\n private fileStat(size: number): FuseAttr {\n return {\n mtime: this.now,\n atime: this.now,\n ctime: this.now,\n nlink: 1,\n size,\n mode: 0o100644,\n uid: this.uid,\n gid: this.gid,\n }\n }\n\n private isVirtualDir(path: string): boolean {\n const bare = rstripSlash(path)\n const normalized = bare + '/'\n for (const p of this.prefixes) {\n const pBare = rstripSlash(p)\n if (p.startsWith(normalized) || pBare === bare) return true\n }\n return false\n }\n\n private virtualChildren(path: string): string[] {\n const normalized = path === '/' ? '/' : rstripSlash(path) + '/'\n const children = new Set<string>()\n for (const p of this.prefixes) {\n if (p.startsWith(normalized) && p !== normalized) {\n const rest = p.slice(normalized.length)\n const child = rest.split('/')[0]\n if (child !== undefined && child !== '') children.add(child)\n }\n }\n return [...children].sort()\n }\n\n private cachedSize(path: string): number | null {\n for (const ctx of this.handles.values()) {\n if (ctx.path === path && ctx.data !== undefined) return ctx.data.byteLength\n }\n const entry = this.prefetchCache.get(path)\n if (entry !== undefined && entry.expires > Date.now()) return entry.data.byteLength\n return null\n }\n\n private cachedData(path: string): Uint8Array | null {\n for (const ctx of this.handles.values()) {\n if (ctx.path === path && ctx.data !== undefined) return ctx.data\n }\n const entry = this.prefetchCache.get(path)\n if (entry !== undefined && entry.expires > Date.now()) return entry.data\n if (entry !== undefined) this.prefetchCache.delete(path)\n return null\n }\n\n /**\n * Fetch bytes for a size-unknown file and cache them so the immediate\n * getattr → open → read burst (and subsequent stats within the TTL) reuse\n * the same fetch. Required because @zkochan/fuse-native doesn't expose\n * libfuse's `direct_io` flag — without a real size from getattr, the kernel\n * decides the file is empty and never issues read().\n */\n private async prefetch(path: string): Promise<Uint8Array | null> {\n const cached = this.cachedData(path)\n if (cached !== null) return cached\n const inflight = this.prefetchInflight.get(path)\n if (inflight !== undefined) return inflight\n const promise = (async (): Promise<Uint8Array | null> => {\n try {\n const data = await this.ws.fs.readFile(this.resolve(path))\n this.prefetchCache.set(path, { data, expires: Date.now() + PREFETCH_TTL_MS })\n return data\n } catch {\n return null\n } finally {\n this.prefetchInflight.delete(path)\n }\n })()\n this.prefetchInflight.set(path, promise)\n return promise\n }\n\n /** Drain and return accumulated op records (mirrors Python's drain_ops). */\n drainOps(): OpRecord[] {\n const records = [...this.ws.records]\n this.ws.records.length = 0\n return records\n }\n\n private async writeFile(path: string, data: Uint8Array): Promise<void> {\n // Keep FUSE writes on Workspace.dispatch rather than Workspace.fs.writeFile:\n // dispatch is where Mirage enforces mount modes, revision tracking, and\n // post-write invalidation. The lower-level fs helper is useful internally,\n // but using it from FUSE made READ-mode mounts reject create while still\n // allowing buffered overwrite on flush.\n await this.ws.dispatch('write', this.resolve(path), [data])\n }\n\n // ── FUSE op surface (mirrors mfusepy Operations) ─────────────────\n\n ops(): Record<string, unknown> {\n return {\n readdir: this.readdir.bind(this),\n getattr: this.getattr.bind(this),\n fgetattr: this.fgetattr.bind(this),\n open: this.open.bind(this),\n read: this.read.bind(this),\n write: this.write.bind(this),\n create: this.create.bind(this),\n unlink: this.unlink.bind(this),\n mkdir: this.mkdir.bind(this),\n rmdir: this.rmdir.bind(this),\n rename: this.rename.bind(this),\n release: this.release.bind(this),\n truncate: this.truncate.bind(this),\n flush: this.flush.bind(this),\n fsync: this.fsync.bind(this),\n utimens: this.utimens.bind(this),\n chmod: this.chmod.bind(this),\n chown: this.chown.bind(this),\n access: this.access.bind(this),\n setxattr: this.setxattr.bind(this),\n getxattr: this.getxattr.bind(this),\n listxattr: this.listxattr.bind(this),\n removexattr: this.removexattr.bind(this),\n statfs: this.statfs.bind(this),\n }\n }\n\n private getattr(path: string, cb: Cb<FuseAttr>): void {\n void (async () => {\n if (path === '/' || path === MIRAGE_DIR) {\n cb(0, this.dirStat())\n return\n }\n if (path === MIRAGE_WHOAMI) {\n cb(0, this.fileStat(this.whoamiContent().byteLength))\n return\n }\n // macOS Finder/Spotlight probes .DS_Store, ._*, .Spotlight-V100, etc.\n // Reject early to avoid hitting the ops layer.\n const name = path.slice(path.lastIndexOf('/') + 1)\n if (isMacosMetadata(name)) {\n cb(ENOENT)\n return\n }\n if (this.isVirtualDir(path)) {\n cb(0, this.dirStat())\n return\n }\n try {\n const s = await this.ws.fs.stat(this.resolve(path))\n if (s.type === FileType.DIRECTORY) {\n cb(0, this.dirStat())\n return\n }\n let size = s.size\n size ??= this.cachedSize(path) ?? UNKNOWN_SIZE_SENTINEL\n cb(0, this.fileStat(size))\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private fgetattr(path: string, fd: number, cb: Cb<FuseAttr>): void {\n // fstat(fd) after open: the open handler prefetched size-unknown files\n // into the handle, so answer with the real byte length instead of the\n // sentinel that path-based getattr reported before open.\n const ctx = this.handles.get(fd)\n if (ctx?.data !== undefined) {\n cb(0, this.fileStat(ctx.data.byteLength))\n return\n }\n this.getattr(path, cb)\n }\n\n private readdir(path: string, cb: Cb<string[]>): void {\n void (async () => {\n // `/.mirage/` virtual dir — a single pseudo file.\n if (path === MIRAGE_DIR) {\n cb(0, ['.', '..', 'whoami'])\n return\n }\n const names = new Set(this.virtualChildren(path))\n if (path === '/') names.add('.mirage')\n try {\n const entries = await this.ws.fs.readdir(this.resolve(path))\n for (const e of entries) {\n const part = rstripSlash(e).split('/').pop() ?? ''\n if (part !== '' && !isMacosMetadata(part)) names.add(part)\n }\n } catch {\n if (names.size === 0) {\n cb(ENOENT)\n return\n }\n }\n cb(0, ['.', '..', ...[...names].sort()])\n })()\n }\n\n private read(\n path: string,\n fd: number,\n buf: Buffer,\n len: number,\n pos: number,\n cb: (result: number) => void,\n ): void {\n void (async () => {\n if (path === MIRAGE_WHOAMI) {\n const data = this.whoamiContent()\n const slice = data.subarray(pos, pos + len)\n buf.set(slice, 0)\n cb(slice.byteLength)\n return\n }\n const ctx = this.handles.get(fd)\n try {\n // Filetype-aware read: no `raw: true`, so parquet/feather/hdf5/etc.\n // get routed through their read ops and surface as rendered text —\n // matches Python's `self._ops.read(path)` which also goes through\n // filetype dispatch.\n if (ctx !== undefined && ctx.data === undefined) {\n const cached = this.cachedData(path)\n ctx.data = cached ?? (await this.ws.fs.readFile(this.resolve(path)))\n }\n const data =\n ctx?.data ?? this.cachedData(path) ?? (await this.ws.fs.readFile(this.resolve(path)))\n const slice = data.subarray(pos, pos + len)\n buf.set(slice, 0)\n cb(slice.byteLength)\n } catch {\n cb(0)\n }\n })()\n }\n\n private write(\n path: string,\n fd: number,\n buf: Buffer,\n len: number,\n pos: number,\n cb: (result: number) => void,\n ): void {\n const ctx = this.handles.get(fd)\n const data = new Uint8Array(buf.subarray(0, len))\n if (ctx !== undefined) {\n ctx.writeBuf ??= []\n ctx.writeBuf.push([pos, data])\n cb(len)\n return\n }\n void (async () => {\n try {\n let existing: Uint8Array = new Uint8Array(0)\n try {\n existing = await this.ws.fs.readFile(this.resolve(path), { raw: true })\n } catch {\n // file may not exist yet\n }\n let merged = existing\n if (pos > merged.byteLength) {\n // zero-pad from end-of-file up to the write offset (sparse write).\n const padded = new Uint8Array(pos + data.byteLength)\n padded.set(merged, 0)\n padded.set(data, pos)\n merged = padded\n } else {\n const size = Math.max(merged.byteLength, pos + data.byteLength)\n const out = new Uint8Array(size)\n out.set(merged.subarray(0, pos), 0)\n out.set(data, pos)\n if (pos + data.byteLength < merged.byteLength) {\n out.set(merged.subarray(pos + data.byteLength), pos + data.byteLength)\n }\n merged = out\n }\n await this.writeFile(path, merged)\n cb(len)\n } catch {\n cb(0)\n }\n })()\n }\n\n private create(path: string, _mode: number, cb: Cb<number>): void {\n void (async () => {\n try {\n // Route through the resource's `create` op so backends that distinguish\n // \"create empty\" from \"write bytes\" get the right code path. Falls back\n // to writeFile(empty) when the resource doesn't expose `create`.\n try {\n await this.ws.dispatch('create', this.resolve(path))\n } catch (dispatchErr) {\n const msg = (\n dispatchErr instanceof Error ? dispatchErr.message : String(dispatchErr)\n ).toLowerCase()\n if (!msg.includes('no op')) throw dispatchErr\n await this.writeFile(path, new Uint8Array(0))\n }\n const fh = this.nextFh++\n this.handles.set(fh, { path })\n cb(0, fh)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private mkdir(path: string, _mode: number, cb: (code: number) => void): void {\n void (async () => {\n try {\n await this.ws.fs.mkdir(this.resolve(path))\n cb(0)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private unlink(path: string, cb: (code: number) => void): void {\n void (async () => {\n try {\n await this.ws.fs.unlink(this.resolve(path))\n this.xattrs.delete(path)\n cb(0)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private rename(src: string, dst: string, cb: (code: number) => void): void {\n void (async () => {\n try {\n await this.ws.fs.rename(this.resolve(src), this.resolve(dst))\n const moved = this.xattrs.get(src)\n if (moved !== undefined) {\n this.xattrs.delete(src)\n this.xattrs.set(dst, moved)\n }\n cb(0)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private rmdir(path: string, cb: (code: number) => void): void {\n void (async () => {\n try {\n // Detect non-empty directories up front so we can map to ENOTEMPTY\n // cleanly. Message-string sniffing alone (classifyError) is unreliable\n // across backends; check contents first.\n try {\n const entries = await this.ws.fs.readdir(this.resolve(path))\n if (entries.length > 0) {\n cb(ENOTEMPTY)\n return\n }\n } catch {\n // readdir failure — fall through to rmdir and let it raise the real\n // error (e.g. ENOENT for missing path).\n }\n await this.ws.fs.rmdir(this.resolve(path))\n this.xattrs.delete(path)\n cb(0)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private truncate(path: string, size: number, cb: (code: number) => void): void {\n void (async () => {\n try {\n // Prefer the resource's dedicated `truncate` op (atomic on most\n // backends). Fall back to read/resize/write for resources that don't\n // expose one.\n try {\n await this.ws.dispatch('truncate', this.resolve(path), [size])\n } catch (dispatchErr) {\n const msg = (\n dispatchErr instanceof Error ? dispatchErr.message : String(dispatchErr)\n ).toLowerCase()\n if (!msg.includes('no op')) throw dispatchErr\n const data = await this.ws.fs\n .readFile(this.resolve(path), { raw: true })\n .catch(() => new Uint8Array(0))\n const out = new Uint8Array(size)\n out.set(data.subarray(0, Math.min(data.byteLength, size)), 0)\n await this.writeFile(path, out)\n }\n cb(0)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private statfs(_path: string, cb: Cb<Record<string, number>>): void {\n cb(0, {\n bsize: 4096,\n frsize: 4096,\n blocks: 1024 * 1024,\n bfree: 1024 * 1024,\n bavail: 1024 * 1024,\n files: 1_000_000,\n ffree: 1_000_000,\n favail: 1_000_000,\n namemax: 255,\n })\n }\n\n // chmod / chown / utimens / access are no-ops for the filesystem but must\n // validate path existence — callers like `touch`/`chmod` on a missing file\n // should fail with ENOENT, not silently succeed.\n\n private chmod(path: string, _mode: number, cb: (code: number) => void): void {\n this.getattrValidate(path, cb)\n }\n\n private chown(path: string, _uid: number, _gid: number, cb: (code: number) => void): void {\n this.getattrValidate(path, cb)\n }\n\n private utimens(path: string, _atime: Date, _mtime: Date, cb: (code: number) => void): void {\n this.getattrValidate(path, cb)\n }\n\n private access(path: string, _amode: number, cb: (code: number) => void): void {\n this.getattrValidate(path, cb)\n }\n\n // Mirage backends (S3, etc.) have no POSIX extended attributes, so there is\n // nothing to persist xattrs to. We keep them in memory per mount so tools that\n // probe or set xattrs (sandbox runtimes, rsync -aX, tar --xattrs, cp -p, macOS\n // Finder writing com.apple.*) succeed instead of failing with ENOTSUP. The\n // values live only for the mount's lifetime and are never written to the\n // backend.\n private setxattr(\n path: string,\n name: string,\n value: Buffer,\n _position: number,\n _flags: number,\n cb: (code: number) => void,\n ): void {\n this.getattr(path, (code) => {\n if (code !== 0) {\n cb(code)\n return\n }\n let attrs = this.xattrs.get(path)\n if (attrs === undefined) {\n attrs = new Map()\n this.xattrs.set(path, attrs)\n }\n attrs.set(name, Buffer.from(value))\n cb(0)\n })\n }\n\n private getxattr(\n path: string,\n name: string,\n _position: number,\n cb: (code: number, value?: Buffer) => void,\n ): void {\n this.getattr(path, (code) => {\n if (code !== 0) {\n cb(code)\n return\n }\n // A missing value tells fuse-native to report ENOATTR/ENODATA.\n cb(0, this.xattrs.get(path)?.get(name))\n })\n }\n\n private listxattr(path: string, cb: (code: number, list?: string[]) => void): void {\n this.getattr(path, (code) => {\n if (code !== 0) {\n cb(code)\n return\n }\n const attrs = this.xattrs.get(path)\n cb(0, attrs ? [...attrs.keys()] : [])\n })\n }\n\n private removexattr(path: string, name: string, cb: (code: number) => void): void {\n this.getattr(path, (code) => {\n if (code !== 0) {\n cb(code)\n return\n }\n this.xattrs.get(path)?.delete(name)\n cb(0)\n })\n }\n\n private getattrValidate(path: string, cb: (code: number) => void): void {\n // getattr's callback returns 0 on success and a negative errno on failure\n // (FUSE convention). Pass the code straight through so missing paths\n // surface as ENOENT instead of silently succeeding.\n this.getattr(path, (code) => {\n cb(code)\n })\n }\n\n private open(path: string, _flags: number, cb: Cb<number>): void {\n void (async () => {\n if (path === MIRAGE_WHOAMI) {\n const fh = this.nextFh++\n this.handles.set(fh, { path })\n cb(0, fh)\n return\n }\n try {\n const s = await this.ws.fs.stat(this.resolve(path))\n const ctx: Handle = { path }\n if (s.size === null && s.type !== FileType.DIRECTORY) {\n const data = await this.prefetch(path)\n if (data !== null) ctx.data = data\n }\n const fh = this.nextFh++\n this.handles.set(fh, ctx)\n cb(0, fh)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private release(_path: string, fd: number, cb: (code: number) => void): void {\n // Python does NOT flush on release — the kernel always issues flush first.\n // Auto-flushing here would conflict on error paths and hide real failures.\n this.handles.delete(fd)\n cb(0)\n }\n\n private flush(path: string, fd: number, cb: (code: number) => void): void {\n const ctx = this.handles.get(fd)\n if (ctx?.writeBuf === undefined || ctx.writeBuf.length === 0) {\n cb(0)\n return\n }\n const writes = ctx.writeBuf\n ctx.writeBuf = []\n void (async () => {\n try {\n let existing: Uint8Array = new Uint8Array(0)\n try {\n existing = await this.ws.fs.readFile(this.resolve(path), { raw: true })\n } catch {\n // ignore\n }\n let total = existing.byteLength\n for (const [off, chunk] of writes) {\n total = Math.max(total, off + chunk.byteLength)\n }\n const merged = new Uint8Array(total)\n merged.set(existing, 0)\n for (const [off, chunk] of writes) {\n merged.set(chunk, off)\n }\n await this.writeFile(path, merged)\n cb(0)\n } catch (err) {\n cb(classifyError(err))\n }\n })()\n }\n\n private fsync(path: string, _datasync: number, fd: number, cb: (code: number) => void): void {\n this.flush(path, fd, cb)\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nconst MACOS_METADATA: ReadonlySet<string> = new Set([\n '.DS_Store',\n '.Spotlight-V100',\n '.fseventsd',\n '.Trashes',\n])\n\nexport function isMacosMetadata(name: string): boolean {\n return MACOS_METADATA.has(name) || name.startsWith('._')\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { CommandSafeguard, MountMode, Resource } from '@struktoai/mirage-core'\n\nexport interface MountSpecOptions {\n /** Per-mount mode override; falls back to the workspace default when unset. */\n mode?: MountMode\n /** `true` mounts at a temp dir; a string pins the mountpoint to that path. */\n fuse?: boolean | string\n commandSafeguards?: Record<string, CommandSafeguard>\n}\n\nexport class Mount {\n constructor(\n readonly resource: Resource,\n readonly options: MountSpecOptions = {},\n ) {}\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { createRequire } from 'node:module'\nimport { registerCompressionCodec } from '@struktoai/mirage-core'\n\ninterface Bzip2Module {\n compressFile(input: Uint8Array): Uint8Array\n decompressFile(input: Uint8Array): Uint8Array\n}\n\ninterface XzModule {\n compress(input: Uint8Array): Promise<Uint8Array>\n decompress(input: Uint8Array): Promise<Uint8Array>\n}\n\n// compressjs and @napi-rs/lzma are CommonJS; load them via createRequire so\n// the built ESM output resolves their exports without named-import interop\n// pitfalls (mirrors the createRequire usage in workspace.ts).\nconst requireCjs = createRequire(import.meta.url)\nconst { Bzip2 } = requireCjs('compressjs') as { Bzip2: Bzip2Module }\nconst { xz } = requireCjs('@napi-rs/lzma') as { xz: XzModule }\n\nregisterCompressionCodec('bzip2', {\n compress: (bytes) => Promise.resolve(Uint8Array.from(Bzip2.compressFile(bytes))),\n decompress: (bytes) => Promise.resolve(Uint8Array.from(Bzip2.decompressFile(bytes))),\n})\n\nregisterCompressionCodec('xz', {\n compress: async (bytes) => new Uint8Array(await xz.compress(Buffer.from(bytes))),\n decompress: async (bytes) => new Uint8Array(await xz.decompress(Buffer.from(bytes))),\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { appendFile, mkdir, readdir, readFile, rmdir, unlink, writeFile } from 'node:fs/promises'\nimport path from 'node:path'\nimport type { ObserverStore } from '@struktoai/mirage-core'\n\n/**\n * ObserverStore backed by a directory of JSONL files. Created lazily on\n * first append. Mirrors the Python DiskObserverStore.\n */\nexport class DiskObserverStore implements ObserverStore {\n private readonly root: string\n\n constructor(root: string) {\n this.root = root\n }\n\n private abs(key: string): string {\n return path.join(this.root, key.replace(/^\\/+/, ''))\n }\n\n async append(key: string, data: Uint8Array): Promise<void> {\n const absPath = this.abs(key)\n await mkdir(path.dirname(absPath), { recursive: true })\n await appendFile(absPath, data)\n }\n\n async write(key: string, data: Uint8Array): Promise<void> {\n const absPath = this.abs(key)\n await mkdir(path.dirname(absPath), { recursive: true })\n await writeFile(absPath, data)\n }\n\n readAll(): Promise<Map<string, Uint8Array>> {\n return this.readMatching('')\n }\n\n async readMatching(suffix: string): Promise<Map<string, Uint8Array>> {\n const out = new Map<string, Uint8Array>()\n const { files } = await this.walk()\n for (const absPath of files) {\n const rel = '/' + path.relative(this.root, absPath)\n if (!rel.endsWith(suffix)) continue\n out.set(rel, new Uint8Array(await readFile(absPath)))\n }\n return out\n }\n\n async clear(): Promise<void> {\n const { files, dirs } = await this.walk()\n for (const absPath of files) await unlink(absPath)\n for (const d of [...dirs].reverse()) await rmdir(d)\n }\n\n close(): Promise<void> {\n return Promise.resolve()\n }\n\n private async walk(): Promise<{ files: string[]; dirs: string[] }> {\n const files: string[] = []\n const dirs: string[] = []\n const stack: string[] = [this.root]\n while (stack.length > 0) {\n const d = stack.pop()\n if (d === undefined) break\n let entries\n try {\n entries = await readdir(d, { withFileTypes: true })\n } catch {\n continue\n }\n dirs.push(d)\n for (const entry of entries) {\n const full = path.join(d, entry.name)\n if (entry.isDirectory()) stack.push(full)\n else files.push(full)\n }\n }\n return { files, dirs }\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RedisClientType } from 'redis'\nimport type { ObserverStore } from '@struktoai/mirage-core'\nimport { loadOptionalPeer } from '../optional_peer.ts'\n\nexport interface RedisObserverStoreOptions {\n url?: string\n keyPrefix?: string\n}\n\n/**\n * ObserverStore backed by Redis strings (one key per JSONL file).\n *\n * Appends use the atomic Redis APPEND command; an index set tracks which\n * file keys exist so readAll needs no SCAN. Mirrors the Python\n * RedisObserverStore.\n */\nexport class RedisObserverStore implements ObserverStore {\n readonly url: string\n private readonly prefix: string\n private readonly indexKey: string\n private clientPromise: Promise<RedisClientType> | null = null\n\n constructor(options: RedisObserverStoreOptions = {}) {\n this.url = options.url ?? 'redis://localhost:6379/0'\n this.prefix = options.keyPrefix ?? 'mirage:observer:'\n this.indexKey = `${this.prefix}keys`\n }\n\n private async client(): Promise<RedisClientType> {\n this.clientPromise ??= (async () => {\n const mod = await loadOptionalPeer(\n () =>\n import('redis') as unknown as Promise<{\n createClient: (o: { url: string }) => RedisClientType\n }>,\n { feature: 'RedisObserverStore', packageName: 'redis' },\n )\n const c = mod.createClient({\n url: this.url,\n socket: { reconnectStrategy: false },\n } as Parameters<typeof mod.createClient>[0])\n await c.connect()\n return c\n })()\n return this.clientPromise\n }\n\n async append(key: string, data: Uint8Array): Promise<void> {\n const c = await this.client()\n const buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength)\n await c.multi().append(`${this.prefix}${key}`, buf).sAdd(this.indexKey, key).exec()\n }\n\n async write(key: string, data: Uint8Array): Promise<void> {\n const c = await this.client()\n const buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength)\n await c.multi().set(`${this.prefix}${key}`, buf).sAdd(this.indexKey, key).exec()\n }\n\n readAll(): Promise<Map<string, Uint8Array>> {\n return this.readMatching('')\n }\n\n async readMatching(suffix: string): Promise<Map<string, Uint8Array>> {\n const paths = (await this.indexedPaths()).filter((p) => p.endsWith(suffix))\n return this.readPaths(paths)\n }\n\n private async indexedPaths(): Promise<string[]> {\n const c = await this.client()\n const members = await c.sMembers(this.indexKey)\n return [...members].sort()\n }\n\n private async readPaths(paths: string[]): Promise<Map<string, Uint8Array>> {\n const out = new Map<string, Uint8Array>()\n if (paths.length === 0) return out\n const c = await this.client()\n const mod = (await import('redis')) as unknown as {\n RESP_TYPES: { readonly BLOB_STRING: number }\n }\n const mapping: Record<number, unknown> = { [mod.RESP_TYPES.BLOB_STRING]: Buffer }\n const typed = c as unknown as {\n withTypeMapping: (m: Record<number, unknown>) => {\n mGet: (keys: string[]) => Promise<(Buffer | null)[]>\n }\n }\n const values = await typed.withTypeMapping(mapping).mGet(paths.map((p) => `${this.prefix}${p}`))\n paths.forEach((p, i) => {\n const raw = values[i]\n out.set(p, raw === null || raw === undefined ? new Uint8Array() : new Uint8Array(raw))\n })\n return out\n }\n\n async clear(): Promise<void> {\n const c = await this.client()\n const paths = await this.indexedPaths()\n const keys = [...paths.map((p) => `${this.prefix}${p}`), this.indexKey]\n if (keys.length > 0) await c.del(keys)\n }\n\n async close(): Promise<void> {\n if (this.clientPromise === null) return\n const c = await this.clientPromise\n await c.quit()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { Buffer } from 'node:buffer'\nimport { createRequire } from 'node:module'\nimport { FileType, type Workspace } from '@struktoai/mirage-core'\n\nconst requireCjs = createRequire(import.meta.url)\nconst fs = requireCjs('node:fs') as Record<string, unknown>\n// fs-monkey ships no types\nconst fsMonkey = requireCjs('fs-monkey') as {\n patchFs: (vol: unknown, target?: unknown) => void\n}\nconst { patchFs } = fsMonkey\n\ntype Cb<T> = (err: NodeJS.ErrnoException | null, value?: T) => void\n\ntype FsLike = Record<string, unknown>\n\nfunction mountedPath(ws: Workspace, p: string): boolean {\n try {\n return ws.registry.mountFor(p) !== null\n } catch {\n return false\n }\n}\n\nasync function mirageStat(ws: Workspace, p: string): Promise<unknown> {\n const s = await ws.fs.stat(p)\n const isDir = s.type === FileType.DIRECTORY\n const mtime = s.modified !== null ? new Date(s.modified) : new Date(0)\n return {\n isFile: () => !isDir,\n isDirectory: () => isDir,\n isBlockDevice: () => false,\n isCharacterDevice: () => false,\n isSymbolicLink: () => false,\n isFIFO: () => false,\n isSocket: () => false,\n size: s.size ?? 0,\n mtime,\n mtimeMs: mtime.getTime(),\n atime: mtime,\n atimeMs: mtime.getTime(),\n ctime: mtime,\n ctimeMs: mtime.getTime(),\n birthtime: mtime,\n birthtimeMs: mtime.getTime(),\n mode: 0,\n nlink: 1,\n uid: 0,\n gid: 0,\n rdev: 0,\n blksize: 0,\n blocks: 0,\n dev: 0,\n ino: 0,\n }\n}\n\n/**\n * Monkey-patch Node's `fs` module so that paths under any mirage mount\n * route through the workspace. Paths NOT under a mount fall through to\n * the real native fs. CJS-friendly; for ESM code you still need to use\n * `ws.fs.*` directly since ESM bindings are frozen.\n *\n * Returns a `restore()` function that undoes the patch.\n */\nexport function patchNodeFs(ws: Workspace): () => void {\n const originalFs: FsLike = { ...(fs as unknown as FsLike) }\n\n const vol: FsLike = {\n promises: {\n readFile: async (p: string, opts?: { encoding?: BufferEncoding } | BufferEncoding) => {\n if (mountedPath(ws, p)) {\n const bytes = await ws.fs.readFile(p)\n const encoding = typeof opts === 'string' ? opts : opts?.encoding\n if (encoding !== undefined) return Buffer.from(bytes).toString(encoding)\n return Buffer.from(bytes)\n }\n const native = (originalFs.promises as FsLike).readFile as (\n path: string,\n opts?: unknown,\n ) => Promise<Uint8Array | string>\n return native(p, opts)\n },\n writeFile: async (p: string, data: Uint8Array | string): Promise<void> => {\n if (mountedPath(ws, p)) {\n await ws.fs.writeFile(p, typeof data === 'string' ? data : data)\n return\n }\n const native = (originalFs.promises as FsLike).writeFile as (\n path: string,\n data: Uint8Array | string,\n ) => Promise<void>\n await native(p, data)\n },\n readdir: async (p: string): Promise<string[]> => {\n if (mountedPath(ws, p)) {\n // Workspace returns full paths; Node's fs.promises.readdir returns basenames.\n // Strip trailing slash on directory entries before slicing so dirs\n // don't collapse to ''.\n const entries = await ws.fs.readdir(p)\n return entries.map((e) => {\n const trimmed = e.endsWith('/') ? e.slice(0, -1) : e\n return trimmed.slice(trimmed.lastIndexOf('/') + 1)\n })\n }\n const native = (originalFs.promises as FsLike).readdir as (\n path: string,\n ) => Promise<string[]>\n return native(p)\n },\n stat: async (p: string): Promise<unknown> => {\n if (mountedPath(ws, p)) return mirageStat(ws, p)\n const native = (originalFs.promises as FsLike).stat as (path: string) => Promise<unknown>\n return native(p)\n },\n unlink: async (p: string): Promise<void> => {\n if (mountedPath(ws, p)) return ws.fs.unlink(p)\n const native = (originalFs.promises as FsLike).unlink as (path: string) => Promise<void>\n await native(p)\n },\n mkdir: async (p: string): Promise<void> => {\n if (mountedPath(ws, p)) return ws.fs.mkdir(p)\n const native = (originalFs.promises as FsLike).mkdir as (path: string) => Promise<void>\n await native(p)\n },\n rmdir: async (p: string): Promise<void> => {\n if (mountedPath(ws, p)) return ws.fs.rmdir(p)\n const native = (originalFs.promises as FsLike).rmdir as (path: string) => Promise<void>\n await native(p)\n },\n },\n readFileSync: (): Uint8Array => {\n throw new Error('mirage.patchNodeFs: sync fs methods not supported — use fs.promises.*')\n },\n readFile: (p: string, cb: Cb<Uint8Array>) => {\n if (mountedPath(ws, p)) {\n ws.fs\n .readFile(p)\n .then((data) => {\n cb(null, Buffer.from(data))\n })\n .catch((err: unknown) => {\n cb(err as NodeJS.ErrnoException)\n })\n return\n }\n const native = originalFs.readFile as (path: string, cb: Cb<Uint8Array>) => void\n native(p, cb)\n },\n readdir: (p: string, cb: Cb<string[]>) => {\n if (mountedPath(ws, p)) {\n ws.fs\n .readdir(p)\n .then((entries) => {\n cb(\n null,\n entries.map((e) => {\n const trimmed = e.endsWith('/') ? e.slice(0, -1) : e\n return trimmed.slice(trimmed.lastIndexOf('/') + 1)\n }),\n )\n })\n .catch((err: unknown) => {\n cb(err as NodeJS.ErrnoException)\n })\n return\n }\n const native = originalFs.readdir as (path: string, cb: Cb<string[]>) => void\n native(p, cb)\n },\n }\n\n patchFs(vol, fs)\n return function restore(): void {\n for (const [k, v] of Object.entries(originalFs)) {\n const desc = Object.getOwnPropertyDescriptor(fs, k)\n if (desc?.writable === false && desc.set === undefined) continue\n try {\n fs[k] = v\n } catch {\n // some fs properties are accessor-only and can't be reassigned; skip\n }\n }\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type Accessor,\n type CommandOpts,\n type IndexCacheStore,\n type PathSpec,\n Precision,\n ProvisionResult,\n type Resource,\n} from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\nimport { stat as redisStat } from '../../../core/redis/stat.ts'\n\nexport interface RedisResourceLike extends Resource {\n readonly accessor: RedisAccessor\n}\n\ninterface ResolvedSizes {\n resolved: [string, number][]\n missing: number\n}\n\nasync function resolveSizes(\n accessor: RedisAccessor,\n paths: readonly PathSpec[],\n index: IndexCacheStore | undefined,\n): Promise<ResolvedSizes> {\n const resolved: [string, number][] = []\n let missing = 0\n for (const p of paths) {\n const pathStr = p.original\n let size: number | null = null\n if (index !== undefined) {\n const lookup = await index.get(pathStr)\n if (lookup.entry !== undefined && lookup.entry !== null) {\n size = lookup.entry.size\n }\n }\n if (size === null) {\n try {\n const fileStat = await redisStat(accessor, p)\n size = fileStat.size\n } catch {\n // fall through — size stays null\n }\n }\n if (size !== null) {\n resolved.push([pathStr, size])\n } else {\n missing += 1\n }\n }\n return { resolved, missing }\n}\n\nexport async function fileReadProvision(\n accessor: Accessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<ProvisionResult> {\n if (paths.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const { resolved, missing } = await resolveSizes(accessor as RedisAccessor, paths, undefined)\n if (missing > 0 || resolved.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const total = resolved.reduce((sum, [, size]) => sum + size, 0)\n return new ProvisionResult({\n networkReadLow: total,\n networkReadHigh: total,\n readOps: resolved.length,\n precision: Precision.EXACT,\n })\n}\n\nexport async function headTailProvision(\n accessor: Accessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<ProvisionResult> {\n if (paths.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const { resolved, missing } = await resolveSizes(accessor as RedisAccessor, paths, undefined)\n if (missing > 0 || resolved.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const total = resolved.reduce((sum, [, size]) => sum + size, 0)\n return new ProvisionResult({\n networkReadLow: total,\n networkReadHigh: total,\n readOps: resolved.length,\n precision: Precision.EXACT,\n })\n}\n\nexport function metadataProvision(\n _accessor: Accessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): ProvisionResult {\n const n = Math.max(1, paths.length > 0 ? paths.length : 1)\n return new ProvisionResult({\n networkReadLow: 0,\n networkReadHigh: 0,\n readOps: n,\n precision: Precision.EXACT,\n })\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type FileCache,\n defaultFingerprint,\n parseLimit,\n type PathSpec,\n} from '@struktoai/mirage-core'\nimport type { RedisClientType } from 'redis'\nimport { RedisResource, type RedisResourceOptions } from '../../resource/redis/redis.ts'\n\nexport interface RedisFileCacheOptions extends RedisResourceOptions {\n cacheLimit?: string | number\n maxDrainBytes?: number | null\n}\n\nexport class RedisFileCacheStore extends RedisResource implements FileCache {\n private readonly limit: number\n private readonly dataPrefix: string\n private readonly metaPrefix: string\n maxDrainBytes: number | null\n\n constructor(options: RedisFileCacheOptions = {}) {\n super({\n url: options.url ?? 'redis://localhost:6379/0',\n keyPrefix: options.keyPrefix ?? 'mirage:cache:',\n })\n this.limit = parseLimit(options.cacheLimit ?? '512MB')\n this.dataPrefix = `${this.keyPrefix}data:`\n this.metaPrefix = `${this.keyPrefix}meta:`\n this.maxDrainBytes = options.maxDrainBytes ?? null\n }\n\n readonly cacheSize = 0\n\n get cacheLimit(): number {\n return this.limit\n }\n\n cacheClient(): Promise<RedisClientType> {\n return this.store.client()\n }\n\n async get(key: string): Promise<Uint8Array | null> {\n const c = await this.cacheClient()\n const mod = await this.module()\n const blob = mod.RESP_TYPES.BLOB_STRING\n const mapping: Record<number, unknown> = { [blob]: Buffer }\n const typed = c as unknown as {\n withTypeMapping: (m: Record<number, unknown>) => {\n get: (k: string) => Promise<Buffer | null>\n }\n }\n const raw = await typed.withTypeMapping(mapping).get(`${this.dataPrefix}${key}`)\n if (raw === null) return null\n return new Uint8Array(raw.buffer, raw.byteOffset, raw.byteLength)\n }\n\n async set(\n key: string,\n data: Uint8Array,\n options: { fingerprint?: string | null; ttl?: number | null } = {},\n ): Promise<void> {\n const fp = options.fingerprint ?? defaultFingerprint(data)\n const c = await this.cacheClient()\n const dk = `${this.dataPrefix}${key}`\n const mk = `${this.metaPrefix}${key}`\n const pipe = c.multi()\n pipe.set(dk, Buffer.from(data.buffer, data.byteOffset, data.byteLength))\n pipe.set(mk, fp)\n if (options.ttl !== null && options.ttl !== undefined) {\n pipe.expire(dk, options.ttl)\n pipe.expire(mk, options.ttl)\n }\n await pipe.exec()\n }\n\n async add(\n key: string,\n data: Uint8Array,\n options: { fingerprint?: string | null; ttl?: number | null } = {},\n ): Promise<boolean> {\n const c = await this.cacheClient()\n const exists = await c.exists(`${this.dataPrefix}${key}`)\n if (exists) return false\n await this.set(key, data, options)\n return true\n }\n\n async remove(key: string): Promise<void> {\n const c = await this.cacheClient()\n const pipe = c.multi()\n pipe.del(`${this.dataPrefix}${key}`)\n pipe.del(`${this.metaPrefix}${key}`)\n await pipe.exec()\n }\n\n async exists(key: string | PathSpec): Promise<boolean> {\n const k = typeof key === 'string' ? key : key.stripPrefix\n const c = await this.cacheClient()\n return (await c.exists(`${this.dataPrefix}${k}`)) > 0\n }\n\n async isFresh(key: string, remoteFingerprint: string): Promise<boolean> {\n const c = await this.cacheClient()\n const fp = await c.get(`${this.metaPrefix}${key}`)\n if (fp === null) return false\n return fp === remoteFingerprint\n }\n\n async clear(): Promise<void> {\n const c = await this.cacheClient()\n for (const pattern of [`${this.dataPrefix}*`, `${this.metaPrefix}*`]) {\n const batch: string[] = []\n for await (const k of c.scanIterator({ MATCH: pattern })) {\n if (Array.isArray(k)) batch.push(...k)\n else batch.push(k)\n }\n if (batch.length > 0) await c.del(batch)\n }\n }\n\n async allCached(keys: readonly string[]): Promise<boolean> {\n for (const k of keys) {\n if (!(await this.exists(k))) return false\n }\n return true\n }\n\n async multiGet(keys: readonly string[]): Promise<(Uint8Array | null)[]> {\n const out: (Uint8Array | null)[] = []\n for (const k of keys) out.push(await this.get(k))\n return out\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type HfRepoConfig,\n type HfRepoConfigRedacted,\n normalizeHfRepoConfig,\n redactHfRepoConfig,\n} from '../hf_buckets/config.ts'\n\nexport type HfModelsConfig = HfRepoConfig\nexport type HfModelsConfigRedacted = HfRepoConfigRedacted\n\nexport const normalizeHfModelsConfig = normalizeHfRepoConfig\nexport const redactHfModelsConfig = redactHfRepoConfig\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n BaseResource,\n type FileStat,\n LANCEDB_COMMANDS,\n LANCEDB_OPS,\n LANCEDB_PROMPT,\n LanceDBAccessor,\n type LanceDBConfig,\n type LanceDBConfigResolved,\n lanceRead,\n lanceReaddir,\n lanceStat,\n type PathSpec,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n resolveLanceDBConfig,\n} from '@struktoai/mirage-core'\nimport { LanceDBStore } from './store.ts'\n\nconst REMOTE_SCHEMES = ['s3://', 'gs://', 'az://', 'hf://', 'db://']\n\nexport interface LanceDBResourceOptions {\n config: LanceDBConfig\n}\n\nexport class LanceDBResource extends BaseResource implements Resource {\n readonly kind: string = ResourceName.LANCEDB\n readonly cachesReads: boolean\n readonly indexTtl: number = 0\n readonly prompt: string = LANCEDB_PROMPT\n readonly config: LanceDBConfigResolved\n readonly store: LanceDBStore\n readonly accessor: LanceDBAccessor\n\n constructor(options: LanceDBResourceOptions | LanceDBConfig) {\n super()\n const config = 'config' in options ? options.config : options\n this.config = resolveLanceDBConfig(config)\n this.cachesReads = REMOTE_SCHEMES.some((scheme) => this.config.uri.startsWith(scheme))\n this.store = new LanceDBStore(this.config)\n this.accessor = new LanceDBAccessor(this.store, this.config)\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n async close(): Promise<void> {\n await this.store.close()\n }\n\n ops(): readonly RegisteredOp[] {\n return LANCEDB_OPS\n }\n\n commands(): readonly RegisteredCommand[] {\n return LANCEDB_COMMANDS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return lanceRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return lanceReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return lanceStat(this.accessor, p, this.index)\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { Connection, Table } from '@lancedb/lancedb'\nimport {\n loadOptionalPeer,\n type LanceDriver,\n type LanceRow,\n type LanceDBConfigResolved,\n} from '@struktoai/mirage-core'\n\nfunction toStr(value: unknown): string {\n if (value === null || value === undefined) return ''\n if (typeof value === 'object') return JSON.stringify(value)\n return String(value as string | number | boolean | bigint)\n}\n\nfunction eqClause(column: string, value: string): string {\n if (/^-?\\d+$/.test(value)) return `${column} = ${value}`\n return `${column} = '${value.replace(/'/g, \"''\")}'`\n}\n\nfunction whereClause(filters: Record<string, string>): string {\n return Object.entries(filters)\n .map(([col, val]) => eqClause(col, val))\n .join(' AND ')\n}\n\nexport class LanceDBStore implements LanceDriver {\n private readonly config: LanceDBConfigResolved\n private db: Connection | null = null\n private readonly tables = new Map<string, Table>()\n\n constructor(config: LanceDBConfigResolved) {\n this.config = config\n }\n\n private async connection(): Promise<Connection> {\n if (this.db === null) {\n const options: Record<string, unknown> = {}\n if (this.config.apiKey !== null) options.apiKey = this.config.apiKey\n if (this.config.storageOptions !== null) options.storageOptions = this.config.storageOptions\n if (this.config.uri.startsWith('db://')) {\n options.region = this.config.region\n if (this.config.hostOverride !== null) options.hostOverride = this.config.hostOverride\n }\n const { connect } = await loadOptionalPeer(() => import('@lancedb/lancedb'), {\n feature: 'LanceDBResource',\n packageName: '@lancedb/lancedb',\n })\n this.db = await connect(this.config.uri, options)\n }\n return this.db\n }\n\n private async table(name: string): Promise<Table> {\n const cached = this.tables.get(name)\n if (cached !== undefined) return cached\n const db = await this.connection()\n const tbl = await db.openTable(name)\n this.tables.set(name, tbl)\n return tbl\n }\n\n async listTables(): Promise<string[]> {\n const db = await this.connection()\n const names = await db.tableNames()\n return [...names].sort()\n }\n\n async distinct(\n table: string,\n column: string,\n filters: Record<string, string>,\n limit: number,\n ): Promise<string[]> {\n const tbl = await this.table(table)\n let query = tbl.query().select([column]).limit(limit)\n if (Object.keys(filters).length > 0) query = query.where(whereClause(filters))\n const rows = (await query.toArray()) as LanceRow[]\n const values = new Set<string>()\n for (const row of rows) {\n const v = row[column]\n if (v !== null && v !== undefined) values.add(toStr(v))\n }\n return [...values].sort()\n }\n\n async rowsMatching(\n table: string,\n filters: Record<string, string>,\n columns: string[],\n limit: number,\n ): Promise<LanceRow[]> {\n const tbl = await this.table(table)\n let query = tbl.query().select(columns).limit(limit)\n if (Object.keys(filters).length > 0) query = query.where(whereClause(filters))\n return (await query.toArray()) as LanceRow[]\n }\n\n async rowRecord(table: string, idColumn: string, rowId: string): Promise<LanceRow | null> {\n const tbl = await this.table(table)\n const rows = (await tbl\n .query()\n .where(eqClause(idColumn, rowId))\n .limit(1)\n .toArray()) as LanceRow[]\n return rows[0] ?? null\n }\n\n async search(table: string, query: string, limit: number): Promise<LanceRow[]> {\n const tbl = await this.table(table)\n return (await tbl.search(query).limit(limit).toArray()) as LanceRow[]\n }\n\n close(): Promise<void> {\n if (this.db !== null) {\n this.db.close()\n this.db = null\n }\n this.tables.clear()\n return Promise.resolve()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { normalizeFields, type Resource } from '@struktoai/mirage-core'\n\n/**\n * Construct a resource by registry name. Mirrors Python's\n * `mirage.resource.registry.build_resource`.\n *\n * Each entry is an async factory that lazy-imports its module so that\n * importing this file doesn't pull in every backend's dependencies.\n * Only the resource you actually request gets loaded — important for\n * S3/Redis whose peer deps (`@aws-sdk/client-s3`, `redis`) are optional.\n *\n * Configs are normalized from Python-style snake_case (used in YAML and\n * by the Python `mirage.config` loader) to TS-idiomatic camelCase. So\n * the same YAML file works in both Python and TS.\n */\nexport type ResourceFactory = (config: Record<string, unknown>) => Promise<Resource>\n\nconst REGISTRY: Record<string, ResourceFactory> = {\n ram: async (_config) => {\n const { RAMResource } = await import('@struktoai/mirage-core')\n return new RAMResource()\n },\n disk: async (config) => {\n const { DiskResource } = await import('./disk/disk.ts')\n const norm = normalizeFields(config) as { root: string }\n return new DiskResource(norm)\n },\n redis: async (config) => {\n const { RedisResource } = await import('./redis/redis.ts')\n const norm = normalizeFields(config)\n return new RedisResource(norm)\n },\n s3: async (config) => {\n const { S3Resource } = await import('./s3/s3.ts')\n const { normalizeS3Config } = await import('./s3/config.ts')\n return new S3Resource(normalizeS3Config(config))\n },\n gcs: async (config) => {\n const { GCSResource } = await import('./gcs/gcs.ts')\n const { normalizeGcsConfig } = await import('./gcs/config.ts')\n return new GCSResource(normalizeGcsConfig(config))\n },\n oci: async (config) => {\n const { OCIResource } = await import('./oci/oci.ts')\n const { normalizeOciConfig } = await import('./oci/config.ts')\n return new OCIResource(normalizeOciConfig(config))\n },\n r2: async (config) => {\n const { R2Resource } = await import('./r2/r2.ts')\n const { normalizeR2Config } = await import('./r2/config.ts')\n return new R2Resource(normalizeR2Config(config))\n },\n hf_buckets: async (config) => {\n const { HfBucketsResource } = await import('./hf_buckets/hf_buckets.ts')\n const { normalizeHfBucketsConfig } = await import('./hf_buckets/config.ts')\n return new HfBucketsResource(normalizeHfBucketsConfig(config))\n },\n hf_datasets: async (config) => {\n const { HfDatasetsResource } = await import('./hf_datasets/hf_datasets.ts')\n const { normalizeHfRepoConfig } = await import('./hf_buckets/config.ts')\n return new HfDatasetsResource(normalizeHfRepoConfig(config))\n },\n hf_models: async (config) => {\n const { HfModelsResource } = await import('./hf_models/hf_models.ts')\n const { normalizeHfRepoConfig } = await import('./hf_buckets/config.ts')\n return new HfModelsResource(normalizeHfRepoConfig(config))\n },\n hf_spaces: async (config) => {\n const { HfSpacesResource } = await import('./hf_spaces/hf_spaces.ts')\n const { normalizeHfRepoConfig } = await import('./hf_buckets/config.ts')\n return new HfSpacesResource(normalizeHfRepoConfig(config))\n },\n supabase: async (config) => {\n const { SupabaseResource } = await import('./supabase/supabase.ts')\n const { normalizeSupabaseConfig } = await import('./supabase/config.ts')\n return new SupabaseResource(normalizeSupabaseConfig(config))\n },\n databricks_volume: async (config) => {\n const { DatabricksVolumeResource } = await import('./databricks_volume/databricks_volume.ts')\n const { normalizeDatabricksVolumeConfig } = await import('@struktoai/mirage-core')\n return DatabricksVolumeResource.create(normalizeDatabricksVolumeConfig(config))\n },\n minio: async (config) => {\n const { MinIOResource } = await import('./minio/minio.ts')\n const { normalizeMinIOConfig } = await import('./minio/config.ts')\n return new MinIOResource(normalizeMinIOConfig(config))\n },\n ceph: async (config) => {\n const { CephResource } = await import('./ceph/ceph.ts')\n const { normalizeCephConfig } = await import('./ceph/config.ts')\n return new CephResource(normalizeCephConfig(config))\n },\n seaweedfs: async (config) => {\n const { SeaweedFSResource } = await import('./seaweedfs/seaweedfs.ts')\n const { normalizeSeaweedFSConfig } = await import('./seaweedfs/config.ts')\n return new SeaweedFSResource(normalizeSeaweedFSConfig(config))\n },\n wasabi: async (config) => {\n const { WasabiResource } = await import('./wasabi/wasabi.ts')\n const { normalizeWasabiConfig } = await import('./wasabi/config.ts')\n return new WasabiResource(normalizeWasabiConfig(config))\n },\n backblaze: async (config) => {\n const { BackblazeResource } = await import('./backblaze/backblaze.ts')\n const { normalizeBackblazeConfig } = await import('./backblaze/config.ts')\n return new BackblazeResource(normalizeBackblazeConfig(config))\n },\n digitalocean: async (config) => {\n const { DigitalOceanResource } = await import('./digitalocean/digitalocean.ts')\n const { normalizeDigitalOceanConfig } = await import('./digitalocean/config.ts')\n return new DigitalOceanResource(normalizeDigitalOceanConfig(config))\n },\n tencent: async (config) => {\n const { TencentResource } = await import('./tencent/tencent.ts')\n const { normalizeTencentConfig } = await import('./tencent/config.ts')\n return new TencentResource(normalizeTencentConfig(config))\n },\n aliyun: async (config) => {\n const { AliyunResource } = await import('./aliyun/aliyun.ts')\n const { normalizeAliyunConfig } = await import('./aliyun/config.ts')\n return new AliyunResource(normalizeAliyunConfig(config))\n },\n scaleway: async (config) => {\n const { ScalewayResource } = await import('./scaleway/scaleway.ts')\n const { normalizeScalewayConfig } = await import('./scaleway/config.ts')\n return new ScalewayResource(normalizeScalewayConfig(config))\n },\n qingstor: async (config) => {\n const { QingStorResource } = await import('./qingstor/qingstor.ts')\n const { normalizeQingStorConfig } = await import('./qingstor/config.ts')\n return new QingStorResource(normalizeQingStorConfig(config))\n },\n postgres: async (config) => {\n const { PostgresResource } = await import('./postgres/postgres.ts')\n const { normalizePostgresConfig } = await import('@struktoai/mirage-core')\n return new PostgresResource(normalizePostgresConfig(config))\n },\n mongodb: async (config) => {\n const { MongoDBResource } = await import('./mongodb/mongodb.ts')\n const { normalizeMongoDBConfig } = await import('@struktoai/mirage-core')\n return new MongoDBResource(normalizeMongoDBConfig(config))\n },\n slack: async (config) => {\n const { SlackResource } = await import('./slack/slack.ts')\n const { normalizeSlackConfig } = await import('./slack/config.ts')\n return new SlackResource(normalizeSlackConfig(config))\n },\n ssh: async (config) => {\n const { SSHResource } = await import('./ssh/ssh.ts')\n const { normalizeSshConfig } = await import('./ssh/config.ts')\n return new SSHResource(normalizeSshConfig(config))\n },\n discord: async (config) => {\n const { DiscordResource } = await import('./discord/discord.ts')\n const { normalizeDiscordConfig } = await import('./discord/config.ts')\n return new DiscordResource(normalizeDiscordConfig(config))\n },\n trello: async (config) => {\n const { TrelloResource } = await import('./trello/trello.ts')\n const { normalizeTrelloConfig } = await import('./trello/config.ts')\n return new TrelloResource(normalizeTrelloConfig(config))\n },\n linear: async (config) => {\n const { LinearResource } = await import('./linear/linear.ts')\n const { normalizeLinearConfig } = await import('./linear/config.ts')\n return new LinearResource(normalizeLinearConfig(config))\n },\n notion: async (config) => {\n const { NotionResource } = await import('./notion/notion.ts')\n const { normalizeNotionConfig } = await import('./notion/config.ts')\n return new NotionResource(normalizeNotionConfig(config))\n },\n langfuse: async (config) => {\n const { LangfuseResource } = await import('./langfuse/langfuse.ts')\n const { normalizeLangfuseConfig } = await import('./langfuse/config.ts')\n return new LangfuseResource(normalizeLangfuseConfig(config))\n },\n github: async (config) => {\n const { GitHubResource } = await import('./github/github.ts')\n const { normalizeGitHubConfig } = await import('./github/config.ts')\n return GitHubResource.create(normalizeGitHubConfig(config))\n },\n github_ci: async (config) => {\n const { GitHubCIResource } = await import('./github_ci/github_ci.ts')\n const { normalizeGitHubCIConfig } = await import('./github_ci/config.ts')\n return new GitHubCIResource(normalizeGitHubCIConfig(config))\n },\n gdocs: async (config) => {\n const { GDocsResource } = await import('./gdocs/gdocs.ts')\n const { normalizeGDocsConfig } = await import('./gdocs/config.ts')\n return new GDocsResource(normalizeGDocsConfig(config))\n },\n gsheets: async (config) => {\n const { GSheetsResource } = await import('./gsheets/gsheets.ts')\n const { normalizeGSheetsConfig } = await import('./gsheets/config.ts')\n return new GSheetsResource(normalizeGSheetsConfig(config))\n },\n gslides: async (config) => {\n const { GSlidesResource } = await import('./gslides/gslides.ts')\n const { normalizeGSlidesConfig } = await import('./gslides/config.ts')\n return new GSlidesResource(normalizeGSlidesConfig(config))\n },\n gdrive: async (config) => {\n const { GDriveResource } = await import('./gdrive/gdrive.ts')\n const { normalizeGDriveConfig } = await import('./gdrive/config.ts')\n return new GDriveResource(normalizeGDriveConfig(config))\n },\n dropbox: async (config) => {\n const { DropboxResource } = await import('./dropbox/dropbox.ts')\n const { normalizeDropboxConfig } = await import('./dropbox/config.ts')\n return new DropboxResource(normalizeDropboxConfig(config))\n },\n box: async (config) => {\n const { BoxResource } = await import('./box/box.ts')\n const { normalizeBoxConfig } = await import('./box/config.ts')\n return new BoxResource(normalizeBoxConfig(config))\n },\n gmail: async (config) => {\n const { GmailResource } = await import('./gmail/gmail.ts')\n const { normalizeGmailConfig } = await import('./gmail/config.ts')\n return new GmailResource(normalizeGmailConfig(config))\n },\n email: async (config) => {\n const { EmailResource } = await import('./email/email.ts')\n const { normalizeEmailConfig } = await import('./email/config.ts')\n return new EmailResource(normalizeEmailConfig(config))\n },\n}\n\n/**\n * Look up the registered names. Lazily-mutated by `register()` so users\n * can extend the registry with custom resources.\n */\nexport function knownResources(): string[] {\n return Object.keys(REGISTRY).sort()\n}\n\n/**\n * Register a custom resource factory under `name`. Existing entries\n * are overwritten, mirroring Python's mutable REGISTRY dict.\n */\nexport function register(name: string, factory: ResourceFactory): void {\n REGISTRY[name] = factory\n}\n\n/**\n * Build a resource instance by registry name. Throws if the name is\n * unknown.\n */\nexport async function buildResource(\n name: string,\n config: Record<string, unknown> = {},\n): Promise<Resource> {\n const factory = REGISTRY[name]\n if (factory === undefined) {\n throw new Error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AO,IAAID,aAAYC,oBAAmB,MAAM,CAAC;AAAA,EACnD;AAAA,EACA,OAAO,OAAO,WAAW;AACvB,UAAM,EAAE,eAAAC,eAAc,IAAI,MAAM,OAAO,qBAAkB;AACzD,UAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,sBAAmB;AACjE,WAAO,IAAIA,eAAc,qBAAqB,MAAM,CAAC;AAAA,EACvD;AAAA,EACA,OAAO,OAAO,WAAW;AACvB,UAAM,EAAE,eAAAC,eAAc,IAAI,MAAM,OAAO,qBAAkB;AACzD,UAAM,EAAE,sBAAAC,sBAAqB,IAAI,MAAM,OAAO,sBAAmB;AACjE,WAAO,IAAID,eAAcC,sBAAqB,MAAM,CAAC;AAAA,EACvD;AACF;AAMO,SAAS,iBAA2B;AACzC,SAAO,OAAO,KAAK,QAAQ,EAAE,KAAK;AACpC;AAMO,SAAS,SAAS,MAAc,SAAgC;AACrE,WAAS,IAAI,IAAI;AACnB;AAMA,eAAsB,cACpB,MACA,SAAkC,CAAC,GAChB;AACnB,QAAM,UAAU,SAAS,IAAI;AAC7B,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR,oBAAoB,KAAK,UAAU,IAAI,CAAC,YAAY,eAAe,EAAE,KAAK,IAAI,CAAC;AAAA,IACjF;AAAA,EACF;AACA,SAAO,QAAQ,MAAM;AACvB;","names":["createRequire","path","requireCjs","createRequire","Buffer","createRequire","FileType","requireCjs","loadOptionalPeer","DiskResource","RedisResource","S3Resource","GCSResource","OCIResource","R2Resource","HfBucketsResource","normalizeHfBucketsConfig","HfDatasetsResource","normalizeHfRepoConfig","HfModelsResource","HfSpacesResource","SupabaseResource","DatabricksVolumeResource","MinIOResource","CephResource","SeaweedFSResource","WasabiResource","BackblazeResource","DigitalOceanResource","TencentResource","AliyunResource","ScalewayResource","QingStorResource","PostgresResource","MongoDBResource","SlackResource","normalizeSlackConfig","SSHResource","normalizeSshConfig","DiscordResource","normalizeDiscordConfig","TrelloResource","normalizeTrelloConfig","LinearResource","normalizeLinearConfig","NotionResource","normalizeNotionConfig","LangfuseResource","normalizeLangfuseConfig","GitHubResource","normalizeGitHubConfig","GitHubCIResource","normalizeGitHubCIConfig","GDocsResource","normalizeGDocsConfig","GSheetsResource","normalizeGSheetsConfig","GSlidesResource","normalizeGSlidesConfig","GDriveResource","normalizeGDriveConfig","DropboxResource","normalizeDropboxConfig","BoxResource","normalizeBoxConfig","GmailResource","EmailResource","normalizeEmailConfig"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/workspace.ts","../src/workspace/fuse.ts","../src/fuse/mount.ts","../src/fuse/backend.ts","../src/fuse/fs.ts","../src/fuse/core.ts","../src/fuse/errors.ts","../src/fuse/platform/macos.ts","../src/workspace/mount_spec.ts","../src/compression_codecs.ts","../src/runtime/sandbox/daytona/runtime.ts","../src/runtime/sandbox/daytona/config.ts","../src/observe/disk_store.ts","../src/observe/redis_store.ts","../src/shell/console/redis/store.ts","../src/shell/console/redis/constants.ts","../src/workspace/namespace/disk.ts","../src/workspace/record/disk.ts","../src/workspace/namespace/redis.ts","../src/workspace/session/disk.ts","../src/workspace/session/redis.ts","../src/workspace/store/disk.ts","../src/workspace/store/redis.ts","../src/fs_monkey.ts","../src/commands/builtin/redis/provision.ts","../src/cache/redis/file.ts","../src/resource/hf_models/config.ts","../src/commands/cli/builtin/himalaya/index.ts","../src/commands/cli/builtin/himalaya/compose.ts","../src/commands/cli/builtin/himalaya/util.ts","../src/commands/cli/builtin/himalaya/builder.ts","../src/commands/cli/builtin/himalaya/smtp.ts","../src/commands/cli/builtin/himalaya/deliver.ts","../src/commands/cli/builtin/himalaya/forward.ts","../src/commands/cli/builtin/himalaya/list.ts","../src/commands/cli/builtin/himalaya/query.ts","../src/commands/cli/builtin/himalaya/read.ts","../src/commands/cli/builtin/himalaya/reply.ts","../src/commands/cli/builtin/himalaya/search.ts","../src/commands/cli/builtin/himalaya/send.ts","../src/runtime/python/local.ts","../src/runtime/sandbox/e2b/runtime.ts","../src/runtime/sandbox/e2b/config.ts","../src/runtime/sandbox/docker/runtime.ts","../src/runtime/sandbox/docker/config.ts","../src/runtime/sandbox/docker/constants.ts","../src/resource/registry.ts","../src/resource/loader.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport * from '@struktoai/mirage-core'\nexport { Workspace, type NodeWorkspaceOptions } from './workspace.ts'\nexport { Mount, type MountSpecOptions } from './workspace/mount_spec.ts'\nexport {\n DiskResource,\n type DiskResourceOptions,\n type DiskResourceState,\n} from './resource/disk/disk.ts'\nexport { DISK_PROMPT } from './resource/disk/prompt.ts'\nexport { DISK_OPS } from './ops/disk/index.ts'\nexport { DiskObserverStore } from './observe/disk_store.ts'\nexport { RedisObserverStore, type RedisObserverStoreOptions } from './observe/redis_store.ts'\nexport { RedisConsoleStore, type RedisConsoleStoreOptions } from './shell/console/redis/index.ts'\nexport { DiskNamespaceStore } from './workspace/namespace/disk.ts'\nexport {\n RedisNamespaceStore,\n type RedisNamespaceStoreOptions,\n} from './workspace/namespace/redis.ts'\nexport { DiskRecordClient } from './workspace/record/disk.ts'\nexport { DiskSessionStore } from './workspace/session/disk.ts'\nexport { RedisSessionStore, type RedisSessionStoreOptions } from './workspace/session/redis.ts'\nexport {\n DEFAULT_STATE_ROOT,\n DiskWorkspaceStateStore,\n type DiskWorkspaceStateStoreOptions,\n} from './workspace/store/disk.ts'\nexport {\n RedisWorkspaceStateStore,\n type RedisWorkspaceStateStoreOptions,\n} from './workspace/store/redis.ts'\nexport { patchNodeFs } from './fs_monkey.ts'\nexport {\n RedisResource,\n type RedisResourceOptions,\n type RedisResourceState,\n} from './resource/redis/redis.ts'\nexport { REDIS_PROMPT } from './resource/redis/prompt.ts'\nexport { RedisStore, type RedisStoreOptions } from './resource/redis/store.ts'\nexport { RedisAccessor } from './accessor/redis.ts'\nexport { REDIS_OPS } from './ops/redis/index.ts'\nexport {\n fileReadProvision,\n headTailProvision,\n metadataProvision,\n type RedisResourceLike,\n} from './commands/builtin/redis/provision.ts'\nexport { RedisFileCacheStore, type RedisFileCacheOptions } from './cache/redis/file.ts'\nexport { FuseManager } from './workspace/fuse.ts'\nexport { MirageFS, type MirageFSOptions, type FuseAttr } from './fuse/fs.ts'\nexport { MountCore, type MountCoreOptions } from './fuse/core.ts'\nexport { classifyErrno, classifyError } from './fuse/errors.ts'\nexport {\n checkMountpoint,\n checkPlatform,\n checkSizes,\n FSKIT_MOUNT_ROOT,\n prepareBackend,\n requireKernelBackend,\n resolveBackend,\n unsizedMounts,\n} from './fuse/backend.ts'\nexport {\n mount as fuseMount,\n mountBackground as fuseMountBackground,\n type FuseHandle,\n type MountOptions as FuseMountOptions,\n} from './fuse/mount.ts'\nexport { isMacosMetadata } from './fuse/platform/macos.ts'\nexport { S3Resource, type S3ResourceState } from './resource/s3/s3.ts'\nexport { GridFSResource, type GridFSResourceState } from './resource/gridfs/gridfs.ts'\nexport {\n normalizeGridFSConfig,\n type GridFSConfig,\n type GridFSConfigRedacted,\n} from './resource/gridfs/config.ts'\nexport { GridFSAccessor } from './accessor/gridfs.ts'\nexport {\n DatabricksVolumeResource,\n type DatabricksVolumeResourceState,\n} from './resource/databricks_volume/databricks_volume.ts'\nexport {\n loadDatabricksProfile,\n parseDatabricksCfg,\n type DatabricksProfile,\n} from './resource/databricks_volume/profile.ts'\nexport {\n normalizeS3Config,\n redactConfig as redactS3Config,\n type S3Config,\n type S3ConfigRedacted,\n} from './resource/s3/config.ts'\nexport { GCSResource, type GCSResourceState } from './resource/gcs/gcs.ts'\nexport {\n GCS_ENDPOINT,\n redactGcsConfig,\n type GCSConfig,\n type GCSConfigRedacted,\n} from './resource/gcs/config.ts'\nexport { GCS_PROMPT } from './resource/gcs/prompt.ts'\nexport { OCIResource, type OCIResourceState } from './resource/oci/oci.ts'\nexport { redactOciConfig, type OCIConfig, type OCIConfigRedacted } from './resource/oci/config.ts'\nexport { OCI_PROMPT } from './resource/oci/prompt.ts'\nexport { R2Resource, type R2ResourceState } from './resource/r2/r2.ts'\nexport { redactR2Config, type R2Config, type R2ConfigRedacted } from './resource/r2/config.ts'\nexport { R2_PROMPT } from './resource/r2/prompt.ts'\nexport { SupabaseResource, type SupabaseResourceState } from './resource/supabase/supabase.ts'\nexport {\n redactSupabaseConfig,\n resolvedSupabaseEndpoint,\n type SupabaseConfig,\n type SupabaseConfigRedacted,\n} from './resource/supabase/config.ts'\nexport { SUPABASE_PROMPT } from './resource/supabase/prompt.ts'\nexport {\n HF_RESOURCES,\n HfAccessor,\n HfBucketsAccessor,\n HfDatasetsAccessor,\n HfModelsAccessor,\n HfSpacesAccessor,\n} from './accessor/hf.ts'\nexport { HfBucketsResource, type HfBucketsResourceState } from './resource/hf_buckets/hf_buckets.ts'\nexport {\n assertHfRepoId,\n HF_ENDPOINT,\n normalizeHfBucketsConfig,\n normalizeHfRepoConfig,\n redactHfBucketsConfig,\n redactHfRepoConfig,\n type HfBucketsConfig,\n type HfBucketsConfigRedacted,\n type HfRepoConfig,\n type HfRepoConfigRedacted,\n} from './resource/hf_buckets/config.ts'\nexport { HF_BUCKETS_PROMPT } from './resource/hf_buckets/prompt.ts'\nexport {\n HfDatasetsResource,\n type HfDatasetsResourceState,\n} from './resource/hf_datasets/hf_datasets.ts'\nexport { HF_DATASETS_PROMPT } from './resource/hf_datasets/prompt.ts'\nexport { HfModelsResource, type HfModelsResourceState } from './resource/hf_models/hf_models.ts'\nexport {\n normalizeHfModelsConfig,\n redactHfModelsConfig,\n type HfModelsConfig,\n type HfModelsConfigRedacted,\n} from './resource/hf_models/config.ts'\nexport { HF_MODELS_PROMPT } from './resource/hf_models/prompt.ts'\nexport { HfSpacesResource, type HfSpacesResourceState } from './resource/hf_spaces/hf_spaces.ts'\nexport { HF_SPACES_PROMPT } from './resource/hf_spaces/prompt.ts'\nexport { HF_COMMANDS } from './commands/builtin/hf/index.ts'\nexport { HF_OPS } from './ops/hf/index.ts'\nexport { MinIOResource, type MinIOResourceState } from './resource/minio/minio.ts'\nexport {\n redactMinIOConfig,\n type MinIOConfig,\n type MinIOConfigRedacted,\n} from './resource/minio/config.ts'\nexport { MINIO_PROMPT } from './resource/minio/prompt.ts'\nexport { SeaweedFSResource, type SeaweedFSResourceState } from './resource/seaweedfs/seaweedfs.ts'\nexport {\n redactSeaweedFSConfig,\n type SeaweedFSConfig,\n type SeaweedFSConfigRedacted,\n} from './resource/seaweedfs/config.ts'\nexport { SEAWEEDFS_PROMPT } from './resource/seaweedfs/prompt.ts'\nexport { CephResource, type CephResourceState } from './resource/ceph/ceph.ts'\nexport {\n redactCephConfig,\n type CephConfig,\n type CephConfigRedacted,\n} from './resource/ceph/config.ts'\nexport { CEPH_PROMPT } from './resource/ceph/prompt.ts'\nexport { WasabiResource, type WasabiResourceState } from './resource/wasabi/wasabi.ts'\nexport {\n redactWasabiConfig,\n resolvedWasabiEndpoint,\n type WasabiConfig,\n type WasabiConfigRedacted,\n} from './resource/wasabi/config.ts'\nexport { WASABI_PROMPT } from './resource/wasabi/prompt.ts'\nexport { BackblazeResource, type BackblazeResourceState } from './resource/backblaze/backblaze.ts'\nexport {\n redactBackblazeConfig,\n resolvedBackblazeEndpoint,\n type BackblazeConfig,\n type BackblazeConfigRedacted,\n} from './resource/backblaze/config.ts'\nexport { BACKBLAZE_PROMPT } from './resource/backblaze/prompt.ts'\nexport {\n DigitalOceanResource,\n type DigitalOceanResourceState,\n} from './resource/digitalocean/digitalocean.ts'\nexport {\n redactDigitalOceanConfig,\n resolvedDigitalOceanEndpoint,\n type DigitalOceanConfig,\n type DigitalOceanConfigRedacted,\n} from './resource/digitalocean/config.ts'\nexport { DIGITALOCEAN_PROMPT } from './resource/digitalocean/prompt.ts'\nexport { TencentResource, type TencentResourceState } from './resource/tencent/tencent.ts'\nexport {\n redactTencentConfig,\n resolvedTencentEndpoint,\n type TencentConfig,\n type TencentConfigRedacted,\n} from './resource/tencent/config.ts'\nexport { TENCENT_PROMPT } from './resource/tencent/prompt.ts'\nexport { AliyunResource, type AliyunResourceState } from './resource/aliyun/aliyun.ts'\nexport {\n redactAliyunConfig,\n resolvedAliyunEndpoint,\n type AliyunConfig,\n type AliyunConfigRedacted,\n} from './resource/aliyun/config.ts'\nexport { ALIYUN_PROMPT } from './resource/aliyun/prompt.ts'\nexport { ScalewayResource, type ScalewayResourceState } from './resource/scaleway/scaleway.ts'\nexport {\n redactScalewayConfig,\n resolvedScalewayEndpoint,\n type ScalewayConfig,\n type ScalewayConfigRedacted,\n} from './resource/scaleway/config.ts'\nexport { SCALEWAY_PROMPT } from './resource/scaleway/prompt.ts'\nexport { QingStorResource, type QingStorResourceState } from './resource/qingstor/qingstor.ts'\nexport {\n redactQingStorConfig,\n resolvedQingStorEndpoint,\n type QingStorConfig,\n type QingStorConfigRedacted,\n} from './resource/qingstor/config.ts'\nexport { QINGSTOR_PROMPT } from './resource/qingstor/prompt.ts'\nexport { PostgresResource, type PostgresResourceOptions } from './resource/postgres/postgres.ts'\nexport { PostgresStore } from './resource/postgres/store.ts'\nexport { MongoDBResource, type MongoDBResourceOptions } from './resource/mongodb/mongodb.ts'\nexport { MongoDBStore } from './resource/mongodb/store.ts'\nexport { LanceDBResource, type LanceDBResourceOptions } from './resource/lancedb/lancedb.ts'\nexport { LanceDBStore } from './resource/lancedb/store.ts'\nexport { SlackResource, type SlackResourceState } from './resource/slack/slack.ts'\nexport {\n normalizeSlackConfig,\n redactSlackConfig,\n type SlackConfig,\n type SlackConfigRedacted,\n} from '@struktoai/mirage-core'\nexport { SSHResource, type SSHResourceState } from './resource/ssh/ssh.ts'\nexport {\n normalizeSshConfig,\n redactSshConfig,\n type SSHConfig,\n type SSHConfigRedacted,\n} from './resource/ssh/config.ts'\nexport { SSHAccessor } from './accessor/ssh.ts'\nexport { SSH_PROMPT } from './resource/ssh/prompt.ts'\nexport { SSH_COMMANDS } from './commands/builtin/ssh/index.ts'\nexport { SSH_OPS } from './ops/ssh/index.ts'\nexport { NextcloudAccessor } from './accessor/nextcloud.ts'\nexport { NextcloudResource, type NextcloudResourceState } from './resource/nextcloud/nextcloud.ts'\nexport {\n normalizeNextcloudConfig,\n redactNextcloudConfig,\n type NextcloudConfig,\n type NextcloudConfigRedacted,\n} from './resource/nextcloud/config.ts'\nexport { NEXTCLOUD_PROMPT } from './resource/nextcloud/prompt.ts'\nexport { NEXTCLOUD_COMMANDS } from './commands/builtin/nextcloud/index.ts'\nexport { NEXTCLOUD_OPS } from './ops/nextcloud/index.ts'\nexport { buildDeltaHook as buildNextcloudDeltaHook, NextcloudWalk } from './core/nextcloud/watch.ts'\nexport { DiscordResource, type DiscordResourceState } from './resource/discord/discord.ts'\nexport {\n normalizeDiscordConfig,\n redactDiscordConfig,\n type DiscordConfig,\n type DiscordConfigRedacted,\n} from '@struktoai/mirage-core'\nexport { TrelloResource, type TrelloResourceState } from './resource/trello/trello.ts'\nexport {\n normalizeTrelloConfig,\n redactTrelloConfig,\n type TrelloConfig,\n type TrelloConfigRedacted,\n} from './resource/trello/config.ts'\nexport { LinearResource, type LinearResourceState } from './resource/linear/linear.ts'\nexport {\n normalizeLinearConfig,\n redactLinearConfig,\n type LinearConfig,\n type LinearConfigRedacted,\n} from '@struktoai/mirage-core'\nexport { NotionResource, type NotionResourceState } from './resource/notion/notion.ts'\nexport {\n normalizeNotionConfig,\n redactNotionConfig,\n type NotionConfig,\n type NotionConfigRedacted,\n} from '@struktoai/mirage-core'\nexport { LangfuseResource, type LangfuseResourceState } from './resource/langfuse/langfuse.ts'\nexport { JaegerResource, type JaegerResourceState } from './resource/jaeger/jaeger.ts'\nexport {\n normalizeLangfuseConfig,\n redactLangfuseConfig,\n type LangfuseConfig,\n type LangfuseConfigRedacted,\n} from './resource/langfuse/config.ts'\nexport { GitHubResource, type GitHubResourceState } from './resource/github/github.ts'\nexport {\n normalizeGitHubConfig,\n redactGitHubConfig,\n type GitHubConfig,\n type GitHubConfigRedacted,\n} from './resource/github/config.ts'\nexport { GitHubCIResource, type GitHubCIResourceState } from './resource/github_ci/github_ci.ts'\nexport {\n normalizeGitHubCIConfig,\n redactGitHubCIConfig,\n type GitHubCIConfig,\n type GitHubCIConfigRedacted,\n} from './resource/github_ci/config.ts'\nexport { GDocsResource, type GDocsResourceState } from './resource/gdocs/gdocs.ts'\nexport {\n normalizeGDocsConfig,\n redactGDocsConfig,\n type GDocsConfig,\n type GDocsConfigRedacted,\n} from './resource/gdocs/config.ts'\nexport { GSheetsResource, type GSheetsResourceState } from './resource/gsheets/gsheets.ts'\nexport {\n normalizeGSheetsConfig,\n redactGSheetsConfig,\n type GSheetsConfig,\n type GSheetsConfigRedacted,\n} from './resource/gsheets/config.ts'\nexport { GSlidesResource, type GSlidesResourceState } from './resource/gslides/gslides.ts'\nexport {\n normalizeGSlidesConfig,\n redactGSlidesConfig,\n type GSlidesConfig,\n type GSlidesConfigRedacted,\n} from './resource/gslides/config.ts'\nexport { GDriveResource, type GDriveResourceState } from './resource/gdrive/gdrive.ts'\nexport {\n Mem0Resource,\n OneDriveResource,\n SharePointResource,\n type Mem0Config,\n type OneDriveConfig,\n type SharePointConfig,\n} from '@struktoai/mirage-core'\nexport {\n normalizeGDriveConfig,\n redactGDriveConfig,\n type GDriveConfig,\n type GDriveConfigRedacted,\n} from './resource/gdrive/config.ts'\nexport { DropboxResource, type DropboxResourceState } from './resource/dropbox/dropbox.ts'\nexport {\n normalizeDropboxConfig,\n redactDropboxConfig,\n type DropboxConfig,\n type DropboxConfigRedacted,\n} from './resource/dropbox/config.ts'\nexport { BoxResource, type BoxResourceState } from './resource/box/box.ts'\nexport {\n normalizeBoxConfig,\n redactBoxConfig,\n type BoxConfig,\n type BoxConfigRedacted,\n} from './resource/box/config.ts'\nexport { GmailResource, type GmailResourceState } from './resource/gmail/gmail.ts'\nexport {\n normalizeGmailConfig,\n redactGmailConfig,\n type GmailConfig,\n type GmailConfigRedacted,\n} from './resource/gmail/config.ts'\nexport { GCalResource, type GCalResourceState } from './resource/gcal/gcal.ts'\nexport {\n normalizeGCalConfig,\n redactGCalConfig,\n type GCalConfig,\n type GCalConfigRedacted,\n} from './resource/gcal/config.ts'\nexport { EmailResource, type EmailResourceState } from './resource/email/email.ts'\nexport {\n buildEmailConfig,\n normalizeEmailConfig,\n redactEmailConfig,\n type EmailConfig,\n type EmailConfigInput,\n type EmailConfigRedacted,\n EMAIL_PROMPT,\n EMAIL_WRITE_PROMPT,\n} from './resource/email/index.ts'\nexport { EmailAccessor } from './accessor/email.ts'\nexport { EMAIL_COMMANDS } from './commands/builtin/email/index.ts'\nexport { HIMALAYA } from './commands/cli/builtin/himalaya/index.ts'\nexport { EMAIL_OPS } from './ops/email/index.ts'\nexport { DaytonaRuntime } from './runtime/sandbox/daytona/runtime.ts'\nexport { LocalRuntime } from './runtime/python/local.ts'\nexport { DAYTONA_CONFIG_KEYS, type DaytonaConfig } from './runtime/sandbox/daytona/config.ts'\nexport { E2BRuntime } from './runtime/sandbox/e2b/runtime.ts'\nexport { E2B_CONFIG_KEYS, type E2BConfig } from './runtime/sandbox/e2b/config.ts'\nexport { DockerRuntime } from './runtime/sandbox/docker/runtime.ts'\nexport { DOCKER_CONFIG_KEYS, type DockerConfig } from './runtime/sandbox/docker/config.ts'\nexport {\n buildResource,\n knownResources,\n register as registerResourceFactory,\n type ResourceFactory,\n} from './resource/registry.ts'\nexport { MODULE_SUFFIXES, isModulePath, loadAttr, splitRef } from './resource/loader.ts'\nexport { DISK_COMMANDS } from './commands/builtin/disk/index.ts'\nexport { REDIS_COMMANDS } from './commands/builtin/redis/index.ts'\nexport { GRIDFS_COMMANDS } from './commands/builtin/gridfs/index.ts'\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport {\n type Limit,\n createShellParser,\n type ExecuteOptions,\n type ExecuteResult,\n KERNEL_BACKENDS,\n MountBackend,\n type MountSpec,\n type ProvisionResult,\n type ShellParser,\n Workspace as CoreWorkspace,\n type WorkspaceOptions,\n} from '@struktoai/mirage-core'\nimport { FuseManager } from './workspace/fuse.ts'\nimport { Mount } from './workspace/mount_spec.ts'\nimport './compression_codecs.ts'\nimport './runtime/sandbox/daytona/runtime.ts'\n\nconst requireCjs = createRequire(import.meta.url)\n\nlet cachedParser: Promise<ShellParser> | null = null\n\nfunction loadShellParser(): Promise<ShellParser> {\n if (cachedParser !== null) return cachedParser\n const enginePath = requireCjs.resolve('web-tree-sitter/web-tree-sitter.wasm')\n const grammarPath = requireCjs.resolve('tree-sitter-bash/tree-sitter-bash.wasm')\n cachedParser = createShellParser({\n engineWasm: readFileSync(enginePath),\n grammarWasm: readFileSync(grammarPath),\n })\n return cachedParser\n}\n\nexport type NodeWorkspaceOptions = WorkspaceOptions\n\nexport class Workspace extends CoreWorkspace {\n private fuseSetupPromise: Promise<void> | null = null\n private readonly fuseMountpointsMap = new Map<string, string>()\n private readonly fuseManagers = new Map<string, FuseManager>()\n\n constructor(resources: Record<string, MountSpec | Mount>, options: NodeWorkspaceOptions = {}) {\n const specs: Record<string, MountSpec> = {}\n const commandLimits: Record<string, Record<string, Limit>> = {\n ...(options.commandLimits ?? {}),\n }\n const mountTargets: [string, MountBackend, string | undefined][] = []\n for (const [prefix, value] of Object.entries(resources)) {\n if (value instanceof Mount) {\n specs[prefix] =\n value.options.mode !== undefined ? [value.resource, value.options.mode] : value.resource\n if (value.options.commandLimits !== undefined)\n commandLimits[prefix] = value.options.commandLimits\n const backend = value.options.backend ?? MountBackend.VFS\n if (KERNEL_BACKENDS.includes(backend))\n mountTargets.push([prefix, backend, value.options.mountpoint])\n } else {\n specs[prefix] = value\n }\n }\n super(specs, {\n ...options,\n ...(Object.keys(commandLimits).length > 0 ? { commandLimits } : {}),\n shellParserFactory: options.shellParserFactory ?? loadShellParser,\n })\n if (mountTargets.length > 0) {\n // Kick off mounts eagerly; await inside fuseReady() / execute() / close()\n // so callers don't need to await the constructor (Python mirrors this).\n //\n // A failed auto-mount (e.g. libfuse absent on the host) degrades to an\n // unmounted but fully usable workspace, mirroring Python: there the mount\n // runs on a daemon thread so its failure never reaches the main process.\n // On Node's single event loop we swallow it here, otherwise the unhandled\n // rejection would terminate the process under Node's default policy.\n const setups = mountTargets.map(([prefix, backend, mountpoint]) =>\n this.addFuseMount(prefix, mountpoint, undefined, backend).then(\n () => undefined,\n (err: unknown) => {\n process.stderr.write(\n `mirage: FUSE auto-mount failed for ${prefix}, continuing without it: ${\n err instanceof Error ? err.message : String(err)\n }\\n`,\n )\n },\n ),\n )\n this.fuseSetupPromise = Promise.all(setups).then(() => undefined)\n }\n }\n\n private registerFuseMount(prefix: string, mountpoint: string): void {\n for (const [otherPrefix, otherMp] of this.fuseMountpointsMap) {\n if (otherMp === mountpoint && otherPrefix !== prefix) {\n throw new Error(\n `FUSE mountpoint ${mountpoint} already used by prefix ${otherPrefix}; mounts need distinct paths`,\n )\n }\n }\n this.fuseMountpointsMap.set(prefix, mountpoint)\n }\n\n /**\n * Mount a workspace subtree under FUSE and own its lifecycle. Each mount gets\n * its own {@link FuseManager}, so a workspace can expose any number of FUSE\n * subtrees at once. A pinned mountpoint is collision-checked BEFORE mounting,\n * so a clash never leaves a partial kernel mount.\n *\n * A session-bound mount (`sessionId` given) runs every op under that\n * session's mount grants (the kernel-tier primitive: bind-mount the tree\n * into a container and the narrowing travels with it); it is keyed\n * separately so the same prefix can also be exposed unbound.\n */\n async addFuseMount(\n prefix: string,\n mountpoint?: string,\n sessionId?: string,\n backend?: MountBackend,\n ): Promise<string> {\n const session = sessionId !== undefined ? this.getSession(sessionId) : undefined\n const key = sessionId === undefined ? prefix : `${prefix}@${sessionId}`\n if (mountpoint !== undefined) this.registerFuseMount(key, mountpoint)\n const fm = new FuseManager()\n this.fuseManagers.set(key, fm)\n try {\n const mp = await fm.setup(this, {\n rootPrefix: prefix,\n ...(mountpoint !== undefined ? { mountpoint } : {}),\n ...(session !== undefined ? { session } : {}),\n ...(backend !== undefined ? { backend } : {}),\n })\n if (mountpoint === undefined) this.registerFuseMount(key, mp)\n return mp\n } catch (err) {\n // The mount never came up; drop the manager and any registered path so\n // fuseMountpoints does not misreport it as live.\n this.fuseManagers.delete(key)\n this.fuseMountpointsMap.delete(key)\n throw err\n }\n }\n\n async removeFuseMount(prefix: string, sessionId?: string): Promise<void> {\n const key = sessionId === undefined ? prefix : `${prefix}@${sessionId}`\n const fm = this.fuseManagers.get(key)\n this.fuseManagers.delete(key)\n if (fm !== undefined) await fm.unmount()\n this.fuseMountpointsMap.delete(key)\n }\n\n get fuseMountpoints(): Record<string, string> {\n return Object.fromEntries(this.fuseMountpointsMap)\n }\n\n get fuseMountpoint(): string | null {\n if (this.fuseMountpointsMap.size === 0) return null\n if (this.fuseMountpointsMap.size > 1) {\n throw new Error('multiple FUSE mounts active; use fuseMountpoints to select one by prefix')\n }\n return this.fuseMountpointsMap.values().next().value ?? null\n }\n\n /** Await the eager per-mount fuse mounts started in the constructor. */\n async fuseReady(): Promise<void> {\n if (this.fuseSetupPromise !== null) {\n await this.fuseSetupPromise\n this.fuseSetupPromise = null\n }\n }\n\n override execute(\n command: string,\n options?: ExecuteOptions & { provision?: false | undefined },\n ): Promise<ExecuteResult>\n override execute(\n command: string,\n options: ExecuteOptions & { provision: true },\n ): Promise<ProvisionResult>\n override execute(\n command: string,\n options: ExecuteOptions,\n ): Promise<ExecuteResult | ProvisionResult>\n override async execute(\n command: string,\n options: ExecuteOptions = {},\n ): Promise<ExecuteResult | ProvisionResult> {\n await this.fuseReady()\n return super.execute(command, options)\n }\n\n override async close(): Promise<void> {\n await this.fuseReady().catch(() => undefined)\n for (const fm of this.fuseManagers.values()) await fm.unmount()\n this.fuseManagers.clear()\n this.fuseMountpointsMap.clear()\n await super.close()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { rmdirSync } from 'node:fs'\nimport type { Workspace } from '@struktoai/mirage-core'\nimport { forceUnmount, mount, type FuseHandle, type MountOptions } from '../fuse/mount.ts'\n\nconst SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP'] as const\ntype Signal = (typeof SIGNALS)[number]\ninterface CleanupEntry {\n mountpoint: string\n handle: FuseHandle\n // Cleanup owns only generated temp directories, never explicit mountpoints.\n ownsMountpoint: boolean\n}\n\nfunction removeMountpointIfOwned(entry: { mountpoint: string; ownsMountpoint: boolean }): void {\n if (!entry.ownsMountpoint) return\n try {\n // Empty-directory cleanup only. Recursive removal is unsafe because a\n // still-mounted FUSE path can make deletes hit the mounted backend.\n rmdirSync(entry.mountpoint)\n } catch {\n // mountpoint may still be busy, non-empty, or already gone; caller can retry\n }\n}\n\n/**\n * Tracks auto-mounted FUSE handles and installs a single process-wide cleanup\n * path on SIGINT / SIGTERM / SIGHUP / `process.exit` so the kernel never ends\n * up with a stale mountpoint after the node process dies. Mirrors Python's\n * KeyboardInterrupt → `diskutil unmount force` / `fusermount -u` in mount.py.\n */\nclass FuseCleanupRegistry {\n private readonly mounts = new Set<CleanupEntry>()\n private installed = false\n private exiting = false\n\n register(entry: CleanupEntry): void {\n this.mounts.add(entry)\n this.install()\n }\n\n unregister(entry: CleanupEntry): void {\n this.mounts.delete(entry)\n }\n\n private install(): void {\n if (this.installed) return\n this.installed = true\n for (const sig of SIGNALS) {\n process.on(sig, this.onSignal)\n }\n process.on('beforeExit', this.onExit)\n process.on('exit', this.onExit)\n }\n\n private readonly onSignal = (sig: Signal): void => {\n if (this.exiting) return\n this.exiting = true\n this.drainSync()\n // Re-raise the signal so the default termination action runs after we've\n // unmounted. Node suppresses the default when a listener is attached.\n process.kill(process.pid, sig)\n }\n\n private readonly onExit = (): void => {\n if (this.exiting) return\n this.exiting = true\n this.drainSync()\n }\n\n private drainSync(): void {\n for (const entry of this.mounts) {\n forceUnmount(entry.mountpoint)\n removeMountpointIfOwned(entry)\n }\n this.mounts.clear()\n }\n}\n\nconst CLEANUP = new FuseCleanupRegistry()\n\n// Passive mounting primitive: it mounts a workspace subtree and tears it down.\n// Registry/lifecycle ownership lives on the node Workspace (addFuseMount /\n// removeFuseMount), mirroring Python's FuseManager.\nexport class FuseManager {\n private handle: FuseHandle | null = null\n private cleanupEntry: CleanupEntry | null = null\n\n get mountpoint(): string | null {\n return this.handle?.mountpoint ?? null\n }\n\n async setup(ws: Workspace, options: MountOptions = {}): Promise<string> {\n if (this.handle !== null) return this.handle.mountpoint\n const handle = await mount(ws, options)\n this.handle = handle\n this.cleanupEntry = {\n mountpoint: handle.mountpoint,\n handle,\n // Preserve the ownership decision made by mount(); unmount cleanup must\n // not infer ownership from path shape or whether the directory exists.\n ownsMountpoint: handle.ownsMountpoint,\n }\n CLEANUP.register(this.cleanupEntry)\n return handle.mountpoint\n }\n\n async unmount(): Promise<void> {\n if (this.handle === null) {\n return\n }\n const mp = this.handle.mountpoint\n try {\n await this.handle.unmount()\n } finally {\n const cleanupEntry = this.cleanupEntry\n if (cleanupEntry !== null) {\n CLEANUP.unregister(cleanupEntry)\n this.cleanupEntry = null\n }\n this.handle = null\n removeMountpointIfOwned({\n mountpoint: mp,\n ownsMountpoint: cleanupEntry?.ownsMountpoint ?? false,\n })\n }\n }\n\n async close(): Promise<void> {\n await this.unmount()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { execSync } from 'node:child_process'\nimport { randomBytes } from 'node:crypto'\nimport { mkdirSync, mkdtempSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { basename, join } from 'node:path'\nimport type { Session, Workspace } from '@struktoai/mirage-core'\nimport { loadOptionalPeer } from '../optional_peer.ts'\nimport { MountBackend } from '@struktoai/mirage-core'\nimport { checkMountpoint, FSKIT_MOUNT_ROOT, prepareBackend } from './backend.ts'\nimport { MirageFS } from './fs.ts'\n\nexport interface FuseHandle {\n mountpoint: string\n /** Whether Mirage created this mountpoint directory and may remove it later. */\n ownsMountpoint: boolean\n unmount: () => Promise<void>\n}\n\nexport interface MountOptions {\n /** Caller/deployment-owned mountpoint. Mirage mounts here but does not delete it. */\n mountpoint?: string\n /** Scope the mount to a single workspace mount prefix (subtree exposure). */\n rootPrefix?: string\n /** Run every op under this session's mount grants (session-bound mountpoint). */\n session?: Session\n /**\n * When true, `@zkochan/fuse-native`'s `autoUnmount` flag is set so the\n * kernel releases the mount if the process exits abnormally. Defaults to\n * `true` on Linux, `false` on darwin — macFUSE rejects the option with\n * \"unknown option `auto_unmount'\". On darwin the SIGINT cleanup in\n * FuseManager runs `diskutil unmount force` instead.\n */\n autoUnmount?: boolean\n /**\n * Extra options forwarded verbatim to `@zkochan/fuse-native`.\n * `directIO: false` additionally skips the `direct_io` mount option that\n * Mirage appends by default (see appendDirectIO).\n */\n fuseOptions?: Record<string, unknown>\n /**\n * Which kernel interface serves the mount: 'fuse' (default) or 'fskit'.\n * 'fskit' routes through macFUSE 5.x's FSKit backend (no kernel\n * extension); macOS-only, mounts under /Volumes, and every mounted\n * resource must report exact sizes. See backend.ts for the guards.\n */\n backend?: MountBackend\n}\n\ninterface FuseInstance {\n mount: (cb: (err: Error | null) => void) => void\n unmount: (cb: (err: Error | null) => void) => void\n _fuseOptions?: () => string\n}\n\ntype FuseConstructor = new (\n mountpoint: string,\n ops: Record<string, unknown>,\n options?: Record<string, unknown>,\n) => FuseInstance\n\n/**\n * Append raw libfuse options to the mount option string.\n * `@zkochan/fuse-native` serializes a fixed allowlist of options in\n * `_fuseOptions()`, so anything outside it (`direct_io`, `backend`,\n * `volname`) is appended by wrapping the serializer at runtime — this\n * ships to consumers, unlike a pnpm patch, which would only apply inside\n * this repository.\n */\nexport function appendMountOptions(fuse: FuseInstance, extras: string[]): void {\n const orig = fuse._fuseOptions?.bind(fuse)\n if (orig === undefined) {\n throw new Error(\n '@zkochan/fuse-native no longer exposes _fuseOptions(); extra mount ' +\n 'options cannot be applied. Update appendMountOptions in mount.ts ' +\n 'for the new fuse-native version.',\n )\n }\n fuse._fuseOptions = () => {\n const serialized = orig()\n const missing = extras.filter((opt) => !serialized.includes(opt))\n if (missing.length === 0) return serialized\n if (serialized === '') return `-o${missing.join(',')}`\n return `${serialized},${missing.join(',')}`\n }\n}\n\n/**\n * Append libfuse's `direct_io`. Load-bearing for size-unknown API files:\n * getattr reports 0 pre-open and the kernel must read to EOF regardless\n * (verified on the macOS kext: without it, `cat` reads 0 bytes; see the\n * CLAUDE.md FUSE section).\n */\nexport function appendDirectIO(fuse: FuseInstance): void {\n appendMountOptions(fuse, ['direct_io'])\n}\n\nasync function loadFuse(): Promise<FuseConstructor> {\n const mod = await loadOptionalPeer(\n () => import('@zkochan/fuse-native') as unknown as Promise<{ default?: FuseConstructor }>,\n {\n feature: 'FUSE support',\n packageName: '@zkochan/fuse-native',\n docsUrl: 'https://mirage.dev/typescript/setup/fuse',\n },\n )\n const Fuse = (mod.default ?? mod) as unknown as FuseConstructor\n if (typeof Fuse !== 'function') {\n throw new Error('@zkochan/fuse-native did not export a constructor')\n }\n return Fuse\n}\n\n/** Fallback unmount via platform tools — mirrors Python's SIGINT handler. */\nexport function forceUnmount(mountpoint: string): void {\n try {\n if (process.platform === 'darwin') {\n execSync(`diskutil unmount force ${JSON.stringify(mountpoint)}`, { stdio: 'ignore' })\n } else {\n execSync(`fusermount -u ${JSON.stringify(mountpoint)}`, { stdio: 'ignore' })\n }\n } catch {\n // best-effort; caller already tried the clean path\n }\n}\n\nexport async function mount(ws: Workspace, options: MountOptions = {}): Promise<FuseHandle> {\n const backend = prepareBackend(\n options.backend ?? MountBackend.FUSE,\n ws,\n undefined,\n options.rootPrefix ?? '',\n )\n const Fuse = await loadFuse()\n const isFskit = backend === MountBackend.FSKIT\n let mountpoint: string\n let ownsMountpoint = false\n if (options.mountpoint !== undefined) {\n checkMountpoint(backend, options.mountpoint)\n // Pinned path: create if missing, but keep ownership with the caller.\n // An FSKit mountpoint is NAMED, never created: /Volumes is root-owned\n // (mkdir there is EACCES for a normal user), and the volume directory\n // is the system's to create when the filesystem goes live.\n if (!isFskit) mkdirSync(options.mountpoint, { recursive: true })\n mountpoint = options.mountpoint\n } else if (isFskit) {\n mountpoint = `${FSKIT_MOUNT_ROOT}/mirage-${randomBytes(4).toString('hex')}`\n // The /Volumes entry is created and removed by the system, not ours to\n // rmdir (nor could we: /Volumes is root-owned).\n } else {\n mountpoint = mkdtempSync(join(tmpdir(), 'mirage-fuse-'))\n ownsMountpoint = true\n }\n const mfs = new MirageFS(ws.fs, {\n ...(options.rootPrefix !== undefined ? { rootPrefix: options.rootPrefix } : {}),\n ...(options.session !== undefined ? { session: options.session } : {}),\n })\n const autoUnmount = options.autoUnmount ?? process.platform === 'linux'\n // Size-unknown recipe, mirroring Python's mount.py: direct_io (appended\n // below) makes the kernel read to EOF even though getattr reports 0\n // pre-open, and attrTimeout '0' (string: the option serializer drops falsy\n // values) keeps the kernel from caching that 0, so the post-open fstat\n // reaches fgetattr, which answers with the prefetched real size. Both are\n // load-bearing on the macOS kext; see the CLAUDE.md FUSE section.\n const fuseOpts: Record<string, unknown> = {\n force: true,\n mkdir: true,\n attrTimeout: '0',\n ...(autoUnmount ? { autoUnmount: true } : {}),\n ...(options.fuseOptions ?? {}),\n }\n const fuse = new Fuse(mountpoint, mfs.ops(), fuseOpts)\n if (isFskit) {\n // Issue #82's verified recipe: backend=fskit + volname, direct_io\n // omitted (FSKit has no direct_io; reads are driven by reported size,\n // which checkSizes guarantees is exact). Mirrors Python's _run_fuse.\n appendMountOptions(fuse, ['backend=fskit', `volname=${basename(mountpoint)}`])\n } else if (fuseOpts.directIO !== false) {\n appendDirectIO(fuse)\n }\n await new Promise<void>((resolve, reject) => {\n fuse.mount((err) => {\n if (err === null) resolve()\n else reject(err)\n })\n })\n return {\n mountpoint,\n ownsMountpoint,\n unmount: () =>\n new Promise<void>((resolve, reject) => {\n fuse.unmount((err) => {\n if (err === null) resolve()\n else reject(err)\n })\n }),\n }\n}\n\nexport function mountBackground(ws: Workspace, options: MountOptions = {}): Promise<FuseHandle> {\n return mount(ws, options)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { posix } from 'node:path'\nimport {\n KERNEL_BACKENDS,\n MountBackend,\n MountMode,\n rstripSlash,\n sizesAlwaysKnown,\n type Workspace,\n} from '@struktoai/mirage-core'\n\n/**\n * FSKit mounts only under /Volumes. Anywhere else the mount fails with an\n * opaque driver error, so the rule is enforced up front rather than\n * discovered at run time (github.com/strukto-ai/mirage#82).\n */\nexport const FSKIT_MOUNT_ROOT = '/Volumes'\n\n/**\n * Coerce a user-supplied backend name into a MountBackend.\n *\n * Missing means vfs, everywhere: an absent `backend` in YAML, `undefined`\n * here, and the `MountSpecOptions` default all resolve to the same thing.\n * Callers that need a kernel mount say so explicitly rather than relying on\n * this function to reinterpret an absent value.\n */\nexport function resolveBackend(value?: string | null): MountBackend {\n if (value === undefined || value === null || value === '') return MountBackend.VFS\n const lowered = value.toLowerCase() as MountBackend\n if (!Object.values(MountBackend).includes(lowered)) {\n throw new Error(\n `unknown mount backend ${JSON.stringify(value)}; expected one of: ${Object.values(\n MountBackend,\n ).join(', ')}`,\n )\n }\n return lowered\n}\n\n/** Reject a backend that registers nothing with the kernel. */\nexport function requireKernelBackend(backend: MountBackend): void {\n if (!KERNEL_BACKENDS.includes(backend)) {\n throw new Error(\n `backend ${JSON.stringify(backend)} does not register a mountpoint; it is served inside ` +\n \"mirage's own filesystem, so there is nothing to mount\",\n )\n }\n}\n\n/**\n * Reject a backend the current platform cannot serve.\n *\n * FSKit works from TypeScript: `fuse.node` links `/usr/local/lib/\n * libfuse.2.dylib` by absolute path (the `libosxfuse.2.dylib` it ships is a\n * stub with that install name), so on a machine with macFUSE 5.x the\n * `backend=fskit` option reaches the same libfuse Python uses. Verified\n * with a live mount; see examples/typescript/fuse/fskit.ts.\n */\nexport function checkPlatform(backend: MountBackend): void {\n if (backend !== MountBackend.FSKIT) return\n if (process.platform !== 'darwin') {\n throw new Error(\n `the fskit mount backend is macOS-only (running on ${process.platform}); use backend 'fuse'`,\n )\n }\n}\n\n/** Reject a mountpoint the backend cannot mount on. */\nexport function checkMountpoint(backend: MountBackend, mountpoint: string): void {\n if (backend !== MountBackend.FSKIT) return\n const resolved = posix.normalize(mountpoint)\n if (resolved !== FSKIT_MOUNT_ROOT && !resolved.startsWith(FSKIT_MOUNT_ROOT + '/')) {\n throw new Error(\n `the fskit mount backend only mounts under ${FSKIT_MOUNT_ROOT}; got ${JSON.stringify(mountpoint)}`,\n )\n }\n}\n\n/**\n * Mounts under `rootPrefix` whose files cannot be sized without reading\n * them. Mirrors Python's `Ops.unsized_mounts`.\n */\nexport function unsizedMounts(ws: Workspace, rootPrefix = ''): [string, string][] {\n const root = rstripSlash(rootPrefix)\n const found: [string, string][] = []\n for (const m of ws.mounts()) {\n const bare = rstripSlash(m.prefix)\n if (root !== '' && bare !== root && !m.prefix.startsWith(root + '/')) continue\n if (!sizesAlwaysKnown(m.resource)) found.push([m.prefix, m.resource.kind])\n }\n return found\n}\n\n/**\n * Warn when an fskit mount will serve size-unknown files as empty.\n *\n * FSKit drives reads from the size the filesystem reports and has no\n * `direct_io` escape hatch, so a resource that cannot size a file without\n * fetching it reports 0, the kernel issues no reads, and every such file\n * comes back empty with exit code 0 (verified on a live fskit mount: the\n * read clamp is pinned at lookup-time size and never refreshed). The mount\n * proceeds anyway: per-backend size push-down is closing this gap, so the\n * degraded mounts are named loudly here rather than refused.\n */\nexport function checkSizes(backend: MountBackend, ws: Workspace, rootPrefix = ''): void {\n if (backend !== MountBackend.FSKIT) return\n const offenders = unsizedMounts(ws, rootPrefix)\n if (offenders.length === 0) return\n const listed = offenders.map(([prefix, kind]) => `${prefix} (${kind})`).join(', ')\n console.warn(\n 'mirage: the fskit mount backend cannot serve resources whose file sizes are only known ' +\n `after a read; size-unknown files under these mounts will read as empty: ${listed}. ` +\n \"Mount them with backend 'fuse', or scope the fskit mount to a byte-store resource \" +\n '(ram, disk, redis, s3, gridfs).',\n )\n}\n\n/**\n * Mounts that accept writes, in mount resolution order. Mirrors Python's\n * `Ops.writable_mounts`.\n */\nexport function writableMounts(ws: Workspace, rootPrefix = ''): [string, string][] {\n const root = rstripSlash(rootPrefix)\n const found: [string, string][] = []\n for (const m of ws.mounts()) {\n const bare = rstripSlash(m.prefix)\n if (root !== '' && bare !== root && !m.prefix.startsWith(root + '/')) continue\n if (m.mode !== MountMode.READ) found.push([m.prefix, m.resource.kind])\n }\n return found\n}\n\n/**\n * Warn when an fskit mount accepts writes the shim may corrupt.\n *\n * Measured on live fskit mounts and pinned in `integ/fuse/truth_fskit.json`: the\n * macFUSE FSKit shim flushes pages a file did not already have (a new file,\n * an empty file, a truncate-then-write) as NUL bytes of the right length,\n * and appended regions arrive intact or zeroed depending on cache state.\n * Metadata ops (create, mkdir, rename, unlink) are reliable. The writer sees\n * no error either way, so the corruption is silent; the mount proceeds with\n * a warning naming the writable mounts.\n */\nexport function checkWrites(backend: MountBackend, ws: Workspace, rootPrefix = ''): void {\n if (backend !== MountBackend.FSKIT) return\n // /dev is mounted writable into every workspace, and a zeroed flush\n // cannot corrupt a discard/byte-source device, so it never warns.\n const offenders = writableMounts(ws, rootPrefix).filter(\n ([prefix]) => rstripSlash(prefix) !== '/dev',\n )\n if (offenders.length === 0) return\n const listed = offenders.map(([prefix, kind]) => `${prefix} (${kind})`).join(', ')\n console.warn(\n 'mirage: file data written through an fskit mount may be flushed by the macFUSE FSKit ' +\n `shim as zeroed pages (metadata ops are reliable; the writer sees no error): ${listed}. ` +\n \"Mount them read-only, or use backend 'fuse' for writes.\",\n )\n}\n\n/**\n * Resolve a backend for a kernel mount and run every guard it implies.\n *\n * One entry point, so a new mount path cannot pick up fskit support while\n * silently skipping the macOS, /Volumes, or size checks.\n */\nexport function prepareBackend(\n value: string | undefined,\n ws?: Workspace,\n mountpoint?: string,\n rootPrefix = '',\n): MountBackend {\n const backend = resolveBackend(value)\n requireKernelBackend(backend)\n checkPlatform(backend)\n if (mountpoint !== undefined) checkMountpoint(backend, mountpoint)\n if (ws !== undefined) {\n checkSizes(backend, ws, rootPrefix)\n checkWrites(backend, ws, rootPrefix)\n }\n return backend\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { type OpRecord, type Ops, runWithSession, type Session } from '@struktoai/mirage-core'\nimport { type FuseAttr, MountCore } from './core.ts'\nimport { classifyError } from './errors.ts'\n\nexport type { FuseAttr }\n\ntype Cb<T> = (code: number, result?: T) => void\n\nexport interface MirageFSOptions {\n rootPrefix?: string\n /**\n * Bind every FUSE op to this session's mount grants. The kernel-tier\n * primitive: bind-mount the tree into a container and the narrowing\n * travels with it. Enforcement happens inside dispatch/Ops via the\n * session context, so binding at the op entry point is sufficient.\n */\n session?: Session\n}\n\n/**\n * libfuse adapter over MountCore.\n *\n * Owns exactly the FUSE-specific concerns: the `@zkochan/fuse-native`\n * callback signatures and the translation of mirage-native errors into\n * negative errno codes. All filesystem semantics live in MountCore, so a\n * non-FUSE adapter can reuse them unchanged. Mirrors Python's `MirageFS`.\n */\nexport class MirageFS {\n readonly core: MountCore\n\n constructor(ops: Ops, options: MirageFSOptions = {}) {\n this.core = new MountCore(ops, options)\n }\n\n /** Drain and return accumulated op records (mirrors Python's drainOps). */\n drainOps(): OpRecord[] {\n return this.core.drainOps()\n }\n\n // ── FUSE op surface (mirrors mfusepy Operations) ─────────────────\n\n ops(): Record<string, unknown> {\n const table: Record<string, (...args: never[]) => void> = {\n readdir: this.readdir.bind(this),\n getattr: this.getattr.bind(this),\n fgetattr: this.fgetattr.bind(this),\n open: this.open.bind(this),\n read: this.read.bind(this),\n write: this.write.bind(this),\n create: this.create.bind(this),\n readlink: this.readlink.bind(this),\n symlink: this.symlink.bind(this),\n unlink: this.unlink.bind(this),\n mkdir: this.mkdir.bind(this),\n rmdir: this.rmdir.bind(this),\n rename: this.rename.bind(this),\n release: this.release.bind(this),\n truncate: this.truncate.bind(this),\n flush: this.flush.bind(this),\n fsync: this.fsync.bind(this),\n utimens: this.utimens.bind(this),\n chmod: this.chmod.bind(this),\n chown: this.chown.bind(this),\n access: this.access.bind(this),\n setxattr: this.setxattr.bind(this),\n getxattr: this.getxattr.bind(this),\n listxattr: this.listxattr.bind(this),\n removexattr: this.removexattr.bind(this),\n statfs: this.statfs.bind(this),\n }\n const session = this.core.session\n if (session === null) return table\n // A session-bound tree enters the session context before every op,\n // mirroring Python's MountCore session binding: the async work each\n // callback starts inherits the context, so dispatch/Ops enforce the\n // session's mount grants for kernel-originated I/O too.\n const bound: Record<string, unknown> = {}\n for (const [name, fn] of Object.entries(table)) {\n bound[name] = (...args: never[]) => {\n void runWithSession(session, () => {\n fn(...args)\n return Promise.resolve()\n })\n }\n }\n return bound\n }\n\n private getattr(path: string, cb: Cb<FuseAttr>): void {\n void this.core.getattr(path).then(\n (attr) => {\n cb(0, attr)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private fgetattr(path: string, fd: number, cb: Cb<FuseAttr>): void {\n void this.core.fgetattr(path, fd).then(\n (attr) => {\n cb(0, attr)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private readdir(path: string, cb: Cb<string[]>): void {\n void this.core.readdir(path).then(\n (names) => {\n cb(0, names)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private read(\n path: string,\n fd: number,\n buf: Buffer,\n len: number,\n pos: number,\n cb: (result: number) => void,\n ): void {\n void this.core.read(path, fd, pos, len).then(\n (slice) => {\n buf.set(slice, 0)\n cb(slice.byteLength)\n },\n (err: unknown) => {\n // A policy refusal must surface as EACCES, never read as an\n // empty file. Any other failed read reports 0 bytes (EOF): the\n // kernel has already accepted the open, and short-reading is how\n // FUSE signals \"nothing more here\".\n if ((err as { code?: string }).code === 'EACCES') {\n cb(classifyError(err))\n return\n }\n cb(0)\n },\n )\n }\n\n private write(\n path: string,\n fd: number,\n buf: Buffer,\n len: number,\n pos: number,\n cb: (result: number) => void,\n ): void {\n const data = new Uint8Array(buf.subarray(0, len))\n void this.core.write(path, fd, data, pos).then(\n () => {\n cb(len)\n },\n (err: unknown) => {\n // Same EACCES rule as read: a policy refusal is an errno, any\n // other failure reports 0 bytes written.\n if ((err as { code?: string }).code === 'EACCES') {\n cb(classifyError(err))\n return\n }\n cb(0)\n },\n )\n }\n\n private create(path: string, _mode: number, cb: Cb<number>): void {\n void this.core.create(path).then(\n (fh) => {\n cb(0, fh)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private mkdir(path: string, _mode: number, cb: (code: number) => void): void {\n void this.core.mkdir(path).then(\n () => {\n cb(0)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private readlink(path: string, cb: Cb<string>): void {\n try {\n cb(0, this.core.readlink(path))\n } catch (err) {\n cb(classifyError(err))\n }\n }\n\n private symlink(src: string, dest: string, cb: (code: number) => void): void {\n void this.core.symlink(src, dest).then(\n () => {\n cb(0)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private unlink(path: string, cb: (code: number) => void): void {\n void this.core.unlink(path).then(\n () => {\n cb(0)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private rename(src: string, dst: string, cb: (code: number) => void): void {\n void this.core.rename(src, dst).then(\n () => {\n cb(0)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private rmdir(path: string, cb: (code: number) => void): void {\n void this.core.rmdir(path).then(\n () => {\n cb(0)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private truncate(path: string, size: number, cb: (code: number) => void): void {\n void this.core.truncate(path, size).then(\n () => {\n cb(0)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private statfs(_path: string, cb: Cb<Record<string, number>>): void {\n cb(0, this.core.statfs())\n }\n\n // chmod / chown / utimens / access are no-ops for the filesystem but must\n // validate path existence — callers like `touch`/`chmod` on a missing file\n // should fail with ENOENT, not silently succeed.\n\n private chmod(path: string, _mode: number, cb: (code: number) => void): void {\n this.validate(path, cb)\n }\n\n private chown(path: string, _uid: number, _gid: number, cb: (code: number) => void): void {\n this.validate(path, cb)\n }\n\n private utimens(path: string, _atime: Date, _mtime: Date, cb: (code: number) => void): void {\n this.validate(path, cb)\n }\n\n private access(path: string, _amode: number, cb: (code: number) => void): void {\n this.validate(path, cb)\n }\n\n private setxattr(\n path: string,\n name: string,\n value: Buffer,\n _position: number,\n _flags: number,\n cb: (code: number) => void,\n ): void {\n this.validate(path, (code) => {\n if (code !== 0) {\n cb(code)\n return\n }\n this.core.setxattr(path, name, value)\n cb(0)\n })\n }\n\n private getxattr(\n path: string,\n name: string,\n _position: number,\n cb: (code: number, value?: Buffer) => void,\n ): void {\n this.validate(path, (code) => {\n if (code !== 0) {\n cb(code)\n return\n }\n // A missing value tells fuse-native to report ENOATTR/ENODATA.\n cb(0, this.core.getxattr(path, name))\n })\n }\n\n private listxattr(path: string, cb: (code: number, list?: string[]) => void): void {\n this.validate(path, (code) => {\n if (code !== 0) {\n cb(code)\n return\n }\n cb(0, this.core.listxattr(path))\n })\n }\n\n private removexattr(path: string, name: string, cb: (code: number) => void): void {\n this.validate(path, (code) => {\n if (code !== 0) {\n cb(code)\n return\n }\n this.core.removexattr(path, name)\n cb(0)\n })\n }\n\n private validate(path: string, cb: (code: number) => void): void {\n // getattr's callback returns 0 on success and a negative errno on failure\n // (FUSE convention). Pass the code straight through so missing paths\n // surface as ENOENT instead of silently succeeding.\n this.getattr(path, (code) => {\n cb(code)\n })\n }\n\n private open(path: string, _flags: number, cb: Cb<number>): void {\n void this.core.open(path).then(\n (fh) => {\n cb(0, fh)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private release(_path: string, fd: number, cb: (code: number) => void): void {\n void this.core.release(fd).then(\n () => {\n cb(0)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private flush(path: string, fd: number, cb: (code: number) => void): void {\n void this.core.flush(path, fd).then(\n () => {\n cb(0)\n },\n (err: unknown) => {\n cb(classifyError(err))\n },\n )\n }\n\n private fsync(path: string, _datasync: number, fd: number, cb: (code: number) => void): void {\n this.flush(path, fd, cb)\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { posix } from 'node:path'\nimport {\n type FileStat,\n DIR_MODE,\n FILE_MODE,\n FileTable,\n FileType,\n isMissingOp,\n mergeWrites,\n mtimeMs,\n type OpRecord,\n rstripSlash,\n type Ops,\n type Session,\n compareCodePoints,\n} from '@struktoai/mirage-core'\nimport { errnoError } from './errors.ts'\nimport { isMacosMetadata } from './platform/macos.ts'\n\nexport interface FuseAttr {\n mtime: Date\n atime: Date\n ctime: Date\n nlink: number\n size: number\n mode: number\n uid: number\n gid: number\n}\n\nexport interface Handle {\n path: string\n data?: Uint8Array\n writeBuf?: [number, Uint8Array][]\n}\n\ninterface PrefetchEntry {\n data: Uint8Array\n expires: number\n}\n\nconst PREFETCH_TTL_MS = 30_000\n\nexport interface MountCoreOptions {\n rootPrefix?: string\n /**\n * Bind every op to this session's mount grants. The kernel-tier\n * primitive: bind-mount the tree into a container and the narrowing\n * travels with it. Enforcement happens inside dispatch/Ops via the\n * session context, so binding at the op entry point is sufficient.\n */\n session?: Session\n}\n\n/**\n * Protocol-neutral mount logic shared by every kernel adapter.\n *\n * Everything here is expressed in POSIX terms (attribute records, ordinary\n * thrown errors) and imports nothing from `@zkochan/fuse-native`, so it is\n * reusable by a non-FUSE adapter and unit-testable without a kernel.\n *\n * The division of labour: this class decides *what* the filesystem\n * contains, an adapter decides *how* to say it to a particular kernel\n * interface. Adapters translate the errors thrown here into their own\n * error codes with `classifyErrno`. Mirrors Python's `MountCore`.\n *\n * Every op goes through `ws.fs`, which delegates to the dispatcher, so\n * a mount walks the same door as a shell line (mount modes, policies,\n * cache, invalidation) and every op it runs lands in `ws.records` for\n * `drainOps`. Reaching `ws.dispatch` from here instead would skip the\n * record; reaching a backend directly would skip the door.\n */\nexport class MountCore {\n readonly ops: Ops\n readonly session: Session | null\n private readonly now: Date\n private readonly root: string\n readonly handles = new FileTable<Handle>()\n // In-memory extended attributes, keyed by path. Backends have no POSIX\n // xattrs, so these are advisory and never persisted; see setxattr.\n readonly xattrs = new Map<string, Map<string, Buffer>>()\n readonly prefetchCache = new Map<string, PrefetchEntry>()\n private readonly prefetchInflight = new Map<string, Promise<Uint8Array | null>>()\n private readonly uid: number\n private readonly gid: number\n\n constructor(ops: Ops, options: MountCoreOptions = {}) {\n this.ops = ops\n this.now = new Date()\n this.root = options.rootPrefix !== undefined ? rstripSlash(options.rootPrefix) : ''\n this.uid = typeof process.getuid === 'function' ? process.getuid() : 0\n this.gid = typeof process.getgid === 'function' ? process.getgid() : 0\n this.session = options.session ?? null\n }\n\n // ── helpers ──────────────────────────────────────────────────────\n\n resolve(path: string): string {\n if (this.root === '') return path\n return path === '/' ? this.root : this.root + path\n }\n\n dirStat(): FuseAttr {\n return {\n mtime: this.now,\n atime: this.now,\n ctime: this.now,\n nlink: 2,\n size: 0,\n mode: DIR_MODE,\n uid: this.uid,\n gid: this.gid,\n }\n }\n\n fileStat(size: number): FuseAttr {\n return {\n mtime: this.now,\n atime: this.now,\n ctime: this.now,\n nlink: 1,\n size,\n mode: FILE_MODE,\n uid: this.uid,\n gid: this.gid,\n }\n }\n\n /**\n * Fold merged stat attributes into an attr record. The workspace stat\n * already carries the namespace overlay (chmod bits, chown ids, touched\n * mtime), so honoring these fields here is what makes metadata ops\n * visible through a mount. String uid/gid (names) are skipped: the kernel\n * wants numeric ids and there is no user db to map against.\n */\n applyStatAttrs(entry: FuseAttr, s: FileStat): FuseAttr {\n if (s.mode !== null) {\n entry.mode = (entry.mode & ~0o7777) | (s.mode & 0o7777)\n }\n if (typeof s.uid === 'number') entry.uid = s.uid\n if (typeof s.gid === 'number') entry.gid = s.gid\n if (s.modified !== null) {\n // One translator per language: the naive-stamp-is-UTC rule lives\n // in core's stat view, never re-parsed here with a bare Date.\n // Null means the stamp did not parse; epoch zero is a real time\n // and lands.\n const ms = mtimeMs(s)\n if (ms !== null) {\n entry.mtime = new Date(ms)\n entry.ctime = new Date(ms)\n }\n }\n return entry\n }\n\n /**\n * The target to present for a namespace link at a mount path, or null\n * when not a link. Relative targets are stored verbatim and returned\n * as-is. Absolute targets name virtual paths, so they are rewritten\n * relative to the link's directory: returned raw, the kernel would\n * resolve them against the host root and escape the mountpoint.\n */\n linkTarget(path: string): string | null {\n const links = this.ops.links\n if (links === null) return null\n const target = links.readlink(this.resolve(path))\n if (target === null) return null\n if (!target.startsWith('/')) return target\n let virtualTarget = target\n if (this.root !== '') {\n if (target === this.root) {\n virtualTarget = '/'\n } else if (target.startsWith(this.root + '/')) {\n virtualTarget = target.slice(this.root.length)\n } else {\n // points outside the scoped root: unreachable through this\n // mount, keep the stored form (a dangling link is legal)\n return target\n }\n }\n const slash = path.lastIndexOf('/')\n const parent = slash <= 0 ? '/' : path.slice(0, slash)\n return posix.relative(parent, virtualTarget)\n }\n\n linkStat(target: string): FuseAttr {\n const entry = this.fileStat(new TextEncoder().encode(target).byteLength)\n entry.mode = 0o120777\n return entry\n }\n\n cachedSize(path: string): number | null {\n for (const ctx of this.handles.values()) {\n if (ctx.path === path && ctx.data !== undefined) return ctx.data.byteLength\n }\n const entry = this.prefetchCache.get(path)\n if (entry !== undefined && entry.expires > Date.now()) return entry.data.byteLength\n return null\n }\n\n cachedData(path: string): Uint8Array | null {\n for (const ctx of this.handles.values()) {\n if (ctx.path === path && ctx.data !== undefined) return ctx.data\n }\n const entry = this.prefetchCache.get(path)\n if (entry !== undefined && entry.expires > Date.now()) return entry.data\n if (entry !== undefined) this.prefetchCache.delete(path)\n return null\n }\n\n /**\n * Fetch bytes for a size-unknown file and cache them so the open → read →\n * fstat burst (and subsequent stats within the TTL) reuse the same fetch.\n * With getattr reporting 0 pre-open, this hydration is what lets fgetattr\n * answer with the real byte length after open (mirrors Python's\n * `prefetch_read`).\n */\n async prefetch(path: string): Promise<Uint8Array | null> {\n const cached = this.cachedData(path)\n if (cached !== null) return cached\n const inflight = this.prefetchInflight.get(path)\n if (inflight !== undefined) return inflight\n const promise = (async (): Promise<Uint8Array | null> => {\n try {\n const data = await this.ops.readFile(this.resolve(path))\n this.prefetchCache.set(path, { data, expires: Date.now() + PREFETCH_TTL_MS })\n return data\n } catch {\n return null\n } finally {\n this.prefetchInflight.delete(path)\n }\n })()\n this.prefetchInflight.set(path, promise)\n return promise\n }\n\n /** Drain and return accumulated op records (mirrors Python's drainOps). */\n drainOps(): OpRecord[] {\n const records = [...this.ops.records]\n this.ops.records.length = 0\n return records\n }\n\n private async writeFile(path: string, data: Uint8Array): Promise<void> {\n await this.ops.writeFile(this.resolve(path), data)\n }\n\n /**\n * Merge buffered writes over the raw base and persist the result.\n * The base is read raw so a flush never stores a rendered view back\n * into the mount.\n */\n private async applyWrites(path: string, writes: [number, Uint8Array][]): Promise<void> {\n let existing: Uint8Array = new Uint8Array(0)\n try {\n existing = await this.ops.readFile(this.resolve(path), { raw: true })\n } catch {\n // missing file: start from empty; the write creates it\n }\n await this.writeFile(path, mergeWrites(existing, writes))\n }\n\n // ── POSIX surface (throws; adapters classify) ────────────────────\n\n async getattr(path: string): Promise<FuseAttr> {\n if (path === '/') return this.dirStat()\n // macOS Finder/Spotlight probes .DS_Store, ._*, .Spotlight-V100, etc.\n // Reject early to avoid hitting the ops layer.\n const name = path.slice(path.lastIndexOf('/') + 1)\n if (isMacosMetadata(name)) {\n throw errnoError('ENOENT', `no such file or directory: ${path}`)\n }\n // Link check must precede the workspace stat: the fs facade follows\n // namespace links, so stat on a link path reports the target.\n const target = this.linkTarget(path)\n if (target !== null) return this.linkStat(target)\n const s = await this.ops.stat(this.resolve(path))\n if (s.type === FileType.DIRECTORY) {\n return this.applyStatAttrs(this.dirStat(), s)\n }\n // Size-unknown API files stat as 0 before open (never a fake size):\n // the mount's direct_io makes the kernel read to EOF regardless, and\n // attrTimeout '0' routes the post-open fstat to fgetattr, which serves\n // the real hydrated size. Mirrors Python's core.py; see the CLAUDE.md\n // FUSE section.\n let size = s.size\n size ??= this.cachedSize(path) ?? 0\n return this.applyStatAttrs(this.fileStat(size), s)\n }\n\n /** Attributes through an open handle, or path-based when not hydrated. */\n async fgetattr(path: string, fd: number): Promise<FuseAttr> {\n // fstat(fd) after open: the open handler prefetched size-unknown files\n // into the handle, so answer with the real byte length instead of the\n // 0 that path-based getattr reported before open.\n const ctx = this.handles.get(fd)\n if (ctx?.data !== undefined) return this.fileStat(ctx.data.byteLength)\n return this.getattr(path)\n }\n\n async readdir(path: string): Promise<string[]> {\n // The workspace dispatcher merges namespace structure (child mounts\n // and symlinks) into readdir and answers structure-only directories\n // itself, so the core only normalizes entry shapes and drops macOS\n // metadata names.\n const names = new Set<string>()\n const entries = await this.ops.readdir(this.resolve(path))\n for (const e of entries) {\n const part = rstripSlash(e).split('/').pop() ?? ''\n if (part !== '' && !isMacosMetadata(part)) names.add(part)\n }\n return ['.', '..', ...[...names].sort(compareCodePoints)]\n }\n\n async read(path: string, fd: number, pos: number, len: number): Promise<Uint8Array> {\n const ctx = this.handles.get(fd)\n // Filetype-aware read: no `raw: true`, so an extension with a\n // registered renderer surfaces as rendered text. Mirage registers\n // none by default, so this reads raw bytes until a mount adds one.\n // Matches Python's `self._ops.read(path)`, which also dispatches.\n if (ctx !== undefined && ctx.data === undefined) {\n const cached = this.cachedData(path)\n ctx.data = cached ?? (await this.ops.readFile(this.resolve(path)))\n }\n const data = ctx?.data ?? this.cachedData(path) ?? (await this.ops.readFile(this.resolve(path)))\n return data.subarray(pos, pos + len)\n }\n\n /** Buffer a write on its handle, or apply it directly when there is none. */\n async write(path: string, fd: number, data: Uint8Array, pos: number): Promise<void> {\n const ctx = this.handles.get(fd)\n if (ctx !== undefined) {\n ctx.writeBuf ??= []\n ctx.writeBuf.push([pos, data])\n return\n }\n await this.applyWrites(path, [[pos, data]])\n }\n\n async create(path: string): Promise<number> {\n // Route through the resource's `create` op so backends that distinguish\n // \"create empty\" from \"write bytes\" get the right code path. Falls back\n // to writeFile(empty) when the resource doesn't expose `create`.\n try {\n await this.ops.create(this.resolve(path))\n } catch (dispatchErr) {\n if (!isMissingOp(dispatchErr, 'create')) throw dispatchErr\n await this.writeFile(path, new Uint8Array(0))\n }\n return this.handles.add({ path })\n }\n\n async mkdir(path: string): Promise<void> {\n await this.ops.mkdir(this.resolve(path))\n }\n\n readlink(path: string): string {\n const target = this.linkTarget(path)\n if (target === null) throw errnoError('EINVAL', `not a symbolic link: ${path}`)\n return target\n }\n\n /**\n * Create namespace link `dest -> src` (ln -s src dest; libfuse passes\n * the pointee first). Relative sources are stored verbatim (resolved\n * at follow time, exactly like the shell `ln -s`); absolute sources\n * are mapped into virtual space so a scoped mount stores the path it\n * will later follow.\n */\n async symlink(src: string, dest: string): Promise<void> {\n // The write routes through the op door like every other FUSE op, so\n // session grants and admission policies refuse a scoped kernel\n // mount exactly like a scoped shell.\n if (this.ops.links === null) throw errnoError('EROFS', 'workspace has no namespace links')\n const stored = src.startsWith('/') ? this.resolve(src) : src\n await this.ops.symlink(this.resolve(dest), stored)\n }\n\n async unlink(path: string): Promise<void> {\n const links = this.ops.links\n if (links?.isLink(this.resolve(path)) === true) {\n await links.unlink(this.resolve(path))\n this.xattrs.delete(path)\n this.prefetchCache.delete(path)\n return\n }\n await this.ops.unlink(this.resolve(path))\n this.xattrs.delete(path)\n }\n\n async rename(src: string, dst: string): Promise<void> {\n // The facade is where a cross-mount pair is refused with EXDEV,\n // which is what makes `mv` between two backends fall back to\n // copy+unlink instead of addressing the destination against the\n // source's backend.\n await this.ops.rename(this.resolve(src), this.resolve(dst))\n const moved = this.xattrs.get(src)\n if (moved !== undefined) {\n this.xattrs.delete(src)\n this.xattrs.set(dst, moved)\n }\n }\n\n async rmdir(path: string): Promise<void> {\n // Detect non-empty directories up front so we can signal ENOTEMPTY\n // cleanly. Message-string sniffing alone is unreliable across backends;\n // check contents first.\n try {\n const entries = await this.ops.readdir(this.resolve(path))\n if (entries.length > 0) {\n throw errnoError('ENOTEMPTY', `directory not empty: ${path}`)\n }\n } catch (err) {\n if ((err as { code?: string }).code === 'ENOTEMPTY') throw err\n // readdir failure — fall through to rmdir and let it raise the real\n // error (e.g. ENOENT for missing path).\n }\n await this.ops.rmdir(this.resolve(path))\n this.xattrs.delete(path)\n }\n\n async truncate(path: string, size: number): Promise<void> {\n // Prefer the resource's dedicated `truncate` op (atomic on most\n // backends). Fall back to read/resize/write for resources that don't\n // expose one.\n try {\n await this.ops.truncate(this.resolve(path), size)\n } catch (dispatchErr) {\n if (!isMissingOp(dispatchErr, 'truncate')) throw dispatchErr\n const data = await this.ops\n .readFile(this.resolve(path), { raw: true })\n .catch(() => new Uint8Array(0))\n const out = new Uint8Array(size)\n out.set(data.subarray(0, Math.min(data.byteLength, size)), 0)\n await this.writeFile(path, out)\n }\n }\n\n statfs(): Record<string, number> {\n return {\n bsize: 4096,\n frsize: 4096,\n blocks: 1024 * 1024,\n bfree: 1024 * 1024,\n bavail: 1024 * 1024,\n files: 1_000_000,\n ffree: 1_000_000,\n favail: 1_000_000,\n namemax: 255,\n }\n }\n\n setxattr(path: string, name: string, value: Buffer): void {\n let attrs = this.xattrs.get(path)\n if (attrs === undefined) {\n attrs = new Map()\n this.xattrs.set(path, attrs)\n }\n attrs.set(name, Buffer.from(value))\n }\n\n getxattr(path: string, name: string): Buffer | undefined {\n return this.xattrs.get(path)?.get(name)\n }\n\n listxattr(path: string): string[] {\n const attrs = this.xattrs.get(path)\n return attrs ? [...attrs.keys()] : []\n }\n\n removexattr(path: string, name: string): void {\n this.xattrs.get(path)?.delete(name)\n }\n\n async open(path: string): Promise<number> {\n const s = await this.ops.stat(this.resolve(path))\n const ctx: Handle = { path }\n if (s.size === null && s.type !== FileType.DIRECTORY) {\n const data = await this.prefetch(path)\n if (data !== null) ctx.data = data\n }\n return this.handles.add(ctx)\n }\n\n async release(fd: number): Promise<void> {\n const ctx = this.handles.get(fd)\n if (ctx?.writeBuf !== undefined && ctx.writeBuf.length > 0) {\n // The macFUSE FSKit shim issues WRITE then RELEASE with no FLUSH in\n // between (the kext always flushes on close), so a handle can still\n // hold buffered writes here. Dropping them would silently lose data\n // written through an fskit mount.\n await this.flush(ctx.path, fd)\n }\n this.handles.pop(fd)\n }\n\n async flush(path: string, fd: number): Promise<void> {\n const ctx = this.handles.get(fd)\n if (ctx?.writeBuf === undefined || ctx.writeBuf.length === 0) return\n const writes = ctx.writeBuf\n ctx.writeBuf = []\n await this.applyWrites(path, writes)\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { constants as osConstants } from 'node:os'\n\nimport { classify, type FsCondition } from '@struktoai/mirage-core'\n\n// Positive POSIX errno values. FUSE callbacks want them negated; other\n// kernel interfaces (FSKit) want them positive, so the classification is\n// kept protocol-neutral here and adapters apply their own sign.\nexport const ENOENT = 2\nexport const EIO = 5\nexport const EACCES = 13\nexport const EEXIST = 17\nexport const EINVAL = 22\nexport const ENOTDIR = 20\nexport const EISDIR = 21\nexport const EROFS = 30\n// macOS value; Linux is 39 — fuse-native normalizes.\nexport const ENOTEMPTY = 66\n// A rename across mounts. The kernel reads this as \"not one filesystem\"\n// and `mv` falls back to copy+unlink, so it must survive the trip out.\nexport const EXDEV = 18\n\n// This kernel boundary's own numbering for the shared vocabulary: the\n// naming lives in core's `classify`, and the numbers here are the\n// host's (node:os supplies the platform-variant ones, mirroring how\n// python's adapter reads its errno module).\nconst CONDITION_ERRNO: Record<FsCondition, number> = {\n ENOENT,\n ENOTDIR,\n EISDIR,\n EEXIST,\n EACCES,\n EPERM: osConstants.errno.EPERM,\n ENOTEMPTY,\n EXDEV,\n CROSS_MOUNT: EXDEV,\n ENOTSUP: osConstants.errno.ENOTSUP,\n ELOOP: osConstants.errno.ELOOP,\n EINVAL,\n EIO,\n EBUSY: osConstants.errno.EBUSY,\n EROFS,\n NO_XATTR: osConstants.errno.ENODATA,\n}\n\nconst MESSAGE_ERRNO: [string[], number][] = [\n [['not empty', 'enotempty'], ENOTEMPTY],\n [['not a directory', 'enotdir'], ENOTDIR],\n [['is a directory', 'eisdir'], EISDIR],\n // A session capability rejection (MountNotAllowedError) is a permission\n // failure, mirroring Python's PermissionError -> EACCES.\n [['not allowed to access mount'], EACCES],\n [['permission', 'eacces', 'read-only'], EACCES],\n [['file exists', 'eexist'], EEXIST],\n [['not found', 'no such', 'enoent', 'no mount'], ENOENT],\n]\n\n/**\n * Map a mirage-native error onto a positive POSIX errno.\n *\n * Mirrors Python's `mirage.fuse.errors.classify_error` so both languages\n * report the same errno for the same backend failure. The naming lives in\n * core's `classify` (shared with the wasi shim and the monty encoders);\n * this adapter only renders the condition in host numbers. A stamped code\n * outside the vocabulary is passed through in the host's own numbering\n * (Python's raw OSError.errno passthrough), and the message needles are a\n * last resort for unstamped errors, not a classification channel.\n */\nexport function classifyErrno(err: unknown): number {\n const condition = classify(err)\n if (condition !== null) return CONDITION_ERRNO[condition]\n const code = (err as { code?: string }).code\n if (code !== undefined) {\n const errnos = osConstants.errno as Record<string, number>\n const passthrough = errnos[code]\n if (passthrough !== undefined) return passthrough\n }\n const msg = (err instanceof Error ? err.message : String(err)).toLowerCase()\n for (const [needles, errno] of MESSAGE_ERRNO) {\n if (needles.some((n) => msg.includes(n))) return errno\n }\n return EIO\n}\n\n/** Same classification, negated for `@zkochan/fuse-native` callbacks. */\nexport function classifyError(err: unknown): number {\n return -classifyErrno(err)\n}\n\n/**\n * Build an error carrying a POSIX code, so the mount core can signal a\n * specific errno without importing any adapter's numbering.\n */\nexport function errnoError(code: FsCondition, message: string): Error {\n return Object.assign(new Error(message), { code })\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nconst MACOS_METADATA: ReadonlySet<string> = new Set([\n '.DS_Store',\n '.Spotlight-V100',\n '.fseventsd',\n '.Trashes',\n])\n\nexport function isMacosMetadata(name: string): boolean {\n return MACOS_METADATA.has(name) || name.startsWith('._')\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { Limit, MountBackend, MountMode, Resource } from '@struktoai/mirage-core'\n\nexport interface MountSpecOptions {\n /** Per-mount mode override; falls back to the workspace default when unset. */\n mode?: MountMode\n /**\n * How the mount is exposed. `vfs` (the default) keeps it inside mirage's\n * own filesystem; `fuse` and `fskit` also register a real mountpoint.\n */\n backend?: MountBackend\n /**\n * Where to mount, for the kernel backends. Omitted picks a temporary\n * directory appropriate for the backend. Ignored when backend is `vfs`.\n */\n mountpoint?: string\n commandLimits?: Record<string, Limit>\n}\n\nexport class Mount {\n constructor(\n readonly resource: Resource,\n readonly options: MountSpecOptions = {},\n ) {}\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { createRequire } from 'node:module'\nimport { registerCompressionCodec } from '@struktoai/mirage-core'\n\ninterface BunzipModule {\n decode(input: Uint8Array): Uint8Array\n}\n\ninterface XzModule {\n compress(input: Uint8Array): Promise<Uint8Array>\n decompress(input: Uint8Array): Promise<Uint8Array>\n}\n\n// seek-bzip and @napi-rs/lzma are CommonJS; load them via createRequire so\n// the built ESM output resolves their exports without named-import interop\n// pitfalls (mirrors the createRequire usage in workspace.ts).\nconst requireCjs = createRequire(import.meta.url)\nconst bunzip = requireCjs('seek-bzip') as BunzipModule\nconst { xz } = requireCjs('@napi-rs/lzma') as { xz: XzModule }\n\n// bzip2 is decompress-only on purpose: seek-bzip is the maintained\n// permissively licensed implementation and it only decodes, so `tar -cj`\n// reports unsupported while `-xj` / `-tj` work. The pure-JS compressor that\n// used to sit here (compressjs) is GPL, which an Apache-2.0 package cannot\n// ship.\nregisterCompressionCodec('bzip2', {\n decompress: (bytes) => Promise.resolve(Uint8Array.from(bunzip.decode(bytes))),\n})\n\nregisterCompressionCodec('xz', {\n compress: async (bytes) => new Uint8Array(await xz.compress(Buffer.from(bytes))),\n decompress: async (bytes) => new Uint8Array(await xz.decompress(Buffer.from(bytes))),\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n loadOptionalPeer,\n registerRuntime,\n RemoteSandbox,\n type RuntimeOptions,\n type RunResult,\n stdinPath,\n stdinRedirect,\n} from '@struktoai/mirage-core'\nimport { DAYTONA_CONFIG_KEYS, type DaytonaConfig } from './config.ts'\nimport type { Daytona, Sandbox } from '@daytonaio/sdk'\nimport type * as daytonaSdk from '@daytonaio/sdk'\n\nexport type DaytonaSdk = typeof daytonaSdk\n\nconst ENC = new TextEncoder()\n\n/**\n * A Daytona sandbox the user runs as a whole-line runtime.\n *\n * You create the sandbox yourself (dashboard, `daytona sandbox\n * create`, or the SDK); mirage only connects by `sandboxId` and execs\n * lines. `apiKey` falls back to DAYTONA_API_KEY. Daytona's exec has\n * no stdin and reports combined output, so piped bytes are uploaded\n * and redirected in, and stderr comes back null. close() releases the\n * SDK client and never touches the sandbox.\n */\nexport class DaytonaRuntime extends RemoteSandbox<DaytonaConfig> {\n readonly name = 'daytona'\n private client: Daytona | null = null\n private sandbox: Sandbox | null = null\n\n constructor(options: RuntimeOptions<DaytonaConfig> | Record<string, unknown> = {}) {\n super(options, DAYTONA_CONFIG_KEYS)\n if (!this.config.sandboxId) {\n throw new Error('daytona config needs sandboxId: the id of a live sandbox you created')\n }\n }\n\n // The SDK loader as a seam: tests substitute a fake module here.\n protected loadSdk(): Promise<DaytonaSdk> {\n return loadOptionalPeer(() => import('@daytonaio/sdk'), {\n feature: \"the 'daytona' runtime\",\n packageName: '@daytonaio/sdk',\n })\n }\n\n async connect(): Promise<void> {\n if (this.client === null) {\n const sdk = await this.loadSdk()\n this.client = new sdk.Daytona(\n this.config.apiKey !== undefined ? { apiKey: this.config.apiKey } : undefined,\n )\n }\n this.sandbox = await this.client.get(this.config.sandboxId)\n }\n\n async execLine(\n line: string,\n stdin: Uint8Array | null,\n env: Record<string, string>,\n cwd: string,\n ): Promise<RunResult> {\n if (this.sandbox === null) throw new Error('daytona sandbox not connected')\n let command = line\n if (stdin !== null) {\n const path = stdinPath()\n await this.upload(path, stdin)\n command = stdinRedirect(line, path)\n }\n const response = await this.sandbox.process.executeCommand(command, cwd, env)\n return {\n stdout: ENC.encode(response.result),\n stderr: null,\n exitCode: response.exitCode,\n }\n }\n\n private async upload(path: string, data: Uint8Array): Promise<void> {\n if (this.sandbox === null) throw new Error('daytona sandbox not connected')\n const slash = path.lastIndexOf('/')\n const parent = slash > 0 ? path.slice(0, slash) : ''\n if (parent !== '') await this.sandbox.fs.createFolder(parent, '755')\n await this.sandbox.fs.uploadFile(Buffer.from(data), path)\n }\n\n /** Release the SDK client; the sandbox itself is the user's. */\n override async close(): Promise<void> {\n this.sandbox = null\n if (this.client !== null) {\n await this.client[Symbol.asyncDispose]()\n this.client = null\n }\n }\n}\n\nregisterRuntime('daytona', DaytonaRuntime)\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { SandboxConfig } from '@struktoai/mirage-core'\n\n/** How to reach the user's live Daytona sandbox. */\nexport interface DaytonaConfig extends SandboxConfig {\n /**\n * Id of a sandbox you created (dashboard, `daytona sandbox create`,\n * or the SDK). Boot it from an image or snapshot with fuse3 and\n * mirage installed.\n */\n sandboxId: string\n /** Daytona credential; absent reads DAYTONA_API_KEY. */\n apiKey?: string\n}\n\nexport const DAYTONA_CONFIG_KEYS: readonly string[] = ['env', 'sandboxId', 'apiKey']\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n appendFile,\n mkdir,\n readdir,\n readFile,\n rmdir,\n stat,\n unlink,\n writeFile,\n} from 'node:fs/promises'\nimport path from 'node:path'\nimport { ObserverStoreBase } from '@struktoai/mirage-core'\n\n/**\n * ObserverStore backed by a directory of JSONL files. Created lazily on\n * first append. Mirrors the Python DiskObserverStore.\n */\nexport class DiskObserverStore extends ObserverStoreBase {\n private readonly root: string\n\n constructor(root: string) {\n super()\n this.root = root\n }\n\n private abs(key: string): string {\n return path.join(this.root, key.replace(/^\\/+/, ''))\n }\n\n async append(key: string, data: Uint8Array): Promise<void> {\n const absPath = this.abs(key)\n await mkdir(path.dirname(absPath), { recursive: true })\n await appendFile(absPath, data)\n }\n\n async write(key: string, data: Uint8Array): Promise<void> {\n const absPath = this.abs(key)\n await mkdir(path.dirname(absPath), { recursive: true })\n await writeFile(absPath, data)\n }\n\n async readMatching(suffix: string): Promise<Map<string, Uint8Array>> {\n const out = new Map<string, Uint8Array>()\n const { files } = await this.walk()\n for (const absPath of files) {\n const rel = '/' + path.relative(this.root, absPath)\n if (!rel.endsWith(suffix)) continue\n out.set(rel, new Uint8Array(await readFile(absPath)))\n }\n return out\n }\n\n async clear(): Promise<void> {\n const { files, dirs } = await this.walk()\n for (const absPath of files) await unlink(absPath)\n for (const d of [...dirs].reverse()) await rmdir(d)\n }\n\n private async rootIsDir(): Promise<boolean> {\n try {\n return (await stat(this.root)).isDirectory()\n } catch (err) {\n // Nothing recorded yet is the normal state before the first\n // append; anything else (EACCES, EIO) is a real fault and must\n // not read as an empty history.\n if ((err as NodeJS.ErrnoException).code === 'ENOENT') return false\n throw err\n }\n }\n\n private async walk(): Promise<{ files: string[]; dirs: string[] }> {\n const files: string[] = []\n const dirs: string[] = []\n if (!(await this.rootIsDir())) return { files, dirs }\n const stack: string[] = [this.root]\n while (stack.length > 0) {\n const d = stack.pop()\n if (d === undefined) break\n // Deliberately unguarded: a readdir that fails mid-tree used to\n // be swallowed, so readAll/readMatching returned a silently\n // partial recording and clear() reported success while leaving\n // files behind.\n const entries = await readdir(d, { withFileTypes: true })\n dirs.push(d)\n for (const entry of entries) {\n const full = path.join(d, entry.name)\n if (entry.isDirectory()) stack.push(full)\n else files.push(full)\n }\n }\n return { files, dirs }\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RedisClientType } from 'redis'\nimport { compareCodePoints, ObserverStoreBase } from '@struktoai/mirage-core'\nimport { loadOptionalPeer } from '../optional_peer.ts'\n\nexport interface RedisObserverStoreOptions {\n url?: string\n keyPrefix?: string\n}\n\n/**\n * ObserverStore backed by Redis strings (one key per JSONL file).\n *\n * Appends use the atomic Redis APPEND command; an index set tracks which\n * file keys exist so readAll needs no SCAN. Mirrors the Python\n * RedisObserverStore.\n */\nexport class RedisObserverStore extends ObserverStoreBase {\n readonly url: string\n private readonly prefix: string\n private readonly indexKey: string\n private clientPromise: Promise<RedisClientType> | null = null\n\n constructor(options: RedisObserverStoreOptions = {}) {\n super()\n this.url = options.url ?? 'redis://localhost:6379/0'\n this.prefix = options.keyPrefix ?? 'mirage:observer:'\n this.indexKey = `${this.prefix}keys`\n }\n\n private async client(): Promise<RedisClientType> {\n this.clientPromise ??= (async () => {\n const mod = await loadOptionalPeer(\n () =>\n import('redis') as unknown as Promise<{\n createClient: (o: { url: string }) => RedisClientType\n }>,\n { feature: 'RedisObserverStore', packageName: 'redis' },\n )\n const c = mod.createClient({\n url: this.url,\n socket: { reconnectStrategy: false },\n } as Parameters<typeof mod.createClient>[0])\n await c.connect()\n return c\n })()\n return this.clientPromise\n }\n\n async append(key: string, data: Uint8Array): Promise<void> {\n const c = await this.client()\n const buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength)\n await c.multi().append(`${this.prefix}${key}`, buf).sAdd(this.indexKey, key).exec()\n }\n\n async write(key: string, data: Uint8Array): Promise<void> {\n const c = await this.client()\n const buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength)\n await c.multi().set(`${this.prefix}${key}`, buf).sAdd(this.indexKey, key).exec()\n }\n\n async readMatching(suffix: string): Promise<Map<string, Uint8Array>> {\n const paths = (await this.indexedPaths()).filter((p) => p.endsWith(suffix))\n return this.readPaths(paths)\n }\n\n private async indexedPaths(): Promise<string[]> {\n const c = await this.client()\n const members = await c.sMembers(this.indexKey)\n return [...members].sort(compareCodePoints)\n }\n\n private async readPaths(paths: string[]): Promise<Map<string, Uint8Array>> {\n const out = new Map<string, Uint8Array>()\n if (paths.length === 0) return out\n const c = await this.client()\n const mod = (await import('redis')) as unknown as {\n RESP_TYPES: { readonly BLOB_STRING: number }\n }\n const mapping: Record<number, unknown> = { [mod.RESP_TYPES.BLOB_STRING]: Buffer }\n const typed = c as unknown as {\n withTypeMapping: (m: Record<number, unknown>) => {\n mGet: (keys: string[]) => Promise<(Buffer | null)[]>\n }\n }\n const values = await typed.withTypeMapping(mapping).mGet(paths.map((p) => `${this.prefix}${p}`))\n paths.forEach((p, i) => {\n const raw = values[i]\n out.set(p, raw === null || raw === undefined ? new Uint8Array() : new Uint8Array(raw))\n })\n return out\n }\n\n async clear(): Promise<void> {\n const c = await this.client()\n const paths = await this.indexedPaths()\n const keys = [...paths.map((p) => `${this.prefix}${p}`), this.indexKey]\n if (keys.length > 0) await c.del(keys)\n }\n\n override async close(): Promise<void> {\n // Idempotent: the workspace closes the plane store it consumed and the\n // owning WorkspaceStateStore closes every plane it built; the second\n // close must be a no-op, not a crash on an already-quit client.\n if (this.clientPromise === null) return\n const pending = this.clientPromise\n this.clientPromise = null\n const c = await pending\n await c.quit()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RedisClientType } from 'redis'\nimport {\n Channel,\n type ConsoleChunk,\n type ConsoleStore,\n type ReadResult,\n} from '@struktoai/mirage-core'\nimport { loadOptionalPeer } from '../../../optional_peer.ts'\nimport { APPEND_LUA, POLL_MS } from './constants.ts'\n\ninterface StreamEntry {\n id: { toString: () => string }\n message: Partial<Record<string, Buffer>>\n}\n\nexport interface RedisConsoleStoreOptions {\n url?: string\n keyPrefix?: string\n /** Expire the keys this long after the last append; absent keeps them. */\n ttlSeconds?: number\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise<void>((resolve) => setTimeout(resolve, ms))\n}\n\n/**\n * Console storage on a Redis stream, for readers in other processes.\n *\n * One stream per job: chunk seq maps to stream id `(seq+1)-0`, with the\n * channel, payload and timestamp as entry fields (`c`/`d`/`t`). The\n * job's process appends through its store instance; a reader anywhere\n * else attaches its own instance on the same keyPrefix and follows\n * live, which is what RAM cannot offer. The schema matches the Python\n * RedisConsoleStore byte for byte, so the reader does not have to be\n * the writer's language.\n *\n * The job owns its keys: a factory must hand every job a prefix nothing\n * else has written, because a reused stream replays the previous job's\n * chunks, ending chunk included. `keyPrefix` stays public because it is\n * the console's address: an embedder reads it off a job's store and\n * hands it to the process that should attach.\n *\n * The ending chunk is terminal in the store itself, not only in this\n * process: the append script refuses any append once a CONTROL chunk\n * landed, so an emit that raced a kill past `JobConsole`'s local guard\n * is dropped server-side instead of landing after the ending.\n *\n * `wait` polls the seq counter rather than blocking server-side the way\n * Python's XREAD BLOCK does: node-redis serializes commands on one\n * connection, so a blocking read would wedge the job's own appends\n * behind it, and a second connection costs more than a short poll.\n * There is no retention trim, so readFrom never reports a truncated\n * cursor; retention is bounded by `ttlSeconds` instead, refreshed on\n * every append, so a console expires that long after its job's last\n * write.\n */\nexport class RedisConsoleStore implements ConsoleStore {\n readonly url: string\n readonly keyPrefix: string\n private readonly streamKey: string\n private readonly counterKey: string\n private readonly endedKey: string\n private readonly ttlSeconds: number\n private clientPromise: Promise<RedisClientType> | null = null\n private isClosed = false\n\n constructor(options: RedisConsoleStoreOptions = {}) {\n this.url = options.url ?? 'redis://localhost:6379/0'\n this.keyPrefix = options.keyPrefix ?? 'mirage:console:'\n this.streamKey = `${this.keyPrefix}stream`\n this.counterKey = `${this.keyPrefix}seq`\n this.endedKey = `${this.keyPrefix}ended`\n this.ttlSeconds = options.ttlSeconds ?? 0\n }\n\n get closed(): boolean {\n return this.isClosed\n }\n\n private async client(): Promise<RedisClientType> {\n this.clientPromise ??= (async () => {\n const mod = await loadOptionalPeer(\n () =>\n import('redis') as unknown as Promise<{\n createClient: (o: { url: string }) => RedisClientType\n }>,\n { feature: 'RedisConsoleStore', packageName: 'redis' },\n )\n const c = mod.createClient({\n url: this.url,\n socket: { reconnectStrategy: false },\n } as Parameters<typeof mod.createClient>[0])\n await c.connect()\n return c\n })()\n return this.clientPromise\n }\n\n /**\n * Append one chunk, atomically against the console's ending.\n *\n * A dropped append (the console already ended) reports the last real\n * chunk's seq; `JobConsole.emit` ignores the return and the drop is\n * exactly its documented after-the-ending semantics.\n */\n async append(channel: Channel, data: Uint8Array): Promise<ConsoleChunk> {\n const c = await this.client()\n const ts = Date.now() / 1000\n const buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength)\n const count = (await c.eval(APPEND_LUA, {\n keys: [this.streamKey, this.counterKey, this.endedKey],\n arguments: [\n channel,\n buf,\n String(ts),\n channel === Channel.CONTROL ? '1' : '0',\n String(this.ttlSeconds),\n ],\n })) as number\n return { seq: count - 1, ts, channel, data }\n }\n\n async readFrom(seq: number, limit?: number): Promise<ReadResult> {\n const c = await this.client()\n const mod = (await import('redis')) as unknown as {\n RESP_TYPES: { readonly BLOB_STRING: number }\n }\n const mapping: Record<number, unknown> = { [mod.RESP_TYPES.BLOB_STRING]: Buffer }\n const typed = c as unknown as {\n withTypeMapping: (m: Record<number, unknown>) => {\n xRange: (\n key: string,\n start: string,\n end: string,\n options?: { COUNT: number },\n ) => Promise<StreamEntry[]>\n }\n }\n const entries = await typed\n .withTypeMapping(mapping)\n .xRange(\n this.streamKey,\n `${(seq + 1).toString()}-0`,\n '+',\n limit === undefined ? undefined : { COUNT: limit },\n )\n const chunks = entries.map((entry) => this.chunk(entry))\n const first = chunks[0]\n const last = chunks[chunks.length - 1]\n if (first !== undefined && last !== undefined) {\n return [chunks, last.seq + 1, first.seq > seq]\n }\n // An empty window still clamps the cursor the way RAM does, so a\n // follower armed past the end waits at the next real seq.\n const raw = await c.get(this.counterKey)\n const total = raw === null ? 0 : Number(raw)\n return [[], Math.min(seq, total), false]\n }\n\n async wait(seq: number): Promise<void> {\n // Checked before touching the client: close() nulls the promise,\n // and a wait arriving later must not reconnect a discarded store.\n if (this.isClosed) return\n const c = await this.client()\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- close() flips it across awaits\n while (!this.isClosed) {\n let raw: string | null\n try {\n raw = await c.get(this.counterKey)\n } catch (err) {\n // close() tore down the client under a parked reader; that is\n // the documented way a wait ends early.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- close() flips it across awaits\n if (this.isClosed) return\n throw err\n }\n if (raw !== null && Number(raw) > seq) return\n await sleep(POLL_MS)\n }\n }\n\n async close(): Promise<void> {\n // Idempotent, and the flag flips before the quit so a parked wait\n // that wakes mid-teardown returns instead of re-polling.\n this.isClosed = true\n if (this.clientPromise === null) return\n const pending = this.clientPromise\n this.clientPromise = null\n const c = await pending\n await c.quit()\n }\n\n /** Delete the console's keys (test and integ teardown only). */\n async clear(): Promise<void> {\n const c = await this.client()\n await c.del([this.streamKey, this.counterKey, this.endedKey])\n }\n\n private chunk(entry: StreamEntry): ConsoleChunk {\n return {\n seq: Number(entry.id.toString().split('-')[0]) - 1,\n ts: Number(entry.message.t?.toString() ?? '0'),\n channel: (entry.message.c?.toString() ?? 'stdout') as Channel,\n data: new Uint8Array(entry.message.d ?? Buffer.alloc(0)),\n }\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { readFileSync } from 'node:fs'\n\n// INCR hands out the dense seq and XADD stores the chunk under the\n// stream id `(seq+1)-0` in one atomic step, so two appends racing (a\n// kill marker against a runner's last emit) cannot collide on an id.\n// Shipped next to this module in src and copied beside the bundle in\n// dist (tsup onSuccess); byte-identical to the Python append.lua.\nexport const APPEND_LUA = readFileSync(new URL('./append.lua', import.meta.url), 'utf8')\n\nexport const POLL_MS = 100\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { NamespaceStore, type NodeFields } from '@struktoai/mirage-core'\nimport { DiskRecordClient } from '../record/disk.ts'\n\nconst NAMESPACE_RECORD = 'namespace'\n\ninterface NamespaceState {\n nodes: Record<string, NodeFields>\n user: string | null\n}\n\n/**\n * NamespaceStore backed by one `namespace.json` per workspace.\n *\n * The whole plane is one human-readable record\n * `{\"nodes\": {path: fields}, \"user\": ...}`: the namespace is bound to\n * the workspace, so it serializes as one JSON file, not per-node\n * files. Read-modify-writes take the record's lockfile so concurrent\n * local processes never lose a node upsert; the write itself stays\n * tmp-then-rename atomic, so readers never see a torn file. Mirrors\n * the Python DiskNamespaceStore byte-for-byte on disk.\n */\nexport class DiskNamespaceStore extends NamespaceStore {\n private readonly records: DiskRecordClient\n\n constructor(root: string) {\n super()\n this.records = new DiskRecordClient(root, '')\n }\n\n private async state(): Promise<NamespaceState> {\n const [fields] = await this.records.get(NAMESPACE_RECORD)\n if (fields === null) return { nodes: {}, user: null }\n return {\n nodes: (fields.nodes as Record<string, NodeFields> | undefined) ?? {},\n user: typeof fields.user === 'string' ? fields.user : null,\n }\n }\n\n private async write(state: NamespaceState): Promise<void> {\n await this.records.put(NAMESPACE_RECORD, { nodes: state.nodes, user: state.user })\n }\n\n async load(): Promise<Map<string, NodeFields>> {\n return new Map(Object.entries((await this.state()).nodes))\n }\n\n async set(path: string, fields: NodeFields): Promise<void> {\n const fh = await this.records.lock(NAMESPACE_RECORD)\n try {\n const state = await this.state()\n state.nodes[path] = fields\n await this.write(state)\n } finally {\n await this.records.unlock(NAMESPACE_RECORD, fh)\n }\n }\n\n async delete(paths: readonly string[]): Promise<void> {\n const fh = await this.records.lock(NAMESPACE_RECORD)\n try {\n const state = await this.state()\n const drop = new Set(paths)\n state.nodes = Object.fromEntries(\n Object.entries(state.nodes).filter(([path]) => !drop.has(path)),\n )\n await this.write(state)\n } finally {\n await this.records.unlock(NAMESPACE_RECORD, fh)\n }\n }\n\n async replaceAll(entries: Map<string, NodeFields>): Promise<void> {\n const fh = await this.records.lock(NAMESPACE_RECORD)\n try {\n const state = await this.state()\n state.nodes = Object.fromEntries(entries)\n await this.write(state)\n } finally {\n await this.records.unlock(NAMESPACE_RECORD, fh)\n }\n }\n\n async loadUser(): Promise<string | null> {\n return (await this.state()).user\n }\n\n async setUser(user: string): Promise<void> {\n const fh = await this.records.lock(NAMESPACE_RECORD)\n try {\n const state = await this.state()\n state.user = user\n await this.write(state)\n } finally {\n await this.records.unlock(NAMESPACE_RECORD, fh)\n }\n }\n\n async clear(): Promise<void> {\n const fh = await this.records.lock(NAMESPACE_RECORD)\n try {\n await this.write({ nodes: {}, user: null })\n } finally {\n await this.records.unlock(NAMESPACE_RECORD, fh)\n }\n }\n\n async close(): Promise<void> {\n await this.records.close()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { mkdir, open, readFile, readdir, rename, stat, unlink, writeFile } from 'node:fs/promises'\nimport type { FileHandle } from 'node:fs/promises'\nimport path from 'node:path'\nimport { generationOf } from '@struktoai/mirage-core'\n\n// A .lock older than this is presumed abandoned by a crashed writer and\n// reclaimed (loudly). Live CAS critical sections are milliseconds.\nconst LOCK_STALE_SECONDS = 10\nconst LOCK_RETRY_SLEEP_MS = 5\nconst LOCK_RETRY_LIMIT = 2000\n\nlet tmpCounter = 0\n\n// Match Python's urllib quote(safe=\"\"): percent-encode everything\n// outside the unreserved set, so both runtimes produce byte-identical\n// filenames over one shared state directory.\nfunction quoteName(name: string): string {\n return encodeURIComponent(name).replace(\n /[!'()*]/g,\n (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,\n )\n}\n\nfunction isMissing(e: unknown): boolean {\n return (e as NodeJS.ErrnoException).code === 'ENOENT'\n}\n\n/**\n * One JSON-record-per-file client with lockfile CAS.\n *\n * The disk twin of `S3RecordClient`: a record is one file at\n * `{root}/{prefix}{name}.json`, written atomically (tmp then rename(2))\n * so readers never see a torn record. The conditional write serializes\n * on a `{record}.lock` created with O_CREAT|O_EXCL, so compare and\n * write hit the same stored version. Record names are percent-encoded\n * into filenames, so any id is safe. Mirrors the Python\n * DiskRecordClient byte-for-byte on disk.\n */\nexport class DiskRecordClient {\n private readonly dir: string\n\n constructor(root: string, prefix: string) {\n this.dir = path.join(root, prefix)\n }\n\n recordPath(name: string): string {\n return path.join(this.dir, `${quoteName(name)}.json`)\n }\n\n // The token slot mirrors the S3 client's ETag but stays empty: disk\n // CAS anchors on the lockfile, not on a version token.\n async get(name: string): Promise<[Record<string, unknown> | null, string]> {\n let body: Buffer\n try {\n body = await readFile(this.recordPath(name))\n } catch (e) {\n if (isMissing(e)) return [null, '']\n throw e\n }\n return [JSON.parse(body.toString()) as Record<string, unknown>, '']\n }\n\n async put(name: string, fields: Record<string, unknown>): Promise<void> {\n await mkdir(this.dir, { recursive: true })\n await this.writeRecord(this.recordPath(name), fields)\n }\n\n /**\n * Write one record iff its stored generation matches.\n *\n * Take the record's lockfile, re-read under the lock, check the\n * generation, then tmp-write + rename. Losing the lock race or the\n * generation check resolves false; the caller adopts and retries.\n */\n async casPut(\n name: string,\n fields: Record<string, unknown>,\n expectedGeneration: number,\n ): Promise<boolean> {\n await mkdir(this.dir, { recursive: true })\n const target = this.recordPath(name)\n const lockPath = `${target}.lock`\n let fh = await this.acquireLock(lockPath)\n if (fh === null) {\n if (!(await this.reclaimStaleLock(lockPath))) return false\n fh = await this.acquireLock(lockPath)\n if (fh === null) return false\n }\n try {\n const [stored] = await this.get(name)\n if (generationOf(stored) !== expectedGeneration) return false\n await this.writeRecord(target, fields)\n return true\n } finally {\n await this.releaseLock(fh, lockPath)\n }\n }\n\n async listNames(): Promise<string[]> {\n let entries: string[]\n try {\n entries = await readdir(this.dir)\n } catch (e) {\n if (isMissing(e)) return []\n throw e\n }\n return entries\n .filter((n) => n.endsWith('.json'))\n .map((n) => decodeURIComponent(n.slice(0, -'.json'.length)))\n }\n\n async loadAll(): Promise<Map<string, Record<string, unknown>>> {\n const names = await this.listNames()\n const records = await Promise.all(names.map((name) => this.get(name)))\n const out = new Map<string, Record<string, unknown>>()\n for (let i = 0; i < names.length; i++) {\n const name = names[i]\n const fields = records[i]?.[0]\n if (name !== undefined && fields != null) out.set(name, fields)\n }\n return out\n }\n\n async delete(names: Iterable<string>): Promise<void> {\n for (const name of names) {\n try {\n await unlink(this.recordPath(name))\n } catch (e) {\n // Delete promises absence; already-absent is success.\n if (!isMissing(e)) throw e\n }\n }\n }\n\n async clear(): Promise<void> {\n await this.delete(await this.listNames())\n }\n\n async close(): Promise<void> {\n // Nothing held open between calls.\n }\n\n /**\n * Block until this record's lockfile is held; handle to release.\n *\n * For callers doing a read-modify-write that is not generation-CAS\n * (e.g. the single-file namespace plane); spins past contention and\n * reclaims stale locks, throwing only if a live writer holds the\n * lock for the whole retry budget (~10s).\n */\n async lock(name: string): Promise<FileHandle> {\n await mkdir(this.dir, { recursive: true })\n const lockPath = `${this.recordPath(name)}.lock`\n for (let i = 0; i < LOCK_RETRY_LIMIT; i++) {\n const fh = await this.acquireLock(lockPath)\n if (fh !== null) return fh\n if (await this.reclaimStaleLock(lockPath)) continue\n await new Promise((r) => setTimeout(r, LOCK_RETRY_SLEEP_MS))\n }\n throw new Error(`could not acquire lock ${lockPath}`)\n }\n\n async unlock(name: string, fh: FileHandle): Promise<void> {\n await this.releaseLock(fh, `${this.recordPath(name)}.lock`)\n }\n\n // O_CREAT|O_EXCL ('wx'): filesystem-atomic mutex, the git protocol.\n // Local filesystems only (O_EXCL is unreliable on ancient NFS, the\n // same caveat git ships with).\n private async acquireLock(lockPath: string): Promise<FileHandle | null> {\n let fh: FileHandle\n try {\n fh = await open(lockPath, 'wx')\n } catch (e) {\n if ((e as NodeJS.ErrnoException).code === 'EEXIST') return null\n throw e\n }\n await fh.write(String(process.pid))\n return fh\n }\n\n // True when the lock is gone or was stale and removed; false when a\n // live writer still holds it.\n private async reclaimStaleLock(lockPath: string): Promise<boolean> {\n let mtimeMs: number\n try {\n mtimeMs = (await stat(lockPath)).mtimeMs\n } catch (e) {\n if (isMissing(e)) return true\n throw e\n }\n const age = (Date.now() - mtimeMs) / 1000\n if (age <= LOCK_STALE_SECONDS) return false\n console.warn(`mirage: reclaiming stale lock ${lockPath} (age ${age.toFixed(1)}s)`)\n try {\n await unlink(lockPath)\n } catch (e) {\n // The holder released it between the stat and the unlink; the\n // lock is gone either way, which is all this method promises.\n if (!isMissing(e)) throw e\n }\n return true\n }\n\n private async releaseLock(fh: FileHandle, lockPath: string): Promise<void> {\n await fh.close()\n try {\n await unlink(lockPath)\n } catch (e) {\n // Only reachable when another writer reclaimed this lock as\n // stale; the record write already landed, nothing to undo.\n if (!isMissing(e)) throw e\n console.warn(`mirage: lock ${lockPath} vanished before release (reclaimed?)`)\n }\n }\n\n private async writeRecord(target: string, fields: Record<string, unknown>): Promise<void> {\n const tmp = `${target}.${String(process.pid)}.${String(tmpCounter++)}.tmp`\n await writeFile(tmp, JSON.stringify(fields))\n await rename(tmp, target)\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RedisClientType } from 'redis'\nimport { NamespaceStore, type NodeFields } from '@struktoai/mirage-core'\nimport { loadOptionalPeer } from '../../optional_peer.ts'\n\nexport interface RedisNamespaceStoreOptions {\n url?: string\n keyPrefix?: string\n}\n\n/**\n * NamespaceStore backed by one Redis hash (path -> JSON fields).\n *\n * Symlinks and attribute overlays survive process restarts and are visible\n * to any workspace pointed at the same key prefix. Writes are\n * single-command (HSET/HDEL) so mutations stay one round trip. Mirrors the\n * Python RedisNamespaceStore.\n */\nexport class RedisNamespaceStore extends NamespaceStore {\n readonly url: string\n private readonly key: string\n private readonly userKey: string\n private clientPromise: Promise<RedisClientType> | null = null\n\n constructor(options: RedisNamespaceStoreOptions = {}) {\n super()\n this.url = options.url ?? 'redis://localhost:6379/0'\n const prefix = options.keyPrefix ?? 'mirage:namespace:'\n this.key = `${prefix}nodes`\n this.userKey = `${prefix}user`\n }\n\n private async client(): Promise<RedisClientType> {\n this.clientPromise ??= (async () => {\n const mod = await loadOptionalPeer(\n () =>\n import('redis') as unknown as Promise<{\n createClient: (o: { url: string }) => RedisClientType\n }>,\n { feature: 'RedisNamespaceStore', packageName: 'redis' },\n )\n const c = mod.createClient({\n url: this.url,\n socket: { reconnectStrategy: false },\n } as Parameters<typeof mod.createClient>[0])\n await c.connect()\n return c\n })()\n return this.clientPromise\n }\n\n async load(): Promise<Map<string, NodeFields>> {\n const c = await this.client()\n const raw = await c.hGetAll(this.key)\n const out = new Map<string, NodeFields>()\n for (const [path, value] of Object.entries(raw)) {\n out.set(path, JSON.parse(value) as NodeFields)\n }\n return out\n }\n\n async set(path: string, fields: NodeFields): Promise<void> {\n const c = await this.client()\n await c.hSet(this.key, path, JSON.stringify(fields))\n }\n\n async delete(paths: readonly string[]): Promise<void> {\n if (paths.length === 0) return\n const c = await this.client()\n await c.hDel(this.key, [...paths])\n }\n\n async replaceAll(entries: Map<string, NodeFields>): Promise<void> {\n const c = await this.client()\n const multi = c.multi().del(this.key)\n for (const [path, fields] of entries) {\n multi.hSet(this.key, path, JSON.stringify(fields))\n }\n await multi.exec()\n }\n\n async loadUser(): Promise<string | null> {\n const c = await this.client()\n return c.get(this.userKey)\n }\n\n async setUser(user: string): Promise<void> {\n const c = await this.client()\n await c.set(this.userKey, user)\n }\n\n async clear(): Promise<void> {\n const c = await this.client()\n await c.del([this.key, this.userKey])\n }\n\n async close(): Promise<void> {\n // Idempotent: the workspace closes the plane store it consumed and the\n // owning WorkspaceStateStore closes every plane it built; the second\n // close must be a no-op, not a crash on an already-quit client.\n if (this.clientPromise === null) return\n const pending = this.clientPromise\n this.clientPromise = null\n const c = await pending\n await c.quit()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { SessionStore, type SessionFields } from '@struktoai/mirage-core'\n\nimport { DiskRecordClient } from '../record/disk.ts'\n\n/**\n * SessionStore backed by per-session files under one directory.\n *\n * One file per session at `{root}/sessions/{session_id}.json`, lockfile\n * CAS per record, so multiple local processes share one session table\n * with the same generation contract as the Redis Lua script, with zero\n * infrastructure. Mirrors the Python DiskSessionStore.\n */\nexport class DiskSessionStore extends SessionStore {\n private readonly records: DiskRecordClient\n\n constructor(root: string) {\n super()\n this.records = new DiskRecordClient(root, 'sessions/')\n }\n\n async load(): Promise<Map<string, SessionFields>> {\n return await this.records.loadAll()\n }\n\n async set(sessionId: string, fields: SessionFields): Promise<void> {\n await this.records.put(sessionId, fields)\n }\n\n async casSet(\n sessionId: string,\n fields: SessionFields,\n expectedGeneration: number,\n ): Promise<boolean> {\n return await this.records.casPut(sessionId, fields, expectedGeneration)\n }\n\n async delete(sessionIds: readonly string[]): Promise<void> {\n await this.records.delete(sessionIds)\n }\n\n async replaceAll(entries: Map<string, SessionFields>): Promise<void> {\n const stale = (await this.records.listNames()).filter((n) => !entries.has(n))\n await this.records.delete(stale)\n await Promise.all([...entries].map(([sid, fields]) => this.records.put(sid, fields)))\n }\n\n async clear(): Promise<void> {\n await this.records.clear()\n }\n\n async close(): Promise<void> {\n await this.records.close()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { readFileSync } from 'node:fs'\nimport type { RedisClientType } from 'redis'\nimport { SessionStore, type SessionFields } from '@struktoai/mirage-core'\nimport { loadOptionalPeer } from '../../optional_peer.ts'\n\n// Shipped next to this module in src and copied beside the bundle in\n// dist (tsup onSuccess); byte-identical to the Python cas.lua. Generic\n// hash-field CAS, shared with the workspace meta record.\nexport const CAS_SCRIPT = readFileSync(new URL('./cas.lua', import.meta.url), 'utf8')\n\nexport interface RedisSessionStoreOptions {\n url?: string\n keyPrefix?: string\n}\n\n/**\n * SessionStore backed by one Redis hash (session id -> JSON fields).\n *\n * Sessions and the mount grants they carry survive restarts and are\n * visible to every workspace pointed at the same key prefix — the seam\n * that lets one process create a session and another (a kernel tier, a\n * sibling daemon) bind a mountpoint to it. Writes are single-command\n * (HSET/HDEL) so mutations stay one round trip. Mirrors the Python\n * RedisSessionStore.\n */\nexport class RedisSessionStore extends SessionStore {\n readonly url: string\n private readonly key: string\n private clientPromise: Promise<RedisClientType> | null = null\n\n constructor(options: RedisSessionStoreOptions = {}) {\n super()\n this.url = options.url ?? 'redis://localhost:6379/0'\n const prefix = options.keyPrefix ?? 'mirage:session:'\n this.key = `${prefix}sessions`\n }\n\n private async client(): Promise<RedisClientType> {\n this.clientPromise ??= (async () => {\n const mod = await loadOptionalPeer(\n () =>\n import('redis') as unknown as Promise<{\n createClient: (o: { url: string }) => RedisClientType\n }>,\n { feature: 'RedisSessionStore', packageName: 'redis' },\n )\n const c = mod.createClient({\n url: this.url,\n socket: { reconnectStrategy: false },\n } as Parameters<typeof mod.createClient>[0])\n await c.connect()\n return c\n })()\n return this.clientPromise\n }\n\n // One atomic server-side compare-and-set: Lua reads the stored\n // record's generation and writes only on a match.\n async casSet(\n sessionId: string,\n fields: SessionFields,\n expectedGeneration: number,\n ): Promise<boolean> {\n const c = await this.client()\n const result = await c.eval(CAS_SCRIPT, {\n keys: [this.key],\n arguments: [sessionId, JSON.stringify(fields), String(expectedGeneration)],\n })\n return result === 1\n }\n\n async load(): Promise<Map<string, SessionFields>> {\n const c = await this.client()\n const raw = await c.hGetAll(this.key)\n const out = new Map<string, SessionFields>()\n for (const [sid, value] of Object.entries(raw)) {\n out.set(sid, JSON.parse(value) as SessionFields)\n }\n return out\n }\n\n async set(sessionId: string, fields: SessionFields): Promise<void> {\n const c = await this.client()\n await c.hSet(this.key, sessionId, JSON.stringify(fields))\n }\n\n async delete(sessionIds: readonly string[]): Promise<void> {\n if (sessionIds.length === 0) return\n const c = await this.client()\n await c.hDel(this.key, [...sessionIds])\n }\n\n async replaceAll(entries: Map<string, SessionFields>): Promise<void> {\n const c = await this.client()\n const multi = c.multi().del(this.key)\n for (const [sid, fields] of entries) {\n multi.hSet(this.key, sid, JSON.stringify(fields))\n }\n await multi.exec()\n }\n\n async clear(): Promise<void> {\n const c = await this.client()\n await c.del(this.key)\n }\n\n async close(): Promise<void> {\n // Idempotent: the workspace closes the plane store it consumed and the\n // owning WorkspaceStateStore closes every plane it built; the second\n // close must be a no-op, not a crash on an already-quit client.\n if (this.clientPromise === null) return\n const pending = this.clientPromise\n this.clientPromise = null\n const c = await pending\n await c.quit()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { homedir } from 'node:os'\nimport path from 'node:path'\nimport {\n WorkspaceStateStore,\n type NamespaceStore,\n type ObserverStore,\n type SessionStore,\n type WorkspaceFields,\n type WorkspaceStateStoreOverrides,\n} from '@struktoai/mirage-core'\nimport { DiskObserverStore } from '../../observe/disk_store.ts'\nimport { DiskNamespaceStore } from '../namespace/disk.ts'\nimport { DiskRecordClient } from '../record/disk.ts'\nimport { DiskSessionStore } from '../session/disk.ts'\n\nexport const DEFAULT_STATE_ROOT = '~/.mirage/state'\n\nfunction expandHome(p: string): string {\n if (p === '~') return homedir()\n if (p.startsWith('~/')) return path.join(homedir(), p.slice(2))\n return p\n}\n\n// Match Python's urllib quote(safe=\"\") for the workspace path segment.\nfunction quoteSegment(name: string): string {\n return encodeURIComponent(name).replace(\n /[!'()*]/g,\n (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,\n )\n}\n\nexport interface DiskWorkspaceStateStoreOptions extends WorkspaceStateStoreOverrides {\n root?: string\n}\n\n/**\n * WorkspaceStateStore backed by a directory tree.\n *\n * Each workspace is one self-contained directory (delete a workspace\n * by removing its folder):\n *\n * - `{root}/workspaces/{ws}/workspace.json` — metadata record\n * - `{root}/workspaces/{ws}/sessions/{sid}.json` — session table\n * - `{root}/workspaces/{ws}/namespace.json` — nodes + user, one JSON\n * - `{root}/workspaces/{ws}/history/<day>/<sid>.jsonl` — history\n *\n * The layout mirrors the S3 store file-for-object; mutable records get\n * the same generation-CAS contract via the lockfile protocol\n * (O_CREAT|O_EXCL mutex, tmp write, rename(2)), so multiple local\n * processes share one workspace with zero infrastructure: a CLI-created\n * workspace survives restart like `git init`. Local filesystems only;\n * anything cross-machine belongs on redis or s3. Mirrors the Python\n * DiskWorkspaceStateStore byte-for-byte on disk.\n */\nexport class DiskWorkspaceStateStore extends WorkspaceStateStore {\n private readonly root: string\n private readonly meta = new Map<string, DiskRecordClient>()\n private readonly namespaces = new Map<string, DiskNamespaceStore>()\n private readonly observers = new Map<string, DiskObserverStore>()\n private readonly sessionTables = new Map<string, DiskSessionStore>()\n\n constructor(options: DiskWorkspaceStateStoreOptions = {}) {\n const { root, ...overrides } = options\n super(overrides)\n this.root = expandHome(root ?? DEFAULT_STATE_ROOT)\n }\n\n private wsRoot(workspaceId: string): string {\n return path.join(this.root, 'workspaces', quoteSegment(workspaceId))\n }\n\n private metaClient(workspaceId: string): DiskRecordClient {\n let client = this.meta.get(workspaceId)\n if (client === undefined) {\n client = new DiskRecordClient(this.wsRoot(workspaceId), '')\n this.meta.set(workspaceId, client)\n }\n return client\n }\n\n protected makeNamespace(workspaceId: string): NamespaceStore {\n let ns = this.namespaces.get(workspaceId)\n if (ns === undefined) {\n ns = new DiskNamespaceStore(this.wsRoot(workspaceId))\n this.namespaces.set(workspaceId, ns)\n }\n return ns\n }\n\n protected makeObserver(workspaceId: string): ObserverStore {\n let ob = this.observers.get(workspaceId)\n if (ob === undefined) {\n ob = new DiskObserverStore(path.join(this.wsRoot(workspaceId), 'history'))\n this.observers.set(workspaceId, ob)\n }\n return ob\n }\n\n protected makeSessions(workspaceId: string): SessionStore {\n let table = this.sessionTables.get(workspaceId)\n if (table === undefined) {\n table = new DiskSessionStore(this.wsRoot(workspaceId))\n this.sessionTables.set(workspaceId, table)\n }\n return table\n }\n\n protected async readMeta(workspaceId: string): Promise<WorkspaceFields | null> {\n const [fields] = await this.metaClient(workspaceId).get('workspace')\n return fields\n }\n\n protected async writeMeta(workspaceId: string, fields: WorkspaceFields): Promise<void> {\n await this.metaClient(workspaceId).put('workspace', fields)\n }\n\n protected async casWriteMeta(\n workspaceId: string,\n fields: WorkspaceFields,\n expectedGeneration: number,\n ): Promise<boolean> {\n return await this.metaClient(workspaceId).casPut('workspace', fields, expectedGeneration)\n }\n\n protected async closeSelf(): Promise<void> {\n for (const ns of this.namespaces.values()) await ns.close()\n for (const ob of this.observers.values()) await ob.close()\n for (const table of this.sessionTables.values()) await table.close()\n for (const client of this.meta.values()) await client.close()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { RedisClientType } from 'redis'\nimport {\n WorkspaceStateStore,\n type NamespaceStore,\n type ObserverStore,\n type SessionStore,\n type WorkspaceFields,\n type WorkspaceStateStoreOverrides,\n} from '@struktoai/mirage-core'\nimport { RedisObserverStore } from '../../observe/redis_store.ts'\nimport { loadOptionalPeer } from '../../optional_peer.ts'\nimport { RedisNamespaceStore } from '../namespace/redis.ts'\nimport { CAS_SCRIPT, RedisSessionStore } from '../session/redis.ts'\n\nexport interface RedisWorkspaceStateStoreOptions extends WorkspaceStateStoreOverrides {\n url?: string\n keyPrefix?: string\n}\n\n/**\n * WorkspaceStateStore backed by one Redis server.\n *\n * Key layout under one prefix, everything scoped by workspace id:\n *\n * - `{prefix}workspaces` — hash, workspace id -> metadata JSON\n * - `{prefix}{ws}:namespace:nodes` (+ `:user`) — namespace plane\n * - `{prefix}{ws}:observer:*` — observer plane\n * - `{prefix}{ws}:sessions` — session table\n *\n * All plane state survives restarts and is visible to every process\n * pointed at the same url and prefix, so a workspace rebuilt from its\n * config alone gets identical overlays, history, sessions, and grants.\n * Mirrors the Python RedisWorkspaceStateStore.\n */\nexport class RedisWorkspaceStateStore extends WorkspaceStateStore {\n readonly url: string\n private readonly prefix: string\n private readonly metaKey: string\n private clientPromise: Promise<RedisClientType> | null = null\n private readonly namespaces = new Map<string, RedisNamespaceStore>()\n private readonly observers = new Map<string, RedisObserverStore>()\n private readonly sessionTables = new Map<string, RedisSessionStore>()\n\n constructor(options: RedisWorkspaceStateStoreOptions = {}) {\n const { url, keyPrefix, ...overrides } = options\n super(overrides)\n this.url = url ?? 'redis://localhost:6379/0'\n this.prefix = keyPrefix ?? 'mirage:'\n this.metaKey = `${this.prefix}workspaces`\n }\n\n private async client(): Promise<RedisClientType> {\n this.clientPromise ??= (async () => {\n const mod = await loadOptionalPeer(\n () =>\n import('redis') as unknown as Promise<{\n createClient: (o: { url: string }) => RedisClientType\n }>,\n { feature: 'RedisWorkspaceStateStore', packageName: 'redis' },\n )\n const c = mod.createClient({\n url: this.url,\n socket: { reconnectStrategy: false },\n } as Parameters<typeof mod.createClient>[0])\n await c.connect()\n return c\n })()\n return this.clientPromise\n }\n\n protected makeNamespace(workspaceId: string): NamespaceStore {\n let ns = this.namespaces.get(workspaceId)\n if (ns === undefined) {\n ns = new RedisNamespaceStore({\n url: this.url,\n keyPrefix: `${this.prefix}${workspaceId}:namespace:`,\n })\n this.namespaces.set(workspaceId, ns)\n }\n return ns\n }\n\n protected makeObserver(workspaceId: string): ObserverStore {\n let ob = this.observers.get(workspaceId)\n if (ob === undefined) {\n ob = new RedisObserverStore({\n url: this.url,\n keyPrefix: `${this.prefix}${workspaceId}:observer:`,\n })\n this.observers.set(workspaceId, ob)\n }\n return ob\n }\n\n protected makeSessions(workspaceId: string): SessionStore {\n let table = this.sessionTables.get(workspaceId)\n if (table === undefined) {\n table = new RedisSessionStore({\n url: this.url,\n keyPrefix: `${this.prefix}${workspaceId}:`,\n })\n this.sessionTables.set(workspaceId, table)\n }\n return table\n }\n\n protected async readMeta(workspaceId: string): Promise<WorkspaceFields | null> {\n const c = await this.client()\n const raw = await c.hGet(this.metaKey, workspaceId)\n return raw != null ? (JSON.parse(raw) as WorkspaceFields) : null\n }\n\n protected async writeMeta(workspaceId: string, fields: WorkspaceFields): Promise<void> {\n const c = await this.client()\n await c.hSet(this.metaKey, workspaceId, JSON.stringify(fields))\n }\n\n // Same generic hash-field CAS the session store uses: the meta hash\n // is keyed by workspace id instead of session id.\n protected async casWriteMeta(\n workspaceId: string,\n fields: WorkspaceFields,\n expectedGeneration: number,\n ): Promise<boolean> {\n const c = await this.client()\n const result = await c.eval(CAS_SCRIPT, {\n keys: [this.metaKey],\n arguments: [workspaceId, JSON.stringify(fields), String(expectedGeneration)],\n })\n return result === 1\n }\n\n protected async closeSelf(): Promise<void> {\n for (const ns of this.namespaces.values()) await ns.close()\n for (const ob of this.observers.values()) await ob.close()\n for (const table of this.sessionTables.values()) await table.close()\n if (this.clientPromise !== null) {\n const c = await this.clientPromise\n await c.quit()\n }\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { Buffer } from 'node:buffer'\nimport { createRequire } from 'node:module'\nimport { FileType, type Workspace } from '@struktoai/mirage-core'\n\nconst requireCjs = createRequire(import.meta.url)\nconst fs = requireCjs('node:fs') as Record<string, unknown>\n// fs-monkey ships no types\nconst fsMonkey = requireCjs('fs-monkey') as {\n patchFs: (vol: unknown, target?: unknown) => void\n}\nconst { patchFs } = fsMonkey\n\ntype Cb<T> = (err: NodeJS.ErrnoException | null, value?: T) => void\n\ntype FsLike = Record<string, unknown>\n\nfunction mountedPath(ws: Workspace, p: string): boolean {\n const m = ws.registry.tryMountFor(p)\n if (m === null) return false\n // The synthetic root anchor is an empty internal mount that matches every\n // path; it does not back real files, so paths caught only by it fall\n // through to the native fs. A user-provided `/` mount is honored.\n if (ws.syntheticRoot && m === ws.registry.rootMount) return false\n return true\n}\n\nasync function mirageStat(ws: Workspace, p: string): Promise<unknown> {\n const s = await ws.fs.stat(p)\n const isDir = s.type === FileType.DIRECTORY\n const mtime = s.modified !== null ? new Date(s.modified) : new Date(0)\n return {\n isFile: () => !isDir,\n isDirectory: () => isDir,\n isBlockDevice: () => false,\n isCharacterDevice: () => false,\n isSymbolicLink: () => false,\n isFIFO: () => false,\n isSocket: () => false,\n size: s.size ?? 0,\n mtime,\n mtimeMs: mtime.getTime(),\n atime: mtime,\n atimeMs: mtime.getTime(),\n ctime: mtime,\n ctimeMs: mtime.getTime(),\n birthtime: mtime,\n birthtimeMs: mtime.getTime(),\n mode: 0,\n nlink: 1,\n uid: 0,\n gid: 0,\n rdev: 0,\n blksize: 0,\n blocks: 0,\n dev: 0,\n ino: 0,\n }\n}\n\n/**\n * Monkey-patch Node's `fs` module so that paths under any mirage mount\n * route through the workspace. Paths NOT under a mount fall through to\n * the real native fs. CJS-friendly; for ESM code you still need to use\n * `ws.fs.*` directly since ESM bindings are frozen.\n *\n * Returns a `restore()` function that undoes the patch.\n */\nexport function patchNodeFs(ws: Workspace): () => void {\n const originalFs: FsLike = { ...(fs as unknown as FsLike) }\n\n const vol: FsLike = {\n promises: {\n readFile: async (p: string, opts?: { encoding?: BufferEncoding } | BufferEncoding) => {\n if (mountedPath(ws, p)) {\n const bytes = await ws.fs.readFile(p)\n const encoding = typeof opts === 'string' ? opts : opts?.encoding\n if (encoding !== undefined) return Buffer.from(bytes).toString(encoding)\n return Buffer.from(bytes)\n }\n const native = (originalFs.promises as FsLike).readFile as (\n path: string,\n opts?: unknown,\n ) => Promise<Uint8Array | string>\n return native(p, opts)\n },\n writeFile: async (p: string, data: Uint8Array | string): Promise<void> => {\n if (mountedPath(ws, p)) {\n await ws.fs.writeFile(p, typeof data === 'string' ? data : data)\n return\n }\n const native = (originalFs.promises as FsLike).writeFile as (\n path: string,\n data: Uint8Array | string,\n ) => Promise<void>\n await native(p, data)\n },\n readdir: async (p: string): Promise<string[]> => {\n if (mountedPath(ws, p)) {\n // Workspace returns full paths; Node's fs.promises.readdir returns basenames.\n // Strip trailing slash on directory entries before slicing so dirs\n // don't collapse to ''.\n const entries = await ws.fs.readdir(p)\n return entries.map((e) => {\n const trimmed = e.endsWith('/') ? e.slice(0, -1) : e\n return trimmed.slice(trimmed.lastIndexOf('/') + 1)\n })\n }\n const native = (originalFs.promises as FsLike).readdir as (\n path: string,\n ) => Promise<string[]>\n return native(p)\n },\n stat: async (p: string): Promise<unknown> => {\n if (mountedPath(ws, p)) return mirageStat(ws, p)\n const native = (originalFs.promises as FsLike).stat as (path: string) => Promise<unknown>\n return native(p)\n },\n unlink: async (p: string): Promise<void> => {\n if (mountedPath(ws, p)) return ws.fs.unlink(p)\n const native = (originalFs.promises as FsLike).unlink as (path: string) => Promise<void>\n await native(p)\n },\n mkdir: async (p: string): Promise<void> => {\n if (mountedPath(ws, p)) return ws.fs.mkdir(p)\n const native = (originalFs.promises as FsLike).mkdir as (path: string) => Promise<void>\n await native(p)\n },\n rmdir: async (p: string): Promise<void> => {\n if (mountedPath(ws, p)) return ws.fs.rmdir(p)\n const native = (originalFs.promises as FsLike).rmdir as (path: string) => Promise<void>\n await native(p)\n },\n },\n readFileSync: (): Uint8Array => {\n throw new Error('mirage.patchNodeFs: sync fs methods not supported — use fs.promises.*')\n },\n readFile: (p: string, cb: Cb<Uint8Array>) => {\n if (mountedPath(ws, p)) {\n ws.fs\n .readFile(p)\n .then((data) => {\n cb(null, Buffer.from(data))\n })\n .catch((err: unknown) => {\n cb(err as NodeJS.ErrnoException)\n })\n return\n }\n const native = originalFs.readFile as (path: string, cb: Cb<Uint8Array>) => void\n native(p, cb)\n },\n readdir: (p: string, cb: Cb<string[]>) => {\n if (mountedPath(ws, p)) {\n ws.fs\n .readdir(p)\n .then((entries) => {\n cb(\n null,\n entries.map((e) => {\n const trimmed = e.endsWith('/') ? e.slice(0, -1) : e\n return trimmed.slice(trimmed.lastIndexOf('/') + 1)\n }),\n )\n })\n .catch((err: unknown) => {\n cb(err as NodeJS.ErrnoException)\n })\n return\n }\n const native = originalFs.readdir as (path: string, cb: Cb<string[]>) => void\n native(p, cb)\n },\n }\n\n patchFs(vol, fs)\n return function restore(): void {\n for (const [k, v] of Object.entries(originalFs)) {\n const desc = Object.getOwnPropertyDescriptor(fs, k)\n if (desc?.writable === false && desc.set === undefined) continue\n try {\n fs[k] = v\n } catch {\n // some fs properties are accessor-only and can't be reassigned; skip\n }\n }\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type Accessor,\n type CommandOpts,\n type IndexCacheStore,\n type PathSpec,\n Precision,\n ProvisionResult,\n type Resource,\n} from '@struktoai/mirage-core'\nimport type { RedisAccessor } from '../../../accessor/redis.ts'\nimport { stat as redisStat } from '../../../core/redis/stat.ts'\n\nexport interface RedisResourceLike extends Resource {\n readonly accessor: RedisAccessor\n}\n\ninterface ResolvedSizes {\n resolved: [string, number][]\n missing: number\n}\n\nasync function resolveSizes(\n accessor: RedisAccessor,\n paths: readonly PathSpec[],\n index: IndexCacheStore | undefined,\n): Promise<ResolvedSizes> {\n const resolved: [string, number][] = []\n let missing = 0\n for (const p of paths) {\n const pathStr = p.virtual\n let size: number | null = null\n if (index !== undefined) {\n const lookup = await index.get(pathStr)\n if (lookup.entry !== undefined && lookup.entry !== null) {\n size = lookup.entry.size\n }\n }\n if (size === null) {\n try {\n const fileStat = await redisStat(accessor, p)\n size = fileStat.size\n } catch {\n // fall through — size stays null\n }\n }\n if (size !== null) {\n resolved.push([pathStr, size])\n } else {\n missing += 1\n }\n }\n return { resolved, missing }\n}\n\nexport async function fileReadProvision(\n accessor: Accessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<ProvisionResult> {\n if (paths.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const { resolved, missing } = await resolveSizes(accessor as RedisAccessor, paths, undefined)\n if (missing > 0 || resolved.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const total = resolved.reduce((sum, [, size]) => sum + size, 0)\n return new ProvisionResult({\n networkReadLow: total,\n networkReadHigh: total,\n readOps: resolved.length,\n precision: Precision.EXACT,\n })\n}\n\nexport async function headTailProvision(\n accessor: Accessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): Promise<ProvisionResult> {\n if (paths.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const { resolved, missing } = await resolveSizes(accessor as RedisAccessor, paths, undefined)\n if (missing > 0 || resolved.length === 0) {\n return new ProvisionResult({ precision: Precision.UNKNOWN })\n }\n const total = resolved.reduce((sum, [, size]) => sum + size, 0)\n return new ProvisionResult({\n networkReadLow: total,\n networkReadHigh: total,\n readOps: resolved.length,\n precision: Precision.EXACT,\n })\n}\n\nexport function metadataProvision(\n _accessor: Accessor,\n paths: PathSpec[],\n _texts: string[],\n _opts: CommandOpts,\n): ProvisionResult {\n const n = Math.max(1, paths.length > 0 ? paths.length : 1)\n return new ProvisionResult({\n networkReadLow: 0,\n networkReadHigh: 0,\n readOps: n,\n precision: Precision.EXACT,\n })\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n CacheType,\n type FileCache,\n defaultFingerprint,\n globEscape,\n parseLimit,\n type PathSpec,\n registerFileCacheStore,\n validateMaxDrainBytes,\n} from '@struktoai/mirage-core'\nimport type { RedisClientType } from 'redis'\nimport { RedisResource, type RedisResourceOptions } from '../../resource/redis/redis.ts'\n\nexport interface RedisFileCacheOptions extends RedisResourceOptions {\n cacheLimit?: string | number\n maxDrainBytes?: number | null\n}\n\nexport class RedisFileCacheStore extends RedisResource implements FileCache {\n // Advisory only: unlike the RAM store there is no client-side LRU, so\n // nothing evicts on overflow. Cap memory on the Redis server instead\n // (maxmemory + maxmemory-policy allkeys-lru) to approximate the RAM\n // store's eviction behavior.\n private readonly limit: number\n private readonly dataPrefix: string\n private readonly metaPrefix: string\n private maxDrainBytesValue: number | null = null\n readonly drainTasks = new Map<string, Promise<void>>()\n\n constructor(options: RedisFileCacheOptions = {}) {\n super({\n url: options.url ?? 'redis://localhost:6379/0',\n keyPrefix: options.keyPrefix ?? 'mirage:cache:',\n })\n this.limit = parseLimit(options.cacheLimit ?? '512MB')\n this.dataPrefix = `${this.keyPrefix}data:`\n this.metaPrefix = `${this.keyPrefix}meta:`\n this.maxDrainBytes = options.maxDrainBytes ?? null\n }\n\n get maxDrainBytes(): number | null {\n return this.maxDrainBytesValue\n }\n\n set maxDrainBytes(value: number | null) {\n validateMaxDrainBytes(this.limit, value)\n this.maxDrainBytesValue = value\n }\n\n // Size lives in the redis server and is not tracked client-side.\n readonly cacheSize: number | null = null\n readonly cacheEntries: number | null = null\n\n get cacheLimit(): number {\n return this.limit\n }\n\n cacheClient(): Promise<RedisClientType> {\n return this.store.client()\n }\n\n async get(key: string): Promise<Uint8Array | null> {\n const c = await this.cacheClient()\n const mod = await this.module()\n const blob = mod.RESP_TYPES.BLOB_STRING\n const mapping: Record<number, unknown> = { [blob]: Buffer }\n const typed = c as unknown as {\n withTypeMapping: (m: Record<number, unknown>) => {\n get: (k: string) => Promise<Buffer | null>\n }\n }\n const raw = await typed.withTypeMapping(mapping).get(`${this.dataPrefix}${key}`)\n if (raw === null) return null\n return new Uint8Array(raw.buffer, raw.byteOffset, raw.byteLength)\n }\n\n async set(\n key: string,\n data: Uint8Array,\n options: { fingerprint?: string | null; ttl?: number | null } = {},\n ): Promise<void> {\n const fp = options.fingerprint ?? defaultFingerprint(data)\n const c = await this.cacheClient()\n const dk = `${this.dataPrefix}${key}`\n const mk = `${this.metaPrefix}${key}`\n const pipe = c.multi()\n pipe.set(dk, Buffer.from(data.buffer, data.byteOffset, data.byteLength))\n pipe.set(mk, fp)\n if (options.ttl !== null && options.ttl !== undefined) {\n pipe.expire(dk, options.ttl)\n pipe.expire(mk, options.ttl)\n }\n await pipe.exec()\n }\n\n async add(\n key: string,\n data: Uint8Array,\n options: { fingerprint?: string | null; ttl?: number | null } = {},\n ): Promise<boolean> {\n const c = await this.cacheClient()\n const exists = await c.exists(`${this.dataPrefix}${key}`)\n if (exists) return false\n await this.set(key, data, options)\n return true\n }\n\n async remove(key: string): Promise<void> {\n // Promises cannot be cancelled: dropping the map entry makes the\n // pending backgroundDrain skip its cache fill, mirroring the RAM\n // store's task cancel.\n this.drainTasks.delete(key)\n const c = await this.cacheClient()\n const pipe = c.multi()\n pipe.del(`${this.dataPrefix}${key}`)\n pipe.del(`${this.metaPrefix}${key}`)\n await pipe.exec()\n }\n\n override async exists(key: string | PathSpec): Promise<boolean> {\n const k = typeof key === 'string' ? key : key.mountPath\n const c = await this.cacheClient()\n return (await c.exists(`${this.dataPrefix}${k}`)) > 0\n }\n\n async isFresh(key: string, remoteFingerprint: string): Promise<boolean> {\n const c = await this.cacheClient()\n const fp = await c.get(`${this.metaPrefix}${key}`)\n if (fp === null) return false\n return fp === remoteFingerprint\n }\n\n async evictPrefix(prefix: string): Promise<void> {\n for (const key of [...this.drainTasks.keys()]) {\n if (key.startsWith(prefix)) this.drainTasks.delete(key)\n }\n const escaped = globEscape(prefix)\n const c = await this.cacheClient()\n for (const base of [this.dataPrefix, this.metaPrefix]) {\n const batch: string[] = []\n for await (const k of c.scanIterator({ MATCH: `${base}${escaped}*` })) {\n if (Array.isArray(k)) batch.push(...k)\n else batch.push(k)\n }\n if (batch.length > 0) await c.del(batch)\n }\n }\n\n evictPaths(_paths: Iterable<string>): void {\n // No-op: the redis cache holds nothing restored from a snapshot\n // (only RAM caches are repopulated at load), and the load path is\n // sync so a redis delete cannot be awaited here. To drop live\n // redis-cached entries, call `remove(key)` per path from an async\n // context. Mirrors Python `RedisFileCacheStore.evict_paths`.\n }\n\n async clear(): Promise<void> {\n this.drainTasks.clear()\n const c = await this.cacheClient()\n for (const pattern of [`${this.dataPrefix}*`, `${this.metaPrefix}*`]) {\n const batch: string[] = []\n for await (const k of c.scanIterator({ MATCH: pattern })) {\n if (Array.isArray(k)) batch.push(...k)\n else batch.push(k)\n }\n if (batch.length > 0) await c.del(batch)\n }\n }\n\n async allCached(keys: readonly string[]): Promise<boolean> {\n for (const k of keys) {\n if (!(await this.exists(k))) return false\n }\n return true\n }\n\n async multiGet(keys: readonly string[]): Promise<(Uint8Array | null)[]> {\n const out: (Uint8Array | null)[] = []\n for (const k of keys) out.push(await this.get(k))\n return out\n }\n}\n\n// Registered on import so a declarative `cache: {type: redis}` resolves\n// here: core owns buildFileCache but cannot import this package. Same\n// seam the runtimes use (`registerRuntime`).\nregisterFileCacheStore(CacheType.REDIS, (config) => {\n return new RedisFileCacheStore({\n ...(config.limit !== undefined ? { cacheLimit: config.limit } : {}),\n ...(config.maxDrainBytes !== undefined ? { maxDrainBytes: config.maxDrainBytes } : {}),\n ...(config.url !== undefined ? { url: config.url } : {}),\n ...(config.keyPrefix !== undefined ? { keyPrefix: config.keyPrefix } : {}),\n })\n})\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type HfRepoConfig,\n type HfRepoConfigRedacted,\n normalizeHfRepoConfig,\n redactHfRepoConfig,\n} from '../hf_buckets/config.ts'\n\nexport type HfModelsConfig = HfRepoConfig\nexport type HfModelsConfigRedacted = HfRepoConfigRedacted\n\nexport const normalizeHfModelsConfig = normalizeHfRepoConfig\nexport const redactHfModelsConfig = redactHfRepoConfig\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { CLISpec, Operand, Option, registerCliSpec } from '@struktoai/mirage-core'\nimport { EmailConfigSchema } from '../../../../core/email/config.ts'\nimport { compose } from './compose.ts'\nimport { forward } from './forward.ts'\nimport { listEnvelopes } from './list.ts'\nimport { read } from './read.ts'\nimport { reply } from './reply.ts'\nimport { searchEnvelopes } from './search.ts'\nimport { send } from './send.ts'\n\n// The himalaya program tree, tracking github.com/pimalaya/himalaya's own\n// grammar: `envelope list|search` to triage, `message read/compose/send/\n// reply/forward` to act. Messages are addressed by positional id, the\n// mailbox by -m/--mailbox, and the built-in flag composer writes RFC 5322\n// to stdout unless --send is passed. Install with a per-account\n// EmailConfig; two installs under different head words are two accounts.\nconst ID = new Operand({ type: 'str' })\nconst MAILBOX = new Option({\n short: '-m',\n long: '--mailbox',\n type: 'str',\n description: 'Mailbox name (default: INBOX)',\n})\nconst PAGE = new Option({\n short: '-p',\n long: '--page',\n type: 'int',\n description: 'Page number, starting from 1',\n})\nconst PAGE_SIZE = new Option({\n short: '-s',\n long: '--page-size',\n type: 'int',\n description: 'Maximum envelopes per page',\n})\n\n// Upstream v2 spells the sent copy as an explicit mailbox on every verb\n// that produces a message, so `--save` alone files it without sending and\n// `--save` with `--send` does both, naming the mailbox the account's\n// saveCopy would otherwise resolve on its own.\nconst SAVE = new Option({\n long: '--save',\n type: 'str',\n metavar: 'MAILBOX',\n description: 'Append a copy of the message to this mailbox',\n})\n\n// The built-in flag composer, shared verbatim by compose, reply and\n// forward: upstream flattens the same clap struct into all three.\nconst COMPOSER = [\n new Option({ long: '--from', type: 'str', description: 'Sender address' }),\n new Option({\n short: '-t',\n long: '--to',\n type: 'str',\n multiple: true,\n description: 'Recipient address(es), repeatable or comma-separated',\n }),\n new Option({\n long: '--cc',\n type: 'str',\n multiple: true,\n description: 'Carbon-copy recipient(s)',\n }),\n new Option({\n long: '--bcc',\n type: 'str',\n multiple: true,\n description: 'Blind carbon-copy recipient(s)',\n }),\n new Option({ short: '-s', long: '--subject', type: 'str', description: 'Subject line' }),\n new Option({ long: '--body', type: 'str', description: 'Inline body (or pipe via stdin)' }),\n new Option({\n long: '--attach',\n type: 'path',\n multiple: true,\n description: 'Attachment file(s), repeatable',\n }),\n new Option({\n long: '--signature',\n type: 'str',\n description: \"Signature appended after a '-- ' line\",\n }),\n new Option({\n long: '--send',\n description: 'Send through SMTP instead of writing MIME to stdout',\n }),\n SAVE,\n]\n\nconst QUOTING = [\n new Option({\n short: '-P',\n long: '--posting-style',\n type: 'str',\n choices: ['top', 'bottom'],\n default: 'top',\n description: 'Quoted source above or below your body',\n }),\n new Option({\n short: '-Q',\n long: '--quote-headline',\n type: 'str',\n description: 'Literal line placed before the quoted body',\n }),\n]\n\nexport const HIMALAYA = new CLISpec({\n name: 'himalaya',\n description: 'IMAP/SMTP mail client',\n configModel: EmailConfigSchema,\n subcommands: [\n new CLISpec({\n name: 'envelope',\n description: 'Manage envelopes',\n subcommands: [\n new CLISpec({\n name: 'list',\n aliases: ['ls'],\n description: 'List envelopes as JSON headers',\n fn: listEnvelopes,\n options: [MAILBOX, PAGE, PAGE_SIZE],\n }),\n new CLISpec({\n name: 'search',\n aliases: ['sr'],\n description: 'Search envelopes with the query DSL',\n fn: searchEnvelopes,\n options: [MAILBOX, PAGE, PAGE_SIZE],\n rest: ID,\n epilog:\n 'Conditions: date <yyyy-mm-dd>, before <yyyy-mm-dd>, after ' +\n '<yyyy-mm-dd>, from <pattern>, to <pattern>, subject <pattern>, ' +\n 'body <pattern>, flag ' +\n '<seen|answered|flagged|draft|deleted>. Combine with and, or, not; ' +\n 'group with parentheses. Sort with order by <date|from|to|subject> [asc|desc].',\n }),\n ],\n }),\n new CLISpec({\n name: 'message',\n description: 'Manage messages',\n subcommands: [\n new CLISpec({\n name: 'read',\n description: 'Read one message as JSON',\n fn: read,\n options: [\n MAILBOX,\n new Option({ long: '--raw', description: 'Write the RFC 5322 bytes instead' }),\n ],\n rest: ID,\n }),\n new CLISpec({\n name: 'compose',\n aliases: ['write', 'new'],\n description: 'Compose a new message from flags',\n fn: compose,\n write: true,\n options: COMPOSER,\n }),\n new CLISpec({\n name: 'send',\n description: 'Send a raw RFC 5322 message',\n fn: send,\n write: true,\n options: [SAVE],\n rest: ID,\n }),\n new CLISpec({\n name: 'reply',\n description: 'Reply to a message',\n fn: reply,\n write: true,\n options: [MAILBOX, ...COMPOSER, ...QUOTING],\n rest: ID,\n }),\n new CLISpec({\n name: 'forward',\n aliases: ['fwd'],\n description: 'Forward a message',\n fn: forward,\n write: true,\n options: [MAILBOX, ...COMPOSER, ...QUOTING],\n rest: ID,\n }),\n ],\n }),\n ],\n})\n\nregisterCliSpec(HIMALAYA)\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { FlagView, type CLIInvocation, type CommandFnResult } from '@struktoai/mirage-core'\nimport type { EmailConfig } from '../../../../core/email/config.ts'\nimport { route } from './util.ts'\n\nexport async function compose(inv: CLIInvocation): Promise<CommandFnResult> {\n return route(inv.config as EmailConfig, new FlagView(inv.flags), inv.stdin, null, inv.doors)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n mimeTypeFor,\n IOResult,\n PathSpec,\n isMissingPath,\n type ByteSource,\n type CLIDoors,\n type CommandFnResult,\n type FlagView,\n} from '@struktoai/mirage-core'\nimport { parseRfc822, type ParsedRfc822 } from '../../../../core/email/_parse.ts'\nimport type { EmailConfig } from '../../../../core/email/config.ts'\nimport { build, readBody, splitAddresses, type Attachment, type Source } from './builder.ts'\nimport { deliver, saveSentCopy } from './deliver.ts'\n\nconst ENC = new TextEncoder()\n\n/** The `to` field both outcomes report, spelled as the header reads. */\nfunction addressList(addresses: ParsedRfc822['to']): string {\n return addresses\n .map((entry) => (entry.name === '' ? entry.email : `${entry.name} <${entry.email}>`))\n .join(', ')\n}\n\n/** The command's first operand, or a usage error. */\nexport function firstText(texts: readonly string[], label: string): string {\n const value = texts[0]\n if (value === undefined) throw new Error(`${label} is required`)\n return value\n}\n\n/**\n * Reads --attach files through the workspace dispatcher.\n *\n * An account CLI has no mount of its own; an attachment is an unrelated\n * workspace file, so it is read through the op dispatcher the executor\n * hands every CLI, the same door git reads repositories through. The\n * flag bag carries path values as their resolved virtual-path strings\n * (the python executor upgrades them to PathSpec instead).\n */\nasync function loadAttachments(\n doors: CLIDoors | undefined,\n paths: readonly string[],\n): Promise<Attachment[]> {\n if (paths.length === 0) return []\n const dispatch = doors?.dispatch\n if (dispatch === undefined) {\n throw new Error('--attach needs a workspace to read files from')\n }\n const attachments: Attachment[] = []\n for (const path of paths) {\n let data: unknown\n try {\n ;[data] = await dispatch('read', PathSpec.fromStrPath(path))\n } catch (err) {\n if (isMissingPath(err)) {\n throw new Error(`read attachment ${path}: No such file or directory`)\n }\n throw err\n }\n const trimmed = path.replace(/\\/+$/, '')\n const filename = trimmed.slice(trimmed.lastIndexOf('/') + 1) || 'attachment'\n attachments.push({\n filename,\n contentType: mimeTypeFor(filename),\n data: data instanceof Uint8Array ? data : new Uint8Array(data as ArrayBufferLike),\n })\n }\n return attachments\n}\n\n/**\n * Assembles a message, then sends it or writes its MIME to stdout.\n *\n * Shared by compose, reply and forward: the three differ only in the\n * source message they derive headers from. Without --send the raw RFC\n * 5322 bytes go to stdout, so a composer chain can pick them up.\n */\nexport async function route(\n config: EmailConfig,\n fl: FlagView,\n stdin: ByteSource | null,\n source: Source | null,\n doors: CLIDoors | undefined,\n): Promise<CommandFnResult> {\n const raw = build(\n {\n sender: fl.asStr('from') ?? config.username,\n to: splitAddresses(fl.asList('to')),\n cc: splitAddresses(fl.asList('cc')),\n bcc: splitAddresses(fl.asList('bcc')),\n subject: fl.asStr('subject') ?? null,\n body: await readBody(fl, stdin),\n signature: fl.asStr('signature') ?? null,\n attachments: await loadAttachments(doors, fl.asList('attach')),\n },\n source,\n )\n const save = fl.asStr('save') ?? null\n if (!fl.asBool('send')) {\n if (save === null) return [raw as ByteSource, new IOResult()]\n // --save without --send files the message and sends nothing, so a\n // refused APPEND means nothing happened at all and may fail loudly:\n // there is no delivered message a retry could duplicate.\n const folder = await saveSentCopy(config, raw, save)\n const filed = await parseRfc822(raw)\n const saved = {\n status: 'saved',\n mailbox: folder,\n to: addressList(filed.to),\n subject: filed.subject,\n }\n return [ENC.encode(JSON.stringify(saved)) as ByteSource, new IOResult()]\n }\n const { parsed, warning } = await deliver(config, raw, save)\n const result = {\n status: 'sent',\n to: addressList(parsed.to),\n subject: parsed.subject,\n }\n return [\n ENC.encode(JSON.stringify(result)) as ByteSource,\n new IOResult({ stderr: warning === '' ? null : ENC.encode(warning) }),\n ]\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { createHash } from 'node:crypto'\n\nimport {\n assertHeaderValue,\n encodeBase64Lines,\n encodeMimeText as encodeText,\n foldAddressList,\n foldContentDisposition,\n foldUnstructured,\n materialize,\n type ByteSource,\n type FlagView,\n} from '@struktoai/mirage-core'\nimport type { FetchedMessage } from '../../../../core/email/_client.ts'\n\ntype SourceMode = 'reply' | 'forward'\nexport type PostingStyle = 'top' | 'bottom'\n\nconst PREFIXES: Record<SourceMode, string> = { reply: 'Re: ', forward: 'Fwd: ' }\nconst ENC = new TextEncoder()\n\n/** One file attached to an outgoing message. */\nexport interface Attachment {\n filename: string\n contentType: string\n data: Uint8Array\n}\n\nexport interface Compose {\n sender: string\n to: readonly string[]\n cc: readonly string[]\n bcc: readonly string[]\n subject: string | null\n body: string\n signature: string | null\n attachments?: readonly Attachment[]\n}\n\n/**\n * A deterministic multipart boundary for the message's content.\n *\n * A random boundary would break byte-for-byte parity with the python\n * builder and make the no-send stdout non-reproducible. Hashing the\n * content gives a boundary that cannot occur inside it (the content\n * would have to contain its own hash) while staying stable across runs\n * and languages.\n */\nexport function mixedBoundary(body: string, attachments: readonly Attachment[]): string {\n const digest = createHash('sha256').update(Buffer.from(body, 'utf8'))\n for (const attachment of attachments) {\n digest.update(Buffer.from(attachment.filename, 'utf8'))\n digest.update(Buffer.from(attachment.contentType, 'utf8'))\n digest.update(attachment.data)\n }\n return digest.digest('hex').slice(0, 32)\n}\n\nexport interface Source {\n message: FetchedMessage\n mode: SourceMode\n postingStyle: PostingStyle\n quoteHeadline: string\n}\n\ninterface EmailAddress {\n name: string\n email: string\n}\n\n/** Flattens repeated address flags, splitting comma-separated lists. */\nexport function splitAddresses(values: readonly string[]): string[] {\n return values.flatMap((value) =>\n value\n .split(',')\n .map((part) => part.trim())\n .filter((part) => part !== ''),\n )\n}\n\n/** Renders one parsed address as a header value. */\nfunction formatAddress(entry: EmailAddress): string {\n const email = entry.email.trim()\n const name = entry.name.trim()\n return name !== '' && email !== '' ? `${name} <${email}>` : email\n}\n\n/**\n * Whether a subject already carries a Re:/Fwd: prefix. The colon is part\n * of the comparison: matching on the letters alone would read \"Ready to\n * ship\" as already prefixed with \"Re:\".\n */\nexport function hasPrefix(subject: string, prefix: string): boolean {\n const head = subject.trimStart()\n const marker = prefix.trim()\n return head.slice(0, marker.length).toLowerCase() === marker.toLowerCase()\n}\n\n/** Derives a reply's To from the source's Reply-To, else its From. */\nfunction replyRecipients(message: FetchedMessage): string[] {\n if (message.reply_to.length > 0) return message.reply_to.map((entry) => formatAddress(entry))\n const rendered = formatAddress(message.from)\n return rendered === '' ? [] : [rendered]\n}\n\n/** Quotes a source body, one leading '>' per line. */\nexport function quoteText(sourceText: string, headline: string): string {\n const trimmed = sourceText.trim()\n if (trimmed === '') return ''\n const lines: string[] = []\n if (headline.trim() !== '') lines.push(headline.replace(/\\n+$/, ''))\n for (const line of trimmed.split('\\n')) {\n lines.push(line.startsWith('>') ? `>${line}` : `> ${line}`)\n }\n return lines.join('\\n')\n}\n\n/** Lays out the user's body, the quoted source and the signature. */\nexport function composeBody(\n userBody: string,\n quote: string,\n signature: string,\n style: PostingStyle,\n): string {\n let body = userBody.replace(/\\n+$/, '')\n if (quote !== '') {\n if (body === '') body = quote\n else if (style === 'bottom') body = `${quote}\\n\\n${body}`\n else body = `${body}\\n\\n${quote}`\n }\n if (signature.trim() !== '') body = `${body}\\n\\n-- \\n${signature.replace(/\\n+$/, '')}`\n return body\n}\n\n/**\n * Assembles an RFC 5322 message from flags and an optional source.\n *\n * Hand-built rather than routed through nodemailer's composer: the raw\n * bytes are the command's output when --send is absent, so they must\n * exist before any transport does. Every header and the body ride the\n * mime module's ports of python's serializers, so the output stays\n * byte-identical to EmailMessage.as_bytes(policy=SMTP) - header order,\n * encoded words, folding, transfer encoding and all (pinned in\n * integ/fixtures/himalaya/mime_parity.json).\n */\nexport function build(compose: Compose, source: Source | null = null): Uint8Array {\n let recipients = [...compose.to]\n let subject = compose.subject\n let sourceText = ''\n const headLines: string[] = [foldAddressList('From', [compose.sender])]\n if (source !== null) {\n const original = source.message\n const prefix = PREFIXES[source.mode]\n subject ??= hasPrefix(original.subject, prefix)\n ? original.subject\n : `${prefix}${original.subject}`\n if (source.mode === 'reply' && recipients.length === 0) {\n recipients = replyRecipients(original)\n }\n if (original.message_id !== '') {\n // Threading headers land before To, matching python's insertion\n // order in the reference builder.\n if (source.mode === 'reply') {\n headLines.push(foldUnstructured('In-Reply-To', original.message_id))\n }\n headLines.push(\n foldUnstructured('References', [...original.references, original.message_id].join(' ')),\n )\n }\n sourceText = original.body_text\n }\n if (recipients.length === 0) throw new Error('no recipient: pass --to')\n // EmailMessage refuses these outright (header injection), so the\n // reference implementation never serializes them.\n for (const value of [\n compose.sender,\n ...recipients,\n ...compose.cc,\n ...compose.bcc,\n subject ?? '',\n ]) {\n assertHeaderValue(value)\n }\n headLines.push(foldAddressList('To', recipients))\n if (compose.cc.length > 0) headLines.push(foldAddressList('Cc', compose.cc))\n if (compose.bcc.length > 0) headLines.push(foldAddressList('Bcc', compose.bcc))\n headLines.push(foldUnstructured('Subject', subject ?? ''))\n const style: PostingStyle = source !== null ? source.postingStyle : 'top'\n const headline = source !== null ? source.quoteHeadline : ''\n const body = composeBody(\n compose.body,\n quoteText(sourceText, headline),\n compose.signature ?? '',\n style,\n )\n // SMTP is a CRLF protocol and these bytes go straight onto the wire\n // (or into `message send`), so the LF-built payload cannot stay\n // LF-only.\n const { cte, payload } = encodeText(body)\n const rendered = payload.replaceAll('\\n', '\\r\\n')\n const attachments = compose.attachments ?? []\n if (attachments.length === 0) {\n headLines.push('Content-Type: text/plain; charset=\"utf-8\"')\n headLines.push(`Content-Transfer-Encoding: ${cte}`)\n headLines.push('MIME-Version: 1.0')\n return ENC.encode(`${headLines.join('\\r\\n')}\\r\\n\\r\\n${rendered}`)\n }\n // Multipart layout matches EmailMessage.add_attachment: MIME-Version\n // moves above the multipart Content-Type at the top, the body part\n // keeps its single-part headers, and each attachment part carries its\n // own MIME-Version after Content-Disposition.\n const boundary = mixedBoundary(body, attachments)\n headLines.push('MIME-Version: 1.0')\n headLines.push(`Content-Type: multipart/mixed; boundary=\"${boundary}\"`)\n const parts = [\n `Content-Type: text/plain; charset=\"utf-8\"\\r\\nContent-Transfer-Encoding: ${cte}\\r\\n\\r\\n${rendered}`,\n ]\n for (const attachment of attachments) {\n const attachmentHead =\n `Content-Type: ${attachment.contentType}\\r\\n` +\n `Content-Transfer-Encoding: base64\\r\\n` +\n `${foldContentDisposition(attachment.filename)}\\r\\n` +\n `MIME-Version: 1.0`\n // The base64 payload is line-terminated (EmailMessage semantics),\n // so empty data serializes as zero lines, not one blank line.\n const encoded = encodeBase64Lines(attachment.data).replaceAll('\\n', '\\r\\n')\n parts.push(`${attachmentHead}\\r\\n\\r\\n${encoded}`)\n }\n const head = headLines.join('\\r\\n')\n const joined = parts.join(`\\r\\n--${boundary}\\r\\n`)\n return ENC.encode(`${head}\\r\\n\\r\\n--${boundary}\\r\\n${joined}\\r\\n--${boundary}--\\r\\n`)\n}\n\n/** Resolves the body from --body, falling back to piped stdin. */\nexport async function readBody(fl: FlagView, stdin: ByteSource | null): Promise<string> {\n const inline = fl.asStr('body')\n if (inline !== undefined) return inline\n if (stdin === null) return ''\n return new TextDecoder().decode(await materialize(stdin))\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { loadOptionalPeer } from '@struktoai/mirage-core'\nimport type * as Nodemailer from 'nodemailer'\nimport { parseRfc822, type ParsedRfc822 } from '../../../../core/email/_parse.ts'\nimport type { EmailConfig } from '../../../../core/email/config.ts'\n\nconst transporterCache = new WeakMap<EmailConfig, Nodemailer.Transporter>()\n\nasync function getTransporter(config: EmailConfig): Promise<Nodemailer.Transporter> {\n const existing = transporterCache.get(config)\n if (existing !== undefined) return existing\n const mod = await loadOptionalPeer(\n () => import('nodemailer') as unknown as Promise<typeof Nodemailer>,\n { feature: 'himalaya message send', packageName: 'nodemailer' },\n )\n const transporter = mod.createTransport({\n host: config.smtpHost,\n port: config.smtpPort,\n secure: config.smtpPort === 465,\n auth: { user: config.username, pass: config.password },\n })\n transporterCache.set(config, transporter)\n return transporter\n}\n\n/**\n * Pushes an RFC 5322 message through the account's SMTP path.\n *\n * Sending lives with the CLI rather than in core/email because the email\n * mount is read-only: no filesystem operation reaches SMTP, and himalaya\n * is the only thing that sends. Returns the parsed message so callers can\n * report its headers.\n */\nexport async function sendRaw(config: EmailConfig, raw: Uint8Array): Promise<ParsedRfc822> {\n const transporter = await getTransporter(config)\n const parsed = await parseRfc822(raw)\n const recipients = [\n ...parsed.to.map((entry) => entry.email),\n ...parsed.cc.map((entry) => entry.email),\n ...bccAddresses(raw),\n ].filter((email) => email !== '')\n // nodemailer does not read the envelope out of a raw message, so the\n // recipients have to be handed over explicitly. Bcc rides the envelope\n // and is stripped from the bytes, the way an MTA would.\n await transporter.sendMail({\n raw: Buffer.from(stripBcc(raw)),\n envelope: { from: parsed.from.email || config.username, to: recipients },\n })\n return parsed\n}\n\n/**\n * The Bcc header's addresses, read here rather than from ParsedRfc822:\n * Bcc never survives delivery, so it has no place in the rendered\n * message the mount serves.\n */\nexport function bccAddresses(raw: Uint8Array): string[] {\n const addresses: string[] = []\n for (const line of bccLines(raw)) {\n const value = line.replace(/^bcc:/i, '')\n for (const part of value.split(',')) {\n const angled = /<([^>]+)>/.exec(part)\n const email = (angled === null ? part : (angled[1] ?? '')).trim()\n if (email !== '') addresses.push(email)\n }\n }\n return addresses\n}\n\nfunction bccLines(raw: Uint8Array): string[] {\n const text = new TextDecoder().decode(raw)\n const split = text.search(/\\r?\\n\\r?\\n/)\n const head = split === -1 ? text : text.slice(0, split)\n const found: string[] = []\n let collecting = false\n for (const line of head.split(/\\r?\\n/)) {\n if (/^[ \\t]/.test(line)) {\n if (collecting) {\n const last = found.pop() ?? ''\n found.push(`${last} ${line.trim()}`)\n }\n continue\n }\n collecting = /^bcc:/i.test(line)\n if (collecting) found.push(line)\n }\n return found\n}\n\n/** Drops the Bcc header (and its folded continuation lines) from a message. */\nexport function stripBcc(raw: Uint8Array): Uint8Array {\n const text = new TextDecoder().decode(raw)\n const split = text.search(/\\r?\\n\\r?\\n/)\n if (split === -1) return raw\n const head = text.slice(0, split)\n const rest = text.slice(split)\n const kept: string[] = []\n let dropping = false\n for (const line of head.split(/\\r?\\n/)) {\n if (/^[ \\t]/.test(line)) {\n if (!dropping) kept.push(line)\n continue\n }\n dropping = /^bcc:/i.test(line)\n if (!dropping) kept.push(line)\n }\n return new TextEncoder().encode(kept.join('\\r\\n') + rest)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { EmailAccessor } from '../../../../accessor/email.ts'\nimport { listFolderEntries } from '../../../../core/email/_client.ts'\nimport type { ParsedRfc822 } from '../../../../core/email/_parse.ts'\nimport type { EmailConfig } from '../../../../core/email/config.ts'\nimport { sendRaw } from './smtp.ts'\n\nconst SENT_ATTRIBUTE = '\\\\sent'\nconst DEFAULT_SENT_FOLDER = 'Sent'\nconst SEEN_FLAG = '\\\\Seen'\n\nexport interface Delivery {\n parsed: ParsedRfc822\n /** A line for stderr, empty when there is nothing to report. */\n warning: string\n}\n\n/**\n * Names the mailbox a sent copy belongs in.\n *\n * IMAP never standardized that name: it is `Sent` on most servers,\n * `Sent Items` on Exchange and `[Gmail]/Sent Mail` on Gmail. A server\n * that implements RFC 6154 tags the right one \\Sent in its LIST reply,\n * so asking beats guessing; upstream himalaya has no probe and falls\n * back on its folder.alias.sent, which is the configured name here and\n * wins so a server whose tag is wrong stays correctable.\n */\nexport async function resolveSentFolder(\n accessor: EmailAccessor,\n configured: string | null,\n): Promise<string> {\n if (configured !== null && configured !== '') return configured\n const entries = await listFolderEntries(accessor)\n const tagged = entries.find((entry) => entry.specialUse?.toLowerCase() === SENT_ATTRIBUTE)\n return tagged?.name ?? DEFAULT_SENT_FOLDER\n}\n\n/**\n * APPENDs a message to a mailbox, seen, and answers with the mailbox it\n * landed in. `named` is the mailbox --save gave; without one the\n * account's own sent mailbox is resolved.\n *\n * Unlike python's, this path quotes nothing: imapflow builds the\n * command from typed attributes, so a mailbox holding a space arrives\n * as one argument on its own.\n */\nexport async function saveSentCopy(\n config: EmailConfig,\n raw: Uint8Array,\n named: string | null = null,\n): Promise<string> {\n const accessor = new EmailAccessor(config)\n try {\n const folder = named ?? (await resolveSentFolder(accessor, config.sentFolder))\n const imap = await accessor.getImap()\n const result = await imap.append(folder, Buffer.from(raw), [SEEN_FLAG])\n if (result === false) throw new Error(`${folder}: the server refused the message`)\n return folder\n } finally {\n await accessor.close()\n }\n}\n\n/**\n * Sends a message over SMTP, then files the sender's own copy.\n *\n * Two conversations with two servers: SMTP hands the message to the\n * recipient's side and keeps no record, so the copy in the sender's\n * Sent mailbox is a separate IMAP APPEND that every mail client makes\n * on its own. Upstream v2 spells that APPEND as `--save <MAILBOX>` and\n * does nothing without it; mirage keeps the account-level `saveCopy` on\n * top, defaulted on, so an agent that never learned the flag still\n * leaves the record a human sender would.\n *\n * The other deliberate divergence is the failure arm. Upstream\n * propagates, which fails the command after the mail has already left;\n * here the APPEND failure is reported on stderr and the verb still\n * succeeds, because a non-zero exit invites a retry that sends the\n * message twice. A `--save` that sends nothing does not go through here\n * at all, precisely because nothing happened yet and failing is safe.\n */\nexport async function deliver(\n config: EmailConfig,\n raw: Uint8Array,\n save: string | null = null,\n): Promise<Delivery> {\n const parsed = await sendRaw(config, raw)\n if (save === null && !config.saveCopy) return { parsed, warning: '' }\n try {\n await saveSentCopy(config, raw, save)\n } catch (error) {\n // Every failure mode is caught on purpose: the message is already\n // delivered by this point, so no fault of the copy may turn into a\n // failed send. Nothing is swallowed, the reason is printed.\n const reason = error instanceof Error ? error.message : String(error)\n return { parsed, warning: `himalaya: sent copy not saved: ${reason}\\n` }\n }\n return { parsed, warning: '' }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { FlagView, type CLIInvocation, type CommandFnResult } from '@struktoai/mirage-core'\nimport { EmailAccessor } from '../../../../accessor/email.ts'\nimport { fetchMessage } from '../../../../core/email/_client.ts'\nimport type { EmailConfig } from '../../../../core/email/config.ts'\nimport { firstText, route } from './util.ts'\n\nexport async function forward(inv: CLIInvocation): Promise<CommandFnResult> {\n const fl = new FlagView(inv.flags)\n const uid = firstText(inv.texts, 'message id')\n const mailbox = fl.asStr('mailbox') ?? 'INBOX'\n const accessor = new EmailAccessor(inv.config as EmailConfig)\n let original\n try {\n original = await fetchMessage(accessor, mailbox, uid)\n } finally {\n await accessor.close()\n }\n return route(\n inv.config as EmailConfig,\n fl,\n inv.stdin,\n {\n message: original,\n mode: 'forward',\n postingStyle: fl.asStr('posting_style') === 'bottom' ? 'bottom' : 'top',\n quoteHeadline: fl.asStr('quote_headline') ?? '',\n },\n inv.doors,\n )\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FlagView,\n IOResult,\n type ByteSource,\n type CLIInvocation,\n type CommandFnResult,\n} from '@struktoai/mirage-core'\nimport { EmailAccessor } from '../../../../accessor/email.ts'\nimport { fetchHeaders, listMessageUids } from '../../../../core/email/_client.ts'\nimport type { EmailConfig } from '../../../../core/email/config.ts'\nimport { messagesJsonBytes } from '../../../../core/email/render.ts'\nimport { pageSlice, sortHeaders, uidBudget } from './query.ts'\n\nexport const DEFAULT_PAGE_SIZE = 25\n\nexport async function listEnvelopes(inv: CLIInvocation): Promise<CommandFnResult> {\n const fl = new FlagView(inv.flags)\n const mailbox = fl.asStr('mailbox') ?? 'INBOX'\n const page = fl.asInt('page') ?? 1\n const pageSize = fl.asInt('page_size') ?? DEFAULT_PAGE_SIZE\n const account = inv.config as EmailConfig\n const budget = uidBudget(page, pageSize, [], account.maxMessages)\n const accessor = new EmailAccessor(account)\n let headers\n try {\n const uids = await listMessageUids(accessor, mailbox, 'ALL', budget)\n headers = uids.length > 0 ? await fetchHeaders(accessor, mailbox, uids) : []\n } finally {\n await accessor.close()\n }\n const pageOf = pageSlice(sortHeaders(headers, []), page, pageSize)\n const out: ByteSource = messagesJsonBytes(pageOf)\n return [out, new IOResult()]\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { FetchedMessage } from '../../../../core/email/_client.ts'\nimport { compareCodePoints } from '@struktoai/mirage-core'\n\n// himalaya's search DSL: 3 operators (and, or, not) and 8 conditions\n// (date, before, after, from, to, subject, body, flag), optionally\n// followed by `order by <kind> [asc|desc]` sorters. Date conditions\n// anchor on the `Date:` header, never on the server's received-at\n// timestamp, which is why they emit SENTON/SENTBEFORE/SENTSINCE rather\n// than ON/BEFORE/SINCE: imported or delayed mail would otherwise land on\n// the wrong day.\nconst CONDITIONS = ['date', 'before', 'after', 'from', 'to', 'subject', 'body', 'flag'] as const\nconst SORT_KINDS = ['date', 'from', 'to', 'subject'] as const\nconst FLAGS: Record<string, string> = {\n seen: 'SEEN',\n answered: 'ANSWERED',\n flagged: 'FLAGGED',\n draft: 'DRAFT',\n deleted: 'DELETED',\n}\nconst IMAP_MONTHS = [\n 'Jan',\n 'Feb',\n 'Mar',\n 'Apr',\n 'May',\n 'Jun',\n 'Jul',\n 'Aug',\n 'Sep',\n 'Oct',\n 'Nov',\n 'Dec',\n]\n\ntype SortKind = (typeof SORT_KINDS)[number]\n\nexport class QueryError extends Error {}\n\ninterface Token {\n text: string\n quoted: boolean\n}\n\nexport interface Sorter {\n kind: SortKind\n descending: boolean\n}\n\nexport interface Query {\n criteria: string\n sorters: Sorter[]\n}\n\n/**\n * Splits a query string into words, parens and quoted patterns.\n *\n * Mirrors upstream, which joins argv with spaces and parses the resulting\n * character stream: a pattern containing spaces must carry literal double\n * quotes, since the shell's own quotes are gone by the time it arrives.\n */\nfunction tokenize(source: string): Token[] {\n const tokens: Token[] = []\n let index = 0\n while (index < source.length) {\n const char = source.charAt(index)\n if (/\\s/.test(char)) {\n index += 1\n continue\n }\n if (char === '(' || char === ')') {\n tokens.push({ text: char, quoted: false })\n index += 1\n continue\n }\n if (char === '\"') {\n index += 1\n const chars: string[] = []\n while (index < source.length && source.charAt(index) !== '\"') {\n if (source.charAt(index) === '\\\\' && index + 1 < source.length) index += 1\n chars.push(source.charAt(index))\n index += 1\n }\n if (index >= source.length) throw new QueryError('unterminated quoted pattern')\n index += 1\n tokens.push({ text: chars.join(''), quoted: true })\n continue\n }\n const start = index\n while (index < source.length && !/[\\s()]/.test(source.charAt(index))) index += 1\n tokens.push({ text: source.slice(start, index), quoted: false })\n }\n return tokens\n}\n\nfunction keyword(token: Token | undefined): string | null {\n if (token === undefined || token.quoted) return null\n return token.text.toLowerCase()\n}\n\nfunction quote(value: string): string {\n return `\"${value.replaceAll('\\\\', '\\\\\\\\').replaceAll('\"', '\\\\\"')}\"`\n}\n\nfunction imapDate(text: string): Date {\n const parts = text.split('-')\n if (parts.length !== 3) {\n throw new QueryError(`invalid date '${text}', expected yyyy-mm-dd`)\n }\n const year = Number(parts[0])\n const month = Number(parts[1])\n const day = Number(parts[2])\n const value = new Date(Date.UTC(year, month - 1, day))\n if (\n !Number.isInteger(year) ||\n !Number.isInteger(month) ||\n !Number.isInteger(day) ||\n Number.isNaN(value.getTime()) ||\n value.getUTCMonth() !== month - 1 ||\n value.getUTCDate() !== day\n ) {\n throw new QueryError(`invalid date '${text}'`)\n }\n return value\n}\n\nfunction formatDate(value: Date): string {\n const day = String(value.getUTCDate()).padStart(2, '0')\n const month = IMAP_MONTHS[value.getUTCMonth()] ?? 'Jan'\n return `${day}-${month}-${String(value.getUTCFullYear())}`\n}\n\n/**\n * Recursive-descent parser producing IMAP SEARCH keys directly: the AST\n * would be a himalaya type, and translating it to IMAP is the only thing\n * anything ever does with it.\n */\nclass Parser {\n private index = 0\n\n constructor(private readonly tokens: Token[]) {}\n\n peek(): Token | undefined {\n return this.tokens[this.index]\n }\n\n take(): Token {\n const token = this.peek()\n if (token === undefined) throw new QueryError('unexpected end of query')\n this.index += 1\n return token\n }\n\n parseOr(): string {\n let left = this.parseAnd()\n while (keyword(this.peek()) === 'or') {\n this.take()\n left = `OR ${left} ${this.parseAnd()}`\n }\n return left\n }\n\n parseAnd(): string {\n let left = this.parseUnary()\n while (keyword(this.peek()) === 'and') {\n this.take()\n left = `(${left} ${this.parseUnary()})`\n }\n return left\n }\n\n parseUnary(): string {\n const word = keyword(this.peek())\n if (word === 'not') {\n this.take()\n return `NOT ${this.parseUnary()}`\n }\n if (word === '(') {\n this.take()\n const inner = this.parseOr()\n if (keyword(this.peek()) !== ')') throw new QueryError(\"missing closing ')'\")\n this.take()\n return inner\n }\n return this.parseCondition()\n }\n\n parseCondition(): string {\n const token = this.take()\n const word = keyword(token)\n if (word === null || !(CONDITIONS as readonly string[]).includes(word)) {\n throw new QueryError(\n `expected a condition (${CONDITIONS.join(', ')}) but found '${token.text}'`,\n )\n }\n const value = this.take().text\n if (word === 'date') return `SENTON ${formatDate(imapDate(value))}`\n if (word === 'before') return `SENTBEFORE ${formatDate(imapDate(value))}`\n if (word === 'after') {\n // Strictly greater than the given day; IMAP SENTSINCE is\n // inclusive, so ask for the day after.\n const next = new Date(imapDate(value).getTime() + 86400000)\n return `SENTSINCE ${formatDate(next)}`\n }\n if (word === 'flag') {\n const key = FLAGS[value.toLowerCase()]\n if (key === undefined) {\n throw new QueryError(\n `unknown flag '${value}', expected one of ${Object.keys(FLAGS).sort(compareCodePoints).join(', ')}`,\n )\n }\n return key\n }\n return `${word.toUpperCase()} ${quote(value)}`\n }\n\n parseSorters(): Sorter[] {\n this.take()\n if (keyword(this.peek()) !== 'by') throw new QueryError(\"expected 'by' after 'order'\")\n this.take()\n const sorters: Sorter[] = []\n for (;;) {\n const kind = keyword(this.peek())\n if (kind === null || !(SORT_KINDS as readonly string[]).includes(kind)) break\n this.take()\n let descending = false\n const order = keyword(this.peek())\n if (order === 'asc' || order === 'desc') {\n this.take()\n descending = order === 'desc'\n }\n sorters.push({ kind: kind as SortKind, descending })\n }\n if (sorters.length === 0) {\n throw new QueryError(`expected a sort key (${SORT_KINDS.join(', ')}) after 'order by'`)\n }\n return sorters\n }\n}\n\n/** Parses a himalaya search query into IMAP criteria plus sorters. */\nexport function parseQuery(source: string): Query {\n const parser = new Parser(tokenize(source))\n let criteria = 'ALL'\n const head = keyword(parser.peek())\n if (head !== null && head !== 'order') criteria = parser.parseOr()\n let sorters: Sorter[] = []\n if (keyword(parser.peek()) === 'order') sorters = parser.parseSorters()\n const leftover = parser.peek()\n if (leftover !== undefined) {\n throw new QueryError(`unexpected '${leftover.text}' at end of query`)\n }\n return { criteria, sorters }\n}\n\nfunction sentAt(header: FetchedMessage): number {\n const value = Date.parse(header.date)\n return Number.isNaN(value) ? 0 : value\n}\n\nconst SORT_KEYS: Record<SortKind, (header: FetchedMessage) => string | number> = {\n date: sentAt,\n from: (header) => header.from.email,\n to: (header) => header.to[0]?.email ?? '',\n subject: (header) => header.subject,\n}\n\nfunction compare(a: string | number, b: string | number): number {\n if (typeof a === 'number' && typeof b === 'number') return a - b\n return String(a) < String(b) ? -1 : String(a) > String(b) ? 1 : 0\n}\n\n/**\n * Orders fetched headers by the query's sorters, applied right to left so\n * the first sorter ends up the primary key. With no sorters the order is\n * date descending, matching `envelope list`.\n */\nexport function sortHeaders(\n headers: FetchedMessage[],\n sorters: readonly Sorter[],\n): FetchedMessage[] {\n const ordered = [...headers]\n if (sorters.length === 0) {\n ordered.sort((a, b) => sentAt(b) - sentAt(a))\n return ordered\n }\n for (const sorter of [...sorters].reverse()) {\n const key = SORT_KEYS[sorter.kind]\n ordered.sort((a, b) => (sorter.descending ? compare(key(b), key(a)) : compare(key(a), key(b))))\n }\n return ordered\n}\n\n/** Takes one page of results, counting from 1. */\n/**\n * How many of the newest matching UIDs to fetch headers for.\n *\n * Sorting happens client-side, so a page cannot be served without\n * holding the candidate headers. Under the default order (date\n * descending) the newest `page * pageSize` messages are the only ones\n * that can appear, so ask for exactly those. An explicit `order by` is\n * unrelated to arrival order, so the whole account window has to be\n * considered, capped by `maxMessages` either way: that is the account\n * knob for how far back mirage looks, and without it one `envelope list`\n * would fetch every message in the mailbox.\n */\nexport function uidBudget(\n page: number,\n pageSize: number,\n sorters: readonly Sorter[],\n maxMessages: number,\n): number {\n if (sorters.length > 0) return maxMessages\n return Math.min(Math.max(page, 1) * pageSize, maxMessages)\n}\n\nexport function pageSlice<T>(items: readonly T[], page: number, pageSize: number): T[] {\n const start = Math.max(page - 1, 0) * pageSize\n return items.slice(start, start + pageSize)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FlagView,\n IOResult,\n type ByteSource,\n type CLIInvocation,\n type CommandFnResult,\n} from '@struktoai/mirage-core'\nimport { EmailAccessor } from '../../../../accessor/email.ts'\nimport { fetchMessage, fetchRawMessage } from '../../../../core/email/_client.ts'\nimport type { EmailConfig } from '../../../../core/email/config.ts'\nimport { messageJsonBytes } from '../../../../core/email/render.ts'\nimport { firstText } from './util.ts'\n\nexport async function read(inv: CLIInvocation): Promise<CommandFnResult> {\n const fl = new FlagView(inv.flags)\n const uid = firstText(inv.texts, 'message id')\n const mailbox = fl.asStr('mailbox') ?? 'INBOX'\n const accessor = new EmailAccessor(inv.config as EmailConfig)\n try {\n if (fl.asBool('raw')) {\n const raw: ByteSource = await fetchRawMessage(accessor, mailbox, uid)\n return [raw, new IOResult()]\n }\n const processed = await fetchMessage(accessor, mailbox, uid)\n // The same renderer the mount serves, so `message read` and `cat`\n // of the .email.json cannot drift apart.\n const out: ByteSource = messageJsonBytes(processed)\n return [out, new IOResult()]\n } finally {\n await accessor.close()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { FlagView, type CLIInvocation, type CommandFnResult } from '@struktoai/mirage-core'\nimport { EmailAccessor } from '../../../../accessor/email.ts'\nimport { fetchMessage } from '../../../../core/email/_client.ts'\nimport type { EmailConfig } from '../../../../core/email/config.ts'\nimport { firstText, route } from './util.ts'\n\nexport async function reply(inv: CLIInvocation): Promise<CommandFnResult> {\n const fl = new FlagView(inv.flags)\n const uid = firstText(inv.texts, 'message id')\n const mailbox = fl.asStr('mailbox') ?? 'INBOX'\n const accessor = new EmailAccessor(inv.config as EmailConfig)\n let original\n try {\n original = await fetchMessage(accessor, mailbox, uid)\n } finally {\n await accessor.close()\n }\n return route(\n inv.config as EmailConfig,\n fl,\n inv.stdin,\n {\n message: original,\n mode: 'reply',\n postingStyle: fl.asStr('posting_style') === 'bottom' ? 'bottom' : 'top',\n quoteHeadline: fl.asStr('quote_headline') ?? '',\n },\n inv.doors,\n )\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FlagView,\n IOResult,\n type ByteSource,\n type CLIInvocation,\n type CommandFnResult,\n} from '@struktoai/mirage-core'\nimport { EmailAccessor } from '../../../../accessor/email.ts'\nimport { fetchHeaders, listMessageUids } from '../../../../core/email/_client.ts'\nimport type { EmailConfig } from '../../../../core/email/config.ts'\nimport { messagesJsonBytes } from '../../../../core/email/render.ts'\nimport { DEFAULT_PAGE_SIZE } from './list.ts'\nimport { pageSlice, parseQuery, sortHeaders, uidBudget } from './query.ts'\n\nexport async function searchEnvelopes(inv: CLIInvocation): Promise<CommandFnResult> {\n const fl = new FlagView(inv.flags)\n const mailbox = fl.asStr('mailbox') ?? 'INBOX'\n const page = fl.asInt('page') ?? 1\n const pageSize = fl.asInt('page_size') ?? DEFAULT_PAGE_SIZE\n // The shell already split the query; upstream joins argv the same way\n // before parsing, so a pattern with spaces needs literal quotes.\n const query = parseQuery(inv.texts.join(' '))\n const account = inv.config as EmailConfig\n const budget = uidBudget(page, pageSize, query.sorters, account.maxMessages)\n const accessor = new EmailAccessor(account)\n let headers\n try {\n const uids = await listMessageUids(accessor, mailbox, query.criteria, budget)\n headers = uids.length > 0 ? await fetchHeaders(accessor, mailbox, uids) : []\n } finally {\n await accessor.close()\n }\n const pageOf = pageSlice(sortHeaders(headers, query.sorters), page, pageSize)\n const out: ByteSource = messagesJsonBytes(pageOf)\n return [out, new IOResult()]\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n FlagView,\n IOResult,\n materialize,\n type ByteSource,\n type CLIInvocation,\n type CommandFnResult,\n} from '@struktoai/mirage-core'\nimport type { EmailConfig } from '../../../../core/email/config.ts'\nimport { deliver } from './deliver.ts'\n\nconst ENC = new TextEncoder()\n\nexport async function send(inv: CLIInvocation): Promise<CommandFnResult> {\n // The operand is a whole RFC 5322 message, so tokens rejoin with a\n // space and literal \\n become real line breaks, the way upstream's\n // MessageArg resolves an inline message.\n const inline = inv.texts.join(' ').replaceAll('\\\\r', '').replaceAll('\\\\n', '\\n')\n const raw =\n inline !== ''\n ? ENC.encode(inline)\n : inv.stdin !== null\n ? await materialize(inv.stdin)\n : new Uint8Array()\n if (new TextDecoder().decode(raw).trim() === '') {\n throw new Error('no message provided: pass it as an argument or pipe it via standard input')\n }\n const fl = new FlagView(inv.flags)\n const { parsed, warning } = await deliver(\n inv.config as EmailConfig,\n raw,\n fl.asStr('save') ?? null,\n )\n const result = {\n status: 'sent',\n to: parsed.to\n .map((entry) => (entry.name === '' ? entry.email : `${entry.name} <${entry.email}>`))\n .join(', '),\n subject: parsed.subject,\n }\n const out: ByteSource = ENC.encode(JSON.stringify(result))\n return [out, new IOResult({ stderr: warning === '' ? null : ENC.encode(warning) })]\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { type ChildProcess, spawn } from 'node:child_process'\nimport {\n HOME_CONFIG_KEYS,\n PythonRuntime,\n registerRuntime,\n type HomeConfig,\n type RunArgs,\n type RunResult,\n type RuntimeOptions,\n} from '@struktoai/mirage-core'\n\nconst LOCAL_HOME_ENV = 'MIRAGE_LOCAL_HOME'\n\n/**\n * Run Python code on a host interpreter as a subprocess.\n *\n * Each run spawns `<interpreter> -c <code>`; the code sees the host\n * filesystem and environment, not the workspace mounts. Mirrors the\n * python LocalRuntime: the interpreter defaults to `python3` on PATH\n * (node has no embedded python, unlike the python package which\n * defaults to its own interpreter); point the config `home` or the\n * MIRAGE_LOCAL_HOME environment variable at another binary, e.g. a\n * project venv whose packages the code needs.\n */\nexport class LocalRuntime extends PythonRuntime {\n readonly name = 'local'\n // Spawns the host interpreter: a real process with the user's own\n // filesystem and network, doors the workspace gate never sees. This\n // is the base default; declared here so the claim is explicit at the\n // one builtin runtime that voids a world's sandbox claim.\n override readonly reach = 'process'\n private readonly python: string\n private readonly children = new Set<ChildProcess>()\n\n constructor(options: RuntimeOptions = {}) {\n super(options, HOME_CONFIG_KEYS)\n const home = (this.config as HomeConfig).home\n const chosen = home !== undefined && home !== '' ? home : process.env[LOCAL_HOME_ENV]\n this.python = chosen !== undefined && chosen !== '' ? chosen : 'python3'\n }\n\n run(args: RunArgs): Promise<RunResult> {\n return new Promise((resolve, reject) => {\n // The signal aborts when the command's limit timeout trips:\n // spawn then SIGKILLs the child (matching the python runtime's\n // proc.kill() on cancellation) and 'close' settles the promise.\n const child = spawn(this.python, ['-c', args.code, ...args.args], {\n stdio: ['pipe', 'pipe', 'pipe'],\n env: { ...process.env, ...args.env },\n ...(args.signal !== undefined ? { signal: args.signal, killSignal: 'SIGKILL' } : {}),\n })\n this.children.add(child)\n const out: Buffer[] = []\n const err: Buffer[] = []\n child.stdout.on('data', (chunk: Buffer) => out.push(chunk))\n child.stderr.on('data', (chunk: Buffer) => err.push(chunk))\n child.on('error', (error: NodeJS.ErrnoException) => {\n if (error.name === 'AbortError') return\n this.children.delete(child)\n reject(\n error.code === 'ENOENT'\n ? new Error(\n `local python interpreter not found: '${this.python}' (set the ` +\n `runtime entry's config home or ${LOCAL_HOME_ENV})`,\n )\n : error,\n )\n })\n child.on('close', (code) => {\n this.children.delete(child)\n const stderr = Buffer.concat(err)\n resolve({\n stdout: new Uint8Array(Buffer.concat(out)),\n stderr: stderr.length > 0 ? new Uint8Array(stderr) : null,\n exitCode: code ?? 1,\n })\n })\n // EPIPE means the program exited without draining its stdin\n // (`head`-like); python's communicate() suppresses the matching\n // BrokenPipeError, so it is not an error here either.\n child.stdin.on('error', (error: NodeJS.ErrnoException) => {\n if (error.code !== 'EPIPE') reject(error)\n })\n if (args.stdin !== null) child.stdin.write(args.stdin)\n child.stdin.end()\n })\n }\n\n override close(): Promise<void> {\n for (const child of this.children) child.kill('SIGKILL')\n this.children.clear()\n return Promise.resolve()\n }\n}\n\nregisterRuntime('local', LocalRuntime)\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n loadOptionalPeer,\n registerRuntime,\n RemoteSandbox,\n type RuntimeOptions,\n type RunResult,\n stdinPath,\n stdinRedirect,\n} from '@struktoai/mirage-core'\nimport { E2B_CONFIG_KEYS, type E2BConfig } from './config.ts'\nimport type { CommandResult, Sandbox } from 'e2b'\nimport type * as e2bSdk from 'e2b'\n\nexport type E2bSdk = typeof e2bSdk\n\nconst ENC = new TextEncoder()\n\n/**\n * An E2B sandbox the user runs as a whole-line runtime.\n *\n * You create the sandbox yourself (`e2b sandbox spawn` or the SDK);\n * mirage only connects by `sandboxId` and execs lines. `apiKey` falls\n * back to E2B_API_KEY. E2B's exec reports stdout and stderr\n * separately, so both stream back real; it takes no stdin, so piped\n * bytes are uploaded and redirected in.\n */\nexport class E2BRuntime extends RemoteSandbox<E2BConfig> {\n readonly name = 'e2b'\n private sdk: E2bSdk | null = null\n private sandbox: Sandbox | null = null\n\n constructor(options: RuntimeOptions<E2BConfig> | Record<string, unknown> = {}) {\n super(options, E2B_CONFIG_KEYS)\n if (!this.config.sandboxId) {\n throw new Error('e2b config needs sandboxId: the id of a live sandbox you created')\n }\n }\n\n // The SDK loader as a seam: tests substitute a fake module here.\n protected loadSdk(): Promise<E2bSdk> {\n return loadOptionalPeer(() => import('e2b'), {\n feature: \"the 'e2b' runtime\",\n packageName: 'e2b',\n })\n }\n\n private async ensureSdk(): Promise<E2bSdk> {\n this.sdk ??= await this.loadSdk()\n return this.sdk\n }\n\n private apiParams(): Record<string, unknown> {\n return this.config.apiKey !== undefined ? { apiKey: this.config.apiKey } : {}\n }\n\n async connect(): Promise<void> {\n const sdk = await this.ensureSdk()\n this.sandbox = await sdk.Sandbox.connect(this.config.sandboxId, this.apiParams())\n }\n\n async execLine(\n line: string,\n stdin: Uint8Array | null,\n env: Record<string, string>,\n cwd: string,\n ): Promise<RunResult> {\n if (this.sandbox === null) throw new Error('e2b sandbox not connected')\n const sdk = await this.ensureSdk()\n let command = line\n if (stdin !== null) {\n const path = stdinPath()\n await this.upload(path, stdin)\n command = stdinRedirect(line, path)\n }\n let result: Pick<CommandResult, 'stdout' | 'stderr' | 'exitCode'>\n try {\n result = await this.sandbox.commands.run(command, { envs: env, cwd })\n } catch (error) {\n if (!(error instanceof sdk.CommandExitError)) throw error\n result = error\n }\n return {\n stdout: ENC.encode(result.stdout),\n stderr: ENC.encode(result.stderr),\n exitCode: result.exitCode,\n }\n }\n\n private async upload(path: string, data: Uint8Array): Promise<void> {\n if (this.sandbox === null) throw new Error('e2b sandbox not connected')\n const slash = path.lastIndexOf('/')\n const parent = slash > 0 ? path.slice(0, slash) : ''\n if (parent !== '') await this.sandbox.files.makeDir(parent)\n await this.sandbox.files.write(path, new Blob([data]))\n }\n}\n\nregisterRuntime('e2b', E2BRuntime)\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { SandboxConfig } from '@struktoai/mirage-core'\n\n/** How to reach the user's live E2B sandbox. */\nexport interface E2BConfig extends SandboxConfig {\n /**\n * Id of a sandbox you created (`e2b sandbox spawn` or the SDK),\n * booted from a template with fuse3 and mirage installed.\n */\n sandboxId: string\n /** E2B credential; absent reads E2B_API_KEY. */\n apiKey?: string\n}\n\nexport const E2B_CONFIG_KEYS: readonly string[] = ['env', 'sandboxId', 'apiKey']\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { spawn } from 'node:child_process'\nimport {\n registerRuntime,\n RemoteSandbox,\n type RuntimeOptions,\n type RunResult,\n} from '@struktoai/mirage-core'\nimport { DOCKER_CONFIG_KEYS, type DockerConfig } from './config.ts'\nimport { DOCKER_CLI_HINT } from './constants.ts'\n\ninterface DockerResult {\n stdout: Uint8Array\n stderr: Uint8Array\n code: number\n}\n\n/**\n * A container the user runs as a whole-line runtime.\n *\n * You start the container yourself; mirage only connects to it and\n * execs lines. The docker CLI is the transport (Docker Desktop,\n * colima, or a podman alias all work), so there is no SDK dependency\n * and no daemon socket wiring; each line is one `docker exec -i` with\n * the merged environment, the rebased cwd, real stdin, and separated\n * stderr.\n */\nexport class DockerRuntime extends RemoteSandbox<DockerConfig> {\n readonly name = 'docker'\n\n constructor(options: RuntimeOptions<DockerConfig> | Record<string, unknown> = {}) {\n super(options, DOCKER_CONFIG_KEYS)\n if (!this.config.container) {\n throw new Error('docker config needs container: the id or name of a running container')\n }\n }\n\n // One docker CLI invocation; the seam tests override.\n protected docker(args: string[], stdin: Uint8Array | null = null): Promise<DockerResult> {\n return new Promise((resolve, reject) => {\n const child = spawn('docker', args, { stdio: ['pipe', 'pipe', 'pipe'] })\n const out: Buffer[] = []\n const err: Buffer[] = []\n child.stdout.on('data', (chunk: Buffer) => out.push(chunk))\n child.stderr.on('data', (chunk: Buffer) => err.push(chunk))\n child.on('error', (error: NodeJS.ErrnoException) => {\n reject(error.code === 'ENOENT' ? new Error(DOCKER_CLI_HINT) : error)\n })\n child.on('close', (code) => {\n resolve({\n stdout: new Uint8Array(Buffer.concat(out)),\n stderr: new Uint8Array(Buffer.concat(err)),\n code: code ?? 1,\n })\n })\n // EPIPE means the container command exited without draining its\n // stdin (`head`-like); python's communicate() suppresses the\n // matching BrokenPipeError, so it is not an error here either.\n child.stdin.on('error', (error: NodeJS.ErrnoException) => {\n if (error.code !== 'EPIPE') reject(error)\n })\n if (stdin !== null) child.stdin.write(stdin)\n child.stdin.end()\n })\n }\n\n async connect(): Promise<void> {\n const result = await this.docker([\n 'inspect',\n '--format',\n '{{.State.Running}}',\n this.config.container,\n ])\n if (result.code !== 0) {\n throw new Error(`docker inspect failed: ${decode(result.stderr).trim()}`)\n }\n if (decode(result.stdout).trim() !== 'true') {\n throw new Error(`container ${this.config.container} is not running`)\n }\n }\n\n async execLine(\n line: string,\n stdin: Uint8Array | null,\n env: Record<string, string>,\n cwd: string,\n ): Promise<RunResult> {\n const args = ['exec', '-i', '-w', cwd]\n for (const [key, value] of Object.entries(env)) args.push('-e', `${key}=${value}`)\n args.push(this.config.container, 'sh', '-c', line)\n const result = await this.docker(args, stdin)\n return { stdout: result.stdout, stderr: result.stderr, exitCode: result.code }\n }\n}\n\nconst DECODER = new TextDecoder()\n\nfunction decode(bytes: Uint8Array): string {\n return DECODER.decode(bytes)\n}\n\nregisterRuntime('docker', DockerRuntime)\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { SandboxConfig } from '@struktoai/mirage-core'\n\n/** How to reach the user's running container. */\nexport interface DockerConfig extends SandboxConfig {\n /**\n * Id or name of a running container. You start it yourself\n * (`docker run -d ... sleep infinity`); live FUSE mounts need\n * `--cap-add SYS_ADMIN --device /dev/fuse` and an image with mirage\n * installed.\n */\n container: string\n}\n\nexport const DOCKER_CONFIG_KEYS: readonly string[] = ['env', 'container']\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport const DOCKER_CLI_HINT =\n 'the docker runtime needs the docker CLI on PATH (Docker Desktop, colima, or a podman alias)'\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n normalizeFields,\n type ChromaConfig,\n type DifyConfig,\n type LanceDBConfig,\n type QdrantConfig,\n type Resource,\n compareCodePoints,\n} from '@struktoai/mirage-core'\n\n/**\n * Construct a resource by registry name. Mirrors Python's\n * `mirage.resource.registry.build_resource`.\n *\n * Each entry is an async factory that lazy-imports its module so that\n * importing this file doesn't pull in every backend's dependencies.\n * Only the resource you actually request gets loaded — important for\n * S3/Redis whose peer deps (`@aws-sdk/client-s3`, `redis`) are optional.\n *\n * Configs are normalized from Python-style snake_case (used in YAML and\n * by the Python `mirage.config` loader) to TS-idiomatic camelCase. So\n * the same YAML file works in both Python and TS.\n */\nexport type ResourceFactory = (config: Record<string, unknown>) => Promise<Resource>\n\nconst REGISTRY: Record<string, ResourceFactory> = {\n ram: async (_config) => {\n const { RAMResource } = await import('@struktoai/mirage-core')\n return new RAMResource()\n },\n disk: async (config) => {\n const { DiskResource } = await import('./disk/disk.ts')\n const norm = normalizeFields(config) as { root: string }\n return new DiskResource(norm)\n },\n redis: async (config) => {\n const { RedisResource } = await import('./redis/redis.ts')\n const norm = normalizeFields(config)\n return new RedisResource(norm)\n },\n s3: async (config) => {\n const { S3Resource } = await import('./s3/s3.ts')\n const { normalizeS3Config } = await import('./s3/config.ts')\n return new S3Resource(normalizeS3Config(config))\n },\n gridfs: async (config) => {\n const { GridFSResource } = await import('./gridfs/gridfs.ts')\n const { normalizeGridFSConfig } = await import('./gridfs/config.ts')\n return new GridFSResource(normalizeGridFSConfig(config))\n },\n gcs: async (config) => {\n const { GCSResource } = await import('./gcs/gcs.ts')\n const { normalizeGcsConfig } = await import('./gcs/config.ts')\n return new GCSResource(normalizeGcsConfig(config))\n },\n oci: async (config) => {\n const { OCIResource } = await import('./oci/oci.ts')\n const { normalizeOciConfig } = await import('./oci/config.ts')\n return new OCIResource(normalizeOciConfig(config))\n },\n r2: async (config) => {\n const { R2Resource } = await import('./r2/r2.ts')\n const { normalizeR2Config } = await import('./r2/config.ts')\n return new R2Resource(normalizeR2Config(config))\n },\n hf_buckets: async (config) => {\n const { HfBucketsResource } = await import('./hf_buckets/hf_buckets.ts')\n const { normalizeHfBucketsConfig } = await import('./hf_buckets/config.ts')\n return new HfBucketsResource(normalizeHfBucketsConfig(config))\n },\n hf_datasets: async (config) => {\n const { HfDatasetsResource } = await import('./hf_datasets/hf_datasets.ts')\n const { normalizeHfRepoConfig } = await import('./hf_buckets/config.ts')\n return new HfDatasetsResource(normalizeHfRepoConfig(config))\n },\n hf_models: async (config) => {\n const { HfModelsResource } = await import('./hf_models/hf_models.ts')\n const { normalizeHfRepoConfig } = await import('./hf_buckets/config.ts')\n return new HfModelsResource(normalizeHfRepoConfig(config))\n },\n hf_spaces: async (config) => {\n const { HfSpacesResource } = await import('./hf_spaces/hf_spaces.ts')\n const { normalizeHfRepoConfig } = await import('./hf_buckets/config.ts')\n return new HfSpacesResource(normalizeHfRepoConfig(config))\n },\n supabase: async (config) => {\n const { SupabaseResource } = await import('./supabase/supabase.ts')\n const { normalizeSupabaseConfig } = await import('./supabase/config.ts')\n return new SupabaseResource(normalizeSupabaseConfig(config))\n },\n databricks_volume: async (config) => {\n const { DatabricksVolumeResource } = await import('./databricks_volume/databricks_volume.ts')\n const { normalizeDatabricksVolumeConfig } = await import('@struktoai/mirage-core')\n return DatabricksVolumeResource.create(normalizeDatabricksVolumeConfig(config))\n },\n minio: async (config) => {\n const { MinIOResource } = await import('./minio/minio.ts')\n const { normalizeMinIOConfig } = await import('./minio/config.ts')\n return new MinIOResource(normalizeMinIOConfig(config))\n },\n ceph: async (config) => {\n const { CephResource } = await import('./ceph/ceph.ts')\n const { normalizeCephConfig } = await import('./ceph/config.ts')\n return new CephResource(normalizeCephConfig(config))\n },\n seaweedfs: async (config) => {\n const { SeaweedFSResource } = await import('./seaweedfs/seaweedfs.ts')\n const { normalizeSeaweedFSConfig } = await import('./seaweedfs/config.ts')\n return new SeaweedFSResource(normalizeSeaweedFSConfig(config))\n },\n wasabi: async (config) => {\n const { WasabiResource } = await import('./wasabi/wasabi.ts')\n const { normalizeWasabiConfig } = await import('./wasabi/config.ts')\n return new WasabiResource(normalizeWasabiConfig(config))\n },\n backblaze: async (config) => {\n const { BackblazeResource } = await import('./backblaze/backblaze.ts')\n const { normalizeBackblazeConfig } = await import('./backblaze/config.ts')\n return new BackblazeResource(normalizeBackblazeConfig(config))\n },\n digitalocean: async (config) => {\n const { DigitalOceanResource } = await import('./digitalocean/digitalocean.ts')\n const { normalizeDigitalOceanConfig } = await import('./digitalocean/config.ts')\n return new DigitalOceanResource(normalizeDigitalOceanConfig(config))\n },\n tencent: async (config) => {\n const { TencentResource } = await import('./tencent/tencent.ts')\n const { normalizeTencentConfig } = await import('./tencent/config.ts')\n return new TencentResource(normalizeTencentConfig(config))\n },\n aliyun: async (config) => {\n const { AliyunResource } = await import('./aliyun/aliyun.ts')\n const { normalizeAliyunConfig } = await import('./aliyun/config.ts')\n return new AliyunResource(normalizeAliyunConfig(config))\n },\n scaleway: async (config) => {\n const { ScalewayResource } = await import('./scaleway/scaleway.ts')\n const { normalizeScalewayConfig } = await import('./scaleway/config.ts')\n return new ScalewayResource(normalizeScalewayConfig(config))\n },\n qingstor: async (config) => {\n const { QingStorResource } = await import('./qingstor/qingstor.ts')\n const { normalizeQingStorConfig } = await import('./qingstor/config.ts')\n return new QingStorResource(normalizeQingStorConfig(config))\n },\n postgres: async (config) => {\n const { PostgresResource } = await import('./postgres/postgres.ts')\n const { normalizePostgresConfig } = await import('@struktoai/mirage-core')\n return new PostgresResource(normalizePostgresConfig(config))\n },\n mongodb: async (config) => {\n const { MongoDBResource } = await import('./mongodb/mongodb.ts')\n const { normalizeMongoDBConfig } = await import('@struktoai/mirage-core')\n return new MongoDBResource(normalizeMongoDBConfig(config))\n },\n chroma: async (config) => {\n const { ChromaResource } = await import('@struktoai/mirage-core')\n return new ChromaResource(normalizeFields(config) as unknown as ChromaConfig)\n },\n dify: async (config) => {\n const { DifyResource } = await import('@struktoai/mirage-core')\n return new DifyResource(normalizeFields(config) as unknown as DifyConfig)\n },\n qdrant: async (config) => {\n const { QdrantResource } = await import('@struktoai/mirage-core')\n return new QdrantResource(normalizeFields(config) as unknown as QdrantConfig)\n },\n lancedb: async (config) => {\n const { LanceDBResource } = await import('./lancedb/lancedb.ts')\n return new LanceDBResource(normalizeFields(config) as unknown as LanceDBConfig)\n },\n slack: async (config) => {\n const { SlackResource } = await import('./slack/slack.ts')\n const { normalizeSlackConfig } = await import('@struktoai/mirage-core')\n return new SlackResource(normalizeSlackConfig(config))\n },\n ssh: async (config) => {\n const { SSHResource } = await import('./ssh/ssh.ts')\n const { normalizeSshConfig } = await import('./ssh/config.ts')\n return new SSHResource(normalizeSshConfig(config))\n },\n nextcloud: async (config) => {\n const { NextcloudResource } = await import('./nextcloud/nextcloud.ts')\n const { normalizeNextcloudConfig } = await import('./nextcloud/config.ts')\n return new NextcloudResource(normalizeNextcloudConfig(config))\n },\n discord: async (config) => {\n const { DiscordResource } = await import('./discord/discord.ts')\n const { normalizeDiscordConfig } = await import('@struktoai/mirage-core')\n return new DiscordResource(normalizeDiscordConfig(config))\n },\n trello: async (config) => {\n const { TrelloResource } = await import('./trello/trello.ts')\n const { normalizeTrelloConfig } = await import('./trello/config.ts')\n return new TrelloResource(normalizeTrelloConfig(config))\n },\n linear: async (config) => {\n const { LinearResource } = await import('./linear/linear.ts')\n const { normalizeLinearConfig } = await import('@struktoai/mirage-core')\n return new LinearResource(normalizeLinearConfig(config))\n },\n notion: async (config) => {\n const { NotionResource } = await import('./notion/notion.ts')\n const { normalizeNotionConfig } = await import('@struktoai/mirage-core')\n return new NotionResource(normalizeNotionConfig(config))\n },\n langfuse: async (config) => {\n const { LangfuseResource } = await import('./langfuse/langfuse.ts')\n const { normalizeLangfuseConfig } = await import('./langfuse/config.ts')\n return new LangfuseResource(normalizeLangfuseConfig(config))\n },\n jaeger: async (config) => {\n const { JaegerResource } = await import('./jaeger/jaeger.ts')\n const { normalizeJaegerConfig } = await import('./jaeger/config.ts')\n return new JaegerResource(normalizeJaegerConfig(config))\n },\n github: async (config) => {\n const { GitHubResource } = await import('./github/github.ts')\n const { normalizeGitHubConfig } = await import('./github/config.ts')\n return GitHubResource.create(normalizeGitHubConfig(config))\n },\n github_ci: async (config) => {\n const { GitHubCIResource } = await import('./github_ci/github_ci.ts')\n const { normalizeGitHubCIConfig } = await import('./github_ci/config.ts')\n return new GitHubCIResource(normalizeGitHubCIConfig(config))\n },\n gcal: async (config) => {\n const { GCalResource } = await import('./gcal/gcal.ts')\n const { normalizeGCalConfig } = await import('./gcal/config.ts')\n return new GCalResource(normalizeGCalConfig(config))\n },\n gdocs: async (config) => {\n const { GDocsResource } = await import('./gdocs/gdocs.ts')\n const { normalizeGDocsConfig } = await import('./gdocs/config.ts')\n return new GDocsResource(normalizeGDocsConfig(config))\n },\n gsheets: async (config) => {\n const { GSheetsResource } = await import('./gsheets/gsheets.ts')\n const { normalizeGSheetsConfig } = await import('./gsheets/config.ts')\n return new GSheetsResource(normalizeGSheetsConfig(config))\n },\n gslides: async (config) => {\n const { GSlidesResource } = await import('./gslides/gslides.ts')\n const { normalizeGSlidesConfig } = await import('./gslides/config.ts')\n return new GSlidesResource(normalizeGSlidesConfig(config))\n },\n gdrive: async (config) => {\n const { GDriveResource } = await import('./gdrive/gdrive.ts')\n const { normalizeGDriveConfig } = await import('./gdrive/config.ts')\n return new GDriveResource(normalizeGDriveConfig(config))\n },\n onedrive: async (config) => {\n const { OneDriveResource, normalizeOneDriveConfig } = await import('@struktoai/mirage-core')\n return new OneDriveResource(normalizeOneDriveConfig(config))\n },\n sharepoint: async (config) => {\n const { SharePointResource, normalizeSharePointConfig } = await import('@struktoai/mirage-core')\n return new SharePointResource(normalizeSharePointConfig(config))\n },\n mem0: async (config) => {\n const { Mem0Resource, normalizeMem0Config } = await import('@struktoai/mirage-core')\n return new Mem0Resource(normalizeMem0Config(config))\n },\n dropbox: async (config) => {\n const { DropboxResource } = await import('./dropbox/dropbox.ts')\n const { normalizeDropboxConfig } = await import('./dropbox/config.ts')\n return new DropboxResource(normalizeDropboxConfig(config))\n },\n box: async (config) => {\n const { BoxResource } = await import('./box/box.ts')\n const { normalizeBoxConfig } = await import('./box/config.ts')\n return new BoxResource(normalizeBoxConfig(config))\n },\n gmail: async (config) => {\n const { GmailResource } = await import('./gmail/gmail.ts')\n const { normalizeGmailConfig } = await import('./gmail/config.ts')\n return new GmailResource(normalizeGmailConfig(config))\n },\n email: async (config) => {\n const { EmailResource } = await import('./email/email.ts')\n const { normalizeEmailConfig } = await import('../core/email/config.ts')\n return new EmailResource(normalizeEmailConfig(config))\n },\n}\n\nconst CUSTOM: Record<string, ResourceFactory> = {}\n\n/**\n * Look up every constructible name: builtins plus whatever `register()`\n * has added.\n */\nexport function knownResources(): string[] {\n return [...new Set([...Object.keys(REGISTRY), ...Object.keys(CUSTOM)])].sort(compareCodePoints)\n}\n\n/**\n * Register a custom resource factory under `name`. Builtin names cannot\n * be shadowed; re-registering a custom name replaces it. Mirrors\n * Python's `mirage.resource.registry.register_resource`, which keeps\n * builtins in REGISTRY and custom entries in a separate _CUSTOM dict so\n * a plugin cannot replace the builtin `s3` factory.\n */\nexport function register(name: string, factory: ResourceFactory): void {\n if (name in REGISTRY) throw new Error(`cannot register '${name}': shadows a builtin`)\n CUSTOM[name] = factory\n}\n\n/**\n * Build a resource instance by registry name. Builtins win over custom\n * registrations. Throws if the name is unknown.\n */\nexport async function buildResource(\n name: string,\n config: Record<string, unknown> = {},\n): Promise<Resource> {\n const factory = REGISTRY[name] ?? CUSTOM[name]\n if (factory === undefined) {\n throw new Error(\n `unknown resource ${JSON.stringify(name)}; known: ${knownResources().join(', ')}`,\n )\n }\n return factory(config)\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { existsSync } from 'node:fs'\nimport { isAbsolute, resolve } from 'node:path'\nimport { pathToFileURL } from 'node:url'\n\n/**\n * Extensions Node will import from disk. Python's twin tests for a\n * single one (`.py`) because it has one module language; here `.ts` and\n * `.mts` ride on Node's own type stripping, which is strip-only: a file\n * using `enum`, a parameter property, a runtime `namespace` or a legacy\n * decorator is refused at load with ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX.\n * `.mjs` is the spelling with no caveats.\n */\nexport const MODULE_SUFFIXES = ['.mjs', '.cjs', '.mts', '.cts', '.js', '.ts']\n\n/**\n * True when a ref's source is a file on disk rather than a package\n * specifier Node resolves for itself.\n *\n * This is Node's own rule, deliberately NOT Python's. Python's twin asks\n * `\"/\" in source`, which is sound there because a module dotpath is\n * dotted, so a slash can only mean a path. In Node a bare specifier\n * carries slashes all the time (`@scope/pkg`, `pkg/subpath`), so the\n * same test would rebase an installed package under the config\n * directory and then report it as a missing file. A path is what Node\n * calls a path: relative (`./`, `../`) or absolute. The one addition is\n * a bare filename carrying a module suffix (`tool.mjs`), which mirrors\n * the convenience Python allows for `tool.py`; it is restricted to\n * sources with no slash so that `pkg/dist/index.js` stays a subpath\n * export, and `./dist/index.js` says path by saying so.\n *\n * The config loader's `absolutizeCliRef` calls this same function, so\n * the two cannot disagree about what a path is.\n */\nexport function isModulePath(source: string): boolean {\n if (source.startsWith('./') || source.startsWith('../')) return true\n if (source.startsWith('/') || isAbsolute(source)) return true\n if (source.includes('/')) return false\n return MODULE_SUFFIXES.some((suffix) => source.endsWith(suffix))\n}\n\n/** Split a `source:exportName` ref on its last colon. */\nexport function splitRef(spec: string): [string, string] {\n const cut = spec.lastIndexOf(':')\n if (cut < 0) {\n throw new Error(`invalid ref ${JSON.stringify(spec)}, expected 'source:ExportName'`)\n }\n return [spec.slice(0, cut), spec.slice(cut + 1)]\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null\n}\n\nfunction isNotFound(error: unknown): boolean {\n if (!isRecord(error)) return false\n return error.code === 'ERR_MODULE_NOT_FOUND' || error.code === 'ENOENT'\n}\n\nfunction isUnsupportedTypeScript(error: unknown): boolean {\n return isRecord(error) && error.code === 'ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX'\n}\n\n/**\n * Load a module export from a `source:exportName` reference.\n *\n * Two forms, auto-detected the way Python's `load_attr` detects them:\n * a file (`\"./my_cli.mjs:TALLY\"`) or a package specifier\n * (`\"my-package/clis:JIRA\"`). Only a missing file is reworded; every\n * other load failure propagates with Node's own diagnostic, because a\n * syntax error in the user's file is the message they need to read.\n *\n * A CommonJS file resolves through `default` as well as through named\n * exports, since cjs-module-lexer only detects some assignment shapes\n * and `module.exports = { TALLY }` is one it can miss.\n */\nexport async function loadAttr(spec: string): Promise<unknown> {\n const [source, attr] = splitRef(spec)\n // The file's own absence is checked here rather than caught from the\n // import, because a missing module is also what a bad import *inside*\n // the file raises: catching that would report the file we asked for as\n // missing when the file is fine and one of its dependencies is not.\n const path = isModulePath(source) ? (isAbsolute(source) ? source : resolve(source)) : null\n if (path !== null && !existsSync(path)) {\n throw new Error(`cannot load script ${JSON.stringify(source)}`)\n }\n const target = path !== null ? pathToFileURL(path).href : source\n let mod: Record<string, unknown>\n try {\n mod = (await import(target)) as Record<string, unknown>\n } catch (error) {\n if (path === null && isNotFound(error)) {\n throw new Error(`cannot load script ${JSON.stringify(source)}`)\n }\n if (isUnsupportedTypeScript(error)) {\n const detail = error instanceof Error ? error.message : String(error)\n throw new Error(\n `cannot load script ${JSON.stringify(source)}: ${detail}. Node strips types ` +\n `without compiling them; precompile the file or ship it as .mjs.`,\n )\n }\n throw error\n }\n if (attr in mod) return mod[attr]\n const fallback = mod.default\n if (isRecord(fallback) && attr in fallback) return fallback[attr]\n throw new Error(`${JSON.stringify(attr)} not found in ${JSON.stringify(source)}`)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,cAAc;;;ACAd,SAAS,oBAAoB;AAC7B,SAAS,iBAAAA,sBAAqB;AAC9B;AAAA,EAEE;AAAA,EAGA,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EAIA,aAAa;AAAA,OAER;;;ACdP,SAAS,iBAAiB;;;ACA1B,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,WAAW,mBAAmB;AACvC,SAAS,cAAc;AACvB,SAAS,UAAU,Y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":["createRequire","KERNEL_BACKENDS","MountBackend","MountBackend","posix","rstripSlash","rstripSlash","path","posix","path","MountBackend","resolve","loadOptionalPeer","loadOptionalPeer","path","requireCjs","createRequire","MountBackend","KERNEL_BACKENDS","stat","compareCodePoints","ObserverStoreBase","ObserverStoreBase","compareCodePoints","readFileSync","resolve","mkdir","readFile","readdir","stat","unlink","writeFile","path","mtimeMs","path","NamespaceStore","NamespaceStore","path","readFileSync","SessionStore","readFileSync","SessionStore","path","path","WorkspaceStateStore","WorkspaceStateStore","Buffer","createRequire","FileType","requireCjs","ENC","quote","compose","loadOptionalPeer","loadOptionalPeer","ENC","path","FlagView","FlagView","FlagView","IOResult","compareCodePoints","FlagView","IOResult","FlagView","IOResult","FlagView","IOResult","FlagView","FlagView","FlagView","IOResult","FlagView","IOResult","FlagView","IOResult","materialize","ENC","materialize","FlagView","IOResult","registerRuntime","resolve","loadOptionalPeer","registerRuntime","RemoteSandbox","stdinPath","stdinRedirect","ENC","RemoteSandbox","loadOptionalPeer","path","stdinPath","stdinRedirect","registerRuntime","spawn","registerRuntime","RemoteSandbox","RemoteSandbox","resolve","spawn","registerRuntime","compareCodePoints","DiskResource","RedisResource","S3Resource","normalizeS3Config","GridFSResource","normalizeGridFSConfig","GCSResource","OCIResource","R2Resource","HfBucketsResource","normalizeHfBucketsConfig","HfDatasetsResource","normalizeHfRepoConfig","HfModelsResource","HfSpacesResource","SupabaseResource","DatabricksVolumeResource","MinIOResource","CephResource","SeaweedFSResource","WasabiResource","BackblazeResource","DigitalOceanResource","TencentResource","AliyunResource","ScalewayResource","QingStorResource","PostgresResource","MongoDBResource","LanceDBResource","SlackResource","normalizeSlackConfig","SSHResource","normalizeSshConfig","NextcloudResource","normalizeNextcloudConfig","DiscordResource","normalizeDiscordConfig","TrelloResource","normalizeTrelloConfig","LinearResource","normalizeLinearConfig","NotionResource","normalizeNotionConfig","LangfuseResource","normalizeLangfuseConfig","JaegerResource","GitHubResource","normalizeGitHubConfig","GitHubCIResource","normalizeGitHubCIConfig","GCalResource","GDocsResource","GSheetsResource","GSlidesResource","GDriveResource","OneDriveResource","SharePointResource","Mem0Resource","DropboxResource","normalizeDropboxConfig","BoxResource","normalizeBoxConfig","GmailResource","EmailResource","normalizeEmailConfig","path"]}
|