@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
package/dist/index.d.ts CHANGED
@@ -1,13 +1,16 @@
1
- import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-CHllybaU.js';
2
- export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-CHllybaU.js';
3
- import { A as AgentOptions, L as LocalOptions, P as ProviderRoutingSettings, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as ContextSettings, c as PluginsSettings, d as SkillsSettings, e as SDKAgent, f as ListAgentsOptions, g as ListResult, h as SDKAgentInfo, G as GetAgentOptions, i as ListRunsOptions, j as GetRunOptions, k as AgentOperationOptions, l as AgentDescription, m as Plugin$1, n as ProviderProfile, I as InlineSkill, J as JudgeResult, o as GoalOptions, p as GoalEvent, q as GoalResult, B as BudgetTracker, r as MemoryProvider, s as MemoryId, t as PreToolCallDecision, u as SDKProvider } from './agent-BiCINq25.js';
4
- export { v as ActiveMemoryPassArgs, w as ActiveMemoryPassResult, x as AgentMemory, y as AgentSubagentDescription, z as AgentToolDescription, D as BudgetCheck, E as BudgetTotal, F as BudgetUsageEvent, H as CloudEnv, K as CloudRepo, N as ContextBudget, O as ContextManagerKind, Q as ContextSnapshot, R as ContextSource, T as ContextSourceStatus, U as CreateSkillSpec, V as HookName, W as InvalidateCacheOptions, X as MemoryAdapter, Y as MemoryAdapterCapabilities, Z as MemoryContext, _ as MemoryFact, $ as MemoryProviderHandle, a0 as MemoryProviderInitOptions, a1 as MemoryRevision, a2 as MemoryToolSchema, a3 as MemoryTurnMessage, a4 as PersonalityPreset, a5 as PluginContext, a6 as PostAssistantReplyContext, a7 as PostToolCallContext, a8 as PreToolCallContext, a9 as PreUserSendContext, aa as PreUserSendResult, ab as ProviderCapability, ac as ProviderRoute, ad as ProviderTransform, ae as ProviderTransformContext, af as RecordSessionSummaryArgs, ag as ResolvedProviderRoute, ah as RunUntilIterator, ai as SDKAgentPlugins, aj as SDKAgentSkillDetail, ak as SDKAgentSkills, al as SDKArtifact, am as SDKContextManager, an as SDKPluginMetadata, ao as SDKProvidersManager, ap as SessionLifecycleContext, aq as SessionRecord, ar as SessionStore, as as SettingSource, at as Skill, au as SkillsResolver, av as SkillsResolverContext, aw as SystemPromptContext, ax as SystemPromptMemoryFact, ay as SystemPromptSkillRef, az as TelemetrySettings, aA as ToolCallSummary, aB as ToolResultTransformContext, aC as TransformContext, aD as Verdict } from './agent-BiCINq25.js';
5
- import { R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, T as ToolResultContentBlock, b as Run, P as Processor, c as PermissionMode, d as PermissionEngine, e as RunEventSink, S as SDKMessage } from './run-C8FBAC8o.js';
6
- export { A as AgentConversationTurn, f as AssistantMessage, g as CompletionCheck, h as CompletionCheckResult, i as ConversationStep, j as ConversationTurn, k as CostBreakdown, l as CostSource, m as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, n as GenerateRunResult, I as ImageBlock, o as InputProcessorContext, p as InteractionUpdate, q as McpAuthConfig, r as McpHttpServerConfig, s as McpOAuthConfig, t as McpStdioServerConfig, u as MessageOrigin, v as ModelParameterValue, O as OutputProcessorContext, w as PartialToolCallUpdate, x as PermissionAction, y as PermissionEngineOptions, z as PermissionRule, B as ProcessorControls, E as ProcessorTripwire, F as ProcessorViolation, H as RunCompactBoundaryEvent, J as RunCompletionCheckEvent, K as RunErrorDetail, L as RunEvent, N as RunGitInfo, Q as RunOperation, U as RunPermissionDeniedEvent, V as RunRateLimitEvent, W as RunStatus, X as RunTaskCompletedEvent, Y as RunTaskStartedEvent, Z as RunTaskUpdatedEvent, _ as RunTimelineEvent, $ as RunToCompletionOptions, a0 as RunToCompletionResult, a1 as RunToolProgressEvent, a2 as RunTripwireEvent, a3 as SDKAssistantMessage, a4 as SDKImage, a5 as SDKImageDimension, a6 as SDKObjectDelta, a7 as SDKRequestMessage, a8 as SDKStatusMessage, a9 as SDKSystemMessage, aa as SDKTaskMessage, ab as SDKThinkingMessage, ac as SDKToolUseMessage, ad as SDKUserMessage, ae as SDKUserMessageEvent, af as SendOptions, ag as ShellCommand, ah as ShellConversationTurn, ai as ShellOutput, aj as ShellOutputDeltaUpdate, ak as StepCompletedUpdate, al as StepStartedUpdate, am as StreamToCompletionResult, an as SummaryCompletedUpdate, ao as SummaryStartedUpdate, ap as SummaryUpdate, aq as TextBlock, ar as TextDeltaUpdate, as as ThinkingCompletedUpdate, at as ThinkingDeltaUpdate, au as ThinkingMessage, av as TokenDeltaUpdate, aw as TokenUsage, ax as ToolCall, ay as ToolCallCompletedUpdate, az as ToolCallStartedUpdate, aA as ToolContextMessage, aB as ToolResult, aC as ToolResultGuardOptions, aD as ToolUseBlock, aE as TurnEndedUpdate, aF as UserMessage, aG as UserMessageAppendedUpdate, aH as applyMode, aI as emitRunEvent } from './run-C8FBAC8o.js';
1
+ import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-C5fJUqLk.js';
2
+ export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, m as ErrorCode, I as IntegrationNotConnectedError, n as InvalidTaskIdError, M as MemoryAdapterError, o as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, p as TaskNotFoundError, U as UnknownAgentError, q as UnsupportedBudgetOperationError, r as UnsupportedRunOperationError, s as UnsupportedTaskOperationError, t as isTransientError } from './errors-C5fJUqLk.js';
3
+ import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-DSec-E0c.js';
4
+ export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as CloudEnv, u as CloudRepo, v as CreateSkillSpec, H as HookName, w as MemoryProviderFactory, x as MemoryProviderHandle, y as MemoryProviderInitOptions, z as PluginContext, D as PostAssistantReplyContext, E as PostToolCallContext, F as PreToolCallContext, J as PreUserSendContext, K as PreUserSendResult, N as ProviderTransform, O as ProviderTransformContext, R as RecordSessionSummaryArgs, Q as SessionLifecycleContext, T as SessionRecord, U as SessionStore, V as SettingSource, W as Skill, X as SkillsResolver, Y as SkillsResolverContext, Z as SystemPromptContext, _ as SystemPromptMemoryFact, $ as TelemetrySettings, a0 as ToolCallSummary, a1 as ToolResultTransformContext, a2 as TransformContext } from './agent-DSec-E0c.js';
5
+ import { k as CostBreakdown, aw as TokenUsage, R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, T as ToolResultContentBlock, b as Run, P as Processor, c as PermissionMode, d as PermissionEngine, e as RunEventSink, S as SDKMessage } from './run-BYSHf58D.js';
6
+ export { A as AgentConversationTurn, f as AssistantMessage, g as CompletionCheck, h as CompletionCheckResult, i as ConversationStep, j as ConversationTurn, k as CostBreakdown, l as CostSource, m as CostStatus, D as DoomLoopThresholds, G as GenerateOptions, n as GenerateRunResult, I as ImageBlock, o as InputProcessorContext, p as InteractionUpdate, q as McpAuthConfig, r as McpHttpServerConfig, s as McpOAuthConfig, t as McpStdioServerConfig, u as MessageOrigin, v as ModelParameterValue, O as OutputProcessorContext, w as PartialToolCallUpdate, x as PermissionAction, y as PermissionEngineOptions, z as PermissionRule, B as ProcessorControls, E as ProcessorTripwire, F as ProcessorViolation, H as RunCompactBoundaryEvent, J as RunCompletionCheckEvent, K as RunErrorDetail, L as RunEvent, N as RunGitInfo, Q as RunOperation, U as RunPermissionDeniedEvent, V as RunRateLimitEvent, W as RunStatus, X as RunTaskCompletedEvent, Y as RunTaskStartedEvent, Z as RunTaskUpdatedEvent, _ as RunTimelineEvent, $ as RunToCompletionOptions, a0 as RunToCompletionResult, a1 as RunToolProgressEvent, a2 as RunTripwireEvent, a3 as SDKAssistantMessage, a4 as SDKImage, a5 as SDKImageDimension, a6 as SDKObjectDelta, a7 as SDKRequestMessage, a8 as SDKStatusMessage, a9 as SDKSystemMessage, aa as SDKTaskMessage, ab as SDKThinkingMessage, ac as SDKToolUseMessage, ad as SDKUserMessage, ae as SDKUserMessageEvent, af as SendOptions, ag as ShellCommand, ah as ShellConversationTurn, ai as ShellOutput, aj as ShellOutputDeltaUpdate, ak as StepCompletedUpdate, al as StepStartedUpdate, am as StreamToCompletionResult, an as SummaryCompletedUpdate, ao as SummaryStartedUpdate, ap as SummaryUpdate, aq as TextBlock, ar as TextDeltaUpdate, as as ThinkingCompletedUpdate, at as ThinkingDeltaUpdate, au as ThinkingMessage, av as TokenDeltaUpdate, aw as TokenUsage, ax as ToolCall, ay as ToolCallCompletedUpdate, az as ToolCallStartedUpdate, aA as ToolContextMessage, aB as ToolResult, aC as ToolResultGuardOptions, aD as ToolUseBlock, aE as TurnEndedUpdate, aF as UserMessage, aG as UserMessageAppendedUpdate, aH as applyMode, aI as emitRunEvent } from './run-BYSHf58D.js';
7
7
  import * as zod from 'zod';
