@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.
Files changed (1141) hide show
  1. package/CHANGELOG.md +7923 -0
  2. package/LICENSE +201 -0
  3. package/README.md +114 -0
  4. package/dist/a2a/agent-mailbox.d.cts +54 -0
  5. package/dist/a2a/agent-mailbox.d.ts +54 -0
  6. package/dist/a2a/index.cjs +138 -0
  7. package/dist/a2a/index.cjs.map +1 -0
  8. package/dist/a2a/index.d.cts +10 -0
  9. package/dist/a2a/index.d.ts +10 -0
  10. package/dist/a2a/index.js +125 -0
  11. package/dist/a2a/index.js.map +1 -0
  12. package/dist/a2a/message-bus.d.cts +118 -0
  13. package/dist/a2a/message-bus.d.ts +118 -0
  14. package/dist/a2a/subagent.d.cts +231 -0
  15. package/dist/a2a/subagent.d.ts +231 -0
  16. package/dist/a2a/types.d.cts +45 -0
  17. package/dist/a2a/types.d.ts +45 -0
  18. package/dist/agent-ARLOD4JX.cjs +67 -0
  19. package/dist/agent-ARLOD4JX.cjs.map +1 -0
  20. package/dist/agent-C3KO5LKm.d.cts +1871 -0
  21. package/dist/agent-CvmTR9uf.d.ts +1871 -0
  22. package/dist/agent-N6WJ54ML.js +58 -0
  23. package/dist/agent-N6WJ54ML.js.map +1 -0
  24. package/dist/agent-builder.d.ts +72 -0
  25. package/dist/agent-factory-registry-UU46BUMU.cjs +16 -0
  26. package/dist/agent-factory-registry-UU46BUMU.cjs.map +1 -0
  27. package/dist/agent-factory-registry-ZVTABLEY.js +3 -0
  28. package/dist/agent-factory-registry-ZVTABLEY.js.map +1 -0
  29. package/dist/agent-factory.d.ts +24 -0
  30. package/dist/agent-generate.d.ts +12 -0
  31. package/dist/agent-session-store-AFML3AXC.js +6 -0
  32. package/dist/agent-session-store-AFML3AXC.js.map +1 -0
  33. package/dist/agent-session-store-MTSIY3MH.cjs +23 -0
  34. package/dist/agent-session-store-MTSIY3MH.cjs.map +1 -0
  35. package/dist/agent.d.ts +276 -0
  36. package/dist/auth/index.cjs +306 -0
  37. package/dist/auth/index.cjs.map +1 -0
  38. package/dist/auth/index.d.cts +34 -0
  39. package/dist/auth/index.d.ts +34 -0
  40. package/dist/auth/index.js +247 -0
  41. package/dist/auth/index.js.map +1 -0
  42. package/dist/batch-I6T6MXZO.cjs +263 -0
  43. package/dist/batch-I6T6MXZO.cjs.map +1 -0
  44. package/dist/batch-US4F6WPK.js +260 -0
  45. package/dist/batch-US4F6WPK.js.map +1 -0
  46. package/dist/chunk-24MGQDK3.js +31 -0
  47. package/dist/chunk-24MGQDK3.js.map +1 -0
  48. package/dist/chunk-24SYBZPL.cjs +121 -0
  49. package/dist/chunk-24SYBZPL.cjs.map +1 -0
  50. package/dist/chunk-2HPNT6HH.cjs +3373 -0
  51. package/dist/chunk-2HPNT6HH.cjs.map +1 -0
  52. package/dist/chunk-2SFBB54R.js +23 -0
  53. package/dist/chunk-2SFBB54R.js.map +1 -0
  54. package/dist/chunk-2WXHA33T.js +105 -0
  55. package/dist/chunk-2WXHA33T.js.map +1 -0
  56. package/dist/chunk-2XC6KDJM.js +22 -0
  57. package/dist/chunk-2XC6KDJM.js.map +1 -0
  58. package/dist/chunk-2XRAWOZZ.js +172 -0
  59. package/dist/chunk-2XRAWOZZ.js.map +1 -0
  60. package/dist/chunk-2ZPEDVLM.cjs +59 -0
  61. package/dist/chunk-2ZPEDVLM.cjs.map +1 -0
  62. package/dist/chunk-3EE6LVWT.cjs +29 -0
  63. package/dist/chunk-3EE6LVWT.cjs.map +1 -0
  64. package/dist/chunk-3JHIFQ4I.js +102 -0
  65. package/dist/chunk-3JHIFQ4I.js.map +1 -0
  66. package/dist/chunk-44I6UYVH.js +133 -0
  67. package/dist/chunk-44I6UYVH.js.map +1 -0
  68. package/dist/chunk-47TF32NQ.js +79 -0
  69. package/dist/chunk-47TF32NQ.js.map +1 -0
  70. package/dist/chunk-4A3SKJ53.cjs +297 -0
  71. package/dist/chunk-4A3SKJ53.cjs.map +1 -0
  72. package/dist/chunk-4HS6FFGL.cjs +433 -0
  73. package/dist/chunk-4HS6FFGL.cjs.map +1 -0
  74. package/dist/chunk-4MMWFSCD.js +25 -0
  75. package/dist/chunk-4MMWFSCD.js.map +1 -0
  76. package/dist/chunk-4NLCWGH7.cjs +177 -0
  77. package/dist/chunk-4NLCWGH7.cjs.map +1 -0
  78. package/dist/chunk-55GB6JYQ.js +208 -0
  79. package/dist/chunk-55GB6JYQ.js.map +1 -0
  80. package/dist/chunk-5WKQDIGO.js +136 -0
  81. package/dist/chunk-5WKQDIGO.js.map +1 -0
  82. package/dist/chunk-67SBTGMA.cjs +457 -0
  83. package/dist/chunk-67SBTGMA.cjs.map +1 -0
  84. package/dist/chunk-6LHQPOMI.cjs +193 -0
  85. package/dist/chunk-6LHQPOMI.cjs.map +1 -0
  86. package/dist/chunk-6M2OIS4Y.js +158 -0
  87. package/dist/chunk-6M2OIS4Y.js.map +1 -0
  88. package/dist/chunk-6PWOWXMC.js +121 -0
  89. package/dist/chunk-6PWOWXMC.js.map +1 -0
  90. package/dist/chunk-6X6ID4MO.js +20 -0
  91. package/dist/chunk-6X6ID4MO.js.map +1 -0
  92. package/dist/chunk-7A6535RA.cjs +231 -0
  93. package/dist/chunk-7A6535RA.cjs.map +1 -0
  94. package/dist/chunk-7FDKWDA2.cjs +135 -0
  95. package/dist/chunk-7FDKWDA2.cjs.map +1 -0
  96. package/dist/chunk-7I5Z3UBJ.js +10 -0
  97. package/dist/chunk-7I5Z3UBJ.js.map +1 -0
  98. package/dist/chunk-7JJ3A6AT.cjs +88 -0
  99. package/dist/chunk-7JJ3A6AT.cjs.map +1 -0
  100. package/dist/chunk-7SZAV6QG.js +593 -0
  101. package/dist/chunk-7SZAV6QG.js.map +1 -0
  102. package/dist/chunk-A4RAL2ER.cjs +51 -0
  103. package/dist/chunk-A4RAL2ER.cjs.map +1 -0
  104. package/dist/chunk-AA27GEYS.cjs +12 -0
  105. package/dist/chunk-AA27GEYS.cjs.map +1 -0
  106. package/dist/chunk-AAEZSPTC.js +133 -0
  107. package/dist/chunk-AAEZSPTC.js.map +1 -0
  108. package/dist/chunk-AGACYRJ2.js +11 -0
  109. package/dist/chunk-AGACYRJ2.js.map +1 -0
  110. package/dist/chunk-ALUN2B4W.js +356 -0
  111. package/dist/chunk-ALUN2B4W.js.map +1 -0
  112. package/dist/chunk-ANMJJD6D.cjs +18 -0
  113. package/dist/chunk-ANMJJD6D.cjs.map +1 -0
  114. package/dist/chunk-ATT276RD.cjs +173 -0
  115. package/dist/chunk-ATT276RD.cjs.map +1 -0
  116. package/dist/chunk-AW6F6HZR.js +166 -0
  117. package/dist/chunk-AW6F6HZR.js.map +1 -0
  118. package/dist/chunk-AWINL3ZC.js +109 -0
  119. package/dist/chunk-AWINL3ZC.js.map +1 -0
  120. package/dist/chunk-BJUJT5ED.cjs +186 -0
  121. package/dist/chunk-BJUJT5ED.cjs.map +1 -0
  122. package/dist/chunk-BUUUWQMB.cjs +34 -0
  123. package/dist/chunk-BUUUWQMB.cjs.map +1 -0
  124. package/dist/chunk-BV2MWEMV.cjs +26 -0
  125. package/dist/chunk-BV2MWEMV.cjs.map +1 -0
  126. package/dist/chunk-CFE6QF2Q.js +221 -0
  127. package/dist/chunk-CFE6QF2Q.js.map +1 -0
  128. package/dist/chunk-CZJ6Q7CW.js +183 -0
  129. package/dist/chunk-CZJ6Q7CW.js.map +1 -0
  130. package/dist/chunk-D3CCY3A2.cjs +10995 -0
  131. package/dist/chunk-D3CCY3A2.cjs.map +1 -0
  132. package/dist/chunk-D6POWE7E.cjs +210 -0
  133. package/dist/chunk-D6POWE7E.cjs.map +1 -0
  134. package/dist/chunk-DMRT67Y6.js +100 -0
  135. package/dist/chunk-DMRT67Y6.js.map +1 -0
  136. package/dist/chunk-DQZU7JK6.cjs +125 -0
  137. package/dist/chunk-DQZU7JK6.cjs.map +1 -0
  138. package/dist/chunk-EFMFILPG.js +77 -0
  139. package/dist/chunk-EFMFILPG.js.map +1 -0
  140. package/dist/chunk-EH6XD3FY.js +222 -0
  141. package/dist/chunk-EH6XD3FY.js.map +1 -0
  142. package/dist/chunk-EIQFAOFD.js +229 -0
  143. package/dist/chunk-EIQFAOFD.js.map +1 -0
  144. package/dist/chunk-EPSICJLZ.js +79 -0
  145. package/dist/chunk-EPSICJLZ.js.map +1 -0
  146. package/dist/chunk-EXTRW7GW.cjs +155 -0
  147. package/dist/chunk-EXTRW7GW.cjs.map +1 -0
  148. package/dist/chunk-FD2UT76F.js +3 -0
  149. package/dist/chunk-FD2UT76F.js.map +1 -0
  150. package/dist/chunk-FJWQP6EE.js +122 -0
  151. package/dist/chunk-FJWQP6EE.js.map +1 -0
  152. package/dist/chunk-FRITRLZQ.cjs +24 -0
  153. package/dist/chunk-FRITRLZQ.cjs.map +1 -0
  154. package/dist/chunk-FUSDYC2B.cjs +280 -0
  155. package/dist/chunk-FUSDYC2B.cjs.map +1 -0
  156. package/dist/chunk-G7BLGBRN.js +43 -0
  157. package/dist/chunk-G7BLGBRN.js.map +1 -0
  158. package/dist/chunk-GBCVPKHE.js +282 -0
  159. package/dist/chunk-GBCVPKHE.js.map +1 -0
  160. package/dist/chunk-GHX4P3V2.cjs +34 -0
  161. package/dist/chunk-GHX4P3V2.cjs.map +1 -0
  162. package/dist/chunk-GZV6AVRL.cjs +282 -0
  163. package/dist/chunk-GZV6AVRL.cjs.map +1 -0
  164. package/dist/chunk-H73MEMQB.js +31 -0
  165. package/dist/chunk-H73MEMQB.js.map +1 -0
  166. package/dist/chunk-HCT4HPCL.cjs +235 -0
  167. package/dist/chunk-HCT4HPCL.cjs.map +1 -0
  168. package/dist/chunk-HFEJE7AC.js +424 -0
  169. package/dist/chunk-HFEJE7AC.js.map +1 -0
  170. package/dist/chunk-HKCKOAIO.js +57 -0
  171. package/dist/chunk-HKCKOAIO.js.map +1 -0
  172. package/dist/chunk-HUFSABUZ.cjs +48 -0
  173. package/dist/chunk-HUFSABUZ.cjs.map +1 -0
  174. package/dist/chunk-HW7SEELD.cjs +46 -0
  175. package/dist/chunk-HW7SEELD.cjs.map +1 -0
  176. package/dist/chunk-HY66GLM6.js +13 -0
  177. package/dist/chunk-HY66GLM6.js.map +1 -0
  178. package/dist/chunk-I2PWY7VM.cjs +27 -0
  179. package/dist/chunk-I2PWY7VM.cjs.map +1 -0
  180. package/dist/chunk-IJ7M6GOG.cjs +28 -0
  181. package/dist/chunk-IJ7M6GOG.cjs.map +1 -0
  182. package/dist/chunk-IU5N5224.cjs +288 -0
  183. package/dist/chunk-IU5N5224.cjs.map +1 -0
  184. package/dist/chunk-IUMAQURF.js +130 -0
  185. package/dist/chunk-IUMAQURF.js.map +1 -0
  186. package/dist/chunk-J7J7J2GN.cjs +377 -0
  187. package/dist/chunk-J7J7J2GN.cjs.map +1 -0
  188. package/dist/chunk-JLRLCBJ4.cjs +108 -0
  189. package/dist/chunk-JLRLCBJ4.cjs.map +1 -0
  190. package/dist/chunk-JMDDYA22.js +171 -0
  191. package/dist/chunk-JMDDYA22.js.map +1 -0
  192. package/dist/chunk-JNAA4G4H.js +43 -0
  193. package/dist/chunk-JNAA4G4H.js.map +1 -0
  194. package/dist/chunk-JOFVLOFY.js +268 -0
  195. package/dist/chunk-JOFVLOFY.js.map +1 -0
  196. package/dist/chunk-K2BQQ445.js +30 -0
  197. package/dist/chunk-K2BQQ445.js.map +1 -0
  198. package/dist/chunk-K2VMFZQ5.js +487 -0
  199. package/dist/chunk-K2VMFZQ5.js.map +1 -0
  200. package/dist/chunk-K3NH62DG.js +3343 -0
  201. package/dist/chunk-K3NH62DG.js.map +1 -0
  202. package/dist/chunk-KGANQYP7.cjs +172 -0
  203. package/dist/chunk-KGANQYP7.cjs.map +1 -0
  204. package/dist/chunk-KRD3GQAA.cjs +71 -0
  205. package/dist/chunk-KRD3GQAA.cjs.map +1 -0
  206. package/dist/chunk-KTTHHYEW.cjs +45 -0
  207. package/dist/chunk-KTTHHYEW.cjs.map +1 -0
  208. package/dist/chunk-KVNWIAO4.js +68 -0
  209. package/dist/chunk-KVNWIAO4.js.map +1 -0
  210. package/dist/chunk-KVSAY6NZ.cjs +497 -0
  211. package/dist/chunk-KVSAY6NZ.cjs.map +1 -0
  212. package/dist/chunk-LOHMT36V.cjs +178 -0
  213. package/dist/chunk-LOHMT36V.cjs.map +1 -0
  214. package/dist/chunk-LX7SEXOQ.js +152 -0
  215. package/dist/chunk-LX7SEXOQ.js.map +1 -0
  216. package/dist/chunk-MUUQ2WFJ.cjs +4 -0
  217. package/dist/chunk-MUUQ2WFJ.cjs.map +1 -0
  218. package/dist/chunk-N6OOOYFZ.js +281 -0
  219. package/dist/chunk-N6OOOYFZ.js.map +1 -0
  220. package/dist/chunk-NAF4L3T6.js +22 -0
  221. package/dist/chunk-NAF4L3T6.js.map +1 -0
  222. package/dist/chunk-NINIJCHU.cjs +23 -0
  223. package/dist/chunk-NINIJCHU.cjs.map +1 -0
  224. package/dist/chunk-NJWYQWDL.js +43 -0
  225. package/dist/chunk-NJWYQWDL.js.map +1 -0
  226. package/dist/chunk-NQTD6QOW.cjs +226 -0
  227. package/dist/chunk-NQTD6QOW.cjs.map +1 -0
  228. package/dist/chunk-NQTNSHSB.cjs +843 -0
  229. package/dist/chunk-NQTNSHSB.cjs.map +1 -0
  230. package/dist/chunk-NVXXWAU7.cjs +13 -0
  231. package/dist/chunk-NVXXWAU7.cjs.map +1 -0
  232. package/dist/chunk-NYQ3IS7K.cjs +130 -0
  233. package/dist/chunk-NYQ3IS7K.cjs.map +1 -0
  234. package/dist/chunk-O6USDERH.js +165 -0
  235. package/dist/chunk-O6USDERH.js.map +1 -0
  236. package/dist/chunk-OBA6YK2R.cjs +8 -0
  237. package/dist/chunk-OBA6YK2R.cjs.map +1 -0
  238. package/dist/chunk-OQRGVTQF.js +169 -0
  239. package/dist/chunk-OQRGVTQF.js.map +1 -0
  240. package/dist/chunk-OR6XIWLB.js +19 -0
  241. package/dist/chunk-OR6XIWLB.js.map +1 -0
  242. package/dist/chunk-OYD3U3LY.js +10981 -0
  243. package/dist/chunk-OYD3U3LY.js.map +1 -0
  244. package/dist/chunk-PRZ3BES7.cjs +79 -0
  245. package/dist/chunk-PRZ3BES7.cjs.map +1 -0
  246. package/dist/chunk-PY2RQOA7.js +6 -0
  247. package/dist/chunk-PY2RQOA7.js.map +1 -0
  248. package/dist/chunk-Q5EWJPRY.js +18 -0
  249. package/dist/chunk-Q5EWJPRY.js.map +1 -0
  250. package/dist/chunk-QATRS7JD.cjs +158 -0
  251. package/dist/chunk-QATRS7JD.cjs.map +1 -0
  252. package/dist/chunk-QC55H6RJ.cjs +601 -0
  253. package/dist/chunk-QC55H6RJ.cjs.map +1 -0
  254. package/dist/chunk-QDM3OHUT.cjs +134 -0
  255. package/dist/chunk-QDM3OHUT.cjs.map +1 -0
  256. package/dist/chunk-QKLOP4VC.cjs +90 -0
  257. package/dist/chunk-QKLOP4VC.cjs.map +1 -0
  258. package/dist/chunk-QOGNZMHD.cjs +34 -0
  259. package/dist/chunk-QOGNZMHD.cjs.map +1 -0
  260. package/dist/chunk-QWD3CZWE.cjs +108 -0
  261. package/dist/chunk-QWD3CZWE.cjs.map +1 -0
  262. package/dist/chunk-QWD4RDZ3.cjs +136 -0
  263. package/dist/chunk-QWD4RDZ3.cjs.map +1 -0
  264. package/dist/chunk-QYLZQ43D.cjs +172 -0
  265. package/dist/chunk-QYLZQ43D.cjs.map +1 -0
  266. package/dist/chunk-R7WIIPUR.js +27 -0
  267. package/dist/chunk-R7WIIPUR.js.map +1 -0
  268. package/dist/chunk-RQMCOFAI.cjs +85 -0
  269. package/dist/chunk-RQMCOFAI.cjs.map +1 -0
  270. package/dist/chunk-SA6K24NB.cjs +25 -0
  271. package/dist/chunk-SA6K24NB.cjs.map +1 -0
  272. package/dist/chunk-SADXXGWU.js +809 -0
  273. package/dist/chunk-SADXXGWU.js.map +1 -0
  274. package/dist/chunk-SAGRF4IB.js +25 -0
  275. package/dist/chunk-SAGRF4IB.js.map +1 -0
  276. package/dist/chunk-SVQIW5RJ.js +81 -0
  277. package/dist/chunk-SVQIW5RJ.js.map +1 -0
  278. package/dist/chunk-TA3K7SBK.js +180 -0
  279. package/dist/chunk-TA3K7SBK.js.map +1 -0
  280. package/dist/chunk-TFG5IBZS.cjs +139 -0
  281. package/dist/chunk-TFG5IBZS.cjs.map +1 -0
  282. package/dist/chunk-TMKTSYDS.cjs +21 -0
  283. package/dist/chunk-TMKTSYDS.cjs.map +1 -0
  284. package/dist/chunk-UADQJBHR.cjs +172 -0
  285. package/dist/chunk-UADQJBHR.cjs.map +1 -0
  286. package/dist/chunk-UBR5PWD7.js +275 -0
  287. package/dist/chunk-UBR5PWD7.js.map +1 -0
  288. package/dist/chunk-UKMBRMGT.js +22 -0
  289. package/dist/chunk-UKMBRMGT.js.map +1 -0
  290. package/dist/chunk-V22DZIXO.js +147 -0
  291. package/dist/chunk-V22DZIXO.js.map +1 -0
  292. package/dist/chunk-VE6DFSKU.js +107 -0
  293. package/dist/chunk-VE6DFSKU.js.map +1 -0
  294. package/dist/chunk-VPK6PHIE.cjs +211 -0
  295. package/dist/chunk-VPK6PHIE.cjs.map +1 -0
  296. package/dist/chunk-VTYY7XL5.cjs +15 -0
  297. package/dist/chunk-VTYY7XL5.cjs.map +1 -0
  298. package/dist/chunk-VWUXIVEI.js +583 -0
  299. package/dist/chunk-VWUXIVEI.js.map +1 -0
  300. package/dist/chunk-WE22OXQA.js +48 -0
  301. package/dist/chunk-WE22OXQA.js.map +1 -0
  302. package/dist/chunk-WMWEI3NS.js +120 -0
  303. package/dist/chunk-WMWEI3NS.js.map +1 -0
  304. package/dist/chunk-WS5ULCL4.js +204 -0
  305. package/dist/chunk-WS5ULCL4.js.map +1 -0
  306. package/dist/chunk-XB4GI5RZ.js +115 -0
  307. package/dist/chunk-XB4GI5RZ.js.map +1 -0
  308. package/dist/chunk-XU6MLSC6.js +455 -0
  309. package/dist/chunk-XU6MLSC6.js.map +1 -0
  310. package/dist/chunk-XYFGKVZ7.js +15 -0
  311. package/dist/chunk-XYFGKVZ7.js.map +1 -0
  312. package/dist/chunk-Y2KYR2ED.cjs +118 -0
  313. package/dist/chunk-Y2KYR2ED.cjs.map +1 -0
  314. package/dist/chunk-YIFFF23U.cjs +109 -0
  315. package/dist/chunk-YIFFF23U.cjs.map +1 -0
  316. package/dist/chunk-YJNYDJ2T.cjs +27 -0
  317. package/dist/chunk-YJNYDJ2T.cjs.map +1 -0
  318. package/dist/chunk-YSTXFWQE.cjs +127 -0
  319. package/dist/chunk-YSTXFWQE.cjs.map +1 -0
  320. package/dist/chunk-Z2JFX372.cjs +595 -0
  321. package/dist/chunk-Z2JFX372.cjs.map +1 -0
  322. package/dist/chunk-Z3NTRKIC.cjs +111 -0
  323. package/dist/chunk-Z3NTRKIC.cjs.map +1 -0
  324. package/dist/chunk-ZF2LDKQQ.cjs +20 -0
  325. package/dist/chunk-ZF2LDKQQ.cjs.map +1 -0
  326. package/dist/client/index.cjs +73 -0
  327. package/dist/client/index.cjs.map +1 -0
  328. package/dist/client/index.d.cts +12 -0
  329. package/dist/client/index.d.ts +12 -0
  330. package/dist/client/index.js +71 -0
  331. package/dist/client/index.js.map +1 -0
  332. package/dist/client/theokit-client.d.cts +60 -0
  333. package/dist/client/theokit-client.d.ts +60 -0
  334. package/dist/client/types.d.cts +51 -0
  335. package/dist/client/types.d.ts +51 -0
  336. package/dist/compact-session-BHTPCIHA.cjs +61 -0
  337. package/dist/compact-session-BHTPCIHA.cjs.map +1 -0
  338. package/dist/compact-session-W4WLJTHA.js +24 -0
  339. package/dist/compact-session-W4WLJTHA.js.map +1 -0
  340. package/dist/compaction.cjs +66 -0
  341. package/dist/compaction.cjs.map +1 -0
  342. package/dist/compaction.d.cts +240 -0
  343. package/dist/compaction.d.ts +240 -0
  344. package/dist/compaction.js +5 -0
  345. package/dist/compaction.js.map +1 -0
  346. package/dist/concurrency.cjs +23 -0
  347. package/dist/concurrency.cjs.map +1 -0
  348. package/dist/concurrency.d.cts +22 -0
  349. package/dist/concurrency.d.ts +22 -0
  350. package/dist/concurrency.js +17 -0
  351. package/dist/concurrency.js.map +1 -0
  352. package/dist/context/index.cjs +37 -0
  353. package/dist/context/index.cjs.map +1 -0
  354. package/dist/context/index.d.cts +78 -0
  355. package/dist/context/index.d.ts +78 -0
  356. package/dist/context/index.js +20 -0
  357. package/dist/context/index.js.map +1 -0
  358. package/dist/context-4QOEWRDF.cjs +23 -0
  359. package/dist/context-4QOEWRDF.cjs.map +1 -0
  360. package/dist/context-Z3CFTT3H.js +6 -0
  361. package/dist/context-Z3CFTT3H.js.map +1 -0
  362. package/dist/create-skill.d.ts +40 -0
  363. package/dist/cron-C3PhZED0.d.cts +246 -0
  364. package/dist/cron-crfMMdAw.d.ts +246 -0
  365. package/dist/cron.cjs +68 -0
  366. package/dist/cron.cjs.map +1 -0
  367. package/dist/cron.d.cts +7 -0
  368. package/dist/cron.d.ts +7 -0
  369. package/dist/cron.js +59 -0
  370. package/dist/cron.js.map +1 -0
  371. package/dist/define-tool.d.ts +86 -0
  372. package/dist/errors-CLOAyuiv.d.ts +569 -0
  373. package/dist/errors-DrDEgyz1.d.cts +569 -0
  374. package/dist/errors-base-B5g01neU.d.cts +75 -0
  375. package/dist/errors-base-B5g01neU.d.ts +75 -0
  376. package/dist/errors-base.d.ts +73 -0
  377. package/dist/errors.cjs +89 -0
  378. package/dist/errors.cjs.map +1 -0
  379. package/dist/errors.d.cts +4 -0
  380. package/dist/errors.d.ts +4 -0
  381. package/dist/errors.js +4 -0
  382. package/dist/errors.js.map +1 -0
  383. package/dist/eval.cjs +1056 -0
  384. package/dist/eval.cjs.map +1 -0
  385. package/dist/eval.d.cts +77 -0
  386. package/dist/eval.d.ts +77 -0
  387. package/dist/eval.js +1042 -0
  388. package/dist/eval.js.map +1 -0
  389. package/dist/event-bus.d.ts +42 -0
  390. package/dist/executor-XQAOQOHD.cjs +993 -0
  391. package/dist/executor-XQAOQOHD.cjs.map +1 -0
  392. package/dist/executor-ZNDQDX6Q.js +989 -0
  393. package/dist/executor-ZNDQDX6Q.js.map +1 -0
  394. package/dist/filesystem/index.cjs +204 -0
  395. package/dist/filesystem/index.cjs.map +1 -0
  396. package/dist/filesystem/index.d.cts +12 -0
  397. package/dist/filesystem/index.d.ts +12 -0
  398. package/dist/filesystem/index.js +195 -0
  399. package/dist/filesystem/index.js.map +1 -0
  400. package/dist/filesystem/local-filesystem.d.cts +54 -0
  401. package/dist/filesystem/local-filesystem.d.ts +54 -0
  402. package/dist/filesystem/types.d.cts +136 -0
  403. package/dist/filesystem/types.d.ts +136 -0
  404. package/dist/fork-agent-S2EPIML7.js +61 -0
  405. package/dist/fork-agent-S2EPIML7.js.map +1 -0
  406. package/dist/fork-agent-WAEQI2DL.cjs +64 -0
  407. package/dist/fork-agent-WAEQI2DL.cjs.map +1 -0
  408. package/dist/fs-session-store-77JU46UZ.js +10 -0
  409. package/dist/fs-session-store-77JU46UZ.js.map +1 -0
  410. package/dist/fs-session-store-E4U3P56L.cjs +19 -0
  411. package/dist/fs-session-store-E4U3P56L.cjs.map +1 -0
  412. package/dist/generate-object-BXV7BZRP.js +7 -0
  413. package/dist/generate-object-BXV7BZRP.js.map +1 -0
  414. package/dist/generate-object-YBI2TDJ3.cjs +20 -0
  415. package/dist/generate-object-YBI2TDJ3.cjs.map +1 -0
  416. package/dist/generate-object.d.ts +111 -0
  417. package/dist/index-manager-3UNPYH34.cjs +26 -0
  418. package/dist/index-manager-3UNPYH34.cjs.map +1 -0
  419. package/dist/index-manager-W7FDMGEG.js +17 -0
  420. package/dist/index-manager-W7FDMGEG.js.map +1 -0
  421. package/dist/index.cjs +2487 -0
  422. package/dist/index.cjs.map +1 -0
  423. package/dist/index.d.cts +4166 -0
  424. package/dist/index.d.ts +4166 -0
  425. package/dist/index.js +2289 -0
  426. package/dist/index.js.map +1 -0
  427. package/dist/inject-session-SUM6TDJF.js +27 -0
  428. package/dist/inject-session-SUM6TDJF.js.map +1 -0
  429. package/dist/inject-session-W6A46J3E.cjs +29 -0
  430. package/dist/inject-session-W6A46J3E.cjs.map +1 -0
  431. package/dist/interactive/index.cjs +35 -0
  432. package/dist/interactive/index.cjs.map +1 -0
  433. package/dist/interactive/index.d.cts +12 -0
  434. package/dist/interactive/index.d.ts +12 -0
  435. package/dist/interactive/index.js +30 -0
  436. package/dist/interactive/index.js.map +1 -0
  437. package/dist/interactive/types.d.cts +95 -0
  438. package/dist/interactive/types.d.ts +95 -0
  439. package/dist/internal/agent/batch.d.ts +11 -0
  440. package/dist/internal/agent/helpers.d.ts +1 -0
  441. package/dist/internal/agent-loop/budget-gate.d.ts +1 -0
  442. package/dist/internal/agent-loop/doom-loop-tracker.d.ts +22 -0
  443. package/dist/internal/agent-loop/live-events.d.ts +46 -0
  444. package/dist/internal/agent-loop/loop-context-init.d.ts +2 -0
  445. package/dist/internal/agent-loop/loop-finalize.d.ts +25 -0
  446. package/dist/internal/agent-loop/loop-llm-stream.d.ts +1 -0
  447. package/dist/internal/agent-loop/loop-thinking-steps.d.ts +28 -0
  448. package/dist/internal/agent-loop/loop.d.ts +7 -0
  449. package/dist/internal/agent-loop/message-builders.d.ts +21 -0
  450. package/dist/internal/agent-loop/replay-messages.d.ts +41 -0
  451. package/dist/internal/agent-loop/tool-dispatch.d.ts +27 -0
  452. package/dist/internal/agent-loop/tool-executors.d.ts +1 -0
  453. package/dist/internal/agent-loop/tool-result-guard.d.ts +20 -0
  454. package/dist/internal/agent-loop/tool-timeout.d.ts +23 -0
  455. package/dist/internal/agent-loop/types.d.ts +43 -0
  456. package/dist/internal/agent-loop/usage-and-cost.d.ts +25 -0
  457. package/dist/internal/auth/api-key-prefix.d.ts +23 -0
  458. package/dist/internal/auth/api-key-validator.d.ts +46 -0
  459. package/dist/internal/auth/credential-availability.d.ts +61 -0
  460. package/dist/internal/auth/credential-store.d.ts +77 -0
  461. package/dist/internal/auth/oauth-device.d.ts +54 -0
  462. package/dist/internal/auth/oauth-engine.d.ts +21 -0
  463. package/dist/internal/auth/resolve-credential.d.ts +56 -0
  464. package/dist/internal/auth/types.d.ts +175 -0
  465. package/dist/internal/base-url.d.ts +14 -0
  466. package/dist/internal/budget/compute-cost.d.ts +28 -0
  467. package/dist/internal/budget/pricing-registry.d.ts +36 -0
  468. package/dist/internal/budget/tracker/budget-tracker.d.ts +11 -0
  469. package/dist/internal/budget/tracker/budget.d.ts +34 -0
  470. package/dist/internal/budget/usage-accumulator.d.ts +46 -0
  471. package/dist/internal/cloud-agent/cloud-agent.d.ts +1 -0
  472. package/dist/internal/cloud-agent/cloud-config-serializer.d.ts +3 -0
  473. package/dist/internal/cloud-agent/cloud-run.d.ts +1 -0
  474. package/dist/internal/cloud-agent/cloud-tool-parity.d.ts +1 -0
  475. package/dist/internal/cloud-agent/index.d.ts +7 -0
  476. package/dist/internal/cloud-agent/real-cloud-run.d.ts +2 -0
  477. package/dist/internal/cloud-agent/types.d.ts +56 -0
  478. package/dist/internal/concurrency/abort-utils.d.ts +21 -0
  479. package/dist/internal/concurrency/async-local-storage.d.ts +20 -0
  480. package/dist/internal/concurrency/async-semaphore.d.ts +24 -0
  481. package/dist/internal/concurrency/delegation-depth.d.ts +27 -0
  482. package/dist/internal/concurrency/map-with-concurrency.d.ts +28 -0
  483. package/dist/internal/concurrency/subagent-credentials.d.ts +112 -0
  484. package/dist/internal/diagnostics.d.ts +69 -0
  485. package/dist/internal/emit-run-event.d.ts +16 -0
  486. package/dist/internal/env.d.ts +1 -0
  487. package/dist/internal/error-mappers/anthropic.d.ts +30 -0
  488. package/dist/internal/error-mappers/bedrock.d.ts +16 -0
  489. package/dist/internal/error-mappers/default-retriable.d.ts +1 -0
  490. package/dist/internal/error-mappers/ollama.d.ts +41 -0
  491. package/dist/internal/error-mappers/openai-compatible.d.ts +25 -0
  492. package/dist/internal/error-mappers/shared.d.ts +23 -0
  493. package/dist/internal/error-mappers/vertex.d.ts +15 -0
  494. package/dist/internal/eval/aggregate.d.ts +9 -0
  495. package/dist/internal/eval/assert.d.ts +27 -0
  496. package/dist/internal/eval/code-runner.d.ts +28 -0
  497. package/dist/internal/eval/dataset-iter.d.ts +9 -0
  498. package/dist/internal/eval/runner.d.ts +9 -0
  499. package/dist/internal/eval/single-flight.d.ts +17 -0
  500. package/dist/internal/eval/telemetry.d.ts +23 -0
  501. package/dist/internal/eval/trials.d.ts +19 -0
  502. package/dist/internal/global-singleton.d.ts +16 -0
  503. package/dist/internal/http.d.ts +1 -0
  504. package/dist/internal/ids.d.ts +1 -0
  505. package/dist/internal/judge/judge-call.d.ts +48 -0
  506. package/dist/internal/judge/parse-verdict.d.ts +11 -0
  507. package/dist/internal/llm/abort-error.d.ts +1 -0
  508. package/dist/internal/llm/anthropic-shared.d.ts +100 -0
  509. package/dist/internal/llm/anthropic.d.ts +9 -0
  510. package/dist/internal/llm/bedrock-anthropic.d.ts +36 -0
  511. package/dist/internal/llm/bedrock-token-cache.d.ts +18 -0
  512. package/dist/internal/llm/credential-pool-context.d.ts +11 -0
  513. package/dist/internal/llm/credential-pool-types.d.ts +22 -0
  514. package/dist/internal/llm/credential-pool.d.ts +18 -0
  515. package/dist/internal/llm/fallback-client.d.ts +1 -0
  516. package/dist/internal/llm/fault-injection.d.ts +50 -0
  517. package/dist/internal/llm/finish.d.ts +1 -0
  518. package/dist/internal/llm/hermes-tool-extract.d.ts +11 -0
  519. package/dist/internal/llm/model-capabilities.d.ts +40 -0
  520. package/dist/internal/llm/model-identifier.d.ts +58 -0
  521. package/dist/internal/llm/model-option.d.ts +38 -0
  522. package/dist/internal/llm/ollama-native.d.ts +27 -0
  523. package/dist/internal/llm/openai-messages.d.ts +2 -0
  524. package/dist/internal/llm/openai.d.ts +146 -0
  525. package/dist/internal/llm/pool-aware-client.d.ts +16 -0
  526. package/dist/internal/llm/prompt-cache-key.d.ts +1 -0
  527. package/dist/internal/llm/responses.d.ts +97 -0
  528. package/dist/internal/llm/retry.d.ts +22 -0
  529. package/dist/internal/llm/retrying-client.d.ts +53 -0
  530. package/dist/internal/llm/router.d.ts +40 -0
  531. package/dist/internal/llm/sse.d.ts +21 -0
  532. package/dist/internal/llm/stream-relay.d.ts +17 -0
  533. package/dist/internal/llm/tool-result-content.d.ts +40 -0
  534. package/dist/internal/llm/transport-error.d.ts +9 -0
  535. package/dist/internal/llm/types.d.ts +226 -0
  536. package/dist/internal/llm/vertex-anthropic.d.ts +40 -0
  537. package/dist/internal/llm/vertex-auth.d.ts +30 -0
  538. package/dist/internal/llm/vertex-gemini.d.ts +28 -0
  539. package/dist/internal/llm/vertex-router.d.ts +21 -0
  540. package/dist/internal/local-agent/index.d.ts +6 -0
  541. package/dist/internal/local-agent/local-agent-bootstrap.d.ts +37 -0
  542. package/dist/internal/local-agent/local-agent-capabilities.d.ts +38 -0
  543. package/dist/internal/local-agent/local-agent-dispatch.d.ts +57 -0
  544. package/dist/internal/local-agent/local-agent-invalidate.d.ts +1 -0
  545. package/dist/internal/local-agent/local-agent-lifecycle.d.ts +13 -0
  546. package/dist/internal/local-agent/local-agent-memory-direct.d.ts +12 -0
  547. package/dist/internal/local-agent/local-agent-memory-hooks.d.ts +41 -0
  548. package/dist/internal/local-agent/local-agent-memory-provider.d.ts +57 -0
  549. package/dist/internal/local-agent/local-agent-memory.d.ts +1 -0
  550. package/dist/internal/local-agent/local-agent-personality-extensions.d.ts +43 -0
  551. package/dist/internal/local-agent/local-agent-runtime-extensions.d.ts +13 -0
  552. package/dist/internal/local-agent/local-agent-send.d.ts +42 -0
  553. package/dist/internal/local-agent/local-agent-task-wrap.d.ts +11 -0
  554. package/dist/internal/local-agent/local-agent.d.ts +1 -0
  555. package/dist/internal/local-agent/local-option-keys.d.ts +2 -0
  556. package/dist/internal/local-agent/local-run.d.ts +1 -0
  557. package/dist/internal/local-agent/mcp-pool.d.ts +43 -0
  558. package/dist/internal/local-agent/real-local-run-mcp.d.ts +26 -0
  559. package/dist/internal/local-agent/real-local-run-options.d.ts +26 -0
  560. package/dist/internal/local-agent/real-local-run-provider.d.ts +13 -0
  561. package/dist/internal/local-agent/real-local-run-tools.d.ts +55 -0
  562. package/dist/internal/local-agent/real-local-run.d.ts +4 -0
  563. package/dist/internal/mcp/client.d.ts +16 -0
  564. package/dist/internal/mcp/handshake-timeout.d.ts +53 -0
  565. package/dist/internal/mcp/oauth.d.ts +19 -0
  566. package/dist/internal/mcp/token-storage.d.ts +52 -0
  567. package/dist/internal/memory/active-memory-cache.d.ts +10 -0
  568. package/dist/internal/memory/active-memory-types.d.ts +8 -0
  569. package/dist/internal/memory/active-memory.d.ts +56 -0
  570. package/dist/internal/memory/adapters/azure-openai-embedding.d.cts +2 -0
  571. package/dist/internal/memory/adapters/azure-openai-embedding.d.ts +2 -0
  572. package/dist/internal/memory/adapters/catalog.d.cts +1 -0
  573. package/dist/internal/memory/adapters/catalog.d.ts +1 -0
  574. package/dist/internal/memory/adapters/cohere-embedding.d.cts +2 -0
  575. package/dist/internal/memory/adapters/cohere-embedding.d.ts +2 -0
  576. package/dist/internal/memory/adapters/deepinfra-embedding.d.cts +2 -0
  577. package/dist/internal/memory/adapters/deepinfra-embedding.d.ts +2 -0
  578. package/dist/internal/memory/adapters/gemini-embedding.d.cts +2 -0
  579. package/dist/internal/memory/adapters/gemini-embedding.d.ts +2 -0
  580. package/dist/internal/memory/adapters/index.cjs +30 -0
  581. package/dist/internal/memory/adapters/index.cjs.map +1 -0
  582. package/dist/internal/memory/adapters/index.d.cts +18 -0
  583. package/dist/internal/memory/adapters/index.d.ts +18 -0
  584. package/dist/internal/memory/adapters/index.js +13 -0
  585. package/dist/internal/memory/adapters/index.js.map +1 -0
  586. package/dist/internal/memory/adapters/jina-embedding.d.cts +2 -0
  587. package/dist/internal/memory/adapters/jina-embedding.d.ts +2 -0
  588. package/dist/internal/memory/adapters/mistral-embedding.d.cts +2 -0
  589. package/dist/internal/memory/adapters/mistral-embedding.d.ts +2 -0
  590. package/dist/internal/memory/adapters/ollama-embedding.d.cts +34 -0
  591. package/dist/internal/memory/adapters/ollama-embedding.d.ts +34 -0
  592. package/dist/internal/memory/adapters/openai-compatible.d.cts +96 -0
  593. package/dist/internal/memory/adapters/openai-compatible.d.ts +96 -0
  594. package/dist/internal/memory/adapters/openai-embedding.d.cts +12 -0
  595. package/dist/internal/memory/adapters/openai-embedding.d.ts +12 -0
  596. package/dist/internal/memory/adapters/openrouter-embedding.d.cts +2 -0
  597. package/dist/internal/memory/adapters/openrouter-embedding.d.ts +2 -0
  598. package/dist/internal/memory/adapters/voyage-embedding.d.cts +2 -0
  599. package/dist/internal/memory/adapters/voyage-embedding.d.ts +2 -0
  600. package/dist/internal/memory/corpus-sync.d.ts +23 -0
  601. package/dist/internal/memory/dreaming/diary.d.ts +41 -0
  602. package/dist/internal/memory/dreaming/phases.d.ts +35 -0
  603. package/dist/internal/memory/dreaming/run.d.ts +10 -0
  604. package/dist/internal/memory/embedding-adapter.d.ts +42 -0
  605. package/dist/internal/memory/embedding-cache.d.ts +42 -0
  606. package/dist/internal/memory/escape-like-pattern.d.ts +22 -0
  607. package/dist/internal/memory/index-db.d.ts +67 -0
  608. package/dist/internal/memory/index-manager-contract.d.ts +48 -0
  609. package/dist/internal/memory/index-manager-dispatch.d.ts +23 -0
  610. package/dist/internal/memory/index-manager-helpers.d.ts +20 -0
  611. package/dist/internal/memory/index-manager.d.ts +44 -0
  612. package/dist/internal/memory/index-repository.d.ts +58 -0
  613. package/dist/internal/memory/index-schema.d.ts +21 -0
  614. package/dist/internal/memory/lance-index.d.ts +46 -0
  615. package/dist/internal/memory/lance-memory-adapter.d.ts +45 -0
  616. package/dist/internal/memory/memory-index.d.ts +67 -0
  617. package/dist/internal/memory/migrate-sqlite-to-lance.d.ts +58 -0
  618. package/dist/internal/memory/migration.d.ts +9 -0
  619. package/dist/internal/memory/sdk-memory-peer-loader.d.ts +74 -0
  620. package/dist/internal/memory/sqlite-vec-loader.d.ts +1 -0
  621. package/dist/internal/memory/storage/chunk-markdown.d.cts +2 -0
  622. package/dist/internal/memory/storage/chunk-markdown.d.ts +2 -0
  623. package/dist/internal/memory/storage/index.cjs +141 -0
  624. package/dist/internal/memory/storage/index.cjs.map +1 -0
  625. package/dist/internal/memory/storage/index.d.cts +28 -0
  626. package/dist/internal/memory/storage/index.d.ts +28 -0
  627. package/dist/internal/memory/storage/index.js +16 -0
  628. package/dist/internal/memory/storage/index.js.map +1 -0
  629. package/dist/internal/memory/storage/list-markdown.d.cts +1 -0
  630. package/dist/internal/memory/storage/list-markdown.d.ts +1 -0
  631. package/dist/internal/memory/storage/markdown-store.d.cts +48 -0
  632. package/dist/internal/memory/storage/markdown-store.d.ts +48 -0
  633. package/dist/internal/memory/storage/memory-file.d.cts +90 -0
  634. package/dist/internal/memory/storage/memory-file.d.ts +90 -0
  635. package/dist/internal/memory/storage/memory-root.d.cts +119 -0
  636. package/dist/internal/memory/storage/memory-root.d.ts +119 -0
  637. package/dist/internal/memory/storage/reader.d.cts +8 -0
  638. package/dist/internal/memory/storage/reader.d.ts +8 -0
  639. package/dist/internal/memory/storage/session-loader.d.cts +35 -0
  640. package/dist/internal/memory/storage/session-loader.d.ts +35 -0
  641. package/dist/internal/memory/storage/session-summary-writer.d.cts +50 -0
  642. package/dist/internal/memory/storage/session-summary-writer.d.ts +50 -0
  643. package/dist/internal/memory/storage/threat-scan.d.cts +62 -0
  644. package/dist/internal/memory/storage/threat-scan.d.ts +62 -0
  645. package/dist/internal/memory/storage/transcript-store.d.cts +38 -0
  646. package/dist/internal/memory/storage/transcript-store.d.ts +38 -0
  647. package/dist/internal/memory/storage/wiki-loader.d.cts +27 -0
  648. package/dist/internal/memory/storage/wiki-loader.d.ts +27 -0
  649. package/dist/internal/memory/tools.d.ts +21 -0
  650. package/dist/internal/memory/types.d.ts +78 -0
  651. package/dist/internal/memory/vec-index.d.ts +28 -0
  652. package/dist/internal/persistence/atomic-write.d.cts +107 -0
  653. package/dist/internal/persistence/atomic-write.d.ts +107 -0
  654. package/dist/internal/persistence/cwd-mutex.d.cts +35 -0
  655. package/dist/internal/persistence/cwd-mutex.d.ts +35 -0
  656. package/dist/internal/persistence/exclusive-create.d.cts +53 -0
  657. package/dist/internal/persistence/exclusive-create.d.ts +53 -0
  658. package/dist/internal/persistence/file-lock.d.cts +54 -0
  659. package/dist/internal/persistence/file-lock.d.ts +54 -0
  660. package/dist/internal/persistence/fs-session-store.d.cts +68 -0
  661. package/dist/internal/persistence/fs-session-store.d.ts +68 -0
  662. package/dist/internal/persistence/fts5-sanitize.d.cts +44 -0
  663. package/dist/internal/persistence/fts5-sanitize.d.ts +44 -0
  664. package/dist/internal/persistence/index.cjs +127 -0
  665. package/dist/internal/persistence/index.cjs.map +1 -0
  666. package/dist/internal/persistence/index.d.cts +33 -0
  667. package/dist/internal/persistence/index.d.ts +33 -0
  668. package/dist/internal/persistence/index.js +40 -0
  669. package/dist/internal/persistence/index.js.map +1 -0
  670. package/dist/internal/persistence/jsonl.d.cts +43 -0
  671. package/dist/internal/persistence/jsonl.d.ts +43 -0
  672. package/dist/internal/persistence/markdown-config-loader.d.cts +35 -0
  673. package/dist/internal/persistence/markdown-config-loader.d.ts +35 -0
  674. package/dist/internal/persistence/pagination.d.cts +21 -0
  675. package/dist/internal/persistence/pagination.d.ts +21 -0
  676. package/dist/internal/persistence/paths.d.cts +137 -0
  677. package/dist/internal/persistence/paths.d.ts +137 -0
  678. package/dist/internal/persistence/persistence-schema.d.cts +29 -0
  679. package/dist/internal/persistence/persistence-schema.d.ts +29 -0
  680. package/dist/internal/persistence/schema-version.d.cts +227 -0
  681. package/dist/internal/persistence/schema-version.d.ts +227 -0
  682. package/dist/internal/persistence/session-artifacts.d.cts +27 -0
  683. package/dist/internal/persistence/session-artifacts.d.ts +27 -0
  684. package/dist/internal/persistence/session-dir.d.cts +1 -0
  685. package/dist/internal/persistence/session-dir.d.ts +1 -0
  686. package/dist/internal/persistence/session-transcript.d.cts +128 -0
  687. package/dist/internal/persistence/session-transcript.d.ts +128 -0
  688. package/dist/internal/persistence/session-writer.d.cts +104 -0
  689. package/dist/internal/persistence/session-writer.d.ts +104 -0
  690. package/dist/internal/persistence/sqlite-cas.d.cts +61 -0
  691. package/dist/internal/persistence/sqlite-cas.d.ts +61 -0
  692. package/dist/internal/persistence/sqlite-open.d.cts +61 -0
  693. package/dist/internal/persistence/sqlite-open.d.ts +61 -0
  694. package/dist/internal/persistence/sqlite-wal.d.cts +54 -0
  695. package/dist/internal/persistence/sqlite-wal.d.ts +54 -0
  696. package/dist/internal/persistence/transcript-ops.d.cts +99 -0
  697. package/dist/internal/persistence/transcript-ops.d.ts +99 -0
  698. package/dist/internal/personality/context.d.ts +17 -0
  699. package/dist/internal/personality/registry.d.ts +17 -0
  700. package/dist/internal/personality/store.d.ts +27 -0
  701. package/dist/internal/personality/switch.d.ts +36 -0
  702. package/dist/internal/personality/types.d.ts +18 -0
  703. package/dist/internal/plugins/context.d.cts +21 -0
  704. package/dist/internal/plugins/context.d.ts +21 -0
  705. package/dist/internal/plugins/enabled-names.d.cts +1 -0
  706. package/dist/internal/plugins/enabled-names.d.ts +1 -0
  707. package/dist/internal/plugins/index.d.cts +9 -0
  708. package/dist/internal/plugins/index.d.ts +9 -0
  709. package/dist/internal/plugins/lifecycle.d.cts +15 -0
  710. package/dist/internal/plugins/lifecycle.d.ts +15 -0
  711. package/dist/internal/plugins/manager.d.cts +57 -0
  712. package/dist/internal/plugins/manager.d.ts +57 -0
  713. package/dist/internal/plugins/plugin-guards.d.cts +13 -0
  714. package/dist/internal/plugins/plugin-guards.d.ts +13 -0
  715. package/dist/internal/plugins/types.d.cts +26 -0
  716. package/dist/internal/plugins/types.d.ts +26 -0
  717. package/dist/internal/providers/builtin/anthropic.d.ts +2 -0
  718. package/dist/internal/providers/builtin/bedrock.d.ts +25 -0
  719. package/dist/internal/providers/builtin/cerebras.d.ts +5 -0
  720. package/dist/internal/providers/builtin/cohere.d.ts +8 -0
  721. package/dist/internal/providers/builtin/deepinfra.d.ts +2 -0
  722. package/dist/internal/providers/builtin/gemini.d.ts +10 -0
  723. package/dist/internal/providers/builtin/google.d.ts +6 -0
  724. package/dist/internal/providers/builtin/groq.d.ts +2 -0
  725. package/dist/internal/providers/builtin/index.d.ts +20 -0
  726. package/dist/internal/providers/builtin/llamacpp.d.ts +1 -0
  727. package/dist/internal/providers/builtin/lmstudio.d.ts +1 -0
  728. package/dist/internal/providers/builtin/mistral.d.ts +2 -0
  729. package/dist/internal/providers/builtin/ollama.d.ts +17 -0
  730. package/dist/internal/providers/builtin/openai-chatgpt.d.ts +14 -0
  731. package/dist/internal/providers/builtin/openai-compatible.d.ts +1 -0
  732. package/dist/internal/providers/builtin/openai.d.ts +2 -0
  733. package/dist/internal/providers/builtin/openrouter.d.ts +2 -0
  734. package/dist/internal/providers/builtin/perplexity.d.ts +5 -0
  735. package/dist/internal/providers/builtin/together.d.ts +2 -0
  736. package/dist/internal/providers/builtin/vertex.d.ts +27 -0
  737. package/dist/internal/providers/builtin/xai.d.ts +2 -0
  738. package/dist/internal/providers/catalog-loader.d.ts +55 -0
  739. package/dist/internal/providers/catalog-schema.d.ts +202 -0
  740. package/dist/internal/providers/catalog-source-models-dev.d.ts +80 -0
  741. package/dist/internal/providers/discovery.d.ts +14 -0
  742. package/dist/internal/providers/index.d.ts +8 -0
  743. package/dist/internal/providers/register-plugin-providers.d.ts +22 -0
  744. package/dist/internal/providers/registry.d.ts +13 -0
  745. package/dist/internal/providers/types.d.ts +11 -0
  746. package/dist/internal/retry/circuit-breaker.d.ts +26 -0
  747. package/dist/internal/retry/with-retry.d.ts +40 -0
  748. package/dist/internal/runtime/compat/compat-config-file.d.ts +31 -0
  749. package/dist/internal/runtime/compat/foreign-config-sources.d.ts +139 -0
  750. package/dist/internal/runtime/compression/compression-attempt.d.ts +24 -0
  751. package/dist/internal/runtime/compression/compression-config.d.ts +33 -0
  752. package/dist/internal/runtime/compression/compression-decision.d.ts +10 -0
  753. package/dist/internal/runtime/compression/compression-helpers.d.ts +18 -0
  754. package/dist/internal/runtime/compression/compression-model-registry.d.ts +41 -0
  755. package/dist/internal/runtime/compression/compression-summarizer.d.ts +34 -0
  756. package/dist/internal/runtime/config/default-model.d.ts +1 -0
  757. package/dist/internal/runtime/config/providers-manager.d.ts +1 -0
  758. package/dist/internal/runtime/config/workspace-dir.d.ts +9 -0
  759. package/dist/internal/runtime/context/context-aggregator.d.ts +26 -0
  760. package/dist/internal/runtime/context/context-discovery-runner.d.ts +80 -0
  761. package/dist/internal/runtime/context/context-discovery.d.ts +79 -0
  762. package/dist/internal/runtime/context/context-frontmatter.d.ts +16 -0
  763. package/dist/internal/runtime/context/context-glob.d.ts +1 -0
  764. package/dist/internal/runtime/context/context-import-resolver.d.ts +41 -0
  765. package/dist/internal/runtime/context/context-loaders.d.ts +42 -0
  766. package/dist/internal/runtime/context/context-manager.d.ts +28 -0
  767. package/dist/internal/runtime/context/context-mdc-parser.d.ts +25 -0
  768. package/dist/internal/runtime/context/context-rules-frontmatter.d.ts +99 -0
  769. package/dist/internal/runtime/context/context-yaml-lite.d.ts +26 -0
  770. package/dist/internal/runtime/context/project-instructions.d.ts +66 -0
  771. package/dist/internal/runtime/context/yaml-frontmatter.d.ts +20 -0
  772. package/dist/internal/runtime/fixtures/fixture-events.d.ts +12 -0
  773. package/dist/internal/runtime/fixtures/fixture-mode.d.ts +24 -0
  774. package/dist/internal/runtime/fixtures/fixture-responder.d.ts +1 -0
  775. package/dist/internal/runtime/fixtures/fixture-run-base.d.ts +96 -0
  776. package/dist/internal/runtime/fixtures/fixture-scripts.d.ts +21 -0
  777. package/dist/internal/runtime/fixtures/types.d.ts +1 -0
  778. package/dist/internal/runtime/hooks/hooks-executor.d.ts +49 -0
  779. package/dist/internal/runtime/hooks/hooks-source.d.ts +35 -0
  780. package/dist/internal/runtime/lifecycle/context-budget-event.d.ts +25 -0
  781. package/dist/internal/runtime/lifecycle/env-policy.d.ts +29 -0
  782. package/dist/internal/runtime/lifecycle/fork-agent.d.ts +15 -0
  783. package/dist/internal/runtime/lifecycle/goal-marker.d.ts +13 -0
  784. package/dist/internal/runtime/lifecycle/post-run-lifecycle.d.ts +16 -0
  785. package/dist/internal/runtime/lifecycle/run-to-completion.d.ts +22 -0
  786. package/dist/internal/runtime/lifecycle/run-until.d.ts +21 -0
  787. package/dist/internal/runtime/lifecycle/spawn-collect.d.ts +8 -0
  788. package/dist/internal/runtime/lifecycle/stream-to-completion.d.ts +31 -0
  789. package/dist/internal/runtime/lifecycle/wrap-completion-check-run.d.ts +30 -0
  790. package/dist/internal/runtime/memory-glue/memory-provider.d.ts +11 -0
  791. package/dist/internal/runtime/memory-glue/memory-store.d.ts +4 -0
  792. package/dist/internal/runtime/memory-glue/select-facts.d.ts +63 -0
  793. package/dist/internal/runtime/model-selection.d.ts +14 -0
  794. package/dist/internal/runtime/plugin-loader/plugin-bundles.d.ts +22 -0
  795. package/dist/internal/runtime/plugin-loader/plugin-frontmatter.d.ts +17 -0
  796. package/dist/internal/runtime/plugin-loader/plugins-manager.d.ts +1 -0
  797. package/dist/internal/runtime/processors/run-processors.d.ts +10 -0
  798. package/dist/internal/runtime/processors/tripwire-run.d.ts +16 -0
  799. package/dist/internal/runtime/processors/wrap-output-run.d.ts +18 -0
  800. package/dist/internal/runtime/registry/agent-factory-registry.d.ts +19 -0
  801. package/dist/internal/runtime/registry/agent-registry-contract.d.ts +31 -0
  802. package/dist/internal/runtime/registry/agent-registry-store.d.ts +75 -0
  803. package/dist/internal/runtime/registry/agent-registry.d.ts +6 -0
  804. package/dist/internal/runtime/registry/live-agent-registry.d.ts +132 -0
  805. package/dist/internal/runtime/registry/run-registry.d.ts +4 -0
  806. package/dist/internal/runtime/skills/discover-skills.d.ts +103 -0
  807. package/dist/internal/runtime/skills/skill-frontmatter.d.ts +6 -0
  808. package/dist/internal/runtime/skills/skills-block.d.ts +18 -0
  809. package/dist/internal/runtime/skills/skills-manager.d.ts +1 -0
  810. package/dist/internal/runtime/skills/subagent-tool-scope.d.ts +25 -0
  811. package/dist/internal/runtime/skills/subagents-loader.d.ts +1 -0
  812. package/dist/internal/runtime/system-prompt/escape.d.ts +1 -0
  813. package/dist/internal/runtime/system-prompt/local-assembly.d.ts +2 -0
  814. package/dist/internal/runtime/system-prompt/native-reasoning.d.ts +25 -0
  815. package/dist/internal/runtime/system-prompt/pipeline.d.ts +1 -0
  816. package/dist/internal/runtime/system-prompt/safe-call.d.ts +1 -0
  817. package/dist/internal/runtime/system-prompt/sources/active-memory-provider.d.ts +1 -0
  818. package/dist/internal/runtime/system-prompt/sources/base-provider.d.ts +1 -0
  819. package/dist/internal/runtime/system-prompt/sources/context-provider.d.ts +1 -0
  820. package/dist/internal/runtime/system-prompt/sources/memory-provider.d.ts +6 -0
  821. package/dist/internal/runtime/system-prompt/sources/reasoning-provider.d.ts +1 -0
  822. package/dist/internal/runtime/system-prompt/sources/skills-provider.d.ts +1 -0
  823. package/dist/internal/runtime/system-prompt/system-prompt.d.ts +1 -0
  824. package/dist/internal/runtime/system-prompt/types.d.ts +5 -0
  825. package/dist/internal/runtime/tools/shell-tool.d.ts +7 -0
  826. package/dist/internal/runtime/validation/validate-agent-options.d.ts +1 -0
  827. package/dist/internal/runtime/validation/validate-response.d.ts +18 -0
  828. package/dist/internal/scorers/levenshtein.d.ts +11 -0
  829. package/dist/internal/scorers/llm-judge.d.ts +41 -0
  830. package/dist/internal/security/index.cjs +52 -0
  831. package/dist/internal/security/index.cjs.map +1 -0
  832. package/dist/internal/security/index.d.cts +19 -0
  833. package/dist/internal/security/index.d.ts +19 -0
  834. package/dist/internal/security/index.js +7 -0
  835. package/dist/internal/security/index.js.map +1 -0
  836. package/dist/internal/security/path-containment.d.cts +24 -0
  837. package/dist/internal/security/path-containment.d.ts +24 -0
  838. package/dist/internal/security/path-guard.d.cts +166 -0
  839. package/dist/internal/security/path-guard.d.ts +166 -0
  840. package/dist/internal/security/redact.d.cts +74 -0
  841. package/dist/internal/security/redact.d.ts +74 -0
  842. package/dist/internal/security/test-reset.d.cts +10 -0
  843. package/dist/internal/security/test-reset.d.ts +10 -0
  844. package/dist/internal/session/agent-session-store.d.ts +65 -0
  845. package/dist/internal/session/agent-session.d.ts +48 -0
  846. package/dist/internal/session/compact-session.d.ts +97 -0
  847. package/dist/internal/session/index.d.ts +7 -0
  848. package/dist/internal/session/inject-session.d.ts +15 -0
  849. package/dist/internal/session/session-cache.d.ts +31 -0
  850. package/dist/internal/session/types.d.ts +46 -0
  851. package/dist/internal/structured-output-helpers.d.ts +54 -0
  852. package/dist/internal/task/registry.d.ts +60 -0
  853. package/dist/internal/task/ring-buffer.d.ts +10 -0
  854. package/dist/internal/task/store.d.ts +145 -0
  855. package/dist/internal/task/subscribe.d.ts +15 -0
  856. package/dist/internal/task/task-id.d.ts +22 -0
  857. package/dist/internal/task/task-run-event-bridge.d.ts +10 -0
  858. package/dist/internal/task/telemetry.d.ts +27 -0
  859. package/dist/internal/telemetry/adapter-registry.d.ts +12 -0
  860. package/dist/internal/telemetry/adapters/arize.d.ts +2 -0
  861. package/dist/internal/telemetry/adapters/braintrust.d.ts +7 -0
  862. package/dist/internal/telemetry/adapters/datadog.d.ts +2 -0
  863. package/dist/internal/telemetry/adapters/langfuse.d.ts +2 -0
  864. package/dist/internal/telemetry/adapters/langsmith.d.ts +7 -0
  865. package/dist/internal/telemetry/adapters/posthog.d.ts +2 -0
  866. package/dist/internal/telemetry/adapters/sentry.d.ts +2 -0
  867. package/dist/internal/telemetry/safe-require.d.ts +1 -0
  868. package/dist/internal/telemetry/span-names.d.ts +10 -0
  869. package/dist/internal/telemetry/tracer-loader.d.ts +20 -0
  870. package/dist/internal/telemetry/tracer.d.ts +57 -0
  871. package/dist/internal/tool-dispatch/repair-middleware.d.ts +34 -0
  872. package/dist/internal/tool-dispatch/strip-think.d.ts +22 -0
  873. package/dist/internal/tool-registry/personality-filter.d.ts +37 -0
  874. package/dist/internal/workflow/ctx.d.ts +24 -0
  875. package/dist/internal/workflow/error-shape.d.ts +7 -0
  876. package/dist/internal/workflow/event-stream.d.ts +13 -0
  877. package/dist/internal/workflow/evented-executor.d.ts +42 -0
  878. package/dist/internal/workflow/executor-helpers.d.ts +30 -0
  879. package/dist/internal/workflow/executor.d.ts +16 -0
  880. package/dist/internal/workflow/retry-policy.d.ts +14 -0
  881. package/dist/internal/workflow/run-id.d.ts +9 -0
  882. package/dist/internal/workflow/scheduler.d.ts +23 -0
  883. package/dist/internal/workflow/single-flight.d.ts +18 -0
  884. package/dist/internal/workflow/snapshot-store.d.ts +23 -0
  885. package/dist/internal/workflow/step-agent.d.ts +12 -0
  886. package/dist/internal/workflow/step-branch.d.ts +10 -0
  887. package/dist/internal/workflow/step-dowhile.d.ts +8 -0
  888. package/dist/internal/workflow/step-execution.d.ts +25 -0
  889. package/dist/internal/workflow/step-fn.d.ts +10 -0
  890. package/dist/internal/workflow/step-foreach.d.ts +11 -0
  891. package/dist/internal/workflow/step-parallel.d.ts +17 -0
  892. package/dist/internal/workflow/step-sleep.d.ts +7 -0
  893. package/dist/internal/workflow/telemetry.d.ts +21 -0
  894. package/dist/internal/zod-to-json-schema.d.ts +11 -0
  895. package/dist/job-queue.d.ts +68 -0
  896. package/dist/judge-call-46M2E5FA.cjs +22 -0
  897. package/dist/judge-call-46M2E5FA.cjs.map +1 -0
  898. package/dist/judge-call-FGUNNWEI.js +5 -0
  899. package/dist/judge-call-FGUNNWEI.js.map +1 -0
  900. package/dist/mcp-auth.cjs +314 -0
  901. package/dist/mcp-auth.cjs.map +1 -0
  902. package/dist/mcp-auth.d.cts +19 -0
  903. package/dist/mcp-auth.d.ts +19 -0
  904. package/dist/mcp-auth.js +307 -0
  905. package/dist/mcp-auth.js.map +1 -0
  906. package/dist/messages.cjs +24 -0
  907. package/dist/messages.cjs.map +1 -0
  908. package/dist/messages.d.cts +33 -0
  909. package/dist/messages.d.ts +33 -0
  910. package/dist/messages.js +20 -0
  911. package/dist/messages.js.map +1 -0
  912. package/dist/models.cjs +295 -0
  913. package/dist/models.cjs.map +1 -0
  914. package/dist/models.d.cts +18 -0
  915. package/dist/models.d.ts +18 -0
  916. package/dist/models.js +286 -0
  917. package/dist/models.js.map +1 -0
  918. package/dist/oauth-transaction-store-5RIR6D5C.js +5 -0
  919. package/dist/oauth-transaction-store-5RIR6D5C.js.map +1 -0
  920. package/dist/oauth-transaction-store-SXIE57OD.cjs +38 -0
  921. package/dist/oauth-transaction-store-SXIE57OD.cjs.map +1 -0
  922. package/dist/path-safety.cjs +39 -0
  923. package/dist/path-safety.cjs.map +1 -0
  924. package/dist/path-safety.d.cts +16 -0
  925. package/dist/path-safety.d.ts +16 -0
  926. package/dist/path-safety.js +6 -0
  927. package/dist/path-safety.js.map +1 -0
  928. package/dist/permission-engine.d.ts +134 -0
  929. package/dist/persistence.cjs +197 -0
  930. package/dist/persistence.cjs.map +1 -0
  931. package/dist/persistence.d.cts +40 -0
  932. package/dist/persistence.d.ts +40 -0
  933. package/dist/persistence.js +100 -0
  934. package/dist/persistence.js.map +1 -0
  935. package/dist/project.cjs +45 -0
  936. package/dist/project.cjs.map +1 -0
  937. package/dist/project.d.cts +14 -0
  938. package/dist/project.d.ts +14 -0
  939. package/dist/project.js +42 -0
  940. package/dist/project.js.map +1 -0
  941. package/dist/provider-catalog.json +1295 -0
  942. package/dist/providers.cjs +23 -0
  943. package/dist/providers.cjs.map +1 -0
  944. package/dist/providers.d.cts +31 -0
  945. package/dist/providers.d.ts +31 -0
  946. package/dist/providers.js +10 -0
  947. package/dist/providers.js.map +1 -0
  948. package/dist/registry-BZQFYRTL.cjs +46 -0
  949. package/dist/registry-BZQFYRTL.cjs.map +1 -0
  950. package/dist/registry-DMWCJKRF.js +9 -0
  951. package/dist/registry-DMWCJKRF.js.map +1 -0
  952. package/dist/retry.cjs +14 -0
  953. package/dist/retry.cjs.map +1 -0
  954. package/dist/retry.d.cts +35 -0
  955. package/dist/retry.d.ts +35 -0
  956. package/dist/retry.js +5 -0
  957. package/dist/retry.js.map +1 -0
  958. package/dist/run-CTAdRU3U.d.cts +1813 -0
  959. package/dist/run-CTAdRU3U.d.ts +1813 -0
  960. package/dist/run-to-completion-DRO77625.js +3 -0
  961. package/dist/run-to-completion-DRO77625.js.map +1 -0
  962. package/dist/run-to-completion-X4OWM673.cjs +48 -0
  963. package/dist/run-to-completion-X4OWM673.cjs.map +1 -0
  964. package/dist/run-until-6D6TQ4JN.js +146 -0
  965. package/dist/run-until-6D6TQ4JN.js.map +1 -0
  966. package/dist/run-until-DG2KXWB2.cjs +149 -0
  967. package/dist/run-until-DG2KXWB2.cjs.map +1 -0
  968. package/dist/sandbox/bwrap.d.cts +112 -0
  969. package/dist/sandbox/bwrap.d.ts +112 -0
  970. package/dist/sandbox/index.cjs +495 -0
  971. package/dist/sandbox/index.cjs.map +1 -0
  972. package/dist/sandbox/index.d.cts +13 -0
  973. package/dist/sandbox/index.d.ts +13 -0
  974. package/dist/sandbox/index.js +451 -0
  975. package/dist/sandbox/index.js.map +1 -0
  976. package/dist/sandbox/linux-sandbox.d.cts +218 -0
  977. package/dist/sandbox/linux-sandbox.d.ts +218 -0
  978. package/dist/sandbox/local-sandbox.d.cts +66 -0
  979. package/dist/sandbox/local-sandbox.d.ts +66 -0
  980. package/dist/sandbox/provision.d.cts +60 -0
  981. package/dist/sandbox/provision.d.ts +60 -0
  982. package/dist/sandbox/seccomp.d.cts +16 -0
  983. package/dist/sandbox/seccomp.d.ts +16 -0
  984. package/dist/sandbox/shell-escape.d.cts +8 -0
  985. package/dist/sandbox/shell-escape.d.ts +8 -0
  986. package/dist/sandbox/types.d.cts +143 -0
  987. package/dist/sandbox/types.d.ts +143 -0
  988. package/dist/sanitize/coerce.d.cts +1 -0
  989. package/dist/sanitize/coerce.d.ts +1 -0
  990. package/dist/sanitize/index.cjs +12 -0
  991. package/dist/sanitize/index.cjs.map +1 -0
  992. package/dist/sanitize/index.d.cts +9 -0
  993. package/dist/sanitize/index.d.ts +9 -0
  994. package/dist/sanitize/index.js +3 -0
  995. package/dist/sanitize/index.js.map +1 -0
  996. package/dist/sanitize/sanitize-tool-input.d.cts +11 -0
  997. package/dist/sanitize/sanitize-tool-input.d.ts +11 -0
  998. package/dist/sanitize/types.d.cts +52 -0
  999. package/dist/sanitize/types.d.ts +52 -0
  1000. package/dist/scorers.d.ts +181 -0
  1001. package/dist/sdk-agent-BOiKqOgL.d.cts +940 -0
  1002. package/dist/sdk-agent-D4a_BR_6.d.ts +940 -0
  1003. package/dist/server/auth/errors.d.cts +54 -0
  1004. package/dist/server/auth/errors.d.ts +54 -0
  1005. package/dist/server/auth/index.cjs +210 -0
  1006. package/dist/server/auth/index.cjs.map +1 -0
  1007. package/dist/server/auth/index.d.cts +244 -0
  1008. package/dist/server/auth/index.d.ts +244 -0
  1009. package/dist/server/auth/index.js +189 -0
  1010. package/dist/server/auth/index.js.map +1 -0
  1011. package/dist/server/auth/oauth-transaction-store.d.cts +52 -0
  1012. package/dist/server/auth/oauth-transaction-store.d.ts +52 -0
  1013. package/dist/server/auth/orchestrator.d.cts +15 -0
  1014. package/dist/server/auth/orchestrator.d.ts +15 -0
  1015. package/dist/server/auth/types.d.cts +109 -0
  1016. package/dist/server/auth/types.d.ts +109 -0
  1017. package/dist/server/auth/validate-return-to.d.cts +27 -0
  1018. package/dist/server/auth/validate-return-to.d.ts +27 -0
  1019. package/dist/server/errors-envelope.cjs +101 -0
  1020. package/dist/server/errors-envelope.cjs.map +1 -0
  1021. package/dist/server/errors-envelope.d.cts +67 -0
  1022. package/dist/server/errors-envelope.d.ts +67 -0
  1023. package/dist/server/errors-envelope.js +95 -0
  1024. package/dist/server/errors-envelope.js.map +1 -0
  1025. package/dist/session-transcript-LGHSNVY5.cjs +62 -0
  1026. package/dist/session-transcript-LGHSNVY5.cjs.map +1 -0
  1027. package/dist/session-transcript-VTBTCGQX.js +5 -0
  1028. package/dist/session-transcript-VTBTCGQX.js.map +1 -0
  1029. package/dist/skills.cjs +25 -0
  1030. package/dist/skills.cjs.map +1 -0
  1031. package/dist/skills.d.cts +19 -0
  1032. package/dist/skills.d.ts +19 -0
  1033. package/dist/skills.js +8 -0
  1034. package/dist/skills.js.map +1 -0
  1035. package/dist/stream-object-HBFMIZLD.js +7 -0
  1036. package/dist/stream-object-HBFMIZLD.js.map +1 -0
  1037. package/dist/stream-object-QSKHISDJ.cjs +20 -0
  1038. package/dist/stream-object-QSKHISDJ.cjs.map +1 -0
  1039. package/dist/stream-object.d.ts +73 -0
  1040. package/dist/stream-to-completion-QV5HCL3J.js +30 -0
  1041. package/dist/stream-to-completion-QV5HCL3J.js.map +1 -0
  1042. package/dist/stream-to-completion-SRISU5AB.cjs +32 -0
  1043. package/dist/stream-to-completion-SRISU5AB.cjs.map +1 -0
  1044. package/dist/subagents-loader-DOBTTICM.js +7 -0
  1045. package/dist/subagents-loader-DOBTTICM.js.map +1 -0
  1046. package/dist/subagents-loader-GEHYCMEX.cjs +16 -0
  1047. package/dist/subagents-loader-GEHYCMEX.cjs.map +1 -0
  1048. package/dist/subagents-loader.cjs +35 -0
  1049. package/dist/subagents-loader.cjs.map +1 -0
  1050. package/dist/subagents-loader.d.cts +90 -0
  1051. package/dist/subagents-loader.d.ts +90 -0
  1052. package/dist/subagents-loader.js +32 -0
  1053. package/dist/subagents-loader.js.map +1 -0
  1054. package/dist/subagents.cjs +18 -0
  1055. package/dist/subagents.cjs.map +1 -0
  1056. package/dist/subagents.d.cts +14 -0
  1057. package/dist/subagents.d.ts +14 -0
  1058. package/dist/subagents.js +15 -0
  1059. package/dist/subagents.js.map +1 -0
  1060. package/dist/subscription/define-subscription.d.cts +71 -0
  1061. package/dist/subscription/define-subscription.d.ts +71 -0
  1062. package/dist/subscription/index.cjs +408 -0
  1063. package/dist/subscription/index.cjs.map +1 -0
  1064. package/dist/subscription/index.d.cts +20 -0
  1065. package/dist/subscription/index.d.ts +20 -0
  1066. package/dist/subscription/index.js +400 -0
  1067. package/dist/subscription/index.js.map +1 -0
  1068. package/dist/subscription/internal/backpressure.d.cts +24 -0
  1069. package/dist/subscription/internal/backpressure.d.ts +24 -0
  1070. package/dist/subscription/internal/server-integration.d.cts +22 -0
  1071. package/dist/subscription/internal/server-integration.d.ts +22 -0
  1072. package/dist/subscription/internal/sse-encoder.d.cts +13 -0
  1073. package/dist/subscription/internal/sse-encoder.d.ts +13 -0
  1074. package/dist/subscription/internal/sse-parser.d.cts +15 -0
  1075. package/dist/subscription/internal/sse-parser.d.ts +15 -0
  1076. package/dist/subscription/internal/subscription-runtime.d.cts +21 -0
  1077. package/dist/subscription/internal/subscription-runtime.d.ts +21 -0
  1078. package/dist/subscription/internal/types.d.cts +11 -0
  1079. package/dist/subscription/internal/types.d.ts +11 -0
  1080. package/dist/subscription/internal/ws-adapter-node.d.cts +10 -0
  1081. package/dist/subscription/internal/ws-adapter-node.d.ts +10 -0
  1082. package/dist/subscription/theokit-subscribe.d.cts +54 -0
  1083. package/dist/subscription/theokit-subscribe.d.ts +54 -0
  1084. package/dist/subscription/types.d.cts +158 -0
  1085. package/dist/subscription/types.d.ts +158 -0
  1086. package/dist/task-errors.d.ts +58 -0
  1087. package/dist/task-store.cjs +23 -0
  1088. package/dist/task-store.cjs.map +1 -0
  1089. package/dist/task-store.d.cts +10 -0
  1090. package/dist/task-store.d.ts +10 -0
  1091. package/dist/task-store.js +6 -0
  1092. package/dist/task-store.js.map +1 -0
  1093. package/dist/tool-error.d.ts +30 -0
  1094. package/dist/types/agent-prims.d.ts +137 -0
  1095. package/dist/types/agent.d.ts +947 -0
  1096. package/dist/types/batch.d.ts +121 -0
  1097. package/dist/types/budget-tracker.d.ts +80 -0
  1098. package/dist/types/budget.d.ts +97 -0
  1099. package/dist/types/content-blocks.d.ts +50 -0
  1100. package/dist/types/context.d.ts +96 -0
  1101. package/dist/types/conversation.d.ts +127 -0
  1102. package/dist/types/cron.d.ts +172 -0
  1103. package/dist/types/env-policy.d.ts +21 -0
  1104. package/dist/types/eval.d.ts +255 -0
  1105. package/dist/types/fork.d.ts +52 -0
  1106. package/dist/types/goal-events.d.ts +144 -0
  1107. package/dist/types/index.d.ts +19 -0
  1108. package/dist/types/mcp.d.ts +90 -0
  1109. package/dist/types/memory-adapter.d.ts +189 -0
  1110. package/dist/types/memory-provider.d.ts +206 -0
  1111. package/dist/types/messages-base.d.ts +24 -0
  1112. package/dist/types/messages.d.ts +161 -0
  1113. package/dist/types/plugin.d.ts +308 -0
  1114. package/dist/types/processors.d.ts +87 -0
  1115. package/dist/types/provider-profile.d.ts +116 -0
  1116. package/dist/types/providers.d.ts +116 -0
  1117. package/dist/types/run-events.d.ts +197 -0
  1118. package/dist/types/run.d.ts +671 -0
  1119. package/dist/types/sdk-agent.d.ts +342 -0
  1120. package/dist/types/session-message.d.ts +62 -0
  1121. package/dist/types/session-record.d.ts +103 -0
  1122. package/dist/types/session-store.d.ts +104 -0
  1123. package/dist/types/task.d.ts +146 -0
  1124. package/dist/types/theokit.d.ts +73 -0
  1125. package/dist/types/trajectory.d.ts +52 -0
  1126. package/dist/types/updates.d.ts +184 -0
  1127. package/dist/types/usage.d.ts +64 -0
  1128. package/dist/types/workflow.d.ts +426 -0
  1129. package/dist/workflow-as-tool.d.ts +66 -0
  1130. package/dist/workflow-errors.d.ts +164 -0
  1131. package/dist/workflow.cjs +100 -0
  1132. package/dist/workflow.cjs.map +1 -0
  1133. package/dist/workflow.d.cts +911 -0
  1134. package/dist/workflow.d.ts +911 -0
  1135. package/dist/workflow.js +11 -0
  1136. package/dist/workflow.js.map +1 -0
  1137. package/docs/adr/README.md +2604 -0
  1138. package/docs/error-codes.md +253 -0
  1139. package/docs/harness-capability-map.md +1435 -0
  1140. package/docs/memory-decisions.md +265 -0
  1141. package/package.json +455 -0
