@theokit/sdk 5.11.0 → 5.12.0
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 +110 -0
- package/dist/a2a/index.cjs +8 -8
- package/dist/a2a/index.js +3 -3
- package/dist/agent-BVKIUP7F.cjs +71 -0
- package/dist/{agent-5DOR5T3E.cjs.map → agent-BVKIUP7F.cjs.map} +1 -1
- package/dist/{agent-XMkGzff_.d.cts → agent-CVzDy_Oj.d.ts} +17 -8
- package/dist/{agent-CmKwSyyD.d.ts → agent-Cn0sphpA.d.cts} +17 -8
- package/dist/agent-IG7BP6GN.js +62 -0
- package/dist/{agent-GWKRARAL.js.map → agent-IG7BP6GN.js.map} +1 -1
- package/dist/agent-prims-CZyxfCmS.d.cts +206 -0
- package/dist/agent-prims-CZyxfCmS.d.ts +206 -0
- package/dist/agent-session-store-22GKA7O4.js +6 -0
- package/dist/{agent-session-store-ODD3IZCW.js.map → agent-session-store-22GKA7O4.js.map} +1 -1
- package/dist/agent-session-store-WP6NGDVX.cjs +23 -0
- package/dist/{agent-session-store-SVEJHSUA.cjs.map → agent-session-store-WP6NGDVX.cjs.map} +1 -1
- package/dist/auth/index.cjs +33 -33
- package/dist/auth/index.js +6 -6
- package/dist/{batch-427O54FQ.js → batch-EP3FCL6D.js} +9 -9
- package/dist/{batch-427O54FQ.js.map → batch-EP3FCL6D.js.map} +1 -1
- package/dist/{batch-U4SO4RLX.cjs → batch-IZ5EDKJ5.cjs} +29 -29
- package/dist/{batch-U4SO4RLX.cjs.map → batch-IZ5EDKJ5.cjs.map} +1 -1
- package/dist/{chunk-IIYJMXYW.cjs → chunk-27V5I2WW.cjs} +4 -4
- package/dist/{chunk-IIYJMXYW.cjs.map → chunk-27V5I2WW.cjs.map} +1 -1
- package/dist/{chunk-DPY2M74T.js → chunk-2C24NSNV.js} +5 -5
- package/dist/{chunk-DPY2M74T.js.map → chunk-2C24NSNV.js.map} +1 -1
- package/dist/{chunk-7F7XE6CM.js → chunk-2S4HQCDF.js} +3 -3
- package/dist/{chunk-7F7XE6CM.js.map → chunk-2S4HQCDF.js.map} +1 -1
- package/dist/{chunk-LZJXEPEQ.js → chunk-2SFLLOMN.js} +3 -3
- package/dist/{chunk-LZJXEPEQ.js.map → chunk-2SFLLOMN.js.map} +1 -1
- package/dist/{chunk-RGQICWFU.js → chunk-354F3OF5.js} +3 -3
- package/dist/{chunk-RGQICWFU.js.map → chunk-354F3OF5.js.map} +1 -1
- package/dist/{chunk-TX56N7FR.js → chunk-3FSBE4PS.js} +4 -4
- package/dist/{chunk-TX56N7FR.js.map → chunk-3FSBE4PS.js.map} +1 -1
- package/dist/{chunk-RQMCOFAI.cjs → chunk-3HA7N2BB.cjs} +8 -8
- package/dist/{chunk-RQMCOFAI.cjs.map → chunk-3HA7N2BB.cjs.map} +1 -1
- package/dist/{chunk-GM54F4FE.cjs → chunk-3KIUY67P.cjs} +9 -9
- package/dist/{chunk-GM54F4FE.cjs.map → chunk-3KIUY67P.cjs.map} +1 -1
- package/dist/{chunk-CZJ6Q7CW.js → chunk-3OY6H3I7.js} +66 -7
- package/dist/chunk-3OY6H3I7.js.map +1 -0
- package/dist/{chunk-ZWACQM5U.cjs → chunk-3WKWBYPO.cjs} +9 -9
- package/dist/{chunk-ZWACQM5U.cjs.map → chunk-3WKWBYPO.cjs.map} +1 -1
- package/dist/{chunk-7Y23B7XX.js → chunk-4GUFNDZR.js} +5 -5
- package/dist/{chunk-7Y23B7XX.js.map → chunk-4GUFNDZR.js.map} +1 -1
- package/dist/{chunk-XDUGSTYJ.cjs → chunk-4YD2WI57.cjs} +15 -15
- package/dist/{chunk-XDUGSTYJ.cjs.map → chunk-4YD2WI57.cjs.map} +1 -1
- package/dist/{chunk-SKDNCTXG.cjs → chunk-5A4UFBHW.cjs} +15 -15
- package/dist/{chunk-SKDNCTXG.cjs.map → chunk-5A4UFBHW.cjs.map} +1 -1
- package/dist/{chunk-SUVCHX4L.js → chunk-5AR6O7GW.js} +3 -3
- package/dist/{chunk-SUVCHX4L.js.map → chunk-5AR6O7GW.js.map} +1 -1
- package/dist/{chunk-SVCPJRUB.js → chunk-5HSMH2ZZ.js} +6 -6
- package/dist/{chunk-SVCPJRUB.js.map → chunk-5HSMH2ZZ.js.map} +1 -1
- package/dist/{chunk-GTX6FEDP.js → chunk-5IRDK5BC.js} +3 -3
- package/dist/{chunk-GTX6FEDP.js.map → chunk-5IRDK5BC.js.map} +1 -1
- package/dist/{chunk-H3CVJSFC.js → chunk-5IUDICRK.js} +3 -3
- package/dist/{chunk-H3CVJSFC.js.map → chunk-5IUDICRK.js.map} +1 -1
- package/dist/{chunk-FYEHYQ7T.cjs → chunk-6CXRYPG7.cjs} +15 -15
- package/dist/{chunk-FYEHYQ7T.cjs.map → chunk-6CXRYPG7.cjs.map} +1 -1
- package/dist/{chunk-NQVWSSX2.cjs → chunk-6OCJWGVD.cjs} +12 -12
- package/dist/{chunk-NQVWSSX2.cjs.map → chunk-6OCJWGVD.cjs.map} +1 -1
- package/dist/{chunk-MPR2ISL2.cjs → chunk-6XQLTQB6.cjs} +4 -4
- package/dist/{chunk-MPR2ISL2.cjs.map → chunk-6XQLTQB6.cjs.map} +1 -1
- package/dist/{chunk-72CPLZPC.cjs → chunk-7INPXUJI.cjs} +5 -5
- package/dist/{chunk-72CPLZPC.cjs.map → chunk-7INPXUJI.cjs.map} +1 -1
- package/dist/{chunk-HG5LKFG7.cjs → chunk-7WARNHWW.cjs} +16 -16
- package/dist/{chunk-HG5LKFG7.cjs.map → chunk-7WARNHWW.cjs.map} +1 -1
- package/dist/{chunk-KIKKTW5O.cjs → chunk-7YUPSBDV.cjs} +4 -4
- package/dist/{chunk-KIKKTW5O.cjs.map → chunk-7YUPSBDV.cjs.map} +1 -1
- package/dist/{chunk-IZDDSLL2.js → chunk-AB4OPJLD.js} +6 -6
- package/dist/{chunk-IZDDSLL2.js.map → chunk-AB4OPJLD.js.map} +1 -1
- package/dist/{chunk-XERM7PDQ.js → chunk-AGO5S5WD.js} +3 -3
- package/dist/{chunk-XERM7PDQ.js.map → chunk-AGO5S5WD.js.map} +1 -1
- package/dist/{chunk-ZWFTECOE.js → chunk-AHKS3DKI.js} +3 -3
- package/dist/{chunk-ZWFTECOE.js.map → chunk-AHKS3DKI.js.map} +1 -1
- package/dist/{chunk-ECD6ER3E.cjs → chunk-AIZ6WXSL.cjs} +4 -4
- package/dist/{chunk-ECD6ER3E.cjs.map → chunk-AIZ6WXSL.cjs.map} +1 -1
- package/dist/{chunk-KO6SHCEH.js → chunk-AQW54OWQ.js} +3 -3
- package/dist/{chunk-KO6SHCEH.js.map → chunk-AQW54OWQ.js.map} +1 -1
- package/dist/{chunk-P22BZE7G.cjs → chunk-AT2PESXB.cjs} +7 -7
- package/dist/{chunk-P22BZE7G.cjs.map → chunk-AT2PESXB.cjs.map} +1 -1
- package/dist/{chunk-4PHSVR2R.js → chunk-BJ7BPLQK.js} +207 -108
- package/dist/chunk-BJ7BPLQK.js.map +1 -0
- package/dist/{chunk-HV4V63CO.js → chunk-BO3PV3OP.js} +4 -4
- package/dist/{chunk-HV4V63CO.js.map → chunk-BO3PV3OP.js.map} +1 -1
- package/dist/{chunk-7NQ7HJ3E.cjs → chunk-BRWI4HLK.cjs} +6 -6
- package/dist/{chunk-7NQ7HJ3E.cjs.map → chunk-BRWI4HLK.cjs.map} +1 -1
- package/dist/{chunk-GHHIJEFX.cjs → chunk-BWYC7RZG.cjs} +9 -9
- package/dist/{chunk-GHHIJEFX.cjs.map → chunk-BWYC7RZG.cjs.map} +1 -1
- package/dist/{chunk-UNFBHV46.cjs → chunk-CEGU5AVD.cjs} +9 -9
- package/dist/chunk-CEGU5AVD.cjs.map +1 -0
- package/dist/{chunk-YEHQ3SIC.cjs → chunk-CGH4BCIY.cjs} +11 -11
- package/dist/{chunk-YEHQ3SIC.cjs.map → chunk-CGH4BCIY.cjs.map} +1 -1
- package/dist/{chunk-L3C6CCBG.cjs → chunk-CWQPQTUZ.cjs} +21 -21
- package/dist/{chunk-L3C6CCBG.cjs.map → chunk-CWQPQTUZ.cjs.map} +1 -1
- package/dist/{chunk-X3LOJJMO.js → chunk-DF77RBF4.js} +9 -9
- package/dist/{chunk-X3LOJJMO.js.map → chunk-DF77RBF4.js.map} +1 -1
- package/dist/{chunk-GMSRRJ53.js → chunk-EEK7S77K.js} +3 -3
- package/dist/{chunk-GMSRRJ53.js.map → chunk-EEK7S77K.js.map} +1 -1
- package/dist/{chunk-NKIQTLFA.cjs → chunk-EQ5IDL6W.cjs} +4 -4
- package/dist/{chunk-NKIQTLFA.cjs.map → chunk-EQ5IDL6W.cjs.map} +1 -1
- package/dist/{chunk-D5KXKBEN.cjs → chunk-FEAWEBWN.cjs} +5 -5
- package/dist/{chunk-D5KXKBEN.cjs.map → chunk-FEAWEBWN.cjs.map} +1 -1
- package/dist/{chunk-NJSIAJEK.cjs → chunk-FLDMPVUC.cjs} +4 -4
- package/dist/{chunk-NJSIAJEK.cjs.map → chunk-FLDMPVUC.cjs.map} +1 -1
- package/dist/{chunk-ASK2OQM5.cjs → chunk-G7XBVM3T.cjs} +5 -5
- package/dist/{chunk-ASK2OQM5.cjs.map → chunk-G7XBVM3T.cjs.map} +1 -1
- package/dist/{chunk-HI3W37FY.js → chunk-H7G65PNI.js} +5 -5
- package/dist/{chunk-HI3W37FY.js.map → chunk-H7G65PNI.js.map} +1 -1
- package/dist/{chunk-JW3GVLM6.cjs → chunk-H7HD6RXO.cjs} +4 -4
- package/dist/{chunk-JW3GVLM6.cjs.map → chunk-H7HD6RXO.cjs.map} +1 -1
- package/dist/{chunk-ZHWKT2NI.js → chunk-HJ2LV464.js} +3 -3
- package/dist/{chunk-ZHWKT2NI.js.map → chunk-HJ2LV464.js.map} +1 -1
- package/dist/{chunk-KGZ66JVZ.cjs → chunk-HN4IKB6X.cjs} +14 -14
- package/dist/{chunk-KGZ66JVZ.cjs.map → chunk-HN4IKB6X.cjs.map} +1 -1
- package/dist/{chunk-XKMVJ443.js → chunk-HWMGR3HA.js} +6 -6
- package/dist/{chunk-XKMVJ443.js.map → chunk-HWMGR3HA.js.map} +1 -1
- package/dist/{chunk-5H2GJXGC.cjs → chunk-IO4RI5ZJ.cjs} +24 -24
- package/dist/{chunk-5H2GJXGC.cjs.map → chunk-IO4RI5ZJ.cjs.map} +1 -1
- package/dist/{chunk-OLSEWLK5.cjs → chunk-IOFMRS6T.cjs} +6 -6
- package/dist/{chunk-OLSEWLK5.cjs.map → chunk-IOFMRS6T.cjs.map} +1 -1
- package/dist/{chunk-7QJYKVP6.js → chunk-KCM3RMKR.js} +3 -3
- package/dist/{chunk-7QJYKVP6.js.map → chunk-KCM3RMKR.js.map} +1 -1
- package/dist/{chunk-7KIN3L2S.js → chunk-KU5O7WPK.js} +3 -3
- package/dist/{chunk-7KIN3L2S.js.map → chunk-KU5O7WPK.js.map} +1 -1
- package/dist/{chunk-J5623RIV.cjs → chunk-KX5QXLBS.cjs} +10 -10
- package/dist/{chunk-J5623RIV.cjs.map → chunk-KX5QXLBS.cjs.map} +1 -1
- package/dist/{chunk-J6GXS5A2.cjs → chunk-L7JPXZ2C.cjs} +17 -17
- package/dist/{chunk-J6GXS5A2.cjs.map → chunk-L7JPXZ2C.cjs.map} +1 -1
- package/dist/{chunk-P7NNKEWO.cjs → chunk-L7V4DDIE.cjs} +4 -4
- package/dist/{chunk-P7NNKEWO.cjs.map → chunk-L7V4DDIE.cjs.map} +1 -1
- package/dist/chunk-LO6LIUZ6.cjs +18 -0
- package/dist/{chunk-SGC7LSHF.cjs.map → chunk-LO6LIUZ6.cjs.map} +1 -1
- package/dist/{chunk-BZKF7TXX.cjs → chunk-LSWHDOCL.cjs} +192 -148
- package/dist/chunk-LSWHDOCL.cjs.map +1 -0
- package/dist/{chunk-3JHIFQ4I.js → chunk-M4U24U6G.js} +3 -3
- package/dist/{chunk-3JHIFQ4I.js.map → chunk-M4U24U6G.js.map} +1 -1
- package/dist/{chunk-GGRPAQ3B.js → chunk-MLGETTYX.js} +5 -5
- package/dist/{chunk-GGRPAQ3B.js.map → chunk-MLGETTYX.js.map} +1 -1
- package/dist/{chunk-XZHJYSPB.js → chunk-MLJDW2YK.js} +4 -4
- package/dist/{chunk-XZHJYSPB.js.map → chunk-MLJDW2YK.js.map} +1 -1
- package/dist/{chunk-5Q4RTLMP.js → chunk-MS3TQSXU.js} +3 -3
- package/dist/{chunk-5Q4RTLMP.js.map → chunk-MS3TQSXU.js.map} +1 -1
- package/dist/{chunk-W2ZVTEOD.js → chunk-MSEL5E5P.js} +6 -6
- package/dist/{chunk-W2ZVTEOD.js.map → chunk-MSEL5E5P.js.map} +1 -1
- package/dist/{chunk-ZAM7BJXJ.cjs → chunk-MSW7LB2V.cjs} +5 -5
- package/dist/{chunk-ZAM7BJXJ.cjs.map → chunk-MSW7LB2V.cjs.map} +1 -1
- package/dist/{chunk-7HUCU3KK.js → chunk-NHOEXFZT.js} +5 -5
- package/dist/{chunk-7HUCU3KK.js.map → chunk-NHOEXFZT.js.map} +1 -1
- package/dist/{chunk-Z5BAFHPU.js → chunk-NJBJ3CUG.js} +6 -6
- package/dist/{chunk-Z5BAFHPU.js.map → chunk-NJBJ3CUG.js.map} +1 -1
- package/dist/{chunk-I2ORT6QD.js → chunk-NKQVLWDF.js} +3 -3
- package/dist/{chunk-I2ORT6QD.js.map → chunk-NKQVLWDF.js.map} +1 -1
- package/dist/chunk-NP362THY.cjs +164 -0
- package/dist/chunk-NP362THY.cjs.map +1 -0
- package/dist/{chunk-NWS2CS3Y.cjs → chunk-NWWTYBD3.cjs} +5 -5
- package/dist/{chunk-NWS2CS3Y.cjs.map → chunk-NWWTYBD3.cjs.map} +1 -1
- package/dist/{chunk-SVQIW5RJ.js → chunk-OLJOI4LK.js} +4 -4
- package/dist/{chunk-SVQIW5RJ.js.map → chunk-OLJOI4LK.js.map} +1 -1
- package/dist/{chunk-7JAKO3NM.js → chunk-ORLTGPOS.js} +3 -3
- package/dist/{chunk-7JAKO3NM.js.map → chunk-ORLTGPOS.js.map} +1 -1
- package/dist/{chunk-5DD4NJN3.js → chunk-PKRPV3R7.js} +3 -3
- package/dist/{chunk-5DD4NJN3.js.map → chunk-PKRPV3R7.js.map} +1 -1
- package/dist/{chunk-R5YPDAKD.cjs → chunk-POBZXULR.cjs} +4 -4
- package/dist/{chunk-R5YPDAKD.cjs.map → chunk-POBZXULR.cjs.map} +1 -1
- package/dist/{chunk-5OHB5HJF.cjs → chunk-Q6WT5535.cjs} +521 -422
- package/dist/chunk-Q6WT5535.cjs.map +1 -0
- package/dist/{chunk-MQGSOKR3.js → chunk-Q7UG242V.js} +3 -3
- package/dist/{chunk-MQGSOKR3.js.map → chunk-Q7UG242V.js.map} +1 -1
- package/dist/{chunk-XKZFIP7Z.cjs → chunk-QG4SXZ2A.cjs} +4 -4
- package/dist/{chunk-XKZFIP7Z.cjs.map → chunk-QG4SXZ2A.cjs.map} +1 -1
- package/dist/{chunk-NAGPKWOD.cjs → chunk-QISSETTG.cjs} +4 -4
- package/dist/{chunk-NAGPKWOD.cjs.map → chunk-QISSETTG.cjs.map} +1 -1
- package/dist/{chunk-OR6XIWLB.js → chunk-QK2ERTO3.js} +4 -4
- package/dist/{chunk-OR6XIWLB.js.map → chunk-QK2ERTO3.js.map} +1 -1
- package/dist/{chunk-ZDYDBXSD.js → chunk-RN3XDZGS.js} +6 -6
- package/dist/{chunk-ZDYDBXSD.js.map → chunk-RN3XDZGS.js.map} +1 -1
- package/dist/{chunk-6LHQPOMI.cjs → chunk-RNXXYF22.cjs} +66 -7
- package/dist/chunk-RNXXYF22.cjs.map +1 -0
- package/dist/{chunk-TMKTSYDS.cjs → chunk-RS7YQR4X.cjs} +6 -6
- package/dist/{chunk-TMKTSYDS.cjs.map → chunk-RS7YQR4X.cjs.map} +1 -1
- package/dist/{chunk-HU666T3Q.cjs → chunk-S46WJTDL.cjs} +14 -14
- package/dist/{chunk-HU666T3Q.cjs.map → chunk-S46WJTDL.cjs.map} +1 -1
- package/dist/{chunk-ZD66GFH5.cjs → chunk-SDZ4XDWS.cjs} +35 -35
- package/dist/{chunk-ZD66GFH5.cjs.map → chunk-SDZ4XDWS.cjs.map} +1 -1
- package/dist/{chunk-ZJZ7LV3A.js → chunk-SV63WTA2.js} +3 -3
- package/dist/{chunk-ZJZ7LV3A.js.map → chunk-SV63WTA2.js.map} +1 -1
- package/dist/{chunk-CQYBJOB2.cjs → chunk-SXH37C7X.cjs} +4 -4
- package/dist/{chunk-CQYBJOB2.cjs.map → chunk-SXH37C7X.cjs.map} +1 -1
- package/dist/{chunk-GMRFAX4I.js → chunk-SZQFCHU6.js} +4 -4
- package/dist/{chunk-GMRFAX4I.js.map → chunk-SZQFCHU6.js.map} +1 -1
- package/dist/{chunk-6PB5AQCY.cjs → chunk-TLVI2OQK.cjs} +16 -16
- package/dist/{chunk-6PB5AQCY.cjs.map → chunk-TLVI2OQK.cjs.map} +1 -1
- package/dist/{chunk-B5MHRQJZ.js → chunk-TNFOU6SB.js} +3 -3
- package/dist/chunk-TNFOU6SB.js.map +1 -0
- package/dist/{chunk-N6OEX5TN.cjs → chunk-UDAKAE4Z.cjs} +16 -16
- package/dist/{chunk-N6OEX5TN.cjs.map → chunk-UDAKAE4Z.cjs.map} +1 -1
- package/dist/{chunk-26NEAJ6T.js → chunk-VVGFZQZC.js} +4 -4
- package/dist/{chunk-26NEAJ6T.js.map → chunk-VVGFZQZC.js.map} +1 -1
- package/dist/{chunk-XCQ432OX.js → chunk-VZGE7NAI.js} +3 -3
- package/dist/{chunk-XCQ432OX.js.map → chunk-VZGE7NAI.js.map} +1 -1
- package/dist/{chunk-C7GKRGKN.cjs → chunk-WDVG5R2Q.cjs} +19 -19
- package/dist/{chunk-C7GKRGKN.cjs.map → chunk-WDVG5R2Q.cjs.map} +1 -1
- package/dist/{chunk-FTZTZBCU.js → chunk-XESYJ4JC.js} +4 -4
- package/dist/{chunk-FTZTZBCU.js.map → chunk-XESYJ4JC.js.map} +1 -1
- package/dist/{chunk-OPAKPEPG.js → chunk-XJ3WU5CZ.js} +5 -5
- package/dist/{chunk-OPAKPEPG.js.map → chunk-XJ3WU5CZ.js.map} +1 -1
- package/dist/{chunk-74OA5DIM.js → chunk-XJ4C4NFX.js} +64 -20
- package/dist/chunk-XJ4C4NFX.js.map +1 -0
- package/dist/{chunk-AY43232P.js → chunk-XRPMZ7TO.js} +4 -4
- package/dist/{chunk-AY43232P.js.map → chunk-XRPMZ7TO.js.map} +1 -1
- package/dist/{chunk-X6DUEDAF.js → chunk-XZKIAENA.js} +3 -3
- package/dist/{chunk-X6DUEDAF.js.map → chunk-XZKIAENA.js.map} +1 -1
- package/dist/{chunk-X7EUUHXU.js → chunk-YMVTUV5K.js} +3 -3
- package/dist/{chunk-X7EUUHXU.js.map → chunk-YMVTUV5K.js.map} +1 -1
- package/dist/{chunk-N7ZIPW2N.cjs → chunk-YOVZMN4P.cjs} +8 -8
- package/dist/{chunk-N7ZIPW2N.cjs.map → chunk-YOVZMN4P.cjs.map} +1 -1
- package/dist/{chunk-TY56BKSK.cjs → chunk-YQ3XC6C2.cjs} +4 -4
- package/dist/{chunk-TY56BKSK.cjs.map → chunk-YQ3XC6C2.cjs.map} +1 -1
- package/dist/chunk-ZJAYFSVI.js +158 -0
- package/dist/chunk-ZJAYFSVI.js.map +1 -0
- package/dist/{chunk-MU7IAA7G.js → chunk-ZLFFDPXC.js} +9 -9
- package/dist/{chunk-MU7IAA7G.js.map → chunk-ZLFFDPXC.js.map} +1 -1
- package/dist/{chunk-JLRLCBJ4.cjs → chunk-ZOFRNNZD.cjs} +4 -4
- package/dist/{chunk-JLRLCBJ4.cjs.map → chunk-ZOFRNNZD.cjs.map} +1 -1
- package/dist/{chunk-MPQJE3G4.cjs → chunk-ZWLFHSON.cjs} +15 -15
- package/dist/{chunk-MPQJE3G4.cjs.map → chunk-ZWLFHSON.cjs.map} +1 -1
- package/dist/compact-session-3U2JYTVG.js +25 -0
- package/dist/{compact-session-F2UDGZCN.js.map → compact-session-3U2JYTVG.js.map} +1 -1
- package/dist/{compact-session-2AETONOS.cjs → compact-session-NM56BREJ.cjs} +24 -24
- package/dist/{compact-session-2AETONOS.cjs.map → compact-session-NM56BREJ.cjs.map} +1 -1
- package/dist/compaction.cjs +18 -18
- package/dist/compaction.js +3 -3
- package/dist/concurrency.cjs +6 -6
- package/dist/concurrency.js +4 -4
- package/dist/context/index.cjs +9 -9
- package/dist/context/index.js +6 -6
- package/dist/context-4RSI3AXT.cjs +24 -0
- package/dist/{context-B5J4GX2F.cjs.map → context-4RSI3AXT.cjs.map} +1 -1
- package/dist/context-7EBZST3L.js +7 -0
- package/dist/{context-3FZRAO5K.js.map → context-7EBZST3L.js.map} +1 -1
- package/dist/{cron-Blj6wMYg.d.cts → cron-BWDYetbq.d.cts} +2 -2
- package/dist/{cron-BPccQCO8.d.ts → cron-CHn-F0fC.d.ts} +2 -2
- package/dist/cron.cjs +42 -42
- package/dist/cron.d.cts +4 -4
- package/dist/cron.d.ts +4 -4
- package/dist/cron.js +41 -41
- package/dist/{errors-BWOJeWTZ.d.cts → errors-BiDQFWTG.d.cts} +10 -7
- package/dist/{errors-DDvG18IB.d.ts → errors-Pf22PJJ-.d.ts} +10 -7
- package/dist/errors.cjs +23 -23
- package/dist/errors.d.cts +2 -3
- package/dist/errors.d.ts +2 -3
- package/dist/errors.js +2 -2
- package/dist/eval.cjs +54 -54
- package/dist/eval.js +42 -42
- package/dist/{executor-3NI7KNL4.js → executor-3D2UDJHW.js} +8 -8
- package/dist/{executor-3NI7KNL4.js.map → executor-3D2UDJHW.js.map} +1 -1
- package/dist/{executor-2SUGI3ZT.cjs → executor-HKHT4CWS.cjs} +26 -26
- package/dist/{executor-2SUGI3ZT.cjs.map → executor-HKHT4CWS.cjs.map} +1 -1
- package/dist/filesystem/index.cjs +12 -12
- package/dist/filesystem/index.js +3 -3
- package/dist/fs-session-store-6ZCCJX3K.js +11 -0
- package/dist/{fs-session-store-3VI4CPTX.js.map → fs-session-store-6ZCCJX3K.js.map} +1 -1
- package/dist/fs-session-store-S2AXVJIX.cjs +20 -0
- package/dist/{fs-session-store-IQ6PEHYF.cjs.map → fs-session-store-S2AXVJIX.cjs.map} +1 -1
- package/dist/generate-object-S7MNVF2V.js +7 -0
- package/dist/{generate-object-NTKAWE7D.js.map → generate-object-S7MNVF2V.js.map} +1 -1
- package/dist/generate-object-XBWD2PU7.cjs +20 -0
- package/dist/{generate-object-YHTWG5DB.cjs.map → generate-object-XBWD2PU7.cjs.map} +1 -1
- package/dist/index-manager-HO456AVW.cjs +27 -0
- package/dist/{index-manager-YGXRFJMZ.cjs.map → index-manager-HO456AVW.cjs.map} +1 -1
- package/dist/index-manager-QDH56FER.js +18 -0
- package/dist/{index-manager-JVYIVTZG.js.map → index-manager-QDH56FER.js.map} +1 -1
- package/dist/index.cjs +172 -172
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +59 -59
- package/dist/{inject-session-W4UKACYJ.cjs → inject-session-JVTZNQF6.cjs} +9 -9
- package/dist/{inject-session-W4UKACYJ.cjs.map → inject-session-JVTZNQF6.cjs.map} +1 -1
- package/dist/{inject-session-E5UDFVLI.js → inject-session-THABTKJY.js} +7 -7
- package/dist/{inject-session-E5UDFVLI.js.map → inject-session-THABTKJY.js.map} +1 -1
- package/dist/interactive/index.cjs +4 -4
- package/dist/interactive/index.js +2 -2
- package/dist/internal/budget/normalize-usage.d.ts +5 -1
- package/dist/internal/error-mappers/openai-compatible.d.ts +5 -1
- package/dist/internal/memory/adapters/index.cjs +8 -8
- package/dist/internal/memory/adapters/index.js +7 -7
- package/dist/internal/memory/storage/index.cjs +42 -42
- package/dist/internal/memory/storage/index.js +10 -10
- package/dist/internal/persistence/index.cjs +25 -25
- package/dist/internal/persistence/index.js +8 -8
- package/dist/internal/providers/catalog-schema.d.ts +1 -1
- package/dist/internal/runtime/lifecycle/throw-on-error-run.d.ts +18 -0
- package/dist/internal/runtime/model-selection.d.ts +1 -1
- package/dist/internal/runtime/system-prompt/native-reasoning.d.ts +2 -2
- package/dist/internal/runtime/typed-run-error.d.ts +16 -0
- package/dist/internal/security/index.cjs +13 -13
- package/dist/internal/security/index.js +3 -3
- package/dist/judge-call-4LR4IFVT.js +5 -0
- package/dist/{judge-call-LOL5FQEX.js.map → judge-call-4LR4IFVT.js.map} +1 -1
- package/dist/judge-call-ZTUQMQRL.cjs +22 -0
- package/dist/{judge-call-AQQYK6VT.cjs.map → judge-call-ZTUQMQRL.cjs.map} +1 -1
- package/dist/mcp-auth.cjs +14 -14
- package/dist/mcp-auth.js +4 -4
- package/dist/models.cjs +22 -22
- package/dist/models.js +8 -8
- package/dist/oauth-transaction-store-OMX436YB.cjs +38 -0
- package/dist/{oauth-transaction-store-ZINDV7AF.cjs.map → oauth-transaction-store-OMX436YB.cjs.map} +1 -1
- package/dist/oauth-transaction-store-U34YLEGP.js +5 -0
- package/dist/{oauth-transaction-store-NP2YHZ6D.js.map → oauth-transaction-store-U34YLEGP.js.map} +1 -1
- package/dist/path-safety.cjs +10 -10
- package/dist/path-safety.js +3 -3
- package/dist/persistence.cjs +31 -31
- package/dist/persistence.js +10 -10
- package/dist/project.cjs +5 -5
- package/dist/project.js +3 -3
- package/dist/providers.cjs +9 -9
- package/dist/providers.js +7 -7
- package/dist/registry-5TDAF7RK.js +9 -0
- package/dist/{registry-5FK42CRV.js.map → registry-5TDAF7RK.js.map} +1 -1
- package/dist/registry-W7TSCLQO.cjs +46 -0
- package/dist/{registry-BVTNO73E.cjs.map → registry-W7TSCLQO.cjs.map} +1 -1
- package/dist/retry.cjs +4 -4
- package/dist/retry.js +3 -3
- package/dist/{run-until-DG2KXWB2.cjs → run-until-4KHVF7YC.cjs} +8 -4
- package/dist/run-until-4KHVF7YC.cjs.map +1 -0
- package/dist/{run-until-6D6TQ4JN.js → run-until-G6BW2DWM.js} +8 -4
- package/dist/run-until-G6BW2DWM.js.map +1 -0
- package/dist/sandbox/index.cjs +22 -22
- package/dist/sandbox/index.js +4 -4
- package/dist/{run-DsA5Ip2i.d.cts → sdk-agent-4-dXI2GS.d.cts} +1500 -753
- package/dist/{run-DsA5Ip2i.d.ts → sdk-agent-CTOJlWA_.d.ts} +1500 -753
- package/dist/server/auth/index.cjs +22 -22
- package/dist/server/auth/index.js +7 -7
- package/dist/server/errors-envelope.cjs +14 -14
- package/dist/server/errors-envelope.d.cts +2 -3
- package/dist/server/errors-envelope.d.ts +2 -3
- package/dist/server/errors-envelope.js +3 -3
- package/dist/session-transcript-7TZ6HXSX.cjs +62 -0
- package/dist/{session-transcript-RACG7BK2.cjs.map → session-transcript-7TZ6HXSX.cjs.map} +1 -1
- package/dist/session-transcript-BSHZYYY6.js +5 -0
- package/dist/{session-transcript-AR7IBICT.js.map → session-transcript-BSHZYYY6.js.map} +1 -1
- package/dist/skills.cjs +8 -8
- package/dist/skills.js +5 -5
- package/dist/stream-object-R6SMYV4R.js +7 -0
- package/dist/{stream-object-QAEHG4YO.js.map → stream-object-R6SMYV4R.js.map} +1 -1
- package/dist/stream-object-TEEK3CAX.cjs +20 -0
- package/dist/{stream-object-TKVGGA54.cjs.map → stream-object-TEEK3CAX.cjs.map} +1 -1
- package/dist/subagents-loader-TXOA5EJJ.cjs +16 -0
- package/dist/{subagents-loader-5TZCAIYQ.cjs.map → subagents-loader-TXOA5EJJ.cjs.map} +1 -1
- package/dist/subagents-loader-Z744TAKD.js +7 -0
- package/dist/{subagents-loader-PEV3PD4Q.js.map → subagents-loader-Z744TAKD.js.map} +1 -1
- package/dist/subagents-loader.cjs +7 -7
- package/dist/subagents-loader.d.cts +4 -3
- package/dist/subagents-loader.d.ts +4 -3
- package/dist/subagents-loader.js +5 -5
- package/dist/subscription/index.cjs +3 -3
- package/dist/subscription/index.js +2 -2
- package/dist/task-store.cjs +7 -7
- package/dist/task-store.js +4 -4
- package/dist/types/agent-prims.d.ts +16 -0
- package/dist/types/agent.d.ts +15 -6
- package/dist/types/run.d.ts +14 -14
- package/dist/workflow.cjs +27 -27
- package/dist/workflow.d.cts +2 -2
- package/dist/workflow.d.ts +2 -2
- package/dist/workflow.js +6 -6
- package/docs/error-codes.md +26 -22
- package/docs/harness-capability-map.md +4 -4
- package/package.json +1 -1
- package/dist/agent-5DOR5T3E.cjs +0 -71
- package/dist/agent-GWKRARAL.js +0 -62
- package/dist/agent-session-store-ODD3IZCW.js +0 -6
- package/dist/agent-session-store-SVEJHSUA.cjs +0 -23
- package/dist/chunk-4PHSVR2R.js.map +0 -1
- package/dist/chunk-5OHB5HJF.cjs.map +0 -1
- package/dist/chunk-6LHQPOMI.cjs.map +0 -1
- package/dist/chunk-74OA5DIM.js.map +0 -1
- package/dist/chunk-B5MHRQJZ.js.map +0 -1
- package/dist/chunk-BZKF7TXX.cjs.map +0 -1
- package/dist/chunk-CZJ6Q7CW.js.map +0 -1
- package/dist/chunk-SGC7LSHF.cjs +0 -18
- package/dist/chunk-TE6XVTOA.js +0 -115
- package/dist/chunk-TE6XVTOA.js.map +0 -1
- package/dist/chunk-UNFBHV46.cjs.map +0 -1
- package/dist/chunk-WPO3VCY4.cjs +0 -121
- package/dist/chunk-WPO3VCY4.cjs.map +0 -1
- package/dist/compact-session-F2UDGZCN.js +0 -25
- package/dist/context-3FZRAO5K.js +0 -7
- package/dist/context-B5J4GX2F.cjs +0 -24
- package/dist/fs-session-store-3VI4CPTX.js +0 -11
- package/dist/fs-session-store-IQ6PEHYF.cjs +0 -20
- package/dist/generate-object-NTKAWE7D.js +0 -7
- package/dist/generate-object-YHTWG5DB.cjs +0 -20
- package/dist/index-manager-JVYIVTZG.js +0 -18
- package/dist/index-manager-YGXRFJMZ.cjs +0 -27
- package/dist/judge-call-AQQYK6VT.cjs +0 -22
- package/dist/judge-call-LOL5FQEX.js +0 -5
- package/dist/oauth-transaction-store-NP2YHZ6D.js +0 -5
- package/dist/oauth-transaction-store-ZINDV7AF.cjs +0 -38
- package/dist/registry-5FK42CRV.js +0 -9
- package/dist/registry-BVTNO73E.cjs +0 -46
- package/dist/run-until-6D6TQ4JN.js.map +0 -1
- package/dist/run-until-DG2KXWB2.cjs.map +0 -1
- package/dist/sdk-agent-dNwjwCt5.d.cts +0 -940
- package/dist/sdk-agent-wEOLXD3F.d.ts +0 -940
- package/dist/session-transcript-AR7IBICT.js +0 -5
- package/dist/session-transcript-RACG7BK2.cjs +0 -62
- package/dist/stream-object-QAEHG4YO.js +0 -7
- package/dist/stream-object-TKVGGA54.cjs +0 -20
- package/dist/subagents-loader-5TZCAIYQ.cjs +0 -16
- package/dist/subagents-loader-PEV3PD4Q.js +0 -7
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkL7JPXZ2C_cjs = require('./chunk-L7JPXZ2C.cjs');
|
|
4
|
+
var chunkYOVZMN4P_cjs = require('./chunk-YOVZMN4P.cjs');
|
|
5
|
+
var chunkCWQPQTUZ_cjs = require('./chunk-CWQPQTUZ.cjs');
|
|
6
|
+
var chunk7YUPSBDV_cjs = require('./chunk-7YUPSBDV.cjs');
|
|
7
7
|
var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
8
|
+
var chunkCGH4BCIY_cjs = require('./chunk-CGH4BCIY.cjs');
|
|
9
|
+
var chunkRS7YQR4X_cjs = require('./chunk-RS7YQR4X.cjs');
|
|
10
|
+
var chunkSDZ4XDWS_cjs = require('./chunk-SDZ4XDWS.cjs');
|
|
11
|
+
var chunk6OCJWGVD_cjs = require('./chunk-6OCJWGVD.cjs');
|
|
12
|
+
var chunkLSWHDOCL_cjs = require('./chunk-LSWHDOCL.cjs');
|
|
13
13
|
var chunk2ZPEDVLM_cjs = require('./chunk-2ZPEDVLM.cjs');
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
14
|
+
var chunkQG4SXZ2A_cjs = require('./chunk-QG4SXZ2A.cjs');
|
|
15
|
+
var chunkUDAKAE4Z_cjs = require('./chunk-UDAKAE4Z.cjs');
|
|
16
|
+
var chunk3HA7N2BB_cjs = require('./chunk-3HA7N2BB.cjs');
|
|
17
17
|
var chunkAA27GEYS_cjs = require('./chunk-AA27GEYS.cjs');
|
|
18
18
|
var chunkYSTXFWQE_cjs = require('./chunk-YSTXFWQE.cjs');
|
|
19
|
-
var
|
|
19
|
+
var chunkH7HD6RXO_cjs = require('./chunk-H7HD6RXO.cjs');
|
|
20
20
|
var chunkNINIJCHU_cjs = require('./chunk-NINIJCHU.cjs');
|
|
21
|
-
var
|
|
21
|
+
var chunk7WARNHWW_cjs = require('./chunk-7WARNHWW.cjs');
|
|
22
22
|
var chunkIJ7M6GOG_cjs = require('./chunk-IJ7M6GOG.cjs');
|
|
23
|
-
var
|
|
23
|
+
var chunk3KIUY67P_cjs = require('./chunk-3KIUY67P.cjs');
|
|
24
24
|
var chunkSA6K24NB_cjs = require('./chunk-SA6K24NB.cjs');
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
25
|
+
var chunk27V5I2WW_cjs = require('./chunk-27V5I2WW.cjs');
|
|
26
|
+
var chunk3WKWBYPO_cjs = require('./chunk-3WKWBYPO.cjs');
|
|
27
|
+
var chunkG7XBVM3T_cjs = require('./chunk-G7XBVM3T.cjs');
|
|
28
28
|
var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
29
|
+
var chunkZOFRNNZD_cjs = require('./chunk-ZOFRNNZD.cjs');
|
|
30
|
+
var chunkWDVG5R2Q_cjs = require('./chunk-WDVG5R2Q.cjs');
|
|
31
|
+
var chunkYQ3XC6C2_cjs = require('./chunk-YQ3XC6C2.cjs');
|
|
32
|
+
var chunk6XQLTQB6_cjs = require('./chunk-6XQLTQB6.cjs');
|
|
33
|
+
var chunkKX5QXLBS_cjs = require('./chunk-KX5QXLBS.cjs');
|
|
34
|
+
var chunkNWWTYBD3_cjs = require('./chunk-NWWTYBD3.cjs');
|
|
35
35
|
var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
|
|
36
|
-
var
|
|
37
|
-
var
|
|
36
|
+
var chunkLO6LIUZ6_cjs = require('./chunk-LO6LIUZ6.cjs');
|
|
37
|
+
var chunkS46WJTDL_cjs = require('./chunk-S46WJTDL.cjs');
|
|
38
38
|
var chunkNVXXWAU7_cjs = require('./chunk-NVXXWAU7.cjs');
|
|
39
39
|
var chunkEHD25JBZ_cjs = require('./chunk-EHD25JBZ.cjs');
|
|
40
|
-
var
|
|
41
|
-
var
|
|
40
|
+
var chunkCEGU5AVD_cjs = require('./chunk-CEGU5AVD.cjs');
|
|
41
|
+
var chunkRNXXYF22_cjs = require('./chunk-RNXXYF22.cjs');
|
|
42
42
|
var promises = require('fs/promises');
|
|
43
43
|
var crypto = require('crypto');
|
|
44
44
|
var path = require('path');
|
|
@@ -164,7 +164,7 @@ async function agentGenerate(agent, agentModel, agentApiKey, agentLocal, input,
|
|
|
164
164
|
const { output, maxRetries, errorStrategy, ...sendOptions } = options;
|
|
165
165
|
const run = await agent.send(input, sendOptions);
|
|
166
166
|
const result = await run.wait();
|
|
167
|
-
const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-
|
|
167
|
+
const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-XBWD2PU7.cjs');
|
|
168
168
|
const answer = structurableAnswerOrThrow(result, GenerateObjectError);
|
|
169
169
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
170
170
|
const facade = getAgentFacade();
|
|
@@ -248,18 +248,59 @@ function isLocalAgentId(id) {
|
|
|
248
248
|
return id.startsWith(PREFIX.localAgent);
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
// src/internal/runtime/lifecycle/throw-on-error-run.ts
|
|
252
|
+
var innerRuns = /* @__PURE__ */ new WeakMap();
|
|
253
|
+
function wrapRunWithThrowOnError(run) {
|
|
254
|
+
let settled;
|
|
255
|
+
const rejectingWait = () => {
|
|
256
|
+
settled ??= run.wait().then(rejectOnTypedFailure);
|
|
257
|
+
return settled;
|
|
258
|
+
};
|
|
259
|
+
const view = new Proxy(run, {
|
|
260
|
+
get(target, prop, receiver) {
|
|
261
|
+
if (prop === "wait") return rejectingWait;
|
|
262
|
+
return Reflect.get(target, prop, receiver);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
innerRuns.set(view, run);
|
|
266
|
+
return view;
|
|
267
|
+
}
|
|
268
|
+
function readRunResolving(run) {
|
|
269
|
+
return (innerRuns.get(run) ?? run).wait();
|
|
270
|
+
}
|
|
271
|
+
function rejectOnTypedFailure(result) {
|
|
272
|
+
const cause = result.status === "error" ? result.error?.cause : void 0;
|
|
273
|
+
if (cause !== void 0) throw cause;
|
|
274
|
+
return result;
|
|
275
|
+
}
|
|
276
|
+
|
|
251
277
|
// src/internal/runtime/model-selection.ts
|
|
252
278
|
function normalizeModel(m) {
|
|
253
|
-
if (m === void 0
|
|
279
|
+
if (m === void 0) return m;
|
|
280
|
+
if (typeof m !== "string") {
|
|
281
|
+
refuseEmptyThinkingParam(m);
|
|
282
|
+
return m;
|
|
283
|
+
}
|
|
254
284
|
const id = m.trim();
|
|
255
285
|
if (id.length === 0) {
|
|
256
|
-
throw new
|
|
286
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
257
287
|
'model must be a non-empty "provider/model" id string or a ModelSelection object',
|
|
258
288
|
{ code: "invalid_model_selection" }
|
|
259
289
|
);
|
|
260
290
|
}
|
|
261
291
|
return { id };
|
|
262
292
|
}
|
|
293
|
+
function refuseEmptyThinkingParam(selection) {
|
|
294
|
+
for (const param of selection.params ?? []) {
|
|
295
|
+
const value = param.value;
|
|
296
|
+
if (param.id === "thinking" && (typeof value !== "string" || value.trim().length === 0)) {
|
|
297
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
298
|
+
'model.params "thinking" needs a non-empty reasoning effort (for example "low" or "high"); leave the param out to request no reasoning',
|
|
299
|
+
{ code: "invalid_model_param" }
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
263
304
|
|
|
264
305
|
// src/internal/plugins/enabled-names.ts
|
|
265
306
|
function isPluginArray(plugins) {
|
|
@@ -389,11 +430,11 @@ function serializeAgents(agents2) {
|
|
|
389
430
|
return out;
|
|
390
431
|
}
|
|
391
432
|
function registryPath(cwd) {
|
|
392
|
-
return path.join(
|
|
433
|
+
return path.join(chunkYQ3XC6C2_cjs.theokitConfigRoot(cwd), REGISTRY_RELATIVE_SUFFIX);
|
|
393
434
|
}
|
|
394
435
|
async function loadRegistry(cwd) {
|
|
395
|
-
void
|
|
396
|
-
return
|
|
436
|
+
void chunkZOFRNNZD_cjs.sweepStaleAtomicTemps(registryPath(cwd)).catch(() => void 0);
|
|
437
|
+
return chunk3HA7N2BB_cjs.readVersionedJson({
|
|
397
438
|
path: registryPath(cwd),
|
|
398
439
|
currentVersion: SCHEMA_VERSION,
|
|
399
440
|
defaultValue: () => ({}),
|
|
@@ -417,7 +458,7 @@ async function saveRegistry(cwd, agents2) {
|
|
|
417
458
|
}
|
|
418
459
|
const path = registryPath(cwd);
|
|
419
460
|
await chunkZF2LDKQQ_cjs.withCwdMutex(`registry:${cwd}`, async () => {
|
|
420
|
-
await
|
|
461
|
+
await chunk3HA7N2BB_cjs.writeVersionedJson(path, serialized, SCHEMA_VERSION);
|
|
421
462
|
});
|
|
422
463
|
}
|
|
423
464
|
function toSerialized(agent) {
|
|
@@ -484,7 +525,7 @@ function scheduleSaveForCwd(cwd) {
|
|
|
484
525
|
}
|
|
485
526
|
} catch (cause) {
|
|
486
527
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
487
|
-
|
|
528
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] registry persist failed (${cwd}): ${msg}
|
|
488
529
|
`);
|
|
489
530
|
} finally {
|
|
490
531
|
pendingSaves.delete(cwd);
|
|
@@ -824,14 +865,14 @@ async function readLegacyFacts(jsonPath) {
|
|
|
824
865
|
}
|
|
825
866
|
async function writeMigratedFacts(cwd, jsonPath, facts) {
|
|
826
867
|
try {
|
|
827
|
-
for (const fact of facts) await
|
|
868
|
+
for (const fact of facts) await chunkSDZ4XDWS_cjs.appendFactToMarkdown(cwd, fact);
|
|
828
869
|
await promises.unlink(jsonPath).catch(() => void 0);
|
|
829
|
-
|
|
870
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
|
|
830
871
|
`);
|
|
831
872
|
return { migrated: true, factCount: facts.length };
|
|
832
873
|
} catch (cause) {
|
|
833
874
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
834
|
-
|
|
875
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] memory migration failed (readonly fs?): ${message}
|
|
835
876
|
`);
|
|
836
877
|
return { migrated: false, factCount: 0, reason: "readonly-fs" };
|
|
837
878
|
}
|
|
@@ -841,12 +882,12 @@ async function migrateLegacyJson(cwd, config) {
|
|
|
841
882
|
const key = `${cwd}::${config.namespace ?? "default"}::${config.scope ?? "agent"}::${config.userId ?? "default"}`;
|
|
842
883
|
if (migrationRun.has(key)) return { migrated: false, factCount: 0, reason: "already-migrated" };
|
|
843
884
|
migrationRun.add(key);
|
|
844
|
-
const jsonPath =
|
|
885
|
+
const jsonPath = chunkSDZ4XDWS_cjs.legacyMemoryJsonPath(cwd, config);
|
|
845
886
|
if (!await fileExists(jsonPath)) {
|
|
846
887
|
return { migrated: false, factCount: 0, reason: "no-legacy-json" };
|
|
847
888
|
}
|
|
848
|
-
if (await fileExists(
|
|
849
|
-
|
|
889
|
+
if (await fileExists(chunkSDZ4XDWS_cjs.memoryMdPath(chunkSDZ4XDWS_cjs.resolveMemoryRoot(cwd, config)))) {
|
|
890
|
+
chunkRNXXYF22_cjs.diag(
|
|
850
891
|
`[theokit-sdk] memory migration skipped: both MEMORY.md and legacy JSON exist at ${jsonPath}; leaving both intact
|
|
851
892
|
`
|
|
852
893
|
);
|
|
@@ -874,29 +915,29 @@ function unstoredRememberWarning(message) {
|
|
|
874
915
|
if (isMemoryWritePrompt(message) && extractMemoryFact(message).length > 0) return void 0;
|
|
875
916
|
const trimmed = message.trim();
|
|
876
917
|
const quoted = trimmed.length > QUOTED_MESSAGE_MAX ? `${trimmed.slice(0, QUOTED_MESSAGE_MAX)}\u2026` : trimmed;
|
|
877
|
-
return `[theokit-sdk] NOTHING WAS STORED \u2014 this message does not match the memory capture pattern: ${JSON.stringify(quoted)}. Supported: "Remember: <fact>" or "Remember (${
|
|
918
|
+
return `[theokit-sdk] NOTHING WAS STORED \u2014 this message does not match the memory capture pattern: ${JSON.stringify(quoted)}. Supported: "Remember: <fact>" or "Remember (${chunkSDZ4XDWS_cjs.MEMORY_KINDS.join("|")}): <fact>". It still reaches the session transcript, so a follow-up may answer from it \u2014 that is search over transcripts, not a durable memory.`;
|
|
878
919
|
}
|
|
879
920
|
function extractMemoryKind(message) {
|
|
880
921
|
const match = REMEMBER_PATTERN.exec(message);
|
|
881
922
|
const declared = match?.[1];
|
|
882
923
|
if (declared === void 0) return void 0;
|
|
883
924
|
const lowered = declared.toLowerCase();
|
|
884
|
-
return
|
|
925
|
+
return chunkSDZ4XDWS_cjs.MEMORY_KINDS.includes(lowered) ? lowered : void 0;
|
|
885
926
|
}
|
|
886
927
|
async function readMemoryFacts(cwd, config) {
|
|
887
928
|
if (!config.enabled) return [];
|
|
888
929
|
await migrateLegacyJson(cwd, config);
|
|
889
|
-
return
|
|
930
|
+
return chunkSDZ4XDWS_cjs.readFacts(cwd, config);
|
|
890
931
|
}
|
|
891
932
|
async function appendMemoryFact(cwd, config, fact) {
|
|
892
933
|
if (!config.enabled) return;
|
|
893
|
-
|
|
934
|
+
chunkSDZ4XDWS_cjs.resolveMaxFacts(config.maxFacts);
|
|
894
935
|
await migrateLegacyJson(cwd, config);
|
|
895
936
|
const sanitized = {
|
|
896
|
-
text:
|
|
937
|
+
text: chunkRNXXYF22_cjs.redactSecrets(fact.text),
|
|
897
938
|
...fact.kind === void 0 ? {} : { kind: fact.kind }
|
|
898
939
|
};
|
|
899
|
-
await
|
|
940
|
+
await chunkSDZ4XDWS_cjs.appendFact(cwd, config, sanitized);
|
|
900
941
|
}
|
|
901
942
|
|
|
902
943
|
// src/internal/runtime/fixtures/fixture-scripts.ts
|
|
@@ -1244,7 +1285,7 @@ function redactScriptSecrets(script) {
|
|
|
1244
1285
|
function redactEventSecrets(event) {
|
|
1245
1286
|
const serialized = JSON.stringify(event);
|
|
1246
1287
|
const localStripped = serialized.replace(FIXTURE_SENTINEL, "***");
|
|
1247
|
-
const redacted =
|
|
1288
|
+
const redacted = chunkRNXXYF22_cjs.redactSecrets(localStripped);
|
|
1248
1289
|
if (redacted === serialized) return event;
|
|
1249
1290
|
return JSON.parse(redacted);
|
|
1250
1291
|
}
|
|
@@ -1253,6 +1294,21 @@ function applyExtraRunFields(base, script) {
|
|
|
1253
1294
|
return { ...base, ...script.extraRunFields };
|
|
1254
1295
|
}
|
|
1255
1296
|
|
|
1297
|
+
// src/internal/runtime/typed-run-error.ts
|
|
1298
|
+
function toTypedRunErrorDetail(detail) {
|
|
1299
|
+
if (detail === void 0) return void 0;
|
|
1300
|
+
if (hasTypedCause(detail)) return detail;
|
|
1301
|
+
const { cause } = detail;
|
|
1302
|
+
const wrapped = new chunkCEGU5AVD_cjs.UnknownAgentError(detail.message, {
|
|
1303
|
+
...detail.code !== void 0 ? { code: detail.code } : {},
|
|
1304
|
+
...cause !== void 0 ? { cause } : {}
|
|
1305
|
+
});
|
|
1306
|
+
return { ...detail, cause: wrapped };
|
|
1307
|
+
}
|
|
1308
|
+
function hasTypedCause(detail) {
|
|
1309
|
+
return detail.cause instanceof chunkCEGU5AVD_cjs.TheokitAgentError;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1256
1312
|
// src/internal/runtime/fixtures/fixture-run-base.ts
|
|
1257
1313
|
function prepareRunContext(message) {
|
|
1258
1314
|
const userText = typeof message === "string" ? message : message.text;
|
|
@@ -1439,7 +1495,7 @@ var FixtureRunBase = class {
|
|
|
1439
1495
|
base.result = this.script.result;
|
|
1440
1496
|
}
|
|
1441
1497
|
if (status === "error" && this.script.errorDetail !== void 0) {
|
|
1442
|
-
base.error = this.script.errorDetail;
|
|
1498
|
+
base.error = toTypedRunErrorDetail(this.script.errorDetail);
|
|
1443
1499
|
}
|
|
1444
1500
|
applyScriptMetrics(base, this.script);
|
|
1445
1501
|
return this.extendRunResult(applyExtraRunFields(base, this.script));
|
|
@@ -1566,8 +1622,8 @@ function createRealCloudRun(options) {
|
|
|
1566
1622
|
cancellable: false,
|
|
1567
1623
|
conversation: []
|
|
1568
1624
|
};
|
|
1569
|
-
const apiKey =
|
|
1570
|
-
const baseUrl =
|
|
1625
|
+
const apiKey = chunkRNXXYF22_cjs.resolveApiKey(options.agentOptions.apiKey);
|
|
1626
|
+
const baseUrl = chunkLSWHDOCL_cjs.getConfiguredBaseUrl();
|
|
1571
1627
|
const handle = new RealCloudRun(
|
|
1572
1628
|
{
|
|
1573
1629
|
id,
|
|
@@ -1640,7 +1696,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1640
1696
|
});
|
|
1641
1697
|
if (!response.ok) {
|
|
1642
1698
|
const text = await response.text().catch(() => "");
|
|
1643
|
-
throw new
|
|
1699
|
+
throw new chunkCEGU5AVD_cjs.NetworkError(
|
|
1644
1700
|
`Cloud Run endpoint returned ${response.status}: ${text.slice(0, 200)}`,
|
|
1645
1701
|
{ code: "cloud_run_http_error" }
|
|
1646
1702
|
);
|
|
@@ -1650,7 +1706,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1650
1706
|
async consumeStream(response) {
|
|
1651
1707
|
let finalStatus = "finished";
|
|
1652
1708
|
let finalText = "";
|
|
1653
|
-
for await (const record of
|
|
1709
|
+
for await (const record of chunkLSWHDOCL_cjs.parseSseStream(response.body, this.controller.signal)) {
|
|
1654
1710
|
const parsed = safeParse(record.data);
|
|
1655
1711
|
if (parsed === void 0) continue;
|
|
1656
1712
|
const update = this.applyRecord(record.event, parsed);
|
|
@@ -1730,7 +1786,7 @@ function toWireStatus(token) {
|
|
|
1730
1786
|
const match = WIRE_STATUSES.find((candidate) => candidate === upper);
|
|
1731
1787
|
if (match !== void 0) return match;
|
|
1732
1788
|
}
|
|
1733
|
-
throw new
|
|
1789
|
+
throw new chunkCEGU5AVD_cjs.NetworkError(
|
|
1734
1790
|
`Cloud Run stream reported an unrecognised status ${JSON.stringify(token)}; expected one of ${WIRE_STATUSES.join(", ")} (case-insensitive)`,
|
|
1735
1791
|
{ code: "cloud_run_unknown_status" }
|
|
1736
1792
|
);
|
|
@@ -1740,7 +1796,7 @@ function toRunStatus(token) {
|
|
|
1740
1796
|
const mapped = SERVER_STATUS_TO_RUN_STATUS[token.toLowerCase()];
|
|
1741
1797
|
if (mapped !== void 0) return mapped;
|
|
1742
1798
|
}
|
|
1743
|
-
throw new
|
|
1799
|
+
throw new chunkCEGU5AVD_cjs.NetworkError(
|
|
1744
1800
|
`Cloud Run stream reported an unrecognised status ${JSON.stringify(token)}; expected one of ${Object.keys(SERVER_STATUS_TO_RUN_STATUS).join(", ")} (case-insensitive)`,
|
|
1745
1801
|
{ code: "cloud_run_unknown_status" }
|
|
1746
1802
|
);
|
|
@@ -1816,8 +1872,8 @@ var CloudAgent = class _CloudAgent {
|
|
|
1816
1872
|
* cloud operations are pre-release and must surface explicit errors.
|
|
1817
1873
|
*/
|
|
1818
1874
|
isFixtureMode() {
|
|
1819
|
-
const apiKey =
|
|
1820
|
-
return
|
|
1875
|
+
const apiKey = chunkRNXXYF22_cjs.resolveApiKey(this.options.apiKey);
|
|
1876
|
+
return chunkLSWHDOCL_cjs.isFixtureApiKey(apiKey) && chunkLSWHDOCL_cjs.getConfiguredBaseUrl() === void 0;
|
|
1821
1877
|
}
|
|
1822
1878
|
// SE9 — integrated structured output; delegates to the shared helper.
|
|
1823
1879
|
generate(message, options) {
|
|
@@ -1831,9 +1887,9 @@ var CloudAgent = class _CloudAgent {
|
|
|
1831
1887
|
);
|
|
1832
1888
|
}
|
|
1833
1889
|
async send(message, options = {}) {
|
|
1834
|
-
if (this.disposed) throw new
|
|
1890
|
+
if (this.disposed) throw new chunkCEGU5AVD_cjs.AgentDisposedError(this.agentId);
|
|
1835
1891
|
if (options.tools !== void 0 && options.tools.length > 0) {
|
|
1836
|
-
throw new
|
|
1892
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
1837
1893
|
"Custom inline tools are local-only in SDK v1.0 \u2014 cloud agents cannot serialize handler functions",
|
|
1838
1894
|
{ code: "cloud_custom_tools_rejected" }
|
|
1839
1895
|
);
|
|
@@ -1851,10 +1907,13 @@ var CloudAgent = class _CloudAgent {
|
|
|
1851
1907
|
reject(err);
|
|
1852
1908
|
return;
|
|
1853
1909
|
}
|
|
1854
|
-
resolve(run);
|
|
1910
|
+
resolve(this.options.throwOnError === true ? wrapRunWithThrowOnError(run) : run);
|
|
1855
1911
|
const mutexTimeoutMs = Number(process.env.THEOKIT_CLOUD_SEND_MUTEX_TIMEOUT_MS) || 3e5;
|
|
1856
1912
|
try {
|
|
1857
|
-
await Promise.race([
|
|
1913
|
+
await Promise.race([
|
|
1914
|
+
readRunResolving(run),
|
|
1915
|
+
new Promise((r) => setTimeout(r, mutexTimeoutMs))
|
|
1916
|
+
]);
|
|
1858
1917
|
} catch {
|
|
1859
1918
|
}
|
|
1860
1919
|
});
|
|
@@ -1868,8 +1927,8 @@ var CloudAgent = class _CloudAgent {
|
|
|
1868
1927
|
}
|
|
1869
1928
|
const userText = typeof message === "string" ? message : message.text;
|
|
1870
1929
|
const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
|
|
1871
|
-
const apiKey =
|
|
1872
|
-
const useRealRuntime = apiKey !== void 0 && !
|
|
1930
|
+
const apiKey = chunkRNXXYF22_cjs.resolveApiKey(this.options.apiKey);
|
|
1931
|
+
const useRealRuntime = apiKey !== void 0 && !chunkLSWHDOCL_cjs.isFixtureApiKey(apiKey) && chunkLSWHDOCL_cjs.getConfiguredBaseUrl() !== void 0;
|
|
1873
1932
|
return useRealRuntime ? createRealCloudRun({
|
|
1874
1933
|
agentId: this.agentId,
|
|
1875
1934
|
model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
|
|
@@ -1918,7 +1977,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1918
1977
|
listArtifacts() {
|
|
1919
1978
|
if (!this.isFixtureMode()) {
|
|
1920
1979
|
return Promise.reject(
|
|
1921
|
-
new
|
|
1980
|
+
new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
1922
1981
|
"Cloud runtime is pre-release. listArtifacts() will return real artifacts when Theo PaaS ships; today it is only available in fixture mode (theo_test_* keys).",
|
|
1923
1982
|
{ code: "cloud_runtime_pre_release" }
|
|
1924
1983
|
)
|
|
@@ -1928,11 +1987,11 @@ var CloudAgent = class _CloudAgent {
|
|
|
1928
1987
|
}
|
|
1929
1988
|
downloadArtifact(path) {
|
|
1930
1989
|
try {
|
|
1931
|
-
|
|
1990
|
+
chunk3KIUY67P_cjs.validateArtifactPath(path);
|
|
1932
1991
|
} catch (cause) {
|
|
1933
|
-
if (cause instanceof
|
|
1992
|
+
if (cause instanceof chunk3KIUY67P_cjs.PathTraversalError) {
|
|
1934
1993
|
return Promise.reject(
|
|
1935
|
-
new
|
|
1994
|
+
new chunkCEGU5AVD_cjs.ConfigurationError(`Artifact path must stay inside the workspace: ${path}`, {
|
|
1936
1995
|
code: "artifact_path_traversal",
|
|
1937
1996
|
cause
|
|
1938
1997
|
})
|
|
@@ -1942,7 +2001,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1942
2001
|
}
|
|
1943
2002
|
if (!this.isFixtureMode()) {
|
|
1944
2003
|
return Promise.reject(
|
|
1945
|
-
new
|
|
2004
|
+
new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
1946
2005
|
"Cloud runtime is pre-release. downloadArtifact() will fetch real PaaS artifacts when the cloud runtime ships; today it is only available in fixture mode (theo_test_* keys).",
|
|
1947
2006
|
{ code: "cloud_runtime_pre_release" }
|
|
1948
2007
|
)
|
|
@@ -1951,7 +2010,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1951
2010
|
const match = buildFixtureArtifacts().find((artifact) => artifact.path === path);
|
|
1952
2011
|
if (match === void 0) {
|
|
1953
2012
|
return Promise.reject(
|
|
1954
|
-
new
|
|
2013
|
+
new chunkCEGU5AVD_cjs.UnknownAgentError(`Artifact ${path} not found`, { code: "unknown_artifact" })
|
|
1955
2014
|
);
|
|
1956
2015
|
}
|
|
1957
2016
|
return Promise.resolve(Buffer.from(`fixture artifact content for ${path}
|
|
@@ -1965,7 +2024,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1965
2024
|
* @public
|
|
1966
2025
|
*/
|
|
1967
2026
|
runUntil() {
|
|
1968
|
-
throw new
|
|
2027
|
+
throw new chunkCEGU5AVD_cjs.UnsupportedRunOperationError(
|
|
1969
2028
|
"Agent.runUntil() is not supported on cloud agents. Cloud runtime manages goal loops server-side. Use a local agent for autonomous Ralph loops.",
|
|
1970
2029
|
"runUntil"
|
|
1971
2030
|
);
|
|
@@ -1976,7 +2035,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1976
2035
|
* @public
|
|
1977
2036
|
*/
|
|
1978
2037
|
fork() {
|
|
1979
|
-
throw new
|
|
2038
|
+
throw new chunkCEGU5AVD_cjs.UnsupportedRunOperationError(
|
|
1980
2039
|
"Agent.fork() is not supported on cloud agents. Fork inheritance requires local credential + system-prompt access. Use a local agent.",
|
|
1981
2040
|
"fork"
|
|
1982
2041
|
);
|
|
@@ -1988,7 +2047,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
1988
2047
|
* @public
|
|
1989
2048
|
*/
|
|
1990
2049
|
runToCompletion() {
|
|
1991
|
-
throw new
|
|
2050
|
+
throw new chunkCEGU5AVD_cjs.UnsupportedRunOperationError(
|
|
1992
2051
|
"Agent.runToCompletion() is not supported on cloud agents. Cloud runtime manages continuation server-side. Use a local agent.",
|
|
1993
2052
|
"runToCompletion"
|
|
1994
2053
|
);
|
|
@@ -2000,7 +2059,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
2000
2059
|
* @public
|
|
2001
2060
|
*/
|
|
2002
2061
|
streamToCompletion() {
|
|
2003
|
-
throw new
|
|
2062
|
+
throw new chunkCEGU5AVD_cjs.UnsupportedRunOperationError(
|
|
2004
2063
|
"Agent.streamToCompletion() is not supported on cloud agents. Cloud runtime manages continuation server-side. Use a local agent.",
|
|
2005
2064
|
"streamToCompletion"
|
|
2006
2065
|
);
|
|
@@ -2014,7 +2073,7 @@ var CloudAgent = class _CloudAgent {
|
|
|
2014
2073
|
*/
|
|
2015
2074
|
usePersonality() {
|
|
2016
2075
|
return Promise.reject(
|
|
2017
|
-
new
|
|
2076
|
+
new chunkCEGU5AVD_cjs.UnsupportedRunOperationError(
|
|
2018
2077
|
"Agent.usePersonality() is not supported on cloud agents (pre-release). Use a local agent or wait for cloud GA.",
|
|
2019
2078
|
"usePersonality"
|
|
2020
2079
|
)
|
|
@@ -2042,7 +2101,7 @@ function validateCloudToolParity(options) {
|
|
|
2042
2101
|
function rejectProcessors(options) {
|
|
2043
2102
|
const hasProcessors = (options.inputProcessors?.length ?? 0) > 0 || (options.outputProcessors?.length ?? 0) > 0;
|
|
2044
2103
|
if (hasProcessors) {
|
|
2045
|
-
throw new
|
|
2104
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
2046
2105
|
"Cloud agents can't run guardrail processors \u2014 a Processor carries function handlers that don't survive serialization to PaaS. Run processors on a local agent, or move the guardrail into a server-side gateway in front of TheoCloud.",
|
|
2047
2106
|
{ code: "cloud_incompatible_function_resolver" }
|
|
2048
2107
|
);
|
|
@@ -2050,7 +2109,7 @@ function rejectProcessors(options) {
|
|
|
2050
2109
|
}
|
|
2051
2110
|
function rejectFunctionSystemPrompt(options) {
|
|
2052
2111
|
if (typeof options.systemPrompt === "function") {
|
|
2053
|
-
throw new
|
|
2112
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
2054
2113
|
"Cloud agents require systemPrompt as a serializable string. SystemPromptResolver functions can't run on PaaS \u2014 resolve to a string before Agent.create() or move the dynamic logic into a hook rule.",
|
|
2055
2114
|
{ code: "cloud_incompatible_function_resolver" }
|
|
2056
2115
|
);
|
|
@@ -2058,7 +2117,7 @@ function rejectFunctionSystemPrompt(options) {
|
|
|
2058
2117
|
}
|
|
2059
2118
|
function rejectFunctionSkills(options) {
|
|
2060
2119
|
if (typeof options.skills === "function") {
|
|
2061
|
-
throw new
|
|
2120
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
2062
2121
|
"Cloud agents require skills as a static settings object. SkillsResolver functions can't run on PaaS \u2014 resolve to a SkillsSettings object before Agent.create() or move the dynamic logic into a hook rule.",
|
|
2063
2122
|
{ code: "cloud_incompatible_function_resolver" }
|
|
2064
2123
|
);
|
|
@@ -2070,7 +2129,7 @@ function rejectStdioMcpLocalPaths(options) {
|
|
|
2070
2129
|
if (!isStdioCommandConfig(config)) continue;
|
|
2071
2130
|
const command = config.command ?? "";
|
|
2072
2131
|
if (isLocalPath(command)) {
|
|
2073
|
-
throw new
|
|
2132
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
2074
2133
|
`MCP server "${name}" uses a local-FS command path (${command}). Cloud agents can't reach local binaries \u2014 use a bare command (npx, uvx, node, \u2026) that the PaaS VM image provides, or switch to an HTTP MCP server.`,
|
|
2075
2134
|
{ code: "cloud_incompatible_mcp_stdio_local" }
|
|
2076
2135
|
);
|
|
@@ -2090,19 +2149,19 @@ function isLocalPath(command) {
|
|
|
2090
2149
|
function resolveSessionDir(local) {
|
|
2091
2150
|
if (local?.sessionDir !== void 0) {
|
|
2092
2151
|
if (local.baseDir !== void 0) {
|
|
2093
|
-
|
|
2152
|
+
chunkRNXXYF22_cjs.diag(
|
|
2094
2153
|
"[theokit-sdk] local.sessionDir and local.baseDir are both set; using sessionDir. baseDir is the deprecated name for the same option (#301)."
|
|
2095
2154
|
);
|
|
2096
2155
|
}
|
|
2097
|
-
return
|
|
2156
|
+
return chunk3WKWBYPO_cjs.expandTilde(local.sessionDir);
|
|
2098
2157
|
}
|
|
2099
2158
|
if (local?.baseDir !== void 0) {
|
|
2100
|
-
|
|
2159
|
+
chunkRNXXYF22_cjs.diag(
|
|
2101
2160
|
"[theokit-sdk] local.baseDir is deprecated; rename it to local.sessionDir (#301). It is the directory for session transcripts, not the working directory \u2014 that is local.cwd."
|
|
2102
2161
|
);
|
|
2103
|
-
return
|
|
2162
|
+
return chunk3WKWBYPO_cjs.expandTilde(local.baseDir);
|
|
2104
2163
|
}
|
|
2105
|
-
return
|
|
2164
|
+
return chunk3WKWBYPO_cjs.defaultBaseDir();
|
|
2106
2165
|
}
|
|
2107
2166
|
var SCHEMA_VERSION2 = 1;
|
|
2108
2167
|
var FILE_NAME = "personality.json";
|
|
@@ -2129,14 +2188,14 @@ async function readState(filePath) {
|
|
|
2129
2188
|
try {
|
|
2130
2189
|
parsed = JSON.parse(raw);
|
|
2131
2190
|
} catch {
|
|
2132
|
-
|
|
2191
|
+
chunkUDAKAE4Z_cjs.warnOnce(
|
|
2133
2192
|
"personality-store-json-parse",
|
|
2134
2193
|
"[theokit-sdk] personality.json is malformed; treating as empty"
|
|
2135
2194
|
);
|
|
2136
2195
|
return emptyState();
|
|
2137
2196
|
}
|
|
2138
2197
|
if (!isStateV1(parsed)) {
|
|
2139
|
-
|
|
2198
|
+
chunkUDAKAE4Z_cjs.warnOnce(
|
|
2140
2199
|
"personality-store-bad-version",
|
|
2141
2200
|
`[theokit-sdk] personality.json has unknown version; treating as empty (file kept untouched)`
|
|
2142
2201
|
);
|
|
@@ -2167,9 +2226,9 @@ var PersonalityStore = class {
|
|
|
2167
2226
|
try {
|
|
2168
2227
|
await this.#persist(agentId, slug);
|
|
2169
2228
|
} catch (err) {
|
|
2170
|
-
|
|
2229
|
+
chunkUDAKAE4Z_cjs.warnOnce(
|
|
2171
2230
|
`personality-store-persist-failure-${agentId}`,
|
|
2172
|
-
`[theokit-sdk] personality persist failed for ${
|
|
2231
|
+
`[theokit-sdk] personality persist failed for ${chunkRNXXYF22_cjs.redactSecrets(agentId)}: ${chunkRNXXYF22_cjs.redactSecrets(
|
|
2173
2232
|
err.message
|
|
2174
2233
|
)}`
|
|
2175
2234
|
);
|
|
@@ -2184,9 +2243,9 @@ var PersonalityStore = class {
|
|
|
2184
2243
|
try {
|
|
2185
2244
|
state = await readState(filePath);
|
|
2186
2245
|
} catch (err) {
|
|
2187
|
-
|
|
2246
|
+
chunkUDAKAE4Z_cjs.warnOnce(
|
|
2188
2247
|
`personality-store-hydrate-failure-${agentId}`,
|
|
2189
|
-
`[theokit-sdk] personality hydrate failed for ${
|
|
2248
|
+
`[theokit-sdk] personality hydrate failed for ${chunkRNXXYF22_cjs.redactSecrets(agentId)}: ${chunkRNXXYF22_cjs.redactSecrets(
|
|
2190
2249
|
err.message
|
|
2191
2250
|
)}`
|
|
2192
2251
|
);
|
|
@@ -2203,17 +2262,17 @@ var PersonalityStore = class {
|
|
|
2203
2262
|
async #persist(agentId, slug) {
|
|
2204
2263
|
const filePath = this.#filePath();
|
|
2205
2264
|
await promises.mkdir(path.dirname(filePath), { recursive: true });
|
|
2206
|
-
await
|
|
2265
|
+
await chunkG7XBVM3T_cjs.withFileLock(filePath, async () => {
|
|
2207
2266
|
const current = await readState(filePath);
|
|
2208
2267
|
const nextAgents = { ...current.agents };
|
|
2209
2268
|
if (slug === void 0) delete nextAgents[agentId];
|
|
2210
2269
|
else nextAgents[agentId] = slug;
|
|
2211
2270
|
const next = { version: SCHEMA_VERSION2, agents: nextAgents };
|
|
2212
|
-
await
|
|
2271
|
+
await chunkZOFRNNZD_cjs.atomicWriteJson(filePath, next);
|
|
2213
2272
|
});
|
|
2214
2273
|
}
|
|
2215
2274
|
#filePath() {
|
|
2216
|
-
return path.join(
|
|
2275
|
+
return path.join(chunkYQ3XC6C2_cjs.getTheokitHome(this.#cwd), FILE_NAME);
|
|
2217
2276
|
}
|
|
2218
2277
|
};
|
|
2219
2278
|
|
|
@@ -2248,7 +2307,7 @@ function createPluginContext() {
|
|
|
2248
2307
|
},
|
|
2249
2308
|
on(hook, handler) {
|
|
2250
2309
|
if (typeof handler !== "function") {
|
|
2251
|
-
|
|
2310
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] ignoring non-function handler for hook "${hook}"
|
|
2252
2311
|
`);
|
|
2253
2312
|
return () => void 0;
|
|
2254
2313
|
}
|
|
@@ -2302,7 +2361,7 @@ var PluginManager = class {
|
|
|
2302
2361
|
const seen = /* @__PURE__ */ new Set();
|
|
2303
2362
|
for (const plugin of plugins) {
|
|
2304
2363
|
if (seen.has(plugin.name)) {
|
|
2305
|
-
|
|
2364
|
+
chunkRNXXYF22_cjs.diag(
|
|
2306
2365
|
`[theokit-sdk] duplicate plugin name "${plugin.name}" \u2014 both will register independently
|
|
2307
2366
|
`
|
|
2308
2367
|
);
|
|
@@ -2329,7 +2388,7 @@ var PluginManager = class {
|
|
|
2329
2388
|
*/
|
|
2330
2389
|
async register(plugin) {
|
|
2331
2390
|
if (plugin.kind !== "general") {
|
|
2332
|
-
throw new
|
|
2391
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
2333
2392
|
`late register supports general plugins only (got "${plugin.kind}" for "${plugin.name}")`,
|
|
2334
2393
|
{ code: "plugin_late_register_kind" }
|
|
2335
2394
|
);
|
|
@@ -2386,7 +2445,7 @@ var PluginManager = class {
|
|
|
2386
2445
|
parts.push(result.recalledContext);
|
|
2387
2446
|
}
|
|
2388
2447
|
} catch (err) {
|
|
2389
|
-
|
|
2448
|
+
chunkRNXXYF22_cjs.diag(
|
|
2390
2449
|
`[theokit-sdk] pre_user_send hook failed: ${err instanceof Error ? err.message : String(err)}
|
|
2391
2450
|
`
|
|
2392
2451
|
);
|
|
@@ -2414,7 +2473,7 @@ var PluginManager = class {
|
|
|
2414
2473
|
try {
|
|
2415
2474
|
await h(ctx);
|
|
2416
2475
|
} catch (err) {
|
|
2417
|
-
|
|
2476
|
+
chunkRNXXYF22_cjs.diag(
|
|
2418
2477
|
`[theokit-sdk] post_assistant_reply hook failed: ${err instanceof Error ? err.message : String(err)}
|
|
2419
2478
|
`
|
|
2420
2479
|
);
|
|
@@ -2430,7 +2489,7 @@ var PluginManager = class {
|
|
|
2430
2489
|
try {
|
|
2431
2490
|
await h(ctx);
|
|
2432
2491
|
} catch (err) {
|
|
2433
|
-
|
|
2492
|
+
chunkRNXXYF22_cjs.diag(
|
|
2434
2493
|
`[theokit-sdk] ${name} hook failed: ${err instanceof Error ? err.message : String(err)}
|
|
2435
2494
|
`
|
|
2436
2495
|
);
|
|
@@ -2445,7 +2504,7 @@ var PluginManager = class {
|
|
|
2445
2504
|
const out = await h(current, ctx);
|
|
2446
2505
|
if (out !== void 0) current = out;
|
|
2447
2506
|
} catch (err) {
|
|
2448
|
-
|
|
2507
|
+
chunkRNXXYF22_cjs.diag(
|
|
2449
2508
|
`[theokit-sdk] ${name} hook failed: ${err instanceof Error ? err.message : String(err)}
|
|
2450
2509
|
`
|
|
2451
2510
|
);
|
|
@@ -2530,7 +2589,7 @@ function removeAll(arr, toRemove) {
|
|
|
2530
2589
|
}
|
|
2531
2590
|
}
|
|
2532
2591
|
function readCompatConfigFile(cwd) {
|
|
2533
|
-
const path$1 = path.join(
|
|
2592
|
+
const path$1 = path.join(chunkYQ3XC6C2_cjs.theokitConfigRoot(cwd), "config.json");
|
|
2534
2593
|
if (!fs.existsSync(path$1)) return [];
|
|
2535
2594
|
let raw;
|
|
2536
2595
|
try {
|
|
@@ -2542,7 +2601,7 @@ function readCompatConfigFile(cwd) {
|
|
|
2542
2601
|
try {
|
|
2543
2602
|
parsed = JSON.parse(raw);
|
|
2544
2603
|
} catch (cause) {
|
|
2545
|
-
|
|
2604
|
+
chunkRNXXYF22_cjs.diag(
|
|
2546
2605
|
`[theokit] ${path$1} is not valid JSON \u2014 ignoring its "compat.adapters" (${cause.message}).
|
|
2547
2606
|
`
|
|
2548
2607
|
);
|
|
@@ -2551,7 +2610,7 @@ function readCompatConfigFile(cwd) {
|
|
|
2551
2610
|
const adapters = parsed.compat?.adapters;
|
|
2552
2611
|
if (adapters === void 0) return [];
|
|
2553
2612
|
if (!Array.isArray(adapters)) {
|
|
2554
|
-
|
|
2613
|
+
chunkRNXXYF22_cjs.diag(`[theokit] ${path$1}: "compat.adapters" must be an array \u2014 ignoring it.
|
|
2555
2614
|
`);
|
|
2556
2615
|
return [];
|
|
2557
2616
|
}
|
|
@@ -2593,7 +2652,7 @@ function readPolicyDocument(path) {
|
|
|
2593
2652
|
try {
|
|
2594
2653
|
raw = fs.readFileSync(path, "utf8");
|
|
2595
2654
|
} catch (cause) {
|
|
2596
|
-
|
|
2655
|
+
chunkRNXXYF22_cjs.diagFailure(
|
|
2597
2656
|
`[theokit-sdk] ${path} exists and could not be read (${cause.message}) \u2014 NO operator policy is being applied. Fix the permissions or remove the file.
|
|
2598
2657
|
`
|
|
2599
2658
|
);
|
|
@@ -2603,14 +2662,14 @@ function readPolicyDocument(path) {
|
|
|
2603
2662
|
try {
|
|
2604
2663
|
parsed = JSON.parse(raw);
|
|
2605
2664
|
} catch (cause) {
|
|
2606
|
-
|
|
2665
|
+
chunkRNXXYF22_cjs.diagFailure(
|
|
2607
2666
|
`[theokit-sdk] ${path} is not valid JSON (${cause.message}) \u2014 NO operator policy is being applied.
|
|
2608
2667
|
`
|
|
2609
2668
|
);
|
|
2610
2669
|
return void 0;
|
|
2611
2670
|
}
|
|
2612
2671
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
2613
|
-
|
|
2672
|
+
chunkRNXXYF22_cjs.diagFailure(
|
|
2614
2673
|
`[theokit-sdk] ${path} is not a JSON object \u2014 NO operator policy is being applied.
|
|
2615
2674
|
`
|
|
2616
2675
|
);
|
|
@@ -2640,7 +2699,7 @@ function applyPolicyKey(out, key, value, path) {
|
|
|
2640
2699
|
if (key === "disableSkillShellExecution") out.disableSkillShellExecution = flag;
|
|
2641
2700
|
}
|
|
2642
2701
|
function decline(path, key, reason) {
|
|
2643
|
-
|
|
2702
|
+
chunkRNXXYF22_cjs.diagFailure(`[theokit-sdk] ${path} declares "${key}" \u2014 ${reason}. It is NOT being applied.
|
|
2644
2703
|
`);
|
|
2645
2704
|
}
|
|
2646
2705
|
function readMode(value, path) {
|
|
@@ -2733,7 +2792,7 @@ var HooksExecutor = class {
|
|
|
2733
2792
|
config = {};
|
|
2734
2793
|
async initialize(settingSourcesIncludeProject) {
|
|
2735
2794
|
if (readManagedSettings(this.policy.managedSettingsRoot).disableAllHooks === true) {
|
|
2736
|
-
|
|
2795
|
+
chunkUDAKAE4Z_cjs.warnFailureOnce(
|
|
2737
2796
|
"hooks-disabled-by-policy",
|
|
2738
2797
|
"[theokit-sdk] hooks: an operator policy (managed-settings.json) declares disableAllHooks \u2014 NO hook will run, including any this project declared."
|
|
2739
2798
|
);
|
|
@@ -2744,7 +2803,7 @@ var HooksExecutor = class {
|
|
|
2744
2803
|
this.config = {};
|
|
2745
2804
|
return;
|
|
2746
2805
|
}
|
|
2747
|
-
this.config = await
|
|
2806
|
+
this.config = await chunkUDAKAE4Z_cjs.loadHookConfig(this.cwd, this.compatSources);
|
|
2748
2807
|
}
|
|
2749
2808
|
/** Fire every hook registered for `event` and aggregate the decisions. */
|
|
2750
2809
|
async run(payload) {
|
|
@@ -2839,7 +2898,7 @@ var HooksExecutor = class {
|
|
|
2839
2898
|
if (result.exitCode === 0) return void 0;
|
|
2840
2899
|
const stderr = result.stderr.trim();
|
|
2841
2900
|
const base = stderr.length > 0 ? stderr : `Hook exited with code ${result.exitCode}`;
|
|
2842
|
-
const missing =
|
|
2901
|
+
const missing = chunkYQ3XC6C2_cjs.undefinedVariablesIn(command.command, env);
|
|
2843
2902
|
if (missing.length === 0) return { decision: "deny", reason: base };
|
|
2844
2903
|
return {
|
|
2845
2904
|
decision: "deny",
|
|
@@ -2859,7 +2918,7 @@ function stdinPayloadFor(payload, command, cwd) {
|
|
|
2859
2918
|
}
|
|
2860
2919
|
function runtimeEnvFor(sourcePath, cwd) {
|
|
2861
2920
|
if (sourcePath === void 0) return {};
|
|
2862
|
-
return
|
|
2921
|
+
return chunkYQ3XC6C2_cjs.adapterForConfigPath(sourcePath)?.runtimeEnv(cwd) ?? {};
|
|
2863
2922
|
}
|
|
2864
2923
|
function parseDecisionFromStdout(stdout) {
|
|
2865
2924
|
const trimmed = stdout.trim();
|
|
@@ -2907,11 +2966,11 @@ function sessionTranscriptAllowed(memory) {
|
|
|
2907
2966
|
}
|
|
2908
2967
|
function resolveWindowForRun(model, contextWindow) {
|
|
2909
2968
|
const override = contextWindow !== void 0 && contextWindow > 0 ? contextWindow : void 0;
|
|
2910
|
-
return
|
|
2969
|
+
return chunkKX5QXLBS_cjs.resolveEffectiveContextWindow({
|
|
2911
2970
|
...override !== void 0 ? { override } : {},
|
|
2912
|
-
catalog:
|
|
2913
|
-
margin:
|
|
2914
|
-
floor:
|
|
2971
|
+
catalog: chunkS46WJTDL_cjs.getCatalogModelInfo(model)?.limit?.context,
|
|
2972
|
+
margin: chunkKX5QXLBS_cjs.CONTEXT_WINDOW_MARGIN,
|
|
2973
|
+
floor: chunkKX5QXLBS_cjs.CONTEXT_WINDOW_FLOOR
|
|
2915
2974
|
});
|
|
2916
2975
|
}
|
|
2917
2976
|
async function runPostRunLifecycle(inputs) {
|
|
@@ -2929,37 +2988,37 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2929
2988
|
} = inputs;
|
|
2930
2989
|
let result;
|
|
2931
2990
|
try {
|
|
2932
|
-
result = await run
|
|
2991
|
+
result = await readRunResolving(run);
|
|
2933
2992
|
} catch {
|
|
2934
2993
|
try {
|
|
2935
2994
|
const partial = await safeConversation(run);
|
|
2936
2995
|
if (partial !== void 0) {
|
|
2937
|
-
|
|
2996
|
+
chunkYOVZMN4P_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
|
|
2938
2997
|
userText,
|
|
2939
2998
|
conversation: partial
|
|
2940
2999
|
});
|
|
2941
3000
|
}
|
|
2942
3001
|
} catch (cause) {
|
|
2943
3002
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
2944
|
-
|
|
3003
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
|
|
2945
3004
|
`);
|
|
2946
3005
|
}
|
|
2947
|
-
await
|
|
3006
|
+
await chunkYOVZMN4P_cjs.flushSessionWrites();
|
|
2948
3007
|
return;
|
|
2949
3008
|
}
|
|
2950
3009
|
if (result.result !== void 0) {
|
|
2951
|
-
|
|
3010
|
+
chunkYOVZMN4P_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
|
|
2952
3011
|
}
|
|
2953
3012
|
const conversation = await safeConversation(run);
|
|
2954
3013
|
const resolvedWindow = resolveWindowForRun(model, contextWindow);
|
|
2955
3014
|
const effectiveWindow = resolvedWindow.window;
|
|
2956
3015
|
const budgetEvent = buildContextBudgetEvent(model, resolvedWindow);
|
|
2957
3016
|
if (budgetEvent !== void 0 && onRunEvent !== void 0) {
|
|
2958
|
-
|
|
3017
|
+
chunkL7JPXZ2C_cjs.emitRunEvent(onRunEvent, budgetEvent);
|
|
2959
3018
|
}
|
|
2960
3019
|
const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
|
|
2961
3020
|
const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
|
|
2962
|
-
|
|
3021
|
+
chunkYOVZMN4P_cjs.persistTurnToTranscript(
|
|
2963
3022
|
sessionStore,
|
|
2964
3023
|
{ cwd: workspaceCwd, agentId, model },
|
|
2965
3024
|
agentId,
|
|
@@ -2971,20 +3030,20 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2971
3030
|
// The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
|
|
2972
3031
|
// `contextWindow` here would budget against a number the clamp already rejected.
|
|
2973
3032
|
contextWindow: effectiveWindow,
|
|
2974
|
-
summarize:
|
|
3033
|
+
summarize: chunkLSWHDOCL_cjs.buildDefaultSummarizer({
|
|
2975
3034
|
agentModel: model,
|
|
2976
3035
|
...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
|
|
2977
3036
|
})
|
|
2978
3037
|
}
|
|
2979
3038
|
},
|
|
2980
|
-
onRunEvent !== void 0 ? () =>
|
|
3039
|
+
onRunEvent !== void 0 ? () => chunkL7JPXZ2C_cjs.emitRunEvent(onRunEvent, { type: "compact_boundary", trigger: "auto" }) : void 0
|
|
2981
3040
|
);
|
|
2982
3041
|
if (result.status === "finished" && result.result !== void 0 && sessionTranscriptAllowed(inputs.memory)) {
|
|
2983
3042
|
const summaryArgs = {
|
|
2984
3043
|
cwd: workspaceCwd,
|
|
2985
3044
|
// Resolved once, here, and handed to both writers. Recomputing it inside either one is how
|
|
2986
3045
|
// the summary ended up in a directory the indexer never scanned (#463).
|
|
2987
|
-
memoryRoot:
|
|
3046
|
+
memoryRoot: chunkSDZ4XDWS_cjs.resolveMemoryRoot(workspaceCwd, inputs.memory),
|
|
2988
3047
|
runId: result.id,
|
|
2989
3048
|
agentId,
|
|
2990
3049
|
userText,
|
|
@@ -2996,11 +3055,11 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2996
3055
|
if (memoryProvider?.recordSessionSummary !== void 0) {
|
|
2997
3056
|
await memoryProvider.recordSessionSummary(summaryArgs);
|
|
2998
3057
|
} else {
|
|
2999
|
-
await
|
|
3058
|
+
await chunkSDZ4XDWS_cjs.writeSessionSummary(summaryArgs);
|
|
3000
3059
|
}
|
|
3001
3060
|
} catch (cause) {
|
|
3002
3061
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
3003
|
-
|
|
3062
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] session summary write failed (${result.id}): ${message}
|
|
3004
3063
|
`);
|
|
3005
3064
|
}
|
|
3006
3065
|
}
|
|
@@ -3013,14 +3072,14 @@ async function runPostRunLifecycle(inputs) {
|
|
|
3013
3072
|
agentId,
|
|
3014
3073
|
runId: result.id
|
|
3015
3074
|
});
|
|
3016
|
-
await
|
|
3075
|
+
await chunkYOVZMN4P_cjs.flushSessionWrites();
|
|
3017
3076
|
}
|
|
3018
3077
|
async function safeConversation(run) {
|
|
3019
3078
|
try {
|
|
3020
3079
|
return await run.conversation();
|
|
3021
3080
|
} catch (cause) {
|
|
3022
3081
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
3023
|
-
|
|
3082
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] conversation() failed; persisting the user turn only: ${msg}
|
|
3024
3083
|
`);
|
|
3025
3084
|
return [];
|
|
3026
3085
|
}
|
|
@@ -3048,17 +3107,17 @@ var SkillsManager = class {
|
|
|
3048
3107
|
}
|
|
3049
3108
|
async refresh() {
|
|
3050
3109
|
const roots = this.skillsDir === void 0 ? [
|
|
3051
|
-
...
|
|
3110
|
+
...chunkYQ3XC6C2_cjs.projectConfigRoots(this.cwd, this.compatSources, "skills").map(
|
|
3052
3111
|
(root) => path.join(root, "skills")
|
|
3053
3112
|
),
|
|
3054
|
-
...(await
|
|
3113
|
+
...(await chunkWDVG5R2Q_cjs.pluginBundleDirs(this.cwd, this.compatSources)).map((b) => path.join(b, "skills"))
|
|
3055
3114
|
] : [this.skillsDir];
|
|
3056
3115
|
const discovered = [];
|
|
3057
3116
|
const seen = /* @__PURE__ */ new Set();
|
|
3058
3117
|
for (const root of roots) {
|
|
3059
|
-
for (const skill of await
|
|
3118
|
+
for (const skill of await chunk7WARNHWW_cjs.discoverSkills(root, {
|
|
3060
3119
|
onInvalidSkill: (info) => {
|
|
3061
|
-
|
|
3120
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
|
|
3062
3121
|
`);
|
|
3063
3122
|
}
|
|
3064
3123
|
})) {
|
|
@@ -3087,7 +3146,7 @@ var SkillsManager = class {
|
|
|
3087
3146
|
async get(name) {
|
|
3088
3147
|
const skill = this.skills.find((s) => s.name === name);
|
|
3089
3148
|
if (skill === void 0) return void 0;
|
|
3090
|
-
const instructions = typeof skill.instructions === "string" ? skill.instructions :
|
|
3149
|
+
const instructions = typeof skill.instructions === "string" ? skill.instructions : chunk7WARNHWW_cjs.stripSkillFrontmatter(await promises.readFile(skill.source, "utf8"));
|
|
3091
3150
|
const references = skill.references;
|
|
3092
3151
|
return {
|
|
3093
3152
|
name: skill.name,
|
|
@@ -3143,7 +3202,7 @@ function defineTool(spec) {
|
|
|
3143
3202
|
}
|
|
3144
3203
|
|
|
3145
3204
|
// src/internal/runtime/system-prompt/native-reasoning.ts
|
|
3146
|
-
var NATIVE_REASONING_PARAM_IDS = /* @__PURE__ */ new Set(["thinking"
|
|
3205
|
+
var NATIVE_REASONING_PARAM_IDS = /* @__PURE__ */ new Set(["thinking"]);
|
|
3147
3206
|
var REASONING_PREAMBLE = "Think step by step before answering: use the `think` tool to reason through each step, validate your work, then answer. Reason about magnitude before comparing numbers.";
|
|
3148
3207
|
function createThinkTool() {
|
|
3149
3208
|
return Tool.create({
|
|
@@ -3163,8 +3222,8 @@ var warned = /* @__PURE__ */ new Set();
|
|
|
3163
3222
|
function warnDoubleReasoningOnce() {
|
|
3164
3223
|
if (warned.has("double-reasoning")) return;
|
|
3165
3224
|
warned.add("double-reasoning");
|
|
3166
|
-
|
|
3167
|
-
"[theokit-sdk] `reasoning: true` skipped \u2014 a native reasoning model is configured (model.params thinking
|
|
3225
|
+
chunkRNXXYF22_cjs.diag(
|
|
3226
|
+
"[theokit-sdk] `reasoning: true` skipped \u2014 a native reasoning model is configured (model.params thinking); native reasoning wins. Remove one to silence.\n"
|
|
3168
3227
|
);
|
|
3169
3228
|
}
|
|
3170
3229
|
function reasoningActive(reasoning, model) {
|
|
@@ -3260,7 +3319,7 @@ async function safeCall(fn, fallback, label = "safeCall") {
|
|
|
3260
3319
|
return await fn();
|
|
3261
3320
|
} catch (cause) {
|
|
3262
3321
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
3263
|
-
|
|
3322
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] ${label} failed: ${message}
|
|
3264
3323
|
`);
|
|
3265
3324
|
return fallback;
|
|
3266
3325
|
}
|
|
@@ -3274,7 +3333,7 @@ var ActiveMemoryPromptProvider = class {
|
|
|
3274
3333
|
if (ctx.activeMemorySummary === void 0 || ctx.activeMemorySummary.length === 0) {
|
|
3275
3334
|
return Promise.resolve(void 0);
|
|
3276
3335
|
}
|
|
3277
|
-
const body =
|
|
3336
|
+
const body = chunk7WARNHWW_cjs.escapeBlockBody(ctx.activeMemorySummary);
|
|
3278
3337
|
return Promise.resolve(`<active-memory>
|
|
3279
3338
|
${body}
|
|
3280
3339
|
</active-memory>`);
|
|
@@ -3327,7 +3386,7 @@ function formatSource(name, tokens) {
|
|
|
3327
3386
|
if (tokens.length === 0) {
|
|
3328
3387
|
return ` <source name="${escapeAttribute(name)}" />`;
|
|
3329
3388
|
}
|
|
3330
|
-
const body =
|
|
3389
|
+
const body = chunk7WARNHWW_cjs.escapeBlockBody(tokens.join(" "));
|
|
3331
3390
|
return ` <source name="${escapeAttribute(name)}">
|
|
3332
3391
|
${body}
|
|
3333
3392
|
</source>`;
|
|
@@ -3351,7 +3410,7 @@ var MemoryPromptProvider = class {
|
|
|
3351
3410
|
if (ctx.memory.length === 0) return Promise.resolve(void 0);
|
|
3352
3411
|
const lines = ctx.memory.map((fact) => {
|
|
3353
3412
|
const tag = fact.observations === 1 ? "[unconfirmed] " : "";
|
|
3354
|
-
return ` - ${tag}${
|
|
3413
|
+
return ` - ${tag}${chunk7WARNHWW_cjs.escapeBlockBody(fact.text)}`;
|
|
3355
3414
|
});
|
|
3356
3415
|
return Promise.resolve(`${MEMORY_GUIDANCE}
|
|
3357
3416
|
<memory>
|
|
@@ -3375,7 +3434,7 @@ var SkillsPromptProvider = class {
|
|
|
3375
3434
|
priority = 20;
|
|
3376
3435
|
contribute(ctx) {
|
|
3377
3436
|
if (ctx.skillsAutoInject === false) return Promise.resolve(void 0);
|
|
3378
|
-
return Promise.resolve(
|
|
3437
|
+
return Promise.resolve(chunk7WARNHWW_cjs.buildSkillsBlock(ctx.skills));
|
|
3379
3438
|
}
|
|
3380
3439
|
};
|
|
3381
3440
|
|
|
@@ -3387,7 +3446,7 @@ var SystemPromptPipeline = class _SystemPromptPipeline {
|
|
|
3387
3446
|
for (const p of providers) {
|
|
3388
3447
|
const key = `${p.priority}:${p.id}`;
|
|
3389
3448
|
if (seen.has(key)) {
|
|
3390
|
-
throw new
|
|
3449
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Duplicate system-prompt provider ${key}`, {
|
|
3391
3450
|
code: "pipeline_duplicate_provider"
|
|
3392
3451
|
});
|
|
3393
3452
|
}
|
|
@@ -3434,7 +3493,7 @@ function validateAgentOptions(options) {
|
|
|
3434
3493
|
ensureRuntimeShape(options);
|
|
3435
3494
|
if (options.local !== void 0) {
|
|
3436
3495
|
if (options.model === void 0) {
|
|
3437
|
-
throw new
|
|
3496
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError("Local agents require a model selection", {
|
|
3438
3497
|
code: "missing_model"
|
|
3439
3498
|
});
|
|
3440
3499
|
}
|
|
@@ -3458,7 +3517,7 @@ function validateCredentialPoolShape(options) {
|
|
|
3458
3517
|
([, arr]) => Array.isArray(arr) && arr.some((k) => typeof k === "string" && k.length > 0)
|
|
3459
3518
|
);
|
|
3460
3519
|
if (populated.length === 0) return;
|
|
3461
|
-
throw new
|
|
3520
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
3462
3521
|
"Ambiguous credential configuration: use either `apiKey: '...'` (single-key, simplest) OR `apiKeys: { provider: [...] }` (multi-key pool), not both.",
|
|
3463
3522
|
{ code: "credential_pool_ambiguous" }
|
|
3464
3523
|
);
|
|
@@ -3467,7 +3526,7 @@ function validatePlugins(options) {
|
|
|
3467
3526
|
const plugins = options.plugins;
|
|
3468
3527
|
if (plugins?.paths === void 0) return;
|
|
3469
3528
|
if (options.cloud !== void 0 && plugins.paths.length > 0) {
|
|
3470
|
-
throw new
|
|
3529
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
3471
3530
|
"Cloud agents require committed plugin manifests; local plugin paths are not supported",
|
|
3472
3531
|
{ code: "cloud_plugin_path_rejected" }
|
|
3473
3532
|
);
|
|
@@ -3475,7 +3534,7 @@ function validatePlugins(options) {
|
|
|
3475
3534
|
}
|
|
3476
3535
|
function ensureRuntimeShape(options) {
|
|
3477
3536
|
if (options.local !== void 0 && options.cloud !== void 0) {
|
|
3478
|
-
throw new
|
|
3537
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
3479
3538
|
"Pass either local or cloud \u2014 they are mutually exclusive runtimes",
|
|
3480
3539
|
{ code: "runtime_exclusive" }
|
|
3481
3540
|
);
|
|
@@ -3483,7 +3542,7 @@ function ensureRuntimeShape(options) {
|
|
|
3483
3542
|
}
|
|
3484
3543
|
function rejectProgrammaticHooks(options) {
|
|
3485
3544
|
if (options.hooks !== void 0) {
|
|
3486
|
-
throw new
|
|
3545
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
3487
3546
|
"Programmatic hooks are not supported \u2014 hooks are file-based only (.theokit/hooks.json)",
|
|
3488
3547
|
{ code: "programmatic_hooks_rejected" }
|
|
3489
3548
|
);
|
|
@@ -3493,7 +3552,7 @@ function validateCloud(cloud) {
|
|
|
3493
3552
|
if (cloud.envVars !== void 0) {
|
|
3494
3553
|
for (const key of Object.keys(cloud.envVars)) {
|
|
3495
3554
|
if (key.startsWith("THEOKIT_")) {
|
|
3496
|
-
throw new
|
|
3555
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
3497
3556
|
`Cloud envVars cannot use the reserved THEOKIT_ prefix (got "${key}")`,
|
|
3498
3557
|
{ code: "reserved_env_prefix" }
|
|
3499
3558
|
);
|
|
@@ -3505,7 +3564,7 @@ function validateMcpServers(options) {
|
|
|
3505
3564
|
if (options.mcpServers === void 0) return;
|
|
3506
3565
|
for (const [name, config] of Object.entries(options.mcpServers)) {
|
|
3507
3566
|
if (options.cloud !== void 0 && isStdioWithCwd(config)) {
|
|
3508
|
-
throw new
|
|
3567
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
3509
3568
|
`MCP server "${name}" uses stdio with cwd, which is rejected for cloud agents`,
|
|
3510
3569
|
{ code: "cloud_stdio_cwd_rejected" }
|
|
3511
3570
|
);
|
|
@@ -3524,12 +3583,12 @@ function validateSubagents(agents2) {
|
|
|
3524
3583
|
if (agents2 === void 0) return;
|
|
3525
3584
|
for (const [name, definition] of Object.entries(agents2)) {
|
|
3526
3585
|
if (typeof definition.description !== "string" || definition.description.length === 0) {
|
|
3527
|
-
throw new
|
|
3586
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty description`, {
|
|
3528
3587
|
code: "subagent_missing_description"
|
|
3529
3588
|
});
|
|
3530
3589
|
}
|
|
3531
3590
|
if (typeof definition.prompt !== "string" || definition.prompt.length === 0) {
|
|
3532
|
-
throw new
|
|
3591
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty prompt`, {
|
|
3533
3592
|
code: "subagent_missing_prompt"
|
|
3534
3593
|
});
|
|
3535
3594
|
}
|
|
@@ -3548,7 +3607,7 @@ function validateToolCatalog(tools, withheldBuiltins) {
|
|
|
3548
3607
|
for (const tool of tools) {
|
|
3549
3608
|
validateSingleTool(tool, reserved);
|
|
3550
3609
|
if (seen.has(tool.name)) {
|
|
3551
|
-
throw new
|
|
3610
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Duplicate custom tool name "${tool.name}"`, {
|
|
3552
3611
|
code: "duplicate_tool_name"
|
|
3553
3612
|
});
|
|
3554
3613
|
}
|
|
@@ -3559,7 +3618,7 @@ function validateCustomTools(options) {
|
|
|
3559
3618
|
const tools = options.tools;
|
|
3560
3619
|
if (tools === void 0 || tools.length === 0) return;
|
|
3561
3620
|
if (options.cloud !== void 0) {
|
|
3562
|
-
throw new
|
|
3621
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
3563
3622
|
"Custom inline tools are local-only in SDK v1.0 \u2014 cloud agents cannot serialize handler functions",
|
|
3564
3623
|
{ code: "cloud_custom_tools_rejected" }
|
|
3565
3624
|
);
|
|
@@ -3571,25 +3630,25 @@ function validateSingleTool(tool, reserved) {
|
|
|
3571
3630
|
validateToolDescription(tool);
|
|
3572
3631
|
validateToolSchema(tool);
|
|
3573
3632
|
if (typeof tool.handler !== "function") {
|
|
3574
|
-
throw new
|
|
3633
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a handler function`, {
|
|
3575
3634
|
code: "tool_missing_handler"
|
|
3576
3635
|
});
|
|
3577
3636
|
}
|
|
3578
3637
|
}
|
|
3579
3638
|
function validateToolName(tool, reserved) {
|
|
3580
3639
|
if (typeof tool.name !== "string" || tool.name.length === 0) {
|
|
3581
|
-
throw new
|
|
3640
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError("Custom tool requires a non-empty name", {
|
|
3582
3641
|
code: "tool_missing_name"
|
|
3583
3642
|
});
|
|
3584
3643
|
}
|
|
3585
3644
|
if (!TOOL_NAME_PATTERN.test(tool.name)) {
|
|
3586
|
-
throw new
|
|
3645
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
3587
3646
|
`Custom tool name "${tool.name}" must match /^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/`,
|
|
3588
3647
|
{ code: "tool_invalid_name" }
|
|
3589
3648
|
);
|
|
3590
3649
|
}
|
|
3591
3650
|
if (reserved.has(tool.name) || tool.name.startsWith("mcp_")) {
|
|
3592
|
-
throw new
|
|
3651
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
3593
3652
|
`Custom tool name "${tool.name}" collides with a reserved SDK tool name`,
|
|
3594
3653
|
{ code: "tool_reserved_name" }
|
|
3595
3654
|
);
|
|
@@ -3597,7 +3656,7 @@ function validateToolName(tool, reserved) {
|
|
|
3597
3656
|
}
|
|
3598
3657
|
function validateToolDescription(tool) {
|
|
3599
3658
|
if (typeof tool.description !== "string" || tool.description.length === 0) {
|
|
3600
|
-
throw new
|
|
3659
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a non-empty description`, {
|
|
3601
3660
|
code: "tool_missing_description"
|
|
3602
3661
|
});
|
|
3603
3662
|
}
|
|
@@ -3605,12 +3664,12 @@ function validateToolDescription(tool) {
|
|
|
3605
3664
|
function validateToolSchema(tool) {
|
|
3606
3665
|
const schema = tool.inputSchema;
|
|
3607
3666
|
if (schema === null || schema === void 0 || typeof schema !== "object") {
|
|
3608
|
-
throw new
|
|
3667
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Custom tool "${tool.name}" requires an inputSchema object`, {
|
|
3609
3668
|
code: "tool_missing_schema"
|
|
3610
3669
|
});
|
|
3611
3670
|
}
|
|
3612
3671
|
if (schema.type !== "object") {
|
|
3613
|
-
throw new
|
|
3672
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
3614
3673
|
`Custom tool "${tool.name}" inputSchema must declare \`type: "object"\``,
|
|
3615
3674
|
{ code: "tool_invalid_schema_type" }
|
|
3616
3675
|
);
|
|
@@ -3618,11 +3677,11 @@ function validateToolSchema(tool) {
|
|
|
3618
3677
|
}
|
|
3619
3678
|
function validateMemory(options) {
|
|
3620
3679
|
const memory = options.memory;
|
|
3621
|
-
|
|
3680
|
+
chunkSDZ4XDWS_cjs.resolveMaxFacts(memory?.maxFacts);
|
|
3622
3681
|
if (memory?.storePath === void 0) return;
|
|
3623
3682
|
const storePath = memory.storePath;
|
|
3624
3683
|
if (storePath.includes("..") || storePath.startsWith("/") || /^[A-Z]:/i.test(storePath)) {
|
|
3625
|
-
throw new
|
|
3684
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
3626
3685
|
`Memory storePath must stay inside the workspace; got "${storePath}"`,
|
|
3627
3686
|
{ code: "memory_path_traversal" }
|
|
3628
3687
|
);
|
|
@@ -3644,7 +3703,7 @@ var HISTOGRAM_NAMES = {
|
|
|
3644
3703
|
};
|
|
3645
3704
|
function safeRequire(moduleName) {
|
|
3646
3705
|
try {
|
|
3647
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3706
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-Q6WT5535.cjs', document.baseURI).href)));
|
|
3648
3707
|
return r(moduleName);
|
|
3649
3708
|
} catch {
|
|
3650
3709
|
return void 0;
|
|
@@ -3726,7 +3785,7 @@ var langfuseAdapter = {
|
|
|
3726
3785
|
}
|
|
3727
3786
|
}
|
|
3728
3787
|
if (lf.LangfuseSpanProcessor === void 0) {
|
|
3729
|
-
|
|
3788
|
+
chunkRNXXYF22_cjs.diag(
|
|
3730
3789
|
"[theokit-sdk] @langfuse/node detected but LangfuseSpanProcessor not found (v2?). Use Langfuse v3+ for auto-instrumentation.\n"
|
|
3731
3790
|
);
|
|
3732
3791
|
return "not-wired";
|
|
@@ -3871,11 +3930,11 @@ function registerOne(adapter) {
|
|
|
3871
3930
|
try {
|
|
3872
3931
|
const wiring = adapter.register();
|
|
3873
3932
|
registered.set(adapter.moduleName, wiring);
|
|
3874
|
-
|
|
3933
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] telemetry: ${adapter.displayName} ${WIRING_PROSE[wiring]}.
|
|
3875
3934
|
`);
|
|
3876
3935
|
} catch (cause) {
|
|
3877
3936
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
3878
|
-
|
|
3937
|
+
chunkRNXXYF22_cjs.diag(
|
|
3879
3938
|
`[theokit-sdk] telemetry: ${adapter.displayName} detected but failed to register: ${message}
|
|
3880
3939
|
`
|
|
3881
3940
|
);
|
|
@@ -3887,7 +3946,7 @@ var cachedOtel;
|
|
|
3887
3946
|
function loadOtel() {
|
|
3888
3947
|
if (cachedOtel === void 0) {
|
|
3889
3948
|
try {
|
|
3890
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3949
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-Q6WT5535.cjs', document.baseURI).href)));
|
|
3891
3950
|
const mod = r("@opentelemetry/api");
|
|
3892
3951
|
cachedOtel = mod;
|
|
3893
3952
|
} catch {
|
|
@@ -3930,7 +3989,7 @@ function safe(op, fallback) {
|
|
|
3930
3989
|
if (!warnedOnce) {
|
|
3931
3990
|
warnedOnce = true;
|
|
3932
3991
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
3933
|
-
|
|
3992
|
+
chunkRNXXYF22_cjs.diag(
|
|
3934
3993
|
`[theokit-sdk] telemetry exporter error (suppressed; agent.send continues): ${message}
|
|
3935
3994
|
`
|
|
3936
3995
|
);
|
|
@@ -3944,7 +4003,7 @@ function createTelemetry(settings) {
|
|
|
3944
4003
|
if (otel === null) {
|
|
3945
4004
|
if (!warnedOnce) {
|
|
3946
4005
|
warnedOnce = true;
|
|
3947
|
-
|
|
4006
|
+
chunkRNXXYF22_cjs.diag(
|
|
3948
4007
|
"[theokit-sdk] telemetry.enabled = true but `@opentelemetry/api` is not installed; telemetry is a no-op.\n"
|
|
3949
4008
|
);
|
|
3950
4009
|
}
|
|
@@ -4038,12 +4097,12 @@ function wrapSpan(span, openSpans) {
|
|
|
4038
4097
|
}
|
|
4039
4098
|
function redactAttrValue(value) {
|
|
4040
4099
|
if (typeof value !== "string") return value;
|
|
4041
|
-
return
|
|
4100
|
+
return chunkRNXXYF22_cjs.redactSecrets(value);
|
|
4042
4101
|
}
|
|
4043
4102
|
function redactAttrs(attrs) {
|
|
4044
4103
|
const out = {};
|
|
4045
4104
|
for (const [k, v] of Object.entries(attrs)) {
|
|
4046
|
-
out[k] = typeof v === "string" ?
|
|
4105
|
+
out[k] = typeof v === "string" ? chunkRNXXYF22_cjs.redactSecrets(v) : v;
|
|
4047
4106
|
}
|
|
4048
4107
|
return out;
|
|
4049
4108
|
}
|
|
@@ -4124,10 +4183,10 @@ async function loadMarkdownEntities(opts) {
|
|
|
4124
4183
|
const raw = await promises.readFile(resolved.source, "utf8").catch(() => null);
|
|
4125
4184
|
if (raw === null) continue;
|
|
4126
4185
|
const split = splitFrontmatter(raw, resolved.source, errorCodePrefix);
|
|
4127
|
-
const fields =
|
|
4186
|
+
const fields = chunk6XQLTQB6_cjs.parseSimpleYaml(split.frontmatter);
|
|
4128
4187
|
const parsed = schema.safeParse(fields);
|
|
4129
4188
|
if (!parsed.success) {
|
|
4130
|
-
throw new
|
|
4189
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
4131
4190
|
`Invalid frontmatter in ${resolved.source}: ${parsed.error.message}`,
|
|
4132
4191
|
{ code: `${errorCodePrefix}_frontmatter_invalid` }
|
|
4133
4192
|
);
|
|
@@ -4145,13 +4204,13 @@ async function assertFileSizeUnderCap(source, errorCodePrefix) {
|
|
|
4145
4204
|
try {
|
|
4146
4205
|
const info = await promises.stat(source);
|
|
4147
4206
|
if (info.size > MAX_MD_FILE_BYTES) {
|
|
4148
|
-
throw new
|
|
4207
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
4149
4208
|
`Config file ${source} exceeds 1 MB size limit (${info.size} bytes). Reduce the file or split into multiple entities.`,
|
|
4150
4209
|
{ code: `${errorCodePrefix}_file_too_large` }
|
|
4151
4210
|
);
|
|
4152
4211
|
}
|
|
4153
4212
|
} catch (cause) {
|
|
4154
|
-
if (cause instanceof
|
|
4213
|
+
if (cause instanceof chunkCEGU5AVD_cjs.ConfigurationError) throw cause;
|
|
4155
4214
|
}
|
|
4156
4215
|
}
|
|
4157
4216
|
async function readDirSafe(dir, errorCodePrefix) {
|
|
@@ -4160,7 +4219,7 @@ async function readDirSafe(dir, errorCodePrefix) {
|
|
|
4160
4219
|
} catch (cause) {
|
|
4161
4220
|
const code = cause.code;
|
|
4162
4221
|
if (code === "ENOENT") return null;
|
|
4163
|
-
throw new
|
|
4222
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Failed to read ${dir}`, {
|
|
4164
4223
|
code: `${errorCodePrefix}_dir_read_error`,
|
|
4165
4224
|
cause
|
|
4166
4225
|
});
|
|
@@ -4177,7 +4236,7 @@ function resolveEntryPath(entry, pattern, dir) {
|
|
|
4177
4236
|
function splitFrontmatter(raw, source, errorCodePrefix) {
|
|
4178
4237
|
const match = /^---\s*\n([\s\S]*?)\n---\s*(?:\n|$)/.exec(raw);
|
|
4179
4238
|
if (match === null) {
|
|
4180
|
-
throw new
|
|
4239
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
4181
4240
|
`Missing or malformed frontmatter in ${source} (expected \`---\` delimited block at file head)`,
|
|
4182
4241
|
{ code: `${errorCodePrefix}_missing_frontmatter` }
|
|
4183
4242
|
);
|
|
@@ -4206,7 +4265,7 @@ function applyAggregateCap(sources, maxTotal) {
|
|
|
4206
4265
|
}
|
|
4207
4266
|
const remaining = maxTotal - totalBytes;
|
|
4208
4267
|
if (remaining > 0) {
|
|
4209
|
-
const { finalContent } =
|
|
4268
|
+
const { finalContent } = chunkQG4SXZ2A_cjs.truncateWithMarker(s.content, remaining);
|
|
4210
4269
|
kept.push({ ...s, content: finalContent, truncated: true });
|
|
4211
4270
|
totalBytes = maxTotal;
|
|
4212
4271
|
} else {
|
|
@@ -4276,7 +4335,7 @@ var FileContextManager = class {
|
|
|
4276
4335
|
*/
|
|
4277
4336
|
grantedContextDialects() {
|
|
4278
4337
|
if (this.compatSources === void 0) return void 0;
|
|
4279
|
-
return
|
|
4338
|
+
return chunkYQ3XC6C2_cjs.adaptersForSurface(this.compatSources, "context").map((a) => a.kind);
|
|
4280
4339
|
}
|
|
4281
4340
|
async initialize() {
|
|
4282
4341
|
if (!this.settingSourcesIncludeProject && this.settings.manager !== "file") {
|
|
@@ -4303,10 +4362,10 @@ var FileContextManager = class {
|
|
|
4303
4362
|
this.lastScope = [...touchedFiles];
|
|
4304
4363
|
const config = await loadContextConfig(this.cwd);
|
|
4305
4364
|
const legacy = await loadSources(config, this.cwd);
|
|
4306
|
-
const maxBytesPerFile = this.settings.maxBytesPerFile ??
|
|
4365
|
+
const maxBytesPerFile = this.settings.maxBytesPerFile ?? chunkQG4SXZ2A_cjs.DEFAULT_MAX_BYTES_PER_FILE;
|
|
4307
4366
|
const maxBytesTotal = this.settings.maxBytesTotal ?? DEFAULT_MAX_BYTES_TOTAL;
|
|
4308
4367
|
const granted = this.grantedContextDialects();
|
|
4309
|
-
const discovered = await
|
|
4368
|
+
const discovered = await chunkQG4SXZ2A_cjs.runDiscovery({
|
|
4310
4369
|
cwd: this.cwd,
|
|
4311
4370
|
maxBytesPerFile,
|
|
4312
4371
|
skipLegacyTheokitContext: true,
|
|
@@ -4369,8 +4428,8 @@ var FileContextManager = class {
|
|
|
4369
4428
|
}
|
|
4370
4429
|
};
|
|
4371
4430
|
async function loadContextConfig(cwd) {
|
|
4372
|
-
const mdDir = path.join(
|
|
4373
|
-
const jsonPath = path.join(
|
|
4431
|
+
const mdDir = path.join(chunkYQ3XC6C2_cjs.theokitConfigRoot(cwd), "context");
|
|
4432
|
+
const jsonPath = path.join(chunkYQ3XC6C2_cjs.theokitConfigRoot(cwd), "context.json");
|
|
4374
4433
|
const mdEntities = await loadMarkdownEntities({
|
|
4375
4434
|
dir: mdDir,
|
|
4376
4435
|
schema: ContextSourceFrontmatterSchema,
|
|
@@ -4379,7 +4438,7 @@ async function loadContextConfig(cwd) {
|
|
|
4379
4438
|
});
|
|
4380
4439
|
if (mdEntities.length > 0) {
|
|
4381
4440
|
if (fs.existsSync(jsonPath)) {
|
|
4382
|
-
|
|
4441
|
+
chunkUDAKAE4Z_cjs.warnOnce(
|
|
4383
4442
|
"context-both-present",
|
|
4384
4443
|
"[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
|
|
4385
4444
|
);
|
|
@@ -4389,7 +4448,7 @@ async function loadContextConfig(cwd) {
|
|
|
4389
4448
|
};
|
|
4390
4449
|
}
|
|
4391
4450
|
if (!fs.existsSync(jsonPath)) return { sources: [] };
|
|
4392
|
-
|
|
4451
|
+
chunkUDAKAE4Z_cjs.warnOnce(
|
|
4393
4452
|
"context-json-deprecated",
|
|
4394
4453
|
// Names no command: `theokit-migrate-config` was unpublished with the `bin` entry, and a warning
|
|
4395
4454
|
// that tells you to run something the package does not ship is worse than one that tells you
|
|
@@ -4400,7 +4459,7 @@ async function loadContextConfig(cwd) {
|
|
|
4400
4459
|
try {
|
|
4401
4460
|
raw = await promises.readFile(jsonPath, "utf8");
|
|
4402
4461
|
} catch (cause) {
|
|
4403
|
-
throw new
|
|
4462
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Failed to read context config: ${jsonPath}`, {
|
|
4404
4463
|
code: "context_read_error",
|
|
4405
4464
|
cause
|
|
4406
4465
|
});
|
|
@@ -4412,13 +4471,13 @@ function parseConfig(raw, configPath) {
|
|
|
4412
4471
|
try {
|
|
4413
4472
|
parsed = JSON.parse(raw);
|
|
4414
4473
|
} catch (cause) {
|
|
4415
|
-
throw new
|
|
4474
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Invalid JSON in context config: ${configPath}`, {
|
|
4416
4475
|
code: "context_json_invalid",
|
|
4417
4476
|
cause
|
|
4418
4477
|
});
|
|
4419
4478
|
}
|
|
4420
4479
|
if (!parsed || typeof parsed !== "object") {
|
|
4421
|
-
throw new
|
|
4480
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Context config must be an object: ${configPath}`, {
|
|
4422
4481
|
code: "context_config_shape"
|
|
4423
4482
|
});
|
|
4424
4483
|
}
|
|
@@ -4433,7 +4492,7 @@ function parseConfig(raw, configPath) {
|
|
|
4433
4492
|
}
|
|
4434
4493
|
function readSources(sourcesRaw, configPath) {
|
|
4435
4494
|
if (!Array.isArray(sourcesRaw)) {
|
|
4436
|
-
throw new
|
|
4495
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Context config sources must be an array: ${configPath}`, {
|
|
4437
4496
|
code: "context_sources_shape"
|
|
4438
4497
|
});
|
|
4439
4498
|
}
|
|
@@ -4530,13 +4589,13 @@ var PluginsManager = class {
|
|
|
4530
4589
|
}
|
|
4531
4590
|
async refresh() {
|
|
4532
4591
|
this.plugins = [];
|
|
4533
|
-
for (const pluginsRoot of
|
|
4592
|
+
for (const pluginsRoot of chunkYQ3XC6C2_cjs.pluginBundleRoots(this.cwd, this.compatSources)) {
|
|
4534
4593
|
await this.refreshRoot(pluginsRoot);
|
|
4535
4594
|
}
|
|
4536
4595
|
}
|
|
4537
4596
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: MD-first + JSON fallback + CLI location + both-present detection per plugin folder — branch table is clearer inlined.
|
|
4538
4597
|
async refreshRoot(pluginsRoot) {
|
|
4539
|
-
const entries = await
|
|
4598
|
+
const entries = await chunk6XQLTQB6_cjs.readWorkspaceDir(pluginsRoot, "plugins_read_error", "plugins directory");
|
|
4540
4599
|
for (const entry of entries) {
|
|
4541
4600
|
if (!entry.isDirectory()) continue;
|
|
4542
4601
|
const folderName = entry.name;
|
|
@@ -4552,13 +4611,13 @@ var PluginsManager = class {
|
|
|
4552
4611
|
const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
|
|
4553
4612
|
const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(this.cwd, pluginsRoot, folderName) : await loadPluginManifestFromJson(this.cwd, jsonPath, folderName);
|
|
4554
4613
|
if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
|
|
4555
|
-
|
|
4614
|
+
chunkUDAKAE4Z_cjs.warnOnce(
|
|
4556
4615
|
`plugin-${folderName}-both`,
|
|
4557
4616
|
`[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
|
|
4558
4617
|
);
|
|
4559
4618
|
}
|
|
4560
4619
|
if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
|
|
4561
|
-
|
|
4620
|
+
chunkUDAKAE4Z_cjs.warnOnce(
|
|
4562
4621
|
"plugin-json-deprecated",
|
|
4563
4622
|
// Same reason as the context.json warning: the CLI it used to name is no longer published.
|
|
4564
4623
|
"[theokit-sdk] plugin.json manifests are deprecated; replace each with a PLUGIN.md"
|
|
@@ -4577,11 +4636,11 @@ var PluginsManager = class {
|
|
|
4577
4636
|
const entry = metadata.entry;
|
|
4578
4637
|
if (entry === void 0) return;
|
|
4579
4638
|
const pluginRoot = path.join(pluginsRoot, folderName);
|
|
4580
|
-
const entryPath =
|
|
4639
|
+
const entryPath = chunk3KIUY67P_cjs.safePathJoin(pluginRoot, entry);
|
|
4581
4640
|
try {
|
|
4582
4641
|
await promises.readFile(entryPath, "utf8");
|
|
4583
4642
|
} catch (cause) {
|
|
4584
|
-
throw new
|
|
4643
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Plugin ${metadata.name} entry file is missing: ${entry}`, {
|
|
4585
4644
|
code: "plugin_entry_missing",
|
|
4586
4645
|
cause
|
|
4587
4646
|
});
|
|
@@ -4605,7 +4664,7 @@ var PluginsManager = class {
|
|
|
4605
4664
|
assertCloudRules() {
|
|
4606
4665
|
if (!this.cloud) return;
|
|
4607
4666
|
if (this.localPaths !== void 0 && this.localPaths.length > 0) {
|
|
4608
|
-
throw new
|
|
4667
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
4609
4668
|
"Cloud agents reject local plugin paths \u2014 plugins must come from committed repo files",
|
|
4610
4669
|
{ code: "cloud_plugin_path_rejected" }
|
|
4611
4670
|
);
|
|
@@ -4617,7 +4676,7 @@ async function loadPluginManifestFromJson(cwd, manifestPath, folderName) {
|
|
|
4617
4676
|
try {
|
|
4618
4677
|
raw = await promises.readFile(manifestPath, "utf8");
|
|
4619
4678
|
} catch (cause) {
|
|
4620
|
-
throw new
|
|
4679
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Plugin ${folderName} is missing plugin.json`, {
|
|
4621
4680
|
code: "plugin_missing_manifest",
|
|
4622
4681
|
cause
|
|
4623
4682
|
});
|
|
@@ -4626,13 +4685,13 @@ async function loadPluginManifestFromJson(cwd, manifestPath, folderName) {
|
|
|
4626
4685
|
try {
|
|
4627
4686
|
parsed = JSON.parse(raw);
|
|
4628
4687
|
} catch (cause) {
|
|
4629
|
-
throw new
|
|
4688
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Plugin ${folderName} manifest is invalid JSON`, {
|
|
4630
4689
|
code: "plugin_manifest_invalid",
|
|
4631
4690
|
cause
|
|
4632
4691
|
});
|
|
4633
4692
|
}
|
|
4634
4693
|
if (!parsed || typeof parsed !== "object") {
|
|
4635
|
-
throw new
|
|
4694
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Plugin ${folderName} manifest must be an object`, {
|
|
4636
4695
|
code: "plugin_manifest_shape"
|
|
4637
4696
|
});
|
|
4638
4697
|
}
|
|
@@ -4651,7 +4710,7 @@ async function loadPluginManifestFromMarkdown(cwd, pluginsRoot, folderName) {
|
|
|
4651
4710
|
try {
|
|
4652
4711
|
raw = await promises.readFile(mdPath, "utf8");
|
|
4653
4712
|
} catch (cause) {
|
|
4654
|
-
throw new
|
|
4713
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Plugin ${folderName} is missing PLUGIN.md`, {
|
|
4655
4714
|
code: "plugin_missing_manifest",
|
|
4656
4715
|
cause
|
|
4657
4716
|
});
|
|
@@ -4666,7 +4725,7 @@ async function loadPluginManifestFromMarkdown(cwd, pluginsRoot, folderName) {
|
|
|
4666
4725
|
});
|
|
4667
4726
|
const entity = entities.find((e) => e.slug === "PLUGIN");
|
|
4668
4727
|
if (entity === void 0) {
|
|
4669
|
-
throw new
|
|
4728
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`Plugin ${folderName} PLUGIN.md not parseable`, {
|
|
4670
4729
|
code: "plugin_missing_manifest"
|
|
4671
4730
|
});
|
|
4672
4731
|
}
|
|
@@ -4792,7 +4851,7 @@ function localAgentListArtifacts() {
|
|
|
4792
4851
|
}
|
|
4793
4852
|
function localAgentDownloadArtifact() {
|
|
4794
4853
|
return Promise.reject(
|
|
4795
|
-
new
|
|
4854
|
+
new chunkCEGU5AVD_cjs.UnsupportedRunOperationError(
|
|
4796
4855
|
"Artifacts are not supported for local agents",
|
|
4797
4856
|
"downloadArtifact"
|
|
4798
4857
|
)
|
|
@@ -4995,7 +5054,7 @@ function assertValidThresholds(soft, hard) {
|
|
|
4995
5054
|
["hardThreshold", hard]
|
|
4996
5055
|
]) {
|
|
4997
5056
|
if (!Number.isInteger(value) || value < 1) {
|
|
4998
|
-
throw new
|
|
5057
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
4999
5058
|
`doomLoop.${label} must be a positive integer (received ${value}).`,
|
|
5000
5059
|
{ code: "invalid_doom_loop_threshold" }
|
|
5001
5060
|
);
|
|
@@ -5342,14 +5401,14 @@ async function initLoopContext(inputs) {
|
|
|
5342
5401
|
}
|
|
5343
5402
|
function reportMemoryDegraded(stage, cause, sink) {
|
|
5344
5403
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
5345
|
-
|
|
5404
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] memory ${stage} failed \u2014 continuing without it: ${message}
|
|
5346
5405
|
`);
|
|
5347
|
-
|
|
5406
|
+
chunkL7JPXZ2C_cjs.emitRunEvent(sink, { type: "memory_degraded", stage, message });
|
|
5348
5407
|
}
|
|
5349
5408
|
async function safeListTools(client, serverName, sink) {
|
|
5350
5409
|
try {
|
|
5351
5410
|
const listed = await client.listTools();
|
|
5352
|
-
|
|
5411
|
+
chunkL7JPXZ2C_cjs.emitRunEvent(sink, {
|
|
5353
5412
|
type: "mcp_server_ready",
|
|
5354
5413
|
serverName: serverName ?? "unknown",
|
|
5355
5414
|
tools: listed.map((tool) => tool.name)
|
|
@@ -5358,9 +5417,9 @@ async function safeListTools(client, serverName, sink) {
|
|
|
5358
5417
|
} catch (cause) {
|
|
5359
5418
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
5360
5419
|
const server = serverName ?? "unknown";
|
|
5361
|
-
|
|
5420
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] mcp listTools failed (server=${server}): ${message}
|
|
5362
5421
|
`);
|
|
5363
|
-
|
|
5422
|
+
chunkL7JPXZ2C_cjs.emitRunEvent(sink, { type: "mcp_server_failed", serverName: server, message });
|
|
5364
5423
|
return [];
|
|
5365
5424
|
}
|
|
5366
5425
|
}
|
|
@@ -5590,7 +5649,7 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
5590
5649
|
const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
|
|
5591
5650
|
if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
|
|
5592
5651
|
for (const key of candidates) {
|
|
5593
|
-
const info =
|
|
5652
|
+
const info = chunkS46WJTDL_cjs.getCatalogModelInfo(key);
|
|
5594
5653
|
const cost = info?.cost;
|
|
5595
5654
|
if (cost === void 0) continue;
|
|
5596
5655
|
const [prov, ...modelParts] = key.split("/");
|
|
@@ -5602,7 +5661,7 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
5602
5661
|
...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
|
|
5603
5662
|
...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
|
|
5604
5663
|
// M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
|
|
5605
|
-
pricingVersion:
|
|
5664
|
+
pricingVersion: chunkS46WJTDL_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
|
|
5606
5665
|
};
|
|
5607
5666
|
}
|
|
5608
5667
|
return void 0;
|
|
@@ -5816,11 +5875,11 @@ ${systemPrompt}`;
|
|
|
5816
5875
|
}
|
|
5817
5876
|
function activeMemoryBlock(additions) {
|
|
5818
5877
|
return `<active-memory>
|
|
5819
|
-
${
|
|
5878
|
+
${chunk7WARNHWW_cjs.escapeBlockBody(additions)}
|
|
5820
5879
|
</active-memory>`;
|
|
5821
5880
|
}
|
|
5822
5881
|
function buildLoopSystem(systemPrompt, additions, modelId) {
|
|
5823
|
-
if (!
|
|
5882
|
+
if (!chunkNWWTYBD3_cjs.isAnthropicFamilyModel(modelId) || systemPrompt === void 0 || systemPrompt.length === 0) {
|
|
5824
5883
|
return resolveSystemPromptWithMemoryAdditions(systemPrompt, additions);
|
|
5825
5884
|
}
|
|
5826
5885
|
const blocks = [{ text: systemPrompt, cacheable: true }];
|
|
@@ -5844,7 +5903,7 @@ function emitLlmMetrics(inputs, result, startAt) {
|
|
|
5844
5903
|
inputs.telemetry?.recordHistogram(HISTOGRAM_NAMES.LLM_USAGE_MISSING, 1, {
|
|
5845
5904
|
provider: inputs.llm.name
|
|
5846
5905
|
});
|
|
5847
|
-
|
|
5906
|
+
chunkRNXXYF22_cjs.diag(
|
|
5848
5907
|
`[theokit-sdk] llm usage missing from ${inputs.llm.name} finish \u2014 budget may undercount
|
|
5849
5908
|
`
|
|
5850
5909
|
);
|
|
@@ -5973,6 +6032,7 @@ function registerLoopError(ctx, cause) {
|
|
|
5973
6032
|
async function consumeStreamEvent(inputs, reasoning, event) {
|
|
5974
6033
|
if (event.type === "text_delta") {
|
|
5975
6034
|
const text = event.text ?? "";
|
|
6035
|
+
if (text.length > 0) await closeReasoningOnce(inputs, reasoning);
|
|
5976
6036
|
await emitTextDeltaCallback(inputs, text);
|
|
5977
6037
|
return text;
|
|
5978
6038
|
}
|
|
@@ -5985,7 +6045,14 @@ async function consumeStreamEvent(inputs, reasoning, event) {
|
|
|
5985
6045
|
return "";
|
|
5986
6046
|
}
|
|
5987
6047
|
async function runCollectorLoop(generator, inputs, ctx, partial) {
|
|
5988
|
-
const reasoning = {
|
|
6048
|
+
const reasoning = {
|
|
6049
|
+
text: "",
|
|
6050
|
+
startedAt: void 0,
|
|
6051
|
+
lastAt: void 0,
|
|
6052
|
+
signature: void 0,
|
|
6053
|
+
closed: false,
|
|
6054
|
+
durationMs: 0
|
|
6055
|
+
};
|
|
5989
6056
|
let errored = false;
|
|
5990
6057
|
let finishValue;
|
|
5991
6058
|
let thinking;
|
|
@@ -6014,17 +6081,24 @@ async function consumeReasoningDelta(inputs, reasoning, delta) {
|
|
|
6014
6081
|
await accumulateReasoning(inputs, reasoning, delta.text);
|
|
6015
6082
|
}
|
|
6016
6083
|
async function accumulateReasoning(inputs, reasoning, text) {
|
|
6017
|
-
|
|
6084
|
+
const now = Date.now();
|
|
6085
|
+
if (reasoning.startedAt === void 0) reasoning.startedAt = now;
|
|
6086
|
+
if (!reasoning.closed) reasoning.lastAt = now;
|
|
6018
6087
|
reasoning.text += text;
|
|
6019
6088
|
await emitReasoningDeltaCallback(inputs, text);
|
|
6020
6089
|
}
|
|
6090
|
+
async function closeReasoningOnce(inputs, reasoning) {
|
|
6091
|
+
if (reasoning.closed || reasoning.text.length === 0) return;
|
|
6092
|
+
reasoning.closed = true;
|
|
6093
|
+
reasoning.durationMs = (reasoning.lastAt ?? 0) - (reasoning.startedAt ?? 0);
|
|
6094
|
+
await emitThinkingCompletedCallback(inputs, reasoning.durationMs);
|
|
6095
|
+
}
|
|
6021
6096
|
async function finalizeReasoning(inputs, ctx, reasoning) {
|
|
6022
6097
|
if (reasoning.text.length === 0) return void 0;
|
|
6023
|
-
|
|
6098
|
+
await closeReasoningOnce(inputs, reasoning);
|
|
6024
6099
|
ctx.events.push(
|
|
6025
|
-
buildThinkingEvent(inputs, reasoning.text,
|
|
6100
|
+
buildThinkingEvent(inputs, reasoning.text, reasoning.durationMs, reasoning.signature)
|
|
6026
6101
|
);
|
|
6027
|
-
await emitThinkingCompletedCallback(inputs, thinkingDurationMs);
|
|
6028
6102
|
return {
|
|
6029
6103
|
type: "thinking",
|
|
6030
6104
|
text: reasoning.text,
|
|
@@ -6151,7 +6225,7 @@ function coerceArgsToSchema(args, schema) {
|
|
|
6151
6225
|
}
|
|
6152
6226
|
|
|
6153
6227
|
// src/tool-error.ts
|
|
6154
|
-
var ToolError = class extends
|
|
6228
|
+
var ToolError = class extends chunkCEGU5AVD_cjs.TheokitAgentError {
|
|
6155
6229
|
name = "ToolError";
|
|
6156
6230
|
/** The error content surfaced to the model: a string, or text/image blocks. */
|
|
6157
6231
|
content;
|
|
@@ -6325,7 +6399,7 @@ function raceToolExecution(exec, opts) {
|
|
|
6325
6399
|
// src/internal/agent-loop/tool-dispatch.ts
|
|
6326
6400
|
async function dispatchTools(inputs, tools, toolCalls, events, parentSpan) {
|
|
6327
6401
|
const maxConcurrent = inputs.maxConcurrentTools ?? 4;
|
|
6328
|
-
return
|
|
6402
|
+
return chunk27V5I2WW_cjs.mapWithConcurrency(
|
|
6329
6403
|
toolCalls,
|
|
6330
6404
|
maxConcurrent,
|
|
6331
6405
|
(call) => dispatchSingleCall(inputs, tools, call, events, parentSpan)
|
|
@@ -6359,7 +6433,7 @@ async function dispatchSingleCall(inputs, tools, call, events, parentSpan) {
|
|
|
6359
6433
|
toolSpan?.end();
|
|
6360
6434
|
return fileVeto;
|
|
6361
6435
|
}
|
|
6362
|
-
|
|
6436
|
+
chunkL7JPXZ2C_cjs.emitRunEvent(inputs.runEventSink, {
|
|
6363
6437
|
type: "tool_progress",
|
|
6364
6438
|
toolName: workingCall.name,
|
|
6365
6439
|
toolCallId: dc.callId
|
|
@@ -6391,7 +6465,7 @@ function vetoFromForkWhitelist(dc) {
|
|
|
6391
6465
|
const { inputs, call, callId, events } = dc;
|
|
6392
6466
|
const whitelistDecision = chunkIJ7M6GOG_cjs.checkToolWhitelist(call.name);
|
|
6393
6467
|
if (whitelistDecision.allowed) return void 0;
|
|
6394
|
-
|
|
6468
|
+
chunkL7JPXZ2C_cjs.emitRunEvent(inputs.runEventSink, {
|
|
6395
6469
|
type: "permission_denied",
|
|
6396
6470
|
toolName: call.name,
|
|
6397
6471
|
toolCallId: callId,
|
|
@@ -6438,7 +6512,7 @@ async function vetoFromPluginPreHook(dc) {
|
|
|
6438
6512
|
...inputs.permissionMode !== void 0 ? { permissionMode: inputs.permissionMode } : {}
|
|
6439
6513
|
});
|
|
6440
6514
|
if (pluginVeto === void 0) return void 0;
|
|
6441
|
-
|
|
6515
|
+
chunkL7JPXZ2C_cjs.emitRunEvent(inputs.runEventSink, {
|
|
6442
6516
|
type: "permission_denied",
|
|
6443
6517
|
toolName: call.name,
|
|
6444
6518
|
toolCallId: callId,
|
|
@@ -6468,7 +6542,7 @@ async function vetoFromFileHookPreDecision(dc) {
|
|
|
6468
6542
|
runId: inputs.runId
|
|
6469
6543
|
});
|
|
6470
6544
|
if (!preDecision.blocked) return void 0;
|
|
6471
|
-
|
|
6545
|
+
chunkL7JPXZ2C_cjs.emitRunEvent(inputs.runEventSink, {
|
|
6472
6546
|
type: "permission_denied",
|
|
6473
6547
|
toolName: call.name,
|
|
6474
6548
|
toolCallId: callId,
|
|
@@ -6571,7 +6645,7 @@ function finalizeSpanAndPostHook(dc, result, toolSpan) {
|
|
|
6571
6645
|
agentId: inputs.agentId,
|
|
6572
6646
|
runId: inputs.runId
|
|
6573
6647
|
}).catch((err) => {
|
|
6574
|
-
|
|
6648
|
+
chunkRNXXYF22_cjs.diag(
|
|
6575
6649
|
`[theokit-sdk] postToolUse hook error (swallowed): ${err instanceof Error ? err.message : String(err)}
|
|
6576
6650
|
`
|
|
6577
6651
|
);
|
|
@@ -6590,7 +6664,7 @@ async function emitToolLifecycleDelta(inputs, update) {
|
|
|
6590
6664
|
try {
|
|
6591
6665
|
await inputs.onDelta({ update });
|
|
6592
6666
|
} catch (err) {
|
|
6593
|
-
|
|
6667
|
+
chunkRNXXYF22_cjs.diag(
|
|
6594
6668
|
`[theokit-sdk] onDelta tool-lifecycle emit error (swallowed): ${err instanceof Error ? err.message : String(err)}
|
|
6595
6669
|
`
|
|
6596
6670
|
);
|
|
@@ -6602,7 +6676,7 @@ async function safeEmitToolHook(callback, event) {
|
|
|
6602
6676
|
await callback(event);
|
|
6603
6677
|
} catch (cause) {
|
|
6604
6678
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
6605
|
-
|
|
6679
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] tool lifecycle hook threw: ${msg}
|
|
6606
6680
|
`);
|
|
6607
6681
|
}
|
|
6608
6682
|
}
|
|
@@ -6669,7 +6743,7 @@ function applyToolResultGuard(parts, opts) {
|
|
|
6669
6743
|
(p) => (
|
|
6670
6744
|
// SE7 — guard the TEXT of a tool result (string or the text blocks of a
|
|
6671
6745
|
// structured content); image blocks pass through untouched.
|
|
6672
|
-
p.type === "tool_result" ? { ...p, content:
|
|
6746
|
+
p.type === "tool_result" ? { ...p, content: chunkLSWHDOCL_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
|
|
6673
6747
|
)
|
|
6674
6748
|
);
|
|
6675
6749
|
}
|
|
@@ -6863,25 +6937,22 @@ async function runIteration(inputs, ctx) {
|
|
|
6863
6937
|
function trackTurnUsage(inputs, llmOutput) {
|
|
6864
6938
|
const tracker = inputs.budgetTracker;
|
|
6865
6939
|
if (tracker === void 0) return;
|
|
6866
|
-
const
|
|
6867
|
-
|
|
6868
|
-
|
|
6940
|
+
const model = inputs.model.id ?? "auto";
|
|
6941
|
+
trackEvent(tracker, { tokens: promptTokens(llmOutput), model, type: "input" });
|
|
6942
|
+
trackEvent(tracker, { tokens: llmOutput.outputTokens ?? 0, model, type: "output" });
|
|
6943
|
+
}
|
|
6944
|
+
function promptTokens(llmOutput) {
|
|
6945
|
+
return (llmOutput.inputTokens ?? 0) + (llmOutput.cacheReadTokens ?? 0) + (llmOutput.cacheWriteTokens ?? 0);
|
|
6946
|
+
}
|
|
6947
|
+
function trackEvent(tracker, event) {
|
|
6948
|
+
if (event.tokens <= 0) return;
|
|
6869
6949
|
try {
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
}
|
|
6877
|
-
if (outputT > 0) {
|
|
6878
|
-
tracker.track({
|
|
6879
|
-
tokens: outputT,
|
|
6880
|
-
model: modelId,
|
|
6881
|
-
type: "output"
|
|
6882
|
-
});
|
|
6883
|
-
}
|
|
6884
|
-
} catch {
|
|
6950
|
+
tracker.track(event);
|
|
6951
|
+
} catch (err) {
|
|
6952
|
+
const why = err instanceof Error ? err.message : String(err);
|
|
6953
|
+
chunkRNXXYF22_cjs.diagFailure(
|
|
6954
|
+
`[theokit-sdk] BudgetTracker.track threw (type=${event.type}, model=${event.model}, tokens=${event.tokens}): ${why}`
|
|
6955
|
+
);
|
|
6885
6956
|
}
|
|
6886
6957
|
}
|
|
6887
6958
|
async function transformLlmOutputText(inputs, text, ctx) {
|
|
@@ -6954,6 +7025,32 @@ async function inspectDoomLoop(inputs, ctx, toolCalls) {
|
|
|
6954
7025
|
return "continue";
|
|
6955
7026
|
}
|
|
6956
7027
|
|
|
7028
|
+
// src/internal/concurrency/abort-utils.ts
|
|
7029
|
+
function anySignal(signals) {
|
|
7030
|
+
const filtered = signals.filter((s) => s !== void 0);
|
|
7031
|
+
if (filtered.length === 0) {
|
|
7032
|
+
return new AbortController().signal;
|
|
7033
|
+
}
|
|
7034
|
+
if (filtered.length === 1) {
|
|
7035
|
+
return filtered[0];
|
|
7036
|
+
}
|
|
7037
|
+
if (typeof AbortSignal.any === "function") {
|
|
7038
|
+
return AbortSignal.any(filtered);
|
|
7039
|
+
}
|
|
7040
|
+
return ponyfillAny(filtered);
|
|
7041
|
+
}
|
|
7042
|
+
function ponyfillAny(signals) {
|
|
7043
|
+
const ctrl = new AbortController();
|
|
7044
|
+
for (const s of signals) {
|
|
7045
|
+
if (s.aborted) {
|
|
7046
|
+
ctrl.abort(s.reason);
|
|
7047
|
+
return ctrl.signal;
|
|
7048
|
+
}
|
|
7049
|
+
s.addEventListener("abort", () => ctrl.abort(s.reason), { once: true });
|
|
7050
|
+
}
|
|
7051
|
+
return ctrl.signal;
|
|
7052
|
+
}
|
|
7053
|
+
|
|
6957
7054
|
// src/internal/llm/fallback-client.ts
|
|
6958
7055
|
var FallbackLlmClient = class {
|
|
6959
7056
|
constructor(clients) {
|
|
@@ -6964,16 +7061,16 @@ var FallbackLlmClient = class {
|
|
|
6964
7061
|
async *stream(request, signal) {
|
|
6965
7062
|
let lastError;
|
|
6966
7063
|
for (const client of this.clients) {
|
|
6967
|
-
if (signal.aborted) throw
|
|
6968
|
-
const attempt = await
|
|
7064
|
+
if (signal.aborted) throw chunkLSWHDOCL_cjs.abortError(signal);
|
|
7065
|
+
const attempt = await chunkLSWHDOCL_cjs.tryFirstEvent(client, request, signal, true);
|
|
6969
7066
|
if (attempt.kind === "handshake_error") {
|
|
6970
7067
|
lastError = attempt.error;
|
|
6971
7068
|
continue;
|
|
6972
7069
|
}
|
|
6973
|
-
return yield*
|
|
7070
|
+
return yield* chunkLSWHDOCL_cjs.relayStream(attempt.generator, attempt.firstResult);
|
|
6974
7071
|
}
|
|
6975
7072
|
if (lastError !== void 0) throw lastError;
|
|
6976
|
-
throw new
|
|
7073
|
+
throw new chunkCEGU5AVD_cjs.NetworkError("FallbackLlmClient has no providers configured", {
|
|
6977
7074
|
code: "fallback_empty_chain"
|
|
6978
7075
|
});
|
|
6979
7076
|
}
|
|
@@ -7001,7 +7098,7 @@ function reconnectDelay(attempt) {
|
|
|
7001
7098
|
return ms <= 0 ? Promise.resolve() : new Promise((resolve) => setTimeout(resolve, ms));
|
|
7002
7099
|
}
|
|
7003
7100
|
function mcpTimeoutError(name, timeoutMs) {
|
|
7004
|
-
return new
|
|
7101
|
+
return new chunkCEGU5AVD_cjs.NetworkError(`MCP ${name} request timed out after ${timeoutMs}ms`, {
|
|
7005
7102
|
code: "mcp_timeout"
|
|
7006
7103
|
});
|
|
7007
7104
|
}
|
|
@@ -7099,7 +7196,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
7099
7196
|
child.stdin.on("error", () => void 0);
|
|
7100
7197
|
child.on("error", () => {
|
|
7101
7198
|
this.rejectAllPending(
|
|
7102
|
-
new
|
|
7199
|
+
new chunkCEGU5AVD_cjs.NetworkError(`MCP ${this.name} process crashed`, { code: "mcp_crashed" })
|
|
7103
7200
|
);
|
|
7104
7201
|
});
|
|
7105
7202
|
child.on("exit", () => {
|
|
@@ -7107,7 +7204,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
7107
7204
|
this.child = void 0;
|
|
7108
7205
|
this.dropped = true;
|
|
7109
7206
|
this.rejectAllPending(
|
|
7110
|
-
new
|
|
7207
|
+
new chunkCEGU5AVD_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
|
|
7111
7208
|
);
|
|
7112
7209
|
});
|
|
7113
7210
|
}
|
|
@@ -7135,7 +7232,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
7135
7232
|
if (this.child !== void 0) return Promise.resolve();
|
|
7136
7233
|
if (!this.dropped) {
|
|
7137
7234
|
return Promise.reject(
|
|
7138
|
-
new
|
|
7235
|
+
new chunkCEGU5AVD_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
|
|
7139
7236
|
);
|
|
7140
7237
|
}
|
|
7141
7238
|
this.reconnectPromise ??= this.reconnect().finally(() => {
|
|
@@ -7159,13 +7256,13 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
7159
7256
|
this.reconnecting = false;
|
|
7160
7257
|
}
|
|
7161
7258
|
}
|
|
7162
|
-
throw new
|
|
7259
|
+
throw new chunkCEGU5AVD_cjs.NetworkError(`MCP ${this.name} reconnect exhausted`, {
|
|
7163
7260
|
code: "mcp_disconnected",
|
|
7164
7261
|
...lastErr instanceof Error ? { cause: lastErr } : {}
|
|
7165
7262
|
});
|
|
7166
7263
|
}
|
|
7167
7264
|
async close() {
|
|
7168
|
-
this.rejectAllPending(new
|
|
7265
|
+
this.rejectAllPending(new chunkCEGU5AVD_cjs.NetworkError(`MCP ${this.name} closed`, { code: "mcp_closed" }));
|
|
7169
7266
|
const child = this.child;
|
|
7170
7267
|
this.child = void 0;
|
|
7171
7268
|
this.dropped = false;
|
|
@@ -7184,7 +7281,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
7184
7281
|
if (this.buffer.length > MAX_STDIO_BUFFER_BYTES) {
|
|
7185
7282
|
this.buffer = "";
|
|
7186
7283
|
this.rejectAllPending(
|
|
7187
|
-
new
|
|
7284
|
+
new chunkCEGU5AVD_cjs.NetworkError(`MCP ${this.name} exceeded stdout buffer limit`, {
|
|
7188
7285
|
code: "mcp_buffer_overflow"
|
|
7189
7286
|
})
|
|
7190
7287
|
);
|
|
@@ -7219,7 +7316,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
7219
7316
|
if (child !== void 0) return this.send(child, method, params);
|
|
7220
7317
|
if (this.dropped) return this.reconnectAndRequest(method, params);
|
|
7221
7318
|
return Promise.reject(
|
|
7222
|
-
new
|
|
7319
|
+
new chunkCEGU5AVD_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
|
|
7223
7320
|
);
|
|
7224
7321
|
}
|
|
7225
7322
|
/** M2 #59 — reconnect a dropped client, then send. Separate async path so the
|
|
@@ -7228,7 +7325,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
7228
7325
|
await this.ensureConnected();
|
|
7229
7326
|
const child = this.child;
|
|
7230
7327
|
if (child === void 0) {
|
|
7231
|
-
throw new
|
|
7328
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" });
|
|
7232
7329
|
}
|
|
7233
7330
|
return this.send(child, method, params);
|
|
7234
7331
|
}
|
|
@@ -7246,7 +7343,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
7246
7343
|
this.child = void 0;
|
|
7247
7344
|
this.dropped = true;
|
|
7248
7345
|
this.rejectAllPending(
|
|
7249
|
-
new
|
|
7346
|
+
new chunkCEGU5AVD_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
|
|
7250
7347
|
);
|
|
7251
7348
|
}, budget);
|
|
7252
7349
|
this.pending.set(id, { resolve, reject, timer });
|
|
@@ -7318,7 +7415,7 @@ var HttpMcpClient = class extends BaseMcpClient {
|
|
|
7318
7415
|
if (payload === "") continue;
|
|
7319
7416
|
return JSON.parse(payload);
|
|
7320
7417
|
}
|
|
7321
|
-
throw new
|
|
7418
|
+
throw new chunkCEGU5AVD_cjs.NetworkError(`MCP ${this.name} returned an event stream with no data payload`, {
|
|
7322
7419
|
code: "mcp_http_error"
|
|
7323
7420
|
});
|
|
7324
7421
|
}
|
|
@@ -7352,7 +7449,7 @@ var HttpMcpClient = class extends BaseMcpClient {
|
|
|
7352
7449
|
throw cause;
|
|
7353
7450
|
}
|
|
7354
7451
|
if (!response.ok) {
|
|
7355
|
-
throw new
|
|
7452
|
+
throw new chunkCEGU5AVD_cjs.NetworkError(`MCP ${this.name} returned ${response.status}`, {
|
|
7356
7453
|
code: "mcp_http_error"
|
|
7357
7454
|
});
|
|
7358
7455
|
}
|
|
@@ -7368,7 +7465,7 @@ var HttpMcpClient = class extends BaseMcpClient {
|
|
|
7368
7465
|
function resolveMcpCwd(configCwd) {
|
|
7369
7466
|
if (configCwd === void 0) return process.cwd();
|
|
7370
7467
|
if (path.isAbsolute(configCwd)) return configCwd;
|
|
7371
|
-
return
|
|
7468
|
+
return chunk3KIUY67P_cjs.safePathJoin(process.cwd(), configCwd);
|
|
7372
7469
|
}
|
|
7373
7470
|
|
|
7374
7471
|
// src/internal/local-agent/mcp-pool.ts
|
|
@@ -7470,7 +7567,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
|
|
|
7470
7567
|
if (exposedSet.has(name)) continue;
|
|
7471
7568
|
const hint = suggestClosest(name, exposedSet);
|
|
7472
7569
|
const message = hint !== void 0 ? `[theokit-sdk] personality "${opts?.personalityName ?? "?"}" references unknown tool "${name}"; did you mean "${hint}"?` : `[theokit-sdk] personality "${opts?.personalityName ?? "?"}" references unknown tool "${name}" (not exposed)`;
|
|
7473
|
-
|
|
7570
|
+
chunkUDAKAE4Z_cjs.warnOnce(
|
|
7474
7571
|
`personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
|
|
7475
7572
|
message
|
|
7476
7573
|
);
|
|
@@ -7512,7 +7609,7 @@ function levenshtein(a, b) {
|
|
|
7512
7609
|
// src/internal/local-agent/real-local-run-tools.ts
|
|
7513
7610
|
function declarativeSubagentTools(agents2, parentTools) {
|
|
7514
7611
|
if (agents2 === void 0 || Object.keys(agents2).length === 0) return [];
|
|
7515
|
-
return
|
|
7612
|
+
return chunkH7HD6RXO_cjs.subAgentToolsFromDefinitions(agents2, parentTools);
|
|
7516
7613
|
}
|
|
7517
7614
|
function resolveInheritedCredentials(agentOptions) {
|
|
7518
7615
|
const parentPlugins = Array.isArray(agentOptions.plugins) ? agentOptions.plugins : void 0;
|
|
@@ -7601,14 +7698,14 @@ function createRealLocalRun(options) {
|
|
|
7601
7698
|
function buildLoopInputs(options, runId, userText, userImages) {
|
|
7602
7699
|
const maxIterations = options.sendOptions.maxIterations;
|
|
7603
7700
|
if (maxIterations !== void 0 && (!Number.isInteger(maxIterations) || maxIterations < 1)) {
|
|
7604
|
-
throw new
|
|
7701
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
7605
7702
|
`SendOptions.maxIterations must be a positive integer, got ${maxIterations}`,
|
|
7606
7703
|
{ code: "invalid_max_iterations" }
|
|
7607
7704
|
);
|
|
7608
7705
|
}
|
|
7609
|
-
const { primary, effectiveModelId } =
|
|
7706
|
+
const { primary, effectiveModelId } = chunkLSWHDOCL_cjs.resolveRunProvider(options);
|
|
7610
7707
|
const fallback = options.agentOptions.providers?.fallback;
|
|
7611
|
-
const apiKeys =
|
|
7708
|
+
const apiKeys = chunkLSWHDOCL_cjs.mergeExplicitApiKey(
|
|
7612
7709
|
options.agentOptions.providers?.apiKeys,
|
|
7613
7710
|
primary,
|
|
7614
7711
|
options.agentOptions.apiKey
|
|
@@ -7617,7 +7714,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7617
7714
|
const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
|
|
7618
7715
|
const rateLimitSink = options.sendOptions.onRunEvent;
|
|
7619
7716
|
const modelBaseUrl = options.model?.url;
|
|
7620
|
-
const chain =
|
|
7717
|
+
const chain = chunkLSWHDOCL_cjs.resolveProviderChain({
|
|
7621
7718
|
primary,
|
|
7622
7719
|
...modelBaseUrl !== void 0 ? { baseUrl: modelBaseUrl } : {},
|
|
7623
7720
|
...fallback !== void 0 ? { fallback } : {},
|
|
@@ -7625,7 +7722,7 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7625
7722
|
...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {},
|
|
7626
7723
|
...extractToolCallsFromContent === true ? { extractToolCallsFromContent: true } : {},
|
|
7627
7724
|
...rateLimitSink !== void 0 ? {
|
|
7628
|
-
onRateLimit: (info) =>
|
|
7725
|
+
onRateLimit: (info) => chunkL7JPXZ2C_cjs.emitRunEvent(rateLimitSink, { type: "rate_limit", ...info })
|
|
7629
7726
|
} : {}
|
|
7630
7727
|
});
|
|
7631
7728
|
const llm = chain.length === 1 ? chain[0] : new FallbackLlmClient(chain);
|
|
@@ -7708,6 +7805,13 @@ var RealLocalRun = class extends FixtureRunBase {
|
|
|
7708
7805
|
ownsMcpClients;
|
|
7709
7806
|
/** theokit#148 — what a delegated child inherits from this parent, scoped to the loop. */
|
|
7710
7807
|
inheritedCredentials;
|
|
7808
|
+
/**
|
|
7809
|
+
* B-495 — the run's own abort, composed into the signal the loop hands to the LLM fetch and the
|
|
7810
|
+
* tool executors, so `cancel()` stops the request and not only the status. A TypeScript `private`
|
|
7811
|
+
* field, never a JS `#private` one: the run wrappers are Proxies that call `cancel()` with `this`
|
|
7812
|
+
* bound to the Proxy, where reading a `#private` field throws.
|
|
7813
|
+
*/
|
|
7814
|
+
cancelController = new AbortController();
|
|
7711
7815
|
constructor(options, buildInputs, ownsMcpClients, inheritedCredentials) {
|
|
7712
7816
|
super(options);
|
|
7713
7817
|
this.buildInputs = buildInputs;
|
|
@@ -7719,6 +7823,11 @@ var RealLocalRun = class extends FixtureRunBase {
|
|
|
7719
7823
|
void this.driveLoop();
|
|
7720
7824
|
}, 0);
|
|
7721
7825
|
}
|
|
7826
|
+
cancel() {
|
|
7827
|
+
if (this.terminated) return Promise.resolve();
|
|
7828
|
+
this.cancelController.abort();
|
|
7829
|
+
return super.cancel();
|
|
7830
|
+
}
|
|
7722
7831
|
notifyImmediately() {
|
|
7723
7832
|
return true;
|
|
7724
7833
|
}
|
|
@@ -7762,7 +7871,9 @@ var RealLocalRun = class extends FixtureRunBase {
|
|
|
7762
7871
|
liveDelivered = /* @__PURE__ */ new Set();
|
|
7763
7872
|
async executeAgentLoop(inputs) {
|
|
7764
7873
|
let textStreamedSinceLastMessage = false;
|
|
7874
|
+
inputs.signal = anySignal([inputs.signal, this.cancelController.signal]);
|
|
7765
7875
|
inputs.onLoopEvent = (event) => {
|
|
7876
|
+
if (this.terminated) return;
|
|
7766
7877
|
this.liveDelivered.add(event);
|
|
7767
7878
|
this.script.events.push(event);
|
|
7768
7879
|
const carriesText = event.type === "assistant" && event.message.content.some((b) => b.type === "text");
|
|
@@ -7778,24 +7889,22 @@ var RealLocalRun = class extends FixtureRunBase {
|
|
|
7778
7889
|
};
|
|
7779
7890
|
const callerOnDelta = inputs.onDelta;
|
|
7780
7891
|
inputs.onDelta = (delta) => {
|
|
7892
|
+
if (this.terminated) return;
|
|
7781
7893
|
callerOnDelta?.(delta);
|
|
7782
7894
|
if (delta.update.type === "text-delta") textStreamedSinceLastMessage = true;
|
|
7783
7895
|
this.pushTimeline({ kind: "delta", update: delta.update });
|
|
7784
7896
|
};
|
|
7785
7897
|
try {
|
|
7898
|
+
if (this.terminated) return;
|
|
7786
7899
|
const runLoop = () => inputs.activeTools !== void 0 ? chunkIJ7M6GOG_cjs.withToolWhitelist(new Set(inputs.activeTools), () => runAgentLoop(inputs)) : runAgentLoop(inputs);
|
|
7787
|
-
const output = await
|
|
7900
|
+
const output = await chunkH7HD6RXO_cjs.withInheritedSubAgentCredentials(this.inheritedCredentials, runLoop);
|
|
7788
7901
|
this.applyAgentLoopOutput(output);
|
|
7789
7902
|
this.transitionTo(output.finalStatus);
|
|
7790
7903
|
} catch (cause) {
|
|
7791
7904
|
this.emitErrorEvent(cause, "Agent loop failed", "", "agent_loop_failed");
|
|
7792
7905
|
this.transitionTo("error");
|
|
7793
7906
|
} finally {
|
|
7794
|
-
if (this.ownsMcpClients)
|
|
7795
|
-
for (const client of inputs.mcp.values()) {
|
|
7796
|
-
await client.close().catch(() => void 0);
|
|
7797
|
-
}
|
|
7798
|
-
}
|
|
7907
|
+
if (this.ownsMcpClients) await closeOwnedMcpClients(inputs);
|
|
7799
7908
|
}
|
|
7800
7909
|
}
|
|
7801
7910
|
/**
|
|
@@ -7807,6 +7916,7 @@ var RealLocalRun = class extends FixtureRunBase {
|
|
|
7807
7916
|
* Finding-B fix (sdk-error-packaging v1.1): set-once errorDetail copy.
|
|
7808
7917
|
*/
|
|
7809
7918
|
applyAgentLoopOutput(output) {
|
|
7919
|
+
if (this.terminated) return;
|
|
7810
7920
|
this.deliverUndeliveredEvents(output.events);
|
|
7811
7921
|
this.script.conversation.push(...output.conversation);
|
|
7812
7922
|
if (output.result.length > 0) this.script.result = output.result;
|
|
@@ -7854,6 +7964,18 @@ var RealLocalRun = class extends FixtureRunBase {
|
|
|
7854
7964
|
this.notifyNewEvents();
|
|
7855
7965
|
}
|
|
7856
7966
|
};
|
|
7967
|
+
async function closeOwnedMcpClients(inputs) {
|
|
7968
|
+
for (const [name, client] of inputs.mcp.entries()) {
|
|
7969
|
+
try {
|
|
7970
|
+
await client.close();
|
|
7971
|
+
} catch (cause) {
|
|
7972
|
+
const why = cause instanceof Error ? cause.message : String(cause);
|
|
7973
|
+
chunkRNXXYF22_cjs.diagFailure(
|
|
7974
|
+
`[theokit-sdk] MCP server ${name} failed to close; its process may still be running: ${why}`
|
|
7975
|
+
);
|
|
7976
|
+
}
|
|
7977
|
+
}
|
|
7978
|
+
}
|
|
7857
7979
|
|
|
7858
7980
|
// src/internal/local-agent/local-agent-dispatch.ts
|
|
7859
7981
|
function buildRealRunOptions(args) {
|
|
@@ -7877,7 +7999,7 @@ function buildRealRunOptions(args) {
|
|
|
7877
7999
|
};
|
|
7878
8000
|
}
|
|
7879
8001
|
async function createFixtureRunHelper(args) {
|
|
7880
|
-
const sessionMessages =
|
|
8002
|
+
const sessionMessages = chunkYOVZMN4P_cjs.getSessionMessages(args.inputs.agentId);
|
|
7881
8003
|
const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
|
|
7882
8004
|
return createLocalRun({
|
|
7883
8005
|
agentId: args.inputs.agentId,
|
|
@@ -7895,8 +8017,8 @@ async function createFixtureRunHelper(args) {
|
|
|
7895
8017
|
});
|
|
7896
8018
|
}
|
|
7897
8019
|
async function dispatchLocalRun(args) {
|
|
7898
|
-
const apiKey =
|
|
7899
|
-
if (
|
|
8020
|
+
const apiKey = chunkRNXXYF22_cjs.resolveApiKey(args.inputs.options.apiKey);
|
|
8021
|
+
if (chunkLSWHDOCL_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
7900
8022
|
return createRealLocalRun(
|
|
7901
8023
|
buildRealRunOptions({
|
|
7902
8024
|
inputs: args.inputs,
|
|
@@ -7919,7 +8041,7 @@ async function dispatchLocalRun(args) {
|
|
|
7919
8041
|
});
|
|
7920
8042
|
}
|
|
7921
8043
|
async function readProjectMcpServers(cwd) {
|
|
7922
|
-
const path$1 = path.join(
|
|
8044
|
+
const path$1 = path.join(chunkYQ3XC6C2_cjs.theokitConfigRoot(cwd), "mcp.json");
|
|
7923
8045
|
try {
|
|
7924
8046
|
const raw = await promises.readFile(path$1, "utf8");
|
|
7925
8047
|
const parsed = JSON.parse(raw);
|
|
@@ -7931,20 +8053,20 @@ async function readProjectMcpServers(cwd) {
|
|
|
7931
8053
|
|
|
7932
8054
|
// src/internal/local-agent/local-agent-invalidate.ts
|
|
7933
8055
|
async function applyDeferredInvalidation(agentId, pending, refresh) {
|
|
7934
|
-
|
|
8056
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] applying deferred cache invalidation (${agentId}): ${pending.reason}
|
|
7935
8057
|
`);
|
|
7936
8058
|
try {
|
|
7937
8059
|
await refresh();
|
|
7938
8060
|
} catch (err) {
|
|
7939
8061
|
const msg = err instanceof Error ? err.message : String(err);
|
|
7940
|
-
|
|
8062
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] invalidateCache reload failed (continuing): ${msg}
|
|
7941
8063
|
`);
|
|
7942
8064
|
}
|
|
7943
8065
|
}
|
|
7944
8066
|
async function invalidateCacheImpl(agentId, reason, options, disposed, dispose, setPending) {
|
|
7945
8067
|
if (disposed) return;
|
|
7946
8068
|
if (options.applyNow === true) {
|
|
7947
|
-
|
|
8069
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] invalidateCache applyNow disposing agent (${agentId}): ${reason}
|
|
7948
8070
|
`);
|
|
7949
8071
|
await dispose();
|
|
7950
8072
|
return;
|
|
@@ -8005,7 +8127,7 @@ var LiveAgentRegistry = class {
|
|
|
8005
8127
|
const existing = this.#agents.get(id);
|
|
8006
8128
|
if (existing !== void 0 && existing.agent !== agent) {
|
|
8007
8129
|
void existing.agent.dispose().catch(() => {
|
|
8008
|
-
|
|
8130
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] dispose during overwrite failed (${id})
|
|
8009
8131
|
`);
|
|
8010
8132
|
});
|
|
8011
8133
|
}
|
|
@@ -8109,7 +8231,7 @@ var LiveAgentRegistry = class {
|
|
|
8109
8231
|
await agent.dispose();
|
|
8110
8232
|
} catch (cause) {
|
|
8111
8233
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
8112
|
-
|
|
8234
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] dispose during eviction failed (${id}): ${msg}
|
|
8113
8235
|
`);
|
|
8114
8236
|
}
|
|
8115
8237
|
if (this.#onEvict !== void 0) {
|
|
@@ -8117,7 +8239,7 @@ var LiveAgentRegistry = class {
|
|
|
8117
8239
|
this.#onEvict(id, reason);
|
|
8118
8240
|
} catch (cause) {
|
|
8119
8241
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
8120
|
-
|
|
8242
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] onEvict listener threw (${id}): ${msg}
|
|
8121
8243
|
`);
|
|
8122
8244
|
}
|
|
8123
8245
|
}
|
|
@@ -8135,7 +8257,7 @@ async function acquireLeaseIfPossible(store, agentId) {
|
|
|
8135
8257
|
await store.acquire(agentId);
|
|
8136
8258
|
} catch (err) {
|
|
8137
8259
|
if (err instanceof Error && err.name === "SessionBusyError") throw err;
|
|
8138
|
-
|
|
8260
|
+
chunkRNXXYF22_cjs.diag(
|
|
8139
8261
|
`[theokit-sdk] writer lease unavailable for ${agentId} (${err instanceof Error ? err.message : String(err)}) \u2014 proceeding without single-writer protection
|
|
8140
8262
|
`
|
|
8141
8263
|
);
|
|
@@ -8152,16 +8274,16 @@ async function disposeLocalAgentSession(agent) {
|
|
|
8152
8274
|
agent.lifecycleAbortController.abort();
|
|
8153
8275
|
await chunkZF2LDKQQ_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
|
|
8154
8276
|
disposeSessionMcpClients(agent.agentId);
|
|
8155
|
-
await
|
|
8277
|
+
await chunkYOVZMN4P_cjs.flushSessionWrites();
|
|
8156
8278
|
await flushRegistrySaves(agent.workspaceCwd);
|
|
8157
8279
|
await disposeSessionStore(agent.sessionStore);
|
|
8158
|
-
|
|
8280
|
+
chunkYOVZMN4P_cjs.discardSession(agent.workspaceCwd, agent.agentId);
|
|
8159
8281
|
}
|
|
8160
8282
|
async function reloadLocalAgent(agent) {
|
|
8161
8283
|
if (agent.context !== void 0) await agent.context.refresh();
|
|
8162
8284
|
if (agent.skillsManager !== void 0) await agent.skillsManager.refresh();
|
|
8163
8285
|
if (agent.pluginsManager !== void 0) await agent.pluginsManager.refresh();
|
|
8164
|
-
return await
|
|
8286
|
+
return await chunkWDVG5R2Q_cjs.loadSubagents(
|
|
8165
8287
|
agent.workspaceCwd,
|
|
8166
8288
|
agent.settingSourcesIncludeProject,
|
|
8167
8289
|
agent.options.agents
|
|
@@ -8174,7 +8296,7 @@ async function createAvailableAdapters(entries, workspaceCwd) {
|
|
|
8174
8296
|
for (const entry of entries) {
|
|
8175
8297
|
const instance = await entry.createProvider(workspaceCwd);
|
|
8176
8298
|
if (instance.isAvailable() === false) {
|
|
8177
|
-
|
|
8299
|
+
chunkRNXXYF22_cjs.diag(
|
|
8178
8300
|
`[theokit-sdk] memory adapter "${instance.id}" reports itself unavailable (plugin "${entry.pluginName}") \u2014 skipping it. Check its credentials.
|
|
8179
8301
|
`
|
|
8180
8302
|
);
|
|
@@ -8208,7 +8330,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
|
|
|
8208
8330
|
...partial?.metadata !== void 0 ? { metadata: partial.metadata } : defaultContext?.metadata !== void 0 ? { metadata: defaultContext.metadata } : {}
|
|
8209
8331
|
};
|
|
8210
8332
|
if (merged.userId === "") {
|
|
8211
|
-
throw new
|
|
8333
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
8212
8334
|
"agent.memory requires a userId \u2014 either set AgentOptions.memoryContext.userId or pass ctx.userId at call time.",
|
|
8213
8335
|
{ code: "memory_context_missing_user_id" }
|
|
8214
8336
|
);
|
|
@@ -8218,7 +8340,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
|
|
|
8218
8340
|
async function requireAdapters() {
|
|
8219
8341
|
const r = await ensure();
|
|
8220
8342
|
if (r.adapters.length === 0) {
|
|
8221
|
-
throw new
|
|
8343
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
8222
8344
|
r.registered === 0 ? "No memory adapter registered. Pass a memory plugin in AgentOptions.plugins (e.g. supermemoryMemory({...}))." : `All ${r.registered} registered memory adapter(s) reported themselves unavailable \u2014 see the warnings naming each one. Check their credentials.`,
|
|
8223
8345
|
{ code: "no_memory_adapter" }
|
|
8224
8346
|
);
|
|
@@ -8259,7 +8381,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
|
|
|
8259
8381
|
const prefix = id.split(":", 1)[0] ?? "";
|
|
8260
8382
|
const target = adapters.find((a) => a.id === prefix);
|
|
8261
8383
|
if (target === void 0) {
|
|
8262
|
-
throw new
|
|
8384
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
8263
8385
|
`No adapter found for MemoryId prefix "${prefix}" (registered: ${adapters.map((a) => a.id).join(", ")}).`,
|
|
8264
8386
|
{ code: "no_memory_adapter" }
|
|
8265
8387
|
);
|
|
@@ -8389,7 +8511,7 @@ async function searchOnce(args, cfg, query, started) {
|
|
|
8389
8511
|
return { summary, durationMs: Date.now() - started, status: "ok", hits };
|
|
8390
8512
|
} catch (cause) {
|
|
8391
8513
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
8392
|
-
|
|
8514
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] active-memory recall failed: ${message}
|
|
8393
8515
|
`);
|
|
8394
8516
|
return { summary: void 0, durationMs: Date.now() - started, status: "error", hits: [] };
|
|
8395
8517
|
}
|
|
@@ -8407,7 +8529,7 @@ async function finalize(args, queryMode, result) {
|
|
|
8407
8529
|
};
|
|
8408
8530
|
args.cache?.set(args.userText, queryMode, result, tenantCtx);
|
|
8409
8531
|
if (args.persistTranscripts === true && args.cwd !== void 0) {
|
|
8410
|
-
await
|
|
8532
|
+
await chunkRS7YQR4X_cjs.persistActiveMemoryTranscript(args.memoryRoot ?? chunkSDZ4XDWS_cjs.resolveMemoryRoot(args.cwd), {
|
|
8411
8533
|
runId: args.runId ?? `run-${Date.now()}`,
|
|
8412
8534
|
startedAtMs: Date.now() - result.durationMs,
|
|
8413
8535
|
userText: args.userText,
|
|
@@ -8510,7 +8632,7 @@ var openAiMemoryEmbeddingProviderAdapter = {
|
|
|
8510
8632
|
transport: "remote",
|
|
8511
8633
|
authProviderId: "openai",
|
|
8512
8634
|
autoSelectPriority: 20,
|
|
8513
|
-
create: (options) =>
|
|
8635
|
+
create: (options) => chunkCGH4BCIY_cjs.createOpenAiCompatibleRuntime(
|
|
8514
8636
|
{
|
|
8515
8637
|
id: "openai",
|
|
8516
8638
|
defaultBaseUrl: "https://api.openai.com",
|
|
@@ -8532,7 +8654,7 @@ var azureOpenAiMemoryEmbeddingProviderAdapter = {
|
|
|
8532
8654
|
transport: "remote",
|
|
8533
8655
|
authProviderId: "azure-openai",
|
|
8534
8656
|
autoSelectPriority: 25,
|
|
8535
|
-
create: (options) =>
|
|
8657
|
+
create: (options) => chunkCGH4BCIY_cjs.createOpenAiCompatibleRuntime(
|
|
8536
8658
|
{
|
|
8537
8659
|
id: "azure-openai",
|
|
8538
8660
|
defaultBaseUrl: "https://your-resource.openai.azure.com",
|
|
@@ -8568,7 +8690,7 @@ var cohereMemoryEmbeddingProviderAdapter = {
|
|
|
8568
8690
|
transport: "remote",
|
|
8569
8691
|
authProviderId: "cohere",
|
|
8570
8692
|
autoSelectPriority: 30,
|
|
8571
|
-
create: (options) =>
|
|
8693
|
+
create: (options) => chunkCGH4BCIY_cjs.createOpenAiCompatibleRuntime(
|
|
8572
8694
|
{
|
|
8573
8695
|
id: "cohere",
|
|
8574
8696
|
defaultBaseUrl: "https://api.cohere.com",
|
|
@@ -8614,7 +8736,7 @@ var deepinfraMemoryEmbeddingProviderAdapter = {
|
|
|
8614
8736
|
transport: "remote",
|
|
8615
8737
|
authProviderId: "deepinfra",
|
|
8616
8738
|
autoSelectPriority: 13,
|
|
8617
|
-
create: (options) =>
|
|
8739
|
+
create: (options) => chunkCGH4BCIY_cjs.createOpenAiCompatibleRuntime(
|
|
8618
8740
|
{
|
|
8619
8741
|
id: "deepinfra",
|
|
8620
8742
|
defaultBaseUrl: "https://api.deepinfra.com",
|
|
@@ -8640,7 +8762,7 @@ var geminiMemoryEmbeddingProviderAdapter = {
|
|
|
8640
8762
|
transport: "remote",
|
|
8641
8763
|
authProviderId: "gemini",
|
|
8642
8764
|
autoSelectPriority: 30,
|
|
8643
|
-
create: (options) =>
|
|
8765
|
+
create: (options) => chunkCGH4BCIY_cjs.createOpenAiCompatibleRuntime(
|
|
8644
8766
|
{
|
|
8645
8767
|
id: "gemini",
|
|
8646
8768
|
defaultBaseUrl: "https://generativelanguage.googleapis.com",
|
|
@@ -8668,7 +8790,7 @@ var jinaMemoryEmbeddingProviderAdapter = {
|
|
|
8668
8790
|
transport: "remote",
|
|
8669
8791
|
authProviderId: "jina",
|
|
8670
8792
|
autoSelectPriority: 35,
|
|
8671
|
-
create: (options) =>
|
|
8793
|
+
create: (options) => chunkCGH4BCIY_cjs.createOpenAiCompatibleRuntime(
|
|
8672
8794
|
{
|
|
8673
8795
|
id: "jina",
|
|
8674
8796
|
defaultBaseUrl: "https://api.jina.ai",
|
|
@@ -8691,7 +8813,7 @@ var mistralMemoryEmbeddingProviderAdapter = {
|
|
|
8691
8813
|
transport: "remote",
|
|
8692
8814
|
authProviderId: "mistral",
|
|
8693
8815
|
autoSelectPriority: 18,
|
|
8694
|
-
create: (options) =>
|
|
8816
|
+
create: (options) => chunkCGH4BCIY_cjs.createOpenAiCompatibleRuntime(
|
|
8695
8817
|
{
|
|
8696
8818
|
id: "mistral",
|
|
8697
8819
|
defaultBaseUrl: "https://api.mistral.ai",
|
|
@@ -8733,7 +8855,7 @@ var ollamaMemoryEmbeddingProviderAdapter = {
|
|
|
8733
8855
|
autoSelectPriority: 10,
|
|
8734
8856
|
create: (options) => {
|
|
8735
8857
|
const apiKey = options.apiKey ?? process.env.OLLAMA_API_KEY ?? OLLAMA_LOCAL_SENTINEL_KEY;
|
|
8736
|
-
return
|
|
8858
|
+
return chunkCGH4BCIY_cjs.createOpenAiCompatibleRuntime(
|
|
8737
8859
|
{
|
|
8738
8860
|
id: "ollama",
|
|
8739
8861
|
defaultBaseUrl: "http://localhost:11434",
|
|
@@ -8761,7 +8883,7 @@ var openRouterMemoryEmbeddingProviderAdapter = {
|
|
|
8761
8883
|
transport: "remote",
|
|
8762
8884
|
authProviderId: "openrouter",
|
|
8763
8885
|
autoSelectPriority: 15,
|
|
8764
|
-
create: (options) =>
|
|
8886
|
+
create: (options) => chunkCGH4BCIY_cjs.createOpenAiCompatibleRuntime(
|
|
8765
8887
|
{
|
|
8766
8888
|
id: "openrouter",
|
|
8767
8889
|
defaultBaseUrl: "https://openrouter.ai/api",
|
|
@@ -8789,7 +8911,7 @@ var voyageMemoryEmbeddingProviderAdapter = {
|
|
|
8789
8911
|
transport: "remote",
|
|
8790
8912
|
authProviderId: "voyage",
|
|
8791
8913
|
autoSelectPriority: 14,
|
|
8792
|
-
create: (options) =>
|
|
8914
|
+
create: (options) => chunkCGH4BCIY_cjs.createOpenAiCompatibleRuntime(
|
|
8793
8915
|
{
|
|
8794
8916
|
id: "voyage",
|
|
8795
8917
|
defaultBaseUrl: "https://api.voyageai.com",
|
|
@@ -8901,7 +9023,7 @@ function createMemoryGetTool(opts) {
|
|
|
8901
9023
|
const lines = readNumber(input.lines);
|
|
8902
9024
|
const resolved = path.resolve(memoryRoot, relPath);
|
|
8903
9025
|
if (!isPathInside(memoryRoot, resolved)) {
|
|
8904
|
-
throw new
|
|
9026
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
8905
9027
|
`memory_get rejected path that escapes memory root: ${relPath}`,
|
|
8906
9028
|
{ code: "memory_path_escapes_root" }
|
|
8907
9029
|
);
|
|
@@ -8921,7 +9043,7 @@ function readString(value, errorIfMissing, allowUndefined = false) {
|
|
|
8921
9043
|
if (typeof value === "string") return value;
|
|
8922
9044
|
if (allowUndefined && (value === void 0 || value === null)) return "";
|
|
8923
9045
|
if (errorIfMissing !== void 0) {
|
|
8924
|
-
throw new
|
|
9046
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(errorIfMissing, { code: "memory_tool_bad_args" });
|
|
8925
9047
|
}
|
|
8926
9048
|
return "";
|
|
8927
9049
|
}
|
|
@@ -8998,7 +9120,7 @@ var LocalAgentMemory = class {
|
|
|
8998
9120
|
const openOpts = { cwd: this.workspaceCwd, memoryRoot };
|
|
8999
9121
|
if (embedding !== void 0) openOpts.embedding = embedding;
|
|
9000
9122
|
if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
|
|
9001
|
-
this.index = await
|
|
9123
|
+
this.index = await chunkCWQPQTUZ_cjs.IndexManager.open(openOpts);
|
|
9002
9124
|
await this.index.sync();
|
|
9003
9125
|
this.toolsCache = [
|
|
9004
9126
|
createMemorySearchTool({ index: this.index }),
|
|
@@ -9010,7 +9132,7 @@ var LocalAgentMemory = class {
|
|
|
9010
9132
|
const warned2 = chunkNVXXWAU7_cjs.globalSingleton("theokit-sdk.memory.warned", () => /* @__PURE__ */ new Set());
|
|
9011
9133
|
if (!warned2.has(message)) {
|
|
9012
9134
|
warned2.add(message);
|
|
9013
|
-
|
|
9135
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] memory tools unavailable: ${message}
|
|
9014
9136
|
`);
|
|
9015
9137
|
}
|
|
9016
9138
|
return void 0;
|
|
@@ -9019,7 +9141,7 @@ var LocalAgentMemory = class {
|
|
|
9019
9141
|
async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
|
|
9020
9142
|
const cfg = this.options.memory?.activeRecall;
|
|
9021
9143
|
if (cfg?.enabled !== true || this.index === void 0) return void 0;
|
|
9022
|
-
if (this.breaker === void 0) this.breaker = new
|
|
9144
|
+
if (this.breaker === void 0) this.breaker = new chunkLSWHDOCL_cjs.CircuitBreaker();
|
|
9023
9145
|
if (this.cache === void 0) this.cache = new ActiveMemoryCache();
|
|
9024
9146
|
const result = await runActiveMemory({
|
|
9025
9147
|
userText,
|
|
@@ -9042,7 +9164,7 @@ var LocalAgentMemory = class {
|
|
|
9042
9164
|
* and the active-memory transcript writer. Three separate resolutions is how they drifted (#463).
|
|
9043
9165
|
*/
|
|
9044
9166
|
memoryRoot() {
|
|
9045
|
-
this.memoryRootCache ??=
|
|
9167
|
+
this.memoryRootCache ??= chunkSDZ4XDWS_cjs.resolveMemoryRoot(this.workspaceCwd, this.options.memory);
|
|
9046
9168
|
return this.memoryRootCache;
|
|
9047
9169
|
}
|
|
9048
9170
|
buildActiveMemoryOptions(cfg) {
|
|
@@ -9078,7 +9200,7 @@ var LocalAgentMemory = class {
|
|
|
9078
9200
|
await this.index.sync();
|
|
9079
9201
|
} catch (cause) {
|
|
9080
9202
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
9081
|
-
|
|
9203
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] session index sync failed: ${message}
|
|
9082
9204
|
`);
|
|
9083
9205
|
}
|
|
9084
9206
|
}
|
|
@@ -9091,7 +9213,7 @@ var LocalAgentMemory = class {
|
|
|
9091
9213
|
return await adapter.create(cfg.model !== void 0 ? { model: cfg.model } : {});
|
|
9092
9214
|
} catch (cause) {
|
|
9093
9215
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
9094
|
-
|
|
9216
|
+
chunkRNXXYF22_cjs.diag(`[theokit-sdk] memory embedding ${cfg.provider} unavailable: ${message}
|
|
9095
9217
|
`);
|
|
9096
9218
|
return void 0;
|
|
9097
9219
|
}
|
|
@@ -9157,7 +9279,7 @@ function createLocalAgentMemoryProvider(opts) {
|
|
|
9157
9279
|
return { facts: [], systemPromptAdditions: summary };
|
|
9158
9280
|
},
|
|
9159
9281
|
async recordSessionSummary(args) {
|
|
9160
|
-
await
|
|
9282
|
+
await chunkSDZ4XDWS_cjs.writeSessionSummary(args);
|
|
9161
9283
|
},
|
|
9162
9284
|
async sync(handle) {
|
|
9163
9285
|
const state = handle[INTERNAL_LAM_KEY];
|
|
@@ -9195,7 +9317,7 @@ var PersonalityRegistry = class _PersonalityRegistry {
|
|
|
9195
9317
|
* @internal
|
|
9196
9318
|
*/
|
|
9197
9319
|
static async load(cwd) {
|
|
9198
|
-
const projectDir = path.join(
|
|
9320
|
+
const projectDir = path.join(chunkYQ3XC6C2_cjs.theokitConfigRoot(cwd), PERSONALITIES_SUFFIX);
|
|
9199
9321
|
const userDir = path.join(os.homedir(), USER_SUBDIR);
|
|
9200
9322
|
const [userEntities, projectEntities] = await Promise.all([
|
|
9201
9323
|
loadMarkdownEntities({
|
|
@@ -9235,19 +9357,19 @@ var PersonalityRegistry = class _PersonalityRegistry {
|
|
|
9235
9357
|
function addEntity(byName, entity, origin, collisionMap) {
|
|
9236
9358
|
const fm = entity.frontmatter;
|
|
9237
9359
|
if (PersonalityRegistry.isReservedClearSlug(fm.name)) {
|
|
9238
|
-
throw new
|
|
9360
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
9239
9361
|
`Personality name "${fm.name}" is reserved (used to clear active preset)`,
|
|
9240
9362
|
{ code: "personality_reserved_name" }
|
|
9241
9363
|
);
|
|
9242
9364
|
}
|
|
9243
9365
|
if (entity.body.trim().length === 0) {
|
|
9244
|
-
throw new
|
|
9366
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
9245
9367
|
`Personality "${fm.name}" has empty body (system prompt required)`,
|
|
9246
9368
|
{ code: "personality_empty_body" }
|
|
9247
9369
|
);
|
|
9248
9370
|
}
|
|
9249
9371
|
if (origin === "project" && collisionMap?.has(fm.name)) {
|
|
9250
|
-
|
|
9372
|
+
chunkUDAKAE4Z_cjs.warnOnce(
|
|
9251
9373
|
`personality-collision-${fm.name}`,
|
|
9252
9374
|
`[theokit-sdk] personality "${fm.name}" overridden by project preset`
|
|
9253
9375
|
);
|
|
@@ -9276,7 +9398,7 @@ async function performPersonalitySwitch(args) {
|
|
|
9276
9398
|
const preset = args.registry.get(args.requestedName);
|
|
9277
9399
|
if (preset === void 0) {
|
|
9278
9400
|
const available = args.registry.all().map((p) => p.name).join(", ") || "(none)";
|
|
9279
|
-
throw new
|
|
9401
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
9280
9402
|
`Personality "${args.requestedName}" not found. Available: ${available}`,
|
|
9281
9403
|
{ code: "personality_not_found" }
|
|
9282
9404
|
);
|
|
@@ -9297,14 +9419,14 @@ async function performPersonalitySwitch(args) {
|
|
|
9297
9419
|
|
|
9298
9420
|
// src/internal/local-agent/local-agent-personality-extensions.ts
|
|
9299
9421
|
function resolveActivePersonalityPreset(args) {
|
|
9300
|
-
const forkCtx =
|
|
9422
|
+
const forkCtx = chunk7YUPSBDV_cjs.currentPersonalityContext();
|
|
9301
9423
|
const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
|
|
9302
9424
|
if (slug === void 0) return void 0;
|
|
9303
9425
|
return args.personalityRegistry?.get(slug);
|
|
9304
9426
|
}
|
|
9305
9427
|
async function ensurePersonalityRegistryIfNeeded(args) {
|
|
9306
9428
|
if (args.personalityRegistry !== void 0) return args.personalityRegistry;
|
|
9307
|
-
const forkSlug =
|
|
9429
|
+
const forkSlug = chunk7YUPSBDV_cjs.currentPersonalityContext()?.slug;
|
|
9308
9430
|
const ownSlug = args.personalityStore.active(args.agentId);
|
|
9309
9431
|
if (forkSlug === void 0 && ownSlug === void 0) return void 0;
|
|
9310
9432
|
return await PersonalityRegistry.load(args.workspaceCwd);
|
|
@@ -9317,8 +9439,8 @@ function applyPersonalityOverlay(preset, base) {
|
|
|
9317
9439
|
${preset.systemPrompt}`;
|
|
9318
9440
|
}
|
|
9319
9441
|
async function localAgentUsePersonality(agent, name, opts) {
|
|
9320
|
-
if (
|
|
9321
|
-
|
|
9442
|
+
if (chunk7YUPSBDV_cjs.currentPersonalityContext() !== void 0) {
|
|
9443
|
+
chunk7YUPSBDV_cjs.warnPersonalitySwitchInsideFork(agent.agentId);
|
|
9322
9444
|
return null;
|
|
9323
9445
|
}
|
|
9324
9446
|
if (agent.personalityRegistry === void 0) {
|
|
@@ -9334,8 +9456,8 @@ async function localAgentUsePersonality(agent, name, opts) {
|
|
|
9334
9456
|
registry,
|
|
9335
9457
|
store: agent.personalityStore,
|
|
9336
9458
|
invalidateCache: (reason) => agent.invalidateCache(reason),
|
|
9337
|
-
appendSessionMessage: (msg) =>
|
|
9338
|
-
clearSession: () =>
|
|
9459
|
+
appendSessionMessage: (msg) => chunkYOVZMN4P_cjs.appendSessionMessage(agent.agentId, msg),
|
|
9460
|
+
clearSession: () => chunkYOVZMN4P_cjs.clearSession(agent.agentId),
|
|
9339
9461
|
opts: opts ?? {}
|
|
9340
9462
|
})
|
|
9341
9463
|
);
|
|
@@ -9344,9 +9466,9 @@ async function localAgentUsePersonality(agent, name, opts) {
|
|
|
9344
9466
|
// src/internal/local-agent/local-agent-runtime-extensions.ts
|
|
9345
9467
|
function localAgentRunUntil(agent, goal, options) {
|
|
9346
9468
|
async function* wrap() {
|
|
9347
|
-
const { runUntilImpl } = await import('./run-until-
|
|
9469
|
+
const { runUntilImpl } = await import('./run-until-4KHVF7YC.cjs');
|
|
9348
9470
|
const buildDeps = async () => {
|
|
9349
|
-
const { judgeCallImpl } = await import('./judge-call-
|
|
9471
|
+
const { judgeCallImpl } = await import('./judge-call-ZTUQMQRL.cjs');
|
|
9350
9472
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
9351
9473
|
const create = getAgentFacade().create;
|
|
9352
9474
|
return {
|
|
@@ -9379,7 +9501,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
|
|
|
9379
9501
|
async function localAgentFork(parent, options) {
|
|
9380
9502
|
const { forkAgentImpl } = await import('./fork-agent-WAEQI2DL.cjs');
|
|
9381
9503
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
9382
|
-
const { withPersonalityContext } = await import('./context-
|
|
9504
|
+
const { withPersonalityContext } = await import('./context-4RSI3AXT.cjs');
|
|
9383
9505
|
const create = getAgentFacade().create;
|
|
9384
9506
|
return withPersonalityContext(
|
|
9385
9507
|
{ slug: parent.personalitySlugSnapshot, isFork: true },
|
|
@@ -9390,7 +9512,7 @@ async function persistMemoryFactIfWritePrompt(workspaceCwd, memoryConfig, userTe
|
|
|
9390
9512
|
if (memoryConfig?.enabled !== true) return;
|
|
9391
9513
|
const unstored = unstoredRememberWarning(userText);
|
|
9392
9514
|
if (unstored !== void 0) {
|
|
9393
|
-
|
|
9515
|
+
chunkRNXXYF22_cjs.diagFailure(unstored);
|
|
9394
9516
|
return;
|
|
9395
9517
|
}
|
|
9396
9518
|
if (!isMemoryWritePrompt(userText)) return;
|
|
@@ -9404,36 +9526,10 @@ async function persistMemoryFactIfWritePrompt(workspaceCwd, memoryConfig, userTe
|
|
|
9404
9526
|
});
|
|
9405
9527
|
} catch (cause) {
|
|
9406
9528
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
9407
|
-
|
|
9529
|
+
chunkRNXXYF22_cjs.diagFailure(`[theokit-sdk] memory write failed, nothing was stored: ${message}`);
|
|
9408
9530
|
}
|
|
9409
9531
|
}
|
|
9410
9532
|
|
|
9411
|
-
// src/internal/concurrency/abort-utils.ts
|
|
9412
|
-
function anySignal(signals) {
|
|
9413
|
-
const filtered = signals.filter((s) => s !== void 0);
|
|
9414
|
-
if (filtered.length === 0) {
|
|
9415
|
-
return new AbortController().signal;
|
|
9416
|
-
}
|
|
9417
|
-
if (filtered.length === 1) {
|
|
9418
|
-
return filtered[0];
|
|
9419
|
-
}
|
|
9420
|
-
if (typeof AbortSignal.any === "function") {
|
|
9421
|
-
return AbortSignal.any(filtered);
|
|
9422
|
-
}
|
|
9423
|
-
return ponyfillAny(filtered);
|
|
9424
|
-
}
|
|
9425
|
-
function ponyfillAny(signals) {
|
|
9426
|
-
const ctrl = new AbortController();
|
|
9427
|
-
for (const s of signals) {
|
|
9428
|
-
if (s.aborted) {
|
|
9429
|
-
ctrl.abort(s.reason);
|
|
9430
|
-
return ctrl.signal;
|
|
9431
|
-
}
|
|
9432
|
-
s.addEventListener("abort", () => ctrl.abort(s.reason), { once: true });
|
|
9433
|
-
}
|
|
9434
|
-
return ctrl.signal;
|
|
9435
|
-
}
|
|
9436
|
-
|
|
9437
9533
|
// src/internal/runtime/lifecycle/wrap-completion-check-run.ts
|
|
9438
9534
|
function wrapRunWithCompletionCheck(args) {
|
|
9439
9535
|
const check = args.completionCheck;
|
|
@@ -9449,7 +9545,7 @@ function wrapRunWithCompletionCheck(args) {
|
|
|
9449
9545
|
judgeOpts
|
|
9450
9546
|
);
|
|
9451
9547
|
const complete = !verdict.parseFailed && verdict.verdict === "done";
|
|
9452
|
-
|
|
9548
|
+
chunkL7JPXZ2C_cjs.emitRunEvent(args.onRunEvent, {
|
|
9453
9549
|
type: "completion_check",
|
|
9454
9550
|
complete,
|
|
9455
9551
|
reason: verdict.reason
|
|
@@ -9766,7 +9862,7 @@ function wrapRunWithOutputProcessors(args) {
|
|
|
9766
9862
|
if (result.status !== "finished" || result.result === void 0) return result;
|
|
9767
9863
|
const res = await runOutputProcessors(args.processors, result.result, args.agentId);
|
|
9768
9864
|
if (res.kind === "ok") return { ...result, result: res.value };
|
|
9769
|
-
|
|
9865
|
+
chunkL7JPXZ2C_cjs.emitRunEvent(args.onRunEvent, {
|
|
9770
9866
|
type: "tripwire",
|
|
9771
9867
|
reason: res.tripwire.reason,
|
|
9772
9868
|
processorId: res.tripwire.processorId
|
|
@@ -9856,7 +9952,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
|
|
|
9856
9952
|
}
|
|
9857
9953
|
const res = await runInputProcessors(processors, rawUserText, inputs.agentId);
|
|
9858
9954
|
if (res.kind === "tripwire") {
|
|
9859
|
-
|
|
9955
|
+
chunkL7JPXZ2C_cjs.emitRunEvent(options.onRunEvent, {
|
|
9860
9956
|
type: "tripwire",
|
|
9861
9957
|
reason: res.tripwire.reason,
|
|
9862
9958
|
processorId: res.tripwire.processorId
|
|
@@ -9873,7 +9969,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
|
|
|
9873
9969
|
return { userText: res.value, effectiveMessage };
|
|
9874
9970
|
}
|
|
9875
9971
|
async function executeSendLocked(inputs, message, options) {
|
|
9876
|
-
if (inputs.disposed) throw new
|
|
9972
|
+
if (inputs.disposed) throw new chunkCEGU5AVD_cjs.AgentDisposedError(inputs.agentId);
|
|
9877
9973
|
await consumePending(
|
|
9878
9974
|
inputs.agentId,
|
|
9879
9975
|
inputs.invalidationPending,
|
|
@@ -9889,7 +9985,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9889
9985
|
if (inputs.options.onBeforeSend !== void 0) {
|
|
9890
9986
|
await inputs.options.onBeforeSend({
|
|
9891
9987
|
conversationId: inputs.agentId,
|
|
9892
|
-
previousMessageCount:
|
|
9988
|
+
previousMessageCount: chunkYOVZMN4P_cjs.getSessionMessages(inputs.agentId).length
|
|
9893
9989
|
});
|
|
9894
9990
|
}
|
|
9895
9991
|
await inputs.runPreHook(userText);
|
|
@@ -9901,8 +9997,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9901
9997
|
userText,
|
|
9902
9998
|
sendOptions: options
|
|
9903
9999
|
});
|
|
9904
|
-
const priorMessages = [...
|
|
9905
|
-
|
|
10000
|
+
const priorMessages = [...chunkYOVZMN4P_cjs.getSessionMessages(inputs.agentId)];
|
|
10001
|
+
chunkYOVZMN4P_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
|
|
9906
10002
|
await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9907
10003
|
const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9908
10004
|
const memoryTools = void 0;
|
|
@@ -9953,7 +10049,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9953
10049
|
function buildCompletionCheckDeps() {
|
|
9954
10050
|
return {
|
|
9955
10051
|
judge: async (ctx, opts) => {
|
|
9956
|
-
const { judgeCallImpl } = await import('./judge-call-
|
|
10052
|
+
const { judgeCallImpl } = await import('./judge-call-ZTUQMQRL.cjs');
|
|
9957
10053
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
9958
10054
|
return judgeCallImpl(ctx, opts, { create: getAgentFacade().create });
|
|
9959
10055
|
}
|
|
@@ -9964,7 +10060,7 @@ function reportRefusedMemoryDirectoryOnce(workspaceCwd, directory, message) {
|
|
|
9964
10060
|
const key = `${workspaceCwd}\0${directory ?? ""}`;
|
|
9965
10061
|
if (reportedRefusedDirectories.has(key)) return;
|
|
9966
10062
|
reportedRefusedDirectories.add(key);
|
|
9967
|
-
|
|
10063
|
+
chunkRNXXYF22_cjs.diagFailure(
|
|
9968
10064
|
`[theokit-sdk] memory is enabled but its directory was refused, so recall is empty on every turn and nothing is stored: ${message}`
|
|
9969
10065
|
);
|
|
9970
10066
|
}
|
|
@@ -9977,7 +10073,7 @@ function readMemoryForSend(workspaceCwd, memoryConfig, query) {
|
|
|
9977
10073
|
...query === void 0 ? {} : { query }
|
|
9978
10074
|
});
|
|
9979
10075
|
} catch (cause) {
|
|
9980
|
-
if (!(cause instanceof
|
|
10076
|
+
if (!(cause instanceof chunkCEGU5AVD_cjs.ConfigurationError)) throw cause;
|
|
9981
10077
|
reportRefusedMemoryDirectoryOnce(workspaceCwd, memoryConfig?.directory, cause.message);
|
|
9982
10078
|
return [];
|
|
9983
10079
|
}
|
|
@@ -9996,7 +10092,7 @@ function registerRunAsTask(run, agentId, taskOpt, userText) {
|
|
|
9996
10092
|
promptPreview: userText.slice(0, 120),
|
|
9997
10093
|
...opts.meta ?? {}
|
|
9998
10094
|
};
|
|
9999
|
-
void
|
|
10095
|
+
void chunkL7JPXZ2C_cjs.submit({
|
|
10000
10096
|
kind: "run",
|
|
10001
10097
|
work: async (ctx) => {
|
|
10002
10098
|
ctx.signal.addEventListener(
|
|
@@ -10007,7 +10103,7 @@ function registerRunAsTask(run, agentId, taskOpt, userText) {
|
|
|
10007
10103
|
},
|
|
10008
10104
|
{ once: true }
|
|
10009
10105
|
);
|
|
10010
|
-
const result = await run
|
|
10106
|
+
const result = await readRunResolving(run);
|
|
10011
10107
|
ctx.emit({ status: result.status, runId: run.id });
|
|
10012
10108
|
return { status: result.status, result: result.result };
|
|
10013
10109
|
},
|
|
@@ -10064,7 +10160,7 @@ function reportUnknownLocalOptions(local) {
|
|
|
10064
10160
|
reported.add(key);
|
|
10065
10161
|
const guess = nearest(key);
|
|
10066
10162
|
const hint = guess === void 0 ? "" : ` Did you mean \`${guess}\`?`;
|
|
10067
|
-
|
|
10163
|
+
chunkRNXXYF22_cjs.diag(
|
|
10068
10164
|
`[theokit] \`local.${key}\` is not an option this SDK version knows, so it was ignored.${hint}
|
|
10069
10165
|
`
|
|
10070
10166
|
);
|
|
@@ -10155,7 +10251,7 @@ var LocalAgent = class {
|
|
|
10155
10251
|
this.options = options;
|
|
10156
10252
|
this.workspaceCwd = resolveCwd(options.local?.cwd);
|
|
10157
10253
|
this.transcriptBaseDir = resolveSessionDir(options.local);
|
|
10158
|
-
this.sessionStore = options.local?.sessionStore ?? new
|
|
10254
|
+
this.sessionStore = options.local?.sessionStore ?? new chunk6OCJWGVD_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
|
|
10159
10255
|
this.settingSourcesIncludeProject = includesSetting(options, "project");
|
|
10160
10256
|
this.settingSourcesIncludePlugins = includesSetting(options, "plugins");
|
|
10161
10257
|
const sub = bootstrapSubmanagers({
|
|
@@ -10172,7 +10268,7 @@ var LocalAgent = class {
|
|
|
10172
10268
|
if (sub.plugins !== void 0) this.plugins = sub.plugins;
|
|
10173
10269
|
reportUnknownLocalOptions(options.local);
|
|
10174
10270
|
const compatSources = resolveCompatSources(options, this.workspaceCwd);
|
|
10175
|
-
|
|
10271
|
+
chunkYQ3XC6C2_cjs.reportUndeclaredSources(this.workspaceCwd, compatSources);
|
|
10176
10272
|
this.hooksExecutor = new HooksExecutor(this.workspaceCwd, compatSources, options.local?.hooks);
|
|
10177
10273
|
this.defaultMemoryProviderForLoop = createLocalAgentMemoryProvider({
|
|
10178
10274
|
agentOptions: options,
|
|
@@ -10200,7 +10296,7 @@ var LocalAgent = class {
|
|
|
10200
10296
|
if (this.pluginsManager !== void 0) await this.pluginsManager.initialize();
|
|
10201
10297
|
const codePlugins = chunkBV2MWEMV_cjs.extractCodePlugins(this.options.plugins);
|
|
10202
10298
|
await this.pluginManagerCode.initialize(codePlugins);
|
|
10203
|
-
this.resolvedSubagents = await
|
|
10299
|
+
this.resolvedSubagents = await chunkWDVG5R2Q_cjs.loadSubagents(
|
|
10204
10300
|
this.workspaceCwd,
|
|
10205
10301
|
this.settingSourcesIncludeProject,
|
|
10206
10302
|
this.options.agents,
|
|
@@ -10208,7 +10304,7 @@ var LocalAgent = class {
|
|
|
10208
10304
|
);
|
|
10209
10305
|
await acquireLeaseIfPossible(this.sessionStore, this.agentId);
|
|
10210
10306
|
try {
|
|
10211
|
-
await
|
|
10307
|
+
await chunkYOVZMN4P_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
|
|
10212
10308
|
await this.personalityStore.hydrate(this.agentId);
|
|
10213
10309
|
} catch (err) {
|
|
10214
10310
|
await releaseLeaseIfPossible(this.sessionStore, this.agentId);
|
|
@@ -10268,7 +10364,7 @@ var LocalAgent = class {
|
|
|
10268
10364
|
return;
|
|
10269
10365
|
}
|
|
10270
10366
|
if (options.task !== void 0) registerRunAsTask(run, this.agentId, options.task, userText);
|
|
10271
|
-
resolve(run);
|
|
10367
|
+
resolve(callerView(run, this.options.throwOnError));
|
|
10272
10368
|
try {
|
|
10273
10369
|
await runPostRunLifecycle({
|
|
10274
10370
|
run,
|
|
@@ -10366,7 +10462,7 @@ var LocalAgent = class {
|
|
|
10366
10462
|
agentId: this.agentId
|
|
10367
10463
|
});
|
|
10368
10464
|
if (preRun.blocked) {
|
|
10369
|
-
throw new
|
|
10465
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
10370
10466
|
`preRun hook denied execution: ${preRun.reason ?? "unspecified"}`,
|
|
10371
10467
|
{ code: "hook_denied" }
|
|
10372
10468
|
);
|
|
@@ -10472,6 +10568,9 @@ var LocalAgent = class {
|
|
|
10472
10568
|
return localAgentStreamToCompletion(this, message, options);
|
|
10473
10569
|
}
|
|
10474
10570
|
};
|
|
10571
|
+
function callerView(run, throwOnError) {
|
|
10572
|
+
return throwOnError === true ? wrapRunWithThrowOnError(run) : run;
|
|
10573
|
+
}
|
|
10475
10574
|
function resolveCwd(cwd) {
|
|
10476
10575
|
return (Array.isArray(cwd) ? cwd[0] : cwd) ?? process.cwd();
|
|
10477
10576
|
}
|
|
@@ -10498,7 +10597,7 @@ async function guardAgainstIdCollision(options) {
|
|
|
10498
10597
|
const persistenceCwd = resolveAgentPersistenceCwd(options);
|
|
10499
10598
|
await hydrateRegistryFromDisk(persistenceCwd);
|
|
10500
10599
|
if (getRegisteredAgent(options.agentId) !== void 0) {
|
|
10501
|
-
throw new
|
|
10600
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
10502
10601
|
`Agent "${options.agentId}" already exists. Use Agent.resume("${options.agentId}") to reattach, or pick a different agentId.`,
|
|
10503
10602
|
{ code: "agent_id_already_exists" }
|
|
10504
10603
|
);
|
|
@@ -10531,7 +10630,7 @@ async function maybeInjectHandoffTools(options) {
|
|
|
10531
10630
|
const spec = "@theokit/sdk-handoff/internal/tool-injector";
|
|
10532
10631
|
mod = await import(spec);
|
|
10533
10632
|
} catch (err) {
|
|
10534
|
-
throw new
|
|
10633
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
10535
10634
|
"Agent.create({ handoffs: [...] }) requires @theokit/sdk-handoff. Install it: pnpm add @theokit/sdk-handoff. Or migrate to the preferred plugin pattern: plugins: [Handoff.asPlugin({ targets: [...] })] (see docs/migration/1-x-to-2-0.md#handoff).",
|
|
10536
10635
|
{ code: "handoff_package_missing", cause: err }
|
|
10537
10636
|
);
|
|
@@ -10549,40 +10648,40 @@ async function maybeInjectHandoffTools(options) {
|
|
|
10549
10648
|
};
|
|
10550
10649
|
}
|
|
10551
10650
|
function keyWillFlowToProvider(apiKey, provider) {
|
|
10552
|
-
if (
|
|
10553
|
-
if (
|
|
10651
|
+
if (chunkLSWHDOCL_cjs.isFixtureApiKey(apiKey)) return false;
|
|
10652
|
+
if (chunkLSWHDOCL_cjs.getConfiguredBaseUrl() !== void 0) return false;
|
|
10554
10653
|
if (provider === void 0) return false;
|
|
10555
|
-
const profile =
|
|
10654
|
+
const profile = chunkLO6LIUZ6_cjs.getProviderProfile(provider);
|
|
10556
10655
|
if (profile === void 0) return false;
|
|
10557
10656
|
return profile.authType !== "none";
|
|
10558
10657
|
}
|
|
10559
10658
|
function missingApiKeyMessage() {
|
|
10560
|
-
const present =
|
|
10561
|
-
const base = `Missing API key \u2014 set ${
|
|
10659
|
+
const present = chunkLSWHDOCL_cjs.presentProviderCredentialEnvVars();
|
|
10660
|
+
const base = `Missing API key \u2014 set ${chunkRNXXYF22_cjs.API_KEY_ENV_VAR}, or pass \`apiKey\` to Agent.create()`;
|
|
10562
10661
|
if (present.length === 0) return `${base}.`;
|
|
10563
10662
|
return `${base}. ${present.join(" and ")} ${present.length === 1 ? "is" : "are"} set, but a provider credential is not read from the environment automatically \u2014 pass it explicitly, e.g. \`Agent.create({ apiKey: process.env.${present[0]}, ... })\`.`;
|
|
10564
10663
|
}
|
|
10565
10664
|
function providerNeedsCallerKey(provider) {
|
|
10566
10665
|
if (provider === void 0) return true;
|
|
10567
|
-
const profile =
|
|
10666
|
+
const profile = chunkLO6LIUZ6_cjs.getProviderProfile(provider);
|
|
10568
10667
|
if (profile === void 0) return true;
|
|
10569
10668
|
return profile.authType === "api_key";
|
|
10570
10669
|
}
|
|
10571
10670
|
async function createLocalAgent(options) {
|
|
10572
10671
|
const provider = providerFromModelId(normalizeModel(options.model)?.id);
|
|
10573
|
-
const apiKey =
|
|
10672
|
+
const apiKey = chunkRNXXYF22_cjs.resolveApiKey(options.apiKey);
|
|
10574
10673
|
if (apiKey === void 0) {
|
|
10575
10674
|
if (providerNeedsCallerKey(provider)) {
|
|
10576
|
-
throw new
|
|
10675
|
+
throw new chunkCEGU5AVD_cjs.AuthenticationError(missingApiKeyMessage(), { code: "missing_api_key" });
|
|
10577
10676
|
}
|
|
10578
10677
|
} else {
|
|
10579
10678
|
const willFlowToProvider = keyWillFlowToProvider(apiKey, provider);
|
|
10580
|
-
const shape =
|
|
10679
|
+
const shape = chunkLSWHDOCL_cjs.validateApiKeyShape(apiKey, {
|
|
10581
10680
|
strict: willFlowToProvider,
|
|
10582
10681
|
...willFlowToProvider ? { provider } : {}
|
|
10583
10682
|
});
|
|
10584
10683
|
if (shape.malformed) {
|
|
10585
|
-
throw new
|
|
10684
|
+
throw new chunkCEGU5AVD_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
10586
10685
|
}
|
|
10587
10686
|
}
|
|
10588
10687
|
const agent = new LocalAgent(options);
|
|
@@ -10590,21 +10689,21 @@ async function createLocalAgent(options) {
|
|
|
10590
10689
|
return agent;
|
|
10591
10690
|
}
|
|
10592
10691
|
async function createCloudAgent(options) {
|
|
10593
|
-
const apiKey =
|
|
10692
|
+
const apiKey = chunkRNXXYF22_cjs.resolveApiKey(options.apiKey);
|
|
10594
10693
|
if (apiKey === void 0) {
|
|
10595
|
-
throw new
|
|
10694
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError("Missing API key for cloud agent", {
|
|
10596
10695
|
code: "missing_api_key"
|
|
10597
10696
|
});
|
|
10598
10697
|
}
|
|
10599
|
-
const shape =
|
|
10698
|
+
const shape = chunkLSWHDOCL_cjs.validateApiKeyShape(apiKey);
|
|
10600
10699
|
if (shape.malformed) {
|
|
10601
|
-
throw new
|
|
10700
|
+
throw new chunkCEGU5AVD_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
10602
10701
|
}
|
|
10603
|
-
const baseUrl =
|
|
10702
|
+
const baseUrl = chunkLSWHDOCL_cjs.getConfiguredBaseUrl();
|
|
10604
10703
|
if (baseUrl === void 0) {
|
|
10605
10704
|
return new CloudAgent(options);
|
|
10606
10705
|
}
|
|
10607
|
-
const response = await
|
|
10706
|
+
const response = await chunkLSWHDOCL_cjs.httpRequest("/v1/agents", {
|
|
10608
10707
|
apiKey,
|
|
10609
10708
|
method: "POST",
|
|
10610
10709
|
body: {
|
|
@@ -10629,7 +10728,7 @@ function resolveAgentPersistenceCwd(options) {
|
|
|
10629
10728
|
return process.cwd();
|
|
10630
10729
|
}
|
|
10631
10730
|
async function rehydrateExistingAgent(agentId, existing, options) {
|
|
10632
|
-
await
|
|
10731
|
+
await chunkLSWHDOCL_cjs.discoverProviderPlugins();
|
|
10633
10732
|
await validateRehydratedAgent(agentId, existing);
|
|
10634
10733
|
const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
|
|
10635
10734
|
const mergedMemory = mergeResumedMemory(existing.options.memory, options.memory);
|
|
@@ -10645,7 +10744,7 @@ async function rehydrateExistingAgent(agentId, existing, options) {
|
|
|
10645
10744
|
mcpServers: void 0,
|
|
10646
10745
|
agentId
|
|
10647
10746
|
};
|
|
10648
|
-
|
|
10747
|
+
chunkSDZ4XDWS_cjs.resolveMaxFacts(mergedOptions.memory?.maxFacts);
|
|
10649
10748
|
if (existing.runtime === "cloud") {
|
|
10650
10749
|
return new CloudAgent(mergedOptions, agentId);
|
|
10651
10750
|
}
|
|
@@ -10667,13 +10766,13 @@ async function validateRehydratedAgent(agentId, entry) {
|
|
|
10667
10766
|
try {
|
|
10668
10767
|
info = await promises.stat(candidate);
|
|
10669
10768
|
} catch (cause) {
|
|
10670
|
-
throw new
|
|
10769
|
+
throw new chunkCEGU5AVD_cjs.UnknownAgentError(
|
|
10671
10770
|
`Agent "${agentId}" cannot be rehydrated \u2014 workspace cwd "${candidate}" is missing or inaccessible.`,
|
|
10672
10771
|
{ code: "agent_rehydration_failed", cause }
|
|
10673
10772
|
);
|
|
10674
10773
|
}
|
|
10675
10774
|
if (!info.isDirectory()) {
|
|
10676
|
-
throw new
|
|
10775
|
+
throw new chunkCEGU5AVD_cjs.UnknownAgentError(
|
|
10677
10776
|
`Agent "${agentId}" cannot be rehydrated \u2014 workspace cwd "${candidate}" exists but is not a directory.`,
|
|
10678
10777
|
{ code: "agent_rehydration_failed" }
|
|
10679
10778
|
);
|
|
@@ -10728,7 +10827,7 @@ async function getRegisteredAgentOrThrow(agentId, cwd = process.cwd()) {
|
|
|
10728
10827
|
agent = getRegisteredAgent(agentId);
|
|
10729
10828
|
}
|
|
10730
10829
|
if (agent === void 0) {
|
|
10731
|
-
throw new
|
|
10830
|
+
throw new chunkCEGU5AVD_cjs.UnknownAgentError(`Agent ${agentId} not found`, { code: "unknown_agent" });
|
|
10732
10831
|
}
|
|
10733
10832
|
return agent;
|
|
10734
10833
|
}
|
|
@@ -10789,7 +10888,7 @@ var Agent = class _Agent {
|
|
|
10789
10888
|
pluginCount: enabledPluginNames(options.plugins).length
|
|
10790
10889
|
});
|
|
10791
10890
|
try {
|
|
10792
|
-
await
|
|
10891
|
+
await chunkLSWHDOCL_cjs.discoverProviderPlugins();
|
|
10793
10892
|
const agent = await runCreateUnderSpan(options, span);
|
|
10794
10893
|
return agent;
|
|
10795
10894
|
} catch (err) {
|
|
@@ -10825,13 +10924,13 @@ var Agent = class _Agent {
|
|
|
10825
10924
|
* @public
|
|
10826
10925
|
*/
|
|
10827
10926
|
static async prompt(message, options) {
|
|
10828
|
-
const agent = await _Agent.create(options);
|
|
10927
|
+
const agent = await _Agent.create({ ...options, throwOnError: false });
|
|
10829
10928
|
try {
|
|
10830
10929
|
const run = await agent.send(message);
|
|
10831
10930
|
const result = await run.wait();
|
|
10832
10931
|
if (options.throwOnError === true && result.status === "error" && result.error !== void 0) {
|
|
10833
|
-
throw new
|
|
10834
|
-
code:
|
|
10932
|
+
throw new chunkCEGU5AVD_cjs.AgentRunError(result.error.message, {
|
|
10933
|
+
code: chunkCEGU5AVD_cjs.coerceToKnownAgentRunErrorCode(result.error.code),
|
|
10835
10934
|
cause: result.error.cause
|
|
10836
10935
|
});
|
|
10837
10936
|
}
|
|
@@ -10858,7 +10957,7 @@ var Agent = class _Agent {
|
|
|
10858
10957
|
if (existing !== void 0) {
|
|
10859
10958
|
return await rehydrateExistingAgent(agentId, existing, options);
|
|
10860
10959
|
}
|
|
10861
|
-
throw new
|
|
10960
|
+
throw new chunkCEGU5AVD_cjs.UnknownAgentError(
|
|
10862
10961
|
`Agent "${agentId}" not found. Use Agent.create({ agentId, ... }) for first-time setup, or catch UnknownAgentError to branch resume-vs-create.`,
|
|
10863
10962
|
{ code: "unknown_agent" }
|
|
10864
10963
|
);
|
|
@@ -10887,7 +10986,7 @@ var Agent = class _Agent {
|
|
|
10887
10986
|
* @public
|
|
10888
10987
|
*/
|
|
10889
10988
|
static async generateObject(options) {
|
|
10890
|
-
const { generateObjectImpl } = await import('./generate-object-
|
|
10989
|
+
const { generateObjectImpl } = await import('./generate-object-XBWD2PU7.cjs');
|
|
10891
10990
|
return generateObjectImpl(options, {
|
|
10892
10991
|
create: (opts) => _Agent.create(opts),
|
|
10893
10992
|
delete: (agentId) => _Agent.delete(agentId)
|
|
@@ -10911,7 +11010,7 @@ var Agent = class _Agent {
|
|
|
10911
11010
|
delete: (agentId) => _Agent.delete(agentId)
|
|
10912
11011
|
};
|
|
10913
11012
|
async function* wrapper() {
|
|
10914
|
-
streamObjectImport ??= import('./stream-object-
|
|
11013
|
+
streamObjectImport ??= import('./stream-object-TEEK3CAX.cjs');
|
|
10915
11014
|
const { streamObjectImpl } = await streamObjectImport;
|
|
10916
11015
|
yield* streamObjectImpl(options, deps);
|
|
10917
11016
|
}
|
|
@@ -10935,7 +11034,7 @@ var Agent = class _Agent {
|
|
|
10935
11034
|
* @public
|
|
10936
11035
|
*/
|
|
10937
11036
|
static async batch(prompts, options) {
|
|
10938
|
-
const { batchImpl } = await import('./batch-
|
|
11037
|
+
const { batchImpl } = await import('./batch-IZ5EDKJ5.cjs');
|
|
10939
11038
|
return batchImpl(prompts, options, { create: (opts) => _Agent.create(opts) });
|
|
10940
11039
|
}
|
|
10941
11040
|
/**
|
|
@@ -11038,14 +11137,14 @@ var Agent = class _Agent {
|
|
|
11038
11137
|
*/
|
|
11039
11138
|
static async getRun(runId, options = {}) {
|
|
11040
11139
|
if (options.runtime === "cloud") {
|
|
11041
|
-
throw new
|
|
11140
|
+
throw new chunkCEGU5AVD_cjs.ConfigurationError(
|
|
11042
11141
|
"Cloud runtime is pre-release. Theo PaaS endpoints are not wired yet \u2014 getRun({ runtime: 'cloud' }) will be enabled when the PaaS ships.",
|
|
11043
11142
|
{ code: "cloud_runtime_pre_release" }
|
|
11044
11143
|
);
|
|
11045
11144
|
}
|
|
11046
11145
|
const existing = getRun(runId);
|
|
11047
11146
|
if (existing !== void 0) return existing;
|
|
11048
|
-
throw new
|
|
11147
|
+
throw new chunkCEGU5AVD_cjs.UnknownAgentError(
|
|
11049
11148
|
`Run ${runId} is not in this process's registry. It may have been disposed, persisted in a previous process, or never created.`,
|
|
11050
11149
|
{ code: "run_not_found" }
|
|
11051
11150
|
);
|
|
@@ -11087,9 +11186,9 @@ var Agent = class _Agent {
|
|
|
11087
11186
|
*/
|
|
11088
11187
|
static async compact(agentId, options = {}) {
|
|
11089
11188
|
const reg = await requireLocalAgent(agentId, "compact");
|
|
11090
|
-
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-
|
|
11189
|
+
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-NM56BREJ.cjs');
|
|
11091
11190
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
11092
|
-
return
|
|
11191
|
+
return chunkYOVZMN4P_cjs.enqueueSessionWrite(
|
|
11093
11192
|
cwd,
|
|
11094
11193
|
agentId,
|
|
11095
11194
|
() => compactSessionTranscript({
|
|
@@ -11117,7 +11216,7 @@ var Agent = class _Agent {
|
|
|
11117
11216
|
*/
|
|
11118
11217
|
static async injectSessionTurn(agentId, turn) {
|
|
11119
11218
|
const reg = await requireLocalAgent(agentId, "injectSessionTurn");
|
|
11120
|
-
const { injectSessionTurn } = await import('./inject-session-
|
|
11219
|
+
const { injectSessionTurn } = await import('./inject-session-JVTZNQF6.cjs');
|
|
11121
11220
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
11122
11221
|
await injectSessionTurn({
|
|
11123
11222
|
store,
|
|
@@ -11147,7 +11246,7 @@ var Agent = class _Agent {
|
|
|
11147
11246
|
*/
|
|
11148
11247
|
static async transcript(agentId) {
|
|
11149
11248
|
const reg = await requireLocalAgent(agentId, "transcript");
|
|
11150
|
-
const { readSessionMessages } = await import('./agent-session-store-
|
|
11249
|
+
const { readSessionMessages } = await import('./agent-session-store-WP6NGDVX.cjs');
|
|
11151
11250
|
const { store } = await openLocalStore(reg);
|
|
11152
11251
|
return readSessionMessages(store, agentId);
|
|
11153
11252
|
}
|
|
@@ -11168,7 +11267,7 @@ var Agent = class _Agent {
|
|
|
11168
11267
|
*/
|
|
11169
11268
|
static async describe(agentId) {
|
|
11170
11269
|
const agent = await getRegisteredAgentOrThrow(agentId);
|
|
11171
|
-
const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-
|
|
11270
|
+
const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-TXOA5EJJ.cjs');
|
|
11172
11271
|
const settingSources = agent.options.local?.settingSources;
|
|
11173
11272
|
const subagents = await loadSubagents2(
|
|
11174
11273
|
agent.cwd ?? process.cwd(),
|
|
@@ -11231,12 +11330,12 @@ async function getOrCreateUncached(agentId, options) {
|
|
|
11231
11330
|
try {
|
|
11232
11331
|
return await Agent.resume(agentId, options);
|
|
11233
11332
|
} catch (err) {
|
|
11234
|
-
if (!(err instanceof
|
|
11333
|
+
if (!(err instanceof chunkCEGU5AVD_cjs.UnknownAgentError)) throw err;
|
|
11235
11334
|
}
|
|
11236
11335
|
try {
|
|
11237
11336
|
return await Agent.create({ ...options, agentId });
|
|
11238
11337
|
} catch (err) {
|
|
11239
|
-
if (err instanceof
|
|
11338
|
+
if (err instanceof chunkCEGU5AVD_cjs.ConfigurationError && err.code === "agent_id_already_exists") {
|
|
11240
11339
|
return await Agent.resume(agentId, options);
|
|
11241
11340
|
}
|
|
11242
11341
|
throw err;
|
|
@@ -11257,7 +11356,7 @@ async function requireLocalAgent(agentId, operation) {
|
|
|
11257
11356
|
reg = getRegisteredAgent(agentId);
|
|
11258
11357
|
}
|
|
11259
11358
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
11260
|
-
throw new
|
|
11359
|
+
throw new chunkCEGU5AVD_cjs.UnknownAgentError(
|
|
11261
11360
|
`No local agent "${agentId}" registered \u2014 ${operation} targets local sessions.`
|
|
11262
11361
|
);
|
|
11263
11362
|
}
|
|
@@ -11267,8 +11366,8 @@ async function openLocalStore(reg) {
|
|
|
11267
11366
|
const cwd = reg.cwd ?? process.cwd();
|
|
11268
11367
|
const optModel = reg.options.model;
|
|
11269
11368
|
const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
|
|
11270
|
-
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-
|
|
11271
|
-
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-
|
|
11369
|
+
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-S2AXVJIX.cjs');
|
|
11370
|
+
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-7TZ6HXSX.cjs');
|
|
11272
11371
|
const configuredSessionDir = reg.options.local?.sessionDir ?? reg.options.local?.baseDir;
|
|
11273
11372
|
const baseDir = configuredSessionDir !== void 0 ? expandTilde2(configuredSessionDir) : defaultBaseDir2();
|
|
11274
11373
|
return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
|
|
@@ -11288,5 +11387,5 @@ exports.managedSettingsPathFor = managedSettingsPathFor;
|
|
|
11288
11387
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
11289
11388
|
exports.readManagedSettings = readManagedSettings;
|
|
11290
11389
|
exports.resolveSessionDir = resolveSessionDir;
|
|
11291
|
-
//# sourceMappingURL=chunk-
|
|
11292
|
-
//# sourceMappingURL=chunk-
|
|
11390
|
+
//# sourceMappingURL=chunk-Q6WT5535.cjs.map
|
|
11391
|
+
//# sourceMappingURL=chunk-Q6WT5535.cjs.map
|