8
8
  import { ZodType, z } from 'zod';
9
- import { S as StepResult } from './cron-DyWQsEG6.js';
10
- export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-DyWQsEG6.js';
9
+ import { P as ProviderRoutingSettings, S as SDKAgent, C as ContextSettings, a as PluginsSettings, J as JudgeResult, G as GoalOptions, b as GoalEvent, c as GoalResult, M as MemoryId, d as SDKProvider } from './sdk-agent-D8qJVkuV.js';
10
+ export { A as AgentMemory, e as ContextBudget, f as ContextManagerKind, g as ContextSnapshot, h as ContextSource, i as ContextSourceStatus, I as InvalidateCacheOptions, j as MemoryAdapter, k as MemoryAdapterCapabilities, l as MemoryContext, m as MemoryFact, n as MemoryRevision, o as MemoryToolSchema, p as MemoryTurnMessage, q as PersonalityPreset, r as ProviderCapability, s as ProviderRoute, R as ResolvedProviderRoute, t as RunUntilIterator, u as SDKAgentPlugins, v as SDKAgentSkillDetail, w as SDKAgentSkills, x as SDKArtifact, y as SDKContextManager, z as SDKPluginMetadata, B as SDKProvidersManager, D as SystemPromptSkillRef, V as Verdict } from './sdk-agent-D8qJVkuV.js';
11
+ export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-CRwy2JBF.js';
12
+ import { StepResult } from './workflow.js';
13
+ export { Workflow, agentStep, fn } from './workflow.js';
11
14
 
12
15
  /**
13
16
  * Public compaction / context-management helpers (M2-1, extended V3-3).
@@ -44,9 +47,9 @@ interface CompressibleMessage {
44
47
  }
45
48
 
46
49
  /**
47
- * M50 (agent-builder) — session-transcript compaction, Codex-faithful.
50
+ * M50 (agent-builder) — session-transcript compaction.
48
51
  *
49
- * Mirrors the vendored Codex mechanism (`codex-rs/core/src/compact.rs`):
52
+ * The mechanism:
50
53
  * - the replacement history = recent USER messages verbatim (newest→oldest under a token budget;
51
54
  * prior summaries filtered by marker) + ONE summary message with a textual marker prefix,
52
55
  * injected as `role:"user"` (`build_compacted_history`, compact.rs:589-663);
@@ -101,6 +104,12 @@ interface BatchOptions extends AgentOptions {
101
104
  /**
102
105
  * Maximum parallel agents. Default 4 (ADR D136). Must be a positive
103
106
  * integer. Capped to `prompts.length` to avoid spinning idle workers.
107
+ *
108
+ * Bounds the WHOLE per-item lifecycle, including `onResult`: a prompt's
109
+ * concurrency slot is not released until its `onResult` callback (if any)
110
+ * has finished (B-110). A caller doing anything stateful in `onResult` —
111
+ * writing a file, appending to a shared buffer, rate-limiting an API — can
112
+ * rely on at most `concurrency` such callbacks running at once.
104
113
  */
105
114
  concurrency?: number;
106
115
  /** Optional filter applied post-collection. Return `false` to discard. */