@@ -0,0 +1,1871 @@
1
+ import { n as MemoryFact, k as MemoryAdapter, m as MemoryContext, E as SystemPromptSkillRef, C as ContextSettings, P as ProviderRoutingSettings, a as PluginsSettings, S as SDKAgent } from './sdk-agent-BOiKqOgL.cjs';
2
+ import { M as ModelSelection, C as CustomTool, c as PermissionMode, a as McpServerConfig, P as Processor } from './run-CTAdRU3U.cjs';
3
+
4
+ /**
5
+ * Owner: `src/` (1 of 2 importers). Derived from the import graph, not
6
+ * declared — `tests/lint/types-name-their-owner.test.ts` re-derives it.
7
+ *
8
+ * `SessionRecord` — the native on-disk transcript record shape (SE40).
9
+ *
10
+ * The theokit session format IS the Claude Code record shape: a
11
+ * `uuid`/`parentUuid` DAG of records with structured
12
+ * `text`/`tool_use`/`tool_result`/`thinking` blocks. This is the contract the
13
+ * pluggable {@link SessionStore} seam operates over.
14
+ *
15
+ * DIP-correct home (SE46): the contract lives in the domain `types/` layer;
16
+ * the application-layer DAG core (`internal/persistence/session-transcript.ts`)
17
+ * re-exports it for back-compat while owning the record builders + reader.
18
+ *
19
+ * @public
20
+ */
21
+ /** A content block inside {@link TranscriptMessage}. */
22
+ type TranscriptBlock = {
23
+ type: "text";
24
+ text: string;
25
+ } | {
26
+ type: "thinking";
27
+ thinking?: string;
28
+ signature?: string;
29
+ } | {
30
+ type: "tool_use";
31
+ id: string;
32
+ name: string;
33
+ input: unknown;
34
+ } | {
35
+ type: "tool_result";
36
+ tool_use_id: string;
37
+ content: unknown;
38
+ is_error?: boolean;
39
+ };
40
+ /**
41
+ * The message body of a {@link SessionRecord}.
42
+ *
43
+ * **It is NOT called `SessionMessage`** — that name already exists in
44
+ * `internal/session/session-types.ts` with the shape `{role, text}`, incompatible with this one.
45
+ * Reusing an exported name for a new shape is
46
+ * precisely the silent break M91 cost two patches to undo.
47
+ *
48
+ * Parsing from disk stays **tolerant** (`readTranscript` skips a malformed line): what changes here
49
+ * is the **type**, not leniency — records written by earlier versions stay readable.
50
+ *
51
+ * @public
52
+ */
53
+ interface TranscriptMessage {
54
+ role: "user" | "assistant";
55
+ content: TranscriptBlock[];
56
+ /**
57
+ * The three fields below appear **only** on the assistant record, and come from the writer
58
+ * (`SessionTranscript.appendAssistant`). Declared optional because the user record does not carry
59
+ * them — measured in the writer itself, not assumed.
60
+ */
61
+ id?: string;
62
+ type?: "message";
63
+ model?: string;
64
+ }
65
+ /**
66
+ * One transcript record — a single line of the session JSONL file, and the unit the pluggable
67
+ * `SessionStore` seam reads and writes.
68
+ *
69
+ * Records form a `uuid`/`parentUuid` DAG, not a flat list: `parentUuid` names the preceding record
70
+ * and is `null` at the root. Thread a session by following those links; a reader that assumes file
71
+ * order is linear will mis-thread one that branched.
72
+ *
73
+ * `message` is absent on `system` records — a compaction boundary carries `compactMetadata` instead —
74
+ * so it is optional even on records you would expect to be conversational, and `type` is what tells
75
+ * you which you are holding.
76
+ *
77
+ * Reading is deliberately tolerant: a malformed line is skipped rather than failing the whole read.
78
+ * Every record you receive is well-formed, but the file may have contained more than you got back,
79
+ * so this is not the type to use for an exact-count audit of what was written.
80
+ *
81
+ * @public
82
+ */
83
+ interface SessionRecord {
84
+ type: "user" | "assistant" | "system";
85
+ uuid: string;
86
+ parentUuid: string | null;
87
+ sessionId: string;
88
+ timestamp: string;
89
+ isSidechain?: boolean;
90
+ userType?: string;
91
+ cwd?: string;
92
+ version?: string;
93
+ subtype?: string;
94
+ compactMetadata?: {
95
+ preTokens: number;
96
+ trigger: string;
97
+ };
98
+ /**
99
+ * The message body, in the shape the transcript writer actually writes.
100
+ *
101
+ * M94 — it was `Record<string, unknown>`, and the consumer recovered the type with a cast on every read.
102
+ * The shape **has always been fixed** (`SessionTranscript.appendToolResults` / `#push` produce
103
+ * it); it simply was not declared. It stays optional because system records carry no message.
104
+ */
105
+ message?: TranscriptMessage;
106
+ }
107
+
108
+ /**
109
+ * Owner: `internal/session/` (4 of 8 importers). Derived from the import graph, not declared —
110
+ * `tests/lint/types-name-their-owner.test.ts` re-derives it.
111
+ *
112
+ * SE41 — the pluggable `SessionStore` seam over the NATIVE session transcript.
113
+ *
114
+ * A minimal, two-method port so an external store (Postgres / Redis / KV /
115
+ * durable object) can be the **primary store AND resume source** — the
116
+ * serverless (ephemeral FS) and multi-host / multi-pod use case that SE40
117
+ * dropped when it removed the `ConversationStorageAdapter`. This is deliberately
118
+ * NOT that removed ~10-method adapter: the seam is JUST record read/append over
119
+ * the native {@link SessionRecord} shape (no getMessages / getSessionMeta /
120
+ * delete / objective methods).
121
+ *
122
+ * The SDK ships a real default implementation, `FsSessionStore`, that reads and
123
+ * append-writes the native Claude-shaped `.jsonl` transcript — omitting
124
+ * `local.sessionStore` yields byte-identical current behavior (back-compat, zero
125
+ * consumer change). Injected via `local.sessionStore` for external stores.
126
+ *
127
+ * THIS SEAM DOES NOT HIDE THE STORAGE, AND IS NOT MEANT TO. A Repository
128
+ * abstracts a persistence model away; this one is defined in terms of the
129
+ * native one — the port speaks {@link SessionRecord}, "the exact SessionRecord
130
+ * the SDK writes", and the on-disk layout's path helpers (`encodeProjectDir`,
131
+ * `transcriptPath`, `transcriptRoot`) are published on purpose at
132
+ * `@theokit/sdk/persistence` so a consumer can locate a transcript file.
133
+ *
134
+ * That is the whole design and the reason the seam is two methods rather than
135
+ * ten: the format is the contract, and a store implements read/append over it.
136
+ * A consumer supplying `local.sessionStore` is NOT bound by those paths — they
137
+ * describe where the DEFAULT `FsSessionStore` puts files, not where an external
138
+ * store must.
139
+ *
140
+ * Consistency contract: `appendRecords` is append-only and ordering-preserving.
141
+ * The FS default serializes appends per agent with a cross-process file lock;
142
+ * external implementations own (and MUST document) their own concurrency
143
+ * guarantees for two hosts appending to the same `agentId`.
144
+ *
145
+ * @public
146
+ */
147
+
148
+ /**
149
+ * The pluggable session-store seam. Exactly two methods over the native
150
+ * {@link SessionRecord} shape.
151
+ *
152
+ * @public
153
+ */
154
+ interface SessionStore {
155
+ /**
156
+ * Return every persisted record for `agentId`, in append order. A session
157
+ * that was never written MUST resolve to `[]` (not throw) — a fresh agent has
158
+ * no history. The SDK reconstructs the resumable `LlmMessage[]` from these
159
+ * records via the native DAG reader, so the shape MUST be the exact
160
+ * {@link SessionRecord} the SDK writes.
161
+ *
162
+ * A store that cannot READ (e.g. the backing DB is unreachable on resume)
163
+ * MUST throw a typed error rather than silently returning `[]` — a silent
164
+ * empty read would masquerade as "no history" and drop the conversation.
165
+ */
166
+ readRecords(agentId: string): Promise<SessionRecord[]>;
167
+ /**
168
+ * Append `records` (the new-turn delta) to `agentId`'s session, append-only.
169
+ * MUST preserve order and MUST NOT drop or rewrite prior records — the native
170
+ * format is an append-only `parentUuid` DAG (compaction is a new-root
171
+ * `compact_boundary` record, still an append).
172
+ *
173
+ * Note on the write path: per-turn persistence is fire-and-forget so `send()`
174
+ * is never blocked by store I/O — an `appendRecords` rejection is logged to
175
+ * stderr, NOT thrown to the caller (best-effort write). An external store that
176
+ * must guarantee durability should make `appendRecords` resilient (retry /
177
+ * durable write) internally. This differs from {@link SessionStore.readRecords},
178
+ * which MUST throw on failure (a resume cannot proceed on a silent partial history).
179
+ */
180
+ appendRecords(agentId: string, records: readonly SessionRecord[]): Promise<void>;
181
+ /**
182
+ * Claim the single-writer lease for `agentId`, if this store has one. OPTIONAL.
183
+ *
184
+ * The SDK calls it when an agent starts and skips it when absent, so a two-method store keeps
185
+ * working unchanged — declaring it here does not require it, which is the whole reason it is
186
+ * optional. What declaring it DOES is make the capability discoverable: the SDK probed for this
187
+ * method through an `as unknown` cast against an interface that never mentioned it, so a
188
+ * third-party store author — the serverless / multi-pod case this port exists to serve — read a
189
+ * two-method interface, implemented two methods, and never learned the hook was there.
190
+ *
191
+ * CONTRACT, and the half that matters: a rejection whose `name` is `"SessionBusyError"` PROPAGATES
192
+ * to the caller, because another process holding the session is a decision the caller has to make
193
+ * (`exec` forks to a new id). Any other rejection is treated as "no lease available here" —
194
+ * logged, and the turn proceeds without single-writer protection, since the write is best-effort
195
+ * by contract anyway.
196
+ */
197
+ acquire?(agentId: string): Promise<void>;
198
+ /**
199
+ * Release the lease `acquire` claimed, if this store has one. OPTIONAL.
200
+ *
201
+ * Called on agent disposal. A rejection is not handled specially.
202
+ */
203
+ release?(agentId: string): Promise<void>;
204
+ /**
205
+ * Release store-level resources — a connection pool, a file handle. OPTIONAL.
206
+ *
207
+ * Called once, on agent disposal, after {@link SessionStore.release}.
208
+ */
209
+ dispose?(): Promise<void>;
210
+ }
211
+
212
+ /**
213
+ * A discovered skill's metadata. The skill BODY is never included — only the
214
+ * strict frontmatter fields plus the resolved `source` path.
215
+ *
216
+ * Public via `@theokit/sdk/skills`.
217
+ *
218
+ * @public
219
+ */
220
+ interface Skill$1 {
221
+ name: string;
222
+ description: string;
223
+ /** Absolute path to the discovered `SKILL.md`. */
224
+ source: string;
225
+ category?: string;
226
+ dependencies?: string[];
227
+ }
228
+
229
+ /**
230
+ * M22 — `createSkill`: define a skill in TypeScript, without a `SKILL.md` file on disk.
231
+ *
232
+ * An inline skill is usable ALONGSIDE filesystem skills (`AgentOptions.skills.inline`), and points
233
+ * an agent at code-defined capabilities without a `.theokit/skills/<name>/SKILL.md`. Like file
234
+ * skills, its `name` + `description` surface in the `<skills>` system-prompt block; its
235
+ * `instructions` (the body) travel on the object for the consumer (the SDK injects name+description,
236
+ * not bodies — inline and file skills are symmetric there). Inline skills override file skills on a
237
+ * name conflict (mirrors the subagents-loader precedent).
238
+ */
239
+
240
+ /** A code-defined skill (from {@link createSkill}) — a {@link Skill} plus its inline body. */
241
+ interface InlineSkill extends Skill$1 {
242
+ /** The skill body/instructions (inline skills carry it here instead of a SKILL.md file). */
243
+ instructions: string;
244
+ /**
245
+ * SE21 — supporting documents bundled with the skill (filename → content),
246
+ * mirroring a filesystem skill's `references/` directory. Surfaced to the app
247
+ * via `agent.skills.get(name)`; not injected into the model prompt.
248
+ */
249
+ references?: Record<string, string>;
250
+ }
251
+ /** Spec accepted by {@link createSkill}. */
252
+ interface CreateSkillSpec {
253
+ name: string;
254
+ description: string;
255
+ instructions: string;
256
+ category?: string;
257
+ dependencies?: string[];
258
+ /** SE21 — supporting documents (filename → content), like a filesystem skill's `references/`. */
259
+ references?: Record<string, string>;
260
+ }
261
+ /** SE36 — `Skill.create` replaces `createSkill` (ADR 0015). @public *
262
+ * `Skill.create` returns an **`InlineSkill`**, not a `Skill`. The class is the namespace;
263
+ * the inline skill descriptor is the product.
264
+ */
265
+ declare class Skill {
266
+ private constructor();
267
+ static create(spec: CreateSkillSpec): InlineSkill;
268
+ }
269
+
270
+ /**
271
+ * Owner: `internal/budget/tracker/` (1 of 1 importers). Derived from the import graph, not
272
+ * declared — `tests/lint/types-name-their-owner.test.ts` re-derives it.
273
+ *
274
+ * `BudgetTracker` — runtime contract for budget/usage tracking in the
275
+ * agent loop (SDK 2.0 Phase 2 / T2.1 — ADR D1 interface inversion).
276
+ *
277
+ * This interface is the FOUNDATION for the eventual extraction of the
278
+ * Budget subsystem to `@theokit/sdk-budget`. The kernel depends on this
279
+ * contract (not on `UsageAccumulator` / `IterationBudget` concrete classes)
280
+ * so the implementation can move to a separate package without circular
281
+ * imports.
282
+ *
283
+ * DIP-correct home (SE46): the contract types live in the domain `types/`
284
+ * layer; the application-layer implementation
285
+ * (`internal/budget/tracker/budget-tracker.ts`) re-exports them for
286
+ * back-compat while owning the concrete trackers.
287
+ *
288
+ * @public — surface-level interface; impl is internal-but-replaceable.
289
+ */
290
+ /** Single usage event recorded during one LLM call. */
291
+ interface BudgetUsageEvent {
292
+ /** Token count for this event. */
293
+ readonly tokens: number;
294
+ /** Provider/model identifier (e.g., `"openai/gpt-4o-mini"`). */
295
+ readonly model: string;
296
+ /** Whether this is an input (prompt) or output (completion) measurement. */
297
+ readonly type: "input" | "output";
298
+ /** Optional ISO 8601 timestamp; defaults to now() if omitted. */
299
+ readonly at?: string;
300
+ }
301
+ /** Decision the tracker returns on each iteration / pre-flight check. */
302
+ interface BudgetCheck {
303
+ /** Whether the agent loop is allowed to proceed. */
304
+ readonly allowed: boolean;
305
+ /**
306
+ * When `allowed` is false, names the reason in a stable, codemod-friendly
307
+ * form. Consumers map this to retry / surface to user / abort behavior.
308
+ */
309
+ readonly reason?: "budget_exceeded" | "iteration_limit" | "cost_limit" | "token_limit" | "custom";
310
+ /** Free-form details for logs / diagnostics. */
311
+ readonly detail?: string;
312
+ }
313
+ /** Aggregate snapshot of usage so far. */
314
+ interface BudgetTotal {
315
+ /** Sum of all input + output tokens. */
316
+ readonly tokens: number;
317
+ /** USD cost when pricing data is available; `undefined` otherwise. */
318
+ readonly costUsd?: number;
319
+ /** Iteration count if the impl tracks it. */
320
+ readonly iterations?: number;
321
+ }
322
+ /**
323
+ * The kernel-facing contract. Implementations live OUTSIDE the agent loop
324
+ * (in `@theokit/sdk-budget` after Phase 2 / in `internal/budget/` until then).
325
+ *
326
+ * Implementations MUST be:
327
+ * - **Synchronous** — every method returns a value, never a Promise.
328
+ * `track()` is on the hot path (called on every iteration); async would
329
+ * bloat the loop with floating promises and force every call site to
330
+ * await.
331
+ * - **Non-throwing in track()** — record-only semantics. Validation
332
+ * failures bubble up via `check()` instead.
333
+ */
334
+ interface BudgetTracker {
335
+ /** Record a single usage event. MUST be synchronous and non-throwing. */
336
+ track(event: BudgetUsageEvent): void;
337
+ /** Pre-flight check before the next iteration. */
338
+ check(): BudgetCheck;
339
+ /** Snapshot of accumulated totals (for telemetry / final reporting). */
340
+ getTotal(): BudgetTotal;
341
+ /**
342
+ * Advance the iteration counter by one. Called by the agent loop ONCE per
343
+ * completed turn (M1-1) so that trackers which gate on `maxIterations`
344
+ * (e.g. `createCounterBudgetTracker`) actually halt. OPTIONAL: trackers that
345
+ * only gate on tokens/USD omit it and the loop no-ops via optional chaining.
346
+ * MUST be synchronous and non-throwing.
347
+ */
348
+ nextIteration?(): void;
349
+ }
350
+
351
+ /**
352
+ * Owner: `internal/memory/storage/` (1 of 2 importers). Derived from the import graph, not
353
+ * declared — `tests/lint/types-name-their-owner.test.ts` re-derives it.
354
+ *
355
+ * `MemoryProvider` — kernel-facing port for the memory subsystem
356
+ * (SDK 2.0 Phase 1 / T1.1 — Hexagonal Architecture / Ports & Adapters,
357
+ * SOLID Dependency Inversion).
358
+ *
359
+ * The agent loop kernel depends on THIS CONTRACT — not on the concrete
360
+ * `internal/memory/*` modules. Default adapter ships with `@theokit/sdk`
361
+ * (no-op for back-compat); rich impl ships in `@theokit/sdk-memory`.
362
+ * Consumers opt-in via `Agent.create({ memoryProvider: ... })`.
363
+ *
364
+ * DIP-correct home (SE46): the port + companion contract types live in the
365
+ * domain `types/` layer; the application-layer module
366
+ * (`internal/runtime/memory-glue/memory-provider.ts`) re-exports them for
367
+ * back-compat while the concrete providers live under `internal/`.
368
+ *
369
+ * Layered model (mirrors Budget):
370
+ * - `MemoryAdapter` (in `types/memory-adapter.ts`) — LOW-LEVEL data port:
371
+ * write / recall / delete primitives.
372
+ * - `MemoryProvider` (THIS FILE) — HIGH-LEVEL lifecycle port: init,
373
+ * tool factories, active memory pass, embedding runtime selection.
374
+ *
375
+ * @public — surface-level interface; impls are internal-but-replaceable.
376
+ */
377
+
378
+ /**
379
+ * The agent identity a `MemoryProvider` is given — the whole of it.
380
+ *
381
+ * `buildTools` used to declare `agent: SDKAgent`, a 33-member interface, and the agent loop satisfied
382
+ * it with `{ agentId, model } as SDKAgent`. The cast is what made it compile, and it suppressed
383
+ * exactly the check that mattered: an implementation reaching for any of the other 31 members —
384
+ * `send()`, `fork()`, `dispose()` — gets `undefined is not a function` at runtime with no
385
+ * compile-time signal.
386
+ *
387
+ * Two fields is what the port actually offers, so two fields is what it declares. `SDKAgent`
388
+ * structurally satisfies this, so a caller holding a real agent still passes it, and TypeScript's
389
+ * bivariant method parameters mean an existing implementation typed `agent: SDKAgent` still compiles.
390
+ * What changes is that the fabricated ref no longer needs a cast to exist.
391
+ */
392
+ interface MemoryProviderAgentRef {
393
+ readonly agentId: string;
394
+ readonly model: ModelSelection | undefined;
395
+ }
396
+ /** Result of `MemoryProvider.runActivePass(...)` — what the kernel injects into the LLM call. */
397
+ interface ActiveMemoryPassResult {
398
+ /** Compressed memory facts to seed the LLM's context window for this turn. */
399
+ readonly facts: ReadonlyArray<MemoryFact>;
400
+ /** Optional system-prompt enrichment derived from the recalled facts. */
401
+ readonly systemPromptAdditions?: string;
402
+ /** Whether the active-memory circuit breaker tripped (degraded mode). */
403
+ readonly breakerTripped?: boolean;
404
+ }
405
+ /** Arguments for `MemoryProvider.runActivePass(...)`. */
406
+ interface ActiveMemoryPassArgs {
407
+ /** The current user message — used as the recall query. */
408
+ readonly userMessage: string;
409
+ /** Conversation history (most recent first). */
410
+ readonly history: ReadonlyArray<{
411
+ role: "user" | "assistant";
412
+ content: string;
413
+ }>;
414
+ /** Agent identity for scope. */
415
+ readonly agentId: string;
416
+ }
417
+ /**
418
+ * Arguments for `MemoryProvider.recordSessionSummary(...)`
419
+ * (SDK 2.0 Phase 1 physical Stage 3 prep — iter 27).
420
+ *
421
+ * The "session summary" is the markdown that gets written to disk
422
+ * after a finished run + indexed under `corpus="sessions"`. This
423
+ * port method lets sdk-core's `post-run-lifecycle.ts` delegate the
424
+ * write to the provider instead of importing
425
+ * `internal/memory/storage/session-summary-writer.ts` directly.
426
+ *
427
+ * @public
428
+ */
429
+ interface RecordSessionSummaryArgs {
430
+ /**
431
+ * Workspace cwd where on-disk artefacts live. Included on the args
432
+ * (not on a handle) because `recordSessionSummary` is STATELESS — it
433
+ * runs AFTER `runAgentLoop`'s `dispose()` releases the per-run handle.
434
+ * The kernel passes its own `workspaceCwd`; the impl uses it to
435
+ * compute the markdown file path.
436
+ */
437
+ readonly cwd: string;
438
+ /**
439
+ * The memory root the kernel resolved for this agent, from `memory.directory` or the default.
440
+ *
441
+ * Supplied by the kernel, never constructed by an implementor — which is why it is required
442
+ * rather than optional. An implementation that recomputed it from `cwd` would write the summary
443
+ * into a different directory than the one the rest of the subsystem uses (#463).
444
+ */
445
+ readonly memoryRoot: MemoryRoot;
446
+ /** Run id used as the filename key. */
447
+ readonly runId: string;
448
+ /** Agent identity for scope (foldering). */
449
+ readonly agentId: string;
450
+ /** Verbatim user message that started the run. */
451
+ readonly userText: string;
452
+ /** Final assistant text the run produced. */
453
+ readonly assistantText: string;
454
+ /** Final run status (only "finished" is recorded today). */
455
+ readonly status: "finished" | "error" | "cancelled";
456
+ /** Wall-clock ms at write time. */
457
+ readonly at: number;
458
+ }
459
+ /** Options for `MemoryProvider.init(...)`. */
460
+ interface MemoryProviderInitOptions {
461
+ /** Workspace cwd where on-disk artefacts live (`.theokit/memory/...`). */
462
+ readonly cwd: string;
463
+ /** Embedding-provider id (`"openai" | "ollama" | ...`); when omitted the impl picks a default. */
464
+ readonly embeddingProviderId?: string;
465
+ }
466
+ /**
467
+ * Opaque handle returned by `init()`. Carried back into other methods so
468
+ * the impl can stash per-agent state (index, breaker, cache, …) without
469
+ * exposing it to the kernel.
470
+ */
471
+ interface MemoryProviderHandle {
472
+ /** Adapter interface for direct read/write — matches existing `MemoryAdapter` shape. */
473
+ readonly adapter: MemoryAdapter;
474
+ /** Implementation-defined opaque field (private state pointer / index handle). */
475
+ readonly [implState: symbol]: unknown;
476
+ }
477
+ /**
478
+ * The kernel-facing contract. Implementations live OUTSIDE the agent loop
479
+ * (in `@theokit/sdk-memory` after Phase 1; in `internal/memory/` until then).
480
+ *
481
+ * Implementations MUST be:
482
+ * - **Lazy** — `init()` may be called once per agent; subsequent calls
483
+ * return the same handle (impl decides via cache). Heavy work
484
+ * (loading the index, opening SQLite) deferred until first use.
485
+ * - **Non-throwing on the hot path** — `runActivePass()` returns an
486
+ * empty `facts: []` on degradation rather than throwing. Errors
487
+ * surface via the breakerTripped flag + telemetry.
488
+ */
489
+ interface MemoryProvider {
490
+ /** Construct or fetch the per-agent handle. Lazy + idempotent. */
491
+ init(opts: MemoryProviderInitOptions): Promise<MemoryProviderHandle>;
492
+ /** Build the LLM-facing tool catalog (memory_search, memory_get, …). */
493
+ buildTools(handle: MemoryProviderHandle, agent: MemoryProviderAgentRef): ReadonlyArray<CustomTool>;
494
+ /** Run the active-memory pre-LLM pass — recall + compress + format. */
495
+ runActivePass(handle: MemoryProviderHandle, args: ActiveMemoryPassArgs): Promise<ActiveMemoryPassResult>;
496
+ /**
497
+ * Optional post-run hook (SDK 2.0 Phase 1 physical Stage 1 — iter 19).
498
+ * Called by the agent loop AFTER a successful send so the impl can
499
+ * incorporate the session summary into its index (e.g., re-index the
500
+ * `sessions` corpus so the next recall sees it).
501
+ *
502
+ * Fire-and-forget at the call site; impl MUST be idempotent +
503
+ * non-throwing. Optional so existing impls (createNoopMemoryProvider,
504
+ * sdk-memory@0.1.0) keep working without modification.
505
+ *
506
+ * Mirrors the role of `LocalAgentMemory.syncIfReady()` in sdk-core's
507
+ * legacy memory path — exposing it via the port is the seam that
508
+ * unblocks moving LocalAgentMemory's logic out to sdk-memory.
509
+ */
510
+ sync?(handle: MemoryProviderHandle): Promise<void> | void;
511
+ /**
512
+ * Optional session-summary write hook (SDK 2.0 Phase 1 physical
513
+ * Stage 3 prep — iter 27, refined iter 28).
514
+ *
515
+ * Called by `post-run-lifecycle.ts` AFTER a finished run to persist
516
+ * the run's session-summary markdown under `corpus="sessions"`. When
517
+ * defined, the kernel delegates the write to the provider; when
518
+ * undefined, post-run-lifecycle falls back to the direct
519
+ * `writeSessionSummary` import (legacy path, until Stage 3 source
520
+ * move drops that import entirely).
521
+ *
522
+ * STATELESS — does NOT take a `MemoryProviderHandle` because post-run-
523
+ * lifecycle runs AFTER `runAgentLoop` disposed the per-run handle.
524
+ * `cwd` lives on `args` instead. Impls that need per-agent state can
525
+ * cache it via closure inside the provider factory.
526
+ *
527
+ * Impl MUST be non-throwing on the hot path. The kernel swallows
528
+ * any throw + emits a stderr warning.
529
+ *
530
+ * Optional so existing impls (createNoopMemoryProvider,
531
+ * createInMemoryMarkdownProvider) keep working without modification.
532
+ */
533
+ recordSessionSummary?(args: RecordSessionSummaryArgs): Promise<void> | void;
534
+ /** Release the handle (close index, flush caches). Idempotent + non-throwing. */
535
+ dispose(handle: MemoryProviderHandle): Promise<void> | void;
536
+ }
537
+ /**
538
+ * A directory that has been RESOLVED as a memory root, distinguished from a bare `cwd`.
539
+ *
540
+ * Structural rather than a `unique symbol` brand: a `unique symbol` is identity-based and the d.ts
541
+ * bundler inlines the declaration into each package that re-exports it, so `@theokit/sdk-memory`
542
+ * ended up with a `MemoryRoot` its own compiler considered incompatible with the SDK's, on values
543
+ * that were the same string. A structural tag refuses a bare `string` exactly as well and survives
544
+ * the package boundary, which is where this type has to work.
545
+ *
546
+ * G7 / DIP — defined HERE, in the domain types layer, rather than in
547
+ * `internal/memory/storage/memory-root.ts`. It was defined in the adapter and reached for from this
548
+ * file, which made the port depend on the adapter for a field of its own argument type; the runtime
549
+ * helpers (`resolveMemoryRoot`, `asMemoryRoot`) stay in the adapter and import it from here.
550
+ *
551
+ * @public
552
+ */
553
+ type MemoryRoot = string & {
554
+ readonly __memoryRoot: "resolved";
555
+ };
556
+
557
+ /**
558
+ * Owner: `internal/providers/` (1 of 1 importers). Derived from the import graph, not
559
+ * declared — `tests/lint/types-name-their-owner.test.ts` re-derives it.
560
+ *
561
+ * ProviderProfile + ApiMode + AuthType contract types (T3.1, ADR D105).
562
+ *
563
+ * Profile is **data-only** — no methods. Adding a provider is declaring an
564
+ * object literal; the Transport layer (D106) consumes `apiMode` to pick
565
+ * the HTTP dialect.
566
+ *
567
+ * SE45/SE46 — relocated from `internal/providers/types.ts` into `types/` so the
568
+ * public contract (embedded in the `Plugin` type) lives above the DIP boundary;
569
+ * `internal/providers/types.ts` re-exports these names for back-compat.
570
+ *
571
+ * @public
572
+ */
573
+ type ApiMode = "chat_completions" | "anthropic_messages" | "responses_api" | "bedrock" | "bedrock_anthropic";
574
+ type AuthType = "api_key" | "oauth_device_code" | "oauth_external" | "aws_sdk" | "aws_bearer" | "gcp_oauth" | "none";
575
+ /**
576
+ * M41 (agent-builder provider framework) — the context a provider's `transform` receives per request. An
577
+ * object from day one so it can grow without breaking (M42 adds the resolved `credential`).
578
+ *
579
+ * @public
580
+ */
581
+ interface ProviderTransformContext {
582
+ /** The bearer the router resolved for this request (env var, injected key, or an oauth access token). */
583
+ apiKey: string;
584
+ }
585
+ /**
586
+ * M41 — the one OPTIONAL behavior seam on a provider profile. It lets a provider own its per-request auth:
587
+ * `fetch` is the universal seam (a provider that returns its own fetch fully controls headers + refresh, for
588
+ * every transport that accepts a fetch); `headers` is a convenience merged over `extraHeaders` on transports
589
+ * that carry them (responses_api). A provider owns its per-request auth material plus transparent token
590
+ * refresh, expressed against theokit's transport model.
591
+ * Closes the gap where a `ProviderProfile` could only declare STATIC headers.
592
+ *
593
+ * @public
594
+ */
595
+ interface ProviderTransform {
596
+ /**
597
+ * Dynamic per-request headers, merged OVER the profile's static `extraHeaders`, and spread AFTER the
598
+ * transport's base `authorization`/`content-type`. A provider that owns its auth MAY intentionally set
599
+ * `authorization` here to override the resolved bearer — but a stray `authorization`/`content-type` key
600
+ * will silently replace the base header, so return only the headers you mean to add.
601
+ */
602
+ headers?(ctx: ProviderTransformContext): Record<string, string>;
603
+ /** A fetch to use for this provider's requests (refresh-aware / fully provider-controlled). */
604
+ fetch?(ctx: ProviderTransformContext): typeof fetch;
605
+ }
606
+ /**
607
+ * A data-only declaration of an LLM provider: its name, HTTP dialect, auth style, base URL and
608
+ * fallback models. There is nothing to implement — the router selects the transport from `apiMode` —
609
+ * so any OpenAI- or Anthropic-compatible endpoint (Groq, Together, Fireworks, a private gateway)
610
+ * becomes a provider without new code.
611
+ *
612
+ * A profile does nothing by itself. Wrap it with `Provider.create(profile)` and pass the resulting
613
+ * plugin to `Agent.create({ plugins: [...] })`; from there you route to it with the `provider/model`
614
+ * id prefix or through `providers.routes`.
615
+ *
616
+ * `name` is the routing prefix and `aliases` adds alternatives to it. `envVars` lists the environment
617
+ * variables that may supply the credential, and `authType` says what kind of credential that is.
618
+ *
619
+ * Reach for `transform` only when static data genuinely is not enough — a provider that computes
620
+ * headers per request or refreshes its own token. Leaving it absent keeps the profile on the pure
621
+ * data path. If you do supply `headers`, note that they are spread AFTER the transport's own
622
+ * `authorization` and `content-type`, so returning either key replaces the base header rather than
623
+ * adding to it.
624
+ */
625
+ interface ProviderProfile {
626
+ name: string;
627
+ apiMode: ApiMode;
628
+ aliases?: ReadonlyArray<string>;
629
+ displayName?: string;
630
+ description?: string;
631
+ signupUrl?: string;
632
+ envVars: ReadonlyArray<string>;
633
+ authType: AuthType;
634
+ baseUrl: string;
635
+ modelsUrl?: string;
636
+ hostname?: string;
637
+ fallbackModels: ReadonlyArray<string>;
638
+ extraHeaders?: Record<string, string>;
639
+ /**
640
+ * M45 — explicit chat-completions path override (data-only). Absent, the transport derives it: a baseUrl
641
+ * whose path already carries a version segment (`/v1`, `/v2beta`, …) gets `/chat/completions` appended;
642
+ * a host-only baseUrl keeps the legacy `/v1/chat/completions`. Set this for shapes neither rule expresses
643
+ * (e.g. Perplexity's unversioned `/chat/completions`).
644
+ */
645
+ chatCompletionsPath?: string;
646
+ bodyOverrides?: Record<string, unknown>;
647
+ /**
648
+ * M41 — the optional per-request behavior seam (dynamic headers + refresh-aware fetch). Absent ⇒ the profile
649
+ * is pure data and takes the static path byte-for-byte. See {@link ProviderTransform}.
650
+ */
651
+ transform?: ProviderTransform;
652
+ /**
653
+ * Opt-in leaked-dialect safe-parse (theokit#58 follow-up). When `true`, a chat_completions finish
654
+ * with ZERO native `tool_calls` has its assistant content scanned for the Hermes
655
+ * `<function=…></tool_call>` dialect and any recovered calls are surfaced as real `tool_calls`.
656
+ * Default off — only enable for routes/models known to leak (e.g. a qwen3-coder profile variant).
657
+ */
658
+ extractToolCallsFromContent?: boolean;
659
+ /**
660
+ * Opt-in encrypted-reasoning carry for `apiMode: "responses_api"` (usetheokit/theokit-sdk#383).
661
+ * When `true`, the request adds `include: ["reasoning.encrypted_content"]` and
662
+ * `reasoning.context: "all_turns"`, and the transport replays the ciphertext the provider returned
663
+ * so the model does not re-derive its chain of thought on every round of a turn.
664
+ *
665
+ * Default off, and deliberately per-profile rather than per-`apiMode`: `include` is a documented
666
+ * Responses-API field but `reasoning.context` is not, so a provider that validates strictly
667
+ * answers it with `400`. Enable it only for a backend measured to accept both — the builtin
668
+ * `openai-chatgpt` profile is one, because issue #383 captured OpenAI Codex sending exactly these
669
+ * fields to that endpoint. Ignored by every other `apiMode`.
670
+ */
671
+ encryptedReasoning?: boolean;
672
+ }
673
+
674
+ /**
675
+ * The fixed set of points a `"general"` plugin may attach to through `PluginContext.on`. A closed
676
+ * enum rather than an open string, so a plugin cannot register for a hook the loop never fires.
677
+ *
678
+ * What separates them is what the SDK does with the handler's return value, and that is the thing to
679
+ * settle before writing one:
680
+ *
681
+ * - `pre_tool_call` is the only VETO point. Return `{ block: true, message }` to stop the call; the
682
+ * first handler that blocks wins and the remaining handlers are not consulted.
683
+ * - `transform_tool_result` and `transform_llm_output` are CHAINED. Each handler receives what the
684
+ * previous one returned; `undefined` keeps the current value and anything else — `null` included —
685
+ * replaces it.
686
+ * - `pre_user_send` returns `{ recalledContext }`, which the loop concatenates across handlers and
687
+ * injects ahead of the user prompt.
688
+ * - Everything else (`post_tool_call`, `pre_llm_call`, `post_llm_call`, `on_session_start`,
689
+ * `on_session_end`, `post_assistant_reply`) is fire-and-forget: the return value is DISCARDED. A
690
+ * policy that needs to change a tool result belongs on `transform_tool_result` — put it on
691
+ * `post_tool_call` and it quietly degrades to observation.
692
+ *
693
+ * Failure is asymmetric too. A fire-and-forget or transform handler that throws is caught, logged to
694
+ * stderr, and the run continues. A `pre_tool_call` handler that throws is NOT caught by the hook
695
+ * dispatcher, so its exception escapes into the tool-dispatch path — a permission-style handler
696
+ * should resolve its own errors to an explicit block rather than relying on that.
697
+ */
698
+ type HookName = "pre_tool_call" | "post_tool_call" | "pre_llm_call" | "post_llm_call" | "on_session_start" | "on_session_end" | "transform_tool_result" | "transform_llm_output" | "pre_user_send" | "post_assistant_reply";
699
+ /**
700
+ * What a `pre_tool_call` handler is given: the tool about to run, the arguments the model produced
701
+ * for it, and the identity of the run asking.
702
+ *
703
+ * `args` came from the model, not from a validated caller. A handler that gates on argument values
704
+ * must treat every field as untrusted and survive one that is missing or of the wrong type.
705
+ *
706
+ * `permissionMode` is the run's resolved mode — `SendOptions.permissionMode` falling back to
707
+ * `AgentOptions.permissionMode` — threaded here so a permission-style plugin can gate per run rather
708
+ * than at construction time. Absent means neither was set, and the plugin's own default applies;
709
+ * plugins that are not about permissions ignore it.
710
+ */
711
+ interface PreToolCallContext {
712
+ name: string;
713
+ args: Record<string, unknown>;
714
+ agentId: string;
715
+ runId: string;
716
+ /**
717
+ * SE1 — the run's resolved `PermissionMode` (from `SendOptions.permissionMode`
718
+ * ?? `AgentOptions.permissionMode`), threaded so a permission-style plugin can
719
+ * gate per-run rather than at construction time. Absent ⇒ the plugin's own
720
+ * default applies. Ignored by non-permission plugins.
721
+ */
722
+ permissionMode?: PermissionMode;
723
+ }
724
+ /**
725
+ * The veto a `pre_tool_call` handler returns to stop a tool call. Returning `undefined` allows it —
726
+ * there is no approval value, and `block` is the literal `true`, so `{ block: false }` is not
727
+ * expressible and cannot be used to force a call through.
728
+ *
729
+ * The first blocking handler decides; later `pre_tool_call` handlers never run.
730
+ *
731
+ * `message` is not a log line. The loop turns the veto into a `tool_result` reading "Plugin blocked
732
+ * this tool call: <message>", deliberately NOT flagged as an error, so the model reads it and can
733
+ * choose another route instead of the run failing. Write it for the model: say what was refused and
734
+ * what it might do instead. It also reaches observability — as the `stderr` of a tool-completed event
735
+ * with exit code 126, and as the message on a `permission_denied` run event.
736
+ */
737
+ interface PreToolCallDecision {
738
+ block: true;
739
+ message: string;
740
+ }
741
+ /** #65 — context for the `post_tool_call` hook (fired after a tool runs). @public */
742
+ interface PostToolCallContext {
743
+ name: string;
744
+ args: Record<string, unknown>;
745
+ result: {
746
+ stdout: string;
747
+ stderr: string;
748
+ exitCode?: number | null;
749
+ };
750
+ agentId: string;
751
+ runId: string;
752
+ }
753
+ /** #65 — context for the `on_session_start` / `on_session_end` hooks. @public */
754
+ interface SessionLifecycleContext {
755
+ agentId: string;
756
+ runId: string;
757
+ }
758
+ /** #65 — context for the `transform_tool_result` / `transform_llm_output` hooks. @public */
759
+ interface TransformContext {
760
+ agentId: string;
761
+ runId: string;
762
+ }
763
+ /**
764
+ * M82 — one tool call of the turn, as seen by `transform_tool_result`. `id` is the correlation key
765
+ * back into the batch: it equals the `toolUseId` of the matching `tool_result` part.
766
+ *
767
+ * @public
768
+ */
769
+ interface ToolCallSummary {
770
+ id: string;
771
+ name: string;
772
+ args: Record<string, unknown>;
773
+ }
774
+ /**
775
+ * M82 — context for `transform_tool_result`, the only tool-stage hook whose return value the SDK
776
+ * actually applies (`#runTransform` folds it; `#runFireAndForget` discards `post_tool_call`'s).
777
+ *
778
+ * Before M82 this seam knew only `{agentId, runId}`, so a hook could transform results but could not
779
+ * tell WHICH tool produced which one. A policy scoped to a tool name — the common case — therefore
780
+ * had to live on `post_tool_call`, whose return is discarded, and silently degraded to observation.
781
+ *
782
+ * `toolCalls` is PLURAL because the seam is batch-shaped: `dispatchTools` runs every tool call of the
783
+ * turn and the hook receives all results together. A singular `name` would have to lie in any
784
+ * multi-tool turn. Correlate with `LlmToolResultPart.toolUseId === ToolCallSummary.id`.
785
+ *
786
+ * Kept separate from {@link TransformContext} on purpose: that type is shared with
787
+ * `transform_llm_output`, which has no tool call at all, and an optional field there would be
788
+ * permanently `undefined` for half its consumers.
789
+ *
790
+ * @public
791
+ */
792
+ interface ToolResultTransformContext extends TransformContext {
793
+ toolCalls: readonly ToolCallSummary[];
794
+ }
795
+ /**
796
+ * Context passed to `pre_user_send` hook handlers (ADR D145).
797
+ *
798
+ * @public
799
+ */
800
+ interface PreUserSendContext {
801
+ prompt: string;
802
+ agentId: string;
803
+ runId: string;
804
+ /** Caller-supplied memory context, flowing through from `AgentOptions.memoryContext`. */
805
+ memoryContext?: MemoryContext;
806
+ /** Forwarded `AbortSignal` so adapter recall HTTP can be cancelled mid-flight (EC-H). */
807
+ signal?: AbortSignal;
808
+ }
809
+ /**
810
+ * Optional result returned by `pre_user_send` handlers. The agent loop
811
+ * concatenates `recalledContext` from all handlers and injects it as a
812
+ * `<memory-context>...</memory-context>` block before the user prompt.
813
+ *
814
+ * @public
815
+ */
816
+ interface PreUserSendResult {
817
+ recalledContext?: string;
818
+ }
819
+ /**
820
+ * Context passed to `post_assistant_reply` hook handlers (ADR D145).
821
+ * Fire-and-forget — exceptions are caught and surfaced to stderr; the
822
+ * caller's `wait()` never blocks on this dispatch.
823
+ *
824
+ * @public
825
+ */
826
+ interface PostAssistantReplyContext {
827
+ prompt: string;
828
+ reply: string;
829
+ agentId: string;
830
+ runId: string;
831
+ /**
832
+ * `true` when the run that produced `reply` called at least one tool (#358).
833
+ *
834
+ * A reply produced by a tool call is not safely replayable: re-serving the text hands a later
835
+ * caller the RESULT of a `write_file` / HTTP POST / payment without the side effect having
836
+ * happened. A semantic cache must skip storing such a reply, and before this field existed it
837
+ * had nothing to key on and assumed `false`.
838
+ *
839
+ * Derived from the run's replayed event stream, so it counts tool calls the run actually made,
840
+ * not tools the agent merely has.
841
+ */
842
+ usedTools: boolean;
843
+ memoryContext?: MemoryContext;
844
+ }
845
+ type HookHandler = (ctx: unknown) => unknown | Promise<unknown>;
846
+ type CommandHandler = (args: Record<string, unknown>) => Promise<string> | string;
847
+ interface CommandOptions {
848
+ description?: string;
849
+ }
850
+ /**
851
+ * Detaches a hook handler attached with {@link PluginContext.on}. Idempotent.
852
+ *
853
+ * @public
854
+ */
855
+ type PluginHookDisposer = () => void;
856
+ /**
857
+ * The registration surface passed to a `"general"` plugin's `register(ctx)`, and the plugin's only
858
+ * route into the agent. Outside production it is a sealed Proxy that throws when a plugin assigns a
859
+ * property of its own, so smuggling state onto the context fails loudly in development.
860
+ *
861
+ * `register` runs ONCE, when the plugin is registered — never per run. Anything the plugin wants to
862
+ * do during a turn has to be attached here as a hook; there is no later entry point. Each plugin gets
863
+ * its own context, so registrations stay attributable to the plugin that made them.
864
+ *
865
+ * Two things worth knowing before writing one. Commands registered here are consumed by CLI and bot
866
+ * wrappers only — the agent loop never dispatches them, so a plugin that ships nothing but commands
867
+ * has no effect on a programmatic run. And `on` drops a handler that is not a function, with a
868
+ * warning on stderr rather than an error at registration: the gentler failure, and the easier one to
869
+ * miss.
870
+ *
871
+ * `on` returns a {@link PluginHookDisposer}: calling it detaches that one handler, and calling it
872
+ * again is a no-op. A plugin that registers a hook per run and never detaches is the leak this
873
+ * exists to make fixable.
874
+ *
875
+ * @public
876
+ */
877
+ interface PluginContext {
878
+ /** Register a custom tool. Equivalent to passing in `AgentOptions.tools`. */
879
+ registerTool(tool: CustomTool): void;
880
+ /** Register a slash-command-style handler. Consumed by CLI/bot wrappers; NOT used by the agent loop. */
881
+ registerCommand(name: string, handler: CommandHandler, opts?: CommandOptions): void;
882
+ /**
883
+ * Attach a hook handler. `pre_tool_call` supports veto via `PreToolCallDecision`.
884
+ *
885
+ * Returns a disposer that detaches THIS handler. Calling it twice is a no-op, and a handler the
886
+ * SDK refused (a non-function, which is warned and ignored) returns a disposer that does nothing —
887
+ * so the caller never has to branch on whether the registration took.
888
+ *
889
+ * It used to return `void`, which made this a one-way door: a plugin registered through
890
+ * `initialize()` had no removal path and its handlers ran for the life of the process. The one
891
+ * documented dynamic case — the ACP permission plugin, re-installed on every prompt — worked only
892
+ * because `#byName` keys the replacement, so re-registering the WHOLE plugin was the only way to
893
+ * detach one hook. Two observers in this package already return their own disposer
894
+ * (`FixtureRunBase.onDidChangeStatus`) or offer an explicit removal (`MessageBus.unregister`).
895
+ */
896
+ on(hook: HookName, handler: HookHandler): PluginHookDisposer;
897
+ /** Inject a user/system message into the next agent turn. v1 supports only `on_session_start` context. */
898
+ injectMessage(content: string, role?: "user" | "system"): void;
899
+ }
900
+ interface BasePlugin {
901
+ name: string;
902
+ version: string;
903
+ }
904
+ /**
905
+ * Memory provider factory shape (ADR D141). Returns a `MemoryAdapter`
906
+ * (sync) or a Promise resolving to one (lazy HTTP probe / config load).
907
+ *
908
+ * Adapters live in `@theokit-memory-*` packages; the SDK never imports
909
+ * them. Factory rejection is caught by the plugin manager and surfaced
910
+ * as `ConfigurationError(code: "plugin_factory_failed")` (EC-F) — never
911
+ * an unhandled rejection.
912
+ *
913
+ * PUBLIC, deliberately (#335). This type is the shape a consumer must satisfy
914
+ * to write a memory plugin: it is named by the PUBLIC `Plugin` union below, in
915
+ * the `createProvider` position. It used to carry the internal-visibility JSDoc
916
+ * tag, which made `stripInternal` delete the declaration while the union went
917
+ * on referencing it — so the published `.d.ts` named a type it did not declare.
918
+ * Invisible under `skipLibCheck`, and an `error`-typed graph for any consumer
919
+ * running type-aware lint. A type reachable from a public signature is public
920
+ * whatever the tag says; the tag was the thing that was wrong.
921
+ *
922
+ * Do NOT write that tag's literal spelling anywhere in this comment. It is
923
+ * matched as text, so a JSDoc block that merely MENTIONS it is stripped exactly
924
+ * as if it had declared it — which is how the first attempt at this fix failed,
925
+ * with a build error naming a symbol whose own explanation had re-hidden it.
926
+ */
927
+ type MemoryProviderFactory = (cwd: string) => MemoryAdapter | Promise<MemoryAdapter>;
928
+ type Plugin = (BasePlugin & {
929
+ kind: "general";
930
+ register: (ctx: PluginContext) => void | Promise<void>;
931
+ }) | (BasePlugin & {
932
+ kind: "model-provider";
933
+ profile: ProviderProfile;
934
+ }) | (BasePlugin & {
935
+ kind: "memory";
936
+ createProvider: MemoryProviderFactory;
937
+ });
938
+
939
+ /**
940
+ * Which on-disk settings layers a local agent loads.
941
+ *
942
+ * @public
943
+ */
944
+ type SettingSource = "project" | "user" | "team" | "mdm" | "plugins" | "all";
945
+ /**
946
+ * A foreign configuration dialect this SDK can read.
947
+ *
948
+ * A DIFFERENT axis from {@link SettingSource}, and collapsing the two would be wrong: that one is
949
+ * about SCOPE (user vs project, and the trust posture behind it), this one about which product's
950
+ * format a project wants imported. A project can legitimately want project scope with `.theokit/`
951
+ * only — which is now the default.
952
+ *
953
+ * @public
954
+ */
955
+ type CompatSource = "claude-code" | CompatSourceAdapter;
956
+ /**
957
+ * A surface a foreign configuration source may be admitted to.
958
+ *
959
+ * They are named separately because they carry very different risk. A skill is TEXT that enters the
960
+ * system prompt; a subagent is a definition; a plugin is CODE LOADING; a hook is COMMAND EXECUTION.
961
+ * Reusing the skills you already wrote for another product is a reasonable thing to want, and it is
962
+ * not a reason to hand that product's directory the right to run commands.
963
+ *
964
+ * @public
965
+ */
966
+ type CompatSurface = "hooks" | "plugins" | "skills" | "subagents";
967
+ /**
968
+ * A foreign source admitted to named surfaces only.
969
+ *
970
+ * ```ts
971
+ * local: { compatSources: [{ kind: "claude-code", import: ["skills", "subagents"] }] }
972
+ * ```
973
+ *
974
+ * `import` is not optional in spirit even though it is in the type: an adapter that omits it
975
+ * imports NOTHING. That is deliberate and it is the fail-closed rule this whole option exists to
976
+ * serve — a typo in a surface name must narrow access, never widen it.
977
+ *
978
+ * The bare `"claude-code"` string keeps meaning every surface. It is what `5.0.0-next.1` published,
979
+ * and silently narrowing it would turn a working opt-in into a no-op that says nothing — which is
980
+ * the defect usetheokit/theokit-sdk#524 reports, one level up.
981
+ *
982
+ * @public
983
+ */
984
+ interface CompatSourceAdapter {
985
+ readonly kind: "claude-code";
986
+ readonly import?: readonly CompatSurface[];
987
+ }
988
+ /**
989
+ * A tool the SDK declares to the model on its own initiative — not one the consumer passed in
990
+ * {@link AgentOptions.tools}, and not one an MCP server exposed.
991
+ *
992
+ * These three names are also the ones the SDK reserves: a custom tool may not claim them. Listing
993
+ * one in {@link AgentOptions.withheldBuiltinTools} both stops it being declared and releases the
994
+ * name, because nothing of the SDK's is occupying it any more.
995
+ *
996
+ * Named for usetheokit/theokit-sdk#381, which is the report that the catalog had no opt-out.
997
+ *
998
+ * @public
999
+ */
1000
+ type BuiltinToolName = "shell" | "memory_search" | "memory_get";
1001
+ /**
1002
+ * Local agent configuration.
1003
+ *
1004
+ * TWO THINGS A LOCAL AGENT DOES BY DEFAULT, both reported as surprises (#338):
1005
+ *
1006
+ * 1. **A `shell` tool is always registered**, including when you pass `tools: []`. Every local
1007
+ * agent can therefore read any file reachable from {@link LocalOptions.cwd}. One report describes
1008
+ * an evaluation invalidated this way: the working directory held the benchmark's answer key, and
1009
+ * two transcripts show the model citing it. Deny it explicitly if that matters —
1010
+ * `{ tool: "shell", action: "deny" }` on a {@link PermissionEngine} rule is terminal under every
1011
+ * permission mode, including `bypass`. A deny rule still leaves the tool in the advertised
1012
+ * catalog, so the model may attempt it and be refused; to keep it out of the catalog entirely,
1013
+ * pass `withheldBuiltinTools: ["shell"]` on {@link AgentOptions} (usetheokit/theokit-sdk#381).
1014
+ *
1015
+ * 2. **Finished runs write a transcript to disk**, at `.theokit/memory/sessions/<runId>.md` under
1016
+ * the workspace `cwd`, with the full prompt and reply. This happens with no `memory` config and
1017
+ * with `settingSources: []` — it is what `memory_search({ corpus: "sessions" })` reads. Opt out
1018
+ * with `memory: { enabled: false }`, which suppresses the write entirely
1019
+ * (usetheokit/theokit-sdk#382). Leaving `memory`
1020
+ * unset still writes, so if the workspace is a git repository, add `.theokit/` to `.gitignore`:
1021
+ * one report describes a transcript reaching a public repo before it was noticed.
1022
+ *
1023
+ * @public
1024
+ */
1025
+ interface LocalOptions {
1026
+ /**
1027
+ * Workspace root(s). Also the reach of the always-present `shell` tool — see the note on
1028
+ * {@link LocalOptions}, and the transcript written under `.theokit/memory/sessions/` here.
1029
+ */
1030
+ cwd?: string | string[];
1031
+ settingSources?: SettingSource[];
1032
+ /**
1033
+ * Foreign configuration dialects to import. Default: none — `.theokit/` only.
1034
+ *
1035
+ * `.claude/` used to be read unconditionally across hooks, plugins, skills and subagents, so a
1036
+ * repository that merely had Claude Code set up had its hooks executed, its skills folded into
1037
+ * the system prompt and its subagents registered, having configured nothing for this SDK
1038
+ * (usetheokit/theokit-sdk#524). One consequence was every turn being denied, because those hook
1039
+ * commands are written against a runtime that defines `$CLAUDE_PROJECT_DIR` and this one did not
1040
+ * (#522).
1041
+ *
1042
+ * A trust gate answers "do I trust the code in this directory?". That is a different question
1043
+ * from "do I want another product's configuration imported into this one?", and they come apart
1044
+ * in the ordinary case: a repository you trust completely is exactly where `.claude/` is
1045
+ * populated — for a different tool, by a different contract, often by a teammate who never heard
1046
+ * of this SDK.
1047
+ *
1048
+ * Listing a dialect is all-or-nothing for that dialect, and restores exactly the previous
1049
+ * behaviour. On a name collision `.theokit/` wins: the native definition is the one the project
1050
+ * wrote for this runtime.
1051
+ */
1052
+ compatSources?: CompatSource[];
1053
+ sandboxOptions?: {
1054
+ enabled: boolean;
1055
+ };
1056
+ /**
1057
+ * Directory for the native Claude-shaped session transcript
1058
+ * (`<sessionDir>/projects/<encoded-cwd>/<agentId>.jsonl`). Default `~/.theokit`.
1059
+ * Set to `~/.claude` to write sessions the Claude Code CLI can `--continue`.
1060
+ *
1061
+ * **This is not the working directory** — that is {@link LocalOptions.cwd},
1062
+ * four lines above. Only transcripts are written here.
1063
+ *
1064
+ * Introduced in #301 as the unambiguous name for what `baseDir` always meant.
1065
+ */
1066
+ sessionDir?: string;
1067
+ /**
1068
+ * @deprecated Renamed to {@link LocalOptions.sessionDir} (#301). Still honoured,
1069
+ * and `sessionDir` wins when both are set.
1070
+ *
1071
+ * "Base directory" reads as the directory the agent works in, sitting in an
1072
+ * interface whose `cwd` is the one that actually means that. Setting it to
1073
+ * `"./"` — which is what the name invites — runs without error and writes
1074
+ * `./projects/<encoded-cwd>/<agentId>.jsonl` into the caller's repository root.
1075
+ * Nothing warns, because nothing is wrong from the code's point of view.
1076
+ */
1077
+ baseDir?: string;
1078
+ /**
1079
+ * SE41 — inject an external {@link import("./session-store.js").SessionStore}
1080
+ * (Postgres / Redis / KV / durable object) as the PRIMARY session store and
1081
+ * resume source. Omit for the default FS transcript store (`baseDir` above) —
1082
+ * byte-identical to SE40. Use this for serverless (ephemeral FS) or multi-host /
1083
+ * multi-pod deployments where a resumed agent must read its history from a shared
1084
+ * store instead of local disk. The records stay the native Claude-shaped shape,
1085
+ * so `--continue` interop is preserved (a store may also mirror to `~/.claude`).
1086
+ */
1087
+ sessionStore?: SessionStore;
1088
+ }
1089
+ /**
1090
+ * Repo to clone into a cloud agent's VM.
1091
+ *
1092
+ * @public
1093
+ */
1094
+ interface CloudRepo {
1095
+ url: string;
1096
+ startingRef?: string;
1097
+ prUrl?: string;
1098
+ }
1099
+ /**
1100
+ * Cloud execution environment.
1101
+ *
1102
+ * @public
1103
+ */
1104
+ interface CloudEnv {
1105
+ type: "cloud" | "pool" | "machine";
1106
+ name?: string;
1107
+ }
1108
+ /**
1109
+ * Cloud agent configuration.
1110
+ *
1111
+ * @public
1112
+ */
1113
+ interface CloudOptions {
1114
+ env?: CloudEnv;
1115
+ repos?: CloudRepo[];
1116
+ workOnCurrentBranch?: boolean;
1117
+ autoCreatePR?: boolean;
1118
+ skipReviewerRequest?: boolean;
1119
+ /**
1120
+ * Short-lived credentials scoped to the agent. Encrypted at rest, deleted
1121
+ * with the agent. Names must not start with `THEOKIT_`.
1122
+ */
1123
+ envVars?: Record<string, string>;
1124
+ }
1125
+ /**
1126
+ * Subagent definition. The parent agent spawns these via its Agent tool.
1127
+ *
1128
+ * @public
1129
+ */
1130
+ interface AgentDefinition {
1131
+ description: string;
1132
+ prompt: string;
1133
+ /**
1134
+ * Absolute path to the `.md` this subagent was read from, when it came from disk.
1135
+ *
1136
+ * ABSENT for a subagent declared in code through {@link AgentOptions.subagents} — "you passed
1137
+ * this one in" is a different fact from "read from disk", and one value for both would trade one
1138
+ * silence for another.
1139
+ *
1140
+ * It exists so a listing can answer which root a subagent came from, which
1141
+ * usetheokit/theokit-sdk#524 asks for by name: a consumer could not tell that an agent arrived
1142
+ * from `.claude/agents/` rather than its own directory, and silent inheritance is what made that
1143
+ * take a debugging session to notice. `HookCommand.sourcePath` and `Skill.source` already
1144
+ * answered it for the other two surfaces.
1145
+ */
1146
+ source?: string;
1147
+ model?: ModelSelection | "inherit";
1148
+ mcpServers?: Array<string | Record<string, McpServerConfig>>;
1149
+ /**
1150
+ * Tool whitelist (M4-6). When set, the sub-agent may ONLY call tools whose
1151
+ * canonical (post-repair, lowercase) name is in this list — any other tool
1152
+ * call is vetoed at dispatch via the same `withToolWhitelist` enforcement
1153
+ * forks use (NOT `PermissionEngine`). Absent/empty → unscoped (inherits the
1154
+ * parent's full toolset). Apply with `withSubagentToolScope`.
1155
+ */
1156
+ tools?: string[];
1157
+ /**
1158
+ * Per-subagent shell sandbox toggle. When `true`, the spawned child runs with
1159
+ * `local.sandboxOptions.enabled = true` (the SDK's boolean shell sandbox). Absent
1160
+ * ⇒ inherit the parent's sandbox posture. The SDK has no granular sandbox *mode*
1161
+ * (read-only / workspace-write / danger); a mode string in the disk frontmatter is
1162
+ * a typed load error, not a silent boolean coercion. Reasoning effort is NOT a
1163
+ * field here — it rides inside `model.params` (e.g. `[{ id: "thinking", value: "low" }]`).
1164
+ */
1165
+ sandbox?: boolean;
1166
+ }
1167
+ /**
1168
+ * Public view of a recalled memory fact exposed to the system-prompt resolver.
1169
+ *
1170
+ * @public
1171
+ */
1172
+ interface SystemPromptMemoryFact {
1173
+ text: string;
1174
+ }
1175
+ /**
1176
+ * Context passed to a {@link SystemPromptResolver}. Field order is a
1177
+ * compatibility contract: new fields are appended, never reordered.
1178
+ *
1179
+ * @public
1180
+ */
1181
+ interface SystemPromptContext {
1182
+ agentId: string;
1183
+ cwd: string | undefined;
1184
+ model: ModelSelection | undefined;
1185
+ skills: ReadonlyArray<SystemPromptSkillRef>;
1186
+ userMessage: string;
1187
+ /** Recalled durable facts when memory is enabled. Appended in v1.1. */
1188
+ memory: ReadonlyArray<SystemPromptMemoryFact>;
1189
+ }
1190
+ /**
1191
+ * Resolver function that produces the system prompt dynamically. Receives
1192
+ * the {@link SystemPromptContext} and returns a string (or a Promise of one).
1193
+ *
1194
+ * The SDK does NOT impose a timeout on the resolver — wrap your own
1195
+ * `Promise.race` if you call into slow resources. Errors propagate to the
1196
+ * caller of `agent.send()`.
1197
+ *
1198
+ * @public
1199
+ */
1200
+ type SystemPromptResolver = (ctx: SystemPromptContext) => string | Promise<string>;
1201
+ /**
1202
+ * Skills configuration accepted by `Agent.create()` via
1203
+ * {@link AgentOptions.skills}.
1204
+ *
1205
+ * Skills are discovered from `.theokit/skills/<name>/SKILL.md` when
1206
+ * `local.settingSources` includes `"project"`.
1207
+ *
1208
+ * @public
1209
+ */
1210
+ interface SkillsSettings {
1211
+ /**
1212
+ * Names of skills the parent agent may invoke. When omitted, every
1213
+ * discovered skill is enabled.
1214
+ */
1215
+ enabled?: string[];
1216
+ /**
1217
+ * Whether the SDK auto-injects the loaded skill list (name + description) as a
1218
+ * `<skills>` block in the LLM system prompt. Default `true`.
1219
+ *
1220
+ * Set to `false` when supplying a custom `systemPrompt` resolver that formats
1221
+ * skills itself.
1222
+ */
1223
+ autoInject?: boolean;
1224
+ /**
1225
+ * M22 — discover skills from a CUSTOM directory (containing `<name>/SKILL.md`) instead of the
1226
+ * default `<cwd>/.theokit/skills`. Absent ⇒ the default root.
1227
+ */
1228
+ skillsDir?: string;
1229
+ /**
1230
+ * M22 — code-defined skills (from `createSkill`) merged with the discovered ones. An inline skill
1231
+ * overrides a discovered file skill of the same name.
1232
+ */
1233
+ inline?: InlineSkill[];
1234
+ }
1235
+ /**
1236
+ * SE22 — context passed to a {@link SkillsResolver}. Mirrors
1237
+ * {@link SystemPromptContext} MINUS `skills`: the resolver runs BEFORE skills
1238
+ * are assembled, so the resolved list does not exist yet.
1239
+ *
1240
+ * @public
1241
+ */
1242
+ interface SkillsResolverContext {
1243
+ agentId: string;
1244
+ /** Workspace cwd. `string | undefined` mirrors {@link SystemPromptContext}; a local agent always passes a concrete path. */
1245
+ cwd: string | undefined;
1246
+ model: ModelSelection | undefined;
1247
+ userMessage: string;
1248
+ /** Recalled durable facts when memory is enabled. */
1249
+ memory: ReadonlyArray<SystemPromptMemoryFact>;
1250
+ }
1251
+ /**
1252
+ * SE22 — a resolver that produces {@link SkillsSettings} per run from runtime
1253
+ * context (e.g. the user's role). Mirrors the {@link SystemPromptResolver}
1254
+ * pattern: evaluated per `send()` BEFORE skill assembly, so a cached
1255
+ * `getOrCreate` agent re-resolves on every run.
1256
+ *
1257
+ * The SDK imposes NO timeout — wrap your own `Promise.race` for slow sources. A
1258
+ * throwing resolver fails the run (no silent fallback — Rule 8). Cloud agents
1259
+ * reject a function resolver (it can't run on PaaS); resolve to a static
1260
+ * {@link SkillsSettings} object before `Agent.create()`.
1261
+ *
1262
+ * @public
1263
+ */
1264
+ type SkillsResolver = (ctx: SkillsResolverContext) => SkillsSettings | Promise<SkillsSettings>;
1265
+ /**
1266
+ * Memory configuration accepted by `Agent.create()` via {@link AgentOptions.memory}.
1267
+ *
1268
+ * Persists durable facts under `.theokit/memory/<namespace>/<scope>-<userId>.json`.
1269
+ *
1270
+ * @public
1271
+ */
1272
+ interface MemorySettings {
1273
+ enabled: boolean;
1274
+ namespace?: string;
1275
+ userId?: string;
1276
+ scope?: "agent" | "user" | "team";
1277
+ storePath?: string;
1278
+ /**
1279
+ * Where this agent's memory lives. Default `<cwd>/.theokit/memory`.
1280
+ *
1281
+ * Must be an absolute path or start with `~/` — a relative value is refused rather than
1282
+ * resolved, because the two plausible bases put the store in two different places.
1283
+ *
1284
+ * Point it at `~/.claude/projects/<encoded-cwd>/memory` to WRITE where the Claude Code CLI
1285
+ * reads. That store is READ unconditionally either way, so setting this is only needed to
1286
+ * share the writes.
1287
+ */
1288
+ directory?: string;
1289
+ /**
1290
+ * Whether the SDK auto-injects recalled facts as a `<memory>` block in the
1291
+ * LLM system prompt. Default `true`.
1292
+ */
1293
+ autoInject?: boolean;
1294
+ /**
1295
+ * Index + tools configuration (memory-system-peer-project-parity).
1296
+ *
1297
+ * When `tools !== false`, the SDK registers `memory_search` and
1298
+ * `memory_get` with the LLM. Backed by SQLite + FTS5 (and sqlite-vec
1299
+ * when an embedding provider is configured).
1300
+ */
1301
+ index?: {
1302
+ /** Whether to register `memory_search` + `memory_get` tools. Default `true`. */
1303
+ tools?: boolean;
1304
+ /**
1305
+ * Vector index backend (ADR D43). Default `"sqlite-vec"`. Set to
1306
+ * `"lance"` to use `@lancedb/lancedb` (optional peer dep) for scale.
1307
+ */
1308
+ backend?: "sqlite-vec" | "lance";
1309
+ /** Embedding provider config. When omitted, the index runs in FTS-only mode. */
1310
+ embedding?: {
1311
+ provider: "openai" | "mistral" | "openrouter" | "voyage" | "deepinfra";
1312
+ model?: string;
1313
+ };
1314
+ };
1315
+ /**
1316
+ * Active Memory blocking recall (Phase 7). When `enabled: true`, runs
1317
+ * before each `send()` and prepends an `<active-memory>` block.
1318
+ */
1319
+ activeRecall?: {
1320
+ enabled?: boolean;
1321
+ queryMode?: "message" | "recent" | "full";
1322
+ timeoutMs?: number;
1323
+ maxSummaryChars?: number;
1324
+ persistTranscripts?: boolean;
1325
+ };
1326
+ }
1327
+ /**
1328
+ * Telemetry configuration for an agent. When `enabled: true`, the SDK emits
1329
+ * OpenTelemetry spans for `agent.send`, `llm.call`, `tool.call`, and
1330
+ * `memory.search`. See ADR D34.
1331
+ *
1332
+ * Privacy: content (prompts, responses, tool args) is OMITTED by default —
1333
+ * only timing/counts/IDs are recorded. Opt in via `includeContent: true`
1334
+ * to add prompt/response/args events to the spans (consumer's
1335
+ * responsibility to sanitize PII).
1336
+ *
1337
+ * `@opentelemetry/api` is an OPTIONAL peer dependency — declared, so your package manager can
1338
+ * tell you the version range, and not installed for you. Without it, telemetry is a NO-OP even
1339
+ * when `enabled: true`: the tracer is loaded lazily inside a try/catch, so nothing throws and
1340
+ * nothing is recorded. A run that reports no spans with `enabled: true` is almost always this,
1341
+ * not a misconfigured collector.
1342
+ *
1343
+ * @public
1344
+ */
1345
+ interface TelemetrySettings {
1346
+ /** Master switch. Default `false`. */
1347
+ enabled: boolean;
1348
+ /** Whether to include prompts/responses/tool args as span events. Default `false`. */
1349
+ includeContent?: boolean;
1350
+ /** Exporter selection. Default `"console"`. Custom exporters are passed-through. */
1351
+ exporter?: "console" | "otlp" | unknown;
1352
+ /** Service name on emitted spans. Default `"theokit-sdk"`. */
1353
+ serviceName?: string;
1354
+ /**
1355
+ * Auto-detect and register OTel exporters for installed observability
1356
+ * libs (Langfuse, Sentry, PostHog) via `createRequire` feature-detect.
1357
+ * Default `true`. See ADR D42.
1358
+ */
1359
+ autoDetect?: boolean;
1360
+ /**
1361
+ * Per-adapter opt-out. Lowercase names: `"langfuse" | "sentry" | "posthog"`.
1362
+ * Default `[]`.
1363
+ */
1364
+ disable?: string[];
1365
+ }
1366
+ /**
1367
+ * Top-level options accepted by `Agent.create()`.
1368
+ *
1369
+ * Pass either `local` or `cloud` to pick a runtime.
1370
+ *
1371
+ * @public
1372
+ */
1373
+ interface AgentOptions {
1374
+ /**
1375
+ * The model to run. SE8 — accepts a bare-string id shorthand
1376
+ * (`"openai/gpt-4o-mini"`, normalized to `{ id }`) OR a {@link ModelSelection}
1377
+ * object (use the object form to pass `params`).
1378
+ */
1379
+ model?: string | ModelSelection;
1380
+ /** Falls back to `THEOKIT_API_KEY`. */
1381
+ apiKey?: string;
1382
+ name?: string;
1383
+ /**
1384
+ * When `true`, `Agent.prompt` (and any helper that goes through `run.wait()`)
1385
+ * rejects with `AgentRunError` instead of resolving with `{ status: 'error' }`.
1386
+ * Cancelled runs (`status: 'cancelled'`) still resolve — cancel ≠ error.
1387
+ * If `result.error` is undefined despite `status: 'error'` (malformed RunResult),
1388
+ * the defensive guard resolves normally (no throw).
1389
+ *
1390
+ * Default `false` (backwards-compatible).
1391
+ *
1392
+ * @public
1393
+ */
1394
+ throwOnError?: boolean;
1395
+ /**
1396
+ * System prompt for the agent. Either a plain string or a resolver
1397
+ * function that receives the {@link SystemPromptContext} and returns the
1398
+ * prompt dynamically. Override per-call via {@link SendOptions.systemPrompt}.
1399
+ *
1400
+ * Subagents do NOT inherit this — they use {@link AgentDefinition.prompt}.
1401
+ */
1402
+ systemPrompt?: string | SystemPromptResolver;
1403
+ local?: LocalOptions;
1404
+ cloud?: CloudOptions;
1405
+ mcpServers?: Record<string, McpServerConfig>;
1406
+ /**
1407
+ * M77 — how long an MCP client lives.
1408
+ *
1409
+ * `'run'` (DEFAULT, and the historical behaviour) spawns a client per `send` and drops it when the
1410
+ * run ends. `'session'` pools clients per `(agentId, server, config)` and keeps them across turns,
1411
+ * which keeps the MCP runtime alive across turns. Measured cost of the per-run path: 193 / 138 / 134 ms of spawn + handshake on
1412
+ * every turn.
1413
+ *
1414
+ * Opt-in rather than default because it changes the FAILURE model: a server that dies mid-session
1415
+ * becomes a reachable state. One-shot and cron runs gain nothing from pooling and would pay that
1416
+ * risk, so they keep `'run'` unless they ask otherwise.
1417
+ */
1418
+ mcpLifecycle?: "run" | "session";
1419
+ agents?: Record<string, AgentDefinition>;
1420
+ agentId?: string;
1421
+ /** Context manager configuration. See `agent.context`. */
1422
+ context?: ContextSettings;
1423
+ /** Provider routing configuration. See `agent.providers`. */
1424
+ providers?: ProviderRoutingSettings;
1425
+ /**
1426
+ * Plugins for this agent, in one of two forms:
1427
+ *
1428
+ * - **Named-enable settings** — `{ enabled: ["name", ...] }`. Selects which
1429
+ * file-discovered plugin providers (under `.theokit/plugins/`) are active.
1430
+ * Plugin sources must also be active via `local.settingSources`.
1431
+ * - **Code `Plugin` objects** — an array of `Plugin` instances, e.g.
1432
+ * `plugins: [Handoff.asPlugin({ ... })]`. These are registered directly by
1433
+ * the runtime (`extractCodePlugins`); no `settingSources` entry is needed.
1434
+ *
1435
+ * The two forms are mutually exclusive — pass one or the other.
1436
+ */
1437
+ plugins?: PluginsSettings | readonly Plugin[];
1438
+ /**
1439
+ * SE1 — the default permission mode for this agent's runs, threaded to a
1440
+ * registered `PermissionPlugin`'s pre-tool gate. A per-send
1441
+ * `SendOptions.permissionMode` overrides it. Absent ⇒ the plugin's own
1442
+ * construction-time mode applies. Local runtime.
1443
+ */
1444
+ permissionMode?: PermissionMode;
1445
+ /**
1446
+ * Skills configuration. Either a static {@link SkillsSettings} object or —
1447
+ * SE22 — a {@link SkillsResolver} evaluated per `send()` to pick skills from
1448
+ * runtime context (e.g. user role). A cached agent re-resolves each run. The
1449
+ * agent-scoped `agent.skills` handle reflects the STATIC/base config; the
1450
+ * resolver drives the per-send `<skills>` block.
1451
+ */
1452
+ skills?: SkillsSettings | SkillsResolver;
1453
+ /**
1454
+ * SE24 — guardrail processors. `inputProcessors` run in order before the LLM
1455
+ * (normalize / validate / block / rewrite the user message); `outputProcessors`
1456
+ * run on the model's final text before it reaches the caller (redact / block).
1457
+ * A processor that `abort()`s stops the run with a {@link RunResult.tripwire}
1458
+ * (+ a `tripwire` run-event). Empty/absent ⇒ unchanged behavior. See
1459
+ * {@link Processor}.
1460
+ */
1461
+ inputProcessors?: readonly Processor[];
1462
+ outputProcessors?: readonly Processor[];
1463
+ /** Memory configuration. Persists durable facts; auto-recalled on send. */
1464
+ memory?: MemorySettings;
1465
+ /**
1466
+ * Inline custom tools. Local runtime only — cloud agents reject any non-empty
1467
+ * `tools` array. Handlers are not persisted; pass them again on resume.
1468
+ * See {@link CustomTool}.
1469
+ */
1470
+ tools?: CustomTool[];
1471
+ /**
1472
+ * Builtin tools this agent must NOT declare to the model. Absent or empty ⇒ every builtin the
1473
+ * rest of the configuration would register is declared, exactly as before this option existed.
1474
+ *
1475
+ * WHY WITHHOLDING IS NOT THE SAME AS DENYING. A consumer that cannot allow `shell` — because it
1476
+ * reaches outside their own sandbox scope — can already refuse the call in a `pre_tool_call` hook
1477
+ * or with a {@link PermissionEngine} deny rule. That stops the execution and pays for the offer
1478
+ * twice over: the schema rides in EVERY request of EVERY round (measured at 267 characters for
1479
+ * `shell`, 1,462 for `memory_search` + `memory_get` together — usetheokit/theokit-sdk#381), and
1480
+ * the model can spend a whole round discovering a refusal it had no way to anticipate. Declaring
1481
+ * a tool that is guaranteed to be refused is the wrong shape; withholding removes it from the
1482
+ * catalog, so the model is never offered what it cannot have.
1483
+ *
1484
+ * WITHHOLDING RELEASES THE NAME. `withheldBuiltinTools: ["shell"]` lets {@link AgentOptions.tools}
1485
+ * declare a tool called `shell` without the `tool_reserved_name` error — the reservation exists to
1486
+ * stop a collision with the SDK's own tool, and there is no longer one to collide with. Every
1487
+ * builtin still declared stays reserved.
1488
+ *
1489
+ * This governs DECLARATION, not authorization. A withheld builtin is simply absent from the
1490
+ * catalog: a model that invents the name anyway gets `Unknown tool <name>` (exit 127) rather than
1491
+ * an execution, but nothing here evaluates a policy. Keep the deny rule if you need one that a
1492
+ * per-send `tools` override cannot reopen.
1493
+ *
1494
+ * @public
1495
+ */
1496
+ withheldBuiltinTools?: readonly BuiltinToolName[];
1497
+ /**
1498
+ * SE37 — opt-in reasoning. When `true`, the agent gets a chain-of-thought
1499
+ * preamble prepended to its system prompt AND the `think` reasoning tool
1500
+ * auto-attached, turning a non-reasoning model into a reason -> act ->
1501
+ * observe loop (same model; reuses the existing tool loop). Default `false` —
1502
+ * byte-identical behaviour when unset. Inert (with a one-time warn) when a
1503
+ * native reasoning model is configured (`model.params: [{ id: "thinking" }]`),
1504
+ * so native and prompt-based reasoning never stack. See `ReasoningTools` in `@theokit/sdk-tools`.
1505
+ */
1506
+ reasoning?: boolean;
1507
+ /**
1508
+ * Telemetry (OpenTelemetry) configuration. Default disabled. See
1509
+ * {@link TelemetrySettings} and ADR D34.
1510
+ */
1511
+ telemetry?: TelemetrySettings;
1512
+ /**
1513
+ * Arbitrary metadata bag for caller-supplied provenance. Currently used by
1514
+ * the fork primitive (ADR D114) to tag `metadata.forkOrigin` and
1515
+ * `metadata.parentAgentId` so memory writes downstream can be attributed.
1516
+ *
1517
+ * Not persisted to the agent registry — informational only at runtime.
1518
+ *
1519
+ * @public
1520
+ */
1521
+ metadata?: Record<string, unknown>;
1522
+ /**
1523
+ * Default `MemoryContext` for third-party memory adapter plugins
1524
+ * (ADR D141). When set, `pre_user_send` / `post_assistant_reply`
1525
+ * hooks receive this context unless the caller overrides it. The
1526
+ * `agent.memory` direct API also defaults to it.
1527
+ *
1528
+ * @public
1529
+ */
1530
+ memoryContext?: MemoryContext;
1531
+ /**
1532
+ * Maximum byte length of the `<memory-context>` block injected by
1533
+ * `pre_user_send` adapter hooks (EC-A). Larger recalls are sliced
1534
+ * with `…[truncated]`. Default 16_000 (~4k tokens). Set lower for
1535
+ * cheaper turns; higher for longer-context models.
1536
+ *
1537
+ * @public
1538
+ */
1539
+ maxRecallContextBytes?: number;
1540
+ /**
1541
+ * Declarative handoff destinations (Adoption Roadmap #4; ADRs D214-D229).
1542
+ * Each entry is either a raw `SDKAgent` (auto-wrapped with defaults) OR a
1543
+ * `HandoffDescriptor` from `Handoff.create(target, opts?)`.
1544
+ *
1545
+ * Runtime injects synthetic `transfer_to_<receiver.name>` tools per
1546
+ * destination (D214/D215). When the LLM invokes one, the receiver takes
1547
+ * over the next turn (peer-to-peer, D217).
1548
+ *
1549
+ * @public
1550
+ */
1551
+ handoffs?: ReadonlyArray<SDKAgent | unknown>;
1552
+ /**
1553
+ * Maximum chain depth across handoffs per `agent.send()` call (D218).
1554
+ * Default 5. Exceeding throws `HandoffLoopError`. Set to 0 to disable
1555
+ * the handoff tools entirely (EC-8 / handoffs never fire).
1556
+ *
1557
+ * @public
1558
+ */
1559
+ maxHandoffDepth?: number;
1560
+ /**
1561
+ * Production-Readiness #6 — quota / abuse gates (ADRs D322-D323).
1562
+ *
1563
+ * `onBeforeCreate` fires BEFORE the agent is registered or persisted —
1564
+ * throw to block creation. `onBeforeSend` fires BEFORE each `agent.send`
1565
+ * (after `pre_user_send` adapter hooks, before any LLM call or storage
1566
+ * write) — throw to block the send.
1567
+ *
1568
+ * Unlike `onTool*` (observation), these hooks are BLOCKERS — errors
1569
+ * propagate as rejection on `Agent.create` / `agent.send`. Use them for
1570
+ * per-user conversation caps, per-conversation message caps, abuse
1571
+ * detection.
1572
+ *
1573
+ * @public
1574
+ */
1575
+ onBeforeCreate?: (event: {
1576
+ conversationId: string;
1577
+ userId?: string;
1578
+ }) => Promise<void> | void;
1579
+ /**
1580
+ * Fires before each `agent.send`. `previousMessageCount` is the count of
1581
+ * messages already persisted BEFORE the current send adds the user
1582
+ * message. Throw to block.
1583
+ *
1584
+ * @public
1585
+ */
1586
+ onBeforeSend?: (event: {
1587
+ conversationId: string;
1588
+ previousMessageCount: number;
1589
+ }) => Promise<void> | void;
1590
+ /**
1591
+ * Production-Readiness #4 — tool lifecycle hooks (ADRs D315-D317).
1592
+ *
1593
+ * `onToolStart` fires BEFORE the handler runs. `onToolEnd` fires after a
1594
+ * successful handler return. `onToolError` fires when validation fails OR
1595
+ * the handler throws — `event.error` is always an `Error` instance.
1596
+ *
1597
+ * Hook errors are SWALLOWED with a stderr warn (do not abort the run).
1598
+ * The `callId` is unique per tool invocation and identical across the
1599
+ * start/end (or start/error) pair, so consumers can correlate.
1600
+ *
1601
+ * Use cases: cost tracking, audit logs, per-tool retry/alerting,
1602
+ * latency telemetry.
1603
+ *
1604
+ * @public
1605
+ */
1606
+ onToolStart?: (event: {
1607
+ toolName: string;
1608
+ args: unknown;
1609
+ conversationId: string;
1610
+ callId: string;
1611
+ }) => void | Promise<void>;
1612
+ /** Fires when a tool handler returns successfully. */
1613
+ onToolEnd?: (event: {
1614
+ toolName: string;
1615
+ args: unknown;
1616
+ result: unknown;
1617
+ conversationId: string;
1618
+ callId: string;
1619
+ durationMs: number;
1620
+ }) => void | Promise<void>;
1621
+ /**
1622
+ * Fires when a tool handler throws OR schema validation rejects the args.
1623
+ * `event.error` is always an `Error` instance (D315/EC-6 — validation
1624
+ * reasons are wrapped in `new Error(reason)`).
1625
+ *
1626
+ * `attempt` is always `1` in v1 (D317 — reserved for future retry policy).
1627
+ */
1628
+ onToolError?: (event: {
1629
+ toolName: string;
1630
+ args: unknown;
1631
+ error: Error;
1632
+ conversationId: string;
1633
+ callId: string;
1634
+ durationMs: number;
1635
+ attempt: number;
1636
+ }) => void | Promise<void>;
1637
+ /**
1638
+ * Pluggable budget/usage tracker (SDK 2.0 Phase 2 / T2.1 — ADR D1 interface
1639
+ * inversion). When provided, the agent loop calls `tracker.track(...)`
1640
+ * after each LLM completion and `tracker.check()` before each iteration.
1641
+ *
1642
+ * **Runtime enforcement is live.** Verified against the call graph on
1643
+ * 2026-09-01: `internal/agent-loop/loop.ts:78-81` reads the tracker and
1644
+ * gates the iteration through `evaluateBudgetGate`, `:110` calls
1645
+ * `nextIteration()`, and `:390`/`:397` call `track(...)` per completion;
1646
+ * the option reaches the loop from `AgentOptions` at
1647
+ * `internal/local-agent/real-local-run.ts:342`.
1648
+ *
1649
+ * This paragraph previously said the opposite — "wired to the type surface
1650
+ * only ... NOT runtime enforcement" — and it was wrong in the expensive stale-claim-ok: verbatim quote of the corrected text
1651
+ * direction: a consumer reading the published `.d.ts` was told the SDK would
1652
+ * not enforce their cost ceiling, so the rational response was to build a
1653
+ * second control outside it, or to stop trusting the option.
1654
+ *
1655
+ * Default impls available today via `@theokit/sdk`:
1656
+ * - `createCounterBudgetTracker({ maxTokens, maxIterations })`
1657
+ *
1658
+ * Future: post-Phase-2, `@theokit/sdk-budget` ships a richer impl with
1659
+ * USD pricing.
1660
+ *
1661
+ * @public
1662
+ */
1663
+ budgetTracker?: BudgetTracker;
1664
+ /**
1665
+ * Pluggable memory subsystem (SDK 2.0 Phase 1 / T1.3 — Hexagonal
1666
+ * Architecture interface inversion). When provided, the agent loop
1667
+ * calls `provider.init(...)` once per agent, surfaces tools from
1668
+ * `provider.buildTools(...)` to the LLM, runs `provider.runActivePass(...)`
1669
+ * pre-LLM to inject recalled facts, and `provider.dispose(...)` on
1670
+ * Agent shutdown.
1671
+ *
1672
+ * **Runtime enforcement is live.** Verified against the call graph on
1673
+ * 2026-09-01: `internal/agent-loop/loop-context-init.ts:95` calls
1674
+ * `provider.init(...)`, `:129` surfaces `provider.buildTools(...)` to the
1675
+ * model, `:166` runs `provider.runActivePass(...)`, and
1676
+ * `internal/agent-loop/loop.ts:176`/`:204` call `sync` and `dispose`.
1677
+ *
1678
+ * This paragraph previously said the opposite — "wired to the type surface
1679
+ * only ... NOT runtime enforcement". A stale "not implemented yet" note on a stale-claim-ok: verbatim quote of the corrected text
1680
+ * `@public` symbol is worse than no note: it is believed, it survives the
1681
+ * work it describes, and nothing in this repo compares such a claim against
1682
+ * the call graph.
1683
+ *
1684
+ * Default impls available today via `@theokit/sdk`:
1685
+ * - `createNoopMemoryProvider()` — degenerate fallback / worked example
1686
+ *
1687
+ * Future: post-Phase-1, `@theokit/sdk-memory` ships a rich impl with
1688
+ * LanceDB / embeddings / circuit breaker / active-memory cache.
1689
+ *
1690
+ * @public
1691
+ */
1692
+ memoryProvider?: MemoryProvider;
1693
+ }
1694
+ /**
1695
+ * Metadata returned by `Agent.list()` and `Agent.get()`.
1696
+ *
1697
+ * @public
1698
+ */
1699
+ type SDKAgentInfo = {
1700
+ agentId: string;
1701
+ name: string;
1702
+ summary: string;
1703
+ lastModified: number;
1704
+ status?: "running" | "finished" | "error";
1705
+ createdAt?: number;
1706
+ archived?: boolean;
1707
+ } & ({
1708
+ runtime?: undefined;
1709
+ } | {
1710
+ runtime: "local";
1711
+ cwd?: string;
1712
+ } | {
1713
+ runtime: "cloud";
1714
+ env?: CloudEnv;
1715
+ repos?: string[];
1716
+ });
1717
+ /**
1718
+ * theokit#123 — one tool of a registered agent, as a reflection surface sees it.
1719
+ *
1720
+ * A projection, not the `CustomTool` itself: the handler is an executable that cannot cross a
1721
+ * process boundary and has no meaning to a caller enumerating a registry.
1722
+ *
1723
+ * @public
1724
+ */
1725
+ interface AgentToolDescription {
1726
+ name: string;
1727
+ description: string;
1728
+ /** The JSON Schema sent to the model verbatim — the tool's callable signature. */
1729
+ inputSchema: Record<string, unknown>;
1730
+ }
1731
+ /**
1732
+ * theokit#123 — one subagent of a registered agent (what theokit-studio calls a workflow).
1733
+ *
1734
+ * `prompt` is deliberately absent. Enumeration asks what a subagent IS and what it may call; its
1735
+ * system prompt is instructions, not signature, and a reflection endpoint that serializes it
1736
+ * publishes the agent's behaviour to anyone who can reach the endpoint.
1737
+ *
1738
+ * @public
1739
+ */
1740
+ interface AgentSubagentDescription {
1741
+ /** The key under `AgentOptions.agents` — how the parent addresses it. */
1742
+ name: string;
1743
+ description: string;
1744
+ /** `"inherit"` (or absent) means it runs on the parent's model. */
1745
+ model?: ModelSelection | "inherit";
1746
+ /** Tool whitelist, when the subagent is scoped to a subset of the parent's tools. */
1747
+ tools?: string[];
1748
+ }
1749
+ /**
1750
+ * theokit#123 — the read-only introspection of a registered agent, returned by `Agent.describe()`.
1751
+ *
1752
+ * `Agent.list()` / `Agent.get()` enumerate agents and `agent.skills.list()` covers skills; this
1753
+ * fills the remaining gap, so a reflection endpoint can report the live registry instead of
1754
+ * degrading to empty lists.
1755
+ *
1756
+ * `tools` and `subagents` are always arrays — never `undefined` — so a caller can distinguish
1757
+ * "this agent has none" from "the SDK did not say".
1758
+ *
1759
+ * @public
1760
+ */
1761
+ interface AgentDescription {
1762
+ agentId: string;
1763
+ /** Inlined rather than imported from the registry contract: `types/` stays a leaf (theokit#146). */
1764
+ runtime: "local" | "cloud";
1765
+ model?: ModelSelection;
1766
+ /**
1767
+ * The agent's DECLARED tool catalog.
1768
+ *
1769
+ * Plugin-contributed tools and the internal `think` tool (added when `reasoning` is on) are
1770
+ * assembled per run and are not knowable from the registry, so they are absent here. Stated
1771
+ * rather than implied: a reflection endpoint should not present this as the complete runtime set.
1772
+ */
1773
+ tools: readonly AgentToolDescription[];
1774
+ /**
1775
+ * Every subagent the runtime would resolve — file-based roles from `.theokit/agents/*.md` merged
1776
+ * with the inline `agentOptions.agents`, the same set `loadSubagents` builds for a run.
1777
+ */
1778
+ subagents: readonly AgentSubagentDescription[];
1779
+ }
1780
+ /**
1781
+ * Options for `Agent.list()`.
1782
+ *
1783
+ * `limit`/`cursor` paginate (B-115): a `limit` bounds the page and, when more agents remain,
1784
+ * `ListResult.nextCursor` is set — pass it back as `cursor` for the next page. Omitting `limit`
1785
+ * returns every matching agent in one page, unpaginated, exactly as before (M107 declared imposing
1786
+ * pagination order unconditionally a breaking change to every caller's observed order; pagination
1787
+ * here is opt-in and only reorders the page it returns, never the unlimited default).
1788
+ *
1789
+ * @public
1790
+ */
1791
+ type ListAgentsOptions = {
1792
+ limit?: number;
1793
+ cursor?: string;
1794
+ } & ({
1795
+ runtime?: undefined;
1796
+ } | {
1797
+ runtime: "local";
1798
+ cwd?: string;
1799
+ } | {
1800
+ runtime: "cloud";
1801
+ /**
1802
+ * Hide archived agents unless `true`. Default `false` (hidden) — B-115, this used to be
1803
+ * accepted and silently ignored; every archived agent was always included.
1804
+ */
1805
+ includeArchived?: boolean;
1806
+ apiKey?: string;
1807
+ });
1808
+ /**
1809
+ * Options for `Agent.get()`.
1810
+ *
1811
+ * `cwd` (default `process.cwd()`) selects which workspace's on-disk registry to hydrate before the
1812
+ * lookup — same rule `Agent.list` uses (B-115; this used to be accepted and silently ignored).
1813
+ *
1814
+ * @public
1815
+ */
1816
+ interface GetAgentOptions {
1817
+ cwd?: string;
1818
+ apiKey?: string;
1819
+ }
1820
+ /**
1821
+ * Options for `Agent.listRuns()`.
1822
+ *
1823
+ * `cwd` (default `process.cwd()`) hydrates that workspace's registry before validating the agent
1824
+ * exists — same rule as `Agent.get` (B-115). `limit`/`cursor` paginate the SAME way as
1825
+ * `Agent.list` — see its doc — except no reordering is ever needed: a single agent's runs are
1826
+ * already returned in the stable order they were created.
1827
+ *
1828
+ * B-115 — `runtime` removed 2026-08-19. A single `agentId` already pins exactly one runtime;
1829
+ * filtering an already-single-agent's runs by runtime filtered nothing and was never checked.
1830
+ *
1831
+ * @public
1832
+ */
1833
+ interface ListRunsOptions {
1834
+ cwd?: string;
1835
+ apiKey?: string;
1836
+ limit?: number;
1837
+ cursor?: string;
1838
+ }
1839
+ /**
1840
+ * Options for `Agent.getRun()`. Cloud requires the parent `agentId`.
1841
+ *
1842
+ * @public
1843
+ */
1844
+ type GetRunOptions = {
1845
+ runtime?: "local";
1846
+ cwd?: string;
1847
+ } | {
1848
+ runtime: "cloud";
1849
+ agentId: string;
1850
+ apiKey?: string;
1851
+ };
1852
+ /**
1853
+ * Options for archive/unarchive/delete.
1854
+ *
1855
+ * @public
1856
+ */
1857
+ interface AgentOperationOptions {
1858
+ cwd?: string;
1859
+ apiKey?: string;
1860
+ }
1861
+ /**
1862
+ * Paginated list shape.
1863
+ *
1864
+ * @public
1865
+ */
1866
+ interface ListResult<T> {
1867
+ items: T[];
1868
+ nextCursor?: string;
1869
+ }
1870
+
1871
+ export { type SettingSource as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type MemoryProviderAgentRef as D, type MemoryProviderFactory as E, type MemoryProviderHandle as F, type GetAgentOptions as G, type HookName as H, type InlineSkill as I, type MemoryProviderInitOptions as J, type PluginContext as K, type LocalOptions as L, type MemorySettings as M, type PluginHookDisposer as N, type PostAssistantReplyContext as O, type Plugin as P, type PostToolCallContext as Q, type PreToolCallContext as R, type SystemPromptResolver as S, type PreUserSendContext as T, type PreUserSendResult as U, type ProviderTransform as V, type ProviderTransformContext as W, type RecordSessionSummaryArgs as X, type SessionLifecycleContext as Y, type SessionRecord as Z, type SessionStore as _, type AgentDefinition as a, Skill as a0, type SkillsResolver as a1, type SkillsResolverContext as a2, type SystemPromptContext as a3, type SystemPromptMemoryFact as a4, type TelemetrySettings as a5, type ToolCallSummary as a6, type ToolResultTransformContext as a7, type TransformContext as a8, type SkillsSettings as b, type ListAgentsOptions as c, type ListResult as d, type SDKAgentInfo as e, type ListRunsOptions as f, type GetRunOptions as g, type AgentOperationOptions as h, type AgentDescription as i, type ProviderProfile as j, type MemoryProvider as k, type PreToolCallDecision as l, type ActiveMemoryPassArgs as m, type ActiveMemoryPassResult as n, type AgentSubagentDescription as o, type AgentToolDescription as p, type BudgetCheck as q, type BudgetTotal as r, type BudgetUsageEvent as s, type BuiltinToolName as t, type CloudEnv as u, type CloudRepo as v, type CompatSource as w, type CompatSourceAdapter as x, type CompatSurface as y, type CreateSkillSpec as z };