@theokit/sdk 4.53.0 → 4.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (719) hide show
  1. package/CHANGELOG.md +1096 -8
  2. package/LICENSE +2 -2
  3. package/README.md +14 -9
  4. package/bin/theokit-migrate-config.mjs +11 -2
  5. package/dist/a2a/agent-mailbox.d.cts +27 -0
  6. package/dist/a2a/agent-mailbox.d.ts +27 -0
  7. package/dist/a2a/index.cjs +9 -4
  8. package/dist/a2a/index.cjs.map +1 -1
  9. package/dist/a2a/index.js +7 -2
  10. package/dist/a2a/index.js.map +1 -1
  11. package/dist/a2a/message-bus.d.cts +39 -0
  12. package/dist/a2a/message-bus.d.ts +39 -0
  13. package/dist/a2a/subagent.d.cts +68 -7
  14. package/dist/a2a/subagent.d.ts +68 -7
  15. package/dist/a2a/types.d.cts +26 -0
  16. package/dist/a2a/types.d.ts +26 -0
  17. package/dist/{agent-BiCINq25.d.ts → agent-CIUgz7cN.d.cts} +211 -858
  18. package/dist/{agent-Zta1kvGH.d.cts → agent-DSec-E0c.d.ts} +211 -858
  19. package/dist/agent-NOEGF4GI.cjs +61 -0
  20. package/dist/{agent-JX5SBYDE.cjs.map → agent-NOEGF4GI.cjs.map} +1 -1
  21. package/dist/agent-VGD5WL4N.js +52 -0
  22. package/dist/{agent-ZAGG6ZBS.js.map → agent-VGD5WL4N.js.map} +1 -1
  23. package/dist/agent-builder.d.ts +19 -0
  24. package/dist/agent-session-store-P6V3FINW.js +7 -0
  25. package/dist/{agent-session-store-JMU7ASDB.js.map → agent-session-store-P6V3FINW.js.map} +1 -1
  26. package/dist/agent-session-store-ZJ3JSRS4.cjs +24 -0
  27. package/dist/{agent-session-store-EPX2WQI4.cjs.map → agent-session-store-ZJ3JSRS4.cjs.map} +1 -1
  28. package/dist/agent.d.ts +25 -7
  29. package/dist/auth/index.cjs +53 -36
  30. package/dist/auth/index.cjs.map +1 -1
  31. package/dist/auth/index.d.cts +1 -1
  32. package/dist/auth/index.d.ts +1 -1
  33. package/dist/auth/index.js +27 -10
  34. package/dist/auth/index.js.map +1 -1
  35. package/dist/{batch-NLIS4QTW.js → batch-2TGJMNCJ.js} +14 -13
  36. package/dist/batch-2TGJMNCJ.js.map +1 -0
  37. package/dist/{batch-WQ3AJCDV.cjs → batch-ND32UKZS.cjs} +31 -30
  38. package/dist/batch-ND32UKZS.cjs.map +1 -0
  39. package/dist/{chunk-TR4V2LHV.cjs → chunk-2ADR2GSO.cjs} +8 -8
  40. package/dist/chunk-2ADR2GSO.cjs.map +1 -0
  41. package/dist/{chunk-7HQVDLFI.cjs → chunk-2C72DXQF.cjs} +65 -27
  42. package/dist/chunk-2C72DXQF.cjs.map +1 -0
  43. package/dist/{chunk-DEZ75ET5.js → chunk-2D34UTDC.js} +21 -5
  44. package/dist/chunk-2D34UTDC.js.map +1 -0
  45. package/dist/{chunk-XGYI2KQH.js → chunk-2QKTVKH3.js} +4 -4
  46. package/dist/{chunk-XGYI2KQH.js.map → chunk-2QKTVKH3.js.map} +1 -1
  47. package/dist/{chunk-BBZYXVLZ.cjs → chunk-2ZPEDVLM.cjs} +2 -2
  48. package/dist/chunk-2ZPEDVLM.cjs.map +1 -0
  49. package/dist/{chunk-DHVNJYTO.js → chunk-3E77SX4H.js} +4 -4
  50. package/dist/{chunk-DHVNJYTO.js.map → chunk-3E77SX4H.js.map} +1 -1
  51. package/dist/{chunk-VYHJZVL5.cjs → chunk-3EE6LVWT.cjs} +2 -2
  52. package/dist/chunk-3EE6LVWT.cjs.map +1 -0
  53. package/dist/chunk-3KGLRRFC.cjs +18 -0
  54. package/dist/chunk-3KGLRRFC.cjs.map +1 -0
  55. package/dist/{chunk-5NBUH3NO.js → chunk-3OR54XG4.js} +2 -2
  56. package/dist/{chunk-C6Y6CWYD.cjs.map → chunk-3OR54XG4.js.map} +1 -1
  57. package/dist/{chunk-FUASIT3E.cjs → chunk-3YJNUKYN.cjs} +15 -15
  58. package/dist/{chunk-FUASIT3E.cjs.map → chunk-3YJNUKYN.cjs.map} +1 -1
  59. package/dist/{chunk-R7TKOQMJ.js → chunk-44JAAH4X.js} +3 -3
  60. package/dist/chunk-44JAAH4X.js.map +1 -0
  61. package/dist/{chunk-XRI6DXPZ.js → chunk-44MBDIHG.js} +4 -4
  62. package/dist/chunk-44MBDIHG.js.map +1 -0
  63. package/dist/{chunk-BXVSBYGW.js → chunk-4ERPXIVB.js} +5 -5
  64. package/dist/{chunk-BXVSBYGW.js.map → chunk-4ERPXIVB.js.map} +1 -1
  65. package/dist/{chunk-T6QUCG7L.cjs → chunk-4I55V454.cjs} +4 -4
  66. package/dist/chunk-4I55V454.cjs.map +1 -0
  67. package/dist/{chunk-B4YA6BRS.cjs → chunk-4O5TGQBW.cjs} +30 -7
  68. package/dist/chunk-4O5TGQBW.cjs.map +1 -0
  69. package/dist/{chunk-4JBHSLQO.cjs → chunk-4OTIXDMU.cjs} +2 -2
  70. package/dist/{chunk-4JBHSLQO.cjs.map → chunk-4OTIXDMU.cjs.map} +1 -1
  71. package/dist/{chunk-C6Y6CWYD.cjs → chunk-52NKC5HT.cjs} +2 -2
  72. package/dist/chunk-52NKC5HT.cjs.map +1 -0
  73. package/dist/{chunk-3YYDHUNH.cjs → chunk-53CBTBWO.cjs} +11 -11
  74. package/dist/{chunk-3YYDHUNH.cjs.map → chunk-53CBTBWO.cjs.map} +1 -1
  75. package/dist/{chunk-2QMK627M.cjs → chunk-5BJV5UPY.cjs} +27 -27
  76. package/dist/chunk-5BJV5UPY.cjs.map +1 -0
  77. package/dist/{chunk-OZXPA3ME.js → chunk-5JLFFPCH.js} +4 -4
  78. package/dist/{chunk-OZXPA3ME.js.map → chunk-5JLFFPCH.js.map} +1 -1
  79. package/dist/{chunk-34XOCZJO.js → chunk-5PHVENFV.js} +3 -3
  80. package/dist/chunk-5PHVENFV.js.map +1 -0
  81. package/dist/{chunk-EQMLJ52C.cjs → chunk-5UOVYM3P.cjs} +36 -31
  82. package/dist/chunk-5UOVYM3P.cjs.map +1 -0
  83. package/dist/{chunk-33L2NVTJ.cjs → chunk-5USCYPPI.cjs} +15 -15
  84. package/dist/chunk-5USCYPPI.cjs.map +1 -0
  85. package/dist/{chunk-I732VEDW.js → chunk-AEOZTXVW.js} +3 -3
  86. package/dist/{chunk-I732VEDW.js.map → chunk-AEOZTXVW.js.map} +1 -1
  87. package/dist/{chunk-5XXUYU3M.js → chunk-AG5JPQIY.js} +3 -3
  88. package/dist/{chunk-5XXUYU3M.js.map → chunk-AG5JPQIY.js.map} +1 -1
  89. package/dist/{chunk-3SHW7XKK.js → chunk-AGSBJD2L.js} +27 -29
  90. package/dist/chunk-AGSBJD2L.js.map +1 -0
  91. package/dist/{chunk-KZBB4YKU.js → chunk-AQLGBKNT.js} +3 -3
  92. package/dist/chunk-AQLGBKNT.js.map +1 -0
  93. package/dist/{chunk-7W7ZWMLQ.js → chunk-AWO27VRZ.js} +3 -3
  94. package/dist/chunk-AWO27VRZ.js.map +1 -0
  95. package/dist/{chunk-VYCKUKPA.cjs → chunk-B2J4ZMZL.cjs} +3 -2
  96. package/dist/chunk-B2J4ZMZL.cjs.map +1 -0
  97. package/dist/{chunk-UJ3SXRZZ.js → chunk-BMAZLQQ4.js} +3 -3
  98. package/dist/{chunk-UJ3SXRZZ.js.map → chunk-BMAZLQQ4.js.map} +1 -1
  99. package/dist/{chunk-NUEL6RCZ.cjs → chunk-BVZW2B5V.cjs} +4 -4
  100. package/dist/chunk-BVZW2B5V.cjs.map +1 -0
  101. package/dist/{chunk-W4FV7JBH.js → chunk-CQ2TQ32Y.js} +4 -4
  102. package/dist/chunk-CQ2TQ32Y.js.map +1 -0
  103. package/dist/{chunk-NFATC6ZF.cjs → chunk-CQGYNZ3K.cjs} +4 -4
  104. package/dist/{chunk-NFATC6ZF.cjs.map → chunk-CQGYNZ3K.cjs.map} +1 -1
  105. package/dist/{chunk-3R4ZCQAZ.cjs → chunk-CTCGWIUD.cjs} +5 -5
  106. package/dist/{chunk-3R4ZCQAZ.cjs.map → chunk-CTCGWIUD.cjs.map} +1 -1
  107. package/dist/{chunk-HTK54K2J.js → chunk-CV7XMBHP.js} +4 -4
  108. package/dist/chunk-CV7XMBHP.js.map +1 -0
  109. package/dist/{chunk-NOS7PTKP.js → chunk-DAPSQZT4.js} +15 -10
  110. package/dist/chunk-DAPSQZT4.js.map +1 -0
  111. package/dist/{chunk-E3OCRJU6.cjs → chunk-DQKERTND.cjs} +11 -11
  112. package/dist/{chunk-E3OCRJU6.cjs.map → chunk-DQKERTND.cjs.map} +1 -1
  113. package/dist/{chunk-I5OTK2RP.js → chunk-DUIF54UP.js} +6 -6
  114. package/dist/chunk-DUIF54UP.js.map +1 -0
  115. package/dist/{chunk-C4EU627W.js → chunk-DZBSJX6J.js} +4 -4
  116. package/dist/{chunk-C4EU627W.js.map → chunk-DZBSJX6J.js.map} +1 -1
  117. package/dist/{chunk-ADVZIC43.cjs → chunk-EI2Q7SJ5.cjs} +12 -12
  118. package/dist/chunk-EI2Q7SJ5.cjs.map +1 -0
  119. package/dist/{chunk-UCFONJBG.js → chunk-EPSICJLZ.js} +2 -2
  120. package/dist/{chunk-UCFONJBG.js.map → chunk-EPSICJLZ.js.map} +1 -1
  121. package/dist/{chunk-RAACTJ7C.cjs → chunk-F3YZMOAU.cjs} +8 -8
  122. package/dist/{chunk-RAACTJ7C.cjs.map → chunk-F3YZMOAU.cjs.map} +1 -1
  123. package/dist/{chunk-KIX45IKP.js → chunk-F7AQV62G.js} +5 -4
  124. package/dist/chunk-F7AQV62G.js.map +1 -0
  125. package/dist/{chunk-2YWWPCGX.js → chunk-FXEUP75G.js} +10 -12
  126. package/dist/chunk-FXEUP75G.js.map +1 -0
  127. package/dist/{chunk-2RW7K6FN.cjs → chunk-GHX4P3V2.cjs} +2 -2
  128. package/dist/chunk-GHX4P3V2.cjs.map +1 -0
  129. package/dist/{chunk-634YVZLU.js → chunk-GJ6RK75E.js} +5 -5
  130. package/dist/chunk-GJ6RK75E.js.map +1 -0
  131. package/dist/{chunk-Z5U2JGEK.cjs → chunk-GNT35C5U.cjs} +13 -13
  132. package/dist/chunk-GNT35C5U.cjs.map +1 -0
  133. package/dist/{chunk-4NAKHID5.js → chunk-GTKFV7O5.js} +2 -2
  134. package/dist/chunk-GTKFV7O5.js.map +1 -0
  135. package/dist/{chunk-BWGXYOBZ.cjs → chunk-GWC3HADL.cjs} +4 -4
  136. package/dist/{chunk-BWGXYOBZ.cjs.map → chunk-GWC3HADL.cjs.map} +1 -1
  137. package/dist/{chunk-OXNYIMZZ.js → chunk-H73MEMQB.js} +2 -2
  138. package/dist/chunk-H73MEMQB.js.map +1 -0
  139. package/dist/{chunk-RTLUZKDL.cjs → chunk-HJBMA5MB.cjs} +11 -11
  140. package/dist/{chunk-RTLUZKDL.cjs.map → chunk-HJBMA5MB.cjs.map} +1 -1
  141. package/dist/{chunk-AM2CNBKE.js → chunk-HKCKOAIO.js} +2 -2
  142. package/dist/chunk-HKCKOAIO.js.map +1 -0
  143. package/dist/{chunk-PVBANCWU.cjs → chunk-HY57ULY2.cjs} +5 -5
  144. package/dist/{chunk-PVBANCWU.cjs.map → chunk-HY57ULY2.cjs.map} +1 -1
  145. package/dist/{chunk-CAH3G4IS.js → chunk-HY66GLM6.js} +2 -2
  146. package/dist/chunk-HY66GLM6.js.map +1 -0
  147. package/dist/{chunk-2CFEET3Y.cjs → chunk-I6TGFUCO.cjs} +4 -4
  148. package/dist/chunk-I6TGFUCO.cjs.map +1 -0
  149. package/dist/{chunk-HI4ZW62S.js → chunk-IDCKSLYH.js} +4 -4
  150. package/dist/chunk-IDCKSLYH.js.map +1 -0
  151. package/dist/{chunk-KNZU4YO5.cjs → chunk-ILCGLTSA.cjs} +4 -4
  152. package/dist/{chunk-KNZU4YO5.cjs.map → chunk-ILCGLTSA.cjs.map} +1 -1
  153. package/dist/{chunk-44IISBRZ.cjs → chunk-IWBGCBR6.cjs} +4 -4
  154. package/dist/{chunk-44IISBRZ.cjs.map → chunk-IWBGCBR6.cjs.map} +1 -1
  155. package/dist/{chunk-R3CKCRK3.cjs → chunk-J24VJOH3.cjs} +22 -6
  156. package/dist/chunk-J24VJOH3.cjs.map +1 -0
  157. package/dist/{chunk-ECPL5RV6.cjs → chunk-JHPGF3FP.cjs} +8 -8
  158. package/dist/{chunk-ECPL5RV6.cjs.map → chunk-JHPGF3FP.cjs.map} +1 -1
  159. package/dist/{chunk-SXSPMRSV.cjs → chunk-JTB5Q42C.cjs} +21 -19
  160. package/dist/chunk-JTB5Q42C.cjs.map +1 -0
  161. package/dist/{chunk-2YGIBOUH.cjs → chunk-K3FW2XZD.cjs} +9 -9
  162. package/dist/chunk-K3FW2XZD.cjs.map +1 -0
  163. package/dist/{chunk-6DCTL32L.cjs → chunk-NGESVVJN.cjs} +17 -17
  164. package/dist/chunk-NGESVVJN.cjs.map +1 -0
  165. package/dist/{chunk-MV4TOCUK.js → chunk-NLTVXLGT.js} +3 -3
  166. package/dist/{chunk-MV4TOCUK.js.map → chunk-NLTVXLGT.js.map} +1 -1
  167. package/dist/chunk-NUKRL3I6.cjs +23 -0
  168. package/dist/chunk-NUKRL3I6.cjs.map +1 -0
  169. package/dist/{chunk-ZSJPRPN7.js → chunk-OC4NTGMN.js} +3 -3
  170. package/dist/{chunk-ZSJPRPN7.js.map → chunk-OC4NTGMN.js.map} +1 -1
  171. package/dist/{chunk-K42QGAKM.cjs → chunk-P6A3M6VD.cjs} +10 -10
  172. package/dist/{chunk-K42QGAKM.cjs.map → chunk-P6A3M6VD.cjs.map} +1 -1
  173. package/dist/{chunk-OKLYRPKL.cjs → chunk-Q47R5E2X.cjs} +8 -8
  174. package/dist/chunk-Q47R5E2X.cjs.map +1 -0
  175. package/dist/{chunk-2XLKLVVR.js → chunk-Q5EWJPRY.js} +2 -2
  176. package/dist/chunk-Q5EWJPRY.js.map +1 -0
  177. package/dist/{chunk-XWCTBGYK.js → chunk-QARJGQSA.js} +16 -7
  178. package/dist/chunk-QARJGQSA.js.map +1 -0
  179. package/dist/{chunk-EUBGGYPH.cjs → chunk-QDED6YO6.cjs} +5 -5
  180. package/dist/{chunk-EUBGGYPH.cjs.map → chunk-QDED6YO6.cjs.map} +1 -1
  181. package/dist/{chunk-VK7MAV65.cjs → chunk-QKLOP4VC.cjs} +2 -2
  182. package/dist/{chunk-VK7MAV65.cjs.map → chunk-QKLOP4VC.cjs.map} +1 -1
  183. package/dist/{chunk-PLUCC4N5.js → chunk-QRSUA2CV.js} +3 -3
  184. package/dist/{chunk-PLUCC4N5.js.map → chunk-QRSUA2CV.js.map} +1 -1
  185. package/dist/{chunk-YTO5BRBD.cjs → chunk-R3UPQFKK.cjs} +21 -12
  186. package/dist/chunk-R3UPQFKK.cjs.map +1 -0
  187. package/dist/{chunk-X2FR4OIT.js → chunk-R7WIIPUR.js} +2 -2
  188. package/dist/chunk-R7WIIPUR.js.map +1 -0
  189. package/dist/{chunk-BC5EUG7R.cjs → chunk-RM7Y65IG.cjs} +18 -20
  190. package/dist/chunk-RM7Y65IG.cjs.map +1 -0
  191. package/dist/{chunk-RP5HQVLD.js → chunk-RNB4APBZ.js} +30 -7
  192. package/dist/chunk-RNB4APBZ.js.map +1 -0
  193. package/dist/{chunk-V45L2OYP.cjs → chunk-ROYPRJH4.cjs} +9 -9
  194. package/dist/{chunk-V45L2OYP.cjs.map → chunk-ROYPRJH4.cjs.map} +1 -1
  195. package/dist/{chunk-JJZ4NIAG.js → chunk-RUDY2GTT.js} +61 -24
  196. package/dist/chunk-RUDY2GTT.js.map +1 -0
  197. package/dist/{chunk-QLAWEGTZ.cjs → chunk-SKXBJ2NU.cjs} +7 -7
  198. package/dist/chunk-SKXBJ2NU.cjs.map +1 -0
  199. package/dist/chunk-SSQZA3DZ.js +15 -0
  200. package/dist/chunk-SSQZA3DZ.js.map +1 -0
  201. package/dist/{chunk-7TB5U7RK.js → chunk-SUKXXLWD.js} +6 -6
  202. package/dist/chunk-SUKXXLWD.js.map +1 -0
  203. package/dist/{chunk-N43XLTHZ.js → chunk-T73NA43R.js} +3 -3
  204. package/dist/{chunk-N43XLTHZ.js.map → chunk-T73NA43R.js.map} +1 -1
  205. package/dist/chunk-T7O6K6PX.js +20 -0
  206. package/dist/chunk-T7O6K6PX.js.map +1 -0
  207. package/dist/{chunk-4X3SBHPK.js → chunk-T7XEKOVW.js} +18 -17
  208. package/dist/chunk-T7XEKOVW.js.map +1 -0
  209. package/dist/{chunk-NZOR3N4E.js → chunk-TPTZA6NI.js} +293 -126
  210. package/dist/chunk-TPTZA6NI.js.map +1 -0
  211. package/dist/{chunk-QN5N3ZVT.cjs → chunk-TTHBHAJI.cjs} +44 -46
  212. package/dist/chunk-TTHBHAJI.cjs.map +1 -0
  213. package/dist/{chunk-CZHPR2G7.cjs → chunk-U2AC6JUP.cjs} +8 -8
  214. package/dist/chunk-U2AC6JUP.cjs.map +1 -0
  215. package/dist/{chunk-ITQ4NO4P.js → chunk-UC3HT2S4.js} +3 -3
  216. package/dist/{chunk-ITQ4NO4P.js.map → chunk-UC3HT2S4.js.map} +1 -1
  217. package/dist/{chunk-2VFZQEDW.cjs → chunk-UFAO4T7Z.cjs} +565 -399
  218. package/dist/chunk-UFAO4T7Z.cjs.map +1 -0
  219. package/dist/{chunk-DM6Y5B2G.cjs → chunk-UNDROG5N.cjs} +201 -154
  220. package/dist/chunk-UNDROG5N.cjs.map +1 -0
  221. package/dist/{chunk-L7EGRCKJ.js → chunk-UPRJR6IP.js} +4 -4
  222. package/dist/chunk-UPRJR6IP.js.map +1 -0
  223. package/dist/{chunk-23VZBRDQ.js → chunk-UQGQFBRL.js} +3 -3
  224. package/dist/chunk-UQGQFBRL.js.map +1 -0
  225. package/dist/{chunk-2Y5NO2SY.js → chunk-VDEWG5TV.js} +88 -43
  226. package/dist/chunk-VDEWG5TV.js.map +1 -0
  227. package/dist/{chunk-CHVSMEKM.js → chunk-VF7EWVDG.js} +3 -3
  228. package/dist/chunk-VF7EWVDG.js.map +1 -0
  229. package/dist/{chunk-PNVDQL5Y.cjs → chunk-VTYY7XL5.cjs} +2 -2
  230. package/dist/chunk-VTYY7XL5.cjs.map +1 -0
  231. package/dist/{chunk-E6T264NS.js → chunk-WKRSH2VR.js} +3 -3
  232. package/dist/{chunk-E6T264NS.js.map → chunk-WKRSH2VR.js.map} +1 -1
  233. package/dist/{chunk-4QEC4CCS.js → chunk-WTMU7J4U.js} +2 -2
  234. package/dist/{chunk-4QEC4CCS.js.map → chunk-WTMU7J4U.js.map} +1 -1
  235. package/dist/{chunk-EFXJ5C7X.js → chunk-XN7NOENA.js} +6 -6
  236. package/dist/chunk-XN7NOENA.js.map +1 -0
  237. package/dist/{chunk-AMYY3JHQ.cjs → chunk-XSX2UU6Y.cjs} +10 -9
  238. package/dist/chunk-XSX2UU6Y.cjs.map +1 -0
  239. package/dist/{chunk-6PTCKXD3.js → chunk-XV4IZNV4.js} +9 -9
  240. package/dist/chunk-XV4IZNV4.js.map +1 -0
  241. package/dist/{chunk-FBZMSLDC.cjs → chunk-XWL6O3SW.cjs} +4 -4
  242. package/dist/chunk-XWL6O3SW.cjs.map +1 -0
  243. package/dist/{chunk-OIBHY6JQ.js → chunk-YMA4S2WO.js} +4 -4
  244. package/dist/{chunk-OIBHY6JQ.js.map → chunk-YMA4S2WO.js.map} +1 -1
  245. package/dist/{chunk-T5ZWI3MC.cjs → chunk-YPJ5NH5N.cjs} +11 -11
  246. package/dist/chunk-YPJ5NH5N.cjs.map +1 -0
  247. package/dist/{chunk-YLQQX5W2.cjs → chunk-ZF2LDKQQ.cjs} +2 -2
  248. package/dist/chunk-ZF2LDKQQ.cjs.map +1 -0
  249. package/dist/{chunk-L5YO6PWL.cjs → chunk-ZNW6V4Y6.cjs} +2 -2
  250. package/dist/chunk-ZNW6V4Y6.cjs.map +1 -0
  251. package/dist/client/index.cjs.map +1 -1
  252. package/dist/client/index.js.map +1 -1
  253. package/dist/client/theokit-client.d.cts +36 -0
  254. package/dist/client/theokit-client.d.ts +36 -0
  255. package/dist/client/types.d.cts +30 -0
  256. package/dist/client/types.d.ts +30 -0
  257. package/dist/compact-session-K5LXTBPJ.js +22 -0
  258. package/dist/{compact-session-EJ36VH5I.js.map → compact-session-K5LXTBPJ.js.map} +1 -1
  259. package/dist/compact-session-YCT6JMBX.cjs +59 -0
  260. package/dist/{compact-session-6GKIS4SD.cjs.map → compact-session-YCT6JMBX.cjs.map} +1 -1
  261. package/dist/compaction.cjs +17 -16
  262. package/dist/compaction.d.cts +13 -13
  263. package/dist/compaction.d.ts +13 -13
  264. package/dist/compaction.js +4 -3
  265. package/dist/concurrency.cjs +7 -6
  266. package/dist/concurrency.cjs.map +1 -1
  267. package/dist/concurrency.js +5 -4
  268. package/dist/concurrency.js.map +1 -1
  269. package/dist/context/index.cjs +7 -7
  270. package/dist/context/index.js +3 -3
  271. package/dist/context-FDOON2DB.js +6 -0
  272. package/dist/{context-DCECDKWN.js.map → context-FDOON2DB.js.map} +1 -1
  273. package/dist/context-VMIE4BMD.cjs +23 -0
  274. package/dist/{context-4HGPCOH6.cjs.map → context-VMIE4BMD.cjs.map} +1 -1
  275. package/dist/cron-CRwy2JBF.d.ts +240 -0
  276. package/dist/cron-DxxeQ-sK.d.cts +240 -0
  277. package/dist/cron.cjs +44 -42
  278. package/dist/cron.d.cts +5 -3
  279. package/dist/cron.d.ts +5 -3
  280. package/dist/cron.js +43 -41
  281. package/dist/define-tool.d.ts +14 -6
  282. package/dist/{errors-CHllybaU.d.ts → errors-BgJH9PHi.d.cts} +39 -24
  283. package/dist/{errors-BSoXcl3F.d.cts → errors-C5fJUqLk.d.ts} +39 -24
  284. package/dist/errors.cjs +22 -21
  285. package/dist/errors.d.cts +2 -2
  286. package/dist/errors.d.ts +2 -2
  287. package/dist/errors.js +3 -2
  288. package/dist/eval.cjs +62 -59
  289. package/dist/eval.cjs.map +1 -1
  290. package/dist/eval.d.cts +38 -0
  291. package/dist/eval.d.ts +38 -0
  292. package/dist/eval.js +52 -49
  293. package/dist/eval.js.map +1 -1
  294. package/dist/event-bus.d.ts +16 -0
  295. package/dist/{executor-3CGPLVJL.js → executor-BMEHFOXZ.js} +8 -7
  296. package/dist/executor-BMEHFOXZ.js.map +1 -0
  297. package/dist/{executor-4SW7QGZ4.cjs → executor-ZERJ3DGN.cjs} +25 -24
  298. package/dist/executor-ZERJ3DGN.cjs.map +1 -0
  299. package/dist/filesystem/index.cjs +8 -7
  300. package/dist/filesystem/index.cjs.map +1 -1
  301. package/dist/filesystem/index.js +4 -3
  302. package/dist/filesystem/index.js.map +1 -1
  303. package/dist/filesystem/local-filesystem.d.cts +18 -0
  304. package/dist/filesystem/local-filesystem.d.ts +18 -0
  305. package/dist/filesystem/types.d.cts +12 -0
  306. package/dist/filesystem/types.d.ts +12 -0
  307. package/dist/fs-session-store-3MOJQGP2.cjs +20 -0
  308. package/dist/{fs-session-store-VXXDIBGM.cjs.map → fs-session-store-3MOJQGP2.cjs.map} +1 -1
  309. package/dist/fs-session-store-IN7JTTXD.js +11 -0
  310. package/dist/{fs-session-store-LIKYT24K.js.map → fs-session-store-IN7JTTXD.js.map} +1 -1
  311. package/dist/generate-object-N5MDZUJI.js +8 -0
  312. package/dist/{generate-object-TVQCW2IZ.js.map → generate-object-N5MDZUJI.js.map} +1 -1
  313. package/dist/generate-object-PGSP5U7N.cjs +21 -0
  314. package/dist/{generate-object-E465DX5I.cjs.map → generate-object-PGSP5U7N.cjs.map} +1 -1
  315. package/dist/generate-object.d.ts +20 -0
  316. package/dist/index-manager-NG5YENWO.cjs +22 -0
  317. package/dist/{index-manager-HGGL4DD5.cjs.map → index-manager-NG5YENWO.cjs.map} +1 -1
  318. package/dist/index-manager-ZMRJ6ZII.js +13 -0
  319. package/dist/{index-manager-EA6FGIQG.js.map → index-manager-ZMRJ6ZII.js.map} +1 -1
  320. package/dist/index.cjs +176 -154
  321. package/dist/index.cjs.map +1 -1
  322. package/dist/index.d.cts +761 -57
  323. package/dist/index.d.ts +761 -57
  324. package/dist/index.js +62 -59
  325. package/dist/index.js.map +1 -1
  326. package/dist/{inject-session-HO7FYVCX.js → inject-session-DDR6X6PC.js} +9 -8
  327. package/dist/inject-session-DDR6X6PC.js.map +1 -0
  328. package/dist/inject-session-XLO3KTBM.cjs +29 -0
  329. package/dist/inject-session-XLO3KTBM.cjs.map +1 -0
  330. package/dist/internal/auth/auth-types.d.ts +84 -2
  331. package/dist/internal/auth/credential-store.d.ts +34 -6
  332. package/dist/internal/auth/oauth-device.d.ts +2 -3
  333. package/dist/internal/auth/resolve-credential.d.ts +40 -0
  334. package/dist/internal/budget/tracker/budget.d.ts +12 -14
  335. package/dist/internal/budget/usage-accumulator.d.ts +15 -0
  336. package/dist/internal/llm/anthropic-shared.d.ts +8 -4
  337. package/dist/internal/llm/model-identifier.d.ts +26 -0
  338. package/dist/internal/llm/openai.d.ts +8 -0
  339. package/dist/internal/llm/router.d.ts +8 -0
  340. package/dist/internal/llm/types.d.ts +12 -1
  341. package/dist/internal/local-agent/mcp-pool.d.ts +2 -4
  342. package/dist/internal/local-agent/real-local-run-provider.d.ts +8 -3
  343. package/dist/internal/local-agent/real-local-run-tools.d.ts +8 -0
  344. package/dist/internal/mcp/oauth.d.ts +19 -1
  345. package/dist/internal/mcp/token-storage.d.ts +52 -1
  346. package/dist/internal/memory/adapters/index.cjs +12 -11
  347. package/dist/internal/memory/adapters/index.d.cts +3 -1
  348. package/dist/internal/memory/adapters/index.d.ts +3 -1
  349. package/dist/internal/memory/adapters/index.js +9 -8
  350. package/dist/internal/memory/adapters/openai-compatible.d.cts +45 -0
  351. package/dist/internal/memory/adapters/openai-compatible.d.ts +45 -0
  352. package/dist/internal/memory/embedding-cache.d.ts +42 -1
  353. package/dist/internal/memory/escape-like-pattern.d.ts +22 -0
  354. package/dist/internal/memory/sqlite-vec-loader.d.ts +1 -3
  355. package/dist/internal/memory/storage/markdown-store.d.ts +0 -5
  356. package/dist/internal/persistence/atomic-write.d.cts +93 -0
  357. package/dist/internal/persistence/atomic-write.d.ts +93 -0
  358. package/dist/internal/persistence/cwd-mutex.d.cts +34 -0
  359. package/dist/internal/persistence/cwd-mutex.d.ts +34 -0
  360. package/dist/internal/persistence/exclusive-create.d.cts +31 -0
  361. package/dist/internal/persistence/exclusive-create.d.ts +31 -0
  362. package/dist/internal/persistence/file-lock.d.cts +41 -1
  363. package/dist/internal/persistence/file-lock.d.ts +41 -1
  364. package/dist/internal/persistence/fs-session-store.d.cts +3 -0
  365. package/dist/internal/persistence/fs-session-store.d.ts +3 -0
  366. package/dist/internal/persistence/fts5-sanitize.d.cts +29 -1
  367. package/dist/internal/persistence/fts5-sanitize.d.ts +29 -1
  368. package/dist/internal/persistence/index.cjs +40 -39
  369. package/dist/internal/persistence/index.cjs.map +1 -1
  370. package/dist/internal/persistence/index.d.cts +6 -1
  371. package/dist/internal/persistence/index.d.ts +6 -1
  372. package/dist/internal/persistence/index.js +9 -8
  373. package/dist/internal/persistence/index.js.map +1 -1
  374. package/dist/internal/persistence/paths.d.cts +54 -1
  375. package/dist/internal/persistence/paths.d.ts +54 -1
  376. package/dist/internal/persistence/persistence-schema.d.cts +9 -1
  377. package/dist/internal/persistence/persistence-schema.d.ts +9 -1
  378. package/dist/internal/persistence/schema-version.d.cts +215 -1
  379. package/dist/internal/persistence/schema-version.d.ts +215 -1
  380. package/dist/internal/persistence/session-dir.d.cts +1 -0
  381. package/dist/internal/persistence/session-dir.d.ts +1 -0
  382. package/dist/internal/persistence/session-writer.d.cts +20 -7
  383. package/dist/internal/persistence/session-writer.d.ts +20 -7
  384. package/dist/internal/persistence/sqlite-cas.d.cts +37 -1
  385. package/dist/internal/persistence/sqlite-cas.d.ts +37 -1
  386. package/dist/internal/persistence/sqlite-open.d.cts +14 -0
  387. package/dist/internal/persistence/sqlite-open.d.ts +14 -0
  388. package/dist/internal/persistence/sqlite-wal.d.cts +53 -0
  389. package/dist/internal/persistence/sqlite-wal.d.ts +53 -0
  390. package/dist/internal/persistence/transcript-ops.d.cts +7 -1
  391. package/dist/internal/persistence/transcript-ops.d.ts +7 -1
  392. package/dist/internal/plugins/types.d.cts +1 -1
  393. package/dist/internal/plugins/types.d.ts +1 -1
  394. package/dist/internal/providers/builtin/cerebras.d.ts +2 -2
  395. package/dist/internal/providers/builtin/deepinfra.d.ts +1 -1
  396. package/dist/internal/providers/builtin/openai-chatgpt.d.ts +12 -0
  397. package/dist/internal/providers/catalog-loader.d.ts +8 -0
  398. package/dist/internal/providers/catalog-schema.d.ts +55 -0
  399. package/dist/internal/providers/catalog-source-models-dev.d.ts +37 -1
  400. package/dist/internal/runtime/concurrency/delegation-depth.d.ts +27 -0
  401. package/dist/internal/runtime/concurrency/subagent-credentials.d.ts +33 -1
  402. package/dist/internal/runtime/context/context-discovery-runner.d.ts +44 -0
  403. package/dist/internal/runtime/context/context-discovery.d.ts +58 -0
  404. package/dist/internal/runtime/context/context-rules-frontmatter.d.ts +70 -1
  405. package/dist/internal/runtime/fixtures/fixture-mode.d.ts +15 -1
  406. package/dist/internal/runtime/lifecycle/env-policy.d.ts +1 -3
  407. package/dist/internal/runtime/lifecycle/post-run-lifecycle.d.ts +15 -0
  408. package/dist/internal/runtime/registry/agent-registry-store.d.ts +12 -0
  409. package/dist/internal/runtime/registry/live-agent-registry.d.ts +37 -0
  410. package/dist/internal/scorers/llm-judge.d.ts +6 -1
  411. package/dist/internal/security/index.cjs +14 -13
  412. package/dist/internal/security/index.d.cts +4 -1
  413. package/dist/internal/security/index.d.ts +4 -1
  414. package/dist/internal/security/index.js +4 -3
  415. package/dist/internal/security/path-guard.d.cts +107 -0
  416. package/dist/internal/security/path-guard.d.ts +107 -0
  417. package/dist/internal/security/redact.d.cts +71 -0
  418. package/dist/internal/security/redact.d.ts +71 -0
  419. package/dist/internal/session/agent-session.d.ts +15 -4
  420. package/dist/internal/session/compact-session.d.ts +2 -2
  421. package/dist/internal/session/session-cache.d.ts +5 -0
  422. package/dist/internal/task/store.d.ts +91 -5
  423. package/dist/internal/telemetry/span-names.d.ts +0 -1
  424. package/dist/internal/telemetry/tracer.d.ts +38 -0
  425. package/dist/job-queue.d.ts +18 -0
  426. package/dist/judge-call-DWHAJATE.js +6 -0
  427. package/dist/{judge-call-QMKGC2ZK.js.map → judge-call-DWHAJATE.js.map} +1 -1
  428. package/dist/judge-call-EGYRC2RE.cjs +23 -0
  429. package/dist/{judge-call-GVIJWQVE.cjs.map → judge-call-EGYRC2RE.cjs.map} +1 -1
  430. package/dist/mcp-auth.cjs +41 -25
  431. package/dist/mcp-auth.cjs.map +1 -1
  432. package/dist/mcp-auth.js +34 -18
  433. package/dist/mcp-auth.js.map +1 -1
  434. package/dist/models.cjs +43 -28
  435. package/dist/models.cjs.map +1 -1
  436. package/dist/models.js +26 -11
  437. package/dist/models.js.map +1 -1
  438. package/dist/oauth-transaction-store-BT4GLTLK.cjs +36 -0
  439. package/dist/{oauth-transaction-store-7CKHPQRN.cjs.map → oauth-transaction-store-BT4GLTLK.cjs.map} +1 -1
  440. package/dist/oauth-transaction-store-W52KVHQ4.js +3 -0
  441. package/dist/{oauth-transaction-store-W74I6EFD.js.map → oauth-transaction-store-W52KVHQ4.js.map} +1 -1
  442. package/dist/path-safety.cjs +11 -10
  443. package/dist/path-safety.js +4 -3
  444. package/dist/permission-engine.d.ts +55 -0
  445. package/dist/persistence.cjs +43 -42
  446. package/dist/persistence.cjs.map +1 -1
  447. package/dist/persistence.js +13 -12
  448. package/dist/persistence.js.map +1 -1
  449. package/dist/project.cjs +9 -8
  450. package/dist/project.cjs.map +1 -1
  451. package/dist/project.js +5 -4
  452. package/dist/project.js.map +1 -1
  453. package/dist/providers.cjs +23 -0
  454. package/dist/providers.cjs.map +1 -0
  455. package/dist/providers.d.cts +29 -0
  456. package/dist/providers.d.ts +29 -0
  457. package/dist/providers.js +10 -0
  458. package/dist/providers.js.map +1 -0
  459. package/dist/registry-VFKX7WOP.cjs +47 -0
  460. package/dist/{registry-UBY26R4I.cjs.map → registry-VFKX7WOP.cjs.map} +1 -1
  461. package/dist/registry-VFP3WWQP.js +10 -0
  462. package/dist/{registry-GC7BQMSV.js.map → registry-VFP3WWQP.js.map} +1 -1
  463. package/dist/retry.cjs +5 -4
  464. package/dist/retry.js +4 -3
  465. package/dist/{run-C8FBAC8o.d.ts → run-BYSHf58D.d.cts} +185 -33
  466. package/dist/{run-C8FBAC8o.d.cts → run-BYSHf58D.d.ts} +185 -33
  467. package/dist/{run-to-completion-JDPIUKSH.js → run-to-completion-DRO77625.js} +3 -3
  468. package/dist/{run-to-completion-JDPIUKSH.js.map → run-to-completion-DRO77625.js.map} +1 -1
  469. package/dist/{run-to-completion-J73I6IY4.cjs → run-to-completion-X4OWM673.cjs} +13 -13
  470. package/dist/{run-to-completion-J73I6IY4.cjs.map → run-to-completion-X4OWM673.cjs.map} +1 -1
  471. package/dist/sandbox/bwrap.d.cts +27 -14
  472. package/dist/sandbox/bwrap.d.ts +27 -14
  473. package/dist/sandbox/index.cjs +21 -20
  474. package/dist/sandbox/index.cjs.map +1 -1
  475. package/dist/sandbox/index.js +6 -5
  476. package/dist/sandbox/index.js.map +1 -1
  477. package/dist/sandbox/linux-sandbox.d.cts +72 -0
  478. package/dist/sandbox/linux-sandbox.d.ts +72 -0
  479. package/dist/sandbox/local-sandbox.d.cts +41 -0
  480. package/dist/sandbox/local-sandbox.d.ts +41 -0
  481. package/dist/sandbox/seccomp.d.cts +6 -0
  482. package/dist/sandbox/seccomp.d.ts +6 -0
  483. package/dist/sandbox/types.d.cts +64 -0
  484. package/dist/sandbox/types.d.ts +64 -0
  485. package/dist/scorers.d.ts +38 -7
  486. package/dist/sdk-agent-D8qJVkuV.d.ts +860 -0
  487. package/dist/sdk-agent-DEoKhA8a.d.cts +860 -0
  488. package/dist/server/auth/errors.d.cts +1 -1
  489. package/dist/server/auth/errors.d.ts +1 -1
  490. package/dist/server/auth/index.cjs +29 -21
  491. package/dist/server/auth/index.cjs.map +1 -1
  492. package/dist/server/auth/index.d.cts +25 -15
  493. package/dist/server/auth/index.d.ts +25 -15
  494. package/dist/server/auth/index.js +15 -7
  495. package/dist/server/auth/index.js.map +1 -1
  496. package/dist/server/auth/oauth-transaction-store.d.cts +13 -1
  497. package/dist/server/auth/oauth-transaction-store.d.ts +13 -1
  498. package/dist/server/auth/orchestrator.d.cts +1 -1
  499. package/dist/server/auth/orchestrator.d.ts +1 -1
  500. package/dist/server/auth/types.d.cts +1 -1
  501. package/dist/server/auth/types.d.ts +1 -1
  502. package/dist/server/auth/validate-return-to.d.cts +21 -11
  503. package/dist/server/auth/validate-return-to.d.ts +21 -11
  504. package/dist/server/errors-envelope.cjs +15 -14
  505. package/dist/server/errors-envelope.cjs.map +1 -1
  506. package/dist/server/errors-envelope.d.cts +4 -4
  507. package/dist/server/errors-envelope.d.ts +4 -4
  508. package/dist/server/errors-envelope.js +4 -3
  509. package/dist/server/errors-envelope.js.map +1 -1
  510. package/dist/session-transcript-AKDYYGXQ.js +6 -0
  511. package/dist/{session-transcript-SKIRBEJE.js.map → session-transcript-AKDYYGXQ.js.map} +1 -1
  512. package/dist/session-transcript-JXHFTB7G.cjs +51 -0
  513. package/dist/{session-transcript-TNAJ4O3M.cjs.map → session-transcript-JXHFTB7G.cjs.map} +1 -1
  514. package/dist/skills.cjs +8 -7
  515. package/dist/skills.js +6 -5
  516. package/dist/stream-object-BUCF5PHO.cjs +21 -0
  517. package/dist/{stream-object-T4DAMNVB.cjs.map → stream-object-BUCF5PHO.cjs.map} +1 -1
  518. package/dist/stream-object-L57K4OFS.js +8 -0
  519. package/dist/{stream-object-QMNR3YFF.js.map → stream-object-L57K4OFS.js.map} +1 -1
  520. package/dist/{stream-to-completion-DFJ5T3BK.js → stream-to-completion-QV5HCL3J.js} +3 -3
  521. package/dist/{stream-to-completion-DFJ5T3BK.js.map → stream-to-completion-QV5HCL3J.js.map} +1 -1
  522. package/dist/{stream-to-completion-H2MHISSK.cjs → stream-to-completion-SRISU5AB.cjs} +10 -10
  523. package/dist/{stream-to-completion-H2MHISSK.cjs.map → stream-to-completion-SRISU5AB.cjs.map} +1 -1
  524. package/dist/subagents-loader-AZIXJ7D3.cjs +16 -0
  525. package/dist/{subagents-loader-3CXBQWWY.cjs.map → subagents-loader-AZIXJ7D3.cjs.map} +1 -1
  526. package/dist/subagents-loader-J54ESLDV.js +7 -0
  527. package/dist/{subagents-loader-WN2SB6PV.js.map → subagents-loader-J54ESLDV.js.map} +1 -1
  528. package/dist/subagents-loader.cjs +7 -6
  529. package/dist/subagents-loader.cjs.map +1 -1
  530. package/dist/subagents-loader.d.cts +3 -2
  531. package/dist/subagents-loader.d.ts +3 -2
  532. package/dist/subagents-loader.js +5 -4
  533. package/dist/subagents-loader.js.map +1 -1
  534. package/dist/subscription/define-subscription.d.cts +1 -1
  535. package/dist/subscription/define-subscription.d.ts +1 -1
  536. package/dist/subscription/index.cjs +22 -9
  537. package/dist/subscription/index.cjs.map +1 -1
  538. package/dist/subscription/index.d.cts +1 -1
  539. package/dist/subscription/index.d.ts +1 -1
  540. package/dist/subscription/index.js +21 -8
  541. package/dist/subscription/index.js.map +1 -1
  542. package/dist/subscription/internal/adapter-types.d.cts +1 -1
  543. package/dist/subscription/internal/adapter-types.d.ts +1 -1
  544. package/dist/subscription/internal/server-integration.d.cts +1 -1
  545. package/dist/subscription/internal/server-integration.d.ts +1 -1
  546. package/dist/subscription/internal/sse-encoder.d.cts +1 -1
  547. package/dist/subscription/internal/sse-encoder.d.ts +1 -1
  548. package/dist/subscription/internal/sse-parser.d.cts +1 -1
  549. package/dist/subscription/internal/sse-parser.d.ts +1 -1
  550. package/dist/subscription/internal/subscription-runtime.d.cts +1 -1
  551. package/dist/subscription/internal/subscription-runtime.d.ts +1 -1
  552. package/dist/subscription/internal/ws-adapter-node.d.cts +1 -1
  553. package/dist/subscription/internal/ws-adapter-node.d.ts +1 -1
  554. package/dist/subscription/theokit-subscribe.d.cts +14 -1
  555. package/dist/subscription/theokit-subscribe.d.ts +14 -1
  556. package/dist/subscription/types.d.cts +19 -1
  557. package/dist/subscription/types.d.ts +19 -1
  558. package/dist/task-store.cjs +8 -7
  559. package/dist/task-store.js +5 -4
  560. package/dist/types/agent-prims.d.ts +14 -0
  561. package/dist/types/agent.d.ts +69 -17
  562. package/dist/types/batch.d.ts +7 -1
  563. package/dist/types/conversation.d.ts +18 -5
  564. package/dist/types/goal-events.d.ts +4 -8
  565. package/dist/types/memory-adapter.d.ts +12 -1
  566. package/dist/types/plugin.d.ts +101 -0
  567. package/dist/types/provider-profile.d.ts +21 -2
  568. package/dist/types/run-events.d.ts +28 -1
  569. package/dist/types/run.d.ts +35 -23
  570. package/dist/types/sdk-agent.d.ts +14 -0
  571. package/dist/types/session-record.d.ts +18 -1
  572. package/dist/types/task.d.ts +15 -1
  573. package/dist/types/theokit.d.ts +10 -1
  574. package/dist/types/updates.d.ts +35 -4
  575. package/dist/types/workflow.d.ts +155 -0
  576. package/dist/workflow.cjs +29 -28
  577. package/dist/workflow.d.cts +666 -17
  578. package/dist/workflow.d.ts +666 -17
  579. package/dist/workflow.js +8 -7
  580. package/docs/error-codes.md +208 -172
  581. package/docs/harness-capability-map.md +1357 -304
  582. package/package.json +21 -8
  583. package/bin/init-claude.mjs +0 -68
  584. package/claude-template/AGENTS.md +0 -157
  585. package/claude-template/CLAUDE.md +0 -66
  586. package/claude-template/dot-claude/rules/theokit-conventions.md +0 -32
  587. package/claude-template/dot-claude/settings.json +0 -16
  588. package/claude-template/dot-claude/skills/theokit-agent-core/SKILL.md +0 -209
  589. package/claude-template/dot-claude/skills/theokit-auth/SKILL.md +0 -102
  590. package/claude-template/dot-claude/skills/theokit-budget/SKILL.md +0 -176
  591. package/claude-template/dot-claude/skills/theokit-client/SKILL.md +0 -58
  592. package/claude-template/dot-claude/skills/theokit-compaction/SKILL.md +0 -102
  593. package/claude-template/dot-claude/skills/theokit-concurrency/SKILL.md +0 -68
  594. package/claude-template/dot-claude/skills/theokit-config/SKILL.md +0 -139
  595. package/claude-template/dot-claude/skills/theokit-cron/SKILL.md +0 -148
  596. package/claude-template/dot-claude/skills/theokit-di/SKILL.md +0 -233
  597. package/claude-template/dot-claude/skills/theokit-di-agent/SKILL.md +0 -294
  598. package/claude-template/dot-claude/skills/theokit-errors/SKILL.md +0 -172
  599. package/claude-template/dot-claude/skills/theokit-eval/SKILL.md +0 -179
  600. package/claude-template/dot-claude/skills/theokit-filesystem/SKILL.md +0 -74
  601. package/claude-template/dot-claude/skills/theokit-gateways/SKILL.md +0 -209
  602. package/claude-template/dot-claude/skills/theokit-memory/SKILL.md +0 -176
  603. package/claude-template/dot-claude/skills/theokit-messages/SKILL.md +0 -58
  604. package/claude-template/dot-claude/skills/theokit-models/SKILL.md +0 -79
  605. package/claude-template/dot-claude/skills/theokit-path-safety/SKILL.md +0 -60
  606. package/claude-template/dot-claude/skills/theokit-persistence/SKILL.md +0 -85
  607. package/claude-template/dot-claude/skills/theokit-project/SKILL.md +0 -55
  608. package/claude-template/dot-claude/skills/theokit-retry/SKILL.md +0 -50
  609. package/claude-template/dot-claude/skills/theokit-sandbox/SKILL.md +0 -93
  610. package/claude-template/dot-claude/skills/theokit-sanitize/SKILL.md +0 -66
  611. package/claude-template/dot-claude/skills/theokit-skills/SKILL.md +0 -68
  612. package/claude-template/dot-claude/skills/theokit-streaming/SKILL.md +0 -156
  613. package/claude-template/dot-claude/skills/theokit-subagents/SKILL.md +0 -109
  614. package/claude-template/dot-claude/skills/theokit-subscriptions/SKILL.md +0 -148
  615. package/claude-template/dot-claude/skills/theokit-task-store/SKILL.md +0 -75
  616. package/claude-template/dot-claude/skills/theokit-tools/SKILL.md +0 -170
  617. package/claude-template/dot-claude/skills/theokit-workflows/SKILL.md +0 -218
  618. package/dist/agent-JX5SBYDE.cjs +0 -59
  619. package/dist/agent-ZAGG6ZBS.js +0 -50
  620. package/dist/agent-session-store-EPX2WQI4.cjs +0 -23
  621. package/dist/agent-session-store-JMU7ASDB.js +0 -6
  622. package/dist/batch-NLIS4QTW.js.map +0 -1
  623. package/dist/batch-WQ3AJCDV.cjs.map +0 -1
  624. package/dist/chunk-23VZBRDQ.js.map +0 -1
  625. package/dist/chunk-2CFEET3Y.cjs.map +0 -1
  626. package/dist/chunk-2QMK627M.cjs.map +0 -1
  627. package/dist/chunk-2RW7K6FN.cjs.map +0 -1
  628. package/dist/chunk-2VFZQEDW.cjs.map +0 -1
  629. package/dist/chunk-2XLKLVVR.js.map +0 -1
  630. package/dist/chunk-2Y5NO2SY.js.map +0 -1
  631. package/dist/chunk-2YGIBOUH.cjs.map +0 -1
  632. package/dist/chunk-2YWWPCGX.js.map +0 -1
  633. package/dist/chunk-33L2NVTJ.cjs.map +0 -1
  634. package/dist/chunk-34XOCZJO.js.map +0 -1
  635. package/dist/chunk-3SHW7XKK.js.map +0 -1
  636. package/dist/chunk-4NAKHID5.js.map +0 -1
  637. package/dist/chunk-4X3SBHPK.js.map +0 -1
  638. package/dist/chunk-5NBUH3NO.js.map +0 -1
  639. package/dist/chunk-634YVZLU.js.map +0 -1
  640. package/dist/chunk-6DCTL32L.cjs.map +0 -1
  641. package/dist/chunk-6PTCKXD3.js.map +0 -1
  642. package/dist/chunk-7HQVDLFI.cjs.map +0 -1
  643. package/dist/chunk-7TB5U7RK.js.map +0 -1
  644. package/dist/chunk-7W7ZWMLQ.js.map +0 -1
  645. package/dist/chunk-ADVZIC43.cjs.map +0 -1
  646. package/dist/chunk-AM2CNBKE.js.map +0 -1
  647. package/dist/chunk-AMYY3JHQ.cjs.map +0 -1
  648. package/dist/chunk-B4YA6BRS.cjs.map +0 -1
  649. package/dist/chunk-BBZYXVLZ.cjs.map +0 -1
  650. package/dist/chunk-BC5EUG7R.cjs.map +0 -1
  651. package/dist/chunk-CAH3G4IS.js.map +0 -1
  652. package/dist/chunk-CHVSMEKM.js.map +0 -1
  653. package/dist/chunk-CZHPR2G7.cjs.map +0 -1
  654. package/dist/chunk-DEZ75ET5.js.map +0 -1
  655. package/dist/chunk-DM6Y5B2G.cjs.map +0 -1
  656. package/dist/chunk-EFXJ5C7X.js.map +0 -1
  657. package/dist/chunk-EQMLJ52C.cjs.map +0 -1
  658. package/dist/chunk-FBZMSLDC.cjs.map +0 -1
  659. package/dist/chunk-HI4ZW62S.js.map +0 -1
  660. package/dist/chunk-HTK54K2J.js.map +0 -1
  661. package/dist/chunk-I5OTK2RP.js.map +0 -1
  662. package/dist/chunk-JJZ4NIAG.js.map +0 -1
  663. package/dist/chunk-KIX45IKP.js.map +0 -1
  664. package/dist/chunk-KZBB4YKU.js.map +0 -1
  665. package/dist/chunk-L5YO6PWL.cjs.map +0 -1
  666. package/dist/chunk-L7EGRCKJ.js.map +0 -1
  667. package/dist/chunk-NOS7PTKP.js.map +0 -1
  668. package/dist/chunk-NUEL6RCZ.cjs.map +0 -1
  669. package/dist/chunk-NZOR3N4E.js.map +0 -1
  670. package/dist/chunk-OKLYRPKL.cjs.map +0 -1
  671. package/dist/chunk-OXNYIMZZ.js.map +0 -1
  672. package/dist/chunk-PNVDQL5Y.cjs.map +0 -1
  673. package/dist/chunk-QLAWEGTZ.cjs.map +0 -1
  674. package/dist/chunk-QN5N3ZVT.cjs.map +0 -1
  675. package/dist/chunk-R3CKCRK3.cjs.map +0 -1
  676. package/dist/chunk-R7TKOQMJ.js.map +0 -1
  677. package/dist/chunk-RP5HQVLD.js.map +0 -1
  678. package/dist/chunk-SXSPMRSV.cjs.map +0 -1
  679. package/dist/chunk-T5ZWI3MC.cjs.map +0 -1
  680. package/dist/chunk-T6QUCG7L.cjs.map +0 -1
  681. package/dist/chunk-TR4V2LHV.cjs.map +0 -1
  682. package/dist/chunk-VYCKUKPA.cjs.map +0 -1
  683. package/dist/chunk-VYHJZVL5.cjs.map +0 -1
  684. package/dist/chunk-W4FV7JBH.js.map +0 -1
  685. package/dist/chunk-X2FR4OIT.js.map +0 -1
  686. package/dist/chunk-XRI6DXPZ.js.map +0 -1
  687. package/dist/chunk-XWCTBGYK.js.map +0 -1
  688. package/dist/chunk-YLQQX5W2.cjs.map +0 -1
  689. package/dist/chunk-YTO5BRBD.cjs.map +0 -1
  690. package/dist/chunk-Z5U2JGEK.cjs.map +0 -1
  691. package/dist/compact-session-6GKIS4SD.cjs +0 -58
  692. package/dist/compact-session-EJ36VH5I.js +0 -21
  693. package/dist/context-4HGPCOH6.cjs +0 -22
  694. package/dist/context-DCECDKWN.js +0 -5
  695. package/dist/cron-DgHJnMAK.d.cts +0 -631
  696. package/dist/cron-DyWQsEG6.d.ts +0 -631
  697. package/dist/executor-3CGPLVJL.js.map +0 -1
  698. package/dist/executor-4SW7QGZ4.cjs.map +0 -1
  699. package/dist/fs-session-store-LIKYT24K.js +0 -10
  700. package/dist/fs-session-store-VXXDIBGM.cjs +0 -19
  701. package/dist/generate-object-E465DX5I.cjs +0 -20
  702. package/dist/generate-object-TVQCW2IZ.js +0 -7
  703. package/dist/index-manager-EA6FGIQG.js +0 -12
  704. package/dist/index-manager-HGGL4DD5.cjs +0 -21
  705. package/dist/inject-session-67SF65FC.cjs +0 -28
  706. package/dist/inject-session-67SF65FC.cjs.map +0 -1
  707. package/dist/inject-session-HO7FYVCX.js.map +0 -1
  708. package/dist/judge-call-GVIJWQVE.cjs +0 -22
  709. package/dist/judge-call-QMKGC2ZK.js +0 -5
  710. package/dist/oauth-transaction-store-7CKHPQRN.cjs +0 -32
  711. package/dist/oauth-transaction-store-W74I6EFD.js +0 -3
  712. package/dist/registry-GC7BQMSV.js +0 -9
  713. package/dist/registry-UBY26R4I.cjs +0 -46
  714. package/dist/session-transcript-SKIRBEJE.js +0 -5
  715. package/dist/session-transcript-TNAJ4O3M.cjs +0 -50
  716. package/dist/stream-object-QMNR3YFF.js +0 -7
  717. package/dist/stream-object-T4DAMNVB.cjs +0 -20
  718. package/dist/subagents-loader-3CXBQWWY.cjs +0 -15
  719. package/dist/subagents-loader-WN2SB6PV.js +0 -6