@@ -108,7 +117,7 @@ interface BatchOptions extends AgentOptions {
108
117
  /**
109
118
  * Streaming callback fired once per completed prompt (success OR failure).
110
119
  * Caller exceptions are caught + logged to stderr without poisoning
111
- * the batch (EC-5).
120
+ * the batch (EC-5). Bounded by `concurrency` — see its doc.
112
121
  */
113
122
  onResult?: (result: BatchResult) => void | Promise<void>;
114
123
  /** Progress callback fired after each result. */
@@ -332,6 +341,25 @@ declare class GenerateObjectError extends Error {
332
341
  constructor(code: "no_tool_call" | "parse_failed", message: string, cause?: unknown);
333
342
  }
334
343
 
344
+ /**
345
+ * Terminal-method callbacks injected by `Agent.builder()` so that
346
+ * `agent-builder.ts` does NOT need a static import of `Agent` — keeps the
347
+ * dependency graph acyclic (G6).
348
+ *
349
+ * Exported, and NOT carrying the internal-visibility JSDoc tag, because
350
+ * `AgentBuilder` is `@public` and so is its constructor: `new AgentBuilder(deps)`
351
+ * is callable by anyone, which makes this parameter's type part of the published
352
+ * contract whether or not we intended it. Hiding it did not make it private — it
353
+ * made the emitted `.d.ts` say `constructor(deps?: AgentBuilderDeps)` with no such
354
+ * type in the file (#335). Prefer `Agent.builder()`, which injects these for you;
355
+ * this is the seam it uses, not an argument callers are expected to construct.
356
+ *
357
+ * @public
358
+ */
359
+ interface AgentBuilderDeps {
360
+ create: (options: AgentOptions) => Promise<SDKAgent>;
361
+ getOrCreate: (agentId: string, options: AgentOptions) => Promise<SDKAgent>;
362
+ }
335
363
  /**
336
364
  * Fluent builder for {@link AgentOptions}. Chainable setters mutate internal
337
365
  * state and return `this`. Three terminals:
@@ -403,6 +431,20 @@ declare class AgentBuilder {
403
431
  */
404
432
 
405
433
  type EvictReason = "lru" | "idle" | "explicit";
434
+ /**
435
+ * Knobs for {@link LiveAgentRegistry.configure}.
436
+ *
437
+ * The three numeric fields are a partial reconfigure — one left out keeps its current value.
438
+ * `onEvict` is NOT: it is assigned on every call, so `configure({ maxAgents: 200 })` clears a
439
+ * listener registered earlier. Re-pass the listener whenever you reconfigure.
440
+ *
441
+ * Two values are load-bearing zeroes. `maxAgents: 0` disables caching entirely, so every lookup
442
+ * misses and every agent is rebuilt; `idleTimeoutMs: 0` keeps the cache but leaves LRU as the only
443
+ * eviction, because the sweep is not started at all below that threshold. Negative numbers are
444
+ * clamped rather than rejected — up to 1000ms for `sweepIntervalMs`, up to 0 for the other two.
445
+ *
446
+ * @public
447
+ */
406
448
  interface AgentRegistryOptions {
407
449
  /**
408
450
  * Maximum number of agents kept alive simultaneously. LRU eviction when
@@ -429,6 +471,29 @@ interface AgentRegistryOptions {
429
471
  */
430
472
  onEvict?: (id: string, reason: EvictReason) => void;
431
473
  }
474
+ /**
475
+ * An LRU-plus-idle cache of live `SDKAgent` instances, reached through `Agent.registry`.
476
+ *
477
+ * It exists for long-running servers that would otherwise build a fresh agent per conversation and
478
+ * never release one. Do not confuse it with the metadata registry in `agent-registry.ts`, which
479
+ * persists `RegisteredAgent` records to disk: that one is the address book, this one is the live
480
+ * cache, and they share nothing.
481
+ *
482
+ * The lifecycle rule that matters to callers: eviction — by LRU, by idle timeout, or by an explicit
483
+ * `evict` — calls `dispose()` on the agent. A reference you held onto before eviction is a disposed
484
+ * agent, not a detached one. `get` counts as a use and refreshes the entry's timestamp, so polling
485
+ * for an agent keeps it alive indefinitely.
486
+ *
487
+ * Idle eviction depends on a background sweep that only `configure` starts. A registry nobody
488
+ * configured caches with the documented defaults but evicts by LRU alone, so entries can sit past
489
+ * `idleTimeoutMs` indefinitely; call `configure` — even with no changes — to arm the sweep.
490
+ *
491
+ * Failures on the eviction path are swallowed and reported to the diagnostics channel — a throwing
492
+ * `dispose()` or a throwing `onEvict` listener must not stop the sweep. Configuration is
493
+ * process-wide and last-call-wins.
494
+ *
495
+ * @public
496
+ */
432
497
  declare class LiveAgentRegistry {
433
498
  #private;
434
499
  /**
@@ -570,7 +635,22 @@ declare class Agent {
570
635
  */
571
636
  static create(options: AgentOptions): Promise<SDKAgent>;
572
637
  /**
573
- * One-shot prompt: create an agent, send a single message, wait, dispose.
638
+ * One-shot prompt: create an agent, send a single message, wait, **dispose**.
639
+ *
640
+ * `Agent.prompt` is STATIC and owns the agent's whole lifecycle. To send to an
641
+ * agent you already hold, use the instance method — `agent.send(message)` —
642
+ * which keeps the conversation and does not dispose anything:
643
+ *
644
+ * ```ts
645
+ * const agent = await Agent.create({ ... });
646
+ * const run = await agent.send("first"); // NOT agent.prompt(...)
647
+ * const run2 = await agent.send("follow-up"); // full context retained
648
+ * ```
649
+ *
650
+ * There is no `agent.prompt()` (#302). The natural sentence for the second
651
+ * operation is "prompt the agent", so it is the method people reach for; the
652
+ * two differ in whether the agent survives the call, which is why they do not
653
+ * share a name.
574
654
  *
575
655
  * When `options.throwOnError === true`, rejects with `AgentRunError` if
576
656
  * the run terminates with `status: 'error'` (instead of resolving with the
@@ -670,24 +750,27 @@ declare class Agent {
670
750
  */
671
751
  static getOrCreate(agentId: string, options: AgentOptions): Promise<SDKAgent>;
672
752
  /**
673
- * List agents (local or cloud). M107 — `cwd` is READ now, not ignored;
674
- * `limit`/`cursor` still are not (see `tests/agent-list-cwd.test.ts`).
753
+ * List agents (local or cloud). M107 — `cwd` is READ, not ignored. B-115 (2026-08-19) —
754
+ * `includeArchived` and `limit`/`cursor` are READ too now; see `ListAgentsOptions`'s doc for the
755
+ * pagination contract and why the unlimited (no `limit`) case is unaffected.
675
756
  *
676
757
  * @public
677
758
  */
678
759
  static list(options?: ListAgentsOptions): Promise<ListResult<SDKAgentInfo>>;
679
760
  /**
680
- * Get metadata for a single agent.
761
+ * Get metadata for a single agent. B-115 (2026-08-19) — `cwd` is READ now (see
762
+ * `GetAgentOptions`'s doc); it used to be accepted and silently ignored.
681
763
  *
682
764
  * @public
683
765
  */
684
- static get(agentId: string, _options?: GetAgentOptions): Promise<SDKAgentInfo>;
766
+ static get(agentId: string, options?: GetAgentOptions): Promise<SDKAgentInfo>;
685
767
  /**
686
- * List runs for an agent.
768
+ * List runs for an agent. B-115 (2026-08-19) — `cwd` and `limit`/`cursor` are READ now (see
769
+ * `ListRunsOptions`'s doc); they used to be accepted and silently ignored.
687
770
  *
688
771
  * @public
689
772
  */
690
- static listRuns(agentId: string, _options?: ListRunsOptions): Promise<ListResult<Run>>;
773
+ static listRuns(agentId: string, options?: ListRunsOptions): Promise<ListResult<Run>>;
691
774
  /**
692
775
  * Get a single run.
693
776
  *
@@ -828,11 +911,35 @@ declare class AgentFactory {
828
911
  */
829
912
  /** What the operator chose for everything not decided per tool. @public */
830
913
  type ApprovalMode = "ask" | "never-ask" | "refuse-all";
831
- /** @public */
914
+ /**
915
+ * The three answers a policy can give: proceed, put the call in front of a human, or stop it.
916
+ *
917
+ * `ask` is not a softer `deny`. A surface with no way to reach a human must treat it as a refusal,
918
+ * because treating it as permission is how an unattended run approves everything it was meant to
919
+ * pause on.
920
+ *
921
+ * @public
922
+ */
832
923
  type ApprovalOutcome = "allow" | "ask" | "deny";
833
- /** @public */
924
+ /**
925
+ * Which rule produced the outcome.
926
+ *
927
+ * The `explicitly-` pair means a per-tool list decided it; the `mode-` triple means no list named
928
+ * the tool and the operator's mode decided instead. Worth rendering alongside the outcome: "you
929
+ * denied this tool" and "your mode refuses everything" send the operator to different settings.
930
+ *
931
+ * @public
932
+ */
834
933
  type ApprovalReason = "explicitly-allowed" | "explicitly-denied" | "mode-ask" | "mode-never-ask" | "mode-refuse-all";
835
- /** @public */
934
+ /**
935
+ * One tool call to decide on, plus the operator's configuration.
936
+ *
937
+ * `tool` is matched against `denied` and `allowed` by exact string equality — there is no pattern
938
+ * or prefix rule. Both lists default to empty, so with neither supplied every call is decided by
939
+ * `mode` alone.
940
+ *
941
+ * @public
942
+ */
836
943
  interface ApprovalInput {
837
944
  readonly tool: string;
838
945
  readonly mode: ApprovalMode;
@@ -841,7 +948,11 @@ interface ApprovalInput {
841
948
  /** Tools the operator refused. Outranks `allowed` and every mode. */
842
949
  readonly denied?: readonly string[];
843
950
  }
844
- /** @public */
951
+ /**
952
+ * The answer, the rule that produced it, and the tool it was about.
953
+ *
954
+ * @public
955
+ */
845
956
  interface ApprovalDecision {
846
957
  readonly outcome: ApprovalOutcome;
847
958
  readonly reason: ApprovalReason;
@@ -849,6 +960,17 @@ interface ApprovalDecision {
849
960
  readonly tool: string;
850
961
  }
851
962
  /**
963
+ * Decide one tool call against the operator's lists and mode.
964
+ *
965
+ * The precedence is fixed and each step short-circuits: `denied` is consulted first, then
966
+ * `allowed`, then `mode`. A tool named in BOTH lists is therefore denied — a contradictory config
967
+ * is read restrictively, because the usual cause is an allow-entry that outlived the denial meant
968
+ * to replace it.
969
+ *
970
+ * This answers only who said yes. What the call REACHES is a separate question with a separate
971
+ * policy — `evaluateBlastRadius` — and neither consults the other, so a product that wants both
972
+ * gates calls both and combines the outcomes itself.
973
+ *
852
974
  * @returns the outcome, why it was reached, and the tool it was about.
853
975
  * @public
854
976
  */
@@ -897,7 +1019,18 @@ interface DeclaredAction {
897
1019
  */
898
1020
  readonly reversible: boolean;
899
1021
  }
900
- /** @public */
1022
+ /**
1023
+ * The action to decide on, plus what the operator granted.
1024
+ *
1025
+ * `granted` is matched against `action.scope` by exact string equality: there is no prefix or
1026
+ * wildcard rule, so granting `cluster:prod` does not grant `cluster:prod:kube-system`. A product
1027
+ * that wants hierarchical scopes expands them itself before calling.
1028
+ *
1029
+ * `irreversibleAllowed` defaults to empty, so an irreversible action inside a granted scope asks
1030
+ * for approval unless its scope was pre-approved for destruction as well.
1031
+ *
1032
+ * @public
1033
+ */
901
1034
  interface BlastRadiusInput {
902
1035
  readonly action: DeclaredAction;
903
1036
  /** Scopes the operator granted reach to. Empty grants nothing — never everything. */
@@ -905,11 +1038,27 @@ interface BlastRadiusInput {
905
1038
  /** Scopes where the operator pre-approved irreversible actions, so an unattended run can work. */
906
1039
  readonly irreversibleAllowed?: readonly string[];
907
1040
  }
908
- /** @public */
1041
+ /**
1042
+ * What the policy decided.
1043
+ *
1044
+ * `require-approval` means a human has to say yes before the action runs; a caller with no way to
1045
+ * ask must treat it as a refusal. `refuse` is not appealable through this policy at all — the
1046
+ * operator has to grant the scope first, which is deliberately a configuration change rather than
1047
+ * a prompt.
1048
+ *
1049
+ * @public
1050
+ */
909
1051
  type BlastRadiusOutcome = "allow" | "require-approval" | "refuse";
910
1052
  /** Why the decision came out that way. Rendered to the operator and read by an audit. @public */
911
1053
  type BlastRadiusReason = "within-granted-scope" | "irreversible" | "scope-not-granted" | "scope-undeclared";
912
- /** @public */
1054
+ /**
1055
+ * The outcome, the rule that produced it, and the scope it was decided about.
1056
+ *
1057
+ * `scope` echoes what the action declared, so it is the empty string when the reason is
1058
+ * `scope-undeclared` — the decision names what it saw rather than substituting a placeholder.
1059
+ *
1060
+ * @public
1061
+ */
913
1062
  interface BlastRadiusDecision {
914
1063
  readonly outcome: BlastRadiusOutcome;
915
1064
  readonly reason: BlastRadiusReason;
@@ -917,6 +1066,19 @@ interface BlastRadiusDecision {
917
1066
  readonly scope: string;
918
1067
  }
919
1068
  /**
1069
+ * Decide one declared action against the scopes the operator granted.
1070
+ *
1071
+ * Four checks, in this order, each short-circuiting: an empty `scope` is refused as undeclared
1072
+ * before any comparison happens; a scope absent from `granted` is refused; an irreversible action
1073
+ * whose scope is not in `irreversibleAllowed` escalates to approval; anything left is allowed.
1074
+ *
1075
+ * Refusal outranking escalation is a decision, not an accident. Asking a human to approve a scope
1076
+ * the operator never granted trains them to approve by reflex, which is how an approval prompt
1077
+ * stops being a control.
1078
+ *
1079
+ * This decides reach only. Whether the operator permitted the tool at all is `decideApproval`, and
1080
+ * the two are independent.
1081
+ *
920
1082
  * @returns the outcome with the reason and the scope it was decided on.
921
1083
  * @public
922
1084
  */
@@ -1005,7 +1167,52 @@ declare function chargeAndCheckThresholds(name: string, actualUsd: number): Prom
1005
1167
  * @internal
1006
1168
  */
1007
1169
  type ApiMode = "anthropic_messages" | "openai_chat_completions" | "openai_responses";
1170
+ /**
1171
+ * Guess which usage shape a provider reports, from its name alone.
1172
+ *
1173
+ * Matching is case-insensitive and exact — `"anthropic"`, `"claude"` and `"bedrock_anthropic"`
1174
+ * give `"anthropic_messages"`; `"openai-codex"` and `"codex"` give `"openai_responses"`. Every
1175
+ * other name, including ones this SDK has never seen, falls through to
1176
+ * `"openai_chat_completions"`. There is no unknown result, so a wrong guess is silent: it is
1177
+ * read as a Chat Completions payload, whose fields are absent, and the tokens come back as 0.
1178
+ *
1179
+ * The default is right for the OpenAI-compatible majority (openai, openrouter, deepseek, and the
1180
+ * compat endpoints of google, ollama and lmstudio). When it is not, pass `apiMode` to
1181
+ * `normalizeUsage` explicitly instead of relying on the name.
1182
+ */
1008
1183
  declare function inferApiMode(provider: string): ApiMode;
1184
+ /**
1185
+ * Convert a provider's raw `usage` object into the SDK's canonical `TokenUsage`.
1186
+ *
1187
+ * Never throws and never reports failure. `null`, `undefined` and any non-object argument return
1188
+ * all-zero usage, which is indistinguishable from a real response that used no tokens — so this
1189
+ * is not the place to detect a malformed payload.
1190
+ *
1191
+ * `opts.apiMode` selects the reader; when omitted it is derived from `opts.provider` via
1192
+ * `inferApiMode`, whose fallback is Chat Completions. Pass it explicitly for any provider whose
1193
+ * name does not identify its wire shape.
1194
+ *
1195
+ * The shapes differ in one way that matters: Anthropic reports cache tokens in buckets separate
1196
+ * from `input_tokens`, while both OpenAI shapes report a prompt total that already includes
1197
+ * them. For the OpenAI readers the cache buckets are subtracted, so `inputTokens` is always the
1198
+ * uncached portion and `inputTokens + cacheReadTokens + cacheWriteTokens` reconstructs the
1199
+ * provider's prompt total. The subtraction is floored at 0, so a payload whose cache counts
1200
+ * exceed its prompt total yields 0 rather than a negative.
1201
+ *
1202
+ * Every field is coerced: numbers are truncated toward zero, numeric strings are parsed, negative
1203
+ * and non-finite values become 0, and anything else becomes 0.
1204
+ *
1205
+ * `totalTokens` is computed here as input + output + both cache buckets; a `total_tokens` the
1206
+ * provider sent is ignored. Reasoning tokens are reported separately but are NOT added again —
1207
+ * providers already count them inside output. `cacheReadTokens`, `cacheWriteTokens` and
1208
+ * `reasoningTokens` are omitted from the result when they are 0, so absent means zero, not
1209
+ * unknown.
1210
+ *
1211
+ * Chat Completions also accepts Anthropic-style top-level `cache_read_input_tokens` /
1212
+ * `cache_creation_input_tokens`, which OpenAI-compatible proxies emit when they route Claude.
1213
+ * The nested `prompt_tokens_details` values win; the top-level fields are consulted only when
1214
+ * those are 0 or missing.
1215
+ */
1009
1216
  declare function normalizeUsage(rawUsage: unknown, opts: {
1010
1217
  provider: string;
1011
1218
  apiMode?: ApiMode;
@@ -1065,6 +1272,21 @@ interface StepUsage {
1065
1272
  cacheWriteTokens?: number;
1066
1273
  reasoningTokens?: number;
1067
1274
  }
1275
+ /**
1276
+ * Sums the per-step token counts of a multi-step run into one `TokenUsage`.
1277
+ *
1278
+ * Call `add` once per LLM finish, in any order, then `toTokenUsage` to read the total. The instance
1279
+ * is a running sum, not a snapshot: `toTokenUsage` may be called repeatedly and reflects everything
1280
+ * added so far, and there is no reset — start a new accumulator per run.
1281
+ *
1282
+ * Two shaping rules to expect in the output. The optional counters (cache read, cache write,
1283
+ * reasoning) are omitted entirely when they sum to zero rather than reported as `0`. And the
1284
+ * per-step `requests` array appears only when at least TWO steps were added, so a single-step run
1285
+ * carries totals alone.
1286
+ *
1287
+ * `totalTokens` is input plus output only — cache and reasoning counts are reported separately and
1288
+ * are not folded into it.
1289
+ */
1068
1290
  declare class UsageAccumulator {
1069
1291
  private input;
1070
1292
  private output;
@@ -1202,7 +1424,14 @@ declare class UnicodeNormalizer {
1202
1424
  *
1203
1425
  * @public
1204
1426
  */
1205
- /** @public */
1427
+ /**
1428
+ * One provider's credential lookup, as the product resolved it.
1429
+ *
1430
+ * `value` is the secret itself. It is hashed and dropped inside `describeCredential` — it never
1431
+ * reaches the report, and nothing here stores it.
1432
+ *
1433
+ * @public
1434
+ */
1206
1435
  interface CredentialInput {
1207
1436
  /** The product's name for the provider. This module never knows one of its own. */
1208
1437
  readonly provider: string;
@@ -1211,7 +1440,15 @@ interface CredentialInput {
1211
1440
  /** Where it came from, in the product's vocabulary — `env`, `file`, `keychain`, `oauth`. */
1212
1441
  readonly source: string;
1213
1442
  }
1214
- /** @public */
1443
+ /**
1444
+ * A presence-only view of one credential, safe to print, log, or attach to a support bundle.
1445
+ *
1446
+ * `fingerprint` is the first eight hex characters of the SHA-256 of the trimmed secret: enough for
1447
+ * two people to agree they are holding the same key, and not a substring of it. It is absent
1448
+ * whenever `present` is false.
1449
+ *
1450
+ * @public
1451
+ */
1215
1452
  interface CredentialReport {
1216
1453
  readonly provider: string;
1217
1454
  readonly present: boolean;
@@ -1220,6 +1457,13 @@ interface CredentialReport {
1220
1457
  readonly fingerprint?: string;
1221
1458
  }
1222
1459
  /**
1460
+ * Turn a resolved credential into something you can show a user.
1461
+ *
1462
+ * The value is trimmed before the emptiness test, so `undefined`, `""` and whitespace all report
1463
+ * `present: false` with no fingerprint. That matters because an environment variable that expanded
1464
+ * to nothing arrives as an empty string, and calling that "present" sends whoever is debugging to
1465
+ * hunt for a routing bug instead of a missing secret.
1466
+ *
1223
1467
  * @returns a report safe to log, render and attach to a support bundle.
1224
1468
  * @public
1225
1469
  */
@@ -1347,12 +1591,6 @@ interface SanitizeOptions {
1347
1591
  maxDepth?: number;
1348
1592
  }
1349
1593
 
1350
- /**
1351
- * Spec accepted by {@link defineTool}. `inputSchema` is a Zod schema; the
1352
- * `handler` argument type is inferred via `z.infer<T>` — no `as` casts.
1353
- *
1354
- * @public
1355
- */
1356
1594
  /**
1357
1595
  * SE16 — the handler's return type. With no `outputSchema` the tool returns a
1358
1596
  * plain `string` (pre-SE16 shape). With an `outputSchema` the handler returns the
@@ -1360,6 +1598,20 @@ interface SanitizeOptions {
1360
1598
  * The `[O]` tuple wrap prevents distribution so `never` maps cleanly to `string`.
1361
1599
  */
1362
1600
  type ToolHandlerReturn<O extends ZodType> = [O] extends [never] ? string : z.infer<O>;
1601
+ /**
1602
+ * Spec accepted by {@link Tool.create}. `inputSchema` is a Zod schema; the `handler` argument type
1603
+ * is inferred via `z.infer<T>` — no `as` casts.
1604
+ *
1605
+ * The two optional output fields do different jobs and compose. `outputSchema` changes what the
1606
+ * handler must RETURN (a structured value instead of a string) and validates it; `toModelOutput`
1607
+ * changes only what the MODEL sees in the tool result, while observability still receives the full
1608
+ * handler output. Set neither and the handler returns a plain string that goes to both.
1609
+ *
1610
+ * `zod` is referenced as a type only, so a consumer that never calls `Tool.create` does not need it
1611
+ * installed.
1612
+ *
1613
+ * @public
1614
+ */
1363
1615
  interface DefineToolSpec<T extends ZodType, O extends ZodType = never> {
1364
1616
  /** Tool name surfaced to the LLM. Same constraints as {@link CustomTool.name}. */
1365
1617
  name: string;
@@ -1455,7 +1707,16 @@ interface EnvOptOut {
1455
1707
  /** What would make this opt-out obsolete. An opt-out with no exit is a permanent excuse. */
1456
1708
  readonly exitCriterion: string;
1457
1709
  }
1458
- /** @public */
1710
+ /**
1711
+ * The three lists the audit compares: every key the product declares, the subset an environment
1712
+ * variable can set, and the documented exemptions.
1713
+ *
1714
+ * All three are matched by exact string equality, and `reachable` and `optOuts` are read as subsets
1715
+ * of `keys` — an entry in either that is not in `keys` is what makes an opt-out stale, and an entry
1716
+ * in `reachable` that is not in `keys` is simply ignored.
1717
+ *
1718
+ * @public
1719
+ */
1459
1720
  interface EnvReachabilityInput {
1460
1721
  /** Every configuration key the product declares. */
1461
1722
  readonly keys: readonly string[];
@@ -1464,7 +1725,15 @@ interface EnvReachabilityInput {
1464
1725
  /** Documented exemptions for keys that deliberately have no environment path. */
1465
1726
  readonly optOuts: readonly EnvOptOut[];
1466
1727
  }
1467
- /** @public */
1728
+ /**
1729
+ * The two failures, reported separately because they have opposite fixes.
1730
+ *
1731
+ * A key in `unreachable` needs either an environment path or a documented opt-out. A key in
1732
+ * `staleOptOuts` needs its opt-out DELETED — it exempts nothing, either because the key gained an
1733
+ * environment path or because the key no longer exists. Both lists empty is the passing state.
1734
+ *
1735
+ * @public
1736
+ */
1468
1737
  interface EnvReachabilityAudit {
1469
1738
  /** Keys with neither an environment path nor a documented opt-out. */
1470
1739
  readonly unreachable: readonly string[];
@@ -1472,6 +1741,15 @@ interface EnvReachabilityAudit {
1472
1741
  readonly staleOptOuts: readonly string[];
1473
1742
  }
1474
1743
  /**
1744
+ * Answer both halves of the reachability question in one call.
1745
+ *
1746
+ * A key counts as covered when it is in `reachable` OR carries an opt-out, so an opt-out silences
1747
+ * the gap it was written for and nothing else. Assert on both returned lists: a suite that checks
1748
+ * only `unreachable` still passes while the opt-outs rot, which is the half everyone forgets.
1749
+ *
1750
+ * This performs no I/O and reads no environment. The caller supplies its own key vocabulary,
1751
+ * because a framework cannot enumerate a consumer's configuration keys.
1752
+ *
1475
1753
  * @returns both axes, in the order the caller declared them — a stable order so a failure message
1476
1754
  * does not change between runs for reasons unrelated to the code.
1477
1755
  * @public
@@ -1485,6 +1763,22 @@ declare function auditEnvReachability(input: EnvReachabilityInput): EnvReachabil
1485
1763
  * Each handler is try-caught (EC-2) so one failing handler cannot break others.
1486
1764
  */
1487
1765
  type EventHandler<T> = (payload: T) => void;
1766
+ /**
1767
+ * A typed publish/subscribe bus, parameterised by a map of event name to payload type.
1768
+ *
1769
+ * `publish` is SYNCHRONOUS: handlers run in subscription order before it returns, so a slow handler
1770
+ * blocks the publisher. Each handler is invoked inside its own try/catch, so one that throws cannot
1771
+ * stop the others — the error is written to the diagnostics channel and counted on
1772
+ * `handlerErrorCount`. Assert on that counter in tests; a subscriber failing on every event is
1773
+ * otherwise invisible.
1774
+ *
1775
+ * `subscribe` returns the unsubscribe function, which is the only way to detach a handler — there
1776
+ * is no `off` taking the handler back. Handlers are held in a `Set` per event, so subscribing the
1777
+ * same function reference twice registers it once.
1778
+ *
1779
+ * Payload objects are passed by reference to every handler; nothing here copies them, so a handler
1780
+ * that mutates a payload mutates it for the handlers after it.
1781
+ */
1488
1782
  declare class EventBus<Events extends Record<string, unknown>> {
1489
1783
  #private;
1490
1784
  private handlers;
@@ -1712,6 +2006,40 @@ type DiagnosticsSink = (message: string) => void;
1712
2006
  */
1713
2007
  declare function setDiagnosticsSink(next: DiagnosticsSink | undefined): void;
1714
2008
 
2009
+ /**
2010
+ * Run `fn` after every earlier `withCwdMutex` call for the same `key` has settled, and return
2011
+ * what `fn` returns.
2012
+ *
2013
+ * Calls with the same key run strictly in the order they were made — FIFO, never concurrent.
2014
+ * Calls with different keys never wait on each other. The key is an opaque string: two callers
2015
+ * serialize against each other exactly when they pass equal keys, so a shared key IS the
2016
+ * contract, and a mismatched one silently buys no protection at all.
2017
+ *
2018
+ * A rejection does not poison the queue. The next waiter runs whether the previous `fn` fulfilled
2019
+ * or rejected, and the rejection is delivered only to the caller whose `fn` threw. This function
2020
+ * neither retries nor swallows: the returned promise rejects with whatever `fn` rejected with.
2021
+ *
2022
+ * There is no timeout and no cancellation. An `fn` that never settles blocks that key for the
2023
+ * lifetime of the process.
2024
+ *
2025
+ * **Scope — this is an in-process lock only.** State is a module-scoped Map, so it serializes
2026
+ * callers that share one module instance and nothing else. Two processes, two worker threads, or
2027
+ * two copies of the SDK resolved into the same tree do not see each other's queue. When the
2028
+ * resource is a file that other processes can also write, use `withFileLock` from
2029
+ * `./file-lock.ts` instead — it takes an OS-level lock and layers this mutex underneath, so it
2030
+ * gives both guarantees. Reach for `withCwdMutex` directly when the shared state is in memory, or
2031
+ * when the file is one only this process touches.
2032
+ *
2033
+ * Extracted packages (`@theokit/sdk-budget`, `@theokit/sdk-memory`) import this from
2034
+ * `@theokit/sdk` rather than reimplementing it, precisely so the Map is the same one: a per-package
2035
+ * copy would give each package its own queue and let their writes race.
2036
+ *
2037
+ * The Map is module-scoped, so nothing survives a process restart or a fresh module instance, and
2038
+ * its entries are never removed — pass keys from a bounded set rather than from arbitrary input.
2039
+ * Signature and semantics will not change before sdk-core v3.0.
2040
+ *
2041
+ * @public
2042
+ */
1715
2043
  declare function withCwdMutex<T>(key: string, fn: () => Promise<T>): Promise<T>;
1716
2044
 
1717
2045
  /**
@@ -1743,6 +2071,61 @@ declare class NoopMemoryProvider {
1743
2071
  static create(): MemoryProvider;
1744
2072
  }
1745
2073
 
2074
+ /**
2075
+ * The subset of the OpenTelemetry `Span` API this SDK calls.
2076
+ *
2077
+ * Structural, not nominal: a real `@opentelemetry/api` span satisfies it, and so does a test double
2078
+ * or a no-op. That is why it is exported — `@theokit/sdk-memory` previously kept a hand-written
2079
+ * mirror of this shape, and the two had already drifted (the mirror rejected `undefined` attribute
2080
+ * values this one accepts, and declared `end()` without its `endTime` parameter). Import this
2081
+ * instead of re-declaring it.
2082
+ *
2083
+ * Erased at build time, so importing it adds nothing to a bundle and does not require
2084
+ * `@opentelemetry/api` to be installed.
2085
+ *
2086
+ * @public
2087
+ */
2088
+ interface OTelSpan {
2089
+ setAttribute(key: string, value: string | number | boolean): void;
2090
+ setAttributes(attrs: Record<string, string | number | boolean | undefined>): void;
2091
+ addEvent(name: string, attrs?: Record<string, string | number | boolean>): void;
2092
+ setStatus(status: {
2093
+ code: number;
2094
+ message?: string;
2095
+ }): void;
2096
+ recordException(err: unknown): void;
2097
+ end(endTime?: number): void;
2098
+ spanContext(): {
2099
+ traceId: string;
2100
+ spanId: string;
2101
+ };
2102
+ isRecording(): boolean;
2103
+ }
2104
+ /**
2105
+ * Telemetry handle returned by {@link createTelemetry}. Callers use this to
2106
+ * start spans, add events, etc. When telemetry is disabled OR OTel is not
2107
+ * installed, every method is a safe no-op.
2108
+ *
2109
+ */
2110
+ interface TelemetryHandle {
2111
+ readonly enabled: boolean;
2112
+ readonly includeContent: boolean;
2113
+ /** Start a span. Returns a no-op span if telemetry is disabled. */
2114
+ startSpan(name: string, attrs?: Record<string, string | number | boolean>): OTelSpan;
2115
+ /** Start a child span nested under `parent` (M3 #64). `undefined` parent →
2116
+ * a root span (parentless callers, or telemetry with no run span). */
2117
+ startChildSpan(parent: OTelSpan | undefined, name: string, attrs?: Record<string, string | number | boolean>): OTelSpan;
2118
+ /**
2119
+ * Record a histogram observation. T0.1 ships
2120
+ * `theokit_memory_recall_duration_ms`; downstream tasks add more.
2121
+ * No-op when telemetry is disabled or when `@opentelemetry/api`'s metrics
2122
+ * namespace is unavailable. ADR D34 — exporter errors are swallowed by `safe()`.
2123
+ */
2124
+ recordHistogram(name: string, valueMs: number, attrs?: Record<string, string | number | boolean>): void;
2125
+ /** End all open spans on this handle (best-effort, used by Agent.dispose). */
2126
+ endAll(): void;
2127
+ }
2128
+
1746
2129
  /**
1747
2130
  * `JobQueue` — background job queue with status tracking, cancellation, and an
1748
2131
  * optional concurrency bound.
@@ -1769,6 +2152,24 @@ interface JobQueueOptions {
1769
2152
  */
1770
2153
  maxConcurrency?: number;
1771
2154
  }
2155
+ /**
2156
+ * An in-process queue of background jobs with status tracking, cancellation, and an optional
2157
+ * concurrency bound.
2158
+ *
2159
+ * `enqueue` returns a job id immediately and never throws for the job's own failure: a synchronous
2160
+ * throw inside the function becomes a rejection, and a rejection becomes `status: "failed"` with
2161
+ * the message on `job.error`. Poll `getJob(id)` or `list()` for outcomes — there is no completion
2162
+ * event and no promise to await.
2163
+ *
2164
+ * Cancellation is COOPERATIVE. `cancel` aborts the `AbortSignal` handed to the job function and
2165
+ * flips the status, but a function that ignores the signal keeps running to completion; its result
2166
+ * is then discarded, because a cancelled job never leaves the cancelled state. The concurrency slot
2167
+ * of a running job is freed at cancel time rather than when it eventually settles, so a job that
2168
+ * never settles cannot deadlock a bounded queue.
2169
+ *
2170
+ * State lives entirely in memory and grows without bound — nothing evicts finished jobs. This is a
2171
+ * queue for one process, not a durable one.
2172
+ */
1772
2173
  declare class JobQueue {
1773
2174
  #private;
1774
2175
  private jobs;
@@ -1814,13 +2215,30 @@ declare class JobQueue {
1814
2215
  declare class LayerOrderError extends TheokitAgentError {
1815
2216
  readonly name = "LayerOrderError";
1816
2217
  }
1817
- /** @public */
2218
+ /**
2219
+ * One named layer in a precedence chain.
2220
+ *
2221
+ * `precedence` is optional and the two usages do not mix well: omit it everywhere to say "this
2222
+ * array is already in order", or supply it everywhere you want `verifyLayerOrdering` to check.
2223
+ * Entries without it are SKIPPED by that check rather than treated as zero, so a chain where only
2224
+ * some entries declare a number is verified only between those.
2225
+ *
2226
+ * @public
2227
+ */
1818
2228
  interface DeclaredLayer {
1819
2229
  readonly layer: string;
1820
2230
  /** Higher wins. Optional — omit it to mean "this array is already the order". */
1821
2231
  readonly precedence?: number;
1822
2232
  }
1823
- /** @public */
2233
+ /**
2234
+ * A declared layer together with the values it supplies.
2235
+ *
2236
+ * `foldLayers` consumes these in array order, so a later entry wins for the keys it mentions. A key
2237
+ * a layer does not mention — or mentions with `undefined` — leaves the earlier value standing;
2238
+ * there is no way for a layer to erase a key another layer set.
2239
+ *
2240
+ * @public
2241
+ */
1824
2242
  interface LayerValues extends DeclaredLayer {
1825
2243
  readonly values: Readonly<Record<string, unknown>>;
1826
2244
  }
@@ -1894,10 +2312,13 @@ interface MemoryIndexHandle {
1894
2312
  close(): Promise<void> | void;
1895
2313
  }
1896
2314
  /**
1897
- * Public `Memory` namespace.
2315
+ * Inputs for {@link Memory.runDreamingSweep}.
1898
2316
  *
1899
- * Exposes operations users can run outside of `agent.send()` most notably
1900
- * the dreaming sweep (consolidation of facts via dedup + clustering).
2317
+ * `embedding` is required and has no default: the sweep scores cosine similarity between facts, so
2318
+ * without real embeddings there is nothing to dedup or cluster on. Both thresholds are cosine
2319
+ * similarity in [0, 1] and default to `0.95` for dedup and `0.75` for clustering — dedup is the
2320
+ * stricter of the two because merging two facts that were merely related is a data loss, while
2321
+ * failing to cluster them only costs a note.
1901
2322
  *
1902
2323
  * @public
1903
2324
  */
@@ -1919,6 +2340,18 @@ interface DreamingSweepOptions {
1919
2340
  /** Cosine-similarity threshold for the clustering phase. Default `0.75`. */
1920
2341
  clusterThreshold?: number;
1921
2342
  }
2343
+ /**
2344
+ * What one dreaming sweep did.
2345
+ *
2346
+ * `status` is `"skipped"` when the workspace held no facts to work on and `"error"` when the sweep
2347
+ * failed; both come back with every counter at zero, so check `status` before reading a zero as
2348
+ * "there was nothing to consolidate". A failure is reported through this field rather than as a
2349
+ * rejection, which means a caller that only awaits the promise never learns the sweep did nothing.
2350
+ * `factsBefore` and `factsAfter` bracket the run, which is the pair to compare when you want to
2351
+ * know whether the sweep was worth running rather than how many operations it performed.
2352
+ *
2353
+ * @public
2354
+ */
1922
2355
  interface DreamingSweepResult {
1923
2356
  status: "ok" | "skipped" | "error";
1924
2357
  factsBefore: number;
@@ -1950,6 +2383,19 @@ interface OpenMemoryIndexOptions {
1950
2383
  /** Default `"sqlite-vec"`. Set to `"lance"` to opt into LanceDB (peer dep). */
1951
2384
  backend?: "sqlite-vec" | "lance";
1952
2385
  }
2386
+ /**
2387
+ * Memory operations that run OUTSIDE an agent turn.
2388
+ *
2389
+ * Everything here is reachable without `Agent.create({ memory: ... })`, which is the point: opening
2390
+ * an index directly is how a CLI or a maintenance job inspects or rebuilds what the agent will
2391
+ * later read, and the dreaming sweep is maintenance that no `send()` triggers.
2392
+ *
2393
+ * Both operations route through the `@theokit/sdk-memory` peer package when it is installed and
2394
+ * fall back to the in-tree implementation when it is not. The fallback is not a degraded mode —
2395
+ * behaviour and thrown errors match — so consumers do not branch on which path ran.
2396
+ *
2397
+ * @public
2398
+ */
1953
2399
  declare const Memory: {
1954
2400
  /**
1955
2401
  * Open a memory index. Dispatches to SQLite-vec (default, zero deps) or
@@ -2158,7 +2604,16 @@ declare class PermissionPlugin {
2158
2604
  * @public
2159
2605
  */
2160
2606
  declare const SOVEREIGN_ENV_KEYS: readonly ["THEOKIT_HOME", "THEOKIT_AUTH_HOME", "THEOKIT_DIR_NAME", "THEOKIT_TRUSTED_PROVIDERS", "THEOKIT_REDACT_SECRETS", "THEOKIT_OAUTH_TX_SALT"];
2161
- /** @public */
2607
+ /**
2608
+ * The union of {@link SOVEREIGN_ENV_KEYS} entries — the variables a project-scoped `.env` may never
2609
+ * set.
2610
+ *
2611
+ * Derived from the array rather than written out, so adding a key in one place cannot leave the
2612
+ * type behind. Use it where a caller must name one of the protected variables and a plain `string`
2613
+ * would let a typo through silently.
2614
+ *
2615
+ * @public
2616
+ */
2162
2617
  type SovereignEnvKey = (typeof SOVEREIGN_ENV_KEYS)[number];
2163
2618
  /** The mutable shape of `process.env`, narrowed so a caller can pass a plain object in tests. */
2164
2619
  type MutableEnv = Record<string, string | undefined>;
@@ -2208,7 +2663,16 @@ declare function loadProjectEnv(env?: MutableEnv, load?: (() => void) | undefine
2208
2663
  declare class RetentionPolicyError extends TheokitAgentError {
2209
2664
  readonly name = "RetentionPolicyError";
2210
2665
  }
2211
- /** @public */
2666
+ /**
2667
+ * One artifact the caller is considering deleting, described well enough to decide about.
2668
+ *
2669
+ * `id` is only ever compared for equality, so any stable identity works — a path, a session id, an
2670
+ * inode. `live` is the tri-state that carries the whole safety property: `"unknown"` means the
2671
+ * caller could not establish liveness, and it is honoured as a third answer rather than folded into
2672
+ * `false`.
2673
+ *
2674
+ * @public
2675
+ */
2212
2676
  interface ReapableArtifact {
2213
2677
  readonly id: string;
2214
2678
  /** Epoch milliseconds. Compared against an injected `nowMs`, never against a read clock. */
@@ -2220,7 +2684,16 @@ interface ReapableArtifact {
2220
2684
  */
2221
2685
  readonly live: boolean | "unknown";
2222
2686
  }
2223
- /** @public */
2687
+ /**
2688
+ * How long artifacts are kept and how many always survive.
2689
+ *
2690
+ * The two interact as a window plus a FLOOR, not as two independent allowances: `keepLast` rescues
2691
+ * artifacts only when the window and liveness together spared fewer than that many, and rescues
2692
+ * exactly enough to reach the count. Both are refused by `planReaping` rather than clamped when
2693
+ * they are not expressible — see its `@throws`.
2694
+ *
2695
+ * @public
2696
+ */
2224
2697
  interface RetentionPolicy {
2225
2698
  /** Artifacts strictly older than this are candidates. The boundary itself is kept. */
2226
2699
  readonly maxAgeMs: number;
@@ -2237,11 +2710,27 @@ interface RetentionPolicy {
2237
2710
  }
2238
2711
  /** Why an artifact survived. @public */
2239
2712
  type KeepReason = "live" | "within-retention" | "keep-last";
2240
- /** @public */
2713
+ /**
2714
+ * An artifact that survived, carrying the reason it did.
2715
+ *
2716
+ * The reason is the one that spared it FIRST, in the order liveness, then the retention window,
2717
+ * then the floor — so a live artifact inside the window reports `"live"`, and `"keep-last"` only
2718
+ * appears on artifacts that had no reason of their own.
2719
+ *
2720
+ * @public
2721
+ */
2241
2722
  interface KeptArtifact extends ReapableArtifact {
2242
2723
  readonly reason: KeepReason;
2243
2724
  }
2244
- /** @public */
2725
+ /**
2726
+ * The decision, as three disjoint buckets whose union is exactly the input.
2727
+ *
2728
+ * Nothing is deleted by producing one of these — the plan IS the dry run, and executing it is a
2729
+ * separate act on a value you can read first. Delete only what is in `reap`; `undetermined` is not
2730
+ * a smaller `reap`, it is the set nobody could decide about.
2731
+ *
2732
+ * @public
2733
+ */
2245
2734
  interface ReapPlan {
2246
2735
  /** Safe to delete. Everything here was decided, not defaulted. */
2247
2736
  readonly reap: readonly ReapableArtifact[];
@@ -2249,13 +2738,39 @@ interface ReapPlan {
2249
2738
  /** Liveness could not be established. Never deleted, never counted as kept. */
2250
2739
  readonly undetermined: readonly ReapableArtifact[];
2251
2740
  }
2252
- /** @public */
2741
+ /**
2742
+ * Everything `planReaping` needs: the candidates, the policy, and the current time.
2743
+ *
2744
+ * `nowMs` is a parameter rather than a clock read so the same input always produces the same plan —
2745
+ * which is what lets a caller compute a plan, show it, and execute it later against the same
2746
+ * decision instead of a freshly re-derived one.
2747
+ *
2748
+ * @public
2749
+ */
2253
2750
  interface ReapPlanInput {
2254
2751
  readonly artifacts: readonly ReapableArtifact[];
2255
2752
  readonly retention: RetentionPolicy;
2256
2753
  /** Injected so the plan is reproducible and testable; this module never reads a clock. */
2257
2754
  readonly nowMs: number;
2258
2755
  }
2756
+ /**
2757
+ * Sort artifacts into keep, reap, and undetermined — and delete nothing.
2758
+ *
2759
+ * The order of decision is liveness, then the retention window, then the floor. An artifact whose
2760
+ * `live` is `"unknown"` leaves at the first step and is never considered again: it is not counted
2761
+ * toward `keepLast`, so a transient mount failure cannot satisfy "keep my last two" with artifacts
2762
+ * nobody confirmed while the confirmed ones are deleted.
2763
+ *
2764
+ * The window boundary belongs to the safe side. An artifact exactly `maxAgeMs` old is kept, so a
2765
+ * 30-day retention never means 29 depending on clock granularity.
2766
+ *
2767
+ * @returns the three buckets. Their union is exactly the input, each artifact counted once — the
2768
+ * invariant an operator reads the totals against.
2769
+ * @throws RetentionPolicyError when `maxAgeMs` is negative or not finite, or `keepLast` is negative
2770
+ * or not an integer. Nonsense is refused rather than clamped, because a clamped window on this
2771
+ * path deletes data the operator meant to keep.
2772
+ * @public
2773
+ */
2259
2774
  declare function planReaping(input: ReapPlanInput): ReapPlan;
2260
2775
 
2261
2776
  /** The internal JSON-Schema shape the synthetic `output` tool consumes. */
@@ -2370,7 +2885,19 @@ declare class Security {
2370
2885
  *
2371
2886
  * @public
2372
2887
  */
2373
- /** @public */
2888
+ /**
2889
+ * The vocabulary, the layer names, and the values to resolve.
2890
+ *
2891
+ * Two orders matter and they are not the same one. The UNRESTRICTED layers — every key of `layers`
2892
+ * that is neither `override` nor listed in `restricted` — are resolved last-wins in the enumeration
2893
+ * order of the `layers` object. The RESTRICTED layers are applied in the order of the `restricted`
2894
+ * array, regardless of where they sit in `layers`. Put a layer in `restricted` and its position in
2895
+ * that array is what decides when it gets to tighten.
2896
+ *
2897
+ * A layer named in `restricted` but absent from `layers`, or present with `undefined`, is skipped.
2898
+ *
2899
+ * @public
2900
+ */
2374
2901
  interface SecurityFloorInput {
2375
2902
  /**
2376
2903
  * The vocabulary, ordered from most confined to least. Index is permissiveness, so
@@ -2388,6 +2915,23 @@ interface SecurityFloorInput {
2388
2915
  readonly layers: Readonly<Record<string, string | undefined>>;
2389
2916
  }
2390
2917
  /**
2918
+ * Resolve a security-relevant setting so that a lower-trust layer can only tighten it.
2919
+ *
2920
+ * Two paths. When `layers[override]` holds a value, that value is returned VERBATIM and nothing
2921
+ * else is consulted — it is not checked against `permissiveness`, because validating the operator's
2922
+ * own flag belongs to the consumer that owns the vocabulary and the error message. Otherwise a
2923
+ * baseline is taken from the unrestricted layers, and each restricted layer in turn may lower it
2924
+ * and never raise it.
2925
+ *
2926
+ * Two consequences worth knowing before wiring this up. A value in a restricted layer that is not
2927
+ * in `permissiveness` is IGNORED rather than trusted, so a typo in a repository's config leaves the
2928
+ * baseline standing instead of becoming the effective setting. And the ceiling only ever descends:
2929
+ * once one restricted layer tightens, a later one cannot return to the baseline, even though it
2930
+ * could have chosen that value had it come first.
2931
+ *
2932
+ * When no layer supplied a value at all, the answer is `undefined` — the absence is reported rather
2933
+ * than filled in with the most confined member of the vocabulary.
2934
+ *
2391
2935
  * @returns the resolved value, or `undefined` when no layer supplied one.
2392
2936
  * @public
2393
2937
  */
@@ -2418,7 +2962,16 @@ declare function applySecurityFloor(input: SecurityFloorInput): string | undefin
2418
2962
 
2419
2963
  /** Why the destruction was refused. @public */
2420
2964
  type LiveSessionReason = "session-is-live" | "liveness-undetermined";
2421
- /** @public */
2965
+ /**
2966
+ * Raised by `guardSessionDestruction` instead of letting a session be destroyed.
2967
+ *
2968
+ * Read `reason` rather than the message when deciding what to do: `"session-is-live"` is fixed by
2969
+ * closing the other session, `"liveness-undetermined"` is fixed by making the liveness check work
2970
+ * again, and telling a user to close a session when nothing could be read sends them to close
2971
+ * nothing. `sessionId` carries the session the refusal was about.
2972
+ *
2973
+ * @public
2974
+ */
2422
2975
  declare class LiveSessionError extends TheokitAgentError {
2423
2976
  readonly name = "LiveSessionError";
2424
2977
  readonly sessionId: string;
@@ -2614,6 +3167,16 @@ interface TaskHandle {
2614
3167
  * AbortController).
2615
3168
  */
2616
3169
  readonly cancelRequested?: boolean;
3170
+ /**
3171
+ * Why the task was cancelled, when whoever cancelled it said. Free text, written alongside
3172
+ * `cancelledAt` for a `queued` task and alongside `cancelRequested` for a `running` one.
3173
+ *
3174
+ * Absent when no reason was given — an empty string is not a reason, and a default like
3175
+ * "cancelled" would put words in the operator's mouth. `theokit tasks cancel --reason` is what
3176
+ * writes it (#351); nothing in the runtime reads it, because it exists for the human reading the
3177
+ * registry later.
3178
+ */
3179
+ readonly cancelReason?: string;
2617
3180
  }
2618
3181
  /** Query filter for `Task.list`. */
2619
3182
  interface TaskFilter {
@@ -2621,7 +3184,11 @@ interface TaskFilter {
2621
3184
  readonly kind?: TaskKind | readonly TaskKind[];
2622
3185
  readonly submittedAfter?: number;
2623
3186
  readonly submittedBefore?: number;
2624
- /** Defaults to 100. JsonFileTaskStore hard-caps loaded entries at 256 (D364). */
3187
+ /**
3188
+ * Defaults to 100. `JsonFileTaskStore` returns the newest matching tasks first and reads its
3189
+ * whole directory to find them (256 files at a time); page past this limit with
3190
+ * `submittedBefore` (#362).
3191
+ */
2625
3192
  readonly limit?: number;
2626
3193
  }
2627
3194
  /** Options for `Task.submit`. */
@@ -2690,6 +3257,15 @@ interface TaskWorkContext {
2690
3257
  readonly signal: AbortSignal;
2691
3258
  emit(payload: unknown): void;
2692
3259
  }
3260
+ /**
3261
+ * The unit of work handed to {@link Task.submit}.
3262
+ *
3263
+ * It receives the context rather than raw arguments: `ctx.signal` aborts on cancel and should be
3264
+ * observed by anything long-running, and `ctx.emit(payload)` produces a `progress` event for
3265
+ * subscribers. May be synchronous — the return type allows a plain value as well as a promise.
3266
+ *
3267
+ * @public
3268
+ */
2693
3269
  type TaskWorkFn<T> = (ctx: TaskWorkContext) => Promise<T> | T;
2694
3270
  /**
2695
3271
  * Registry-level configuration. May only be applied BEFORE the first
@@ -2701,6 +3277,22 @@ interface TaskConfigureOptions {
2701
3277
  readonly maxConcurrent?: number;
2702
3278
  readonly retentionMs?: number;
2703
3279
  }
3280
+ /**
3281
+ * Static facade over the process-wide task registry — the observability layer for asynchronous
3282
+ * work.
3283
+ *
3284
+ * Not instantiable: the constructor throws, and every operation is a static that delegates to one
3285
+ * in-process singleton. Tasks are an OPT-IN wrapper. `Agent.send`, `Agent.batch`, `Workflow.run`
3286
+ * and `Cron` fires only appear here when submitted with `{ task: true }`; work you submit yourself
3287
+ * goes through `Task.submit`.
3288
+ *
3289
+ * Two ordering constraints bite in practice. `Task.configure` must run before the first `submit` of
3290
+ * the process — a later call logs one line and is otherwise a no-op. And `Task.get` returning
3291
+ * `undefined` does not mean the id never existed: retention evicts terminal tasks, so an id can go
3292
+ * from known to unknown over time.
3293
+ *
3294
+ * @public
3295
+ */
2704
3296
  declare class Task {
2705
3297
  private constructor();
2706
3298
  /**
@@ -2831,7 +3423,16 @@ interface ModelListItem {
2831
3423
  parameters?: ModelParameterDefinition[];
2832
3424
  variants?: ModelVariant[];
2833
3425
  }
2834
- /** @public */
3426
+ /**
3427
+ * Alias of {@link ModelListItem}, used where a model comes back from the Theokit platform rather
3428
+ * than from a catalog listing.
3429
+ *
3430
+ * It is the SAME type, not a narrowed one — the alias exists so platform-facing signatures read in
3431
+ * platform vocabulary alongside `SDKRepository` and `SDKUser`, and a value of either name is
3432
+ * assignable to the other.
3433
+ *
3434
+ * @public
3435
+ */
2835
3436
  type SDKModel = ModelListItem;
2836
3437
  /**
2837
3438
  * GitHub repository connected to the team. Cloud-only.
@@ -2943,17 +3544,56 @@ declare class Theokit {
2943
3544
  * @public
2944
3545
  */
2945
3546
 
2946
- /** @public */
3547
+ /**
3548
+ * Symbol-keyed on purpose. THAT is what keeps the declaration out of a prompt: `Object.keys` and
3549
+ * `JSON.stringify` both ignore symbol keys, so a tool serialised on its way to the model carries
3550
+ * none of it. A string key would also risk colliding with a property the tool already has.
3551
+ *
3552
+ * Exported because the `@public` `WithBlastRadius<T>` below uses it as a COMPUTED
3553
+ * KEY. A computed key is part of the type it keys, so the emitted declaration
3554
+ * names this const — and a name the declaration file does not carry is a broken
3555
+ * reference (#335). `Symbol.for` keeps it a registry symbol, so an exported
3556
+ * binding does not weaken the property-hiding this comment describes: the value
3557
+ * was always retrievable by any code that knows the string.
3558
+ *
3559
+ * @public
3560
+ */
3561
+ declare const DECLARED: unique symbol;
3562
+ /**
3563
+ * A tool that may carry a blast-radius declaration under {@link DECLARED}.
3564
+ *
3565
+ * The property is OPTIONAL in the type, so a plain tool is assignable to it and the type alone
3566
+ * never proves a declaration was made. `describeAction` is what tells the two apart at runtime.
3567
+ *
3568
+ * @public
3569
+ */
2947
3570
  type WithBlastRadius<T> = T & {
2948
3571
  readonly [DECLARED]?: DeclaredAction;
2949
3572
  };
2950
3573
  /**
3574
+ * Declare what a tool reaches, for the approval layer rather than for the model.
3575
+ *
3576
+ * This MUTATES `tool` — it defines a symbol-keyed property on the object it was given and hands
3577
+ * the same reference back, so every existing reference to that tool sees the declaration too.
3578
+ * Calling it again on the same tool replaces the previous declaration; the property is
3579
+ * `configurable`, so re-declaring never throws.
3580
+ *
3581
+ * The declaration is invisible to `Object.keys` and `JSON.stringify` because the key is a symbol,
3582
+ * which is what keeps it out of anything serialised into a prompt.
3583
+ *
2951
3584
  * @returns the same tool, with its action declared. The tool is not otherwise altered — the model
2952
3585
  * must see exactly what it saw before.
2953
3586
  * @public
2954
3587
  */
2955
3588
  declare function withBlastRadius<T extends object>(tool: T, action: DeclaredAction): WithBlastRadius<T>;
2956
3589
  /**
3590
+ * Read back the action a tool declared, if any.
3591
+ *
3592
+ * This is how an approval layer obtains the `action` for `evaluateBlastRadius`. An `undefined`
3593
+ * result means nobody has reviewed this tool's reach, which is a different fact from a tool that
3594
+ * declared a narrow scope — decide what to do with the unreviewed case explicitly rather than
3595
+ * treating it as harmless.
3596
+ *
2957
3597
  * @returns the declared action, or `undefined` when the tool never declared one — NOT an empty
2958
3598
  * action. "Never declared" and "declared as reaching nothing" are different facts, and collapsing
2959
3599
  * them is how an unreviewed tool passes as harmless.
@@ -3102,11 +3742,27 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
3102
3742
  *
3103
3743
  * @public
3104
3744
  */
3105
- /** @public */
3745
+ /**
3746
+ * Whether a project directory may switch anything on.
3747
+ *
3748
+ * There is no middle level on purpose: `untrusted` means every declared capability is off, not
3749
+ * "some are off". A product that wants a partial grant expresses it by declaring fewer capabilities
3750
+ * for that call, not by inventing a third level here.
3751
+ *
3752
+ * @public
3753
+ */
3106
3754
  type TrustLevel = "trusted" | "untrusted";
3107
3755
  /** Where the decision came from. @public */
3108
3756
  type TrustSource = "env" | "store" | "default";
3109
- /** @public */
3757
+ /**
3758
+ * What the decision is made from: the capability vocabulary, a way to read the operator's record,
3759
+ * and an optional blanket override.
3760
+ *
3761
+ * `capabilities` is load-bearing rather than descriptive — the returned `allows` is built from
3762
+ * exactly this list, so a capability missing from it is a capability nothing gates.
3763
+ *
3764
+ * @public
3765
+ */
3110
3766
  interface TrustPostureInput<K extends string> {
3111
3767
  /**
3112
3768
  * Every capability a repository could switch on. `allows` is built from exactly this list — the
@@ -3125,14 +3781,36 @@ interface TrustPostureInput<K extends string> {
3125
3781
  */
3126
3782
  readonly envOverride?: boolean;
3127
3783
  }
3128
- /** @public */
3784
+ /**
3785
+ * The decision: the level, where it came from, and one boolean per declared capability.
3786
+ *
3787
+ * `allows` has exactly the keys of the `capabilities` list it was built from, so reading a
3788
+ * capability the caller never declared is a type error rather than a silent `undefined` that a
3789
+ * consumer would read as "not allowed".
3790
+ *
3791
+ * @public
3792
+ */
3129
3793
  interface TrustPosture<K extends string> {
3130
3794
  readonly level: TrustLevel;
3131
3795
  readonly source: TrustSource;
3132
3796
  /** One entry per declared capability. Every value is `false` when the level is untrusted. */
3133
3797
  readonly allows: Readonly<Record<K, boolean>>;
3134
3798
  }
3135
- /** @public */
3799
+ /**
3800
+ * Decide what a project directory is allowed to switch on.
3801
+ *
3802
+ * Precedence: `envOverride === true` grants trust and SHORT-CIRCUITS — `isTrusted` is not called at
3803
+ * all, which matters because it may touch the filesystem. Otherwise `isTrusted()` is called exactly
3804
+ * once and its answer decides. `envOverride === false` is not a denial: it falls through to the
3805
+ * store like `undefined` does, so an unset or explicitly-off environment switch can never revoke a
3806
+ * directory the operator recorded as trusted.
3807
+ *
3808
+ * Every entry of `allows` is `false` whenever the level is untrusted, and the entries are generated
3809
+ * from `capabilities` rather than supplied per capability — that is what makes "nothing was left
3810
+ * ungated" a property of the call instead of a habit of the caller.
3811
+ *
3812
+ * @public
3813
+ */
3136
3814
  declare function resolveTrustPosture<K extends string>(input: TrustPostureInput<K>): TrustPosture<K>;
3137
3815
 
3138
3816
  /**
@@ -3187,7 +3865,19 @@ interface WiredEntity {
3187
3865
  */
3188
3866
  readonly suppressedByTrust: boolean;
3189
3867
  }
3190
- /** @public */
3868
+ /**
3869
+ * The two halves of the observation: the gate that was applied, and what was handed to the builder.
3870
+ *
3871
+ * `requested` drives the shape of the record — the result has exactly its keys — while `posture`
3872
+ * only has to contain a gate for each of them. A posture that gates MORE than `requested` covers is
3873
+ * fine and normal; a posture that gates FEWER is refused, see `recordWiring`.
3874
+ *
3875
+ * Pass the values at the moment they go to the builder. Re-deriving them from configuration
3876
+ * afterwards would defeat the point: config is what was asked for, and the disagreement with what
3877
+ * was wired is the only thing this records.
3878
+ *
3879
+ * @public
3880
+ */
3191
3881
  interface WiringRecordInput<K extends string> {
3192
3882
  /**
3193
3883
  * The gate. Typically the output of `resolveTrustPosture`, which is what makes the name
@@ -3204,11 +3894,25 @@ interface WiringRecordInput<K extends string> {
3204
3894
  readonly requested: Readonly<Record<K, readonly string[]>>;
3205
3895
  }
3206
3896
  /**
3897
+ * Record what a build actually wired, per capability.
3898
+ *
3899
+ * For each key of `requested`: `active` is a copy of the requested names when the posture allows
3900
+ * that capability and an empty array when it does not, `requested` is always a copy of what was
3901
+ * asked for, and `suppressedByTrust` is true only when the gate emptied a NON-EMPTY request. A
3902
+ * withheld capability that requested nothing reports `false`, because a flag that fires when
3903
+ * nothing happened is a flag readers learn to ignore.
3904
+ *
3905
+ * Pure and synchronous — it performs no I/O, which is what makes "this is not a second read of the
3906
+ * configuration" checkable rather than promised.
3907
+ *
3207
3908
  * @returns one entry per key of `requested`, each a snapshot rather than a view of the caller's
3208
3909
  * arrays — the record is read long after the build, and aliasing would make it answer with what
3209
3910
  * the process holds now instead of with what was wired.
3911
+ * @throws UngatedCapabilityError when a key of `requested` has no entry in `posture.allows`. Absent
3912
+ * is not read as denied: reporting a capability nobody gates as suppressed would send the reader
3913
+ * looking for a trust setting that does not exist.
3210
3914
  * @public
3211
3915
  */
3212
3916
  declare function recordWiring<K extends string>(input: WiringRecordInput<K>): Readonly<Record<K, WiredEntity>>;
3213
3917
 
3214
- export { Agent, AgentBuilder, AgentDefinition, AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type ApprovalDecision, type ApprovalInput, type ApprovalMode, type ApprovalOutcome, type ApprovalReason, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, type BlastRadiusDecision, type BlastRadiusInput, type BlastRadiusOutcome, type BlastRadiusReason, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, BudgetTracker, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, type CredentialInput, type CredentialReport, CustomTool, type DeclaredAction, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, type EnvOptOut, type EnvReachabilityAudit, type EnvReachabilityInput, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, JudgeResult, type KeepReason, type KeptArtifact, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, LiveAgentRegistry, LiveSessionError, type LiveSessionReason, LocalOptions, McpServerConfig, Memory, MemoryId, MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, PermissionEngine, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, Plugin, PluginsSettings, PreToolCallDecision, Processor, Provider, ProviderProfile, ProviderRoutingSettings, type ReapPlan, type ReapPlanInput, type ReapableArtifact, type RetentionPolicy, RetentionPolicyError, Run, RunEventSink, RunResult, SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, UsageAccumulator, type WiredEntity, type WiringRecordInput, type WithBlastRadius, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, decideApproval, describeAction, describeCredential, estimateTokens, evaluateBlastRadius, extractRawId, foldLayers, getPricingEntry, guardSessionDestruction, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, planReaping, preflightCheck, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withBlastRadius, withCwdMutex };
3918
+ export { Agent, AgentBuilder, AgentDefinition, type AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type ApprovalDecision, type ApprovalInput, type ApprovalMode, type ApprovalOutcome, type ApprovalReason, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, type BlastRadiusDecision, type BlastRadiusInput, type BlastRadiusOutcome, type BlastRadiusReason, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, type BudgetTracker, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, type CredentialInput, type CredentialReport, type CustomTool, type DeclaredAction, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, type EnvOptOut, type EnvReachabilityAudit, type EnvReachabilityInput, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, type JudgeResult, type KeepReason, type KeptArtifact, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, type LiveAgentRegistry, LiveSessionError, type LiveSessionReason, LocalOptions, McpServerConfig, Memory, MemoryId, type MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, type OTelSpan, PermissionEngine, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, Plugin, PluginsSettings, PreToolCallDecision, type Processor, Provider, type ProviderProfile, ProviderRoutingSettings, type ReapPlan, type ReapPlanInput, type ReapableArtifact, type RetentionPolicy, RetentionPolicyError, Run, RunEventSink, RunResult, type SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, type TelemetryHandle, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, type ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, UsageAccumulator, type WiredEntity, type WiringRecordInput, type WithBlastRadius, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, decideApproval, describeAction, describeCredential, estimateTokens, evaluateBlastRadius, extractRawId, foldLayers, getPricingEntry, guardSessionDestruction, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, planReaping, preflightCheck, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withBlastRadius, withCwdMutex };