@theokit/sdk 4.51.0 → 4.52.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 +32 -0
- package/dist/agent-C66BEJGO.cjs +58 -0
- package/dist/{agent-B2WU3JP6.cjs.map → agent-C66BEJGO.cjs.map} +1 -1
- package/dist/agent-HYQGJTIN.js +49 -0
- package/dist/{agent-DI2QQHSJ.js.map → agent-HYQGJTIN.js.map} +1 -1
- package/dist/agent-session-store-EPX2WQI4.cjs +23 -0
- package/dist/{agent-session-store-EPUERCUU.cjs.map → agent-session-store-EPX2WQI4.cjs.map} +1 -1
- package/dist/agent-session-store-JMU7ASDB.js +6 -0
- package/dist/{agent-session-store-TXP5ZVOD.js.map → agent-session-store-JMU7ASDB.js.map} +1 -1
- package/dist/auth/index.cjs +21 -16
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +5 -4
- package/dist/auth/index.js.map +1 -1
- package/dist/{batch-OUF4N2TM.js → batch-NLIS4QTW.js} +9 -9
- package/dist/{batch-OUF4N2TM.js.map → batch-NLIS4QTW.js.map} +1 -1
- package/dist/{batch-URTEXK77.cjs → batch-WQ3AJCDV.cjs} +26 -26
- package/dist/{batch-URTEXK77.cjs.map → batch-WQ3AJCDV.cjs.map} +1 -1
- package/dist/{chunk-WUUSAMFC.cjs → chunk-2CD5XUAG.cjs} +24 -24
- package/dist/{chunk-WUUSAMFC.cjs.map → chunk-2CD5XUAG.cjs.map} +1 -1
- package/dist/{chunk-NETYW4V3.cjs → chunk-2CFEET3Y.cjs} +4 -4
- package/dist/{chunk-NETYW4V3.cjs.map → chunk-2CFEET3Y.cjs.map} +1 -1
- package/dist/{chunk-YULF6FPB.cjs → chunk-2YGIBOUH.cjs} +8 -8
- package/dist/{chunk-YULF6FPB.cjs.map → chunk-2YGIBOUH.cjs.map} +1 -1
- package/dist/{chunk-FZ4YMZA3.cjs → chunk-3R4ZCQAZ.cjs} +5 -5
- package/dist/{chunk-FZ4YMZA3.cjs.map → chunk-3R4ZCQAZ.cjs.map} +1 -1
- package/dist/{chunk-HECR7KF5.cjs → chunk-3YYDHUNH.cjs} +11 -11
- package/dist/{chunk-HECR7KF5.cjs.map → chunk-3YYDHUNH.cjs.map} +1 -1
- package/dist/{chunk-BRHRQOJA.cjs → chunk-44IISBRZ.cjs} +4 -4
- package/dist/{chunk-BRHRQOJA.cjs.map → chunk-44IISBRZ.cjs.map} +1 -1
- package/dist/{chunk-PBML2FHN.js → chunk-4X3SBHPK.js} +2 -2
- package/dist/chunk-4X3SBHPK.js.map +1 -0
- package/dist/{chunk-OLLOUAUJ.js → chunk-5XXUYU3M.js} +3 -3
- package/dist/{chunk-OLLOUAUJ.js.map → chunk-5XXUYU3M.js.map} +1 -1
- package/dist/{chunk-KCQUYQ3V.cjs → chunk-6DCTL32L.cjs} +17 -17
- package/dist/{chunk-KCQUYQ3V.cjs.map → chunk-6DCTL32L.cjs.map} +1 -1
- package/dist/{chunk-R2A3WIJY.js → chunk-6PTCKXD3.js} +8 -8
- package/dist/{chunk-R2A3WIJY.js.map → chunk-6PTCKXD3.js.map} +1 -1
- package/dist/{chunk-XR4LPBXH.cjs → chunk-7HQVDLFI.cjs} +9 -9
- package/dist/{chunk-XR4LPBXH.cjs.map → chunk-7HQVDLFI.cjs.map} +1 -1
- package/dist/{chunk-GNMPCZNN.js → chunk-7TB5U7RK.js} +6 -6
- package/dist/{chunk-GNMPCZNN.js.map → chunk-7TB5U7RK.js.map} +1 -1
- package/dist/{chunk-7PESI6YD.cjs → chunk-ADVZIC43.cjs} +10 -10
- package/dist/{chunk-7PESI6YD.cjs.map → chunk-ADVZIC43.cjs.map} +1 -1
- package/dist/{chunk-NNNUQELM.cjs → chunk-AMYY3JHQ.cjs} +9 -9
- package/dist/{chunk-NNNUQELM.cjs.map → chunk-AMYY3JHQ.cjs.map} +1 -1
- package/dist/{chunk-L4JFQCG4.js → chunk-BKRTYDVN.js} +3 -3
- package/dist/{chunk-L4JFQCG4.js.map → chunk-BKRTYDVN.js.map} +1 -1
- package/dist/{chunk-UJMEWGO6.cjs → chunk-BWGXYOBZ.cjs} +4 -4
- package/dist/{chunk-UJMEWGO6.cjs.map → chunk-BWGXYOBZ.cjs.map} +1 -1
- package/dist/{chunk-E7WDXT4X.js → chunk-BXVSBYGW.js} +5 -5
- package/dist/{chunk-E7WDXT4X.js.map → chunk-BXVSBYGW.js.map} +1 -1
- package/dist/{chunk-AF4BBKIF.js → chunk-C4EU627W.js} +4 -4
- package/dist/{chunk-AF4BBKIF.js.map → chunk-C4EU627W.js.map} +1 -1
- package/dist/{chunk-VQFSEKU5.js → chunk-CHVSMEKM.js} +3 -3
- package/dist/{chunk-VQFSEKU5.js.map → chunk-CHVSMEKM.js.map} +1 -1
- package/dist/{chunk-6X2HUT4A.cjs → chunk-CZHPR2G7.cjs} +8 -8
- package/dist/{chunk-6X2HUT4A.cjs.map → chunk-CZHPR2G7.cjs.map} +1 -1
- package/dist/{chunk-F4RUADRC.js → chunk-DHVNJYTO.js} +3 -3
- package/dist/{chunk-F4RUADRC.js.map → chunk-DHVNJYTO.js.map} +1 -1
- package/dist/{chunk-SEZJGV7C.js → chunk-DU7PBCAM.js} +5 -5
- package/dist/{chunk-SEZJGV7C.js.map → chunk-DU7PBCAM.js.map} +1 -1
- package/dist/{chunk-S4Q5OMIK.cjs → chunk-E3OCRJU6.cjs} +11 -11
- package/dist/{chunk-S4Q5OMIK.cjs.map → chunk-E3OCRJU6.cjs.map} +1 -1
- package/dist/{chunk-3KY7MHR4.js → chunk-E6T264NS.js} +3 -3
- package/dist/{chunk-3KY7MHR4.js.map → chunk-E6T264NS.js.map} +1 -1
- package/dist/{chunk-WCXOKGOQ.cjs → chunk-ECPL5RV6.cjs} +8 -8
- package/dist/{chunk-WCXOKGOQ.cjs.map → chunk-ECPL5RV6.cjs.map} +1 -1
- package/dist/{chunk-LLE7HPRI.js → chunk-EFXJ5C7X.js} +5 -5
- package/dist/{chunk-LLE7HPRI.js.map → chunk-EFXJ5C7X.js.map} +1 -1
- package/dist/{chunk-RWMNTFHZ.cjs → chunk-EQMLJ52C.cjs} +26 -26
- package/dist/{chunk-RWMNTFHZ.cjs.map → chunk-EQMLJ52C.cjs.map} +1 -1
- package/dist/{chunk-WIGJGFH4.cjs → chunk-EUBGGYPH.cjs} +5 -5
- package/dist/{chunk-WIGJGFH4.cjs.map → chunk-EUBGGYPH.cjs.map} +1 -1
- package/dist/{chunk-RBQYHEZD.cjs → chunk-FBZMSLDC.cjs} +4 -4
- package/dist/{chunk-RBQYHEZD.cjs.map → chunk-FBZMSLDC.cjs.map} +1 -1
- package/dist/{chunk-3G6ZDZ6L.cjs → chunk-FUASIT3E.cjs} +15 -15
- package/dist/{chunk-3G6ZDZ6L.cjs.map → chunk-FUASIT3E.cjs.map} +1 -1
- package/dist/{chunk-MRKSSN36.js → chunk-HI4ZW62S.js} +3 -3
- package/dist/{chunk-MRKSSN36.js.map → chunk-HI4ZW62S.js.map} +1 -1
- package/dist/{chunk-O3IZ7JEL.js → chunk-I732VEDW.js} +3 -3
- package/dist/{chunk-O3IZ7JEL.js.map → chunk-I732VEDW.js.map} +1 -1
- package/dist/{chunk-AZ6FKDQR.js → chunk-ITQ4NO4P.js} +3 -3
- package/dist/{chunk-AZ6FKDQR.js.map → chunk-ITQ4NO4P.js.map} +1 -1
- package/dist/{chunk-PYM5OUL4.js → chunk-J4RY5DTI.js} +5 -5
- package/dist/{chunk-PYM5OUL4.js.map → chunk-J4RY5DTI.js.map} +1 -1
- package/dist/{chunk-NOM2YWFP.js → chunk-JJZ4NIAG.js} +5 -5
- package/dist/{chunk-NOM2YWFP.js.map → chunk-JJZ4NIAG.js.map} +1 -1
- package/dist/{chunk-GC44RATP.cjs → chunk-K42QGAKM.cjs} +10 -10
- package/dist/{chunk-GC44RATP.cjs.map → chunk-K42QGAKM.cjs.map} +1 -1
- package/dist/{chunk-FRQ6F44U.js → chunk-KIX45IKP.js} +4 -4
- package/dist/{chunk-FRQ6F44U.js.map → chunk-KIX45IKP.js.map} +1 -1
- package/dist/{chunk-OEFFPR2S.cjs → chunk-KNZU4YO5.cjs} +4 -4
- package/dist/{chunk-OEFFPR2S.cjs.map → chunk-KNZU4YO5.cjs.map} +1 -1
- package/dist/{chunk-HK4HRLWE.js → chunk-KZBB4YKU.js} +3 -3
- package/dist/{chunk-HK4HRLWE.js.map → chunk-KZBB4YKU.js.map} +1 -1
- package/dist/{chunk-ZS6SLELQ.js → chunk-L7EGRCKJ.js} +4 -4
- package/dist/{chunk-ZS6SLELQ.js.map → chunk-L7EGRCKJ.js.map} +1 -1
- package/dist/{chunk-F7OBYH2X.cjs → chunk-LLK2RS6I.cjs} +294 -294
- package/dist/{chunk-F7OBYH2X.cjs.map → chunk-LLK2RS6I.cjs.map} +1 -1
- package/dist/{chunk-LXKNENHK.js → chunk-MV4TOCUK.js} +3 -3
- package/dist/{chunk-LXKNENHK.js.map → chunk-MV4TOCUK.js.map} +1 -1
- package/dist/{chunk-PAV4ZPSW.js → chunk-N43XLTHZ.js} +3 -3
- package/dist/{chunk-PAV4ZPSW.js.map → chunk-N43XLTHZ.js.map} +1 -1
- package/dist/{chunk-ZNW2TXLO.js → chunk-NACDF3PK.js} +3 -3
- package/dist/{chunk-ZNW2TXLO.js.map → chunk-NACDF3PK.js.map} +1 -1
- package/dist/{chunk-27DYRARU.cjs → chunk-NFATC6ZF.cjs} +4 -4
- package/dist/{chunk-27DYRARU.cjs.map → chunk-NFATC6ZF.cjs.map} +1 -1
- package/dist/{chunk-E54KDYOE.js → chunk-NOS7PTKP.js} +7 -7
- package/dist/{chunk-E54KDYOE.js.map → chunk-NOS7PTKP.js.map} +1 -1
- package/dist/{chunk-NRA36JKG.cjs → chunk-OI6RHLGC.cjs} +11 -11
- package/dist/{chunk-NRA36JKG.cjs.map → chunk-OI6RHLGC.cjs.map} +1 -1
- package/dist/{chunk-J5RW43IR.js → chunk-OIBHY6JQ.js} +4 -4
- package/dist/{chunk-J5RW43IR.js.map → chunk-OIBHY6JQ.js.map} +1 -1
- package/dist/{chunk-SNKY3C2L.js → chunk-OZXPA3ME.js} +4 -4
- package/dist/{chunk-SNKY3C2L.js.map → chunk-OZXPA3ME.js.map} +1 -1
- package/dist/{chunk-35NFZ7QB.js → chunk-PLUCC4N5.js} +3 -3
- package/dist/{chunk-35NFZ7QB.js.map → chunk-PLUCC4N5.js.map} +1 -1
- package/dist/{chunk-MMZX557L.cjs → chunk-PVBANCWU.cjs} +5 -5
- package/dist/{chunk-MMZX557L.cjs.map → chunk-PVBANCWU.cjs.map} +1 -1
- package/dist/{chunk-BV42CCRP.cjs → chunk-QLAWEGTZ.cjs} +7 -7
- package/dist/{chunk-BV42CCRP.cjs.map → chunk-QLAWEGTZ.cjs.map} +1 -1
- package/dist/{chunk-HKSSM5RK.js → chunk-R7TKOQMJ.js} +3 -3
- package/dist/{chunk-HKSSM5RK.js.map → chunk-R7TKOQMJ.js.map} +1 -1
- package/dist/{chunk-HLNLYLNN.cjs → chunk-RAACTJ7C.cjs} +4 -4
- package/dist/{chunk-HLNLYLNN.cjs.map → chunk-RAACTJ7C.cjs.map} +1 -1
- package/dist/{chunk-X2YQP452.cjs → chunk-RTLUZKDL.cjs} +11 -11
- package/dist/{chunk-X2YQP452.cjs.map → chunk-RTLUZKDL.cjs.map} +1 -1
- package/dist/{chunk-6W4U2G3J.cjs → chunk-SDJYLCJK.cjs} +5 -5
- package/dist/{chunk-6W4U2G3J.cjs.map → chunk-SDJYLCJK.cjs.map} +1 -1
- package/dist/{chunk-VK7SIDYI.js → chunk-SPZZSAHV.js} +5 -5
- package/dist/{chunk-VK7SIDYI.js.map → chunk-SPZZSAHV.js.map} +1 -1
- package/dist/{chunk-ZHPET3LZ.cjs → chunk-SXSPMRSV.cjs} +2 -2
- package/dist/chunk-SXSPMRSV.cjs.map +1 -0
- package/dist/{chunk-JA4FEA5Z.cjs → chunk-T6QUCG7L.cjs} +4 -4
- package/dist/{chunk-JA4FEA5Z.cjs.map → chunk-T6QUCG7L.cjs.map} +1 -1
- package/dist/{chunk-GLEKLAUW.cjs → chunk-T6ZCG5AP.cjs} +12 -12
- package/dist/{chunk-GLEKLAUW.cjs.map → chunk-T6ZCG5AP.cjs.map} +1 -1
- package/dist/chunk-U3PAW4PL.js +22 -0
- package/dist/chunk-U3PAW4PL.js.map +1 -0
- package/dist/{chunk-ZTEAJAE6.js → chunk-UJ3SXRZZ.js} +3 -3
- package/dist/{chunk-ZTEAJAE6.js.map → chunk-UJ3SXRZZ.js.map} +1 -1
- package/dist/{chunk-Z6N6SDNR.js → chunk-V2EJLKGA.js} +4 -4
- package/dist/{chunk-Z6N6SDNR.js.map → chunk-V2EJLKGA.js.map} +1 -1
- package/dist/{chunk-57KX5WTP.cjs → chunk-V45L2OYP.cjs} +9 -9
- package/dist/{chunk-57KX5WTP.cjs.map → chunk-V45L2OYP.cjs.map} +1 -1
- package/dist/{chunk-2WB6EIYW.js → chunk-W4FV7JBH.js} +4 -4
- package/dist/{chunk-2WB6EIYW.js.map → chunk-W4FV7JBH.js.map} +1 -1
- package/dist/chunk-WVDH34LK.cjs +24 -0
- package/dist/chunk-WVDH34LK.cjs.map +1 -0
- package/dist/{chunk-TJRPNBY5.js → chunk-XGYI2KQH.js} +4 -4
- package/dist/{chunk-TJRPNBY5.js.map → chunk-XGYI2KQH.js.map} +1 -1
- package/dist/{chunk-4JRRFRV4.cjs → chunk-XK54DTRF.cjs} +4 -4
- package/dist/{chunk-4JRRFRV4.cjs.map → chunk-XK54DTRF.cjs.map} +1 -1
- package/dist/{chunk-JGYYNDAZ.js → chunk-XWCTBGYK.js} +3 -3
- package/dist/{chunk-JGYYNDAZ.js.map → chunk-XWCTBGYK.js.map} +1 -1
- package/dist/{chunk-UQHIEUDY.cjs → chunk-YARJG3GV.cjs} +8 -8
- package/dist/{chunk-UQHIEUDY.cjs.map → chunk-YARJG3GV.cjs.map} +1 -1
- package/dist/{chunk-TDDRPFO3.js → chunk-YBB66SZZ.js} +13 -21
- package/dist/chunk-YBB66SZZ.js.map +1 -0
- package/dist/{chunk-XABN5HY6.cjs → chunk-YTO5BRBD.cjs} +8 -8
- package/dist/{chunk-XABN5HY6.cjs.map → chunk-YTO5BRBD.cjs.map} +1 -1
- package/dist/{chunk-72HEBGWN.cjs → chunk-Z5U2JGEK.cjs} +11 -11
- package/dist/{chunk-72HEBGWN.cjs.map → chunk-Z5U2JGEK.cjs.map} +1 -1
- package/dist/{chunk-ACHVCIDQ.js → chunk-ZFARZBOX.js} +35 -35
- package/dist/{chunk-ACHVCIDQ.js.map → chunk-ZFARZBOX.js.map} +1 -1
- package/dist/{chunk-QFFNMJAS.cjs → chunk-ZNEYQ56O.cjs} +124 -132
- package/dist/chunk-ZNEYQ56O.cjs.map +1 -0
- package/dist/{chunk-Q4DTGCSD.js → chunk-ZSJPRPN7.js} +3 -3
- package/dist/{chunk-Q4DTGCSD.js.map → chunk-ZSJPRPN7.js.map} +1 -1
- package/dist/compact-session-AXKDB6FC.cjs +57 -0
- package/dist/{compact-session-FKYCJRAK.cjs.map → compact-session-AXKDB6FC.cjs.map} +1 -1
- package/dist/compact-session-DUAUEFRR.js +20 -0
- package/dist/{compact-session-LF4YOT5S.js.map → compact-session-DUAUEFRR.js.map} +1 -1
- package/dist/compaction.cjs +16 -16
- package/dist/compaction.js +3 -3
- package/dist/concurrency.cjs +6 -6
- package/dist/concurrency.js +4 -4
- package/dist/context-4HGPCOH6.cjs +22 -0
- package/dist/{context-2G4375BZ.cjs.map → context-4HGPCOH6.cjs.map} +1 -1
- package/dist/context-DCECDKWN.js +5 -0
- package/dist/{context-GSQYVVMJ.js.map → context-DCECDKWN.js.map} +1 -1
- package/dist/cron.cjs +32 -31
- package/dist/cron.js +31 -30
- package/dist/errors.cjs +21 -21
- package/dist/errors.js +2 -2
- package/dist/eval.cjs +37 -36
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +31 -30
- package/dist/eval.js.map +1 -1
- package/dist/{executor-VQLTQY53.js → executor-3CGPLVJL.js} +7 -7
- package/dist/{executor-VQLTQY53.js.map → executor-3CGPLVJL.js.map} +1 -1
- package/dist/{executor-CB75B5BH.cjs → executor-4SW7QGZ4.cjs} +24 -24
- package/dist/{executor-CB75B5BH.cjs.map → executor-4SW7QGZ4.cjs.map} +1 -1
- package/dist/filesystem/index.cjs +7 -7
- package/dist/filesystem/index.js +3 -3
- package/dist/fs-session-store-2TF3ZWMT.js +10 -0
- package/dist/{fs-session-store-ZNUYZHYI.js.map → fs-session-store-2TF3ZWMT.js.map} +1 -1
- package/dist/fs-session-store-TL4RJTXZ.cjs +19 -0
- package/dist/{fs-session-store-MAZV5FXJ.cjs.map → fs-session-store-TL4RJTXZ.cjs.map} +1 -1
- package/dist/generate-object-E465DX5I.cjs +20 -0
- package/dist/{generate-object-6PWGH5DZ.cjs.map → generate-object-E465DX5I.cjs.map} +1 -1
- package/dist/generate-object-TVQCW2IZ.js +7 -0
- package/dist/{generate-object-IXMJ7FUX.js.map → generate-object-TVQCW2IZ.js.map} +1 -1
- package/dist/index-manager-EA6FGIQG.js +12 -0
- package/dist/{index-manager-OMJVYS2U.js.map → index-manager-EA6FGIQG.js.map} +1 -1
- package/dist/index-manager-HGGL4DD5.cjs +21 -0
- package/dist/{index-manager-34ELCOAP.cjs.map → index-manager-HGGL4DD5.cjs.map} +1 -1
- package/dist/index.cjs +134 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -43
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-MWRJENH4.js → inject-session-RBGOGACE.js} +7 -7
- package/dist/{inject-session-MWRJENH4.js.map → inject-session-RBGOGACE.js.map} +1 -1
- package/dist/{inject-session-J7Y6XACY.cjs → inject-session-TASLP5FA.cjs} +9 -9
- package/dist/{inject-session-J7Y6XACY.cjs.map → inject-session-TASLP5FA.cjs.map} +1 -1
- package/dist/internal/auth/api-key-prefix.d.ts +17 -0
- package/dist/internal/memory/adapters/index.cjs +8 -8
- package/dist/internal/memory/adapters/index.js +7 -7
- package/dist/internal/persistence/index.cjs +25 -25
- package/dist/internal/persistence/index.js +6 -6
- package/dist/internal/security/index.cjs +13 -13
- package/dist/internal/security/index.js +3 -3
- package/dist/judge-call-GVIJWQVE.cjs +22 -0
- package/dist/{judge-call-J5EETJL3.cjs.map → judge-call-GVIJWQVE.cjs.map} +1 -1
- package/dist/judge-call-QMKGC2ZK.js +5 -0
- package/dist/{judge-call-3QZO5H5N.js.map → judge-call-QMKGC2ZK.js.map} +1 -1
- package/dist/models.cjs +20 -20
- package/dist/models.js +5 -5
- package/dist/path-safety.cjs +10 -10
- package/dist/path-safety.js +3 -3
- package/dist/persistence.cjs +28 -28
- package/dist/persistence.js +8 -8
- package/dist/project.cjs +5 -5
- package/dist/project.js +3 -3
- package/dist/registry-GC7BQMSV.js +9 -0
- package/dist/{registry-PPFMCM4A.js.map → registry-GC7BQMSV.js.map} +1 -1
- package/dist/registry-UBY26R4I.cjs +46 -0
- package/dist/{registry-KB3TS6BM.cjs.map → registry-UBY26R4I.cjs.map} +1 -1
- package/dist/retry.cjs +4 -4
- package/dist/retry.js +3 -3
- package/dist/sandbox/index.cjs +6 -6
- package/dist/sandbox/index.js +2 -2
- package/dist/server/errors-envelope.cjs +14 -14
- package/dist/server/errors-envelope.js +3 -3
- package/dist/session-transcript-SKIRBEJE.js +5 -0
- package/dist/{session-transcript-7FWTO4BK.js.map → session-transcript-SKIRBEJE.js.map} +1 -1
- package/dist/session-transcript-TNAJ4O3M.cjs +50 -0
- package/dist/{session-transcript-FYRKWRWV.cjs.map → session-transcript-TNAJ4O3M.cjs.map} +1 -1
- package/dist/skills.cjs +7 -7
- package/dist/skills.js +5 -5
- package/dist/stream-object-QMNR3YFF.js +7 -0
- package/dist/{stream-object-NPJXDZXO.js.map → stream-object-QMNR3YFF.js.map} +1 -1
- package/dist/stream-object-T4DAMNVB.cjs +20 -0
- package/dist/{stream-object-3R3HZPQN.cjs.map → stream-object-T4DAMNVB.cjs.map} +1 -1
- package/dist/subagents-loader-3CXBQWWY.cjs +15 -0
- package/dist/{subagents-loader-FDXPBBRA.cjs.map → subagents-loader-3CXBQWWY.cjs.map} +1 -1
- package/dist/subagents-loader-WN2SB6PV.js +6 -0
- package/dist/{subagents-loader-5KQVYUNS.js.map → subagents-loader-WN2SB6PV.js.map} +1 -1
- package/dist/subagents-loader.cjs +6 -6
- package/dist/subagents-loader.js +4 -4
- 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/workflow.cjs +27 -27
- package/dist/workflow.js +6 -6
- package/package.json +1 -1
- package/dist/agent-B2WU3JP6.cjs +0 -57
- package/dist/agent-DI2QQHSJ.js +0 -48
- package/dist/agent-session-store-EPUERCUU.cjs +0 -23
- package/dist/agent-session-store-TXP5ZVOD.js +0 -6
- package/dist/chunk-PBML2FHN.js.map +0 -1
- package/dist/chunk-QFFNMJAS.cjs.map +0 -1
- package/dist/chunk-TDDRPFO3.js.map +0 -1
- package/dist/chunk-ZHPET3LZ.cjs.map +0 -1
- package/dist/compact-session-FKYCJRAK.cjs +0 -56
- package/dist/compact-session-LF4YOT5S.js +0 -19
- package/dist/context-2G4375BZ.cjs +0 -22
- package/dist/context-GSQYVVMJ.js +0 -5
- package/dist/fs-session-store-MAZV5FXJ.cjs +0 -19
- package/dist/fs-session-store-ZNUYZHYI.js +0 -10
- package/dist/generate-object-6PWGH5DZ.cjs +0 -20
- package/dist/generate-object-IXMJ7FUX.js +0 -7
- package/dist/index-manager-34ELCOAP.cjs +0 -21
- package/dist/index-manager-OMJVYS2U.js +0 -12
- package/dist/judge-call-3QZO5H5N.js +0 -5
- package/dist/judge-call-J5EETJL3.cjs +0 -22
- package/dist/registry-KB3TS6BM.cjs +0 -46
- package/dist/registry-PPFMCM4A.js +0 -9
- package/dist/session-transcript-7FWTO4BK.js +0 -5
- package/dist/session-transcript-FYRKWRWV.cjs +0 -50
- package/dist/stream-object-3R3HZPQN.cjs +0 -20
- package/dist/stream-object-NPJXDZXO.js +0 -7
- package/dist/subagents-loader-5KQVYUNS.js +0 -6
- package/dist/subagents-loader-FDXPBBRA.cjs +0 -15
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkYARJG3GV_cjs = require('./chunk-YARJG3GV.cjs');
|
|
4
4
|
var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
5
|
+
var chunk6DCTL32L_cjs = require('./chunk-6DCTL32L.cjs');
|
|
6
|
+
var chunkOI6RHLGC_cjs = require('./chunk-OI6RHLGC.cjs');
|
|
7
|
+
var chunkZNEYQ56O_cjs = require('./chunk-ZNEYQ56O.cjs');
|
|
8
|
+
var chunkEQMLJ52C_cjs = require('./chunk-EQMLJ52C.cjs');
|
|
9
|
+
var chunk3YYDHUNH_cjs = require('./chunk-3YYDHUNH.cjs');
|
|
10
10
|
var chunkBBZYXVLZ_cjs = require('./chunk-BBZYXVLZ.cjs');
|
|
11
11
|
var chunkOKLYRPKL_cjs = require('./chunk-OKLYRPKL.cjs');
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var chunkCZHPR2G7_cjs = require('./chunk-CZHPR2G7.cjs');
|
|
13
|
+
var chunkADVZIC43_cjs = require('./chunk-ADVZIC43.cjs');
|
|
14
14
|
var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
|
|
15
15
|
var chunkB4YA6BRS_cjs = require('./chunk-B4YA6BRS.cjs');
|
|
16
16
|
var chunkNINIJCHU_cjs = require('./chunk-NINIJCHU.cjs');
|
|
17
17
|
var chunkVJ26EKGJ_cjs = require('./chunk-VJ26EKGJ.cjs');
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
18
|
+
var chunkKNZU4YO5_cjs = require('./chunk-KNZU4YO5.cjs');
|
|
19
|
+
var chunkECPL5RV6_cjs = require('./chunk-ECPL5RV6.cjs');
|
|
20
|
+
var chunkSDJYLCJK_cjs = require('./chunk-SDJYLCJK.cjs');
|
|
21
21
|
var chunkYLQQX5W2_cjs = require('./chunk-YLQQX5W2.cjs');
|
|
22
22
|
var chunkWJVHMTKB_cjs = require('./chunk-WJVHMTKB.cjs');
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
23
|
+
var chunk2CFEET3Y_cjs = require('./chunk-2CFEET3Y.cjs');
|
|
24
|
+
var chunkRTLUZKDL_cjs = require('./chunk-RTLUZKDL.cjs');
|
|
25
|
+
var chunkAMYY3JHQ_cjs = require('./chunk-AMYY3JHQ.cjs');
|
|
26
26
|
var chunkVYHJZVL5_cjs = require('./chunk-VYHJZVL5.cjs');
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
27
|
+
var chunkT6ZCG5AP_cjs = require('./chunk-T6ZCG5AP.cjs');
|
|
28
|
+
var chunkFUASIT3E_cjs = require('./chunk-FUASIT3E.cjs');
|
|
29
|
+
var chunkYTO5BRBD_cjs = require('./chunk-YTO5BRBD.cjs');
|
|
30
30
|
var chunkVKJ7V7EB_cjs = require('./chunk-VKJ7V7EB.cjs');
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
31
|
+
var chunk44IISBRZ_cjs = require('./chunk-44IISBRZ.cjs');
|
|
32
|
+
var chunk2YGIBOUH_cjs = require('./chunk-2YGIBOUH.cjs');
|
|
33
|
+
var chunkSXSPMRSV_cjs = require('./chunk-SXSPMRSV.cjs');
|
|
34
34
|
var promises = require('fs/promises');
|
|
35
35
|
var crypto = require('crypto');
|
|
36
36
|
var path = require('path');
|
|
@@ -226,7 +226,7 @@ async function agentGenerate(agent, agentModel, agentApiKey, agentLocal, input,
|
|
|
226
226
|
const { output, maxRetries, errorStrategy, ...sendOptions } = options;
|
|
227
227
|
const run = await agent.send(input, sendOptions);
|
|
228
228
|
const result = await run.wait();
|
|
229
|
-
const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-
|
|
229
|
+
const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-E465DX5I.cjs');
|
|
230
230
|
const answer = structurableAnswerOrThrow(result, GenerateObjectError);
|
|
231
231
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
232
232
|
const facade = getAgentFacade();
|
|
@@ -328,7 +328,7 @@ function normalizeModel(m) {
|
|
|
328
328
|
if (m === void 0 || typeof m !== "string") return m;
|
|
329
329
|
const id = m.trim();
|
|
330
330
|
if (id.length === 0) {
|
|
331
|
-
throw new
|
|
331
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
332
332
|
'model must be a non-empty "provider/model" id string or a ModelSelection object',
|
|
333
333
|
{ code: "invalid_model_selection" }
|
|
334
334
|
);
|
|
@@ -464,7 +464,7 @@ function registryPath(cwd) {
|
|
|
464
464
|
return path.join(cwd, REGISTRY_RELATIVE_PATH);
|
|
465
465
|
}
|
|
466
466
|
async function loadRegistry(cwd) {
|
|
467
|
-
return
|
|
467
|
+
return chunkCZHPR2G7_cjs.readVersionedJson({
|
|
468
468
|
path: registryPath(cwd),
|
|
469
469
|
currentVersion: SCHEMA_VERSION,
|
|
470
470
|
defaultValue: () => ({}),
|
|
@@ -488,7 +488,7 @@ async function saveRegistry(cwd, agents2) {
|
|
|
488
488
|
}
|
|
489
489
|
const path = registryPath(cwd);
|
|
490
490
|
await chunkYLQQX5W2_cjs.withCwdMutex(`registry:${cwd}`, async () => {
|
|
491
|
-
await
|
|
491
|
+
await chunkCZHPR2G7_cjs.writeVersionedJson(path, serialized, SCHEMA_VERSION);
|
|
492
492
|
});
|
|
493
493
|
}
|
|
494
494
|
function toSerialized(agent) {
|
|
@@ -555,7 +555,7 @@ function scheduleSaveForCwd(cwd) {
|
|
|
555
555
|
}
|
|
556
556
|
} catch (cause) {
|
|
557
557
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
558
|
-
|
|
558
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] registry persist failed (${cwd}): ${msg}
|
|
559
559
|
`);
|
|
560
560
|
} finally {
|
|
561
561
|
pendingSaves.delete(cwd);
|
|
@@ -894,14 +894,14 @@ async function readLegacyFacts(jsonPath) {
|
|
|
894
894
|
}
|
|
895
895
|
async function writeMigratedFacts(cwd, jsonPath, facts) {
|
|
896
896
|
try {
|
|
897
|
-
for (const fact of facts) await
|
|
897
|
+
for (const fact of facts) await chunkEQMLJ52C_cjs.appendFactToMarkdown(cwd, fact);
|
|
898
898
|
await promises.unlink(jsonPath).catch(() => void 0);
|
|
899
|
-
|
|
899
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
|
|
900
900
|
`);
|
|
901
901
|
return { migrated: true, factCount: facts.length };
|
|
902
902
|
} catch (cause) {
|
|
903
903
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
904
|
-
|
|
904
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] memory migration failed (readonly fs?): ${message}
|
|
905
905
|
`);
|
|
906
906
|
return { migrated: false, factCount: 0, reason: "readonly-fs" };
|
|
907
907
|
}
|
|
@@ -911,12 +911,12 @@ async function migrateLegacyJson(cwd, config) {
|
|
|
911
911
|
const key = `${cwd}::${config.namespace ?? "default"}::${config.scope ?? "agent"}::${config.userId ?? "default"}`;
|
|
912
912
|
if (migrationRun.has(key)) return { migrated: false, factCount: 0, reason: "already-migrated" };
|
|
913
913
|
migrationRun.add(key);
|
|
914
|
-
const jsonPath =
|
|
914
|
+
const jsonPath = chunkEQMLJ52C_cjs.legacyMemoryJsonPath(cwd, config);
|
|
915
915
|
if (!await fileExists(jsonPath)) {
|
|
916
916
|
return { migrated: false, factCount: 0, reason: "no-legacy-json" };
|
|
917
917
|
}
|
|
918
|
-
if (await fileExists(
|
|
919
|
-
|
|
918
|
+
if (await fileExists(chunkEQMLJ52C_cjs.memoryMdPath(cwd))) {
|
|
919
|
+
chunkSXSPMRSV_cjs.diag(
|
|
920
920
|
`[theokit-sdk] memory migration skipped: both MEMORY.md and legacy JSON exist at ${jsonPath}; leaving both intact
|
|
921
921
|
`
|
|
922
922
|
);
|
|
@@ -940,13 +940,13 @@ function extractMemoryFact(message) {
|
|
|
940
940
|
async function readMemoryFacts(cwd, config) {
|
|
941
941
|
if (!config.enabled) return [];
|
|
942
942
|
await migrateLegacyJson(cwd, config);
|
|
943
|
-
return
|
|
943
|
+
return chunkEQMLJ52C_cjs.readFacts(cwd, config);
|
|
944
944
|
}
|
|
945
945
|
async function appendMemoryFact(cwd, config, fact) {
|
|
946
946
|
if (!config.enabled) return;
|
|
947
947
|
await migrateLegacyJson(cwd, config);
|
|
948
|
-
const sanitized = { text:
|
|
949
|
-
await
|
|
948
|
+
const sanitized = { text: chunkSXSPMRSV_cjs.redactSecrets(fact.text) };
|
|
949
|
+
await chunkEQMLJ52C_cjs.appendFact(cwd, config, sanitized);
|
|
950
950
|
}
|
|
951
951
|
|
|
952
952
|
// src/internal/runtime/fixtures/fixture-scripts.ts
|
|
@@ -1294,7 +1294,7 @@ function redactScriptSecrets(script) {
|
|
|
1294
1294
|
function redactEventSecrets(event) {
|
|
1295
1295
|
const serialized = JSON.stringify(event);
|
|
1296
1296
|
const localStripped = serialized.replace(FIXTURE_SENTINEL, "***");
|
|
1297
|
-
const redacted =
|
|
1297
|
+
const redacted = chunkSXSPMRSV_cjs.redactSecrets(localStripped);
|
|
1298
1298
|
if (redacted === serialized) return event;
|
|
1299
1299
|
return JSON.parse(redacted);
|
|
1300
1300
|
}
|
|
@@ -1617,7 +1617,7 @@ function createRealCloudRun(options) {
|
|
|
1617
1617
|
conversation: []
|
|
1618
1618
|
};
|
|
1619
1619
|
const apiKey = resolveApiKey(options.agentOptions.apiKey);
|
|
1620
|
-
const baseUrl =
|
|
1620
|
+
const baseUrl = chunkZNEYQ56O_cjs.getConfiguredBaseUrl();
|
|
1621
1621
|
const handle = new RealCloudRun(
|
|
1622
1622
|
{
|
|
1623
1623
|
id,
|
|
@@ -1690,7 +1690,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1690
1690
|
});
|
|
1691
1691
|
if (!response.ok) {
|
|
1692
1692
|
const text = await response.text().catch(() => "");
|
|
1693
|
-
throw new
|
|
1693
|
+
throw new chunk2YGIBOUH_cjs.NetworkError(
|
|
1694
1694
|
`Cloud Run endpoint returned ${response.status}: ${text.slice(0, 200)}`,
|
|
1695
1695
|
{ code: "cloud_run_http_error" }
|
|
1696
1696
|
);
|
|
@@ -1700,7 +1700,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1700
1700
|
async consumeStream(response) {
|
|
1701
1701
|
let finalStatus = "finished";
|
|
1702
1702
|
let finalText = "";
|
|
1703
|
-
for await (const record of
|
|
1703
|
+
for await (const record of chunkZNEYQ56O_cjs.parseSseStream(response.body, this.controller.signal)) {
|
|
1704
1704
|
const parsed = safeParse(record.data);
|
|
1705
1705
|
if (parsed === void 0) continue;
|
|
1706
1706
|
const update = this.applyRecord(record.event, parsed);
|
|
@@ -1809,7 +1809,7 @@ var CloudAgent = class {
|
|
|
1809
1809
|
*/
|
|
1810
1810
|
isFixtureMode() {
|
|
1811
1811
|
const apiKey = resolveApiKey(this.options.apiKey);
|
|
1812
|
-
return
|
|
1812
|
+
return chunkZNEYQ56O_cjs.isFixtureApiKey(apiKey) && chunkZNEYQ56O_cjs.getConfiguredBaseUrl() === void 0;
|
|
1813
1813
|
}
|
|
1814
1814
|
// SE9 — integrated structured output; delegates to the shared helper.
|
|
1815
1815
|
generate(message, options) {
|
|
@@ -1824,7 +1824,7 @@ var CloudAgent = class {
|
|
|
1824
1824
|
}
|
|
1825
1825
|
async send(message, options = {}) {
|
|
1826
1826
|
if (options.tools !== void 0 && options.tools.length > 0) {
|
|
1827
|
-
throw new
|
|
1827
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
1828
1828
|
"Custom inline tools are local-only in SDK v1.0 \u2014 cloud agents cannot serialize handler functions",
|
|
1829
1829
|
{ code: "cloud_custom_tools_rejected" }
|
|
1830
1830
|
);
|
|
@@ -1860,7 +1860,7 @@ var CloudAgent = class {
|
|
|
1860
1860
|
const userText = typeof message === "string" ? message : message.text;
|
|
1861
1861
|
const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
|
|
1862
1862
|
const apiKey = resolveApiKey(this.options.apiKey);
|
|
1863
|
-
const useRealRuntime = apiKey !== void 0 && !
|
|
1863
|
+
const useRealRuntime = apiKey !== void 0 && !chunkZNEYQ56O_cjs.isFixtureApiKey(apiKey) && chunkZNEYQ56O_cjs.getConfiguredBaseUrl() !== void 0;
|
|
1864
1864
|
return useRealRuntime ? createRealCloudRun({
|
|
1865
1865
|
agentId: this.agentId,
|
|
1866
1866
|
model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
|
|
@@ -1909,7 +1909,7 @@ var CloudAgent = class {
|
|
|
1909
1909
|
listArtifacts() {
|
|
1910
1910
|
if (!this.isFixtureMode()) {
|
|
1911
1911
|
return Promise.reject(
|
|
1912
|
-
new
|
|
1912
|
+
new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
1913
1913
|
"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).",
|
|
1914
1914
|
{ code: "cloud_runtime_pre_release" }
|
|
1915
1915
|
)
|
|
@@ -1919,11 +1919,11 @@ var CloudAgent = class {
|
|
|
1919
1919
|
}
|
|
1920
1920
|
downloadArtifact(path) {
|
|
1921
1921
|
try {
|
|
1922
|
-
|
|
1922
|
+
chunkYTO5BRBD_cjs.validateArtifactPath(path);
|
|
1923
1923
|
} catch (cause) {
|
|
1924
|
-
if (cause instanceof
|
|
1924
|
+
if (cause instanceof chunkYTO5BRBD_cjs.PathTraversalError) {
|
|
1925
1925
|
return Promise.reject(
|
|
1926
|
-
new
|
|
1926
|
+
new chunk2YGIBOUH_cjs.ConfigurationError(`Artifact path must stay inside the workspace: ${path}`, {
|
|
1927
1927
|
code: "artifact_path_traversal",
|
|
1928
1928
|
cause
|
|
1929
1929
|
})
|
|
@@ -1933,7 +1933,7 @@ var CloudAgent = class {
|
|
|
1933
1933
|
}
|
|
1934
1934
|
if (!this.isFixtureMode()) {
|
|
1935
1935
|
return Promise.reject(
|
|
1936
|
-
new
|
|
1936
|
+
new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
1937
1937
|
"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).",
|
|
1938
1938
|
{ code: "cloud_runtime_pre_release" }
|
|
1939
1939
|
)
|
|
@@ -1942,7 +1942,7 @@ var CloudAgent = class {
|
|
|
1942
1942
|
const match = buildFixtureArtifacts().find((artifact) => artifact.path === path);
|
|
1943
1943
|
if (match === void 0) {
|
|
1944
1944
|
return Promise.reject(
|
|
1945
|
-
new
|
|
1945
|
+
new chunk2YGIBOUH_cjs.UnknownAgentError(`Artifact ${path} not found`, { code: "unknown_artifact" })
|
|
1946
1946
|
);
|
|
1947
1947
|
}
|
|
1948
1948
|
return Promise.resolve(Buffer.from(`fixture artifact content for ${path}
|
|
@@ -1956,7 +1956,7 @@ var CloudAgent = class {
|
|
|
1956
1956
|
* @public
|
|
1957
1957
|
*/
|
|
1958
1958
|
runUntil() {
|
|
1959
|
-
throw new
|
|
1959
|
+
throw new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
|
|
1960
1960
|
"Agent.runUntil() is not supported on cloud agents. Cloud runtime manages goal loops server-side. Use a local agent for autonomous Ralph loops.",
|
|
1961
1961
|
"runUntil"
|
|
1962
1962
|
);
|
|
@@ -1967,7 +1967,7 @@ var CloudAgent = class {
|
|
|
1967
1967
|
* @public
|
|
1968
1968
|
*/
|
|
1969
1969
|
fork() {
|
|
1970
|
-
throw new
|
|
1970
|
+
throw new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
|
|
1971
1971
|
"Agent.fork() is not supported on cloud agents. Fork inheritance requires local credential + system-prompt access. Use a local agent.",
|
|
1972
1972
|
"fork"
|
|
1973
1973
|
);
|
|
@@ -1979,7 +1979,7 @@ var CloudAgent = class {
|
|
|
1979
1979
|
* @public
|
|
1980
1980
|
*/
|
|
1981
1981
|
runToCompletion() {
|
|
1982
|
-
throw new
|
|
1982
|
+
throw new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
|
|
1983
1983
|
"Agent.runToCompletion() is not supported on cloud agents. Cloud runtime manages continuation server-side. Use a local agent.",
|
|
1984
1984
|
"runToCompletion"
|
|
1985
1985
|
);
|
|
@@ -1991,7 +1991,7 @@ var CloudAgent = class {
|
|
|
1991
1991
|
* @public
|
|
1992
1992
|
*/
|
|
1993
1993
|
streamToCompletion() {
|
|
1994
|
-
throw new
|
|
1994
|
+
throw new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
|
|
1995
1995
|
"Agent.streamToCompletion() is not supported on cloud agents. Cloud runtime manages continuation server-side. Use a local agent.",
|
|
1996
1996
|
"streamToCompletion"
|
|
1997
1997
|
);
|
|
@@ -2005,7 +2005,7 @@ var CloudAgent = class {
|
|
|
2005
2005
|
*/
|
|
2006
2006
|
usePersonality() {
|
|
2007
2007
|
return Promise.reject(
|
|
2008
|
-
new
|
|
2008
|
+
new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
|
|
2009
2009
|
"Agent.usePersonality() is not supported on cloud agents (pre-release). Use a local agent or wait for cloud GA.",
|
|
2010
2010
|
"usePersonality"
|
|
2011
2011
|
)
|
|
@@ -2033,7 +2033,7 @@ function validateCloudToolParity(options) {
|
|
|
2033
2033
|
function rejectProcessors(options) {
|
|
2034
2034
|
const hasProcessors = (options.inputProcessors?.length ?? 0) > 0 || (options.outputProcessors?.length ?? 0) > 0;
|
|
2035
2035
|
if (hasProcessors) {
|
|
2036
|
-
throw new
|
|
2036
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2037
2037
|
"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.",
|
|
2038
2038
|
{ code: "cloud_incompatible_function_resolver" }
|
|
2039
2039
|
);
|
|
@@ -2041,7 +2041,7 @@ function rejectProcessors(options) {
|
|
|
2041
2041
|
}
|
|
2042
2042
|
function rejectFunctionSystemPrompt(options) {
|
|
2043
2043
|
if (typeof options.systemPrompt === "function") {
|
|
2044
|
-
throw new
|
|
2044
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2045
2045
|
"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.",
|
|
2046
2046
|
{ code: "cloud_incompatible_function_resolver" }
|
|
2047
2047
|
);
|
|
@@ -2049,7 +2049,7 @@ function rejectFunctionSystemPrompt(options) {
|
|
|
2049
2049
|
}
|
|
2050
2050
|
function rejectFunctionSkills(options) {
|
|
2051
2051
|
if (typeof options.skills === "function") {
|
|
2052
|
-
throw new
|
|
2052
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2053
2053
|
"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.",
|
|
2054
2054
|
{ code: "cloud_incompatible_function_resolver" }
|
|
2055
2055
|
);
|
|
@@ -2061,7 +2061,7 @@ function rejectStdioMcpLocalPaths(options) {
|
|
|
2061
2061
|
if (!isStdioCommandConfig(config)) continue;
|
|
2062
2062
|
const command = config.command ?? "";
|
|
2063
2063
|
if (isLocalPath(command)) {
|
|
2064
|
-
throw new
|
|
2064
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2065
2065
|
`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.`,
|
|
2066
2066
|
{ code: "cloud_incompatible_mcp_stdio_local" }
|
|
2067
2067
|
);
|
|
@@ -2101,14 +2101,14 @@ async function readState(filePath) {
|
|
|
2101
2101
|
try {
|
|
2102
2102
|
parsed = JSON.parse(raw);
|
|
2103
2103
|
} catch {
|
|
2104
|
-
|
|
2104
|
+
chunk3YYDHUNH_cjs.warnOnce(
|
|
2105
2105
|
"personality-store-json-parse",
|
|
2106
2106
|
"[theokit-sdk] personality.json is malformed; treating as empty"
|
|
2107
2107
|
);
|
|
2108
2108
|
return emptyState();
|
|
2109
2109
|
}
|
|
2110
2110
|
if (!isStateV1(parsed)) {
|
|
2111
|
-
|
|
2111
|
+
chunk3YYDHUNH_cjs.warnOnce(
|
|
2112
2112
|
"personality-store-bad-version",
|
|
2113
2113
|
`[theokit-sdk] personality.json has unknown version; treating as empty (file kept untouched)`
|
|
2114
2114
|
);
|
|
@@ -2139,9 +2139,9 @@ var PersonalityStore = class {
|
|
|
2139
2139
|
try {
|
|
2140
2140
|
await this.#persist(agentId, slug);
|
|
2141
2141
|
} catch (err) {
|
|
2142
|
-
|
|
2142
|
+
chunk3YYDHUNH_cjs.warnOnce(
|
|
2143
2143
|
`personality-store-persist-failure-${agentId}`,
|
|
2144
|
-
`[theokit-sdk] personality persist failed for ${
|
|
2144
|
+
`[theokit-sdk] personality persist failed for ${chunkSXSPMRSV_cjs.redactSecrets(agentId)}: ${chunkSXSPMRSV_cjs.redactSecrets(
|
|
2145
2145
|
err.message
|
|
2146
2146
|
)}`
|
|
2147
2147
|
);
|
|
@@ -2156,9 +2156,9 @@ var PersonalityStore = class {
|
|
|
2156
2156
|
try {
|
|
2157
2157
|
state = await readState(filePath);
|
|
2158
2158
|
} catch (err) {
|
|
2159
|
-
|
|
2159
|
+
chunk3YYDHUNH_cjs.warnOnce(
|
|
2160
2160
|
`personality-store-hydrate-failure-${agentId}`,
|
|
2161
|
-
`[theokit-sdk] personality hydrate failed for ${
|
|
2161
|
+
`[theokit-sdk] personality hydrate failed for ${chunkSXSPMRSV_cjs.redactSecrets(agentId)}: ${chunkSXSPMRSV_cjs.redactSecrets(
|
|
2162
2162
|
err.message
|
|
2163
2163
|
)}`
|
|
2164
2164
|
);
|
|
@@ -2175,17 +2175,17 @@ var PersonalityStore = class {
|
|
|
2175
2175
|
async #persist(agentId, slug) {
|
|
2176
2176
|
const filePath = this.#filePath();
|
|
2177
2177
|
await promises.mkdir(path.dirname(filePath), { recursive: true });
|
|
2178
|
-
await
|
|
2178
|
+
await chunkSDJYLCJK_cjs.withFileLock(filePath, async () => {
|
|
2179
2179
|
const current = await readState(filePath);
|
|
2180
2180
|
const nextAgents = { ...current.agents };
|
|
2181
2181
|
if (slug === void 0) delete nextAgents[agentId];
|
|
2182
2182
|
else nextAgents[agentId] = slug;
|
|
2183
2183
|
const next = { version: SCHEMA_VERSION2, agents: nextAgents };
|
|
2184
|
-
await
|
|
2184
|
+
await chunk2CFEET3Y_cjs.atomicWriteJson(filePath, next);
|
|
2185
2185
|
});
|
|
2186
2186
|
}
|
|
2187
2187
|
#filePath() {
|
|
2188
|
-
return path.join(
|
|
2188
|
+
return path.join(chunkCZHPR2G7_cjs.getTheokitHome(this.#cwd), FILE_NAME);
|
|
2189
2189
|
}
|
|
2190
2190
|
};
|
|
2191
2191
|
|
|
@@ -2208,7 +2208,7 @@ function createPluginContext() {
|
|
|
2208
2208
|
},
|
|
2209
2209
|
on(hook, handler) {
|
|
2210
2210
|
if (typeof handler !== "function") {
|
|
2211
|
-
|
|
2211
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] ignoring non-function handler for hook "${hook}"
|
|
2212
2212
|
`);
|
|
2213
2213
|
return;
|
|
2214
2214
|
}
|
|
@@ -2261,7 +2261,7 @@ var PluginManager = class {
|
|
|
2261
2261
|
const seen = /* @__PURE__ */ new Set();
|
|
2262
2262
|
for (const plugin of plugins) {
|
|
2263
2263
|
if (seen.has(plugin.name)) {
|
|
2264
|
-
|
|
2264
|
+
chunkSXSPMRSV_cjs.diag(
|
|
2265
2265
|
`[theokit-sdk] duplicate plugin name "${plugin.name}" \u2014 both will register independently
|
|
2266
2266
|
`
|
|
2267
2267
|
);
|
|
@@ -2288,7 +2288,7 @@ var PluginManager = class {
|
|
|
2288
2288
|
*/
|
|
2289
2289
|
async register(plugin) {
|
|
2290
2290
|
if (plugin.kind !== "general") {
|
|
2291
|
-
throw new
|
|
2291
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
2292
2292
|
`late register supports general plugins only (got "${plugin.kind}" for "${plugin.name}")`,
|
|
2293
2293
|
{ code: "plugin_late_register_kind" }
|
|
2294
2294
|
);
|
|
@@ -2345,7 +2345,7 @@ var PluginManager = class {
|
|
|
2345
2345
|
parts.push(result.recalledContext);
|
|
2346
2346
|
}
|
|
2347
2347
|
} catch (err) {
|
|
2348
|
-
|
|
2348
|
+
chunkSXSPMRSV_cjs.diag(
|
|
2349
2349
|
`[theokit-sdk] pre_user_send hook failed: ${err instanceof Error ? err.message : String(err)}
|
|
2350
2350
|
`
|
|
2351
2351
|
);
|
|
@@ -2373,7 +2373,7 @@ var PluginManager = class {
|
|
|
2373
2373
|
try {
|
|
2374
2374
|
await h(ctx);
|
|
2375
2375
|
} catch (err) {
|
|
2376
|
-
|
|
2376
|
+
chunkSXSPMRSV_cjs.diag(
|
|
2377
2377
|
`[theokit-sdk] post_assistant_reply hook failed: ${err instanceof Error ? err.message : String(err)}
|
|
2378
2378
|
`
|
|
2379
2379
|
);
|
|
@@ -2389,7 +2389,7 @@ var PluginManager = class {
|
|
|
2389
2389
|
try {
|
|
2390
2390
|
await h(ctx);
|
|
2391
2391
|
} catch (err) {
|
|
2392
|
-
|
|
2392
|
+
chunkSXSPMRSV_cjs.diag(
|
|
2393
2393
|
`[theokit-sdk] ${name} hook failed: ${err instanceof Error ? err.message : String(err)}
|
|
2394
2394
|
`
|
|
2395
2395
|
);
|
|
@@ -2404,7 +2404,7 @@ var PluginManager = class {
|
|
|
2404
2404
|
const out = await h(current, ctx);
|
|
2405
2405
|
if (out !== void 0) current = out;
|
|
2406
2406
|
} catch (err) {
|
|
2407
|
-
|
|
2407
|
+
chunkSXSPMRSV_cjs.diag(
|
|
2408
2408
|
`[theokit-sdk] ${name} hook failed: ${err instanceof Error ? err.message : String(err)}
|
|
2409
2409
|
`
|
|
2410
2410
|
);
|
|
@@ -2546,7 +2546,7 @@ var HooksExecutor = class {
|
|
|
2546
2546
|
this.config = {};
|
|
2547
2547
|
return;
|
|
2548
2548
|
}
|
|
2549
|
-
this.config = await
|
|
2549
|
+
this.config = await chunk3YYDHUNH_cjs.loadHookConfig(this.cwd);
|
|
2550
2550
|
}
|
|
2551
2551
|
/** Fire every hook registered for `event` and aggregate the decisions. */
|
|
2552
2552
|
async run(payload) {
|
|
@@ -2652,11 +2652,11 @@ function buildContextBudgetEvent(model, resolved) {
|
|
|
2652
2652
|
// src/internal/runtime/lifecycle/post-run-lifecycle.ts
|
|
2653
2653
|
function resolveWindowForRun(model, contextWindow) {
|
|
2654
2654
|
const override = contextWindow !== void 0 && contextWindow > 0 ? contextWindow : void 0;
|
|
2655
|
-
return
|
|
2655
|
+
return chunkAMYY3JHQ_cjs.resolveEffectiveContextWindow({
|
|
2656
2656
|
...override !== void 0 ? { override } : {},
|
|
2657
|
-
catalog:
|
|
2658
|
-
margin:
|
|
2659
|
-
floor:
|
|
2657
|
+
catalog: chunkT6ZCG5AP_cjs.getCatalogModelInfo(model)?.limit?.context,
|
|
2658
|
+
margin: chunkAMYY3JHQ_cjs.CONTEXT_WINDOW_MARGIN,
|
|
2659
|
+
floor: chunkAMYY3JHQ_cjs.CONTEXT_WINDOW_FLOOR
|
|
2660
2660
|
});
|
|
2661
2661
|
}
|
|
2662
2662
|
async function runPostRunLifecycle(inputs) {
|
|
@@ -2680,32 +2680,32 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2680
2680
|
try {
|
|
2681
2681
|
const partial = await safeConversation(run);
|
|
2682
2682
|
if (partial !== void 0) {
|
|
2683
|
-
|
|
2683
|
+
chunkYARJG3GV_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
|
|
2684
2684
|
userText,
|
|
2685
2685
|
conversation: partial
|
|
2686
2686
|
});
|
|
2687
2687
|
}
|
|
2688
2688
|
} catch (cause) {
|
|
2689
2689
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
2690
|
-
|
|
2690
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
|
|
2691
2691
|
`);
|
|
2692
2692
|
}
|
|
2693
|
-
await
|
|
2693
|
+
await chunkYARJG3GV_cjs.flushSessionWrites();
|
|
2694
2694
|
return;
|
|
2695
2695
|
}
|
|
2696
2696
|
if (result.result !== void 0) {
|
|
2697
|
-
|
|
2697
|
+
chunkYARJG3GV_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
|
|
2698
2698
|
}
|
|
2699
2699
|
const conversation = await safeConversation(run);
|
|
2700
2700
|
const resolvedWindow = resolveWindowForRun(model, contextWindow);
|
|
2701
2701
|
const effectiveWindow = resolvedWindow.window;
|
|
2702
2702
|
const budgetEvent = buildContextBudgetEvent(model, resolvedWindow);
|
|
2703
2703
|
if (budgetEvent !== void 0 && onRunEvent !== void 0) {
|
|
2704
|
-
|
|
2704
|
+
chunk6DCTL32L_cjs.emitRunEvent(onRunEvent, budgetEvent);
|
|
2705
2705
|
}
|
|
2706
2706
|
const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
|
|
2707
2707
|
const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
|
|
2708
|
-
|
|
2708
|
+
chunkYARJG3GV_cjs.persistTurnToTranscript(
|
|
2709
2709
|
sessionStore,
|
|
2710
2710
|
{ cwd: workspaceCwd, agentId, model },
|
|
2711
2711
|
agentId,
|
|
@@ -2717,13 +2717,13 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2717
2717
|
// The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
|
|
2718
2718
|
// `contextWindow` here would budget against a number the clamp already rejected.
|
|
2719
2719
|
contextWindow: effectiveWindow,
|
|
2720
|
-
summarize:
|
|
2720
|
+
summarize: chunkZNEYQ56O_cjs.buildDefaultSummarizer({
|
|
2721
2721
|
agentModel: model,
|
|
2722
2722
|
...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
|
|
2723
2723
|
})
|
|
2724
2724
|
}
|
|
2725
2725
|
},
|
|
2726
|
-
onRunEvent !== void 0 ? () =>
|
|
2726
|
+
onRunEvent !== void 0 ? () => chunk6DCTL32L_cjs.emitRunEvent(onRunEvent, { type: "compact_boundary", trigger: "auto" }) : void 0
|
|
2727
2727
|
);
|
|
2728
2728
|
if (result.status === "finished" && result.result !== void 0) {
|
|
2729
2729
|
const summaryArgs = {
|
|
@@ -2739,14 +2739,14 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2739
2739
|
if (memoryProvider?.recordSessionSummary !== void 0) {
|
|
2740
2740
|
await memoryProvider.recordSessionSummary(summaryArgs);
|
|
2741
2741
|
} else {
|
|
2742
|
-
await
|
|
2742
|
+
await chunkEQMLJ52C_cjs.writeSessionSummary(summaryArgs);
|
|
2743
2743
|
}
|
|
2744
2744
|
if (!shouldUsePortMemoryPath()) {
|
|
2745
2745
|
void memoryGlue.syncIfReady();
|
|
2746
2746
|
}
|
|
2747
2747
|
} catch (cause) {
|
|
2748
2748
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
2749
|
-
|
|
2749
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] session summary write failed (${result.id}): ${message}
|
|
2750
2750
|
`);
|
|
2751
2751
|
}
|
|
2752
2752
|
}
|
|
@@ -2759,7 +2759,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2759
2759
|
agentId,
|
|
2760
2760
|
runId: result.id
|
|
2761
2761
|
});
|
|
2762
|
-
await
|
|
2762
|
+
await chunkYARJG3GV_cjs.flushSessionWrites();
|
|
2763
2763
|
}
|
|
2764
2764
|
async function safeConversation(run) {
|
|
2765
2765
|
try {
|
|
@@ -2834,7 +2834,7 @@ var warned = /* @__PURE__ */ new Set();
|
|
|
2834
2834
|
function warnDoubleReasoningOnce() {
|
|
2835
2835
|
if (warned.has("double-reasoning")) return;
|
|
2836
2836
|
warned.add("double-reasoning");
|
|
2837
|
-
|
|
2837
|
+
chunkSXSPMRSV_cjs.diag(
|
|
2838
2838
|
"[theokit-sdk] `reasoning: true` skipped \u2014 a native reasoning model is configured (model.params thinking/reasoning); native reasoning wins. Remove one to silence.\n"
|
|
2839
2839
|
);
|
|
2840
2840
|
}
|
|
@@ -2867,9 +2867,9 @@ var SkillsManager = class {
|
|
|
2867
2867
|
}
|
|
2868
2868
|
async refresh() {
|
|
2869
2869
|
const skillsRoot = this.skillsDir ?? path.join(this.cwd, ".theokit", "skills");
|
|
2870
|
-
const discovered = await
|
|
2870
|
+
const discovered = await chunkFUASIT3E_cjs.discoverSkills(skillsRoot, {
|
|
2871
2871
|
onInvalidSkill: (info) => {
|
|
2872
|
-
|
|
2872
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
|
|
2873
2873
|
`);
|
|
2874
2874
|
}
|
|
2875
2875
|
});
|
|
@@ -2893,7 +2893,7 @@ var SkillsManager = class {
|
|
|
2893
2893
|
async get(name) {
|
|
2894
2894
|
const skill = this.skills.find((s) => s.name === name);
|
|
2895
2895
|
if (skill === void 0) return void 0;
|
|
2896
|
-
const instructions = typeof skill.instructions === "string" ? skill.instructions :
|
|
2896
|
+
const instructions = typeof skill.instructions === "string" ? skill.instructions : chunkFUASIT3E_cjs.stripSkillFrontmatter(await promises.readFile(skill.source, "utf8"));
|
|
2897
2897
|
const references = skill.references;
|
|
2898
2898
|
return {
|
|
2899
2899
|
name: skill.name,
|
|
@@ -2979,7 +2979,7 @@ async function safeCall(fn, fallback, label = "safeCall") {
|
|
|
2979
2979
|
return await fn();
|
|
2980
2980
|
} catch (cause) {
|
|
2981
2981
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
2982
|
-
|
|
2982
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] ${label} failed: ${message}
|
|
2983
2983
|
`);
|
|
2984
2984
|
return fallback;
|
|
2985
2985
|
}
|
|
@@ -2993,7 +2993,7 @@ var ActiveMemoryPromptProvider = class {
|
|
|
2993
2993
|
if (ctx.activeMemorySummary === void 0 || ctx.activeMemorySummary.length === 0) {
|
|
2994
2994
|
return Promise.resolve(void 0);
|
|
2995
2995
|
}
|
|
2996
|
-
const body =
|
|
2996
|
+
const body = chunkFUASIT3E_cjs.escapeBlockBody(ctx.activeMemorySummary);
|
|
2997
2997
|
return Promise.resolve(`<active-memory>
|
|
2998
2998
|
${body}
|
|
2999
2999
|
</active-memory>`);
|
|
@@ -3046,7 +3046,7 @@ function formatSource(name, tokens) {
|
|
|
3046
3046
|
if (tokens.length === 0) {
|
|
3047
3047
|
return ` <source name="${escapeAttribute(name)}" />`;
|
|
3048
3048
|
}
|
|
3049
|
-
const body =
|
|
3049
|
+
const body = chunkFUASIT3E_cjs.escapeBlockBody(tokens.join(" "));
|
|
3050
3050
|
return ` <source name="${escapeAttribute(name)}">
|
|
3051
3051
|
${body}
|
|
3052
3052
|
</source>`;
|
|
@@ -3062,7 +3062,7 @@ var MemoryPromptProvider = class {
|
|
|
3062
3062
|
contribute(ctx) {
|
|
3063
3063
|
if (ctx.memoryAutoInject === false) return Promise.resolve(void 0);
|
|
3064
3064
|
if (ctx.memory.length === 0) return Promise.resolve(void 0);
|
|
3065
|
-
const lines = ctx.memory.map((fact) => ` - ${
|
|
3065
|
+
const lines = ctx.memory.map((fact) => ` - ${chunkFUASIT3E_cjs.escapeBlockBody(fact.text)}`);
|
|
3066
3066
|
return Promise.resolve(`<memory>
|
|
3067
3067
|
${lines.join("\n")}
|
|
3068
3068
|
</memory>`);
|
|
@@ -3084,7 +3084,7 @@ var SkillsPromptProvider = class {
|
|
|
3084
3084
|
priority = 20;
|
|
3085
3085
|
contribute(ctx) {
|
|
3086
3086
|
if (ctx.skillsAutoInject === false) return Promise.resolve(void 0);
|
|
3087
|
-
return Promise.resolve(
|
|
3087
|
+
return Promise.resolve(chunkFUASIT3E_cjs.buildSkillsBlock(ctx.skills));
|
|
3088
3088
|
}
|
|
3089
3089
|
};
|
|
3090
3090
|
|
|
@@ -3096,7 +3096,7 @@ var SystemPromptPipeline = class _SystemPromptPipeline {
|
|
|
3096
3096
|
for (const p of providers) {
|
|
3097
3097
|
const key = `${p.priority}:${p.id}`;
|
|
3098
3098
|
if (seen.has(key)) {
|
|
3099
|
-
throw new
|
|
3099
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Duplicate system-prompt provider ${key}`, {
|
|
3100
3100
|
code: "pipeline_duplicate_provider"
|
|
3101
3101
|
});
|
|
3102
3102
|
}
|
|
@@ -3143,7 +3143,7 @@ function validateAgentOptions(options) {
|
|
|
3143
3143
|
ensureRuntimeShape(options);
|
|
3144
3144
|
if (options.local !== void 0) {
|
|
3145
3145
|
if (options.model === void 0) {
|
|
3146
|
-
throw new
|
|
3146
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError("Local agents require a model selection", {
|
|
3147
3147
|
code: "missing_model"
|
|
3148
3148
|
});
|
|
3149
3149
|
}
|
|
@@ -3167,7 +3167,7 @@ function validateCredentialPoolShape(options) {
|
|
|
3167
3167
|
([, arr]) => Array.isArray(arr) && arr.some((k) => typeof k === "string" && k.length > 0)
|
|
3168
3168
|
);
|
|
3169
3169
|
if (populated.length === 0) return;
|
|
3170
|
-
throw new
|
|
3170
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3171
3171
|
"Ambiguous credential configuration: use either `apiKey: '...'` (single-key, simplest) OR `apiKeys: { provider: [...] }` (multi-key pool), not both.",
|
|
3172
3172
|
{ code: "credential_pool_ambiguous" }
|
|
3173
3173
|
);
|
|
@@ -3176,7 +3176,7 @@ function validatePlugins(options) {
|
|
|
3176
3176
|
const plugins = options.plugins;
|
|
3177
3177
|
if (plugins?.paths === void 0) return;
|
|
3178
3178
|
if (options.cloud !== void 0 && plugins.paths.length > 0) {
|
|
3179
|
-
throw new
|
|
3179
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3180
3180
|
"Cloud agents require committed plugin manifests; local plugin paths are not supported",
|
|
3181
3181
|
{ code: "cloud_plugin_path_rejected" }
|
|
3182
3182
|
);
|
|
@@ -3184,7 +3184,7 @@ function validatePlugins(options) {
|
|
|
3184
3184
|
}
|
|
3185
3185
|
function ensureRuntimeShape(options) {
|
|
3186
3186
|
if (options.local !== void 0 && options.cloud !== void 0) {
|
|
3187
|
-
throw new
|
|
3187
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3188
3188
|
"Pass either local or cloud \u2014 they are mutually exclusive runtimes",
|
|
3189
3189
|
{ code: "runtime_exclusive" }
|
|
3190
3190
|
);
|
|
@@ -3192,7 +3192,7 @@ function ensureRuntimeShape(options) {
|
|
|
3192
3192
|
}
|
|
3193
3193
|
function rejectProgrammaticHooks(options) {
|
|
3194
3194
|
if (options.hooks !== void 0) {
|
|
3195
|
-
throw new
|
|
3195
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3196
3196
|
"Programmatic hooks are not supported \u2014 hooks are file-based only (.theokit/hooks.json)",
|
|
3197
3197
|
{ code: "programmatic_hooks_rejected" }
|
|
3198
3198
|
);
|
|
@@ -3202,7 +3202,7 @@ function validateCloud(cloud) {
|
|
|
3202
3202
|
if (cloud.envVars !== void 0) {
|
|
3203
3203
|
for (const key of Object.keys(cloud.envVars)) {
|
|
3204
3204
|
if (key.startsWith("THEOKIT_")) {
|
|
3205
|
-
throw new
|
|
3205
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3206
3206
|
`Cloud envVars cannot use the reserved THEOKIT_ prefix (got "${key}")`,
|
|
3207
3207
|
{ code: "reserved_env_prefix" }
|
|
3208
3208
|
);
|
|
@@ -3214,7 +3214,7 @@ function validateMcpServers(options) {
|
|
|
3214
3214
|
if (options.mcpServers === void 0) return;
|
|
3215
3215
|
for (const [name, config] of Object.entries(options.mcpServers)) {
|
|
3216
3216
|
if (options.cloud !== void 0 && isStdioWithCwd(config)) {
|
|
3217
|
-
throw new
|
|
3217
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3218
3218
|
`MCP server "${name}" uses stdio with cwd, which is rejected for cloud agents`,
|
|
3219
3219
|
{ code: "cloud_stdio_cwd_rejected" }
|
|
3220
3220
|
);
|
|
@@ -3233,12 +3233,12 @@ function validateSubagents(agents2) {
|
|
|
3233
3233
|
if (agents2 === void 0) return;
|
|
3234
3234
|
for (const [name, definition] of Object.entries(agents2)) {
|
|
3235
3235
|
if (typeof definition.description !== "string" || definition.description.length === 0) {
|
|
3236
|
-
throw new
|
|
3236
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty description`, {
|
|
3237
3237
|
code: "subagent_missing_description"
|
|
3238
3238
|
});
|
|
3239
3239
|
}
|
|
3240
3240
|
if (typeof definition.prompt !== "string" || definition.prompt.length === 0) {
|
|
3241
|
-
throw new
|
|
3241
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty prompt`, {
|
|
3242
3242
|
code: "subagent_missing_prompt"
|
|
3243
3243
|
});
|
|
3244
3244
|
}
|
|
@@ -3251,7 +3251,7 @@ function validateToolCatalog(tools) {
|
|
|
3251
3251
|
for (const tool of tools) {
|
|
3252
3252
|
validateSingleTool(tool);
|
|
3253
3253
|
if (seen.has(tool.name)) {
|
|
3254
|
-
throw new
|
|
3254
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Duplicate custom tool name "${tool.name}"`, {
|
|
3255
3255
|
code: "duplicate_tool_name"
|
|
3256
3256
|
});
|
|
3257
3257
|
}
|
|
@@ -3262,7 +3262,7 @@ function validateCustomTools(options) {
|
|
|
3262
3262
|
const tools = options.tools;
|
|
3263
3263
|
if (tools === void 0 || tools.length === 0) return;
|
|
3264
3264
|
if (options.cloud !== void 0) {
|
|
3265
|
-
throw new
|
|
3265
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3266
3266
|
"Custom inline tools are local-only in SDK v1.0 \u2014 cloud agents cannot serialize handler functions",
|
|
3267
3267
|
{ code: "cloud_custom_tools_rejected" }
|
|
3268
3268
|
);
|
|
@@ -3274,25 +3274,25 @@ function validateSingleTool(tool) {
|
|
|
3274
3274
|
validateToolDescription(tool);
|
|
3275
3275
|
validateToolSchema(tool);
|
|
3276
3276
|
if (typeof tool.handler !== "function") {
|
|
3277
|
-
throw new
|
|
3277
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a handler function`, {
|
|
3278
3278
|
code: "tool_missing_handler"
|
|
3279
3279
|
});
|
|
3280
3280
|
}
|
|
3281
3281
|
}
|
|
3282
3282
|
function validateToolName(tool) {
|
|
3283
3283
|
if (typeof tool.name !== "string" || tool.name.length === 0) {
|
|
3284
|
-
throw new
|
|
3284
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError("Custom tool requires a non-empty name", {
|
|
3285
3285
|
code: "tool_missing_name"
|
|
3286
3286
|
});
|
|
3287
3287
|
}
|
|
3288
3288
|
if (!TOOL_NAME_PATTERN.test(tool.name)) {
|
|
3289
|
-
throw new
|
|
3289
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3290
3290
|
`Custom tool name "${tool.name}" must match /^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/`,
|
|
3291
3291
|
{ code: "tool_invalid_name" }
|
|
3292
3292
|
);
|
|
3293
3293
|
}
|
|
3294
3294
|
if (RESERVED_TOOL_NAMES.has(tool.name) || tool.name.startsWith("mcp_")) {
|
|
3295
|
-
throw new
|
|
3295
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3296
3296
|
`Custom tool name "${tool.name}" collides with a reserved SDK tool name`,
|
|
3297
3297
|
{ code: "tool_reserved_name" }
|
|
3298
3298
|
);
|
|
@@ -3300,7 +3300,7 @@ function validateToolName(tool) {
|
|
|
3300
3300
|
}
|
|
3301
3301
|
function validateToolDescription(tool) {
|
|
3302
3302
|
if (typeof tool.description !== "string" || tool.description.length === 0) {
|
|
3303
|
-
throw new
|
|
3303
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a non-empty description`, {
|
|
3304
3304
|
code: "tool_missing_description"
|
|
3305
3305
|
});
|
|
3306
3306
|
}
|
|
@@ -3308,12 +3308,12 @@ function validateToolDescription(tool) {
|
|
|
3308
3308
|
function validateToolSchema(tool) {
|
|
3309
3309
|
const schema = tool.inputSchema;
|
|
3310
3310
|
if (schema === null || schema === void 0 || typeof schema !== "object") {
|
|
3311
|
-
throw new
|
|
3311
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Custom tool "${tool.name}" requires an inputSchema object`, {
|
|
3312
3312
|
code: "tool_missing_schema"
|
|
3313
3313
|
});
|
|
3314
3314
|
}
|
|
3315
3315
|
if (schema.type !== "object") {
|
|
3316
|
-
throw new
|
|
3316
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3317
3317
|
`Custom tool "${tool.name}" inputSchema must declare \`type: "object"\``,
|
|
3318
3318
|
{ code: "tool_invalid_schema_type" }
|
|
3319
3319
|
);
|
|
@@ -3324,7 +3324,7 @@ function validateMemory(options) {
|
|
|
3324
3324
|
if (memory?.storePath === void 0) return;
|
|
3325
3325
|
const storePath = memory.storePath;
|
|
3326
3326
|
if (storePath.includes("..") || storePath.startsWith("/") || /^[A-Z]:/i.test(storePath)) {
|
|
3327
|
-
throw new
|
|
3327
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3328
3328
|
`Memory storePath must stay inside the workspace; got "${storePath}"`,
|
|
3329
3329
|
{ code: "memory_path_traversal" }
|
|
3330
3330
|
);
|
|
@@ -3346,7 +3346,7 @@ var HISTOGRAM_NAMES = {
|
|
|
3346
3346
|
};
|
|
3347
3347
|
function safeRequire(moduleName) {
|
|
3348
3348
|
try {
|
|
3349
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3349
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LLK2RS6I.cjs', document.baseURI).href)));
|
|
3350
3350
|
return r(moduleName);
|
|
3351
3351
|
} catch {
|
|
3352
3352
|
return void 0;
|
|
@@ -3425,7 +3425,7 @@ var langfuseAdapter = {
|
|
|
3425
3425
|
}
|
|
3426
3426
|
}
|
|
3427
3427
|
if (lf.LangfuseSpanProcessor === void 0) {
|
|
3428
|
-
|
|
3428
|
+
chunkSXSPMRSV_cjs.diag(
|
|
3429
3429
|
"[theokit-sdk] @langfuse/node detected but LangfuseSpanProcessor not found (v2?). Use Langfuse v3+ for auto-instrumentation.\n"
|
|
3430
3430
|
);
|
|
3431
3431
|
return;
|
|
@@ -3554,11 +3554,11 @@ function tryAutoRegisterAdapters(settings) {
|
|
|
3554
3554
|
try {
|
|
3555
3555
|
adapter.register();
|
|
3556
3556
|
registered.add(adapter.moduleName);
|
|
3557
|
-
|
|
3557
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] telemetry: ${adapter.displayName} auto-instrumented.
|
|
3558
3558
|
`);
|
|
3559
3559
|
} catch (cause) {
|
|
3560
3560
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
3561
|
-
|
|
3561
|
+
chunkSXSPMRSV_cjs.diag(
|
|
3562
3562
|
`[theokit-sdk] telemetry: ${adapter.displayName} detected but failed to register: ${message}
|
|
3563
3563
|
`
|
|
3564
3564
|
);
|
|
@@ -3571,7 +3571,7 @@ var cachedOtel;
|
|
|
3571
3571
|
function loadOtel() {
|
|
3572
3572
|
if (cachedOtel === void 0) {
|
|
3573
3573
|
try {
|
|
3574
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3574
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LLK2RS6I.cjs', document.baseURI).href)));
|
|
3575
3575
|
const mod = r("@opentelemetry/api");
|
|
3576
3576
|
cachedOtel = mod;
|
|
3577
3577
|
} catch {
|
|
@@ -3614,7 +3614,7 @@ function safe(op, fallback) {
|
|
|
3614
3614
|
if (!warnedOnce) {
|
|
3615
3615
|
warnedOnce = true;
|
|
3616
3616
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
3617
|
-
|
|
3617
|
+
chunkSXSPMRSV_cjs.diag(
|
|
3618
3618
|
`[theokit-sdk] telemetry exporter error (suppressed; agent.send continues): ${message}
|
|
3619
3619
|
`
|
|
3620
3620
|
);
|
|
@@ -3628,7 +3628,7 @@ function createTelemetry(settings) {
|
|
|
3628
3628
|
if (otel === null) {
|
|
3629
3629
|
if (!warnedOnce) {
|
|
3630
3630
|
warnedOnce = true;
|
|
3631
|
-
|
|
3631
|
+
chunkSXSPMRSV_cjs.diag(
|
|
3632
3632
|
"[theokit-sdk] telemetry.enabled = true but `@opentelemetry/api` is not installed; telemetry is a no-op.\n"
|
|
3633
3633
|
);
|
|
3634
3634
|
}
|
|
@@ -3722,12 +3722,12 @@ function wrapSpan(span, openSpans) {
|
|
|
3722
3722
|
}
|
|
3723
3723
|
function redactAttrValue(value) {
|
|
3724
3724
|
if (typeof value !== "string") return value;
|
|
3725
|
-
return
|
|
3725
|
+
return chunkSXSPMRSV_cjs.redactSecrets(value);
|
|
3726
3726
|
}
|
|
3727
3727
|
function redactAttrs(attrs) {
|
|
3728
3728
|
const out = {};
|
|
3729
3729
|
for (const [k, v] of Object.entries(attrs)) {
|
|
3730
|
-
out[k] = typeof v === "string" ?
|
|
3730
|
+
out[k] = typeof v === "string" ? chunkSXSPMRSV_cjs.redactSecrets(v) : v;
|
|
3731
3731
|
}
|
|
3732
3732
|
return out;
|
|
3733
3733
|
}
|
|
@@ -3809,10 +3809,10 @@ async function loadMarkdownEntities(opts) {
|
|
|
3809
3809
|
const raw = await promises.readFile(resolved.source, "utf8").catch(() => null);
|
|
3810
3810
|
if (raw === null) continue;
|
|
3811
3811
|
const split = splitFrontmatter(raw, resolved.source, errorCodePrefix);
|
|
3812
|
-
const fields =
|
|
3812
|
+
const fields = chunk44IISBRZ_cjs.parseSimpleYaml(split.frontmatter);
|
|
3813
3813
|
const parsed = schema.safeParse(fields);
|
|
3814
3814
|
if (!parsed.success) {
|
|
3815
|
-
throw new
|
|
3815
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3816
3816
|
`Invalid frontmatter in ${resolved.source}: ${parsed.error.message}`,
|
|
3817
3817
|
{ code: `${errorCodePrefix}_frontmatter_invalid` }
|
|
3818
3818
|
);
|
|
@@ -3830,13 +3830,13 @@ async function assertFileSizeUnderCap(source, errorCodePrefix) {
|
|
|
3830
3830
|
try {
|
|
3831
3831
|
const info = await promises.stat(source);
|
|
3832
3832
|
if (info.size > MAX_MD_FILE_BYTES) {
|
|
3833
|
-
throw new
|
|
3833
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3834
3834
|
`Config file ${source} exceeds 1 MB size limit (${info.size} bytes). Reduce the file or split into multiple entities.`,
|
|
3835
3835
|
{ code: `${errorCodePrefix}_file_too_large` }
|
|
3836
3836
|
);
|
|
3837
3837
|
}
|
|
3838
3838
|
} catch (cause) {
|
|
3839
|
-
if (cause instanceof
|
|
3839
|
+
if (cause instanceof chunk2YGIBOUH_cjs.ConfigurationError) throw cause;
|
|
3840
3840
|
}
|
|
3841
3841
|
}
|
|
3842
3842
|
async function readDirSafe(dir, errorCodePrefix) {
|
|
@@ -3845,7 +3845,7 @@ async function readDirSafe(dir, errorCodePrefix) {
|
|
|
3845
3845
|
} catch (cause) {
|
|
3846
3846
|
const code = cause.code;
|
|
3847
3847
|
if (code === "ENOENT") return null;
|
|
3848
|
-
throw new
|
|
3848
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Failed to read ${dir}`, {
|
|
3849
3849
|
code: `${errorCodePrefix}_dir_read_error`,
|
|
3850
3850
|
cause
|
|
3851
3851
|
});
|
|
@@ -3862,7 +3862,7 @@ function resolveEntryPath(entry, pattern, dir) {
|
|
|
3862
3862
|
function splitFrontmatter(raw, source, errorCodePrefix) {
|
|
3863
3863
|
const match = /^---\s*\n([\s\S]*?)\n---\s*(?:\n|$)/.exec(raw);
|
|
3864
3864
|
if (match === null) {
|
|
3865
|
-
throw new
|
|
3865
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
3866
3866
|
`Missing or malformed frontmatter in ${source} (expected \`---\` delimited block at file head)`,
|
|
3867
3867
|
{ code: `${errorCodePrefix}_missing_frontmatter` }
|
|
3868
3868
|
);
|
|
@@ -4036,7 +4036,7 @@ async function loadContextConfig(cwd) {
|
|
|
4036
4036
|
});
|
|
4037
4037
|
if (mdEntities.length > 0) {
|
|
4038
4038
|
if (fs.existsSync(jsonPath)) {
|
|
4039
|
-
|
|
4039
|
+
chunk3YYDHUNH_cjs.warnOnce(
|
|
4040
4040
|
"context-both-present",
|
|
4041
4041
|
"[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
|
|
4042
4042
|
);
|
|
@@ -4046,7 +4046,7 @@ async function loadContextConfig(cwd) {
|
|
|
4046
4046
|
};
|
|
4047
4047
|
}
|
|
4048
4048
|
if (!fs.existsSync(jsonPath)) return { sources: [] };
|
|
4049
|
-
|
|
4049
|
+
chunk3YYDHUNH_cjs.warnOnce(
|
|
4050
4050
|
"context-json-deprecated",
|
|
4051
4051
|
"[theokit-sdk] .theokit/context.json is deprecated; migrate to .theokit/context/<name>.md via theokit-migrate-config"
|
|
4052
4052
|
);
|
|
@@ -4054,7 +4054,7 @@ async function loadContextConfig(cwd) {
|
|
|
4054
4054
|
try {
|
|
4055
4055
|
raw = await promises.readFile(jsonPath, "utf8");
|
|
4056
4056
|
} catch (cause) {
|
|
4057
|
-
throw new
|
|
4057
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Failed to read context config: ${jsonPath}`, {
|
|
4058
4058
|
code: "context_read_error",
|
|
4059
4059
|
cause
|
|
4060
4060
|
});
|
|
@@ -4066,13 +4066,13 @@ function parseConfig(raw, configPath) {
|
|
|
4066
4066
|
try {
|
|
4067
4067
|
parsed = JSON.parse(raw);
|
|
4068
4068
|
} catch (cause) {
|
|
4069
|
-
throw new
|
|
4069
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Invalid JSON in context config: ${configPath}`, {
|
|
4070
4070
|
code: "context_json_invalid",
|
|
4071
4071
|
cause
|
|
4072
4072
|
});
|
|
4073
4073
|
}
|
|
4074
4074
|
if (!parsed || typeof parsed !== "object") {
|
|
4075
|
-
throw new
|
|
4075
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Context config must be an object: ${configPath}`, {
|
|
4076
4076
|
code: "context_config_shape"
|
|
4077
4077
|
});
|
|
4078
4078
|
}
|
|
@@ -4087,7 +4087,7 @@ function parseConfig(raw, configPath) {
|
|
|
4087
4087
|
}
|
|
4088
4088
|
function readSources(sourcesRaw, configPath) {
|
|
4089
4089
|
if (!Array.isArray(sourcesRaw)) {
|
|
4090
|
-
throw new
|
|
4090
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Context config sources must be an array: ${configPath}`, {
|
|
4091
4091
|
code: "context_sources_shape"
|
|
4092
4092
|
});
|
|
4093
4093
|
}
|
|
@@ -4185,7 +4185,7 @@ var PluginsManager = class {
|
|
|
4185
4185
|
async refresh() {
|
|
4186
4186
|
this.plugins = [];
|
|
4187
4187
|
const pluginsRoot = path.join(this.cwd, ".theokit", "plugins");
|
|
4188
|
-
const entries = await
|
|
4188
|
+
const entries = await chunk44IISBRZ_cjs.readWorkspaceDir(pluginsRoot, "plugins_read_error", "plugins directory");
|
|
4189
4189
|
for (const entry of entries) {
|
|
4190
4190
|
if (!entry.isDirectory()) continue;
|
|
4191
4191
|
const folderName = entry.name;
|
|
@@ -4193,13 +4193,13 @@ var PluginsManager = class {
|
|
|
4193
4193
|
const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
|
|
4194
4194
|
const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(pluginsRoot, folderName) : await loadPluginManifestFromJson(jsonPath, folderName);
|
|
4195
4195
|
if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
|
|
4196
|
-
|
|
4196
|
+
chunk3YYDHUNH_cjs.warnOnce(
|
|
4197
4197
|
`plugin-${folderName}-both`,
|
|
4198
4198
|
`[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
|
|
4199
4199
|
);
|
|
4200
4200
|
}
|
|
4201
4201
|
if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
|
|
4202
|
-
|
|
4202
|
+
chunk3YYDHUNH_cjs.warnOnce(
|
|
4203
4203
|
"plugin-json-deprecated",
|
|
4204
4204
|
"[theokit-sdk] plugin.json manifests are deprecated; migrate to PLUGIN.md via theokit-migrate-config"
|
|
4205
4205
|
);
|
|
@@ -4217,11 +4217,11 @@ var PluginsManager = class {
|
|
|
4217
4217
|
const entry = metadata.entry;
|
|
4218
4218
|
if (entry === void 0) return;
|
|
4219
4219
|
const pluginRoot = path.join(this.cwd, ".theokit", "plugins", folderName);
|
|
4220
|
-
const entryPath =
|
|
4220
|
+
const entryPath = chunkYTO5BRBD_cjs.safePathJoin(pluginRoot, entry);
|
|
4221
4221
|
try {
|
|
4222
4222
|
await promises.readFile(entryPath, "utf8");
|
|
4223
4223
|
} catch (cause) {
|
|
4224
|
-
throw new
|
|
4224
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${metadata.name} entry file is missing: ${entry}`, {
|
|
4225
4225
|
code: "plugin_entry_missing",
|
|
4226
4226
|
cause
|
|
4227
4227
|
});
|
|
@@ -4230,7 +4230,7 @@ var PluginsManager = class {
|
|
|
4230
4230
|
assertCloudRules() {
|
|
4231
4231
|
if (!this.cloud) return;
|
|
4232
4232
|
if (this.localPaths !== void 0 && this.localPaths.length > 0) {
|
|
4233
|
-
throw new
|
|
4233
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
4234
4234
|
"Cloud agents reject local plugin paths \u2014 plugins must come from committed repo files",
|
|
4235
4235
|
{ code: "cloud_plugin_path_rejected" }
|
|
4236
4236
|
);
|
|
@@ -4242,7 +4242,7 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
|
|
|
4242
4242
|
try {
|
|
4243
4243
|
raw = await promises.readFile(manifestPath, "utf8");
|
|
4244
4244
|
} catch (cause) {
|
|
4245
|
-
throw new
|
|
4245
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} is missing plugin.json`, {
|
|
4246
4246
|
code: "plugin_missing_manifest",
|
|
4247
4247
|
cause
|
|
4248
4248
|
});
|
|
@@ -4251,13 +4251,13 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
|
|
|
4251
4251
|
try {
|
|
4252
4252
|
parsed = JSON.parse(raw);
|
|
4253
4253
|
} catch (cause) {
|
|
4254
|
-
throw new
|
|
4254
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} manifest is invalid JSON`, {
|
|
4255
4255
|
code: "plugin_manifest_invalid",
|
|
4256
4256
|
cause
|
|
4257
4257
|
});
|
|
4258
4258
|
}
|
|
4259
4259
|
if (!parsed || typeof parsed !== "object") {
|
|
4260
|
-
throw new
|
|
4260
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} manifest must be an object`, {
|
|
4261
4261
|
code: "plugin_manifest_shape"
|
|
4262
4262
|
});
|
|
4263
4263
|
}
|
|
@@ -4276,7 +4276,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
|
|
|
4276
4276
|
try {
|
|
4277
4277
|
raw = await promises.readFile(mdPath, "utf8");
|
|
4278
4278
|
} catch (cause) {
|
|
4279
|
-
throw new
|
|
4279
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} is missing PLUGIN.md`, {
|
|
4280
4280
|
code: "plugin_missing_manifest",
|
|
4281
4281
|
cause
|
|
4282
4282
|
});
|
|
@@ -4291,7 +4291,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
|
|
|
4291
4291
|
});
|
|
4292
4292
|
const entity = entities.find((e) => e.slug === "PLUGIN");
|
|
4293
4293
|
if (entity === void 0) {
|
|
4294
|
-
throw new
|
|
4294
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} PLUGIN.md not parseable`, {
|
|
4295
4295
|
code: "plugin_missing_manifest"
|
|
4296
4296
|
});
|
|
4297
4297
|
}
|
|
@@ -4565,7 +4565,7 @@ function assertValidThresholds(soft, hard) {
|
|
|
4565
4565
|
["hardThreshold", hard]
|
|
4566
4566
|
]) {
|
|
4567
4567
|
if (!Number.isInteger(value) || value < 1) {
|
|
4568
|
-
throw new
|
|
4568
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
4569
4569
|
`doomLoop.${label} must be a positive integer (received ${value}).`,
|
|
4570
4570
|
{ code: "invalid_doom_loop_threshold" }
|
|
4571
4571
|
);
|
|
@@ -4878,9 +4878,9 @@ async function safeListTools(client, serverName, sink) {
|
|
|
4878
4878
|
} catch (cause) {
|
|
4879
4879
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
4880
4880
|
const server = serverName ?? "unknown";
|
|
4881
|
-
|
|
4881
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] mcp listTools failed (server=${server}): ${message}
|
|
4882
4882
|
`);
|
|
4883
|
-
|
|
4883
|
+
chunk6DCTL32L_cjs.emitRunEvent(sink, { type: "mcp_server_failed", serverName: server, message });
|
|
4884
4884
|
return [];
|
|
4885
4885
|
}
|
|
4886
4886
|
}
|
|
@@ -4948,7 +4948,7 @@ function emitLlmMetrics(inputs, result, startAt) {
|
|
|
4948
4948
|
inputs.telemetry?.recordHistogram(HISTOGRAM_NAMES.LLM_USAGE_MISSING, 1, {
|
|
4949
4949
|
provider: inputs.llm.name
|
|
4950
4950
|
});
|
|
4951
|
-
|
|
4951
|
+
chunkSXSPMRSV_cjs.diag(
|
|
4952
4952
|
`[theokit-sdk] llm usage missing from ${inputs.llm.name} finish \u2014 budget may undercount
|
|
4953
4953
|
`
|
|
4954
4954
|
);
|
|
@@ -5244,7 +5244,7 @@ function coerceArgsToSchema(args, schema) {
|
|
|
5244
5244
|
}
|
|
5245
5245
|
|
|
5246
5246
|
// src/tool-error.ts
|
|
5247
|
-
var ToolError = class extends
|
|
5247
|
+
var ToolError = class extends chunk2YGIBOUH_cjs.TheokitAgentError {
|
|
5248
5248
|
name = "ToolError";
|
|
5249
5249
|
/** The error content surfaced to the model: a string, or text/image blocks. */
|
|
5250
5250
|
content;
|
|
@@ -5438,7 +5438,7 @@ function raceToolExecution(exec, opts) {
|
|
|
5438
5438
|
// src/internal/agent-loop/tool-dispatch.ts
|
|
5439
5439
|
async function dispatchTools(inputs, tools, toolCalls, events, parentSpan) {
|
|
5440
5440
|
const maxConcurrent = inputs.maxConcurrentTools ?? 4;
|
|
5441
|
-
return
|
|
5441
|
+
return chunkKNZU4YO5_cjs.mapWithConcurrency(
|
|
5442
5442
|
toolCalls,
|
|
5443
5443
|
maxConcurrent,
|
|
5444
5444
|
(call) => dispatchSingleCall(inputs, tools, call, events, parentSpan)
|
|
@@ -5466,7 +5466,7 @@ async function dispatchSingleCall(inputs, tools, call, events, parentSpan) {
|
|
|
5466
5466
|
toolSpan?.end();
|
|
5467
5467
|
return fileVeto;
|
|
5468
5468
|
}
|
|
5469
|
-
|
|
5469
|
+
chunk6DCTL32L_cjs.emitRunEvent(inputs.runEventSink, {
|
|
5470
5470
|
type: "tool_progress",
|
|
5471
5471
|
toolName: workingCall.name,
|
|
5472
5472
|
toolCallId: callId
|
|
@@ -5497,7 +5497,7 @@ function applyRepairAndExtractCall(tools, call) {
|
|
|
5497
5497
|
function vetoFromForkWhitelist(inputs, call, callId, events) {
|
|
5498
5498
|
const whitelistDecision = chunkVJ26EKGJ_cjs.checkToolWhitelist(call.name);
|
|
5499
5499
|
if (whitelistDecision.allowed) return void 0;
|
|
5500
|
-
|
|
5500
|
+
chunk6DCTL32L_cjs.emitRunEvent(inputs.runEventSink, {
|
|
5501
5501
|
type: "permission_denied",
|
|
5502
5502
|
toolName: call.name,
|
|
5503
5503
|
toolCallId: callId,
|
|
@@ -5542,7 +5542,7 @@ async function vetoFromPluginPreHook(inputs, call, callId, events) {
|
|
|
5542
5542
|
...inputs.permissionMode !== void 0 ? { permissionMode: inputs.permissionMode } : {}
|
|
5543
5543
|
});
|
|
5544
5544
|
if (pluginVeto === void 0) return void 0;
|
|
5545
|
-
|
|
5545
|
+
chunk6DCTL32L_cjs.emitRunEvent(inputs.runEventSink, {
|
|
5546
5546
|
type: "permission_denied",
|
|
5547
5547
|
toolName: call.name,
|
|
5548
5548
|
toolCallId: callId,
|
|
@@ -5571,7 +5571,7 @@ async function vetoFromFileHookPreDecision(inputs, call, callId, events) {
|
|
|
5571
5571
|
runId: inputs.runId
|
|
5572
5572
|
});
|
|
5573
5573
|
if (!preDecision.blocked) return void 0;
|
|
5574
|
-
|
|
5574
|
+
chunk6DCTL32L_cjs.emitRunEvent(inputs.runEventSink, {
|
|
5575
5575
|
type: "permission_denied",
|
|
5576
5576
|
toolName: call.name,
|
|
5577
5577
|
toolCallId: callId,
|
|
@@ -5672,7 +5672,7 @@ function finalizeSpanAndPostHook(inputs, call, callId, result, events, toolSpan)
|
|
|
5672
5672
|
agentId: inputs.agentId,
|
|
5673
5673
|
runId: inputs.runId
|
|
5674
5674
|
}).catch((err) => {
|
|
5675
|
-
|
|
5675
|
+
chunkSXSPMRSV_cjs.diag(
|
|
5676
5676
|
`[theokit-sdk] postToolUse hook error (swallowed): ${err instanceof Error ? err.message : String(err)}
|
|
5677
5677
|
`
|
|
5678
5678
|
);
|
|
@@ -5691,7 +5691,7 @@ async function emitToolLifecycleDelta(inputs, update) {
|
|
|
5691
5691
|
try {
|
|
5692
5692
|
await inputs.onDelta({ update });
|
|
5693
5693
|
} catch (err) {
|
|
5694
|
-
|
|
5694
|
+
chunkSXSPMRSV_cjs.diag(
|
|
5695
5695
|
`[theokit-sdk] onDelta tool-lifecycle emit error (swallowed): ${err instanceof Error ? err.message : String(err)}
|
|
5696
5696
|
`
|
|
5697
5697
|
);
|
|
@@ -5703,7 +5703,7 @@ async function safeEmitToolHook(callback, event) {
|
|
|
5703
5703
|
await callback(event);
|
|
5704
5704
|
} catch (cause) {
|
|
5705
5705
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
5706
|
-
|
|
5706
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] tool lifecycle hook threw: ${msg}
|
|
5707
5707
|
`);
|
|
5708
5708
|
}
|
|
5709
5709
|
}
|
|
@@ -5770,7 +5770,7 @@ function applyToolResultGuard(parts, opts) {
|
|
|
5770
5770
|
(p) => (
|
|
5771
5771
|
// SE7 — guard the TEXT of a tool result (string or the text blocks of a
|
|
5772
5772
|
// structured content); image blocks pass through untouched.
|
|
5773
|
-
p.type === "tool_result" ? { ...p, content:
|
|
5773
|
+
p.type === "tool_result" ? { ...p, content: chunkZNEYQ56O_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
|
|
5774
5774
|
)
|
|
5775
5775
|
);
|
|
5776
5776
|
}
|
|
@@ -5965,7 +5965,7 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
5965
5965
|
const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
|
|
5966
5966
|
if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
|
|
5967
5967
|
for (const key of candidates) {
|
|
5968
|
-
const info =
|
|
5968
|
+
const info = chunkT6ZCG5AP_cjs.getCatalogModelInfo(key);
|
|
5969
5969
|
const cost = info?.cost;
|
|
5970
5970
|
if (cost === void 0) continue;
|
|
5971
5971
|
const [prov, ...modelParts] = key.split("/");
|
|
@@ -5977,7 +5977,7 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
5977
5977
|
...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
|
|
5978
5978
|
...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
|
|
5979
5979
|
// M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
|
|
5980
|
-
pricingVersion:
|
|
5980
|
+
pricingVersion: chunkT6ZCG5AP_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
|
|
5981
5981
|
};
|
|
5982
5982
|
}
|
|
5983
5983
|
return void 0;
|
|
@@ -6430,15 +6430,15 @@ var FallbackLlmClient = class {
|
|
|
6430
6430
|
let lastError;
|
|
6431
6431
|
for (const client of this.clients) {
|
|
6432
6432
|
if (signal.aborted) throw abortError(signal);
|
|
6433
|
-
const attempt = await
|
|
6433
|
+
const attempt = await chunkZNEYQ56O_cjs.tryFirstEvent(client, request, signal, true);
|
|
6434
6434
|
if (attempt.kind === "handshake_error") {
|
|
6435
6435
|
lastError = attempt.error;
|
|
6436
6436
|
continue;
|
|
6437
6437
|
}
|
|
6438
|
-
return yield*
|
|
6438
|
+
return yield* chunkZNEYQ56O_cjs.relayStream(attempt.generator, attempt.firstResult);
|
|
6439
6439
|
}
|
|
6440
6440
|
if (lastError !== void 0) throw lastError;
|
|
6441
|
-
throw new
|
|
6441
|
+
throw new chunk2YGIBOUH_cjs.NetworkError("FallbackLlmClient has no providers configured", {
|
|
6442
6442
|
code: "fallback_empty_chain"
|
|
6443
6443
|
});
|
|
6444
6444
|
}
|
|
@@ -6461,7 +6461,7 @@ function reconnectDelay(attempt) {
|
|
|
6461
6461
|
return ms <= 0 ? Promise.resolve() : new Promise((resolve) => setTimeout(resolve, ms));
|
|
6462
6462
|
}
|
|
6463
6463
|
function mcpTimeoutError(name, timeoutMs) {
|
|
6464
|
-
return new
|
|
6464
|
+
return new chunk2YGIBOUH_cjs.NetworkError(`MCP ${name} request timed out after ${timeoutMs}ms`, {
|
|
6465
6465
|
code: "mcp_timeout"
|
|
6466
6466
|
});
|
|
6467
6467
|
}
|
|
@@ -6544,7 +6544,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6544
6544
|
child.stdin.on("error", () => void 0);
|
|
6545
6545
|
child.on("error", () => {
|
|
6546
6546
|
this.rejectAllPending(
|
|
6547
|
-
new
|
|
6547
|
+
new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} process crashed`, { code: "mcp_crashed" })
|
|
6548
6548
|
);
|
|
6549
6549
|
});
|
|
6550
6550
|
child.on("exit", () => {
|
|
@@ -6552,7 +6552,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6552
6552
|
this.child = void 0;
|
|
6553
6553
|
this.dropped = true;
|
|
6554
6554
|
this.rejectAllPending(
|
|
6555
|
-
new
|
|
6555
|
+
new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
|
|
6556
6556
|
);
|
|
6557
6557
|
});
|
|
6558
6558
|
}
|
|
@@ -6580,7 +6580,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6580
6580
|
if (this.child !== void 0) return Promise.resolve();
|
|
6581
6581
|
if (!this.dropped) {
|
|
6582
6582
|
return Promise.reject(
|
|
6583
|
-
new
|
|
6583
|
+
new chunk2YGIBOUH_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
|
|
6584
6584
|
);
|
|
6585
6585
|
}
|
|
6586
6586
|
this.reconnectPromise ??= this.reconnect().finally(() => {
|
|
@@ -6601,13 +6601,13 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6601
6601
|
lastErr = err;
|
|
6602
6602
|
}
|
|
6603
6603
|
}
|
|
6604
|
-
throw new
|
|
6604
|
+
throw new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} reconnect exhausted`, {
|
|
6605
6605
|
code: "mcp_disconnected",
|
|
6606
6606
|
...lastErr instanceof Error ? { cause: lastErr } : {}
|
|
6607
6607
|
});
|
|
6608
6608
|
}
|
|
6609
6609
|
async close() {
|
|
6610
|
-
this.rejectAllPending(new
|
|
6610
|
+
this.rejectAllPending(new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} closed`, { code: "mcp_closed" }));
|
|
6611
6611
|
const child = this.child;
|
|
6612
6612
|
this.child = void 0;
|
|
6613
6613
|
this.dropped = false;
|
|
@@ -6626,7 +6626,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6626
6626
|
if (this.buffer.length > MAX_STDIO_BUFFER_BYTES) {
|
|
6627
6627
|
this.buffer = "";
|
|
6628
6628
|
this.rejectAllPending(
|
|
6629
|
-
new
|
|
6629
|
+
new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} exceeded stdout buffer limit`, {
|
|
6630
6630
|
code: "mcp_buffer_overflow"
|
|
6631
6631
|
})
|
|
6632
6632
|
);
|
|
@@ -6661,7 +6661,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6661
6661
|
if (child !== void 0) return this.send(child, method, params);
|
|
6662
6662
|
if (this.dropped) return this.reconnectAndRequest(method, params);
|
|
6663
6663
|
return Promise.reject(
|
|
6664
|
-
new
|
|
6664
|
+
new chunk2YGIBOUH_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
|
|
6665
6665
|
);
|
|
6666
6666
|
}
|
|
6667
6667
|
/** M2 #59 — reconnect a dropped client, then send. Separate async path so the
|
|
@@ -6670,7 +6670,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6670
6670
|
await this.ensureConnected();
|
|
6671
6671
|
const child = this.child;
|
|
6672
6672
|
if (child === void 0) {
|
|
6673
|
-
throw new
|
|
6673
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" });
|
|
6674
6674
|
}
|
|
6675
6675
|
return this.send(child, method, params);
|
|
6676
6676
|
}
|
|
@@ -6687,7 +6687,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6687
6687
|
this.child = void 0;
|
|
6688
6688
|
this.dropped = true;
|
|
6689
6689
|
this.rejectAllPending(
|
|
6690
|
-
new
|
|
6690
|
+
new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
|
|
6691
6691
|
);
|
|
6692
6692
|
}, this.timeoutMs);
|
|
6693
6693
|
this.pending.set(id, { resolve, reject, timer });
|
|
@@ -6765,7 +6765,7 @@ var HttpMcpClient = class extends BaseMcpClient {
|
|
|
6765
6765
|
if (payload === "") continue;
|
|
6766
6766
|
return JSON.parse(payload);
|
|
6767
6767
|
}
|
|
6768
|
-
throw new
|
|
6768
|
+
throw new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} returned an event stream with no data payload`, {
|
|
6769
6769
|
code: "mcp_http_error"
|
|
6770
6770
|
});
|
|
6771
6771
|
}
|
|
@@ -6793,7 +6793,7 @@ var HttpMcpClient = class extends BaseMcpClient {
|
|
|
6793
6793
|
throw cause;
|
|
6794
6794
|
}
|
|
6795
6795
|
if (!response.ok) {
|
|
6796
|
-
throw new
|
|
6796
|
+
throw new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} returned ${response.status}`, {
|
|
6797
6797
|
code: "mcp_http_error"
|
|
6798
6798
|
});
|
|
6799
6799
|
}
|
|
@@ -6809,14 +6809,14 @@ var HttpMcpClient = class extends BaseMcpClient {
|
|
|
6809
6809
|
function resolveMcpCwd(configCwd) {
|
|
6810
6810
|
if (configCwd === void 0) return process.cwd();
|
|
6811
6811
|
if (path.isAbsolute(configCwd)) return configCwd;
|
|
6812
|
-
return
|
|
6812
|
+
return chunkYTO5BRBD_cjs.safePathJoin(process.cwd(), configCwd);
|
|
6813
6813
|
}
|
|
6814
6814
|
|
|
6815
6815
|
// src/internal/providers/register-plugin-providers.ts
|
|
6816
6816
|
function registerPluginProviderProfiles(entries) {
|
|
6817
6817
|
let registered2 = 0;
|
|
6818
6818
|
for (const entry of entries) {
|
|
6819
|
-
|
|
6819
|
+
chunkT6ZCG5AP_cjs.registerProvider(entry.profile);
|
|
6820
6820
|
registered2 += 1;
|
|
6821
6821
|
}
|
|
6822
6822
|
return registered2;
|
|
@@ -6896,7 +6896,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
|
|
|
6896
6896
|
if (exposedSet.has(name)) continue;
|
|
6897
6897
|
const hint = suggestClosest(name, exposedSet);
|
|
6898
6898
|
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)`;
|
|
6899
|
-
|
|
6899
|
+
chunk3YYDHUNH_cjs.warnOnce(
|
|
6900
6900
|
`personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
|
|
6901
6901
|
message
|
|
6902
6902
|
);
|
|
@@ -7005,25 +7005,25 @@ function createRealLocalRun(options) {
|
|
|
7005
7005
|
}
|
|
7006
7006
|
var pluginProvidersAnnounced = false;
|
|
7007
7007
|
function resolveRunProvider(options) {
|
|
7008
|
-
|
|
7008
|
+
chunkT6ZCG5AP_cjs.registerBuiltins();
|
|
7009
7009
|
const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
|
|
7010
7010
|
const registered2 = registerPluginProviderProfiles(profiles);
|
|
7011
7011
|
if (registered2 > 0 && !pluginProvidersAnnounced) {
|
|
7012
7012
|
pluginProvidersAnnounced = true;
|
|
7013
7013
|
const names = profiles.map((e) => e.profile.name).join(", ");
|
|
7014
|
-
|
|
7014
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] registered ${registered2} plugin provider profile(s): ${names}
|
|
7015
7015
|
`);
|
|
7016
7016
|
}
|
|
7017
7017
|
const parsedModel = chunkVYHJZVL5_cjs.parseModelId(options.model?.id);
|
|
7018
|
-
const modelInferredProvider = parsedModel.provider !== void 0 &&
|
|
7019
|
-
const keyInferredProvider =
|
|
7020
|
-
const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ??
|
|
7018
|
+
const modelInferredProvider = parsedModel.provider !== void 0 && chunkT6ZCG5AP_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
|
|
7019
|
+
const keyInferredProvider = chunkZNEYQ56O_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
|
|
7020
|
+
const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkZNEYQ56O_cjs.detectPrimaryProvider();
|
|
7021
7021
|
const effectiveModelId = modelInferredProvider !== void 0 && modelInferredProvider === primary ? parsedModel.name : options.model?.id ?? "claude-sonnet-4-6";
|
|
7022
7022
|
return { primary, effectiveModelId };
|
|
7023
7023
|
}
|
|
7024
7024
|
function mergeExplicitApiKey(pools, primary, apiKey) {
|
|
7025
7025
|
if (apiKey === void 0 || apiKey.length === 0) return pools;
|
|
7026
|
-
if (
|
|
7026
|
+
if (chunkZNEYQ56O_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
|
|
7027
7027
|
const existing = pools?.[primary];
|
|
7028
7028
|
if (existing !== void 0 && existing.length > 0) return pools;
|
|
7029
7029
|
return { ...pools ?? {}, [primary]: [apiKey] };
|
|
@@ -7031,7 +7031,7 @@ function mergeExplicitApiKey(pools, primary, apiKey) {
|
|
|
7031
7031
|
function buildLoopInputs(options, runId, userText, userImages) {
|
|
7032
7032
|
const maxIterations = options.sendOptions.maxIterations;
|
|
7033
7033
|
if (maxIterations !== void 0 && (!Number.isInteger(maxIterations) || maxIterations < 1)) {
|
|
7034
|
-
throw new
|
|
7034
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
7035
7035
|
`SendOptions.maxIterations must be a positive integer, got ${maxIterations}`,
|
|
7036
7036
|
{ code: "invalid_max_iterations" }
|
|
7037
7037
|
);
|
|
@@ -7046,14 +7046,14 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7046
7046
|
const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
|
|
7047
7047
|
const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
|
|
7048
7048
|
const rateLimitSink = options.sendOptions.onRunEvent;
|
|
7049
|
-
const chain =
|
|
7049
|
+
const chain = chunkZNEYQ56O_cjs.resolveProviderChain({
|
|
7050
7050
|
primary,
|
|
7051
7051
|
...fallback !== void 0 ? { fallback } : {},
|
|
7052
7052
|
...apiKeys !== void 0 ? { apiKeys } : {},
|
|
7053
7053
|
...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {},
|
|
7054
7054
|
...extractToolCallsFromContent === true ? { extractToolCallsFromContent: true } : {},
|
|
7055
7055
|
...rateLimitSink !== void 0 ? {
|
|
7056
|
-
onRateLimit: (info) =>
|
|
7056
|
+
onRateLimit: (info) => chunk6DCTL32L_cjs.emitRunEvent(rateLimitSink, { type: "rate_limit", ...info })
|
|
7057
7057
|
} : {}
|
|
7058
7058
|
});
|
|
7059
7059
|
const llm = chain.length === 1 ? chain[0] : new FallbackLlmClient(chain);
|
|
@@ -7328,7 +7328,7 @@ function buildRealRunOptions(args) {
|
|
|
7328
7328
|
};
|
|
7329
7329
|
}
|
|
7330
7330
|
async function createFixtureRunHelper(args) {
|
|
7331
|
-
const sessionMessages =
|
|
7331
|
+
const sessionMessages = chunkYARJG3GV_cjs.getSessionMessages(args.inputs.agentId);
|
|
7332
7332
|
const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
|
|
7333
7333
|
return createLocalRun({
|
|
7334
7334
|
agentId: args.inputs.agentId,
|
|
@@ -7347,7 +7347,7 @@ async function createFixtureRunHelper(args) {
|
|
|
7347
7347
|
}
|
|
7348
7348
|
async function dispatchLocalRun(args) {
|
|
7349
7349
|
const apiKey = resolveApiKey(args.inputs.options.apiKey);
|
|
7350
|
-
if (
|
|
7350
|
+
if (chunkZNEYQ56O_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
7351
7351
|
return createRealLocalRun(
|
|
7352
7352
|
buildRealRunOptions({
|
|
7353
7353
|
inputs: args.inputs,
|
|
@@ -7382,20 +7382,20 @@ async function readProjectMcpServers(cwd) {
|
|
|
7382
7382
|
|
|
7383
7383
|
// src/internal/local-agent/local-agent-invalidate.ts
|
|
7384
7384
|
async function applyDeferredInvalidation(agentId, pending, refresh) {
|
|
7385
|
-
|
|
7385
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] applying deferred cache invalidation (${agentId}): ${pending.reason}
|
|
7386
7386
|
`);
|
|
7387
7387
|
try {
|
|
7388
7388
|
await refresh();
|
|
7389
7389
|
} catch (err) {
|
|
7390
7390
|
const msg = err instanceof Error ? err.message : String(err);
|
|
7391
|
-
|
|
7391
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] invalidateCache reload failed (continuing): ${msg}
|
|
7392
7392
|
`);
|
|
7393
7393
|
}
|
|
7394
7394
|
}
|
|
7395
7395
|
async function invalidateCacheImpl(agentId, reason, options, disposed, dispose, setPending) {
|
|
7396
7396
|
if (disposed) return;
|
|
7397
7397
|
if (options.applyNow === true) {
|
|
7398
|
-
|
|
7398
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] invalidateCache applyNow disposing agent (${agentId}): ${reason}
|
|
7399
7399
|
`);
|
|
7400
7400
|
await dispose();
|
|
7401
7401
|
return;
|
|
@@ -7456,7 +7456,7 @@ var LiveAgentRegistry = class {
|
|
|
7456
7456
|
const existing = this.#agents.get(id);
|
|
7457
7457
|
if (existing !== void 0 && existing.agent !== agent) {
|
|
7458
7458
|
void existing.agent.dispose().catch(() => {
|
|
7459
|
-
|
|
7459
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] dispose during overwrite failed (${id})
|
|
7460
7460
|
`);
|
|
7461
7461
|
});
|
|
7462
7462
|
}
|
|
@@ -7560,7 +7560,7 @@ var LiveAgentRegistry = class {
|
|
|
7560
7560
|
await agent.dispose();
|
|
7561
7561
|
} catch (cause) {
|
|
7562
7562
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
7563
|
-
|
|
7563
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] dispose during eviction failed (${id}): ${msg}
|
|
7564
7564
|
`);
|
|
7565
7565
|
}
|
|
7566
7566
|
if (this.#onEvict !== void 0) {
|
|
@@ -7568,7 +7568,7 @@ var LiveAgentRegistry = class {
|
|
|
7568
7568
|
this.#onEvict(id, reason);
|
|
7569
7569
|
} catch (cause) {
|
|
7570
7570
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
7571
|
-
|
|
7571
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] onEvict listener threw (${id}): ${msg}
|
|
7572
7572
|
`);
|
|
7573
7573
|
}
|
|
7574
7574
|
}
|
|
@@ -7584,7 +7584,7 @@ async function acquireLeaseIfPossible(store, agentId) {
|
|
|
7584
7584
|
await a.call(store, agentId);
|
|
7585
7585
|
} catch (err) {
|
|
7586
7586
|
if (err instanceof Error && err.name === "SessionBusyError") throw err;
|
|
7587
|
-
|
|
7587
|
+
chunkSXSPMRSV_cjs.diag(
|
|
7588
7588
|
`[theokit-sdk] writer lease unavailable for ${agentId} (${err instanceof Error ? err.message : String(err)}) \u2014 proceeding without single-writer protection
|
|
7589
7589
|
`
|
|
7590
7590
|
);
|
|
@@ -7603,16 +7603,16 @@ async function disposeLocalAgentSession(agent) {
|
|
|
7603
7603
|
agent.lifecycleAbortController.abort();
|
|
7604
7604
|
await chunkYLQQX5W2_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
|
|
7605
7605
|
disposeSessionMcpClients(agent.agentId);
|
|
7606
|
-
await
|
|
7606
|
+
await chunkYARJG3GV_cjs.flushSessionWrites();
|
|
7607
7607
|
await flushRegistrySaves(agent.workspaceCwd);
|
|
7608
7608
|
await disposeSessionStore(agent.sessionStore);
|
|
7609
|
-
|
|
7609
|
+
chunkYARJG3GV_cjs.discardSession(agent.workspaceCwd, agent.agentId);
|
|
7610
7610
|
}
|
|
7611
7611
|
async function reloadLocalAgent(agent) {
|
|
7612
7612
|
if (agent.context !== void 0) await agent.context.refresh();
|
|
7613
7613
|
if (agent.skillsManager !== void 0) await agent.skillsManager.refresh();
|
|
7614
7614
|
if (agent.pluginsManager !== void 0) await agent.pluginsManager.refresh();
|
|
7615
|
-
return await
|
|
7615
|
+
return await chunkRTLUZKDL_cjs.loadSubagents(
|
|
7616
7616
|
agent.workspaceCwd,
|
|
7617
7617
|
agent.settingSourcesIncludeProject,
|
|
7618
7618
|
agent.options.agents
|
|
@@ -7620,12 +7620,12 @@ async function reloadLocalAgent(agent) {
|
|
|
7620
7620
|
}
|
|
7621
7621
|
async function persistActiveMemoryTranscript(cwd, transcript) {
|
|
7622
7622
|
try {
|
|
7623
|
-
const dir = path.join(
|
|
7623
|
+
const dir = path.join(chunkEQMLJ52C_cjs.memoryDir(cwd), "transcripts", "active-memory");
|
|
7624
7624
|
const file = path.join(dir, `${transcript.runId}.json`);
|
|
7625
|
-
await
|
|
7625
|
+
await chunk2CFEET3Y_cjs.atomicWriteJson(file, transcript);
|
|
7626
7626
|
} catch (cause) {
|
|
7627
7627
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
7628
|
-
|
|
7628
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] active-memory transcript persist failed: ${message}
|
|
7629
7629
|
`);
|
|
7630
7630
|
}
|
|
7631
7631
|
}
|
|
@@ -7746,7 +7746,7 @@ async function searchOnce(args, cfg, query, started) {
|
|
|
7746
7746
|
return { summary, durationMs: Date.now() - started, status: "ok", hits };
|
|
7747
7747
|
} catch (cause) {
|
|
7748
7748
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
7749
|
-
|
|
7749
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] active-memory recall failed: ${message}
|
|
7750
7750
|
`);
|
|
7751
7751
|
return { summary: void 0, durationMs: Date.now() - started, status: "error", hits: [] };
|
|
7752
7752
|
}
|
|
@@ -7866,7 +7866,7 @@ var azureOpenAiMemoryEmbeddingProviderAdapter = {
|
|
|
7866
7866
|
transport: "remote",
|
|
7867
7867
|
authProviderId: "azure-openai",
|
|
7868
7868
|
autoSelectPriority: 25,
|
|
7869
|
-
create: (options) =>
|
|
7869
|
+
create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
|
|
7870
7870
|
{
|
|
7871
7871
|
id: "azure-openai",
|
|
7872
7872
|
defaultBaseUrl: "https://your-resource.openai.azure.com",
|
|
@@ -7902,7 +7902,7 @@ var cohereMemoryEmbeddingProviderAdapter = {
|
|
|
7902
7902
|
transport: "remote",
|
|
7903
7903
|
authProviderId: "cohere",
|
|
7904
7904
|
autoSelectPriority: 30,
|
|
7905
|
-
create: (options) =>
|
|
7905
|
+
create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
|
|
7906
7906
|
{
|
|
7907
7907
|
id: "cohere",
|
|
7908
7908
|
defaultBaseUrl: "https://api.cohere.com",
|
|
@@ -7948,7 +7948,7 @@ var deepinfraMemoryEmbeddingProviderAdapter = {
|
|
|
7948
7948
|
transport: "remote",
|
|
7949
7949
|
authProviderId: "deepinfra",
|
|
7950
7950
|
autoSelectPriority: 13,
|
|
7951
|
-
create: (options) =>
|
|
7951
|
+
create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
|
|
7952
7952
|
{
|
|
7953
7953
|
id: "deepinfra",
|
|
7954
7954
|
defaultBaseUrl: "https://api.deepinfra.com",
|
|
@@ -7974,7 +7974,7 @@ var geminiMemoryEmbeddingProviderAdapter = {
|
|
|
7974
7974
|
transport: "remote",
|
|
7975
7975
|
authProviderId: "gemini",
|
|
7976
7976
|
autoSelectPriority: 30,
|
|
7977
|
-
create: (options) =>
|
|
7977
|
+
create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
|
|
7978
7978
|
{
|
|
7979
7979
|
id: "gemini",
|
|
7980
7980
|
defaultBaseUrl: "https://generativelanguage.googleapis.com",
|
|
@@ -8002,7 +8002,7 @@ var jinaMemoryEmbeddingProviderAdapter = {
|
|
|
8002
8002
|
transport: "remote",
|
|
8003
8003
|
authProviderId: "jina",
|
|
8004
8004
|
autoSelectPriority: 35,
|
|
8005
|
-
create: (options) =>
|
|
8005
|
+
create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
|
|
8006
8006
|
{
|
|
8007
8007
|
id: "jina",
|
|
8008
8008
|
defaultBaseUrl: "https://api.jina.ai",
|
|
@@ -8025,7 +8025,7 @@ var mistralMemoryEmbeddingProviderAdapter = {
|
|
|
8025
8025
|
transport: "remote",
|
|
8026
8026
|
authProviderId: "mistral",
|
|
8027
8027
|
autoSelectPriority: 18,
|
|
8028
|
-
create: (options) =>
|
|
8028
|
+
create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
|
|
8029
8029
|
{
|
|
8030
8030
|
id: "mistral",
|
|
8031
8031
|
defaultBaseUrl: "https://api.mistral.ai",
|
|
@@ -8067,7 +8067,7 @@ var ollamaMemoryEmbeddingProviderAdapter = {
|
|
|
8067
8067
|
autoSelectPriority: 10,
|
|
8068
8068
|
create: (options) => {
|
|
8069
8069
|
const apiKey = options.apiKey ?? process.env.OLLAMA_API_KEY ?? OLLAMA_LOCAL_SENTINEL_KEY;
|
|
8070
|
-
return
|
|
8070
|
+
return chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
|
|
8071
8071
|
{
|
|
8072
8072
|
id: "ollama",
|
|
8073
8073
|
defaultBaseUrl: "http://localhost:11434",
|
|
@@ -8094,7 +8094,7 @@ var openAiMemoryEmbeddingProviderAdapter = {
|
|
|
8094
8094
|
transport: "remote",
|
|
8095
8095
|
authProviderId: "openai",
|
|
8096
8096
|
autoSelectPriority: 20,
|
|
8097
|
-
create: (options) =>
|
|
8097
|
+
create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
|
|
8098
8098
|
{
|
|
8099
8099
|
id: "openai",
|
|
8100
8100
|
defaultBaseUrl: "https://api.openai.com",
|
|
@@ -8121,7 +8121,7 @@ var openRouterMemoryEmbeddingProviderAdapter = {
|
|
|
8121
8121
|
transport: "remote",
|
|
8122
8122
|
authProviderId: "openrouter",
|
|
8123
8123
|
autoSelectPriority: 15,
|
|
8124
|
-
create: (options) =>
|
|
8124
|
+
create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
|
|
8125
8125
|
{
|
|
8126
8126
|
id: "openrouter",
|
|
8127
8127
|
defaultBaseUrl: "https://openrouter.ai/api",
|
|
@@ -8149,7 +8149,7 @@ var voyageMemoryEmbeddingProviderAdapter = {
|
|
|
8149
8149
|
transport: "remote",
|
|
8150
8150
|
authProviderId: "voyage",
|
|
8151
8151
|
autoSelectPriority: 14,
|
|
8152
|
-
create: (options) =>
|
|
8152
|
+
create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
|
|
8153
8153
|
{
|
|
8154
8154
|
id: "voyage",
|
|
8155
8155
|
defaultBaseUrl: "https://api.voyageai.com",
|
|
@@ -8250,7 +8250,7 @@ function createMemorySearchTool(opts) {
|
|
|
8250
8250
|
};
|
|
8251
8251
|
}
|
|
8252
8252
|
function createMemoryGetTool(opts) {
|
|
8253
|
-
const memoryRoot = path.resolve(
|
|
8253
|
+
const memoryRoot = path.resolve(chunkEQMLJ52C_cjs.memoryDir(opts.cwd));
|
|
8254
8254
|
return {
|
|
8255
8255
|
name: "memory_get",
|
|
8256
8256
|
description: GET_DESCRIPTION,
|
|
@@ -8261,7 +8261,7 @@ function createMemoryGetTool(opts) {
|
|
|
8261
8261
|
const lines = readNumber(input.lines);
|
|
8262
8262
|
const resolved = path.resolve(memoryRoot, relPath);
|
|
8263
8263
|
if (!isPathInside(memoryRoot, resolved)) {
|
|
8264
|
-
throw new
|
|
8264
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
8265
8265
|
`memory_get rejected path that escapes memory root: ${relPath}`,
|
|
8266
8266
|
{ code: "memory_path_escapes_root" }
|
|
8267
8267
|
);
|
|
@@ -8281,7 +8281,7 @@ function readString(value, errorIfMissing, allowUndefined = false) {
|
|
|
8281
8281
|
if (typeof value === "string") return value;
|
|
8282
8282
|
if (allowUndefined && (value === void 0 || value === null)) return "";
|
|
8283
8283
|
if (errorIfMissing !== void 0) {
|
|
8284
|
-
throw new
|
|
8284
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(errorIfMissing, { code: "memory_tool_bad_args" });
|
|
8285
8285
|
}
|
|
8286
8286
|
return "";
|
|
8287
8287
|
}
|
|
@@ -8356,7 +8356,7 @@ var LocalAgentMemory = class {
|
|
|
8356
8356
|
const openOpts = { cwd: this.workspaceCwd };
|
|
8357
8357
|
if (embedding !== void 0) openOpts.embedding = embedding;
|
|
8358
8358
|
if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
|
|
8359
|
-
this.index = await
|
|
8359
|
+
this.index = await chunkEQMLJ52C_cjs.IndexManager.open(openOpts);
|
|
8360
8360
|
await this.index.sync();
|
|
8361
8361
|
this.toolsCache = [
|
|
8362
8362
|
createMemorySearchTool({ index: this.index }),
|
|
@@ -8371,7 +8371,7 @@ var LocalAgentMemory = class {
|
|
|
8371
8371
|
const warned2 = g[sym];
|
|
8372
8372
|
if (!warned2.has(message)) {
|
|
8373
8373
|
warned2.add(message);
|
|
8374
|
-
|
|
8374
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] memory tools unavailable: ${message}
|
|
8375
8375
|
`);
|
|
8376
8376
|
}
|
|
8377
8377
|
return void 0;
|
|
@@ -8380,7 +8380,7 @@ var LocalAgentMemory = class {
|
|
|
8380
8380
|
async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
|
|
8381
8381
|
const cfg = this.options.memory?.activeRecall;
|
|
8382
8382
|
if (cfg?.enabled !== true || this.index === void 0) return void 0;
|
|
8383
|
-
if (this.breaker === void 0) this.breaker = new
|
|
8383
|
+
if (this.breaker === void 0) this.breaker = new chunkZNEYQ56O_cjs.CircuitBreaker();
|
|
8384
8384
|
if (this.cache === void 0) this.cache = new ActiveMemoryCache();
|
|
8385
8385
|
const result = await runActiveMemory({
|
|
8386
8386
|
userText,
|
|
@@ -8430,7 +8430,7 @@ var LocalAgentMemory = class {
|
|
|
8430
8430
|
await this.index.sync();
|
|
8431
8431
|
} catch (cause) {
|
|
8432
8432
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
8433
|
-
|
|
8433
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] session index sync failed: ${message}
|
|
8434
8434
|
`);
|
|
8435
8435
|
}
|
|
8436
8436
|
}
|
|
@@ -8443,7 +8443,7 @@ var LocalAgentMemory = class {
|
|
|
8443
8443
|
return await adapter.create(cfg.model !== void 0 ? { model: cfg.model } : {});
|
|
8444
8444
|
} catch (cause) {
|
|
8445
8445
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
8446
|
-
|
|
8446
|
+
chunkSXSPMRSV_cjs.diag(`[theokit-sdk] memory embedding ${cfg.provider} unavailable: ${message}
|
|
8447
8447
|
`);
|
|
8448
8448
|
return void 0;
|
|
8449
8449
|
}
|
|
@@ -8479,7 +8479,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
|
|
|
8479
8479
|
...partial?.metadata !== void 0 ? { metadata: partial.metadata } : defaultContext?.metadata !== void 0 ? { metadata: defaultContext.metadata } : {}
|
|
8480
8480
|
};
|
|
8481
8481
|
if (merged.userId === "") {
|
|
8482
|
-
throw new
|
|
8482
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
8483
8483
|
"agent.memory requires a userId \u2014 either set AgentOptions.memoryContext.userId or pass ctx.userId at call time.",
|
|
8484
8484
|
{ code: "memory_context_missing_user_id" }
|
|
8485
8485
|
);
|
|
@@ -8489,7 +8489,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
|
|
|
8489
8489
|
async function requireAdapters() {
|
|
8490
8490
|
const r = await ensure();
|
|
8491
8491
|
if (r.adapters.length === 0) {
|
|
8492
|
-
throw new
|
|
8492
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
8493
8493
|
"No memory adapter registered. Pass a memory plugin in AgentOptions.plugins (e.g. supermemoryMemory({...})).",
|
|
8494
8494
|
{ code: "no_memory_adapter" }
|
|
8495
8495
|
);
|
|
@@ -8530,7 +8530,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
|
|
|
8530
8530
|
const prefix = id.split(":", 1)[0] ?? "";
|
|
8531
8531
|
const target = adapters.find((a) => a.id === prefix);
|
|
8532
8532
|
if (target === void 0) {
|
|
8533
|
-
throw new
|
|
8533
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
8534
8534
|
`No adapter found for MemoryId prefix "${prefix}" (registered: ${adapters.map((a) => a.id).join(", ")}).`,
|
|
8535
8535
|
{ code: "no_memory_adapter" }
|
|
8536
8536
|
);
|
|
@@ -8603,7 +8603,7 @@ function createLocalAgentMemoryProvider(opts) {
|
|
|
8603
8603
|
return { facts: [], systemPromptAdditions: summary };
|
|
8604
8604
|
},
|
|
8605
8605
|
async recordSessionSummary(args) {
|
|
8606
|
-
await
|
|
8606
|
+
await chunkEQMLJ52C_cjs.writeSessionSummary(args);
|
|
8607
8607
|
},
|
|
8608
8608
|
async sync(handle) {
|
|
8609
8609
|
const state = handle[INTERNAL_LAM_KEY];
|
|
@@ -8681,19 +8681,19 @@ var PersonalityRegistry = class _PersonalityRegistry {
|
|
|
8681
8681
|
function addEntity(byName, entity, origin, collisionMap) {
|
|
8682
8682
|
const fm = entity.frontmatter;
|
|
8683
8683
|
if (PersonalityRegistry.isReservedClearSlug(fm.name)) {
|
|
8684
|
-
throw new
|
|
8684
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
8685
8685
|
`Personality name "${fm.name}" is reserved (used to clear active preset)`,
|
|
8686
8686
|
{ code: "personality_reserved_name" }
|
|
8687
8687
|
);
|
|
8688
8688
|
}
|
|
8689
8689
|
if (entity.body.trim().length === 0) {
|
|
8690
|
-
throw new
|
|
8690
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
8691
8691
|
`Personality "${fm.name}" has empty body (system prompt required)`,
|
|
8692
8692
|
{ code: "personality_empty_body" }
|
|
8693
8693
|
);
|
|
8694
8694
|
}
|
|
8695
8695
|
if (origin === "project" && collisionMap?.has(fm.name)) {
|
|
8696
|
-
|
|
8696
|
+
chunk3YYDHUNH_cjs.warnOnce(
|
|
8697
8697
|
`personality-collision-${fm.name}`,
|
|
8698
8698
|
`[theokit-sdk] personality "${fm.name}" overridden by project preset`
|
|
8699
8699
|
);
|
|
@@ -8722,7 +8722,7 @@ async function performPersonalitySwitch(args) {
|
|
|
8722
8722
|
const preset = args.registry.get(args.requestedName);
|
|
8723
8723
|
if (preset === void 0) {
|
|
8724
8724
|
const available = args.registry.all().map((p) => p.name).join(", ") || "(none)";
|
|
8725
|
-
throw new
|
|
8725
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
8726
8726
|
`Personality "${args.requestedName}" not found. Available: ${available}`,
|
|
8727
8727
|
{ code: "personality_not_found" }
|
|
8728
8728
|
);
|
|
@@ -8743,14 +8743,14 @@ async function performPersonalitySwitch(args) {
|
|
|
8743
8743
|
|
|
8744
8744
|
// src/internal/local-agent/local-agent-personality-extensions.ts
|
|
8745
8745
|
function resolveActivePersonalityPreset(args) {
|
|
8746
|
-
const forkCtx =
|
|
8746
|
+
const forkCtx = chunk3YYDHUNH_cjs.currentPersonalityContext();
|
|
8747
8747
|
const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
|
|
8748
8748
|
if (slug === void 0) return void 0;
|
|
8749
8749
|
return args.personalityRegistry?.get(slug);
|
|
8750
8750
|
}
|
|
8751
8751
|
async function ensurePersonalityRegistryIfNeeded(args) {
|
|
8752
8752
|
if (args.personalityRegistry !== void 0) return args.personalityRegistry;
|
|
8753
|
-
const forkSlug =
|
|
8753
|
+
const forkSlug = chunk3YYDHUNH_cjs.currentPersonalityContext()?.slug;
|
|
8754
8754
|
const ownSlug = args.personalityStore.active(args.agentId);
|
|
8755
8755
|
if (forkSlug === void 0 && ownSlug === void 0) return void 0;
|
|
8756
8756
|
return await PersonalityRegistry.load(args.workspaceCwd);
|
|
@@ -8764,8 +8764,8 @@ ${preset.systemPrompt}`;
|
|
|
8764
8764
|
}
|
|
8765
8765
|
async function localAgentUsePersonality(args) {
|
|
8766
8766
|
if (args.disposed) throw new Error("Agent has been disposed");
|
|
8767
|
-
if (
|
|
8768
|
-
|
|
8767
|
+
if (chunk3YYDHUNH_cjs.currentPersonalityContext() !== void 0) {
|
|
8768
|
+
chunk3YYDHUNH_cjs.warnPersonalitySwitchInsideFork(args.agentId);
|
|
8769
8769
|
return null;
|
|
8770
8770
|
}
|
|
8771
8771
|
let registry = args.personalityRegistry;
|
|
@@ -8782,8 +8782,8 @@ async function localAgentUsePersonality(args) {
|
|
|
8782
8782
|
registry,
|
|
8783
8783
|
store: args.personalityStore,
|
|
8784
8784
|
invalidateCache: (reason) => args.invalidateCache(reason),
|
|
8785
|
-
appendSessionMessage: (msg) =>
|
|
8786
|
-
clearSession: () =>
|
|
8785
|
+
appendSessionMessage: (msg) => chunkYARJG3GV_cjs.appendSessionMessage(args.agentId, msg),
|
|
8786
|
+
clearSession: () => chunkYARJG3GV_cjs.clearSession(args.agentId),
|
|
8787
8787
|
opts: args.opts ?? {}
|
|
8788
8788
|
})
|
|
8789
8789
|
);
|
|
@@ -8794,7 +8794,7 @@ function localAgentRunUntil(agent, goal, options) {
|
|
|
8794
8794
|
async function* wrap() {
|
|
8795
8795
|
const { runUntilImpl } = await import('./run-until-U2B5FJJI.cjs');
|
|
8796
8796
|
const buildDeps = async () => {
|
|
8797
|
-
const { judgeCallImpl } = await import('./judge-call-
|
|
8797
|
+
const { judgeCallImpl } = await import('./judge-call-GVIJWQVE.cjs');
|
|
8798
8798
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
8799
8799
|
const create = getAgentFacade().create;
|
|
8800
8800
|
return {
|
|
@@ -8827,7 +8827,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
|
|
|
8827
8827
|
async function localAgentFork(parent, options) {
|
|
8828
8828
|
const { forkAgentImpl } = await import('./fork-agent-Y2IK2RYU.cjs');
|
|
8829
8829
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
8830
|
-
const { withPersonalityContext } = await import('./context-
|
|
8830
|
+
const { withPersonalityContext } = await import('./context-4HGPCOH6.cjs');
|
|
8831
8831
|
const create = getAgentFacade().create;
|
|
8832
8832
|
return withPersonalityContext(
|
|
8833
8833
|
{ slug: parent.personalitySlugSnapshot, isFork: true },
|
|
@@ -8887,7 +8887,7 @@ function wrapRunWithCompletionCheck(args) {
|
|
|
8887
8887
|
judgeOpts
|
|
8888
8888
|
);
|
|
8889
8889
|
const complete = !verdict.parseFailed && verdict.verdict === "done";
|
|
8890
|
-
|
|
8890
|
+
chunk6DCTL32L_cjs.emitRunEvent(args.onRunEvent, {
|
|
8891
8891
|
type: "completion_check",
|
|
8892
8892
|
complete,
|
|
8893
8893
|
reason: verdict.reason
|
|
@@ -9034,7 +9034,7 @@ function wrapRunWithOutputProcessors(args) {
|
|
|
9034
9034
|
if (result.status !== "finished" || result.result === void 0) return result;
|
|
9035
9035
|
const res = await runOutputProcessors(args.processors, result.result, args.agentId);
|
|
9036
9036
|
if (res.kind === "ok") return { ...result, result: res.value };
|
|
9037
|
-
|
|
9037
|
+
chunk6DCTL32L_cjs.emitRunEvent(args.onRunEvent, {
|
|
9038
9038
|
type: "tripwire",
|
|
9039
9039
|
reason: res.tripwire.reason,
|
|
9040
9040
|
processorId: res.tripwire.processorId
|
|
@@ -9109,7 +9109,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
|
|
|
9109
9109
|
}
|
|
9110
9110
|
const res = await runInputProcessors(processors, rawUserText, inputs.agentId);
|
|
9111
9111
|
if (res.kind === "tripwire") {
|
|
9112
|
-
|
|
9112
|
+
chunk6DCTL32L_cjs.emitRunEvent(options.onRunEvent, {
|
|
9113
9113
|
type: "tripwire",
|
|
9114
9114
|
reason: res.tripwire.reason,
|
|
9115
9115
|
processorId: res.tripwire.processorId
|
|
@@ -9126,7 +9126,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
|
|
|
9126
9126
|
return { userText: res.value, effectiveMessage };
|
|
9127
9127
|
}
|
|
9128
9128
|
async function executeSendLocked(inputs, message, options) {
|
|
9129
|
-
if (inputs.disposed) throw new
|
|
9129
|
+
if (inputs.disposed) throw new chunk2YGIBOUH_cjs.AgentDisposedError(inputs.agentId);
|
|
9130
9130
|
await consumePending(inputs.agentId, inputs.invalidationPending, inputs.clearInvalidation, inputs.reload);
|
|
9131
9131
|
const sendModel = normalizeModel(options.model);
|
|
9132
9132
|
inputs.applyModelOverride(sendModel);
|
|
@@ -9137,7 +9137,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9137
9137
|
if (inputs.options.onBeforeSend !== void 0) {
|
|
9138
9138
|
await inputs.options.onBeforeSend({
|
|
9139
9139
|
conversationId: inputs.agentId,
|
|
9140
|
-
previousMessageCount:
|
|
9140
|
+
previousMessageCount: chunkYARJG3GV_cjs.getSessionMessages(inputs.agentId).length
|
|
9141
9141
|
});
|
|
9142
9142
|
}
|
|
9143
9143
|
await inputs.runPreHook(userText);
|
|
@@ -9149,8 +9149,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9149
9149
|
userText,
|
|
9150
9150
|
sendOptions: options
|
|
9151
9151
|
});
|
|
9152
|
-
const priorMessages = [...
|
|
9153
|
-
|
|
9152
|
+
const priorMessages = [...chunkYARJG3GV_cjs.getSessionMessages(inputs.agentId)];
|
|
9153
|
+
chunkYARJG3GV_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
|
|
9154
9154
|
await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9155
9155
|
const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory);
|
|
9156
9156
|
const portPathActive = shouldUsePortMemoryPath();
|
|
@@ -9208,7 +9208,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9208
9208
|
function buildCompletionCheckDeps() {
|
|
9209
9209
|
return {
|
|
9210
9210
|
judge: async (ctx, opts) => {
|
|
9211
|
-
const { judgeCallImpl } = await import('./judge-call-
|
|
9211
|
+
const { judgeCallImpl } = await import('./judge-call-GVIJWQVE.cjs');
|
|
9212
9212
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
9213
9213
|
return judgeCallImpl(ctx, opts, { create: getAgentFacade().create });
|
|
9214
9214
|
}
|
|
@@ -9228,7 +9228,7 @@ function registerRunAsTask(run, agentId, taskOpt, userText) {
|
|
|
9228
9228
|
promptPreview: userText.slice(0, 120),
|
|
9229
9229
|
...opts.meta ?? {}
|
|
9230
9230
|
};
|
|
9231
|
-
void
|
|
9231
|
+
void chunk6DCTL32L_cjs.submit({
|
|
9232
9232
|
kind: "run",
|
|
9233
9233
|
work: async (ctx) => {
|
|
9234
9234
|
ctx.signal.addEventListener(
|
|
@@ -9312,7 +9312,7 @@ var LocalAgent = class {
|
|
|
9312
9312
|
this.options = options;
|
|
9313
9313
|
this.workspaceCwd = resolveCwd(options.local?.cwd);
|
|
9314
9314
|
this.transcriptBaseDir = resolveBaseDir(options.local?.baseDir);
|
|
9315
|
-
this.sessionStore = options.local?.sessionStore ?? new
|
|
9315
|
+
this.sessionStore = options.local?.sessionStore ?? new chunkOI6RHLGC_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
|
|
9316
9316
|
this.settingSourcesIncludeProject = includesSetting(options, "project");
|
|
9317
9317
|
this.settingSourcesIncludePlugins = includesSetting(options, "plugins");
|
|
9318
9318
|
const sub = bootstrapSubmanagers({
|
|
@@ -9355,14 +9355,14 @@ var LocalAgent = class {
|
|
|
9355
9355
|
if (this.pluginsManager !== void 0) await this.pluginsManager.initialize();
|
|
9356
9356
|
const codePlugins = chunkBV2MWEMV_cjs.extractCodePlugins(this.options.plugins);
|
|
9357
9357
|
await this.pluginManagerCode.initialize(codePlugins);
|
|
9358
|
-
this.resolvedSubagents = await
|
|
9358
|
+
this.resolvedSubagents = await chunkRTLUZKDL_cjs.loadSubagents(
|
|
9359
9359
|
this.workspaceCwd,
|
|
9360
9360
|
this.settingSourcesIncludeProject,
|
|
9361
9361
|
this.options.agents
|
|
9362
9362
|
);
|
|
9363
9363
|
await acquireLeaseIfPossible(this.sessionStore, this.agentId);
|
|
9364
9364
|
try {
|
|
9365
|
-
await
|
|
9365
|
+
await chunkYARJG3GV_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
|
|
9366
9366
|
await this.personalityStore.hydrate(this.agentId);
|
|
9367
9367
|
} catch (err) {
|
|
9368
9368
|
await releaseLeaseIfPossible(this.sessionStore, this.agentId);
|
|
@@ -9511,7 +9511,7 @@ var LocalAgent = class {
|
|
|
9511
9511
|
agentId: this.agentId
|
|
9512
9512
|
});
|
|
9513
9513
|
if (preRun.blocked) {
|
|
9514
|
-
throw new
|
|
9514
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
9515
9515
|
`preRun hook denied execution: ${preRun.reason ?? "unspecified"}`,
|
|
9516
9516
|
{ code: "hook_denied" }
|
|
9517
9517
|
);
|
|
@@ -9592,7 +9592,7 @@ var LocalAgent = class {
|
|
|
9592
9592
|
}
|
|
9593
9593
|
// biome-ignore format: G8 budget — see listArtifacts.
|
|
9594
9594
|
downloadArtifact(_path) {
|
|
9595
|
-
return Promise.reject(new
|
|
9595
|
+
return Promise.reject(new chunk2YGIBOUH_cjs.UnsupportedRunOperationError("Artifacts are not supported for local agents", "downloadArtifact"));
|
|
9596
9596
|
}
|
|
9597
9597
|
// biome-ignore format: G8 budget — delegates to `local-agent-runtime-extensions.ts`; kept 1-line.
|
|
9598
9598
|
runUntil(goal, options) {
|
|
@@ -9615,7 +9615,7 @@ function resolveCwd(cwd) {
|
|
|
9615
9615
|
return (Array.isArray(cwd) ? cwd[0] : cwd) ?? process.cwd();
|
|
9616
9616
|
}
|
|
9617
9617
|
function resolveBaseDir(baseDir) {
|
|
9618
|
-
return baseDir === void 0 ?
|
|
9618
|
+
return baseDir === void 0 ? chunkECPL5RV6_cjs.defaultBaseDir() : chunkECPL5RV6_cjs.expandTilde(baseDir);
|
|
9619
9619
|
}
|
|
9620
9620
|
function includesSetting(options, source) {
|
|
9621
9621
|
const sources = options.local?.settingSources;
|
|
@@ -9640,7 +9640,7 @@ async function guardAgainstIdCollision(options) {
|
|
|
9640
9640
|
const persistenceCwd = resolveAgentPersistenceCwd(options);
|
|
9641
9641
|
await hydrateRegistryFromDisk(persistenceCwd);
|
|
9642
9642
|
if (getRegisteredAgent(options.agentId) !== void 0) {
|
|
9643
|
-
throw new
|
|
9643
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
9644
9644
|
`Agent "${options.agentId}" already exists. Use Agent.resume("${options.agentId}") to reattach, or pick a different agentId.`,
|
|
9645
9645
|
{ code: "agent_id_already_exists" }
|
|
9646
9646
|
);
|
|
@@ -9673,7 +9673,7 @@ async function maybeInjectHandoffTools(options) {
|
|
|
9673
9673
|
const spec = "@theokit/sdk-handoff/internal/tool-injector";
|
|
9674
9674
|
mod = await import(spec);
|
|
9675
9675
|
} catch (err) {
|
|
9676
|
-
throw new
|
|
9676
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
9677
9677
|
"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).",
|
|
9678
9678
|
{ code: "handoff_package_missing", cause: err }
|
|
9679
9679
|
);
|
|
@@ -9693,9 +9693,9 @@ async function maybeInjectHandoffTools(options) {
|
|
|
9693
9693
|
async function createLocalAgent(options) {
|
|
9694
9694
|
const apiKey = resolveApiKey(options.apiKey);
|
|
9695
9695
|
if (apiKey === void 0) {
|
|
9696
|
-
throw new
|
|
9696
|
+
throw new chunk2YGIBOUH_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
|
|
9697
9697
|
}
|
|
9698
|
-
const willFlowToProvider = !
|
|
9698
|
+
const willFlowToProvider = !chunkZNEYQ56O_cjs.isFixtureApiKey(apiKey) && !chunkZNEYQ56O_cjs.shouldUseRealLocalRuntime(apiKey);
|
|
9699
9699
|
const shape = validateApiKeyShape(apiKey, {
|
|
9700
9700
|
strict: willFlowToProvider,
|
|
9701
9701
|
// `options.model` is already normalized by `runCreateUnderSpan`; `normalizeModel`
|
|
@@ -9704,10 +9704,10 @@ async function createLocalAgent(options) {
|
|
|
9704
9704
|
...willFlowToProvider ? { provider: providerFromModelId(normalizeModel(options.model)?.id) } : {}
|
|
9705
9705
|
});
|
|
9706
9706
|
if (shape.malformed) {
|
|
9707
|
-
throw new
|
|
9707
|
+
throw new chunk2YGIBOUH_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
9708
9708
|
}
|
|
9709
|
-
if (!
|
|
9710
|
-
throw new
|
|
9709
|
+
if (!chunkZNEYQ56O_cjs.isFixtureApiKey(apiKey) && chunkZNEYQ56O_cjs.getConfiguredBaseUrl() === void 0 && !chunkZNEYQ56O_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
9710
|
+
throw new chunk2YGIBOUH_cjs.AuthenticationError("Invalid API key", {
|
|
9711
9711
|
code: "authentication_error"
|
|
9712
9712
|
});
|
|
9713
9713
|
}
|
|
@@ -9718,19 +9718,19 @@ async function createLocalAgent(options) {
|
|
|
9718
9718
|
async function createCloudAgent(options) {
|
|
9719
9719
|
const apiKey = resolveApiKey(options.apiKey);
|
|
9720
9720
|
if (apiKey === void 0) {
|
|
9721
|
-
throw new
|
|
9721
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError("Missing API key for cloud agent", {
|
|
9722
9722
|
code: "missing_api_key"
|
|
9723
9723
|
});
|
|
9724
9724
|
}
|
|
9725
9725
|
const shape = validateApiKeyShape(apiKey);
|
|
9726
9726
|
if (shape.malformed) {
|
|
9727
|
-
throw new
|
|
9727
|
+
throw new chunk2YGIBOUH_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
9728
9728
|
}
|
|
9729
|
-
const baseUrl =
|
|
9729
|
+
const baseUrl = chunkZNEYQ56O_cjs.getConfiguredBaseUrl();
|
|
9730
9730
|
if (baseUrl === void 0) {
|
|
9731
9731
|
return new CloudAgent(options);
|
|
9732
9732
|
}
|
|
9733
|
-
const response = await
|
|
9733
|
+
const response = await chunkZNEYQ56O_cjs.httpRequest("/v1/agents", {
|
|
9734
9734
|
apiKey,
|
|
9735
9735
|
method: "POST",
|
|
9736
9736
|
body: {
|
|
@@ -9755,7 +9755,7 @@ function resolveAgentPersistenceCwd(options) {
|
|
|
9755
9755
|
return process.cwd();
|
|
9756
9756
|
}
|
|
9757
9757
|
async function rehydrateExistingAgent(agentId, existing, options) {
|
|
9758
|
-
await
|
|
9758
|
+
await chunkZNEYQ56O_cjs.discoverProviderPlugins();
|
|
9759
9759
|
await validateRehydratedAgent(agentId, existing);
|
|
9760
9760
|
const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
|
|
9761
9761
|
const mergedOptions = {
|
|
@@ -9786,7 +9786,7 @@ async function validateRehydratedAgent(agentId, entry) {
|
|
|
9786
9786
|
throw new Error(`Workspace path is not a directory: ${candidate}`);
|
|
9787
9787
|
}
|
|
9788
9788
|
} catch (cause) {
|
|
9789
|
-
throw new
|
|
9789
|
+
throw new chunk2YGIBOUH_cjs.UnknownAgentError(
|
|
9790
9790
|
`Agent "${agentId}" cannot be rehydrated \u2014 workspace cwd "${candidate}" is missing or inaccessible.`,
|
|
9791
9791
|
{ code: "agent_rehydration_failed", cause }
|
|
9792
9792
|
);
|
|
@@ -9838,7 +9838,7 @@ async function getRegisteredAgentOrThrow(agentId) {
|
|
|
9838
9838
|
agent = getRegisteredAgent(agentId);
|
|
9839
9839
|
}
|
|
9840
9840
|
if (agent === void 0) {
|
|
9841
|
-
throw new
|
|
9841
|
+
throw new chunk2YGIBOUH_cjs.UnknownAgentError(`Agent ${agentId} not found`, { code: "unknown_agent" });
|
|
9842
9842
|
}
|
|
9843
9843
|
return agent;
|
|
9844
9844
|
}
|
|
@@ -9883,7 +9883,7 @@ var Agent = class _Agent {
|
|
|
9883
9883
|
pluginCount: enabledPluginNames(options.plugins).length
|
|
9884
9884
|
});
|
|
9885
9885
|
try {
|
|
9886
|
-
await
|
|
9886
|
+
await chunkZNEYQ56O_cjs.discoverProviderPlugins();
|
|
9887
9887
|
const agent = await runCreateUnderSpan(options, span);
|
|
9888
9888
|
return agent;
|
|
9889
9889
|
} catch (err) {
|
|
@@ -9909,8 +9909,8 @@ var Agent = class _Agent {
|
|
|
9909
9909
|
const run = await agent.send(message);
|
|
9910
9910
|
const result = await run.wait();
|
|
9911
9911
|
if (options.throwOnError === true && result.status === "error" && result.error !== void 0) {
|
|
9912
|
-
throw new
|
|
9913
|
-
code:
|
|
9912
|
+
throw new chunk2YGIBOUH_cjs.AgentRunError(result.error.message, {
|
|
9913
|
+
code: chunk2YGIBOUH_cjs.coerceToKnownAgentRunErrorCode(result.error.code),
|
|
9914
9914
|
cause: result.error.cause
|
|
9915
9915
|
});
|
|
9916
9916
|
}
|
|
@@ -9937,7 +9937,7 @@ var Agent = class _Agent {
|
|
|
9937
9937
|
if (existing !== void 0) {
|
|
9938
9938
|
return await rehydrateExistingAgent(agentId, existing, options);
|
|
9939
9939
|
}
|
|
9940
|
-
throw new
|
|
9940
|
+
throw new chunk2YGIBOUH_cjs.UnknownAgentError(
|
|
9941
9941
|
`Agent "${agentId}" not found. Use Agent.create({ agentId, ... }) for first-time setup, or catch UnknownAgentError to branch resume-vs-create.`,
|
|
9942
9942
|
{ code: "unknown_agent" }
|
|
9943
9943
|
);
|
|
@@ -9966,7 +9966,7 @@ var Agent = class _Agent {
|
|
|
9966
9966
|
* @public
|
|
9967
9967
|
*/
|
|
9968
9968
|
static async generateObject(options) {
|
|
9969
|
-
const { generateObjectImpl } = await import('./generate-object-
|
|
9969
|
+
const { generateObjectImpl } = await import('./generate-object-E465DX5I.cjs');
|
|
9970
9970
|
return generateObjectImpl(options, {
|
|
9971
9971
|
create: (opts) => _Agent.create(opts),
|
|
9972
9972
|
delete: (agentId) => _Agent.delete(agentId)
|
|
@@ -9990,7 +9990,7 @@ var Agent = class _Agent {
|
|
|
9990
9990
|
delete: (agentId) => _Agent.delete(agentId)
|
|
9991
9991
|
};
|
|
9992
9992
|
async function* wrapper() {
|
|
9993
|
-
streamObjectImport ??= import('./stream-object-
|
|
9993
|
+
streamObjectImport ??= import('./stream-object-T4DAMNVB.cjs');
|
|
9994
9994
|
const { streamObjectImpl } = await streamObjectImport;
|
|
9995
9995
|
yield* streamObjectImpl(options, deps);
|
|
9996
9996
|
}
|
|
@@ -10014,7 +10014,7 @@ var Agent = class _Agent {
|
|
|
10014
10014
|
* @public
|
|
10015
10015
|
*/
|
|
10016
10016
|
static async batch(prompts, options) {
|
|
10017
|
-
const { batchImpl } = await import('./batch-
|
|
10017
|
+
const { batchImpl } = await import('./batch-WQ3AJCDV.cjs');
|
|
10018
10018
|
return batchImpl(prompts, options, { create: (opts) => _Agent.create(opts) });
|
|
10019
10019
|
}
|
|
10020
10020
|
/**
|
|
@@ -10094,14 +10094,14 @@ var Agent = class _Agent {
|
|
|
10094
10094
|
*/
|
|
10095
10095
|
static async getRun(runId, options = {}) {
|
|
10096
10096
|
if (options.runtime === "cloud") {
|
|
10097
|
-
throw new
|
|
10097
|
+
throw new chunk2YGIBOUH_cjs.ConfigurationError(
|
|
10098
10098
|
"Cloud runtime is pre-release. Theo PaaS endpoints are not wired yet \u2014 getRun({ runtime: 'cloud' }) will be enabled when the PaaS ships.",
|
|
10099
10099
|
{ code: "cloud_runtime_pre_release" }
|
|
10100
10100
|
);
|
|
10101
10101
|
}
|
|
10102
10102
|
const existing = getRun(runId);
|
|
10103
10103
|
if (existing !== void 0) return existing;
|
|
10104
|
-
throw new
|
|
10104
|
+
throw new chunk2YGIBOUH_cjs.UnknownAgentError(
|
|
10105
10105
|
`Run ${runId} is not in this process's registry. It may have been disposed, persisted in a previous process, or never created.`,
|
|
10106
10106
|
{ code: "run_not_found" }
|
|
10107
10107
|
);
|
|
@@ -10148,13 +10148,13 @@ var Agent = class _Agent {
|
|
|
10148
10148
|
reg = getRegisteredAgent(agentId);
|
|
10149
10149
|
}
|
|
10150
10150
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
10151
|
-
throw new
|
|
10151
|
+
throw new chunk2YGIBOUH_cjs.UnknownAgentError(
|
|
10152
10152
|
`No local agent "${agentId}" registered \u2014 compact targets local sessions.`
|
|
10153
10153
|
);
|
|
10154
10154
|
}
|
|
10155
|
-
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-
|
|
10155
|
+
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-AXKDB6FC.cjs');
|
|
10156
10156
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
10157
|
-
return
|
|
10157
|
+
return chunkYARJG3GV_cjs.enqueueSessionWrite(
|
|
10158
10158
|
cwd,
|
|
10159
10159
|
agentId,
|
|
10160
10160
|
() => compactSessionTranscript({
|
|
@@ -10184,11 +10184,11 @@ var Agent = class _Agent {
|
|
|
10184
10184
|
reg = getRegisteredAgent(agentId);
|
|
10185
10185
|
}
|
|
10186
10186
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
10187
|
-
throw new
|
|
10187
|
+
throw new chunk2YGIBOUH_cjs.UnknownAgentError(
|
|
10188
10188
|
`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
|
|
10189
10189
|
);
|
|
10190
10190
|
}
|
|
10191
|
-
const { injectSessionTurn } = await import('./inject-session-
|
|
10191
|
+
const { injectSessionTurn } = await import('./inject-session-TASLP5FA.cjs');
|
|
10192
10192
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
10193
10193
|
await injectSessionTurn({
|
|
10194
10194
|
store,
|
|
@@ -10223,11 +10223,11 @@ var Agent = class _Agent {
|
|
|
10223
10223
|
reg = getRegisteredAgent(agentId);
|
|
10224
10224
|
}
|
|
10225
10225
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
10226
|
-
throw new
|
|
10226
|
+
throw new chunk2YGIBOUH_cjs.UnknownAgentError(
|
|
10227
10227
|
`No local agent "${agentId}" registered \u2014 transcript targets local sessions.`
|
|
10228
10228
|
);
|
|
10229
10229
|
}
|
|
10230
|
-
const { readSessionMessages } = await import('./agent-session-store-
|
|
10230
|
+
const { readSessionMessages } = await import('./agent-session-store-EPX2WQI4.cjs');
|
|
10231
10231
|
const { store } = await openLocalStore(reg);
|
|
10232
10232
|
return readSessionMessages(store, agentId);
|
|
10233
10233
|
}
|
|
@@ -10248,7 +10248,7 @@ var Agent = class _Agent {
|
|
|
10248
10248
|
*/
|
|
10249
10249
|
static async describe(agentId) {
|
|
10250
10250
|
const agent = await getRegisteredAgentOrThrow(agentId);
|
|
10251
|
-
const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-
|
|
10251
|
+
const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-3CXBQWWY.cjs');
|
|
10252
10252
|
const settingSources = agent.options.local?.settingSources;
|
|
10253
10253
|
const subagents = await loadSubagents2(
|
|
10254
10254
|
agent.cwd ?? process.cwd(),
|
|
@@ -10292,12 +10292,12 @@ async function getOrCreateUncached(agentId, options) {
|
|
|
10292
10292
|
try {
|
|
10293
10293
|
return await Agent.resume(agentId, options);
|
|
10294
10294
|
} catch (err) {
|
|
10295
|
-
if (!(err instanceof
|
|
10295
|
+
if (!(err instanceof chunk2YGIBOUH_cjs.UnknownAgentError)) throw err;
|
|
10296
10296
|
}
|
|
10297
10297
|
try {
|
|
10298
10298
|
return await Agent.create({ ...options, agentId });
|
|
10299
10299
|
} catch (err) {
|
|
10300
|
-
if (err instanceof
|
|
10300
|
+
if (err instanceof chunk2YGIBOUH_cjs.ConfigurationError && err.code === "agent_id_already_exists") {
|
|
10301
10301
|
return await Agent.resume(agentId, options);
|
|
10302
10302
|
}
|
|
10303
10303
|
throw err;
|
|
@@ -10315,8 +10315,8 @@ async function openLocalStore(reg) {
|
|
|
10315
10315
|
const cwd = reg.cwd ?? process.cwd();
|
|
10316
10316
|
const optModel = reg.options.model;
|
|
10317
10317
|
const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
|
|
10318
|
-
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-
|
|
10319
|
-
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-
|
|
10318
|
+
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-TL4RJTXZ.cjs');
|
|
10319
|
+
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-TNAJ4O3M.cjs');
|
|
10320
10320
|
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
10321
10321
|
return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
|
|
10322
10322
|
}
|
|
@@ -10333,5 +10333,5 @@ exports.generateCronId = generateCronId;
|
|
|
10333
10333
|
exports.getPricingEntry = getPricingEntry;
|
|
10334
10334
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
10335
10335
|
exports.resolveApiKey = resolveApiKey;
|
|
10336
|
-
//# sourceMappingURL=chunk-
|
|
10337
|
-
//# sourceMappingURL=chunk-
|
|
10336
|
+
//# sourceMappingURL=chunk-LLK2RS6I.cjs.map
|
|
10337
|
+
//# sourceMappingURL=chunk-LLK2RS6I.cjs.map
|