@@ -1,5 +1,5 @@
1
- import { M as ModelSelection, ad as SDKUserMessage, af as SendOptions, b as Run, G as GenerateOptions, n as GenerateRunResult, $ as RunToCompletionOptions, a0 as RunToCompletionResult, S as SDKMessage, am as StreamToCompletionResult, C as CustomTool, c as PermissionMode, a as McpServerConfig, P as Processor } from './run-C8FBAC8o.js';
2
- import * as zod from 'zod';
1
+ import { m as MemoryFact, j as MemoryAdapter, S as SDKAgent, l as MemoryContext, D as SystemPromptSkillRef, C as ContextSettings, P as ProviderRoutingSettings, a as PluginsSettings } from './sdk-agent-DEoKhA8a.cjs';
2
+ import { C as CustomTool, c as PermissionMode, M as ModelSelection, a as McpServerConfig, P as Processor } from './run-BYSHf58D.cjs';
3
3
 
4
4
  /**
5
5
  * `SessionRecord` — the native on-disk transcript record shape (SE40).
@@ -15,7 +15,6 @@ import * as zod from 'zod';
15
15
  *
16
16
  * @public
17
17
  */
18
- /** One transcript record (one JSONL line). `message` absent on `system` (compact_boundary) records. */
19
18
  /** A content block inside {@link TranscriptMessage}. */
