@theokit/sdk 5.15.1 → 5.15.2
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/CHANGELOG.md +6 -0
- package/dist/a2a/index.cjs +3 -3
- package/dist/a2a/index.js +1 -1
- package/dist/agent-D6WBBNGR.cjs +72 -0
- package/dist/{agent-CB27KF6O.cjs.map → agent-D6WBBNGR.cjs.map} +1 -1
- package/dist/agent-QRIFX2SY.js +63 -0
- package/dist/{agent-66U5QCPF.js.map → agent-QRIFX2SY.js.map} +1 -1
- package/dist/agent-session-store-2LQEPS4H.js +6 -0
- package/dist/{agent-session-store-22GKA7O4.js.map → agent-session-store-2LQEPS4H.js.map} +1 -1
- package/dist/agent-session-store-IOH6BREF.cjs +23 -0
- package/dist/{agent-session-store-WP6NGDVX.cjs.map → agent-session-store-IOH6BREF.cjs.map} +1 -1
- package/dist/auth/index.cjs +15 -15
- package/dist/auth/index.js +3 -3
- package/dist/{batch-N2XDYZED.js → batch-7IGV2OKA.js} +8 -8
- package/dist/{batch-N2XDYZED.js.map → batch-7IGV2OKA.js.map} +1 -1
- package/dist/{batch-VFR2MAUE.cjs → batch-FIWQZ3JD.cjs} +14 -14
- package/dist/{batch-VFR2MAUE.cjs.map → batch-FIWQZ3JD.cjs.map} +1 -1
- package/dist/{chunk-AT2PESXB.cjs → chunk-2UYAL4N7.cjs} +5 -5
- package/dist/chunk-2UYAL4N7.cjs.map +1 -0
- package/dist/{chunk-K2BQQ445.js → chunk-3GQYMKVJ.js} +3 -3
- package/dist/{chunk-K2BQQ445.js.map → chunk-3GQYMKVJ.js.map} +1 -1
- package/dist/{chunk-YSTXFWQE.cjs → chunk-3HL43XBD.cjs} +4 -4
- package/dist/{chunk-YSTXFWQE.cjs.map → chunk-3HL43XBD.cjs.map} +1 -1
- package/dist/{chunk-XESYJ4JC.js → chunk-3VX7JHJI.js} +7 -7
- package/dist/{chunk-XESYJ4JC.js.map → chunk-3VX7JHJI.js.map} +1 -1
- package/dist/{chunk-6XQLTQB6.cjs → chunk-3YCNBOX7.cjs} +3 -3
- package/dist/{chunk-6XQLTQB6.cjs.map → chunk-3YCNBOX7.cjs.map} +1 -1
- package/dist/{chunk-CHKV2L2Y.cjs → chunk-46YYJIHL.cjs} +30 -30
- package/dist/chunk-46YYJIHL.cjs.map +1 -0
- package/dist/{chunk-73IITAF7.js → chunk-4C37ELQL.js} +9 -9
- package/dist/{chunk-73IITAF7.js.map → chunk-4C37ELQL.js.map} +1 -1
- package/dist/{chunk-AGO5S5WD.js → chunk-4E4D6H77.js} +3 -3
- package/dist/{chunk-AGO5S5WD.js.map → chunk-4E4D6H77.js.map} +1 -1
- package/dist/{chunk-R35ZJAYT.cjs → chunk-4JF52NED.cjs} +12 -12
- package/dist/{chunk-R35ZJAYT.cjs.map → chunk-4JF52NED.cjs.map} +1 -1
- package/dist/{chunk-INVEGVGO.js → chunk-4TA47IK4.js} +8 -8
- package/dist/{chunk-INVEGVGO.js.map → chunk-4TA47IK4.js.map} +1 -1
- package/dist/{chunk-MLGETTYX.js → chunk-4YUIYSZO.js} +6 -6
- package/dist/{chunk-MLGETTYX.js.map → chunk-4YUIYSZO.js.map} +1 -1
- package/dist/{chunk-RZL2W4C3.js → chunk-5L7S2VOL.js} +5 -5
- package/dist/{chunk-RZL2W4C3.js.map → chunk-5L7S2VOL.js.map} +1 -1
- package/dist/{chunk-3WKWBYPO.cjs → chunk-6EHOJLJ3.cjs} +20 -20
- package/dist/chunk-6EHOJLJ3.cjs.map +1 -0
- package/dist/{chunk-XOU3CL7S.cjs → chunk-6HQFPX7N.cjs} +28 -28
- package/dist/chunk-6HQFPX7N.cjs.map +1 -0
- package/dist/{chunk-3E3VSMB6.cjs → chunk-6XT5LAZG.cjs} +58 -58
- package/dist/chunk-6XT5LAZG.cjs.map +1 -0
- package/dist/{chunk-R427EOZE.cjs → chunk-7EFT6N5C.cjs} +13 -13
- package/dist/{chunk-R427EOZE.cjs.map → chunk-7EFT6N5C.cjs.map} +1 -1
- package/dist/{chunk-L7V4DDIE.cjs → chunk-7VNFOGRD.cjs} +12 -12
- package/dist/chunk-7VNFOGRD.cjs.map +1 -0
- package/dist/{chunk-YKNBTHMD.js → chunk-AQ23NII7.js} +3 -3
- package/dist/{chunk-YKNBTHMD.js.map → chunk-AQ23NII7.js.map} +1 -1
- package/dist/{chunk-O2RCS3SJ.js → chunk-ATGSV4GS.js} +4 -4
- package/dist/{chunk-O2RCS3SJ.js.map → chunk-ATGSV4GS.js.map} +1 -1
- package/dist/{chunk-H7HD6RXO.cjs → chunk-AW72G4TC.cjs} +5 -5
- package/dist/{chunk-H7HD6RXO.cjs.map → chunk-AW72G4TC.cjs.map} +1 -1
- package/dist/{chunk-M4U24U6G.js → chunk-AZK3QM36.js} +5 -5
- package/dist/{chunk-M4U24U6G.js.map → chunk-AZK3QM36.js.map} +1 -1
- package/dist/{chunk-QK2ERTO3.js → chunk-BH6M2DGV.js} +4 -4
- package/dist/{chunk-QK2ERTO3.js.map → chunk-BH6M2DGV.js.map} +1 -1
- package/dist/{chunk-26UQG242.cjs → chunk-BTGYRM4J.cjs} +264 -264
- package/dist/chunk-BTGYRM4J.cjs.map +1 -0
- package/dist/{chunk-ZQWRUJHE.js → chunk-CG64VPPU.js} +50 -50
- package/dist/{chunk-ZQWRUJHE.js.map → chunk-CG64VPPU.js.map} +1 -1
- package/dist/{chunk-CBBT42VX.js → chunk-CMDM4VF6.js} +3 -3
- package/dist/{chunk-CBBT42VX.js.map → chunk-CMDM4VF6.js.map} +1 -1
- package/dist/{chunk-OLJOI4LK.js → chunk-CN732Z5C.js} +4 -4
- package/dist/{chunk-OLJOI4LK.js.map → chunk-CN732Z5C.js.map} +1 -1
- package/dist/{chunk-SETHRLQS.cjs → chunk-D3BL3EEB.cjs} +9 -9
- package/dist/chunk-D3BL3EEB.cjs.map +1 -0
- package/dist/{chunk-LCCT5ZXJ.js → chunk-DB5RYCXX.js} +13 -13
- package/dist/{chunk-LCCT5ZXJ.js.map → chunk-DB5RYCXX.js.map} +1 -1
- package/dist/{chunk-SV63WTA2.js → chunk-DBH2WA2U.js} +4 -4
- package/dist/{chunk-SV63WTA2.js.map → chunk-DBH2WA2U.js.map} +1 -1
- package/dist/{chunk-XE3CAY6Z.cjs → chunk-DEHPRORL.cjs} +4 -4
- package/dist/{chunk-XE3CAY6Z.cjs.map → chunk-DEHPRORL.cjs.map} +1 -1
- package/dist/{chunk-UKMBRMGT.js → chunk-DGO4LPLP.js} +4 -4
- package/dist/{chunk-UKMBRMGT.js.map → chunk-DGO4LPLP.js.map} +1 -1
- package/dist/{chunk-RS7YQR4X.cjs → chunk-EBX6XUN7.cjs} +7 -7
- package/dist/{chunk-RS7YQR4X.cjs.map → chunk-EBX6XUN7.cjs.map} +1 -1
- package/dist/chunk-EDIYR4VR.cjs +18 -0
- package/dist/{chunk-SPEN7RJU.cjs.map → chunk-EDIYR4VR.cjs.map} +1 -1
- package/dist/{chunk-QGDPMM3C.js → chunk-EF5IONLL.js} +5 -5
- package/dist/{chunk-QGDPMM3C.js.map → chunk-EF5IONLL.js.map} +1 -1
- package/dist/{chunk-MSW7LB2V.cjs → chunk-EOWIUDKG.cjs} +5 -5
- package/dist/{chunk-MSW7LB2V.cjs.map → chunk-EOWIUDKG.cjs.map} +1 -1
- package/dist/{chunk-L7JPXZ2C.cjs → chunk-ER3BF23R.cjs} +19 -19
- package/dist/{chunk-L7JPXZ2C.cjs.map → chunk-ER3BF23R.cjs.map} +1 -1
- package/dist/{chunk-BNEUB52I.cjs → chunk-ERBKPA2N.cjs} +4 -4
- package/dist/{chunk-BNEUB52I.cjs.map → chunk-ERBKPA2N.cjs.map} +1 -1
- package/dist/{chunk-4QCJAJAG.js → chunk-F54PXZIA.js} +5 -5
- package/dist/{chunk-4QCJAJAG.js.map → chunk-F54PXZIA.js.map} +1 -1
- package/dist/{chunk-2XWAYCFM.cjs → chunk-FBT2SF2S.cjs} +12 -12
- package/dist/{chunk-2XWAYCFM.cjs.map → chunk-FBT2SF2S.cjs.map} +1 -1
- package/dist/{chunk-AUH2EVWY.cjs → chunk-FZSPVIFK.cjs} +16 -16
- package/dist/chunk-FZSPVIFK.cjs.map +1 -0
- package/dist/{chunk-CYWOJA6B.js → chunk-GA27FFT5.js} +3 -3
- package/dist/{chunk-CYWOJA6B.js.map → chunk-GA27FFT5.js.map} +1 -1
- package/dist/{chunk-HWMGR3HA.js → chunk-GEQLHBJM.js} +6 -6
- package/dist/{chunk-HWMGR3HA.js.map → chunk-GEQLHBJM.js.map} +1 -1
- package/dist/{chunk-IJ7M6GOG.cjs → chunk-GKERJ52A.cjs} +4 -4
- package/dist/{chunk-IJ7M6GOG.cjs.map → chunk-GKERJ52A.cjs.map} +1 -1
- package/dist/{chunk-NEH3BPFD.cjs → chunk-HI5TJWQE.cjs} +19 -19
- package/dist/{chunk-NEH3BPFD.cjs.map → chunk-HI5TJWQE.cjs.map} +1 -1
- package/dist/{chunk-ZOFRNNZD.cjs → chunk-IZV72OEI.cjs} +11 -11
- package/dist/chunk-IZV72OEI.cjs.map +1 -0
- package/dist/{chunk-KU5O7WPK.js → chunk-JD3EKKKB.js} +4 -4
- package/dist/{chunk-KU5O7WPK.js.map → chunk-JD3EKKKB.js.map} +1 -1
- package/dist/{chunk-DFBWYETS.js → chunk-JRP2W2DR.js} +3 -3
- package/dist/{chunk-DFBWYETS.js.map → chunk-JRP2W2DR.js.map} +1 -1
- package/dist/{chunk-26GI3OYA.js → chunk-JRQJMZKY.js} +13 -13
- package/dist/{chunk-26GI3OYA.js.map → chunk-JRQJMZKY.js.map} +1 -1
- package/dist/{chunk-YQ3XC6C2.cjs → chunk-JVH3NNJ3.cjs} +13 -13
- package/dist/chunk-JVH3NNJ3.cjs.map +1 -0
- package/dist/{chunk-VWYFGE27.cjs → chunk-KC2HKUPT.cjs} +56 -56
- package/dist/chunk-KC2HKUPT.cjs.map +1 -0
- package/dist/{chunk-PDOXYXWX.cjs → chunk-KDJTECE6.cjs} +4 -4
- package/dist/{chunk-PDOXYXWX.cjs.map → chunk-KDJTECE6.cjs.map} +1 -1
- package/dist/{chunk-QD6B6W6I.js → chunk-L2KC2G7H.js} +5 -5
- package/dist/{chunk-QD6B6W6I.js.map → chunk-L2KC2G7H.js.map} +1 -1
- package/dist/{chunk-3BBTHFGJ.js → chunk-L5B7EWWH.js} +5 -5
- package/dist/{chunk-3BBTHFGJ.js.map → chunk-L5B7EWWH.js.map} +1 -1
- package/dist/{chunk-X7CE7Y5W.js → chunk-LG4JCJEI.js} +11 -11
- package/dist/{chunk-X7CE7Y5W.js.map → chunk-LG4JCJEI.js.map} +1 -1
- package/dist/{chunk-2HXTNVLM.js → chunk-LSURFRJA.js} +6 -6
- package/dist/{chunk-2HXTNVLM.js.map → chunk-LSURFRJA.js.map} +1 -1
- package/dist/{chunk-55LLQFHW.cjs → chunk-MJGY3E3C.cjs} +4 -4
- package/dist/{chunk-55LLQFHW.cjs.map → chunk-MJGY3E3C.cjs.map} +1 -1
- package/dist/{chunk-EQ5IDL6W.cjs → chunk-MKS5FFH5.cjs} +15 -15
- package/dist/chunk-MKS5FFH5.cjs.map +1 -0
- package/dist/{chunk-WM646HEN.js → chunk-MTNCJ7MQ.js} +6 -6
- package/dist/{chunk-WM646HEN.js.map → chunk-MTNCJ7MQ.js.map} +1 -1
- package/dist/{chunk-SA6K24NB.cjs → chunk-MXJJMP4U.cjs} +7 -7
- package/dist/chunk-MXJJMP4U.cjs.map +1 -0
- package/dist/{chunk-FTXY4D44.cjs → chunk-N2ORTDSO.cjs} +20 -20
- package/dist/chunk-N2ORTDSO.cjs.map +1 -0
- package/dist/{chunk-7YUPSBDV.cjs → chunk-NDXZXGVP.cjs} +6 -6
- package/dist/{chunk-7YUPSBDV.cjs.map → chunk-NDXZXGVP.cjs.map} +1 -1
- package/dist/{chunk-3UMPP553.cjs → chunk-NMRNE6QX.cjs} +11 -11
- package/dist/{chunk-3UMPP553.cjs.map → chunk-NMRNE6QX.cjs.map} +1 -1
- package/dist/{chunk-PKRPV3R7.js → chunk-NO6AG22P.js} +6 -6
- package/dist/{chunk-PKRPV3R7.js.map → chunk-NO6AG22P.js.map} +1 -1
- package/dist/{chunk-NK5EOTDY.js → chunk-OIOSY5G6.js} +3 -3
- package/dist/{chunk-NK5EOTDY.js.map → chunk-OIOSY5G6.js.map} +1 -1
- package/dist/{chunk-RGVMJU57.js → chunk-P7B64NFK.js} +8 -8
- package/dist/{chunk-RGVMJU57.js.map → chunk-P7B64NFK.js.map} +1 -1
- package/dist/{chunk-TDED5XES.js → chunk-PCPYTBVV.js} +6 -6
- package/dist/chunk-PCPYTBVV.js.map +1 -0
- package/dist/{chunk-FBIDOOJM.cjs → chunk-PDFSLD5P.cjs} +6 -6
- package/dist/{chunk-FBIDOOJM.cjs.map → chunk-PDFSLD5P.cjs.map} +1 -1
- package/dist/{chunk-YMVTUV5K.js → chunk-PISZRLES.js} +5 -5
- package/dist/{chunk-YMVTUV5K.js.map → chunk-PISZRLES.js.map} +1 -1
- package/dist/{chunk-BUUUWQMB.cjs → chunk-PNL63WDP.cjs} +4 -4
- package/dist/{chunk-BUUUWQMB.cjs.map → chunk-PNL63WDP.cjs.map} +1 -1
- package/dist/{chunk-VNRNZ3WI.js → chunk-PSMWZYW6.js} +4 -4
- package/dist/{chunk-VNRNZ3WI.js.map → chunk-PSMWZYW6.js.map} +1 -1
- package/dist/{chunk-5645PMVU.cjs → chunk-PXYINWBC.cjs} +20 -20
- package/dist/chunk-PXYINWBC.cjs.map +1 -0
- package/dist/{chunk-RTDVSHJR.cjs → chunk-Q4UOCMAO.cjs} +5 -5
- package/dist/{chunk-RTDVSHJR.cjs.map → chunk-Q4UOCMAO.cjs.map} +1 -1
- package/dist/{chunk-5IRDK5BC.js → chunk-QH6MWGOA.js} +4 -4
- package/dist/{chunk-5IRDK5BC.js.map → chunk-QH6MWGOA.js.map} +1 -1
- package/dist/{chunk-3LMVJTNJ.js → chunk-QPUKIZOT.js} +3 -3
- package/dist/{chunk-3LMVJTNJ.js.map → chunk-QPUKIZOT.js.map} +1 -1
- package/dist/{chunk-SWALPLFQ.cjs → chunk-RTCO3USA.cjs} +16 -16
- package/dist/chunk-RTCO3USA.cjs.map +1 -0
- package/dist/{chunk-SAGRF4IB.js → chunk-S2CMEJ5F.js} +3 -3
- package/dist/{chunk-SAGRF4IB.js.map → chunk-S2CMEJ5F.js.map} +1 -1
- package/dist/{chunk-VZGE7NAI.js → chunk-S5ERB3CH.js} +3 -3
- package/dist/{chunk-VZGE7NAI.js.map → chunk-S5ERB3CH.js.map} +1 -1
- package/dist/{chunk-XJ3WU5CZ.js → chunk-S7IZEVXX.js} +6 -6
- package/dist/{chunk-XJ3WU5CZ.js.map → chunk-S7IZEVXX.js.map} +1 -1
- package/dist/{chunk-Q7UG242V.js → chunk-TIYQDJFK.js} +3 -3
- package/dist/{chunk-Q7UG242V.js.map → chunk-TIYQDJFK.js.map} +1 -1
- package/dist/{chunk-POBZXULR.cjs → chunk-TTNJOM5W.cjs} +16 -16
- package/dist/{chunk-POBZXULR.cjs.map → chunk-TTNJOM5W.cjs.map} +1 -1
- package/dist/{chunk-VCQ37TC5.js → chunk-TTXRNCXY.js} +3 -3
- package/dist/{chunk-VCQ37TC5.js.map → chunk-TTXRNCXY.js.map} +1 -1
- package/dist/{chunk-3HA7N2BB.cjs → chunk-TYKBAKAS.cjs} +5 -5
- package/dist/{chunk-3HA7N2BB.cjs.map → chunk-TYKBAKAS.cjs.map} +1 -1
- package/dist/{chunk-A77UMVMD.cjs → chunk-UMCCYXFZ.cjs} +8 -8
- package/dist/{chunk-A77UMVMD.cjs.map → chunk-UMCCYXFZ.cjs.map} +1 -1
- package/dist/{chunk-3GTN4HOO.js → chunk-UNP4NCMZ.js} +3 -3
- package/dist/{chunk-3GTN4HOO.js.map → chunk-UNP4NCMZ.js.map} +1 -1
- package/dist/{chunk-BPL5CVZ5.js → chunk-VFT63FJF.js} +3 -3
- package/dist/{chunk-BPL5CVZ5.js.map → chunk-VFT63FJF.js.map} +1 -1
- package/dist/{chunk-3KIUY67P.cjs → chunk-VHY6NVCJ.cjs} +30 -30
- package/dist/chunk-VHY6NVCJ.cjs.map +1 -0
- package/dist/{chunk-TRPRTZEH.cjs → chunk-VT3NWHFH.cjs} +6 -6
- package/dist/{chunk-TRPRTZEH.cjs.map → chunk-VT3NWHFH.cjs.map} +1 -1
- package/dist/{chunk-FJWQP6EE.js → chunk-WJ6OGKAO.js} +3 -3
- package/dist/{chunk-FJWQP6EE.js.map → chunk-WJ6OGKAO.js.map} +1 -1
- package/dist/{chunk-FLDHYF5C.cjs → chunk-X2XLSE2N.cjs} +9 -9
- package/dist/chunk-X2XLSE2N.cjs.map +1 -0
- package/dist/{chunk-UDAKAE4Z.cjs → chunk-X4ZYEZPD.cjs} +12 -12
- package/dist/chunk-X4ZYEZPD.cjs.map +1 -0
- package/dist/{chunk-QG4SXZ2A.cjs → chunk-XR6O6G3B.cjs} +27 -27
- package/dist/chunk-XR6O6G3B.cjs.map +1 -0
- package/dist/{chunk-BWYC7RZG.cjs → chunk-XTQWTVVI.cjs} +11 -11
- package/dist/chunk-XTQWTVVI.cjs.map +1 -0
- package/dist/{chunk-MLJDW2YK.js → chunk-YSGS57DA.js} +4 -4
- package/dist/{chunk-MLJDW2YK.js.map → chunk-YSGS57DA.js.map} +1 -1
- package/dist/{chunk-KCM3RMKR.js → chunk-YUQNHLKN.js} +8 -8
- package/dist/{chunk-KCM3RMKR.js.map → chunk-YUQNHLKN.js.map} +1 -1
- package/dist/{chunk-P7QYG4RZ.cjs → chunk-Z5MB2HAN.cjs} +8 -8
- package/dist/{chunk-P7QYG4RZ.cjs.map → chunk-Z5MB2HAN.cjs.map} +1 -1
- package/dist/{chunk-HJ2LV464.js → chunk-ZUWVO442.js} +4 -4
- package/dist/{chunk-HJ2LV464.js.map → chunk-ZUWVO442.js.map} +1 -1
- package/dist/{compact-session-CHBJOYWP.cjs → compact-session-5DWFHMW4.cjs} +21 -21
- package/dist/{compact-session-CHBJOYWP.cjs.map → compact-session-5DWFHMW4.cjs.map} +1 -1
- package/dist/{compact-session-F3J3FMEU.js → compact-session-AL65PEMX.js} +12 -12
- package/dist/{compact-session-F3J3FMEU.js.map → compact-session-AL65PEMX.js.map} +1 -1
- package/dist/context/index.cjs +11 -11
- package/dist/context/index.js +6 -6
- package/dist/context-4XSD2V3G.js +7 -0
- package/dist/{context-7EBZST3L.js.map → context-4XSD2V3G.js.map} +1 -1
- package/dist/context-ZX2VBGSX.cjs +24 -0
- package/dist/{context-4RSI3AXT.cjs.map → context-ZX2VBGSX.cjs.map} +1 -1
- package/dist/cron.cjs +40 -40
- package/dist/cron.js +39 -39
- package/dist/eval.cjs +51 -51
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +41 -41
- package/dist/{executor-THUXNAFR.js → executor-ZHIUSHRV.js} +7 -7
- package/dist/{executor-THUXNAFR.js.map → executor-ZHIUSHRV.js.map} +1 -1
- package/dist/{executor-5QL5AXIZ.cjs → executor-ZTLJZ5LK.cjs} +24 -24
- package/dist/{executor-5QL5AXIZ.cjs.map → executor-ZTLJZ5LK.cjs.map} +1 -1
- package/dist/filesystem/index.cjs +14 -14
- package/dist/filesystem/index.cjs.map +1 -1
- package/dist/filesystem/index.js +4 -4
- package/dist/{fork-agent-S2EPIML7.js → fork-agent-BHVTALT5.js} +3 -3
- package/dist/{fork-agent-S2EPIML7.js.map → fork-agent-BHVTALT5.js.map} +1 -1
- package/dist/{fork-agent-WAEQI2DL.cjs → fork-agent-DCOPPXM2.cjs} +4 -4
- package/dist/{fork-agent-WAEQI2DL.cjs.map → fork-agent-DCOPPXM2.cjs.map} +1 -1
- package/dist/fs-session-store-EZ32TFGB.js +11 -0
- package/dist/{fs-session-store-MYQEVUFL.js.map → fs-session-store-EZ32TFGB.js.map} +1 -1
- package/dist/fs-session-store-G664LDDN.cjs +20 -0
- package/dist/{fs-session-store-CYNTEPJZ.cjs.map → fs-session-store-G664LDDN.cjs.map} +1 -1
- package/dist/generate-object-JFZTK567.cjs +20 -0
- package/dist/{generate-object-A5F576IT.cjs.map → generate-object-JFZTK567.cjs.map} +1 -1
- package/dist/{generate-object-TBDOBBYW.js → generate-object-RPBXY2U3.js} +4 -4
- package/dist/{generate-object-TBDOBBYW.js.map → generate-object-RPBXY2U3.js.map} +1 -1
- package/dist/index-manager-2MJEEN2O.js +18 -0
- package/dist/{index-manager-NF2WRLOU.js.map → index-manager-2MJEEN2O.js.map} +1 -1
- package/dist/index-manager-CT6MMG7S.cjs +27 -0
- package/dist/{index-manager-2KH75BRW.cjs.map → index-manager-CT6MMG7S.cjs.map} +1 -1
- package/dist/index.cjs +130 -130
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +56 -56
- package/dist/{inject-session-LC2TROHM.js → inject-session-E2SZ4A35.js} +6 -6
- package/dist/{inject-session-LC2TROHM.js.map → inject-session-E2SZ4A35.js.map} +1 -1
- package/dist/{inject-session-T4RXANG3.cjs → inject-session-QZULG65O.cjs} +8 -8
- package/dist/{inject-session-T4RXANG3.cjs.map → inject-session-QZULG65O.cjs.map} +1 -1
- package/dist/internal/memory/adapters/index.cjs +4 -4
- package/dist/internal/memory/adapters/index.js +3 -3
- package/dist/internal/memory/storage/index.cjs +45 -45
- package/dist/internal/memory/storage/index.js +9 -9
- package/dist/internal/persistence/index.cjs +22 -22
- package/dist/internal/persistence/index.js +6 -6
- package/dist/internal/security/index.cjs +9 -9
- package/dist/internal/security/index.js +2 -2
- package/dist/mcp-auth.cjs +8 -8
- package/dist/mcp-auth.js +3 -3
- package/dist/models.cjs +30 -30
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +8 -8
- package/dist/{oauth-transaction-store-U34YLEGP.js → oauth-transaction-store-QQBWGNE2.js} +3 -3
- package/dist/{oauth-transaction-store-U34YLEGP.js.map → oauth-transaction-store-QQBWGNE2.js.map} +1 -1
- package/dist/{oauth-transaction-store-OMX436YB.cjs → oauth-transaction-store-YF7WOA6B.cjs} +10 -10
- package/dist/{oauth-transaction-store-OMX436YB.cjs.map → oauth-transaction-store-YF7WOA6B.cjs.map} +1 -1
- package/dist/path-safety.cjs +9 -9
- package/dist/path-safety.js +2 -2
- package/dist/persistence.cjs +41 -41
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +11 -11
- package/dist/project.cjs +7 -7
- package/dist/project.cjs.map +1 -1
- package/dist/project.js +4 -4
- package/dist/providers.cjs +6 -6
- package/dist/providers.js +4 -4
- package/dist/{registry-5TDAF7RK.js → registry-DOYBR237.js} +6 -6
- package/dist/{registry-5TDAF7RK.js.map → registry-DOYBR237.js.map} +1 -1
- package/dist/{registry-W7TSCLQO.cjs → registry-PB7JFVUJ.cjs} +14 -14
- package/dist/{registry-W7TSCLQO.cjs.map → registry-PB7JFVUJ.cjs.map} +1 -1
- package/dist/sandbox/index.cjs +41 -41
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.js +7 -7
- package/dist/sanitize/index.cjs +2 -2
- package/dist/sanitize/index.js +1 -1
- package/dist/server/auth/index.cjs +9 -9
- package/dist/server/auth/index.cjs.map +1 -1
- package/dist/server/auth/index.js +4 -4
- package/dist/{session-transcript-7TZ6HXSX.cjs → session-transcript-EBVGLZ6B.cjs} +17 -17
- package/dist/{session-transcript-7TZ6HXSX.cjs.map → session-transcript-EBVGLZ6B.cjs.map} +1 -1
- package/dist/{session-transcript-BSHZYYY6.js → session-transcript-GU2VE7JX.js} +4 -4
- package/dist/{session-transcript-BSHZYYY6.js.map → session-transcript-GU2VE7JX.js.map} +1 -1
- package/dist/skills.cjs +7 -7
- package/dist/skills.js +4 -4
- package/dist/stream-object-3AU7QDHT.js +7 -0
- package/dist/{stream-object-EKM4WGTI.js.map → stream-object-3AU7QDHT.js.map} +1 -1
- package/dist/stream-object-SLGR2KIA.cjs +20 -0
- package/dist/{stream-object-AS4YYM4B.cjs.map → stream-object-SLGR2KIA.cjs.map} +1 -1
- package/dist/subagents-loader-4PQS7ULK.cjs +16 -0
- package/dist/{subagents-loader-KLWF4QPD.cjs.map → subagents-loader-4PQS7ULK.cjs.map} +1 -1
- package/dist/subagents-loader-CPFVLWLH.js +7 -0
- package/dist/{subagents-loader-SXETS2F2.js.map → subagents-loader-CPFVLWLH.js.map} +1 -1
- package/dist/subagents-loader.cjs +4 -4
- package/dist/subagents-loader.js +3 -3
- package/dist/subagents.cjs +2 -2
- package/dist/subagents.js +1 -1
- package/dist/task-store.cjs +5 -5
- package/dist/task-store.js +2 -2
- package/dist/workflow.cjs +28 -28
- package/dist/workflow.js +5 -5
- package/package.json +1 -1
- package/dist/agent-66U5QCPF.js +0 -63
- package/dist/agent-CB27KF6O.cjs +0 -72
- package/dist/agent-session-store-22GKA7O4.js +0 -6
- package/dist/agent-session-store-WP6NGDVX.cjs +0 -23
- package/dist/chunk-26UQG242.cjs.map +0 -1
- package/dist/chunk-3E3VSMB6.cjs.map +0 -1
- package/dist/chunk-3KIUY67P.cjs.map +0 -1
- package/dist/chunk-3WKWBYPO.cjs.map +0 -1
- package/dist/chunk-5645PMVU.cjs.map +0 -1
- package/dist/chunk-AT2PESXB.cjs.map +0 -1
- package/dist/chunk-AUH2EVWY.cjs.map +0 -1
- package/dist/chunk-BWYC7RZG.cjs.map +0 -1
- package/dist/chunk-CHKV2L2Y.cjs.map +0 -1
- package/dist/chunk-EQ5IDL6W.cjs.map +0 -1
- package/dist/chunk-FLDHYF5C.cjs.map +0 -1
- package/dist/chunk-FTXY4D44.cjs.map +0 -1
- package/dist/chunk-L7V4DDIE.cjs.map +0 -1
- package/dist/chunk-QG4SXZ2A.cjs.map +0 -1
- package/dist/chunk-SA6K24NB.cjs.map +0 -1
- package/dist/chunk-SETHRLQS.cjs.map +0 -1
- package/dist/chunk-SPEN7RJU.cjs +0 -18
- package/dist/chunk-SWALPLFQ.cjs.map +0 -1
- package/dist/chunk-TDED5XES.js.map +0 -1
- package/dist/chunk-UDAKAE4Z.cjs.map +0 -1
- package/dist/chunk-VWYFGE27.cjs.map +0 -1
- package/dist/chunk-XOU3CL7S.cjs.map +0 -1
- package/dist/chunk-YQ3XC6C2.cjs.map +0 -1
- package/dist/chunk-ZOFRNNZD.cjs.map +0 -1
- package/dist/context-4RSI3AXT.cjs +0 -24
- package/dist/context-7EBZST3L.js +0 -7
- package/dist/fs-session-store-CYNTEPJZ.cjs +0 -20
- package/dist/fs-session-store-MYQEVUFL.js +0 -11
- package/dist/generate-object-A5F576IT.cjs +0 -20
- package/dist/index-manager-2KH75BRW.cjs +0 -27
- package/dist/index-manager-NF2WRLOU.js +0 -18
- package/dist/stream-object-AS4YYM4B.cjs +0 -20
- package/dist/stream-object-EKM4WGTI.js +0 -7
- package/dist/subagents-loader-KLWF4QPD.cjs +0 -16
- package/dist/subagents-loader-SXETS2F2.js +0 -7
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkVTYY7XL5_cjs = require('../../chunk-VTYY7XL5.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkTYKBAKAS_cjs = require('../../chunk-TYKBAKAS.cjs');
|
|
5
5
|
var chunkA4RAL2ER_cjs = require('../../chunk-A4RAL2ER.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
6
|
+
var chunk2UYAL4N7_cjs = require('../../chunk-2UYAL4N7.cjs');
|
|
7
|
+
var chunkTTNJOM5W_cjs = require('../../chunk-TTNJOM5W.cjs');
|
|
8
8
|
var chunkMHUOVS5I_cjs = require('../../chunk-MHUOVS5I.cjs');
|
|
9
9
|
var chunkU3DW3WDE_cjs = require('../../chunk-U3DW3WDE.cjs');
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var chunkIZV72OEI_cjs = require('../../chunk-IZV72OEI.cjs');
|
|
11
|
+
var chunkJVH3NNJ3_cjs = require('../../chunk-JVH3NNJ3.cjs');
|
|
12
12
|
require('../../chunk-CEGU5AVD.cjs');
|
|
13
13
|
require('../../chunk-RNXXYF22.cjs');
|
|
14
|
-
var promises = require('fs/promises');
|
|
14
|
+
var promises = require('node:fs/promises');
|
|
15
15
|
|
|
16
16
|
async function createExclusive(path, data, options) {
|
|
17
17
|
const mode = options?.mode ?? 384;
|
|
@@ -44,15 +44,15 @@ Object.defineProperty(exports, "PersistenceSchema", {
|
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "migrateSchema", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkTYKBAKAS_cjs.migrateSchema; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "readVersionedJson", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkTYKBAKAS_cjs.readVersionedJson; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "writeVersionedJson", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkTYKBAKAS_cjs.writeVersionedJson; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "containsCjk", {
|
|
58
58
|
enumerable: true,
|
|
@@ -64,31 +64,31 @@ Object.defineProperty(exports, "sanitizeFts5Query", {
|
|
|
64
64
|
});
|
|
65
65
|
Object.defineProperty(exports, "applyWalWithFallback", {
|
|
66
66
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunk2UYAL4N7_cjs.applyWalWithFallback; }
|
|
68
68
|
});
|
|
69
69
|
Object.defineProperty(exports, "isCorruptionError", {
|
|
70
70
|
enumerable: true,
|
|
71
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunk2UYAL4N7_cjs.isCorruptionError; }
|
|
72
72
|
});
|
|
73
73
|
Object.defineProperty(exports, "openSqliteResilient", {
|
|
74
74
|
enumerable: true,
|
|
75
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunk2UYAL4N7_cjs.openSqliteResilient; }
|
|
76
76
|
});
|
|
77
77
|
Object.defineProperty(exports, "JsonlParseError", {
|
|
78
78
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunkTTNJOM5W_cjs.JsonlParseError; }
|
|
80
80
|
});
|
|
81
81
|
Object.defineProperty(exports, "appendJsonl", {
|
|
82
82
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunkTTNJOM5W_cjs.appendJsonl; }
|
|
84
84
|
});
|
|
85
85
|
Object.defineProperty(exports, "loadJsonl", {
|
|
86
86
|
enumerable: true,
|
|
87
|
-
get: function () { return
|
|
87
|
+
get: function () { return chunkTTNJOM5W_cjs.loadJsonl; }
|
|
88
88
|
});
|
|
89
89
|
Object.defineProperty(exports, "readJsonlIds", {
|
|
90
90
|
enumerable: true,
|
|
91
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunkTTNJOM5W_cjs.readJsonlIds; }
|
|
92
92
|
});
|
|
93
93
|
Object.defineProperty(exports, "withFileLock", {
|
|
94
94
|
enumerable: true,
|
|
@@ -100,27 +100,27 @@ Object.defineProperty(exports, "withCwdMutex", {
|
|
|
100
100
|
});
|
|
101
101
|
Object.defineProperty(exports, "atomicWriteJson", {
|
|
102
102
|
enumerable: true,
|
|
103
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunkIZV72OEI_cjs.atomicWriteJson; }
|
|
104
104
|
});
|
|
105
105
|
Object.defineProperty(exports, "atomicWriteText", {
|
|
106
106
|
enumerable: true,
|
|
107
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunkIZV72OEI_cjs.atomicWriteText; }
|
|
108
108
|
});
|
|
109
109
|
Object.defineProperty(exports, "replaceFileAtomic", {
|
|
110
110
|
enumerable: true,
|
|
111
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunkIZV72OEI_cjs.replaceFileAtomic; }
|
|
112
112
|
});
|
|
113
113
|
Object.defineProperty(exports, "displayTheokitHome", {
|
|
114
114
|
enumerable: true,
|
|
115
|
-
get: function () { return
|
|
115
|
+
get: function () { return chunkJVH3NNJ3_cjs.displayTheokitHome; }
|
|
116
116
|
});
|
|
117
117
|
Object.defineProperty(exports, "getProfilesRoot", {
|
|
118
118
|
enumerable: true,
|
|
119
|
-
get: function () { return
|
|
119
|
+
get: function () { return chunkJVH3NNJ3_cjs.getProfilesRoot; }
|
|
120
120
|
});
|
|
121
121
|
Object.defineProperty(exports, "getTheokitHome", {
|
|
122
122
|
enumerable: true,
|
|
123
|
-
get: function () { return
|
|
123
|
+
get: function () { return chunkJVH3NNJ3_cjs.getTheokitHome; }
|
|
124
124
|
});
|
|
125
125
|
exports.casUpdate = casUpdate;
|
|
126
126
|
exports.createExclusive = createExclusive;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { PersistenceSchema } from '../../chunk-HY66GLM6.js';
|
|
2
|
-
export { migrateSchema, readVersionedJson, writeVersionedJson } from '../../chunk-
|
|
2
|
+
export { migrateSchema, readVersionedJson, writeVersionedJson } from '../../chunk-CN732Z5C.js';
|
|
3
3
|
export { containsCjk, sanitizeFts5Query } from '../../chunk-WE22OXQA.js';
|
|
4
|
-
export { applyWalWithFallback, isCorruptionError, openSqliteResilient } from '../../chunk-
|
|
5
|
-
export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds } from '../../chunk-
|
|
4
|
+
export { applyWalWithFallback, isCorruptionError, openSqliteResilient } from '../../chunk-YSGS57DA.js';
|
|
5
|
+
export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds } from '../../chunk-JD3EKKKB.js';
|
|
6
6
|
export { withFileLock } from '../../chunk-FGGVSHDW.js';
|
|
7
7
|
export { withCwdMutex } from '../../chunk-PPU2D4FZ.js';
|
|
8
|
-
export { atomicWriteJson, atomicWriteText, replaceFileAtomic } from '../../chunk-
|
|
9
|
-
export { displayTheokitHome, getProfilesRoot, getTheokitHome } from '../../chunk-
|
|
8
|
+
export { atomicWriteJson, atomicWriteText, replaceFileAtomic } from '../../chunk-AZK3QM36.js';
|
|
9
|
+
export { displayTheokitHome, getProfilesRoot, getTheokitHome } from '../../chunk-PISZRLES.js';
|
|
10
10
|
import '../../chunk-TNFOU6SB.js';
|
|
11
11
|
import '../../chunk-3OY6H3I7.js';
|
|
12
|
-
import { open } from 'fs/promises';
|
|
12
|
+
import { open } from 'node:fs/promises';
|
|
13
13
|
|
|
14
14
|
async function createExclusive(path, data, options) {
|
|
15
15
|
const mode = options?.mode ?? 384;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('../../chunk-MUUQ2WFJ.cjs');
|
|
4
|
-
var
|
|
5
|
-
require('../../chunk-
|
|
4
|
+
var chunkVHY6NVCJ_cjs = require('../../chunk-VHY6NVCJ.cjs');
|
|
5
|
+
require('../../chunk-MXJJMP4U.cjs');
|
|
6
6
|
require('../../chunk-CEGU5AVD.cjs');
|
|
7
7
|
var chunkRNXXYF22_cjs = require('../../chunk-RNXXYF22.cjs');
|
|
8
8
|
|
|
@@ -10,31 +10,31 @@ var chunkRNXXYF22_cjs = require('../../chunk-RNXXYF22.cjs');
|
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(exports, "ForbiddenPathError", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkVHY6NVCJ_cjs.ForbiddenPathError; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "PathTraversalError", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkVHY6NVCJ_cjs.PathTraversalError; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "assertNoSymlinkEscape", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkVHY6NVCJ_cjs.assertNoSymlinkEscape; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "isForbiddenPath", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkVHY6NVCJ_cjs.isForbiddenPath; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "safePathJoin", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkVHY6NVCJ_cjs.safePathJoin; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "sanitizeIdentifier", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkVHY6NVCJ_cjs.sanitizeIdentifier; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "validateArtifactPath", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkVHY6NVCJ_cjs.validateArtifactPath; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "addPattern", {
|
|
40
40
|
enumerable: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../chunk-FD2UT76F.js';
|
|
2
|
-
export { ForbiddenPathError, PathTraversalError, assertNoSymlinkEscape, isForbiddenPath, safePathJoin, sanitizeIdentifier, validateArtifactPath } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
2
|
+
export { ForbiddenPathError, PathTraversalError, assertNoSymlinkEscape, isForbiddenPath, safePathJoin, sanitizeIdentifier, validateArtifactPath } from '../../chunk-NO6AG22P.js';
|
|
3
|
+
import '../../chunk-DGO4LPLP.js';
|
|
4
4
|
import '../../chunk-TNFOU6SB.js';
|
|
5
5
|
export { addPattern, maskToken, redactSecrets } from '../../chunk-3OY6H3I7.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/mcp-auth.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunk6HQFPX7N_cjs = require('./chunk-6HQFPX7N.cjs');
|
|
4
|
+
require('./chunk-IZV72OEI.cjs');
|
|
5
|
+
require('./chunk-PXYINWBC.cjs');
|
|
6
6
|
require('./chunk-CEGU5AVD.cjs');
|
|
7
7
|
require('./chunk-RNXXYF22.cjs');
|
|
8
8
|
|
|
@@ -10,23 +10,23 @@ require('./chunk-RNXXYF22.cjs');
|
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(exports, "getTokens", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk6HQFPX7N_cjs.getTokens; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "lockedRefresh", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk6HQFPX7N_cjs.lockedRefresh; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "refreshAccessToken", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk6HQFPX7N_cjs.refreshAccessToken; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "runPkceFlow", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk6HQFPX7N_cjs.runPkceFlow; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "setTokens", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk6HQFPX7N_cjs.setTokens; }
|
|
30
30
|
});
|
|
31
31
|
//# sourceMappingURL=mcp-auth.cjs.map
|
|
32
32
|
//# sourceMappingURL=mcp-auth.cjs.map
|
package/dist/mcp-auth.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { getTokens, lockedRefresh, refreshAccessToken, runPkceFlow, setTokens } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { getTokens, lockedRefresh, refreshAccessToken, runPkceFlow, setTokens } from './chunk-LG4JCJEI.js';
|
|
2
|
+
import './chunk-AZK3QM36.js';
|
|
3
|
+
import './chunk-L2KC2G7H.js';
|
|
4
4
|
import './chunk-TNFOU6SB.js';
|
|
5
5
|
import './chunk-3OY6H3I7.js';
|
|
6
6
|
//# sourceMappingURL=mcp-auth.js.map
|
package/dist/models.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk7INPXUJI_cjs = require('./chunk-7INPXUJI.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkQ4UOCMAO_cjs = require('./chunk-Q4UOCMAO.cjs');
|
|
5
5
|
var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkZ5MB2HAN_cjs = require('./chunk-Z5MB2HAN.cjs');
|
|
7
7
|
require('./chunk-NVXXWAU7.cjs');
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-UMCCYXFZ.cjs');
|
|
9
|
+
require('./chunk-PXYINWBC.cjs');
|
|
10
10
|
require('./chunk-IOFMRS6T.cjs');
|
|
11
11
|
var chunkEHD25JBZ_cjs = require('./chunk-EHD25JBZ.cjs');
|
|
12
12
|
require('./chunk-CEGU5AVD.cjs');
|
|
13
13
|
var chunkRNXXYF22_cjs = require('./chunk-RNXXYF22.cjs');
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
14
|
+
var node_crypto = require('node:crypto');
|
|
15
|
+
var node_fs = require('node:fs');
|
|
16
|
+
var node_os = require('node:os');
|
|
17
|
+
var node_path = require('node:path');
|
|
18
18
|
|
|
19
19
|
// src/internal/llm/model-option.ts
|
|
20
20
|
var ACRONYMS = /* @__PURE__ */ new Set(["gpt", "ai", "hd", "ui", "api", "sdk", "llm", "xl"]);
|
|
@@ -52,21 +52,21 @@ var MAX_CATALOG_BYTES = 32 * 1024 * 1024;
|
|
|
52
52
|
var TTL_MS = 60 * 60 * 1e3;
|
|
53
53
|
var FETCH_TIMEOUT_MS = 1e4;
|
|
54
54
|
function cachePathFor(url) {
|
|
55
|
-
const base = process.env.THEOKIT_HOME?.trim() ||
|
|
56
|
-
const dir =
|
|
57
|
-
if (url === DEFAULT_URL) return
|
|
58
|
-
const hash =
|
|
59
|
-
return
|
|
60
|
-
}
|
|
61
|
-
function writeCacheAtomic(path
|
|
62
|
-
|
|
63
|
-
const tmp = `${path
|
|
55
|
+
const base = process.env.THEOKIT_HOME?.trim() || node_path.join(node_os.homedir(), ".theokit");
|
|
56
|
+
const dir = node_path.join(base, "cache", "models-dev");
|
|
57
|
+
if (url === DEFAULT_URL) return node_path.join(dir, "api.json");
|
|
58
|
+
const hash = node_crypto.createHash("sha256").update(url).digest("hex").slice(0, 12);
|
|
59
|
+
return node_path.join(dir, `api-${hash}.json`);
|
|
60
|
+
}
|
|
61
|
+
function writeCacheAtomic(path, body) {
|
|
62
|
+
node_fs.mkdirSync(node_path.dirname(path), { recursive: true });
|
|
63
|
+
const tmp = `${path}.tmp-${node_crypto.randomBytes(6).toString("hex")}`;
|
|
64
64
|
try {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
node_fs.writeFileSync(tmp, body);
|
|
66
|
+
node_fs.renameSync(tmp, path);
|
|
67
67
|
} catch (err) {
|
|
68
68
|
try {
|
|
69
|
-
|
|
69
|
+
node_fs.unlinkSync(tmp);
|
|
70
70
|
} catch {
|
|
71
71
|
}
|
|
72
72
|
throw err;
|
|
@@ -85,7 +85,7 @@ function catalogTargets() {
|
|
|
85
85
|
if (_catalogTargets !== void 0) return _catalogTargets;
|
|
86
86
|
_catalogTargets = /* @__PURE__ */ new Map();
|
|
87
87
|
try {
|
|
88
|
-
for (const entry of Object.values(
|
|
88
|
+
for (const entry of Object.values(chunkZ5MB2HAN_cjs.loadProviderCatalog())) {
|
|
89
89
|
const keys = [entry.id, ...entry.aliases ?? []];
|
|
90
90
|
for (const k of keys) {
|
|
91
91
|
if (!_catalogTargets.has(k)) _catalogTargets.set(k, { keys });
|
|
@@ -99,7 +99,7 @@ function resolvePatchKeys(externalId) {
|
|
|
99
99
|
const mapped = MODELS_DEV_ID_MAP[externalId] ?? externalId;
|
|
100
100
|
const fromCatalog = catalogTargets().get(mapped);
|
|
101
101
|
if (fromCatalog !== void 0) return fromCatalog.keys;
|
|
102
|
-
const profile =
|
|
102
|
+
const profile = chunkZ5MB2HAN_cjs.getProviderProfile(mapped);
|
|
103
103
|
if (profile !== void 0) return [profile.name, ...profile.aliases ?? []];
|
|
104
104
|
return void 0;
|
|
105
105
|
}
|
|
@@ -116,9 +116,9 @@ function patchIndexFromApiJson(raw) {
|
|
|
116
116
|
continue;
|
|
117
117
|
}
|
|
118
118
|
for (const [modelId, rawModel] of Object.entries(models)) {
|
|
119
|
-
const parsed =
|
|
119
|
+
const parsed = chunkZ5MB2HAN_cjs.catalogModelSchema.safeParse(rawModel);
|
|
120
120
|
if (!parsed.success) continue;
|
|
121
|
-
for (const key of keys)
|
|
121
|
+
for (const key of keys) chunkZ5MB2HAN_cjs.patchModelInfo(`${key}/${modelId}`, parsed.data);
|
|
122
122
|
patched++;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -134,7 +134,7 @@ function loadCacheIntoIndex(url = DEFAULT_URL) {
|
|
|
134
134
|
const path = cachePathFor(url);
|
|
135
135
|
let body;
|
|
136
136
|
try {
|
|
137
|
-
body =
|
|
137
|
+
body = node_fs.readFileSync(path, "utf-8");
|
|
138
138
|
} catch {
|
|
139
139
|
return 0;
|
|
140
140
|
}
|
|
@@ -143,7 +143,7 @@ function loadCacheIntoIndex(url = DEFAULT_URL) {
|
|
|
143
143
|
parsed = JSON.parse(body);
|
|
144
144
|
} catch {
|
|
145
145
|
try {
|
|
146
|
-
|
|
146
|
+
node_fs.unlinkSync(path);
|
|
147
147
|
} catch {
|
|
148
148
|
}
|
|
149
149
|
chunkRNXXYF22_cjs.diag(`[theokit-sdk] WARN: corrupt models-dev cache deleted (${path})
|
|
@@ -164,7 +164,7 @@ function fetchDisabledByEnv() {
|
|
|
164
164
|
}
|
|
165
165
|
function servedFromFreshCache(url, path, now) {
|
|
166
166
|
try {
|
|
167
|
-
if (now() -
|
|
167
|
+
if (now() - node_fs.statSync(path).mtimeMs >= TTL_MS) return void 0;
|
|
168
168
|
} catch {
|
|
169
169
|
return void 0;
|
|
170
170
|
}
|
|
@@ -218,7 +218,7 @@ function persistAndPatch(path, body) {
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
async function refreshModelCatalog(opts = {}) {
|
|
221
|
-
|
|
221
|
+
chunkZ5MB2HAN_cjs.registerBuiltins();
|
|
222
222
|
if (fetchDisabledByEnv()) return { source: "skipped", models: 0 };
|
|
223
223
|
const url = opts.url ?? process.env.THEOKIT_MODELS_URL ?? DEFAULT_URL;
|
|
224
224
|
const path = cachePathFor(url);
|
|
@@ -232,12 +232,12 @@ async function refreshModelCatalog(opts = {}) {
|
|
|
232
232
|
return persistAndPatch(path, body);
|
|
233
233
|
}
|
|
234
234
|
function getModelInfo(modelId) {
|
|
235
|
-
return
|
|
235
|
+
return chunkZ5MB2HAN_cjs.getCatalogModelInfo(modelId);
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
Object.defineProperty(exports, "resolveModelCapabilities", {
|
|
239
239
|
enumerable: true,
|
|
240
|
-
get: function () { return
|
|
240
|
+
get: function () { return chunkQ4UOCMAO_cjs.resolveModelCapabilities; }
|
|
241
241
|
});
|
|
242
242
|
Object.defineProperty(exports, "parseModelId", {
|
|
243
243
|
enumerable: true,
|
package/dist/models.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internal/llm/model-option.ts","../src/internal/providers/catalog-source-models-dev.ts"],"names":["parseModelId","join","homedir","createHash","path","mkdirSync","dirname","randomBytes","writeFileSync","renameSync","unlinkSync","loadProviderCatalog","getProviderProfile","catalogModelSchema","patchModelInfo","diag","readFileSync","statSync","Retry","registerBu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\";\n\n/**\n * A UI-friendly model option — the shape a `<select>`/dropdown consumes.\n *\n * Public via `@theokit/sdk/models`.\n *\n * @public\n */\nexport interface ModelOption {\n /** The original model id (what you pass back to the SDK). */\n value: string;\n /** Best-effort human label (see {@link humanizeModelName}). */\n label: string;\n /** Provider from the slug prefix, or `undefined` when none. */\n provider: string | undefined;\n}\n\n/** Tokens rendered upper-case rather than title-case. */\nconst ACRONYMS = new Set([\"gpt\", \"ai\", \"hd\", \"ui\", \"api\", \"sdk\", \"llm\", \"xl\"]);\n\nfunction prettyToken(token: string): string {\n if (ACRONYMS.has(token.toLowerCase())) return token.toUpperCase();\n return token.charAt(0).toUpperCase() + token.slice(1);\n}\n\n/**\n * Turn a model id into a best-effort human label: strip the routing/vendor\n * prefix to the core model segment, split on `-`/`_`/`.`/whitespace, title-case\n * each token (known acronyms upper-cased), and append an OpenRouter `:variant`\n * in parentheses. Deterministic, pure, dependency-free.\n *\n * Best-effort, NOT vendor-canonical: `\"anthropic/claude-3-5-sonnet\"` →\n * `\"Claude 3 5 Sonnet\"`. A UI wanting exact marketing names overrides per id.\n *\n * Public via `@theokit/sdk/models`.\n *\n * @public\n */\nexport function humanizeModelName(modelId: string): string {\n const { name } = parseModelId(modelId);\n if (name.length === 0) return \"\";\n const colon = name.indexOf(\":\");\n // Strip a trailing slash so a typo'd `gpt-4o/` keeps its name (not lost to an\n // empty last segment).\n //\n // Done by index rather than with `/\\/+$/`, and the difference is not stylistic: that pattern\n // consumes slashes to the end of the string at every start position and then backtracks\n // looking for an end-anchor that is not there (CodeQL js/polynomial-redos #6). This function\n // is `@public` and takes a caller-supplied model id. Measured on a run of slashes followed by\n // one other character: 25_000 took 496 ms, 100_000 took 31_305 ms — half a minute of pinned\n // CPU to render a label. Walking back from the end is linear and cannot backtrack.\n const base = trimTrailingSlashes(colon >= 0 ? name.slice(0, colon) : name);\n const variant = colon >= 0 ? name.slice(colon + 1) : \"\";\n const lastSlash = base.lastIndexOf(\"/\");\n const core = lastSlash >= 0 ? base.slice(lastSlash + 1) : base;\n const label = core\n .split(/[-_.\\s]+/)\n .filter((t) => t.length > 0)\n .map(prettyToken)\n .join(\" \");\n if (label.length === 0) return variant; // no base label (e.g. \":free\") → bare variant\n return variant.length > 0 ? `${label} (${variant})` : label;\n}\n\n/**\n * Build a {@link ModelOption} (`{ value, label, provider }`) for a model id —\n * a dropdown-ready entry composing {@link humanizeModelName} + `parseModelId`.\n *\n * Public via `@theokit/sdk/models`.\n *\n * @public\n */\nexport function toModelOption(modelId: string): ModelOption {\n return {\n value: modelId,\n label: humanizeModelName(modelId),\n provider: parseModelId(modelId).provider,\n };\n}\n\nconst SLASH_CODE = 47; // \"/\"\n\n/** Removes trailing `/` characters in one linear pass. See the call site for why not a regex. */\nfunction trimTrailingSlashes(value: string): string {\n let end = value.length;\n while (end > 0 && value.charCodeAt(end - 1) === SLASH_CODE) end--;\n return end === value.length ? value : value.slice(0, end);\n}\n","import { createHash, randomBytes } from \"node:crypto\";\nimport { mkdirSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nimport { Retry } from \"../../retry.js\";\nimport { diag } from \"../diagnostics.js\";\nimport { boundFetch } from \"../runtime-fetch.js\";\nimport { registerBuiltins } from \"./builtin/index.js\";\nimport { getCatalogModelInfo, loadProviderCatalog, patchModelInfo } from \"./catalog-loader.js\";\nimport { catalogModelSchema } from \"./catalog-schema.js\";\nimport { getProviderProfile } from \"./registry.js\";\n\n/**\n * M44 — the OPTIONAL models.dev catalog source. Explicit opt-in ONLY (`refreshModelCatalog()`): the SDK\n * NEVER fetches at startup or per-request — the vendored catalog + any existing disk cache are the offline\n * base, and every failure mode fails CLOSED back to them (ROADMAP constraint: no runtime hard network dep).\n *\n * The models.dev consumption mechanism:\n * disk cache with mtime TTL, atomic tempfile+rename write, corrupt-cache delete-and-fall-through, kill-switch\n * env. Library adaptations: NO background refresh loop (a consumer composes refresh with the SDK's cron);\n * TTL 1h (not 5min — no background refresher to keep it warm); no cross-process flock v1 (atomic rename +\n * idempotent upstream content — at most one wasted fetch).\n *\n * @internal (the public surface is `refreshModelCatalog` re-exported via `@theokit/sdk/models`)\n */\n\nconst DEFAULT_URL = \"https://models.dev/api.json\";\n\n/**\n * Ceiling on a fetched catalog, before it is parsed or written to the cache.\n *\n * The response body was read with `res.text()` and persisted with no bound, so a host serving a\n * multi-gigabyte document would have been materialised in memory and then written to disk. The\n * default URL is trusted, but `THEOKIT_MODELS_URL` lets an operator point this anywhere, and a\n * limit is the difference between \"we only fetch from a host we trust\" and \"we cannot be hurt by\n * one we do not\".\n *\n * 32 MiB is roughly 40x the real catalog (~800 KiB in 2026-08), so it bounds the failure without\n * being a number anyone has to tune when models.dev grows.\n */\nconst MAX_CATALOG_BYTES = 32 * 1024 * 1024;\nconst TTL_MS = 60 * 60 * 1000; // 1 hour\nconst FETCH_TIMEOUT_MS = 10_000;\n\n/**\n * Arguments to `refreshModelCatalog`, the SDK's only network trigger for model metadata.\n *\n * `url` wins over the `THEOKIT_MODELS_URL` environment variable, which in turn wins over\n * `https://models.dev/api.json`. A non-default URL gets its own cache file, named by a hash of\n * the URL, so switching sources never reads another source's cache.\n *\n * `force` skips only the freshness check — it does not skip the kill switch. When\n * `THEOKIT_DISABLE_MODELS_FETCH` is set to anything other than an empty string, `\"0\"` or\n * `\"false\"`, the call returns `source: \"skipped\"` with no fetch and no cache read, whatever\n * `force` says.\n *\n * Without `force`, a cache file whose mtime is under an hour old is served directly and no\n * request is made.\n *\n * `deps` exists so tests can drive the fetch and the clock; production leaves it unset.\n */\nexport interface RefreshModelCatalogOptions {\n /** Override the source URL (`THEOKIT_MODELS_URL` env also honored). */\n url?: string;\n /** Bypass the TTL freshness gate. */\n force?: boolean;\n /** Injected for tests. */\n deps?: { fetch?: typeof fetch; now?: () => number };\n}\n\n/**\n * What `refreshModelCatalog` did. It never throws on a failed refresh, so this is the only place\n * the outcome is reported.\n *\n * `source` is `\"network\"` only when a request succeeded, its body parsed as JSON, and the models\n * were patched in. Every failure path — kill switch aside — returns `\"cache\"`: an HTTP error\n * after retries, a timeout, an unparseable body, or a patch that threw. `\"cache\"` therefore means\n * \"serving what was already there\", which may be a fresh cache, a stale one, or nothing but the\n * vendored catalog. Read `models` to tell those apart. `\"skipped\"` means the kill switch was set.\n *\n * `models` counts the models patched into the index during this call, not the catalog's size. It\n * counts each model once even when the provider has aliases and the model is written under several\n * index keys, and it excludes models whose payload failed schema validation and models under\n * providers the SDK does not know. It is 0 whenever there was no cache to fall back on, and 0 for\n * `\"skipped\"`.\n *\n * A cache write that fails is logged and otherwise ignored: the result can still say `\"network\"`\n * with the data live in memory and nothing on disk.\n */\nexport interface RefreshModelCatalogResult {\n /** Where the data came from: a fresh network fetch, the still-fresh disk cache, or skipped entirely. */\n source: \"network\" | \"cache\" | \"skipped\";\n /** How many models were patched into the index. */\n models: number;\n}\n\n/** The cache file for a source URL (custom URLs get a hash-suffixed name). */\nexport function cachePathFor(url: string): string {\n // M44 L8 fix — honor the SDK home override so tests and multi-home setups never touch the real ~/.theokit.\n const base = process.env.THEOKIT_HOME?.trim() || join(homedir(), \".theokit\");\n const dir = join(base, \"cache\", \"models-dev\");\n if (url === DEFAULT_URL) return join(dir, \"api.json\");\n const hash = createHash(\"sha256\").update(url).digest(\"hex\").slice(0, 12);\n return join(dir, `api-${hash}.json`);\n}\n\n/** Atomic write: temp file + rename (crash mid-write never leaves a partial cache). */\nfunction writeCacheAtomic(path: string, body: string): void {\n mkdirSync(dirname(path), { recursive: true });\n const tmp = `${path}.tmp-${randomBytes(6).toString(\"hex\")}`;\n try {\n writeFileSync(tmp, body);\n renameSync(tmp, path);\n } catch (err) {\n try {\n unlinkSync(tmp);\n } catch {\n // best effort\n }\n throw err;\n }\n}\n\n/**\n * M44 H3 fix — models.dev provider ids ≠ theokit ids (google↔google-gemini, zai↔zhipu, togetherai↔together,\n * fireworks-ai↔fireworks, amazon-bedrock↔bedrock, google-vertex↔vertex). The RUNTIME mapping mirrors the\n * maintenance script's table; targets resolve against the CATALOG entries (id + aliases — the same namespace\n * the vendored index uses) first, then the registry.\n */\nconst MODELS_DEV_ID_MAP: Record<string, string> = {\n google: \"google-gemini\",\n zai: \"zhipu\",\n togetherai: \"together\",\n \"fireworks-ai\": \"fireworks\",\n \"amazon-bedrock\": \"bedrock\",\n \"google-vertex\": \"vertex\",\n};\n\nlet _catalogTargets: Map<string, { keys: string[] }> | undefined;\n/** external-id → the index keys (entry id + aliases) its models patch under. Lazy; catalog-first. */\nfunction catalogTargets(): Map<string, { keys: string[] }> {\n if (_catalogTargets !== undefined) return _catalogTargets;\n _catalogTargets = new Map();\n try {\n for (const entry of Object.values(loadProviderCatalog())) {\n const keys = [entry.id, ...(entry.aliases ?? [])];\n for (const k of keys) {\n if (!_catalogTargets.has(k)) _catalogTargets.set(k, { keys });\n }\n }\n } catch {\n // catalog unavailable — registry fallback below still works\n }\n return _catalogTargets;\n}\n\nfunction resolvePatchKeys(externalId: string): string[] | undefined {\n const mapped = MODELS_DEV_ID_MAP[externalId] ?? externalId;\n const fromCatalog = catalogTargets().get(mapped);\n if (fromCatalog !== undefined) return fromCatalog.keys;\n const profile = getProviderProfile(mapped);\n if (profile !== undefined) return [profile.name, ...(profile.aliases ?? [])];\n return undefined;\n}\n\n/** Parse + patch the index from an api.json payload. Unknown providers are skipped with WARN (once each). */\n// PRE-EXISTING debt, exposed when M75 fixed the Biome config that used to abort before\n// sweeping these files (a nested root under refactor/). It is not new code and was not touched\n// by M75; refactoring SDK internals without review would trade a visible problem for a diff\n// risky. Tracked in usetheodev/theokit-sdk#151.\n// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: validates and merges an UNTRUSTED upstream payload (models.dev api.json) shape by shape, dropping a single bad model rather than the file. Each branch is a distinct malformed input; merging them loses which one was seen.\nfunction patchIndexFromApiJson(raw: unknown): number {\n if (typeof raw !== \"object\" || raw === null) return 0;\n let patched = 0;\n const skipped: string[] = [];\n for (const [providerId, provider] of Object.entries(raw as Record<string, unknown>)) {\n const models = (provider as { models?: Record<string, unknown> })?.models;\n if (models === undefined || typeof models !== \"object\") continue;\n // Enrich ONLY providers the SDK knows — models.dev's npm/api fields cannot be mapped to a theokit\n // apiMode/authType safely, so unknown providers are data we cannot route.\n const keys = resolvePatchKeys(providerId);\n if (keys === undefined) {\n skipped.push(providerId);\n continue;\n }\n for (const [modelId, rawModel] of Object.entries(models)) {\n const parsed = catalogModelSchema.safeParse(rawModel);\n if (!parsed.success) continue; // malformed model — drop silently (live data, additive drift expected)\n for (const key of keys) patchModelInfo(`${key}/${modelId}`, parsed.data);\n patched++;\n }\n }\n if (skipped.length > 0) {\n diag(\n `[theokit-sdk] WARN: models-dev refresh skipped ${skipped.length} unknown provider(s) (e.g. ${skipped.slice(0, 3).join(\", \")})\\n`,\n );\n }\n return patched;\n}\n\n/**\n * Load an existing disk cache into the index (called by refresh when fresh, or opportunistically by a\n * consumer at startup — NEVER fetches). Corrupt cache → delete + fall through to vendored data.\n */\nexport function loadCacheIntoIndex(url: string = DEFAULT_URL): number {\n const path = cachePathFor(url);\n let body: string;\n try {\n body = readFileSync(path, \"utf-8\");\n } catch {\n return 0; // no cache — vendored data only\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(body);\n } catch {\n // corrupt cache: delete and fall through to the vendored catalog.\n // M44 L9 fix — only a PARSE failure is cache corruption; a patch error must never delete a valid cache.\n try {\n unlinkSync(path);\n } catch {\n // best effort\n }\n diag(`[theokit-sdk] WARN: corrupt models-dev cache deleted (${path})\\n`);\n return 0;\n }\n try {\n return patchIndexFromApiJson(parsed);\n } catch (err) {\n diag(`[theokit-sdk] WARN: models-dev cache patch failed (${(err as Error).message})\\n`);\n return 0;\n }\n}\n\n/**\n * The kill switch, read from the environment.\n *\n * Truthy-only by design (M44 L11): a presence check would treat `THEOKIT_DISABLE_MODELS_FETCH=0`\n * and `=false` as \"disabled\", which is the opposite of what anyone writing them means.\n */\nfunction fetchDisabledByEnv(): boolean {\n const kill = process.env.THEOKIT_DISABLE_MODELS_FETCH;\n return kill !== undefined && kill !== \"\" && kill !== \"0\" && kill.toLowerCase() !== \"false\";\n}\n\n/**\n * The TTL gate: a cache file younger than {@link TTL_MS} serves without touching the network.\n *\n * Returns `undefined` when there is no usable cache — including when `statSync` throws, which is\n * how \"no cache file\" arrives. That is the ONE failure this step owns, and its fallback is simply\n * to let the caller proceed to the fetch.\n */\nfunction servedFromFreshCache(\n url: string,\n path: string,\n now: () => number,\n): RefreshModelCatalogResult | undefined {\n try {\n if (now() - statSync(path).mtimeMs >= TTL_MS) return undefined;\n } catch {\n return undefined; // no cache — proceed to fetch\n }\n return { source: \"cache\", models: loadCacheIntoIndex(url) };\n}\n\n/**\n * Fetch the catalog, bound its size, and prove it parses before anyone persists it.\n *\n * Returns `undefined` after logging when ANY of that fails — timeout, non-2xx, oversize, unparseable\n * body. The fallback this step owns is \"serve what we already have\", and the caller applies it.\n * Splitting the step from its fallback was the objection recorded in the suppression this replaces;\n * the fallback is not separated, it is named — `undefined` means \"this step could not produce a\n * body\", and there is exactly one thing to do about that.\n */\nasync function fetchCatalogBody(url: string, fetchImpl: typeof fetch): Promise<string | undefined> {\n try {\n const res = await Retry.run(\n async () => {\n const r = await fetchImpl(url, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });\n if (!r.ok) throw new Error(`HTTP ${r.status}`);\n return r;\n },\n // 2 transient retries with backoff; every error here is worth one more try —\n // the whole call is already fail-closed at the caller.\n { retries: 2, isRetryable: () => true, initialDelayMs: 200 },\n );\n const declaredLength = Number(res.headers.get(\"content-length\") ?? Number.NaN);\n if (Number.isFinite(declaredLength) && declaredLength > MAX_CATALOG_BYTES) {\n throw new Error(`catalog too large: ${declaredLength} bytes declared`);\n }\n const body = await res.text();\n // Checked again after reading: `content-length` is the server's claim, and a server that\n // omits it or lies about it is exactly the one worth bounding. Both checks are cheap and\n // neither alone is sufficient.\n if (body.length > MAX_CATALOG_BYTES) {\n throw new Error(`catalog too large: ${body.length} bytes received`);\n }\n JSON.parse(body); // validate before persisting — never cache garbage\n return body;\n } catch (err) {\n diag(\n `[theokit-sdk] WARN: models-dev refresh failed (${(err as Error).message}) — serving existing data\\n`,\n );\n return undefined;\n }\n}\n\n/**\n * Persist the fetched body and patch it into the index.\n *\n * Two independent failures with two different consequences, which is why they are two try blocks\n * and not one: a cache write that fails costs the NEXT process a fetch and nothing more, so the run\n * continues; a patch that fails means this body never reached the index, so the index is whatever it\n * was and the result says `cache`.\n */\nfunction persistAndPatch(path: string, body: string): RefreshModelCatalogResult {\n try {\n writeCacheAtomic(path, body);\n } catch (err) {\n diag(`[theokit-sdk] WARN: models-dev cache write failed (${(err as Error).message})\\n`);\n }\n try {\n return { source: \"network\", models: patchIndexFromApiJson(JSON.parse(body)) };\n } catch (err) {\n diag(\n `[theokit-sdk] WARN: models-dev patch failed (${(err as Error).message}) — serving existing data\\n`,\n );\n return { source: \"cache\", models: 0 };\n }\n}\n\n/**\n * Explicitly refresh the model catalog from models.dev (the ONLY network trigger in the subsystem).\n * Fail-closed: any failure keeps serving the current index (cache or vendored). Kill-switch:\n * `THEOKIT_DISABLE_MODELS_FETCH`.\n *\n * The sequence carried a cognitive-complexity suppression whose reason said splitting it would\n * \"separate a step from the fallback it owns\". The four helpers above each KEEP their fallback: the\n * TTL gate owns \"no cache\", the fetch owns every network and validation failure, the persist owns\n * the write and the patch. What is left here is the order they run in, which is what this function\n * was always for.\n *\n * Still true, and NOT fixed by the split: three of the paths return `{ source: \"cache\" }`, so a\n * caller cannot tell a timeout from an unparseable body from a patch failure. Distinguishing them\n * means adding a field to the PUBLIC `RefreshModelCatalogResult`, which is a release decision rather\n * than a refactor. The `diag` line already names the cause for an operator.\n */\nexport async function refreshModelCatalog(\n opts: RefreshModelCatalogOptions = {},\n): Promise<RefreshModelCatalogResult> {\n // M44 M4 fix — self-initialize provider registration so the `@theokit/sdk/models` subpath works\n // standalone (without the consumer having built an Agent first).\n registerBuiltins();\n if (fetchDisabledByEnv()) return { source: \"skipped\", models: 0 };\n\n const url = opts.url ?? process.env.THEOKIT_MODELS_URL ?? DEFAULT_URL;\n const path = cachePathFor(url);\n const now = opts.deps?.now ?? (() => Date.now());\n\n if (opts.force !== true) {\n const cached = servedFromFreshCache(url, path, now);\n if (cached !== undefined) return cached;\n }\n\n const body = await fetchCatalogBody(url, boundFetch(opts.deps?.fetch));\n // fail-closed: serve whatever we already have (stale cache if present, else vendored)\n if (body === undefined) return { source: \"cache\", models: loadCacheIntoIndex(url) };\n\n return persistAndPatch(path, body);\n}\n\n/** The enriched per-model view (public via `@theokit/sdk/models`): index lookup by (possibly prefixed) id. */\nexport function getModelInfo(modelId: string): ReturnType<typeof getCatalogModelInfo> {\n return getCatalogModelInfo(modelId);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/internal/llm/model-option.ts","../src/internal/providers/catalog-source-models-dev.ts"],"names":["parseModelId","join","homedir","createHash","mkdirSync","dirname","randomBytes","writeFileSync","renameSync","unlinkSync","loadProviderCatalog","getProviderProfile","catalogModelSchema","patchModelInfo","diag","readFileSync","statSync","Retry","registerBuiltins","boundFetch","getCatalogModelInfo"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,IAAM,QAAA,mBAAW,IAAI,GAAA,CAAI,CAAC,KAAA,EAAO,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,IAAI,CAAC,CAAA;AAE7E,SAAS,YAAY,KAAA,EAAuB;AAC1C,EAAA,IAAI,QAAA,CAAS,IAAI,KAAA,CAAM,WAAA,EAAa,CAAA,EAAG,OAAO,MAAM,WAAA,EAAY;AAChE,EAAA,OAAO,KAAA,CAAM,OAAO,CAAC,CAAA,CAAE,aAAY,GAAI,KAAA,CAAM,MAAM,CAAC,CAAA;AACtD;AAeO,SAAS,kBAAkB,OAAA,EAAyB;AACzD,EAAA,MAAM,EAAE,IAAA,EAAK,GAAIA,8BAAA,CAAa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AAO,aAAa,GAAG,CAAA;AAC7B,EAAA,MAAM,MAAM,IAAA,CAAK,IAAA,EAAM,GAAA,KAAQ,MAAM,KAAK,GAAA,EAAI,CAAA;AAE9C,EAAA,IAAI,IAAA,CAAK,UAAU,IAAA,EAAM;AACvB,IAAA,MAAM,MAAA,GAAS,oBAAA,CAAqB,GAAA,EAAK,IAAA,EAAM,GAAG,CAAA;AAClD,IAAA,IAAI,MAAA,KAAW,QAAW,OAAO,MAAA;AAAA,EACnC;AAEA,EAAA,MAAM,IAAA,GAAO,MAAM,gBAAA,CAAiB,GAAA,EAAKC,6BAAW,IAAA,CAAK,IAAA,EAAM,KAAK,CAAC,CAAA;AAErE,EAAA,IAAI,IAAA,KAAS,QAAW,OAAO,EAAE,QAAQ,OAAA,EAAS,MAAA,EAAQ,kBAAA,CAAmB,GAAG,CAAA,EAAE;AAElF,EAAA,OAAO,eAAA,CAAgB,MAAM,IAAI,CAAA;AACnC;AAGO,SAAS,aAAa,OAAA,EAAyD;AACpF,EAAA,OAAOC,sCAAoB,OAAO,CAAA;AACpC","file":"models.cjs","sourcesContent":["import { parseModelId } from \"./model-identifier.js\";\n\n/**\n * A UI-friendly model option — the shape a `<select>`/dropdown consumes.\n *\n * Public via `@theokit/sdk/models`.\n *\n * @public\n */\nexport interface ModelOption {\n /** The original model id (what you pass back to the SDK). */\n value: string;\n /** Best-effort human label (see {@link humanizeModelName}). */\n label: string;\n /** Provider from the slug prefix, or `undefined` when none. */\n provider: string | undefined;\n}\n\n/** Tokens rendered upper-case rather than title-case. */\nconst ACRONYMS = new Set([\"gpt\", \"ai\", \"hd\", \"ui\", \"api\", \"sdk\", \"llm\", \"xl\"]);\n\nfunction prettyToken(token: string): string {\n if (ACRONYMS.has(token.toLowerCase())) return token.toUpperCase();\n return token.charAt(0).toUpperCase() + token.slice(1);\n}\n\n/**\n * Turn a model id into a best-effort human label: strip the routing/vendor\n * prefix to the core model segment, split on `-`/`_`/`.`/whitespace, title-case\n * each token (known acronyms upper-cased), and append an OpenRouter `:variant`\n * in parentheses. Deterministic, pure, dependency-free.\n *\n * Best-effort, NOT vendor-canonical: `\"anthropic/claude-3-5-sonnet\"` →\n * `\"Claude 3 5 Sonnet\"`. A UI wanting exact marketing names overrides per id.\n *\n * Public via `@theokit/sdk/models`.\n *\n * @public\n */\nexport function humanizeModelName(modelId: string): string {\n const { name } = parseModelId(modelId);\n if (name.length === 0) return \"\";\n const colon = name.indexOf(\":\");\n // Strip a trailing slash so a typo'd `gpt-4o/` keeps its name (not lost to an\n // empty last segment).\n //\n // Done by index rather than with `/\\/+$/`, and the difference is not stylistic: that pattern\n // consumes slashes to the end of the string at every start position and then backtracks\n // looking for an end-anchor that is not there (CodeQL js/polynomial-redos #6). This function\n // is `@public` and takes a caller-supplied model id. Measured on a run of slashes followed by\n // one other character: 25_000 took 496 ms, 100_000 took 31_305 ms — half a minute of pinned\n // CPU to render a label. Walking back from the end is linear and cannot backtrack.\n const base = trimTrailingSlashes(colon >= 0 ? name.slice(0, colon) : name);\n const variant = colon >= 0 ? name.slice(colon + 1) : \"\";\n const lastSlash = base.lastIndexOf(\"/\");\n const core = lastSlash >= 0 ? base.slice(lastSlash + 1) : base;\n const label = core\n .split(/[-_.\\s]+/)\n .filter((t) => t.length > 0)\n .map(prettyToken)\n .join(\" \");\n if (label.length === 0) return variant; // no base label (e.g. \":free\") → bare variant\n return variant.length > 0 ? `${label} (${variant})` : label;\n}\n\n/**\n * Build a {@link ModelOption} (`{ value, label, provider }`) for a model id —\n * a dropdown-ready entry composing {@link humanizeModelName} + `parseModelId`.\n *\n * Public via `@theokit/sdk/models`.\n *\n * @public\n */\nexport function toModelOption(modelId: string): ModelOption {\n return {\n value: modelId,\n label: humanizeModelName(modelId),\n provider: parseModelId(modelId).provider,\n };\n}\n\nconst SLASH_CODE = 47; // \"/\"\n\n/** Removes trailing `/` characters in one linear pass. See the call site for why not a regex. */\nfunction trimTrailingSlashes(value: string): string {\n let end = value.length;\n while (end > 0 && value.charCodeAt(end - 1) === SLASH_CODE) end--;\n return end === value.length ? value : value.slice(0, end);\n}\n","import { createHash, randomBytes } from \"node:crypto\";\nimport { mkdirSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\n\nimport { Retry } from \"../../retry.js\";\nimport { diag } from \"../diagnostics.js\";\nimport { boundFetch } from \"../runtime-fetch.js\";\nimport { registerBuiltins } from \"./builtin/index.js\";\nimport { getCatalogModelInfo, loadProviderCatalog, patchModelInfo } from \"./catalog-loader.js\";\nimport { catalogModelSchema } from \"./catalog-schema.js\";\nimport { getProviderProfile } from \"./registry.js\";\n\n/**\n * M44 — the OPTIONAL models.dev catalog source. Explicit opt-in ONLY (`refreshModelCatalog()`): the SDK\n * NEVER fetches at startup or per-request — the vendored catalog + any existing disk cache are the offline\n * base, and every failure mode fails CLOSED back to them (ROADMAP constraint: no runtime hard network dep).\n *\n * The models.dev consumption mechanism:\n * disk cache with mtime TTL, atomic tempfile+rename write, corrupt-cache delete-and-fall-through, kill-switch\n * env. Library adaptations: NO background refresh loop (a consumer composes refresh with the SDK's cron);\n * TTL 1h (not 5min — no background refresher to keep it warm); no cross-process flock v1 (atomic rename +\n * idempotent upstream content — at most one wasted fetch).\n *\n * @internal (the public surface is `refreshModelCatalog` re-exported via `@theokit/sdk/models`)\n */\n\nconst DEFAULT_URL = \"https://models.dev/api.json\";\n\n/**\n * Ceiling on a fetched catalog, before it is parsed or written to the cache.\n *\n * The response body was read with `res.text()` and persisted with no bound, so a host serving a\n * multi-gigabyte document would have been materialised in memory and then written to disk. The\n * default URL is trusted, but `THEOKIT_MODELS_URL` lets an operator point this anywhere, and a\n * limit is the difference between \"we only fetch from a host we trust\" and \"we cannot be hurt by\n * one we do not\".\n *\n * 32 MiB is roughly 40x the real catalog (~800 KiB in 2026-08), so it bounds the failure without\n * being a number anyone has to tune when models.dev grows.\n */\nconst MAX_CATALOG_BYTES = 32 * 1024 * 1024;\nconst TTL_MS = 60 * 60 * 1000; // 1 hour\nconst FETCH_TIMEOUT_MS = 10_000;\n\n/**\n * Arguments to `refreshModelCatalog`, the SDK's only network trigger for model metadata.\n *\n * `url` wins over the `THEOKIT_MODELS_URL` environment variable, which in turn wins over\n * `https://models.dev/api.json`. A non-default URL gets its own cache file, named by a hash of\n * the URL, so switching sources never reads another source's cache.\n *\n * `force` skips only the freshness check — it does not skip the kill switch. When\n * `THEOKIT_DISABLE_MODELS_FETCH` is set to anything other than an empty string, `\"0\"` or\n * `\"false\"`, the call returns `source: \"skipped\"` with no fetch and no cache read, whatever\n * `force` says.\n *\n * Without `force`, a cache file whose mtime is under an hour old is served directly and no\n * request is made.\n *\n * `deps` exists so tests can drive the fetch and the clock; production leaves it unset.\n */\nexport interface RefreshModelCatalogOptions {\n /** Override the source URL (`THEOKIT_MODELS_URL` env also honored). */\n url?: string;\n /** Bypass the TTL freshness gate. */\n force?: boolean;\n /** Injected for tests. */\n deps?: { fetch?: typeof fetch; now?: () => number };\n}\n\n/**\n * What `refreshModelCatalog` did. It never throws on a failed refresh, so this is the only place\n * the outcome is reported.\n *\n * `source` is `\"network\"` only when a request succeeded, its body parsed as JSON, and the models\n * were patched in. Every failure path — kill switch aside — returns `\"cache\"`: an HTTP error\n * after retries, a timeout, an unparseable body, or a patch that threw. `\"cache\"` therefore means\n * \"serving what was already there\", which may be a fresh cache, a stale one, or nothing but the\n * vendored catalog. Read `models` to tell those apart. `\"skipped\"` means the kill switch was set.\n *\n * `models` counts the models patched into the index during this call, not the catalog's size. It\n * counts each model once even when the provider has aliases and the model is written under several\n * index keys, and it excludes models whose payload failed schema validation and models under\n * providers the SDK does not know. It is 0 whenever there was no cache to fall back on, and 0 for\n * `\"skipped\"`.\n *\n * A cache write that fails is logged and otherwise ignored: the result can still say `\"network\"`\n * with the data live in memory and nothing on disk.\n */\nexport interface RefreshModelCatalogResult {\n /** Where the data came from: a fresh network fetch, the still-fresh disk cache, or skipped entirely. */\n source: \"network\" | \"cache\" | \"skipped\";\n /** How many models were patched into the index. */\n models: number;\n}\n\n/** The cache file for a source URL (custom URLs get a hash-suffixed name). */\nexport function cachePathFor(url: string): string {\n // M44 L8 fix — honor the SDK home override so tests and multi-home setups never touch the real ~/.theokit.\n const base = process.env.THEOKIT_HOME?.trim() || join(homedir(), \".theokit\");\n const dir = join(base, \"cache\", \"models-dev\");\n if (url === DEFAULT_URL) return join(dir, \"api.json\");\n const hash = createHash(\"sha256\").update(url).digest(\"hex\").slice(0, 12);\n return join(dir, `api-${hash}.json`);\n}\n\n/** Atomic write: temp file + rename (crash mid-write never leaves a partial cache). */\nfunction writeCacheAtomic(path: string, body: string): void {\n mkdirSync(dirname(path), { recursive: true });\n const tmp = `${path}.tmp-${randomBytes(6).toString(\"hex\")}`;\n try {\n writeFileSync(tmp, body);\n renameSync(tmp, path);\n } catch (err) {\n try {\n unlinkSync(tmp);\n } catch {\n // best effort\n }\n throw err;\n }\n}\n\n/**\n * M44 H3 fix — models.dev provider ids ≠ theokit ids (google↔google-gemini, zai↔zhipu, togetherai↔together,\n * fireworks-ai↔fireworks, amazon-bedrock↔bedrock, google-vertex↔vertex). The RUNTIME mapping mirrors the\n * maintenance script's table; targets resolve against the CATALOG entries (id + aliases — the same namespace\n * the vendored index uses) first, then the registry.\n */\nconst MODELS_DEV_ID_MAP: Record<string, string> = {\n google: \"google-gemini\",\n zai: \"zhipu\",\n togetherai: \"together\",\n \"fireworks-ai\": \"fireworks\",\n \"amazon-bedrock\": \"bedrock\",\n \"google-vertex\": \"vertex\",\n};\n\nlet _catalogTargets: Map<string, { keys: string[] }> | undefined;\n/** external-id → the index keys (entry id + aliases) its models patch under. Lazy; catalog-first. */\nfunction catalogTargets(): Map<string, { keys: string[] }> {\n if (_catalogTargets !== undefined) return _catalogTargets;\n _catalogTargets = new Map();\n try {\n for (const entry of Object.values(loadProviderCatalog())) {\n const keys = [entry.id, ...(entry.aliases ?? [])];\n for (const k of keys) {\n if (!_catalogTargets.has(k)) _catalogTargets.set(k, { keys });\n }\n }\n } catch {\n // catalog unavailable — registry fallback below still works\n }\n return _catalogTargets;\n}\n\nfunction resolvePatchKeys(externalId: string): string[] | undefined {\n const mapped = MODELS_DEV_ID_MAP[externalId] ?? externalId;\n const fromCatalog = catalogTargets().get(mapped);\n if (fromCatalog !== undefined) return fromCatalog.keys;\n const profile = getProviderProfile(mapped);\n if (profile !== undefined) return [profile.name, ...(profile.aliases ?? [])];\n return undefined;\n}\n\n/** Parse + patch the index from an api.json payload. Unknown providers are skipped with WARN (once each). */\n// PRE-EXISTING debt, exposed when M75 fixed the Biome config that used to abort before\n// sweeping these files (a nested root under refactor/). It is not new code and was not touched\n// by M75; refactoring SDK internals without review would trade a visible problem for a diff\n// risky. Tracked in usetheodev/theokit-sdk#151.\n// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: validates and merges an UNTRUSTED upstream payload (models.dev api.json) shape by shape, dropping a single bad model rather than the file. Each branch is a distinct malformed input; merging them loses which one was seen.\nfunction patchIndexFromApiJson(raw: unknown): number {\n if (typeof raw !== \"object\" || raw === null) return 0;\n let patched = 0;\n const skipped: string[] = [];\n for (const [providerId, provider] of Object.entries(raw as Record<string, unknown>)) {\n const models = (provider as { models?: Record<string, unknown> })?.models;\n if (models === undefined || typeof models !== \"object\") continue;\n // Enrich ONLY providers the SDK knows — models.dev's npm/api fields cannot be mapped to a theokit\n // apiMode/authType safely, so unknown providers are data we cannot route.\n const keys = resolvePatchKeys(providerId);\n if (keys === undefined) {\n skipped.push(providerId);\n continue;\n }\n for (const [modelId, rawModel] of Object.entries(models)) {\n const parsed = catalogModelSchema.safeParse(rawModel);\n if (!parsed.success) continue; // malformed model — drop silently (live data, additive drift expected)\n for (const key of keys) patchModelInfo(`${key}/${modelId}`, parsed.data);\n patched++;\n }\n }\n if (skipped.length > 0) {\n diag(\n `[theokit-sdk] WARN: models-dev refresh skipped ${skipped.length} unknown provider(s) (e.g. ${skipped.slice(0, 3).join(\", \")})\\n`,\n );\n }\n return patched;\n}\n\n/**\n * Load an existing disk cache into the index (called by refresh when fresh, or opportunistically by a\n * consumer at startup — NEVER fetches). Corrupt cache → delete + fall through to vendored data.\n */\nexport function loadCacheIntoIndex(url: string = DEFAULT_URL): number {\n const path = cachePathFor(url);\n let body: string;\n try {\n body = readFileSync(path, \"utf-8\");\n } catch {\n return 0; // no cache — vendored data only\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(body);\n } catch {\n // corrupt cache: delete and fall through to the vendored catalog.\n // M44 L9 fix — only a PARSE failure is cache corruption; a patch error must never delete a valid cache.\n try {\n unlinkSync(path);\n } catch {\n // best effort\n }\n diag(`[theokit-sdk] WARN: corrupt models-dev cache deleted (${path})\\n`);\n return 0;\n }\n try {\n return patchIndexFromApiJson(parsed);\n } catch (err) {\n diag(`[theokit-sdk] WARN: models-dev cache patch failed (${(err as Error).message})\\n`);\n return 0;\n }\n}\n\n/**\n * The kill switch, read from the environment.\n *\n * Truthy-only by design (M44 L11): a presence check would treat `THEOKIT_DISABLE_MODELS_FETCH=0`\n * and `=false` as \"disabled\", which is the opposite of what anyone writing them means.\n */\nfunction fetchDisabledByEnv(): boolean {\n const kill = process.env.THEOKIT_DISABLE_MODELS_FETCH;\n return kill !== undefined && kill !== \"\" && kill !== \"0\" && kill.toLowerCase() !== \"false\";\n}\n\n/**\n * The TTL gate: a cache file younger than {@link TTL_MS} serves without touching the network.\n *\n * Returns `undefined` when there is no usable cache — including when `statSync` throws, which is\n * how \"no cache file\" arrives. That is the ONE failure this step owns, and its fallback is simply\n * to let the caller proceed to the fetch.\n */\nfunction servedFromFreshCache(\n url: string,\n path: string,\n now: () => number,\n): RefreshModelCatalogResult | undefined {\n try {\n if (now() - statSync(path).mtimeMs >= TTL_MS) return undefined;\n } catch {\n return undefined; // no cache — proceed to fetch\n }\n return { source: \"cache\", models: loadCacheIntoIndex(url) };\n}\n\n/**\n * Fetch the catalog, bound its size, and prove it parses before anyone persists it.\n *\n * Returns `undefined` after logging when ANY of that fails — timeout, non-2xx, oversize, unparseable\n * body. The fallback this step owns is \"serve what we already have\", and the caller applies it.\n * Splitting the step from its fallback was the objection recorded in the suppression this replaces;\n * the fallback is not separated, it is named — `undefined` means \"this step could not produce a\n * body\", and there is exactly one thing to do about that.\n */\nasync function fetchCatalogBody(url: string, fetchImpl: typeof fetch): Promise<string | undefined> {\n try {\n const res = await Retry.run(\n async () => {\n const r = await fetchImpl(url, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });\n if (!r.ok) throw new Error(`HTTP ${r.status}`);\n return r;\n },\n // 2 transient retries with backoff; every error here is worth one more try —\n // the whole call is already fail-closed at the caller.\n { retries: 2, isRetryable: () => true, initialDelayMs: 200 },\n );\n const declaredLength = Number(res.headers.get(\"content-length\") ?? Number.NaN);\n if (Number.isFinite(declaredLength) && declaredLength > MAX_CATALOG_BYTES) {\n throw new Error(`catalog too large: ${declaredLength} bytes declared`);\n }\n const body = await res.text();\n // Checked again after reading: `content-length` is the server's claim, and a server that\n // omits it or lies about it is exactly the one worth bounding. Both checks are cheap and\n // neither alone is sufficient.\n if (body.length > MAX_CATALOG_BYTES) {\n throw new Error(`catalog too large: ${body.length} bytes received`);\n }\n JSON.parse(body); // validate before persisting — never cache garbage\n return body;\n } catch (err) {\n diag(\n `[theokit-sdk] WARN: models-dev refresh failed (${(err as Error).message}) — serving existing data\\n`,\n );\n return undefined;\n }\n}\n\n/**\n * Persist the fetched body and patch it into the index.\n *\n * Two independent failures with two different consequences, which is why they are two try blocks\n * and not one: a cache write that fails costs the NEXT process a fetch and nothing more, so the run\n * continues; a patch that fails means this body never reached the index, so the index is whatever it\n * was and the result says `cache`.\n */\nfunction persistAndPatch(path: string, body: string): RefreshModelCatalogResult {\n try {\n writeCacheAtomic(path, body);\n } catch (err) {\n diag(`[theokit-sdk] WARN: models-dev cache write failed (${(err as Error).message})\\n`);\n }\n try {\n return { source: \"network\", models: patchIndexFromApiJson(JSON.parse(body)) };\n } catch (err) {\n diag(\n `[theokit-sdk] WARN: models-dev patch failed (${(err as Error).message}) — serving existing data\\n`,\n );\n return { source: \"cache\", models: 0 };\n }\n}\n\n/**\n * Explicitly refresh the model catalog from models.dev (the ONLY network trigger in the subsystem).\n * Fail-closed: any failure keeps serving the current index (cache or vendored). Kill-switch:\n * `THEOKIT_DISABLE_MODELS_FETCH`.\n *\n * The sequence carried a cognitive-complexity suppression whose reason said splitting it would\n * \"separate a step from the fallback it owns\". The four helpers above each KEEP their fallback: the\n * TTL gate owns \"no cache\", the fetch owns every network and validation failure, the persist owns\n * the write and the patch. What is left here is the order they run in, which is what this function\n * was always for.\n *\n * Still true, and NOT fixed by the split: three of the paths return `{ source: \"cache\" }`, so a\n * caller cannot tell a timeout from an unparseable body from a patch failure. Distinguishing them\n * means adding a field to the PUBLIC `RefreshModelCatalogResult`, which is a release decision rather\n * than a refactor. The `diag` line already names the cause for an operator.\n */\nexport async function refreshModelCatalog(\n opts: RefreshModelCatalogOptions = {},\n): Promise<RefreshModelCatalogResult> {\n // M44 M4 fix — self-initialize provider registration so the `@theokit/sdk/models` subpath works\n // standalone (without the consumer having built an Agent first).\n registerBuiltins();\n if (fetchDisabledByEnv()) return { source: \"skipped\", models: 0 };\n\n const url = opts.url ?? process.env.THEOKIT_MODELS_URL ?? DEFAULT_URL;\n const path = cachePathFor(url);\n const now = opts.deps?.now ?? (() => Date.now());\n\n if (opts.force !== true) {\n const cached = servedFromFreshCache(url, path, now);\n if (cached !== undefined) return cached;\n }\n\n const body = await fetchCatalogBody(url, boundFetch(opts.deps?.fetch));\n // fail-closed: serve whatever we already have (stale cache if present, else vendored)\n if (body === undefined) return { source: \"cache\", models: loadCacheIntoIndex(url) };\n\n return persistAndPatch(path, body);\n}\n\n/** The enriched per-model view (public via `@theokit/sdk/models`): index lookup by (possibly prefixed) id. */\nexport function getModelInfo(modelId: string): ReturnType<typeof getCatalogModelInfo> {\n return getCatalogModelInfo(modelId);\n}\n"]}
|
package/dist/models.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Retry } from './chunk-2S4HQCDF.js';
|
|
2
|
-
export { resolveModelCapabilities } from './chunk-
|
|
2
|
+
export { resolveModelCapabilities } from './chunk-CMDM4VF6.js';
|
|
3
3
|
import { parseModelId } from './chunk-R7WIIPUR.js';
|
|
4
4
|
export { parseModelId } from './chunk-R7WIIPUR.js';
|
|
5
|
-
import { registerBuiltins, getCatalogModelInfo, catalogModelSchema, patchModelInfo, getProviderProfile, loadProviderCatalog } from './chunk-
|
|
5
|
+
import { registerBuiltins, getCatalogModelInfo, catalogModelSchema, patchModelInfo, getProviderProfile, loadProviderCatalog } from './chunk-5L7S2VOL.js';
|
|
6
6
|
import './chunk-AGACYRJ2.js';
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
7
|
+
import './chunk-UNP4NCMZ.js';
|
|
8
|
+
import './chunk-L2KC2G7H.js';
|
|
9
9
|
import './chunk-5IUDICRK.js';
|
|
10
10
|
import { boundFetch } from './chunk-Q7GYMXVC.js';
|
|
11
11
|
import './chunk-TNFOU6SB.js';
|
|
12
12
|
import { diag } from './chunk-3OY6H3I7.js';
|
|
13
|
-
import { createHash, randomBytes } from 'crypto';
|
|
14
|
-
import { statSync, readFileSync, unlinkSync, mkdirSync, writeFileSync, renameSync } from 'fs';
|
|
15
|
-
import { homedir } from 'os';
|
|
16
|
-
import { join, dirname } from 'path';
|
|
13
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
14
|
+
import { statSync, readFileSync, unlinkSync, mkdirSync, writeFileSync, renameSync } from 'node:fs';
|
|
15
|
+
import { homedir } from 'node:os';
|
|
16
|
+
import { join, dirname } from 'node:path';
|
|
17
17
|
|
|
18
18
|
// src/internal/llm/model-option.ts
|
|
19
19
|
var ACRONYMS = /* @__PURE__ */ new Set(["gpt", "ai", "hd", "ui", "api", "sdk", "llm", "xl"]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { AuthSecretTooShortError, COOKIE_NAME, __TESTING__deriveKey, clearTransaction, encodeTransaction, getTransaction, newTransaction } from './chunk-
|
|
1
|
+
export { AuthSecretTooShortError, COOKIE_NAME, __TESTING__deriveKey, clearTransaction, encodeTransaction, getTransaction, newTransaction } from './chunk-DBH2WA2U.js';
|
|
2
2
|
import './chunk-TNFOU6SB.js';
|
|
3
3
|
import './chunk-3OY6H3I7.js';
|
|
4
|
-
//# sourceMappingURL=oauth-transaction-store-
|
|
5
|
-
//# sourceMappingURL=oauth-transaction-store-
|
|
4
|
+
//# sourceMappingURL=oauth-transaction-store-QQBWGNE2.js.map
|
|
5
|
+
//# sourceMappingURL=oauth-transaction-store-QQBWGNE2.js.map
|
package/dist/{oauth-transaction-store-U34YLEGP.js.map → oauth-transaction-store-QQBWGNE2.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"oauth-transaction-store-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"oauth-transaction-store-QQBWGNE2.js"}
|