@theokit/sdk 4.53.1 → 4.55.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 (694) hide show
  1. package/CHANGELOG.md +1184 -0
  2. package/README.md +9 -4
  3. package/dist/a2a/agent-mailbox.d.cts +27 -0
  4. package/dist/a2a/agent-mailbox.d.ts +27 -0
  5. package/dist/a2a/index.cjs +9 -4
  6. package/dist/a2a/index.cjs.map +1 -1
  7. package/dist/a2a/index.js +7 -2
  8. package/dist/a2a/index.js.map +1 -1
  9. package/dist/a2a/message-bus.d.cts +39 -0
  10. package/dist/a2a/message-bus.d.ts +39 -0
  11. package/dist/a2a/subagent.d.cts +68 -7
  12. package/dist/a2a/subagent.d.ts +68 -7
  13. package/dist/a2a/types.d.cts +26 -0
  14. package/dist/a2a/types.d.ts +26 -0
  15. package/dist/{agent-B9HXlwID.d.ts → agent-D3Xr_-6Z.d.cts} +245 -850
  16. package/dist/{agent-nLqeXKIX.d.cts → agent-DIu6FooJ.d.ts} +245 -850
  17. package/dist/agent-HDEVVUBS.js +52 -0
  18. package/dist/{agent-FFVV4U5N.js.map → agent-HDEVVUBS.js.map} +1 -1
  19. package/dist/agent-R2HOJFZJ.cjs +61 -0
  20. package/dist/{agent-YLAHVHEH.cjs.map → agent-R2HOJFZJ.cjs.map} +1 -1
  21. package/dist/agent-builder.d.ts +19 -0
  22. package/dist/agent-session-store-P6V3FINW.js +7 -0
  23. package/dist/{agent-session-store-TNCGL5RN.js.map → agent-session-store-P6V3FINW.js.map} +1 -1
  24. package/dist/agent-session-store-ZJ3JSRS4.cjs +24 -0
  25. package/dist/{agent-session-store-DUGBAX5V.cjs.map → agent-session-store-ZJ3JSRS4.cjs.map} +1 -1
  26. package/dist/agent.d.ts +9 -6
  27. package/dist/auth/index.cjs +52 -35
  28. package/dist/auth/index.cjs.map +1 -1
  29. package/dist/auth/index.js +26 -9
  30. package/dist/auth/index.js.map +1 -1
  31. package/dist/{batch-UPKN4SG6.js → batch-2TGJMNCJ.js} +14 -13
  32. package/dist/batch-2TGJMNCJ.js.map +1 -0
  33. package/dist/{batch-ZEFN5SO7.cjs → batch-ND32UKZS.cjs} +31 -30
  34. package/dist/batch-ND32UKZS.cjs.map +1 -0
  35. package/dist/{chunk-TTJ54H3E.cjs → chunk-2ADR2GSO.cjs} +8 -8
  36. package/dist/chunk-2ADR2GSO.cjs.map +1 -0
  37. package/dist/chunk-2BDH744Z.js +15 -0
  38. package/dist/chunk-2BDH744Z.js.map +1 -0
  39. package/dist/{chunk-VGPXHHF3.cjs → chunk-2C72DXQF.cjs} +63 -27
  40. package/dist/chunk-2C72DXQF.cjs.map +1 -0
  41. package/dist/{chunk-4Q4K4WB5.js → chunk-2D34UTDC.js} +20 -4
  42. package/dist/chunk-2D34UTDC.js.map +1 -0
  43. package/dist/{chunk-UFIXH26P.js → chunk-2QKTVKH3.js} +4 -4
  44. package/dist/{chunk-UFIXH26P.js.map → chunk-2QKTVKH3.js.map} +1 -1
  45. package/dist/{chunk-GBBDINFK.js → chunk-3E77SX4H.js} +4 -4
  46. package/dist/{chunk-GBBDINFK.js.map → chunk-3E77SX4H.js.map} +1 -1
  47. package/dist/{chunk-VYHJZVL5.cjs → chunk-3EE6LVWT.cjs} +2 -2
  48. package/dist/chunk-3EE6LVWT.cjs.map +1 -0
  49. package/dist/{chunk-5NBUH3NO.js → chunk-3OR54XG4.js} +2 -2
  50. package/dist/{chunk-C6Y6CWYD.cjs.map → chunk-3OR54XG4.js.map} +1 -1
  51. package/dist/{chunk-ZN2DGEY3.cjs → chunk-3YJNUKYN.cjs} +15 -15
  52. package/dist/{chunk-ZN2DGEY3.cjs.map → chunk-3YJNUKYN.cjs.map} +1 -1
  53. package/dist/{chunk-POWRZSK4.js → chunk-44JAAH4X.js} +3 -3
  54. package/dist/{chunk-POWRZSK4.js.map → chunk-44JAAH4X.js.map} +1 -1
  55. package/dist/{chunk-SSDD676S.js → chunk-44MBDIHG.js} +4 -4
  56. package/dist/{chunk-SSDD676S.js.map → chunk-44MBDIHG.js.map} +1 -1
  57. package/dist/{chunk-OY7O3Q6R.js → chunk-4ERPXIVB.js} +5 -5
  58. package/dist/{chunk-OY7O3Q6R.js.map → chunk-4ERPXIVB.js.map} +1 -1
  59. package/dist/{chunk-3BK6YR5P.cjs → chunk-4I55V454.cjs} +4 -4
  60. package/dist/{chunk-3BK6YR5P.cjs.map → chunk-4I55V454.cjs.map} +1 -1
  61. package/dist/{chunk-B4YA6BRS.cjs → chunk-4O5TGQBW.cjs} +30 -7
  62. package/dist/chunk-4O5TGQBW.cjs.map +1 -0
  63. package/dist/{chunk-4JBHSLQO.cjs → chunk-4OTIXDMU.cjs} +2 -2
  64. package/dist/{chunk-4JBHSLQO.cjs.map → chunk-4OTIXDMU.cjs.map} +1 -1
  65. package/dist/{chunk-C6Y6CWYD.cjs → chunk-52NKC5HT.cjs} +2 -2
  66. package/dist/chunk-52NKC5HT.cjs.map +1 -0
  67. package/dist/{chunk-665SFFFR.cjs → chunk-53CBTBWO.cjs} +11 -11
  68. package/dist/{chunk-665SFFFR.cjs.map → chunk-53CBTBWO.cjs.map} +1 -1
  69. package/dist/{chunk-FFM3SJTQ.js → chunk-5JLFFPCH.js} +4 -4
  70. package/dist/{chunk-FFM3SJTQ.js.map → chunk-5JLFFPCH.js.map} +1 -1
  71. package/dist/{chunk-34XOCZJO.js → chunk-5PHVENFV.js} +3 -3
  72. package/dist/chunk-5PHVENFV.js.map +1 -0
  73. package/dist/{chunk-BDTVFIPB.cjs → chunk-5UOVYM3P.cjs} +36 -31
  74. package/dist/chunk-5UOVYM3P.cjs.map +1 -0
  75. package/dist/{chunk-VF7X6HDR.cjs → chunk-5USCYPPI.cjs} +15 -15
  76. package/dist/{chunk-VF7X6HDR.cjs.map → chunk-5USCYPPI.cjs.map} +1 -1
  77. package/dist/chunk-6HTXPPHK.cjs +18 -0
  78. package/dist/chunk-6HTXPPHK.cjs.map +1 -0
  79. package/dist/{chunk-D24WJWN2.js → chunk-AEOZTXVW.js} +3 -3
  80. package/dist/{chunk-D24WJWN2.js.map → chunk-AEOZTXVW.js.map} +1 -1
  81. package/dist/{chunk-DGOG5NXR.js → chunk-AG5JPQIY.js} +3 -3
  82. package/dist/{chunk-DGOG5NXR.js.map → chunk-AG5JPQIY.js.map} +1 -1
  83. package/dist/{chunk-BFYGJGC5.js → chunk-AQLGBKNT.js} +3 -3
  84. package/dist/chunk-AQLGBKNT.js.map +1 -0
  85. package/dist/{chunk-7W7ZWMLQ.js → chunk-AWO27VRZ.js} +3 -3
  86. package/dist/chunk-AWO27VRZ.js.map +1 -0
  87. package/dist/{chunk-VYCKUKPA.cjs → chunk-B2J4ZMZL.cjs} +3 -2
  88. package/dist/chunk-B2J4ZMZL.cjs.map +1 -0
  89. package/dist/{chunk-BERBYXFH.js → chunk-BMAZLQQ4.js} +3 -3
  90. package/dist/{chunk-BERBYXFH.js.map → chunk-BMAZLQQ4.js.map} +1 -1
  91. package/dist/{chunk-5YKNEMXR.cjs → chunk-BVZW2B5V.cjs} +4 -4
  92. package/dist/chunk-BVZW2B5V.cjs.map +1 -0
  93. package/dist/{chunk-MSFLYJDY.js → chunk-CQ2TQ32Y.js} +4 -4
  94. package/dist/chunk-CQ2TQ32Y.js.map +1 -0
  95. package/dist/{chunk-C5DEO6OI.cjs → chunk-CQGYNZ3K.cjs} +4 -4
  96. package/dist/{chunk-C5DEO6OI.cjs.map → chunk-CQGYNZ3K.cjs.map} +1 -1
  97. package/dist/{chunk-D75S2X6I.cjs → chunk-CTCGWIUD.cjs} +5 -5
  98. package/dist/{chunk-D75S2X6I.cjs.map → chunk-CTCGWIUD.cjs.map} +1 -1
  99. package/dist/{chunk-NZL4BNFQ.js → chunk-CV7XMBHP.js} +4 -4
  100. package/dist/chunk-CV7XMBHP.js.map +1 -0
  101. package/dist/{chunk-SEL2ZQMT.js → chunk-DAPSQZT4.js} +15 -10
  102. package/dist/chunk-DAPSQZT4.js.map +1 -0
  103. package/dist/{chunk-SVO5WPZX.cjs → chunk-DQKERTND.cjs} +11 -11
  104. package/dist/{chunk-SVO5WPZX.cjs.map → chunk-DQKERTND.cjs.map} +1 -1
  105. package/dist/{chunk-N5CR3TJZ.js → chunk-DZBSJX6J.js} +4 -4
  106. package/dist/{chunk-N5CR3TJZ.js.map → chunk-DZBSJX6J.js.map} +1 -1
  107. package/dist/{chunk-RAHSWE5C.cjs → chunk-EI2Q7SJ5.cjs} +12 -12
  108. package/dist/chunk-EI2Q7SJ5.cjs.map +1 -0
  109. package/dist/{chunk-UCFONJBG.js → chunk-EPSICJLZ.js} +2 -2
  110. package/dist/{chunk-UCFONJBG.js.map → chunk-EPSICJLZ.js.map} +1 -1
  111. package/dist/{chunk-3X6PM7DU.cjs → chunk-F3YZMOAU.cjs} +8 -8
  112. package/dist/{chunk-3X6PM7DU.cjs.map → chunk-F3YZMOAU.cjs.map} +1 -1
  113. package/dist/{chunk-F77UENR6.cjs → chunk-F5WMX4EA.cjs} +586 -398
  114. package/dist/chunk-F5WMX4EA.cjs.map +1 -0
  115. package/dist/{chunk-HE4BIAOS.js → chunk-F7AQV62G.js} +5 -4
  116. package/dist/chunk-F7AQV62G.js.map +1 -0
  117. package/dist/{chunk-2RW7K6FN.cjs → chunk-GHX4P3V2.cjs} +2 -2
  118. package/dist/chunk-GHX4P3V2.cjs.map +1 -0
  119. package/dist/{chunk-B6HOIWQ6.js → chunk-GJ6RK75E.js} +5 -5
  120. package/dist/chunk-GJ6RK75E.js.map +1 -0
  121. package/dist/{chunk-FOXKFTVZ.cjs → chunk-GNT35C5U.cjs} +13 -13
  122. package/dist/chunk-GNT35C5U.cjs.map +1 -0
  123. package/dist/{chunk-4NAKHID5.js → chunk-GTKFV7O5.js} +2 -2
  124. package/dist/chunk-GTKFV7O5.js.map +1 -0
  125. package/dist/{chunk-ELKO4ZLR.cjs → chunk-GWC3HADL.cjs} +4 -4
  126. package/dist/{chunk-ELKO4ZLR.cjs.map → chunk-GWC3HADL.cjs.map} +1 -1
  127. package/dist/{chunk-OXNYIMZZ.js → chunk-H73MEMQB.js} +2 -2
  128. package/dist/chunk-H73MEMQB.js.map +1 -0
  129. package/dist/{chunk-E7FJOO4G.cjs → chunk-HJBMA5MB.cjs} +11 -11
  130. package/dist/{chunk-E7FJOO4G.cjs.map → chunk-HJBMA5MB.cjs.map} +1 -1
  131. package/dist/{chunk-2FYEVT2B.cjs → chunk-HLPSLDGL.cjs} +275 -160
  132. package/dist/chunk-HLPSLDGL.cjs.map +1 -0
  133. package/dist/{chunk-VW6M4B3Z.cjs → chunk-HY57ULY2.cjs} +5 -5
  134. package/dist/{chunk-VW6M4B3Z.cjs.map → chunk-HY57ULY2.cjs.map} +1 -1
  135. package/dist/{chunk-CAH3G4IS.js → chunk-HY66GLM6.js} +2 -2
  136. package/dist/chunk-HY66GLM6.js.map +1 -0
  137. package/dist/{chunk-G3JWXOGY.js → chunk-I5BE5M5L.js} +310 -122
  138. package/dist/chunk-I5BE5M5L.js.map +1 -0
  139. package/dist/{chunk-C4H6PB5J.cjs → chunk-I6TGFUCO.cjs} +4 -4
  140. package/dist/{chunk-C4H6PB5J.cjs.map → chunk-I6TGFUCO.cjs.map} +1 -1
  141. package/dist/{chunk-U4UJHOSH.js → chunk-IDCKSLYH.js} +3 -3
  142. package/dist/{chunk-U4UJHOSH.js.map → chunk-IDCKSLYH.js.map} +1 -1
  143. package/dist/{chunk-WQ53UQL4.cjs → chunk-ILCGLTSA.cjs} +4 -4
  144. package/dist/{chunk-WQ53UQL4.cjs.map → chunk-ILCGLTSA.cjs.map} +1 -1
  145. package/dist/{chunk-QBTVATSF.cjs → chunk-ITSSOVOB.cjs} +44 -47
  146. package/dist/chunk-ITSSOVOB.cjs.map +1 -0
  147. package/dist/{chunk-V6HWJQQV.js → chunk-IVNNSANC.js} +27 -30
  148. package/dist/chunk-IVNNSANC.js.map +1 -0
  149. package/dist/{chunk-SZHU7A5B.cjs → chunk-IWBGCBR6.cjs} +4 -4
  150. package/dist/{chunk-SZHU7A5B.cjs.map → chunk-IWBGCBR6.cjs.map} +1 -1
  151. package/dist/{chunk-Q4RESANI.cjs → chunk-J24VJOH3.cjs} +20 -4
  152. package/dist/chunk-J24VJOH3.cjs.map +1 -0
  153. package/dist/{chunk-Y4AXQOT4.cjs → chunk-JHPGF3FP.cjs} +8 -8
  154. package/dist/{chunk-Y4AXQOT4.cjs.map → chunk-JHPGF3FP.cjs.map} +1 -1
  155. package/dist/{chunk-BM6N4KHO.cjs → chunk-JTB5Q42C.cjs} +6 -22
  156. package/dist/chunk-JTB5Q42C.cjs.map +1 -0
  157. package/dist/{chunk-LPVIRJVF.cjs → chunk-K3FW2XZD.cjs} +9 -9
  158. package/dist/{chunk-LPVIRJVF.cjs.map → chunk-K3FW2XZD.cjs.map} +1 -1
  159. package/dist/{chunk-LS3LMQ23.js → chunk-MVAPK2BX.js} +162 -49
  160. package/dist/chunk-MVAPK2BX.js.map +1 -0
  161. package/dist/{chunk-XPR366DL.cjs → chunk-NGESVVJN.cjs} +17 -17
  162. package/dist/chunk-NGESVVJN.cjs.map +1 -0
  163. package/dist/{chunk-VUKQL3L2.cjs → chunk-NIRE5CNO.cjs} +20 -13
  164. package/dist/chunk-NIRE5CNO.cjs.map +1 -0
  165. package/dist/{chunk-VC5ABJXC.js → chunk-NLTVXLGT.js} +3 -3
  166. package/dist/{chunk-VC5ABJXC.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-R5YZACGK.js → chunk-OC4NTGMN.js} +3 -3
  170. package/dist/{chunk-R5YZACGK.js.map → chunk-OC4NTGMN.js.map} +1 -1
  171. package/dist/{chunk-GOVJO4YE.js → chunk-OHBIUXKM.js} +6 -6
  172. package/dist/chunk-OHBIUXKM.js.map +1 -0
  173. package/dist/{chunk-FPYT5WZP.cjs → chunk-P6A3M6VD.cjs} +10 -10
  174. package/dist/{chunk-FPYT5WZP.cjs.map → chunk-P6A3M6VD.cjs.map} +1 -1
  175. package/dist/{chunk-OKLYRPKL.cjs → chunk-Q47R5E2X.cjs} +8 -8
  176. package/dist/chunk-Q47R5E2X.cjs.map +1 -0
  177. package/dist/{chunk-HSQ5Q3I5.js → chunk-Q4CMI2LP.js} +12 -5
  178. package/dist/chunk-Q4CMI2LP.js.map +1 -0
  179. package/dist/{chunk-2XLKLVVR.js → chunk-Q5EWJPRY.js} +2 -2
  180. package/dist/chunk-Q5EWJPRY.js.map +1 -0
  181. package/dist/{chunk-SK4QLUBK.js → chunk-QARJGQSA.js} +16 -7
  182. package/dist/chunk-QARJGQSA.js.map +1 -0
  183. package/dist/{chunk-CZ2GKKYL.cjs → chunk-QDED6YO6.cjs} +5 -5
  184. package/dist/{chunk-CZ2GKKYL.cjs.map → chunk-QDED6YO6.cjs.map} +1 -1
  185. package/dist/{chunk-VK7MAV65.cjs → chunk-QKLOP4VC.cjs} +2 -2
  186. package/dist/{chunk-VK7MAV65.cjs.map → chunk-QKLOP4VC.cjs.map} +1 -1
  187. package/dist/{chunk-FIOCJYLA.js → chunk-QRSUA2CV.js} +3 -3
  188. package/dist/{chunk-FIOCJYLA.js.map → chunk-QRSUA2CV.js.map} +1 -1
  189. package/dist/{chunk-ZT57WTUJ.cjs → chunk-R3UPQFKK.cjs} +21 -12
  190. package/dist/chunk-R3UPQFKK.cjs.map +1 -0
  191. package/dist/{chunk-X2FR4OIT.js → chunk-R7WIIPUR.js} +2 -2
  192. package/dist/chunk-R7WIIPUR.js.map +1 -0
  193. package/dist/{chunk-RP5HQVLD.js → chunk-RNB4APBZ.js} +30 -7
  194. package/dist/chunk-RNB4APBZ.js.map +1 -0
  195. package/dist/{chunk-GD63JPGC.cjs → chunk-ROYPRJH4.cjs} +9 -9
  196. package/dist/{chunk-GD63JPGC.cjs.map → chunk-ROYPRJH4.cjs.map} +1 -1
  197. package/dist/{chunk-V26QVGUG.js → chunk-RUDY2GTT.js} +59 -23
  198. package/dist/chunk-RUDY2GTT.js.map +1 -0
  199. package/dist/{chunk-JIQRXKTA.cjs → chunk-SKXBJ2NU.cjs} +7 -7
  200. package/dist/chunk-SKXBJ2NU.cjs.map +1 -0
  201. package/dist/{chunk-XROIW6BH.js → chunk-SUKXXLWD.js} +6 -6
  202. package/dist/chunk-SUKXXLWD.js.map +1 -0
  203. package/dist/{chunk-LTSTGCL6.js → chunk-T73NA43R.js} +3 -3
  204. package/dist/{chunk-LTSTGCL6.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-5F5NWKPN.js → chunk-T7XEKOVW.js} +5 -20
  208. package/dist/chunk-T7XEKOVW.js.map +1 -0
  209. package/dist/{chunk-HAWE74GQ.cjs → chunk-U2AC6JUP.cjs} +8 -8
  210. package/dist/chunk-U2AC6JUP.cjs.map +1 -0
  211. package/dist/{chunk-3WVMJY7F.js → chunk-UC3HT2S4.js} +3 -3
  212. package/dist/{chunk-3WVMJY7F.js.map → chunk-UC3HT2S4.js.map} +1 -1
  213. package/dist/{chunk-PBZ7HMBP.js → chunk-UPRJR6IP.js} +4 -4
  214. package/dist/chunk-UPRJR6IP.js.map +1 -0
  215. package/dist/{chunk-3V7UJLQT.js → chunk-UQGQFBRL.js} +3 -3
  216. package/dist/chunk-UQGQFBRL.js.map +1 -0
  217. package/dist/{chunk-2D43RD5D.cjs → chunk-V2UUGUY4.cjs} +27 -27
  218. package/dist/chunk-V2UUGUY4.cjs.map +1 -0
  219. package/dist/{chunk-6AZDM6LK.js → chunk-VF7EWVDG.js} +3 -3
  220. package/dist/{chunk-6AZDM6LK.js.map → chunk-VF7EWVDG.js.map} +1 -1
  221. package/dist/{chunk-PNVDQL5Y.cjs → chunk-VTYY7XL5.cjs} +2 -2
  222. package/dist/chunk-VTYY7XL5.cjs.map +1 -0
  223. package/dist/{chunk-Y4I4EQFK.js → chunk-WKRSH2VR.js} +3 -3
  224. package/dist/{chunk-Y4I4EQFK.js.map → chunk-WKRSH2VR.js.map} +1 -1
  225. package/dist/{chunk-4QEC4CCS.js → chunk-WTMU7J4U.js} +2 -2
  226. package/dist/{chunk-4QEC4CCS.js.map → chunk-WTMU7J4U.js.map} +1 -1
  227. package/dist/{chunk-KSWHTR54.js → chunk-XN7NOENA.js} +6 -6
  228. package/dist/chunk-XN7NOENA.js.map +1 -0
  229. package/dist/{chunk-ADLLFY3H.cjs → chunk-XSX2UU6Y.cjs} +10 -9
  230. package/dist/chunk-XSX2UU6Y.cjs.map +1 -0
  231. package/dist/{chunk-LD4MOBFX.js → chunk-XV4IZNV4.js} +9 -9
  232. package/dist/chunk-XV4IZNV4.js.map +1 -0
  233. package/dist/{chunk-EZ2YEF4F.cjs → chunk-XWL6O3SW.cjs} +4 -4
  234. package/dist/chunk-XWL6O3SW.cjs.map +1 -0
  235. package/dist/{chunk-PGP7IOJ2.js → chunk-YMA4S2WO.js} +4 -4
  236. package/dist/{chunk-PGP7IOJ2.js.map → chunk-YMA4S2WO.js.map} +1 -1
  237. package/dist/{chunk-OUOXM36O.cjs → chunk-YPJ5NH5N.cjs} +11 -11
  238. package/dist/chunk-YPJ5NH5N.cjs.map +1 -0
  239. package/dist/{chunk-YLQQX5W2.cjs → chunk-ZF2LDKQQ.cjs} +2 -2
  240. package/dist/chunk-ZF2LDKQQ.cjs.map +1 -0
  241. package/dist/{chunk-L5YO6PWL.cjs → chunk-ZNW6V4Y6.cjs} +2 -2
  242. package/dist/chunk-ZNW6V4Y6.cjs.map +1 -0
  243. package/dist/client/index.cjs.map +1 -1
  244. package/dist/client/index.js.map +1 -1
  245. package/dist/client/theokit-client.d.cts +36 -0
  246. package/dist/client/theokit-client.d.ts +36 -0
  247. package/dist/client/types.d.cts +30 -0
  248. package/dist/client/types.d.ts +30 -0
  249. package/dist/compact-session-FUJDVF7B.js +22 -0
  250. package/dist/{compact-session-4MNKNMO2.js.map → compact-session-FUJDVF7B.js.map} +1 -1
  251. package/dist/compact-session-LEWF554G.cjs +59 -0
  252. package/dist/{compact-session-EPFBQ46Z.cjs.map → compact-session-LEWF554G.cjs.map} +1 -1
  253. package/dist/compaction.cjs +17 -16
  254. package/dist/compaction.d.cts +13 -13
  255. package/dist/compaction.d.ts +13 -13
  256. package/dist/compaction.js +4 -3
  257. package/dist/concurrency.cjs +7 -6
  258. package/dist/concurrency.cjs.map +1 -1
  259. package/dist/concurrency.js +5 -4
  260. package/dist/concurrency.js.map +1 -1
  261. package/dist/context/index.cjs +7 -7
  262. package/dist/context/index.js +3 -3
  263. package/dist/context-FDOON2DB.js +6 -0
  264. package/dist/{context-ENXZNF6J.js.map → context-FDOON2DB.js.map} +1 -1
  265. package/dist/context-VMIE4BMD.cjs +23 -0
  266. package/dist/{context-7USNN6LP.cjs.map → context-VMIE4BMD.cjs.map} +1 -1
  267. package/dist/cron-BcWmzWzT.d.cts +240 -0
  268. package/dist/cron-De6hzWCF.d.ts +240 -0
  269. package/dist/cron.cjs +43 -41
  270. package/dist/cron.d.cts +5 -3
  271. package/dist/cron.d.ts +5 -3
  272. package/dist/cron.js +42 -40
  273. package/dist/define-tool.d.ts +14 -6
  274. package/dist/{errors-BSoXcl3F.d.cts → errors-BgJH9PHi.d.cts} +39 -24
  275. package/dist/{errors-CHllybaU.d.ts → errors-C5fJUqLk.d.ts} +39 -24
  276. package/dist/errors.cjs +22 -21
  277. package/dist/errors.d.cts +2 -2
  278. package/dist/errors.d.ts +2 -2
  279. package/dist/errors.js +3 -2
  280. package/dist/eval.cjs +61 -58
  281. package/dist/eval.cjs.map +1 -1
  282. package/dist/eval.d.cts +38 -0
  283. package/dist/eval.d.ts +38 -0
  284. package/dist/eval.js +51 -48
  285. package/dist/eval.js.map +1 -1
  286. package/dist/event-bus.d.ts +16 -0
  287. package/dist/{executor-2Z6XJJJG.js → executor-BMEHFOXZ.js} +8 -7
  288. package/dist/executor-BMEHFOXZ.js.map +1 -0
  289. package/dist/{executor-2Z3LGG3I.cjs → executor-ZERJ3DGN.cjs} +25 -24
  290. package/dist/executor-ZERJ3DGN.cjs.map +1 -0
  291. package/dist/filesystem/index.cjs +8 -7
  292. package/dist/filesystem/index.cjs.map +1 -1
  293. package/dist/filesystem/index.js +4 -3
  294. package/dist/filesystem/index.js.map +1 -1
  295. package/dist/filesystem/local-filesystem.d.cts +18 -0
  296. package/dist/filesystem/local-filesystem.d.ts +18 -0
  297. package/dist/filesystem/types.d.cts +12 -0
  298. package/dist/filesystem/types.d.ts +12 -0
  299. package/dist/fs-session-store-3MOJQGP2.cjs +20 -0
  300. package/dist/{fs-session-store-VVY2AHWG.cjs.map → fs-session-store-3MOJQGP2.cjs.map} +1 -1
  301. package/dist/fs-session-store-IN7JTTXD.js +11 -0
  302. package/dist/{fs-session-store-R5FD3EN6.js.map → fs-session-store-IN7JTTXD.js.map} +1 -1
  303. package/dist/generate-object-N5MDZUJI.js +8 -0
  304. package/dist/{generate-object-WQRCXFD2.js.map → generate-object-N5MDZUJI.js.map} +1 -1
  305. package/dist/generate-object-PGSP5U7N.cjs +21 -0
  306. package/dist/{generate-object-AVXOJK2I.cjs.map → generate-object-PGSP5U7N.cjs.map} +1 -1
  307. package/dist/generate-object.d.ts +20 -0
  308. package/dist/index-manager-NG5YENWO.cjs +22 -0
  309. package/dist/{index-manager-VRU3A2YL.cjs.map → index-manager-NG5YENWO.cjs.map} +1 -1
  310. package/dist/index-manager-ZMRJ6ZII.js +13 -0
  311. package/dist/{index-manager-WS7TVKUW.js.map → index-manager-ZMRJ6ZII.js.map} +1 -1
  312. package/dist/index.cjs +169 -155
  313. package/dist/index.cjs.map +1 -1
  314. package/dist/index.d.cts +702 -54
  315. package/dist/index.d.ts +702 -54
  316. package/dist/index.js +61 -58
  317. package/dist/index.js.map +1 -1
  318. package/dist/{inject-session-GMBMJVNZ.js → inject-session-BJMJH5BX.js} +9 -8
  319. package/dist/inject-session-BJMJH5BX.js.map +1 -0
  320. package/dist/inject-session-WQGGMCQY.cjs +29 -0
  321. package/dist/inject-session-WQGGMCQY.cjs.map +1 -0
  322. package/dist/internal/auth/auth-types.d.ts +83 -1
  323. package/dist/internal/auth/credential-store.d.ts +34 -6
  324. package/dist/internal/auth/oauth-device.d.ts +0 -1
  325. package/dist/internal/auth/resolve-credential.d.ts +40 -0
  326. package/dist/internal/budget/tracker/budget.d.ts +12 -14
  327. package/dist/internal/budget/usage-accumulator.d.ts +15 -0
  328. package/dist/internal/llm/anthropic-shared.d.ts +8 -4
  329. package/dist/internal/llm/model-identifier.d.ts +26 -0
  330. package/dist/internal/llm/openai.d.ts +8 -0
  331. package/dist/internal/llm/prompt-cache-key.d.ts +1 -0
  332. package/dist/internal/llm/responses.d.ts +67 -1
  333. package/dist/internal/llm/router.d.ts +8 -0
  334. package/dist/internal/llm/types.d.ts +27 -1
  335. package/dist/internal/local-agent/real-local-run-provider.d.ts +8 -3
  336. package/dist/internal/local-agent/real-local-run-tools.d.ts +23 -4
  337. package/dist/internal/mcp/oauth.d.ts +5 -0
  338. package/dist/internal/mcp/token-storage.d.ts +34 -0
  339. package/dist/internal/memory/adapters/index.cjs +12 -11
  340. package/dist/internal/memory/adapters/index.d.cts +3 -1
  341. package/dist/internal/memory/adapters/index.d.ts +3 -1
  342. package/dist/internal/memory/adapters/index.js +9 -8
  343. package/dist/internal/memory/adapters/openai-compatible.d.cts +45 -0
  344. package/dist/internal/memory/adapters/openai-compatible.d.ts +45 -0
  345. package/dist/internal/memory/embedding-cache.d.ts +42 -1
  346. package/dist/internal/memory/escape-like-pattern.d.ts +22 -0
  347. package/dist/internal/memory/sqlite-vec-loader.d.ts +1 -3
  348. package/dist/internal/memory/storage/markdown-store.d.ts +0 -5
  349. package/dist/internal/persistence/cwd-mutex.d.cts +34 -0
  350. package/dist/internal/persistence/cwd-mutex.d.ts +34 -0
  351. package/dist/internal/persistence/exclusive-create.d.cts +31 -0
  352. package/dist/internal/persistence/exclusive-create.d.ts +31 -0
  353. package/dist/internal/persistence/file-lock.d.cts +28 -0
  354. package/dist/internal/persistence/file-lock.d.ts +28 -0
  355. package/dist/internal/persistence/fs-session-store.d.cts +3 -0
  356. package/dist/internal/persistence/fs-session-store.d.ts +3 -0
  357. package/dist/internal/persistence/fts5-sanitize.d.cts +20 -0
  358. package/dist/internal/persistence/fts5-sanitize.d.ts +20 -0
  359. package/dist/internal/persistence/index.cjs +40 -39
  360. package/dist/internal/persistence/index.cjs.map +1 -1
  361. package/dist/internal/persistence/index.d.cts +6 -1
  362. package/dist/internal/persistence/index.d.ts +6 -1
  363. package/dist/internal/persistence/index.js +9 -8
  364. package/dist/internal/persistence/index.js.map +1 -1
  365. package/dist/internal/persistence/paths.d.cts +54 -1
  366. package/dist/internal/persistence/paths.d.ts +54 -1
  367. package/dist/internal/persistence/persistence-schema.d.cts +9 -1
  368. package/dist/internal/persistence/persistence-schema.d.ts +9 -1
  369. package/dist/internal/persistence/schema-version.d.cts +215 -1
  370. package/dist/internal/persistence/schema-version.d.ts +215 -1
  371. package/dist/internal/persistence/session-writer.d.cts +7 -7
  372. package/dist/internal/persistence/session-writer.d.ts +7 -7
  373. package/dist/internal/persistence/sqlite-cas.d.cts +37 -1
  374. package/dist/internal/persistence/sqlite-cas.d.ts +37 -1
  375. package/dist/internal/persistence/sqlite-open.d.cts +14 -0
  376. package/dist/internal/persistence/sqlite-open.d.ts +14 -0
  377. package/dist/internal/persistence/sqlite-wal.d.cts +45 -0
  378. package/dist/internal/persistence/sqlite-wal.d.ts +45 -0
  379. package/dist/internal/persistence/transcript-ops.d.cts +7 -1
  380. package/dist/internal/persistence/transcript-ops.d.ts +7 -1
  381. package/dist/internal/plugins/types.d.cts +1 -1
  382. package/dist/internal/plugins/types.d.ts +1 -1
  383. package/dist/internal/providers/builtin/openai-chatgpt.d.ts +12 -0
  384. package/dist/internal/providers/catalog-loader.d.ts +8 -0
  385. package/dist/internal/providers/catalog-schema.d.ts +55 -0
  386. package/dist/internal/providers/catalog-source-models-dev.d.ts +36 -0
  387. package/dist/internal/runtime/concurrency/delegation-depth.d.ts +27 -0
  388. package/dist/internal/runtime/concurrency/subagent-credentials.d.ts +33 -1
  389. package/dist/internal/runtime/context/context-discovery-runner.d.ts +44 -0
  390. package/dist/internal/runtime/context/context-discovery.d.ts +58 -0
  391. package/dist/internal/runtime/context/context-rules-frontmatter.d.ts +70 -1
  392. package/dist/internal/runtime/fixtures/fixture-mode.d.ts +15 -1
  393. package/dist/internal/runtime/lifecycle/post-run-lifecycle.d.ts +15 -0
  394. package/dist/internal/runtime/registry/agent-registry-store.d.ts +12 -0
  395. package/dist/internal/runtime/registry/live-agent-registry.d.ts +37 -0
  396. package/dist/internal/scorers/llm-judge.d.ts +6 -1
  397. package/dist/internal/security/index.cjs +14 -13
  398. package/dist/internal/security/index.d.cts +4 -1
  399. package/dist/internal/security/index.d.ts +4 -1
  400. package/dist/internal/security/index.js +4 -3
  401. package/dist/internal/security/path-guard.d.cts +46 -0
  402. package/dist/internal/security/path-guard.d.ts +46 -0
  403. package/dist/internal/security/redact.d.cts +71 -0
  404. package/dist/internal/security/redact.d.ts +71 -0
  405. package/dist/internal/session/agent-session.d.ts +15 -4
  406. package/dist/internal/session/session-cache.d.ts +5 -0
  407. package/dist/internal/task/store.d.ts +91 -5
  408. package/dist/internal/telemetry/span-names.d.ts +0 -1
  409. package/dist/internal/telemetry/tracer.d.ts +14 -0
  410. package/dist/job-queue.d.ts +18 -0
  411. package/dist/judge-call-DWHAJATE.js +6 -0
  412. package/dist/{judge-call-MDIPTBJI.js.map → judge-call-DWHAJATE.js.map} +1 -1
  413. package/dist/judge-call-EGYRC2RE.cjs +23 -0
  414. package/dist/{judge-call-G5SGV2M2.cjs.map → judge-call-EGYRC2RE.cjs.map} +1 -1
  415. package/dist/mcp-auth.cjs +41 -25
  416. package/dist/mcp-auth.cjs.map +1 -1
  417. package/dist/mcp-auth.js +34 -18
  418. package/dist/mcp-auth.js.map +1 -1
  419. package/dist/models.cjs +42 -27
  420. package/dist/models.cjs.map +1 -1
  421. package/dist/models.js +25 -10
  422. package/dist/models.js.map +1 -1
  423. package/dist/oauth-transaction-store-BT4GLTLK.cjs +36 -0
  424. package/dist/{oauth-transaction-store-7CKHPQRN.cjs.map → oauth-transaction-store-BT4GLTLK.cjs.map} +1 -1
  425. package/dist/oauth-transaction-store-W52KVHQ4.js +3 -0
  426. package/dist/{oauth-transaction-store-W74I6EFD.js.map → oauth-transaction-store-W52KVHQ4.js.map} +1 -1
  427. package/dist/path-safety.cjs +11 -10
  428. package/dist/path-safety.js +4 -3
  429. package/dist/permission-engine.d.ts +55 -0
  430. package/dist/persistence.cjs +43 -42
  431. package/dist/persistence.cjs.map +1 -1
  432. package/dist/persistence.js +13 -12
  433. package/dist/persistence.js.map +1 -1
  434. package/dist/project.cjs +9 -8
  435. package/dist/project.cjs.map +1 -1
  436. package/dist/project.js +5 -4
  437. package/dist/project.js.map +1 -1
  438. package/dist/providers.cjs +23 -0
  439. package/dist/providers.cjs.map +1 -0
  440. package/dist/providers.d.cts +29 -0
  441. package/dist/providers.d.ts +29 -0
  442. package/dist/providers.js +10 -0
  443. package/dist/providers.js.map +1 -0
  444. package/dist/registry-VFKX7WOP.cjs +47 -0
  445. package/dist/{registry-63ASMXT4.cjs.map → registry-VFKX7WOP.cjs.map} +1 -1
  446. package/dist/registry-VFP3WWQP.js +10 -0
  447. package/dist/{registry-O7FJ2MPM.js.map → registry-VFP3WWQP.js.map} +1 -1
  448. package/dist/retry.cjs +5 -4
  449. package/dist/retry.js +4 -3
  450. package/dist/{run-C8FBAC8o.d.cts → run-BYSHf58D.d.cts} +185 -33
  451. package/dist/{run-C8FBAC8o.d.ts → run-BYSHf58D.d.ts} +185 -33
  452. package/dist/{run-to-completion-JDPIUKSH.js → run-to-completion-DRO77625.js} +3 -3
  453. package/dist/{run-to-completion-JDPIUKSH.js.map → run-to-completion-DRO77625.js.map} +1 -1
  454. package/dist/{run-to-completion-J73I6IY4.cjs → run-to-completion-X4OWM673.cjs} +13 -13
  455. package/dist/{run-to-completion-J73I6IY4.cjs.map → run-to-completion-X4OWM673.cjs.map} +1 -1
  456. package/dist/sandbox/bwrap.d.cts +27 -13
  457. package/dist/sandbox/bwrap.d.ts +27 -13
  458. package/dist/sandbox/index.cjs +20 -19
  459. package/dist/sandbox/index.cjs.map +1 -1
  460. package/dist/sandbox/index.js +5 -4
  461. package/dist/sandbox/index.js.map +1 -1
  462. package/dist/sandbox/linux-sandbox.d.cts +72 -0
  463. package/dist/sandbox/linux-sandbox.d.ts +72 -0
  464. package/dist/sandbox/local-sandbox.d.cts +41 -0
  465. package/dist/sandbox/local-sandbox.d.ts +41 -0
  466. package/dist/sandbox/seccomp.d.cts +6 -0
  467. package/dist/sandbox/seccomp.d.ts +6 -0
  468. package/dist/sandbox/types.d.cts +64 -0
  469. package/dist/sandbox/types.d.ts +64 -0
  470. package/dist/scorers.d.ts +38 -7
  471. package/dist/sdk-agent-D8qJVkuV.d.ts +860 -0
  472. package/dist/sdk-agent-DEoKhA8a.d.cts +860 -0
  473. package/dist/server/auth/errors.d.cts +1 -1
  474. package/dist/server/auth/errors.d.ts +1 -1
  475. package/dist/server/auth/index.cjs +29 -21
  476. package/dist/server/auth/index.cjs.map +1 -1
  477. package/dist/server/auth/index.d.cts +25 -15
  478. package/dist/server/auth/index.d.ts +25 -15
  479. package/dist/server/auth/index.js +15 -7
  480. package/dist/server/auth/index.js.map +1 -1
  481. package/dist/server/auth/oauth-transaction-store.d.cts +13 -1
  482. package/dist/server/auth/oauth-transaction-store.d.ts +13 -1
  483. package/dist/server/auth/orchestrator.d.cts +1 -1
  484. package/dist/server/auth/orchestrator.d.ts +1 -1
  485. package/dist/server/auth/types.d.cts +1 -1
  486. package/dist/server/auth/types.d.ts +1 -1
  487. package/dist/server/auth/validate-return-to.d.cts +21 -11
  488. package/dist/server/auth/validate-return-to.d.ts +21 -11
  489. package/dist/server/errors-envelope.cjs +15 -14
  490. package/dist/server/errors-envelope.cjs.map +1 -1
  491. package/dist/server/errors-envelope.d.cts +4 -4
  492. package/dist/server/errors-envelope.d.ts +4 -4
  493. package/dist/server/errors-envelope.js +4 -3
  494. package/dist/server/errors-envelope.js.map +1 -1
  495. package/dist/session-transcript-AKDYYGXQ.js +6 -0
  496. package/dist/{session-transcript-RAKEK76V.js.map → session-transcript-AKDYYGXQ.js.map} +1 -1
  497. package/dist/session-transcript-JXHFTB7G.cjs +51 -0
  498. package/dist/{session-transcript-DOM3UTXR.cjs.map → session-transcript-JXHFTB7G.cjs.map} +1 -1
  499. package/dist/skills.cjs +8 -7
  500. package/dist/skills.js +6 -5
  501. package/dist/stream-object-BUCF5PHO.cjs +21 -0
  502. package/dist/{stream-object-L3Q7PBMF.cjs.map → stream-object-BUCF5PHO.cjs.map} +1 -1
  503. package/dist/stream-object-L57K4OFS.js +8 -0
  504. package/dist/{stream-object-ZYXWS4B2.js.map → stream-object-L57K4OFS.js.map} +1 -1
  505. package/dist/{stream-to-completion-DFJ5T3BK.js → stream-to-completion-QV5HCL3J.js} +3 -3
  506. package/dist/{stream-to-completion-DFJ5T3BK.js.map → stream-to-completion-QV5HCL3J.js.map} +1 -1
  507. package/dist/{stream-to-completion-H2MHISSK.cjs → stream-to-completion-SRISU5AB.cjs} +10 -10
  508. package/dist/{stream-to-completion-H2MHISSK.cjs.map → stream-to-completion-SRISU5AB.cjs.map} +1 -1
  509. package/dist/subagents-loader-AZIXJ7D3.cjs +16 -0
  510. package/dist/{subagents-loader-VRW73QQT.cjs.map → subagents-loader-AZIXJ7D3.cjs.map} +1 -1
  511. package/dist/subagents-loader-J54ESLDV.js +7 -0
  512. package/dist/{subagents-loader-I56GSKAQ.js.map → subagents-loader-J54ESLDV.js.map} +1 -1
  513. package/dist/subagents-loader.cjs +7 -6
  514. package/dist/subagents-loader.cjs.map +1 -1
  515. package/dist/subagents-loader.d.cts +3 -2
  516. package/dist/subagents-loader.d.ts +3 -2
  517. package/dist/subagents-loader.js +5 -4
  518. package/dist/subagents-loader.js.map +1 -1
  519. package/dist/subscription/define-subscription.d.cts +1 -1
  520. package/dist/subscription/define-subscription.d.ts +1 -1
  521. package/dist/subscription/index.cjs +22 -9
  522. package/dist/subscription/index.cjs.map +1 -1
  523. package/dist/subscription/index.d.cts +1 -1
  524. package/dist/subscription/index.d.ts +1 -1
  525. package/dist/subscription/index.js +21 -8
  526. package/dist/subscription/index.js.map +1 -1
  527. package/dist/subscription/internal/adapter-types.d.cts +1 -1
  528. package/dist/subscription/internal/adapter-types.d.ts +1 -1
  529. package/dist/subscription/internal/server-integration.d.cts +1 -1
  530. package/dist/subscription/internal/server-integration.d.ts +1 -1
  531. package/dist/subscription/internal/sse-encoder.d.cts +1 -1
  532. package/dist/subscription/internal/sse-encoder.d.ts +1 -1
  533. package/dist/subscription/internal/sse-parser.d.cts +1 -1
  534. package/dist/subscription/internal/sse-parser.d.ts +1 -1
  535. package/dist/subscription/internal/subscription-runtime.d.cts +1 -1
  536. package/dist/subscription/internal/subscription-runtime.d.ts +1 -1
  537. package/dist/subscription/internal/ws-adapter-node.d.cts +1 -1
  538. package/dist/subscription/internal/ws-adapter-node.d.ts +1 -1
  539. package/dist/subscription/theokit-subscribe.d.cts +14 -1
  540. package/dist/subscription/theokit-subscribe.d.ts +14 -1
  541. package/dist/subscription/types.d.cts +19 -1
  542. package/dist/subscription/types.d.ts +19 -1
  543. package/dist/task-store.cjs +8 -7
  544. package/dist/task-store.js +5 -4
  545. package/dist/types/agent-prims.d.ts +14 -0
  546. package/dist/types/agent.d.ts +92 -11
  547. package/dist/types/batch.d.ts +7 -1
  548. package/dist/types/conversation.d.ts +18 -5
  549. package/dist/types/goal-events.d.ts +4 -8
  550. package/dist/types/memory-adapter.d.ts +12 -1
  551. package/dist/types/plugin.d.ts +101 -0
  552. package/dist/types/provider-profile.d.ts +32 -0
  553. package/dist/types/run-events.d.ts +28 -1
  554. package/dist/types/run.d.ts +35 -23
  555. package/dist/types/sdk-agent.d.ts +14 -0
  556. package/dist/types/session-record.d.ts +18 -1
  557. package/dist/types/task.d.ts +15 -1
  558. package/dist/types/theokit.d.ts +10 -1
  559. package/dist/types/updates.d.ts +35 -4
  560. package/dist/types/workflow.d.ts +155 -0
  561. package/dist/workflow.cjs +29 -28
  562. package/dist/workflow.d.cts +666 -17
  563. package/dist/workflow.d.ts +666 -17
  564. package/dist/workflow.js +8 -7
  565. package/docs/error-codes.md +215 -0
  566. package/docs/harness-capability-map.md +1358 -0
  567. package/package.json +29 -16
  568. package/bin/init-claude.mjs +0 -68
  569. package/claude-template/AGENTS.md +0 -157
  570. package/claude-template/CLAUDE.md +0 -66
  571. package/claude-template/dot-claude/rules/theokit-conventions.md +0 -32
  572. package/claude-template/dot-claude/settings.json +0 -16
  573. package/claude-template/dot-claude/skills/theokit-agent-core/SKILL.md +0 -209
  574. package/claude-template/dot-claude/skills/theokit-auth/SKILL.md +0 -102
  575. package/claude-template/dot-claude/skills/theokit-budget/SKILL.md +0 -176
  576. package/claude-template/dot-claude/skills/theokit-client/SKILL.md +0 -58
  577. package/claude-template/dot-claude/skills/theokit-compaction/SKILL.md +0 -102
  578. package/claude-template/dot-claude/skills/theokit-concurrency/SKILL.md +0 -68
  579. package/claude-template/dot-claude/skills/theokit-config/SKILL.md +0 -139
  580. package/claude-template/dot-claude/skills/theokit-cron/SKILL.md +0 -148
  581. package/claude-template/dot-claude/skills/theokit-di/SKILL.md +0 -233
  582. package/claude-template/dot-claude/skills/theokit-di-agent/SKILL.md +0 -294
  583. package/claude-template/dot-claude/skills/theokit-errors/SKILL.md +0 -172
  584. package/claude-template/dot-claude/skills/theokit-eval/SKILL.md +0 -179
  585. package/claude-template/dot-claude/skills/theokit-filesystem/SKILL.md +0 -74
  586. package/claude-template/dot-claude/skills/theokit-gateways/SKILL.md +0 -209
  587. package/claude-template/dot-claude/skills/theokit-memory/SKILL.md +0 -176
  588. package/claude-template/dot-claude/skills/theokit-messages/SKILL.md +0 -58
  589. package/claude-template/dot-claude/skills/theokit-models/SKILL.md +0 -79
  590. package/claude-template/dot-claude/skills/theokit-path-safety/SKILL.md +0 -60
  591. package/claude-template/dot-claude/skills/theokit-persistence/SKILL.md +0 -85
  592. package/claude-template/dot-claude/skills/theokit-project/SKILL.md +0 -55
  593. package/claude-template/dot-claude/skills/theokit-retry/SKILL.md +0 -50
  594. package/claude-template/dot-claude/skills/theokit-sandbox/SKILL.md +0 -93
  595. package/claude-template/dot-claude/skills/theokit-sanitize/SKILL.md +0 -66
  596. package/claude-template/dot-claude/skills/theokit-skills/SKILL.md +0 -68
  597. package/claude-template/dot-claude/skills/theokit-streaming/SKILL.md +0 -156
  598. package/claude-template/dot-claude/skills/theokit-subagents/SKILL.md +0 -109
  599. package/claude-template/dot-claude/skills/theokit-subscriptions/SKILL.md +0 -148
  600. package/claude-template/dot-claude/skills/theokit-task-store/SKILL.md +0 -75
  601. package/claude-template/dot-claude/skills/theokit-tools/SKILL.md +0 -170
  602. package/claude-template/dot-claude/skills/theokit-workflows/SKILL.md +0 -218
  603. package/dist/agent-FFVV4U5N.js +0 -50
  604. package/dist/agent-YLAHVHEH.cjs +0 -59
  605. package/dist/agent-session-store-DUGBAX5V.cjs +0 -23
  606. package/dist/agent-session-store-TNCGL5RN.js +0 -6
  607. package/dist/batch-UPKN4SG6.js.map +0 -1
  608. package/dist/batch-ZEFN5SO7.cjs.map +0 -1
  609. package/dist/chunk-2D43RD5D.cjs.map +0 -1
  610. package/dist/chunk-2FYEVT2B.cjs.map +0 -1
  611. package/dist/chunk-2RW7K6FN.cjs.map +0 -1
  612. package/dist/chunk-2XLKLVVR.js.map +0 -1
  613. package/dist/chunk-34XOCZJO.js.map +0 -1
  614. package/dist/chunk-3V7UJLQT.js.map +0 -1
  615. package/dist/chunk-4NAKHID5.js.map +0 -1
  616. package/dist/chunk-4Q4K4WB5.js.map +0 -1
  617. package/dist/chunk-5F5NWKPN.js.map +0 -1
  618. package/dist/chunk-5NBUH3NO.js.map +0 -1
  619. package/dist/chunk-5YKNEMXR.cjs.map +0 -1
  620. package/dist/chunk-7W7ZWMLQ.js.map +0 -1
  621. package/dist/chunk-ADLLFY3H.cjs.map +0 -1
  622. package/dist/chunk-B4YA6BRS.cjs.map +0 -1
  623. package/dist/chunk-B6HOIWQ6.js.map +0 -1
  624. package/dist/chunk-BDTVFIPB.cjs.map +0 -1
  625. package/dist/chunk-BFYGJGC5.js.map +0 -1
  626. package/dist/chunk-BM6N4KHO.cjs.map +0 -1
  627. package/dist/chunk-CAH3G4IS.js.map +0 -1
  628. package/dist/chunk-EZ2YEF4F.cjs.map +0 -1
  629. package/dist/chunk-F77UENR6.cjs.map +0 -1
  630. package/dist/chunk-FOXKFTVZ.cjs.map +0 -1
  631. package/dist/chunk-G3JWXOGY.js.map +0 -1
  632. package/dist/chunk-GOVJO4YE.js.map +0 -1
  633. package/dist/chunk-HAWE74GQ.cjs.map +0 -1
  634. package/dist/chunk-HE4BIAOS.js.map +0 -1
  635. package/dist/chunk-HSQ5Q3I5.js.map +0 -1
  636. package/dist/chunk-JIQRXKTA.cjs.map +0 -1
  637. package/dist/chunk-KSWHTR54.js.map +0 -1
  638. package/dist/chunk-L5YO6PWL.cjs.map +0 -1
  639. package/dist/chunk-LD4MOBFX.js.map +0 -1
  640. package/dist/chunk-LS3LMQ23.js.map +0 -1
  641. package/dist/chunk-MSFLYJDY.js.map +0 -1
  642. package/dist/chunk-NZL4BNFQ.js.map +0 -1
  643. package/dist/chunk-OKLYRPKL.cjs.map +0 -1
  644. package/dist/chunk-OUOXM36O.cjs.map +0 -1
  645. package/dist/chunk-OXNYIMZZ.js.map +0 -1
  646. package/dist/chunk-PBZ7HMBP.js.map +0 -1
  647. package/dist/chunk-PNVDQL5Y.cjs.map +0 -1
  648. package/dist/chunk-Q4RESANI.cjs.map +0 -1
  649. package/dist/chunk-QBTVATSF.cjs.map +0 -1
  650. package/dist/chunk-RAHSWE5C.cjs.map +0 -1
  651. package/dist/chunk-RP5HQVLD.js.map +0 -1
  652. package/dist/chunk-SEL2ZQMT.js.map +0 -1
  653. package/dist/chunk-SK4QLUBK.js.map +0 -1
  654. package/dist/chunk-TTJ54H3E.cjs.map +0 -1
  655. package/dist/chunk-V26QVGUG.js.map +0 -1
  656. package/dist/chunk-V6HWJQQV.js.map +0 -1
  657. package/dist/chunk-VGPXHHF3.cjs.map +0 -1
  658. package/dist/chunk-VUKQL3L2.cjs.map +0 -1
  659. package/dist/chunk-VYCKUKPA.cjs.map +0 -1
  660. package/dist/chunk-VYHJZVL5.cjs.map +0 -1
  661. package/dist/chunk-X2FR4OIT.js.map +0 -1
  662. package/dist/chunk-XPR366DL.cjs.map +0 -1
  663. package/dist/chunk-XROIW6BH.js.map +0 -1
  664. package/dist/chunk-YLQQX5W2.cjs.map +0 -1
  665. package/dist/chunk-ZT57WTUJ.cjs.map +0 -1
  666. package/dist/compact-session-4MNKNMO2.js +0 -21
  667. package/dist/compact-session-EPFBQ46Z.cjs +0 -58
  668. package/dist/context-7USNN6LP.cjs +0 -22
  669. package/dist/context-ENXZNF6J.js +0 -5
  670. package/dist/cron-BMjgFH-_.d.ts +0 -631
  671. package/dist/cron-DFDdCdMM.d.cts +0 -631
  672. package/dist/executor-2Z3LGG3I.cjs.map +0 -1
  673. package/dist/executor-2Z6XJJJG.js.map +0 -1
  674. package/dist/fs-session-store-R5FD3EN6.js +0 -10
  675. package/dist/fs-session-store-VVY2AHWG.cjs +0 -19
  676. package/dist/generate-object-AVXOJK2I.cjs +0 -20
  677. package/dist/generate-object-WQRCXFD2.js +0 -7
  678. package/dist/index-manager-VRU3A2YL.cjs +0 -21
  679. package/dist/index-manager-WS7TVKUW.js +0 -12
  680. package/dist/inject-session-AUQLBDRS.cjs +0 -28
  681. package/dist/inject-session-AUQLBDRS.cjs.map +0 -1
  682. package/dist/inject-session-GMBMJVNZ.js.map +0 -1
  683. package/dist/judge-call-G5SGV2M2.cjs +0 -22
  684. package/dist/judge-call-MDIPTBJI.js +0 -5
  685. package/dist/oauth-transaction-store-7CKHPQRN.cjs +0 -32
  686. package/dist/oauth-transaction-store-W74I6EFD.js +0 -3
  687. package/dist/registry-63ASMXT4.cjs +0 -46
  688. package/dist/registry-O7FJ2MPM.js +0 -9
  689. package/dist/session-transcript-DOM3UTXR.cjs +0 -50
  690. package/dist/session-transcript-RAKEK76V.js +0 -5
  691. package/dist/stream-object-L3Q7PBMF.cjs +0 -20
  692. package/dist/stream-object-ZYXWS4B2.js +0 -7
  693. package/dist/subagents-loader-I56GSKAQ.js +0 -6
  694. package/dist/subagents-loader-VRW73QQT.cjs +0 -15