20
19
  type TranscriptBlock = {
21
20
  type: "text";
@@ -60,6 +59,24 @@ interface TranscriptMessage {
60
59
  type?: "message";
61
60
  model?: string;
62
61
  }
62
+ /**
63
+ * One transcript record — a single line of the session JSONL file, and the unit the pluggable
64
+ * `SessionStore` seam reads and writes.
65
+ *
66
+ * Records form a `uuid`/`parentUuid` DAG, not a flat list: `parentUuid` names the preceding record
67
+ * and is `null` at the root. Thread a session by following those links; a reader that assumes file
68
+ * order is linear will mis-thread one that branched.
69
+ *
70
+ * `message` is absent on `system` records — a compaction boundary carries `compactMetadata` instead —
71
+ * so it is optional even on records you would expect to be conversational, and `type` is what tells
72
+ * you which you are holding.
73
+ *
74
+ * Reading is deliberately tolerant: a malformed line is skipped rather than failing the whole read.
75
+ * Every record you receive is well-formed, but the file may have contained more than you got back,
76
+ * so this is not the type to use for an exact-count audit of what was written.
77
+ *
78
+ * @public
79
+ */
63
80
  interface SessionRecord {
64
81
  type: "user" | "assistant" | "system";
65
82
  uuid: string;
@@ -144,182 +161,6 @@ interface SessionStore {
144
161
  appendRecords(agentId: string, records: readonly SessionRecord[]): Promise<void>;
145
162
  }
146
163
 
147
- /**
148
- * Public `MemoryAdapter` contract (T1.1, ADRs D141 / D147).
149
- *
150
- * The plugin extension point `{ kind: "memory" }` (ADR D98) declares a
151
- * `createProvider` factory; this file types its return value formally.
152
- * Adapters implement `write` / `recall` / `delete` plus optional methods
153
- * gated by `capabilities`. `MemoryId` is a branded string prefixed with
154
- * the adapter id so cross-adapter use throws on `extractRawId` (EC-B).
155
- *
156
- * Each provider-specific package (`@theokit-memory-supermemory`, etc)
157
- * exports a factory returning a `Plugin { kind: "memory" }` whose
158
- * `createProvider` resolves to a `MemoryAdapter` instance.
159
- *
160
- * @public
161
- */
162
- /**
163
- * Branded provider memory ID. Format: `${adapterId}:${rawProviderId}`.
164
- * Use `mkMemoryId` / `extractRawId` from `../memory-adapter-helpers.js`
165
- * to construct and unwrap with cross-adapter safety (EC-B).
166
- *
167
- * @public
168
- */
169
- type MemoryId = string & {
170
- readonly __brand: "MemoryId";
171
- };
172
- /**
173
- * Portable identity context. `userId` is the only required field —
174
- * the lowest common denominator across Supermemory / Honcho / Mem0.
175
- * Adapter implementations translate the optional fields to their
176
- * provider's native primitives (Honcho session, Mem0 run_id, etc).
177
- *
178
- * @public
179
- */
180
- interface MemoryContext {
181
- /** End-user identity. */
182
- userId: string;
183
- /** Agent / persona writing the memory. */
184
- agentId?: string;
185
- /** Logical conversation / run boundary. */
186
- sessionId?: string;
187
- /** Tenant / workspace partition. */
188
- tenantId?: string;
189
- /** Free-form tags for filtering / categorization. */
190
- tags?: string[];
191
- /** Provider-passthrough metadata. */
192
- metadata?: Record<string, unknown>;
193
- }
194
- /**
195
- * A single memory fact returned by `recall` or `get`.
196
- *
197
- * @public
198
- */
199
- interface MemoryFact {
200
- id: MemoryId;
201
- content: string;
202
- /** Semantic relevance score (provider-defined scale) when result of `recall`. */
203
- score?: number;
204
- /** ISO 8601 timestamp of creation. */
205
- createdAt?: string;
206
- metadata?: Record<string, unknown>;
207
- }
208
- /**
209
- * Versioned snapshot of a memory's history. Only emitted by providers
210
- * with `capabilities.history === true` (Mem0 today).
211
- *
212
- * @public
213
- */
214
- interface MemoryRevision {
215
- id: MemoryId;
216
- content: string;
217
- version: number;
218
- changedAt: string;
219
- }
220
- /**
221
- * Statically declared adapter feature flags. Consumers feature-detect
222
- * at compile time via `if (adapter.capabilities.history)`.
223
- *
224
- * @public
225
- */
226
- interface MemoryAdapterCapabilities {
227
- /** Returns prior versions of a memory via `history(id)`. */
228
- history: boolean;
229
- /** First-class `sessionId` scoping. */
230
- sessions: boolean;
231
- /** First-class `tenantId` scoping. */
232
- tenancy: boolean;
233
- /** Provider performs reasoning over memory (e.g., Honcho dialectic). */
234
- reasoning: boolean;
235
- /** Exposes LLM-callable function-calling schemas. */
236
- toolSchemas: boolean;
237
- /** Supports background prefetch (currently informational). */
238
- prefetch: boolean;
239
- }
240
- /**
241
- * One assistant-turn message in the canonical `{role, content}` shape
242
- * an adapter may receive instead of a flat string when writing a turn.
243
- *
244
- * @public
245
- */
246
- interface MemoryTurnMessage {
247
- role: "user" | "assistant" | "system";
248
- content: string;
249
- }
250
- /**
251
- * OpenAI-format function-calling schema exposed to the LLM.
252
- *
253
- * @public
254
- */
255
- interface MemoryToolSchema {
256
- name: string;
257
- description: string;
258
- parameters: Record<string, unknown>;
259
- }
260
- /**
261
- * Portable third-party memory adapter contract. Implementations live
262
- * in `@theokit-memory-*` packages; the SDK never imports them.
263
- *
264
- * @public
265
- */
266
- interface MemoryAdapter {
267
- /** Short identifier — matches the `${adapterId}` prefix in `MemoryId`. */
268
- readonly id: string;
269
- readonly capabilities: MemoryAdapterCapabilities;
270
- /** Synchronous availability probe — no network, no I/O. */
271
- isAvailable(): boolean;
272
- /** One-shot initialization. Idempotent: safe to call multiple times. */
273
- initialize?(): Promise<void>;
274
- /**
275
- * Persist a fact or full turn to memory. Returns the stored
276
- * `MemoryId`. Throws `MemoryAdapterError(code: "invalid_input")` on
277
- * empty content or invalid identifiers in `ctx`.
278
- */
279
- write(content: string | MemoryTurnMessage[], ctx: MemoryContext): Promise<MemoryId>;
280
- /**
281
- * Semantic recall — top-`k` facts ordered by relevance. Returns
282
- * empty array when `k === 0` or no matches.
283
- */
284
- recall(query: string, ctx: MemoryContext, k?: number): Promise<MemoryFact[]>;
285
- /**
286
- * Delete a memory by id. Throws `MemoryAdapterError(code:
287
- * "invalid_input")` when the id was minted by a different adapter
288
- * (EC-B). Throws `code: "not_found"` when the id does not exist.
289
- */
290
- delete(id: MemoryId): Promise<void>;
291
- list?(ctx: MemoryContext, opts?: {
292
- cursor?: string;
293
- limit?: number;
294
- }): AsyncIterable<MemoryFact>;
295
- get?(id: MemoryId): Promise<MemoryFact | null>;
296
- history?(id: MemoryId): Promise<MemoryRevision[]>;
297
- /** Empty array when `capabilities.toolSchemas === false`. */
298
- getToolSchemas?(): MemoryToolSchema[];
299
- handleToolCall?(name: string, args: Record<string, unknown>, ctx: MemoryContext): Promise<string>;
300
- /** Graceful shutdown — flush queues, close connections. */
301
- shutdown?(): Promise<void>;
302
- }
303
- /**
304
- * Direct memory API exposed on `SDKAgent.memory`. Resolves to whichever
305
- * memory adapter(s) are registered via `Agent.create({ plugins: [...] })`.
306
- *
307
- * @public
308
- */
309
- interface AgentMemory {
310
- /**
311
- * Persist a fact. Returns the first adapter's id; in multi-adapter
312
- * setups all adapters receive the write (fan-out).
313
- */
314
- write(content: string | MemoryTurnMessage[], ctx?: Partial<MemoryContext>): Promise<MemoryId>;
315
- /** Semantic recall — merged + deduped across registered adapters. */
316
- recall(query: string, ctx?: Partial<MemoryContext>, k?: number): Promise<MemoryFact[]>;
317
- /** Delete a memory by id — routes to the owning adapter via prefix. */
318
- delete(id: MemoryId): Promise<void>;
319
- /** Returns the first registered adapter or `null` when none exists. */
320
- adapter(): MemoryAdapter | null;
321
- }
322
-
323
164
  /**
324
165
  * A discovered skill's metadata. The skill BODY is never included — only the
325
166
  * strict frontmatter fields plus the resolved `source` path.
@@ -453,665 +294,6 @@ interface BudgetTracker {
453
294
  nextIteration?(): void;
454
295
  }
455
296
 
456
- /**
457
- * Context manager backend.
458
- *
459
- * - `"file"` — Read `.theokit/context.json` from the workspace (local) or the
460
- * cloned repo (cloud).
461
- *
462
- * @public
463
- */
464
- type ContextManagerKind = "file";
465
- /**
466
- * Context configuration accepted by `Agent.create()` via {@link AgentOptions.context}.
467
- *
468
- * @public
469
- */
470
- interface ContextSettings {
471
- /** Which backend reads context. Defaults to `"file"`. */
472
- manager?: ContextManagerKind;
473
- /** Hard cap on tokens emitted into the agent's system prompt. */
474
- maxTokens?: number;
475
- /**
476
- * Per-file truncation cap in characters. Default 40_000 (~10k tokens).
477
- * Larger files are truncated with 70%/20% head/tail + marker (ADR D155).
478
- *
479
- * @public
480
- */
481
- maxBytesPerFile?: number;
482
- /**
483
- * Aggregate cap across all context files in characters. Default 120_000.
484
- * When total exceeds this, lower-priority sources are dropped (ADR D155).
485
- *
486
- * Note: context snapshot is **refresh-time** (EC-T); modifying context
487
- * files mid-flight does not auto-update. Call `agent.reload()` to pick
488
- * up changes.
489
- *
490
- * @public
491
- */
492
- maxBytesTotal?: number;
493
- }
494
- /**
495
- * Inclusion state of a single context source in a {@link ContextSnapshot}.
496
- *
497
- * @public
498
- */
499
- type ContextSourceStatus = "included" | "excluded" | "summarized";
500
- /**
501
- * A single context source resolved by the context manager.
502
- *
503
- * @public
504
- */
505
- interface ContextSource {
506
- /** Stable identifier — usually the filename without extension. */
507
- name: string;
508
- /** Path relative to the workspace root, when applicable. */
509
- path?: string;
510
- /** Whether the source was included, dropped, or summarized to fit the budget. */
511
- status: ContextSourceStatus;
512
- /** Free-text reason when `status !== "included"`. */
513
- reason?: string;
514
- }
515
- /**
516
- * Token budget used by the context manager for a single agent.
517
- *
518
- * @public
519
- */
520
- interface ContextBudget {
521
- maxTokens?: number;
522
- /**
523
- * Either a token count or a list of token strings extracted from source
524
- * content. Normalized to `<tokens>` in golden comparisons.
525
- */
526
- usedTokens?: number | string[];
527
- }
528
- /**
529
- * Result of `agent.context.snapshot()`. Public and secret-free by design — safe
530
- * to log and persist. Raw secrets, local absolute paths, and exact token values
531
- * are never present.
532
- *
533
- * @public
534
- */
535
- interface ContextSnapshot {
536
- runtime: "local" | "cloud";
537
- sources: ContextSource[];
538
- budget?: ContextBudget;
539
- }
540
- /**
541
- * Public context manager handle exposed as `agent.context`.
542
- *
543
- * @public
544
- */
545
- interface SDKContextManager {
546
- /** Inspect what the context manager actually loaded for the agent. */
547
- snapshot(): Promise<ContextSnapshot>;
548
- }
549
-
550
- /**
551
- * Fork primitive public type contracts (T1.2, ADRs D110-D114).
552
- *
553
- * Extracted into a leaf type module (arch-review ADR 0001) so the public
554
- * `types/agent.ts` barrel can reference `ForkOptions`/`ForkResult` without
555
- * importing the `internal/runtime/lifecycle/fork-agent.ts` implementation — which in
556
- * turn imports back from `types/agent.ts`. That mutual reference created a
557
- * type-only `madge` cycle. These interfaces are self-contained (no SDKAgent
558
- * / AgentOptions references), so co-locating them here breaks the cycle with
559
- * no runtime change. `fork-agent.ts` re-exports them for back-compat.
560
- */
561
- /**
562
- * Caller-supplied fork configuration. See `forkAgentImpl`.
563
- *
564
- * @public
565
- */
566
- interface ForkOptions {
567
- /**
568
- * Tool subset visible to the fork. Names must match the canonical (post-repair)
569
- * tool name — typically lowercase. Tools not in this set return a `tool_result`
570
- * with `"Tool blocked by fork whitelist"` content (EC-H).
571
- */
572
- allowedTools: Set<string>;
573
- /** Task prompt sent to the fork. */
574
- prompt: string;
575
- /** Override system prompt. Default: byte-identical inheritance from parent (D112). */
576
- systemPrompt?: string;
577
- /** Memory write provenance tag (D114). Default `"fork"`. */
578
- forkOrigin?: string;
579
- }
580
- /**
581
- * Outcome of a fork run.
582
- *
583
- * @public
584
- */
585
- interface ForkResult {
586
- /** Final agent response text (`undefined` when the fork produced no result). */
587
- result: string | undefined;
588
- /** Tool calls executed inside the fork. */
589
- toolCalls: ReadonlyArray<{
590
- name: string;
591
- input: Record<string, unknown>;
592
- }>;
593
- /** Aggregate token usage reported by the run. */
594
- usage: {
595
- inputTokens: number;
596
- outputTokens: number;
597
- };
598
- }
599
-
600
- /**
601
- * M80 — the terminal verdicts a judge can return.
602
- *
603
- * `"blocked"` was added here in this milestone. `GoalResult.status` already carried it, but the
604
- * judge had no way to EMIT it: its vocabulary was `done | continue | skipped`, so facing a real
605
- * blocker it could only say `continue` — and the loop repeated the same turn until it blew the
606
- * budget, reporting `failed` on a limit rather than `blocked` on impossibility. Two different causes
607
- * with the same visible outcome.
608
- *
609
- * @public
610
- */
611
- type Verdict = "done" | "continue" | "skipped" | "blocked";
612
- /**
613
- * M80 — the result of a judge call, now public.
614
- *
615
- * It was `internal/`, so a consumer wanting to type the return — to react to `blocked` without a
616
- * magic string — had to redeclare the shape. It is the same duplication M78 closed for the error
617
- * hierarchy: without a public surface, reimplementing is the only legal way out for anyone behind
618
- * the layer boundary.
619
- *
620
- * @public
621
- */
622
- interface JudgeResult {
623
- verdict: Verdict;
624
- reason: string;
625
- /**
626
- * `true` when the text did not start with one of the canonical prefixes. The verdict becomes
627
- * `"continue"` (fail-safe) so the loop does not stop too early; the caller counts consecutive
628
- * failures and gives up via `maxConsecutiveJudgeFailures`.
629
- */
630
- parseFailed: boolean;
631
- }
632
- /**
633
- * Public event types emitted by {@link SDKAgent.runUntil} (ADRs D115-D117).
634
- *
635
- * Discriminated union by `type` field so consumers can `switch (event.type)`
636
- * with full TypeScript exhaustiveness. Mirrors the
637
- * {@link import("../stream-object.js").StreamObjectEvent} pattern (ADR D39).
638
- *
639
- * @public
640
- */
641
- /**
642
- * Single event emitted while iterating a goal-driven loop. Five variants:
643
- *
644
- * - `turn_start` — the agent is about to invoke `send()`. Emitted once
645
- * per turn.
646
- * - `agent_response` — the agent's `send()` resolved; carries the text
647
- * reply.
648
- * - `judge_verdict` — the auxiliary judge model evaluated the response.
649
- * `parseFailed: true` indicates the judge returned a malformed reply
650
- * (fail-safe verdict = `continue`, see ADR D121).
651
- * - `continuation` — the judge ruled `continue`; carries the prompt that
652
- * was sent on THIS turn (i.e., the input that produced the agent
653
- * response just yielded). Useful for consumers who want to audit the
654
- * exact continuation message that drove each iteration. The prompt
655
- * for the NEXT turn is composed lazily at the start of that turn
656
- * from the latest `agent_response.content`.
657
- * - `status_change` — transition of the overall goal state. Always
658
- * emitted once at start (`active`) and once at end
659
- * (`completed | failed | paused`).
660
- *
661
- * @public
662
- */
663
- type GoalEvent = {
664
- type: "turn_start";
665
- turn: number;
666
- goal: string;
667
- } | {
668
- type: "agent_response";
669
- turn: number;
670
- content: string;
671
- } | {
672
- type: "judge_verdict";
673
- turn: number;
674
- /** M80 — `"blocked"` was added: the judge can declare impossibility, not just "continue". */
675
- verdict: "done" | "continue" | "skipped" | "blocked";
676
- reason: string;
677
- parseFailed: boolean;
678
- } | {
679
- type: "continuation";
680
- turn: number;
681
- prompt: string;
682
- } | {
683
- type: "status_change";
684
- status: "active" | "paused" | "completed" | "failed" | "budget_limited" | "blocked";
685
- reason: string;
686
- };
687
- /**
688
- * Return value of the `runUntil` async generator. Consumer reads via
689
- * `const { value } = await gen.next()` (when `done: true`).
690
- *
691
- * @public
692
- */
693
- interface GoalResult {
694
- status: "completed" | "failed" | "paused" | "budget_limited" | "blocked";
695
- turnsUsed: number;
696
- /** M55 — tokens summed across the loop (0 when `usage` was absent — fail-open). */
697
- tokensUsed: number;
698
- finalResponse: string | undefined;
699
- }
700
- /**
701
- * Return type of {@link import("../internal/local-agent/local-agent.js").LocalAgent.runUntil}.
702
- * Extracted so the LocalAgent method signature stays a single line (G8 LoC budget).
703
- *
704
- * @public
705
- */
706
- type RunUntilIterator = AsyncGenerator<GoalEvent, GoalResult, void>;
707
- /**
708
- * Per-call configuration for `Agent.runUntil`.
709
- *
710
- * @public
711
- */
712
- interface GoalOptions {
713
- /** Hard cap on iterations (safety net against runaway). Default `20`. */
714
- maxTurns?: number;
715
- /**
716
- * M55 — token budget (Codex ext/goal parity, tool.rs:454-465). Sums `run.wait().usage.totalTokens`
717
- * per turn; on crossing it, the loop stops with status `budget_limited`. Omitted => unlimited (only
718
- * maxTurns). A missing `usage` never blows the budget (fail-open).
719
- */
720
- tokenBudget?: number;
721
- /** Bail after N consecutive judge parse failures. Default `3` (ADR D121). */
722
- maxConsecutiveJudgeFailures?: number;
723
- /** Judge model identifier. Default `"openai/gpt-4o-mini"` (ADR D119). */
724
- judgeModel?: string;
725
- /** Override env for the judge auxiliary agent. Default `OPENROUTER_API_KEY` (EC-A). */
726
- judgeApiKey?: string;
727
- /**
728
- * M80 — the model of the DRIVEN agent, the basis for deriving the judge when `judgeModel` is
729
- * omitted.
730
- *
731
- * It exists because the fixed default (`openai/gpt-4o-mini`) only resolves on OpenRouter: an
732
- * Anthropic key gives 404, an OAuth bearer gives 401, and the goal burned 3 turns before failing
733
- * with a misleading reason. A judge running on the chat's own model works wherever chat works.
734
- */
735
- agentModel?: string;
736
- /** Optional subgoals fed to the judge prompt. */
737
- subgoals?: string[];
738
- /**
739
- * Cancel mid-loop via `AbortController.signal`. The generator yields
740
- * a `status_change: paused` event and returns at the next turn
741
- * boundary (ADR D117).
742
- */
743
- signal?: AbortSignal;
744
- }
745
-
746
- /**
747
- * Capability slot a provider can fulfill.
748
- *
749
- * @public
750
- */
751
- type ProviderCapability = "chat" | "web_search" | "image" | "embedding";
752
- /**
753
- * A single user-declared routing rule. Maps a capability to a provider, and
754
- * optionally pins a specific model.
755
- *
756
- * @public
757
- */
758
- interface ProviderRoute {
759
- capability: ProviderCapability;
760
- provider: string;
761
- model?: string;
762
- /**
763
- * Opt-in leaked-dialect safe-parse for this route's provider (theokit#58
764
- * follow-up). When `true`, a `chat_completions` finish that carries ZERO
765
- * native `tool_calls` has its assistant text scanned for the Hermes
766
- * `<function=…></tool_call>` dialect, and any recovered calls are surfaced as
767
- * real `tool_calls` so the loop executes them — for models (qwen3-coder via
768
- * OpenRouter) that intermittently leak tool calls as text. Default `false`;
769
- * fail-open (a partial/unclosed block never fabricates a call). Scoped to the
770
- * resolved chat chain, so a non-leaking route is unaffected.
771
- */
772
- extractToolCallsFromContent?: boolean;
773
- }
774
- /**
775
- * Provider routing configuration accepted by `Agent.create()` via
776
- * {@link AgentOptions.providers}.
777
- *
778
- * @public
779
- */
780
- interface ProviderRoutingSettings {
781
- /** Explicit `{ capability → provider }` map. First match wins per capability. */
782
- routes: ProviderRoute[];
783
- /** Provider names to try in order when a route has no provider available. */
784
- fallback?: string[];
785
- /**
786
- * Multiple API keys per provider for same-provider key rotation
787
- * (credential pool — ADRs D123-D133). When a key hits HTTP 429, 402,
788
- * or 401, the SDK rotates to the next entry transparently before
789
- * falling back to a different provider.
790
- *
791
- * Example:
792
- * ```ts
793
- * apiKeys: { openrouter: ["sk-or-...", "sk-or-..."], anthropic: ["..."] }
794
- * ```
795
- *
796
- * Empty arrays and empty strings are filtered out. If a provider has
797
- * exactly 1 effective key, the pool is transparent (no rotation behavior).
798
- *
799
- * Conflicts with the single-key shape `AgentOptions.apiKey: "..."` —
800
- * use one OR the other, not both.
801
- *
802
- * @public
803
- */
804
- apiKeys?: Record<string, string[]>;
805
- /**
806
- * Rotation strategy per provider for the credential pool. Default is
807
- * `"fill_first"` (use entries[0] until exhausted). Only consulted when
808
- * `apiKeys[provider]` has ≥2 entries.
809
- *
810
- * @public
811
- */
812
- credentialPoolStrategy?: Record<string, "fill_first" | "round_robin" | "least_used" | "random">;
813
- }
814
- /**
815
- * Plugins configuration accepted by `Agent.create()` via
816
- * {@link AgentOptions.plugins}.
817
- *
818
- * @public
819
- */
820
- interface PluginsSettings {
821
- /** Plugin names to enable. Plugin discovery is plugin-provider specific. */
822
- enabled?: string[];
823
- }
824
- /**
825
- * Resolved routing decision returned by `agent.providers.routes()`. Public and
826
- * secret-free by design — safe to log.
827
- *
828
- * @public
829
- */
830
- interface ResolvedProviderRoute {
831
- capability: string;
832
- provider: string;
833
- model?: string;
834
- /** Why the runtime picked this provider (e.g. `"explicit-model-provider"`). */
835
- reason: string;
836
- }
837
- /**
838
- * Public providers manager handle exposed as `agent.providers`.
839
- *
840
- * @public
841
- */
842
- interface SDKProvidersManager {
843
- /** Inspect which provider serves each capability for this agent. */
844
- routes(): Promise<ResolvedProviderRoute[]>;
845
- }
846
- /**
847
- * Provider catalog entry returned by `Theokit.providers.list()`.
848
- *
849
- * @public
850
- */
851
- interface SDKProvider {
852
- name: string;
853
- displayName: string;
854
- capabilities: string[];
855
- isAvailable: boolean;
856
- /** JSON Schema describing the env vars / fields needed to enable this provider. */
857
- setupSchema: object;
858
- }
859
-
860
- /**
861
- * Public skill metadata exposed to the system-prompt resolver. Mirrors the
862
- * shape returned by `agent.skills.list()` — name + description only, never
863
- * full skill bodies.
864
- *
865
- * @public
866
- */
867
- interface SystemPromptSkillRef {
868
- name: string;
869
- description: string;
870
- }
871
- /**
872
- * A skill resolved WITH its body, returned by {@link SDKAgentSkills.get}. Unlike
873
- * {@link SystemPromptSkillRef} (name + description only), this carries the full
874
- * `instructions` — read from the SKILL.md for filesystem skills or the inline
875
- * `createSkill` body. @public
876
- */
877
- interface SDKAgentSkillDetail {
878
- name: string;
879
- description: string;
880
- instructions: string;
881
- /** SE21 — supporting documents bundled with the skill (filename → content), when present. */
882
- references?: Record<string, string>;
883
- }
884
- interface SDKAgentSkills {
885
- list(): Promise<ReadonlyArray<SystemPromptSkillRef>>;
886
- /**
887
- * SE20 — resolve a skill by name INCLUDING its body (`instructions`). Returns
888
- * `undefined` when no enabled skill matches. `list()` stays lean (name +
889
- * description); full bodies come only through `get`.
890
- */
891
- get(name: string): Promise<SDKAgentSkillDetail | undefined>;
892
- }
893
- /**
894
- * Public plugin metadata returned by `agent.plugins.list()`. Mirrors the
895
- * `.theokit/plugins/<name>/MANIFEST.json` allow-listed shape; never exposes
896
- * raw plugin bodies, credentials, or internal hooks.
897
- *
898
- * @public
899
- */
900
- interface SDKPluginMetadata {
901
- name: string;
902
- description?: string;
903
- }
904
- /**
905
- * Public plugin listing handle exposed as `agent.plugins`. Populated when
906
- * `settingSources` includes `"plugins"` OR when `plugins.enabled` is set
907
- * on the agent options.
908
- *
909
- * @public
910
- */
911
- interface SDKAgentPlugins {
912
- list(): Promise<ReadonlyArray<SDKPluginMetadata>>;
913
- }
914
- /**
915
- * Artifact produced inside an agent's workspace. Cloud-only.
916
- *
917
- * @public
918
- */
919
- interface SDKArtifact {
920
- path: string;
921
- sizeBytes: number;
922
- updatedAt: string;
923
- }
924
- /**
925
- * Handle returned by `Agent.create()` and `Agent.resume()`.
926
- *
927
- * @public
928
- */
929
- interface SDKAgent {
930
- readonly agentId: string;
931
- readonly model: ModelSelection | undefined;
932
- /**
933
- * Context manager for this agent. Populated when context is enabled via
934
- * {@link AgentOptions.context}. See {@link SDKContextManager}.
935
- */
936
- readonly context?: SDKContextManager;
937
- /**
938
- * Provider routing inspector for this agent. Populated when at least one
939
- * provider route is configured (via {@link AgentOptions.providers}, plugins,
940
- * or model-implied providers). See {@link SDKProvidersManager}.
941
- */
942
- readonly providers?: SDKProvidersManager;
943
- /**
944
- * Skill listing for this agent. Populated when project-scoped skills are
945
- * enabled (`settingSources: ["project"]`) or when `skills.enabled` is set.
946
- * See {@link SDKAgentSkills}.
947
- */
948
- readonly skills?: SDKAgentSkills;
949
- /**
950
- * Plugin listing for this agent. Populated when project-scoped plugins are
951
- * enabled (`settingSources: ["plugins"]`) or when `plugins.enabled` is set.
952
- * See {@link SDKAgentPlugins}.
953
- */
954
- readonly plugins?: SDKAgentPlugins;
955
- send(message: string | SDKUserMessage, options?: SendOptions): Promise<Run>;
956
- /**
957
- * SE9 — integrated structured output. Runs the normal tool loop (the tools run
958
- * first) then coerces the final answer into the `output` Zod schema, returning a
959
- * validated, inferred-typed object. Sugar over `Agent.generateObject` (ADR D33).
960
- */
961
- generate<T extends zod.ZodType>(message: string | SDKUserMessage, options: GenerateOptions<T>): Promise<GenerateRunResult<zod.z.infer<T>>>;
962
- /** Fire-and-forget disposal. */
963
- close(): void;
964
- /** Re-read filesystem config (context, hooks, project MCP, subagents) without disposing. */
965
- reload(): Promise<void>;
966
- /**
967
- * Async disposal. Idempotent — calling more than once is a no-op (per ADR D5).
968
- * Prefer `await using agent = await Agent.create(...)` over explicit
969
- * `dispose()` for resource safety.
970
- */
971
- dispose(): Promise<void>;
972
- /**
973
- * `await using` support per ADR D5. Identical semantics to `dispose()` —
974
- * idempotent across both surfaces.
975
- */
976
- [Symbol.asyncDispose](): Promise<void>;
977
- /** Cloud-only. Local returns an empty array. */
978
- listArtifacts(): Promise<SDKArtifact[]>;
979
- /** Cloud-only. Local throws `UnsupportedRunOperationError`. */
980
- downloadArtifact(path: string): Promise<Buffer>;
981
- /**
982
- * Signal that prompt cache should be invalidated. By default deferred —
983
- * applied at the start of the next `send()`. Pass `{ applyNow: true }` to
984
- * force immediate disposal (caller must `Agent.create()` again to use).
985
- *
986
- * Cache invalidation is a cost regression (provider charges full price
987
- * for the rebuilt cache; see ADRs D94-D95). Use sparingly and deliberately.
988
- *
989
- * Cloud agents: no-op (cloud runtime reconstructs state per request).
990
- *
991
- * @public
992
- */
993
- invalidateCache?(reason: string, options?: InvalidateCacheOptions): Promise<void>;
994
- /**
995
- * Goal-driven Ralph loop (ADRs D115-D121). Iterates `agent.send` →
996
- * judge → continuation until the auxiliary judge model returns `done`,
997
- * the judge fails too many times in a row, max turns are exhausted,
998
- * or the caller aborts via `AbortSignal`.
999
- *
1000
- * Yields {@link import("./goal-events.js").GoalEvent} per state
1001
- * transition; returns a {@link import("./goal-events.js").GoalResult}
1002
- * summary as the generator's final value.
1003
- *
1004
- * Cloud agents throw {@link import("../errors.js").UnsupportedRunOperationError}
1005
- * **synchronously** (no AsyncGenerator returned) — wrap in try/catch
1006
- * if you support both runtimes.
1007
- *
1008
- * Caveat: do not call `agent.dispose()` mid-iteration; the next `send`
1009
- * propagates the disposal error through the generator to the consumer.
1010
- *
1011
- * @public
1012
- */
1013
- runUntil?(goal?: string, options?: GoalOptions): RunUntilIterator;
1014
- /**
1015
- * Fork a short-lived sub-agent with parent's credentials + system
1016
- * prompt byte-identical (ADR D112 — cache hit) and a restricted tool
1017
- * whitelist (ADR D111 — AsyncLocalStorage isolation).
1018
- *
1019
- * Cloud agents throw {@link import("../errors.js").UnsupportedRunOperationError}.
1020
- *
1021
- * @public
1022
- */
1023
- fork?(options: ForkOptions): Promise<ForkResult>;
1024
- /**
1025
- * Drive `send` to completion across iteration-ceiling truncations (M1 Phase 3).
1026
- * When a `send` stops at the loop's iteration cap (`RunResult.stoppedAtIterationLimit`),
1027
- * this re-sends a short continuation prompt — the agent's stateful session
1028
- * preserves the conversation — until a genuine terminal: `done` (finished),
1029
- * `step_limit` (`maxRounds` exhausted), or `no_progress` (two empty rounds).
1030
- *
1031
- * Local agents only. Cloud agents throw
1032
- * {@link import("../errors.js").UnsupportedRunOperationError} (the cloud
1033
- * runtime manages its own continuation policy server-side).
1034
- *
1035
- * @public
1036
- */
1037
- runToCompletion?(message: string, options?: RunToCompletionOptions): Promise<RunToCompletionResult>;
1038
- /**
1039
- * STREAMING continuation driver (V3-4) — the streaming twin of
1040
- * {@link SDKAgent.runToCompletion}. Returns an `AsyncGenerator` that yields each
1041
- * round's {@link import("./messages.js").SDKMessage}s LIVE (for a UI), reusing the
1042
- * same terminal policy (`done`/`step_limit`/`no_progress` + bounded re-prompt).
1043
- *
1044
- * The {@link import("./run.js").StreamToCompletionResult} is the generator's RETURN
1045
- * value — read it via a manual `gen.next()` loop (`while (!res.done) res = await
1046
- * gen.next()` → `res.value`); a plain `for await...of` consumes the yielded
1047
- * messages but discards the return value.
1048
- *
1049
- * Local agents only. Cloud agents throw
1050
- * {@link import("../errors.js").UnsupportedRunOperationError}.
1051
- *
1052
- * @public
1053
- */
1054
- streamToCompletion?(message: string, options?: RunToCompletionOptions): AsyncGenerator<SDKMessage, StreamToCompletionResult>;
1055
- /**
1056
- * Direct API to third-party memory adapter(s) registered via
1057
- * `plugins: [...]` (ADR D141 / D142). Returns `null` when no adapter
1058
- * is registered. In multi-adapter setups `write` fans out to all;
1059
- * `recall` merges + dedupes; `delete` routes by `MemoryId` prefix.
1060
- *
1061
- * @public
1062
- */
1063
- memory?: AgentMemory;
1064
- /**
1065
- * Activate a personality preset for the next `send` (Hermes #26).
1066
- * Reserved names `"none"`, `"default"`, and `"neutral"` clear the
1067
- * active preset. Returns the resolved preset (or `null` when cleared).
1068
- *
1069
- * Persistence: pass `{ save: true }` to persist across process
1070
- * restarts (stored under `$THEOKIT_HOME/personality.json`).
1071
- *
1072
- * History: by default the conversation history is preserved across
1073
- * the switch. Pass `{ reset: true }` to also clear the session.
1074
- *
1075
- * Cloud agents throw {@link import("../errors.js").UnsupportedRunOperationError}.
1076
- *
1077
- * @public
1078
- */
1079
- usePersonality?(name: string, opts?: {
1080
- save?: boolean;
1081
- reset?: boolean;
1082
- }): Promise<PersonalityPreset | null>;
1083
- }
1084
- /**
1085
- * Resolved personality preset surfaced via {@link SDKAgent.usePersonality}
1086
- * (Hermes #26, ADRs D160-D169). Re-declared here so the public DTS bundle
1087
- * never crosses the `internal/` path boundary. The implementation type in
1088
- * `internal/personality/types.ts` is structurally identical.
1089
- *
1090
- * @public
1091
- */
1092
- interface PersonalityPreset {
1093
- readonly name: string;
1094
- readonly description: string | undefined;
1095
- readonly tools: ReadonlyArray<string> | undefined;
1096
- readonly model: string | undefined;
1097
- readonly tags: ReadonlyArray<string> | undefined;
1098
- readonly systemPrompt: string;
1099
- readonly source: "project" | "user";
1100
- readonly sourcePath: string;
1101
- }
1102
- /**
1103
- * Options for {@link SDKAgent.invalidateCache}.
1104
- *
1105
- * @public
1106
- */
1107
- interface InvalidateCacheOptions {
1108
- /**
1109
- * When `true`, dispose the agent immediately so caller must recreate it
1110
- * to continue. Default `false` (deferred — applied on next `send()`).
1111
- */
1112
- applyNow?: boolean;
1113
- }
1114
-
1115
297
  /**
1116
298
  * `MemoryProvider` — kernel-facing port for the memory subsystem
1117
299
  * (SDK 2.0 Phase 1 / T1.1 — Hexagonal Architecture / Ports & Adapters,
@@ -1299,8 +481,8 @@ interface ProviderTransformContext {
1299
481
  * M41 — the one OPTIONAL behavior seam on a provider profile. It lets a provider own its per-request auth:
1300
482
  * `fetch` is the universal seam (a provider that returns its own fetch fully controls headers + refresh, for
1301
483
  * every transport that accepts a fetch); `headers` is a convenience merged over `extraHeaders` on transports
1302
- * that carry them (responses_api). This is the CONTRACT-shape adaptation of OpenCode's provider `auth.loader`
1303
- * (MIT © 2025 opencode — `packages/core/src/plugin/provider/*.ts`), retargeted to theokit's transport model.
484
+ * that carry them (responses_api). A provider owns its per-request auth material plus transparent token
485
+ * refresh, expressed against theokit's transport model.
1304
486
  * Closes the gap where a `ProviderProfile` could only declare STATIC headers.
1305
487
  *
1306
488
  * @public
@@ -1316,6 +498,25 @@ interface ProviderTransform {
1316
498
  /** A fetch to use for this provider's requests (refresh-aware / fully provider-controlled). */
1317
499
  fetch?(ctx: ProviderTransformContext): typeof fetch;
1318
500
  }
501
+ /**
502
+ * A data-only declaration of an LLM provider: its name, HTTP dialect, auth style, base URL and
503
+ * fallback models. There is nothing to implement — the router selects the transport from `apiMode` —
504
+ * so any OpenAI- or Anthropic-compatible endpoint (Groq, Together, Fireworks, a private gateway)
505
+ * becomes a provider without new code.
506
+ *
507
+ * A profile does nothing by itself. Wrap it with `Provider.create(profile)` and pass the resulting
508
+ * plugin to `Agent.create({ plugins: [...] })`; from there you route to it with the `provider/model`
509
+ * id prefix or through `providers.routes`.
510
+ *
511
+ * `name` is the routing prefix and `aliases` adds alternatives to it. `envVars` lists the environment
512
+ * variables that may supply the credential, and `authType` says what kind of credential that is.
513
+ *
514
+ * Reach for `transform` only when static data genuinely is not enough — a provider that computes
515
+ * headers per request or refreshes its own token. Leaving it absent keeps the profile on the pure
516
+ * data path. If you do supply `headers`, note that they are spread AFTER the transport's own
517
+ * `authorization` and `content-type`, so returning either key replaces the base header rather than
518
+ * adding to it.
519
+ */
1319
520
  interface ProviderProfile {
1320
521
  name: string;
1321
522
  apiMode: ApiMode;
@@ -1352,7 +553,43 @@ interface ProviderProfile {
1352
553
  extractToolCallsFromContent?: boolean;
1353
554
  }
1354
555
 
556
+ /**
557
+ * The fixed set of points a `"general"` plugin may attach to through `PluginContext.on`. A closed
558
+ * enum rather than an open string, so a plugin cannot register for a hook the loop never fires.
559
+ *
560
+ * What separates them is what the SDK does with the handler's return value, and that is the thing to
561
+ * settle before writing one:
562
+ *
563
+ * - `pre_tool_call` is the only VETO point. Return `{ block: true, message }` to stop the call; the
564
+ * first handler that blocks wins and the remaining handlers are not consulted.
565
+ * - `transform_tool_result` and `transform_llm_output` are CHAINED. Each handler receives what the
566
+ * previous one returned; `undefined` keeps the current value and anything else — `null` included —
567
+ * replaces it.
568
+ * - `pre_user_send` returns `{ recalledContext }`, which the loop concatenates across handlers and
569
+ * injects ahead of the user prompt.
570
+ * - Everything else (`post_tool_call`, `pre_llm_call`, `post_llm_call`, `on_session_start`,
571
+ * `on_session_end`, `post_assistant_reply`) is fire-and-forget: the return value is DISCARDED. A
572
+ * policy that needs to change a tool result belongs on `transform_tool_result` — put it on
573
+ * `post_tool_call` and it quietly degrades to observation.
574
+ *
575
+ * Failure is asymmetric too. A fire-and-forget or transform handler that throws is caught, logged to
576
+ * stderr, and the run continues. A `pre_tool_call` handler that throws is NOT caught by the hook
577
+ * dispatcher, so its exception escapes into the tool-dispatch path — a permission-style handler
578
+ * should resolve its own errors to an explicit block rather than relying on that.
579
+ */
1355
580
  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";
581
+ /**
582
+ * What a `pre_tool_call` handler is given: the tool about to run, the arguments the model produced
583
+ * for it, and the identity of the run asking.
584
+ *
585
+ * `args` came from the model, not from a validated caller. A handler that gates on argument values
586
+ * must treat every field as untrusted and survive one that is missing or of the wrong type.
587
+ *
588
+ * `permissionMode` is the run's resolved mode — `SendOptions.permissionMode` falling back to
589
+ * `AgentOptions.permissionMode` — threaded here so a permission-style plugin can gate per run rather
590
+ * than at construction time. Absent means neither was set, and the plugin's own default applies;
591
+ * plugins that are not about permissions ignore it.
592
+ */
1356
593
  interface PreToolCallContext {
1357
594
  name: string;
1358
595
  args: Record<string, unknown>;
@@ -1366,6 +603,19 @@ interface PreToolCallContext {
1366
603
  */
1367
604
  permissionMode?: PermissionMode;
1368
605
  }
606
+ /**
607
+ * The veto a `pre_tool_call` handler returns to stop a tool call. Returning `undefined` allows it —
608
+ * there is no approval value, and `block` is the literal `true`, so `{ block: false }` is not
609
+ * expressible and cannot be used to force a call through.
610
+ *
611
+ * The first blocking handler decides; later `pre_tool_call` handlers never run.
612
+ *
613
+ * `message` is not a log line. The loop turns the veto into a `tool_result` reading "Plugin blocked
614
+ * this tool call: <message>", deliberately NOT flagged as an error, so the model reads it and can
615
+ * choose another route instead of the run failing. Write it for the model: say what was refused and
616
+ * what it might do instead. It also reaches observability — as the `stderr` of a tool-completed event
617
+ * with exit code 126, and as the message on a `permission_denied` run event.
618
+ */
1369
619
  interface PreToolCallDecision {
1370
620
  block: true;
1371
621
  message: string;
@@ -1460,6 +710,18 @@ interface PostAssistantReplyContext {
1460
710
  reply: string;
1461
711
  agentId: string;
1462
712
  runId: string;
713
+ /**
714
+ * `true` when the run that produced `reply` called at least one tool (#358).
715
+ *
716
+ * A reply produced by a tool call is not safely replayable: re-serving the text hands a later
717
+ * caller the RESULT of a `write_file` / HTTP POST / payment without the side effect having
718
+ * happened. A semantic cache must skip storing such a reply, and before this field existed it
719
+ * had nothing to key on and assumed `false`.
720
+ *
721
+ * Derived from the run's replayed event stream, so it counts tool calls the run actually made,
722
+ * not tools the agent merely has.
723
+ */
724
+ usedTools: boolean;
1463
725
  memoryContext?: MemoryContext;
1464
726
  }
1465
727
  type HookHandler = (ctx: unknown) => unknown | Promise<unknown>;
@@ -1467,6 +729,21 @@ type CommandHandler = (args: Record<string, unknown>) => Promise<string> | strin
1467
729
  interface CommandOptions {
1468
730
  description?: string;
1469
731
  }
732
+ /**
733
+ * The registration surface passed to a `"general"` plugin's `register(ctx)`, and the plugin's only
734
+ * route into the agent. Outside production it is a sealed Proxy that throws when a plugin assigns a
735
+ * property of its own, so smuggling state onto the context fails loudly in development.
736
+ *
737
+ * `register` runs ONCE, when the plugin is registered — never per run. Anything the plugin wants to
738
+ * do during a turn has to be attached here as a hook; there is no later entry point. Each plugin gets
739
+ * its own context, so registrations stay attributable to the plugin that made them.
740
+ *
741
+ * Two things worth knowing before writing one. Commands registered here are consumed by CLI and bot
742
+ * wrappers only — the agent loop never dispatches them, so a plugin that ships nothing but commands
743
+ * has no effect on a programmatic run. And `on` drops a handler that is not a function, with a
744
+ * warning on stderr rather than an error at registration: the gentler failure, and the easier one to
745
+ * miss.
746
+ */
1470
747
  interface PluginContext {
1471
748
  /** Register a custom tool. Equivalent to passing in `AgentOptions.tools`. */
1472
749
  registerTool(tool: CustomTool): void;
@@ -1481,6 +758,30 @@ interface BasePlugin {
1481
758
  name: string;
1482
759
  version: string;
1483
760
  }
761
+ /**
762
+ * Memory provider factory shape (ADR D141). Returns a `MemoryAdapter`
763
+ * (sync) or a Promise resolving to one (lazy HTTP probe / config load).
764
+ *
765
+ * Adapters live in `@theokit-memory-*` packages; the SDK never imports
766
+ * them. Factory rejection is caught by the plugin manager and surfaced
767
+ * as `ConfigurationError(code: "plugin_factory_failed")` (EC-F) — never
768
+ * an unhandled rejection.
769
+ *
770
+ * PUBLIC, deliberately (#335). This type is the shape a consumer must satisfy
771
+ * to write a memory plugin: it is named by the PUBLIC `Plugin` union below, in
772
+ * the `createProvider` position. It used to carry the internal-visibility JSDoc
773
+ * tag, which made `stripInternal` delete the declaration while the union went
774
+ * on referencing it — so the published `.d.ts` named a type it did not declare.
775
+ * Invisible under `skipLibCheck`, and an `error`-typed graph for any consumer
776
+ * running type-aware lint. A type reachable from a public signature is public
777
+ * whatever the tag says; the tag was the thing that was wrong.
778
+ *
779
+ * Do NOT write that tag's literal spelling anywhere in this comment. It is
780
+ * matched as text, so a JSDoc block that merely MENTIONS it is stripped exactly
781
+ * as if it had declared it — which is how the first attempt at this fix failed,
782
+ * with a build error naming a symbol whose own explanation had re-hidden it.
783
+ */
784
+ type MemoryProviderFactory = (cwd: string) => MemoryAdapter | Promise<MemoryAdapter>;
1484
785
  type Plugin = (BasePlugin & {
1485
786
  kind: "general";
1486
787
  register: (ctx: PluginContext) => void | Promise<void>;
@@ -1501,18 +802,54 @@ type SettingSource = "project" | "user" | "team" | "mdm" | "plugins" | "all";
1501
802
  /**
1502
803
  * Local agent configuration.
1503
804
  *
805
+ * TWO THINGS A LOCAL AGENT DOES BY DEFAULT, both reported as surprises (#338):
806
+ *
807
+ * 1. **A `shell` tool is always registered**, including when you pass `tools: []`. Every local
808
+ * agent can therefore read any file reachable from {@link LocalOptions.cwd}. One report describes
809
+ * an evaluation invalidated this way: the working directory held the benchmark's answer key, and
810
+ * two transcripts show the model citing it. Deny it explicitly if that matters —
811
+ * `{ tool: "shell", action: "deny" }` on a {@link PermissionEngine} rule is terminal under every
812
+ * permission mode, including `bypass`. Note the tool still appears in the advertised catalog, so
813
+ * the model may attempt it and be refused, rather than never seeing it.
814
+ *
815
+ * 2. **Finished runs write a transcript to disk**, at `.theokit/memory/sessions/<runId>.md` under
816
+ * the workspace `cwd`, with the full prompt and reply. This happens with no `memory` config and
817
+ * with `settingSources: []` — it is what `memory_search({ corpus: "sessions" })` reads. It is not
818
+ * currently opt-out. If the workspace is a git repository, add `.theokit/` to `.gitignore`: one
819
+ * report describes a transcript reaching a public repo before it was noticed.
820
+ *
1504
821
  * @public
1505
822
  */
1506
823
  interface LocalOptions {
824
+ /**
825
+ * Workspace root(s). Also the reach of the always-present `shell` tool — see the note on
826
+ * {@link LocalOptions}, and the transcript written under `.theokit/memory/sessions/` here.
827
+ */
1507
828
  cwd?: string | string[];
1508
829
  settingSources?: SettingSource[];
1509
830
  sandboxOptions?: {
1510
831
  enabled: boolean;
1511
832
  };
1512
833
  /**
1513
- * SE40 — base directory for the native Claude-shaped session transcript
1514
- * (`<baseDir>/projects/<encoded-cwd>/<agentId>.jsonl`). Default `~/.theokit`.
834
+ * Directory for the native Claude-shaped session transcript
835
+ * (`<sessionDir>/projects/<encoded-cwd>/<agentId>.jsonl`). Default `~/.theokit`.
1515
836
  * Set to `~/.claude` to write sessions the Claude Code CLI can `--continue`.
837
+ *
838
+ * **This is not the working directory** — that is {@link LocalOptions.cwd},
839
+ * four lines above. Only transcripts are written here.
840
+ *
841
+ * Introduced in #301 as the unambiguous name for what `baseDir` always meant.
842
+ */
843
+ sessionDir?: string;
844
+ /**
845
+ * @deprecated Renamed to {@link LocalOptions.sessionDir} (#301). Still honoured,
846
+ * and `sessionDir` wins when both are set.
847
+ *
848
+ * "Base directory" reads as the directory the agent works in, sitting in an
849
+ * interface whose `cwd` is the one that actually means that. Setting it to
850
+ * `"./"` — which is what the name invites — runs without error and writes
851
+ * `./projects/<encoded-cwd>/<agentId>.jsonl` into the caller's repository root.
852
+ * Nothing warns, because nothing is wrong from the code's point of view.
1516
853
  */
1517
854
  baseDir?: string;
1518
855
  /**
@@ -1749,8 +1086,11 @@ interface MemorySettings {
1749
1086
  * to add prompt/response/args events to the spans (consumer's
1750
1087
  * responsibility to sanitize PII).
1751
1088
  *
1752
- * `@opentelemetry/api` is an OPTIONAL peer dependency. Without it
1753
- * installed, telemetry is a no-op even when `enabled: true`.
1089
+ * `@opentelemetry/api` is an OPTIONAL peer dependency declared, so your package manager can
1090
+ * tell you the version range, and not installed for you. Without it, telemetry is a NO-OP even
1091
+ * when `enabled: true`: the tracer is loaded lazily inside a try/catch, so nothing throws and
1092
+ * nothing is recorded. A run that reports no spans with `enabled: true` is almost always this,
1093
+ * not a misconfigured collector.
1754
1094
  *
1755
1095
  * @public
1756
1096
  */
@@ -1820,10 +1160,7 @@ interface AgentOptions {
1820
1160
  *
1821
1161
  * `'run'` (DEFAULT, and the historical behaviour) spawns a client per `send` and drops it when the
1822
1162
  * run ends. `'session'` pools clients per `(agentId, server, config)` and keeps them across turns,
1823
- * which is what the reference does Codex holds its MCP runtime in `SessionServices`
1824
- * (`codex-rs/core/src/state/service.rs:51-58`; theokit#155 corrected the earlier
1825
- * `core/src/state/service.rs:116`, which named a parameter of `install_mcp_runtime`, not the
1826
- * owning field). Measured cost of the per-run path: 193 / 138 / 134 ms of spawn + handshake on
1163
+ * which keeps the MCP runtime alive across turns. Measured cost of the per-run path: 193 / 138 / 134 ms of spawn + handshake on
1827
1164
  * every turn.
1828
1165
  *
1829
1166
  * Opt-in rather than default because it changes the FAILURE model: a server that dies mid-session
@@ -2158,6 +1495,12 @@ interface AgentDescription {
2158
1495
  /**
2159
1496
  * Options for `Agent.list()`.
2160
1497
  *
1498
+ * `limit`/`cursor` paginate (B-115): a `limit` bounds the page and, when more agents remain,
1499
+ * `ListResult.nextCursor` is set — pass it back as `cursor` for the next page. Omitting `limit`
1500
+ * returns every matching agent in one page, unpaginated, exactly as before (M107 declared imposing
1501
+ * pagination order unconditionally a breaking change to every caller's observed order; pagination
1502
+ * here is opt-in and only reorders the page it returns, never the unlimited default).
1503
+ *
2161
1504
  * @public
2162
1505
  */
2163
1506
  type ListAgentsOptions = {
@@ -2170,13 +1513,19 @@ type ListAgentsOptions = {
2170
1513
  cwd?: string;
2171
1514
  } | {
2172
1515
  runtime: "cloud";
2173
- prUrl?: string;
1516
+ /**
1517
+ * Hide archived agents unless `true`. Default `false` (hidden) — B-115, this used to be
1518
+ * accepted and silently ignored; every archived agent was always included.
1519
+ */
2174
1520
  includeArchived?: boolean;
2175
1521
  apiKey?: string;
2176
1522
  });
2177
1523
  /**
2178
1524
  * Options for `Agent.get()`.
2179
1525
  *
1526
+ * `cwd` (default `process.cwd()`) selects which workspace's on-disk registry to hydrate before the
1527
+ * lookup — same rule `Agent.list` uses (B-115; this used to be accepted and silently ignored).
1528
+ *
2180
1529
  * @public
2181
1530
  */
2182
1531
  interface GetAgentOptions {
@@ -2186,18 +1535,22 @@ interface GetAgentOptions {
2186
1535
  /**
2187
1536
  * Options for `Agent.listRuns()`.
2188
1537
  *
1538
+ * `cwd` (default `process.cwd()`) hydrates that workspace's registry before validating the agent
1539
+ * exists — same rule as `Agent.get` (B-115). `limit`/`cursor` paginate the SAME way as
1540
+ * `Agent.list` — see its doc — except no reordering is ever needed: a single agent's runs are
1541
+ * already returned in the stable order they were created.
1542
+ *
1543
+ * B-115 — `runtime` removed 2026-08-19. A single `agentId` already pins exactly one runtime;
1544
+ * filtering an already-single-agent's runs by runtime filtered nothing and was never checked.
1545
+ *
2189
1546
  * @public
2190
1547
  */
2191
- type ListRunsOptions = {
2192
- limit?: number;
2193
- cursor?: string;
2194
- } & ({
2195
- runtime?: "local";
1548
+ interface ListRunsOptions {
2196
1549
  cwd?: string;
2197
- } | {
2198
- runtime: "cloud";
2199
1550
  apiKey?: string;
2200
- });
1551
+ limit?: number;
1552
+ cursor?: string;
1553
+ }
2201
1554
  /**
2202
1555
  * Options for `Agent.getRun()`. Cloud requires the parent `agentId`.
2203
1556
  *
@@ -2230,4 +1583,4 @@ interface ListResult<T> {
2230
1583
  nextCursor?: string;
2231
1584
  }
2232
1585
 
2233
- export { type MemoryProviderHandle as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type BudgetCheck as D, type BudgetTotal as E, type BudgetUsageEvent as F, type GetAgentOptions as G, type CloudEnv as H, type InlineSkill as I, type JudgeResult as J, type CloudRepo as K, type LocalOptions as L, type MemorySettings as M, type ContextBudget as N, type ContextManagerKind as O, type ProviderRoutingSettings as P, type ContextSnapshot as Q, type ContextSource as R, type SystemPromptResolver as S, type ContextSourceStatus as T, type CreateSkillSpec as U, type HookName as V, type InvalidateCacheOptions as W, type MemoryAdapter as X, type MemoryAdapterCapabilities as Y, type MemoryContext as Z, type MemoryFact as _, type AgentDefinition as a, type MemoryProviderInitOptions as a0, type MemoryRevision as a1, type MemoryToolSchema as a2, type MemoryTurnMessage as a3, type PersonalityPreset as a4, type PluginContext as a5, type PostAssistantReplyContext as a6, type PostToolCallContext as a7, type PreToolCallContext as a8, type PreUserSendContext as a9, type ToolCallSummary as aA, type ToolResultTransformContext as aB, type TransformContext as aC, type Verdict as aD, type PreUserSendResult as aa, type ProviderCapability as ab, type ProviderRoute as ac, type ProviderTransform as ad, type ProviderTransformContext as ae, type RecordSessionSummaryArgs as af, type ResolvedProviderRoute as ag, type RunUntilIterator as ah, type SDKAgentPlugins as ai, type SDKAgentSkillDetail as aj, type SDKAgentSkills as ak, type SDKArtifact as al, type SDKContextManager as am, type SDKPluginMetadata as an, type SDKProvidersManager as ao, type SessionLifecycleContext as ap, type SessionRecord as aq, type SessionStore as ar, type SettingSource as as, Skill as at, type SkillsResolver as au, type SkillsResolverContext as av, type SystemPromptContext as aw, type SystemPromptMemoryFact as ax, type SystemPromptSkillRef as ay, type TelemetrySettings as az, type ContextSettings as b, type PluginsSettings as c, type SkillsSettings as d, type SDKAgent as e, type ListAgentsOptions as f, type ListResult as g, type SDKAgentInfo as h, type ListRunsOptions as i, type GetRunOptions as j, type AgentOperationOptions as k, type AgentDescription as l, type Plugin as m, type ProviderProfile as n, type GoalOptions as o, type GoalEvent as p, type GoalResult as q, type MemoryProvider as r, type MemoryId as s, type PreToolCallDecision as t, type SDKProvider as u, type ActiveMemoryPassArgs as v, type ActiveMemoryPassResult as w, type AgentMemory as x, type AgentSubagentDescription as y, type AgentToolDescription as z };
1586
+ export { type TelemetrySettings as $, type AgentOptions as A, type BudgetTracker as B, type CloudOptions as C, type PostAssistantReplyContext as D, type PostToolCallContext as E, type PreToolCallContext as F, type GetAgentOptions as G, type HookName as H, type InlineSkill as I, type PreUserSendContext as J, type PreUserSendResult as K, type LocalOptions as L, type MemorySettings as M, type ProviderTransform as N, type ProviderTransformContext as O, type Plugin as P, type SessionLifecycleContext as Q, type RecordSessionSummaryArgs as R, type SystemPromptResolver as S, type SessionRecord as T, type SessionStore as U, type SettingSource as V, Skill as W, type SkillsResolver as X, type SkillsResolverContext as Y, type SystemPromptContext as Z, type SystemPromptMemoryFact as _, type AgentDefinition as a, type ToolCallSummary as a0, type ToolResultTransformContext as a1, type TransformContext as a2, 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 CloudEnv as t, type CloudRepo as u, type CreateSkillSpec as v, type MemoryProviderFactory as w, type MemoryProviderHandle as x, type MemoryProviderInitOptions as y, type PluginContext as z };