@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
|
@@ -0,0 +1,1813 @@
|
|
|
1
|
+
import * as zod from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Owner: `types/` (2 of 2 importers: conversation.ts, updates.ts). The only module in this folder
|
|
5
|
+
* whose owner IS the layer — it exists to break a type-only cycle BETWEEN two of its siblings, so
|
|
6
|
+
* pointing it at a subsystem would name something that does not use it.
|
|
7
|
+
*
|
|
8
|
+
* Type-leaf — base message types shared between `conversation.ts` and
|
|
9
|
+
* `updates.ts`. Extracted to break LOW type-only cycle #6 (audit
|
|
10
|
+
* `architecture-output/final_report.md`) per plan arch-review-fixes-2026-06-06
|
|
11
|
+
* § Phase 4 / T4.1 (D438).
|
|
12
|
+
*
|
|
13
|
+
* Public surface unchanged — `types/conversation.ts` re-exports `UserMessage`
|
|
14
|
+
* from this leaf so `import type { UserMessage } from "@theokit/sdk"` keeps
|
|
15
|
+
* resolving.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* User-authored message in a conversation history.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
interface UserMessage {
|
|
25
|
+
text: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Owner: `internal/agent-loop/` (1 of 1 importers). Derived from the import graph, not declared —
|
|
30
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Single tool call event. The internal `args` and `result` shapes are NOT stable.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
interface ToolCall {
|
|
40
|
+
callId: string;
|
|
41
|
+
name: string;
|
|
42
|
+
args?: unknown;
|
|
43
|
+
result?: unknown;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Incremental text token from the assistant.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
interface TextDeltaUpdate {
|
|
51
|
+
type: "text-delta";
|
|
52
|
+
text: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Incremental reasoning token.
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
interface ThinkingDeltaUpdate {
|
|
60
|
+
type: "thinking-delta";
|
|
61
|
+
text: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Emitted when a reasoning block completes.
|
|
65
|
+
*
|
|
66
|
+
* @public
|
|
67
|
+
*/
|
|
68
|
+
interface ThinkingCompletedUpdate {
|
|
69
|
+
type: "thinking-completed";
|
|
70
|
+
thinkingDurationMs: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Tool call started — args committed.
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
interface ToolCallStartedUpdate {
|
|
78
|
+
type: "tool-call-started";
|
|
79
|
+
callId: string;
|
|
80
|
+
toolCall: ToolCall;
|
|
81
|
+
modelCallId: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Tool call arguments streaming in incrementally.
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
interface PartialToolCallUpdate {
|
|
89
|
+
type: "partial-tool-call";
|
|
90
|
+
callId: string;
|
|
91
|
+
toolCall: ToolCall;
|
|
92
|
+
modelCallId: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Tool call completed.
|
|
96
|
+
*
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
interface ToolCallCompletedUpdate {
|
|
100
|
+
type: "tool-call-completed";
|
|
101
|
+
callId: string;
|
|
102
|
+
toolCall: ToolCall;
|
|
103
|
+
modelCallId: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Token count delta for usage tracking.
|
|
107
|
+
*
|
|
108
|
+
* @public
|
|
109
|
+
*/
|
|
110
|
+
interface TokenDeltaUpdate {
|
|
111
|
+
type: "token-delta";
|
|
112
|
+
tokens: number;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Conversation step started.
|
|
116
|
+
*
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
interface StepStartedUpdate {
|
|
120
|
+
type: "step-started";
|
|
121
|
+
stepId: number;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Conversation step completed.
|
|
125
|
+
*
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
interface StepCompletedUpdate {
|
|
129
|
+
type: "step-completed";
|
|
130
|
+
stepId: number;
|
|
131
|
+
stepDurationMs: number;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Turn ended with usage summary.
|
|
135
|
+
*
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
interface TurnEndedUpdate {
|
|
139
|
+
type: "turn-ended";
|
|
140
|
+
usage?: {
|
|
141
|
+
inputTokens: number;
|
|
142
|
+
outputTokens: number;
|
|
143
|
+
cacheReadTokens: number;
|
|
144
|
+
cacheWriteTokens: number;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* User message appended to the conversation.
|
|
149
|
+
*
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
152
|
+
interface UserMessageAppendedUpdate {
|
|
153
|
+
type: "user-message-appended";
|
|
154
|
+
userMessage: UserMessage;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* A conversation summary produced during a run, delivered through `SendOptions.onDelta`.
|
|
158
|
+
*
|
|
159
|
+
* Nothing in this package emits it. It is declared so an exhaustive `switch` over
|
|
160
|
+
* {@link InteractionUpdate} compiles, and so a runtime that does produce summaries has a typed
|
|
161
|
+
* channel — do not build a feature that waits on it against the local runtime.
|
|
162
|
+
*
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
interface SummaryUpdate {
|
|
166
|
+
type: "summary";
|
|
167
|
+
summary: string;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Opens the bracket around a {@link SummaryUpdate}, for a UI that wants to show a pending state
|
|
171
|
+
* before the summary text exists. Paired with {@link SummaryCompletedUpdate}.
|
|
172
|
+
*
|
|
173
|
+
* Like the summary variants around it, nothing in this package emits it.
|
|
174
|
+
*
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
interface SummaryStartedUpdate {
|
|
178
|
+
type: "summary-started";
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Closes the bracket opened by {@link SummaryStartedUpdate}. Carries no payload — the summary text
|
|
182
|
+
* itself arrives as {@link SummaryUpdate}.
|
|
183
|
+
*
|
|
184
|
+
* Like the summary variants around it, nothing in this package emits it.
|
|
185
|
+
*
|
|
186
|
+
* @public
|
|
187
|
+
*/
|
|
188
|
+
interface SummaryCompletedUpdate {
|
|
189
|
+
type: "summary-completed";
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Incremental output from a shell command running inside a run.
|
|
193
|
+
*
|
|
194
|
+
* `event` is an untyped bag on purpose: this package neither produces nor narrows it, so a consumer
|
|
195
|
+
* that receives one should treat it as unvalidated input and check for the fields it needs rather
|
|
196
|
+
* than casting. As with the summary variants, nothing here emits this — it exists so the
|
|
197
|
+
* {@link InteractionUpdate} union covers a runtime that does.
|
|
198
|
+
*
|
|
199
|
+
* @public
|
|
200
|
+
*/
|
|
201
|
+
interface ShellOutputDeltaUpdate {
|
|
202
|
+
type: "shell-output-delta";
|
|
203
|
+
event: Record<string, unknown>;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Lowest-level raw update from a run. Pass `onDelta` to `agent.send()` to
|
|
207
|
+
* consume these. Finer-grained than `SDKMessage` events.
|
|
208
|
+
*
|
|
209
|
+
* @public
|
|
210
|
+
*/
|
|
211
|
+
type InteractionUpdate = TextDeltaUpdate | ThinkingDeltaUpdate | ThinkingCompletedUpdate | ToolCallStartedUpdate | ToolCallCompletedUpdate | PartialToolCallUpdate | TokenDeltaUpdate | StepStartedUpdate | StepCompletedUpdate | TurnEndedUpdate | UserMessageAppendedUpdate | SummaryUpdate | SummaryStartedUpdate | SummaryCompletedUpdate | ShellOutputDeltaUpdate;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Owner: `internal/agent-loop/` (3 of 11 importers). Derived from the import graph, not declared —
|
|
215
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
216
|
+
*
|
|
217
|
+
* SE2 — typed runtime EVENT stream, ADDITIVE to the `SDKMessage` content stream.
|
|
218
|
+
*
|
|
219
|
+
* `Run.stream()` yields `SDKMessage`s (the conversation content). `RunEvent`s are
|
|
220
|
+
* out-of-band runtime-OBSERVABILITY signals — the model's content is unaffected —
|
|
221
|
+
* delivered opt-in via `SendOptions.onRunEvent`. Discriminate on `type`. Mirrors
|
|
222
|
+
* the Anthropic `SDKMessage`-union approach (rate-limit, permission-denied, task
|
|
223
|
+
* lifecycle, compaction boundary).
|
|
224
|
+
*
|
|
225
|
+
* The union is the forward-compatible CONTRACT (discriminate exhaustively). The
|
|
226
|
+
* runtime EMITS every variant end-to-end: `tool_progress` + `permission_denied`
|
|
227
|
+
* (agent-loop tool-dispatch seam), `rate_limit` (pool-aware LLM client 429 retry),
|
|
228
|
+
* `compact_boundary` (session auto-compaction), and `task_*` (opt-in bridge from a
|
|
229
|
+
* `Task.submit({ onRunEvent })` task's lifecycle). A consumer switching on `type`
|
|
230
|
+
* sees the real signal.
|
|
231
|
+
*
|
|
232
|
+
* @public
|
|
233
|
+
*/
|
|
234
|
+
type RunEvent = RunToolProgressEvent | RunRateLimitEvent | RunPermissionDeniedEvent | RunTaskStartedEvent | RunTaskUpdatedEvent | RunTaskCompletedEvent | RunCompactBoundaryEvent | RunCompactionFallbackEvent | RunTripwireEvent | RunCompletionCheckEvent | RunMcpServerFailedEvent | RunMcpServerReadyEvent | RunMemoryDegradedEvent;
|
|
235
|
+
/**
|
|
236
|
+
* theokit#188 — an MCP server was configured but its tools could not be listed, so NONE of its
|
|
237
|
+
* tools exist for this run.
|
|
238
|
+
*
|
|
239
|
+
* The failure was always caught (`safeListTools` returns `[]` so one broken server cannot take the
|
|
240
|
+
* turn down) and always DIAGNOSED — to `diag()`, i.e. the SDK's stderr. Nothing reached the
|
|
241
|
+
* consumer, so a UI listing configured servers could show one as present while every tool it
|
|
242
|
+
* provides had silently vanished. Degrading gracefully is right; degrading INVISIBLY is not.
|
|
243
|
+
*
|
|
244
|
+
* Emitted once per failing server per run, on the same catch path that already had both the name
|
|
245
|
+
* and the reason.
|
|
246
|
+
*/
|
|
247
|
+
interface RunMcpServerFailedEvent {
|
|
248
|
+
readonly type: "mcp_server_failed";
|
|
249
|
+
/** The server as named in the MCP configuration, so the consumer can match it to what it lists. */
|
|
250
|
+
readonly serverName: string;
|
|
251
|
+
/** Why listing failed — a spawn error, a handshake timeout, a protocol error. */
|
|
252
|
+
readonly message: string;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* usetheokit/theokit#426 — an MCP server came up, and these are the tools it delivered.
|
|
256
|
+
*
|
|
257
|
+
* The sibling of {@link RunMcpServerFailedEvent}, emitted from the same function, on the other
|
|
258
|
+
* branch. Without it a consumer could see what was CONFIGURED and what BROKE, and could not tell a
|
|
259
|
+
* server that came up with twelve tools from one that came up with none — which is exactly the case
|
|
260
|
+
* an operator opens a server-status panel to find. `tools: []` on a healthy server is a real and
|
|
261
|
+
* previously unreportable state.
|
|
262
|
+
*
|
|
263
|
+
* An EVENT rather than a getter, because the state is scoped to the run: with
|
|
264
|
+
* `mcpLifecycle: "run"` a server may not exist by the time anyone asks, so a getter would have to
|
|
265
|
+
* answer about something already gone. This says what was true when the run started.
|
|
266
|
+
*
|
|
267
|
+
* Emitted once per successfully-listed server per run.
|
|
268
|
+
*/
|
|
269
|
+
interface RunMcpServerReadyEvent {
|
|
270
|
+
readonly type: "mcp_server_ready";
|
|
271
|
+
/** The server as named in the MCP configuration — the key a consumer already lists it under. */
|
|
272
|
+
readonly serverName: string;
|
|
273
|
+
/**
|
|
274
|
+
* The tool names the server reported, as IT names them.
|
|
275
|
+
*
|
|
276
|
+
* Not the `mcp_<server>_<tool>` form the model sees: that spelling is sanitized for the provider,
|
|
277
|
+
* and a consumer matching it back to a server's own documentation would have to undo the mangling.
|
|
278
|
+
*/
|
|
279
|
+
readonly tools: readonly string[];
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* SE24 — a guardrail processor called `abort()`; the run stops with a tripwire.
|
|
283
|
+
* Delivered via {@link SendOptions.onRunEvent} (mirrors the `RunResult.tripwire`
|
|
284
|
+
* surfaced on `wait()`).
|
|
285
|
+
*/
|
|
286
|
+
interface RunTripwireEvent {
|
|
287
|
+
readonly type: "tripwire";
|
|
288
|
+
readonly reason: string;
|
|
289
|
+
readonly processorId: string;
|
|
290
|
+
}
|
|
291
|
+
/** A tool call is being dispatched (before its result). */
|
|
292
|
+
interface RunToolProgressEvent {
|
|
293
|
+
readonly type: "tool_progress";
|
|
294
|
+
readonly toolName: string;
|
|
295
|
+
readonly toolCallId: string;
|
|
296
|
+
}
|
|
297
|
+
/** The provider returned a rate-limit (HTTP 429); the loop will back off + retry. */
|
|
298
|
+
interface RunRateLimitEvent {
|
|
299
|
+
readonly type: "rate_limit";
|
|
300
|
+
/** Retry attempt number (1-based) about to be delayed. */
|
|
301
|
+
readonly attempt: number;
|
|
302
|
+
/** Delay in ms before the retry, when the provider/policy supplied one. */
|
|
303
|
+
readonly retryAfterMs?: number;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* A tool call was DENIED before dispatch — by the permission gate/plugin (SE1),
|
|
307
|
+
* an operator file-hook `preToolUse`, or the fork tool-whitelist. `source`
|
|
308
|
+
* discriminates which. `toolCallId` joins the event to the tool-call log.
|
|
309
|
+
*/
|
|
310
|
+
interface RunPermissionDeniedEvent {
|
|
311
|
+
readonly type: "permission_denied";
|
|
312
|
+
readonly toolName: string;
|
|
313
|
+
readonly toolCallId: string;
|
|
314
|
+
/** Which layer blocked the call. */
|
|
315
|
+
readonly source: "plugin" | "file_hook" | "fork_whitelist";
|
|
316
|
+
/** The rejection message surfaced to the model. */
|
|
317
|
+
readonly message: string;
|
|
318
|
+
}
|
|
319
|
+
/** A background task/subagent started. */
|
|
320
|
+
interface RunTaskStartedEvent {
|
|
321
|
+
readonly type: "task_started";
|
|
322
|
+
readonly taskId: string;
|
|
323
|
+
readonly description?: string;
|
|
324
|
+
}
|
|
325
|
+
/** A background task/subagent changed state. */
|
|
326
|
+
interface RunTaskUpdatedEvent {
|
|
327
|
+
readonly type: "task_updated";
|
|
328
|
+
readonly taskId: string;
|
|
329
|
+
readonly status: string;
|
|
330
|
+
}
|
|
331
|
+
/** A background task/subagent finished. */
|
|
332
|
+
interface RunTaskCompletedEvent {
|
|
333
|
+
readonly type: "task_completed";
|
|
334
|
+
readonly taskId: string;
|
|
335
|
+
readonly status: "completed" | "failed" | "stopped";
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* SE34 — the per-send completion check (`isTaskComplete`) produced a verdict.
|
|
339
|
+
* Emitted once, after a finished run's reply is judged against
|
|
340
|
+
* {@link SendOptions.completionCheck}. Distinct from `task_completed` (which is
|
|
341
|
+
* background-task/subagent lifecycle). Mirrors {@link RunResult.completionCheck}.
|
|
342
|
+
*/
|
|
343
|
+
interface RunCompletionCheckEvent {
|
|
344
|
+
readonly type: "completion_check";
|
|
345
|
+
readonly complete: boolean;
|
|
346
|
+
readonly reason: string;
|
|
347
|
+
}
|
|
348
|
+
/** The conversation crossed a compaction boundary (history was summarized). */
|
|
349
|
+
interface RunCompactBoundaryEvent {
|
|
350
|
+
readonly type: "compact_boundary";
|
|
351
|
+
readonly trigger: "manual" | "auto";
|
|
352
|
+
/** Token count before compaction, when known. */
|
|
353
|
+
readonly preTokens?: number;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* M77 — auto-compaction is budgeting against a FLOOR, because neither the catalog nor the caller
|
|
357
|
+
* supplied a context window for this model.
|
|
358
|
+
*
|
|
359
|
+
* The prior behaviour was to disable auto-compaction entirely and write one line to stderr per
|
|
360
|
+
* process. That is fail-OPEN: the conversation grows until the provider rejects it. This event exists
|
|
361
|
+
* so a surface can say "I am running without a real budget" instead of the user discovering it at the
|
|
362
|
+
* moment of failure.
|
|
363
|
+
*
|
|
364
|
+
* Not emitted when the window came from the catalog (the normal path) or from an explicit caller
|
|
365
|
+
* override (the caller already knows).
|
|
366
|
+
*/
|
|
367
|
+
interface RunCompactionFallbackEvent {
|
|
368
|
+
readonly type: "compaction_fallback";
|
|
369
|
+
/** The model whose window is unknown — what the user needs to fix in configuration. */
|
|
370
|
+
readonly model: string;
|
|
371
|
+
/** The floor being budgeted against, after the safety margin. */
|
|
372
|
+
readonly window: number;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* A memory stage failed and the run continued without it.
|
|
376
|
+
*
|
|
377
|
+
* The same shape of gap {@link RunMcpServerFailedEvent} closed for MCP, in the module next door.
|
|
378
|
+
* `initLoopContext` had three bare `catch { <field> = <empty> }` blocks: an init failure meant no
|
|
379
|
+
* memory tool was registered, a `buildTools` failure meant no provider tools, and a `runActivePass`
|
|
380
|
+
* failure meant no recalled context in the system prompt. The agent then answered without the memory
|
|
381
|
+
* it was configured with, and nothing recorded it — not stderr, not this sink, not the span in scope.
|
|
382
|
+
*
|
|
383
|
+
* Degrading to a working agent is the right BEHAVIOUR. This event exists because the degradation was
|
|
384
|
+
* unobservable, so a host UI showed a healthy run.
|
|
385
|
+
*
|
|
386
|
+
* Emitted once per failing stage per run.
|
|
387
|
+
*
|
|
388
|
+
* @public
|
|
389
|
+
*/
|
|
390
|
+
interface RunMemoryDegradedEvent {
|
|
391
|
+
readonly type: "memory_degraded";
|
|
392
|
+
/** Which stage failed: `init`, `buildTools`, or `activePass`. */
|
|
393
|
+
readonly stage: string;
|
|
394
|
+
/** Why it failed, as the provider reported it. */
|
|
395
|
+
readonly message: string;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Receives every {@link RunEvent} a run emits, in emission order.
|
|
399
|
+
*
|
|
400
|
+
* Wired through `onRunEvent` on the run options. The sink is observability, never control flow: it
|
|
401
|
+
* cannot cancel, alter, or delay the run, and {@link emitRunEvent} swallows anything it throws — a
|
|
402
|
+
* broken sink degrades what you can see, never what the agent does.
|
|
403
|
+
*
|
|
404
|
+
* Synchronous by signature, so a slow sink slows the run. Hand work off rather than awaiting inside
|
|
405
|
+
* it; returning a promise here would be ignored, not awaited.
|
|
406
|
+
*
|
|
407
|
+
* @public
|
|
408
|
+
*/
|
|
409
|
+
type RunEventSink = (event: RunEvent) => void;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Owner: `internal/runtime/processors/` (3 of 4 importers). Derived from the import graph, not declared —
|
|
413
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
414
|
+
*
|
|
415
|
+
* SE24 — guardrail processor pipeline. A `Processor` inspects/transforms/blocks
|
|
416
|
+
* the user message (input) or the model's final text (output). Processors run in
|
|
417
|
+
* order; each may rewrite its payload, `abort(reason)` to stop the run (surfaced
|
|
418
|
+
* as {@link RunResult.tripwire} + a `tripwire` run-event), or `warn()` to report
|
|
419
|
+
* a non-blocking violation. The pipeline is provider-agnostic and carries NO LLM
|
|
420
|
+
* — an LLM-classifier processor is the consumer's (delegated, see the guardrails
|
|
421
|
+
* ADR). Mirrors a peer framework's `inputProcessors` / `outputProcessors`.
|
|
422
|
+
*
|
|
423
|
+
* @public
|
|
424
|
+
*/
|
|
425
|
+
/**
|
|
426
|
+
* A policy violation surfaced to a processor's {@link Processor.onViolation}
|
|
427
|
+
* callback — on `abort()` (blocking) AND on `warn()` (non-blocking).
|
|
428
|
+
*
|
|
429
|
+
* @public
|
|
430
|
+
*/
|
|
431
|
+
interface ProcessorViolation {
|
|
432
|
+
processorId: string;
|
|
433
|
+
message: string;
|
|
434
|
+
detail?: unknown;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Controls available to a processor while it runs: `abort()` stops the run with
|
|
438
|
+
* a tripwire; `warn()` reports a non-blocking violation and continues.
|
|
439
|
+
*
|
|
440
|
+
* @public
|
|
441
|
+
*/
|
|
442
|
+
interface ProcessorControls {
|
|
443
|
+
/** Stop the run immediately with a tripwire. Throws — code after it never runs. */
|
|
444
|
+
abort(reason: string): never;
|
|
445
|
+
/** Report a non-blocking violation (fires `onViolation`); the run continues. */
|
|
446
|
+
warn(message: string, detail?: unknown): void;
|
|
447
|
+
}
|
|
448
|
+
/** Context passed to {@link Processor.processInput}. @public */
|
|
449
|
+
interface InputProcessorContext extends ProcessorControls {
|
|
450
|
+
/** The user message text for this send. */
|
|
451
|
+
message: string;
|
|
452
|
+
agentId: string;
|
|
453
|
+
}
|
|
454
|
+
/** Context passed to {@link Processor.processOutput}. @public */
|
|
455
|
+
interface OutputProcessorContext extends ProcessorControls {
|
|
456
|
+
/** The model's final assistant text for this run. */
|
|
457
|
+
text: string;
|
|
458
|
+
agentId: string;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* A guardrail processor. Provide `processInput` (runs before the LLM) and/or
|
|
462
|
+
* `processOutput` (runs on the final text). A processor's `strategy` (block /
|
|
463
|
+
* rewrite / redact / warn) is expressed via the {@link ProcessorControls}:
|
|
464
|
+
* return the transformed payload to rewrite/redact, `abort()` to block, `warn()`
|
|
465
|
+
* to report without blocking. The core ships no strategy enum — strategies are a
|
|
466
|
+
* processor-level convention over these primitives.
|
|
467
|
+
*
|
|
468
|
+
* @public
|
|
469
|
+
*/
|
|
470
|
+
interface Processor {
|
|
471
|
+
/** Stable id — surfaced on {@link ProcessorViolation} and {@link RunResult.tripwire}. */
|
|
472
|
+
id: string;
|
|
473
|
+
/**
|
|
474
|
+
* Transform or block the user message before it reaches the model. Return the
|
|
475
|
+
* (possibly rewritten) text; returning nothing (void) preserves the message
|
|
476
|
+
* unchanged. May be `async`.
|
|
477
|
+
*/
|
|
478
|
+
processInput?(ctx: InputProcessorContext): string | Promise<string> | void;
|
|
479
|
+
/**
|
|
480
|
+
* Transform or block the model's final text before it reaches the caller.
|
|
481
|
+
* Return the (possibly redacted) text; returning nothing (void) preserves the
|
|
482
|
+
* text unchanged. May be `async`.
|
|
483
|
+
*/
|
|
484
|
+
processOutput?(ctx: OutputProcessorContext): string | Promise<string> | void;
|
|
485
|
+
/** Fires on `abort()` and `warn()`. Errors thrown here are swallowed (never break the pipeline). */
|
|
486
|
+
onViolation?(violation: ProcessorViolation): void;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* The tripwire detail attached to {@link RunResult.tripwire} when a processor
|
|
490
|
+
* aborts, and carried by the `tripwire` run-event.
|
|
491
|
+
*
|
|
492
|
+
* @public
|
|
493
|
+
*/
|
|
494
|
+
interface ProcessorTripwire {
|
|
495
|
+
reason: string;
|
|
496
|
+
processorId: string;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Owner: `src/` (2 of 7 importers). Derived from the import graph, not declared —
|
|
501
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
502
|
+
*
|
|
503
|
+
* Leaf module for content-block types shared by `messages.ts` (assistant/user
|
|
504
|
+
* content) and `agent-prims.ts` (`CustomTool` handler results). Kept
|
|
505
|
+
* import-free so both can depend on it WITHOUT the `agent-prims ↔ messages`
|
|
506
|
+
* cycle (#7).
|
|
507
|
+
*
|
|
508
|
+
* @public
|
|
509
|
+
*/
|
|
510
|
+
/**
|
|
511
|
+
* Plain text content block emitted by the assistant or user, or returned by a
|
|
512
|
+
* tool.
|
|
513
|
+
*
|
|
514
|
+
* @public
|
|
515
|
+
*/
|
|
516
|
+
interface TextBlock {
|
|
517
|
+
type: "text";
|
|
518
|
+
text: string;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* SE7 — a base64-encoded image block a tool can hand back as (part of) its
|
|
522
|
+
* result or its `ToolError`. `media_type` is a MIME type (e.g. `"image/png"`);
|
|
523
|
+
* `data` is the base64 payload without a data-URL prefix.
|
|
524
|
+
*
|
|
525
|
+
* Note: when a tool builds this from model- or user-influenced input, treat
|
|
526
|
+
* `media_type` as UNTRUSTED — validate/allow-list it before rendering it in a
|
|
527
|
+
* log or UI (it could carry newlines / control chars). The SDK only forwards it
|
|
528
|
+
* (JSON-serialized onto the wire) and never executes or path-joins it.
|
|
529
|
+
*
|
|
530
|
+
* @public
|
|
531
|
+
*/
|
|
532
|
+
interface ImageBlock {
|
|
533
|
+
type: "image";
|
|
534
|
+
source: {
|
|
535
|
+
type: "base64";
|
|
536
|
+
media_type: string;
|
|
537
|
+
data: string;
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* SE7 — structured content a tool result may carry: text and/or images. A tool
|
|
542
|
+
* `handler` may return this (success) and a `ToolError` may carry it (failure).
|
|
543
|
+
* Block-capable provider wires forward it natively; string-only provider wires
|
|
544
|
+
* flatten text and fail fast on an image.
|
|
545
|
+
*
|
|
546
|
+
* @public
|
|
547
|
+
*/
|
|
548
|
+
type ToolResultContentBlock = TextBlock | ImageBlock;
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Owner: `internal/agent-loop/` (3 of 11 importers). Derived from the import graph, not
|
|
552
|
+
* declared — `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
553
|
+
*
|
|
554
|
+
* Type-leaf — primitives shared between `agent.ts`, `run.ts`, and
|
|
555
|
+
* `messages.ts`. Extracted to break LOW type-only cycles #5 and #7
|
|
556
|
+
* (audit `architecture-output/final_report.md`) per plan
|
|
557
|
+
* arch-review-fixes-2026-06-06 § Phase 4 / T4.1 (D438).
|
|
558
|
+
*
|
|
559
|
+
* Public surface unchanged — `types/agent.ts` re-exports these from this
|
|
560
|
+
* leaf so `import type { ModelSelection, CustomTool } from "@theokit/sdk"`
|
|
561
|
+
* keeps resolving.
|
|
562
|
+
*
|
|
563
|
+
* @public
|
|
564
|
+
*/
|
|
565
|
+
/**
|
|
566
|
+
* One slot in a {@link ModelSelection.params} array.
|
|
567
|
+
*
|
|
568
|
+
* @public
|
|
569
|
+
*/
|
|
570
|
+
interface ModelParameterValue {
|
|
571
|
+
id: string;
|
|
572
|
+
value: string;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Identifies a model plus optional per-model parameters (e.g. reasoning effort).
|
|
576
|
+
*
|
|
577
|
+
* Use `Theokit.models.list()` to discover valid ids and parameter definitions.
|
|
578
|
+
*
|
|
579
|
+
* @public
|
|
580
|
+
*/
|
|
581
|
+
interface ModelSelection {
|
|
582
|
+
id: string;
|
|
583
|
+
params?: ModelParameterValue[];
|
|
584
|
+
/**
|
|
585
|
+
* M94 — the model's context window, in tokens. Becomes the window resolver's `override`.
|
|
586
|
+
*
|
|
587
|
+
* It exists for models with NO catalog entry: without it, a 400k model was budgeted against the
|
|
588
|
+
* 128k floor and compacted ~3x more than it needed to. A value above what the catalog knows is
|
|
589
|
+
* clamped — declaring 10M does not blow past the provider.
|
|
590
|
+
*/
|
|
591
|
+
contextWindow?: number;
|
|
592
|
+
/**
|
|
593
|
+
* #332 — the endpoint THIS model should reach, for OpenAI-compatible and local servers.
|
|
594
|
+
*
|
|
595
|
+
* Without it the base URL came only from a process-wide env var (`OLLAMA_HOST`) or the provider
|
|
596
|
+
* profile's shipped default, so every `ollama/*` model in a process shared one host — an app
|
|
597
|
+
* could not run a small model on localhost and a large one on a GPU box.
|
|
598
|
+
*
|
|
599
|
+
* It outranks the env var deliberately: with the env var winning, whoever set it for one model
|
|
600
|
+
* would keep hijacking every other one, which is the same bug wearing a hat.
|
|
601
|
+
*
|
|
602
|
+
* Leaving it unset keeps the zero-config path exactly as it was — `ollama/qwen2.5:3b` still
|
|
603
|
+
* resolves to `http://localhost:11434` from the profile, with no key and no setup.
|
|
604
|
+
*/
|
|
605
|
+
url?: string;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* SE12 — a read-only, text-only projection of one turn of the run's conversation,
|
|
609
|
+
* exposed to a tool handler via `ctx.messages`. Content is flattened to text; tool
|
|
610
|
+
* calls / results and non-text parts are dropped, and turns that project to empty
|
|
611
|
+
* text are omitted. Consumed by `defineSubAgent`'s `messageFilter` to forward
|
|
612
|
+
* (a subset of) the supervisor transcript to a subagent.
|
|
613
|
+
*
|
|
614
|
+
* `role` includes `"system"` for type-completeness with the wire message shape,
|
|
615
|
+
* but the system prompt travels on a separate request field — a `"system"` entry
|
|
616
|
+
* does NOT appear in the current projection.
|
|
617
|
+
*
|
|
618
|
+
* @public
|
|
619
|
+
*/
|
|
620
|
+
interface ToolContextMessage {
|
|
621
|
+
role: "system" | "user" | "assistant";
|
|
622
|
+
content: string;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Local function tool declared per-agent via {@link AgentOptions.tools}. The
|
|
626
|
+
* handler runs in-process; no MCP server is involved. The SDK serializes
|
|
627
|
+
* `name`, `description`, and `inputSchema` into the model's tool catalog.
|
|
628
|
+
*
|
|
629
|
+
* Handlers MUST be re-passed on `Agent.resume()` because closures cannot be
|
|
630
|
+
* persisted. The tool catalog (name + description + schema) is NOT serialized.
|
|
631
|
+
*
|
|
632
|
+
* @public
|
|
633
|
+
*/
|
|
634
|
+
interface CustomTool {
|
|
635
|
+
/**
|
|
636
|
+
* Tool name surfaced to the LLM. Must match `^[a-zA-Z][a-zA-Z0-9_-]{0,63}$`
|
|
637
|
+
* and must not collide with `shell`, `memory_search`, `memory_get`, or any
|
|
638
|
+
* `mcp_*` prefix (reserved for the SDK's built-in tools).
|
|
639
|
+
*/
|
|
640
|
+
name: string;
|
|
641
|
+
/** Description surfaced to the LLM. Required — drives tool-selection accuracy. */
|
|
642
|
+
description: string;
|
|
643
|
+
/** JSON Schema (Draft-7 subset) describing the `input` argument. Must be `type: "object"`. */
|
|
644
|
+
inputSchema: Record<string, unknown>;
|
|
645
|
+
/**
|
|
646
|
+
* Local handler invoked when the model emits `tool_use` for this tool.
|
|
647
|
+
* Returns a string OR structured content blocks (SE7 — text + image, e.g. a
|
|
648
|
+
* screenshot) that become the `tool_result.content` surfaced back to the
|
|
649
|
+
* model. Throws → SDK converts to `tool_result` with `isError: true` and the
|
|
650
|
+
* error `message` as content; throw a `ToolError` to carry a clean message or
|
|
651
|
+
* multimodal error content. #65 — an optional 2nd `ToolContext` argument
|
|
652
|
+
* carries the run's `AbortSignal`; single-argument handlers are unaffected. M7
|
|
653
|
+
* — the same `ctx` also carries an optional user `context` (provided once via
|
|
654
|
+
* `SendOptions.context`), so shared config like a `projectRoot` is read by
|
|
655
|
+
* every tool instead of baked into each factory. SE12 — `ctx.messages` is a
|
|
656
|
+
* read-only, text-only projection of the current turn's transcript (see
|
|
657
|
+
* {@link ToolContextMessage}); `defineSubAgent`'s `messageFilter` consumes it.
|
|
658
|
+
* #119 — `ctx.threadId` is the run's session identity (the key passed to
|
|
659
|
+
* `Agent.getOrCreate(sessionId, …)`, or the agent's own id), so a stateful tool
|
|
660
|
+
* shared across sessions can scope its state per session instead of leaking it.
|
|
661
|
+
*/
|
|
662
|
+
handler: (input: Record<string, unknown>, ctx?: {
|
|
663
|
+
signal?: AbortSignal;
|
|
664
|
+
context?: unknown;
|
|
665
|
+
messages?: readonly ToolContextMessage[];
|
|
666
|
+
threadId?: string;
|
|
667
|
+
}) => string | ToolResultContentBlock[] | Promise<string | ToolResultContentBlock[]>;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* How the permission engine treats the UNMATCHED verdict.
|
|
671
|
+
*
|
|
672
|
+
* - `default` — ask.
|
|
673
|
+
* - `plan` — read-only.
|
|
674
|
+
* - `acceptEdits` — auto-approve the unmatched verdict, but still honour an explicit `ask` rule.
|
|
675
|
+
* - `bypass` (alias `bypassPermissions`, the Anthropic-exact name) — everything allowed EXCEPT an
|
|
676
|
+
* explicit `deny`. Never asks.
|
|
677
|
+
*
|
|
678
|
+
* G7 / DIP — defined in this type leaf rather than in `permission-engine.ts`, which is a RUNTIME
|
|
679
|
+
* module. `types/agent.ts`, `types/run.ts` and `types/plugin.ts` all need the union, and each one
|
|
680
|
+
* used to reach into the engine for it: three of the nine violations the `types-dont-import-runtime`
|
|
681
|
+
* rule reported the moment it was able to see type-only edges at all. The engine re-exports it, so
|
|
682
|
+
* `import type { PermissionMode } from "@theokit/sdk"` is unchanged.
|
|
683
|
+
*
|
|
684
|
+
* @public
|
|
685
|
+
*/
|
|
686
|
+
type PermissionMode = "default" | "plan" | "acceptEdits" | "bypass" | "bypassPermissions";
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Owner: `internal/agent-loop/` (4 of 8 importers). Derived from the import graph, not
|
|
690
|
+
* declared — `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
691
|
+
*
|
|
692
|
+
*/
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Plain assistant message in a conversation history.
|
|
696
|
+
*
|
|
697
|
+
* @public
|
|
698
|
+
*/
|
|
699
|
+
interface AssistantMessage {
|
|
700
|
+
text: string;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Reasoning step in a conversation history.
|
|
704
|
+
*
|
|
705
|
+
* @public
|
|
706
|
+
*/
|
|
707
|
+
interface ThinkingMessage {
|
|
708
|
+
text: string;
|
|
709
|
+
thinkingDurationMs?: number;
|
|
710
|
+
/**
|
|
711
|
+
* theokit#122 — the provider's cryptographic signature for this thinking block, when it issued
|
|
712
|
+
* one. Persisted with the block so a resumed conversation can replay it byte-identically;
|
|
713
|
+
* Anthropic rejects a modified or unsigned thinking block with
|
|
714
|
+
* `400 "thinking blocks cannot be modified"`.
|
|
715
|
+
*/
|
|
716
|
+
signature?: string;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Shell command executed during a run.
|
|
720
|
+
*
|
|
721
|
+
* @public
|
|
722
|
+
*/
|
|
723
|
+
interface ShellCommand {
|
|
724
|
+
command: string;
|
|
725
|
+
workingDirectory?: string;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Output of a shell command.
|
|
729
|
+
*
|
|
730
|
+
* @public
|
|
731
|
+
*/
|
|
732
|
+
interface ShellOutput {
|
|
733
|
+
stdout: string;
|
|
734
|
+
stderr: string;
|
|
735
|
+
exitCode: number;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Result of a tool invocation. Pairs with the preceding `toolCall` step
|
|
739
|
+
* by `callId`. `isError: true` when the tool returned a failure result.
|
|
740
|
+
*
|
|
741
|
+
* T2.3 — added so `Run.conversation()` surfaces the full interaction
|
|
742
|
+
* including tool results (parity with OpenAI Agents `RunResult.new_items`).
|
|
743
|
+
*
|
|
744
|
+
* @public
|
|
745
|
+
*/
|
|
746
|
+
interface ToolResult {
|
|
747
|
+
callId: string;
|
|
748
|
+
name: string;
|
|
749
|
+
result: string;
|
|
750
|
+
isError: boolean;
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* A single step inside an agent turn, discriminated by `type`: an assistant message, a tool call, the
|
|
754
|
+
* tool result that pairs with it, or a thinking block.
|
|
755
|
+
*
|
|
756
|
+
* It reaches a caller by two routes that are NOT the same set. `Run.conversation()` returns the
|
|
757
|
+
* accumulated steps of a finished turn and includes `thinkingMessage`. `SendOptions.onStep` fires
|
|
758
|
+
* live while the turn runs and emits `assistantMessage`, `toolCall` and `toolResult` — but never
|
|
759
|
+
* `thinkingMessage`, which the loop builds only into the accumulated conversation. A UI that wants
|
|
760
|
+
* reasoning as it happens should read the `thinking-delta` / `thinking-completed` variants of
|
|
761
|
+
* `InteractionUpdate` through `onDelta` instead.
|
|
762
|
+
*
|
|
763
|
+
* `toolCall` and its `toolResult` arrive as an ordered pair matched by `callId`; a call whose result
|
|
764
|
+
* never came back has no `toolResult` step, so do not assume they alternate. Where a
|
|
765
|
+
* `thinkingMessage` exists it precedes the `assistantMessage` of the same turn — that is the order
|
|
766
|
+
* the provider requires of the message the block belongs to, not a presentation choice.
|
|
767
|
+
*
|
|
768
|
+
* @public
|
|
769
|
+
*/
|
|
770
|
+
type ConversationStep = {
|
|
771
|
+
type: "assistantMessage";
|
|
772
|
+
message: AssistantMessage;
|
|
773
|
+
} | {
|
|
774
|
+
type: "toolCall";
|
|
775
|
+
message: ToolCall;
|
|
776
|
+
} | {
|
|
777
|
+
type: "toolResult";
|
|
778
|
+
message: ToolResult;
|
|
779
|
+
} | {
|
|
780
|
+
type: "thinkingMessage";
|
|
781
|
+
message: ThinkingMessage;
|
|
782
|
+
};
|
|
783
|
+
/**
|
|
784
|
+
* Agent turn: user message + assistant/tool/thinking steps.
|
|
785
|
+
*
|
|
786
|
+
* @public
|
|
787
|
+
*/
|
|
788
|
+
interface AgentConversationTurn {
|
|
789
|
+
userMessage?: UserMessage;
|
|
790
|
+
steps: ConversationStep[];
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Shell turn: a command and its output.
|
|
794
|
+
*
|
|
795
|
+
* @public
|
|
796
|
+
*/
|
|
797
|
+
interface ShellConversationTurn {
|
|
798
|
+
shellCommand?: ShellCommand;
|
|
799
|
+
shellOutput?: ShellOutput;
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Structured per-turn view of a run.
|
|
803
|
+
*
|
|
804
|
+
* @public
|
|
805
|
+
*/
|
|
806
|
+
type ConversationTurn = {
|
|
807
|
+
type: "agentConversationTurn";
|
|
808
|
+
turn: AgentConversationTurn;
|
|
809
|
+
} | {
|
|
810
|
+
type: "shellConversationTurn";
|
|
811
|
+
turn: ShellConversationTurn;
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Owner: `sandbox/` (1 of 2 importers). Derived from the import graph, not
|
|
816
|
+
* declared — `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
817
|
+
*
|
|
818
|
+
* Child-process environment policy contract (#54).
|
|
819
|
+
*
|
|
820
|
+
* The DIP-correct home for the `EnvPolicy` contract type: the domain `types/`
|
|
821
|
+
* layer owns the contract, and the application-layer implementation
|
|
822
|
+
* (`internal/runtime/lifecycle/env-policy.ts`) re-exports it for back-compat
|
|
823
|
+
* while owning the runtime logic (`resolveChildEnv`, secret patterns, …).
|
|
824
|
+
*
|
|
825
|
+
* Modes:
|
|
826
|
+
* - `inherit-scrubbed` (DEFAULT) — inherit all parent vars EXCEPT secret-like
|
|
827
|
+
* names (`*KEY*`, `*SECRET*`, `*TOKEN*`, `*PASSWORD*`, `*_AUTH*`). Non-breaking:
|
|
828
|
+
* existing spawns keep every non-secret var; only secrets stop leaking.
|
|
829
|
+
* - `core` — inherit ONLY a safe base allowlist (PATH/HOME/…); strongest scrub.
|
|
830
|
+
* - `all` — explicit opt-out: inherit everything, secrets included.
|
|
831
|
+
*
|
|
832
|
+
* @public
|
|
833
|
+
*/
|
|
834
|
+
type EnvPolicy = "inherit-scrubbed" | "core" | "all";
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Owner: `internal/mcp/` (2 of 5 importers). Derived from the import graph, not declared —
|
|
838
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
839
|
+
*
|
|
840
|
+
*/
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* MCP server configuration accepted by `Agent.create()` and `agent.send()`.
|
|
844
|
+
*
|
|
845
|
+
* @public
|
|
846
|
+
*/
|
|
847
|
+
type McpStdioServerConfig = {
|
|
848
|
+
type?: "stdio";
|
|
849
|
+
command: string;
|
|
850
|
+
args?: string[];
|
|
851
|
+
env?: Record<string, string>;
|
|
852
|
+
/** Local agents only. Cloud rejects this field. */
|
|
853
|
+
cwd?: string;
|
|
854
|
+
/**
|
|
855
|
+
* #59 — per-request timeout in ms. A request that gets no reply within this
|
|
856
|
+
* window rejects with a typed `NetworkError` (`code: "mcp_timeout"`) instead
|
|
857
|
+
* of hanging the agent loop forever. Default 30_000.
|
|
858
|
+
*/
|
|
859
|
+
requestTimeoutMs?: number;
|
|
860
|
+
/**
|
|
861
|
+
* #54 — env inherit/scrub policy for the spawned MCP server process. Defaults
|
|
862
|
+
* to `"inherit-scrubbed"` (drop secret-like host vars: `*KEY*`/`*SECRET*`/
|
|
863
|
+
* `*TOKEN*`/`*PASSWORD*`/`*_AUTH*`/…) so a third-party MCP server binary cannot
|
|
864
|
+
* exfiltrate host secrets via the environment. `env` above is merged AFTER the
|
|
865
|
+
* policy and always wins. Pass `"all"` to restore full inheritance.
|
|
866
|
+
*/
|
|
867
|
+
envPolicy?: EnvPolicy;
|
|
868
|
+
};
|
|
869
|
+
/**
|
|
870
|
+
* OAuth-style auth bundle for HTTP/SSE MCP servers.
|
|
871
|
+
*
|
|
872
|
+
* @public
|
|
873
|
+
*/
|
|
874
|
+
interface McpAuthConfig {
|
|
875
|
+
CLIENT_ID: string;
|
|
876
|
+
CLIENT_SECRET?: string;
|
|
877
|
+
scopes?: string[];
|
|
878
|
+
/**
|
|
879
|
+
* OAuth 2.1 PKCE flow configuration (ADR D41, v1.2+). When present, the
|
|
880
|
+
* SDK runs the PKCE flow on first use and stores tokens via keychain or
|
|
881
|
+
* file. Without this, the SDK relies on `CLIENT_SECRET` + manual headers.
|
|
882
|
+
*/
|
|
883
|
+
oauth?: McpOAuthConfig;
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* OAuth 2.1 PKCE flow descriptor. See ADR D41.
|
|
887
|
+
*
|
|
888
|
+
* @public
|
|
889
|
+
*/
|
|
890
|
+
interface McpOAuthConfig {
|
|
891
|
+
/** Authorization endpoint (e.g. https://api.notion.com/v1/oauth/authorize). */
|
|
892
|
+
authorizationEndpoint: string;
|
|
893
|
+
/** Token endpoint (e.g. https://api.notion.com/v1/oauth/token). */
|
|
894
|
+
tokenEndpoint: string;
|
|
895
|
+
/** Where the OAuth `code` is received. */
|
|
896
|
+
redirectMode: "manual" | "localhost";
|
|
897
|
+
/** Localhost callback port (0 = random free port, default). */
|
|
898
|
+
localhostPort?: number;
|
|
899
|
+
/** Flow timeout in ms (default 300_000 = 5min). */
|
|
900
|
+
timeoutMs?: number;
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* HTTP or SSE MCP server.
|
|
904
|
+
*
|
|
905
|
+
* @public
|
|
906
|
+
*/
|
|
907
|
+
type McpHttpServerConfig = {
|
|
908
|
+
type?: "http" | "sse";
|
|
909
|
+
url: string;
|
|
910
|
+
/** Passed through. `Authorization` works here. */
|
|
911
|
+
headers?: Record<string, string>;
|
|
912
|
+
auth?: McpAuthConfig;
|
|
913
|
+
/**
|
|
914
|
+
* #59 — per-request timeout in ms, enforced via `AbortSignal.timeout`. A
|
|
915
|
+
* fetch that does not respond within this window rejects with a typed
|
|
916
|
+
* `NetworkError` (`code: "mcp_timeout"`). Default 30_000.
|
|
917
|
+
*/
|
|
918
|
+
requestTimeoutMs?: number;
|
|
919
|
+
};
|
|
920
|
+
/**
|
|
921
|
+
* Union of MCP server configs.
|
|
922
|
+
*
|
|
923
|
+
* @public
|
|
924
|
+
*/
|
|
925
|
+
type McpServerConfig = McpStdioServerConfig | McpHttpServerConfig;
|
|
926
|
+
|
|
927
|
+
/**
|
|
928
|
+
* Owner: `internal/agent-loop/` (4 of 16 importers). Derived from the import graph, not declared —
|
|
929
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
930
|
+
*
|
|
931
|
+
*/
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Tool invocation block emitted by the assistant.
|
|
935
|
+
*
|
|
936
|
+
* @public
|
|
937
|
+
*/
|
|
938
|
+
interface ToolUseBlock {
|
|
939
|
+
type: "tool_use";
|
|
940
|
+
id: string;
|
|
941
|
+
name: string;
|
|
942
|
+
/** Tool args are not part of the stable schema. Treat as unknown and parse defensively. */
|
|
943
|
+
input: unknown;
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Init metadata. Emitted once at the start of a run.
|
|
947
|
+
*
|
|
948
|
+
* @public
|
|
949
|
+
*/
|
|
950
|
+
interface SDKSystemMessage {
|
|
951
|
+
type: "system";
|
|
952
|
+
subtype?: "init";
|
|
953
|
+
agent_id: string;
|
|
954
|
+
run_id: string;
|
|
955
|
+
model?: ModelSelection;
|
|
956
|
+
tools?: string[];
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Echo of the user prompt for this run.
|
|
960
|
+
*
|
|
961
|
+
* @public
|
|
962
|
+
*/
|
|
963
|
+
interface SDKUserMessageEvent {
|
|
964
|
+
type: "user";
|
|
965
|
+
agent_id: string;
|
|
966
|
+
run_id: string;
|
|
967
|
+
message: {
|
|
968
|
+
role: "user";
|
|
969
|
+
content: TextBlock[];
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Model text output for this run.
|
|
974
|
+
*
|
|
975
|
+
* @public
|
|
976
|
+
*/
|
|
977
|
+
interface SDKAssistantMessage {
|
|
978
|
+
type: "assistant";
|
|
979
|
+
agent_id: string;
|
|
980
|
+
run_id: string;
|
|
981
|
+
message: {
|
|
982
|
+
role: "assistant";
|
|
983
|
+
content: Array<TextBlock | ToolUseBlock>;
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Reasoning content.
|
|
988
|
+
*
|
|
989
|
+
* @public
|
|
990
|
+
*/
|
|
991
|
+
interface SDKThinkingMessage {
|
|
992
|
+
type: "thinking";
|
|
993
|
+
agent_id: string;
|
|
994
|
+
run_id: string;
|
|
995
|
+
text: string;
|
|
996
|
+
thinking_duration_ms?: number;
|
|
997
|
+
/**
|
|
998
|
+
* theokit#122 — the provider's cryptographic signature for this thinking block, when it issued
|
|
999
|
+
* one. Anthropic requires a resumed conversation to replay each thinking block WITH its
|
|
1000
|
+
* signature; without it the next request fails with `400 "thinking blocks cannot be modified"`,
|
|
1001
|
+
* which made an extended-thinking session unresumable.
|
|
1002
|
+
*
|
|
1003
|
+
* Absent for providers that stream reasoning text unsigned (the OpenAI-compatible wire).
|
|
1004
|
+
*/
|
|
1005
|
+
signature?: string;
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Tool invocation lifecycle event. Emitted at start with `args`, then again on
|
|
1009
|
+
* completion with `result`.
|
|
1010
|
+
*
|
|
1011
|
+
* Tool `args` and `result` are NOT part of the stable schema — treat as unknown.
|
|
1012
|
+
*
|
|
1013
|
+
* @public
|
|
1014
|
+
*/
|
|
1015
|
+
interface SDKToolUseMessage {
|
|
1016
|
+
type: "tool_call";
|
|
1017
|
+
agent_id: string;
|
|
1018
|
+
run_id: string;
|
|
1019
|
+
call_id: string;
|
|
1020
|
+
name: string;
|
|
1021
|
+
status: "running" | "completed" | "error";
|
|
1022
|
+
args?: unknown;
|
|
1023
|
+
result?: unknown;
|
|
1024
|
+
truncated?: {
|
|
1025
|
+
args?: boolean;
|
|
1026
|
+
result?: boolean;
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Cloud run lifecycle transitions.
|
|
1031
|
+
*
|
|
1032
|
+
* @public
|
|
1033
|
+
*/
|
|
1034
|
+
interface SDKStatusMessage {
|
|
1035
|
+
type: "status";
|
|
1036
|
+
agent_id: string;
|
|
1037
|
+
run_id: string;
|
|
1038
|
+
status: "CREATING" | "RUNNING" | "FINISHED" | "ERROR" | "CANCELLED" | "EXPIRED";
|
|
1039
|
+
message?: string;
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Task-level milestones and summaries.
|
|
1043
|
+
*
|
|
1044
|
+
* @public
|
|
1045
|
+
*/
|
|
1046
|
+
interface SDKTaskMessage {
|
|
1047
|
+
type: "task";
|
|
1048
|
+
agent_id: string;
|
|
1049
|
+
run_id: string;
|
|
1050
|
+
status?: string;
|
|
1051
|
+
text?: string;
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Awaiting user input or approval.
|
|
1055
|
+
*
|
|
1056
|
+
* @public
|
|
1057
|
+
*/
|
|
1058
|
+
interface SDKRequestMessage {
|
|
1059
|
+
type: "request";
|
|
1060
|
+
agent_id: string;
|
|
1061
|
+
run_id: string;
|
|
1062
|
+
request_id: string;
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Partial object emitted during `Agent.streamObject<T>` streaming (ADR D45).
|
|
1066
|
+
* `partial` is `DeepPartial<z.infer<T>>` at the typed iterator level but
|
|
1067
|
+
* erased to `unknown` here because SDKMessage union is non-generic.
|
|
1068
|
+
*
|
|
1069
|
+
* @public
|
|
1070
|
+
*/
|
|
1071
|
+
interface SDKObjectDelta {
|
|
1072
|
+
type: "object_delta";
|
|
1073
|
+
agent_id: string;
|
|
1074
|
+
run_id: string;
|
|
1075
|
+
partial: unknown;
|
|
1076
|
+
attempt: number;
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Discriminated union of all stream events. Discriminate on `type`.
|
|
1080
|
+
*
|
|
1081
|
+
* All events include `agent_id` and `run_id`.
|
|
1082
|
+
*
|
|
1083
|
+
* @public
|
|
1084
|
+
*/
|
|
1085
|
+
type SDKMessage = SDKSystemMessage | SDKUserMessageEvent | SDKAssistantMessage | SDKThinkingMessage | SDKToolUseMessage | SDKStatusMessage | SDKTaskMessage | SDKRequestMessage | SDKObjectDelta;
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* Owner: `internal/budget/` (3 of 8 importers). Derived from the import graph, not declared —
|
|
1089
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
1090
|
+
*
|
|
1091
|
+
* Public type contract for token usage + cost tracking (ADRs D376-D379).
|
|
1092
|
+
*
|
|
1093
|
+
* Surfaces via `RunResult.usage` + `RunResult.cost` after every Run.
|
|
1094
|
+
* Re-exported through the package barrel; consumers import from
|
|
1095
|
+
* `@theokit/sdk`.
|
|
1096
|
+
*
|
|
1097
|
+
* @public
|
|
1098
|
+
*/
|
|
1099
|
+
/**
|
|
1100
|
+
* Token usage observed during a Run. 5 closed buckets (D376) cover
|
|
1101
|
+
* 100% of providers in 2026: OpenAI Chat / OpenAI Responses (o-series
|
|
1102
|
+
* with reasoning) / Anthropic Messages (with prompt caching).
|
|
1103
|
+
*
|
|
1104
|
+
* `totalTokens` is derived (`inputTokens + outputTokens`); EC-10
|
|
1105
|
+
* invariant: SDK must never emit `totalTokens !== inputTokens + outputTokens`.
|
|
1106
|
+
*
|
|
1107
|
+
* `requests[]` is the per-request breakdown (mirror a peer SDK)
|
|
1108
|
+
* — populated only when the run made > 1 LLM call.
|
|
1109
|
+
*/
|
|
1110
|
+
interface TokenUsage {
|
|
1111
|
+
readonly inputTokens: number;
|
|
1112
|
+
readonly outputTokens: number;
|
|
1113
|
+
readonly cacheReadTokens?: number;
|
|
1114
|
+
readonly cacheWriteTokens?: number;
|
|
1115
|
+
readonly reasoningTokens?: number;
|
|
1116
|
+
readonly totalTokens: number;
|
|
1117
|
+
/** Per-request breakdown; absent when the run made a single LLM call. */
|
|
1118
|
+
readonly requests?: ReadonlyArray<Omit<TokenUsage, "requests">>;
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Cost confidence level (D377).
|
|
1122
|
+
* - `actual`: returned by a provider billing API (e.g. OpenRouter `/generation`).
|
|
1123
|
+
* - `estimated`: computed from bundled pricing snapshot.
|
|
1124
|
+
* - `included`: subscription-included route (Codex CLI, Claude Pro).
|
|
1125
|
+
* - `unknown`: pricing data unavailable; `amountUsd` is undefined.
|
|
1126
|
+
*/
|
|
1127
|
+
type CostStatus = "actual" | "estimated" | "included" | "unknown";
|
|
1128
|
+
/** Source of the cost figure for caller-side audit. */
|
|
1129
|
+
type CostSource = "openrouter_api" | "litellm_snapshot" | "user_override" | "subscription_included" | "unknown";
|
|
1130
|
+
/**
|
|
1131
|
+
* Cost breakdown attached to `RunResult.cost`. When `status === "unknown"`,
|
|
1132
|
+
* `amountUsd` is `undefined` — DO NOT default to 0 (a lie). The UI shows
|
|
1133
|
+
* `n/a` for unknown, `~$1.23` for estimated, `$1.23` for actual.
|
|
1134
|
+
*/
|
|
1135
|
+
interface CostBreakdown {
|
|
1136
|
+
readonly amountUsd: number | undefined;
|
|
1137
|
+
readonly status: CostStatus;
|
|
1138
|
+
readonly currency: "USD";
|
|
1139
|
+
readonly source: CostSource;
|
|
1140
|
+
readonly pricingVersion: string | undefined;
|
|
1141
|
+
readonly notes?: ReadonlyArray<string>;
|
|
1142
|
+
/** Per-bucket detail (in USD) for caller analytics. */
|
|
1143
|
+
readonly detail?: {
|
|
1144
|
+
readonly input?: number;
|
|
1145
|
+
readonly output?: number;
|
|
1146
|
+
readonly cacheRead?: number;
|
|
1147
|
+
readonly cacheWrite?: number;
|
|
1148
|
+
readonly reasoning?: number;
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* Options for the tool-result guard (spotlighting + PII redaction on tool
|
|
1154
|
+
* output). Contract type owned by `types/` (SE45 / D435) — the implementation
|
|
1155
|
+
* lives in `internal/agent-loop/tool-result-guard.ts`, which re-exports this.
|
|
1156
|
+
*
|
|
1157
|
+
* @public
|
|
1158
|
+
*/
|
|
1159
|
+
interface ToolResultGuardOptions {
|
|
1160
|
+
/** Wrap tool-result content in explicit data boundaries (spotlighting). */
|
|
1161
|
+
delimit?: boolean;
|
|
1162
|
+
/** Redact common PII patterns (email, phone) in tool-result content. */
|
|
1163
|
+
redactPii?: boolean;
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Lifecycle status of a {@link Run}.
|
|
1167
|
+
*
|
|
1168
|
+
* @public
|
|
1169
|
+
*/
|
|
1170
|
+
type RunStatus = "running" | "finished" | "error" | "cancelled";
|
|
1171
|
+
/**
|
|
1172
|
+
* Operations that may or may not be supported on a given {@link Run}, or on
|
|
1173
|
+
* its parent agent.
|
|
1174
|
+
*
|
|
1175
|
+
* Runtime-specific availability — query at runtime with `run.supports(op)` and
|
|
1176
|
+
* read the human reason via `run.unsupportedReason(op)`.
|
|
1177
|
+
*
|
|
1178
|
+
* @public
|
|
1179
|
+
*/
|
|
1180
|
+
type RunOperation = "stream" | "wait" | "cancel" | "conversation" | "listArtifacts" | "downloadArtifact" | "runUntil" | "runToCompletion" | "streamToCompletion" | "fork" | "usePersonality" | "workflow";
|
|
1181
|
+
/**
|
|
1182
|
+
* Git metadata attached to cloud runs.
|
|
1183
|
+
*
|
|
1184
|
+
* @public
|
|
1185
|
+
*/
|
|
1186
|
+
interface RunGitInfo {
|
|
1187
|
+
branches: Array<{
|
|
1188
|
+
repoUrl: string;
|
|
1189
|
+
branch?: string;
|
|
1190
|
+
prUrl?: string;
|
|
1191
|
+
}>;
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* SE3 — provenance of the turn that produced a run: WHO triggered it. Metadata-only —
|
|
1195
|
+
* it never changes routing or dispatch. Stamped in the multi-agent path (Squad / a2a /
|
|
1196
|
+
* handoff / background-delegation) and forwarded onto {@link RunResult.origin}, so
|
|
1197
|
+
* consumers can attribute/route turns by their trigger; discriminate on `kind`. Mirrors
|
|
1198
|
+
* the Anthropic Agent SDK's `origin` shape.
|
|
1199
|
+
*
|
|
1200
|
+
* Producers: `peer` (Squad step / a2a envelope), `coordinator` (subagent delegation) and
|
|
1201
|
+
* `auto-continuation` (the run-to-completion / stream-to-completion driver's continuation
|
|
1202
|
+
* rounds) are stamped BY the SDK. `human` and `task-notification` are positive markers a
|
|
1203
|
+
* HOST stamps (e.g. re-sending an agent after a background task completed).
|
|
1204
|
+
*
|
|
1205
|
+
* Encoding note (distinct from absence): an ABSENT origin (`undefined`) means the
|
|
1206
|
+
* provenance was NOT stamped — the default for a plain `agent.send()`. The explicit
|
|
1207
|
+
* `{ kind: "human" }` is a positive marker a HOST stamps to say "this turn is
|
|
1208
|
+
* definitely from a human" (e.g. to distinguish a real user message from an
|
|
1209
|
+
* un-attributed one in an audit UI). The two are not interchangeable: `undefined`
|
|
1210
|
+
* = unknown/unstamped; `{ kind: "human" }` = explicitly human. Consumers writing an
|
|
1211
|
+
* exhaustive `switch (origin?.kind)` therefore handle `undefined` (unstamped) and
|
|
1212
|
+
* `"human"` (explicit) as separate, meaningful cases.
|
|
1213
|
+
*
|
|
1214
|
+
* @public
|
|
1215
|
+
*/
|
|
1216
|
+
type MessageOrigin =
|
|
1217
|
+
/** Explicitly a human-triggered turn — a positive marker a host stamps (NOT the
|
|
1218
|
+
* same as an absent/unstamped origin, which is `undefined`). */
|
|
1219
|
+
{
|
|
1220
|
+
readonly kind: "human";
|
|
1221
|
+
}
|
|
1222
|
+
/** Another agent (a Squad peer or an a2a sender) triggered this turn. */
|
|
1223
|
+
| {
|
|
1224
|
+
readonly kind: "peer";
|
|
1225
|
+
readonly from: string;
|
|
1226
|
+
}
|
|
1227
|
+
/** A background task's completion re-entered the agent as a follow-up turn. */
|
|
1228
|
+
| {
|
|
1229
|
+
readonly kind: "task-notification";
|
|
1230
|
+
}
|
|
1231
|
+
/** A delegating/handoff coordinator triggered this turn. `from` is the coordinator's
|
|
1232
|
+
* id when known, omitted for an anonymous coordinator. */
|
|
1233
|
+
| {
|
|
1234
|
+
readonly kind: "coordinator";
|
|
1235
|
+
readonly from?: string;
|
|
1236
|
+
}
|
|
1237
|
+
/** The loop's continuation driver re-sent to continue truncated work. */
|
|
1238
|
+
| {
|
|
1239
|
+
readonly kind: "auto-continuation";
|
|
1240
|
+
};
|
|
1241
|
+
/**
|
|
1242
|
+
* Terminal result of a {@link Run}.
|
|
1243
|
+
*
|
|
1244
|
+
* @public
|
|
1245
|
+
*/
|
|
1246
|
+
interface RunResult {
|
|
1247
|
+
id: string;
|
|
1248
|
+
status: "finished" | "error" | "cancelled";
|
|
1249
|
+
result?: string;
|
|
1250
|
+
/**
|
|
1251
|
+
* SE24 — set when a guardrail processor called `abort()`. The run stops
|
|
1252
|
+
* (`status: "cancelled"`) and `tripwire` carries the blocking reason +
|
|
1253
|
+
* processor id. `undefined` on every non-guardrail outcome. A
|
|
1254
|
+
* `throwOnError: true` agent resolves normally on a tripwire (status is
|
|
1255
|
+
* `"cancelled"`, not `"error"`). On an OUTPUT block the model already ran, so
|
|
1256
|
+
* `usage`/`cost` survive (billing) while `result` is suppressed; an INPUT
|
|
1257
|
+
* block never reaches the model, so `usage` is absent.
|
|
1258
|
+
*
|
|
1259
|
+
* @public
|
|
1260
|
+
*/
|
|
1261
|
+
tripwire?: ProcessorTripwire;
|
|
1262
|
+
model?: ModelSelection;
|
|
1263
|
+
durationMs?: number;
|
|
1264
|
+
git?: RunGitInfo;
|
|
1265
|
+
/**
|
|
1266
|
+
* SE3 — provenance forwarded from {@link SendOptions.origin}: who triggered
|
|
1267
|
+
* this turn (human / peer / task-notification / coordinator / auto-continuation).
|
|
1268
|
+
* `undefined` means the provenance was not stamped (a plain `agent.send()`).
|
|
1269
|
+
* Metadata-only — never affects routing.
|
|
1270
|
+
*
|
|
1271
|
+
* @public
|
|
1272
|
+
*/
|
|
1273
|
+
origin?: MessageOrigin;
|
|
1274
|
+
/**
|
|
1275
|
+
* Structured error detail, populated when `status === "error"`. Surfaces
|
|
1276
|
+
* the diagnostic that emit-error-event pushes into the stream so callers
|
|
1277
|
+
* that don't drain `run.stream()` still get the cause via `run.wait()`.
|
|
1278
|
+
*
|
|
1279
|
+
* For successful runs (`status: "finished"`) this is undefined.
|
|
1280
|
+
*
|
|
1281
|
+
* @public
|
|
1282
|
+
*/
|
|
1283
|
+
error?: RunErrorDetail;
|
|
1284
|
+
/**
|
|
1285
|
+
* Token usage observed for this run (ADR D376). Populated in every
|
|
1286
|
+
* status where ≥1 LLM call COMPLETED — including partial-failure
|
|
1287
|
+
* runs (EC-5). `undefined` when zero LLM calls executed (e.g. an
|
|
1288
|
+
* abort before send) and, for the same reason, when the only call was
|
|
1289
|
+
* cut mid-stream: the counts arrive with the provider's terminating
|
|
1290
|
+
* frame, which a severed connection never delivers. Such a run can
|
|
1291
|
+
* therefore return partial text (#371) with no usage to bill it
|
|
1292
|
+
* against — the tokens were generated and are not reported here.
|
|
1293
|
+
*
|
|
1294
|
+
* @public
|
|
1295
|
+
*/
|
|
1296
|
+
usage?: TokenUsage;
|
|
1297
|
+
/**
|
|
1298
|
+
* Estimated/actual USD cost for this run (ADR D377). Always paired
|
|
1299
|
+
* with `usage` when populated. `cost.status` tells caller how to
|
|
1300
|
+
* trust the figure.
|
|
1301
|
+
*
|
|
1302
|
+
* @public
|
|
1303
|
+
*/
|
|
1304
|
+
cost?: CostBreakdown;
|
|
1305
|
+
/**
|
|
1306
|
+
* M1-2: `true` when the run stopped because the agent loop hit its iteration
|
|
1307
|
+
* ceiling (`SendOptions.maxIterations` or the default of 8) while the model
|
|
1308
|
+
* still wanted to call tools — i.e. the work was silently truncated rather
|
|
1309
|
+
* than finished. `undefined`/absent on a clean finish. A continuation driver
|
|
1310
|
+
* (or a careful caller) inspects this to decide whether to send again.
|
|
1311
|
+
*
|
|
1312
|
+
* @public
|
|
1313
|
+
*/
|
|
1314
|
+
stoppedAtIterationLimit?: boolean;
|
|
1315
|
+
/**
|
|
1316
|
+
* `true` when the run stopped because the **doom-loop guard** detected the model repeating
|
|
1317
|
+
* IDENTICAL tool calls (same name + same input) to the hard threshold — making no progress (e.g.
|
|
1318
|
+
* a tool that keeps failing and is retried unchanged). `undefined`/absent otherwise. Through the
|
|
1319
|
+
* continuation driver this surfaces as `terminal: "no_progress"` (a controlled stop, NOT a
|
|
1320
|
+
* truncation to re-send). Tune or disable via {@link SendOptions.doomLoop}.
|
|
1321
|
+
*
|
|
1322
|
+
* @public
|
|
1323
|
+
*/
|
|
1324
|
+
stoppedByDoomLoop?: boolean;
|
|
1325
|
+
/**
|
|
1326
|
+
* SE34 — the per-send completion verdict, populated when
|
|
1327
|
+
* {@link SendOptions.completionCheck} was set AND the run finished. Absent on
|
|
1328
|
+
* non-finished runs and when no completion check was requested. Reuses the
|
|
1329
|
+
* shipped LLM-as-judge (same one `runUntil` drives). @public
|
|
1330
|
+
*/
|
|
1331
|
+
completionCheck?: CompletionCheckResult;
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Doom-loop guard thresholds (see {@link SendOptions.doomLoop}). Both are counts of CONSECUTIVE
|
|
1335
|
+
* identical tool calls: `softThreshold` injects a one-time guidance nudge; `hardThreshold` stops.
|
|
1336
|
+
*
|
|
1337
|
+
* @public
|
|
1338
|
+
*/
|
|
1339
|
+
interface DoomLoopThresholds {
|
|
1340
|
+
/** Consecutive-identical count at which a one-time guidance nudge is injected. Default 3. */
|
|
1341
|
+
softThreshold?: number;
|
|
1342
|
+
/** Consecutive-identical count at which the run stops (`no_progress`). Default 5. */
|
|
1343
|
+
hardThreshold?: number;
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Options for {@link SDKAgent.runToCompletion} (M1 Phase 3 — continuation driver).
|
|
1347
|
+
*
|
|
1348
|
+
* @public
|
|
1349
|
+
*/
|
|
1350
|
+
interface RunToCompletionOptions {
|
|
1351
|
+
/**
|
|
1352
|
+
* Maximum number of continuation rounds (re-sends) before giving up with
|
|
1353
|
+
* `terminal: "step_limit"`. Default 5. A hard ceiling that prevents a
|
|
1354
|
+
* runaway loop when the model keeps truncating.
|
|
1355
|
+
*/
|
|
1356
|
+
maxRounds?: number;
|
|
1357
|
+
/**
|
|
1358
|
+
* The short prompt re-sent after a truncated round to make the (stateful)
|
|
1359
|
+
* agent resume. Defaults to a generic "continue" instruction. The original
|
|
1360
|
+
* conversation is preserved by the agent's session, so this need not repeat
|
|
1361
|
+
* the task.
|
|
1362
|
+
*/
|
|
1363
|
+
continuationPrompt?: string;
|
|
1364
|
+
/** Called once per truncated round that triggers a re-send (for metrics/logging). */
|
|
1365
|
+
onTruncated?: (event: {
|
|
1366
|
+
round: number;
|
|
1367
|
+
}) => void | Promise<void>;
|
|
1368
|
+
/** Abort signal; checked between rounds — once aborted, no further round starts. */
|
|
1369
|
+
signal?: AbortSignal;
|
|
1370
|
+
/** Per-send options forwarded to each underlying `send()` (e.g. `maxIterations`). */
|
|
1371
|
+
sendOptions?: SendOptions;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Result of {@link SDKAgent.runToCompletion}.
|
|
1375
|
+
*
|
|
1376
|
+
* @public
|
|
1377
|
+
*/
|
|
1378
|
+
interface RunToCompletionResult {
|
|
1379
|
+
/**
|
|
1380
|
+
* Why the driver stopped:
|
|
1381
|
+
* - `"done"` — a round finished without truncating (the model is done).
|
|
1382
|
+
* - `"step_limit"` — `maxRounds` exhausted (or aborted) while still truncating.
|
|
1383
|
+
* - `"no_progress"` — two consecutive rounds produced empty output.
|
|
1384
|
+
*/
|
|
1385
|
+
terminal: "done" | "step_limit" | "no_progress";
|
|
1386
|
+
/**
|
|
1387
|
+
* Index of the final round. Round 0 is the initial `send`; rounds ≥ 1 are
|
|
1388
|
+
* continuation re-sends. So `terminal: "done"` with `rounds: 0` means the
|
|
1389
|
+
* first send finished without truncating; `rounds: N` means N continuation
|
|
1390
|
+
* re-sends happened. For `step_limit`, `rounds` equals `maxRounds`.
|
|
1391
|
+
*/
|
|
1392
|
+
rounds: number;
|
|
1393
|
+
/** The `RunResult` of the final round. */
|
|
1394
|
+
lastResult: RunResult;
|
|
1395
|
+
/** Token usage summed across all rounds; `undefined` when no round reported usage. */
|
|
1396
|
+
usage?: TokenUsage;
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* Result of {@link SDKAgent.streamToCompletion} (V3-4 — the STREAMING continuation
|
|
1400
|
+
* driver). Same shape + terminal semantics as {@link RunToCompletionResult}; it is
|
|
1401
|
+
* the generator's RETURN value (read it via a manual `gen.next()` loop — a plain
|
|
1402
|
+
* `for await...of` consumes the yielded `SDKMessage`s but discards this return value).
|
|
1403
|
+
*
|
|
1404
|
+
* @public
|
|
1405
|
+
*/
|
|
1406
|
+
type StreamToCompletionResult = RunToCompletionResult;
|
|
1407
|
+
/**
|
|
1408
|
+
* Structured error attached to a {@link RunResult} when the underlying run
|
|
1409
|
+
* transitioned to `"error"` status. `message` is always present; `code` is
|
|
1410
|
+
* a stable identifier suitable for branching (e.g. `"llm_4xx"`,
|
|
1411
|
+
* `"tool_dispatch_failed"`, `"mcp_init_failed"`); `cause` is the raw error
|
|
1412
|
+
* for further inspection when available.
|
|
1413
|
+
*
|
|
1414
|
+
* @public
|
|
1415
|
+
*/
|
|
1416
|
+
interface RunErrorDetail {
|
|
1417
|
+
message: string;
|
|
1418
|
+
code?: string;
|
|
1419
|
+
cause?: unknown;
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* Dimensions of an inline image attachment.
|
|
1423
|
+
*
|
|
1424
|
+
* @public
|
|
1425
|
+
*/
|
|
1426
|
+
interface SDKImageDimension {
|
|
1427
|
+
width: number;
|
|
1428
|
+
height: number;
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Either a remote URL or inline base64 payload.
|
|
1432
|
+
*
|
|
1433
|
+
* @public
|
|
1434
|
+
*/
|
|
1435
|
+
type SDKImage = {
|
|
1436
|
+
url: string;
|
|
1437
|
+
dimension?: SDKImageDimension;
|
|
1438
|
+
} | {
|
|
1439
|
+
data: string;
|
|
1440
|
+
mimeType: string;
|
|
1441
|
+
dimension?: SDKImageDimension;
|
|
1442
|
+
};
|
|
1443
|
+
/**
|
|
1444
|
+
* Structured form of `agent.send()`'s message argument. Use it to send images
|
|
1445
|
+
* alongside text.
|
|
1446
|
+
*
|
|
1447
|
+
* @public
|
|
1448
|
+
*/
|
|
1449
|
+
interface SDKUserMessage {
|
|
1450
|
+
text: string;
|
|
1451
|
+
images?: SDKImage[];
|
|
1452
|
+
}
|
|
1453
|
+
/**
|
|
1454
|
+
* Per-send overrides and callbacks.
|
|
1455
|
+
*
|
|
1456
|
+
* ## Which options do I need?
|
|
1457
|
+
*
|
|
1458
|
+
* Twenty-one optional fields with genuinely different audiences, so most callers read all of them to
|
|
1459
|
+
* find their two. This table is the fix that was chosen; the alternative — nesting the groups under
|
|
1460
|
+
* `observe?` and `toolPolicy?` and carrying the flat keys as deprecated aliases for one major — would
|
|
1461
|
+
* have added surface to remove surface, and the harm here is the READING cost, not a representable
|
|
1462
|
+
* illegal state. There is no measured defect behind this grouping and no consumer census; the fields
|
|
1463
|
+
* and the audiences are what was measured.
|
|
1464
|
+
*
|
|
1465
|
+
* | If you are… | you want |
|
|
1466
|
+
* |---|---|
|
|
1467
|
+
* | rendering a live UI | `onDelta`, `onStep`, `onRunEvent` |
|
|
1468
|
+
* | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `perToolTimeoutMs` |
|
|
1469
|
+
* | running an eval or a harness | `maxIterations`, `completionCheck`, `doomLoop`, `signal` |
|
|
1470
|
+
* | orchestrating agents | `origin`, `task`, `context` |
|
|
1471
|
+
* | overriding this one send | `model`, `systemPrompt`, `tools`, `mcpServers`, `contextPaths`, `local` |
|
|
1472
|
+
*
|
|
1473
|
+
* Every field appears in exactly one row, and
|
|
1474
|
+
* `tests/lint/send-options-audience-table.test.ts` fails when one is added without a row — a table
|
|
1475
|
+
* that silently stops covering the type is worse than none, because a reader trusts it and stops
|
|
1476
|
+
* looking.
|
|
1477
|
+
*
|
|
1478
|
+
* @public
|
|
1479
|
+
*/
|
|
1480
|
+
interface SendOptions {
|
|
1481
|
+
/**
|
|
1482
|
+
* Per-send model override. SE8 — accepts a bare-string id shorthand
|
|
1483
|
+
* (`"openai/gpt-4o-mini"`, normalized to `{ id }`) OR a {@link ModelSelection}
|
|
1484
|
+
* object (use the object form to pass `params`).
|
|
1485
|
+
*/
|
|
1486
|
+
model?: string | ModelSelection;
|
|
1487
|
+
/**
|
|
1488
|
+
* SE3 — provenance of this turn (who triggered it). Stamped by the multi-agent
|
|
1489
|
+
* path (Squad peer, a2a sender, coordinator/handoff, background task-notification)
|
|
1490
|
+
* and forwarded onto {@link RunResult.origin}. Metadata-only — the value never
|
|
1491
|
+
* changes routing or dispatch. Omit to leave the turn un-attributed; a host may
|
|
1492
|
+
* pass `{ kind: "human" }` to positively mark a human turn.
|
|
1493
|
+
*/
|
|
1494
|
+
origin?: MessageOrigin;
|
|
1495
|
+
/**
|
|
1496
|
+
* SE2 — opt-in typed runtime-EVENT sink. Receives out-of-band `RunEvent`s
|
|
1497
|
+
* (permission_denied, tool_progress, rate_limit, task_*, compact_boundary) for
|
|
1498
|
+
* observability, ADDITIVE to the `SDKMessage` content stream. Best-effort: a
|
|
1499
|
+
* throwing sink never breaks the run. Discriminate on `event.type`.
|
|
1500
|
+
*/
|
|
1501
|
+
onRunEvent?: RunEventSink;
|
|
1502
|
+
/**
|
|
1503
|
+
* Doom-loop guard config. The loop stops (with `terminal: "no_progress"`, `RunResult.stoppedByDoomLoop`)
|
|
1504
|
+
* when the model repeats IDENTICAL tool calls to the hard threshold. On by default with generous
|
|
1505
|
+
* thresholds (soft 3 / hard 5). Set `false` to disable, or an object to tune the thresholds.
|
|
1506
|
+
*/
|
|
1507
|
+
doomLoop?: false | DoomLoopThresholds;
|
|
1508
|
+
/**
|
|
1509
|
+
* Per-call system prompt override. Wins over `AgentOptions.systemPrompt`.
|
|
1510
|
+
* String only — for dynamic resolvers, configure on `AgentOptions`. An
|
|
1511
|
+
* empty string is honoured (it explicitly clears the system context).
|
|
1512
|
+
*/
|
|
1513
|
+
systemPrompt?: string;
|
|
1514
|
+
/** Fully replaces creation-time servers for this run (not merged). */
|
|
1515
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
1516
|
+
/**
|
|
1517
|
+
* Per-call inline custom tools. Fully replaces `AgentOptions.tools` for
|
|
1518
|
+
* this run (not merged). Local runtime only — cloud agents reject any
|
|
1519
|
+
* non-empty per-call tools array with the same error code as creation
|
|
1520
|
+
* (`cloud_custom_tools_rejected`). Semantics:
|
|
1521
|
+
* - `undefined` → fall back to `AgentOptions.tools`
|
|
1522
|
+
* - `[]` → explicitly clear (no custom tools for this run)
|
|
1523
|
+
* - `[t1, t2]` → use exactly these tools for this run
|
|
1524
|
+
*/
|
|
1525
|
+
tools?: CustomTool[];
|
|
1526
|
+
/**
|
|
1527
|
+
* The set of repo-relative file paths in scope for THIS send (local runtime).
|
|
1528
|
+
* Declares "which files am I working on" so path-scoped rule files
|
|
1529
|
+
* (`.theokit/rules/*.md` with `paths:`/`globs:`, and `.cursor/rules/*.mdc`
|
|
1530
|
+
* globs) activate when a pattern matches one of these paths. `alwaysApply`
|
|
1531
|
+
* rules load regardless. Omit ⇒ only unconditional rules load (the create-time
|
|
1532
|
+
* snapshot is untouched). Matching is glob-based (`**`, `*`, `?`).
|
|
1533
|
+
*/
|
|
1534
|
+
contextPaths?: readonly string[];
|
|
1535
|
+
/**
|
|
1536
|
+
* SE1 — the permission mode for THIS run, threaded to a registered
|
|
1537
|
+
* `PermissionPlugin`'s pre-tool gate. Precedence: this per-send value wins over
|
|
1538
|
+
* `AgentOptions.permissionMode` (creation-time default). Modes: `default` (rules
|
|
1539
|
+
* decide; unmatched ⇒ fail-closed ask), `plan` (read-only — allow rules pass,
|
|
1540
|
+
* everything else denied), `acceptEdits` (auto-approve unmatched, honor explicit
|
|
1541
|
+
* ask rules), `bypass` / `bypassPermissions` (allow all except an explicit deny).
|
|
1542
|
+
* Absent ⇒ the plugin's own construction-time mode applies. Local runtime.
|
|
1543
|
+
*/
|
|
1544
|
+
permissionMode?: PermissionMode;
|
|
1545
|
+
onStep?: (args: {
|
|
1546
|
+
step: ConversationStep;
|
|
1547
|
+
}) => void | Promise<void>;
|
|
1548
|
+
onDelta?: (args: {
|
|
1549
|
+
update: InteractionUpdate;
|
|
1550
|
+
}) => void | Promise<void>;
|
|
1551
|
+
/**
|
|
1552
|
+
* Per-call tool gate (OpenAI/OpenRouter `tool_choice`). `"none"` forces a text answer even when
|
|
1553
|
+
* the agent has tools registered — used by an agent loop to force a closing summary at its step
|
|
1554
|
+
* ceiling (a cached agent's tools cannot be un-registered, so the gate is per-send). `"required"`
|
|
1555
|
+
* forces a tool call; `"auto"` (or omitted) is the default. Local runtime; OpenAI-compat providers.
|
|
1556
|
+
*/
|
|
1557
|
+
toolChoice?: "auto" | "none" | "required";
|
|
1558
|
+
/**
|
|
1559
|
+
* SE18 — per-send runtime tool subset (**local runtime only**; cloud agents
|
|
1560
|
+
* ignore it). When set, only tools whose name is in this list may be called for
|
|
1561
|
+
* this send; a call to any other registered tool is vetoed at dispatch (the same
|
|
1562
|
+
* `withToolWhitelist` path `Agent.fork`'s `allowedTools` uses — NOT
|
|
1563
|
+
* `PermissionEngine`). Composes with `toolChoice`: `activeTools` narrows the set,
|
|
1564
|
+
* `toolChoice` gates calling within it. Absent ⇒ the full toolset is available.
|
|
1565
|
+
*
|
|
1566
|
+
* Matching is EXACT against the tool's registered name — the same name the
|
|
1567
|
+
* dispatch sees after tool-name repair (mirrors `Agent.fork`'s `allowedTools`;
|
|
1568
|
+
* it is NOT lowercased for you, so a mixed-case registered tool needs its exact
|
|
1569
|
+
* registered name here). An empty list (`[]`) vetoes EVERY tool (fail-closed —
|
|
1570
|
+
* "restrict to the empty set"); pass `undefined` (or omit) for no restriction.
|
|
1571
|
+
* A subagent invoked within this send inherits the whitelist via async-context
|
|
1572
|
+
* propagation unless it declares its own tool scope.
|
|
1573
|
+
*/
|
|
1574
|
+
activeTools?: string[];
|
|
1575
|
+
/** Local agents only. Expire a stuck active run before starting this message. */
|
|
1576
|
+
local?: {
|
|
1577
|
+
force?: boolean;
|
|
1578
|
+
};
|
|
1579
|
+
/**
|
|
1580
|
+
* Optional `AbortSignal` propagated to memory adapter `pre_user_send`
|
|
1581
|
+
* hooks (EC-H). Note: the LLM HTTP call itself is NOT cancellable
|
|
1582
|
+
* mid-stream — same constraint as `Agent.batch` (ADR D140).
|
|
1583
|
+
*
|
|
1584
|
+
* @public
|
|
1585
|
+
*/
|
|
1586
|
+
signal?: AbortSignal;
|
|
1587
|
+
/**
|
|
1588
|
+
* M7 — an opaque user `context` forwarded to every tool handler's `ctx.context`
|
|
1589
|
+
* for this run. Set shared config (e.g. `projectRoot`) once here instead of
|
|
1590
|
+
* baking it into each tool factory (mirrors a framework `experimental_context`,
|
|
1591
|
+
* a peer framework `RuntimeContext`, a peer SDK `RunContext`).
|
|
1592
|
+
*
|
|
1593
|
+
* @public
|
|
1594
|
+
*/
|
|
1595
|
+
context?: unknown;
|
|
1596
|
+
/**
|
|
1597
|
+
* #58 — per-tool execution timeout in ms. Each tool call is bounded by this
|
|
1598
|
+
* deadline (merged with `signal`); a hung tool yields a typed timeout result
|
|
1599
|
+
* (exit 124) instead of wedging the run. Undefined = no per-tool timeout.
|
|
1600
|
+
*
|
|
1601
|
+
* @public
|
|
1602
|
+
*/
|
|
1603
|
+
perToolTimeoutMs?: number;
|
|
1604
|
+
/**
|
|
1605
|
+
* #57 — opt-in tool-result content guard applied before tool output reaches
|
|
1606
|
+
* the LLM. `{ delimit: true }` frames untrusted tool output as data
|
|
1607
|
+
* (prompt-injection mitigation); `{ redactPii: true }` redacts email/phone.
|
|
1608
|
+
* Undefined = no guard.
|
|
1609
|
+
*
|
|
1610
|
+
* @public
|
|
1611
|
+
*/
|
|
1612
|
+
toolResultGuard?: ToolResultGuardOptions;
|
|
1613
|
+
/**
|
|
1614
|
+
* Opt-in task wrapping (ADRs D363, D374). When truthy, the entire
|
|
1615
|
+
* run is registered as a `Task` in the SDK's observable registry —
|
|
1616
|
+
* caller can list / inspect / cancel / subscribe via the `Task`
|
|
1617
|
+
* namespace. Default behavior (no `task` option) is byte-identical
|
|
1618
|
+
* to v1.1 (no Task overhead).
|
|
1619
|
+
*
|
|
1620
|
+
* Accepts:
|
|
1621
|
+
* - `true` — auto-generate task id; no extra metadata.
|
|
1622
|
+
* - `{ id, meta }` — user-supplied id (D368 grammar enforced) and/or
|
|
1623
|
+
* metadata attached to the handle's `meta` field.
|
|
1624
|
+
*
|
|
1625
|
+
* The work-fn `signal` is **merged** with `options.signal` (whichever
|
|
1626
|
+
* aborts first wins). Local agents only — CloudAgent throws
|
|
1627
|
+
* `UnsupportedTaskOperationError` (D370).
|
|
1628
|
+
*
|
|
1629
|
+
* @public
|
|
1630
|
+
*/
|
|
1631
|
+
task?: true | {
|
|
1632
|
+
id?: string;
|
|
1633
|
+
meta?: Record<string, unknown>;
|
|
1634
|
+
};
|
|
1635
|
+
/**
|
|
1636
|
+
* Per-send ceiling on the agent loop's tool-calling turns (M1-2). Raises (or
|
|
1637
|
+
* lowers) the default cap of 8 for this single send — useful when one heavy
|
|
1638
|
+
* task needs more rounds than the agent's default. Must be a positive
|
|
1639
|
+
* integer; invalid values throw `ConfigurationError` at the boundary. When
|
|
1640
|
+
* unset, the loop uses the default of 8.
|
|
1641
|
+
*
|
|
1642
|
+
* @public
|
|
1643
|
+
*/
|
|
1644
|
+
maxIterations?: number;
|
|
1645
|
+
/**
|
|
1646
|
+
* SE34 — per-send completion check (`isTaskComplete`). After this single
|
|
1647
|
+
* `send()` reaches a terminal `finished` state, the shipped LLM-as-judge
|
|
1648
|
+
* scores the final reply against `criteria` and surfaces the verdict on
|
|
1649
|
+
* {@link RunResult.completionCheck} + a `completion_check` run-event. This is
|
|
1650
|
+
* the finer-grained, single-`send()` gate (contrast `runUntil`, which judges
|
|
1651
|
+
* the FULL response BETWEEN sends). Opt-in — absent ⇒ the send is byte-identical
|
|
1652
|
+
* to today (no extra judge call). Non-finished runs skip the check. The judge
|
|
1653
|
+
* runs when `wait()` is called on the returned `Run`; a stream-only consumer
|
|
1654
|
+
* must call `wait()` to trigger the verdict + the `completion_check` event.
|
|
1655
|
+
*
|
|
1656
|
+
* @public
|
|
1657
|
+
*/
|
|
1658
|
+
completionCheck?: CompletionCheck;
|
|
1659
|
+
}
|
|
1660
|
+
/**
|
|
1661
|
+
* SE34 — the per-send completion criterion (see {@link SendOptions.completionCheck}).
|
|
1662
|
+
*
|
|
1663
|
+
* @public
|
|
1664
|
+
*/
|
|
1665
|
+
interface CompletionCheck {
|
|
1666
|
+
/** What "complete" means for this send — fed to the judge as the goal. */
|
|
1667
|
+
criteria: string;
|
|
1668
|
+
/** Judge model identifier. Default `"openai/gpt-4o-mini"`. */
|
|
1669
|
+
judgeModel?: string;
|
|
1670
|
+
/** Override env for the judge auxiliary agent. Default `OPENROUTER_API_KEY`. */
|
|
1671
|
+
apiKey?: string;
|
|
1672
|
+
}
|
|
1673
|
+
/**
|
|
1674
|
+
* SE34 — the resolved per-send completion verdict (see {@link RunResult.completionCheck}).
|
|
1675
|
+
*
|
|
1676
|
+
* @public
|
|
1677
|
+
*/
|
|
1678
|
+
interface CompletionCheckResult {
|
|
1679
|
+
/** `true` when the judge ruled the send's reply satisfies the criteria. */
|
|
1680
|
+
complete: boolean;
|
|
1681
|
+
/** The judge's stated reason. */
|
|
1682
|
+
reason: string;
|
|
1683
|
+
/** `true` when the judge output could not be parsed — fail-safe `complete: false`. */
|
|
1684
|
+
parseFailed: boolean;
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* theokit#140 - one element of {@link Run.events}: either a structural SDK message or a live delta.
|
|
1688
|
+
*
|
|
1689
|
+
* A discriminated union rather than a widened `SDKMessage`, because a token delta is not a message
|
|
1690
|
+
* and pretending otherwise would force every consumer to guess which of the two it is holding.
|
|
1691
|
+
*
|
|
1692
|
+
* @public
|
|
1693
|
+
*/
|
|
1694
|
+
type RunTimelineEvent = {
|
|
1695
|
+
kind: "message";
|
|
1696
|
+
message: SDKMessage;
|
|
1697
|
+
/**
|
|
1698
|
+
* theokit#140 - `true` when this message's TEXT content already crossed the timeline as
|
|
1699
|
+
* `kind: "delta"` events. Absent when the question does not apply (no text to duplicate).
|
|
1700
|
+
*
|
|
1701
|
+
* Unifying the source fixed ordering and the `callId` namespace; it did NOT stop the same
|
|
1702
|
+
* text arriving twice, because the run's event log carries the complete assistant message and
|
|
1703
|
+
* the deltas are additional. Without this field a consumer has to infer the relation by
|
|
1704
|
+
* COMPARING TEXT - which is where the `callId`-namespace and timestamp-fallback bugs came
|
|
1705
|
+
* from. The SDK emitted the deltas and emits the message from the same scope, so it knows the
|
|
1706
|
+
* answer as a fact; stating it replaces the inference with a boolean.
|
|
1707
|
+
*
|
|
1708
|
+
* Marked rather than suppressed: the message also carries tool calls and metadata, so
|
|
1709
|
+
* dropping it would trade a duplicate for a hole. Optional, so no existing consumer breaks.
|
|
1710
|
+
*/
|
|
1711
|
+
textAlreadyStreamed?: boolean;
|
|
1712
|
+
} | {
|
|
1713
|
+
kind: "delta";
|
|
1714
|
+
update: InteractionUpdate;
|
|
1715
|
+
};
|
|
1716
|
+
/**
|
|
1717
|
+
* Handle to a single prompt submission, returned by `agent.send()` before the model has answered.
|
|
1718
|
+
*
|
|
1719
|
+
* It is a live handle rather than a result — `status` is `"running"` when you receive it — and how
|
|
1720
|
+
* you consume the turn is the decision it asks of you. Call `wait()` when only the final answer
|
|
1721
|
+
* matters. Call `events()` when you want the whole timeline: structural messages and token/tool
|
|
1722
|
+
* deltas interleaved in true order, from one source. That is the one to reach for instead of fusing
|
|
1723
|
+
* `stream()` with `SendOptions.onDelta` yourself, which is what produced the ordering and
|
|
1724
|
+
* duplicate-text bugs it replaces. `stream()` remains the SDKMessage-only view, and
|
|
1725
|
+
* `conversation()` returns the finished turn grouped per turn instead of as a stream.
|
|
1726
|
+
*
|
|
1727
|
+
* `cancel()` moves the run to `"cancelled"`, aborts the stream and stops in-flight tool calls.
|
|
1728
|
+
*
|
|
1729
|
+
* Not every method is available on every runtime — see {@link RunOperation}. Ask `supports(op)`
|
|
1730
|
+
* before calling an optional one and surface `unsupportedReason(op)`, rather than calling it and
|
|
1731
|
+
* catching. The optional fields (`result`, `model`, `durationMs`, `git`, `createdAt`) fill in as the
|
|
1732
|
+
* run progresses, so treat their absence as "not yet", not as an error.
|
|
1733
|
+
*/
|
|
1734
|
+
interface Run {
|
|
1735
|
+
readonly id: string;
|
|
1736
|
+
readonly agentId: string;
|
|
1737
|
+
readonly status: RunStatus;
|
|
1738
|
+
readonly result?: string;
|
|
1739
|
+
readonly model?: ModelSelection;
|
|
1740
|
+
readonly durationMs?: number;
|
|
1741
|
+
readonly git?: RunGitInfo;
|
|
1742
|
+
readonly createdAt?: number;
|
|
1743
|
+
/** AsyncGenerator of normalized stream events. Discriminate on `event.type`. */
|
|
1744
|
+
stream(): AsyncGenerator<SDKMessage, void>;
|
|
1745
|
+
/**
|
|
1746
|
+
* theokit#140 - every event of this run in TRUE order, from one source: structural messages and
|
|
1747
|
+
* live token/tool deltas interleaved as they occurred.
|
|
1748
|
+
*
|
|
1749
|
+
* Use this instead of fusing `stream()` with `SendOptions.onDelta` by hand. Neither of those is
|
|
1750
|
+
* complete alone - `onDelta` carries no `run_started`/`system`, `stream()` carries no token
|
|
1751
|
+
* granularity - and reconciling them in the consumer is what produced the ordering and dedup
|
|
1752
|
+
* bugs this replaces.
|
|
1753
|
+
*
|
|
1754
|
+
* `stream()` is unchanged and remains the SDKMessage-only view.
|
|
1755
|
+
*/
|
|
1756
|
+
events(): AsyncGenerator<RunTimelineEvent, void>;
|
|
1757
|
+
/** Resolves to the terminal {@link RunResult}. */
|
|
1758
|
+
wait(): Promise<RunResult>;
|
|
1759
|
+
/** Move status to `"cancelled"`, abort the stream, stop in-flight tool calls. */
|
|
1760
|
+
cancel(): Promise<void>;
|
|
1761
|
+
/** Structured per-turn view of the conversation. */
|
|
1762
|
+
conversation(): Promise<ConversationTurn[]>;
|
|
1763
|
+
/** Whether the given operation is available on this run's runtime. */
|
|
1764
|
+
supports(operation: RunOperation): boolean;
|
|
1765
|
+
/** Human-readable reason that `supports(operation)` returned `false`. */
|
|
1766
|
+
unsupportedReason(operation: RunOperation): string | undefined;
|
|
1767
|
+
/** Subscribe to status changes. Returns an unsubscribe function. */
|
|
1768
|
+
onDidChangeStatus(listener: (status: RunStatus) => void): () => void;
|
|
1769
|
+
}
|
|
1770
|
+
/**
|
|
1771
|
+
* SE9 — options for the integrated structured-output method `agent.generate`: the
|
|
1772
|
+
* {@link SendOptions} that drive the tool loop (phase 1) plus the required `output`
|
|
1773
|
+
* Zod schema and structuring knobs (phase 2). Co-located with `SendOptions` /
|
|
1774
|
+
* `RunResult` (which they extend/use) so the public `SDKAgent` interface does not
|
|
1775
|
+
* import the runtime `agent-generate` module (breaks the type cycle).
|
|
1776
|
+
*
|
|
1777
|
+
* @public
|
|
1778
|
+
*/
|
|
1779
|
+
interface GenerateOptions<T extends zod.ZodType> extends SendOptions {
|
|
1780
|
+
/** Zod schema the final answer is coerced into (the structuring contract). */
|
|
1781
|
+
output: T;
|
|
1782
|
+
/** Retry budget on the structuring phase's parse-failures (reused from generateObject). Default 1. */
|
|
1783
|
+
maxRetries?: number;
|
|
1784
|
+
/**
|
|
1785
|
+
* What the STRUCTURING phase (phase 2) does when the model's output still fails
|
|
1786
|
+
* Zod validation after retries. Default `"throw"`. `"return-partial"` / `"return-raw"`
|
|
1787
|
+
* salvage the object; the salvaged/raw value is in {@link GenerateRunResult.raw}
|
|
1788
|
+
* (the pre-parse structuring input) — NOT the phase-1 text answer, which is in
|
|
1789
|
+
* `result.result`.
|
|
1790
|
+
*/
|
|
1791
|
+
errorStrategy?: "throw" | "return-partial" | "return-raw";
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* SE9 — result of `agent.generate`: the validated typed object plus the underlying
|
|
1795
|
+
* tool-loop {@link RunResult} (status / usage / model) and the raw pre-parse input.
|
|
1796
|
+
*
|
|
1797
|
+
* @public
|
|
1798
|
+
*/
|
|
1799
|
+
interface GenerateRunResult<O> {
|
|
1800
|
+
/** The validated object — inferred type from the `output` schema. */
|
|
1801
|
+
object: O;
|
|
1802
|
+
/** The underlying tool-loop run (phase 1). */
|
|
1803
|
+
result: RunResult;
|
|
1804
|
+
/** Raw model input to the synthetic `output` tool, before the Zod parse. */
|
|
1805
|
+
raw: unknown;
|
|
1806
|
+
/** Combined token usage of the structuring phase. */
|
|
1807
|
+
usage: {
|
|
1808
|
+
inputTokens: number;
|
|
1809
|
+
outputTokens: number;
|
|
1810
|
+
};
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
export type { RunTripwireEvent as $, AgentConversationTurn as A, RunCompletionCheckEvent as B, CustomTool as C, DoomLoopThresholds as D, RunErrorDetail as E, RunEvent as F, GenerateOptions as G, RunGitInfo as H, ImageBlock as I, RunMemoryDegradedEvent as J, RunOperation as K, RunPermissionDeniedEvent as L, ModelSelection as M, RunRateLimitEvent as N, OutputProcessorContext as O, Processor as P, RunStatus as Q, RunResult as R, SDKMessage as S, ToolResultContentBlock as T, RunTaskCompletedEvent as U, RunTaskStartedEvent as V, RunTaskUpdatedEvent as W, RunTimelineEvent as X, RunToCompletionOptions as Y, RunToCompletionResult as Z, RunToolProgressEvent as _, McpServerConfig as a, SDKAssistantMessage as a0, SDKImage as a1, SDKImageDimension as a2, SDKObjectDelta as a3, SDKRequestMessage as a4, SDKStatusMessage as a5, SDKSystemMessage as a6, SDKTaskMessage as a7, SDKThinkingMessage as a8, SDKToolUseMessage as a9, ToolUseBlock as aA, TurnEndedUpdate as aB, UserMessage as aC, UserMessageAppendedUpdate as aD, SDKUserMessage as aa, SDKUserMessageEvent as ab, SendOptions as ac, ShellCommand as ad, ShellConversationTurn as ae, ShellOutput as af, ShellOutputDeltaUpdate as ag, StepCompletedUpdate as ah, StepStartedUpdate as ai, StreamToCompletionResult as aj, SummaryCompletedUpdate as ak, SummaryStartedUpdate as al, SummaryUpdate as am, TextBlock as an, TextDeltaUpdate as ao, ThinkingCompletedUpdate as ap, ThinkingDeltaUpdate as aq, ThinkingMessage as ar, TokenDeltaUpdate as as, TokenUsage as at, ToolCall as au, ToolCallCompletedUpdate as av, ToolCallStartedUpdate as aw, ToolContextMessage as ax, ToolResult as ay, ToolResultGuardOptions as az, Run as b, PermissionMode as c, RunEventSink as d, AssistantMessage as e, CompletionCheck as f, CompletionCheckResult as g, ConversationStep as h, ConversationTurn as i, CostBreakdown as j, CostSource as k, CostStatus as l, GenerateRunResult as m, InputProcessorContext as n, InteractionUpdate as o, McpAuthConfig as p, McpHttpServerConfig as q, McpOAuthConfig as r, McpStdioServerConfig as s, MessageOrigin as t, ModelParameterValue as u, PartialToolCallUpdate as v, ProcessorControls as w, ProcessorTripwire as x, ProcessorViolation as y, RunCompactBoundaryEvent as z };
|