package/dist/index.d.cts CHANGED
@@ -1,13 +1,16 @@
1
- import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-BSoXcl3F.cjs';
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-BSoXcl3F.cjs';
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-nLqeXKIX.cjs';
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-nLqeXKIX.cjs';
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.cjs';
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.cjs';
1
+ import { T as TheokitAgentError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot, E as ErrorMetadata } from './errors-BgJH9PHi.cjs';
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-BgJH9PHi.cjs';
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-D3Xr_-6Z.cjs';
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 BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CreateSkillSpec, H as HookName, x as MemoryProviderFactory, y as MemoryProviderHandle, z as MemoryProviderInitOptions, D as PluginContext, E as PostAssistantReplyContext, F as PostToolCallContext, J as PreToolCallContext, K as PreUserSendContext, N as PreUserSendResult, O as ProviderTransform, Q as ProviderTransformContext, R as RecordSessionSummaryArgs, T as SessionLifecycleContext, U as SessionRecord, V as SessionStore, W as SettingSource, X as Skill, Y as SkillsResolver, Z as SkillsResolverContext, _ as SystemPromptContext, $ as SystemPromptMemoryFact, a0 as TelemetrySettings, a1 as ToolCallSummary, a2 as ToolResultTransformContext, a3 as TransformContext } from './agent-D3Xr_-6Z.cjs';
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.cjs';
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.cjs';
7
7
  import * as zod from 'zod';
