@theokit/sdk 4.39.0 → 4.39.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +61 -0
- package/dist/agent-KGKKAGXY.js +46 -0
- package/dist/{agent-KKZYLY5D.js.map → agent-KGKKAGXY.js.map} +1 -1
- package/dist/agent-TOWHPM7B.cjs +55 -0
- package/dist/{agent-I3EZZR6S.cjs.map → agent-TOWHPM7B.cjs.map} +1 -1
- package/dist/agent-session-store-EGTTYSKS.js +6 -0
- package/dist/{agent-session-store-RHMHP5DG.js.map → agent-session-store-EGTTYSKS.js.map} +1 -1
- package/dist/agent-session-store-RHTLZ5OX.cjs +23 -0
- package/dist/{agent-session-store-N4TVKHBU.cjs.map → agent-session-store-RHTLZ5OX.cjs.map} +1 -1
- package/dist/auth/index.cjs +15 -15
- package/dist/auth/index.js +4 -4
- package/dist/{batch-X6JKGDPK.cjs → batch-FO2KZN7W.cjs} +26 -26
- package/dist/{batch-X6JKGDPK.cjs.map → batch-FO2KZN7W.cjs.map} +1 -1
- package/dist/{batch-6KQM3EBA.js → batch-WX2HLXX2.js} +9 -9
- package/dist/{batch-6KQM3EBA.js.map → batch-WX2HLXX2.js.map} +1 -1
- package/dist/{chunk-ECHGWE47.cjs → chunk-27E4EMR6.cjs} +4 -4
- package/dist/{chunk-ECHGWE47.cjs.map → chunk-27E4EMR6.cjs.map} +1 -1
- package/dist/{chunk-DGLLVCNB.cjs → chunk-33B2BSME.cjs} +4 -4
- package/dist/{chunk-DGLLVCNB.cjs.map → chunk-33B2BSME.cjs.map} +1 -1
- package/dist/{chunk-KE6XKRLQ.js → chunk-3CAQCFVZ.js} +3 -3
- package/dist/{chunk-KE6XKRLQ.js.map → chunk-3CAQCFVZ.js.map} +1 -1
- package/dist/{chunk-XYOHKCYG.cjs → chunk-3LK3ZDL5.cjs} +5 -5
- package/dist/{chunk-XYOHKCYG.cjs.map → chunk-3LK3ZDL5.cjs.map} +1 -1
- package/dist/{chunk-I53ZQHU6.cjs → chunk-4E3HLSYE.cjs} +4 -4
- package/dist/{chunk-I53ZQHU6.cjs.map → chunk-4E3HLSYE.cjs.map} +1 -1
- package/dist/{chunk-AR5MQZ3J.js → chunk-4GGXF7YM.js} +3 -3
- package/dist/{chunk-AR5MQZ3J.js.map → chunk-4GGXF7YM.js.map} +1 -1
- package/dist/{chunk-4JSZYSGW.js → chunk-4H2DCO6P.js} +3 -3
- package/dist/{chunk-4JSZYSGW.js.map → chunk-4H2DCO6P.js.map} +1 -1
- package/dist/{chunk-75DSEWTJ.cjs → chunk-4H2QARXM.cjs} +7 -7
- package/dist/{chunk-75DSEWTJ.cjs.map → chunk-4H2QARXM.cjs.map} +1 -1
- package/dist/{chunk-JZUPMTJY.js → chunk-4HKAZRTC.js} +3 -3
- package/dist/{chunk-JZUPMTJY.js.map → chunk-4HKAZRTC.js.map} +1 -1
- package/dist/{chunk-CEIHCKTO.cjs → chunk-5COPO3H4.cjs} +4 -4
- package/dist/{chunk-CEIHCKTO.cjs.map → chunk-5COPO3H4.cjs.map} +1 -1
- package/dist/{chunk-KX7JV5KM.js → chunk-5XPKYDK7.js} +3 -3
- package/dist/{chunk-KX7JV5KM.js.map → chunk-5XPKYDK7.js.map} +1 -1
- package/dist/{chunk-E2FFG33C.js → chunk-7HP6N5X3.js} +5 -5
- package/dist/{chunk-E2FFG33C.js.map → chunk-7HP6N5X3.js.map} +1 -1
- package/dist/{chunk-3I4B3OIX.js → chunk-7PBAJ2WA.js} +3 -3
- package/dist/{chunk-3I4B3OIX.js.map → chunk-7PBAJ2WA.js.map} +1 -1
- package/dist/{chunk-KGRIHEDT.js → chunk-7WXT5M6P.js} +5 -5
- package/dist/{chunk-KGRIHEDT.js.map → chunk-7WXT5M6P.js.map} +1 -1
- package/dist/{chunk-BCQ3E2ZG.cjs → chunk-A76OFN2B.cjs} +8 -4
- package/dist/chunk-A76OFN2B.cjs.map +1 -0
- package/dist/{chunk-TOTP24P6.js → chunk-AFJAQ5JV.js} +4 -4
- package/dist/{chunk-TOTP24P6.js.map → chunk-AFJAQ5JV.js.map} +1 -1
- package/dist/{chunk-DKFGUOWL.js → chunk-AKMPQJPX.js} +3 -3
- package/dist/{chunk-DKFGUOWL.js.map → chunk-AKMPQJPX.js.map} +1 -1
- package/dist/{chunk-HIQFVHC6.cjs → chunk-ALDFVGQQ.cjs} +9 -9
- package/dist/{chunk-HIQFVHC6.cjs.map → chunk-ALDFVGQQ.cjs.map} +1 -1
- package/dist/{chunk-INSFS5GT.cjs → chunk-AYDSWY35.cjs} +293 -293
- package/dist/{chunk-INSFS5GT.cjs.map → chunk-AYDSWY35.cjs.map} +1 -1
- package/dist/{chunk-YRXY2A5L.js → chunk-BBMN4O6E.js} +4 -4
- package/dist/{chunk-YRXY2A5L.js.map → chunk-BBMN4O6E.js.map} +1 -1
- package/dist/{chunk-6EEYRFJC.js → chunk-BM7VYZED.js} +5 -5
- package/dist/{chunk-6EEYRFJC.js.map → chunk-BM7VYZED.js.map} +1 -1
- package/dist/{chunk-ML5A5DOJ.js → chunk-C64E2EJS.js} +4 -4
- package/dist/{chunk-ML5A5DOJ.js.map → chunk-C64E2EJS.js.map} +1 -1
- package/dist/{chunk-E4IUN3JB.cjs → chunk-CJHBSSAF.cjs} +15 -15
- package/dist/{chunk-E4IUN3JB.cjs.map → chunk-CJHBSSAF.cjs.map} +1 -1
- package/dist/{chunk-IHFNRNTJ.cjs → chunk-E7WWIX34.cjs} +8 -8
- package/dist/{chunk-IHFNRNTJ.cjs.map → chunk-E7WWIX34.cjs.map} +1 -1
- package/dist/{chunk-C7OP3FAK.cjs → chunk-EJNFZET4.cjs} +11 -11
- package/dist/{chunk-C7OP3FAK.cjs.map → chunk-EJNFZET4.cjs.map} +1 -1
- package/dist/{chunk-ECW2MLEW.cjs → chunk-ELYGL52R.cjs} +4 -4
- package/dist/{chunk-ECW2MLEW.cjs.map → chunk-ELYGL52R.cjs.map} +1 -1
- package/dist/{chunk-GIRD3RWH.js → chunk-ERBH54V3.js} +35 -35
- package/dist/{chunk-GIRD3RWH.js.map → chunk-ERBH54V3.js.map} +1 -1
- package/dist/{chunk-JRLXEYR4.js → chunk-EYUZZXHZ.js} +4 -4
- package/dist/{chunk-JRLXEYR4.js.map → chunk-EYUZZXHZ.js.map} +1 -1
- package/dist/{chunk-PI4RO4GR.js → chunk-F4SQTWVR.js} +3 -3
- package/dist/{chunk-PI4RO4GR.js.map → chunk-F4SQTWVR.js.map} +1 -1
- package/dist/{chunk-LALG2K33.cjs → chunk-FMDZZRYE.cjs} +8 -8
- package/dist/{chunk-LALG2K33.cjs.map → chunk-FMDZZRYE.cjs.map} +1 -1
- package/dist/{chunk-SCFW5MJZ.js → chunk-FUP3ZA5T.js} +4 -4
- package/dist/{chunk-SCFW5MJZ.js.map → chunk-FUP3ZA5T.js.map} +1 -1
- package/dist/{chunk-DWY25VLP.cjs → chunk-H2V6CXM7.cjs} +9 -9
- package/dist/{chunk-DWY25VLP.cjs.map → chunk-H2V6CXM7.cjs.map} +1 -1
- package/dist/{chunk-DU7DE543.js → chunk-HCRCNI7A.js} +3 -3
- package/dist/{chunk-DU7DE543.js.map → chunk-HCRCNI7A.js.map} +1 -1
- package/dist/{chunk-QKE556YD.js → chunk-HJMFPIRM.js} +5 -5
- package/dist/{chunk-QKE556YD.js.map → chunk-HJMFPIRM.js.map} +1 -1
- package/dist/{chunk-J3UK2GMN.js → chunk-IEKSEAIV.js} +3 -3
- package/dist/{chunk-J3UK2GMN.js.map → chunk-IEKSEAIV.js.map} +1 -1
- package/dist/{chunk-DMTZ3FII.cjs → chunk-JERO4TP6.cjs} +5 -5
- package/dist/{chunk-DMTZ3FII.cjs.map → chunk-JERO4TP6.cjs.map} +1 -1
- package/dist/{chunk-6LGQECT7.cjs → chunk-K6TWHNT4.cjs} +11 -11
- package/dist/{chunk-6LGQECT7.cjs.map → chunk-K6TWHNT4.cjs.map} +1 -1
- package/dist/{chunk-4F7JQZOX.js → chunk-KRPEPZQY.js} +7 -7
- package/dist/{chunk-4F7JQZOX.js.map → chunk-KRPEPZQY.js.map} +1 -1
- package/dist/{chunk-CN6UX5EV.cjs → chunk-LNTQRD23.cjs} +26 -26
- package/dist/{chunk-CN6UX5EV.cjs.map → chunk-LNTQRD23.cjs.map} +1 -1
- package/dist/{chunk-W4WKVOOQ.cjs → chunk-LOTWA65Z.cjs} +11 -11
- package/dist/{chunk-W4WKVOOQ.cjs.map → chunk-LOTWA65Z.cjs.map} +1 -1
- package/dist/{chunk-BPN5ONSW.cjs → chunk-LR3VKB7A.cjs} +124 -120
- package/dist/chunk-LR3VKB7A.cjs.map +1 -0
- package/dist/{chunk-ET6PHZRX.js → chunk-LWVKI75U.js} +3 -3
- package/dist/{chunk-ET6PHZRX.js.map → chunk-LWVKI75U.js.map} +1 -1
- package/dist/{chunk-G2Q3ZC6C.cjs → chunk-LY4KEOOY.cjs} +4 -4
- package/dist/{chunk-G2Q3ZC6C.cjs.map → chunk-LY4KEOOY.cjs.map} +1 -1
- package/dist/{chunk-42IFCKQZ.js → chunk-LYD3ALDT.js} +5 -5
- package/dist/{chunk-42IFCKQZ.js.map → chunk-LYD3ALDT.js.map} +1 -1
- package/dist/{chunk-KWUNN5J2.js → chunk-MDN44YMZ.js} +5 -5
- package/dist/{chunk-KWUNN5J2.js.map → chunk-MDN44YMZ.js.map} +1 -1
- package/dist/{chunk-HWNVAUK4.js → chunk-MI3OKONE.js} +3 -3
- package/dist/{chunk-HWNVAUK4.js.map → chunk-MI3OKONE.js.map} +1 -1
- package/dist/{chunk-VJYSQXN6.cjs → chunk-MM2JKFQV.cjs} +10 -10
- package/dist/{chunk-VJYSQXN6.cjs.map → chunk-MM2JKFQV.cjs.map} +1 -1
- package/dist/{chunk-74D7KSBP.cjs → chunk-MWVLE5RY.cjs} +11 -11
- package/dist/{chunk-74D7KSBP.cjs.map → chunk-MWVLE5RY.cjs.map} +1 -1
- package/dist/{chunk-V2RBCCN5.js → chunk-NHXPQN44.js} +3 -3
- package/dist/{chunk-V2RBCCN5.js.map → chunk-NHXPQN44.js.map} +1 -1
- package/dist/{chunk-Z2CUEBXV.cjs → chunk-NJVV5OAV.cjs} +8 -8
- package/dist/{chunk-Z2CUEBXV.cjs.map → chunk-NJVV5OAV.cjs.map} +1 -1
- package/dist/{chunk-J6T5LWJ4.cjs → chunk-OVGNXGCK.cjs} +9 -9
- package/dist/{chunk-J6T5LWJ4.cjs.map → chunk-OVGNXGCK.cjs.map} +1 -1
- package/dist/{chunk-TIMPJL5V.cjs → chunk-PDOLUFGY.cjs} +4 -4
- package/dist/{chunk-TIMPJL5V.cjs.map → chunk-PDOLUFGY.cjs.map} +1 -1
- package/dist/{chunk-FWBSDQZ7.cjs → chunk-PIBXDEZM.cjs} +5 -5
- package/dist/{chunk-FWBSDQZ7.cjs.map → chunk-PIBXDEZM.cjs.map} +1 -1
- package/dist/{chunk-USZTVNUQ.cjs → chunk-PY7G7YWK.cjs} +5 -5
- package/dist/{chunk-USZTVNUQ.cjs.map → chunk-PY7G7YWK.cjs.map} +1 -1
- package/dist/{chunk-N475ETD6.cjs → chunk-QMIG7TKG.cjs} +17 -17
- package/dist/{chunk-N475ETD6.cjs.map → chunk-QMIG7TKG.cjs.map} +1 -1
- package/dist/{chunk-D7IULBF2.js → chunk-RA2UZBYP.js} +3 -3
- package/dist/{chunk-D7IULBF2.js.map → chunk-RA2UZBYP.js.map} +1 -1
- package/dist/{chunk-7OLG7VI4.cjs → chunk-RHQJX3EI.cjs} +4 -4
- package/dist/{chunk-7OLG7VI4.cjs.map → chunk-RHQJX3EI.cjs.map} +1 -1
- package/dist/{chunk-YP67XZES.js → chunk-RMCHJZNZ.js} +4 -4
- package/dist/{chunk-YP67XZES.js.map → chunk-RMCHJZNZ.js.map} +1 -1
- package/dist/{chunk-ZYB6B7QJ.js → chunk-RMO7HAIF.js} +13 -9
- package/dist/chunk-RMO7HAIF.js.map +1 -0
- package/dist/{chunk-IVSD7L22.js → chunk-RNCN2TTP.js} +8 -4
- package/dist/chunk-RNCN2TTP.js.map +1 -0
- package/dist/{chunk-BQDUEG4C.js → chunk-RTDT2UMT.js} +3 -3
- package/dist/{chunk-BQDUEG4C.js.map → chunk-RTDT2UMT.js.map} +1 -1
- package/dist/{chunk-FRUBE44B.cjs → chunk-TZ47DTM2.cjs} +24 -24
- package/dist/{chunk-FRUBE44B.cjs.map → chunk-TZ47DTM2.cjs.map} +1 -1
- package/dist/{chunk-6YNYA7GD.cjs → chunk-U53AYSHS.cjs} +11 -11
- package/dist/{chunk-6YNYA7GD.cjs.map → chunk-U53AYSHS.cjs.map} +1 -1
- package/dist/{chunk-G4XUXSRN.cjs → chunk-UDSGSPUY.cjs} +12 -12
- package/dist/{chunk-G4XUXSRN.cjs.map → chunk-UDSGSPUY.cjs.map} +1 -1
- package/dist/{chunk-LJX2SQV2.js → chunk-UIPTINIF.js} +6 -6
- package/dist/{chunk-LJX2SQV2.js.map → chunk-UIPTINIF.js.map} +1 -1
- package/dist/{chunk-6NEHIHFU.cjs → chunk-V7CA3CX5.cjs} +4 -4
- package/dist/{chunk-6NEHIHFU.cjs.map → chunk-V7CA3CX5.cjs.map} +1 -1
- package/dist/{chunk-SG5ZWT6C.js → chunk-VQ33XLC6.js} +3 -3
- package/dist/{chunk-SG5ZWT6C.js.map → chunk-VQ33XLC6.js.map} +1 -1
- package/dist/{chunk-AECV3G5Z.js → chunk-VTDQRUAJ.js} +4 -4
- package/dist/{chunk-AECV3G5Z.js.map → chunk-VTDQRUAJ.js.map} +1 -1
- package/dist/{chunk-MC5EINBV.js → chunk-WJOLIPEM.js} +8 -8
- package/dist/{chunk-MC5EINBV.js.map → chunk-WJOLIPEM.js.map} +1 -1
- package/dist/{chunk-7U2HAAWB.cjs → chunk-X2LDDKFM.cjs} +10 -10
- package/dist/{chunk-7U2HAAWB.cjs.map → chunk-X2LDDKFM.cjs.map} +1 -1
- package/dist/{chunk-LGILIGV3.js → chunk-XKGOIGTJ.js} +3 -3
- package/dist/{chunk-LGILIGV3.js.map → chunk-XKGOIGTJ.js.map} +1 -1
- package/dist/{chunk-65ONFZWM.js → chunk-XZ7PO2FM.js} +4 -4
- package/dist/{chunk-65ONFZWM.js.map → chunk-XZ7PO2FM.js.map} +1 -1
- package/dist/{chunk-DCXRHCZJ.cjs → chunk-Z5DYGBPV.cjs} +8 -8
- package/dist/{chunk-DCXRHCZJ.cjs.map → chunk-Z5DYGBPV.cjs.map} +1 -1
- package/dist/{chunk-7YBJZS5P.cjs → chunk-ZAKTZ5B4.cjs} +8 -8
- package/dist/{chunk-7YBJZS5P.cjs.map → chunk-ZAKTZ5B4.cjs.map} +1 -1
- package/dist/compact-session-FCEFK2CG.cjs +55 -0
- package/dist/{compact-session-VVT6IBJG.cjs.map → compact-session-FCEFK2CG.cjs.map} +1 -1
- package/dist/compact-session-KPYRNTQN.js +18 -0
- package/dist/{compact-session-PYEC3NZV.js.map → compact-session-KPYRNTQN.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-DNFT4B5D.cjs +22 -0
- package/dist/{context-2FZSC6VQ.cjs.map → context-DNFT4B5D.cjs.map} +1 -1
- package/dist/context-LYE6TJL5.js +5 -0
- package/dist/{context-ATJJAFOS.js.map → context-LYE6TJL5.js.map} +1 -1
- package/dist/cron.cjs +31 -31
- package/dist/cron.js +30 -30
- package/dist/errors.cjs +21 -21
- package/dist/errors.js +2 -2
- package/dist/eval.cjs +36 -36
- package/dist/eval.js +30 -30
- package/dist/{executor-T65PPOPT.js → executor-PCRX3533.js} +7 -7
- package/dist/{executor-T65PPOPT.js.map → executor-PCRX3533.js.map} +1 -1
- package/dist/{executor-BMRICN46.cjs → executor-TQ3FSZ7F.cjs} +24 -24
- package/dist/{executor-BMRICN46.cjs.map → executor-TQ3FSZ7F.cjs.map} +1 -1
- package/dist/filesystem/index.cjs +7 -7
- package/dist/filesystem/index.js +3 -3
- package/dist/fs-session-store-V32XJ63Z.cjs +19 -0
- package/dist/{fs-session-store-J5MCFFUM.cjs.map → fs-session-store-V32XJ63Z.cjs.map} +1 -1
- package/dist/fs-session-store-YPZIOLJM.js +10 -0
- package/dist/{fs-session-store-O6FNHECD.js.map → fs-session-store-YPZIOLJM.js.map} +1 -1
- package/dist/generate-object-DLHT5RXH.js +7 -0
- package/dist/{generate-object-XDCBYVK3.js.map → generate-object-DLHT5RXH.js.map} +1 -1
- package/dist/generate-object-QILSGTEJ.cjs +20 -0
- package/dist/{generate-object-UF6WIZLF.cjs.map → generate-object-QILSGTEJ.cjs.map} +1 -1
- package/dist/index-manager-LEMQ73A7.cjs +20 -0
- package/dist/{index-manager-N7RQYUKT.cjs.map → index-manager-LEMQ73A7.cjs.map} +1 -1
- package/dist/index-manager-SXF3FAQV.js +11 -0
- package/dist/{index-manager-ZVZUHPP7.js.map → index-manager-SXF3FAQV.js.map} +1 -1
- package/dist/index.cjs +129 -129
- package/dist/index.js +43 -43
- package/dist/{inject-session-LFCYVSLJ.cjs → inject-session-BIVVFWGL.cjs} +9 -9
- package/dist/{inject-session-LFCYVSLJ.cjs.map → inject-session-BIVVFWGL.cjs.map} +1 -1
- package/dist/{inject-session-GQMTDZUN.js → inject-session-OLWZ2NJN.js} +7 -7
- package/dist/{inject-session-GQMTDZUN.js.map → inject-session-OLWZ2NJN.js.map} +1 -1
- 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-AIT3EULV.cjs +22 -0
- package/dist/{judge-call-U2D33JOW.cjs.map → judge-call-AIT3EULV.cjs.map} +1 -1
- package/dist/judge-call-NPRU7JIQ.js +5 -0
- package/dist/{judge-call-NA2G6ZMJ.js.map → judge-call-NPRU7JIQ.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 +26 -26
- package/dist/persistence.js +7 -7
- package/dist/project.cjs +5 -5
- package/dist/project.js +3 -3
- package/dist/registry-AXQXPLFH.js +9 -0
- package/dist/{registry-CAS6Y5ZY.js.map → registry-AXQXPLFH.js.map} +1 -1
- package/dist/registry-VKDFTK6L.cjs +46 -0
- package/dist/{registry-JSDI4WKA.cjs.map → registry-VKDFTK6L.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-SLQRKQ72.cjs +50 -0
- package/dist/{session-transcript-H7NUFXXM.cjs.map → session-transcript-SLQRKQ72.cjs.map} +1 -1
- package/dist/session-transcript-X3UMSVL2.js +5 -0
- package/dist/{session-transcript-3B52DKTG.js.map → session-transcript-X3UMSVL2.js.map} +1 -1
- package/dist/skills.cjs +7 -7
- package/dist/skills.js +5 -5
- package/dist/stream-object-3HEUGMQY.cjs +20 -0
- package/dist/{stream-object-4FDU76YW.cjs.map → stream-object-3HEUGMQY.cjs.map} +1 -1
- package/dist/stream-object-VWYW7FJ2.js +7 -0
- package/dist/{stream-object-HWDEEQN4.js.map → stream-object-VWYW7FJ2.js.map} +1 -1
- package/dist/subagents-loader-F52ARQ62.cjs +15 -0
- package/dist/{subagents-loader-A4W6C3QP.cjs.map → subagents-loader-F52ARQ62.cjs.map} +1 -1
- package/dist/subagents-loader-QUIK6GMV.js +6 -0
- package/dist/{subagents-loader-X33KH2SZ.js.map → subagents-loader-QUIK6GMV.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-I3EZZR6S.cjs +0 -55
- package/dist/agent-KKZYLY5D.js +0 -46
- package/dist/agent-session-store-N4TVKHBU.cjs +0 -23
- package/dist/agent-session-store-RHMHP5DG.js +0 -6
- package/dist/chunk-BCQ3E2ZG.cjs.map +0 -1
- package/dist/chunk-BPN5ONSW.cjs.map +0 -1
- package/dist/chunk-IVSD7L22.js.map +0 -1
- package/dist/chunk-ZYB6B7QJ.js.map +0 -1
- package/dist/compact-session-PYEC3NZV.js +0 -18
- package/dist/compact-session-VVT6IBJG.cjs +0 -55
- package/dist/context-2FZSC6VQ.cjs +0 -22
- package/dist/context-ATJJAFOS.js +0 -5
- package/dist/fs-session-store-J5MCFFUM.cjs +0 -19
- package/dist/fs-session-store-O6FNHECD.js +0 -10
- package/dist/generate-object-UF6WIZLF.cjs +0 -20
- package/dist/generate-object-XDCBYVK3.js +0 -7
- package/dist/index-manager-N7RQYUKT.cjs +0 -20
- package/dist/index-manager-ZVZUHPP7.js +0 -11
- package/dist/judge-call-NA2G6ZMJ.js +0 -5
- package/dist/judge-call-U2D33JOW.cjs +0 -22
- package/dist/registry-CAS6Y5ZY.js +0 -9
- package/dist/registry-JSDI4WKA.cjs +0 -46
- package/dist/session-transcript-3B52DKTG.js +0 -5
- package/dist/session-transcript-H7NUFXXM.cjs +0 -50
- package/dist/stream-object-4FDU76YW.cjs +0 -20
- package/dist/stream-object-HWDEEQN4.js +0 -7
- package/dist/subagents-loader-A4W6C3QP.cjs +0 -15
- package/dist/subagents-loader-X33KH2SZ.js +0 -6
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
4
|
+
var chunkQMIG7TKG_cjs = require('./chunk-QMIG7TKG.cjs');
|
|
5
|
+
var chunkZ5DYGBPV_cjs = require('./chunk-Z5DYGBPV.cjs');
|
|
6
|
+
var chunkMWVLE5RY_cjs = require('./chunk-MWVLE5RY.cjs');
|
|
7
|
+
var chunkLR3VKB7A_cjs = require('./chunk-LR3VKB7A.cjs');
|
|
8
|
+
var chunkLNTQRD23_cjs = require('./chunk-LNTQRD23.cjs');
|
|
9
|
+
var chunkK6TWHNT4_cjs = require('./chunk-K6TWHNT4.cjs');
|
|
10
10
|
var chunkWPZTYOUX_cjs = require('./chunk-WPZTYOUX.cjs');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
11
|
+
var chunkFMDZZRYE_cjs = require('./chunk-FMDZZRYE.cjs');
|
|
12
|
+
var chunkX2LDDKFM_cjs = require('./chunk-X2LDDKFM.cjs');
|
|
13
13
|
var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
|
|
14
14
|
var chunkB4YA6BRS_cjs = require('./chunk-B4YA6BRS.cjs');
|
|
15
15
|
var chunkNINIJCHU_cjs = require('./chunk-NINIJCHU.cjs');
|
|
16
16
|
var chunkYPEPCZHF_cjs = require('./chunk-YPEPCZHF.cjs');
|
|
17
17
|
var chunkVJ26EKGJ_cjs = require('./chunk-VJ26EKGJ.cjs');
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
18
|
+
var chunkRHQJX3EI_cjs = require('./chunk-RHQJX3EI.cjs');
|
|
19
|
+
var chunkNJVV5OAV_cjs = require('./chunk-NJVV5OAV.cjs');
|
|
20
|
+
var chunkJERO4TP6_cjs = require('./chunk-JERO4TP6.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 chunk33B2BSME_cjs = require('./chunk-33B2BSME.cjs');
|
|
24
|
+
var chunkLOTWA65Z_cjs = require('./chunk-LOTWA65Z.cjs');
|
|
25
|
+
var chunkOVGNXGCK_cjs = require('./chunk-OVGNXGCK.cjs');
|
|
26
26
|
var chunkVYHJZVL5_cjs = require('./chunk-VYHJZVL5.cjs');
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
27
|
+
var chunkUDSGSPUY_cjs = require('./chunk-UDSGSPUY.cjs');
|
|
28
|
+
var chunkCJHBSSAF_cjs = require('./chunk-CJHBSSAF.cjs');
|
|
29
|
+
var chunkZAKTZ5B4_cjs = require('./chunk-ZAKTZ5B4.cjs');
|
|
30
|
+
var chunkLY4KEOOY_cjs = require('./chunk-LY4KEOOY.cjs');
|
|
31
|
+
var chunkE7WWIX34_cjs = require('./chunk-E7WWIX34.cjs');
|
|
32
|
+
var chunkA76OFN2B_cjs = require('./chunk-A76OFN2B.cjs');
|
|
33
33
|
var promises = require('fs/promises');
|
|
34
34
|
var crypto = require('crypto');
|
|
35
35
|
var path = require('path');
|
|
@@ -225,7 +225,7 @@ async function agentGenerate(agent, agentModel, agentApiKey, agentLocal, input,
|
|
|
225
225
|
const { output, maxRetries, errorStrategy, ...sendOptions } = options;
|
|
226
226
|
const run = await agent.send(input, sendOptions);
|
|
227
227
|
const result = await run.wait();
|
|
228
|
-
const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-
|
|
228
|
+
const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-QILSGTEJ.cjs');
|
|
229
229
|
const answer = structurableAnswerOrThrow(result, GenerateObjectError);
|
|
230
230
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
231
231
|
const facade = getAgentFacade();
|
|
@@ -327,7 +327,7 @@ function normalizeModel(m) {
|
|
|
327
327
|
if (m === void 0 || typeof m !== "string") return m;
|
|
328
328
|
const id = m.trim();
|
|
329
329
|
if (id.length === 0) {
|
|
330
|
-
throw new
|
|
330
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
331
331
|
'model must be a non-empty "provider/model" id string or a ModelSelection object',
|
|
332
332
|
{ code: "invalid_model_selection" }
|
|
333
333
|
);
|
|
@@ -463,7 +463,7 @@ function registryPath(cwd) {
|
|
|
463
463
|
return path.join(cwd, REGISTRY_RELATIVE_PATH);
|
|
464
464
|
}
|
|
465
465
|
async function loadRegistry(cwd) {
|
|
466
|
-
return
|
|
466
|
+
return chunkFMDZZRYE_cjs.readVersionedJson({
|
|
467
467
|
path: registryPath(cwd),
|
|
468
468
|
currentVersion: SCHEMA_VERSION,
|
|
469
469
|
defaultValue: () => ({}),
|
|
@@ -487,7 +487,7 @@ async function saveRegistry(cwd, agents2) {
|
|
|
487
487
|
}
|
|
488
488
|
const path = registryPath(cwd);
|
|
489
489
|
await chunkYLQQX5W2_cjs.withCwdMutex(`registry:${cwd}`, async () => {
|
|
490
|
-
await
|
|
490
|
+
await chunkFMDZZRYE_cjs.writeVersionedJson(path, serialized, SCHEMA_VERSION);
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
493
|
function toSerialized(agent) {
|
|
@@ -554,7 +554,7 @@ function scheduleSaveForCwd(cwd) {
|
|
|
554
554
|
}
|
|
555
555
|
} catch (cause) {
|
|
556
556
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
557
|
-
|
|
557
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] registry persist failed (${cwd}): ${msg}
|
|
558
558
|
`);
|
|
559
559
|
} finally {
|
|
560
560
|
pendingSaves.delete(cwd);
|
|
@@ -893,14 +893,14 @@ async function readLegacyFacts(jsonPath) {
|
|
|
893
893
|
}
|
|
894
894
|
async function writeMigratedFacts(cwd, jsonPath, facts) {
|
|
895
895
|
try {
|
|
896
|
-
for (const fact of facts) await
|
|
896
|
+
for (const fact of facts) await chunkLNTQRD23_cjs.appendFactToMarkdown(cwd, fact);
|
|
897
897
|
await promises.unlink(jsonPath).catch(() => void 0);
|
|
898
|
-
|
|
898
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
|
|
899
899
|
`);
|
|
900
900
|
return { migrated: true, factCount: facts.length };
|
|
901
901
|
} catch (cause) {
|
|
902
902
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
903
|
-
|
|
903
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] memory migration failed (readonly fs?): ${message}
|
|
904
904
|
`);
|
|
905
905
|
return { migrated: false, factCount: 0, reason: "readonly-fs" };
|
|
906
906
|
}
|
|
@@ -910,12 +910,12 @@ async function migrateLegacyJson(cwd, config) {
|
|
|
910
910
|
const key = `${cwd}::${config.namespace ?? "default"}::${config.scope ?? "agent"}::${config.userId ?? "default"}`;
|
|
911
911
|
if (migrationRun.has(key)) return { migrated: false, factCount: 0, reason: "already-migrated" };
|
|
912
912
|
migrationRun.add(key);
|
|
913
|
-
const jsonPath =
|
|
913
|
+
const jsonPath = chunkLNTQRD23_cjs.legacyMemoryJsonPath(cwd, config);
|
|
914
914
|
if (!await fileExists(jsonPath)) {
|
|
915
915
|
return { migrated: false, factCount: 0, reason: "no-legacy-json" };
|
|
916
916
|
}
|
|
917
|
-
if (await fileExists(
|
|
918
|
-
|
|
917
|
+
if (await fileExists(chunkLNTQRD23_cjs.memoryMdPath(cwd))) {
|
|
918
|
+
chunkA76OFN2B_cjs.diag(
|
|
919
919
|
`[theokit-sdk] memory migration skipped: both MEMORY.md and legacy JSON exist at ${jsonPath}; leaving both intact
|
|
920
920
|
`
|
|
921
921
|
);
|
|
@@ -939,13 +939,13 @@ function extractMemoryFact(message) {
|
|
|
939
939
|
async function readMemoryFacts(cwd, config) {
|
|
940
940
|
if (!config.enabled) return [];
|
|
941
941
|
await migrateLegacyJson(cwd, config);
|
|
942
|
-
return
|
|
942
|
+
return chunkLNTQRD23_cjs.readFacts(cwd, config);
|
|
943
943
|
}
|
|
944
944
|
async function appendMemoryFact(cwd, config, fact) {
|
|
945
945
|
if (!config.enabled) return;
|
|
946
946
|
await migrateLegacyJson(cwd, config);
|
|
947
|
-
const sanitized = { text:
|
|
948
|
-
await
|
|
947
|
+
const sanitized = { text: chunkA76OFN2B_cjs.redactSecrets(fact.text) };
|
|
948
|
+
await chunkLNTQRD23_cjs.appendFact(cwd, config, sanitized);
|
|
949
949
|
}
|
|
950
950
|
|
|
951
951
|
// src/internal/runtime/fixtures/fixture-scripts.ts
|
|
@@ -1293,7 +1293,7 @@ function redactScriptSecrets(script) {
|
|
|
1293
1293
|
function redactEventSecrets(event) {
|
|
1294
1294
|
const serialized = JSON.stringify(event);
|
|
1295
1295
|
const localStripped = serialized.replace(FIXTURE_SENTINEL, "***");
|
|
1296
|
-
const redacted =
|
|
1296
|
+
const redacted = chunkA76OFN2B_cjs.redactSecrets(localStripped);
|
|
1297
1297
|
if (redacted === serialized) return event;
|
|
1298
1298
|
return JSON.parse(redacted);
|
|
1299
1299
|
}
|
|
@@ -1616,7 +1616,7 @@ function createRealCloudRun(options) {
|
|
|
1616
1616
|
conversation: []
|
|
1617
1617
|
};
|
|
1618
1618
|
const apiKey = resolveApiKey(options.agentOptions.apiKey);
|
|
1619
|
-
const baseUrl =
|
|
1619
|
+
const baseUrl = chunkLR3VKB7A_cjs.getConfiguredBaseUrl();
|
|
1620
1620
|
const handle = new RealCloudRun(
|
|
1621
1621
|
{
|
|
1622
1622
|
id,
|
|
@@ -1689,7 +1689,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1689
1689
|
});
|
|
1690
1690
|
if (!response.ok) {
|
|
1691
1691
|
const text = await response.text().catch(() => "");
|
|
1692
|
-
throw new
|
|
1692
|
+
throw new chunkE7WWIX34_cjs.NetworkError(
|
|
1693
1693
|
`Cloud Run endpoint returned ${response.status}: ${text.slice(0, 200)}`,
|
|
1694
1694
|
{ code: "cloud_run_http_error" }
|
|
1695
1695
|
);
|
|
@@ -1699,7 +1699,7 @@ var RealCloudRun = class extends FixtureRunBase {
|
|
|
1699
1699
|
async consumeStream(response) {
|
|
1700
1700
|
let finalStatus = "finished";
|
|
1701
1701
|
let finalText = "";
|
|
1702
|
-
for await (const record of
|
|
1702
|
+
for await (const record of chunkLR3VKB7A_cjs.parseSseStream(response.body, this.controller.signal)) {
|
|
1703
1703
|
const parsed = safeParse(record.data);
|
|
1704
1704
|
if (parsed === void 0) continue;
|
|
1705
1705
|
const update = this.applyRecord(record.event, parsed);
|
|
@@ -1808,7 +1808,7 @@ var CloudAgent = class {
|
|
|
1808
1808
|
*/
|
|
1809
1809
|
isFixtureMode() {
|
|
1810
1810
|
const apiKey = resolveApiKey(this.options.apiKey);
|
|
1811
|
-
return
|
|
1811
|
+
return chunkLR3VKB7A_cjs.isFixtureApiKey(apiKey) && chunkLR3VKB7A_cjs.getConfiguredBaseUrl() === void 0;
|
|
1812
1812
|
}
|
|
1813
1813
|
// SE9 — integrated structured output; delegates to the shared helper.
|
|
1814
1814
|
generate(message, options) {
|
|
@@ -1823,7 +1823,7 @@ var CloudAgent = class {
|
|
|
1823
1823
|
}
|
|
1824
1824
|
async send(message, options = {}) {
|
|
1825
1825
|
if (options.tools !== void 0 && options.tools.length > 0) {
|
|
1826
|
-
throw new
|
|
1826
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
1827
1827
|
"Custom inline tools are local-only in SDK v1.0 \u2014 cloud agents cannot serialize handler functions",
|
|
1828
1828
|
{ code: "cloud_custom_tools_rejected" }
|
|
1829
1829
|
);
|
|
@@ -1859,7 +1859,7 @@ var CloudAgent = class {
|
|
|
1859
1859
|
const userText = typeof message === "string" ? message : message.text;
|
|
1860
1860
|
const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
|
|
1861
1861
|
const apiKey = resolveApiKey(this.options.apiKey);
|
|
1862
|
-
const useRealRuntime = apiKey !== void 0 && !
|
|
1862
|
+
const useRealRuntime = apiKey !== void 0 && !chunkLR3VKB7A_cjs.isFixtureApiKey(apiKey) && chunkLR3VKB7A_cjs.getConfiguredBaseUrl() !== void 0;
|
|
1863
1863
|
return useRealRuntime ? createRealCloudRun({
|
|
1864
1864
|
agentId: this.agentId,
|
|
1865
1865
|
model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
|
|
@@ -1908,7 +1908,7 @@ var CloudAgent = class {
|
|
|
1908
1908
|
listArtifacts() {
|
|
1909
1909
|
if (!this.isFixtureMode()) {
|
|
1910
1910
|
return Promise.reject(
|
|
1911
|
-
new
|
|
1911
|
+
new chunkE7WWIX34_cjs.ConfigurationError(
|
|
1912
1912
|
"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).",
|
|
1913
1913
|
{ code: "cloud_runtime_pre_release" }
|
|
1914
1914
|
)
|
|
@@ -1918,11 +1918,11 @@ var CloudAgent = class {
|
|
|
1918
1918
|
}
|
|
1919
1919
|
downloadArtifact(path) {
|
|
1920
1920
|
try {
|
|
1921
|
-
|
|
1921
|
+
chunkZAKTZ5B4_cjs.validateArtifactPath(path);
|
|
1922
1922
|
} catch (cause) {
|
|
1923
|
-
if (cause instanceof
|
|
1923
|
+
if (cause instanceof chunkZAKTZ5B4_cjs.PathTraversalError) {
|
|
1924
1924
|
return Promise.reject(
|
|
1925
|
-
new
|
|
1925
|
+
new chunkE7WWIX34_cjs.ConfigurationError(`Artifact path must stay inside the workspace: ${path}`, {
|
|
1926
1926
|
code: "artifact_path_traversal",
|
|
1927
1927
|
cause
|
|
1928
1928
|
})
|
|
@@ -1932,7 +1932,7 @@ var CloudAgent = class {
|
|
|
1932
1932
|
}
|
|
1933
1933
|
if (!this.isFixtureMode()) {
|
|
1934
1934
|
return Promise.reject(
|
|
1935
|
-
new
|
|
1935
|
+
new chunkE7WWIX34_cjs.ConfigurationError(
|
|
1936
1936
|
"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).",
|
|
1937
1937
|
{ code: "cloud_runtime_pre_release" }
|
|
1938
1938
|
)
|
|
@@ -1941,7 +1941,7 @@ var CloudAgent = class {
|
|
|
1941
1941
|
const match = buildFixtureArtifacts().find((artifact) => artifact.path === path);
|
|
1942
1942
|
if (match === void 0) {
|
|
1943
1943
|
return Promise.reject(
|
|
1944
|
-
new
|
|
1944
|
+
new chunkE7WWIX34_cjs.UnknownAgentError(`Artifact ${path} not found`, { code: "unknown_artifact" })
|
|
1945
1945
|
);
|
|
1946
1946
|
}
|
|
1947
1947
|
return Promise.resolve(Buffer.from(`fixture artifact content for ${path}
|
|
@@ -1955,7 +1955,7 @@ var CloudAgent = class {
|
|
|
1955
1955
|
* @public
|
|
1956
1956
|
*/
|
|
1957
1957
|
runUntil() {
|
|
1958
|
-
throw new
|
|
1958
|
+
throw new chunkE7WWIX34_cjs.UnsupportedRunOperationError(
|
|
1959
1959
|
"Agent.runUntil() is not supported on cloud agents. Cloud runtime manages goal loops server-side. Use a local agent for autonomous Ralph loops.",
|
|
1960
1960
|
"runUntil"
|
|
1961
1961
|
);
|
|
@@ -1966,7 +1966,7 @@ var CloudAgent = class {
|
|
|
1966
1966
|
* @public
|
|
1967
1967
|
*/
|
|
1968
1968
|
fork() {
|
|
1969
|
-
throw new
|
|
1969
|
+
throw new chunkE7WWIX34_cjs.UnsupportedRunOperationError(
|
|
1970
1970
|
"Agent.fork() is not supported on cloud agents. Fork inheritance requires local credential + system-prompt access. Use a local agent.",
|
|
1971
1971
|
"fork"
|
|
1972
1972
|
);
|
|
@@ -1978,7 +1978,7 @@ var CloudAgent = class {
|
|
|
1978
1978
|
* @public
|
|
1979
1979
|
*/
|
|
1980
1980
|
runToCompletion() {
|
|
1981
|
-
throw new
|
|
1981
|
+
throw new chunkE7WWIX34_cjs.UnsupportedRunOperationError(
|
|
1982
1982
|
"Agent.runToCompletion() is not supported on cloud agents. Cloud runtime manages continuation server-side. Use a local agent.",
|
|
1983
1983
|
"runToCompletion"
|
|
1984
1984
|
);
|
|
@@ -1990,7 +1990,7 @@ var CloudAgent = class {
|
|
|
1990
1990
|
* @public
|
|
1991
1991
|
*/
|
|
1992
1992
|
streamToCompletion() {
|
|
1993
|
-
throw new
|
|
1993
|
+
throw new chunkE7WWIX34_cjs.UnsupportedRunOperationError(
|
|
1994
1994
|
"Agent.streamToCompletion() is not supported on cloud agents. Cloud runtime manages continuation server-side. Use a local agent.",
|
|
1995
1995
|
"streamToCompletion"
|
|
1996
1996
|
);
|
|
@@ -2004,7 +2004,7 @@ var CloudAgent = class {
|
|
|
2004
2004
|
*/
|
|
2005
2005
|
usePersonality() {
|
|
2006
2006
|
return Promise.reject(
|
|
2007
|
-
new
|
|
2007
|
+
new chunkE7WWIX34_cjs.UnsupportedRunOperationError(
|
|
2008
2008
|
"Agent.usePersonality() is not supported on cloud agents (pre-release). Use a local agent or wait for cloud GA.",
|
|
2009
2009
|
"usePersonality"
|
|
2010
2010
|
)
|
|
@@ -2032,7 +2032,7 @@ function validateCloudToolParity(options) {
|
|
|
2032
2032
|
function rejectProcessors(options) {
|
|
2033
2033
|
const hasProcessors = (options.inputProcessors?.length ?? 0) > 0 || (options.outputProcessors?.length ?? 0) > 0;
|
|
2034
2034
|
if (hasProcessors) {
|
|
2035
|
-
throw new
|
|
2035
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2036
2036
|
"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.",
|
|
2037
2037
|
{ code: "cloud_incompatible_function_resolver" }
|
|
2038
2038
|
);
|
|
@@ -2040,7 +2040,7 @@ function rejectProcessors(options) {
|
|
|
2040
2040
|
}
|
|
2041
2041
|
function rejectFunctionSystemPrompt(options) {
|
|
2042
2042
|
if (typeof options.systemPrompt === "function") {
|
|
2043
|
-
throw new
|
|
2043
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2044
2044
|
"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.",
|
|
2045
2045
|
{ code: "cloud_incompatible_function_resolver" }
|
|
2046
2046
|
);
|
|
@@ -2048,7 +2048,7 @@ function rejectFunctionSystemPrompt(options) {
|
|
|
2048
2048
|
}
|
|
2049
2049
|
function rejectFunctionSkills(options) {
|
|
2050
2050
|
if (typeof options.skills === "function") {
|
|
2051
|
-
throw new
|
|
2051
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2052
2052
|
"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.",
|
|
2053
2053
|
{ code: "cloud_incompatible_function_resolver" }
|
|
2054
2054
|
);
|
|
@@ -2060,7 +2060,7 @@ function rejectStdioMcpLocalPaths(options) {
|
|
|
2060
2060
|
if (!isStdioCommandConfig(config)) continue;
|
|
2061
2061
|
const command = config.command ?? "";
|
|
2062
2062
|
if (isLocalPath(command)) {
|
|
2063
|
-
throw new
|
|
2063
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2064
2064
|
`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.`,
|
|
2065
2065
|
{ code: "cloud_incompatible_mcp_stdio_local" }
|
|
2066
2066
|
);
|
|
@@ -2100,14 +2100,14 @@ async function readState(filePath) {
|
|
|
2100
2100
|
try {
|
|
2101
2101
|
parsed = JSON.parse(raw);
|
|
2102
2102
|
} catch {
|
|
2103
|
-
|
|
2103
|
+
chunkK6TWHNT4_cjs.warnOnce(
|
|
2104
2104
|
"personality-store-json-parse",
|
|
2105
2105
|
"[theokit-sdk] personality.json is malformed; treating as empty"
|
|
2106
2106
|
);
|
|
2107
2107
|
return emptyState();
|
|
2108
2108
|
}
|
|
2109
2109
|
if (!isStateV1(parsed)) {
|
|
2110
|
-
|
|
2110
|
+
chunkK6TWHNT4_cjs.warnOnce(
|
|
2111
2111
|
"personality-store-bad-version",
|
|
2112
2112
|
`[theokit-sdk] personality.json has unknown version; treating as empty (file kept untouched)`
|
|
2113
2113
|
);
|
|
@@ -2138,9 +2138,9 @@ var PersonalityStore = class {
|
|
|
2138
2138
|
try {
|
|
2139
2139
|
await this.#persist(agentId, slug);
|
|
2140
2140
|
} catch (err) {
|
|
2141
|
-
|
|
2141
|
+
chunkK6TWHNT4_cjs.warnOnce(
|
|
2142
2142
|
`personality-store-persist-failure-${agentId}`,
|
|
2143
|
-
`[theokit-sdk] personality persist failed for ${
|
|
2143
|
+
`[theokit-sdk] personality persist failed for ${chunkA76OFN2B_cjs.redactSecrets(agentId)}: ${chunkA76OFN2B_cjs.redactSecrets(
|
|
2144
2144
|
err.message
|
|
2145
2145
|
)}`
|
|
2146
2146
|
);
|
|
@@ -2155,9 +2155,9 @@ var PersonalityStore = class {
|
|
|
2155
2155
|
try {
|
|
2156
2156
|
state = await readState(filePath);
|
|
2157
2157
|
} catch (err) {
|
|
2158
|
-
|
|
2158
|
+
chunkK6TWHNT4_cjs.warnOnce(
|
|
2159
2159
|
`personality-store-hydrate-failure-${agentId}`,
|
|
2160
|
-
`[theokit-sdk] personality hydrate failed for ${
|
|
2160
|
+
`[theokit-sdk] personality hydrate failed for ${chunkA76OFN2B_cjs.redactSecrets(agentId)}: ${chunkA76OFN2B_cjs.redactSecrets(
|
|
2161
2161
|
err.message
|
|
2162
2162
|
)}`
|
|
2163
2163
|
);
|
|
@@ -2174,17 +2174,17 @@ var PersonalityStore = class {
|
|
|
2174
2174
|
async #persist(agentId, slug) {
|
|
2175
2175
|
const filePath = this.#filePath();
|
|
2176
2176
|
await promises.mkdir(path.dirname(filePath), { recursive: true });
|
|
2177
|
-
await
|
|
2177
|
+
await chunkJERO4TP6_cjs.withFileLock(filePath, async () => {
|
|
2178
2178
|
const current = await readState(filePath);
|
|
2179
2179
|
const nextAgents = { ...current.agents };
|
|
2180
2180
|
if (slug === void 0) delete nextAgents[agentId];
|
|
2181
2181
|
else nextAgents[agentId] = slug;
|
|
2182
2182
|
const next = { version: SCHEMA_VERSION2, agents: nextAgents };
|
|
2183
|
-
await
|
|
2183
|
+
await chunk33B2BSME_cjs.atomicWriteJson(filePath, next);
|
|
2184
2184
|
});
|
|
2185
2185
|
}
|
|
2186
2186
|
#filePath() {
|
|
2187
|
-
return path.join(
|
|
2187
|
+
return path.join(chunkFMDZZRYE_cjs.getTheokitHome(this.#cwd), FILE_NAME);
|
|
2188
2188
|
}
|
|
2189
2189
|
};
|
|
2190
2190
|
|
|
@@ -2207,7 +2207,7 @@ function createPluginContext() {
|
|
|
2207
2207
|
},
|
|
2208
2208
|
on(hook, handler) {
|
|
2209
2209
|
if (typeof handler !== "function") {
|
|
2210
|
-
|
|
2210
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] ignoring non-function handler for hook "${hook}"
|
|
2211
2211
|
`);
|
|
2212
2212
|
return;
|
|
2213
2213
|
}
|
|
@@ -2260,7 +2260,7 @@ var PluginManager = class {
|
|
|
2260
2260
|
const seen = /* @__PURE__ */ new Set();
|
|
2261
2261
|
for (const plugin of plugins) {
|
|
2262
2262
|
if (seen.has(plugin.name)) {
|
|
2263
|
-
|
|
2263
|
+
chunkA76OFN2B_cjs.diag(
|
|
2264
2264
|
`[theokit-sdk] duplicate plugin name "${plugin.name}" \u2014 both will register independently
|
|
2265
2265
|
`
|
|
2266
2266
|
);
|
|
@@ -2287,7 +2287,7 @@ var PluginManager = class {
|
|
|
2287
2287
|
*/
|
|
2288
2288
|
async register(plugin) {
|
|
2289
2289
|
if (plugin.kind !== "general") {
|
|
2290
|
-
throw new
|
|
2290
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
2291
2291
|
`late register supports general plugins only (got "${plugin.kind}" for "${plugin.name}")`,
|
|
2292
2292
|
{ code: "plugin_late_register_kind" }
|
|
2293
2293
|
);
|
|
@@ -2344,7 +2344,7 @@ var PluginManager = class {
|
|
|
2344
2344
|
parts.push(result.recalledContext);
|
|
2345
2345
|
}
|
|
2346
2346
|
} catch (err) {
|
|
2347
|
-
|
|
2347
|
+
chunkA76OFN2B_cjs.diag(
|
|
2348
2348
|
`[theokit-sdk] pre_user_send hook failed: ${err instanceof Error ? err.message : String(err)}
|
|
2349
2349
|
`
|
|
2350
2350
|
);
|
|
@@ -2372,7 +2372,7 @@ var PluginManager = class {
|
|
|
2372
2372
|
try {
|
|
2373
2373
|
await h(ctx);
|
|
2374
2374
|
} catch (err) {
|
|
2375
|
-
|
|
2375
|
+
chunkA76OFN2B_cjs.diag(
|
|
2376
2376
|
`[theokit-sdk] post_assistant_reply hook failed: ${err instanceof Error ? err.message : String(err)}
|
|
2377
2377
|
`
|
|
2378
2378
|
);
|
|
@@ -2388,7 +2388,7 @@ var PluginManager = class {
|
|
|
2388
2388
|
try {
|
|
2389
2389
|
await h(ctx);
|
|
2390
2390
|
} catch (err) {
|
|
2391
|
-
|
|
2391
|
+
chunkA76OFN2B_cjs.diag(
|
|
2392
2392
|
`[theokit-sdk] ${name} hook failed: ${err instanceof Error ? err.message : String(err)}
|
|
2393
2393
|
`
|
|
2394
2394
|
);
|
|
@@ -2403,7 +2403,7 @@ var PluginManager = class {
|
|
|
2403
2403
|
const out = await h(current, ctx);
|
|
2404
2404
|
if (out !== void 0) current = out;
|
|
2405
2405
|
} catch (err) {
|
|
2406
|
-
|
|
2406
|
+
chunkA76OFN2B_cjs.diag(
|
|
2407
2407
|
`[theokit-sdk] ${name} hook failed: ${err instanceof Error ? err.message : String(err)}
|
|
2408
2408
|
`
|
|
2409
2409
|
);
|
|
@@ -2545,7 +2545,7 @@ var HooksExecutor = class {
|
|
|
2545
2545
|
this.config = {};
|
|
2546
2546
|
return;
|
|
2547
2547
|
}
|
|
2548
|
-
this.config = await
|
|
2548
|
+
this.config = await chunkK6TWHNT4_cjs.loadHookConfig(this.cwd);
|
|
2549
2549
|
}
|
|
2550
2550
|
/** Fire every hook registered for `event` and aggregate the decisions. */
|
|
2551
2551
|
async run(payload) {
|
|
@@ -2651,11 +2651,11 @@ function buildContextBudgetEvent(model, resolved) {
|
|
|
2651
2651
|
// src/internal/runtime/lifecycle/post-run-lifecycle.ts
|
|
2652
2652
|
function resolveWindowForRun(model, contextWindow) {
|
|
2653
2653
|
const override = contextWindow !== void 0 && contextWindow > 0 ? contextWindow : void 0;
|
|
2654
|
-
return
|
|
2654
|
+
return chunkOVGNXGCK_cjs.resolveEffectiveContextWindow({
|
|
2655
2655
|
...override !== void 0 ? { override } : {},
|
|
2656
|
-
catalog:
|
|
2657
|
-
margin:
|
|
2658
|
-
floor:
|
|
2656
|
+
catalog: chunkUDSGSPUY_cjs.getCatalogModelInfo(model)?.limit?.context,
|
|
2657
|
+
margin: chunkOVGNXGCK_cjs.CONTEXT_WINDOW_MARGIN,
|
|
2658
|
+
floor: chunkOVGNXGCK_cjs.CONTEXT_WINDOW_FLOOR
|
|
2659
2659
|
});
|
|
2660
2660
|
}
|
|
2661
2661
|
async function runPostRunLifecycle(inputs) {
|
|
@@ -2679,32 +2679,32 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2679
2679
|
try {
|
|
2680
2680
|
const parcial = await safeConversation(run);
|
|
2681
2681
|
if (parcial !== void 0) {
|
|
2682
|
-
|
|
2682
|
+
chunkZ5DYGBPV_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
|
|
2683
2683
|
userText,
|
|
2684
2684
|
conversation: parcial
|
|
2685
2685
|
});
|
|
2686
2686
|
}
|
|
2687
2687
|
} catch (cause) {
|
|
2688
2688
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
2689
|
-
|
|
2689
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
|
|
2690
2690
|
`);
|
|
2691
2691
|
}
|
|
2692
|
-
await
|
|
2692
|
+
await chunkZ5DYGBPV_cjs.flushSessionWrites();
|
|
2693
2693
|
return;
|
|
2694
2694
|
}
|
|
2695
2695
|
if (result.result !== void 0) {
|
|
2696
|
-
|
|
2696
|
+
chunkZ5DYGBPV_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
|
|
2697
2697
|
}
|
|
2698
2698
|
const conversation = await safeConversation(run);
|
|
2699
2699
|
const resolvedWindow = resolveWindowForRun(model, contextWindow);
|
|
2700
2700
|
const effectiveWindow = resolvedWindow.window;
|
|
2701
2701
|
const budgetEvent = buildContextBudgetEvent(model, resolvedWindow);
|
|
2702
2702
|
if (budgetEvent !== void 0 && onRunEvent !== void 0) {
|
|
2703
|
-
|
|
2703
|
+
chunkQMIG7TKG_cjs.emitRunEvent(onRunEvent, budgetEvent);
|
|
2704
2704
|
}
|
|
2705
2705
|
const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
|
|
2706
2706
|
const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
|
|
2707
|
-
|
|
2707
|
+
chunkZ5DYGBPV_cjs.persistTurnToTranscript(
|
|
2708
2708
|
sessionStore,
|
|
2709
2709
|
{ cwd: workspaceCwd, agentId, model },
|
|
2710
2710
|
agentId,
|
|
@@ -2716,13 +2716,13 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2716
2716
|
// The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
|
|
2717
2717
|
// `contextWindow` here would budget against a number the clamp already rejected.
|
|
2718
2718
|
contextWindow: effectiveWindow,
|
|
2719
|
-
summarize:
|
|
2719
|
+
summarize: chunkLR3VKB7A_cjs.buildDefaultSummarizer({
|
|
2720
2720
|
agentModel: model,
|
|
2721
2721
|
...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
|
|
2722
2722
|
})
|
|
2723
2723
|
}
|
|
2724
2724
|
},
|
|
2725
|
-
onRunEvent !== void 0 ? () =>
|
|
2725
|
+
onRunEvent !== void 0 ? () => chunkQMIG7TKG_cjs.emitRunEvent(onRunEvent, { type: "compact_boundary", trigger: "auto" }) : void 0
|
|
2726
2726
|
);
|
|
2727
2727
|
if (result.status === "finished" && result.result !== void 0) {
|
|
2728
2728
|
const summaryArgs = {
|
|
@@ -2738,14 +2738,14 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2738
2738
|
if (memoryProvider?.recordSessionSummary !== void 0) {
|
|
2739
2739
|
await memoryProvider.recordSessionSummary(summaryArgs);
|
|
2740
2740
|
} else {
|
|
2741
|
-
await
|
|
2741
|
+
await chunkLNTQRD23_cjs.writeSessionSummary(summaryArgs);
|
|
2742
2742
|
}
|
|
2743
2743
|
if (!shouldUsePortMemoryPath()) {
|
|
2744
2744
|
void memoryGlue.syncIfReady();
|
|
2745
2745
|
}
|
|
2746
2746
|
} catch (cause) {
|
|
2747
2747
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
2748
|
-
|
|
2748
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] session summary write failed (${result.id}): ${message}
|
|
2749
2749
|
`);
|
|
2750
2750
|
}
|
|
2751
2751
|
}
|
|
@@ -2758,7 +2758,7 @@ async function runPostRunLifecycle(inputs) {
|
|
|
2758
2758
|
agentId,
|
|
2759
2759
|
runId: result.id
|
|
2760
2760
|
});
|
|
2761
|
-
await
|
|
2761
|
+
await chunkZ5DYGBPV_cjs.flushSessionWrites();
|
|
2762
2762
|
}
|
|
2763
2763
|
async function safeConversation(run) {
|
|
2764
2764
|
try {
|
|
@@ -2833,7 +2833,7 @@ var warned = /* @__PURE__ */ new Set();
|
|
|
2833
2833
|
function warnDoubleReasoningOnce() {
|
|
2834
2834
|
if (warned.has("double-reasoning")) return;
|
|
2835
2835
|
warned.add("double-reasoning");
|
|
2836
|
-
|
|
2836
|
+
chunkA76OFN2B_cjs.diag(
|
|
2837
2837
|
"[theokit-sdk] `reasoning: true` skipped \u2014 a native reasoning model is configured (model.params thinking/reasoning); native reasoning wins. Remove one to silence.\n"
|
|
2838
2838
|
);
|
|
2839
2839
|
}
|
|
@@ -2866,9 +2866,9 @@ var SkillsManager = class {
|
|
|
2866
2866
|
}
|
|
2867
2867
|
async refresh() {
|
|
2868
2868
|
const skillsRoot = this.skillsDir ?? path.join(this.cwd, ".theokit", "skills");
|
|
2869
|
-
const discovered = await
|
|
2869
|
+
const discovered = await chunkCJHBSSAF_cjs.discoverSkills(skillsRoot, {
|
|
2870
2870
|
onInvalidSkill: (info) => {
|
|
2871
|
-
|
|
2871
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
|
|
2872
2872
|
`);
|
|
2873
2873
|
}
|
|
2874
2874
|
});
|
|
@@ -2892,7 +2892,7 @@ var SkillsManager = class {
|
|
|
2892
2892
|
async get(name) {
|
|
2893
2893
|
const skill = this.skills.find((s) => s.name === name);
|
|
2894
2894
|
if (skill === void 0) return void 0;
|
|
2895
|
-
const instructions = typeof skill.instructions === "string" ? skill.instructions :
|
|
2895
|
+
const instructions = typeof skill.instructions === "string" ? skill.instructions : chunkCJHBSSAF_cjs.stripSkillFrontmatter(await promises.readFile(skill.source, "utf8"));
|
|
2896
2896
|
const references = skill.references;
|
|
2897
2897
|
return {
|
|
2898
2898
|
name: skill.name,
|
|
@@ -2978,7 +2978,7 @@ async function safeCall(fn, fallback, label = "safeCall") {
|
|
|
2978
2978
|
return await fn();
|
|
2979
2979
|
} catch (cause) {
|
|
2980
2980
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
2981
|
-
|
|
2981
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] ${label} failed: ${message}
|
|
2982
2982
|
`);
|
|
2983
2983
|
return fallback;
|
|
2984
2984
|
}
|
|
@@ -2992,7 +2992,7 @@ var ActiveMemoryPromptProvider = class {
|
|
|
2992
2992
|
if (ctx.activeMemorySummary === void 0 || ctx.activeMemorySummary.length === 0) {
|
|
2993
2993
|
return Promise.resolve(void 0);
|
|
2994
2994
|
}
|
|
2995
|
-
const body =
|
|
2995
|
+
const body = chunkCJHBSSAF_cjs.escapeBlockBody(ctx.activeMemorySummary);
|
|
2996
2996
|
return Promise.resolve(`<active-memory>
|
|
2997
2997
|
${body}
|
|
2998
2998
|
</active-memory>`);
|
|
@@ -3045,7 +3045,7 @@ function formatSource(name, tokens) {
|
|
|
3045
3045
|
if (tokens.length === 0) {
|
|
3046
3046
|
return ` <source name="${escapeAttribute(name)}" />`;
|
|
3047
3047
|
}
|
|
3048
|
-
const body =
|
|
3048
|
+
const body = chunkCJHBSSAF_cjs.escapeBlockBody(tokens.join(" "));
|
|
3049
3049
|
return ` <source name="${escapeAttribute(name)}">
|
|
3050
3050
|
${body}
|
|
3051
3051
|
</source>`;
|
|
@@ -3061,7 +3061,7 @@ var MemoryPromptProvider = class {
|
|
|
3061
3061
|
contribute(ctx) {
|
|
3062
3062
|
if (ctx.memoryAutoInject === false) return Promise.resolve(void 0);
|
|
3063
3063
|
if (ctx.memory.length === 0) return Promise.resolve(void 0);
|
|
3064
|
-
const lines = ctx.memory.map((fact) => ` - ${
|
|
3064
|
+
const lines = ctx.memory.map((fact) => ` - ${chunkCJHBSSAF_cjs.escapeBlockBody(fact.text)}`);
|
|
3065
3065
|
return Promise.resolve(`<memory>
|
|
3066
3066
|
${lines.join("\n")}
|
|
3067
3067
|
</memory>`);
|
|
@@ -3083,7 +3083,7 @@ var SkillsPromptProvider = class {
|
|
|
3083
3083
|
priority = 20;
|
|
3084
3084
|
contribute(ctx) {
|
|
3085
3085
|
if (ctx.skillsAutoInject === false) return Promise.resolve(void 0);
|
|
3086
|
-
return Promise.resolve(
|
|
3086
|
+
return Promise.resolve(chunkCJHBSSAF_cjs.buildSkillsBlock(ctx.skills));
|
|
3087
3087
|
}
|
|
3088
3088
|
};
|
|
3089
3089
|
|
|
@@ -3095,7 +3095,7 @@ var SystemPromptPipeline = class _SystemPromptPipeline {
|
|
|
3095
3095
|
for (const p of providers) {
|
|
3096
3096
|
const key = `${p.priority}:${p.id}`;
|
|
3097
3097
|
if (seen.has(key)) {
|
|
3098
|
-
throw new
|
|
3098
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Duplicate system-prompt provider ${key}`, {
|
|
3099
3099
|
code: "pipeline_duplicate_provider"
|
|
3100
3100
|
});
|
|
3101
3101
|
}
|
|
@@ -3142,7 +3142,7 @@ function validateAgentOptions(options) {
|
|
|
3142
3142
|
ensureRuntimeShape(options);
|
|
3143
3143
|
if (options.local !== void 0) {
|
|
3144
3144
|
if (options.model === void 0) {
|
|
3145
|
-
throw new
|
|
3145
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError("Local agents require a model selection", {
|
|
3146
3146
|
code: "missing_model"
|
|
3147
3147
|
});
|
|
3148
3148
|
}
|
|
@@ -3166,7 +3166,7 @@ function validateCredentialPoolShape(options) {
|
|
|
3166
3166
|
([, arr]) => Array.isArray(arr) && arr.some((k) => typeof k === "string" && k.length > 0)
|
|
3167
3167
|
);
|
|
3168
3168
|
if (populated.length === 0) return;
|
|
3169
|
-
throw new
|
|
3169
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3170
3170
|
"Ambiguous credential configuration: use either `apiKey: '...'` (single-key, simplest) OR `apiKeys: { provider: [...] }` (multi-key pool), not both.",
|
|
3171
3171
|
{ code: "credential_pool_ambiguous" }
|
|
3172
3172
|
);
|
|
@@ -3175,7 +3175,7 @@ function validatePlugins(options) {
|
|
|
3175
3175
|
const plugins = options.plugins;
|
|
3176
3176
|
if (plugins?.paths === void 0) return;
|
|
3177
3177
|
if (options.cloud !== void 0 && plugins.paths.length > 0) {
|
|
3178
|
-
throw new
|
|
3178
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3179
3179
|
"Cloud agents require committed plugin manifests; local plugin paths are not supported",
|
|
3180
3180
|
{ code: "cloud_plugin_path_rejected" }
|
|
3181
3181
|
);
|
|
@@ -3183,7 +3183,7 @@ function validatePlugins(options) {
|
|
|
3183
3183
|
}
|
|
3184
3184
|
function ensureRuntimeShape(options) {
|
|
3185
3185
|
if (options.local !== void 0 && options.cloud !== void 0) {
|
|
3186
|
-
throw new
|
|
3186
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3187
3187
|
"Pass either local or cloud \u2014 they are mutually exclusive runtimes",
|
|
3188
3188
|
{ code: "runtime_exclusive" }
|
|
3189
3189
|
);
|
|
@@ -3191,7 +3191,7 @@ function ensureRuntimeShape(options) {
|
|
|
3191
3191
|
}
|
|
3192
3192
|
function rejectProgrammaticHooks(options) {
|
|
3193
3193
|
if (options.hooks !== void 0) {
|
|
3194
|
-
throw new
|
|
3194
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3195
3195
|
"Programmatic hooks are not supported \u2014 hooks are file-based only (.theokit/hooks.json)",
|
|
3196
3196
|
{ code: "programmatic_hooks_rejected" }
|
|
3197
3197
|
);
|
|
@@ -3201,7 +3201,7 @@ function validateCloud(cloud) {
|
|
|
3201
3201
|
if (cloud.envVars !== void 0) {
|
|
3202
3202
|
for (const key of Object.keys(cloud.envVars)) {
|
|
3203
3203
|
if (key.startsWith("THEOKIT_")) {
|
|
3204
|
-
throw new
|
|
3204
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3205
3205
|
`Cloud envVars cannot use the reserved THEOKIT_ prefix (got "${key}")`,
|
|
3206
3206
|
{ code: "reserved_env_prefix" }
|
|
3207
3207
|
);
|
|
@@ -3213,7 +3213,7 @@ function validateMcpServers(options) {
|
|
|
3213
3213
|
if (options.mcpServers === void 0) return;
|
|
3214
3214
|
for (const [name, config] of Object.entries(options.mcpServers)) {
|
|
3215
3215
|
if (options.cloud !== void 0 && isStdioWithCwd(config)) {
|
|
3216
|
-
throw new
|
|
3216
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3217
3217
|
`MCP server "${name}" uses stdio with cwd, which is rejected for cloud agents`,
|
|
3218
3218
|
{ code: "cloud_stdio_cwd_rejected" }
|
|
3219
3219
|
);
|
|
@@ -3232,12 +3232,12 @@ function validateSubagents(agents2) {
|
|
|
3232
3232
|
if (agents2 === void 0) return;
|
|
3233
3233
|
for (const [name, definition] of Object.entries(agents2)) {
|
|
3234
3234
|
if (typeof definition.description !== "string" || definition.description.length === 0) {
|
|
3235
|
-
throw new
|
|
3235
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty description`, {
|
|
3236
3236
|
code: "subagent_missing_description"
|
|
3237
3237
|
});
|
|
3238
3238
|
}
|
|
3239
3239
|
if (typeof definition.prompt !== "string" || definition.prompt.length === 0) {
|
|
3240
|
-
throw new
|
|
3240
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty prompt`, {
|
|
3241
3241
|
code: "subagent_missing_prompt"
|
|
3242
3242
|
});
|
|
3243
3243
|
}
|
|
@@ -3250,7 +3250,7 @@ function validateToolCatalog(tools) {
|
|
|
3250
3250
|
for (const tool of tools) {
|
|
3251
3251
|
validateSingleTool(tool);
|
|
3252
3252
|
if (seen.has(tool.name)) {
|
|
3253
|
-
throw new
|
|
3253
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Duplicate custom tool name "${tool.name}"`, {
|
|
3254
3254
|
code: "duplicate_tool_name"
|
|
3255
3255
|
});
|
|
3256
3256
|
}
|
|
@@ -3261,7 +3261,7 @@ function validateCustomTools(options) {
|
|
|
3261
3261
|
const tools = options.tools;
|
|
3262
3262
|
if (tools === void 0 || tools.length === 0) return;
|
|
3263
3263
|
if (options.cloud !== void 0) {
|
|
3264
|
-
throw new
|
|
3264
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3265
3265
|
"Custom inline tools are local-only in SDK v1.0 \u2014 cloud agents cannot serialize handler functions",
|
|
3266
3266
|
{ code: "cloud_custom_tools_rejected" }
|
|
3267
3267
|
);
|
|
@@ -3273,25 +3273,25 @@ function validateSingleTool(tool) {
|
|
|
3273
3273
|
validateToolDescription(tool);
|
|
3274
3274
|
validateToolSchema(tool);
|
|
3275
3275
|
if (typeof tool.handler !== "function") {
|
|
3276
|
-
throw new
|
|
3276
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a handler function`, {
|
|
3277
3277
|
code: "tool_missing_handler"
|
|
3278
3278
|
});
|
|
3279
3279
|
}
|
|
3280
3280
|
}
|
|
3281
3281
|
function validateToolName(tool) {
|
|
3282
3282
|
if (typeof tool.name !== "string" || tool.name.length === 0) {
|
|
3283
|
-
throw new
|
|
3283
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError("Custom tool requires a non-empty name", {
|
|
3284
3284
|
code: "tool_missing_name"
|
|
3285
3285
|
});
|
|
3286
3286
|
}
|
|
3287
3287
|
if (!TOOL_NAME_PATTERN.test(tool.name)) {
|
|
3288
|
-
throw new
|
|
3288
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3289
3289
|
`Custom tool name "${tool.name}" must match /^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/`,
|
|
3290
3290
|
{ code: "tool_invalid_name" }
|
|
3291
3291
|
);
|
|
3292
3292
|
}
|
|
3293
3293
|
if (RESERVED_TOOL_NAMES.has(tool.name) || tool.name.startsWith("mcp_")) {
|
|
3294
|
-
throw new
|
|
3294
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3295
3295
|
`Custom tool name "${tool.name}" collides with a reserved SDK tool name`,
|
|
3296
3296
|
{ code: "tool_reserved_name" }
|
|
3297
3297
|
);
|
|
@@ -3299,7 +3299,7 @@ function validateToolName(tool) {
|
|
|
3299
3299
|
}
|
|
3300
3300
|
function validateToolDescription(tool) {
|
|
3301
3301
|
if (typeof tool.description !== "string" || tool.description.length === 0) {
|
|
3302
|
-
throw new
|
|
3302
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a non-empty description`, {
|
|
3303
3303
|
code: "tool_missing_description"
|
|
3304
3304
|
});
|
|
3305
3305
|
}
|
|
@@ -3307,12 +3307,12 @@ function validateToolDescription(tool) {
|
|
|
3307
3307
|
function validateToolSchema(tool) {
|
|
3308
3308
|
const schema = tool.inputSchema;
|
|
3309
3309
|
if (schema === null || schema === void 0 || typeof schema !== "object") {
|
|
3310
|
-
throw new
|
|
3310
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Custom tool "${tool.name}" requires an inputSchema object`, {
|
|
3311
3311
|
code: "tool_missing_schema"
|
|
3312
3312
|
});
|
|
3313
3313
|
}
|
|
3314
3314
|
if (schema.type !== "object") {
|
|
3315
|
-
throw new
|
|
3315
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3316
3316
|
`Custom tool "${tool.name}" inputSchema must declare \`type: "object"\``,
|
|
3317
3317
|
{ code: "tool_invalid_schema_type" }
|
|
3318
3318
|
);
|
|
@@ -3323,7 +3323,7 @@ function validateMemory(options) {
|
|
|
3323
3323
|
if (memory?.storePath === void 0) return;
|
|
3324
3324
|
const storePath = memory.storePath;
|
|
3325
3325
|
if (storePath.includes("..") || storePath.startsWith("/") || /^[A-Z]:/i.test(storePath)) {
|
|
3326
|
-
throw new
|
|
3326
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3327
3327
|
`Memory storePath must stay inside the workspace; got "${storePath}"`,
|
|
3328
3328
|
{ code: "memory_path_traversal" }
|
|
3329
3329
|
);
|
|
@@ -3345,7 +3345,7 @@ var HISTOGRAM_NAMES = {
|
|
|
3345
3345
|
};
|
|
3346
3346
|
function safeRequire(moduleName) {
|
|
3347
3347
|
try {
|
|
3348
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3348
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-AYDSWY35.cjs', document.baseURI).href)));
|
|
3349
3349
|
return r(moduleName);
|
|
3350
3350
|
} catch {
|
|
3351
3351
|
return void 0;
|
|
@@ -3424,7 +3424,7 @@ var langfuseAdapter = {
|
|
|
3424
3424
|
}
|
|
3425
3425
|
}
|
|
3426
3426
|
if (lf.LangfuseSpanProcessor === void 0) {
|
|
3427
|
-
|
|
3427
|
+
chunkA76OFN2B_cjs.diag(
|
|
3428
3428
|
"[theokit-sdk] @langfuse/node detected but LangfuseSpanProcessor not found (v2?). Use Langfuse v3+ for auto-instrumentation.\n"
|
|
3429
3429
|
);
|
|
3430
3430
|
return;
|
|
@@ -3553,11 +3553,11 @@ function tryAutoRegisterAdapters(settings) {
|
|
|
3553
3553
|
try {
|
|
3554
3554
|
adapter.register();
|
|
3555
3555
|
registered.add(adapter.moduleName);
|
|
3556
|
-
|
|
3556
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] telemetry: ${adapter.displayName} auto-instrumented.
|
|
3557
3557
|
`);
|
|
3558
3558
|
} catch (cause) {
|
|
3559
3559
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
3560
|
-
|
|
3560
|
+
chunkA76OFN2B_cjs.diag(
|
|
3561
3561
|
`[theokit-sdk] telemetry: ${adapter.displayName} detected but failed to register: ${message}
|
|
3562
3562
|
`
|
|
3563
3563
|
);
|
|
@@ -3570,7 +3570,7 @@ var cachedOtel;
|
|
|
3570
3570
|
function loadOtel() {
|
|
3571
3571
|
if (cachedOtel === void 0) {
|
|
3572
3572
|
try {
|
|
3573
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
3573
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-AYDSWY35.cjs', document.baseURI).href)));
|
|
3574
3574
|
const mod = r("@opentelemetry/api");
|
|
3575
3575
|
cachedOtel = mod;
|
|
3576
3576
|
} catch {
|
|
@@ -3613,7 +3613,7 @@ function safe(op, fallback) {
|
|
|
3613
3613
|
if (!warnedOnce) {
|
|
3614
3614
|
warnedOnce = true;
|
|
3615
3615
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
3616
|
-
|
|
3616
|
+
chunkA76OFN2B_cjs.diag(
|
|
3617
3617
|
`[theokit-sdk] telemetry exporter error (suppressed; agent.send continues): ${message}
|
|
3618
3618
|
`
|
|
3619
3619
|
);
|
|
@@ -3627,7 +3627,7 @@ function createTelemetry(settings) {
|
|
|
3627
3627
|
if (otel === null) {
|
|
3628
3628
|
if (!warnedOnce) {
|
|
3629
3629
|
warnedOnce = true;
|
|
3630
|
-
|
|
3630
|
+
chunkA76OFN2B_cjs.diag(
|
|
3631
3631
|
"[theokit-sdk] telemetry.enabled = true but `@opentelemetry/api` is not installed; telemetry is a no-op.\n"
|
|
3632
3632
|
);
|
|
3633
3633
|
}
|
|
@@ -3721,12 +3721,12 @@ function wrapSpan(span, openSpans) {
|
|
|
3721
3721
|
}
|
|
3722
3722
|
function redactAttrValue(value) {
|
|
3723
3723
|
if (typeof value !== "string") return value;
|
|
3724
|
-
return
|
|
3724
|
+
return chunkA76OFN2B_cjs.redactSecrets(value);
|
|
3725
3725
|
}
|
|
3726
3726
|
function redactAttrs(attrs) {
|
|
3727
3727
|
const out = {};
|
|
3728
3728
|
for (const [k, v] of Object.entries(attrs)) {
|
|
3729
|
-
out[k] = typeof v === "string" ?
|
|
3729
|
+
out[k] = typeof v === "string" ? chunkA76OFN2B_cjs.redactSecrets(v) : v;
|
|
3730
3730
|
}
|
|
3731
3731
|
return out;
|
|
3732
3732
|
}
|
|
@@ -3808,10 +3808,10 @@ async function loadMarkdownEntities(opts) {
|
|
|
3808
3808
|
const raw = await promises.readFile(resolved.source, "utf8").catch(() => null);
|
|
3809
3809
|
if (raw === null) continue;
|
|
3810
3810
|
const split = splitFrontmatter(raw, resolved.source, errorCodePrefix);
|
|
3811
|
-
const fields =
|
|
3811
|
+
const fields = chunkLY4KEOOY_cjs.parseSimpleYaml(split.frontmatter);
|
|
3812
3812
|
const parsed = schema.safeParse(fields);
|
|
3813
3813
|
if (!parsed.success) {
|
|
3814
|
-
throw new
|
|
3814
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3815
3815
|
`Invalid frontmatter in ${resolved.source}: ${parsed.error.message}`,
|
|
3816
3816
|
{ code: `${errorCodePrefix}_frontmatter_invalid` }
|
|
3817
3817
|
);
|
|
@@ -3829,13 +3829,13 @@ async function assertFileSizeUnderCap(source, errorCodePrefix) {
|
|
|
3829
3829
|
try {
|
|
3830
3830
|
const info = await promises.stat(source);
|
|
3831
3831
|
if (info.size > MAX_MD_FILE_BYTES) {
|
|
3832
|
-
throw new
|
|
3832
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3833
3833
|
`Config file ${source} exceeds 1 MB size limit (${info.size} bytes). Reduce the file or split into multiple entities.`,
|
|
3834
3834
|
{ code: `${errorCodePrefix}_file_too_large` }
|
|
3835
3835
|
);
|
|
3836
3836
|
}
|
|
3837
3837
|
} catch (cause) {
|
|
3838
|
-
if (cause instanceof
|
|
3838
|
+
if (cause instanceof chunkE7WWIX34_cjs.ConfigurationError) throw cause;
|
|
3839
3839
|
}
|
|
3840
3840
|
}
|
|
3841
3841
|
async function readDirSafe(dir, errorCodePrefix) {
|
|
@@ -3844,7 +3844,7 @@ async function readDirSafe(dir, errorCodePrefix) {
|
|
|
3844
3844
|
} catch (cause) {
|
|
3845
3845
|
const code = cause.code;
|
|
3846
3846
|
if (code === "ENOENT") return null;
|
|
3847
|
-
throw new
|
|
3847
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Failed to read ${dir}`, {
|
|
3848
3848
|
code: `${errorCodePrefix}_dir_read_error`,
|
|
3849
3849
|
cause
|
|
3850
3850
|
});
|
|
@@ -3861,7 +3861,7 @@ function resolveEntryPath(entry, pattern, dir) {
|
|
|
3861
3861
|
function splitFrontmatter(raw, source, errorCodePrefix) {
|
|
3862
3862
|
const match = /^---\s*\n([\s\S]*?)\n---\s*(?:\n|$)/.exec(raw);
|
|
3863
3863
|
if (match === null) {
|
|
3864
|
-
throw new
|
|
3864
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
3865
3865
|
`Missing or malformed frontmatter in ${source} (expected \`---\` delimited block at file head)`,
|
|
3866
3866
|
{ code: `${errorCodePrefix}_missing_frontmatter` }
|
|
3867
3867
|
);
|
|
@@ -4345,7 +4345,7 @@ async function loadContextConfig(cwd) {
|
|
|
4345
4345
|
});
|
|
4346
4346
|
if (mdEntities.length > 0) {
|
|
4347
4347
|
if (fs.existsSync(jsonPath)) {
|
|
4348
|
-
|
|
4348
|
+
chunkK6TWHNT4_cjs.warnOnce(
|
|
4349
4349
|
"context-both-present",
|
|
4350
4350
|
"[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
|
|
4351
4351
|
);
|
|
@@ -4355,7 +4355,7 @@ async function loadContextConfig(cwd) {
|
|
|
4355
4355
|
};
|
|
4356
4356
|
}
|
|
4357
4357
|
if (!fs.existsSync(jsonPath)) return { sources: [] };
|
|
4358
|
-
|
|
4358
|
+
chunkK6TWHNT4_cjs.warnOnce(
|
|
4359
4359
|
"context-json-deprecated",
|
|
4360
4360
|
"[theokit-sdk] .theokit/context.json is deprecated; migrate to .theokit/context/<name>.md via theokit-migrate-config"
|
|
4361
4361
|
);
|
|
@@ -4363,7 +4363,7 @@ async function loadContextConfig(cwd) {
|
|
|
4363
4363
|
try {
|
|
4364
4364
|
raw = await promises.readFile(jsonPath, "utf8");
|
|
4365
4365
|
} catch (cause) {
|
|
4366
|
-
throw new
|
|
4366
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Failed to read context config: ${jsonPath}`, {
|
|
4367
4367
|
code: "context_read_error",
|
|
4368
4368
|
cause
|
|
4369
4369
|
});
|
|
@@ -4375,13 +4375,13 @@ function parseConfig(raw, configPath) {
|
|
|
4375
4375
|
try {
|
|
4376
4376
|
parsed = JSON.parse(raw);
|
|
4377
4377
|
} catch (cause) {
|
|
4378
|
-
throw new
|
|
4378
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Invalid JSON in context config: ${configPath}`, {
|
|
4379
4379
|
code: "context_json_invalid",
|
|
4380
4380
|
cause
|
|
4381
4381
|
});
|
|
4382
4382
|
}
|
|
4383
4383
|
if (!parsed || typeof parsed !== "object") {
|
|
4384
|
-
throw new
|
|
4384
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Context config must be an object: ${configPath}`, {
|
|
4385
4385
|
code: "context_config_shape"
|
|
4386
4386
|
});
|
|
4387
4387
|
}
|
|
@@ -4396,7 +4396,7 @@ function parseConfig(raw, configPath) {
|
|
|
4396
4396
|
}
|
|
4397
4397
|
function readSources(sourcesRaw, configPath) {
|
|
4398
4398
|
if (!Array.isArray(sourcesRaw)) {
|
|
4399
|
-
throw new
|
|
4399
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Context config sources must be an array: ${configPath}`, {
|
|
4400
4400
|
code: "context_sources_shape"
|
|
4401
4401
|
});
|
|
4402
4402
|
}
|
|
@@ -4494,7 +4494,7 @@ var PluginsManager = class {
|
|
|
4494
4494
|
async refresh() {
|
|
4495
4495
|
this.plugins = [];
|
|
4496
4496
|
const pluginsRoot = path.join(this.cwd, ".theokit", "plugins");
|
|
4497
|
-
const entries = await
|
|
4497
|
+
const entries = await chunkLY4KEOOY_cjs.readWorkspaceDir(pluginsRoot, "plugins_read_error", "plugins directory");
|
|
4498
4498
|
for (const entry of entries) {
|
|
4499
4499
|
if (!entry.isDirectory()) continue;
|
|
4500
4500
|
const folderName = entry.name;
|
|
@@ -4502,13 +4502,13 @@ var PluginsManager = class {
|
|
|
4502
4502
|
const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
|
|
4503
4503
|
const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(pluginsRoot, folderName) : await loadPluginManifestFromJson(jsonPath, folderName);
|
|
4504
4504
|
if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
|
|
4505
|
-
|
|
4505
|
+
chunkK6TWHNT4_cjs.warnOnce(
|
|
4506
4506
|
`plugin-${folderName}-both`,
|
|
4507
4507
|
`[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
|
|
4508
4508
|
);
|
|
4509
4509
|
}
|
|
4510
4510
|
if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
|
|
4511
|
-
|
|
4511
|
+
chunkK6TWHNT4_cjs.warnOnce(
|
|
4512
4512
|
"plugin-json-deprecated",
|
|
4513
4513
|
"[theokit-sdk] plugin.json manifests are deprecated; migrate to PLUGIN.md via theokit-migrate-config"
|
|
4514
4514
|
);
|
|
@@ -4526,11 +4526,11 @@ var PluginsManager = class {
|
|
|
4526
4526
|
const entry = metadata.entry;
|
|
4527
4527
|
if (entry === void 0) return;
|
|
4528
4528
|
const pluginRoot = path.join(this.cwd, ".theokit", "plugins", folderName);
|
|
4529
|
-
const entryPath =
|
|
4529
|
+
const entryPath = chunkZAKTZ5B4_cjs.safePathJoin(pluginRoot, entry);
|
|
4530
4530
|
try {
|
|
4531
4531
|
await promises.readFile(entryPath, "utf8");
|
|
4532
4532
|
} catch (cause) {
|
|
4533
|
-
throw new
|
|
4533
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${metadata.name} entry file is missing: ${entry}`, {
|
|
4534
4534
|
code: "plugin_entry_missing",
|
|
4535
4535
|
cause
|
|
4536
4536
|
});
|
|
@@ -4539,7 +4539,7 @@ var PluginsManager = class {
|
|
|
4539
4539
|
assertCloudRules() {
|
|
4540
4540
|
if (!this.cloud) return;
|
|
4541
4541
|
if (this.localPaths !== void 0 && this.localPaths.length > 0) {
|
|
4542
|
-
throw new
|
|
4542
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
4543
4543
|
"Cloud agents reject local plugin paths \u2014 plugins must come from committed repo files",
|
|
4544
4544
|
{ code: "cloud_plugin_path_rejected" }
|
|
4545
4545
|
);
|
|
@@ -4551,7 +4551,7 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
|
|
|
4551
4551
|
try {
|
|
4552
4552
|
raw = await promises.readFile(manifestPath, "utf8");
|
|
4553
4553
|
} catch (cause) {
|
|
4554
|
-
throw new
|
|
4554
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} is missing plugin.json`, {
|
|
4555
4555
|
code: "plugin_missing_manifest",
|
|
4556
4556
|
cause
|
|
4557
4557
|
});
|
|
@@ -4560,13 +4560,13 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
|
|
|
4560
4560
|
try {
|
|
4561
4561
|
parsed = JSON.parse(raw);
|
|
4562
4562
|
} catch (cause) {
|
|
4563
|
-
throw new
|
|
4563
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} manifest is invalid JSON`, {
|
|
4564
4564
|
code: "plugin_manifest_invalid",
|
|
4565
4565
|
cause
|
|
4566
4566
|
});
|
|
4567
4567
|
}
|
|
4568
4568
|
if (!parsed || typeof parsed !== "object") {
|
|
4569
|
-
throw new
|
|
4569
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} manifest must be an object`, {
|
|
4570
4570
|
code: "plugin_manifest_shape"
|
|
4571
4571
|
});
|
|
4572
4572
|
}
|
|
@@ -4585,7 +4585,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
|
|
|
4585
4585
|
try {
|
|
4586
4586
|
raw = await promises.readFile(mdPath, "utf8");
|
|
4587
4587
|
} catch (cause) {
|
|
4588
|
-
throw new
|
|
4588
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} is missing PLUGIN.md`, {
|
|
4589
4589
|
code: "plugin_missing_manifest",
|
|
4590
4590
|
cause
|
|
4591
4591
|
});
|
|
@@ -4600,7 +4600,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
|
|
|
4600
4600
|
});
|
|
4601
4601
|
const entity = entities.find((e) => e.slug === "PLUGIN");
|
|
4602
4602
|
if (entity === void 0) {
|
|
4603
|
-
throw new
|
|
4603
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} PLUGIN.md not parseable`, {
|
|
4604
4604
|
code: "plugin_missing_manifest"
|
|
4605
4605
|
});
|
|
4606
4606
|
}
|
|
@@ -4874,7 +4874,7 @@ function assertValidThresholds(soft, hard) {
|
|
|
4874
4874
|
["hardThreshold", hard]
|
|
4875
4875
|
]) {
|
|
4876
4876
|
if (!Number.isInteger(value) || value < 1) {
|
|
4877
|
-
throw new
|
|
4877
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
4878
4878
|
`doomLoop.${label} must be a positive integer (received ${value}).`,
|
|
4879
4879
|
{ code: "invalid_doom_loop_threshold" }
|
|
4880
4880
|
);
|
|
@@ -5187,7 +5187,7 @@ async function safeListTools(client, serverName) {
|
|
|
5187
5187
|
} catch (cause) {
|
|
5188
5188
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
5189
5189
|
const server = serverName ?? "unknown";
|
|
5190
|
-
|
|
5190
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] mcp listTools failed (server=${server}): ${message}
|
|
5191
5191
|
`);
|
|
5192
5192
|
return [];
|
|
5193
5193
|
}
|
|
@@ -5256,7 +5256,7 @@ function emitLlmMetrics(inputs, result, startAt) {
|
|
|
5256
5256
|
inputs.telemetry?.recordHistogram(HISTOGRAM_NAMES.LLM_USAGE_MISSING, 1, {
|
|
5257
5257
|
provider: inputs.llm.name
|
|
5258
5258
|
});
|
|
5259
|
-
|
|
5259
|
+
chunkA76OFN2B_cjs.diag(
|
|
5260
5260
|
`[theokit-sdk] llm usage missing from ${inputs.llm.name} finish \u2014 budget may undercount
|
|
5261
5261
|
`
|
|
5262
5262
|
);
|
|
@@ -5552,7 +5552,7 @@ function coerceArgsToSchema(args, schema) {
|
|
|
5552
5552
|
}
|
|
5553
5553
|
|
|
5554
5554
|
// src/tool-error.ts
|
|
5555
|
-
var ToolError = class extends
|
|
5555
|
+
var ToolError = class extends chunkE7WWIX34_cjs.TheokitAgentError {
|
|
5556
5556
|
name = "ToolError";
|
|
5557
5557
|
/** The error content surfaced to the model: a string, or text/image blocks. */
|
|
5558
5558
|
content;
|
|
@@ -5746,7 +5746,7 @@ function raceToolExecution(exec, opts) {
|
|
|
5746
5746
|
// src/internal/agent-loop/tool-dispatch.ts
|
|
5747
5747
|
async function dispatchTools(inputs, tools, toolCalls, events, parentSpan) {
|
|
5748
5748
|
const maxConcurrent = inputs.maxConcurrentTools ?? 4;
|
|
5749
|
-
return
|
|
5749
|
+
return chunkRHQJX3EI_cjs.mapWithConcurrency(
|
|
5750
5750
|
toolCalls,
|
|
5751
5751
|
maxConcurrent,
|
|
5752
5752
|
(call) => dispatchSingleCall(inputs, tools, call, events, parentSpan)
|
|
@@ -5774,7 +5774,7 @@ async function dispatchSingleCall(inputs, tools, call, events, parentSpan) {
|
|
|
5774
5774
|
toolSpan?.end();
|
|
5775
5775
|
return fileVeto;
|
|
5776
5776
|
}
|
|
5777
|
-
|
|
5777
|
+
chunkQMIG7TKG_cjs.emitRunEvent(inputs.runEventSink, {
|
|
5778
5778
|
type: "tool_progress",
|
|
5779
5779
|
toolName: workingCall.name,
|
|
5780
5780
|
toolCallId: callId
|
|
@@ -5805,7 +5805,7 @@ function applyRepairAndExtractCall(tools, call) {
|
|
|
5805
5805
|
function vetoFromForkWhitelist(inputs, call, callId, events) {
|
|
5806
5806
|
const whitelistDecision = chunkVJ26EKGJ_cjs.checkToolWhitelist(call.name);
|
|
5807
5807
|
if (whitelistDecision.allowed) return void 0;
|
|
5808
|
-
|
|
5808
|
+
chunkQMIG7TKG_cjs.emitRunEvent(inputs.runEventSink, {
|
|
5809
5809
|
type: "permission_denied",
|
|
5810
5810
|
toolName: call.name,
|
|
5811
5811
|
toolCallId: callId,
|
|
@@ -5850,7 +5850,7 @@ async function vetoFromPluginPreHook(inputs, call, callId, events) {
|
|
|
5850
5850
|
...inputs.permissionMode !== void 0 ? { permissionMode: inputs.permissionMode } : {}
|
|
5851
5851
|
});
|
|
5852
5852
|
if (pluginVeto === void 0) return void 0;
|
|
5853
|
-
|
|
5853
|
+
chunkQMIG7TKG_cjs.emitRunEvent(inputs.runEventSink, {
|
|
5854
5854
|
type: "permission_denied",
|
|
5855
5855
|
toolName: call.name,
|
|
5856
5856
|
toolCallId: callId,
|
|
@@ -5879,7 +5879,7 @@ async function vetoFromFileHookPreDecision(inputs, call, callId, events) {
|
|
|
5879
5879
|
runId: inputs.runId
|
|
5880
5880
|
});
|
|
5881
5881
|
if (!preDecision.blocked) return void 0;
|
|
5882
|
-
|
|
5882
|
+
chunkQMIG7TKG_cjs.emitRunEvent(inputs.runEventSink, {
|
|
5883
5883
|
type: "permission_denied",
|
|
5884
5884
|
toolName: call.name,
|
|
5885
5885
|
toolCallId: callId,
|
|
@@ -5980,7 +5980,7 @@ function finalizeSpanAndPostHook(inputs, call, callId, result, events, toolSpan)
|
|
|
5980
5980
|
agentId: inputs.agentId,
|
|
5981
5981
|
runId: inputs.runId
|
|
5982
5982
|
}).catch((err) => {
|
|
5983
|
-
|
|
5983
|
+
chunkA76OFN2B_cjs.diag(
|
|
5984
5984
|
`[theokit-sdk] postToolUse hook error (swallowed): ${err instanceof Error ? err.message : String(err)}
|
|
5985
5985
|
`
|
|
5986
5986
|
);
|
|
@@ -5999,7 +5999,7 @@ async function emitToolLifecycleDelta(inputs, update) {
|
|
|
5999
5999
|
try {
|
|
6000
6000
|
await inputs.onDelta({ update });
|
|
6001
6001
|
} catch (err) {
|
|
6002
|
-
|
|
6002
|
+
chunkA76OFN2B_cjs.diag(
|
|
6003
6003
|
`[theokit-sdk] onDelta tool-lifecycle emit error (swallowed): ${err instanceof Error ? err.message : String(err)}
|
|
6004
6004
|
`
|
|
6005
6005
|
);
|
|
@@ -6011,7 +6011,7 @@ async function safeEmitToolHook(callback, event) {
|
|
|
6011
6011
|
await callback(event);
|
|
6012
6012
|
} catch (cause) {
|
|
6013
6013
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
6014
|
-
|
|
6014
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] tool lifecycle hook threw: ${msg}
|
|
6015
6015
|
`);
|
|
6016
6016
|
}
|
|
6017
6017
|
}
|
|
@@ -6078,7 +6078,7 @@ function applyToolResultGuard(parts, opts) {
|
|
|
6078
6078
|
(p) => (
|
|
6079
6079
|
// SE7 — guard the TEXT of a tool result (string or the text blocks of a
|
|
6080
6080
|
// structured content); image blocks pass through untouched.
|
|
6081
|
-
p.type === "tool_result" ? { ...p, content:
|
|
6081
|
+
p.type === "tool_result" ? { ...p, content: chunkLR3VKB7A_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
|
|
6082
6082
|
)
|
|
6083
6083
|
);
|
|
6084
6084
|
}
|
|
@@ -6273,7 +6273,7 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
6273
6273
|
const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
|
|
6274
6274
|
if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
|
|
6275
6275
|
for (const key of candidates) {
|
|
6276
|
-
const info =
|
|
6276
|
+
const info = chunkUDSGSPUY_cjs.getCatalogModelInfo(key);
|
|
6277
6277
|
const cost = info?.cost;
|
|
6278
6278
|
if (cost === void 0) continue;
|
|
6279
6279
|
const [prov, ...modelParts] = key.split("/");
|
|
@@ -6285,7 +6285,7 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
6285
6285
|
...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
|
|
6286
6286
|
...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
|
|
6287
6287
|
// M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
|
|
6288
|
-
pricingVersion:
|
|
6288
|
+
pricingVersion: chunkUDSGSPUY_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
|
|
6289
6289
|
};
|
|
6290
6290
|
}
|
|
6291
6291
|
return void 0;
|
|
@@ -6738,15 +6738,15 @@ var FallbackLlmClient = class {
|
|
|
6738
6738
|
let lastError;
|
|
6739
6739
|
for (const client of this.clients) {
|
|
6740
6740
|
if (signal.aborted) throw abortError(signal);
|
|
6741
|
-
const attempt = await
|
|
6741
|
+
const attempt = await chunkLR3VKB7A_cjs.tryFirstEvent(client, request, signal, true);
|
|
6742
6742
|
if (attempt.kind === "handshake_error") {
|
|
6743
6743
|
lastError = attempt.error;
|
|
6744
6744
|
continue;
|
|
6745
6745
|
}
|
|
6746
|
-
return yield*
|
|
6746
|
+
return yield* chunkLR3VKB7A_cjs.relayStream(attempt.generator, attempt.firstResult);
|
|
6747
6747
|
}
|
|
6748
6748
|
if (lastError !== void 0) throw lastError;
|
|
6749
|
-
throw new
|
|
6749
|
+
throw new chunkE7WWIX34_cjs.NetworkError("FallbackLlmClient has no providers configured", {
|
|
6750
6750
|
code: "fallback_empty_chain"
|
|
6751
6751
|
});
|
|
6752
6752
|
}
|
|
@@ -6769,7 +6769,7 @@ function reconnectDelay(attempt) {
|
|
|
6769
6769
|
return ms <= 0 ? Promise.resolve() : new Promise((resolve) => setTimeout(resolve, ms));
|
|
6770
6770
|
}
|
|
6771
6771
|
function mcpTimeoutError(name, timeoutMs) {
|
|
6772
|
-
return new
|
|
6772
|
+
return new chunkE7WWIX34_cjs.NetworkError(`MCP ${name} request timed out after ${timeoutMs}ms`, {
|
|
6773
6773
|
code: "mcp_timeout"
|
|
6774
6774
|
});
|
|
6775
6775
|
}
|
|
@@ -6852,7 +6852,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6852
6852
|
child.stdin.on("error", () => void 0);
|
|
6853
6853
|
child.on("error", () => {
|
|
6854
6854
|
this.rejectAllPending(
|
|
6855
|
-
new
|
|
6855
|
+
new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} process crashed`, { code: "mcp_crashed" })
|
|
6856
6856
|
);
|
|
6857
6857
|
});
|
|
6858
6858
|
child.on("exit", () => {
|
|
@@ -6860,7 +6860,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6860
6860
|
this.child = void 0;
|
|
6861
6861
|
this.dropped = true;
|
|
6862
6862
|
this.rejectAllPending(
|
|
6863
|
-
new
|
|
6863
|
+
new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
|
|
6864
6864
|
);
|
|
6865
6865
|
});
|
|
6866
6866
|
}
|
|
@@ -6888,7 +6888,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6888
6888
|
if (this.child !== void 0) return Promise.resolve();
|
|
6889
6889
|
if (!this.dropped) {
|
|
6890
6890
|
return Promise.reject(
|
|
6891
|
-
new
|
|
6891
|
+
new chunkE7WWIX34_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
|
|
6892
6892
|
);
|
|
6893
6893
|
}
|
|
6894
6894
|
this.reconnectPromise ??= this.reconnect().finally(() => {
|
|
@@ -6909,13 +6909,13 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6909
6909
|
lastErr = err;
|
|
6910
6910
|
}
|
|
6911
6911
|
}
|
|
6912
|
-
throw new
|
|
6912
|
+
throw new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} reconnect exhausted`, {
|
|
6913
6913
|
code: "mcp_disconnected",
|
|
6914
6914
|
...lastErr instanceof Error ? { cause: lastErr } : {}
|
|
6915
6915
|
});
|
|
6916
6916
|
}
|
|
6917
6917
|
async close() {
|
|
6918
|
-
this.rejectAllPending(new
|
|
6918
|
+
this.rejectAllPending(new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} closed`, { code: "mcp_closed" }));
|
|
6919
6919
|
const child = this.child;
|
|
6920
6920
|
this.child = void 0;
|
|
6921
6921
|
this.dropped = false;
|
|
@@ -6934,7 +6934,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6934
6934
|
if (this.buffer.length > MAX_STDIO_BUFFER_BYTES) {
|
|
6935
6935
|
this.buffer = "";
|
|
6936
6936
|
this.rejectAllPending(
|
|
6937
|
-
new
|
|
6937
|
+
new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} exceeded stdout buffer limit`, {
|
|
6938
6938
|
code: "mcp_buffer_overflow"
|
|
6939
6939
|
})
|
|
6940
6940
|
);
|
|
@@ -6969,7 +6969,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6969
6969
|
if (child !== void 0) return this.send(child, method, params);
|
|
6970
6970
|
if (this.dropped) return this.reconnectAndRequest(method, params);
|
|
6971
6971
|
return Promise.reject(
|
|
6972
|
-
new
|
|
6972
|
+
new chunkE7WWIX34_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
|
|
6973
6973
|
);
|
|
6974
6974
|
}
|
|
6975
6975
|
/** M2 #59 — reconnect a dropped client, then send. Separate async path so the
|
|
@@ -6978,7 +6978,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6978
6978
|
await this.ensureConnected();
|
|
6979
6979
|
const child = this.child;
|
|
6980
6980
|
if (child === void 0) {
|
|
6981
|
-
throw new
|
|
6981
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" });
|
|
6982
6982
|
}
|
|
6983
6983
|
return this.send(child, method, params);
|
|
6984
6984
|
}
|
|
@@ -6995,7 +6995,7 @@ var StdioMcpClient = class extends BaseMcpClient {
|
|
|
6995
6995
|
this.child = void 0;
|
|
6996
6996
|
this.dropped = true;
|
|
6997
6997
|
this.rejectAllPending(
|
|
6998
|
-
new
|
|
6998
|
+
new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
|
|
6999
6999
|
);
|
|
7000
7000
|
}, this.timeoutMs);
|
|
7001
7001
|
this.pending.set(id, { resolve, reject, timer });
|
|
@@ -7073,7 +7073,7 @@ var HttpMcpClient = class extends BaseMcpClient {
|
|
|
7073
7073
|
if (payload === "") continue;
|
|
7074
7074
|
return JSON.parse(payload);
|
|
7075
7075
|
}
|
|
7076
|
-
throw new
|
|
7076
|
+
throw new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} returned an event stream with no data payload`, {
|
|
7077
7077
|
code: "mcp_http_error"
|
|
7078
7078
|
});
|
|
7079
7079
|
}
|
|
@@ -7101,7 +7101,7 @@ var HttpMcpClient = class extends BaseMcpClient {
|
|
|
7101
7101
|
throw cause;
|
|
7102
7102
|
}
|
|
7103
7103
|
if (!response.ok) {
|
|
7104
|
-
throw new
|
|
7104
|
+
throw new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} returned ${response.status}`, {
|
|
7105
7105
|
code: "mcp_http_error"
|
|
7106
7106
|
});
|
|
7107
7107
|
}
|
|
@@ -7117,14 +7117,14 @@ var HttpMcpClient = class extends BaseMcpClient {
|
|
|
7117
7117
|
function resolveMcpCwd(configCwd) {
|
|
7118
7118
|
if (configCwd === void 0) return process.cwd();
|
|
7119
7119
|
if (path.isAbsolute(configCwd)) return configCwd;
|
|
7120
|
-
return
|
|
7120
|
+
return chunkZAKTZ5B4_cjs.safePathJoin(process.cwd(), configCwd);
|
|
7121
7121
|
}
|
|
7122
7122
|
|
|
7123
7123
|
// src/internal/providers/register-plugin-providers.ts
|
|
7124
7124
|
function registerPluginProviderProfiles(entries) {
|
|
7125
7125
|
let registered2 = 0;
|
|
7126
7126
|
for (const entry of entries) {
|
|
7127
|
-
|
|
7127
|
+
chunkUDSGSPUY_cjs.registerProvider(entry.profile);
|
|
7128
7128
|
registered2 += 1;
|
|
7129
7129
|
}
|
|
7130
7130
|
return registered2;
|
|
@@ -7204,7 +7204,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
|
|
|
7204
7204
|
if (exposedSet.has(name)) continue;
|
|
7205
7205
|
const hint = suggestClosest(name, exposedSet);
|
|
7206
7206
|
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)`;
|
|
7207
|
-
|
|
7207
|
+
chunkK6TWHNT4_cjs.warnOnce(
|
|
7208
7208
|
`personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
|
|
7209
7209
|
message
|
|
7210
7210
|
);
|
|
@@ -7313,25 +7313,25 @@ function createRealLocalRun(options) {
|
|
|
7313
7313
|
}
|
|
7314
7314
|
var pluginProvidersAnnounced = false;
|
|
7315
7315
|
function resolveRunProvider(options) {
|
|
7316
|
-
|
|
7316
|
+
chunkUDSGSPUY_cjs.registerBuiltins();
|
|
7317
7317
|
const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
|
|
7318
7318
|
const registered2 = registerPluginProviderProfiles(profiles);
|
|
7319
7319
|
if (registered2 > 0 && !pluginProvidersAnnounced) {
|
|
7320
7320
|
pluginProvidersAnnounced = true;
|
|
7321
7321
|
const names = profiles.map((e) => e.profile.name).join(", ");
|
|
7322
|
-
|
|
7322
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] registered ${registered2} plugin provider profile(s): ${names}
|
|
7323
7323
|
`);
|
|
7324
7324
|
}
|
|
7325
7325
|
const parsedModel = chunkVYHJZVL5_cjs.parseModelId(options.model?.id);
|
|
7326
|
-
const modelInferredProvider = parsedModel.provider !== void 0 &&
|
|
7327
|
-
const keyInferredProvider =
|
|
7328
|
-
const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ??
|
|
7326
|
+
const modelInferredProvider = parsedModel.provider !== void 0 && chunkUDSGSPUY_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
|
|
7327
|
+
const keyInferredProvider = chunkLR3VKB7A_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
|
|
7328
|
+
const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkLR3VKB7A_cjs.detectPrimaryProvider();
|
|
7329
7329
|
const effectiveModelId = modelInferredProvider !== void 0 && modelInferredProvider === primary ? parsedModel.name : options.model?.id ?? "claude-sonnet-4-6";
|
|
7330
7330
|
return { primary, effectiveModelId };
|
|
7331
7331
|
}
|
|
7332
7332
|
function mergeExplicitApiKey(pools, primary, apiKey) {
|
|
7333
7333
|
if (apiKey === void 0 || apiKey.length === 0) return pools;
|
|
7334
|
-
if (
|
|
7334
|
+
if (chunkLR3VKB7A_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
|
|
7335
7335
|
const existing = pools?.[primary];
|
|
7336
7336
|
if (existing !== void 0 && existing.length > 0) return pools;
|
|
7337
7337
|
return { ...pools ?? {}, [primary]: [apiKey] };
|
|
@@ -7339,7 +7339,7 @@ function mergeExplicitApiKey(pools, primary, apiKey) {
|
|
|
7339
7339
|
function buildLoopInputs(options, runId, userText, userImages) {
|
|
7340
7340
|
const maxIterations = options.sendOptions.maxIterations;
|
|
7341
7341
|
if (maxIterations !== void 0 && (!Number.isInteger(maxIterations) || maxIterations < 1)) {
|
|
7342
|
-
throw new
|
|
7342
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
7343
7343
|
`SendOptions.maxIterations must be a positive integer, got ${maxIterations}`,
|
|
7344
7344
|
{ code: "invalid_max_iterations" }
|
|
7345
7345
|
);
|
|
@@ -7354,14 +7354,14 @@ function buildLoopInputs(options, runId, userText, userImages) {
|
|
|
7354
7354
|
const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
|
|
7355
7355
|
const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
|
|
7356
7356
|
const rateLimitSink = options.sendOptions.onRunEvent;
|
|
7357
|
-
const chain =
|
|
7357
|
+
const chain = chunkLR3VKB7A_cjs.resolveProviderChain({
|
|
7358
7358
|
primary,
|
|
7359
7359
|
...fallback !== void 0 ? { fallback } : {},
|
|
7360
7360
|
...apiKeys !== void 0 ? { apiKeys } : {},
|
|
7361
7361
|
...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {},
|
|
7362
7362
|
...extractToolCallsFromContent === true ? { extractToolCallsFromContent: true } : {},
|
|
7363
7363
|
...rateLimitSink !== void 0 ? {
|
|
7364
|
-
onRateLimit: (info) =>
|
|
7364
|
+
onRateLimit: (info) => chunkQMIG7TKG_cjs.emitRunEvent(rateLimitSink, { type: "rate_limit", ...info })
|
|
7365
7365
|
} : {}
|
|
7366
7366
|
});
|
|
7367
7367
|
const llm = chain.length === 1 ? chain[0] : new FallbackLlmClient(chain);
|
|
@@ -7626,7 +7626,7 @@ function buildRealRunOptions(args) {
|
|
|
7626
7626
|
};
|
|
7627
7627
|
}
|
|
7628
7628
|
async function createFixtureRunHelper(args) {
|
|
7629
|
-
const sessionMessages =
|
|
7629
|
+
const sessionMessages = chunkZ5DYGBPV_cjs.getSessionMessages(args.inputs.agentId);
|
|
7630
7630
|
const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
|
|
7631
7631
|
return createLocalRun({
|
|
7632
7632
|
agentId: args.inputs.agentId,
|
|
@@ -7645,7 +7645,7 @@ async function createFixtureRunHelper(args) {
|
|
|
7645
7645
|
}
|
|
7646
7646
|
async function dispatchLocalRun(args) {
|
|
7647
7647
|
const apiKey = resolveApiKey(args.inputs.options.apiKey);
|
|
7648
|
-
if (
|
|
7648
|
+
if (chunkLR3VKB7A_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
7649
7649
|
return createRealLocalRun(
|
|
7650
7650
|
buildRealRunOptions({
|
|
7651
7651
|
inputs: args.inputs,
|
|
@@ -7680,20 +7680,20 @@ async function readProjectMcpServers(cwd) {
|
|
|
7680
7680
|
|
|
7681
7681
|
// src/internal/local-agent/local-agent-invalidate.ts
|
|
7682
7682
|
async function applyDeferredInvalidation(agentId, pending, refresh) {
|
|
7683
|
-
|
|
7683
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] applying deferred cache invalidation (${agentId}): ${pending.reason}
|
|
7684
7684
|
`);
|
|
7685
7685
|
try {
|
|
7686
7686
|
await refresh();
|
|
7687
7687
|
} catch (err) {
|
|
7688
7688
|
const msg = err instanceof Error ? err.message : String(err);
|
|
7689
|
-
|
|
7689
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] invalidateCache reload failed (continuing): ${msg}
|
|
7690
7690
|
`);
|
|
7691
7691
|
}
|
|
7692
7692
|
}
|
|
7693
7693
|
async function invalidateCacheImpl(agentId, reason, options, disposed, dispose, setPending) {
|
|
7694
7694
|
if (disposed) return;
|
|
7695
7695
|
if (options.applyNow === true) {
|
|
7696
|
-
|
|
7696
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] invalidateCache applyNow disposing agent (${agentId}): ${reason}
|
|
7697
7697
|
`);
|
|
7698
7698
|
await dispose();
|
|
7699
7699
|
return;
|
|
@@ -7754,7 +7754,7 @@ var LiveAgentRegistry = class {
|
|
|
7754
7754
|
const existing = this.#agents.get(id);
|
|
7755
7755
|
if (existing !== void 0 && existing.agent !== agent) {
|
|
7756
7756
|
void existing.agent.dispose().catch(() => {
|
|
7757
|
-
|
|
7757
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] dispose during overwrite failed (${id})
|
|
7758
7758
|
`);
|
|
7759
7759
|
});
|
|
7760
7760
|
}
|
|
@@ -7858,7 +7858,7 @@ var LiveAgentRegistry = class {
|
|
|
7858
7858
|
await agent.dispose();
|
|
7859
7859
|
} catch (cause) {
|
|
7860
7860
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
7861
|
-
|
|
7861
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] dispose during eviction failed (${id}): ${msg}
|
|
7862
7862
|
`);
|
|
7863
7863
|
}
|
|
7864
7864
|
if (this.#onEvict !== void 0) {
|
|
@@ -7866,7 +7866,7 @@ var LiveAgentRegistry = class {
|
|
|
7866
7866
|
this.#onEvict(id, reason);
|
|
7867
7867
|
} catch (cause) {
|
|
7868
7868
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
7869
|
-
|
|
7869
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] onEvict listener threw (${id}): ${msg}
|
|
7870
7870
|
`);
|
|
7871
7871
|
}
|
|
7872
7872
|
}
|
|
@@ -7882,7 +7882,7 @@ async function acquireLeaseIfPossible(store, agentId) {
|
|
|
7882
7882
|
await a.call(store, agentId);
|
|
7883
7883
|
} catch (err) {
|
|
7884
7884
|
if (err instanceof Error && err.name === "SessionBusyError") throw err;
|
|
7885
|
-
|
|
7885
|
+
chunkA76OFN2B_cjs.diag(
|
|
7886
7886
|
`[theokit-sdk] writer lease unavailable for ${agentId} (${err instanceof Error ? err.message : String(err)}) \u2014 proceeding without single-writer protection
|
|
7887
7887
|
`
|
|
7888
7888
|
);
|
|
@@ -7901,16 +7901,16 @@ async function disposeLocalAgentSession(agent) {
|
|
|
7901
7901
|
agent.lifecycleAbortController.abort();
|
|
7902
7902
|
await chunkYLQQX5W2_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
|
|
7903
7903
|
disposeSessionMcpClients(agent.agentId);
|
|
7904
|
-
await
|
|
7904
|
+
await chunkZ5DYGBPV_cjs.flushSessionWrites();
|
|
7905
7905
|
await flushRegistrySaves(agent.workspaceCwd);
|
|
7906
7906
|
await disposeSessionStore(agent.sessionStore);
|
|
7907
|
-
|
|
7907
|
+
chunkZ5DYGBPV_cjs.discardSession(agent.workspaceCwd, agent.agentId);
|
|
7908
7908
|
}
|
|
7909
7909
|
async function reloadLocalAgent(agent) {
|
|
7910
7910
|
if (agent.context !== void 0) await agent.context.refresh();
|
|
7911
7911
|
if (agent.skillsManager !== void 0) await agent.skillsManager.refresh();
|
|
7912
7912
|
if (agent.pluginsManager !== void 0) await agent.pluginsManager.refresh();
|
|
7913
|
-
return await
|
|
7913
|
+
return await chunkLOTWA65Z_cjs.loadSubagents(
|
|
7914
7914
|
agent.workspaceCwd,
|
|
7915
7915
|
agent.settingSourcesIncludeProject,
|
|
7916
7916
|
agent.options.agents
|
|
@@ -7918,12 +7918,12 @@ async function reloadLocalAgent(agent) {
|
|
|
7918
7918
|
}
|
|
7919
7919
|
async function persistActiveMemoryTranscript(cwd, transcript) {
|
|
7920
7920
|
try {
|
|
7921
|
-
const dir = path.join(
|
|
7921
|
+
const dir = path.join(chunkLNTQRD23_cjs.memoryDir(cwd), "transcripts", "active-memory");
|
|
7922
7922
|
const file = path.join(dir, `${transcript.runId}.json`);
|
|
7923
|
-
await
|
|
7923
|
+
await chunk33B2BSME_cjs.atomicWriteJson(file, transcript);
|
|
7924
7924
|
} catch (cause) {
|
|
7925
7925
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
7926
|
-
|
|
7926
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] active-memory transcript persist failed: ${message}
|
|
7927
7927
|
`);
|
|
7928
7928
|
}
|
|
7929
7929
|
}
|
|
@@ -8044,7 +8044,7 @@ async function searchOnce(args, cfg, query, started) {
|
|
|
8044
8044
|
return { summary, durationMs: Date.now() - started, status: "ok", hits };
|
|
8045
8045
|
} catch (cause) {
|
|
8046
8046
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
8047
|
-
|
|
8047
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] active-memory recall failed: ${message}
|
|
8048
8048
|
`);
|
|
8049
8049
|
return { summary: void 0, durationMs: Date.now() - started, status: "error", hits: [] };
|
|
8050
8050
|
}
|
|
@@ -8164,7 +8164,7 @@ var azureOpenAiMemoryEmbeddingProviderAdapter = {
|
|
|
8164
8164
|
transport: "remote",
|
|
8165
8165
|
authProviderId: "azure-openai",
|
|
8166
8166
|
autoSelectPriority: 25,
|
|
8167
|
-
create: (options) =>
|
|
8167
|
+
create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
|
|
8168
8168
|
{
|
|
8169
8169
|
id: "azure-openai",
|
|
8170
8170
|
defaultBaseUrl: "https://your-resource.openai.azure.com",
|
|
@@ -8200,7 +8200,7 @@ var cohereMemoryEmbeddingProviderAdapter = {
|
|
|
8200
8200
|
transport: "remote",
|
|
8201
8201
|
authProviderId: "cohere",
|
|
8202
8202
|
autoSelectPriority: 30,
|
|
8203
|
-
create: (options) =>
|
|
8203
|
+
create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
|
|
8204
8204
|
{
|
|
8205
8205
|
id: "cohere",
|
|
8206
8206
|
defaultBaseUrl: "https://api.cohere.com",
|
|
@@ -8246,7 +8246,7 @@ var deepinfraMemoryEmbeddingProviderAdapter = {
|
|
|
8246
8246
|
transport: "remote",
|
|
8247
8247
|
authProviderId: "deepinfra",
|
|
8248
8248
|
autoSelectPriority: 13,
|
|
8249
|
-
create: (options) =>
|
|
8249
|
+
create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
|
|
8250
8250
|
{
|
|
8251
8251
|
id: "deepinfra",
|
|
8252
8252
|
defaultBaseUrl: "https://api.deepinfra.com",
|
|
@@ -8272,7 +8272,7 @@ var geminiMemoryEmbeddingProviderAdapter = {
|
|
|
8272
8272
|
transport: "remote",
|
|
8273
8273
|
authProviderId: "gemini",
|
|
8274
8274
|
autoSelectPriority: 30,
|
|
8275
|
-
create: (options) =>
|
|
8275
|
+
create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
|
|
8276
8276
|
{
|
|
8277
8277
|
id: "gemini",
|
|
8278
8278
|
defaultBaseUrl: "https://generativelanguage.googleapis.com",
|
|
@@ -8300,7 +8300,7 @@ var jinaMemoryEmbeddingProviderAdapter = {
|
|
|
8300
8300
|
transport: "remote",
|
|
8301
8301
|
authProviderId: "jina",
|
|
8302
8302
|
autoSelectPriority: 35,
|
|
8303
|
-
create: (options) =>
|
|
8303
|
+
create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
|
|
8304
8304
|
{
|
|
8305
8305
|
id: "jina",
|
|
8306
8306
|
defaultBaseUrl: "https://api.jina.ai",
|
|
@@ -8323,7 +8323,7 @@ var mistralMemoryEmbeddingProviderAdapter = {
|
|
|
8323
8323
|
transport: "remote",
|
|
8324
8324
|
authProviderId: "mistral",
|
|
8325
8325
|
autoSelectPriority: 18,
|
|
8326
|
-
create: (options) =>
|
|
8326
|
+
create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
|
|
8327
8327
|
{
|
|
8328
8328
|
id: "mistral",
|
|
8329
8329
|
defaultBaseUrl: "https://api.mistral.ai",
|
|
@@ -8365,7 +8365,7 @@ var ollamaMemoryEmbeddingProviderAdapter = {
|
|
|
8365
8365
|
autoSelectPriority: 10,
|
|
8366
8366
|
create: (options) => {
|
|
8367
8367
|
const apiKey = options.apiKey ?? process.env.OLLAMA_API_KEY ?? OLLAMA_LOCAL_SENTINEL_KEY;
|
|
8368
|
-
return
|
|
8368
|
+
return chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
|
|
8369
8369
|
{
|
|
8370
8370
|
id: "ollama",
|
|
8371
8371
|
defaultBaseUrl: "http://localhost:11434",
|
|
@@ -8392,7 +8392,7 @@ var openAiMemoryEmbeddingProviderAdapter = {
|
|
|
8392
8392
|
transport: "remote",
|
|
8393
8393
|
authProviderId: "openai",
|
|
8394
8394
|
autoSelectPriority: 20,
|
|
8395
|
-
create: (options) =>
|
|
8395
|
+
create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
|
|
8396
8396
|
{
|
|
8397
8397
|
id: "openai",
|
|
8398
8398
|
defaultBaseUrl: "https://api.openai.com",
|
|
@@ -8419,7 +8419,7 @@ var openRouterMemoryEmbeddingProviderAdapter = {
|
|
|
8419
8419
|
transport: "remote",
|
|
8420
8420
|
authProviderId: "openrouter",
|
|
8421
8421
|
autoSelectPriority: 15,
|
|
8422
|
-
create: (options) =>
|
|
8422
|
+
create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
|
|
8423
8423
|
{
|
|
8424
8424
|
id: "openrouter",
|
|
8425
8425
|
defaultBaseUrl: "https://openrouter.ai/api",
|
|
@@ -8447,7 +8447,7 @@ var voyageMemoryEmbeddingProviderAdapter = {
|
|
|
8447
8447
|
transport: "remote",
|
|
8448
8448
|
authProviderId: "voyage",
|
|
8449
8449
|
autoSelectPriority: 14,
|
|
8450
|
-
create: (options) =>
|
|
8450
|
+
create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
|
|
8451
8451
|
{
|
|
8452
8452
|
id: "voyage",
|
|
8453
8453
|
defaultBaseUrl: "https://api.voyageai.com",
|
|
@@ -8548,7 +8548,7 @@ function createMemorySearchTool(opts) {
|
|
|
8548
8548
|
};
|
|
8549
8549
|
}
|
|
8550
8550
|
function createMemoryGetTool(opts) {
|
|
8551
|
-
const memoryRoot = path.resolve(
|
|
8551
|
+
const memoryRoot = path.resolve(chunkLNTQRD23_cjs.memoryDir(opts.cwd));
|
|
8552
8552
|
return {
|
|
8553
8553
|
name: "memory_get",
|
|
8554
8554
|
description: GET_DESCRIPTION,
|
|
@@ -8559,7 +8559,7 @@ function createMemoryGetTool(opts) {
|
|
|
8559
8559
|
const lines = readNumber(input.lines);
|
|
8560
8560
|
const resolved = path.resolve(memoryRoot, relPath);
|
|
8561
8561
|
if (!isPathInside(memoryRoot, resolved)) {
|
|
8562
|
-
throw new
|
|
8562
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
8563
8563
|
`memory_get rejected path that escapes memory root: ${relPath}`,
|
|
8564
8564
|
{ code: "memory_path_escapes_root" }
|
|
8565
8565
|
);
|
|
@@ -8579,7 +8579,7 @@ function readString(value, errorIfMissing, allowUndefined = false) {
|
|
|
8579
8579
|
if (typeof value === "string") return value;
|
|
8580
8580
|
if (allowUndefined && (value === void 0 || value === null)) return "";
|
|
8581
8581
|
if (errorIfMissing !== void 0) {
|
|
8582
|
-
throw new
|
|
8582
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(errorIfMissing, { code: "memory_tool_bad_args" });
|
|
8583
8583
|
}
|
|
8584
8584
|
return "";
|
|
8585
8585
|
}
|
|
@@ -8655,7 +8655,7 @@ var LocalAgentMemory = class {
|
|
|
8655
8655
|
const openOpts = { cwd: this.workspaceCwd };
|
|
8656
8656
|
if (embedding !== void 0) openOpts.embedding = embedding;
|
|
8657
8657
|
if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
|
|
8658
|
-
this.index = await
|
|
8658
|
+
this.index = await chunkLNTQRD23_cjs.IndexManager.open(openOpts);
|
|
8659
8659
|
await this.index.sync();
|
|
8660
8660
|
this.toolsCache = [
|
|
8661
8661
|
createMemorySearchTool({ index: this.index }),
|
|
@@ -8670,7 +8670,7 @@ var LocalAgentMemory = class {
|
|
|
8670
8670
|
const warned2 = g[sym];
|
|
8671
8671
|
if (!warned2.has(message)) {
|
|
8672
8672
|
warned2.add(message);
|
|
8673
|
-
|
|
8673
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] memory tools unavailable: ${message}
|
|
8674
8674
|
`);
|
|
8675
8675
|
}
|
|
8676
8676
|
return void 0;
|
|
@@ -8679,7 +8679,7 @@ var LocalAgentMemory = class {
|
|
|
8679
8679
|
async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
|
|
8680
8680
|
const cfg = this.options.memory?.activeRecall;
|
|
8681
8681
|
if (cfg?.enabled !== true || this.index === void 0) return void 0;
|
|
8682
|
-
if (this.breaker === void 0) this.breaker = new
|
|
8682
|
+
if (this.breaker === void 0) this.breaker = new chunkLR3VKB7A_cjs.CircuitBreaker();
|
|
8683
8683
|
if (this.cache === void 0) this.cache = new ActiveMemoryCache();
|
|
8684
8684
|
const result = await runActiveMemory({
|
|
8685
8685
|
userText,
|
|
@@ -8729,7 +8729,7 @@ var LocalAgentMemory = class {
|
|
|
8729
8729
|
await this.index.sync();
|
|
8730
8730
|
} catch (cause) {
|
|
8731
8731
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
8732
|
-
|
|
8732
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] session index sync failed: ${message}
|
|
8733
8733
|
`);
|
|
8734
8734
|
}
|
|
8735
8735
|
}
|
|
@@ -8742,7 +8742,7 @@ var LocalAgentMemory = class {
|
|
|
8742
8742
|
return await adapter.create(cfg.model !== void 0 ? { model: cfg.model } : {});
|
|
8743
8743
|
} catch (cause) {
|
|
8744
8744
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
8745
|
-
|
|
8745
|
+
chunkA76OFN2B_cjs.diag(`[theokit-sdk] memory embedding ${cfg.provider} unavailable: ${message}
|
|
8746
8746
|
`);
|
|
8747
8747
|
return void 0;
|
|
8748
8748
|
}
|
|
@@ -8778,7 +8778,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
|
|
|
8778
8778
|
...partial?.metadata !== void 0 ? { metadata: partial.metadata } : defaultContext?.metadata !== void 0 ? { metadata: defaultContext.metadata } : {}
|
|
8779
8779
|
};
|
|
8780
8780
|
if (merged.userId === "") {
|
|
8781
|
-
throw new
|
|
8781
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
8782
8782
|
"agent.memory requires a userId \u2014 either set AgentOptions.memoryContext.userId or pass ctx.userId at call time.",
|
|
8783
8783
|
{ code: "memory_context_missing_user_id" }
|
|
8784
8784
|
);
|
|
@@ -8788,7 +8788,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
|
|
|
8788
8788
|
async function requireAdapters() {
|
|
8789
8789
|
const r = await ensure();
|
|
8790
8790
|
if (r.adapters.length === 0) {
|
|
8791
|
-
throw new
|
|
8791
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
8792
8792
|
"No memory adapter registered. Pass a memory plugin in AgentOptions.plugins (e.g. supermemoryMemory({...})).",
|
|
8793
8793
|
{ code: "no_memory_adapter" }
|
|
8794
8794
|
);
|
|
@@ -8829,7 +8829,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
|
|
|
8829
8829
|
const prefix = id.split(":", 1)[0] ?? "";
|
|
8830
8830
|
const target = adapters.find((a) => a.id === prefix);
|
|
8831
8831
|
if (target === void 0) {
|
|
8832
|
-
throw new
|
|
8832
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
8833
8833
|
`No adapter found for MemoryId prefix "${prefix}" (registered: ${adapters.map((a) => a.id).join(", ")}).`,
|
|
8834
8834
|
{ code: "no_memory_adapter" }
|
|
8835
8835
|
);
|
|
@@ -8902,7 +8902,7 @@ function createLocalAgentMemoryProvider(opts) {
|
|
|
8902
8902
|
return { facts: [], systemPromptAdditions: summary };
|
|
8903
8903
|
},
|
|
8904
8904
|
async recordSessionSummary(args) {
|
|
8905
|
-
await
|
|
8905
|
+
await chunkLNTQRD23_cjs.writeSessionSummary(args);
|
|
8906
8906
|
},
|
|
8907
8907
|
async sync(handle) {
|
|
8908
8908
|
const state = handle[INTERNAL_LAM_KEY];
|
|
@@ -8980,19 +8980,19 @@ var PersonalityRegistry = class _PersonalityRegistry {
|
|
|
8980
8980
|
function addEntity(byName, entity, origin, collisionMap) {
|
|
8981
8981
|
const fm = entity.frontmatter;
|
|
8982
8982
|
if (PersonalityRegistry.isReservedClearSlug(fm.name)) {
|
|
8983
|
-
throw new
|
|
8983
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
8984
8984
|
`Personality name "${fm.name}" is reserved (used to clear active preset)`,
|
|
8985
8985
|
{ code: "personality_reserved_name" }
|
|
8986
8986
|
);
|
|
8987
8987
|
}
|
|
8988
8988
|
if (entity.body.trim().length === 0) {
|
|
8989
|
-
throw new
|
|
8989
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
8990
8990
|
`Personality "${fm.name}" has empty body (system prompt required)`,
|
|
8991
8991
|
{ code: "personality_empty_body" }
|
|
8992
8992
|
);
|
|
8993
8993
|
}
|
|
8994
8994
|
if (origin === "project" && collisionMap?.has(fm.name)) {
|
|
8995
|
-
|
|
8995
|
+
chunkK6TWHNT4_cjs.warnOnce(
|
|
8996
8996
|
`personality-collision-${fm.name}`,
|
|
8997
8997
|
`[theokit-sdk] personality "${fm.name}" overridden by project preset`
|
|
8998
8998
|
);
|
|
@@ -9021,7 +9021,7 @@ async function performPersonalitySwitch(args) {
|
|
|
9021
9021
|
const preset = args.registry.get(args.requestedName);
|
|
9022
9022
|
if (preset === void 0) {
|
|
9023
9023
|
const available = args.registry.all().map((p) => p.name).join(", ") || "(none)";
|
|
9024
|
-
throw new
|
|
9024
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
9025
9025
|
`Personality "${args.requestedName}" not found. Available: ${available}`,
|
|
9026
9026
|
{ code: "personality_not_found" }
|
|
9027
9027
|
);
|
|
@@ -9042,14 +9042,14 @@ async function performPersonalitySwitch(args) {
|
|
|
9042
9042
|
|
|
9043
9043
|
// src/internal/local-agent/local-agent-personality-extensions.ts
|
|
9044
9044
|
function resolveActivePersonalityPreset(args) {
|
|
9045
|
-
const forkCtx =
|
|
9045
|
+
const forkCtx = chunkK6TWHNT4_cjs.currentPersonalityContext();
|
|
9046
9046
|
const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
|
|
9047
9047
|
if (slug === void 0) return void 0;
|
|
9048
9048
|
return args.personalityRegistry?.get(slug);
|
|
9049
9049
|
}
|
|
9050
9050
|
async function ensurePersonalityRegistryIfNeeded(args) {
|
|
9051
9051
|
if (args.personalityRegistry !== void 0) return args.personalityRegistry;
|
|
9052
|
-
const forkSlug =
|
|
9052
|
+
const forkSlug = chunkK6TWHNT4_cjs.currentPersonalityContext()?.slug;
|
|
9053
9053
|
const ownSlug = args.personalityStore.active(args.agentId);
|
|
9054
9054
|
if (forkSlug === void 0 && ownSlug === void 0) return void 0;
|
|
9055
9055
|
return await PersonalityRegistry.load(args.workspaceCwd);
|
|
@@ -9063,8 +9063,8 @@ ${preset.systemPrompt}`;
|
|
|
9063
9063
|
}
|
|
9064
9064
|
async function localAgentUsePersonality(args) {
|
|
9065
9065
|
if (args.disposed) throw new Error("Agent has been disposed");
|
|
9066
|
-
if (
|
|
9067
|
-
|
|
9066
|
+
if (chunkK6TWHNT4_cjs.currentPersonalityContext() !== void 0) {
|
|
9067
|
+
chunkK6TWHNT4_cjs.warnPersonalitySwitchInsideFork(args.agentId);
|
|
9068
9068
|
return null;
|
|
9069
9069
|
}
|
|
9070
9070
|
let registry = args.personalityRegistry;
|
|
@@ -9081,8 +9081,8 @@ async function localAgentUsePersonality(args) {
|
|
|
9081
9081
|
registry,
|
|
9082
9082
|
store: args.personalityStore,
|
|
9083
9083
|
invalidateCache: (reason) => args.invalidateCache(reason),
|
|
9084
|
-
appendSessionMessage: (msg) =>
|
|
9085
|
-
clearSession: () =>
|
|
9084
|
+
appendSessionMessage: (msg) => chunkZ5DYGBPV_cjs.appendSessionMessage(args.agentId, msg),
|
|
9085
|
+
clearSession: () => chunkZ5DYGBPV_cjs.clearSession(args.agentId),
|
|
9086
9086
|
opts: args.opts ?? {}
|
|
9087
9087
|
})
|
|
9088
9088
|
);
|
|
@@ -9093,7 +9093,7 @@ function localAgentRunUntil(agent, goal, options) {
|
|
|
9093
9093
|
async function* wrap() {
|
|
9094
9094
|
const { runUntilImpl } = await import('./run-until-L5KQD3PV.cjs');
|
|
9095
9095
|
const buildDeps = async () => {
|
|
9096
|
-
const { judgeCallImpl } = await import('./judge-call-
|
|
9096
|
+
const { judgeCallImpl } = await import('./judge-call-AIT3EULV.cjs');
|
|
9097
9097
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
9098
9098
|
const create = getAgentFacade().create;
|
|
9099
9099
|
return {
|
|
@@ -9126,7 +9126,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
|
|
|
9126
9126
|
async function localAgentFork(parent, options) {
|
|
9127
9127
|
const { forkAgentImpl } = await import('./fork-agent-Y2IK2RYU.cjs');
|
|
9128
9128
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
9129
|
-
const { withPersonalityContext } = await import('./context-
|
|
9129
|
+
const { withPersonalityContext } = await import('./context-DNFT4B5D.cjs');
|
|
9130
9130
|
const create = getAgentFacade().create;
|
|
9131
9131
|
return withPersonalityContext(
|
|
9132
9132
|
{ slug: parent.personalitySlugSnapshot, isFork: true },
|
|
@@ -9186,7 +9186,7 @@ function wrapRunWithCompletionCheck(args) {
|
|
|
9186
9186
|
judgeOpts
|
|
9187
9187
|
);
|
|
9188
9188
|
const complete = !verdict.parseFailed && verdict.verdict === "done";
|
|
9189
|
-
|
|
9189
|
+
chunkQMIG7TKG_cjs.emitRunEvent(args.onRunEvent, {
|
|
9190
9190
|
type: "completion_check",
|
|
9191
9191
|
complete,
|
|
9192
9192
|
reason: verdict.reason
|
|
@@ -9333,7 +9333,7 @@ function wrapRunWithOutputProcessors(args) {
|
|
|
9333
9333
|
if (result.status !== "finished" || result.result === void 0) return result;
|
|
9334
9334
|
const res = await runOutputProcessors(args.processors, result.result, args.agentId);
|
|
9335
9335
|
if (res.kind === "ok") return { ...result, result: res.value };
|
|
9336
|
-
|
|
9336
|
+
chunkQMIG7TKG_cjs.emitRunEvent(args.onRunEvent, {
|
|
9337
9337
|
type: "tripwire",
|
|
9338
9338
|
reason: res.tripwire.reason,
|
|
9339
9339
|
processorId: res.tripwire.processorId
|
|
@@ -9408,7 +9408,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
|
|
|
9408
9408
|
}
|
|
9409
9409
|
const res = await runInputProcessors(processors, rawUserText, inputs.agentId);
|
|
9410
9410
|
if (res.kind === "tripwire") {
|
|
9411
|
-
|
|
9411
|
+
chunkQMIG7TKG_cjs.emitRunEvent(options.onRunEvent, {
|
|
9412
9412
|
type: "tripwire",
|
|
9413
9413
|
reason: res.tripwire.reason,
|
|
9414
9414
|
processorId: res.tripwire.processorId
|
|
@@ -9425,7 +9425,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
|
|
|
9425
9425
|
return { userText: res.value, effectiveMessage };
|
|
9426
9426
|
}
|
|
9427
9427
|
async function executeSendLocked(inputs, message, options) {
|
|
9428
|
-
if (inputs.disposed) throw new
|
|
9428
|
+
if (inputs.disposed) throw new chunkE7WWIX34_cjs.AgentDisposedError(inputs.agentId);
|
|
9429
9429
|
await consumePending(inputs.agentId, inputs.invalidationPending, inputs.clearInvalidation, inputs.reload);
|
|
9430
9430
|
const sendModel = normalizeModel(options.model);
|
|
9431
9431
|
inputs.applyModelOverride(sendModel);
|
|
@@ -9436,7 +9436,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9436
9436
|
if (inputs.options.onBeforeSend !== void 0) {
|
|
9437
9437
|
await inputs.options.onBeforeSend({
|
|
9438
9438
|
conversationId: inputs.agentId,
|
|
9439
|
-
previousMessageCount:
|
|
9439
|
+
previousMessageCount: chunkZ5DYGBPV_cjs.getSessionMessages(inputs.agentId).length
|
|
9440
9440
|
});
|
|
9441
9441
|
}
|
|
9442
9442
|
await inputs.runPreHook(userText);
|
|
@@ -9448,8 +9448,8 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9448
9448
|
userText,
|
|
9449
9449
|
sendOptions: options
|
|
9450
9450
|
});
|
|
9451
|
-
const priorMessages = [...
|
|
9452
|
-
|
|
9451
|
+
const priorMessages = [...chunkZ5DYGBPV_cjs.getSessionMessages(inputs.agentId)];
|
|
9452
|
+
chunkZ5DYGBPV_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
|
|
9453
9453
|
await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
|
|
9454
9454
|
const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory);
|
|
9455
9455
|
const portPathActive = shouldUsePortMemoryPath();
|
|
@@ -9507,7 +9507,7 @@ async function executeSendLocked(inputs, message, options) {
|
|
|
9507
9507
|
function buildCompletionCheckDeps() {
|
|
9508
9508
|
return {
|
|
9509
9509
|
judge: async (ctx, opts) => {
|
|
9510
|
-
const { judgeCallImpl } = await import('./judge-call-
|
|
9510
|
+
const { judgeCallImpl } = await import('./judge-call-AIT3EULV.cjs');
|
|
9511
9511
|
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
9512
9512
|
return judgeCallImpl(ctx, opts, { create: getAgentFacade().create });
|
|
9513
9513
|
}
|
|
@@ -9527,7 +9527,7 @@ function registerRunAsTask(run, agentId, taskOpt, userText) {
|
|
|
9527
9527
|
promptPreview: userText.slice(0, 120),
|
|
9528
9528
|
...opts.meta ?? {}
|
|
9529
9529
|
};
|
|
9530
|
-
void
|
|
9530
|
+
void chunkQMIG7TKG_cjs.submit({
|
|
9531
9531
|
kind: "run",
|
|
9532
9532
|
work: async (ctx) => {
|
|
9533
9533
|
ctx.signal.addEventListener(
|
|
@@ -9611,7 +9611,7 @@ var LocalAgent = class {
|
|
|
9611
9611
|
this.options = options;
|
|
9612
9612
|
this.workspaceCwd = resolveCwd(options.local?.cwd);
|
|
9613
9613
|
this.transcriptBaseDir = resolveBaseDir(options.local?.baseDir);
|
|
9614
|
-
this.sessionStore = options.local?.sessionStore ?? new
|
|
9614
|
+
this.sessionStore = options.local?.sessionStore ?? new chunkMWVLE5RY_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
|
|
9615
9615
|
this.settingSourcesIncludeProject = includesSetting(options, "project");
|
|
9616
9616
|
this.settingSourcesIncludePlugins = includesSetting(options, "plugins");
|
|
9617
9617
|
const sub = bootstrapSubmanagers({
|
|
@@ -9654,14 +9654,14 @@ var LocalAgent = class {
|
|
|
9654
9654
|
if (this.pluginsManager !== void 0) await this.pluginsManager.initialize();
|
|
9655
9655
|
const codePlugins = chunkBV2MWEMV_cjs.extractCodePlugins(this.options.plugins);
|
|
9656
9656
|
await this.pluginManagerCode.initialize(codePlugins);
|
|
9657
|
-
this.resolvedSubagents = await
|
|
9657
|
+
this.resolvedSubagents = await chunkLOTWA65Z_cjs.loadSubagents(
|
|
9658
9658
|
this.workspaceCwd,
|
|
9659
9659
|
this.settingSourcesIncludeProject,
|
|
9660
9660
|
this.options.agents
|
|
9661
9661
|
);
|
|
9662
9662
|
await acquireLeaseIfPossible(this.sessionStore, this.agentId);
|
|
9663
9663
|
try {
|
|
9664
|
-
await
|
|
9664
|
+
await chunkZ5DYGBPV_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
|
|
9665
9665
|
await this.personalityStore.hydrate(this.agentId);
|
|
9666
9666
|
} catch (err) {
|
|
9667
9667
|
await releaseLeaseIfPossible(this.sessionStore, this.agentId);
|
|
@@ -9810,7 +9810,7 @@ var LocalAgent = class {
|
|
|
9810
9810
|
agentId: this.agentId
|
|
9811
9811
|
});
|
|
9812
9812
|
if (preRun.blocked) {
|
|
9813
|
-
throw new
|
|
9813
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
9814
9814
|
`preRun hook denied execution: ${preRun.reason ?? "unspecified"}`,
|
|
9815
9815
|
{ code: "hook_denied" }
|
|
9816
9816
|
);
|
|
@@ -9891,7 +9891,7 @@ var LocalAgent = class {
|
|
|
9891
9891
|
}
|
|
9892
9892
|
// biome-ignore format: G8 budget — see listArtifacts.
|
|
9893
9893
|
downloadArtifact(_path) {
|
|
9894
|
-
return Promise.reject(new
|
|
9894
|
+
return Promise.reject(new chunkE7WWIX34_cjs.UnsupportedRunOperationError("Artifacts are not supported for local agents", "downloadArtifact"));
|
|
9895
9895
|
}
|
|
9896
9896
|
// biome-ignore format: G8 budget — delegates to `local-agent-runtime-extensions.ts`; kept 1-line.
|
|
9897
9897
|
runUntil(goal, options) {
|
|
@@ -9914,7 +9914,7 @@ function resolveCwd(cwd) {
|
|
|
9914
9914
|
return (Array.isArray(cwd) ? cwd[0] : cwd) ?? process.cwd();
|
|
9915
9915
|
}
|
|
9916
9916
|
function resolveBaseDir(baseDir) {
|
|
9917
|
-
return baseDir === void 0 ?
|
|
9917
|
+
return baseDir === void 0 ? chunkNJVV5OAV_cjs.defaultBaseDir() : chunkNJVV5OAV_cjs.expandTilde(baseDir);
|
|
9918
9918
|
}
|
|
9919
9919
|
function includesSetting(options, source) {
|
|
9920
9920
|
const sources = options.local?.settingSources;
|
|
@@ -9939,7 +9939,7 @@ async function guardAgainstIdCollision(options) {
|
|
|
9939
9939
|
const persistenceCwd = resolveAgentPersistenceCwd(options);
|
|
9940
9940
|
await hydrateRegistryFromDisk(persistenceCwd);
|
|
9941
9941
|
if (getRegisteredAgent(options.agentId) !== void 0) {
|
|
9942
|
-
throw new
|
|
9942
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
9943
9943
|
`Agent "${options.agentId}" already exists. Use Agent.resume("${options.agentId}") to reattach, or pick a different agentId.`,
|
|
9944
9944
|
{ code: "agent_id_already_exists" }
|
|
9945
9945
|
);
|
|
@@ -9972,7 +9972,7 @@ async function maybeInjectHandoffTools(options) {
|
|
|
9972
9972
|
const spec = "@theokit/sdk-handoff/internal/tool-injector";
|
|
9973
9973
|
mod = await import(spec);
|
|
9974
9974
|
} catch (err) {
|
|
9975
|
-
throw new
|
|
9975
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
9976
9976
|
"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).",
|
|
9977
9977
|
{ code: "handoff_package_missing", cause: err }
|
|
9978
9978
|
);
|
|
@@ -9992,9 +9992,9 @@ async function maybeInjectHandoffTools(options) {
|
|
|
9992
9992
|
async function createLocalAgent(options) {
|
|
9993
9993
|
const apiKey = resolveApiKey(options.apiKey);
|
|
9994
9994
|
if (apiKey === void 0) {
|
|
9995
|
-
throw new
|
|
9995
|
+
throw new chunkE7WWIX34_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
|
|
9996
9996
|
}
|
|
9997
|
-
const willFlowToProvider = !
|
|
9997
|
+
const willFlowToProvider = !chunkLR3VKB7A_cjs.isFixtureApiKey(apiKey) && !chunkLR3VKB7A_cjs.shouldUseRealLocalRuntime(apiKey);
|
|
9998
9998
|
const shape = validateApiKeyShape(apiKey, {
|
|
9999
9999
|
strict: willFlowToProvider,
|
|
10000
10000
|
// `options.model` is already normalized by `runCreateUnderSpan`; `normalizeModel`
|
|
@@ -10003,10 +10003,10 @@ async function createLocalAgent(options) {
|
|
|
10003
10003
|
...willFlowToProvider ? { provider: providerFromModelId(normalizeModel(options.model)?.id) } : {}
|
|
10004
10004
|
});
|
|
10005
10005
|
if (shape.malformed) {
|
|
10006
|
-
throw new
|
|
10006
|
+
throw new chunkE7WWIX34_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
10007
10007
|
}
|
|
10008
|
-
if (!
|
|
10009
|
-
throw new
|
|
10008
|
+
if (!chunkLR3VKB7A_cjs.isFixtureApiKey(apiKey) && chunkLR3VKB7A_cjs.getConfiguredBaseUrl() === void 0 && !chunkLR3VKB7A_cjs.shouldUseRealLocalRuntime(apiKey)) {
|
|
10009
|
+
throw new chunkE7WWIX34_cjs.AuthenticationError("Invalid API key", {
|
|
10010
10010
|
code: "authentication_error"
|
|
10011
10011
|
});
|
|
10012
10012
|
}
|
|
@@ -10017,19 +10017,19 @@ async function createLocalAgent(options) {
|
|
|
10017
10017
|
async function createCloudAgent(options) {
|
|
10018
10018
|
const apiKey = resolveApiKey(options.apiKey);
|
|
10019
10019
|
if (apiKey === void 0) {
|
|
10020
|
-
throw new
|
|
10020
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError("Missing API key for cloud agent", {
|
|
10021
10021
|
code: "missing_api_key"
|
|
10022
10022
|
});
|
|
10023
10023
|
}
|
|
10024
10024
|
const shape = validateApiKeyShape(apiKey);
|
|
10025
10025
|
if (shape.malformed) {
|
|
10026
|
-
throw new
|
|
10026
|
+
throw new chunkE7WWIX34_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
|
|
10027
10027
|
}
|
|
10028
|
-
const baseUrl =
|
|
10028
|
+
const baseUrl = chunkLR3VKB7A_cjs.getConfiguredBaseUrl();
|
|
10029
10029
|
if (baseUrl === void 0) {
|
|
10030
10030
|
return new CloudAgent(options);
|
|
10031
10031
|
}
|
|
10032
|
-
const response = await
|
|
10032
|
+
const response = await chunkLR3VKB7A_cjs.httpRequest("/v1/agents", {
|
|
10033
10033
|
apiKey,
|
|
10034
10034
|
method: "POST",
|
|
10035
10035
|
body: {
|
|
@@ -10054,7 +10054,7 @@ function resolveAgentPersistenceCwd(options) {
|
|
|
10054
10054
|
return process.cwd();
|
|
10055
10055
|
}
|
|
10056
10056
|
async function rehydrateExistingAgent(agentId, existing, options) {
|
|
10057
|
-
await
|
|
10057
|
+
await chunkLR3VKB7A_cjs.discoverProviderPlugins();
|
|
10058
10058
|
await validateRehydratedAgent(agentId, existing);
|
|
10059
10059
|
const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
|
|
10060
10060
|
const mergedOptions = {
|
|
@@ -10085,7 +10085,7 @@ async function validateRehydratedAgent(agentId, entry) {
|
|
|
10085
10085
|
throw new Error(`Workspace path is not a directory: ${candidate}`);
|
|
10086
10086
|
}
|
|
10087
10087
|
} catch (cause) {
|
|
10088
|
-
throw new
|
|
10088
|
+
throw new chunkE7WWIX34_cjs.UnknownAgentError(
|
|
10089
10089
|
`Agent "${agentId}" cannot be rehydrated \u2014 workspace cwd "${candidate}" is missing or inaccessible.`,
|
|
10090
10090
|
{ code: "agent_rehydration_failed", cause }
|
|
10091
10091
|
);
|
|
@@ -10137,7 +10137,7 @@ async function getRegisteredAgentOrThrow(agentId) {
|
|
|
10137
10137
|
agent = getRegisteredAgent(agentId);
|
|
10138
10138
|
}
|
|
10139
10139
|
if (agent === void 0) {
|
|
10140
|
-
throw new
|
|
10140
|
+
throw new chunkE7WWIX34_cjs.UnknownAgentError(`Agent ${agentId} not found`, { code: "unknown_agent" });
|
|
10141
10141
|
}
|
|
10142
10142
|
return agent;
|
|
10143
10143
|
}
|
|
@@ -10182,7 +10182,7 @@ var Agent = class _Agent {
|
|
|
10182
10182
|
pluginCount: enabledPluginNames(options.plugins).length
|
|
10183
10183
|
});
|
|
10184
10184
|
try {
|
|
10185
|
-
await
|
|
10185
|
+
await chunkLR3VKB7A_cjs.discoverProviderPlugins();
|
|
10186
10186
|
const agent = await runCreateUnderSpan(options, span);
|
|
10187
10187
|
return agent;
|
|
10188
10188
|
} catch (err) {
|
|
@@ -10208,8 +10208,8 @@ var Agent = class _Agent {
|
|
|
10208
10208
|
const run = await agent.send(message);
|
|
10209
10209
|
const result = await run.wait();
|
|
10210
10210
|
if (options.throwOnError === true && result.status === "error" && result.error !== void 0) {
|
|
10211
|
-
throw new
|
|
10212
|
-
code:
|
|
10211
|
+
throw new chunkE7WWIX34_cjs.AgentRunError(result.error.message, {
|
|
10212
|
+
code: chunkE7WWIX34_cjs.coerceToKnownAgentRunErrorCode(result.error.code),
|
|
10213
10213
|
cause: result.error.cause
|
|
10214
10214
|
});
|
|
10215
10215
|
}
|
|
@@ -10236,7 +10236,7 @@ var Agent = class _Agent {
|
|
|
10236
10236
|
if (existing !== void 0) {
|
|
10237
10237
|
return await rehydrateExistingAgent(agentId, existing, options);
|
|
10238
10238
|
}
|
|
10239
|
-
throw new
|
|
10239
|
+
throw new chunkE7WWIX34_cjs.UnknownAgentError(
|
|
10240
10240
|
`Agent "${agentId}" not found. Use Agent.create({ agentId, ... }) for first-time setup, or catch UnknownAgentError to branch resume-vs-create.`,
|
|
10241
10241
|
{ code: "unknown_agent" }
|
|
10242
10242
|
);
|
|
@@ -10265,7 +10265,7 @@ var Agent = class _Agent {
|
|
|
10265
10265
|
* @public
|
|
10266
10266
|
*/
|
|
10267
10267
|
static async generateObject(options) {
|
|
10268
|
-
const { generateObjectImpl } = await import('./generate-object-
|
|
10268
|
+
const { generateObjectImpl } = await import('./generate-object-QILSGTEJ.cjs');
|
|
10269
10269
|
return generateObjectImpl(options, {
|
|
10270
10270
|
create: (opts) => _Agent.create(opts),
|
|
10271
10271
|
delete: (agentId) => _Agent.delete(agentId)
|
|
@@ -10289,7 +10289,7 @@ var Agent = class _Agent {
|
|
|
10289
10289
|
delete: (agentId) => _Agent.delete(agentId)
|
|
10290
10290
|
};
|
|
10291
10291
|
async function* wrapper() {
|
|
10292
|
-
streamObjectImport ??= import('./stream-object-
|
|
10292
|
+
streamObjectImport ??= import('./stream-object-3HEUGMQY.cjs');
|
|
10293
10293
|
const { streamObjectImpl } = await streamObjectImport;
|
|
10294
10294
|
yield* streamObjectImpl(options, deps);
|
|
10295
10295
|
}
|
|
@@ -10313,7 +10313,7 @@ var Agent = class _Agent {
|
|
|
10313
10313
|
* @public
|
|
10314
10314
|
*/
|
|
10315
10315
|
static async batch(prompts, options) {
|
|
10316
|
-
const { batchImpl } = await import('./batch-
|
|
10316
|
+
const { batchImpl } = await import('./batch-FO2KZN7W.cjs');
|
|
10317
10317
|
return batchImpl(prompts, options, { create: (opts) => _Agent.create(opts) });
|
|
10318
10318
|
}
|
|
10319
10319
|
/**
|
|
@@ -10393,14 +10393,14 @@ var Agent = class _Agent {
|
|
|
10393
10393
|
*/
|
|
10394
10394
|
static async getRun(runId, options = {}) {
|
|
10395
10395
|
if (options.runtime === "cloud") {
|
|
10396
|
-
throw new
|
|
10396
|
+
throw new chunkE7WWIX34_cjs.ConfigurationError(
|
|
10397
10397
|
"Cloud runtime is pre-release. Theo PaaS endpoints are not wired yet \u2014 getRun({ runtime: 'cloud' }) will be enabled when the PaaS ships.",
|
|
10398
10398
|
{ code: "cloud_runtime_pre_release" }
|
|
10399
10399
|
);
|
|
10400
10400
|
}
|
|
10401
10401
|
const existing = getRun(runId);
|
|
10402
10402
|
if (existing !== void 0) return existing;
|
|
10403
|
-
throw new
|
|
10403
|
+
throw new chunkE7WWIX34_cjs.UnknownAgentError(
|
|
10404
10404
|
`Run ${runId} is not in this process's registry. It may have been disposed, persisted in a previous process, or never created.`,
|
|
10405
10405
|
{ code: "run_not_found" }
|
|
10406
10406
|
);
|
|
@@ -10447,13 +10447,13 @@ var Agent = class _Agent {
|
|
|
10447
10447
|
reg = getRegisteredAgent(agentId);
|
|
10448
10448
|
}
|
|
10449
10449
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
10450
|
-
throw new
|
|
10450
|
+
throw new chunkE7WWIX34_cjs.UnknownAgentError(
|
|
10451
10451
|
`No local agent "${agentId}" registered \u2014 compact targets local sessions.`
|
|
10452
10452
|
);
|
|
10453
10453
|
}
|
|
10454
|
-
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-
|
|
10454
|
+
const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-FCEFK2CG.cjs');
|
|
10455
10455
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
10456
|
-
return
|
|
10456
|
+
return chunkZ5DYGBPV_cjs.enqueueSessionWrite(
|
|
10457
10457
|
cwd,
|
|
10458
10458
|
agentId,
|
|
10459
10459
|
() => compactSessionTranscript({
|
|
@@ -10483,11 +10483,11 @@ var Agent = class _Agent {
|
|
|
10483
10483
|
reg = getRegisteredAgent(agentId);
|
|
10484
10484
|
}
|
|
10485
10485
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
10486
|
-
throw new
|
|
10486
|
+
throw new chunkE7WWIX34_cjs.UnknownAgentError(
|
|
10487
10487
|
`No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
|
|
10488
10488
|
);
|
|
10489
10489
|
}
|
|
10490
|
-
const { injectSessionTurn } = await import('./inject-session-
|
|
10490
|
+
const { injectSessionTurn } = await import('./inject-session-BIVVFWGL.cjs');
|
|
10491
10491
|
const { cwd, model, store } = await openLocalStore(reg);
|
|
10492
10492
|
await injectSessionTurn({
|
|
10493
10493
|
store,
|
|
@@ -10522,11 +10522,11 @@ var Agent = class _Agent {
|
|
|
10522
10522
|
reg = getRegisteredAgent(agentId);
|
|
10523
10523
|
}
|
|
10524
10524
|
if (reg === void 0 || reg.runtime !== "local") {
|
|
10525
|
-
throw new
|
|
10525
|
+
throw new chunkE7WWIX34_cjs.UnknownAgentError(
|
|
10526
10526
|
`No local agent "${agentId}" registered \u2014 transcript targets local sessions.`
|
|
10527
10527
|
);
|
|
10528
10528
|
}
|
|
10529
|
-
const { readSessionMessages } = await import('./agent-session-store-
|
|
10529
|
+
const { readSessionMessages } = await import('./agent-session-store-RHTLZ5OX.cjs');
|
|
10530
10530
|
const { store } = await openLocalStore(reg);
|
|
10531
10531
|
return readSessionMessages(store, agentId);
|
|
10532
10532
|
}
|
|
@@ -10547,7 +10547,7 @@ var Agent = class _Agent {
|
|
|
10547
10547
|
*/
|
|
10548
10548
|
static async describe(agentId) {
|
|
10549
10549
|
const agent = await getRegisteredAgentOrThrow(agentId);
|
|
10550
|
-
const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-
|
|
10550
|
+
const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-F52ARQ62.cjs');
|
|
10551
10551
|
const settingSources = agent.options.local?.settingSources;
|
|
10552
10552
|
const subagents = await loadSubagents2(
|
|
10553
10553
|
agent.cwd ?? process.cwd(),
|
|
@@ -10591,12 +10591,12 @@ async function getOrCreateUncached(agentId, options) {
|
|
|
10591
10591
|
try {
|
|
10592
10592
|
return await Agent.resume(agentId, options);
|
|
10593
10593
|
} catch (err) {
|
|
10594
|
-
if (!(err instanceof
|
|
10594
|
+
if (!(err instanceof chunkE7WWIX34_cjs.UnknownAgentError)) throw err;
|
|
10595
10595
|
}
|
|
10596
10596
|
try {
|
|
10597
10597
|
return await Agent.create({ ...options, agentId });
|
|
10598
10598
|
} catch (err) {
|
|
10599
|
-
if (err instanceof
|
|
10599
|
+
if (err instanceof chunkE7WWIX34_cjs.ConfigurationError && err.code === "agent_id_already_exists") {
|
|
10600
10600
|
return await Agent.resume(agentId, options);
|
|
10601
10601
|
}
|
|
10602
10602
|
throw err;
|
|
@@ -10614,8 +10614,8 @@ async function openLocalStore(reg) {
|
|
|
10614
10614
|
const cwd = reg.cwd ?? process.cwd();
|
|
10615
10615
|
const optModel = reg.options.model;
|
|
10616
10616
|
const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
|
|
10617
|
-
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-
|
|
10618
|
-
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-
|
|
10617
|
+
const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-V32XJ63Z.cjs');
|
|
10618
|
+
const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-SLQRKQ72.cjs');
|
|
10619
10619
|
const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
|
|
10620
10620
|
return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
|
|
10621
10621
|
}
|
|
@@ -10632,5 +10632,5 @@ exports.generateCronId = generateCronId;
|
|
|
10632
10632
|
exports.getPricingEntry = getPricingEntry;
|
|
10633
10633
|
exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
|
|
10634
10634
|
exports.resolveApiKey = resolveApiKey;
|
|
10635
|
-
//# sourceMappingURL=chunk-
|
|
10636
|
-
//# sourceMappingURL=chunk-
|
|
10635
|
+
//# sourceMappingURL=chunk-AYDSWY35.cjs.map
|
|
10636
|
+
//# sourceMappingURL=chunk-AYDSWY35.cjs.map
|