@theokit/sdk 0.0.0-compat-580-20260905204608
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 +7923 -0
- package/LICENSE +201 -0
- package/README.md +114 -0
- package/dist/a2a/agent-mailbox.d.cts +54 -0
- package/dist/a2a/agent-mailbox.d.ts +54 -0
- package/dist/a2a/index.cjs +138 -0
- package/dist/a2a/index.cjs.map +1 -0
- package/dist/a2a/index.d.cts +10 -0
- package/dist/a2a/index.d.ts +10 -0
- package/dist/a2a/index.js +125 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/a2a/message-bus.d.cts +118 -0
- package/dist/a2a/message-bus.d.ts +118 -0
- package/dist/a2a/subagent.d.cts +231 -0
- package/dist/a2a/subagent.d.ts +231 -0
- package/dist/a2a/types.d.cts +45 -0
- package/dist/a2a/types.d.ts +45 -0
- package/dist/agent-ARLOD4JX.cjs +67 -0
- package/dist/agent-ARLOD4JX.cjs.map +1 -0
- package/dist/agent-C3KO5LKm.d.cts +1871 -0
- package/dist/agent-CvmTR9uf.d.ts +1871 -0
- package/dist/agent-N6WJ54ML.js +58 -0
- package/dist/agent-N6WJ54ML.js.map +1 -0
- package/dist/agent-builder.d.ts +72 -0
- package/dist/agent-factory-registry-UU46BUMU.cjs +16 -0
- package/dist/agent-factory-registry-UU46BUMU.cjs.map +1 -0
- package/dist/agent-factory-registry-ZVTABLEY.js +3 -0
- package/dist/agent-factory-registry-ZVTABLEY.js.map +1 -0
- package/dist/agent-factory.d.ts +24 -0
- package/dist/agent-generate.d.ts +12 -0
- package/dist/agent-session-store-AFML3AXC.js +6 -0
- package/dist/agent-session-store-AFML3AXC.js.map +1 -0
- package/dist/agent-session-store-MTSIY3MH.cjs +23 -0
- package/dist/agent-session-store-MTSIY3MH.cjs.map +1 -0
- package/dist/agent.d.ts +276 -0
- package/dist/auth/index.cjs +306 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +34 -0
- package/dist/auth/index.d.ts +34 -0
- package/dist/auth/index.js +247 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/batch-I6T6MXZO.cjs +263 -0
- package/dist/batch-I6T6MXZO.cjs.map +1 -0
- package/dist/batch-US4F6WPK.js +260 -0
- package/dist/batch-US4F6WPK.js.map +1 -0
- package/dist/chunk-24MGQDK3.js +31 -0
- package/dist/chunk-24MGQDK3.js.map +1 -0
- package/dist/chunk-24SYBZPL.cjs +121 -0
- package/dist/chunk-24SYBZPL.cjs.map +1 -0
- package/dist/chunk-2HPNT6HH.cjs +3373 -0
- package/dist/chunk-2HPNT6HH.cjs.map +1 -0
- package/dist/chunk-2SFBB54R.js +23 -0
- package/dist/chunk-2SFBB54R.js.map +1 -0
- package/dist/chunk-2WXHA33T.js +105 -0
- package/dist/chunk-2WXHA33T.js.map +1 -0
- package/dist/chunk-2XC6KDJM.js +22 -0
- package/dist/chunk-2XC6KDJM.js.map +1 -0
- package/dist/chunk-2XRAWOZZ.js +172 -0
- package/dist/chunk-2XRAWOZZ.js.map +1 -0
- package/dist/chunk-2ZPEDVLM.cjs +59 -0
- package/dist/chunk-2ZPEDVLM.cjs.map +1 -0
- package/dist/chunk-3EE6LVWT.cjs +29 -0
- package/dist/chunk-3EE6LVWT.cjs.map +1 -0
- package/dist/chunk-3JHIFQ4I.js +102 -0
- package/dist/chunk-3JHIFQ4I.js.map +1 -0
- package/dist/chunk-44I6UYVH.js +133 -0
- package/dist/chunk-44I6UYVH.js.map +1 -0
- package/dist/chunk-47TF32NQ.js +79 -0
- package/dist/chunk-47TF32NQ.js.map +1 -0
- package/dist/chunk-4A3SKJ53.cjs +297 -0
- package/dist/chunk-4A3SKJ53.cjs.map +1 -0
- package/dist/chunk-4HS6FFGL.cjs +433 -0
- package/dist/chunk-4HS6FFGL.cjs.map +1 -0
- package/dist/chunk-4MMWFSCD.js +25 -0
- package/dist/chunk-4MMWFSCD.js.map +1 -0
- package/dist/chunk-4NLCWGH7.cjs +177 -0
- package/dist/chunk-4NLCWGH7.cjs.map +1 -0
- package/dist/chunk-55GB6JYQ.js +208 -0
- package/dist/chunk-55GB6JYQ.js.map +1 -0
- package/dist/chunk-5WKQDIGO.js +136 -0
- package/dist/chunk-5WKQDIGO.js.map +1 -0
- package/dist/chunk-67SBTGMA.cjs +457 -0
- package/dist/chunk-67SBTGMA.cjs.map +1 -0
- package/dist/chunk-6LHQPOMI.cjs +193 -0
- package/dist/chunk-6LHQPOMI.cjs.map +1 -0
- package/dist/chunk-6M2OIS4Y.js +158 -0
- package/dist/chunk-6M2OIS4Y.js.map +1 -0
- package/dist/chunk-6PWOWXMC.js +121 -0
- package/dist/chunk-6PWOWXMC.js.map +1 -0
- package/dist/chunk-6X6ID4MO.js +20 -0
- package/dist/chunk-6X6ID4MO.js.map +1 -0
- package/dist/chunk-7A6535RA.cjs +231 -0
- package/dist/chunk-7A6535RA.cjs.map +1 -0
- package/dist/chunk-7FDKWDA2.cjs +135 -0
- package/dist/chunk-7FDKWDA2.cjs.map +1 -0
- package/dist/chunk-7I5Z3UBJ.js +10 -0
- package/dist/chunk-7I5Z3UBJ.js.map +1 -0
- package/dist/chunk-7JJ3A6AT.cjs +88 -0
- package/dist/chunk-7JJ3A6AT.cjs.map +1 -0
- package/dist/chunk-7SZAV6QG.js +593 -0
- package/dist/chunk-7SZAV6QG.js.map +1 -0
- package/dist/chunk-A4RAL2ER.cjs +51 -0
- package/dist/chunk-A4RAL2ER.cjs.map +1 -0
- package/dist/chunk-AA27GEYS.cjs +12 -0
- package/dist/chunk-AA27GEYS.cjs.map +1 -0
- package/dist/chunk-AAEZSPTC.js +133 -0
- package/dist/chunk-AAEZSPTC.js.map +1 -0
- package/dist/chunk-AGACYRJ2.js +11 -0
- package/dist/chunk-AGACYRJ2.js.map +1 -0
- package/dist/chunk-ALUN2B4W.js +356 -0
- package/dist/chunk-ALUN2B4W.js.map +1 -0
- package/dist/chunk-ANMJJD6D.cjs +18 -0
- package/dist/chunk-ANMJJD6D.cjs.map +1 -0
- package/dist/chunk-ATT276RD.cjs +173 -0
- package/dist/chunk-ATT276RD.cjs.map +1 -0
- package/dist/chunk-AW6F6HZR.js +166 -0
- package/dist/chunk-AW6F6HZR.js.map +1 -0
- package/dist/chunk-AWINL3ZC.js +109 -0
- package/dist/chunk-AWINL3ZC.js.map +1 -0
- package/dist/chunk-BJUJT5ED.cjs +186 -0
- package/dist/chunk-BJUJT5ED.cjs.map +1 -0
- package/dist/chunk-BUUUWQMB.cjs +34 -0
- package/dist/chunk-BUUUWQMB.cjs.map +1 -0
- package/dist/chunk-BV2MWEMV.cjs +26 -0
- package/dist/chunk-BV2MWEMV.cjs.map +1 -0
- package/dist/chunk-CFE6QF2Q.js +221 -0
- package/dist/chunk-CFE6QF2Q.js.map +1 -0
- package/dist/chunk-CZJ6Q7CW.js +183 -0
- package/dist/chunk-CZJ6Q7CW.js.map +1 -0
- package/dist/chunk-D3CCY3A2.cjs +10995 -0
- package/dist/chunk-D3CCY3A2.cjs.map +1 -0
- package/dist/chunk-D6POWE7E.cjs +210 -0
- package/dist/chunk-D6POWE7E.cjs.map +1 -0
- package/dist/chunk-DMRT67Y6.js +100 -0
- package/dist/chunk-DMRT67Y6.js.map +1 -0
- package/dist/chunk-DQZU7JK6.cjs +125 -0
- package/dist/chunk-DQZU7JK6.cjs.map +1 -0
- package/dist/chunk-EFMFILPG.js +77 -0
- package/dist/chunk-EFMFILPG.js.map +1 -0
- package/dist/chunk-EH6XD3FY.js +222 -0
- package/dist/chunk-EH6XD3FY.js.map +1 -0
- package/dist/chunk-EIQFAOFD.js +229 -0
- package/dist/chunk-EIQFAOFD.js.map +1 -0
- package/dist/chunk-EPSICJLZ.js +79 -0
- package/dist/chunk-EPSICJLZ.js.map +1 -0
- package/dist/chunk-EXTRW7GW.cjs +155 -0
- package/dist/chunk-EXTRW7GW.cjs.map +1 -0
- package/dist/chunk-FD2UT76F.js +3 -0
- package/dist/chunk-FD2UT76F.js.map +1 -0
- package/dist/chunk-FJWQP6EE.js +122 -0
- package/dist/chunk-FJWQP6EE.js.map +1 -0
- package/dist/chunk-FRITRLZQ.cjs +24 -0
- package/dist/chunk-FRITRLZQ.cjs.map +1 -0
- package/dist/chunk-FUSDYC2B.cjs +280 -0
- package/dist/chunk-FUSDYC2B.cjs.map +1 -0
- package/dist/chunk-G7BLGBRN.js +43 -0
- package/dist/chunk-G7BLGBRN.js.map +1 -0
- package/dist/chunk-GBCVPKHE.js +282 -0
- package/dist/chunk-GBCVPKHE.js.map +1 -0
- package/dist/chunk-GHX4P3V2.cjs +34 -0
- package/dist/chunk-GHX4P3V2.cjs.map +1 -0
- package/dist/chunk-GZV6AVRL.cjs +282 -0
- package/dist/chunk-GZV6AVRL.cjs.map +1 -0
- package/dist/chunk-H73MEMQB.js +31 -0
- package/dist/chunk-H73MEMQB.js.map +1 -0
- package/dist/chunk-HCT4HPCL.cjs +235 -0
- package/dist/chunk-HCT4HPCL.cjs.map +1 -0
- package/dist/chunk-HFEJE7AC.js +424 -0
- package/dist/chunk-HFEJE7AC.js.map +1 -0
- package/dist/chunk-HKCKOAIO.js +57 -0
- package/dist/chunk-HKCKOAIO.js.map +1 -0
- package/dist/chunk-HUFSABUZ.cjs +48 -0
- package/dist/chunk-HUFSABUZ.cjs.map +1 -0
- package/dist/chunk-HW7SEELD.cjs +46 -0
- package/dist/chunk-HW7SEELD.cjs.map +1 -0
- package/dist/chunk-HY66GLM6.js +13 -0
- package/dist/chunk-HY66GLM6.js.map +1 -0
- package/dist/chunk-I2PWY7VM.cjs +27 -0
- package/dist/chunk-I2PWY7VM.cjs.map +1 -0
- package/dist/chunk-IJ7M6GOG.cjs +28 -0
- package/dist/chunk-IJ7M6GOG.cjs.map +1 -0
- package/dist/chunk-IU5N5224.cjs +288 -0
- package/dist/chunk-IU5N5224.cjs.map +1 -0
- package/dist/chunk-IUMAQURF.js +130 -0
- package/dist/chunk-IUMAQURF.js.map +1 -0
- package/dist/chunk-J7J7J2GN.cjs +377 -0
- package/dist/chunk-J7J7J2GN.cjs.map +1 -0
- package/dist/chunk-JLRLCBJ4.cjs +108 -0
- package/dist/chunk-JLRLCBJ4.cjs.map +1 -0
- package/dist/chunk-JMDDYA22.js +171 -0
- package/dist/chunk-JMDDYA22.js.map +1 -0
- package/dist/chunk-JNAA4G4H.js +43 -0
- package/dist/chunk-JNAA4G4H.js.map +1 -0
- package/dist/chunk-JOFVLOFY.js +268 -0
- package/dist/chunk-JOFVLOFY.js.map +1 -0
- package/dist/chunk-K2BQQ445.js +30 -0
- package/dist/chunk-K2BQQ445.js.map +1 -0
- package/dist/chunk-K2VMFZQ5.js +487 -0
- package/dist/chunk-K2VMFZQ5.js.map +1 -0
- package/dist/chunk-K3NH62DG.js +3343 -0
- package/dist/chunk-K3NH62DG.js.map +1 -0
- package/dist/chunk-KGANQYP7.cjs +172 -0
- package/dist/chunk-KGANQYP7.cjs.map +1 -0
- package/dist/chunk-KRD3GQAA.cjs +71 -0
- package/dist/chunk-KRD3GQAA.cjs.map +1 -0
- package/dist/chunk-KTTHHYEW.cjs +45 -0
- package/dist/chunk-KTTHHYEW.cjs.map +1 -0
- package/dist/chunk-KVNWIAO4.js +68 -0
- package/dist/chunk-KVNWIAO4.js.map +1 -0
- package/dist/chunk-KVSAY6NZ.cjs +497 -0
- package/dist/chunk-KVSAY6NZ.cjs.map +1 -0
- package/dist/chunk-LOHMT36V.cjs +178 -0
- package/dist/chunk-LOHMT36V.cjs.map +1 -0
- package/dist/chunk-LX7SEXOQ.js +152 -0
- package/dist/chunk-LX7SEXOQ.js.map +1 -0
- package/dist/chunk-MUUQ2WFJ.cjs +4 -0
- package/dist/chunk-MUUQ2WFJ.cjs.map +1 -0
- package/dist/chunk-N6OOOYFZ.js +281 -0
- package/dist/chunk-N6OOOYFZ.js.map +1 -0
- package/dist/chunk-NAF4L3T6.js +22 -0
- package/dist/chunk-NAF4L3T6.js.map +1 -0
- package/dist/chunk-NINIJCHU.cjs +23 -0
- package/dist/chunk-NINIJCHU.cjs.map +1 -0
- package/dist/chunk-NJWYQWDL.js +43 -0
- package/dist/chunk-NJWYQWDL.js.map +1 -0
- package/dist/chunk-NQTD6QOW.cjs +226 -0
- package/dist/chunk-NQTD6QOW.cjs.map +1 -0
- package/dist/chunk-NQTNSHSB.cjs +843 -0
- package/dist/chunk-NQTNSHSB.cjs.map +1 -0
- package/dist/chunk-NVXXWAU7.cjs +13 -0
- package/dist/chunk-NVXXWAU7.cjs.map +1 -0
- package/dist/chunk-NYQ3IS7K.cjs +130 -0
- package/dist/chunk-NYQ3IS7K.cjs.map +1 -0
- package/dist/chunk-O6USDERH.js +165 -0
- package/dist/chunk-O6USDERH.js.map +1 -0
- package/dist/chunk-OBA6YK2R.cjs +8 -0
- package/dist/chunk-OBA6YK2R.cjs.map +1 -0
- package/dist/chunk-OQRGVTQF.js +169 -0
- package/dist/chunk-OQRGVTQF.js.map +1 -0
- package/dist/chunk-OR6XIWLB.js +19 -0
- package/dist/chunk-OR6XIWLB.js.map +1 -0
- package/dist/chunk-OYD3U3LY.js +10981 -0
- package/dist/chunk-OYD3U3LY.js.map +1 -0
- package/dist/chunk-PRZ3BES7.cjs +79 -0
- package/dist/chunk-PRZ3BES7.cjs.map +1 -0
- package/dist/chunk-PY2RQOA7.js +6 -0
- package/dist/chunk-PY2RQOA7.js.map +1 -0
- package/dist/chunk-Q5EWJPRY.js +18 -0
- package/dist/chunk-Q5EWJPRY.js.map +1 -0
- package/dist/chunk-QATRS7JD.cjs +158 -0
- package/dist/chunk-QATRS7JD.cjs.map +1 -0
- package/dist/chunk-QC55H6RJ.cjs +601 -0
- package/dist/chunk-QC55H6RJ.cjs.map +1 -0
- package/dist/chunk-QDM3OHUT.cjs +134 -0
- package/dist/chunk-QDM3OHUT.cjs.map +1 -0
- package/dist/chunk-QKLOP4VC.cjs +90 -0
- package/dist/chunk-QKLOP4VC.cjs.map +1 -0
- package/dist/chunk-QOGNZMHD.cjs +34 -0
- package/dist/chunk-QOGNZMHD.cjs.map +1 -0
- package/dist/chunk-QWD3CZWE.cjs +108 -0
- package/dist/chunk-QWD3CZWE.cjs.map +1 -0
- package/dist/chunk-QWD4RDZ3.cjs +136 -0
- package/dist/chunk-QWD4RDZ3.cjs.map +1 -0
- package/dist/chunk-QYLZQ43D.cjs +172 -0
- package/dist/chunk-QYLZQ43D.cjs.map +1 -0
- package/dist/chunk-R7WIIPUR.js +27 -0
- package/dist/chunk-R7WIIPUR.js.map +1 -0
- package/dist/chunk-RQMCOFAI.cjs +85 -0
- package/dist/chunk-RQMCOFAI.cjs.map +1 -0
- package/dist/chunk-SA6K24NB.cjs +25 -0
- package/dist/chunk-SA6K24NB.cjs.map +1 -0
- package/dist/chunk-SADXXGWU.js +809 -0
- package/dist/chunk-SADXXGWU.js.map +1 -0
- package/dist/chunk-SAGRF4IB.js +25 -0
- package/dist/chunk-SAGRF4IB.js.map +1 -0
- package/dist/chunk-SVQIW5RJ.js +81 -0
- package/dist/chunk-SVQIW5RJ.js.map +1 -0
- package/dist/chunk-TA3K7SBK.js +180 -0
- package/dist/chunk-TA3K7SBK.js.map +1 -0
- package/dist/chunk-TFG5IBZS.cjs +139 -0
- package/dist/chunk-TFG5IBZS.cjs.map +1 -0
- package/dist/chunk-TMKTSYDS.cjs +21 -0
- package/dist/chunk-TMKTSYDS.cjs.map +1 -0
- package/dist/chunk-UADQJBHR.cjs +172 -0
- package/dist/chunk-UADQJBHR.cjs.map +1 -0
- package/dist/chunk-UBR5PWD7.js +275 -0
- package/dist/chunk-UBR5PWD7.js.map +1 -0
- package/dist/chunk-UKMBRMGT.js +22 -0
- package/dist/chunk-UKMBRMGT.js.map +1 -0
- package/dist/chunk-V22DZIXO.js +147 -0
- package/dist/chunk-V22DZIXO.js.map +1 -0
- package/dist/chunk-VE6DFSKU.js +107 -0
- package/dist/chunk-VE6DFSKU.js.map +1 -0
- package/dist/chunk-VPK6PHIE.cjs +211 -0
- package/dist/chunk-VPK6PHIE.cjs.map +1 -0
- package/dist/chunk-VTYY7XL5.cjs +15 -0
- package/dist/chunk-VTYY7XL5.cjs.map +1 -0
- package/dist/chunk-VWUXIVEI.js +583 -0
- package/dist/chunk-VWUXIVEI.js.map +1 -0
- package/dist/chunk-WE22OXQA.js +48 -0
- package/dist/chunk-WE22OXQA.js.map +1 -0
- package/dist/chunk-WMWEI3NS.js +120 -0
- package/dist/chunk-WMWEI3NS.js.map +1 -0
- package/dist/chunk-WS5ULCL4.js +204 -0
- package/dist/chunk-WS5ULCL4.js.map +1 -0
- package/dist/chunk-XB4GI5RZ.js +115 -0
- package/dist/chunk-XB4GI5RZ.js.map +1 -0
- package/dist/chunk-XU6MLSC6.js +455 -0
- package/dist/chunk-XU6MLSC6.js.map +1 -0
- package/dist/chunk-XYFGKVZ7.js +15 -0
- package/dist/chunk-XYFGKVZ7.js.map +1 -0
- package/dist/chunk-Y2KYR2ED.cjs +118 -0
- package/dist/chunk-Y2KYR2ED.cjs.map +1 -0
- package/dist/chunk-YIFFF23U.cjs +109 -0
- package/dist/chunk-YIFFF23U.cjs.map +1 -0
- package/dist/chunk-YJNYDJ2T.cjs +27 -0
- package/dist/chunk-YJNYDJ2T.cjs.map +1 -0
- package/dist/chunk-YSTXFWQE.cjs +127 -0
- package/dist/chunk-YSTXFWQE.cjs.map +1 -0
- package/dist/chunk-Z2JFX372.cjs +595 -0
- package/dist/chunk-Z2JFX372.cjs.map +1 -0
- package/dist/chunk-Z3NTRKIC.cjs +111 -0
- package/dist/chunk-Z3NTRKIC.cjs.map +1 -0
- package/dist/chunk-ZF2LDKQQ.cjs +20 -0
- package/dist/chunk-ZF2LDKQQ.cjs.map +1 -0
- package/dist/client/index.cjs +73 -0
- package/dist/client/index.cjs.map +1 -0
- package/dist/client/index.d.cts +12 -0
- package/dist/client/index.d.ts +12 -0
- package/dist/client/index.js +71 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/theokit-client.d.cts +60 -0
- package/dist/client/theokit-client.d.ts +60 -0
- package/dist/client/types.d.cts +51 -0
- package/dist/client/types.d.ts +51 -0
- package/dist/compact-session-BHTPCIHA.cjs +61 -0
- package/dist/compact-session-BHTPCIHA.cjs.map +1 -0
- package/dist/compact-session-W4WLJTHA.js +24 -0
- package/dist/compact-session-W4WLJTHA.js.map +1 -0
- package/dist/compaction.cjs +66 -0
- package/dist/compaction.cjs.map +1 -0
- package/dist/compaction.d.cts +240 -0
- package/dist/compaction.d.ts +240 -0
- package/dist/compaction.js +5 -0
- package/dist/compaction.js.map +1 -0
- package/dist/concurrency.cjs +23 -0
- package/dist/concurrency.cjs.map +1 -0
- package/dist/concurrency.d.cts +22 -0
- package/dist/concurrency.d.ts +22 -0
- package/dist/concurrency.js +17 -0
- package/dist/concurrency.js.map +1 -0
- package/dist/context/index.cjs +37 -0
- package/dist/context/index.cjs.map +1 -0
- package/dist/context/index.d.cts +78 -0
- package/dist/context/index.d.ts +78 -0
- package/dist/context/index.js +20 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context-4QOEWRDF.cjs +23 -0
- package/dist/context-4QOEWRDF.cjs.map +1 -0
- package/dist/context-Z3CFTT3H.js +6 -0
- package/dist/context-Z3CFTT3H.js.map +1 -0
- package/dist/create-skill.d.ts +40 -0
- package/dist/cron-C3PhZED0.d.cts +246 -0
- package/dist/cron-crfMMdAw.d.ts +246 -0
- package/dist/cron.cjs +68 -0
- package/dist/cron.cjs.map +1 -0
- package/dist/cron.d.cts +7 -0
- package/dist/cron.d.ts +7 -0
- package/dist/cron.js +59 -0
- package/dist/cron.js.map +1 -0
- package/dist/define-tool.d.ts +86 -0
- package/dist/errors-CLOAyuiv.d.ts +569 -0
- package/dist/errors-DrDEgyz1.d.cts +569 -0
- package/dist/errors-base-B5g01neU.d.cts +75 -0
- package/dist/errors-base-B5g01neU.d.ts +75 -0
- package/dist/errors-base.d.ts +73 -0
- package/dist/errors.cjs +89 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +4 -0
- package/dist/errors.d.ts +4 -0
- package/dist/errors.js +4 -0
- package/dist/errors.js.map +1 -0
- package/dist/eval.cjs +1056 -0
- package/dist/eval.cjs.map +1 -0
- package/dist/eval.d.cts +77 -0
- package/dist/eval.d.ts +77 -0
- package/dist/eval.js +1042 -0
- package/dist/eval.js.map +1 -0
- package/dist/event-bus.d.ts +42 -0
- package/dist/executor-XQAOQOHD.cjs +993 -0
- package/dist/executor-XQAOQOHD.cjs.map +1 -0
- package/dist/executor-ZNDQDX6Q.js +989 -0
- package/dist/executor-ZNDQDX6Q.js.map +1 -0
- package/dist/filesystem/index.cjs +204 -0
- package/dist/filesystem/index.cjs.map +1 -0
- package/dist/filesystem/index.d.cts +12 -0
- package/dist/filesystem/index.d.ts +12 -0
- package/dist/filesystem/index.js +195 -0
- package/dist/filesystem/index.js.map +1 -0
- package/dist/filesystem/local-filesystem.d.cts +54 -0
- package/dist/filesystem/local-filesystem.d.ts +54 -0
- package/dist/filesystem/types.d.cts +136 -0
- package/dist/filesystem/types.d.ts +136 -0
- package/dist/fork-agent-S2EPIML7.js +61 -0
- package/dist/fork-agent-S2EPIML7.js.map +1 -0
- package/dist/fork-agent-WAEQI2DL.cjs +64 -0
- package/dist/fork-agent-WAEQI2DL.cjs.map +1 -0
- package/dist/fs-session-store-77JU46UZ.js +10 -0
- package/dist/fs-session-store-77JU46UZ.js.map +1 -0
- package/dist/fs-session-store-E4U3P56L.cjs +19 -0
- package/dist/fs-session-store-E4U3P56L.cjs.map +1 -0
- package/dist/generate-object-BXV7BZRP.js +7 -0
- package/dist/generate-object-BXV7BZRP.js.map +1 -0
- package/dist/generate-object-YBI2TDJ3.cjs +20 -0
- package/dist/generate-object-YBI2TDJ3.cjs.map +1 -0
- package/dist/generate-object.d.ts +111 -0
- package/dist/index-manager-3UNPYH34.cjs +26 -0
- package/dist/index-manager-3UNPYH34.cjs.map +1 -0
- package/dist/index-manager-W7FDMGEG.js +17 -0
- package/dist/index-manager-W7FDMGEG.js.map +1 -0
- package/dist/index.cjs +2487 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4166 -0
- package/dist/index.d.ts +4166 -0
- package/dist/index.js +2289 -0
- package/dist/index.js.map +1 -0
- package/dist/inject-session-SUM6TDJF.js +27 -0
- package/dist/inject-session-SUM6TDJF.js.map +1 -0
- package/dist/inject-session-W6A46J3E.cjs +29 -0
- package/dist/inject-session-W6A46J3E.cjs.map +1 -0
- package/dist/interactive/index.cjs +35 -0
- package/dist/interactive/index.cjs.map +1 -0
- package/dist/interactive/index.d.cts +12 -0
- package/dist/interactive/index.d.ts +12 -0
- package/dist/interactive/index.js +30 -0
- package/dist/interactive/index.js.map +1 -0
- package/dist/interactive/types.d.cts +95 -0
- package/dist/interactive/types.d.ts +95 -0
- package/dist/internal/agent/batch.d.ts +11 -0
- package/dist/internal/agent/helpers.d.ts +1 -0
- package/dist/internal/agent-loop/budget-gate.d.ts +1 -0
- package/dist/internal/agent-loop/doom-loop-tracker.d.ts +22 -0
- package/dist/internal/agent-loop/live-events.d.ts +46 -0
- package/dist/internal/agent-loop/loop-context-init.d.ts +2 -0
- package/dist/internal/agent-loop/loop-finalize.d.ts +25 -0
- package/dist/internal/agent-loop/loop-llm-stream.d.ts +1 -0
- package/dist/internal/agent-loop/loop-thinking-steps.d.ts +28 -0
- package/dist/internal/agent-loop/loop.d.ts +7 -0
- package/dist/internal/agent-loop/message-builders.d.ts +21 -0
- package/dist/internal/agent-loop/replay-messages.d.ts +41 -0
- package/dist/internal/agent-loop/tool-dispatch.d.ts +27 -0
- package/dist/internal/agent-loop/tool-executors.d.ts +1 -0
- package/dist/internal/agent-loop/tool-result-guard.d.ts +20 -0
- package/dist/internal/agent-loop/tool-timeout.d.ts +23 -0
- package/dist/internal/agent-loop/types.d.ts +43 -0
- package/dist/internal/agent-loop/usage-and-cost.d.ts +25 -0
- package/dist/internal/auth/api-key-prefix.d.ts +23 -0
- package/dist/internal/auth/api-key-validator.d.ts +46 -0
- package/dist/internal/auth/credential-availability.d.ts +61 -0
- package/dist/internal/auth/credential-store.d.ts +77 -0
- package/dist/internal/auth/oauth-device.d.ts +54 -0
- package/dist/internal/auth/oauth-engine.d.ts +21 -0
- package/dist/internal/auth/resolve-credential.d.ts +56 -0
- package/dist/internal/auth/types.d.ts +175 -0
- package/dist/internal/base-url.d.ts +14 -0
- package/dist/internal/budget/compute-cost.d.ts +28 -0
- package/dist/internal/budget/pricing-registry.d.ts +36 -0
- package/dist/internal/budget/tracker/budget-tracker.d.ts +11 -0
- package/dist/internal/budget/tracker/budget.d.ts +34 -0
- package/dist/internal/budget/usage-accumulator.d.ts +46 -0
- package/dist/internal/cloud-agent/cloud-agent.d.ts +1 -0
- package/dist/internal/cloud-agent/cloud-config-serializer.d.ts +3 -0
- package/dist/internal/cloud-agent/cloud-run.d.ts +1 -0
- package/dist/internal/cloud-agent/cloud-tool-parity.d.ts +1 -0
- package/dist/internal/cloud-agent/index.d.ts +7 -0
- package/dist/internal/cloud-agent/real-cloud-run.d.ts +2 -0
- package/dist/internal/cloud-agent/types.d.ts +56 -0
- package/dist/internal/concurrency/abort-utils.d.ts +21 -0
- package/dist/internal/concurrency/async-local-storage.d.ts +20 -0
- package/dist/internal/concurrency/async-semaphore.d.ts +24 -0
- package/dist/internal/concurrency/delegation-depth.d.ts +27 -0
- package/dist/internal/concurrency/map-with-concurrency.d.ts +28 -0
- package/dist/internal/concurrency/subagent-credentials.d.ts +112 -0
- package/dist/internal/diagnostics.d.ts +69 -0
- package/dist/internal/emit-run-event.d.ts +16 -0
- package/dist/internal/env.d.ts +1 -0
- package/dist/internal/error-mappers/anthropic.d.ts +30 -0
- package/dist/internal/error-mappers/bedrock.d.ts +16 -0
- package/dist/internal/error-mappers/default-retriable.d.ts +1 -0
- package/dist/internal/error-mappers/ollama.d.ts +41 -0
- package/dist/internal/error-mappers/openai-compatible.d.ts +25 -0
- package/dist/internal/error-mappers/shared.d.ts +23 -0
- package/dist/internal/error-mappers/vertex.d.ts +15 -0
- package/dist/internal/eval/aggregate.d.ts +9 -0
- package/dist/internal/eval/assert.d.ts +27 -0
- package/dist/internal/eval/code-runner.d.ts +28 -0
- package/dist/internal/eval/dataset-iter.d.ts +9 -0
- package/dist/internal/eval/runner.d.ts +9 -0
- package/dist/internal/eval/single-flight.d.ts +17 -0
- package/dist/internal/eval/telemetry.d.ts +23 -0
- package/dist/internal/eval/trials.d.ts +19 -0
- package/dist/internal/global-singleton.d.ts +16 -0
- package/dist/internal/http.d.ts +1 -0
- package/dist/internal/ids.d.ts +1 -0
- package/dist/internal/judge/judge-call.d.ts +48 -0
- package/dist/internal/judge/parse-verdict.d.ts +11 -0
- package/dist/internal/llm/abort-error.d.ts +1 -0
- package/dist/internal/llm/anthropic-shared.d.ts +100 -0
- package/dist/internal/llm/anthropic.d.ts +9 -0
- package/dist/internal/llm/bedrock-anthropic.d.ts +36 -0
- package/dist/internal/llm/bedrock-token-cache.d.ts +18 -0
- package/dist/internal/llm/credential-pool-context.d.ts +11 -0
- package/dist/internal/llm/credential-pool-types.d.ts +22 -0
- package/dist/internal/llm/credential-pool.d.ts +18 -0
- package/dist/internal/llm/fallback-client.d.ts +1 -0
- package/dist/internal/llm/fault-injection.d.ts +50 -0
- package/dist/internal/llm/finish.d.ts +1 -0
- package/dist/internal/llm/hermes-tool-extract.d.ts +11 -0
- package/dist/internal/llm/model-capabilities.d.ts +40 -0
- package/dist/internal/llm/model-identifier.d.ts +58 -0
- package/dist/internal/llm/model-option.d.ts +38 -0
- package/dist/internal/llm/ollama-native.d.ts +27 -0
- package/dist/internal/llm/openai-messages.d.ts +2 -0
- package/dist/internal/llm/openai.d.ts +146 -0
- package/dist/internal/llm/pool-aware-client.d.ts +16 -0
- package/dist/internal/llm/prompt-cache-key.d.ts +1 -0
- package/dist/internal/llm/responses.d.ts +97 -0
- package/dist/internal/llm/retry.d.ts +22 -0
- package/dist/internal/llm/retrying-client.d.ts +53 -0
- package/dist/internal/llm/router.d.ts +40 -0
- package/dist/internal/llm/sse.d.ts +21 -0
- package/dist/internal/llm/stream-relay.d.ts +17 -0
- package/dist/internal/llm/tool-result-content.d.ts +40 -0
- package/dist/internal/llm/transport-error.d.ts +9 -0
- package/dist/internal/llm/types.d.ts +226 -0
- package/dist/internal/llm/vertex-anthropic.d.ts +40 -0
- package/dist/internal/llm/vertex-auth.d.ts +30 -0
- package/dist/internal/llm/vertex-gemini.d.ts +28 -0
- package/dist/internal/llm/vertex-router.d.ts +21 -0
- package/dist/internal/local-agent/index.d.ts +6 -0
- package/dist/internal/local-agent/local-agent-bootstrap.d.ts +37 -0
- package/dist/internal/local-agent/local-agent-capabilities.d.ts +38 -0
- package/dist/internal/local-agent/local-agent-dispatch.d.ts +57 -0
- package/dist/internal/local-agent/local-agent-invalidate.d.ts +1 -0
- package/dist/internal/local-agent/local-agent-lifecycle.d.ts +13 -0
- package/dist/internal/local-agent/local-agent-memory-direct.d.ts +12 -0
- package/dist/internal/local-agent/local-agent-memory-hooks.d.ts +41 -0
- package/dist/internal/local-agent/local-agent-memory-provider.d.ts +57 -0
- package/dist/internal/local-agent/local-agent-memory.d.ts +1 -0
- package/dist/internal/local-agent/local-agent-personality-extensions.d.ts +43 -0
- package/dist/internal/local-agent/local-agent-runtime-extensions.d.ts +13 -0
- package/dist/internal/local-agent/local-agent-send.d.ts +42 -0
- package/dist/internal/local-agent/local-agent-task-wrap.d.ts +11 -0
- package/dist/internal/local-agent/local-agent.d.ts +1 -0
- package/dist/internal/local-agent/local-option-keys.d.ts +2 -0
- package/dist/internal/local-agent/local-run.d.ts +1 -0
- package/dist/internal/local-agent/mcp-pool.d.ts +43 -0
- package/dist/internal/local-agent/real-local-run-mcp.d.ts +26 -0
- package/dist/internal/local-agent/real-local-run-options.d.ts +26 -0
- package/dist/internal/local-agent/real-local-run-provider.d.ts +13 -0
- package/dist/internal/local-agent/real-local-run-tools.d.ts +55 -0
- package/dist/internal/local-agent/real-local-run.d.ts +4 -0
- package/dist/internal/mcp/client.d.ts +16 -0
- package/dist/internal/mcp/handshake-timeout.d.ts +53 -0
- package/dist/internal/mcp/oauth.d.ts +19 -0
- package/dist/internal/mcp/token-storage.d.ts +52 -0
- package/dist/internal/memory/active-memory-cache.d.ts +10 -0
- package/dist/internal/memory/active-memory-types.d.ts +8 -0
- package/dist/internal/memory/active-memory.d.ts +56 -0
- package/dist/internal/memory/adapters/azure-openai-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/azure-openai-embedding.d.ts +2 -0
- package/dist/internal/memory/adapters/catalog.d.cts +1 -0
- package/dist/internal/memory/adapters/catalog.d.ts +1 -0
- package/dist/internal/memory/adapters/cohere-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/cohere-embedding.d.ts +2 -0
- package/dist/internal/memory/adapters/deepinfra-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/deepinfra-embedding.d.ts +2 -0
- package/dist/internal/memory/adapters/gemini-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/gemini-embedding.d.ts +2 -0
- package/dist/internal/memory/adapters/index.cjs +30 -0
- package/dist/internal/memory/adapters/index.cjs.map +1 -0
- package/dist/internal/memory/adapters/index.d.cts +18 -0
- package/dist/internal/memory/adapters/index.d.ts +18 -0
- package/dist/internal/memory/adapters/index.js +13 -0
- package/dist/internal/memory/adapters/index.js.map +1 -0
- package/dist/internal/memory/adapters/jina-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/jina-embedding.d.ts +2 -0
- package/dist/internal/memory/adapters/mistral-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/mistral-embedding.d.ts +2 -0
- package/dist/internal/memory/adapters/ollama-embedding.d.cts +34 -0
- package/dist/internal/memory/adapters/ollama-embedding.d.ts +34 -0
- package/dist/internal/memory/adapters/openai-compatible.d.cts +96 -0
- package/dist/internal/memory/adapters/openai-compatible.d.ts +96 -0
- package/dist/internal/memory/adapters/openai-embedding.d.cts +12 -0
- package/dist/internal/memory/adapters/openai-embedding.d.ts +12 -0
- package/dist/internal/memory/adapters/openrouter-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/openrouter-embedding.d.ts +2 -0
- package/dist/internal/memory/adapters/voyage-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/voyage-embedding.d.ts +2 -0
- package/dist/internal/memory/corpus-sync.d.ts +23 -0
- package/dist/internal/memory/dreaming/diary.d.ts +41 -0
- package/dist/internal/memory/dreaming/phases.d.ts +35 -0
- package/dist/internal/memory/dreaming/run.d.ts +10 -0
- package/dist/internal/memory/embedding-adapter.d.ts +42 -0
- package/dist/internal/memory/embedding-cache.d.ts +42 -0
- package/dist/internal/memory/escape-like-pattern.d.ts +22 -0
- package/dist/internal/memory/index-db.d.ts +67 -0
- package/dist/internal/memory/index-manager-contract.d.ts +48 -0
- package/dist/internal/memory/index-manager-dispatch.d.ts +23 -0
- package/dist/internal/memory/index-manager-helpers.d.ts +20 -0
- package/dist/internal/memory/index-manager.d.ts +44 -0
- package/dist/internal/memory/index-repository.d.ts +58 -0
- package/dist/internal/memory/index-schema.d.ts +21 -0
- package/dist/internal/memory/lance-index.d.ts +46 -0
- package/dist/internal/memory/lance-memory-adapter.d.ts +45 -0
- package/dist/internal/memory/memory-index.d.ts +67 -0
- package/dist/internal/memory/migrate-sqlite-to-lance.d.ts +58 -0
- package/dist/internal/memory/migration.d.ts +9 -0
- package/dist/internal/memory/sdk-memory-peer-loader.d.ts +74 -0
- package/dist/internal/memory/sqlite-vec-loader.d.ts +1 -0
- package/dist/internal/memory/storage/chunk-markdown.d.cts +2 -0
- package/dist/internal/memory/storage/chunk-markdown.d.ts +2 -0
- package/dist/internal/memory/storage/index.cjs +141 -0
- package/dist/internal/memory/storage/index.cjs.map +1 -0
- package/dist/internal/memory/storage/index.d.cts +28 -0
- package/dist/internal/memory/storage/index.d.ts +28 -0
- package/dist/internal/memory/storage/index.js +16 -0
- package/dist/internal/memory/storage/index.js.map +1 -0
- package/dist/internal/memory/storage/list-markdown.d.cts +1 -0
- package/dist/internal/memory/storage/list-markdown.d.ts +1 -0
- package/dist/internal/memory/storage/markdown-store.d.cts +48 -0
- package/dist/internal/memory/storage/markdown-store.d.ts +48 -0
- package/dist/internal/memory/storage/memory-file.d.cts +90 -0
- package/dist/internal/memory/storage/memory-file.d.ts +90 -0
- package/dist/internal/memory/storage/memory-root.d.cts +119 -0
- package/dist/internal/memory/storage/memory-root.d.ts +119 -0
- package/dist/internal/memory/storage/reader.d.cts +8 -0
- package/dist/internal/memory/storage/reader.d.ts +8 -0
- package/dist/internal/memory/storage/session-loader.d.cts +35 -0
- package/dist/internal/memory/storage/session-loader.d.ts +35 -0
- package/dist/internal/memory/storage/session-summary-writer.d.cts +50 -0
- package/dist/internal/memory/storage/session-summary-writer.d.ts +50 -0
- package/dist/internal/memory/storage/threat-scan.d.cts +62 -0
- package/dist/internal/memory/storage/threat-scan.d.ts +62 -0
- package/dist/internal/memory/storage/transcript-store.d.cts +38 -0
- package/dist/internal/memory/storage/transcript-store.d.ts +38 -0
- package/dist/internal/memory/storage/wiki-loader.d.cts +27 -0
- package/dist/internal/memory/storage/wiki-loader.d.ts +27 -0
- package/dist/internal/memory/tools.d.ts +21 -0
- package/dist/internal/memory/types.d.ts +78 -0
- package/dist/internal/memory/vec-index.d.ts +28 -0
- package/dist/internal/persistence/atomic-write.d.cts +107 -0
- package/dist/internal/persistence/atomic-write.d.ts +107 -0
- package/dist/internal/persistence/cwd-mutex.d.cts +35 -0
- package/dist/internal/persistence/cwd-mutex.d.ts +35 -0
- package/dist/internal/persistence/exclusive-create.d.cts +53 -0
- package/dist/internal/persistence/exclusive-create.d.ts +53 -0
- package/dist/internal/persistence/file-lock.d.cts +54 -0
- package/dist/internal/persistence/file-lock.d.ts +54 -0
- package/dist/internal/persistence/fs-session-store.d.cts +68 -0
- package/dist/internal/persistence/fs-session-store.d.ts +68 -0
- package/dist/internal/persistence/fts5-sanitize.d.cts +44 -0
- package/dist/internal/persistence/fts5-sanitize.d.ts +44 -0
- package/dist/internal/persistence/index.cjs +127 -0
- package/dist/internal/persistence/index.cjs.map +1 -0
- package/dist/internal/persistence/index.d.cts +33 -0
- package/dist/internal/persistence/index.d.ts +33 -0
- package/dist/internal/persistence/index.js +40 -0
- package/dist/internal/persistence/index.js.map +1 -0
- package/dist/internal/persistence/jsonl.d.cts +43 -0
- package/dist/internal/persistence/jsonl.d.ts +43 -0
- package/dist/internal/persistence/markdown-config-loader.d.cts +35 -0
- package/dist/internal/persistence/markdown-config-loader.d.ts +35 -0
- package/dist/internal/persistence/pagination.d.cts +21 -0
- package/dist/internal/persistence/pagination.d.ts +21 -0
- package/dist/internal/persistence/paths.d.cts +137 -0
- package/dist/internal/persistence/paths.d.ts +137 -0
- package/dist/internal/persistence/persistence-schema.d.cts +29 -0
- package/dist/internal/persistence/persistence-schema.d.ts +29 -0
- package/dist/internal/persistence/schema-version.d.cts +227 -0
- package/dist/internal/persistence/schema-version.d.ts +227 -0
- package/dist/internal/persistence/session-artifacts.d.cts +27 -0
- package/dist/internal/persistence/session-artifacts.d.ts +27 -0
- package/dist/internal/persistence/session-dir.d.cts +1 -0
- package/dist/internal/persistence/session-dir.d.ts +1 -0
- package/dist/internal/persistence/session-transcript.d.cts +128 -0
- package/dist/internal/persistence/session-transcript.d.ts +128 -0
- package/dist/internal/persistence/session-writer.d.cts +104 -0
- package/dist/internal/persistence/session-writer.d.ts +104 -0
- package/dist/internal/persistence/sqlite-cas.d.cts +61 -0
- package/dist/internal/persistence/sqlite-cas.d.ts +61 -0
- package/dist/internal/persistence/sqlite-open.d.cts +61 -0
- package/dist/internal/persistence/sqlite-open.d.ts +61 -0
- package/dist/internal/persistence/sqlite-wal.d.cts +54 -0
- package/dist/internal/persistence/sqlite-wal.d.ts +54 -0
- package/dist/internal/persistence/transcript-ops.d.cts +99 -0
- package/dist/internal/persistence/transcript-ops.d.ts +99 -0
- package/dist/internal/personality/context.d.ts +17 -0
- package/dist/internal/personality/registry.d.ts +17 -0
- package/dist/internal/personality/store.d.ts +27 -0
- package/dist/internal/personality/switch.d.ts +36 -0
- package/dist/internal/personality/types.d.ts +18 -0
- package/dist/internal/plugins/context.d.cts +21 -0
- package/dist/internal/plugins/context.d.ts +21 -0
- package/dist/internal/plugins/enabled-names.d.cts +1 -0
- package/dist/internal/plugins/enabled-names.d.ts +1 -0
- package/dist/internal/plugins/index.d.cts +9 -0
- package/dist/internal/plugins/index.d.ts +9 -0
- package/dist/internal/plugins/lifecycle.d.cts +15 -0
- package/dist/internal/plugins/lifecycle.d.ts +15 -0
- package/dist/internal/plugins/manager.d.cts +57 -0
- package/dist/internal/plugins/manager.d.ts +57 -0
- package/dist/internal/plugins/plugin-guards.d.cts +13 -0
- package/dist/internal/plugins/plugin-guards.d.ts +13 -0
- package/dist/internal/plugins/types.d.cts +26 -0
- package/dist/internal/plugins/types.d.ts +26 -0
- package/dist/internal/providers/builtin/anthropic.d.ts +2 -0
- package/dist/internal/providers/builtin/bedrock.d.ts +25 -0
- package/dist/internal/providers/builtin/cerebras.d.ts +5 -0
- package/dist/internal/providers/builtin/cohere.d.ts +8 -0
- package/dist/internal/providers/builtin/deepinfra.d.ts +2 -0
- package/dist/internal/providers/builtin/gemini.d.ts +10 -0
- package/dist/internal/providers/builtin/google.d.ts +6 -0
- package/dist/internal/providers/builtin/groq.d.ts +2 -0
- package/dist/internal/providers/builtin/index.d.ts +20 -0
- package/dist/internal/providers/builtin/llamacpp.d.ts +1 -0
- package/dist/internal/providers/builtin/lmstudio.d.ts +1 -0
- package/dist/internal/providers/builtin/mistral.d.ts +2 -0
- package/dist/internal/providers/builtin/ollama.d.ts +17 -0
- package/dist/internal/providers/builtin/openai-chatgpt.d.ts +14 -0
- package/dist/internal/providers/builtin/openai-compatible.d.ts +1 -0
- package/dist/internal/providers/builtin/openai.d.ts +2 -0
- package/dist/internal/providers/builtin/openrouter.d.ts +2 -0
- package/dist/internal/providers/builtin/perplexity.d.ts +5 -0
- package/dist/internal/providers/builtin/together.d.ts +2 -0
- package/dist/internal/providers/builtin/vertex.d.ts +27 -0
- package/dist/internal/providers/builtin/xai.d.ts +2 -0
- package/dist/internal/providers/catalog-loader.d.ts +55 -0
- package/dist/internal/providers/catalog-schema.d.ts +202 -0
- package/dist/internal/providers/catalog-source-models-dev.d.ts +80 -0
- package/dist/internal/providers/discovery.d.ts +14 -0
- package/dist/internal/providers/index.d.ts +8 -0
- package/dist/internal/providers/register-plugin-providers.d.ts +22 -0
- package/dist/internal/providers/registry.d.ts +13 -0
- package/dist/internal/providers/types.d.ts +11 -0
- package/dist/internal/retry/circuit-breaker.d.ts +26 -0
- package/dist/internal/retry/with-retry.d.ts +40 -0
- package/dist/internal/runtime/compat/compat-config-file.d.ts +31 -0
- package/dist/internal/runtime/compat/foreign-config-sources.d.ts +139 -0
- package/dist/internal/runtime/compression/compression-attempt.d.ts +24 -0
- package/dist/internal/runtime/compression/compression-config.d.ts +33 -0
- package/dist/internal/runtime/compression/compression-decision.d.ts +10 -0
- package/dist/internal/runtime/compression/compression-helpers.d.ts +18 -0
- package/dist/internal/runtime/compression/compression-model-registry.d.ts +41 -0
- package/dist/internal/runtime/compression/compression-summarizer.d.ts +34 -0
- package/dist/internal/runtime/config/default-model.d.ts +1 -0
- package/dist/internal/runtime/config/providers-manager.d.ts +1 -0
- package/dist/internal/runtime/config/workspace-dir.d.ts +9 -0
- package/dist/internal/runtime/context/context-aggregator.d.ts +26 -0
- package/dist/internal/runtime/context/context-discovery-runner.d.ts +80 -0
- package/dist/internal/runtime/context/context-discovery.d.ts +79 -0
- package/dist/internal/runtime/context/context-frontmatter.d.ts +16 -0
- package/dist/internal/runtime/context/context-glob.d.ts +1 -0
- package/dist/internal/runtime/context/context-import-resolver.d.ts +41 -0
- package/dist/internal/runtime/context/context-loaders.d.ts +42 -0
- package/dist/internal/runtime/context/context-manager.d.ts +28 -0
- package/dist/internal/runtime/context/context-mdc-parser.d.ts +25 -0
- package/dist/internal/runtime/context/context-rules-frontmatter.d.ts +99 -0
- package/dist/internal/runtime/context/context-yaml-lite.d.ts +26 -0
- package/dist/internal/runtime/context/project-instructions.d.ts +66 -0
- package/dist/internal/runtime/context/yaml-frontmatter.d.ts +20 -0
- package/dist/internal/runtime/fixtures/fixture-events.d.ts +12 -0
- package/dist/internal/runtime/fixtures/fixture-mode.d.ts +24 -0
- package/dist/internal/runtime/fixtures/fixture-responder.d.ts +1 -0
- package/dist/internal/runtime/fixtures/fixture-run-base.d.ts +96 -0
- package/dist/internal/runtime/fixtures/fixture-scripts.d.ts +21 -0
- package/dist/internal/runtime/fixtures/types.d.ts +1 -0
- package/dist/internal/runtime/hooks/hooks-executor.d.ts +49 -0
- package/dist/internal/runtime/hooks/hooks-source.d.ts +35 -0
- package/dist/internal/runtime/lifecycle/context-budget-event.d.ts +25 -0
- package/dist/internal/runtime/lifecycle/env-policy.d.ts +29 -0
- package/dist/internal/runtime/lifecycle/fork-agent.d.ts +15 -0
- package/dist/internal/runtime/lifecycle/goal-marker.d.ts +13 -0
- package/dist/internal/runtime/lifecycle/post-run-lifecycle.d.ts +16 -0
- package/dist/internal/runtime/lifecycle/run-to-completion.d.ts +22 -0
- package/dist/internal/runtime/lifecycle/run-until.d.ts +21 -0
- package/dist/internal/runtime/lifecycle/spawn-collect.d.ts +8 -0
- package/dist/internal/runtime/lifecycle/stream-to-completion.d.ts +31 -0
- package/dist/internal/runtime/lifecycle/wrap-completion-check-run.d.ts +30 -0
- package/dist/internal/runtime/memory-glue/memory-provider.d.ts +11 -0
- package/dist/internal/runtime/memory-glue/memory-store.d.ts +4 -0
- package/dist/internal/runtime/memory-glue/select-facts.d.ts +63 -0
- package/dist/internal/runtime/model-selection.d.ts +14 -0
- package/dist/internal/runtime/plugin-loader/plugin-bundles.d.ts +22 -0
- package/dist/internal/runtime/plugin-loader/plugin-frontmatter.d.ts +17 -0
- package/dist/internal/runtime/plugin-loader/plugins-manager.d.ts +1 -0
- package/dist/internal/runtime/processors/run-processors.d.ts +10 -0
- package/dist/internal/runtime/processors/tripwire-run.d.ts +16 -0
- package/dist/internal/runtime/processors/wrap-output-run.d.ts +18 -0
- package/dist/internal/runtime/registry/agent-factory-registry.d.ts +19 -0
- package/dist/internal/runtime/registry/agent-registry-contract.d.ts +31 -0
- package/dist/internal/runtime/registry/agent-registry-store.d.ts +75 -0
- package/dist/internal/runtime/registry/agent-registry.d.ts +6 -0
- package/dist/internal/runtime/registry/live-agent-registry.d.ts +132 -0
- package/dist/internal/runtime/registry/run-registry.d.ts +4 -0
- package/dist/internal/runtime/skills/discover-skills.d.ts +103 -0
- package/dist/internal/runtime/skills/skill-frontmatter.d.ts +6 -0
- package/dist/internal/runtime/skills/skills-block.d.ts +18 -0
- package/dist/internal/runtime/skills/skills-manager.d.ts +1 -0
- package/dist/internal/runtime/skills/subagent-tool-scope.d.ts +25 -0
- package/dist/internal/runtime/skills/subagents-loader.d.ts +1 -0
- package/dist/internal/runtime/system-prompt/escape.d.ts +1 -0
- package/dist/internal/runtime/system-prompt/local-assembly.d.ts +2 -0
- package/dist/internal/runtime/system-prompt/native-reasoning.d.ts +25 -0
- package/dist/internal/runtime/system-prompt/pipeline.d.ts +1 -0
- package/dist/internal/runtime/system-prompt/safe-call.d.ts +1 -0
- package/dist/internal/runtime/system-prompt/sources/active-memory-provider.d.ts +1 -0
- package/dist/internal/runtime/system-prompt/sources/base-provider.d.ts +1 -0
- package/dist/internal/runtime/system-prompt/sources/context-provider.d.ts +1 -0
- package/dist/internal/runtime/system-prompt/sources/memory-provider.d.ts +6 -0
- package/dist/internal/runtime/system-prompt/sources/reasoning-provider.d.ts +1 -0
- package/dist/internal/runtime/system-prompt/sources/skills-provider.d.ts +1 -0
- package/dist/internal/runtime/system-prompt/system-prompt.d.ts +1 -0
- package/dist/internal/runtime/system-prompt/types.d.ts +5 -0
- package/dist/internal/runtime/tools/shell-tool.d.ts +7 -0
- package/dist/internal/runtime/validation/validate-agent-options.d.ts +1 -0
- package/dist/internal/runtime/validation/validate-response.d.ts +18 -0
- package/dist/internal/scorers/levenshtein.d.ts +11 -0
- package/dist/internal/scorers/llm-judge.d.ts +41 -0
- package/dist/internal/security/index.cjs +52 -0
- package/dist/internal/security/index.cjs.map +1 -0
- package/dist/internal/security/index.d.cts +19 -0
- package/dist/internal/security/index.d.ts +19 -0
- package/dist/internal/security/index.js +7 -0
- package/dist/internal/security/index.js.map +1 -0
- package/dist/internal/security/path-containment.d.cts +24 -0
- package/dist/internal/security/path-containment.d.ts +24 -0
- package/dist/internal/security/path-guard.d.cts +166 -0
- package/dist/internal/security/path-guard.d.ts +166 -0
- package/dist/internal/security/redact.d.cts +74 -0
- package/dist/internal/security/redact.d.ts +74 -0
- package/dist/internal/security/test-reset.d.cts +10 -0
- package/dist/internal/security/test-reset.d.ts +10 -0
- package/dist/internal/session/agent-session-store.d.ts +65 -0
- package/dist/internal/session/agent-session.d.ts +48 -0
- package/dist/internal/session/compact-session.d.ts +97 -0
- package/dist/internal/session/index.d.ts +7 -0
- package/dist/internal/session/inject-session.d.ts +15 -0
- package/dist/internal/session/session-cache.d.ts +31 -0
- package/dist/internal/session/types.d.ts +46 -0
- package/dist/internal/structured-output-helpers.d.ts +54 -0
- package/dist/internal/task/registry.d.ts +60 -0
- package/dist/internal/task/ring-buffer.d.ts +10 -0
- package/dist/internal/task/store.d.ts +145 -0
- package/dist/internal/task/subscribe.d.ts +15 -0
- package/dist/internal/task/task-id.d.ts +22 -0
- package/dist/internal/task/task-run-event-bridge.d.ts +10 -0
- package/dist/internal/task/telemetry.d.ts +27 -0
- package/dist/internal/telemetry/adapter-registry.d.ts +12 -0
- package/dist/internal/telemetry/adapters/arize.d.ts +2 -0
- package/dist/internal/telemetry/adapters/braintrust.d.ts +7 -0
- package/dist/internal/telemetry/adapters/datadog.d.ts +2 -0
- package/dist/internal/telemetry/adapters/langfuse.d.ts +2 -0
- package/dist/internal/telemetry/adapters/langsmith.d.ts +7 -0
- package/dist/internal/telemetry/adapters/posthog.d.ts +2 -0
- package/dist/internal/telemetry/adapters/sentry.d.ts +2 -0
- package/dist/internal/telemetry/safe-require.d.ts +1 -0
- package/dist/internal/telemetry/span-names.d.ts +10 -0
- package/dist/internal/telemetry/tracer-loader.d.ts +20 -0
- package/dist/internal/telemetry/tracer.d.ts +57 -0
- package/dist/internal/tool-dispatch/repair-middleware.d.ts +34 -0
- package/dist/internal/tool-dispatch/strip-think.d.ts +22 -0
- package/dist/internal/tool-registry/personality-filter.d.ts +37 -0
- package/dist/internal/workflow/ctx.d.ts +24 -0
- package/dist/internal/workflow/error-shape.d.ts +7 -0
- package/dist/internal/workflow/event-stream.d.ts +13 -0
- package/dist/internal/workflow/evented-executor.d.ts +42 -0
- package/dist/internal/workflow/executor-helpers.d.ts +30 -0
- package/dist/internal/workflow/executor.d.ts +16 -0
- package/dist/internal/workflow/retry-policy.d.ts +14 -0
- package/dist/internal/workflow/run-id.d.ts +9 -0
- package/dist/internal/workflow/scheduler.d.ts +23 -0
- package/dist/internal/workflow/single-flight.d.ts +18 -0
- package/dist/internal/workflow/snapshot-store.d.ts +23 -0
- package/dist/internal/workflow/step-agent.d.ts +12 -0
- package/dist/internal/workflow/step-branch.d.ts +10 -0
- package/dist/internal/workflow/step-dowhile.d.ts +8 -0
- package/dist/internal/workflow/step-execution.d.ts +25 -0
- package/dist/internal/workflow/step-fn.d.ts +10 -0
- package/dist/internal/workflow/step-foreach.d.ts +11 -0
- package/dist/internal/workflow/step-parallel.d.ts +17 -0
- package/dist/internal/workflow/step-sleep.d.ts +7 -0
- package/dist/internal/workflow/telemetry.d.ts +21 -0
- package/dist/internal/zod-to-json-schema.d.ts +11 -0
- package/dist/job-queue.d.ts +68 -0
- package/dist/judge-call-46M2E5FA.cjs +22 -0
- package/dist/judge-call-46M2E5FA.cjs.map +1 -0
- package/dist/judge-call-FGUNNWEI.js +5 -0
- package/dist/judge-call-FGUNNWEI.js.map +1 -0
- package/dist/mcp-auth.cjs +314 -0
- package/dist/mcp-auth.cjs.map +1 -0
- package/dist/mcp-auth.d.cts +19 -0
- package/dist/mcp-auth.d.ts +19 -0
- package/dist/mcp-auth.js +307 -0
- package/dist/mcp-auth.js.map +1 -0
- package/dist/messages.cjs +24 -0
- package/dist/messages.cjs.map +1 -0
- package/dist/messages.d.cts +33 -0
- package/dist/messages.d.ts +33 -0
- package/dist/messages.js +20 -0
- package/dist/messages.js.map +1 -0
- package/dist/models.cjs +295 -0
- package/dist/models.cjs.map +1 -0
- package/dist/models.d.cts +18 -0
- package/dist/models.d.ts +18 -0
- package/dist/models.js +286 -0
- package/dist/models.js.map +1 -0
- package/dist/oauth-transaction-store-5RIR6D5C.js +5 -0
- package/dist/oauth-transaction-store-5RIR6D5C.js.map +1 -0
- package/dist/oauth-transaction-store-SXIE57OD.cjs +38 -0
- package/dist/oauth-transaction-store-SXIE57OD.cjs.map +1 -0
- package/dist/path-safety.cjs +39 -0
- package/dist/path-safety.cjs.map +1 -0
- package/dist/path-safety.d.cts +16 -0
- package/dist/path-safety.d.ts +16 -0
- package/dist/path-safety.js +6 -0
- package/dist/path-safety.js.map +1 -0
- package/dist/permission-engine.d.ts +134 -0
- package/dist/persistence.cjs +197 -0
- package/dist/persistence.cjs.map +1 -0
- package/dist/persistence.d.cts +40 -0
- package/dist/persistence.d.ts +40 -0
- package/dist/persistence.js +100 -0
- package/dist/persistence.js.map +1 -0
- package/dist/project.cjs +45 -0
- package/dist/project.cjs.map +1 -0
- package/dist/project.d.cts +14 -0
- package/dist/project.d.ts +14 -0
- package/dist/project.js +42 -0
- package/dist/project.js.map +1 -0
- package/dist/provider-catalog.json +1295 -0
- package/dist/providers.cjs +23 -0
- package/dist/providers.cjs.map +1 -0
- package/dist/providers.d.cts +31 -0
- package/dist/providers.d.ts +31 -0
- package/dist/providers.js +10 -0
- package/dist/providers.js.map +1 -0
- package/dist/registry-BZQFYRTL.cjs +46 -0
- package/dist/registry-BZQFYRTL.cjs.map +1 -0
- package/dist/registry-DMWCJKRF.js +9 -0
- package/dist/registry-DMWCJKRF.js.map +1 -0
- package/dist/retry.cjs +14 -0
- package/dist/retry.cjs.map +1 -0
- package/dist/retry.d.cts +35 -0
- package/dist/retry.d.ts +35 -0
- package/dist/retry.js +5 -0
- package/dist/retry.js.map +1 -0
- package/dist/run-CTAdRU3U.d.cts +1813 -0
- package/dist/run-CTAdRU3U.d.ts +1813 -0
- package/dist/run-to-completion-DRO77625.js +3 -0
- package/dist/run-to-completion-DRO77625.js.map +1 -0
- package/dist/run-to-completion-X4OWM673.cjs +48 -0
- package/dist/run-to-completion-X4OWM673.cjs.map +1 -0
- package/dist/run-until-6D6TQ4JN.js +146 -0
- package/dist/run-until-6D6TQ4JN.js.map +1 -0
- package/dist/run-until-DG2KXWB2.cjs +149 -0
- package/dist/run-until-DG2KXWB2.cjs.map +1 -0
- package/dist/sandbox/bwrap.d.cts +112 -0
- package/dist/sandbox/bwrap.d.ts +112 -0
- package/dist/sandbox/index.cjs +495 -0
- package/dist/sandbox/index.cjs.map +1 -0
- package/dist/sandbox/index.d.cts +13 -0
- package/dist/sandbox/index.d.ts +13 -0
- package/dist/sandbox/index.js +451 -0
- package/dist/sandbox/index.js.map +1 -0
- package/dist/sandbox/linux-sandbox.d.cts +218 -0
- package/dist/sandbox/linux-sandbox.d.ts +218 -0
- package/dist/sandbox/local-sandbox.d.cts +66 -0
- package/dist/sandbox/local-sandbox.d.ts +66 -0
- package/dist/sandbox/provision.d.cts +60 -0
- package/dist/sandbox/provision.d.ts +60 -0
- package/dist/sandbox/seccomp.d.cts +16 -0
- package/dist/sandbox/seccomp.d.ts +16 -0
- package/dist/sandbox/shell-escape.d.cts +8 -0
- package/dist/sandbox/shell-escape.d.ts +8 -0
- package/dist/sandbox/types.d.cts +143 -0
- package/dist/sandbox/types.d.ts +143 -0
- package/dist/sanitize/coerce.d.cts +1 -0
- package/dist/sanitize/coerce.d.ts +1 -0
- package/dist/sanitize/index.cjs +12 -0
- package/dist/sanitize/index.cjs.map +1 -0
- package/dist/sanitize/index.d.cts +9 -0
- package/dist/sanitize/index.d.ts +9 -0
- package/dist/sanitize/index.js +3 -0
- package/dist/sanitize/index.js.map +1 -0
- package/dist/sanitize/sanitize-tool-input.d.cts +11 -0
- package/dist/sanitize/sanitize-tool-input.d.ts +11 -0
- package/dist/sanitize/types.d.cts +52 -0
- package/dist/sanitize/types.d.ts +52 -0
- package/dist/scorers.d.ts +181 -0
- package/dist/sdk-agent-BOiKqOgL.d.cts +940 -0
- package/dist/sdk-agent-D4a_BR_6.d.ts +940 -0
- package/dist/server/auth/errors.d.cts +54 -0
- package/dist/server/auth/errors.d.ts +54 -0
- package/dist/server/auth/index.cjs +210 -0
- package/dist/server/auth/index.cjs.map +1 -0
- package/dist/server/auth/index.d.cts +244 -0
- package/dist/server/auth/index.d.ts +244 -0
- package/dist/server/auth/index.js +189 -0
- package/dist/server/auth/index.js.map +1 -0
- package/dist/server/auth/oauth-transaction-store.d.cts +52 -0
- package/dist/server/auth/oauth-transaction-store.d.ts +52 -0
- package/dist/server/auth/orchestrator.d.cts +15 -0
- package/dist/server/auth/orchestrator.d.ts +15 -0
- package/dist/server/auth/types.d.cts +109 -0
- package/dist/server/auth/types.d.ts +109 -0
- package/dist/server/auth/validate-return-to.d.cts +27 -0
- package/dist/server/auth/validate-return-to.d.ts +27 -0
- package/dist/server/errors-envelope.cjs +101 -0
- package/dist/server/errors-envelope.cjs.map +1 -0
- package/dist/server/errors-envelope.d.cts +67 -0
- package/dist/server/errors-envelope.d.ts +67 -0
- package/dist/server/errors-envelope.js +95 -0
- package/dist/server/errors-envelope.js.map +1 -0
- package/dist/session-transcript-LGHSNVY5.cjs +62 -0
- package/dist/session-transcript-LGHSNVY5.cjs.map +1 -0
- package/dist/session-transcript-VTBTCGQX.js +5 -0
- package/dist/session-transcript-VTBTCGQX.js.map +1 -0
- package/dist/skills.cjs +25 -0
- package/dist/skills.cjs.map +1 -0
- package/dist/skills.d.cts +19 -0
- package/dist/skills.d.ts +19 -0
- package/dist/skills.js +8 -0
- package/dist/skills.js.map +1 -0
- package/dist/stream-object-HBFMIZLD.js +7 -0
- package/dist/stream-object-HBFMIZLD.js.map +1 -0
- package/dist/stream-object-QSKHISDJ.cjs +20 -0
- package/dist/stream-object-QSKHISDJ.cjs.map +1 -0
- package/dist/stream-object.d.ts +73 -0
- package/dist/stream-to-completion-QV5HCL3J.js +30 -0
- package/dist/stream-to-completion-QV5HCL3J.js.map +1 -0
- package/dist/stream-to-completion-SRISU5AB.cjs +32 -0
- package/dist/stream-to-completion-SRISU5AB.cjs.map +1 -0
- package/dist/subagents-loader-DOBTTICM.js +7 -0
- package/dist/subagents-loader-DOBTTICM.js.map +1 -0
- package/dist/subagents-loader-GEHYCMEX.cjs +16 -0
- package/dist/subagents-loader-GEHYCMEX.cjs.map +1 -0
- package/dist/subagents-loader.cjs +35 -0
- package/dist/subagents-loader.cjs.map +1 -0
- package/dist/subagents-loader.d.cts +90 -0
- package/dist/subagents-loader.d.ts +90 -0
- package/dist/subagents-loader.js +32 -0
- package/dist/subagents-loader.js.map +1 -0
- package/dist/subagents.cjs +18 -0
- package/dist/subagents.cjs.map +1 -0
- package/dist/subagents.d.cts +14 -0
- package/dist/subagents.d.ts +14 -0
- package/dist/subagents.js +15 -0
- package/dist/subagents.js.map +1 -0
- package/dist/subscription/define-subscription.d.cts +71 -0
- package/dist/subscription/define-subscription.d.ts +71 -0
- package/dist/subscription/index.cjs +408 -0
- package/dist/subscription/index.cjs.map +1 -0
- package/dist/subscription/index.d.cts +20 -0
- package/dist/subscription/index.d.ts +20 -0
- package/dist/subscription/index.js +400 -0
- package/dist/subscription/index.js.map +1 -0
- package/dist/subscription/internal/backpressure.d.cts +24 -0
- package/dist/subscription/internal/backpressure.d.ts +24 -0
- package/dist/subscription/internal/server-integration.d.cts +22 -0
- package/dist/subscription/internal/server-integration.d.ts +22 -0
- package/dist/subscription/internal/sse-encoder.d.cts +13 -0
- package/dist/subscription/internal/sse-encoder.d.ts +13 -0
- package/dist/subscription/internal/sse-parser.d.cts +15 -0
- package/dist/subscription/internal/sse-parser.d.ts +15 -0
- package/dist/subscription/internal/subscription-runtime.d.cts +21 -0
- package/dist/subscription/internal/subscription-runtime.d.ts +21 -0
- package/dist/subscription/internal/types.d.cts +11 -0
- package/dist/subscription/internal/types.d.ts +11 -0
- package/dist/subscription/internal/ws-adapter-node.d.cts +10 -0
- package/dist/subscription/internal/ws-adapter-node.d.ts +10 -0
- package/dist/subscription/theokit-subscribe.d.cts +54 -0
- package/dist/subscription/theokit-subscribe.d.ts +54 -0
- package/dist/subscription/types.d.cts +158 -0
- package/dist/subscription/types.d.ts +158 -0
- package/dist/task-errors.d.ts +58 -0
- package/dist/task-store.cjs +23 -0
- package/dist/task-store.cjs.map +1 -0
- package/dist/task-store.d.cts +10 -0
- package/dist/task-store.d.ts +10 -0
- package/dist/task-store.js +6 -0
- package/dist/task-store.js.map +1 -0
- package/dist/tool-error.d.ts +30 -0
- package/dist/types/agent-prims.d.ts +137 -0
- package/dist/types/agent.d.ts +947 -0
- package/dist/types/batch.d.ts +121 -0
- package/dist/types/budget-tracker.d.ts +80 -0
- package/dist/types/budget.d.ts +97 -0
- package/dist/types/content-blocks.d.ts +50 -0
- package/dist/types/context.d.ts +96 -0
- package/dist/types/conversation.d.ts +127 -0
- package/dist/types/cron.d.ts +172 -0
- package/dist/types/env-policy.d.ts +21 -0
- package/dist/types/eval.d.ts +255 -0
- package/dist/types/fork.d.ts +52 -0
- package/dist/types/goal-events.d.ts +144 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/mcp.d.ts +90 -0
- package/dist/types/memory-adapter.d.ts +189 -0
- package/dist/types/memory-provider.d.ts +206 -0
- package/dist/types/messages-base.d.ts +24 -0
- package/dist/types/messages.d.ts +161 -0
- package/dist/types/plugin.d.ts +308 -0
- package/dist/types/processors.d.ts +87 -0
- package/dist/types/provider-profile.d.ts +116 -0
- package/dist/types/providers.d.ts +116 -0
- package/dist/types/run-events.d.ts +197 -0
- package/dist/types/run.d.ts +671 -0
- package/dist/types/sdk-agent.d.ts +342 -0
- package/dist/types/session-message.d.ts +62 -0
- package/dist/types/session-record.d.ts +103 -0
- package/dist/types/session-store.d.ts +104 -0
- package/dist/types/task.d.ts +146 -0
- package/dist/types/theokit.d.ts +73 -0
- package/dist/types/trajectory.d.ts +52 -0
- package/dist/types/updates.d.ts +184 -0
- package/dist/types/usage.d.ts +64 -0
- package/dist/types/workflow.d.ts +426 -0
- package/dist/workflow-as-tool.d.ts +66 -0
- package/dist/workflow-errors.d.ts +164 -0
- package/dist/workflow.cjs +100 -0
- package/dist/workflow.cjs.map +1 -0
- package/dist/workflow.d.cts +911 -0
- package/dist/workflow.d.ts +911 -0
- package/dist/workflow.js +11 -0
- package/dist/workflow.js.map +1 -0
- package/docs/adr/README.md +2604 -0
- package/docs/error-codes.md +253 -0
- package/docs/harness-capability-map.md +1435 -0
- package/docs/memory-decisions.md +265 -0
- package/package.json +455 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2487 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkTFG5IBZS_cjs = require('./chunk-TFG5IBZS.cjs');
|
|
4
|
+
var chunkOBA6YK2R_cjs = require('./chunk-OBA6YK2R.cjs');
|
|
5
|
+
var chunkQDM3OHUT_cjs = require('./chunk-QDM3OHUT.cjs');
|
|
6
|
+
var chunkVPK6PHIE_cjs = require('./chunk-VPK6PHIE.cjs');
|
|
7
|
+
var chunkQWD4RDZ3_cjs = require('./chunk-QWD4RDZ3.cjs');
|
|
8
|
+
require('./chunk-7JJ3A6AT.cjs');
|
|
9
|
+
var chunk4HS6FFGL_cjs = require('./chunk-4HS6FFGL.cjs');
|
|
10
|
+
require('./chunk-4A3SKJ53.cjs');
|
|
11
|
+
require('./chunk-VTYY7XL5.cjs');
|
|
12
|
+
var chunk67SBTGMA_cjs = require('./chunk-67SBTGMA.cjs');
|
|
13
|
+
var chunkD3CCY3A2_cjs = require('./chunk-D3CCY3A2.cjs');
|
|
14
|
+
var chunkKVSAY6NZ_cjs = require('./chunk-KVSAY6NZ.cjs');
|
|
15
|
+
require('./chunk-Y2KYR2ED.cjs');
|
|
16
|
+
require('./chunk-BUUUWQMB.cjs');
|
|
17
|
+
require('./chunk-Z2JFX372.cjs');
|
|
18
|
+
require('./chunk-KGANQYP7.cjs');
|
|
19
|
+
require('./chunk-BV2MWEMV.cjs');
|
|
20
|
+
require('./chunk-D6POWE7E.cjs');
|
|
21
|
+
require('./chunk-GHX4P3V2.cjs');
|
|
22
|
+
require('./chunk-TMKTSYDS.cjs');
|
|
23
|
+
var chunkNQTNSHSB_cjs = require('./chunk-NQTNSHSB.cjs');
|
|
24
|
+
var chunk7FDKWDA2_cjs = require('./chunk-7FDKWDA2.cjs');
|
|
25
|
+
var chunk2HPNT6HH_cjs = require('./chunk-2HPNT6HH.cjs');
|
|
26
|
+
require('./chunk-FUSDYC2B.cjs');
|
|
27
|
+
require('./chunk-YJNYDJ2T.cjs');
|
|
28
|
+
require('./chunk-24SYBZPL.cjs');
|
|
29
|
+
require('./chunk-QOGNZMHD.cjs');
|
|
30
|
+
var chunkYIFFF23U_cjs = require('./chunk-YIFFF23U.cjs');
|
|
31
|
+
require('./chunk-2ZPEDVLM.cjs');
|
|
32
|
+
require('./chunk-IU5N5224.cjs');
|
|
33
|
+
require('./chunk-KRD3GQAA.cjs');
|
|
34
|
+
require('./chunk-RQMCOFAI.cjs');
|
|
35
|
+
require('./chunk-MUUQ2WFJ.cjs');
|
|
36
|
+
var chunkAA27GEYS_cjs = require('./chunk-AA27GEYS.cjs');
|
|
37
|
+
require('./chunk-YSTXFWQE.cjs');
|
|
38
|
+
require('./chunk-FRITRLZQ.cjs');
|
|
39
|
+
require('./chunk-NQTD6QOW.cjs');
|
|
40
|
+
require('./chunk-NINIJCHU.cjs');
|
|
41
|
+
require('./chunk-QATRS7JD.cjs');
|
|
42
|
+
require('./chunk-LOHMT36V.cjs');
|
|
43
|
+
require('./chunk-IJ7M6GOG.cjs');
|
|
44
|
+
require('./chunk-7A6535RA.cjs');
|
|
45
|
+
require('./chunk-SA6K24NB.cjs');
|
|
46
|
+
require('./chunk-I2PWY7VM.cjs');
|
|
47
|
+
require('./chunk-KTTHHYEW.cjs');
|
|
48
|
+
require('./chunk-Z3NTRKIC.cjs');
|
|
49
|
+
require('./chunk-GZV6AVRL.cjs');
|
|
50
|
+
require('./chunk-A4RAL2ER.cjs');
|
|
51
|
+
require('./chunk-DQZU7JK6.cjs');
|
|
52
|
+
require('./chunk-BJUJT5ED.cjs');
|
|
53
|
+
var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
|
|
54
|
+
var chunkHCT4HPCL_cjs = require('./chunk-HCT4HPCL.cjs');
|
|
55
|
+
var chunkJLRLCBJ4_cjs = require('./chunk-JLRLCBJ4.cjs');
|
|
56
|
+
require('./chunk-QYLZQ43D.cjs');
|
|
57
|
+
require('./chunk-NYQ3IS7K.cjs');
|
|
58
|
+
require('./chunk-HW7SEELD.cjs');
|
|
59
|
+
var chunkATT276RD_cjs = require('./chunk-ATT276RD.cjs');
|
|
60
|
+
var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
|
|
61
|
+
require('./chunk-ANMJJD6D.cjs');
|
|
62
|
+
var chunkQC55H6RJ_cjs = require('./chunk-QC55H6RJ.cjs');
|
|
63
|
+
require('./chunk-NVXXWAU7.cjs');
|
|
64
|
+
require('./chunk-4NLCWGH7.cjs');
|
|
65
|
+
require('./chunk-EXTRW7GW.cjs');
|
|
66
|
+
require('./chunk-HUFSABUZ.cjs');
|
|
67
|
+
var chunkJ7J7J2GN_cjs = require('./chunk-J7J7J2GN.cjs');
|
|
68
|
+
var chunk6LHQPOMI_cjs = require('./chunk-6LHQPOMI.cjs');
|
|
69
|
+
var crypto = require('crypto');
|
|
70
|
+
var zod = require('zod');
|
|
71
|
+
var promises = require('fs/promises');
|
|
72
|
+
var path = require('path');
|
|
73
|
+
|
|
74
|
+
// src/agent-factory.ts
|
|
75
|
+
function createAgentFactory(common) {
|
|
76
|
+
return {
|
|
77
|
+
forSession: (agentId, overrides) => chunkD3CCY3A2_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
|
|
78
|
+
getOrCreate: (agentId, overrides) => chunkD3CCY3A2_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function mergeAgentOptions(common, overrides, agentId) {
|
|
82
|
+
const o = overrides ?? {};
|
|
83
|
+
const merged = { ...common, ...o };
|
|
84
|
+
const local = deepMergeLocal(common.local, o.local);
|
|
85
|
+
if (local !== void 0) merged.local = local;
|
|
86
|
+
const memory = deepMergeMemory(common.memory, o.memory);
|
|
87
|
+
if (memory !== void 0) merged.memory = memory;
|
|
88
|
+
const cloud = deepMergeCloud(common.cloud, o.cloud);
|
|
89
|
+
if (cloud !== void 0) merged.cloud = cloud;
|
|
90
|
+
merged.agentId = agentId;
|
|
91
|
+
return merged;
|
|
92
|
+
}
|
|
93
|
+
function deepMergeLocal(base, top) {
|
|
94
|
+
if (base === void 0 && top === void 0) return void 0;
|
|
95
|
+
return { ...base ?? {}, ...top ?? {} };
|
|
96
|
+
}
|
|
97
|
+
function deepMergeMemory(base, top) {
|
|
98
|
+
if (base === void 0 && top === void 0) return void 0;
|
|
99
|
+
return {
|
|
100
|
+
...base ?? {},
|
|
101
|
+
...top ?? {},
|
|
102
|
+
enabled: top?.enabled ?? base?.enabled ?? false
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function deepMergeCloud(base, top) {
|
|
106
|
+
if (base === void 0 && top === void 0) return void 0;
|
|
107
|
+
return { ...base ?? {}, ...top ?? {} };
|
|
108
|
+
}
|
|
109
|
+
var AgentFactory = class {
|
|
110
|
+
constructor() {
|
|
111
|
+
}
|
|
112
|
+
static create(common) {
|
|
113
|
+
return createAgentFactory(common);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
// src/approval-policy.ts
|
|
118
|
+
var BY_MODE = {
|
|
119
|
+
ask: { outcome: "ask", reason: "mode-ask" },
|
|
120
|
+
"never-ask": { outcome: "allow", reason: "mode-never-ask" },
|
|
121
|
+
"refuse-all": { outcome: "deny", reason: "mode-refuse-all" }
|
|
122
|
+
};
|
|
123
|
+
function decideApproval(input) {
|
|
124
|
+
const { tool } = input;
|
|
125
|
+
if ((input.denied ?? []).includes(tool)) {
|
|
126
|
+
return { outcome: "deny", reason: "explicitly-denied", tool };
|
|
127
|
+
}
|
|
128
|
+
if ((input.allowed ?? []).includes(tool)) {
|
|
129
|
+
return { outcome: "allow", reason: "explicitly-allowed", tool };
|
|
130
|
+
}
|
|
131
|
+
const fromMode = BY_MODE[input.mode];
|
|
132
|
+
return { outcome: fromMode.outcome, reason: fromMode.reason, tool };
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// src/blast-radius.ts
|
|
136
|
+
function evaluateBlastRadius(input) {
|
|
137
|
+
const { scope, reversible } = input.action;
|
|
138
|
+
if (scope.length === 0) {
|
|
139
|
+
return { outcome: "refuse", reason: "scope-undeclared", scope };
|
|
140
|
+
}
|
|
141
|
+
if (!input.granted.includes(scope)) {
|
|
142
|
+
return { outcome: "refuse", reason: "scope-not-granted", scope };
|
|
143
|
+
}
|
|
144
|
+
if (!reversible && !(input.irreversibleAllowed ?? []).includes(scope)) {
|
|
145
|
+
return { outcome: "require-approval", reason: "irreversible", scope };
|
|
146
|
+
}
|
|
147
|
+
return { outcome: "allow", reason: "within-granted-scope", scope };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// src/internal/budget/calendar-window.ts
|
|
151
|
+
function startOfDayUtc(now = /* @__PURE__ */ new Date()) {
|
|
152
|
+
return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()));
|
|
153
|
+
}
|
|
154
|
+
function startOfWeekUtc(now = /* @__PURE__ */ new Date()) {
|
|
155
|
+
const dayOfWeek = now.getUTCDay();
|
|
156
|
+
const daysSinceMonday = (dayOfWeek + 6) % 7;
|
|
157
|
+
const start = startOfDayUtc(now);
|
|
158
|
+
start.setUTCDate(start.getUTCDate() - daysSinceMonday);
|
|
159
|
+
return start;
|
|
160
|
+
}
|
|
161
|
+
var MS_PER_HOUR = 60 * 60 * 1e3;
|
|
162
|
+
var MS_PER_DAY = 24 * MS_PER_HOUR;
|
|
163
|
+
function windowStartMs(window, now = /* @__PURE__ */ new Date()) {
|
|
164
|
+
switch (window) {
|
|
165
|
+
case "1h":
|
|
166
|
+
return now.getTime() - MS_PER_HOUR;
|
|
167
|
+
case "1d":
|
|
168
|
+
return startOfDayUtc(now).getTime();
|
|
169
|
+
case "1w":
|
|
170
|
+
return startOfWeekUtc(now).getTime();
|
|
171
|
+
case "30d":
|
|
172
|
+
return now.getTime() - 30 * MS_PER_DAY;
|
|
173
|
+
case "365d":
|
|
174
|
+
return now.getTime() - 365 * MS_PER_DAY;
|
|
175
|
+
default: {
|
|
176
|
+
const _exhaustive = window;
|
|
177
|
+
throw new Error(`unreachable window: ${_exhaustive}`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// src/internal/budget/ledger.ts
|
|
183
|
+
var MS_PER_YEAR = 365 * 24 * 60 * 60 * 1e3;
|
|
184
|
+
var GC_INTERVAL_MS = 5 * 60 * 1e3;
|
|
185
|
+
var GC_LOGS_THRESHOLD = 1e4;
|
|
186
|
+
var state = {
|
|
187
|
+
logs: /* @__PURE__ */ new Map(),
|
|
188
|
+
lastGcAt: Date.now()
|
|
189
|
+
};
|
|
190
|
+
var MUTEX_KEY = "budget-ledger";
|
|
191
|
+
function shouldGc(now) {
|
|
192
|
+
if (now - state.lastGcAt < GC_INTERVAL_MS) return false;
|
|
193
|
+
let totalLogs = 0;
|
|
194
|
+
for (const arr of state.logs.values()) totalLogs += arr.length;
|
|
195
|
+
return totalLogs > GC_LOGS_THRESHOLD;
|
|
196
|
+
}
|
|
197
|
+
function gcOlderThanOneYear(now) {
|
|
198
|
+
const cutoff = now - MS_PER_YEAR;
|
|
199
|
+
for (const [name, arr] of state.logs.entries()) {
|
|
200
|
+
const kept = arr.filter((l) => l.timestamp >= cutoff);
|
|
201
|
+
if (kept.length === 0) state.logs.delete(name);
|
|
202
|
+
else state.logs.set(name, kept);
|
|
203
|
+
}
|
|
204
|
+
state.lastGcAt = now;
|
|
205
|
+
}
|
|
206
|
+
async function charge(name, amountUsd) {
|
|
207
|
+
if (amountUsd <= 0) return;
|
|
208
|
+
await chunkZF2LDKQQ_cjs.withCwdMutex(MUTEX_KEY, async () => {
|
|
209
|
+
const now = Date.now();
|
|
210
|
+
const list2 = state.logs.get(name) ?? [];
|
|
211
|
+
list2.push({ timestamp: now, amountUsd });
|
|
212
|
+
state.logs.set(name, list2);
|
|
213
|
+
if (shouldGc(now)) gcOlderThanOneYear(now);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function spentIn(name, window, now = /* @__PURE__ */ new Date()) {
|
|
217
|
+
const arr = state.logs.get(name);
|
|
218
|
+
if (arr === void 0) return 0;
|
|
219
|
+
const sinceMs = windowStartMs(window, now);
|
|
220
|
+
let total = 0;
|
|
221
|
+
for (const log of arr) {
|
|
222
|
+
if (log.timestamp >= sinceMs) total += log.amountUsd;
|
|
223
|
+
}
|
|
224
|
+
return total;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// src/internal/budget/registry.ts
|
|
228
|
+
var NAME_GRAMMAR = /^[a-z0-9][a-z0-9_-]*$/;
|
|
229
|
+
var registry = /* @__PURE__ */ new Map();
|
|
230
|
+
function validateBudgetName(name) {
|
|
231
|
+
if (typeof name !== "string" || name.length === 0) {
|
|
232
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError("Budget name must be a non-empty string", {
|
|
233
|
+
code: "invalid_budget_name"
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
if (!NAME_GRAMMAR.test(name)) {
|
|
237
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError(
|
|
238
|
+
`Budget name "${name}" must match ^[a-z0-9][a-z0-9_-]*$ (lowercase + dash/underscore, start alphanumeric)`,
|
|
239
|
+
{ code: "invalid_budget_name" }
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function assertImplementedScope(scope) {
|
|
244
|
+
if (scope === "process") return;
|
|
245
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError(
|
|
246
|
+
`Budget scope "${scope}" is declared but not implemented \u2014 only "process" is honoured. A budget created with it would have been accounted process-wide with no warning.`,
|
|
247
|
+
{ code: "unimplemented_budget_scope" }
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
function createBudget(opts) {
|
|
251
|
+
validateBudgetName(opts.name);
|
|
252
|
+
assertImplementedScope(opts.scope);
|
|
253
|
+
if (registry.has(opts.name)) {
|
|
254
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError(`Budget "${opts.name}" already exists`, {
|
|
255
|
+
code: "invalid_budget_name"
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
registry.set(opts.name, opts);
|
|
259
|
+
return buildHandle(opts);
|
|
260
|
+
}
|
|
261
|
+
function getBudget(name) {
|
|
262
|
+
const opts = registry.get(name);
|
|
263
|
+
if (opts === void 0) return void 0;
|
|
264
|
+
return buildHandle(opts);
|
|
265
|
+
}
|
|
266
|
+
function listBudgets() {
|
|
267
|
+
return [...registry.values()].map(buildHandle);
|
|
268
|
+
}
|
|
269
|
+
function deleteBudget(name) {
|
|
270
|
+
return registry.delete(name);
|
|
271
|
+
}
|
|
272
|
+
function snapshotAll() {
|
|
273
|
+
const result = [];
|
|
274
|
+
for (const opts of registry.values()) {
|
|
275
|
+
for (const lim of opts.limits) {
|
|
276
|
+
const spent = spentIn(opts.name, lim.window);
|
|
277
|
+
result.push({
|
|
278
|
+
name: opts.name,
|
|
279
|
+
window: lim.window,
|
|
280
|
+
spentUsd: spent,
|
|
281
|
+
limitUsd: lim.limitUsd,
|
|
282
|
+
ratio: lim.limitUsd > 0 ? spent / lim.limitUsd : 0
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return result;
|
|
287
|
+
}
|
|
288
|
+
function getBudgetOptionsRaw(name) {
|
|
289
|
+
return registry.get(name);
|
|
290
|
+
}
|
|
291
|
+
function defaultMode(opts) {
|
|
292
|
+
return opts.mode ?? "warn";
|
|
293
|
+
}
|
|
294
|
+
function buildHandle(opts) {
|
|
295
|
+
return {
|
|
296
|
+
name: opts.name,
|
|
297
|
+
mode: defaultMode(opts),
|
|
298
|
+
scope: opts.scope,
|
|
299
|
+
limits: opts.limits,
|
|
300
|
+
spentIn: (window) => spentIn(opts.name, window),
|
|
301
|
+
remainingIn: (window) => {
|
|
302
|
+
const lim = opts.limits.find((l) => l.window === window);
|
|
303
|
+
if (lim === void 0) return Number.POSITIVE_INFINITY;
|
|
304
|
+
return Math.max(0, lim.limitUsd - spentIn(opts.name, window));
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// src/internal/budget/enforcement.ts
|
|
310
|
+
var THRESHOLDS = [0.8, 0.95];
|
|
311
|
+
function preflightCheck(name, estimatedUsd) {
|
|
312
|
+
const opts = getBudgetOptionsRaw(name);
|
|
313
|
+
if (opts === void 0) return;
|
|
314
|
+
if (defaultMode(opts) !== "block") return;
|
|
315
|
+
for (const lim of opts.limits) {
|
|
316
|
+
const currentSpent = spentIn(opts.name, lim.window);
|
|
317
|
+
if (currentSpent + estimatedUsd > lim.limitUsd) {
|
|
318
|
+
throw new chunkJ7J7J2GN_cjs.BudgetExceededError({
|
|
319
|
+
budgetName: opts.name,
|
|
320
|
+
window: lim.window,
|
|
321
|
+
spentUsd: currentSpent + estimatedUsd,
|
|
322
|
+
limitUsd: lim.limitUsd,
|
|
323
|
+
mode: "block"
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
async function chargeAndCheckThresholds(name, actualUsd) {
|
|
329
|
+
const opts = getBudgetOptionsRaw(name);
|
|
330
|
+
if (opts === void 0) {
|
|
331
|
+
chunk6LHQPOMI_cjs.diag(
|
|
332
|
+
`[budget] charge for deleted budget "${name}" is a no-op (was the budget removed during in-flight send?)
|
|
333
|
+
`
|
|
334
|
+
);
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const mode = defaultMode(opts);
|
|
338
|
+
await charge(opts.name, actualUsd);
|
|
339
|
+
if (mode === "audit") return;
|
|
340
|
+
await dispatchCallbacksFor(opts, mode);
|
|
341
|
+
}
|
|
342
|
+
async function dispatchCallbacksFor(opts, mode) {
|
|
343
|
+
for (const lim of opts.limits) {
|
|
344
|
+
const spent = spentIn(opts.name, lim.window);
|
|
345
|
+
if (lim.limitUsd <= 0) {
|
|
346
|
+
if (spent > 0) await dispatchExceed(opts, lim.window, spent, lim.limitUsd, mode);
|
|
347
|
+
continue;
|
|
348
|
+
}
|
|
349
|
+
const ratio = spent / lim.limitUsd;
|
|
350
|
+
if (ratio >= 1) {
|
|
351
|
+
await dispatchExceed(opts, lim.window, spent, lim.limitUsd, mode);
|
|
352
|
+
} else {
|
|
353
|
+
for (const t of [...THRESHOLDS].reverse()) {
|
|
354
|
+
if (ratio >= t) {
|
|
355
|
+
await dispatchThreshold(opts, lim.window, spent, lim.limitUsd, t);
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
async function dispatchThreshold(opts, window, spentUsd, limitUsd, threshold) {
|
|
363
|
+
if (opts.onThreshold === void 0) return;
|
|
364
|
+
try {
|
|
365
|
+
await opts.onThreshold({
|
|
366
|
+
budgetName: opts.name,
|
|
367
|
+
window,
|
|
368
|
+
threshold,
|
|
369
|
+
spentUsd,
|
|
370
|
+
limitUsd
|
|
371
|
+
});
|
|
372
|
+
} catch (err) {
|
|
373
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
374
|
+
chunk6LHQPOMI_cjs.diag(`[budget] onThreshold callback threw: ${msg}
|
|
375
|
+
`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
async function dispatchExceed(opts, window, spentUsd, limitUsd, mode) {
|
|
379
|
+
if (opts.onExceed === void 0) {
|
|
380
|
+
if (mode === "warn") {
|
|
381
|
+
chunk6LHQPOMI_cjs.diag(
|
|
382
|
+
`[budget] "${opts.name}" exceeded ${window} limit: $${spentUsd.toFixed(4)} > $${limitUsd.toFixed(4)}
|
|
383
|
+
`
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
try {
|
|
389
|
+
await opts.onExceed({
|
|
390
|
+
budgetName: opts.name,
|
|
391
|
+
window,
|
|
392
|
+
spentUsd,
|
|
393
|
+
limitUsd,
|
|
394
|
+
mode
|
|
395
|
+
});
|
|
396
|
+
} catch (err) {
|
|
397
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
398
|
+
chunk6LHQPOMI_cjs.diag(`[budget] onExceed callback threw: ${msg}
|
|
399
|
+
`);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// src/internal/budget/normalize-usage.ts
|
|
404
|
+
function int(v) {
|
|
405
|
+
if (typeof v === "number") return Number.isFinite(v) ? Math.max(0, Math.trunc(v)) : 0;
|
|
406
|
+
if (typeof v === "string") {
|
|
407
|
+
const n = Number.parseInt(v, 10);
|
|
408
|
+
return Number.isFinite(n) ? Math.max(0, n) : 0;
|
|
409
|
+
}
|
|
410
|
+
return 0;
|
|
411
|
+
}
|
|
412
|
+
function buildTotal(buckets) {
|
|
413
|
+
return buckets.inputTokens + buckets.outputTokens + buckets.cacheReadTokens + buckets.cacheWriteTokens;
|
|
414
|
+
}
|
|
415
|
+
function omitUndefined(usage) {
|
|
416
|
+
return {
|
|
417
|
+
inputTokens: usage.inputTokens,
|
|
418
|
+
outputTokens: usage.outputTokens,
|
|
419
|
+
...usage.cacheReadTokens > 0 ? { cacheReadTokens: usage.cacheReadTokens } : {},
|
|
420
|
+
...usage.cacheWriteTokens > 0 ? { cacheWriteTokens: usage.cacheWriteTokens } : {},
|
|
421
|
+
...usage.reasoningTokens > 0 ? { reasoningTokens: usage.reasoningTokens } : {},
|
|
422
|
+
totalTokens: usage.totalTokens
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
function inferApiMode(provider) {
|
|
426
|
+
const p = provider.toLowerCase();
|
|
427
|
+
if (p === "anthropic" || p === "claude" || p === "bedrock_anthropic") {
|
|
428
|
+
return "anthropic_messages";
|
|
429
|
+
}
|
|
430
|
+
if (p === "openai-codex" || p === "codex") return "openai_responses";
|
|
431
|
+
return "openai_chat_completions";
|
|
432
|
+
}
|
|
433
|
+
function normalizeUsage(rawUsage, opts) {
|
|
434
|
+
if (rawUsage === null || rawUsage === void 0) {
|
|
435
|
+
return { inputTokens: 0, outputTokens: 0, totalTokens: 0 };
|
|
436
|
+
}
|
|
437
|
+
if (typeof rawUsage !== "object") {
|
|
438
|
+
return { inputTokens: 0, outputTokens: 0, totalTokens: 0 };
|
|
439
|
+
}
|
|
440
|
+
const raw = rawUsage;
|
|
441
|
+
const mode = opts.apiMode ?? inferApiMode(opts.provider);
|
|
442
|
+
if (mode === "anthropic_messages") return normalizeAnthropic(raw);
|
|
443
|
+
if (mode === "openai_responses") return normalizeOpenAIResponses(raw);
|
|
444
|
+
return normalizeOpenAIChat(raw);
|
|
445
|
+
}
|
|
446
|
+
function normalizeAnthropic(raw) {
|
|
447
|
+
const inputTokens = int(raw.input_tokens);
|
|
448
|
+
const outputTokens = int(raw.output_tokens);
|
|
449
|
+
const cacheReadTokens = int(raw.cache_read_input_tokens);
|
|
450
|
+
const cacheWriteTokens = int(raw.cache_creation_input_tokens);
|
|
451
|
+
const usage = {
|
|
452
|
+
inputTokens,
|
|
453
|
+
outputTokens,
|
|
454
|
+
cacheReadTokens,
|
|
455
|
+
cacheWriteTokens,
|
|
456
|
+
reasoningTokens: 0,
|
|
457
|
+
totalTokens: buildTotal({ inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens })
|
|
458
|
+
};
|
|
459
|
+
return omitUndefined(usage);
|
|
460
|
+
}
|
|
461
|
+
function normalizeOpenAIResponses(raw) {
|
|
462
|
+
const inputTotal = int(raw.input_tokens);
|
|
463
|
+
const outputTokens = int(raw.output_tokens);
|
|
464
|
+
const inputDetails = raw.input_tokens_details ?? {};
|
|
465
|
+
const outputDetails = raw.output_tokens_details ?? {};
|
|
466
|
+
const cacheReadTokens = int(inputDetails.cached_tokens);
|
|
467
|
+
const cacheWriteTokens = int(inputDetails.cache_creation_tokens);
|
|
468
|
+
const reasoningTokens = int(outputDetails.reasoning_tokens);
|
|
469
|
+
const inputTokens = Math.max(0, inputTotal - cacheReadTokens - cacheWriteTokens);
|
|
470
|
+
const usage = {
|
|
471
|
+
inputTokens,
|
|
472
|
+
outputTokens,
|
|
473
|
+
cacheReadTokens,
|
|
474
|
+
cacheWriteTokens,
|
|
475
|
+
reasoningTokens,
|
|
476
|
+
totalTokens: buildTotal({ inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens })
|
|
477
|
+
};
|
|
478
|
+
return omitUndefined(usage);
|
|
479
|
+
}
|
|
480
|
+
function normalizeOpenAIChat(raw) {
|
|
481
|
+
const promptTotal = int(raw.prompt_tokens);
|
|
482
|
+
const outputTokens = int(raw.completion_tokens);
|
|
483
|
+
const promptDetails = raw.prompt_tokens_details ?? {};
|
|
484
|
+
const completionDetails = raw.completion_tokens_details ?? {};
|
|
485
|
+
const cacheReadTokens = int(promptDetails.cached_tokens) || int(raw.cache_read_input_tokens);
|
|
486
|
+
const cacheWriteTokens = int(promptDetails.cache_write_tokens) || int(raw.cache_creation_input_tokens);
|
|
487
|
+
const reasoningTokens = int(completionDetails.reasoning_tokens);
|
|
488
|
+
const inputTokens = Math.max(0, promptTotal - cacheReadTokens - cacheWriteTokens);
|
|
489
|
+
const usage = {
|
|
490
|
+
inputTokens,
|
|
491
|
+
outputTokens,
|
|
492
|
+
cacheReadTokens,
|
|
493
|
+
cacheWriteTokens,
|
|
494
|
+
reasoningTokens,
|
|
495
|
+
totalTokens: buildTotal({ inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens })
|
|
496
|
+
};
|
|
497
|
+
return omitUndefined(usage);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
// src/budget.ts
|
|
501
|
+
var Budget = class {
|
|
502
|
+
// D375 — static class with private constructor.
|
|
503
|
+
constructor() {
|
|
504
|
+
throw new Error("Budget is static; do not instantiate");
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Create a budget. `name` must match `^[a-z0-9][a-z0-9_-]*$` (EC-7).
|
|
508
|
+
* Throws `ConfigurationError` if name is invalid OR already exists
|
|
509
|
+
* (EC-16: duplicate surface caller bug).
|
|
510
|
+
*
|
|
511
|
+
* `limits` is stacked (D384) — ANY exceeded triggers enforcement.
|
|
512
|
+
* Empty `limits[]` is valid: pure tracking, no thresholds/exceed
|
|
513
|
+
* callbacks fire (EC-19).
|
|
514
|
+
*
|
|
515
|
+
* Default `mode` is `"warn"` (D383). For emergency stop, use
|
|
516
|
+
* `mode: "block", limits: [{ window: "1d", limitUsd: 0 }]` (EC-18).
|
|
517
|
+
*/
|
|
518
|
+
static create(options) {
|
|
519
|
+
return createBudget(options);
|
|
520
|
+
}
|
|
521
|
+
/** Returns the handle for an active budget, or `undefined`. */
|
|
522
|
+
static get(name) {
|
|
523
|
+
return getBudget(name);
|
|
524
|
+
}
|
|
525
|
+
/** Returns all active budgets. */
|
|
526
|
+
static list() {
|
|
527
|
+
return listBudgets();
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Deletes a budget from the registry. Returns `true` if it existed.
|
|
531
|
+
* In-flight `agent.send` calls referencing the name treat the
|
|
532
|
+
* subsequent charge as a silent no-op + stderr warn (EC-20).
|
|
533
|
+
*/
|
|
534
|
+
static delete(name) {
|
|
535
|
+
return deleteBudget(name);
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Returns per-window spend snapshot for all active budgets. Each
|
|
539
|
+
* entry has `{ name, window, spentUsd, limitUsd, ratio }`.
|
|
540
|
+
*/
|
|
541
|
+
static snapshot() {
|
|
542
|
+
return snapshotAll();
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
// src/built-in-processors.ts
|
|
547
|
+
var CONTROL_CHARS = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F]/g;
|
|
548
|
+
function createUnicodeNormalizer(opts = {}) {
|
|
549
|
+
const stripControlChars = opts.stripControlChars ?? false;
|
|
550
|
+
const collapseWhitespace = opts.collapseWhitespace ?? false;
|
|
551
|
+
return {
|
|
552
|
+
id: "unicode-normalizer",
|
|
553
|
+
processInput(ctx) {
|
|
554
|
+
let s = ctx.message.normalize("NFC");
|
|
555
|
+
if (stripControlChars) s = s.replace(CONTROL_CHARS, "");
|
|
556
|
+
if (collapseWhitespace) {
|
|
557
|
+
s = s.replace(/[^\S\n]+/g, " ").replace(/ *\n */g, "\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
558
|
+
}
|
|
559
|
+
return s;
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
function createTokenLimiter(opts) {
|
|
564
|
+
if (!Number.isInteger(opts.limit) || opts.limit <= 0) {
|
|
565
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError("createTokenLimiter: `limit` must be a positive integer.", {
|
|
566
|
+
code: "invalid_processor_options"
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
const limit = opts.limit;
|
|
570
|
+
const strategy = opts.strategy ?? "truncate";
|
|
571
|
+
const cap = (text, controls) => {
|
|
572
|
+
const estimated = chunkATT276RD_cjs.estimateTokens(text);
|
|
573
|
+
if (estimated <= limit) return text;
|
|
574
|
+
if (strategy === "block") {
|
|
575
|
+
controls.abort(`exceeds token limit ${limit} (~${estimated} estimated)`);
|
|
576
|
+
}
|
|
577
|
+
return [...text].slice(0, limit * chunkATT276RD_cjs.CHARS_PER_TOKEN).join("");
|
|
578
|
+
};
|
|
579
|
+
return {
|
|
580
|
+
id: "token-limiter",
|
|
581
|
+
processInput: (ctx) => cap(ctx.message, ctx),
|
|
582
|
+
processOutput: (ctx) => cap(ctx.text, ctx)
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
var TokenLimiter = class {
|
|
586
|
+
constructor() {
|
|
587
|
+
}
|
|
588
|
+
static create(opts) {
|
|
589
|
+
return createTokenLimiter(opts);
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
var UnicodeNormalizer = class {
|
|
593
|
+
constructor() {
|
|
594
|
+
}
|
|
595
|
+
static create(opts = {}) {
|
|
596
|
+
return createUnicodeNormalizer(opts);
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
// src/create-skill.ts
|
|
601
|
+
function createSkill(spec) {
|
|
602
|
+
if (!spec.name) {
|
|
603
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError("createSkill: `name` is required.", {
|
|
604
|
+
code: "invalid_skill_spec"
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
if (!spec.description) {
|
|
608
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError("createSkill: `description` is required.", {
|
|
609
|
+
code: "invalid_skill_spec"
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
return {
|
|
613
|
+
name: spec.name,
|
|
614
|
+
description: spec.description,
|
|
615
|
+
source: `inline://${spec.name}`,
|
|
616
|
+
instructions: spec.instructions,
|
|
617
|
+
...spec.category !== void 0 ? { category: spec.category } : {},
|
|
618
|
+
...spec.dependencies !== void 0 ? { dependencies: spec.dependencies } : {},
|
|
619
|
+
...spec.references !== void 0 ? { references: spec.references } : {}
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
var Skill = class {
|
|
623
|
+
constructor() {
|
|
624
|
+
}
|
|
625
|
+
static create(spec) {
|
|
626
|
+
return createSkill(spec);
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
function describeCredential(input) {
|
|
630
|
+
const secret = (input.value ?? "").trim();
|
|
631
|
+
if (secret.length === 0) {
|
|
632
|
+
return { provider: input.provider, present: false, source: input.source };
|
|
633
|
+
}
|
|
634
|
+
return {
|
|
635
|
+
provider: input.provider,
|
|
636
|
+
present: true,
|
|
637
|
+
source: input.source,
|
|
638
|
+
fingerprint: crypto.createHash("sha256").update(secret).digest("hex").slice(0, 8)
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// src/define-provider.ts
|
|
643
|
+
function defineProvider(profile, opts) {
|
|
644
|
+
return {
|
|
645
|
+
name: profile.name,
|
|
646
|
+
version: opts?.version ?? "1.0.0",
|
|
647
|
+
kind: "model-provider",
|
|
648
|
+
profile
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
var Provider = class _Provider {
|
|
652
|
+
constructor() {
|
|
653
|
+
}
|
|
654
|
+
static create(profile, opts) {
|
|
655
|
+
return defineProvider(profile, opts);
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Every first-party builtin provider (anthropic, openai, openrouter, gemini, ollama, the ChatGPT/Codex
|
|
659
|
+
* `openai-chatgpt`, …) as model-provider plugins, ready to hand to `Agent.create({ plugins })` or any
|
|
660
|
+
* runtime that consumes model-provider plugins (e.g. the `theokit` agent server / `@theokit/agents`, whose
|
|
661
|
+
* own model resolution does NOT share this registry). Enables a consumer to route to ANY SDK builtin —
|
|
662
|
+
* including one added later in a single SDK file — with ZERO provider-specific code: just
|
|
663
|
+
* `.plugins(Provider.builtins())` once, then pick a `provider/model` id. @public
|
|
664
|
+
*/
|
|
665
|
+
static builtins() {
|
|
666
|
+
chunkQC55H6RJ_cjs.registerBuiltins();
|
|
667
|
+
return chunkQC55H6RJ_cjs.listProviders().map((profile) => defineProvider(profile));
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* The builtin serving `modelId`, or `undefined` when none does.
|
|
671
|
+
*
|
|
672
|
+
* The grammar of a model id — `provider/model` — now has **one** owner. M94: the consumer
|
|
673
|
+
* redid it by hand with `modelId.slice(0, modelId.indexOf('/'))`, which on an id **without a slash** returns the
|
|
674
|
+
* id minus its last character (`claude-opus-5` -> `claude-opus-`): it matches no provider and the
|
|
675
|
+
* caller fell through to the default, without distinguishing that from a hit. A non-routable model was
|
|
676
|
+
* indistinguishable from the happy path.
|
|
677
|
+
*
|
|
678
|
+
* Returns `undefined` instead of throwing: the caller decides whether absence is an error, and only they
|
|
679
|
+
* know whether the model came from an explicit `--model` (an error) or from the default (normal).
|
|
680
|
+
*
|
|
681
|
+
* @public
|
|
682
|
+
*/
|
|
683
|
+
static forModel(modelId) {
|
|
684
|
+
const { provider } = chunk3EE6LVWT_cjs.parseModelId(modelId);
|
|
685
|
+
if (provider === void 0) return void 0;
|
|
686
|
+
return _Provider.builtins().find((p) => p.name === provider);
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
var SkillReadInputSchema = zod.z.object({
|
|
690
|
+
name: zod.z.string().min(1, "skill_read: `name` is required.")
|
|
691
|
+
});
|
|
692
|
+
function renderSkill(skill) {
|
|
693
|
+
const parts = [`# Skill: ${skill.name}`, "", skill.instructions];
|
|
694
|
+
const refs = skill.references;
|
|
695
|
+
if (refs !== void 0 && Object.keys(refs).length > 0) {
|
|
696
|
+
parts.push("", "## References");
|
|
697
|
+
for (const [file, content] of Object.entries(refs)) {
|
|
698
|
+
parts.push("", `### ${file}`, content);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
return parts.join("\n");
|
|
702
|
+
}
|
|
703
|
+
function defineSkillReadTool(skills) {
|
|
704
|
+
const seen = /* @__PURE__ */ new Set();
|
|
705
|
+
for (const skill of skills) {
|
|
706
|
+
if (seen.has(skill.name)) {
|
|
707
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError(`defineSkillReadTool: duplicate skill name "${skill.name}".`, {
|
|
708
|
+
code: "duplicate_skill_name"
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
seen.add(skill.name);
|
|
712
|
+
}
|
|
713
|
+
return {
|
|
714
|
+
name: "skill_read",
|
|
715
|
+
description: "Read a skill's full instructions (and any bundled reference documents) by its name. Use this to load the body of a skill listed in the <skills> block before acting on it.",
|
|
716
|
+
inputSchema: chunkAA27GEYS_cjs.toJsonSchema(SkillReadInputSchema),
|
|
717
|
+
handler: (input) => {
|
|
718
|
+
const { name } = SkillReadInputSchema.parse(input);
|
|
719
|
+
const skill = skills.find((s) => s.name === name);
|
|
720
|
+
if (skill === void 0) {
|
|
721
|
+
const available = skills.map((s) => s.name).join(", ");
|
|
722
|
+
return `Skill "${name}" not found. Available skills: ${available.length > 0 ? available : "(none)"}.`;
|
|
723
|
+
}
|
|
724
|
+
return renderSkill(skill);
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
var SkillReadTool = class {
|
|
729
|
+
constructor() {
|
|
730
|
+
}
|
|
731
|
+
static create(skills) {
|
|
732
|
+
return defineSkillReadTool(skills);
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
|
|
736
|
+
// src/env-reachability.ts
|
|
737
|
+
function auditEnvReachability(input) {
|
|
738
|
+
const reachable = new Set(input.reachable);
|
|
739
|
+
const exempt = new Set(input.optOuts.map((o) => o.key));
|
|
740
|
+
const declared = new Set(input.keys);
|
|
741
|
+
return {
|
|
742
|
+
unreachable: input.keys.filter((k) => !reachable.has(k) && !exempt.has(k)),
|
|
743
|
+
staleOptOuts: input.optOuts.filter((o) => !declared.has(o.key) || reachable.has(o.key)).map((o) => o.key)
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
// src/event-bus.ts
|
|
748
|
+
var EventBus = class {
|
|
749
|
+
handlers = /* @__PURE__ */ new Map();
|
|
750
|
+
// M3 #64 — a swallowed handler error used to vanish without a trace (fail-loud
|
|
751
|
+
// violation). We now log it AND expose an observable count so ops/tests can see
|
|
752
|
+
// that a subscriber is silently failing, without breaking the EC-2 contract.
|
|
753
|
+
#handlerErrorCount = 0;
|
|
754
|
+
/** M3 #64 — number of handler invocations that threw (and were logged). */
|
|
755
|
+
get handlerErrorCount() {
|
|
756
|
+
return this.#handlerErrorCount;
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Subscribe to an event. Returns an unsubscribe function.
|
|
760
|
+
*/
|
|
761
|
+
subscribe(event, handler) {
|
|
762
|
+
if (!this.handlers.has(event)) {
|
|
763
|
+
this.handlers.set(event, /* @__PURE__ */ new Set());
|
|
764
|
+
}
|
|
765
|
+
const set = this.handlers.get(event);
|
|
766
|
+
set.add(handler);
|
|
767
|
+
return () => {
|
|
768
|
+
set.delete(handler);
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Publish an event to all subscribers. EC-2: try-catch per handler.
|
|
773
|
+
*/
|
|
774
|
+
publish(event, payload) {
|
|
775
|
+
const set = this.handlers.get(event);
|
|
776
|
+
if (!set) return;
|
|
777
|
+
for (const handler of set) {
|
|
778
|
+
try {
|
|
779
|
+
handler(payload);
|
|
780
|
+
} catch (cause) {
|
|
781
|
+
this.#handlerErrorCount += 1;
|
|
782
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
783
|
+
chunk6LHQPOMI_cjs.diag(`[theokit-sdk] event-bus: handler for "${String(event)}" threw: ${message}
|
|
784
|
+
`);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Subscribe to an event for a single firing. Returns an unsubscribe function.
|
|
790
|
+
*/
|
|
791
|
+
once(event, handler) {
|
|
792
|
+
const wrapped = (payload) => {
|
|
793
|
+
unsub();
|
|
794
|
+
handler(payload);
|
|
795
|
+
};
|
|
796
|
+
const unsub = this.subscribe(event, wrapped);
|
|
797
|
+
return unsub;
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
// src/goal-loop.ts
|
|
802
|
+
function runGoalLoop(agent, goal, options, depsOverride) {
|
|
803
|
+
async function* wrap() {
|
|
804
|
+
const { runUntilImpl } = await import('./run-until-DG2KXWB2.cjs');
|
|
805
|
+
const deps = depsOverride ?? await (async () => {
|
|
806
|
+
const { judgeCallImpl } = await import('./judge-call-46M2E5FA.cjs');
|
|
807
|
+
const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
|
|
808
|
+
const create = getAgentFacade().create;
|
|
809
|
+
return {
|
|
810
|
+
judge: (ctx, opts) => judgeCallImpl(ctx, opts, { create })
|
|
811
|
+
};
|
|
812
|
+
})();
|
|
813
|
+
return yield* runUntilImpl(agent, goal, options, deps);
|
|
814
|
+
}
|
|
815
|
+
return wrap();
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
// src/internal/budget/tracker/budget-tracker-counter.ts
|
|
819
|
+
function createCounterBudgetTracker(options = {}) {
|
|
820
|
+
let totalTokens = 0;
|
|
821
|
+
let iterations = 0;
|
|
822
|
+
const maxTokens = options.maxTokens;
|
|
823
|
+
const maxIterations = options.maxIterations;
|
|
824
|
+
return {
|
|
825
|
+
track(event) {
|
|
826
|
+
const t = Number.isFinite(event.tokens) && event.tokens > 0 ? event.tokens : 0;
|
|
827
|
+
totalTokens += t;
|
|
828
|
+
},
|
|
829
|
+
check() {
|
|
830
|
+
if (maxTokens !== void 0 && totalTokens >= maxTokens) {
|
|
831
|
+
return {
|
|
832
|
+
allowed: false,
|
|
833
|
+
reason: "token_limit",
|
|
834
|
+
detail: `${totalTokens} >= maxTokens ${maxTokens}`
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
if (maxIterations !== void 0 && iterations >= maxIterations) {
|
|
838
|
+
return {
|
|
839
|
+
allowed: false,
|
|
840
|
+
reason: "iteration_limit",
|
|
841
|
+
detail: `${iterations} >= maxIterations ${maxIterations}`
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
return { allowed: true };
|
|
845
|
+
},
|
|
846
|
+
getTotal() {
|
|
847
|
+
return { tokens: totalTokens, iterations };
|
|
848
|
+
},
|
|
849
|
+
nextIteration() {
|
|
850
|
+
iterations += 1;
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
// src/internal/plugins/types.ts
|
|
856
|
+
function definePlugin(p) {
|
|
857
|
+
return p;
|
|
858
|
+
}
|
|
859
|
+
var Plugin = { create: definePlugin };
|
|
860
|
+
|
|
861
|
+
// src/internal/runtime/memory-glue/memory-provider-noop.ts
|
|
862
|
+
var NOOP_ADAPTER_ID = "noop";
|
|
863
|
+
var NOOP_CAPABILITIES = {
|
|
864
|
+
history: false,
|
|
865
|
+
sessions: false,
|
|
866
|
+
tenancy: false,
|
|
867
|
+
reasoning: false,
|
|
868
|
+
toolSchemas: false,
|
|
869
|
+
prefetch: false
|
|
870
|
+
};
|
|
871
|
+
function createNoopMemoryAdapter() {
|
|
872
|
+
return {
|
|
873
|
+
id: NOOP_ADAPTER_ID,
|
|
874
|
+
capabilities: NOOP_CAPABILITIES,
|
|
875
|
+
isAvailable() {
|
|
876
|
+
return true;
|
|
877
|
+
},
|
|
878
|
+
async write(_content, _ctx) {
|
|
879
|
+
return `${NOOP_ADAPTER_ID}:noop`;
|
|
880
|
+
},
|
|
881
|
+
async recall(_query, _ctx, _k) {
|
|
882
|
+
return [];
|
|
883
|
+
},
|
|
884
|
+
async delete(_id) {
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
function createNoopMemoryProvider() {
|
|
890
|
+
return {
|
|
891
|
+
async init(_opts) {
|
|
892
|
+
return {
|
|
893
|
+
adapter: createNoopMemoryAdapter()
|
|
894
|
+
};
|
|
895
|
+
},
|
|
896
|
+
buildTools(_handle) {
|
|
897
|
+
return [];
|
|
898
|
+
},
|
|
899
|
+
async runActivePass(_handle, _args) {
|
|
900
|
+
return { facts: [] };
|
|
901
|
+
},
|
|
902
|
+
recordSessionSummary() {
|
|
903
|
+
return;
|
|
904
|
+
},
|
|
905
|
+
dispose(_handle) {
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
var NoopMemoryProvider = class {
|
|
911
|
+
constructor() {
|
|
912
|
+
}
|
|
913
|
+
static create() {
|
|
914
|
+
return createNoopMemoryProvider();
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
var JobQueue = class {
|
|
918
|
+
jobs = /* @__PURE__ */ new Map();
|
|
919
|
+
controllers = /* @__PURE__ */ new Map();
|
|
920
|
+
maxConcurrency;
|
|
921
|
+
running = 0;
|
|
922
|
+
waiting = [];
|
|
923
|
+
constructor(options = {}) {
|
|
924
|
+
this.maxConcurrency = options.maxConcurrency === void 0 ? Number.POSITIVE_INFINITY : Math.max(1, options.maxConcurrency);
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Enqueue a background function. Returns the job ID immediately. The function
|
|
928
|
+
* receives an `AbortSignal` that fires when the job is cancelled (#58) — a
|
|
929
|
+
* cooperative job should observe it to stop early. Existing `() => Promise<T>`
|
|
930
|
+
* callers are unaffected (the signal argument is simply ignored).
|
|
931
|
+
*/
|
|
932
|
+
enqueue(fn2) {
|
|
933
|
+
const id = crypto.randomUUID();
|
|
934
|
+
const job = { id, status: "pending" };
|
|
935
|
+
this.jobs.set(id, job);
|
|
936
|
+
const controller = new AbortController();
|
|
937
|
+
this.controllers.set(id, controller);
|
|
938
|
+
void this.#acquire().then(() => {
|
|
939
|
+
if (job.status === "cancelled") {
|
|
940
|
+
this.#release(id);
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
job.status = "running";
|
|
944
|
+
Promise.resolve().then(() => fn2(controller.signal)).then((result) => {
|
|
945
|
+
if (job.status === "cancelled") return;
|
|
946
|
+
job.result = result;
|
|
947
|
+
job.status = "completed";
|
|
948
|
+
}).catch((err) => {
|
|
949
|
+
if (job.status === "cancelled") return;
|
|
950
|
+
job.error = err instanceof Error ? err.message : String(err);
|
|
951
|
+
job.status = "failed";
|
|
952
|
+
}).finally(() => this.#release(id));
|
|
953
|
+
});
|
|
954
|
+
return id;
|
|
955
|
+
}
|
|
956
|
+
getJob(id) {
|
|
957
|
+
return this.jobs.get(id);
|
|
958
|
+
}
|
|
959
|
+
list() {
|
|
960
|
+
return [...this.jobs.values()];
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Cancel a pending or running job. Returns true if cancelled. #58 — aborts the
|
|
964
|
+
* job's `AbortSignal` so a cooperative running job is actually interrupted.
|
|
965
|
+
*/
|
|
966
|
+
cancel(id) {
|
|
967
|
+
const job = this.jobs.get(id);
|
|
968
|
+
if (!job) return false;
|
|
969
|
+
if (job.status === "pending" || job.status === "running") {
|
|
970
|
+
const wasRunning = job.status === "running";
|
|
971
|
+
job.status = "cancelled";
|
|
972
|
+
this.controllers.get(id)?.abort();
|
|
973
|
+
if (wasRunning) this.#release(id);
|
|
974
|
+
return true;
|
|
975
|
+
}
|
|
976
|
+
return false;
|
|
977
|
+
}
|
|
978
|
+
/** Acquire a concurrency slot (resolves immediately when unbounded/free). */
|
|
979
|
+
#acquire() {
|
|
980
|
+
if (this.running < this.maxConcurrency) {
|
|
981
|
+
this.running += 1;
|
|
982
|
+
return Promise.resolve();
|
|
983
|
+
}
|
|
984
|
+
return new Promise((resolve) => {
|
|
985
|
+
this.waiting.push(() => {
|
|
986
|
+
this.running += 1;
|
|
987
|
+
resolve();
|
|
988
|
+
});
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Release a slot + clean up the controller; start the next waiting job.
|
|
993
|
+
* Idempotent — keyed on the controller's presence, so a running job that was
|
|
994
|
+
* cancelled (released early) does not double-decrement when its `.finally`
|
|
995
|
+
* eventually fires.
|
|
996
|
+
*/
|
|
997
|
+
#release(id) {
|
|
998
|
+
if (!this.controllers.has(id)) return;
|
|
999
|
+
this.controllers.delete(id);
|
|
1000
|
+
this.running -= 1;
|
|
1001
|
+
const next = this.waiting.shift();
|
|
1002
|
+
if (next !== void 0) next();
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
// src/layer-fold.ts
|
|
1007
|
+
var LayerOrderError = class extends chunkJ7J7J2GN_cjs.TheokitAgentError {
|
|
1008
|
+
name = "LayerOrderError";
|
|
1009
|
+
};
|
|
1010
|
+
function verifyLayerOrdering(layers) {
|
|
1011
|
+
let previous;
|
|
1012
|
+
for (const current of layers) {
|
|
1013
|
+
if (current.precedence === void 0) continue;
|
|
1014
|
+
const declared = { layer: current.layer, precedence: current.precedence };
|
|
1015
|
+
if (previous !== void 0 && declared.precedence <= previous.precedence) {
|
|
1016
|
+
throw new LayerOrderError(
|
|
1017
|
+
`layers out of order: \`${declared.layer}\` (precedence ${String(declared.precedence)}) comes after \`${previous.layer}\` (precedence ${String(previous.precedence)}) but does not outrank it`
|
|
1018
|
+
);
|
|
1019
|
+
}
|
|
1020
|
+
previous = declared;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
function foldLayers(entries, accumulatingKeys = []) {
|
|
1024
|
+
verifyLayerOrdering(entries);
|
|
1025
|
+
const accumulated = new Map(accumulatingKeys.map((k) => [k, []]));
|
|
1026
|
+
const combined = {};
|
|
1027
|
+
for (const { values } of entries) {
|
|
1028
|
+
for (const [key, value] of Object.entries(values)) {
|
|
1029
|
+
if (value === void 0) continue;
|
|
1030
|
+
const stack = accumulated.get(key);
|
|
1031
|
+
if (stack !== void 0 && Array.isArray(value)) {
|
|
1032
|
+
stack.push(...value);
|
|
1033
|
+
combined[key] = [...stack];
|
|
1034
|
+
continue;
|
|
1035
|
+
}
|
|
1036
|
+
combined[key] = value;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
return combined;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// src/internal/memory/dreaming/phases.ts
|
|
1043
|
+
var DEFAULT_DEDUP_THRESHOLD = 0.95;
|
|
1044
|
+
var DEFAULT_CLUSTER_THRESHOLD = 0.75;
|
|
1045
|
+
var CONSOLIDATABLE_KINDS = /* @__PURE__ */ new Set(["project"]);
|
|
1046
|
+
var ATOMIC_KINDS = /* @__PURE__ */ new Set(["user", "feedback", "reference"]);
|
|
1047
|
+
function dedupPolicy(fact) {
|
|
1048
|
+
if (fact.kind === void 0) return "exact";
|
|
1049
|
+
if (ATOMIC_KINDS.has(fact.kind)) return "never";
|
|
1050
|
+
return CONSOLIDATABLE_KINDS.has(fact.kind) ? "similar" : "never";
|
|
1051
|
+
}
|
|
1052
|
+
function normalizeForExactMatch(text) {
|
|
1053
|
+
return text.trim().toLowerCase().replace(/\s+/g, " ").replace(/[.!?]+$/, "");
|
|
1054
|
+
}
|
|
1055
|
+
async function lightPhase(facts, embedding, threshold = DEFAULT_DEDUP_THRESHOLD) {
|
|
1056
|
+
if (facts.length <= 1) return { kept: [...facts], duplicatesRemoved: 0 };
|
|
1057
|
+
const never = facts.filter((f) => dedupPolicy(f) === "never");
|
|
1058
|
+
const exact = facts.filter((f) => dedupPolicy(f) === "exact");
|
|
1059
|
+
const similar = facts.filter((f) => dedupPolicy(f) === "similar");
|
|
1060
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1061
|
+
const exactKept = [];
|
|
1062
|
+
let removed = 0;
|
|
1063
|
+
for (const f of exact) {
|
|
1064
|
+
const key = normalizeForExactMatch(f.text);
|
|
1065
|
+
if (seen.has(key)) {
|
|
1066
|
+
removed += 1;
|
|
1067
|
+
continue;
|
|
1068
|
+
}
|
|
1069
|
+
seen.add(key);
|
|
1070
|
+
exactKept.push(f);
|
|
1071
|
+
}
|
|
1072
|
+
const sim = similar.length > 1 ? await dedupCandidates(similar, embedding, threshold) : { kept: [...similar], duplicatesRemoved: 0 };
|
|
1073
|
+
return {
|
|
1074
|
+
kept: [...never, ...exactKept, ...sim.kept],
|
|
1075
|
+
duplicatesRemoved: removed + sim.duplicatesRemoved
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
async function dedupCandidates(facts, embedding, threshold) {
|
|
1079
|
+
if (facts.length <= 1) return { kept: [...facts], duplicatesRemoved: 0 };
|
|
1080
|
+
const vectors = await embedding.embed(facts.map((f) => f.text));
|
|
1081
|
+
const keptIdx = [];
|
|
1082
|
+
const keptVecs = [];
|
|
1083
|
+
for (let i = 0; i < facts.length; i++) {
|
|
1084
|
+
const vec = vectors[i] ?? [];
|
|
1085
|
+
const isDup = keptVecs.some((kept2) => cosineSimilarity(vec, kept2) >= threshold);
|
|
1086
|
+
if (isDup) continue;
|
|
1087
|
+
keptIdx.push(i);
|
|
1088
|
+
keptVecs.push(vec);
|
|
1089
|
+
}
|
|
1090
|
+
const kept = keptIdx.map((i) => facts[i]);
|
|
1091
|
+
return { kept, duplicatesRemoved: facts.length - kept.length };
|
|
1092
|
+
}
|
|
1093
|
+
var DEFAULT_MAX_FACTS_PER_SWEEP = 500;
|
|
1094
|
+
async function remPhase(facts, embedding, threshold = DEFAULT_CLUSTER_THRESHOLD, maxFactsPerSweep = DEFAULT_MAX_FACTS_PER_SWEEP) {
|
|
1095
|
+
if (facts.length === 0) return { clusters: [] };
|
|
1096
|
+
const capped = facts.length > maxFactsPerSweep ? facts.slice(0, maxFactsPerSweep) : facts;
|
|
1097
|
+
const vectors = await embedding.embed(capped.map((f) => f.text));
|
|
1098
|
+
const clusterOfIdx = unionFindByPairs(vectors, threshold);
|
|
1099
|
+
const groups = bucketFactsByClusterRoot(capped, clusterOfIdx);
|
|
1100
|
+
return { clusters: [...groups.values()].map(buildClusterFromMembers) };
|
|
1101
|
+
}
|
|
1102
|
+
function unionFindByPairs(vectors, threshold) {
|
|
1103
|
+
const clusterOfIdx = vectors.map((_, i) => i);
|
|
1104
|
+
for (let i = 0; i < vectors.length; i++) {
|
|
1105
|
+
for (let j = i + 1; j < vectors.length; j++) {
|
|
1106
|
+
if (cosineSimilarity(vectors[i] ?? [], vectors[j] ?? []) >= threshold) {
|
|
1107
|
+
unifyClusters(clusterOfIdx, i, j);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
return clusterOfIdx;
|
|
1112
|
+
}
|
|
1113
|
+
function bucketFactsByClusterRoot(facts, clusterOfIdx) {
|
|
1114
|
+
const groups = /* @__PURE__ */ new Map();
|
|
1115
|
+
for (let i = 0; i < facts.length; i++) {
|
|
1116
|
+
const root = findRoot(clusterOfIdx, i);
|
|
1117
|
+
const list2 = groups.get(root) ?? [];
|
|
1118
|
+
list2.push(facts[i]);
|
|
1119
|
+
groups.set(root, list2);
|
|
1120
|
+
}
|
|
1121
|
+
return groups;
|
|
1122
|
+
}
|
|
1123
|
+
function buildClusterFromMembers(members) {
|
|
1124
|
+
const sorted = [...members].sort((a, b) => b.text.length - a.text.length);
|
|
1125
|
+
return { representativeText: sorted[0]?.text ?? "", members };
|
|
1126
|
+
}
|
|
1127
|
+
function deepPhase(clusters, timestampMs) {
|
|
1128
|
+
if (clusters.length === 0) return "";
|
|
1129
|
+
const isoStamp = new Date(timestampMs).toISOString();
|
|
1130
|
+
const lines = [`# Dreamed ${isoStamp}`, ""];
|
|
1131
|
+
for (let i = 0; i < clusters.length; i++) {
|
|
1132
|
+
const c = clusters[i];
|
|
1133
|
+
if (c === void 0) continue;
|
|
1134
|
+
lines.push(`## Cluster ${i + 1}: ${c.representativeText}`);
|
|
1135
|
+
lines.push("");
|
|
1136
|
+
for (const member of c.members) lines.push(`- ${member.text}`);
|
|
1137
|
+
lines.push("");
|
|
1138
|
+
}
|
|
1139
|
+
return `${lines.join("\n")}
|
|
1140
|
+
`;
|
|
1141
|
+
}
|
|
1142
|
+
function cosineSimilarity(a, b) {
|
|
1143
|
+
if (a.length === 0 || b.length === 0 || a.length !== b.length) return 0;
|
|
1144
|
+
let dot = 0;
|
|
1145
|
+
let aNorm = 0;
|
|
1146
|
+
let bNorm = 0;
|
|
1147
|
+
for (let i = 0; i < a.length; i++) {
|
|
1148
|
+
const ai = a[i] ?? 0;
|
|
1149
|
+
const bi = b[i] ?? 0;
|
|
1150
|
+
dot += ai * bi;
|
|
1151
|
+
aNorm += ai * ai;
|
|
1152
|
+
bNorm += bi * bi;
|
|
1153
|
+
}
|
|
1154
|
+
const denom = Math.sqrt(aNorm) * Math.sqrt(bNorm);
|
|
1155
|
+
return denom === 0 ? 0 : dot / denom;
|
|
1156
|
+
}
|
|
1157
|
+
function findRoot(parents, i) {
|
|
1158
|
+
let root = i;
|
|
1159
|
+
while (parents[root] !== root) {
|
|
1160
|
+
const next = parents[root] ?? root;
|
|
1161
|
+
if (next === root) break;
|
|
1162
|
+
root = next;
|
|
1163
|
+
}
|
|
1164
|
+
parents[i] = root;
|
|
1165
|
+
return root;
|
|
1166
|
+
}
|
|
1167
|
+
function unifyClusters(parents, a, b) {
|
|
1168
|
+
const rootA = findRoot(parents, a);
|
|
1169
|
+
const rootB = findRoot(parents, b);
|
|
1170
|
+
if (rootA !== rootB) parents[rootB] = rootA;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
// src/internal/memory/dreaming/run.ts
|
|
1174
|
+
function runDreamingSweep(options) {
|
|
1175
|
+
return chunkZF2LDKQQ_cjs.withCwdMutex(`dream:${options.cwd}`, () => runInner(options));
|
|
1176
|
+
}
|
|
1177
|
+
async function runInner(options) {
|
|
1178
|
+
const now = options.now ?? Date.now;
|
|
1179
|
+
const timestampMs = now();
|
|
1180
|
+
try {
|
|
1181
|
+
const root = options.memoryRoot ?? chunkNQTNSHSB_cjs.resolveMemoryRoot(options.cwd);
|
|
1182
|
+
const facts = await chunkNQTNSHSB_cjs.readFactsFromMarkdown(
|
|
1183
|
+
options.cwd,
|
|
1184
|
+
options.memoryRoot ? { directory: options.memoryRoot } : void 0
|
|
1185
|
+
);
|
|
1186
|
+
if (facts.length === 0) {
|
|
1187
|
+
return emptyResult("skipped");
|
|
1188
|
+
}
|
|
1189
|
+
const dedup = await lightPhase(facts, options.embedding, options.dedupThreshold);
|
|
1190
|
+
const rem = await remPhase(dedup.kept, options.embedding, options.clusterThreshold);
|
|
1191
|
+
const notesWritten = await writeConsolidatedNotes(root, rem.clusters, timestampMs);
|
|
1192
|
+
const result = {
|
|
1193
|
+
status: "ok",
|
|
1194
|
+
factsBefore: facts.length,
|
|
1195
|
+
factsAfter: dedup.kept.length,
|
|
1196
|
+
duplicatesRemoved: dedup.duplicatesRemoved,
|
|
1197
|
+
clustersCreated: rem.clusters.length,
|
|
1198
|
+
notesWritten,
|
|
1199
|
+
diaryEntryHash: void 0
|
|
1200
|
+
};
|
|
1201
|
+
await chunkVPK6PHIE_cjs.appendDiaryEntry(root, {
|
|
1202
|
+
timestampMs,
|
|
1203
|
+
factsBefore: result.factsBefore,
|
|
1204
|
+
factsAfter: result.factsAfter,
|
|
1205
|
+
duplicatesRemoved: result.duplicatesRemoved,
|
|
1206
|
+
clustersCreated: result.clustersCreated,
|
|
1207
|
+
notesWritten: result.notesWritten
|
|
1208
|
+
});
|
|
1209
|
+
return result;
|
|
1210
|
+
} catch (cause) {
|
|
1211
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
1212
|
+
chunk6LHQPOMI_cjs.diag(`[theokit-sdk] dreaming sweep failed: ${message}
|
|
1213
|
+
`);
|
|
1214
|
+
return emptyResult("error");
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
async function writeConsolidatedNotes(root, clusters, timestampMs) {
|
|
1218
|
+
if (clusters.length === 0) return 0;
|
|
1219
|
+
const notesDir = path.join(root, "notes");
|
|
1220
|
+
await promises.mkdir(notesDir, { recursive: true });
|
|
1221
|
+
const isoSlug = new Date(timestampMs).toISOString().replace(/[^\dT]/g, "-");
|
|
1222
|
+
const file = path.join(notesDir, `dreamed-${isoSlug}.md`);
|
|
1223
|
+
const body = deepPhase(clusters, timestampMs);
|
|
1224
|
+
await chunkJLRLCBJ4_cjs.replaceFileAtomic(file, body);
|
|
1225
|
+
return 1;
|
|
1226
|
+
}
|
|
1227
|
+
function emptyResult(status) {
|
|
1228
|
+
return {
|
|
1229
|
+
status,
|
|
1230
|
+
factsBefore: 0,
|
|
1231
|
+
factsAfter: 0,
|
|
1232
|
+
duplicatesRemoved: 0,
|
|
1233
|
+
clustersCreated: 0,
|
|
1234
|
+
notesWritten: 0,
|
|
1235
|
+
diaryEntryHash: void 0
|
|
1236
|
+
};
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
// src/internal/memory/sdk-memory-peer-loader.ts
|
|
1240
|
+
var cachedAttempt;
|
|
1241
|
+
async function loadPeer() {
|
|
1242
|
+
try {
|
|
1243
|
+
const spec = "@theokit/sdk-memory";
|
|
1244
|
+
const mod = await import(spec);
|
|
1245
|
+
if (hasExpectedSurface(mod)) return mod;
|
|
1246
|
+
chunk6LHQPOMI_cjs.diag(
|
|
1247
|
+
"sdk-memory peer loaded but does not expose the expected surface (runDreamingSweep / MEMORY_EMBEDDING_ADAPTERS / IndexManager / migrateSqliteToLance) \u2014 falling back to the legacy memory path"
|
|
1248
|
+
);
|
|
1249
|
+
return null;
|
|
1250
|
+
} catch (err) {
|
|
1251
|
+
if (err?.code !== "ERR_MODULE_NOT_FOUND") {
|
|
1252
|
+
chunk6LHQPOMI_cjs.diag(
|
|
1253
|
+
`sdk-memory peer is installed but failed to load \u2014 falling back to the legacy memory path: ${err instanceof Error ? err.message : String(err)}`
|
|
1254
|
+
);
|
|
1255
|
+
}
|
|
1256
|
+
return null;
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
function hasExpectedSurface(mod) {
|
|
1260
|
+
return typeof mod.runDreamingSweep === "function" && mod.MEMORY_EMBEDDING_ADAPTERS !== void 0 && mod.IndexManager !== void 0 && typeof mod.migrateSqliteToLance === "function";
|
|
1261
|
+
}
|
|
1262
|
+
function tryLoadSdkMemoryPeer() {
|
|
1263
|
+
if (cachedAttempt !== void 0) return cachedAttempt;
|
|
1264
|
+
cachedAttempt = loadPeer();
|
|
1265
|
+
return cachedAttempt;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// src/memory.ts
|
|
1269
|
+
var Memory = {
|
|
1270
|
+
/**
|
|
1271
|
+
* Open a memory index. Dispatches to SQLite-vec (default, zero deps) or
|
|
1272
|
+
* LanceDB (opt-in via `backend: "lance"`, requires `@lancedb/lancedb`
|
|
1273
|
+
* peer dep + an embedding runtime).
|
|
1274
|
+
*
|
|
1275
|
+
* Returns a `MemoryIndex` with `sync()`, `search(query, opts?)`,
|
|
1276
|
+
* `status()`, and `close()`. Use this when you want a direct index
|
|
1277
|
+
* handle outside of `Agent.create({ memory: ... })`.
|
|
1278
|
+
*
|
|
1279
|
+
* @throws ConfigurationError({code:"invalid_memory_backend"}) for typos
|
|
1280
|
+
* like `"lancedb"`.
|
|
1281
|
+
* @throws ConfigurationError({code:"lance_requires_embedding"}) when
|
|
1282
|
+
* `backend: "lance"` is requested without `embedding`.
|
|
1283
|
+
* @throws ConfigurationError({code:"lance_backend_unavailable"}) when
|
|
1284
|
+
* `backend: "lance"` is requested but the peer dep is absent.
|
|
1285
|
+
*
|
|
1286
|
+
* @public
|
|
1287
|
+
*/
|
|
1288
|
+
async openIndex(opts) {
|
|
1289
|
+
const peer = await tryLoadSdkMemoryPeer();
|
|
1290
|
+
const openArgs = buildIndexOpenArgs(opts);
|
|
1291
|
+
if (peer !== null) {
|
|
1292
|
+
openArgs.embedding = await resolveEmbedding(opts.embedding, peer.MEMORY_EMBEDDING_ADAPTERS);
|
|
1293
|
+
return await peer.IndexManager.open(openArgs);
|
|
1294
|
+
}
|
|
1295
|
+
const { IndexManager } = await import('./index-manager-3UNPYH34.cjs');
|
|
1296
|
+
openArgs.embedding = await resolveEmbedding(opts.embedding, chunkD3CCY3A2_cjs.MEMORY_EMBEDDING_ADAPTERS);
|
|
1297
|
+
return await IndexManager.open(openArgs);
|
|
1298
|
+
},
|
|
1299
|
+
/**
|
|
1300
|
+
* Run a dreaming sweep: dedup near-duplicate facts, cluster thematically
|
|
1301
|
+
* related ones, and write a consolidated note + diary entry.
|
|
1302
|
+
*
|
|
1303
|
+
* @public
|
|
1304
|
+
*/
|
|
1305
|
+
async runDreamingSweep(opts) {
|
|
1306
|
+
const peer = await tryLoadSdkMemoryPeer();
|
|
1307
|
+
const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkD3CCY3A2_cjs.MEMORY_EMBEDDING_ADAPTERS;
|
|
1308
|
+
const sweepArgs = await buildDreamingSweepArgs(opts, catalog);
|
|
1309
|
+
const result = peer !== null ? (
|
|
1310
|
+
// biome-ignore lint/suspicious/noExplicitAny: peer is dynamically loaded — structural compat ensured by sdk-memory
|
|
1311
|
+
await peer.runDreamingSweep(sweepArgs)
|
|
1312
|
+
) : (
|
|
1313
|
+
// biome-ignore lint/suspicious/noExplicitAny: legacy path accepts the same shape
|
|
1314
|
+
await runDreamingSweep(sweepArgs)
|
|
1315
|
+
);
|
|
1316
|
+
return toDreamingSweepResult(result);
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
async function resolveEmbedding(embeddingOpts, catalog) {
|
|
1320
|
+
if (embeddingOpts === void 0) return void 0;
|
|
1321
|
+
const adapter = catalog[embeddingOpts.provider];
|
|
1322
|
+
if (adapter === void 0) {
|
|
1323
|
+
throw new Error(
|
|
1324
|
+
`Unknown embedding provider "${embeddingOpts.provider}". Supported: ${Object.keys(catalog).join(", ")}.`
|
|
1325
|
+
);
|
|
1326
|
+
}
|
|
1327
|
+
return adapter.create(embeddingOpts.model !== void 0 ? { model: embeddingOpts.model } : {});
|
|
1328
|
+
}
|
|
1329
|
+
function buildIndexOpenArgs(opts, embedding) {
|
|
1330
|
+
return {
|
|
1331
|
+
cwd: opts.cwd,
|
|
1332
|
+
...opts.filePath !== void 0 ? { filePath: opts.filePath } : {},
|
|
1333
|
+
...{},
|
|
1334
|
+
...opts.backend !== void 0 ? { backend: opts.backend } : {}
|
|
1335
|
+
};
|
|
1336
|
+
}
|
|
1337
|
+
async function buildDreamingSweepArgs(opts, catalog) {
|
|
1338
|
+
const runtime = await resolveEmbedding(opts.embedding, catalog);
|
|
1339
|
+
return {
|
|
1340
|
+
cwd: opts.cwd,
|
|
1341
|
+
memoryRoot: chunkNQTNSHSB_cjs.resolveMemoryRoot(opts.cwd, { directory: opts.directory }),
|
|
1342
|
+
embedding: runtime,
|
|
1343
|
+
...opts.dedupThreshold !== void 0 ? { dedupThreshold: opts.dedupThreshold } : {},
|
|
1344
|
+
...opts.clusterThreshold !== void 0 ? { clusterThreshold: opts.clusterThreshold } : {}
|
|
1345
|
+
};
|
|
1346
|
+
}
|
|
1347
|
+
function toDreamingSweepResult(result) {
|
|
1348
|
+
return {
|
|
1349
|
+
status: result.status,
|
|
1350
|
+
factsBefore: result.factsBefore,
|
|
1351
|
+
factsAfter: result.factsAfter,
|
|
1352
|
+
duplicatesRemoved: result.duplicatesRemoved,
|
|
1353
|
+
clustersCreated: result.clustersCreated,
|
|
1354
|
+
notesWritten: result.notesWritten
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
// src/memory-adapter-helpers.ts
|
|
1359
|
+
function mkMemoryId(adapterId, rawId) {
|
|
1360
|
+
return `${adapterId}:${rawId}`;
|
|
1361
|
+
}
|
|
1362
|
+
function extractRawId(id, expectedAdapterId) {
|
|
1363
|
+
const prefix = `${expectedAdapterId}:`;
|
|
1364
|
+
if (!id.startsWith(prefix)) {
|
|
1365
|
+
const sourcePrefix = id.split(":", 1)[0] ?? "<malformed>";
|
|
1366
|
+
throw new chunkJ7J7J2GN_cjs.MemoryAdapterError(
|
|
1367
|
+
`MemoryId belongs to a different adapter (expected "${expectedAdapterId}", got "${sourcePrefix}")`,
|
|
1368
|
+
{ adapterId: expectedAdapterId, code: "invalid_input" }
|
|
1369
|
+
);
|
|
1370
|
+
}
|
|
1371
|
+
return id.slice(prefix.length);
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
// src/migrate.ts
|
|
1375
|
+
async function migrateSqliteToLance2(options) {
|
|
1376
|
+
const peer = await tryLoadSdkMemoryPeer();
|
|
1377
|
+
if (peer !== null) {
|
|
1378
|
+
return peer.migrateSqliteToLance(options);
|
|
1379
|
+
}
|
|
1380
|
+
return chunkVPK6PHIE_cjs.migrateSqliteToLance(options);
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
// src/permission-engine.ts
|
|
1384
|
+
function applyMode(verdict, mode, explicit) {
|
|
1385
|
+
if (verdict === "deny") return "deny";
|
|
1386
|
+
switch (mode) {
|
|
1387
|
+
case "default":
|
|
1388
|
+
return verdict;
|
|
1389
|
+
case "plan":
|
|
1390
|
+
return verdict === "allow" ? "allow" : "deny";
|
|
1391
|
+
case "acceptEdits":
|
|
1392
|
+
if (verdict === "ask") return explicit ? "ask" : "allow";
|
|
1393
|
+
return verdict;
|
|
1394
|
+
// allow stays allow
|
|
1395
|
+
case "bypass":
|
|
1396
|
+
case "bypassPermissions":
|
|
1397
|
+
return "allow";
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
function argMatches(matcher, value) {
|
|
1401
|
+
if (value === void 0) return false;
|
|
1402
|
+
if (typeof matcher === "function") return matcher(value);
|
|
1403
|
+
if (matcher instanceof RegExp) {
|
|
1404
|
+
matcher.lastIndex = 0;
|
|
1405
|
+
return matcher.test(String(value));
|
|
1406
|
+
}
|
|
1407
|
+
return matcher === value;
|
|
1408
|
+
}
|
|
1409
|
+
var PermissionEngine = class {
|
|
1410
|
+
constructor(rules, options = {}) {
|
|
1411
|
+
this.rules = rules;
|
|
1412
|
+
this.defaultAction = options.defaultAction ?? "ask";
|
|
1413
|
+
}
|
|
1414
|
+
rules;
|
|
1415
|
+
defaultAction;
|
|
1416
|
+
/**
|
|
1417
|
+
* Evaluate a tool name (and optional arguments) against the rules. First
|
|
1418
|
+
* match wins; falls back to the configured `defaultAction` (default `"ask"`,
|
|
1419
|
+
* fail-closed) when no rule matches. #55 — a rule with `args` gates on the
|
|
1420
|
+
* argument values, so the same tool name can resolve to different actions
|
|
1421
|
+
* depending on what it is asked to do.
|
|
1422
|
+
*/
|
|
1423
|
+
evaluate(toolName, args, mode = "default") {
|
|
1424
|
+
for (const rule of this.rules) {
|
|
1425
|
+
const nameMatches = typeof rule.tool === "string" ? rule.tool === toolName : rule.tool.test(toolName);
|
|
1426
|
+
if (!nameMatches) continue;
|
|
1427
|
+
if (rule.args !== void 0 && !this.#argsMatch(rule.args, args)) continue;
|
|
1428
|
+
return applyMode(rule.action, mode, true);
|
|
1429
|
+
}
|
|
1430
|
+
return applyMode(this.defaultAction, mode, false);
|
|
1431
|
+
}
|
|
1432
|
+
#argsMatch(matchers, args) {
|
|
1433
|
+
const call = args ?? {};
|
|
1434
|
+
for (const [key, matcher] of Object.entries(matchers)) {
|
|
1435
|
+
if (!argMatches(matcher, call[key])) return false;
|
|
1436
|
+
}
|
|
1437
|
+
return true;
|
|
1438
|
+
}
|
|
1439
|
+
};
|
|
1440
|
+
|
|
1441
|
+
// src/permission-plugin.ts
|
|
1442
|
+
async function resolveAsk(opts, name, args, mode) {
|
|
1443
|
+
if (opts.canUseTool !== void 0) {
|
|
1444
|
+
let decision;
|
|
1445
|
+
try {
|
|
1446
|
+
decision = await opts.canUseTool(name, args, { toolName: name, mode });
|
|
1447
|
+
} catch {
|
|
1448
|
+
return { block: true, message: `permission gate error (fail-closed): ${name}` };
|
|
1449
|
+
}
|
|
1450
|
+
return decision?.behavior === "allow" ? void 0 : { block: true, message: decision?.message ?? `denied: ${name}` };
|
|
1451
|
+
}
|
|
1452
|
+
return opts.onAsk ? opts.onAsk(name) : { block: true, message: `requires approval: ${name}` };
|
|
1453
|
+
}
|
|
1454
|
+
function createPermissionPlugin(engine, opts = {}) {
|
|
1455
|
+
return definePlugin({
|
|
1456
|
+
name: opts.name ?? "permission-engine",
|
|
1457
|
+
version: "1.0.0",
|
|
1458
|
+
kind: "general",
|
|
1459
|
+
register(ctx) {
|
|
1460
|
+
ctx.on("pre_tool_call", async (rawCtx) => {
|
|
1461
|
+
const { name, args, permissionMode } = rawCtx;
|
|
1462
|
+
const mode = permissionMode ?? opts.mode ?? "default";
|
|
1463
|
+
const action = engine.evaluate(name, args, mode);
|
|
1464
|
+
if (action === "deny") {
|
|
1465
|
+
return { block: true, message: `denied by permission engine: ${name}` };
|
|
1466
|
+
}
|
|
1467
|
+
if (action === "ask") return resolveAsk(opts, name, args, mode);
|
|
1468
|
+
return void 0;
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
var PermissionPlugin = class {
|
|
1474
|
+
constructor() {
|
|
1475
|
+
}
|
|
1476
|
+
static create(engine, opts = {}) {
|
|
1477
|
+
return createPermissionPlugin(engine, opts);
|
|
1478
|
+
}
|
|
1479
|
+
};
|
|
1480
|
+
|
|
1481
|
+
// src/project-env.ts
|
|
1482
|
+
var SOVEREIGN_ENV_KEYS = [
|
|
1483
|
+
/** Locates the SDK home — sessions, and the credential store beneath it. */
|
|
1484
|
+
"THEOKIT_HOME",
|
|
1485
|
+
/** Locates the credential store explicitly, independently of `THEOKIT_HOME`. */
|
|
1486
|
+
"THEOKIT_AUTH_HOME",
|
|
1487
|
+
/** A trust decision: which providers are honoured without further checks. */
|
|
1488
|
+
"THEOKIT_TRUSTED_PROVIDERS",
|
|
1489
|
+
/** Turning redaction off from a repository's `.env` would put secrets into logs. */
|
|
1490
|
+
"THEOKIT_REDACT_SECRETS",
|
|
1491
|
+
/** Cryptographic material for the OAuth transaction cookie. */
|
|
1492
|
+
"THEOKIT_OAUTH_TX_SALT"
|
|
1493
|
+
];
|
|
1494
|
+
function loadProjectEnv(env = process.env, load = typeof process.loadEnvFile === "function" ? () => {
|
|
1495
|
+
process.loadEnvFile();
|
|
1496
|
+
} : void 0) {
|
|
1497
|
+
if (load === void 0) return;
|
|
1498
|
+
const sovereign = new Map(
|
|
1499
|
+
SOVEREIGN_ENV_KEYS.map((key) => [key, env[key]])
|
|
1500
|
+
);
|
|
1501
|
+
try {
|
|
1502
|
+
load();
|
|
1503
|
+
} catch {
|
|
1504
|
+
return;
|
|
1505
|
+
}
|
|
1506
|
+
for (const [key, original] of sovereign) {
|
|
1507
|
+
if (original === void 0) delete env[key];
|
|
1508
|
+
else env[key] = original;
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
// src/reap-plan.ts
|
|
1513
|
+
var RetentionPolicyError = class extends chunkJ7J7J2GN_cjs.TheokitAgentError {
|
|
1514
|
+
name = "RetentionPolicyError";
|
|
1515
|
+
};
|
|
1516
|
+
function assertPolicy(retention) {
|
|
1517
|
+
const { maxAgeMs, keepLast } = retention;
|
|
1518
|
+
if (!Number.isFinite(maxAgeMs) || maxAgeMs < 0) {
|
|
1519
|
+
throw new RetentionPolicyError(
|
|
1520
|
+
`retention.maxAgeMs must be a non-negative number of milliseconds, got ${String(maxAgeMs)}`
|
|
1521
|
+
);
|
|
1522
|
+
}
|
|
1523
|
+
if (!Number.isInteger(keepLast) || keepLast < 0) {
|
|
1524
|
+
throw new RetentionPolicyError(
|
|
1525
|
+
`retention.keepLast must be a non-negative integer, got ${String(keepLast)}`
|
|
1526
|
+
);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
function classifyByOwnReason(input) {
|
|
1530
|
+
const keep = [];
|
|
1531
|
+
const atRisk = [];
|
|
1532
|
+
for (const artifact of input.artifacts) {
|
|
1533
|
+
if (artifact.live === "unknown") continue;
|
|
1534
|
+
if (artifact.live === true) {
|
|
1535
|
+
keep.push({ ...artifact, reason: "live" });
|
|
1536
|
+
continue;
|
|
1537
|
+
}
|
|
1538
|
+
if (input.nowMs - artifact.lastModifiedMs <= input.retention.maxAgeMs) {
|
|
1539
|
+
keep.push({ ...artifact, reason: "within-retention" });
|
|
1540
|
+
continue;
|
|
1541
|
+
}
|
|
1542
|
+
atRisk.push(artifact);
|
|
1543
|
+
}
|
|
1544
|
+
return { keep, atRisk };
|
|
1545
|
+
}
|
|
1546
|
+
function applyFloor(kept, atRisk, keepLast) {
|
|
1547
|
+
const shortfall = Math.max(0, keepLast - kept.length);
|
|
1548
|
+
const newestFirst = [...atRisk].sort((a, b) => b.lastModifiedMs - a.lastModifiedMs);
|
|
1549
|
+
const spared = new Set(newestFirst.slice(0, shortfall).map((a) => a.id));
|
|
1550
|
+
const rescued = [];
|
|
1551
|
+
const reap = [];
|
|
1552
|
+
for (const artifact of atRisk) {
|
|
1553
|
+
if (spared.has(artifact.id)) rescued.push({ ...artifact, reason: "keep-last" });
|
|
1554
|
+
else reap.push(artifact);
|
|
1555
|
+
}
|
|
1556
|
+
return { rescued, reap };
|
|
1557
|
+
}
|
|
1558
|
+
function planReaping(input) {
|
|
1559
|
+
assertPolicy(input.retention);
|
|
1560
|
+
const undetermined = input.artifacts.filter((a) => a.live === "unknown");
|
|
1561
|
+
const { keep, atRisk } = classifyByOwnReason(input);
|
|
1562
|
+
const { rescued, reap } = applyFloor(keep, atRisk, input.retention.keepLast);
|
|
1563
|
+
return { reap, keep: [...keep, ...rescued], undetermined };
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
// src/schema-normalizer.ts
|
|
1567
|
+
function isJsonSchemaObject(s) {
|
|
1568
|
+
if (typeof s !== "object" || s === null) return false;
|
|
1569
|
+
const o = s;
|
|
1570
|
+
if ("$schema" in o) return true;
|
|
1571
|
+
return o.type === "object" && typeof o.properties === "object" && o.properties !== null;
|
|
1572
|
+
}
|
|
1573
|
+
function hasToJsonSchemaMethod(s) {
|
|
1574
|
+
return typeof s === "object" && s !== null && typeof s.toJsonSchema === "function";
|
|
1575
|
+
}
|
|
1576
|
+
function isZodSchema(s) {
|
|
1577
|
+
if (typeof s !== "object" || s === null) return false;
|
|
1578
|
+
const o = s;
|
|
1579
|
+
return typeof o.safeParse === "function" && ("_def" in o || "def" in o);
|
|
1580
|
+
}
|
|
1581
|
+
function isValibotSchema(s) {
|
|
1582
|
+
if (typeof s !== "object" || s === null) return false;
|
|
1583
|
+
const o = s;
|
|
1584
|
+
return o.kind === "schema" && "type" in o && typeof o.toJsonSchema !== "function";
|
|
1585
|
+
}
|
|
1586
|
+
function isMissingModuleError(err) {
|
|
1587
|
+
if (err?.code === "ERR_MODULE_NOT_FOUND") return true;
|
|
1588
|
+
return err instanceof Error && /Cannot find|Cannot resolve|ERR_MODULE_NOT_FOUND/.test(err.message);
|
|
1589
|
+
}
|
|
1590
|
+
async function normalizeValibotSchema(schema) {
|
|
1591
|
+
const specifier = "@valibot/to-json-schema";
|
|
1592
|
+
try {
|
|
1593
|
+
const mod = await import(specifier);
|
|
1594
|
+
return mod.toJsonSchema(schema);
|
|
1595
|
+
} catch (err) {
|
|
1596
|
+
if (!isMissingModuleError(err)) throw err;
|
|
1597
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError(
|
|
1598
|
+
"normalizeSchema: a Valibot schema requires the optional '@valibot/to-json-schema' package. Install it, or use a Zod schema (the default recommendation).",
|
|
1599
|
+
{ code: "valibot_converter_missing" }
|
|
1600
|
+
);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
async function normalizeSchema(schema) {
|
|
1604
|
+
if (isJsonSchemaObject(schema)) return schema;
|
|
1605
|
+
if (isValibotSchema(schema)) return await normalizeValibotSchema(schema);
|
|
1606
|
+
if (isZodSchema(schema)) {
|
|
1607
|
+
return chunkAA27GEYS_cjs.toJsonSchema(schema, { unrepresentable: "any" });
|
|
1608
|
+
}
|
|
1609
|
+
if (hasToJsonSchemaMethod(schema)) return schema.toJsonSchema();
|
|
1610
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError(
|
|
1611
|
+
"normalizeSchema: unsupported schema. Supported: Zod (default), JSON Schema, ArkType (.toJsonSchema()), Valibot (with @valibot/to-json-schema).",
|
|
1612
|
+
{ code: "unsupported_schema" }
|
|
1613
|
+
);
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
// src/security.ts
|
|
1617
|
+
var Security = class {
|
|
1618
|
+
constructor() {
|
|
1619
|
+
}
|
|
1620
|
+
/**
|
|
1621
|
+
* Redact known credential patterns from `text` and return the masked
|
|
1622
|
+
* string. Use this at any consumer output boundary the SDK does not
|
|
1623
|
+
* directly own (custom stdout loggers, app-level metrics, debug-share
|
|
1624
|
+
* artifacts, etc.).
|
|
1625
|
+
*
|
|
1626
|
+
* Coerces non-strings (objects via JSON.stringify, null/undefined → "").
|
|
1627
|
+
* Two-bucket masking: tokens shorter than 18 chars → `***`; longer
|
|
1628
|
+
* tokens preserve `prefix...suffix` for debuggability without revealing
|
|
1629
|
+
* the secret middle.
|
|
1630
|
+
*
|
|
1631
|
+
* @param text - The value to redact. Strings, objects, primitives all OK.
|
|
1632
|
+
* @param opts.codeFile - When `true`, skips the parametric `key=value`
|
|
1633
|
+
* matcher so file content like `.env.example` placeholders is left
|
|
1634
|
+
* intact. Built-in pattern matches still apply.
|
|
1635
|
+
*
|
|
1636
|
+
* @example
|
|
1637
|
+
* console.log(`[bot] received: ${Security.redact(userText)}`);
|
|
1638
|
+
* // → "[bot] received: please remember sk-abc...xyz1"
|
|
1639
|
+
*/
|
|
1640
|
+
static redact(text, opts) {
|
|
1641
|
+
return chunk6LHQPOMI_cjs.redactSecrets(text, opts);
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Register a custom redaction pattern. Additive — built-in patterns
|
|
1645
|
+
* (OpenAI, Anthropic, GitHub PAT, AWS, etc.) cannot be removed.
|
|
1646
|
+
*
|
|
1647
|
+
* @param re - RegExp with `/g` flag. Throws if `/g` is missing
|
|
1648
|
+
* (without /g, only first match is replaced and the rest
|
|
1649
|
+
* leaks).
|
|
1650
|
+
*
|
|
1651
|
+
* Process-global mutable state. The SDK is designed for single-tenant
|
|
1652
|
+
* processes (Theo PaaS user runtime, local CLI). Multi-tenant
|
|
1653
|
+
* deployments running multiple SDK consumers in the same Node process
|
|
1654
|
+
* share this list — patterns added by tenant A apply to tenant B's
|
|
1655
|
+
* redactions. Acceptable for v1; future isolate-aware refactor would
|
|
1656
|
+
* thread patterns through a context if needed.
|
|
1657
|
+
*
|
|
1658
|
+
* @example
|
|
1659
|
+
* Security.addPattern(/MYORG-[A-Z0-9]{32}/g);
|
|
1660
|
+
* // → text containing "MYORG-AAAA...AAAA" now masks like a builtin.
|
|
1661
|
+
*/
|
|
1662
|
+
static addPattern(re) {
|
|
1663
|
+
if (!re.global) {
|
|
1664
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError(
|
|
1665
|
+
"Security.addPattern: regex must have /g flag for replace-all semantics",
|
|
1666
|
+
{ code: "invalid_redaction_pattern" }
|
|
1667
|
+
);
|
|
1668
|
+
}
|
|
1669
|
+
chunk6LHQPOMI_cjs.addPattern(re);
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
|
|
1673
|
+
// src/security-floor.ts
|
|
1674
|
+
function permissivenessOf(order, value) {
|
|
1675
|
+
if (value === void 0) return -1;
|
|
1676
|
+
return order.indexOf(value);
|
|
1677
|
+
}
|
|
1678
|
+
function baseline(input) {
|
|
1679
|
+
const { restricted, override, layers } = input;
|
|
1680
|
+
let value;
|
|
1681
|
+
for (const [name, candidate] of Object.entries(layers)) {
|
|
1682
|
+
if (name === override || restricted.includes(name)) continue;
|
|
1683
|
+
if (candidate !== void 0) value = candidate;
|
|
1684
|
+
}
|
|
1685
|
+
return value;
|
|
1686
|
+
}
|
|
1687
|
+
function tightenOnly(input, start) {
|
|
1688
|
+
const { permissiveness, restricted, layers } = input;
|
|
1689
|
+
let resolved = start;
|
|
1690
|
+
let ceiling = permissivenessOf(permissiveness, start);
|
|
1691
|
+
for (const layer of restricted) {
|
|
1692
|
+
const candidate = layers[layer];
|
|
1693
|
+
if (candidate === void 0) continue;
|
|
1694
|
+
const level = permissivenessOf(permissiveness, candidate);
|
|
1695
|
+
if (level < 0) continue;
|
|
1696
|
+
if (ceiling >= 0 && level > ceiling) continue;
|
|
1697
|
+
resolved = candidate;
|
|
1698
|
+
ceiling = level;
|
|
1699
|
+
}
|
|
1700
|
+
return resolved;
|
|
1701
|
+
}
|
|
1702
|
+
function applySecurityFloor(input) {
|
|
1703
|
+
return input.layers[input.override] ?? tightenOnly(input, baseline(input));
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
// src/session-guard.ts
|
|
1707
|
+
var LiveSessionError = class extends chunkJ7J7J2GN_cjs.TheokitAgentError {
|
|
1708
|
+
name = "LiveSessionError";
|
|
1709
|
+
sessionId;
|
|
1710
|
+
reason;
|
|
1711
|
+
constructor(sessionId, reason) {
|
|
1712
|
+
super(
|
|
1713
|
+
reason === "session-is-live" ? `refusing to destroy session ${sessionId}: it is live \u2014 another process is probably still appending to it. Switch to another session first.` : `refusing to destroy session ${sessionId}: the set of live sessions could not be determined, so this cannot be shown to be safe. Resolve that before deleting.`
|
|
1714
|
+
);
|
|
1715
|
+
this.sessionId = sessionId;
|
|
1716
|
+
this.reason = reason;
|
|
1717
|
+
}
|
|
1718
|
+
};
|
|
1719
|
+
function guardSessionDestruction(sessionId, live) {
|
|
1720
|
+
if (live === void 0) {
|
|
1721
|
+
throw new LiveSessionError(sessionId, "liveness-undetermined");
|
|
1722
|
+
}
|
|
1723
|
+
if (live.includes(sessionId)) {
|
|
1724
|
+
throw new LiveSessionError(sessionId, "session-is-live");
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
// src/session-messages.ts
|
|
1729
|
+
async function readSessionMessages2(options) {
|
|
1730
|
+
const cwd = options.cwd ?? process.cwd();
|
|
1731
|
+
const baseDir = chunkD3CCY3A2_cjs.resolveSessionDir({ sessionDir: options.sessionDir });
|
|
1732
|
+
return chunkYIFFF23U_cjs.readSessionMessages(new chunk7FDKWDA2_cjs.FsSessionStore({ baseDir, cwd }), options.sessionId);
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
// src/session-scope.ts
|
|
1736
|
+
function scopedConversationId(scope, id) {
|
|
1737
|
+
return `${scope}__${id}`;
|
|
1738
|
+
}
|
|
1739
|
+
function sessionScopePrefix(scope) {
|
|
1740
|
+
return `${scope}__`;
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
// src/squad.ts
|
|
1744
|
+
function isBuiltAgent(m) {
|
|
1745
|
+
return typeof m.send === "function";
|
|
1746
|
+
}
|
|
1747
|
+
async function materialize(def, index) {
|
|
1748
|
+
const { Agent: Agent2 } = await import('./agent-ARLOD4JX.cjs');
|
|
1749
|
+
return Agent2.create({
|
|
1750
|
+
// `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
|
|
1751
|
+
// here means "declare nothing and let the default apply" — forwarding the literal would create
|
|
1752
|
+
// an agent asking for a model literally named `inherit`.
|
|
1753
|
+
...def.model !== void 0 && def.model !== "inherit" ? { model: def.model } : {},
|
|
1754
|
+
...def.prompt !== void 0 ? { systemPrompt: def.prompt } : {},
|
|
1755
|
+
agentId: `squad-member-${String(index)}`,
|
|
1756
|
+
local: {}
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
function createSquad(options) {
|
|
1760
|
+
const { agents } = options;
|
|
1761
|
+
if (!Array.isArray(agents) || agents.length === 0) {
|
|
1762
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError("createSquad requires a non-empty `agents` array", {
|
|
1763
|
+
code: "invalid_squad"
|
|
1764
|
+
});
|
|
1765
|
+
}
|
|
1766
|
+
if (options.process !== void 0 && options.process !== "sequential") {
|
|
1767
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError(
|
|
1768
|
+
`createSquad only supports process "sequential"; for manager\u2192worker delegation use subagents or @theokit/sdk-handoff`,
|
|
1769
|
+
{ code: "squad_process_unsupported" }
|
|
1770
|
+
);
|
|
1771
|
+
}
|
|
1772
|
+
return {
|
|
1773
|
+
run: async (input) => {
|
|
1774
|
+
const run = await (await buildPipeline(agents, options.name)).run(input);
|
|
1775
|
+
return { result: run.output, status: run.status, steps: run.stepResults };
|
|
1776
|
+
}
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
async function buildPipeline(agents, name) {
|
|
1780
|
+
let builder = chunk4HS6FFGL_cjs.Workflow.create({ name: name ?? "squad" });
|
|
1781
|
+
for (let i = 0; i < agents.length; i++) {
|
|
1782
|
+
const member = agents[i];
|
|
1783
|
+
if (member === void 0) continue;
|
|
1784
|
+
const agent = isBuiltAgent(member) ? member : await materialize(member, i);
|
|
1785
|
+
const opts = i > 0 ? { origin: { kind: "peer", from: `agent-${i - 1}` } } : void 0;
|
|
1786
|
+
builder = builder.then(chunk4HS6FFGL_cjs.agentStep(`agent-${i}`, agent, (prev) => String(prev), opts));
|
|
1787
|
+
}
|
|
1788
|
+
return builder.commit();
|
|
1789
|
+
}
|
|
1790
|
+
var Squad = class {
|
|
1791
|
+
constructor() {
|
|
1792
|
+
}
|
|
1793
|
+
static create(options) {
|
|
1794
|
+
return createSquad(options);
|
|
1795
|
+
}
|
|
1796
|
+
};
|
|
1797
|
+
|
|
1798
|
+
// src/task.ts
|
|
1799
|
+
var Task = class {
|
|
1800
|
+
// D361 — static class with private constructor.
|
|
1801
|
+
constructor() {
|
|
1802
|
+
throw new Error("Task is static; do not instantiate");
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Configure the registry. **Must be called before the first `submit`**
|
|
1806
|
+
* (EC-13). Available knobs: pluggable store (D364), concurrency cap
|
|
1807
|
+
* (D369), and retention (D373).
|
|
1808
|
+
*/
|
|
1809
|
+
static configure(opts) {
|
|
1810
|
+
chunkKVSAY6NZ_cjs.configure(opts);
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Submit a unit of asynchronous work to the registry.
|
|
1814
|
+
*
|
|
1815
|
+
* The `work` function receives `{ signal, emit }` — `signal` is the
|
|
1816
|
+
* AbortSignal honored on cancel; `emit(payload)` produces a
|
|
1817
|
+
* `progress` event observable via `Task.subscribe`.
|
|
1818
|
+
*
|
|
1819
|
+
* Returns a `TaskHandle` in `state: "queued"`. Subsequent state
|
|
1820
|
+
* transitions are observable via `Task.subscribe(handle.id)` OR
|
|
1821
|
+
* polled via `Task.get(handle.id)`.
|
|
1822
|
+
*
|
|
1823
|
+
* **Idempotency (D367):** submitting twice with the same `id` returns
|
|
1824
|
+
* the existing handle without re-invoking work.
|
|
1825
|
+
*
|
|
1826
|
+
* **Grammar (D368):** user-supplied ids must match
|
|
1827
|
+
* `^[a-z0-9][a-z0-9_-]*$` and must not start with reserved prefixes
|
|
1828
|
+
* `wf-` / `b-` / `cron-`. Otherwise `InvalidTaskIdError` is thrown.
|
|
1829
|
+
*
|
|
1830
|
+
* **Pre-aborted signal (EC-4):** if `options.signal` is already
|
|
1831
|
+
* aborted, the task short-circuits to `cancelled` without acquiring
|
|
1832
|
+
* a semaphore slot and without invoking `work`.
|
|
1833
|
+
*/
|
|
1834
|
+
static async submit(kind, work, options = {}) {
|
|
1835
|
+
return chunkKVSAY6NZ_cjs.submit({
|
|
1836
|
+
kind,
|
|
1837
|
+
work,
|
|
1838
|
+
...options.id !== void 0 ? { id: options.id } : {},
|
|
1839
|
+
...options.meta !== void 0 ? { meta: options.meta } : {},
|
|
1840
|
+
...options.signal !== void 0 ? { signal: options.signal } : {},
|
|
1841
|
+
...options.onRunEvent !== void 0 ? { onRunEvent: options.onRunEvent } : {}
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
1844
|
+
/** Returns matching handles, capped at `filter.limit ?? 100`. */
|
|
1845
|
+
static list(filter = {}) {
|
|
1846
|
+
return chunkKVSAY6NZ_cjs.list(filter);
|
|
1847
|
+
}
|
|
1848
|
+
/** Returns a single handle by id, or `undefined` if unknown / evicted. */
|
|
1849
|
+
static get(id) {
|
|
1850
|
+
return chunkKVSAY6NZ_cjs.get(id);
|
|
1851
|
+
}
|
|
1852
|
+
/**
|
|
1853
|
+
* Idempotent cancel (D365). Returns:
|
|
1854
|
+
* - `{ cancelled: true, alreadyTerminal: false }` — transitioned
|
|
1855
|
+
* queued/running task to `cancelled`.
|
|
1856
|
+
* - `{ cancelled: false, alreadyTerminal: true }` — task already
|
|
1857
|
+
* terminal.
|
|
1858
|
+
* - `{ cancelled: false, alreadyTerminal: false }` — task unknown.
|
|
1859
|
+
*
|
|
1860
|
+
* Never throws.
|
|
1861
|
+
*/
|
|
1862
|
+
static cancel(id, reason) {
|
|
1863
|
+
return chunkKVSAY6NZ_cjs.cancel(id, reason);
|
|
1864
|
+
}
|
|
1865
|
+
/**
|
|
1866
|
+
* Subscribe to a task's event stream. The returned `AsyncIterable<TaskEvent>`
|
|
1867
|
+
* starts by replaying buffered events (ring buffer cap 64, D372) and
|
|
1868
|
+
* then yields live events until a terminal event (finished / errored
|
|
1869
|
+
* / cancelled) is emitted, at which point it closes automatically.
|
|
1870
|
+
*
|
|
1871
|
+
* Calling `.return()` on the iterator (or `break` in a `for await`)
|
|
1872
|
+
* cleans up the subscriber callback (EC-10).
|
|
1873
|
+
*
|
|
1874
|
+
* Throws `TaskNotFoundError` if the id is unknown or has been evicted.
|
|
1875
|
+
*/
|
|
1876
|
+
static subscribe(id) {
|
|
1877
|
+
return chunkKVSAY6NZ_cjs.subscribe(id);
|
|
1878
|
+
}
|
|
1879
|
+
};
|
|
1880
|
+
|
|
1881
|
+
// src/internal/catalog/fixtures.ts
|
|
1882
|
+
var FIXTURE_TIMESTAMP = "2024-01-01T00:00:00.000Z";
|
|
1883
|
+
var FIXTURE_USER = {
|
|
1884
|
+
apiKeyName: "Contract Test Key",
|
|
1885
|
+
userEmail: "sdk-contract@example.com",
|
|
1886
|
+
createdAt: FIXTURE_TIMESTAMP
|
|
1887
|
+
};
|
|
1888
|
+
var FIXTURE_MODELS = [
|
|
1889
|
+
{
|
|
1890
|
+
id: chunkD3CCY3A2_cjs.DEFAULT_AGENTIC_MODEL_ID,
|
|
1891
|
+
name: "Gemini 2.0 Flash",
|
|
1892
|
+
displayName: "Gemini 2.0 Flash",
|
|
1893
|
+
parameters: [
|
|
1894
|
+
{
|
|
1895
|
+
id: "thinking",
|
|
1896
|
+
displayName: "Thinking",
|
|
1897
|
+
values: [
|
|
1898
|
+
{ value: "low", displayName: "Low" },
|
|
1899
|
+
{ value: "high", displayName: "High" }
|
|
1900
|
+
]
|
|
1901
|
+
}
|
|
1902
|
+
],
|
|
1903
|
+
variants: [
|
|
1904
|
+
{
|
|
1905
|
+
displayName: "High thinking",
|
|
1906
|
+
params: [{ id: "thinking", value: "high" }],
|
|
1907
|
+
isDefault: false
|
|
1908
|
+
}
|
|
1909
|
+
]
|
|
1910
|
+
}
|
|
1911
|
+
];
|
|
1912
|
+
var FIXTURE_REPOSITORIES = [
|
|
1913
|
+
{ url: "https://github.com/usetheo/example" }
|
|
1914
|
+
];
|
|
1915
|
+
var GENERIC_SETUP_SCHEMA = {
|
|
1916
|
+
type: "object",
|
|
1917
|
+
description: "Configuration values for this provider.",
|
|
1918
|
+
required: ["credential"],
|
|
1919
|
+
properties: { credential: { type: "string" } }
|
|
1920
|
+
};
|
|
1921
|
+
var FIXTURE_PROVIDERS = [
|
|
1922
|
+
{
|
|
1923
|
+
name: "anthropic",
|
|
1924
|
+
displayName: "Anthropic",
|
|
1925
|
+
capabilities: ["chat"],
|
|
1926
|
+
isAvailable: true,
|
|
1927
|
+
setupSchema: GENERIC_SETUP_SCHEMA
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
name: "openai",
|
|
1931
|
+
displayName: "OpenAI",
|
|
1932
|
+
capabilities: ["chat", "embedding", "image"],
|
|
1933
|
+
isAvailable: false,
|
|
1934
|
+
setupSchema: GENERIC_SETUP_SCHEMA
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
name: "openrouter",
|
|
1938
|
+
displayName: "OpenRouter",
|
|
1939
|
+
capabilities: ["chat"],
|
|
1940
|
+
isAvailable: true,
|
|
1941
|
+
setupSchema: GENERIC_SETUP_SCHEMA
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
name: "nous",
|
|
1945
|
+
displayName: "Nous Research",
|
|
1946
|
+
capabilities: ["chat"],
|
|
1947
|
+
isAvailable: true,
|
|
1948
|
+
setupSchema: GENERIC_SETUP_SCHEMA
|
|
1949
|
+
},
|
|
1950
|
+
{
|
|
1951
|
+
name: "fixture-search",
|
|
1952
|
+
displayName: "Fixture Search",
|
|
1953
|
+
capabilities: ["web_search"],
|
|
1954
|
+
isAvailable: true,
|
|
1955
|
+
setupSchema: GENERIC_SETUP_SCHEMA
|
|
1956
|
+
}
|
|
1957
|
+
];
|
|
1958
|
+
|
|
1959
|
+
// src/internal/catalog/local-models.ts
|
|
1960
|
+
async function listLocalModelsViaOpenAiCompat(baseUrl) {
|
|
1961
|
+
const url = `${baseUrl}/v1/models`;
|
|
1962
|
+
let response;
|
|
1963
|
+
try {
|
|
1964
|
+
response = await fetch(url, { method: "GET" });
|
|
1965
|
+
} catch (fetchErr) {
|
|
1966
|
+
const mapped = chunk2HPNT6HH_cjs.mapOllamaTransportError({
|
|
1967
|
+
providerId: "ollama",
|
|
1968
|
+
cause: fetchErr,
|
|
1969
|
+
endpoint: "/v1/models"
|
|
1970
|
+
});
|
|
1971
|
+
if (mapped !== void 0) throw mapped;
|
|
1972
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError(
|
|
1973
|
+
`Failed to reach local provider at ${baseUrl}: ${fetchErr.message}`,
|
|
1974
|
+
{ code: "local_provider_unreachable" }
|
|
1975
|
+
);
|
|
1976
|
+
}
|
|
1977
|
+
if (!response.ok) {
|
|
1978
|
+
const body = await chunk2HPNT6HH_cjs.readErrorResponseBody(response);
|
|
1979
|
+
const mapped = chunk2HPNT6HH_cjs.mapOllamaHttpError({
|
|
1980
|
+
providerId: "ollama",
|
|
1981
|
+
status: response.status,
|
|
1982
|
+
body,
|
|
1983
|
+
headers: response.headers,
|
|
1984
|
+
endpoint: "/v1/models"
|
|
1985
|
+
});
|
|
1986
|
+
if (mapped !== void 0) throw mapped;
|
|
1987
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError(
|
|
1988
|
+
`Local provider at ${baseUrl} returned HTTP ${response.status} on /v1/models`,
|
|
1989
|
+
{ code: "local_provider_http_error" }
|
|
1990
|
+
);
|
|
1991
|
+
}
|
|
1992
|
+
let parsed;
|
|
1993
|
+
try {
|
|
1994
|
+
parsed = await response.json();
|
|
1995
|
+
} catch {
|
|
1996
|
+
return [];
|
|
1997
|
+
}
|
|
1998
|
+
const data = parsed.data ?? [];
|
|
1999
|
+
return data.filter(
|
|
2000
|
+
(entry) => typeof entry?.id === "string" && entry.id.length > 0
|
|
2001
|
+
).map((entry) => ({
|
|
2002
|
+
id: entry.id,
|
|
2003
|
+
displayName: entry.id,
|
|
2004
|
+
name: entry.id
|
|
2005
|
+
}));
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
// src/theokit.ts
|
|
2009
|
+
var Theokit = class {
|
|
2010
|
+
constructor() {
|
|
2011
|
+
}
|
|
2012
|
+
/**
|
|
2013
|
+
* Return the user behind the current API key.
|
|
2014
|
+
*
|
|
2015
|
+
* @public
|
|
2016
|
+
*/
|
|
2017
|
+
static me(options = {}) {
|
|
2018
|
+
return executeCatalogRequest({
|
|
2019
|
+
apiKey: options.apiKey,
|
|
2020
|
+
fixture: FIXTURE_USER,
|
|
2021
|
+
path: "/v1/me"
|
|
2022
|
+
});
|
|
2023
|
+
}
|
|
2024
|
+
/**
|
|
2025
|
+
* Model catalog reads.
|
|
2026
|
+
*
|
|
2027
|
+
* @public
|
|
2028
|
+
*/
|
|
2029
|
+
static models = {
|
|
2030
|
+
list: async (options = {}) => {
|
|
2031
|
+
if (options.provider !== void 0) {
|
|
2032
|
+
const localModels = await maybeListLocalModels(options.provider);
|
|
2033
|
+
if (localModels !== void 0) return localModels;
|
|
2034
|
+
}
|
|
2035
|
+
return executeCatalogRequest({
|
|
2036
|
+
apiKey: options.apiKey,
|
|
2037
|
+
fixture: FIXTURE_MODELS,
|
|
2038
|
+
path: "/v1/models"
|
|
2039
|
+
});
|
|
2040
|
+
},
|
|
2041
|
+
capabilities: (providerOrModelId) => {
|
|
2042
|
+
chunkQC55H6RJ_cjs.registerBuiltins();
|
|
2043
|
+
const providerId = providerOrModelId.includes("/") ? providerOrModelId.split("/")[0] ?? providerOrModelId : providerOrModelId;
|
|
2044
|
+
return chunkQC55H6RJ_cjs.getCatalogCapabilities(providerId);
|
|
2045
|
+
}
|
|
2046
|
+
};
|
|
2047
|
+
/**
|
|
2048
|
+
* Connected GitHub repositories for the calling user's team. Cloud only.
|
|
2049
|
+
*
|
|
2050
|
+
* @public
|
|
2051
|
+
*/
|
|
2052
|
+
static repositories = {
|
|
2053
|
+
list: (options = {}) => executeCatalogRequest({
|
|
2054
|
+
apiKey: options.apiKey,
|
|
2055
|
+
fixture: FIXTURE_REPOSITORIES,
|
|
2056
|
+
path: "/v1/repositories"
|
|
2057
|
+
})
|
|
2058
|
+
};
|
|
2059
|
+
/**
|
|
2060
|
+
* Provider catalog. Lists every provider known to the platform, including
|
|
2061
|
+
* plugin-registered ones, with capability and availability metadata.
|
|
2062
|
+
*
|
|
2063
|
+
* @public
|
|
2064
|
+
*/
|
|
2065
|
+
static providers = {
|
|
2066
|
+
list: (options = {}) => executeCatalogRequest({
|
|
2067
|
+
apiKey: options.apiKey,
|
|
2068
|
+
fixture: FIXTURE_PROVIDERS,
|
|
2069
|
+
path: "/v1/providers"
|
|
2070
|
+
})
|
|
2071
|
+
};
|
|
2072
|
+
/**
|
|
2073
|
+
* Local introspection of bundled SDK assets (ADR D201). Unlike the
|
|
2074
|
+
* cloud-catalog `providers.list()` (which hits the TheoCloud HTTP API),
|
|
2075
|
+
* `inspect.*` reads the SDK's own bundled registries — useful for
|
|
2076
|
+
* tooling (e.g. `@theokit/cli`'s `theokit inspect`) that needs to know
|
|
2077
|
+
* what's available WITHOUT a network round-trip.
|
|
2078
|
+
*
|
|
2079
|
+
* @public
|
|
2080
|
+
*/
|
|
2081
|
+
static inspect = {
|
|
2082
|
+
builtinProviders: () => {
|
|
2083
|
+
chunkQC55H6RJ_cjs.registerBuiltins();
|
|
2084
|
+
return chunkQC55H6RJ_cjs.listProviders().map((p) => ({
|
|
2085
|
+
name: p.name,
|
|
2086
|
+
apiMode: p.apiMode,
|
|
2087
|
+
authType: p.authType,
|
|
2088
|
+
baseUrl: p.baseUrl,
|
|
2089
|
+
...p.aliases !== void 0 ? { aliases: p.aliases } : {},
|
|
2090
|
+
envVars: p.envVars
|
|
2091
|
+
}));
|
|
2092
|
+
},
|
|
2093
|
+
embeddingAdapters: () => Object.entries(chunkD3CCY3A2_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
|
|
2094
|
+
id,
|
|
2095
|
+
transport: adapter.transport,
|
|
2096
|
+
defaultModel: adapter.defaultModel
|
|
2097
|
+
}))
|
|
2098
|
+
};
|
|
2099
|
+
// NOTE: `Theokit.subscribe` is exported from `@theokit/sdk/subscription`
|
|
2100
|
+
// sub-path entry instead of the main `Theokit` static class to avoid
|
|
2101
|
+
// pulling the subscription module into the main `index.ts` DTS bundle
|
|
2102
|
+
// (which trips on the pre-existing `types/agent.ts ↔ fork-agent.ts` cycle
|
|
2103
|
+
// — same pattern as `path-safety` per ADR D425/D429 + see tsup.config.ts
|
|
2104
|
+
// header comment). Consumers import via:
|
|
2105
|
+
// `import { subscribe } from "@theokit/sdk/subscription"`
|
|
2106
|
+
// The function shape mirrors a hypothetical `Theokit.subscribe(name, input, opts)`
|
|
2107
|
+
// and may be promoted onto Theokit once the agent.ts cycle is broken.
|
|
2108
|
+
};
|
|
2109
|
+
async function maybeListLocalModels(providerName) {
|
|
2110
|
+
chunkQC55H6RJ_cjs.registerBuiltins();
|
|
2111
|
+
await chunk2HPNT6HH_cjs.discoverProviderPlugins();
|
|
2112
|
+
const profile = chunkQC55H6RJ_cjs.getProviderProfile(providerName);
|
|
2113
|
+
if (profile === void 0) return void 0;
|
|
2114
|
+
if (profile.authType !== "none") return void 0;
|
|
2115
|
+
const baseUrl = resolveLocalProviderBaseUrl(profile.name, profile.baseUrl);
|
|
2116
|
+
return listLocalModelsViaOpenAiCompat(baseUrl);
|
|
2117
|
+
}
|
|
2118
|
+
function resolveLocalProviderBaseUrl(providerName, fallback) {
|
|
2119
|
+
if (providerName === "ollama" && process.env.OLLAMA_HOST !== void 0) {
|
|
2120
|
+
return process.env.OLLAMA_HOST;
|
|
2121
|
+
}
|
|
2122
|
+
return fallback;
|
|
2123
|
+
}
|
|
2124
|
+
async function executeCatalogRequest(request) {
|
|
2125
|
+
const apiKey = chunk6LHQPOMI_cjs.resolveApiKey(request.apiKey);
|
|
2126
|
+
if (apiKey === void 0) {
|
|
2127
|
+
throw new chunkJ7J7J2GN_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
|
|
2128
|
+
}
|
|
2129
|
+
if (chunk2HPNT6HH_cjs.shouldUseFixtureMode(apiKey)) {
|
|
2130
|
+
return request.fixture;
|
|
2131
|
+
}
|
|
2132
|
+
if (!chunk2HPNT6HH_cjs.isFixtureApiKey(apiKey) && process.env.THEOKIT_API_BASE_URL === void 0) {
|
|
2133
|
+
throw new chunkJ7J7J2GN_cjs.AuthenticationError("Invalid API key", { code: "authentication_error" });
|
|
2134
|
+
}
|
|
2135
|
+
return chunk2HPNT6HH_cjs.httpRequest(request.path, { apiKey });
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
// src/tool-blast-radius.ts
|
|
2139
|
+
var DECLARED = /* @__PURE__ */ Symbol.for("@theokit/sdk.blastRadius");
|
|
2140
|
+
function withBlastRadius(tool, action) {
|
|
2141
|
+
return Object.defineProperty(tool, DECLARED, {
|
|
2142
|
+
value: action,
|
|
2143
|
+
// `enumerable: false` is defensive and NOT load-bearing — checked, not assumed. Flipping it to
|
|
2144
|
+
// true leaves every case green, because the symbol key already excludes this from `Object.keys`
|
|
2145
|
+
// and `JSON.stringify`. It stays because a future string-keyed variant would need it, and the
|
|
2146
|
+
// next reader should not have to discover that the flag has no test behind it.
|
|
2147
|
+
enumerable: false,
|
|
2148
|
+
configurable: true
|
|
2149
|
+
});
|
|
2150
|
+
}
|
|
2151
|
+
function describeAction(tool) {
|
|
2152
|
+
return tool[DECLARED];
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
// src/trajectory-helpers.ts
|
|
2156
|
+
function toShareGptTrajectory(result, options) {
|
|
2157
|
+
if (!result.ok) return null;
|
|
2158
|
+
const conversations = buildConversations(result, options?.messages);
|
|
2159
|
+
const trajectory = {
|
|
2160
|
+
conversations,
|
|
2161
|
+
metadata: {
|
|
2162
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2163
|
+
durationMs: result.durationMs,
|
|
2164
|
+
promptIndex: result.index,
|
|
2165
|
+
...options?.model !== void 0 ? { model: options.model } : {}
|
|
2166
|
+
},
|
|
2167
|
+
completed: true
|
|
2168
|
+
};
|
|
2169
|
+
const usage = extractUsage(result.result);
|
|
2170
|
+
if (usage !== void 0) trajectory.usage = usage;
|
|
2171
|
+
return trajectory;
|
|
2172
|
+
}
|
|
2173
|
+
function buildConversations(result, messages) {
|
|
2174
|
+
const conversations = [{ from: "human", value: result.prompt }];
|
|
2175
|
+
if (Array.isArray(messages) && messages.length > 0) {
|
|
2176
|
+
for (const m of messages) {
|
|
2177
|
+
for (const entry of mapSdkMessage(m)) conversations.push(entry);
|
|
2178
|
+
}
|
|
2179
|
+
return conversations;
|
|
2180
|
+
}
|
|
2181
|
+
const finalText = typeof result.result.result === "string" ? result.result.result : "";
|
|
2182
|
+
conversations.push({ from: "gpt", value: finalText });
|
|
2183
|
+
return conversations;
|
|
2184
|
+
}
|
|
2185
|
+
function extractUsage(runResult) {
|
|
2186
|
+
const usage = runResult?.usage;
|
|
2187
|
+
if (usage === void 0) return void 0;
|
|
2188
|
+
if (typeof usage.inputTokens !== "number" || typeof usage.outputTokens !== "number") {
|
|
2189
|
+
return void 0;
|
|
2190
|
+
}
|
|
2191
|
+
return { inputTokens: usage.inputTokens, outputTokens: usage.outputTokens };
|
|
2192
|
+
}
|
|
2193
|
+
function mapSdkMessage(m) {
|
|
2194
|
+
if (m === null || typeof m !== "object") return [];
|
|
2195
|
+
switch (m.type) {
|
|
2196
|
+
case "assistant":
|
|
2197
|
+
return mapAssistant(m);
|
|
2198
|
+
case "tool_call":
|
|
2199
|
+
return mapToolCall(m);
|
|
2200
|
+
case "thinking":
|
|
2201
|
+
case "system":
|
|
2202
|
+
case "user":
|
|
2203
|
+
case "status":
|
|
2204
|
+
case "task":
|
|
2205
|
+
case "request":
|
|
2206
|
+
case "object_delta":
|
|
2207
|
+
return [];
|
|
2208
|
+
default: {
|
|
2209
|
+
return [];
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
function mapAssistant(m) {
|
|
2214
|
+
const content = m.message?.content;
|
|
2215
|
+
if (!Array.isArray(content)) return [];
|
|
2216
|
+
const textParts = [];
|
|
2217
|
+
const toolCalls = [];
|
|
2218
|
+
for (const block of content) {
|
|
2219
|
+
appendBlock(block, textParts, toolCalls);
|
|
2220
|
+
}
|
|
2221
|
+
const entry = { from: "gpt", value: textParts.join("") };
|
|
2222
|
+
if (toolCalls.length > 0) entry.tool_calls = toolCalls;
|
|
2223
|
+
return [entry];
|
|
2224
|
+
}
|
|
2225
|
+
function appendBlock(block, textParts, toolCalls) {
|
|
2226
|
+
if (block === null || typeof block !== "object") return;
|
|
2227
|
+
const text = block;
|
|
2228
|
+
if (text.type === "text" && typeof text.text === "string") {
|
|
2229
|
+
textParts.push(text.text);
|
|
2230
|
+
return;
|
|
2231
|
+
}
|
|
2232
|
+
const tu = block;
|
|
2233
|
+
if (tu.type !== "tool_use") return;
|
|
2234
|
+
const args = tu.input !== null && typeof tu.input === "object" ? tu.input : {};
|
|
2235
|
+
toolCalls.push({ name: tu.name, arguments: args });
|
|
2236
|
+
}
|
|
2237
|
+
function mapToolCall(m) {
|
|
2238
|
+
if (m.status !== "completed") return [];
|
|
2239
|
+
const value = typeof m.result === "string" ? m.result : m.result === void 0 ? "" : safeStringify(m.result);
|
|
2240
|
+
return [{ from: "tool", value }];
|
|
2241
|
+
}
|
|
2242
|
+
function safeStringify(v) {
|
|
2243
|
+
try {
|
|
2244
|
+
return JSON.stringify(v);
|
|
2245
|
+
} catch {
|
|
2246
|
+
return String(v);
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
// src/trust-posture.ts
|
|
2251
|
+
function resolveTrustPosture(input) {
|
|
2252
|
+
const source = input.envOverride === true ? "env" : input.isTrusted() ? "store" : "default";
|
|
2253
|
+
const level = source === "default" ? "untrusted" : "trusted";
|
|
2254
|
+
const granted = level === "trusted";
|
|
2255
|
+
const allows = Object.fromEntries(input.capabilities.map((key) => [key, granted]));
|
|
2256
|
+
return { level, source, allows };
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
// src/wiring-record.ts
|
|
2260
|
+
var UngatedCapabilityError = class extends chunkJ7J7J2GN_cjs.TheokitAgentError {
|
|
2261
|
+
name = "UngatedCapabilityError";
|
|
2262
|
+
};
|
|
2263
|
+
function recordWiring(input) {
|
|
2264
|
+
const record = {};
|
|
2265
|
+
for (const [capability, requested] of Object.entries(input.requested)) {
|
|
2266
|
+
const allowed = input.posture.allows[capability];
|
|
2267
|
+
if (allowed === void 0) {
|
|
2268
|
+
throw new UngatedCapabilityError(
|
|
2269
|
+
`capability \`${capability}\` was recorded as wired but the posture does not gate it; gated capabilities are: ${Object.keys(input.posture.allows).join(", ") || "(none)"}`
|
|
2270
|
+
);
|
|
2271
|
+
}
|
|
2272
|
+
record[capability] = {
|
|
2273
|
+
// Copied, not aliased. See the @returns note.
|
|
2274
|
+
active: allowed ? [...requested] : [],
|
|
2275
|
+
requested: [...requested],
|
|
2276
|
+
suppressedByTrust: !allowed && requested.length > 0
|
|
2277
|
+
};
|
|
2278
|
+
}
|
|
2279
|
+
return record;
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
Object.defineProperty(exports, "StreamObjectError", {
|
|
2283
|
+
enumerable: true,
|
|
2284
|
+
get: function () { return chunkTFG5IBZS_cjs.StreamObjectError; }
|
|
2285
|
+
});
|
|
2286
|
+
Object.defineProperty(exports, "GOAL_CONTINUATION_MARKER", {
|
|
2287
|
+
enumerable: true,
|
|
2288
|
+
get: function () { return chunkOBA6YK2R_cjs.GOAL_CONTINUATION_MARKER; }
|
|
2289
|
+
});
|
|
2290
|
+
Object.defineProperty(exports, "JudgeCredentialError", {
|
|
2291
|
+
enumerable: true,
|
|
2292
|
+
get: function () { return chunkQDM3OHUT_cjs.JudgeCredentialError; }
|
|
2293
|
+
});
|
|
2294
|
+
Object.defineProperty(exports, "GenerateObjectError", {
|
|
2295
|
+
enumerable: true,
|
|
2296
|
+
get: function () { return chunkQWD4RDZ3_cjs.GenerateObjectError; }
|
|
2297
|
+
});
|
|
2298
|
+
Object.defineProperty(exports, "Workflow", {
|
|
2299
|
+
enumerable: true,
|
|
2300
|
+
get: function () { return chunk4HS6FFGL_cjs.Workflow; }
|
|
2301
|
+
});
|
|
2302
|
+
Object.defineProperty(exports, "agentStep", {
|
|
2303
|
+
enumerable: true,
|
|
2304
|
+
get: function () { return chunk4HS6FFGL_cjs.agentStep; }
|
|
2305
|
+
});
|
|
2306
|
+
Object.defineProperty(exports, "fn", {
|
|
2307
|
+
enumerable: true,
|
|
2308
|
+
get: function () { return chunk4HS6FFGL_cjs.fn; }
|
|
2309
|
+
});
|
|
2310
|
+
Object.defineProperty(exports, "Cron", {
|
|
2311
|
+
enumerable: true,
|
|
2312
|
+
get: function () { return chunk67SBTGMA_cjs.Cron; }
|
|
2313
|
+
});
|
|
2314
|
+
Object.defineProperty(exports, "Agent", {
|
|
2315
|
+
enumerable: true,
|
|
2316
|
+
get: function () { return chunkD3CCY3A2_cjs.Agent; }
|
|
2317
|
+
});
|
|
2318
|
+
Object.defineProperty(exports, "AgentBuilder", {
|
|
2319
|
+
enumerable: true,
|
|
2320
|
+
get: function () { return chunkD3CCY3A2_cjs.AgentBuilder; }
|
|
2321
|
+
});
|
|
2322
|
+
Object.defineProperty(exports, "Tool", {
|
|
2323
|
+
enumerable: true,
|
|
2324
|
+
get: function () { return chunkD3CCY3A2_cjs.Tool; }
|
|
2325
|
+
});
|
|
2326
|
+
Object.defineProperty(exports, "ToolError", {
|
|
2327
|
+
enumerable: true,
|
|
2328
|
+
get: function () { return chunkD3CCY3A2_cjs.ToolError; }
|
|
2329
|
+
});
|
|
2330
|
+
Object.defineProperty(exports, "UsageAccumulator", {
|
|
2331
|
+
enumerable: true,
|
|
2332
|
+
get: function () { return chunkD3CCY3A2_cjs.UsageAccumulator; }
|
|
2333
|
+
});
|
|
2334
|
+
Object.defineProperty(exports, "computeCost", {
|
|
2335
|
+
enumerable: true,
|
|
2336
|
+
get: function () { return chunkD3CCY3A2_cjs.computeCost; }
|
|
2337
|
+
});
|
|
2338
|
+
Object.defineProperty(exports, "getPricingEntry", {
|
|
2339
|
+
enumerable: true,
|
|
2340
|
+
get: function () { return chunkD3CCY3A2_cjs.getPricingEntry; }
|
|
2341
|
+
});
|
|
2342
|
+
Object.defineProperty(exports, "emitRunEvent", {
|
|
2343
|
+
enumerable: true,
|
|
2344
|
+
get: function () { return chunkKVSAY6NZ_cjs.emitRunEvent; }
|
|
2345
|
+
});
|
|
2346
|
+
Object.defineProperty(exports, "withCwdMutex", {
|
|
2347
|
+
enumerable: true,
|
|
2348
|
+
get: function () { return chunkZF2LDKQQ_cjs.withCwdMutex; }
|
|
2349
|
+
});
|
|
2350
|
+
Object.defineProperty(exports, "TASK_RESERVED_PREFIXES", {
|
|
2351
|
+
enumerable: true,
|
|
2352
|
+
get: function () { return chunkHCT4HPCL_cjs.TASK_RESERVED_PREFIXES; }
|
|
2353
|
+
});
|
|
2354
|
+
Object.defineProperty(exports, "isValidTaskId", {
|
|
2355
|
+
enumerable: true,
|
|
2356
|
+
get: function () { return chunkHCT4HPCL_cjs.isValidTaskId; }
|
|
2357
|
+
});
|
|
2358
|
+
Object.defineProperty(exports, "estimateTokens", {
|
|
2359
|
+
enumerable: true,
|
|
2360
|
+
get: function () { return chunkATT276RD_cjs.estimateTokens; }
|
|
2361
|
+
});
|
|
2362
|
+
Object.defineProperty(exports, "AgentDisposedError", {
|
|
2363
|
+
enumerable: true,
|
|
2364
|
+
get: function () { return chunkJ7J7J2GN_cjs.AgentDisposedError; }
|
|
2365
|
+
});
|
|
2366
|
+
Object.defineProperty(exports, "AgentRunError", {
|
|
2367
|
+
enumerable: true,
|
|
2368
|
+
get: function () { return chunkJ7J7J2GN_cjs.AgentRunError; }
|
|
2369
|
+
});
|
|
2370
|
+
Object.defineProperty(exports, "AuthenticationError", {
|
|
2371
|
+
enumerable: true,
|
|
2372
|
+
get: function () { return chunkJ7J7J2GN_cjs.AuthenticationError; }
|
|
2373
|
+
});
|
|
2374
|
+
Object.defineProperty(exports, "BudgetExceededError", {
|
|
2375
|
+
enumerable: true,
|
|
2376
|
+
get: function () { return chunkJ7J7J2GN_cjs.BudgetExceededError; }
|
|
2377
|
+
});
|
|
2378
|
+
Object.defineProperty(exports, "ConfigurationError", {
|
|
2379
|
+
enumerable: true,
|
|
2380
|
+
get: function () { return chunkJ7J7J2GN_cjs.ConfigurationError; }
|
|
2381
|
+
});
|
|
2382
|
+
Object.defineProperty(exports, "IntegrationNotConnectedError", {
|
|
2383
|
+
enumerable: true,
|
|
2384
|
+
get: function () { return chunkJ7J7J2GN_cjs.IntegrationNotConnectedError; }
|
|
2385
|
+
});
|
|
2386
|
+
Object.defineProperty(exports, "InvalidTaskIdError", {
|
|
2387
|
+
enumerable: true,
|
|
2388
|
+
get: function () { return chunkJ7J7J2GN_cjs.InvalidTaskIdError; }
|
|
2389
|
+
});
|
|
2390
|
+
Object.defineProperty(exports, "MemoryAdapterError", {
|
|
2391
|
+
enumerable: true,
|
|
2392
|
+
get: function () { return chunkJ7J7J2GN_cjs.MemoryAdapterError; }
|
|
2393
|
+
});
|
|
2394
|
+
Object.defineProperty(exports, "NetworkError", {
|
|
2395
|
+
enumerable: true,
|
|
2396
|
+
get: function () { return chunkJ7J7J2GN_cjs.NetworkError; }
|
|
2397
|
+
});
|
|
2398
|
+
Object.defineProperty(exports, "RateLimitError", {
|
|
2399
|
+
enumerable: true,
|
|
2400
|
+
get: function () { return chunkJ7J7J2GN_cjs.RateLimitError; }
|
|
2401
|
+
});
|
|
2402
|
+
Object.defineProperty(exports, "TaskNotFoundError", {
|
|
2403
|
+
enumerable: true,
|
|
2404
|
+
get: function () { return chunkJ7J7J2GN_cjs.TaskNotFoundError; }
|
|
2405
|
+
});
|
|
2406
|
+
Object.defineProperty(exports, "TheokitAgentError", {
|
|
2407
|
+
enumerable: true,
|
|
2408
|
+
get: function () { return chunkJ7J7J2GN_cjs.TheokitAgentError; }
|
|
2409
|
+
});
|
|
2410
|
+
Object.defineProperty(exports, "UnknownAgentError", {
|
|
2411
|
+
enumerable: true,
|
|
2412
|
+
get: function () { return chunkJ7J7J2GN_cjs.UnknownAgentError; }
|
|
2413
|
+
});
|
|
2414
|
+
Object.defineProperty(exports, "UnsupportedBudgetOperationError", {
|
|
2415
|
+
enumerable: true,
|
|
2416
|
+
get: function () { return chunkJ7J7J2GN_cjs.UnsupportedBudgetOperationError; }
|
|
2417
|
+
});
|
|
2418
|
+
Object.defineProperty(exports, "UnsupportedRunOperationError", {
|
|
2419
|
+
enumerable: true,
|
|
2420
|
+
get: function () { return chunkJ7J7J2GN_cjs.UnsupportedRunOperationError; }
|
|
2421
|
+
});
|
|
2422
|
+
Object.defineProperty(exports, "UnsupportedTaskOperationError", {
|
|
2423
|
+
enumerable: true,
|
|
2424
|
+
get: function () { return chunkJ7J7J2GN_cjs.UnsupportedTaskOperationError; }
|
|
2425
|
+
});
|
|
2426
|
+
Object.defineProperty(exports, "isTransientError", {
|
|
2427
|
+
enumerable: true,
|
|
2428
|
+
get: function () { return chunkJ7J7J2GN_cjs.isTransientError; }
|
|
2429
|
+
});
|
|
2430
|
+
Object.defineProperty(exports, "setDiagnosticsSink", {
|
|
2431
|
+
enumerable: true,
|
|
2432
|
+
get: function () { return chunk6LHQPOMI_cjs.setDiagnosticsSink; }
|
|
2433
|
+
});
|
|
2434
|
+
exports.AgentFactory = AgentFactory;
|
|
2435
|
+
exports.Budget = Budget;
|
|
2436
|
+
exports.EventBus = EventBus;
|
|
2437
|
+
exports.JobQueue = JobQueue;
|
|
2438
|
+
exports.LayerOrderError = LayerOrderError;
|
|
2439
|
+
exports.LiveSessionError = LiveSessionError;
|
|
2440
|
+
exports.Memory = Memory;
|
|
2441
|
+
exports.NoopMemoryProvider = NoopMemoryProvider;
|
|
2442
|
+
exports.PermissionEngine = PermissionEngine;
|
|
2443
|
+
exports.PermissionPlugin = PermissionPlugin;
|
|
2444
|
+
exports.Plugin = Plugin;
|
|
2445
|
+
exports.Provider = Provider;
|
|
2446
|
+
exports.RetentionPolicyError = RetentionPolicyError;
|
|
2447
|
+
exports.SOVEREIGN_ENV_KEYS = SOVEREIGN_ENV_KEYS;
|
|
2448
|
+
exports.Security = Security;
|
|
2449
|
+
exports.Skill = Skill;
|
|
2450
|
+
exports.SkillReadTool = SkillReadTool;
|
|
2451
|
+
exports.Squad = Squad;
|
|
2452
|
+
exports.Task = Task;
|
|
2453
|
+
exports.Theokit = Theokit;
|
|
2454
|
+
exports.TokenLimiter = TokenLimiter;
|
|
2455
|
+
exports.UngatedCapabilityError = UngatedCapabilityError;
|
|
2456
|
+
exports.UnicodeNormalizer = UnicodeNormalizer;
|
|
2457
|
+
exports.applyMode = applyMode;
|
|
2458
|
+
exports.applySecurityFloor = applySecurityFloor;
|
|
2459
|
+
exports.auditEnvReachability = auditEnvReachability;
|
|
2460
|
+
exports.chargeAndCheckThresholds = chargeAndCheckThresholds;
|
|
2461
|
+
exports.createCounterBudgetTracker = createCounterBudgetTracker;
|
|
2462
|
+
exports.decideApproval = decideApproval;
|
|
2463
|
+
exports.describeAction = describeAction;
|
|
2464
|
+
exports.describeCredential = describeCredential;
|
|
2465
|
+
exports.evaluateBlastRadius = evaluateBlastRadius;
|
|
2466
|
+
exports.extractRawId = extractRawId;
|
|
2467
|
+
exports.foldLayers = foldLayers;
|
|
2468
|
+
exports.guardSessionDestruction = guardSessionDestruction;
|
|
2469
|
+
exports.inferApiMode = inferApiMode;
|
|
2470
|
+
exports.loadProjectEnv = loadProjectEnv;
|
|
2471
|
+
exports.migrateSqliteToLance = migrateSqliteToLance2;
|
|
2472
|
+
exports.mkMemoryId = mkMemoryId;
|
|
2473
|
+
exports.normalizeSchema = normalizeSchema;
|
|
2474
|
+
exports.normalizeUsage = normalizeUsage;
|
|
2475
|
+
exports.planReaping = planReaping;
|
|
2476
|
+
exports.preflightCheck = preflightCheck;
|
|
2477
|
+
exports.readSessionMessages = readSessionMessages2;
|
|
2478
|
+
exports.recordWiring = recordWiring;
|
|
2479
|
+
exports.resolveTrustPosture = resolveTrustPosture;
|
|
2480
|
+
exports.runGoalLoop = runGoalLoop;
|
|
2481
|
+
exports.scopedConversationId = scopedConversationId;
|
|
2482
|
+
exports.sessionScopePrefix = sessionScopePrefix;
|
|
2483
|
+
exports.toShareGptTrajectory = toShareGptTrajectory;
|
|
2484
|
+
exports.verifyLayerOrdering = verifyLayerOrdering;
|
|
2485
|
+
exports.withBlastRadius = withBlastRadius;
|
|
2486
|
+
//# sourceMappingURL=index.cjs.map
|
|
2487
|
+
//# sourceMappingURL=index.cjs.map
|