8
8
  import { ZodType, z } from 'zod';
9
- import { S as StepResult } from './cron-DFDdCdMM.cjs';
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-DFDdCdMM.cjs';
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-DEoKhA8a.cjs';
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-DEoKhA8a.cjs';
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-BcWmzWzT.cjs';
12
+ import { StepResult } from './workflow.cjs';
13
+ export { Workflow, agentStep, fn } from './workflow.cjs';
11
14
 
12
15
  /**
13
16
  * Public compaction / context-management helpers (M2-1, extended V3-3).
@@ -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
  /**
@@ -685,24 +750,27 @@ declare class Agent {
685
750
  */
686
751
  static getOrCreate(agentId: string, options: AgentOptions): Promise<SDKAgent>;
687
752
  /**
688
- * List agents (local or cloud). M107 — `cwd` is READ now, not ignored;
689
- * `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.
690
756
  *
691
757
  * @public
692
758
  */
693
759
  static list(options?: ListAgentsOptions): Promise<ListResult<SDKAgentInfo>>;
694
760
  /**
695
- * 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.
696
763
  *
697
764
  * @public
698
765
  */
699
- static get(agentId: string, _options?: GetAgentOptions): Promise<SDKAgentInfo>;
766
+ static get(agentId: string, options?: GetAgentOptions): Promise<SDKAgentInfo>;
700
767
  /**
701
- * 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.
702
770
  *
703
771
  * @public
704
772
  */
