@archipelagolab/lobi 1.0.5 → 1.0.6
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/dist/APEv2Parser-FYYGMFPI.js +15 -0
- package/dist/APEv2Parser-FYYGMFPI.js.map +7 -0
- package/dist/AiffParser-JHSDQA7T.js +194 -0
- package/dist/AiffParser-JHSDQA7T.js.map +7 -0
- package/dist/AsfParser-TPCQDEJB.js +620 -0
- package/dist/AsfParser-TPCQDEJB.js.map +7 -0
- package/dist/DsdiffParser-CGD3C3TL.js +192 -0
- package/dist/DsdiffParser-CGD3C3TL.js.map +7 -0
- package/dist/DsfParser-3UTIJVNF.js +114 -0
- package/dist/DsfParser-3UTIJVNF.js.map +7 -0
- package/dist/FlacParser-HLLYPJ76.js +16 -0
- package/dist/FlacParser-HLLYPJ76.js.map +7 -0
- package/dist/MP4Parser-SM7HYL3Z.js +1145 -0
- package/dist/MP4Parser-SM7HYL3Z.js.map +7 -0
- package/dist/MatroskaParser-X7WRZ6D4.js +662 -0
- package/dist/MatroskaParser-X7WRZ6D4.js.map +7 -0
- package/dist/MpegParser-KXQEC6KD.js +652 -0
- package/dist/MpegParser-KXQEC6KD.js.map +7 -0
- package/dist/MusepackParser-NURI46TG.js +331 -0
- package/dist/MusepackParser-NURI46TG.js.map +7 -0
- package/dist/OggParser-5IYVBXPS.js +448 -0
- package/dist/OggParser-5IYVBXPS.js.map +7 -0
- package/dist/WavPackParser-RTEHKSJH.js +209 -0
- package/dist/WavPackParser-RTEHKSJH.js.map +7 -0
- package/dist/WaveParser-3R2NLXGP.js +300 -0
- package/dist/WaveParser-3R2NLXGP.js.map +7 -0
- package/dist/auth-presence.js +2 -2
- package/dist/channel-plugin-api.js +68 -68
- package/dist/chunk-2GFROLI2.js +261 -0
- package/dist/chunk-2GFROLI2.js.map +7 -0
- package/dist/chunk-2IQWKATM.js +127 -0
- package/dist/chunk-2IQWKATM.js.map +7 -0
- package/dist/chunk-2V6Y4CAN.js +25 -0
- package/dist/chunk-2V6Y4CAN.js.map +7 -0
- package/dist/chunk-2WHRUMOM.js +321 -0
- package/dist/chunk-2WHRUMOM.js.map +7 -0
- package/dist/chunk-3GIK7SAA.js +109 -0
- package/dist/chunk-3GIK7SAA.js.map +7 -0
- package/dist/chunk-3OXOEMBS.js +123 -0
- package/dist/chunk-3OXOEMBS.js.map +7 -0
- package/dist/chunk-3R4ATE4Q.js +176 -0
- package/dist/chunk-3R4ATE4Q.js.map +7 -0
- package/dist/chunk-4CFQNJ7F.js +7 -0
- package/dist/chunk-4CFQNJ7F.js.map +7 -0
- package/dist/chunk-4COI4L2Y.js +31 -0
- package/dist/chunk-4COI4L2Y.js.map +7 -0
- package/dist/chunk-4EKKDVG3.js +1662 -0
- package/dist/chunk-4EKKDVG3.js.map +7 -0
- package/dist/chunk-4L2QI6AY.js +71 -0
- package/dist/chunk-4L2QI6AY.js.map +7 -0
- package/dist/chunk-4OXPPDV6.js +676 -0
- package/dist/chunk-4OXPPDV6.js.map +7 -0
- package/dist/chunk-4QTZHELX.js +51 -0
- package/dist/chunk-4QTZHELX.js.map +7 -0
- package/dist/chunk-4U42OJMK.js +217 -0
- package/dist/chunk-4U42OJMK.js.map +7 -0
- package/dist/chunk-4WCKVGQ5.js +193 -0
- package/dist/chunk-4WCKVGQ5.js.map +7 -0
- package/dist/chunk-4XXERLFH.js +95 -0
- package/dist/chunk-4XXERLFH.js.map +7 -0
- package/dist/chunk-4ZY2BOQ4.js +123 -0
- package/dist/chunk-4ZY2BOQ4.js.map +7 -0
- package/dist/chunk-57ROEOHB.js +183 -0
- package/dist/chunk-57ROEOHB.js.map +7 -0
- package/dist/chunk-5BQ6LLNU.js +39 -0
- package/dist/chunk-5BQ6LLNU.js.map +7 -0
- package/dist/chunk-63QTHDJL.js +52 -0
- package/dist/chunk-63QTHDJL.js.map +7 -0
- package/dist/chunk-65UUVZ6B.js +151 -0
- package/dist/chunk-65UUVZ6B.js.map +7 -0
- package/dist/chunk-6COVTMAO.js +3586 -0
- package/dist/chunk-6COVTMAO.js.map +7 -0
- package/dist/chunk-6EYPDJUD.js +34 -0
- package/dist/chunk-6EYPDJUD.js.map +7 -0
- package/dist/chunk-6HDYPVA4.js +15 -0
- package/dist/chunk-6HDYPVA4.js.map +7 -0
- package/dist/chunk-6OP3FK5F.js +266 -0
- package/dist/chunk-6OP3FK5F.js.map +7 -0
- package/dist/chunk-6RBDFNSX.js +88 -0
- package/dist/chunk-6RBDFNSX.js.map +7 -0
- package/dist/chunk-6TWWCETB.js +70 -0
- package/dist/chunk-6TWWCETB.js.map +7 -0
- package/dist/chunk-6WFHPMUF.js +17 -0
- package/dist/chunk-6WFHPMUF.js.map +7 -0
- package/dist/chunk-77BEEAPD.js +86 -0
- package/dist/chunk-77BEEAPD.js.map +7 -0
- package/dist/chunk-77JJ6QJK.js +50 -0
- package/dist/chunk-77JJ6QJK.js.map +7 -0
- package/dist/chunk-7BIUNV33.js +62 -0
- package/dist/chunk-7BIUNV33.js.map +7 -0
- package/dist/chunk-7L37R42D.js +52 -0
- package/dist/chunk-7L37R42D.js.map +7 -0
- package/dist/chunk-7ZP3KYVO.js +104 -0
- package/dist/chunk-7ZP3KYVO.js.map +7 -0
- package/dist/chunk-ARGF232V.js +32 -0
- package/dist/chunk-ARGF232V.js.map +7 -0
- package/dist/chunk-ATCJOK3K.js +24 -0
- package/dist/chunk-ATCJOK3K.js.map +7 -0
- package/dist/chunk-AUUABFHL.js +124 -0
- package/dist/chunk-AUUABFHL.js.map +7 -0
- package/dist/chunk-B3NTODO7.js +57 -0
- package/dist/chunk-B3NTODO7.js.map +7 -0
- package/dist/chunk-BM7J2W36.js +86 -0
- package/dist/chunk-BM7J2W36.js.map +7 -0
- package/dist/chunk-CEB5S2Z5.js +127 -0
- package/dist/chunk-CEB5S2Z5.js.map +7 -0
- package/dist/chunk-CEKNTCJD.js +177 -0
- package/dist/chunk-CEKNTCJD.js.map +7 -0
- package/dist/chunk-CGFDIH77.js +94 -0
- package/dist/chunk-CGFDIH77.js.map +7 -0
- package/dist/chunk-CPLEC5LJ.js +26 -0
- package/dist/chunk-CPLEC5LJ.js.map +7 -0
- package/dist/chunk-D4GYYYMW.js +155 -0
- package/dist/chunk-D4GYYYMW.js.map +7 -0
- package/dist/chunk-D64CZG54.js +78 -0
- package/dist/chunk-D64CZG54.js.map +7 -0
- package/dist/chunk-DSGPDHF2.js +737 -0
- package/dist/chunk-DSGPDHF2.js.map +7 -0
- package/dist/chunk-EBXHW7ZO.js +108 -0
- package/dist/chunk-EBXHW7ZO.js.map +7 -0
- package/dist/chunk-EO35SCFP.js +7 -0
- package/dist/chunk-EO35SCFP.js.map +7 -0
- package/dist/chunk-ER2XTD2S.js +271 -0
- package/dist/chunk-ER2XTD2S.js.map +7 -0
- package/dist/chunk-ERXO3674.js +54 -0
- package/dist/chunk-ERXO3674.js.map +7 -0
- package/dist/chunk-F43CC2X2.js +49 -0
- package/dist/chunk-F43CC2X2.js.map +7 -0
- package/dist/chunk-F64TXVJJ.js +158 -0
- package/dist/chunk-F64TXVJJ.js.map +7 -0
- package/dist/chunk-F6APWSAA.js +51 -0
- package/dist/chunk-F6APWSAA.js.map +7 -0
- package/dist/chunk-F7LNS7G3.js +235 -0
- package/dist/chunk-F7LNS7G3.js.map +7 -0
- package/dist/chunk-FCNWR7ZX.js +16352 -0
- package/dist/chunk-FCNWR7ZX.js.map +7 -0
- package/dist/chunk-FFCG5NRU.js +87 -0
- package/dist/chunk-FFCG5NRU.js.map +7 -0
- package/dist/chunk-FJFC6CRR.js +446 -0
- package/dist/chunk-FJFC6CRR.js.map +7 -0
- package/dist/chunk-FK6RGYBB.js +46 -0
- package/dist/chunk-FK6RGYBB.js.map +7 -0
- package/dist/chunk-FMY6KXK6.js +251 -0
- package/dist/chunk-FMY6KXK6.js.map +7 -0
- package/dist/chunk-FPH56SCM.js +21 -0
- package/dist/chunk-FPH56SCM.js.map +7 -0
- package/dist/chunk-FVSH4Z6T.js +173 -0
- package/dist/chunk-FVSH4Z6T.js.map +7 -0
- package/dist/chunk-FVWBLEAD.js +44 -0
- package/dist/chunk-FVWBLEAD.js.map +7 -0
- package/dist/chunk-FYSARMGS.js +93 -0
- package/dist/chunk-FYSARMGS.js.map +7 -0
- package/dist/chunk-FZJOJ6P4.js +28 -0
- package/dist/chunk-FZJOJ6P4.js.map +7 -0
- package/dist/chunk-G46GHNDU.js +4890 -0
- package/dist/chunk-G46GHNDU.js.map +7 -0
- package/dist/chunk-G4TIS2SC.js +56 -0
- package/dist/chunk-G4TIS2SC.js.map +7 -0
- package/dist/chunk-GGWS7NQP.js +247 -0
- package/dist/chunk-GGWS7NQP.js.map +7 -0
- package/dist/chunk-GRBJYAYF.js +129 -0
- package/dist/chunk-GRBJYAYF.js.map +7 -0
- package/dist/chunk-GXDQGBA2.js +106 -0
- package/dist/chunk-GXDQGBA2.js.map +7 -0
- package/dist/chunk-H2HY73I6.js +122 -0
- package/dist/chunk-H2HY73I6.js.map +7 -0
- package/dist/chunk-H5MLA6PA.js +29 -0
- package/dist/chunk-H5MLA6PA.js.map +7 -0
- package/dist/chunk-H7KAUMBC.js +635 -0
- package/dist/chunk-H7KAUMBC.js.map +7 -0
- package/dist/chunk-HGHU3TVL.js +174 -0
- package/dist/chunk-HGHU3TVL.js.map +7 -0
- package/dist/chunk-HJ5E2JRL.js +88 -0
- package/dist/chunk-HJ5E2JRL.js.map +7 -0
- package/dist/chunk-HJW3CKZL.js +94 -0
- package/dist/chunk-HJW3CKZL.js.map +7 -0
- package/dist/chunk-HKF5EBER.js +418 -0
- package/dist/chunk-HKF5EBER.js.map +7 -0
- package/dist/chunk-HLUR35G5.js +30 -0
- package/dist/chunk-HLUR35G5.js.map +7 -0
- package/dist/chunk-HNIW2NZU.js +120 -0
- package/dist/chunk-HNIW2NZU.js.map +7 -0
- package/dist/chunk-HSXRCP25.js +171 -0
- package/dist/chunk-HSXRCP25.js.map +7 -0
- package/dist/chunk-I26OPZLO.js +28 -0
- package/dist/chunk-I26OPZLO.js.map +7 -0
- package/dist/chunk-I7JJQ4BQ.js +30 -0
- package/dist/chunk-I7JJQ4BQ.js.map +7 -0
- package/dist/chunk-IJ6Y4W7F.js +392 -0
- package/dist/chunk-IJ6Y4W7F.js.map +7 -0
- package/dist/chunk-IJH4NOQ4.js +18 -0
- package/dist/chunk-IJH4NOQ4.js.map +7 -0
- package/dist/chunk-IMHRZQRH.js +76 -0
- package/dist/chunk-IMHRZQRH.js.map +7 -0
- package/dist/chunk-JB6ZQEVR.js +465 -0
- package/dist/chunk-JB6ZQEVR.js.map +7 -0
- package/dist/chunk-JCWNMWNY.js +102 -0
- package/dist/chunk-JCWNMWNY.js.map +7 -0
- package/dist/chunk-JGIZPU2Y.js +39 -0
- package/dist/chunk-JGIZPU2Y.js.map +7 -0
- package/dist/chunk-JIU4FXA7.js +485 -0
- package/dist/chunk-JIU4FXA7.js.map +7 -0
- package/dist/chunk-JU2Y33DB.js +60 -0
- package/dist/chunk-JU2Y33DB.js.map +7 -0
- package/dist/chunk-JVLRI4RU.js +62 -0
- package/dist/chunk-JVLRI4RU.js.map +7 -0
- package/dist/chunk-JZ3AVNZC.js +44117 -0
- package/dist/chunk-JZ3AVNZC.js.map +7 -0
- package/dist/chunk-K3HEWOHN.js +30 -0
- package/dist/chunk-K3HEWOHN.js.map +7 -0
- package/dist/chunk-K5EK4WZV.js +7 -0
- package/dist/chunk-K5EK4WZV.js.map +7 -0
- package/dist/chunk-KAWXMSYC.js +58 -0
- package/dist/chunk-KAWXMSYC.js.map +7 -0
- package/dist/chunk-KEGPHS4C.js +80 -0
- package/dist/chunk-KEGPHS4C.js.map +7 -0
- package/dist/chunk-KXXVR3DC.js +244 -0
- package/dist/chunk-KXXVR3DC.js.map +7 -0
- package/dist/chunk-L5T6XUDP.js +412 -0
- package/dist/chunk-L5T6XUDP.js.map +7 -0
- package/dist/chunk-LIFXTQ4U.js +7287 -0
- package/dist/chunk-LIFXTQ4U.js.map +7 -0
- package/dist/chunk-LMD5UTKM.js +169 -0
- package/dist/chunk-LMD5UTKM.js.map +7 -0
- package/dist/chunk-LTXNC6JX.js +27 -0
- package/dist/chunk-LTXNC6JX.js.map +7 -0
- package/dist/chunk-LUGTGPT6.js +138 -0
- package/dist/chunk-LUGTGPT6.js.map +7 -0
- package/dist/chunk-LZQFDJNW.js +300 -0
- package/dist/chunk-LZQFDJNW.js.map +7 -0
- package/dist/chunk-M4VQPIF4.js +5853 -0
- package/dist/chunk-M4VQPIF4.js.map +7 -0
- package/dist/chunk-M64QE4QC.js +64 -0
- package/dist/chunk-M64QE4QC.js.map +7 -0
- package/dist/chunk-MJ2GW6SU.js +163 -0
- package/dist/chunk-MJ2GW6SU.js.map +7 -0
- package/dist/chunk-MYSK3SIM.js +55 -0
- package/dist/chunk-MYSK3SIM.js.map +7 -0
- package/dist/chunk-N46MIZXB.js +154 -0
- package/dist/chunk-N46MIZXB.js.map +7 -0
- package/dist/chunk-N53537P6.js +31 -0
- package/dist/chunk-N53537P6.js.map +7 -0
- package/dist/chunk-N5CTFOLX.js +40 -0
- package/dist/chunk-N5CTFOLX.js.map +7 -0
- package/dist/chunk-NIFG55CE.js +52 -0
- package/dist/chunk-NIFG55CE.js.map +7 -0
- package/dist/chunk-NJ63ALPX.js +7 -0
- package/dist/chunk-NJ63ALPX.js.map +7 -0
- package/dist/chunk-NZVHE4IT.js +3101 -0
- package/dist/chunk-NZVHE4IT.js.map +7 -0
- package/dist/chunk-O7ORICEC.js +82 -0
- package/dist/chunk-O7ORICEC.js.map +7 -0
- package/dist/chunk-OBMBAM3N.js +73 -0
- package/dist/chunk-OBMBAM3N.js.map +7 -0
- package/dist/chunk-OJJBD5K3.js +45 -0
- package/dist/chunk-OJJBD5K3.js.map +7 -0
- package/dist/chunk-OKDOVX4B.js +699 -0
- package/dist/chunk-OKDOVX4B.js.map +7 -0
- package/dist/chunk-OVMDMCZ5.js +241 -0
- package/dist/chunk-OVMDMCZ5.js.map +7 -0
- package/dist/chunk-OVU43GJK.js +63 -0
- package/dist/chunk-OVU43GJK.js.map +7 -0
- package/dist/chunk-P3TMARA6.js +18 -0
- package/dist/chunk-P3TMARA6.js.map +7 -0
- package/dist/chunk-PLMOTQ42.js +335 -0
- package/dist/chunk-PLMOTQ42.js.map +7 -0
- package/dist/chunk-Q6H5OV2R.js +180 -0
- package/dist/chunk-Q6H5OV2R.js.map +7 -0
- package/dist/chunk-QAR5POXD.js +472 -0
- package/dist/chunk-QAR5POXD.js.map +7 -0
- package/dist/chunk-R5S76YR5.js +12 -0
- package/dist/chunk-R5S76YR5.js.map +7 -0
- package/dist/chunk-R7ZBOXPS.js +163 -0
- package/dist/chunk-R7ZBOXPS.js.map +7 -0
- package/dist/chunk-RAL3KX76.js +239 -0
- package/dist/chunk-RAL3KX76.js.map +7 -0
- package/dist/chunk-RHITG64O.js +50 -0
- package/dist/chunk-RHITG64O.js.map +7 -0
- package/dist/chunk-RK5HZFP6.js +111 -0
- package/dist/chunk-RK5HZFP6.js.map +7 -0
- package/dist/chunk-RQ26XXFS.js +45 -0
- package/dist/chunk-RQ26XXFS.js.map +7 -0
- package/dist/chunk-RSA7PKZH.js +187 -0
- package/dist/chunk-RSA7PKZH.js.map +7 -0
- package/dist/chunk-RTSINQ4T.js +78 -0
- package/dist/chunk-RTSINQ4T.js.map +7 -0
- package/dist/chunk-SH6Y4CGQ.js +175 -0
- package/dist/chunk-SH6Y4CGQ.js.map +7 -0
- package/dist/chunk-SHBAAFFH.js +74 -0
- package/dist/chunk-SHBAAFFH.js.map +7 -0
- package/dist/chunk-SPNSM6SB.js +36 -0
- package/dist/chunk-SPNSM6SB.js.map +7 -0
- package/dist/chunk-SQUHLLK5.js +125 -0
- package/dist/chunk-SQUHLLK5.js.map +7 -0
- package/dist/chunk-SWWK35VQ.js +84 -0
- package/dist/chunk-SWWK35VQ.js.map +7 -0
- package/dist/chunk-TC5ZVFV6.js +292 -0
- package/dist/chunk-TC5ZVFV6.js.map +7 -0
- package/dist/chunk-TFD7ZIYD.js +105 -0
- package/dist/chunk-TFD7ZIYD.js.map +7 -0
- package/dist/chunk-TH6ONRWT.js +516 -0
- package/dist/chunk-TH6ONRWT.js.map +7 -0
- package/dist/chunk-TMQMQ67T.js +81 -0
- package/dist/chunk-TMQMQ67T.js.map +7 -0
- package/dist/chunk-TPYWUZOR.js +178 -0
- package/dist/chunk-TPYWUZOR.js.map +7 -0
- package/dist/chunk-U2O4LE6S.js +22 -0
- package/dist/chunk-U2O4LE6S.js.map +7 -0
- package/dist/chunk-U44IVNP2.js +91 -0
- package/dist/chunk-U44IVNP2.js.map +7 -0
- package/dist/chunk-UDDWLWKZ.js +82 -0
- package/dist/chunk-UDDWLWKZ.js.map +7 -0
- package/dist/chunk-UMMPB6FL.js +506 -0
- package/dist/chunk-UMMPB6FL.js.map +7 -0
- package/dist/chunk-UP42ACP7.js +27 -0
- package/dist/chunk-UP42ACP7.js.map +7 -0
- package/dist/chunk-UPEF7ETP.js +92 -0
- package/dist/chunk-UPEF7ETP.js.map +7 -0
- package/dist/chunk-VBDLTKI2.js +130 -0
- package/dist/chunk-VBDLTKI2.js.map +7 -0
- package/dist/chunk-VCWIKEJ7.js +7 -0
- package/dist/chunk-VCWIKEJ7.js.map +7 -0
- package/dist/chunk-VPQICZQR.js +93 -0
- package/dist/chunk-VPQICZQR.js.map +7 -0
- package/dist/chunk-VRBJNFPL.js +114 -0
- package/dist/chunk-VRBJNFPL.js.map +7 -0
- package/dist/chunk-VUU5KFH3.js +38 -0
- package/dist/chunk-VUU5KFH3.js.map +7 -0
- package/dist/chunk-VVBL5CFF.js +7 -0
- package/dist/chunk-VVBL5CFF.js.map +7 -0
- package/dist/chunk-VYZEQ6KY.js +22 -0
- package/dist/chunk-VYZEQ6KY.js.map +7 -0
- package/dist/chunk-WBPQVWSU.js +198 -0
- package/dist/chunk-WBPQVWSU.js.map +7 -0
- package/dist/chunk-WS6HWBKT.js +30 -0
- package/dist/chunk-WS6HWBKT.js.map +7 -0
- package/dist/chunk-XOZPOHLG.js +233 -0
- package/dist/chunk-XOZPOHLG.js.map +7 -0
- package/dist/chunk-XR7DPSNX.js +195 -0
- package/dist/chunk-XR7DPSNX.js.map +7 -0
- package/dist/chunk-XYH4JC3U.js +7 -0
- package/dist/chunk-XYH4JC3U.js.map +7 -0
- package/dist/chunk-YB5UCHLN.js +314 -0
- package/dist/chunk-YB5UCHLN.js.map +7 -0
- package/dist/chunk-YF5DYD3X.js +97 -0
- package/dist/chunk-YF5DYD3X.js.map +7 -0
- package/dist/chunk-YGVQZCE7.js +30 -0
- package/dist/chunk-YGVQZCE7.js.map +7 -0
- package/dist/chunk-YNHADHHS.js +138 -0
- package/dist/chunk-YNHADHHS.js.map +7 -0
- package/dist/chunk-YOAMBAM2.js +70 -0
- package/dist/chunk-YOAMBAM2.js.map +7 -0
- package/dist/chunk-YWE5AQPZ.js +258 -0
- package/dist/chunk-YWE5AQPZ.js.map +7 -0
- package/dist/chunk-YWHH3MB6.js +1405 -0
- package/dist/chunk-YWHH3MB6.js.map +7 -0
- package/dist/chunk-YZ6F5N7R.js +455 -0
- package/dist/chunk-YZ6F5N7R.js.map +7 -0
- package/dist/chunk-ZFGRQIB6.js +38 -0
- package/dist/chunk-ZFGRQIB6.js.map +7 -0
- package/dist/chunk-ZGAUVPAB.js +14 -0
- package/dist/chunk-ZGAUVPAB.js.map +7 -0
- package/dist/chunk-ZGCATLM5.js +18 -0
- package/dist/chunk-ZGCATLM5.js.map +7 -0
- package/dist/chunk-ZSOPE7DO.js +92 -0
- package/dist/chunk-ZSOPE7DO.js.map +7 -0
- package/dist/chunk-ZY247PXY.js +135 -0
- package/dist/chunk-ZY247PXY.js.map +7 -0
- package/dist/cli-metadata.js +3 -3
- package/dist/contract-api.js +64 -64
- package/dist/dist-DVBXHDB4.js +549 -0
- package/dist/dist-DVBXHDB4.js.map +7 -0
- package/dist/helper-api.js +6 -6
- package/dist/index.js +8 -9
- package/dist/index.js.map +1 -1
- package/dist/magic-string.es-ITIPPYGW.js +1315 -0
- package/dist/magic-string.es-ITIPPYGW.js.map +7 -0
- package/dist/package.json +1 -1
- package/dist/plugin-entry.handlers.runtime-JLRK5XTV.js +20 -0
- package/dist/plugin-entry.handlers.runtime-JLRK5XTV.js.map +7 -0
- package/dist/runtime-api.js +9 -9
- package/dist/rust-crypto-7KS7OJ3F.js +5323 -0
- package/dist/rust-crypto-7KS7OJ3F.js.map +7 -0
- package/dist/secret-contract-api.js +3 -3
- package/dist/setup-entry.js +2 -3
- package/dist/setup-entry.js.map +1 -1
- package/dist/src/account-selection.js +5 -5
- package/dist/src/actions.js +18 -18
- package/dist/src/approval-auth.js +19 -19
- package/dist/src/approval-handler.runtime.js +55 -55
- package/dist/src/approval-ids.js +3 -3
- package/dist/src/approval-native.js +22 -22
- package/dist/src/approval-reactions.js +2 -2
- package/dist/src/auth-precedence.js +2 -2
- package/dist/src/channel-account-paths.js +3 -3
- package/dist/src/channel.js +68 -68
- package/dist/src/channel.runtime.js +51 -51
- package/dist/src/cli-metadata.js +2 -2
- package/dist/src/cli.js +63 -63
- package/dist/src/config-adapter.js +18 -18
- package/dist/src/config-schema.js +2 -2
- package/dist/src/directory-live.js +27 -27
- package/dist/src/doctor-contract.js +3 -3
- package/dist/src/doctor.js +24 -24
- package/dist/src/env-vars.js +2 -2
- package/dist/src/exec-approval-resolver.js +2 -2
- package/dist/src/exec-approvals.js +20 -20
- package/dist/src/group-mentions.js +20 -20
- package/dist/src/legacy-crypto-inspector-availability.js +2 -2
- package/dist/src/legacy-crypto.js +18 -18
- package/dist/src/legacy-state.js +16 -16
- package/dist/src/matrix/account-config.js +2 -2
- package/dist/src/matrix/accounts.js +16 -16
- package/dist/src/matrix/actions/client.js +30 -30
- package/dist/src/matrix/actions/devices.js +32 -32
- package/dist/src/matrix/actions/limits.js +2 -2
- package/dist/src/matrix/actions/messages.js +37 -37
- package/dist/src/matrix/actions/pins.js +36 -36
- package/dist/src/matrix/actions/polls.js +31 -31
- package/dist/src/matrix/actions/profile.js +32 -32
- package/dist/src/matrix/actions/reactions.js +32 -32
- package/dist/src/matrix/actions/room.js +32 -32
- package/dist/src/matrix/actions/summary.js +9 -9
- package/dist/src/matrix/actions/types.js +3 -3
- package/dist/src/matrix/actions/verification.js +37 -37
- package/dist/src/matrix/actions.js +51 -51
- package/dist/src/matrix/active-client.js +2 -2
- package/dist/src/matrix/async-lock.js +2 -2
- package/dist/src/matrix/backup-health.js +2 -2
- package/dist/src/matrix/client/config-runtime-api.js +3 -3
- package/dist/src/matrix/client/config-secret-input.runtime.js +1 -1
- package/dist/src/matrix/client/config.js +13 -13
- package/dist/src/matrix/client/create-client.js +14 -14
- package/dist/src/matrix/client/env-auth.js +14 -14
- package/dist/src/matrix/client/file-sync-store.js +17 -17
- package/dist/src/matrix/client/logging.js +5 -5
- package/dist/src/matrix/client/migration-snapshot.runtime.js +2 -2
- package/dist/src/matrix/client/private-network-host.js +2 -2
- package/dist/src/matrix/client/runtime.js +2 -2
- package/dist/src/matrix/client/shared.js +16 -16
- package/dist/src/matrix/client/storage.js +8 -8
- package/dist/src/matrix/client/types.js +1 -1
- package/dist/src/matrix/client-bootstrap.js +5 -5
- package/dist/src/matrix/client-resolver.test-helpers.js +2 -2
- package/dist/src/matrix/client.js +19 -19
- package/dist/src/matrix/config-paths.js +2 -2
- package/dist/src/matrix/config-update.js +4 -4
- package/dist/src/matrix/credentials-read.js +8 -8
- package/dist/src/matrix/credentials-write.runtime.js +1 -1
- package/dist/src/matrix/credentials.js +10 -10
- package/dist/src/matrix/deps.js +2 -2
- package/dist/src/matrix/device-health.js +2 -2
- package/dist/src/matrix/direct-management.js +6 -6
- package/dist/src/matrix/direct-room.js +2 -2
- package/dist/src/matrix/draft-stream.js +27 -27
- package/dist/src/matrix/encryption-guidance.js +7 -7
- package/dist/src/matrix/errors.js +2 -2
- package/dist/src/matrix/format.js +3 -3
- package/dist/src/matrix/legacy-crypto-inspector.js +3 -4
- package/dist/src/matrix/legacy-crypto-inspector.js.map +1 -1
- package/dist/src/matrix/media-errors.js +2 -2
- package/dist/src/matrix/media-text.js +2 -2
- package/dist/src/matrix/monitor/access-state.js +3 -3
- package/dist/src/matrix/monitor/ack-config.js +4 -4
- package/dist/src/matrix/monitor/allowlist.js +2 -2
- package/dist/src/matrix/monitor/auto-join.js +3 -3
- package/dist/src/matrix/monitor/config.js +31 -31
- package/dist/src/matrix/monitor/context-summary.js +5 -5
- package/dist/src/matrix/monitor/direct.js +7 -7
- package/dist/src/matrix/monitor/events.js +14 -14
- package/dist/src/matrix/monitor/handler.js +70 -70
- package/dist/src/matrix/monitor/handler.test-helpers.js +71 -71
- package/dist/src/matrix/monitor/inbound-dedupe.js +11 -11
- package/dist/src/matrix/monitor/index.js +100 -100
- package/dist/src/matrix/monitor/legacy-crypto-restore.js +8 -8
- package/dist/src/matrix/monitor/location.js +5 -5
- package/dist/src/matrix/monitor/media.js +4 -4
- package/dist/src/matrix/monitor/mentions.js +3 -3
- package/dist/src/matrix/monitor/reaction-events.js +30 -30
- package/dist/src/matrix/monitor/recent-invite.js +4 -4
- package/dist/src/matrix/monitor/replies.js +27 -27
- package/dist/src/matrix/monitor/reply-context.js +6 -6
- package/dist/src/matrix/monitor/room-history.js +2 -2
- package/dist/src/matrix/monitor/room-info.js +3 -3
- package/dist/src/matrix/monitor/rooms.js +3 -3
- package/dist/src/matrix/monitor/route.js +6 -6
- package/dist/src/matrix/monitor/runtime-api.js +2 -2
- package/dist/src/matrix/monitor/startup-verification.js +9 -9
- package/dist/src/matrix/monitor/startup.js +3 -3
- package/dist/src/matrix/monitor/status.js +4 -4
- package/dist/src/matrix/monitor/sync-lifecycle.js +3 -3
- package/dist/src/matrix/monitor/task-runner.js +2 -2
- package/dist/src/matrix/monitor/thread-context.js +6 -6
- package/dist/src/matrix/monitor/threads.js +4 -4
- package/dist/src/matrix/monitor/types.js +3 -3
- package/dist/src/matrix/monitor/verification-events.js +7 -7
- package/dist/src/matrix/monitor/verification-utils.js +2 -2
- package/dist/src/matrix/outbound-media-runtime.js +3 -3
- package/dist/src/matrix/poll-summary.js +4 -4
- package/dist/src/matrix/poll-types.js +3 -3
- package/dist/src/matrix/probe.js +3 -3
- package/dist/src/matrix/probe.runtime.js +19 -19
- package/dist/src/matrix/profile.js +2 -2
- package/dist/src/matrix/reaction-common.js +2 -2
- package/dist/src/matrix/sdk/crypto-bootstrap.js +9 -9
- package/dist/src/matrix/sdk/crypto-facade.js +2 -2
- package/dist/src/matrix/sdk/crypto-node.runtime.js +2 -3
- package/dist/src/matrix/sdk/crypto-node.runtime.js.map +1 -1
- package/dist/src/matrix/sdk/crypto-runtime.js +16 -16
- package/dist/src/matrix/sdk/decrypt-bridge.js +5 -5
- package/dist/src/matrix/sdk/event-helpers.js +2 -2
- package/dist/src/matrix/sdk/http-client.js +7 -7
- package/dist/src/matrix/sdk/idb-persistence-lock.js +2 -2
- package/dist/src/matrix/sdk/idb-persistence.js +5 -5
- package/dist/src/matrix/sdk/idb-persistence.test-helpers.js +1 -1
- package/dist/src/matrix/sdk/logger.js +3 -3
- package/dist/src/matrix/sdk/read-response-with-limit.js +2 -2
- package/dist/src/matrix/sdk/recovery-key-store.js +6 -6
- package/dist/src/matrix/sdk/transport.js +5 -5
- package/dist/src/matrix/sdk/types.js +1 -1
- package/dist/src/matrix/sdk/verification-manager.js +5 -5
- package/dist/src/matrix/sdk/verification-status.js +2 -2
- package/dist/src/matrix/sdk.js +31 -31
- package/dist/src/matrix/send/client.js +4 -4
- package/dist/src/matrix/send/formatting.js +7 -7
- package/dist/src/matrix/send/media.js +12 -12
- package/dist/src/matrix/send/targets.js +7 -7
- package/dist/src/matrix/send/types.js +3 -3
- package/dist/src/matrix/send.js +26 -26
- package/dist/src/matrix/session-store-metadata.js +3 -3
- package/dist/src/matrix/startup-abort.js +2 -2
- package/dist/src/matrix/sync-state.js +2 -2
- package/dist/src/matrix/target-ids.js +2 -2
- package/dist/src/matrix/thread-bindings-shared.js +2 -2
- package/dist/src/matrix/thread-bindings.js +34 -34
- package/dist/src/matrix-migration.runtime.js +22 -22
- package/dist/src/migration-config.js +15 -15
- package/dist/src/migration-snapshot-backup.js +2 -2
- package/dist/src/migration-snapshot.js +21 -21
- package/dist/src/onboarding.js +37 -37
- package/dist/src/onboarding.test-harness.js +2 -2
- package/dist/src/outbound.js +27 -27
- package/dist/src/plugin-entry.runtime.js +3 -3
- package/dist/src/profile-update.js +35 -35
- package/dist/src/record-shared.js +2 -2
- package/dist/src/resolve-targets.js +28 -28
- package/dist/src/resolver.js +2 -2
- package/dist/src/runtime-api.js +2 -2
- package/dist/src/runtime.js +2 -2
- package/dist/src/secret-contract.js +3 -3
- package/dist/src/session-route.js +19 -19
- package/dist/src/setup-bootstrap.js +46 -46
- package/dist/src/setup-config.js +18 -18
- package/dist/src/setup-contract.js +2 -2
- package/dist/src/setup-core.js +19 -19
- package/dist/src/setup-surface.js +38 -38
- package/dist/src/startup-maintenance.js +23 -23
- package/dist/src/storage-paths.js +2 -2
- package/dist/src/test-helpers.js +1 -1
- package/dist/src/test-mocks.js +2 -2
- package/dist/src/test-runtime.js +3 -3
- package/dist/src/tool-actions.js +62 -62
- package/dist/src/tool-actions.runtime.js +62 -62
- package/dist/src/types.js +1 -1
- package/dist/test-api.js +68 -68
- package/dist/thread-bindings-runtime.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
import {
|
|
2
|
+
repairCurrentTokenStorageMetaDeviceId
|
|
3
|
+
} from "./chunk-HKF5EBER.js";
|
|
4
|
+
import {
|
|
5
|
+
resolveMatrixConfigFieldPath
|
|
6
|
+
} from "./chunk-SPNSM6SB.js";
|
|
7
|
+
import {
|
|
8
|
+
DEFAULT_ACCOUNT_ID,
|
|
9
|
+
assertHttpUrlTargetsPrivateNetwork,
|
|
10
|
+
isPrivateNetworkOptInEnabled,
|
|
11
|
+
normalizeAccountId,
|
|
12
|
+
normalizeOptionalAccountId,
|
|
13
|
+
ssrfPolicyFromDangerouslyAllowPrivateNetwork
|
|
14
|
+
} from "./chunk-FZJOJ6P4.js";
|
|
15
|
+
import {
|
|
16
|
+
isPrivateOrLoopbackHost
|
|
17
|
+
} from "./chunk-4QTZHELX.js";
|
|
18
|
+
import {
|
|
19
|
+
findMatrixAccountConfig,
|
|
20
|
+
listNormalizedMatrixAccountIds,
|
|
21
|
+
resolveMatrixBaseConfig
|
|
22
|
+
} from "./chunk-3OXOEMBS.js";
|
|
23
|
+
import {
|
|
24
|
+
getMatrixRuntime
|
|
25
|
+
} from "./chunk-ZGAUVPAB.js";
|
|
26
|
+
import {
|
|
27
|
+
requiresExplicitMatrixDefaultAccount,
|
|
28
|
+
resolveMatrixDefaultOrOnlyAccountId
|
|
29
|
+
} from "./chunk-3R4ATE4Q.js";
|
|
30
|
+
import {
|
|
31
|
+
resolveMatrixAccountStringValues
|
|
32
|
+
} from "./chunk-5BQ6LLNU.js";
|
|
33
|
+
import {
|
|
34
|
+
getLobiScopedEnvVarNames
|
|
35
|
+
} from "./chunk-HJ5E2JRL.js";
|
|
36
|
+
import {
|
|
37
|
+
init_shims
|
|
38
|
+
} from "./chunk-G4TIS2SC.js";
|
|
39
|
+
|
|
40
|
+
// src/matrix/client/config.ts
|
|
41
|
+
init_shims();
|
|
42
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/infra-runtime";
|
|
43
|
+
import { coerceSecretRef } from "openclaw/plugin-sdk/provider-auth";
|
|
44
|
+
import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
45
|
+
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
46
|
+
var matrixAuthClientDepsPromise;
|
|
47
|
+
var matrixCredentialsReadDepsPromise;
|
|
48
|
+
var matrixSecretInputDepsPromise;
|
|
49
|
+
var matrixAuthClientDepsForTest;
|
|
50
|
+
var MATRIX_AUTH_REQUEST_RETRY_RE = /\b(fetch failed|econnreset|econnrefused|enotfound|etimedout|ehostunreach|enetunreach|eai_again|und_err_|socket hang up|network|headers timeout|body timeout|connect timeout)\b/i;
|
|
51
|
+
function setMatrixAuthClientDepsForTest(deps) {
|
|
52
|
+
matrixAuthClientDepsForTest = deps;
|
|
53
|
+
}
|
|
54
|
+
async function loadMatrixAuthClientDeps() {
|
|
55
|
+
if (matrixAuthClientDepsForTest) {
|
|
56
|
+
return matrixAuthClientDepsForTest;
|
|
57
|
+
}
|
|
58
|
+
matrixAuthClientDepsPromise ??= Promise.all([import("./src/matrix/sdk.js"), import("./src/matrix/client/logging.js")]).then(
|
|
59
|
+
([sdkModule, loggingModule]) => ({
|
|
60
|
+
MatrixClient: sdkModule.MatrixClient,
|
|
61
|
+
ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
return await matrixAuthClientDepsPromise;
|
|
65
|
+
}
|
|
66
|
+
async function loadMatrixCredentialsReadDeps() {
|
|
67
|
+
matrixCredentialsReadDepsPromise ??= import("./src/matrix/credentials-read.js").then(
|
|
68
|
+
(credentialsReadModule) => ({
|
|
69
|
+
loadMatrixCredentials: credentialsReadModule.loadMatrixCredentials,
|
|
70
|
+
credentialsMatchConfig: credentialsReadModule.credentialsMatchConfig
|
|
71
|
+
})
|
|
72
|
+
);
|
|
73
|
+
return await matrixCredentialsReadDepsPromise;
|
|
74
|
+
}
|
|
75
|
+
async function loadMatrixSecretInputDeps() {
|
|
76
|
+
matrixSecretInputDepsPromise ??= import("./src/matrix/client/config-secret-input.runtime.js").then((runtime) => ({
|
|
77
|
+
resolveConfiguredSecretInputString: runtime.resolveConfiguredSecretInputString
|
|
78
|
+
}));
|
|
79
|
+
return await matrixSecretInputDepsPromise;
|
|
80
|
+
}
|
|
81
|
+
function shouldRetryMatrixAuthRequest(err) {
|
|
82
|
+
return MATRIX_AUTH_REQUEST_RETRY_RE.test(formatErrorMessage(err));
|
|
83
|
+
}
|
|
84
|
+
function isAbortSignalTriggered(signal) {
|
|
85
|
+
return signal?.aborted === true;
|
|
86
|
+
}
|
|
87
|
+
function credentialsMatchBackfillAuthLineage(params) {
|
|
88
|
+
if (!params.stored) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
return params.stored.homeserver === params.auth.homeserver && params.stored.userId === params.auth.userId && params.stored.accessToken === params.auth.accessToken;
|
|
92
|
+
}
|
|
93
|
+
async function retryMatrixAuthRequest(label, run) {
|
|
94
|
+
return await retryAsync(run, {
|
|
95
|
+
attempts: 3,
|
|
96
|
+
minDelayMs: 250,
|
|
97
|
+
maxDelayMs: 1500,
|
|
98
|
+
jitter: 0.1,
|
|
99
|
+
label,
|
|
100
|
+
shouldRetry: (err) => shouldRetryMatrixAuthRequest(err)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async function fetchMatrixWhoamiIdentity(params) {
|
|
104
|
+
const { MatrixClient, ensureMatrixSdkLoggingConfigured } = await loadMatrixAuthClientDeps();
|
|
105
|
+
ensureMatrixSdkLoggingConfigured();
|
|
106
|
+
const tempClient = new MatrixClient(params.homeserver, params.accessToken, {
|
|
107
|
+
userId: params.userId,
|
|
108
|
+
ssrfPolicy: params.ssrfPolicy,
|
|
109
|
+
dispatcherPolicy: params.dispatcherPolicy
|
|
110
|
+
});
|
|
111
|
+
return await retryMatrixAuthRequest("matrix auth whoami", async () => {
|
|
112
|
+
return await tempClient.doRequest("GET", "/_matrix/client/v3/account/whoami");
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function readEnvSecretRefFallback(params) {
|
|
116
|
+
const ref = coerceSecretRef(params.value, params.config?.secrets?.defaults);
|
|
117
|
+
if (!ref || ref.source !== "env" || !params.env) {
|
|
118
|
+
return void 0;
|
|
119
|
+
}
|
|
120
|
+
const providerConfig = params.config?.secrets?.providers?.[ref.provider];
|
|
121
|
+
if (providerConfig) {
|
|
122
|
+
if (providerConfig.source !== "env") {
|
|
123
|
+
throw new Error(
|
|
124
|
+
`Secret provider "${ref.provider}" has source "${providerConfig.source}" but ref requests "env".`
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
if (providerConfig.allowlist && !providerConfig.allowlist.includes(ref.id)) {
|
|
128
|
+
throw new Error(
|
|
129
|
+
`Environment variable "${ref.id}" is not allowlisted in secrets.providers.${ref.provider}.allowlist.`
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
} else if (ref.provider !== (params.config?.secrets?.defaults?.env?.trim() || "default")) {
|
|
133
|
+
throw new Error(
|
|
134
|
+
`Secret provider "${ref.provider}" is not configured (ref: ${ref.source}:${ref.provider}:${ref.id}).`
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
const resolved = params.env[ref.id];
|
|
138
|
+
if (typeof resolved !== "string") {
|
|
139
|
+
return void 0;
|
|
140
|
+
}
|
|
141
|
+
const trimmed = resolved.trim();
|
|
142
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
143
|
+
}
|
|
144
|
+
function clean(value, path, opts) {
|
|
145
|
+
const ref = coerceSecretRef(value, opts?.config?.secrets?.defaults);
|
|
146
|
+
if (opts?.suppressSecretRef && ref) {
|
|
147
|
+
return "";
|
|
148
|
+
}
|
|
149
|
+
const normalizedValue = opts?.allowEnvSecretRefFallback ? ref?.source === "env" ? readEnvSecretRefFallback({
|
|
150
|
+
value,
|
|
151
|
+
env: opts.env,
|
|
152
|
+
config: opts.config
|
|
153
|
+
}) ?? value : ref ? "" : value : value;
|
|
154
|
+
return normalizeResolvedSecretInputString({
|
|
155
|
+
value: normalizedValue,
|
|
156
|
+
path,
|
|
157
|
+
defaults: opts?.config?.secrets?.defaults
|
|
158
|
+
}) ?? "";
|
|
159
|
+
}
|
|
160
|
+
function resolveMatrixBaseConfigFieldPath(field) {
|
|
161
|
+
return `channels.lobi.${field}`;
|
|
162
|
+
}
|
|
163
|
+
function shouldAllowEnvSecretRefFallback(field) {
|
|
164
|
+
return field === "accessToken" || field === "password";
|
|
165
|
+
}
|
|
166
|
+
function hasConfiguredSecretInputValue(value, cfg) {
|
|
167
|
+
return typeof value === "string" && value.trim().length > 0 || Boolean(coerceSecretRef(value, cfg.secrets?.defaults));
|
|
168
|
+
}
|
|
169
|
+
function hasConfiguredMatrixAccessTokenSource(params) {
|
|
170
|
+
const normalizedAccountId = normalizeAccountId(params.accountId);
|
|
171
|
+
const account = findMatrixAccountConfig(params.cfg, normalizedAccountId) ?? {};
|
|
172
|
+
const scopedAccessTokenVar = getLobiScopedEnvVarNames(normalizedAccountId).accessToken;
|
|
173
|
+
if (hasConfiguredSecretInputValue(account.accessToken, params.cfg) || clean(params.env[scopedAccessTokenVar], scopedAccessTokenVar).length > 0) {
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
if (normalizedAccountId !== DEFAULT_ACCOUNT_ID) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
const matrix = resolveMatrixBaseConfig(params.cfg);
|
|
180
|
+
return hasConfiguredSecretInputValue(matrix.accessToken, params.cfg) || clean(params.env.LOBI_ACCESS_TOKEN, "LOBI_ACCESS_TOKEN").length > 0;
|
|
181
|
+
}
|
|
182
|
+
function resolveConfiguredMatrixAuthInput(params) {
|
|
183
|
+
const normalizedAccountId = normalizeAccountId(params.accountId);
|
|
184
|
+
const account = findMatrixAccountConfig(params.cfg, normalizedAccountId) ?? {};
|
|
185
|
+
const accountValue = account[params.field];
|
|
186
|
+
if (accountValue !== void 0) {
|
|
187
|
+
return {
|
|
188
|
+
value: accountValue,
|
|
189
|
+
path: resolveMatrixConfigFieldPath(params.cfg, normalizedAccountId, params.field)
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
const scopedKeys = getLobiScopedEnvVarNames(normalizedAccountId);
|
|
193
|
+
const scopedEnv = resolveScopedMatrixEnvConfig(normalizedAccountId, params.env);
|
|
194
|
+
const scopedValue = scopedEnv[params.field];
|
|
195
|
+
if (scopedValue !== void 0) {
|
|
196
|
+
return {
|
|
197
|
+
value: scopedValue,
|
|
198
|
+
path: params.field === "accessToken" ? scopedKeys.accessToken : scopedKeys.password
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
if (normalizedAccountId !== DEFAULT_ACCOUNT_ID) {
|
|
202
|
+
return void 0;
|
|
203
|
+
}
|
|
204
|
+
const matrix = resolveMatrixBaseConfig(params.cfg);
|
|
205
|
+
const baseValue = matrix[params.field];
|
|
206
|
+
if (baseValue !== void 0) {
|
|
207
|
+
return {
|
|
208
|
+
value: baseValue,
|
|
209
|
+
path: resolveMatrixBaseConfigFieldPath(params.field)
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
const globalValue = params.field === "accessToken" ? params.env.LOBI_ACCESS_TOKEN : params.env.LOBI_PASSWORD;
|
|
213
|
+
if (globalValue !== void 0) {
|
|
214
|
+
return {
|
|
215
|
+
value: globalValue,
|
|
216
|
+
path: params.field === "accessToken" ? "LOBI_ACCESS_TOKEN" : "LOBI_PASSWORD"
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
return void 0;
|
|
220
|
+
}
|
|
221
|
+
async function resolveConfiguredMatrixAuthSecretInput(params) {
|
|
222
|
+
const configured = resolveConfiguredMatrixAuthInput(params);
|
|
223
|
+
if (!configured) {
|
|
224
|
+
return void 0;
|
|
225
|
+
}
|
|
226
|
+
const { resolveConfiguredSecretInputString } = await loadMatrixSecretInputDeps();
|
|
227
|
+
const resolved = await resolveConfiguredSecretInputString({
|
|
228
|
+
config: params.cfg,
|
|
229
|
+
env: params.env,
|
|
230
|
+
value: configured.value,
|
|
231
|
+
path: configured.path,
|
|
232
|
+
unresolvedReasonStyle: "detailed"
|
|
233
|
+
});
|
|
234
|
+
if (resolved.value !== void 0) {
|
|
235
|
+
return resolved.value;
|
|
236
|
+
}
|
|
237
|
+
if (coerceSecretRef(configured.value, params.cfg.secrets?.defaults)) {
|
|
238
|
+
throw new Error(
|
|
239
|
+
resolved.unresolvedRefReason ?? `${configured.path} SecretRef could not be resolved.`
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
return void 0;
|
|
243
|
+
}
|
|
244
|
+
function readMatrixBaseConfigField(matrix, field, opts) {
|
|
245
|
+
return clean(matrix[field], resolveMatrixBaseConfigFieldPath(field), {
|
|
246
|
+
env: opts?.env,
|
|
247
|
+
config: opts?.config,
|
|
248
|
+
allowEnvSecretRefFallback: shouldAllowEnvSecretRefFallback(field),
|
|
249
|
+
suppressSecretRef: opts?.suppressSecretRef
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function readMatrixAccountConfigField(cfg, accountId, account, field, opts) {
|
|
253
|
+
return clean(account[field], resolveMatrixConfigFieldPath(cfg, accountId, field), {
|
|
254
|
+
env: opts?.env,
|
|
255
|
+
config: opts?.config,
|
|
256
|
+
allowEnvSecretRefFallback: shouldAllowEnvSecretRefFallback(field),
|
|
257
|
+
suppressSecretRef: opts?.suppressSecretRef
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
function clampMatrixInitialSyncLimit(value) {
|
|
261
|
+
return typeof value === "number" ? Math.max(0, Math.floor(value)) : void 0;
|
|
262
|
+
}
|
|
263
|
+
var MATRIX_HTTP_HOMESERVER_ERROR = "Matrix homeserver must use https:// unless it targets a private or loopback host";
|
|
264
|
+
function buildMatrixNetworkFields(params) {
|
|
265
|
+
const dispatcherPolicy = params.dispatcherPolicy ?? (params.proxy ? { mode: "explicit-proxy", proxyUrl: params.proxy } : void 0);
|
|
266
|
+
if (!params.allowPrivateNetwork && !dispatcherPolicy) {
|
|
267
|
+
return {};
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
...params.allowPrivateNetwork ? {
|
|
271
|
+
allowPrivateNetwork: true,
|
|
272
|
+
ssrfPolicy: ssrfPolicyFromDangerouslyAllowPrivateNetwork(true)
|
|
273
|
+
} : {},
|
|
274
|
+
...dispatcherPolicy ? { dispatcherPolicy } : {}
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
var DEFAULT_LOBI_HOMESERVER = "https://lobi.lobisland.com/";
|
|
278
|
+
function resolveGlobalMatrixEnvConfig(env) {
|
|
279
|
+
const homeserver = clean(env.LOBI_HOMESERVER, "LOBI_HOMESERVER");
|
|
280
|
+
return {
|
|
281
|
+
homeserver: homeserver || DEFAULT_LOBI_HOMESERVER,
|
|
282
|
+
userId: clean(env.LOBI_USER_ID, "LOBI_USER_ID"),
|
|
283
|
+
accessToken: clean(env.LOBI_ACCESS_TOKEN, "LOBI_ACCESS_TOKEN") || void 0,
|
|
284
|
+
password: clean(env.LOBI_PASSWORD, "LOBI_PASSWORD") || void 0,
|
|
285
|
+
deviceId: clean(env.LOBI_DEVICE_ID, "LOBI_DEVICE_ID") || void 0,
|
|
286
|
+
deviceName: clean(env.LOBI_DEVICE_NAME, "LOBI_DEVICE_NAME") || void 0
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function resolveMatrixEnvAuthReadiness(accountId, env = process.env) {
|
|
290
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
291
|
+
const scoped = resolveScopedMatrixEnvConfig(normalizedAccountId, env);
|
|
292
|
+
const scopedReady = hasReadyMatrixEnvAuth(scoped);
|
|
293
|
+
if (normalizedAccountId !== DEFAULT_ACCOUNT_ID) {
|
|
294
|
+
const keys = getLobiScopedEnvVarNames(normalizedAccountId);
|
|
295
|
+
return {
|
|
296
|
+
ready: scopedReady,
|
|
297
|
+
homeserver: scoped.homeserver || void 0,
|
|
298
|
+
userId: scoped.userId || void 0,
|
|
299
|
+
sourceHint: `${keys.homeserver} (+ auth vars)`,
|
|
300
|
+
missingMessage: `Set per-account env vars for "${normalizedAccountId}" (for example ${keys.homeserver} + ${keys.accessToken} or ${keys.userId} + ${keys.password}).`
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
const defaultScoped = resolveScopedMatrixEnvConfig(DEFAULT_ACCOUNT_ID, env);
|
|
304
|
+
const global = resolveGlobalMatrixEnvConfig(env);
|
|
305
|
+
const defaultScopedReady = hasReadyMatrixEnvAuth(defaultScoped);
|
|
306
|
+
const globalReady = hasReadyMatrixEnvAuth(global);
|
|
307
|
+
const defaultKeys = getLobiScopedEnvVarNames(DEFAULT_ACCOUNT_ID);
|
|
308
|
+
return {
|
|
309
|
+
ready: defaultScopedReady || globalReady,
|
|
310
|
+
homeserver: defaultScoped.homeserver || global.homeserver || void 0,
|
|
311
|
+
userId: defaultScoped.userId || global.userId || void 0,
|
|
312
|
+
sourceHint: "LOBI_* or LOBI_DEFAULT_*",
|
|
313
|
+
missingMessage: `Set Lobi env vars for the default account (for example LOBI_HOMESERVER + LOBI_ACCESS_TOKEN, LOBI_USER_ID + LOBI_PASSWORD, or ${defaultKeys.homeserver} + ${defaultKeys.accessToken}).`
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
function resolveScopedMatrixEnvConfig(accountId, env = process.env) {
|
|
317
|
+
const keys = getLobiScopedEnvVarNames(accountId);
|
|
318
|
+
return {
|
|
319
|
+
homeserver: clean(env[keys.homeserver], keys.homeserver),
|
|
320
|
+
userId: clean(env[keys.userId], keys.userId),
|
|
321
|
+
accessToken: clean(env[keys.accessToken], keys.accessToken) || void 0,
|
|
322
|
+
password: clean(env[keys.password], keys.password) || void 0,
|
|
323
|
+
deviceId: clean(env[keys.deviceId], keys.deviceId) || void 0,
|
|
324
|
+
deviceName: clean(env[keys.deviceName], keys.deviceName) || void 0
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function hasScopedMatrixEnvConfig(accountId, env) {
|
|
328
|
+
const scoped = resolveScopedMatrixEnvConfig(accountId, env);
|
|
329
|
+
return Boolean(
|
|
330
|
+
scoped.homeserver || scoped.userId || scoped.accessToken || scoped.password || scoped.deviceId || scoped.deviceName
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
function hasReadyMatrixEnvAuth(config) {
|
|
334
|
+
const homeserver = clean(config.homeserver, "matrix.env.homeserver");
|
|
335
|
+
const userId = clean(config.userId, "matrix.env.userId");
|
|
336
|
+
const accessToken = clean(config.accessToken, "matrix.env.accessToken");
|
|
337
|
+
const password = clean(config.password, "matrix.env.password");
|
|
338
|
+
return Boolean(homeserver && (accessToken || userId && password));
|
|
339
|
+
}
|
|
340
|
+
function validateMatrixHomeserverUrl(homeserver, opts) {
|
|
341
|
+
const trimmed = clean(homeserver, "matrix.homeserver");
|
|
342
|
+
if (!trimmed) {
|
|
343
|
+
throw new Error("Matrix homeserver is required (matrix.homeserver)");
|
|
344
|
+
}
|
|
345
|
+
let parsed;
|
|
346
|
+
try {
|
|
347
|
+
parsed = new URL(trimmed);
|
|
348
|
+
} catch {
|
|
349
|
+
throw new Error("Matrix homeserver must be a valid http(s) URL");
|
|
350
|
+
}
|
|
351
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
|
|
352
|
+
throw new Error("Matrix homeserver must use http:// or https://");
|
|
353
|
+
}
|
|
354
|
+
if (!parsed.hostname) {
|
|
355
|
+
throw new Error("Matrix homeserver must include a hostname");
|
|
356
|
+
}
|
|
357
|
+
if (parsed.username || parsed.password) {
|
|
358
|
+
throw new Error("Matrix homeserver URL must not include embedded credentials");
|
|
359
|
+
}
|
|
360
|
+
if (parsed.search || parsed.hash) {
|
|
361
|
+
throw new Error("Matrix homeserver URL must not include query strings or fragments");
|
|
362
|
+
}
|
|
363
|
+
if (parsed.protocol === "http:" && opts?.allowPrivateNetwork !== true && !isPrivateOrLoopbackHost(parsed.hostname)) {
|
|
364
|
+
throw new Error(MATRIX_HTTP_HOMESERVER_ERROR);
|
|
365
|
+
}
|
|
366
|
+
return trimmed;
|
|
367
|
+
}
|
|
368
|
+
async function resolveValidatedMatrixHomeserverUrl(homeserver, opts) {
|
|
369
|
+
const allowPrivateNetwork = typeof opts?.dangerouslyAllowPrivateNetwork === "boolean" ? opts.dangerouslyAllowPrivateNetwork : opts?.allowPrivateNetwork;
|
|
370
|
+
const normalized = validateMatrixHomeserverUrl(homeserver, {
|
|
371
|
+
allowPrivateNetwork
|
|
372
|
+
});
|
|
373
|
+
await assertHttpUrlTargetsPrivateNetwork(normalized, {
|
|
374
|
+
dangerouslyAllowPrivateNetwork: opts?.dangerouslyAllowPrivateNetwork,
|
|
375
|
+
allowPrivateNetwork,
|
|
376
|
+
lookupFn: opts?.lookupFn,
|
|
377
|
+
errorMessage: MATRIX_HTTP_HOMESERVER_ERROR
|
|
378
|
+
});
|
|
379
|
+
return normalized;
|
|
380
|
+
}
|
|
381
|
+
function resolveMatrixConfigForAccount(cfg, accountId, env = process.env) {
|
|
382
|
+
const matrix = resolveMatrixBaseConfig(cfg);
|
|
383
|
+
const account = findMatrixAccountConfig(cfg, accountId) ?? {};
|
|
384
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
385
|
+
const suppressInactivePasswordSecretRef = hasConfiguredMatrixAccessTokenSource({
|
|
386
|
+
cfg,
|
|
387
|
+
env,
|
|
388
|
+
accountId: normalizedAccountId
|
|
389
|
+
});
|
|
390
|
+
const fieldReadOptions = {
|
|
391
|
+
env,
|
|
392
|
+
config: cfg
|
|
393
|
+
};
|
|
394
|
+
const scopedEnv = resolveScopedMatrixEnvConfig(normalizedAccountId, env);
|
|
395
|
+
const globalEnv = resolveGlobalMatrixEnvConfig(env);
|
|
396
|
+
const accountField = (field) => readMatrixAccountConfigField(cfg, normalizedAccountId, account, field, {
|
|
397
|
+
...fieldReadOptions,
|
|
398
|
+
suppressSecretRef: field === "password" ? suppressInactivePasswordSecretRef : void 0
|
|
399
|
+
});
|
|
400
|
+
const resolvedStrings = resolveMatrixAccountStringValues({
|
|
401
|
+
accountId: normalizedAccountId,
|
|
402
|
+
account: {
|
|
403
|
+
homeserver: accountField("homeserver"),
|
|
404
|
+
userId: accountField("userId"),
|
|
405
|
+
accessToken: accountField("accessToken"),
|
|
406
|
+
password: accountField("password"),
|
|
407
|
+
deviceId: accountField("deviceId"),
|
|
408
|
+
deviceName: accountField("deviceName")
|
|
409
|
+
},
|
|
410
|
+
scopedEnv,
|
|
411
|
+
channel: {
|
|
412
|
+
homeserver: readMatrixBaseConfigField(matrix, "homeserver", fieldReadOptions),
|
|
413
|
+
userId: readMatrixBaseConfigField(matrix, "userId", fieldReadOptions),
|
|
414
|
+
accessToken: readMatrixBaseConfigField(matrix, "accessToken", fieldReadOptions),
|
|
415
|
+
password: readMatrixBaseConfigField(matrix, "password", {
|
|
416
|
+
...fieldReadOptions,
|
|
417
|
+
suppressSecretRef: suppressInactivePasswordSecretRef
|
|
418
|
+
}),
|
|
419
|
+
deviceId: readMatrixBaseConfigField(matrix, "deviceId", fieldReadOptions),
|
|
420
|
+
deviceName: readMatrixBaseConfigField(matrix, "deviceName", fieldReadOptions)
|
|
421
|
+
},
|
|
422
|
+
globalEnv
|
|
423
|
+
});
|
|
424
|
+
const accountInitialSyncLimit = clampMatrixInitialSyncLimit(account.initialSyncLimit);
|
|
425
|
+
const initialSyncLimit = accountInitialSyncLimit ?? clampMatrixInitialSyncLimit(matrix.initialSyncLimit);
|
|
426
|
+
const encryption = typeof account.encryption === "boolean" ? account.encryption : matrix.encryption ?? false;
|
|
427
|
+
const allowPrivateNetwork = isPrivateNetworkOptInEnabled(account) || isPrivateNetworkOptInEnabled(matrix) ? true : void 0;
|
|
428
|
+
return {
|
|
429
|
+
homeserver: resolvedStrings.homeserver,
|
|
430
|
+
userId: resolvedStrings.userId,
|
|
431
|
+
accessToken: resolvedStrings.accessToken || void 0,
|
|
432
|
+
password: resolvedStrings.password || void 0,
|
|
433
|
+
deviceId: resolvedStrings.deviceId || void 0,
|
|
434
|
+
deviceName: resolvedStrings.deviceName || void 0,
|
|
435
|
+
initialSyncLimit,
|
|
436
|
+
encryption,
|
|
437
|
+
...buildMatrixNetworkFields({
|
|
438
|
+
allowPrivateNetwork,
|
|
439
|
+
proxy: account.proxy ?? matrix.proxy
|
|
440
|
+
})
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
function resolveImplicitMatrixAccountId(cfg, env = process.env) {
|
|
444
|
+
if (requiresExplicitMatrixDefaultAccount(cfg, env)) {
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
return normalizeAccountId(resolveMatrixDefaultOrOnlyAccountId(cfg, env));
|
|
448
|
+
}
|
|
449
|
+
function resolveMatrixAuthContext(params) {
|
|
450
|
+
const cfg = params?.cfg ?? getMatrixRuntime().config.loadConfig();
|
|
451
|
+
const env = params?.env ?? process.env;
|
|
452
|
+
const explicitAccountId = normalizeOptionalAccountId(params?.accountId);
|
|
453
|
+
const effectiveAccountId = explicitAccountId ?? resolveImplicitMatrixAccountId(cfg, env);
|
|
454
|
+
if (!effectiveAccountId) {
|
|
455
|
+
throw new Error(
|
|
456
|
+
'Multiple Lobi accounts are configured and channels.lobi.defaultAccount is not set. Set "channels.lobi.defaultAccount" to the intended account or pass --account <id>.'
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
if (explicitAccountId && explicitAccountId !== DEFAULT_ACCOUNT_ID && !listNormalizedMatrixAccountIds(cfg).includes(explicitAccountId) && !hasScopedMatrixEnvConfig(explicitAccountId, env)) {
|
|
460
|
+
throw new Error(
|
|
461
|
+
`Lobi account "${explicitAccountId}" is not configured. Add channels.lobi.accounts.${explicitAccountId} or define scoped ${getLobiScopedEnvVarNames(explicitAccountId).accessToken.replace(/_ACCESS_TOKEN$/, "")}_* variables.`
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
const resolved = resolveMatrixConfigForAccount(cfg, effectiveAccountId, env);
|
|
465
|
+
return {
|
|
466
|
+
cfg,
|
|
467
|
+
env,
|
|
468
|
+
accountId: effectiveAccountId,
|
|
469
|
+
resolved
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
async function resolveMatrixAuth(params) {
|
|
473
|
+
const { cfg, env, accountId, resolved } = resolveMatrixAuthContext(params);
|
|
474
|
+
const accessToken = await resolveConfiguredMatrixAuthSecretInput({
|
|
475
|
+
cfg,
|
|
476
|
+
env,
|
|
477
|
+
accountId,
|
|
478
|
+
field: "accessToken"
|
|
479
|
+
}) ?? resolved.accessToken;
|
|
480
|
+
const tokenAuthPassword = resolved.password;
|
|
481
|
+
const homeserver = await resolveValidatedMatrixHomeserverUrl(resolved.homeserver, {
|
|
482
|
+
dangerouslyAllowPrivateNetwork: resolved.allowPrivateNetwork
|
|
483
|
+
});
|
|
484
|
+
let credentialsWriter;
|
|
485
|
+
const loadCredentialsWriter = async () => {
|
|
486
|
+
credentialsWriter ??= await import("./src/matrix/credentials-write.runtime.js");
|
|
487
|
+
return credentialsWriter;
|
|
488
|
+
};
|
|
489
|
+
const { loadMatrixCredentials, credentialsMatchConfig } = await loadMatrixCredentialsReadDeps();
|
|
490
|
+
const cached = loadMatrixCredentials(env, accountId);
|
|
491
|
+
const cachedCredentials = cached && credentialsMatchConfig(cached, {
|
|
492
|
+
homeserver,
|
|
493
|
+
userId: resolved.userId || "",
|
|
494
|
+
accessToken
|
|
495
|
+
}) ? cached : null;
|
|
496
|
+
if (accessToken) {
|
|
497
|
+
let userId = resolved.userId;
|
|
498
|
+
const hasMatchingCachedToken = cachedCredentials?.accessToken === accessToken;
|
|
499
|
+
let knownDeviceId = hasMatchingCachedToken ? cachedCredentials?.deviceId || resolved.deviceId : resolved.deviceId;
|
|
500
|
+
if (!userId) {
|
|
501
|
+
const whoami = await fetchMatrixWhoamiIdentity({
|
|
502
|
+
homeserver,
|
|
503
|
+
accessToken,
|
|
504
|
+
userId,
|
|
505
|
+
ssrfPolicy: resolved.ssrfPolicy,
|
|
506
|
+
dispatcherPolicy: resolved.dispatcherPolicy
|
|
507
|
+
});
|
|
508
|
+
const fetchedUserId = whoami.user_id?.trim();
|
|
509
|
+
if (!fetchedUserId) {
|
|
510
|
+
throw new Error("Matrix whoami did not return user_id");
|
|
511
|
+
}
|
|
512
|
+
userId = fetchedUserId;
|
|
513
|
+
knownDeviceId = knownDeviceId || whoami.device_id?.trim() || resolved.deviceId;
|
|
514
|
+
}
|
|
515
|
+
const shouldRefreshCachedCredentials = !cachedCredentials || !hasMatchingCachedToken || cachedCredentials.userId !== userId || (cachedCredentials.deviceId || void 0) !== knownDeviceId;
|
|
516
|
+
if (shouldRefreshCachedCredentials) {
|
|
517
|
+
const { saveMatrixCredentials: saveMatrixCredentials2 } = await loadCredentialsWriter();
|
|
518
|
+
await saveMatrixCredentials2(
|
|
519
|
+
{
|
|
520
|
+
homeserver,
|
|
521
|
+
userId,
|
|
522
|
+
accessToken,
|
|
523
|
+
deviceId: knownDeviceId
|
|
524
|
+
},
|
|
525
|
+
env,
|
|
526
|
+
accountId
|
|
527
|
+
);
|
|
528
|
+
} else if (hasMatchingCachedToken) {
|
|
529
|
+
const { touchMatrixCredentials } = await loadCredentialsWriter();
|
|
530
|
+
await touchMatrixCredentials(env, accountId);
|
|
531
|
+
}
|
|
532
|
+
return {
|
|
533
|
+
accountId,
|
|
534
|
+
homeserver,
|
|
535
|
+
userId,
|
|
536
|
+
accessToken,
|
|
537
|
+
password: tokenAuthPassword,
|
|
538
|
+
deviceId: knownDeviceId,
|
|
539
|
+
deviceName: resolved.deviceName,
|
|
540
|
+
initialSyncLimit: resolved.initialSyncLimit,
|
|
541
|
+
encryption: resolved.encryption,
|
|
542
|
+
...buildMatrixNetworkFields({
|
|
543
|
+
allowPrivateNetwork: resolved.allowPrivateNetwork,
|
|
544
|
+
dispatcherPolicy: resolved.dispatcherPolicy
|
|
545
|
+
})
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
if (cachedCredentials) {
|
|
549
|
+
const { touchMatrixCredentials } = await loadCredentialsWriter();
|
|
550
|
+
await touchMatrixCredentials(env, accountId);
|
|
551
|
+
return {
|
|
552
|
+
accountId,
|
|
553
|
+
homeserver: cachedCredentials.homeserver,
|
|
554
|
+
userId: cachedCredentials.userId,
|
|
555
|
+
accessToken: cachedCredentials.accessToken,
|
|
556
|
+
password: tokenAuthPassword,
|
|
557
|
+
deviceId: cachedCredentials.deviceId || resolved.deviceId,
|
|
558
|
+
deviceName: resolved.deviceName,
|
|
559
|
+
initialSyncLimit: resolved.initialSyncLimit,
|
|
560
|
+
encryption: resolved.encryption,
|
|
561
|
+
...buildMatrixNetworkFields({
|
|
562
|
+
allowPrivateNetwork: resolved.allowPrivateNetwork,
|
|
563
|
+
dispatcherPolicy: resolved.dispatcherPolicy
|
|
564
|
+
})
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
if (!resolved.userId) {
|
|
568
|
+
throw new Error("Matrix userId is required when no access token is configured (matrix.userId)");
|
|
569
|
+
}
|
|
570
|
+
const password = await resolveConfiguredMatrixAuthSecretInput({
|
|
571
|
+
cfg,
|
|
572
|
+
env,
|
|
573
|
+
accountId,
|
|
574
|
+
field: "password"
|
|
575
|
+
}) ?? resolved.password;
|
|
576
|
+
if (!password) {
|
|
577
|
+
throw new Error(
|
|
578
|
+
"Matrix password is required when no access token is configured (matrix.password)"
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
const { MatrixClient, ensureMatrixSdkLoggingConfigured } = await loadMatrixAuthClientDeps();
|
|
582
|
+
ensureMatrixSdkLoggingConfigured();
|
|
583
|
+
const loginClient = new MatrixClient(homeserver, "", {
|
|
584
|
+
ssrfPolicy: resolved.ssrfPolicy,
|
|
585
|
+
dispatcherPolicy: resolved.dispatcherPolicy
|
|
586
|
+
});
|
|
587
|
+
const login = await retryMatrixAuthRequest("matrix auth login", async () => {
|
|
588
|
+
return await loginClient.doRequest("POST", "/_matrix/client/v3/login", void 0, {
|
|
589
|
+
type: "m.login.password",
|
|
590
|
+
identifier: { type: "m.id.user", user: resolved.userId },
|
|
591
|
+
password,
|
|
592
|
+
device_id: resolved.deviceId,
|
|
593
|
+
initial_device_display_name: resolved.deviceName ?? "OpenClaw Gateway"
|
|
594
|
+
});
|
|
595
|
+
});
|
|
596
|
+
const loginAccessToken = login.access_token?.trim();
|
|
597
|
+
if (!loginAccessToken) {
|
|
598
|
+
throw new Error("Matrix login did not return an access token");
|
|
599
|
+
}
|
|
600
|
+
const auth = {
|
|
601
|
+
accountId,
|
|
602
|
+
homeserver,
|
|
603
|
+
userId: login.user_id ?? resolved.userId,
|
|
604
|
+
accessToken: loginAccessToken,
|
|
605
|
+
password,
|
|
606
|
+
deviceId: login.device_id ?? resolved.deviceId,
|
|
607
|
+
deviceName: resolved.deviceName,
|
|
608
|
+
initialSyncLimit: resolved.initialSyncLimit,
|
|
609
|
+
encryption: resolved.encryption,
|
|
610
|
+
...buildMatrixNetworkFields({
|
|
611
|
+
allowPrivateNetwork: resolved.allowPrivateNetwork,
|
|
612
|
+
dispatcherPolicy: resolved.dispatcherPolicy
|
|
613
|
+
})
|
|
614
|
+
};
|
|
615
|
+
const { saveMatrixCredentials } = await loadCredentialsWriter();
|
|
616
|
+
await saveMatrixCredentials(
|
|
617
|
+
{
|
|
618
|
+
homeserver: auth.homeserver,
|
|
619
|
+
userId: auth.userId,
|
|
620
|
+
accessToken: auth.accessToken,
|
|
621
|
+
deviceId: auth.deviceId
|
|
622
|
+
},
|
|
623
|
+
env,
|
|
624
|
+
accountId
|
|
625
|
+
);
|
|
626
|
+
return auth;
|
|
627
|
+
}
|
|
628
|
+
async function backfillMatrixAuthDeviceIdAfterStartup(params) {
|
|
629
|
+
const knownDeviceId = params.auth.deviceId?.trim();
|
|
630
|
+
if (knownDeviceId) {
|
|
631
|
+
return knownDeviceId;
|
|
632
|
+
}
|
|
633
|
+
if (isAbortSignalTriggered(params.abortSignal)) {
|
|
634
|
+
return void 0;
|
|
635
|
+
}
|
|
636
|
+
const whoami = await fetchMatrixWhoamiIdentity({
|
|
637
|
+
homeserver: params.auth.homeserver,
|
|
638
|
+
accessToken: params.auth.accessToken,
|
|
639
|
+
userId: params.auth.userId,
|
|
640
|
+
ssrfPolicy: params.auth.ssrfPolicy,
|
|
641
|
+
dispatcherPolicy: params.auth.dispatcherPolicy
|
|
642
|
+
});
|
|
643
|
+
const deviceId = whoami.device_id?.trim();
|
|
644
|
+
if (!deviceId) {
|
|
645
|
+
return void 0;
|
|
646
|
+
}
|
|
647
|
+
if (isAbortSignalTriggered(params.abortSignal)) {
|
|
648
|
+
return void 0;
|
|
649
|
+
}
|
|
650
|
+
const env = params.env ?? process.env;
|
|
651
|
+
const { loadMatrixCredentials } = await loadMatrixCredentialsReadDeps();
|
|
652
|
+
if (!credentialsMatchBackfillAuthLineage({
|
|
653
|
+
stored: loadMatrixCredentials(env, params.auth.accountId),
|
|
654
|
+
auth: params.auth
|
|
655
|
+
})) {
|
|
656
|
+
return void 0;
|
|
657
|
+
}
|
|
658
|
+
const repairedStorageMeta = repairCurrentTokenStorageMetaDeviceId({
|
|
659
|
+
homeserver: params.auth.homeserver,
|
|
660
|
+
userId: params.auth.userId,
|
|
661
|
+
accessToken: params.auth.accessToken,
|
|
662
|
+
accountId: params.auth.accountId,
|
|
663
|
+
deviceId,
|
|
664
|
+
env: params.env
|
|
665
|
+
});
|
|
666
|
+
if (!repairedStorageMeta) {
|
|
667
|
+
throw new Error("Matrix deviceId backfill failed to repair current-token storage metadata");
|
|
668
|
+
}
|
|
669
|
+
if (isAbortSignalTriggered(params.abortSignal)) {
|
|
670
|
+
return void 0;
|
|
671
|
+
}
|
|
672
|
+
const credentialsWriter = await import("./src/matrix/credentials-write.runtime.js");
|
|
673
|
+
const saved = await credentialsWriter.saveBackfilledMatrixDeviceId(
|
|
674
|
+
{
|
|
675
|
+
homeserver: params.auth.homeserver,
|
|
676
|
+
userId: params.auth.userId,
|
|
677
|
+
accessToken: params.auth.accessToken,
|
|
678
|
+
deviceId
|
|
679
|
+
},
|
|
680
|
+
env,
|
|
681
|
+
params.auth.accountId
|
|
682
|
+
);
|
|
683
|
+
return saved === "saved" ? deviceId : void 0;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
export {
|
|
687
|
+
setMatrixAuthClientDepsForTest,
|
|
688
|
+
resolveGlobalMatrixEnvConfig,
|
|
689
|
+
resolveMatrixEnvAuthReadiness,
|
|
690
|
+
resolveScopedMatrixEnvConfig,
|
|
691
|
+
hasReadyMatrixEnvAuth,
|
|
692
|
+
validateMatrixHomeserverUrl,
|
|
693
|
+
resolveValidatedMatrixHomeserverUrl,
|
|
694
|
+
resolveMatrixConfigForAccount,
|
|
695
|
+
resolveMatrixAuthContext,
|
|
696
|
+
resolveMatrixAuth,
|
|
697
|
+
backfillMatrixAuthDeviceIdAfterStartup
|
|
698
|
+
};
|
|
699
|
+
//# sourceMappingURL=chunk-OKDOVX4B.js.map
|