705
- static listRuns(agentId: string, _options?: ListRunsOptions): Promise<ListResult<Run>>;
773
+ static listRuns(agentId: string, options?: ListRunsOptions): Promise<ListResult<Run>>;
706
774
  /**
707
775
  * Get a single run.
708
776
  *
@@ -843,11 +911,35 @@ declare class AgentFactory {
843
911
  */
844
912
  /** What the operator chose for everything not decided per tool. @public */
845
913
  type ApprovalMode = "ask" | "never-ask" | "refuse-all";
846
- /** @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
+ */
847
923
  type ApprovalOutcome = "allow" | "ask" | "deny";
848
- /** @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
+ */
849
933
  type ApprovalReason = "explicitly-allowed" | "explicitly-denied" | "mode-ask" | "mode-never-ask" | "mode-refuse-all";
850
- /** @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
+ */
851
943
  interface ApprovalInput {
852
944
  readonly tool: string;
853
945
  readonly mode: ApprovalMode;
@@ -856,7 +948,11 @@ interface ApprovalInput {
856
948
  /** Tools the operator refused. Outranks `allowed` and every mode. */
857
949
  readonly denied?: readonly string[];
858
950
  }
859
- /** @public */
951
+ /**
952
+ * The answer, the rule that produced it, and the tool it was about.
953
+ *
954
+ * @public
955
+ */
860
956
  interface ApprovalDecision {
861
957
  readonly outcome: ApprovalOutcome;
862
958
  readonly reason: ApprovalReason;
@@ -864,6 +960,17 @@ interface ApprovalDecision {
864
960
  readonly tool: string;
865
961
  }
866
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
+ *
867
974
  * @returns the outcome, why it was reached, and the tool it was about.
868
975
  * @public
869
976
  */
@@ -912,7 +1019,18 @@ interface DeclaredAction {
912
1019
  */
913
1020
  readonly reversible: boolean;
914
1021
  }
915
- /** @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
+ */
916
1034
  interface BlastRadiusInput {
917
1035
  readonly action: DeclaredAction;
918
1036
  /** Scopes the operator granted reach to. Empty grants nothing — never everything. */
@@ -920,11 +1038,27 @@ interface BlastRadiusInput {
920
1038
  /** Scopes where the operator pre-approved irreversible actions, so an unattended run can work. */
921
1039
  readonly irreversibleAllowed?: readonly string[];
922
1040
  }
923
- /** @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
+ */
924
1051
  type BlastRadiusOutcome = "allow" | "require-approval" | "refuse";
925
1052
  /** Why the decision came out that way. Rendered to the operator and read by an audit. @public */
926
1053
  type BlastRadiusReason = "within-granted-scope" | "irreversible" | "scope-not-granted" | "scope-undeclared";
927
- /** @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
+ */
928
1062
  interface BlastRadiusDecision {
929
1063
  readonly outcome: BlastRadiusOutcome;
930
1064
  readonly reason: BlastRadiusReason;
@@ -932,6 +1066,19 @@ interface BlastRadiusDecision {
932
1066
  readonly scope: string;
933
1067
  }
934
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
+ *
935
1082
  * @returns the outcome with the reason and the scope it was decided on.
936
1083
  * @public
937
1084
  */
@@ -1020,7 +1167,52 @@ declare function chargeAndCheckThresholds(name: string, actualUsd: number): Prom
1020
1167
  * @internal
1021
1168
  */
1022
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
+ */
1023
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
+ */
1024
1216
  declare function normalizeUsage(rawUsage: unknown, opts: {
1025
1217
  provider: string;
1026
1218
  apiMode?: ApiMode;
@@ -1080,6 +1272,21 @@ interface StepUsage {
1080
1272
  cacheWriteTokens?: number;
1081
1273
  reasoningTokens?: number;
1082
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
+ */
1083
1290
  declare class UsageAccumulator {
1084
1291
  private input;
1085
1292
  private output;
@@ -1217,7 +1424,14 @@ declare class UnicodeNormalizer {
1217
1424
  *
1218
1425
  * @public
1219
1426
  */
1220
- /** @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
+ */
1221
1435
  interface CredentialInput {
1222
1436
  /** The product's name for the provider. This module never knows one of its own. */
1223
1437
  readonly provider: string;
@@ -1226,7 +1440,15 @@ interface CredentialInput {
1226
1440
  /** Where it came from, in the product's vocabulary — `env`, `file`, `keychain`, `oauth`. */
1227
1441
  readonly source: string;
1228
1442
  }
1229
- /** @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
+ */
1230
1452
  interface CredentialReport {
1231
1453
  readonly provider: string;
1232
1454
  readonly present: boolean;
@@ -1235,6 +1457,13 @@ interface CredentialReport {
1235
1457
  readonly fingerprint?: string;
1236
1458
  }
1237
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
+ *
1238
1467
  * @returns a report safe to log, render and attach to a support bundle.
1239
1468
  * @public
1240
1469
  */
@@ -1362,12 +1591,6 @@ interface SanitizeOptions {
1362
1591
  maxDepth?: number;
1363
1592
  }
1364
1593
 
1365
- /**
1366
- * Spec accepted by {@link defineTool}. `inputSchema` is a Zod schema; the
1367
- * `handler` argument type is inferred via `z.infer<T>` — no `as` casts.
1368
- *
1369
- * @public
1370
- */
1371
1594
  /**
1372
1595
  * SE16 — the handler's return type. With no `outputSchema` the tool returns a
1373
1596
  * plain `string` (pre-SE16 shape). With an `outputSchema` the handler returns the
@@ -1375,6 +1598,20 @@ interface SanitizeOptions {
1375
1598
  * The `[O]` tuple wrap prevents distribution so `never` maps cleanly to `string`.
1376
1599
  */
1377
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
+ */
1378
1615
  interface DefineToolSpec<T extends ZodType, O extends ZodType = never> {
1379
1616
  /** Tool name surfaced to the LLM. Same constraints as {@link CustomTool.name}. */
1380
1617
  name: string;
@@ -1470,7 +1707,16 @@ interface EnvOptOut {
1470
1707
  /** What would make this opt-out obsolete. An opt-out with no exit is a permanent excuse. */
1471
1708
  readonly exitCriterion: string;
1472
1709
  }
1473
- /** @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
+ */
1474
1720
  interface EnvReachabilityInput {
1475
1721
  /** Every configuration key the product declares. */
1476
1722
  readonly keys: readonly string[];
@@ -1479,7 +1725,15 @@ interface EnvReachabilityInput {
1479
1725
  /** Documented exemptions for keys that deliberately have no environment path. */
1480
1726
  readonly optOuts: readonly EnvOptOut[];
1481
1727
  }
1482
- /** @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
+ */
1483
1737
  interface EnvReachabilityAudit {
1484
1738
  /** Keys with neither an environment path nor a documented opt-out. */
1485
1739
  readonly unreachable: readonly string[];
@@ -1487,6 +1741,15 @@ interface EnvReachabilityAudit {
1487
1741
  readonly staleOptOuts: readonly string[];
1488
1742
  }
1489
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
+ *
1490
1753
  * @returns both axes, in the order the caller declared them — a stable order so a failure message
1491
1754
  * does not change between runs for reasons unrelated to the code.
1492
1755
  * @public
@@ -1500,6 +1763,22 @@ declare function auditEnvReachability(input: EnvReachabilityInput): EnvReachabil
1500
1763
  * Each handler is try-caught (EC-2) so one failing handler cannot break others.
1501
1764
  */
1502
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
+ */
1503
1782
  declare class EventBus<Events extends Record<string, unknown>> {
1504
1783
  #private;
1505
1784
  private handlers;
@@ -1727,6 +2006,40 @@ type DiagnosticsSink = (message: string) => void;
1727
2006
  */
1728
2007
  declare function setDiagnosticsSink(next: DiagnosticsSink | undefined): void;
1729
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
+ */
1730
2043
  declare function withCwdMutex<T>(key: string, fn: () => Promise<T>): Promise<T>;
1731
2044
 
1732
2045
  /**
@@ -1758,6 +2071,20 @@ declare class NoopMemoryProvider {
1758
2071
  static create(): MemoryProvider;
1759
2072
  }
1760
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
+ */
1761
2088
  interface OTelSpan {
1762
2089
  setAttribute(key: string, value: string | number | boolean): void;
1763
2090
  setAttributes(attrs: Record<string, string | number | boolean | undefined>): void;
@@ -1825,6 +2152,24 @@ interface JobQueueOptions {
1825
2152
  */
1826
2153
  maxConcurrency?: number;
1827
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
+ */
1828
2173
  declare class JobQueue {
1829
2174
  #private;
1830
2175
  private jobs;
@@ -1870,13 +2215,30 @@ declare class JobQueue {
1870
2215
  declare class LayerOrderError extends TheokitAgentError {
1871
2216
  readonly name = "LayerOrderError";
1872
2217
  }
1873
- /** @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
+ */
1874
2228
  interface DeclaredLayer {
1875
2229
  readonly layer: string;
1876
2230
  /** Higher wins. Optional — omit it to mean "this array is already the order". */
1877
2231
  readonly precedence?: number;
1878
2232
  }
1879
- /** @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
+ */
1880
2242
  interface LayerValues extends DeclaredLayer {
1881
2243
  readonly values: Readonly<Record<string, unknown>>;
1882
2244
  }
@@ -1950,10 +2312,13 @@ interface MemoryIndexHandle {
1950
2312
  close(): Promise<void> | void;
1951
2313
  }
1952
2314
  /**
1953
- * Public `Memory` namespace.
2315
+ * Inputs for {@link Memory.runDreamingSweep}.
1954
2316
  *
1955
- * Exposes operations users can run outside of `agent.send()` most notably
1956
- * 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.
1957
2322
  *
1958
2323
  * @public
1959
2324
  */
@@ -1975,6 +2340,18 @@ interface DreamingSweepOptions {
1975
2340
  /** Cosine-similarity threshold for the clustering phase. Default `0.75`. */
1976
2341
  clusterThreshold?: number;
1977
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
+ */
1978
2355
  interface DreamingSweepResult {
1979
2356
  status: "ok" | "skipped" | "error";
1980
2357
  factsBefore: number;
@@ -2006,6 +2383,19 @@ interface OpenMemoryIndexOptions {
2006
2383
  /** Default `"sqlite-vec"`. Set to `"lance"` to opt into LanceDB (peer dep). */
2007
2384
  backend?: "sqlite-vec" | "lance";
2008
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
+ */
2009
2399
  declare const Memory: {
2010
2400
  /**
2011
2401
  * Open a memory index. Dispatches to SQLite-vec (default, zero deps) or
@@ -2214,7 +2604,16 @@ declare class PermissionPlugin {
2214
2604
  * @public
2215
2605
  */
2216
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"];
2217
- /** @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
+ */
2218
2617
  type SovereignEnvKey = (typeof SOVEREIGN_ENV_KEYS)[number];
2219
2618
  /** The mutable shape of `process.env`, narrowed so a caller can pass a plain object in tests. */
2220
2619
  type MutableEnv = Record<string, string | undefined>;
@@ -2264,7 +2663,16 @@ declare function loadProjectEnv(env?: MutableEnv, load?: (() => void) | undefine
2264
2663
  declare class RetentionPolicyError extends TheokitAgentError {
2265
2664
  readonly name = "RetentionPolicyError";
2266
2665
  }
2267
- /** @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
+ */
2268
2676
  interface ReapableArtifact {
2269
2677
  readonly id: string;
2270
2678
  /** Epoch milliseconds. Compared against an injected `nowMs`, never against a read clock. */
@@ -2276,7 +2684,16 @@ interface ReapableArtifact {
2276
2684
  */
2277
2685
  readonly live: boolean | "unknown";
2278
2686
  }
2279
- /** @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
+ */
2280
2697
  interface RetentionPolicy {
2281
2698
  /** Artifacts strictly older than this are candidates. The boundary itself is kept. */
2282
2699
  readonly maxAgeMs: number;
@@ -2293,11 +2710,27 @@ interface RetentionPolicy {
2293
2710
  }
2294
2711
  /** Why an artifact survived. @public */
2295
2712
  type KeepReason = "live" | "within-retention" | "keep-last";
2296
- /** @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
+ */
2297
2722
  interface KeptArtifact extends ReapableArtifact {
2298
2723
  readonly reason: KeepReason;
2299
2724
  }
2300
- /** @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
+ */
2301
2734
  interface ReapPlan {
2302
2735
  /** Safe to delete. Everything here was decided, not defaulted. */
2303
2736
  readonly reap: readonly ReapableArtifact[];
@@ -2305,13 +2738,39 @@ interface ReapPlan {
2305
2738
  /** Liveness could not be established. Never deleted, never counted as kept. */
2306
2739
  readonly undetermined: readonly ReapableArtifact[];
2307
2740
  }
2308
- /** @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
+ */
2309
2750
  interface ReapPlanInput {
2310
2751
  readonly artifacts: readonly ReapableArtifact[];
2311
2752
  readonly retention: RetentionPolicy;
2312
2753
  /** Injected so the plan is reproducible and testable; this module never reads a clock. */
2313
2754
  readonly nowMs: number;
2314
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
+ */
2315
2774
  declare function planReaping(input: ReapPlanInput): ReapPlan;
2316
2775
 
2317
2776
  /** The internal JSON-Schema shape the synthetic `output` tool consumes. */
@@ -2426,7 +2885,19 @@ declare class Security {
2426
2885
  *
2427
2886
  * @public
2428
2887
  */
2429
- /** @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
+ */
2430
2901
  interface SecurityFloorInput {
2431
2902
  /**
2432
2903
  * The vocabulary, ordered from most confined to least. Index is permissiveness, so
@@ -2444,6 +2915,23 @@ interface SecurityFloorInput {
2444
2915
  readonly layers: Readonly<Record<string, string | undefined>>;
2445
2916
  }
2446
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
+ *
2447
2935
  * @returns the resolved value, or `undefined` when no layer supplied one.
2448
2936
  * @public
2449
2937
  */
@@ -2474,7 +2962,16 @@ declare function applySecurityFloor(input: SecurityFloorInput): string | undefin
2474
2962
 
2475
2963
  /** Why the destruction was refused. @public */
2476
2964
  type LiveSessionReason = "session-is-live" | "liveness-undetermined";
2477
- /** @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
+ */
2478
2975
  declare class LiveSessionError extends TheokitAgentError {
2479
2976
  readonly name = "LiveSessionError";
2480
2977
  readonly sessionId: string;
@@ -2670,6 +3167,16 @@ interface TaskHandle {
2670
3167
  * AbortController).
2671
3168
  */
2672
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;
2673
3180
  }
2674
3181
  /** Query filter for `Task.list`. */
2675
3182
  interface TaskFilter {
@@ -2677,7 +3184,11 @@ interface TaskFilter {
2677
3184
  readonly kind?: TaskKind | readonly TaskKind[];
2678
3185
  readonly submittedAfter?: number;
2679
3186
  readonly submittedBefore?: number;
2680
- /** 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
+ */
2681
3192
  readonly limit?: number;
2682
3193
  }
2683
3194
  /** Options for `Task.submit`. */
@@ -2746,6 +3257,15 @@ interface TaskWorkContext {
2746
3257
  readonly signal: AbortSignal;
2747
3258
  emit(payload: unknown): void;
2748
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
+ */
2749
3269
  type TaskWorkFn<T> = (ctx: TaskWorkContext) => Promise<T> | T;
2750
3270
  /**
2751
3271
  * Registry-level configuration. May only be applied BEFORE the first
@@ -2757,6 +3277,22 @@ interface TaskConfigureOptions {
2757
3277
  readonly maxConcurrent?: number;
2758
3278
  readonly retentionMs?: number;
2759
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
+ */
2760
3296
  declare class Task {
2761
3297
  private constructor();
2762
3298
  /**
@@ -2887,7 +3423,16 @@ interface ModelListItem {
2887
3423
  parameters?: ModelParameterDefinition[];
2888
3424
  variants?: ModelVariant[];
2889
3425
  }
2890
- /** @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
+ */
2891
3436
  type SDKModel = ModelListItem;
2892
3437
  /**
2893
3438
  * GitHub repository connected to the team. Cloud-only.
@@ -2999,17 +3544,56 @@ declare class Theokit {
2999
3544
  * @public
3000
3545
  */
3001
3546
 
3002
- /** @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
+ */
3003
3570
  type WithBlastRadius<T> = T & {
3004
3571
  readonly [DECLARED]?: DeclaredAction;
3005
3572
  };
3006
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
+ *
3007
3584
  * @returns the same tool, with its action declared. The tool is not otherwise altered — the model
3008
3585
  * must see exactly what it saw before.
3009
3586
  * @public
3010
3587
  */
3011
3588
  declare function withBlastRadius<T extends object>(tool: T, action: DeclaredAction): WithBlastRadius<T>;
3012
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
+ *
3013
3597
  * @returns the declared action, or `undefined` when the tool never declared one — NOT an empty
3014
3598
  * action. "Never declared" and "declared as reaching nothing" are different facts, and collapsing
3015
3599
  * them is how an unreviewed tool passes as harmless.
@@ -3158,11 +3742,27 @@ declare function toShareGptTrajectory(result: BatchResult, options?: {
3158
3742
  *
3159
3743
  * @public
3160
3744
  */
3161
- /** @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
+ */
3162
3754
  type TrustLevel = "trusted" | "untrusted";
3163
3755
  /** Where the decision came from. @public */
3164
3756
  type TrustSource = "env" | "store" | "default";
3165
- /** @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
+ */
3166
3766
  interface TrustPostureInput<K extends string> {
3167
3767
  /**
3168
3768
  * Every capability a repository could switch on. `allows` is built from exactly this list — the
@@ -3181,14 +3781,36 @@ interface TrustPostureInput<K extends string> {
3181
3781
  */
3182
3782
  readonly envOverride?: boolean;
3183
3783
  }
3184
- /** @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
+ */
3185
3793
  interface TrustPosture<K extends string> {
3186
3794
  readonly level: TrustLevel;
3187
3795
  readonly source: TrustSource;
3188
3796
  /** One entry per declared capability. Every value is `false` when the level is untrusted. */
3189
3797
  readonly allows: Readonly<Record<K, boolean>>;
3190
3798
  }
3191
- /** @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
+ */
3192
3814
  declare function resolveTrustPosture<K extends string>(input: TrustPostureInput<K>): TrustPosture<K>;
3193
3815
 
3194
3816
  /**
@@ -3243,7 +3865,19 @@ interface WiredEntity {
3243
3865
  */
3244
3866
  readonly suppressedByTrust: boolean;
3245
3867
  }
3246
- /** @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
+ */
3247
3881
  interface WiringRecordInput<K extends string> {
3248
3882
  /**
3249
3883
  * The gate. Typically the output of `resolveTrustPosture`, which is what makes the name
@@ -3260,11 +3894,25 @@ interface WiringRecordInput<K extends string> {
3260
3894
  readonly requested: Readonly<Record<K, readonly string[]>>;
3261
3895
  }
3262
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
+ *
3263
3908
  * @returns one entry per key of `requested`, each a snapshot rather than a view of the caller's
3264
3909
  * arrays — the record is read long after the build, and aliasing would make it answer with what
3265
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.
3266
3914
  * @public
3267
3915
  */
3268
3916
  declare function recordWiring<K extends string>(input: WiringRecordInput<K>): Readonly<Record<K, WiredEntity>>;
3269
3917
 
3270
- 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, type OTelSpan, 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, type TelemetryHandle, 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 };