@theokit/sdk 4.63.4 → 5.0.0-next.2

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 (786) hide show
  1. package/CHANGELOG.md +847 -23
  2. package/dist/a2a/index.cjs +29 -13
  3. package/dist/a2a/index.cjs.map +1 -1
  4. package/dist/a2a/index.d.cts +1 -1
  5. package/dist/a2a/index.d.ts +1 -1
  6. package/dist/a2a/index.js +26 -11
  7. package/dist/a2a/index.js.map +1 -1
  8. package/dist/a2a/message-bus.d.cts +26 -3
  9. package/dist/a2a/message-bus.d.ts +26 -3
  10. package/dist/a2a/subagent.d.cts +8 -3
  11. package/dist/a2a/subagent.d.ts +8 -3
  12. package/dist/{agent-X0DKA943.d.cts → agent-C3KO5LKm.d.cts} +251 -36
  13. package/dist/{agent-BFno7Sfn.d.ts → agent-CvmTR9uf.d.ts} +251 -36
  14. package/dist/agent-GPV2JWZG.cjs +67 -0
  15. package/dist/{agent-UX7WFI6B.cjs.map → agent-GPV2JWZG.cjs.map} +1 -1
  16. package/dist/agent-Y24I5JBM.js +58 -0
  17. package/dist/{agent-A5XMIVNP.js.map → agent-Y24I5JBM.js.map} +1 -1
  18. package/dist/agent-session-store-AFML3AXC.js +6 -0
  19. package/dist/{agent-session-store-OPGRB4XM.js.map → agent-session-store-AFML3AXC.js.map} +1 -1
  20. package/dist/agent-session-store-MTSIY3MH.cjs +23 -0
  21. package/dist/{agent-session-store-6EL5NPA4.cjs.map → agent-session-store-MTSIY3MH.cjs.map} +1 -1
  22. package/dist/agent.d.ts +1 -1
  23. package/dist/auth/index.cjs +33 -34
  24. package/dist/auth/index.cjs.map +1 -1
  25. package/dist/auth/index.d.cts +1 -1
  26. package/dist/auth/index.d.ts +1 -1
  27. package/dist/auth/index.js +6 -7
  28. package/dist/auth/index.js.map +1 -1
  29. package/dist/{batch-BXYTW2DP.cjs → batch-I6T6MXZO.cjs} +58 -40
  30. package/dist/batch-I6T6MXZO.cjs.map +1 -0
  31. package/dist/{batch-L4ZXS46M.js → batch-US4F6WPK.js} +42 -24
  32. package/dist/batch-US4F6WPK.js.map +1 -0
  33. package/dist/chunk-24MGQDK3.js +31 -0
  34. package/dist/chunk-24MGQDK3.js.map +1 -0
  35. package/dist/{chunk-UGT7GK7I.cjs → chunk-24SYBZPL.cjs} +36 -18
  36. package/dist/chunk-24SYBZPL.cjs.map +1 -0
  37. package/dist/{chunk-KYAJINUI.cjs → chunk-2HPNT6HH.cjs} +581 -401
  38. package/dist/chunk-2HPNT6HH.cjs.map +1 -0
  39. package/dist/{chunk-VLVVJLDH.cjs → chunk-2NE7DTOK.cjs} +234 -193
  40. package/dist/chunk-2NE7DTOK.cjs.map +1 -0
  41. package/dist/{chunk-N2U4AZGB.js → chunk-2WXHA33T.js} +3 -3
  42. package/dist/chunk-2WXHA33T.js.map +1 -0
  43. package/dist/chunk-2XC6KDJM.js +22 -0
  44. package/dist/chunk-2XC6KDJM.js.map +1 -0
  45. package/dist/{chunk-L3MTL4NA.js → chunk-2ZLVT7H3.js} +223 -182
  46. package/dist/chunk-2ZLVT7H3.js.map +1 -0
  47. package/dist/{chunk-2GUYQR5P.js → chunk-3JHIFQ4I.js} +39 -13
  48. package/dist/chunk-3JHIFQ4I.js.map +1 -0
  49. package/dist/{chunk-BU4KFWXF.js → chunk-44I6UYVH.js} +8 -17
  50. package/dist/chunk-44I6UYVH.js.map +1 -0
  51. package/dist/{chunk-UNYXQ4M5.js → chunk-47TF32NQ.js} +10 -5
  52. package/dist/chunk-47TF32NQ.js.map +1 -0
  53. package/dist/{chunk-WNO3C3N2.cjs → chunk-4A3SKJ53.cjs} +56 -27
  54. package/dist/chunk-4A3SKJ53.cjs.map +1 -0
  55. package/dist/{chunk-YML4ME27.cjs → chunk-4HS6FFGL.cjs} +55 -46
  56. package/dist/chunk-4HS6FFGL.cjs.map +1 -0
  57. package/dist/{chunk-C72AZW7J.js → chunk-4MMWFSCD.js} +4 -4
  58. package/dist/chunk-4MMWFSCD.js.map +1 -0
  59. package/dist/{chunk-6HKGLTJI.cjs → chunk-4NLCWGH7.cjs} +15 -15
  60. package/dist/chunk-4NLCWGH7.cjs.map +1 -0
  61. package/dist/{chunk-LKBEROHN.js → chunk-4S5TWFIZ.js} +14 -14
  62. package/dist/chunk-4S5TWFIZ.js.map +1 -0
  63. package/dist/{chunk-UBDMVMBZ.js → chunk-55GB6JYQ.js} +33 -22
  64. package/dist/chunk-55GB6JYQ.js.map +1 -0
  65. package/dist/{chunk-U6IFHFWK.js → chunk-5WKQDIGO.js} +8 -17
  66. package/dist/chunk-5WKQDIGO.js.map +1 -0
  67. package/dist/chunk-67ADYSTW.js +120 -0
  68. package/dist/chunk-67ADYSTW.js.map +1 -0
  69. package/dist/{chunk-XL7Q7HB2.cjs → chunk-6LHQPOMI.cjs} +39 -6
  70. package/dist/chunk-6LHQPOMI.cjs.map +1 -0
  71. package/dist/{chunk-A4JVILQU.js → chunk-6M2OIS4Y.js} +7 -7
  72. package/dist/chunk-6M2OIS4Y.js.map +1 -0
  73. package/dist/{chunk-LWGSI6M3.js → chunk-6PWOWXMC.js} +4 -4
  74. package/dist/{chunk-LWGSI6M3.js.map → chunk-6PWOWXMC.js.map} +1 -1
  75. package/dist/{chunk-RNB4APBZ.js → chunk-6WAKKTBO.js} +9 -5
  76. package/dist/chunk-6WAKKTBO.js.map +1 -0
  77. package/dist/{chunk-V2BOS4WF.cjs → chunk-7A6535RA.cjs} +11 -11
  78. package/dist/chunk-7A6535RA.cjs.map +1 -0
  79. package/dist/{chunk-ZLQSWSJ2.cjs → chunk-7FDKWDA2.cjs} +11 -11
  80. package/dist/{chunk-ZLQSWSJ2.cjs.map → chunk-7FDKWDA2.cjs.map} +1 -1
  81. package/dist/{chunk-4VPXM6UU.js → chunk-7I5Z3UBJ.js} +3 -3
  82. package/dist/{chunk-4VPXM6UU.js.map → chunk-7I5Z3UBJ.js.map} +1 -1
  83. package/dist/{chunk-B4EOJWOY.cjs → chunk-7JJ3A6AT.cjs} +13 -7
  84. package/dist/chunk-7JJ3A6AT.cjs.map +1 -0
  85. package/dist/{chunk-WJVHMTKB.cjs → chunk-AA27GEYS.cjs} +3 -3
  86. package/dist/{chunk-WJVHMTKB.cjs.map → chunk-AA27GEYS.cjs.map} +1 -1
  87. package/dist/{chunk-BP46RJ5X.js → chunk-AAEZSPTC.js} +5 -5
  88. package/dist/{chunk-BP46RJ5X.js.map → chunk-AAEZSPTC.js.map} +1 -1
  89. package/dist/chunk-AGACYRJ2.js +11 -0
  90. package/dist/chunk-AGACYRJ2.js.map +1 -0
  91. package/dist/{chunk-ZZMZWBR6.js → chunk-ALUN2B4W.js} +81 -58
  92. package/dist/chunk-ALUN2B4W.js.map +1 -0
  93. package/dist/chunk-ANMJJD6D.cjs +18 -0
  94. package/dist/chunk-ANMJJD6D.cjs.map +1 -0
  95. package/dist/{chunk-DXGZ2NUG.cjs → chunk-ATT276RD.cjs} +12 -11
  96. package/dist/chunk-ATT276RD.cjs.map +1 -0
  97. package/dist/{chunk-4FFBAUFS.js → chunk-AWINL3ZC.js} +6 -6
  98. package/dist/chunk-AWINL3ZC.js.map +1 -0
  99. package/dist/{chunk-UU36SHFY.cjs → chunk-BJUJT5ED.cjs} +9 -8
  100. package/dist/chunk-BJUJT5ED.cjs.map +1 -0
  101. package/dist/{chunk-D4CUGAKZ.js → chunk-CZJ6Q7CW.js} +36 -6
  102. package/dist/chunk-CZJ6Q7CW.js.map +1 -0
  103. package/dist/{chunk-KQ7TS7WW.cjs → chunk-D6POWE7E.cjs} +37 -26
  104. package/dist/chunk-D6POWE7E.cjs.map +1 -0
  105. package/dist/{chunk-AWO27VRZ.js → chunk-DMRT67Y6.js} +6 -5
  106. package/dist/chunk-DMRT67Y6.js.map +1 -0
  107. package/dist/{chunk-5VB22SYX.cjs → chunk-DQZU7JK6.cjs} +7 -7
  108. package/dist/{chunk-5VB22SYX.cjs.map → chunk-DQZU7JK6.cjs.map} +1 -1
  109. package/dist/{chunk-3NSS2OIZ.cjs → chunk-DRL7URI4.cjs} +6 -6
  110. package/dist/{chunk-3NSS2OIZ.cjs.map → chunk-DRL7URI4.cjs.map} +1 -1
  111. package/dist/{chunk-RFXWMRFC.js → chunk-EFMFILPG.js} +14 -6
  112. package/dist/chunk-EFMFILPG.js.map +1 -0
  113. package/dist/{chunk-HS7AVXTF.js → chunk-EH6XD3FY.js} +4 -4
  114. package/dist/chunk-EH6XD3FY.js.map +1 -0
  115. package/dist/{chunk-KQRW2GPZ.js → chunk-EIQFAOFD.js} +6 -6
  116. package/dist/chunk-EIQFAOFD.js.map +1 -0
  117. package/dist/{chunk-XJCXEKMD.cjs → chunk-EXTRW7GW.cjs} +4 -4
  118. package/dist/chunk-EXTRW7GW.cjs.map +1 -0
  119. package/dist/{chunk-U54XCYG3.js → chunk-FJWQP6EE.js} +12 -6
  120. package/dist/chunk-FJWQP6EE.js.map +1 -0
  121. package/dist/{chunk-O7DK5PBJ.cjs → chunk-FUSDYC2B.cjs} +26 -42
  122. package/dist/chunk-FUSDYC2B.cjs.map +1 -0
  123. package/dist/{chunk-4QZSA2HJ.js → chunk-G7BLGBRN.js} +4 -4
  124. package/dist/chunk-G7BLGBRN.js.map +1 -0
  125. package/dist/{chunk-BZRFXJHA.js → chunk-GBCVPKHE.js} +55 -26
  126. package/dist/chunk-GBCVPKHE.js.map +1 -0
  127. package/dist/chunk-GGZ5GPE3.cjs +130 -0
  128. package/dist/chunk-GGZ5GPE3.cjs.map +1 -0
  129. package/dist/{chunk-5HEG4CQH.cjs → chunk-GZV6AVRL.cjs} +8 -8
  130. package/dist/{chunk-5HEG4CQH.cjs.map → chunk-GZV6AVRL.cjs.map} +1 -1
  131. package/dist/{chunk-VCLBZAZU.cjs → chunk-H6YM3PV6.cjs} +17 -17
  132. package/dist/chunk-H6YM3PV6.cjs.map +1 -0
  133. package/dist/{chunk-RFMBZPOW.cjs → chunk-HCT4HPCL.cjs} +10 -10
  134. package/dist/chunk-HCT4HPCL.cjs.map +1 -0
  135. package/dist/{chunk-OSEG74VJ.js → chunk-HFEJE7AC.js} +52 -43
  136. package/dist/chunk-HFEJE7AC.js.map +1 -0
  137. package/dist/{chunk-52NKC5HT.cjs → chunk-HUFSABUZ.cjs} +12 -8
  138. package/dist/chunk-HUFSABUZ.cjs.map +1 -0
  139. package/dist/{chunk-4CLOXP6H.cjs → chunk-HW7SEELD.cjs} +4 -4
  140. package/dist/{chunk-4CLOXP6H.cjs.map → chunk-HW7SEELD.cjs.map} +1 -1
  141. package/dist/{chunk-ZSWPZ23K.cjs → chunk-I2PWY7VM.cjs} +5 -5
  142. package/dist/chunk-I2PWY7VM.cjs.map +1 -0
  143. package/dist/{chunk-VJ26EKGJ.cjs → chunk-IJ7M6GOG.cjs} +3 -3
  144. package/dist/chunk-IJ7M6GOG.cjs.map +1 -0
  145. package/dist/{chunk-SAVIWMZB.js → chunk-ILGZ2ZZV.js} +3 -3
  146. package/dist/chunk-ILGZ2ZZV.js.map +1 -0
  147. package/dist/{chunk-4ZHTIJNE.cjs → chunk-J7J7J2GN.cjs} +87 -63
  148. package/dist/chunk-J7J7J2GN.cjs.map +1 -0
  149. package/dist/{chunk-UALX2J2Q.cjs → chunk-JLRLCBJ4.cjs} +38 -11
  150. package/dist/chunk-JLRLCBJ4.cjs.map +1 -0
  151. package/dist/{chunk-2QDYBS2A.js → chunk-JMDDYA22.js} +4 -4
  152. package/dist/chunk-JMDDYA22.js.map +1 -0
  153. package/dist/{chunk-LXQ6HKPS.js → chunk-JNAA4G4H.js} +3 -3
  154. package/dist/{chunk-LXQ6HKPS.js.map → chunk-JNAA4G4H.js.map} +1 -1
  155. package/dist/{chunk-UMP6OJIM.js → chunk-JOFVLOFY.js} +4 -4
  156. package/dist/{chunk-UMP6OJIM.js.map → chunk-JOFVLOFY.js.map} +1 -1
  157. package/dist/{chunk-A46SWMIF.js → chunk-K2VMFZQ5.js} +7 -7
  158. package/dist/chunk-K2VMFZQ5.js.map +1 -0
  159. package/dist/{chunk-DN2PACRI.js → chunk-K3NH62DG.js} +461 -282
  160. package/dist/chunk-K3NH62DG.js.map +1 -0
  161. package/dist/{chunk-LYTOXSRH.js → chunk-KDR53EO7.js} +1939 -1864
  162. package/dist/chunk-KDR53EO7.js.map +1 -0
  163. package/dist/{chunk-XWTLIGO3.cjs → chunk-KTTHHYEW.cjs} +5 -5
  164. package/dist/chunk-KTTHHYEW.cjs.map +1 -0
  165. package/dist/{chunk-3FFAEAUJ.cjs → chunk-KVSAY6NZ.cjs} +18 -18
  166. package/dist/chunk-KVSAY6NZ.cjs.map +1 -0
  167. package/dist/{chunk-IAHZCGBE.cjs → chunk-LHSWHYF3.cjs} +120 -146
  168. package/dist/chunk-LHSWHYF3.cjs.map +1 -0
  169. package/dist/{chunk-3OR54XG4.js → chunk-NJWYQWDL.js} +12 -8
  170. package/dist/chunk-NJWYQWDL.js.map +1 -0
  171. package/dist/chunk-NVXXWAU7.cjs +13 -0
  172. package/dist/chunk-NVXXWAU7.cjs.map +1 -0
  173. package/dist/{chunk-2D34UTDC.js → chunk-O6USDERH.js} +31 -11
  174. package/dist/chunk-O6USDERH.js.map +1 -0
  175. package/dist/{chunk-XO4SOZN6.js → chunk-OR6XIWLB.js} +4 -4
  176. package/dist/{chunk-XO4SOZN6.js.map → chunk-OR6XIWLB.js.map} +1 -1
  177. package/dist/{chunk-4PYZ5AX3.cjs → chunk-PRZ3BES7.cjs} +16 -8
  178. package/dist/chunk-PRZ3BES7.cjs.map +1 -0
  179. package/dist/{chunk-HCZD23VS.cjs → chunk-QC55H6RJ.cjs} +65 -39
  180. package/dist/chunk-QC55H6RJ.cjs.map +1 -0
  181. package/dist/{chunk-4O5TGQBW.cjs → chunk-QME6FDFG.cjs} +9 -5
  182. package/dist/chunk-QME6FDFG.cjs.map +1 -0
  183. package/dist/chunk-QOGNZMHD.cjs +34 -0
  184. package/dist/chunk-QOGNZMHD.cjs.map +1 -0
  185. package/dist/{chunk-7VT4P3Z4.cjs → chunk-QUAEOKDW.cjs} +1642 -1567
  186. package/dist/chunk-QUAEOKDW.cjs.map +1 -0
  187. package/dist/{chunk-B2J4ZMZL.cjs → chunk-QWD3CZWE.cjs} +6 -5
  188. package/dist/chunk-QWD3CZWE.cjs.map +1 -0
  189. package/dist/{chunk-SZVR77EJ.cjs → chunk-QWD4RDZ3.cjs} +15 -24
  190. package/dist/chunk-QWD4RDZ3.cjs.map +1 -0
  191. package/dist/{chunk-7BG5UH3T.cjs → chunk-RHZ6HP23.cjs} +4 -4
  192. package/dist/chunk-RHZ6HP23.cjs.map +1 -0
  193. package/dist/{chunk-2HVF2WJY.cjs → chunk-RQMCOFAI.cjs} +8 -8
  194. package/dist/{chunk-2HVF2WJY.cjs.map → chunk-RQMCOFAI.cjs.map} +1 -1
  195. package/dist/{chunk-VKJ7V7EB.cjs → chunk-SA6K24NB.cjs} +3 -3
  196. package/dist/chunk-SA6K24NB.cjs.map +1 -0
  197. package/dist/{chunk-7AD3ZTZL.js → chunk-SAGRF4IB.js} +3 -3
  198. package/dist/chunk-SAGRF4IB.js.map +1 -0
  199. package/dist/{chunk-PUAEFLYK.js → chunk-SVQIW5RJ.js} +4 -4
  200. package/dist/{chunk-PUAEFLYK.js.map → chunk-SVQIW5RJ.js.map} +1 -1
  201. package/dist/{chunk-43ZQRWAP.cjs → chunk-SYVWE64W.cjs} +22 -22
  202. package/dist/chunk-SYVWE64W.cjs.map +1 -0
  203. package/dist/{chunk-3O42QOMJ.js → chunk-TA3K7SBK.js} +7 -6
  204. package/dist/chunk-TA3K7SBK.js.map +1 -0
  205. package/dist/{chunk-LYRDF5TQ.cjs → chunk-TFG5IBZS.cjs} +14 -23
  206. package/dist/chunk-TFG5IBZS.cjs.map +1 -0
  207. package/dist/{chunk-GKEFRLU7.cjs → chunk-TMKTSYDS.cjs} +6 -6
  208. package/dist/{chunk-GKEFRLU7.cjs.map → chunk-TMKTSYDS.cjs.map} +1 -1
  209. package/dist/{chunk-J24VJOH3.cjs → chunk-UADQJBHR.cjs} +31 -11
  210. package/dist/chunk-UADQJBHR.cjs.map +1 -0
  211. package/dist/{chunk-TAZVKYWJ.js → chunk-UBR5PWD7.js} +26 -40
  212. package/dist/chunk-UBR5PWD7.js.map +1 -0
  213. package/dist/{chunk-IPYYKCRC.js → chunk-UFPUHJWS.js} +5 -5
  214. package/dist/{chunk-IPYYKCRC.js.map → chunk-UFPUHJWS.js.map} +1 -1
  215. package/dist/{chunk-OHLDPWTA.cjs → chunk-UGRS7ZA7.cjs} +15 -15
  216. package/dist/{chunk-OHLDPWTA.cjs.map → chunk-UGRS7ZA7.cjs.map} +1 -1
  217. package/dist/{chunk-RIAM53CP.js → chunk-UKMBRMGT.js} +3 -3
  218. package/dist/chunk-UKMBRMGT.js.map +1 -0
  219. package/dist/{chunk-L4BDVXIM.js → chunk-UNK4HNJH.js} +97 -123
  220. package/dist/chunk-UNK4HNJH.js.map +1 -0
  221. package/dist/{chunk-C3NT3PVE.js → chunk-V22DZIXO.js} +3 -3
  222. package/dist/chunk-V22DZIXO.js.map +1 -0
  223. package/dist/{chunk-OFRFZRQ4.cjs → chunk-V6ZY4AX6.cjs} +24 -14
  224. package/dist/chunk-V6ZY4AX6.cjs.map +1 -0
  225. package/dist/{chunk-B3IMEBOA.js → chunk-VE6DFSKU.js} +3 -3
  226. package/dist/{chunk-B3IMEBOA.js.map → chunk-VE6DFSKU.js.map} +1 -1
  227. package/dist/{chunk-WLQNMXQE.js → chunk-VWUXIVEI.js} +53 -26
  228. package/dist/chunk-VWUXIVEI.js.map +1 -0
  229. package/dist/{chunk-GMLBYDW4.cjs → chunk-VXDEKILY.cjs} +108 -109
  230. package/dist/chunk-VXDEKILY.cjs.map +1 -0
  231. package/dist/{chunk-ACDLHN3W.js → chunk-WJXOICRC.js} +16 -6
  232. package/dist/chunk-WJXOICRC.js.map +1 -0
  233. package/dist/{chunk-7YGCPMGB.js → chunk-XB4GI5RZ.js} +27 -12
  234. package/dist/chunk-XB4GI5RZ.js.map +1 -0
  235. package/dist/{chunk-O73J46PV.js → chunk-XDANGA2C.js} +5 -5
  236. package/dist/{chunk-O73J46PV.js.map → chunk-XDANGA2C.js.map} +1 -1
  237. package/dist/{chunk-NDGGJQTZ.js → chunk-XJZEBGXD.js} +10 -10
  238. package/dist/chunk-XJZEBGXD.js.map +1 -0
  239. package/dist/{chunk-UTSRIDKZ.js → chunk-XYFGKVZ7.js} +3 -3
  240. package/dist/chunk-XYFGKVZ7.js.map +1 -0
  241. package/dist/{chunk-RMWTPV3M.cjs → chunk-Y2KYR2ED.cjs} +27 -27
  242. package/dist/chunk-Y2KYR2ED.cjs.map +1 -0
  243. package/dist/{chunk-O7LZFG6O.cjs → chunk-YIFFF23U.cjs} +5 -5
  244. package/dist/chunk-YIFFF23U.cjs.map +1 -0
  245. package/dist/{chunk-4OTIXDMU.cjs → chunk-YJNYDJ2T.cjs} +12 -4
  246. package/dist/chunk-YJNYDJ2T.cjs.map +1 -0
  247. package/dist/{chunk-6JSIEDKL.cjs → chunk-YSTXFWQE.cjs} +13 -7
  248. package/dist/chunk-YSTXFWQE.cjs.map +1 -0
  249. package/dist/{chunk-I6HGWHPU.cjs → chunk-Z3NTRKIC.cjs} +4 -4
  250. package/dist/{chunk-I6HGWHPU.cjs.map → chunk-Z3NTRKIC.cjs.map} +1 -1
  251. package/dist/{chunk-32WTYBUH.js → chunk-ZH26RNQA.js} +91 -92
  252. package/dist/chunk-ZH26RNQA.js.map +1 -0
  253. package/dist/compact-session-BHTPCIHA.cjs +61 -0
  254. package/dist/{compact-session-QV57KR66.cjs.map → compact-session-BHTPCIHA.cjs.map} +1 -1
  255. package/dist/compact-session-W4WLJTHA.js +24 -0
  256. package/dist/{compact-session-RIGOWC4Y.js.map → compact-session-W4WLJTHA.js.map} +1 -1
  257. package/dist/compaction.cjs +20 -17
  258. package/dist/compaction.d.cts +15 -1
  259. package/dist/compaction.d.ts +15 -1
  260. package/dist/compaction.js +3 -4
  261. package/dist/concurrency.cjs +6 -7
  262. package/dist/concurrency.cjs.map +1 -1
  263. package/dist/concurrency.d.cts +6 -3
  264. package/dist/concurrency.d.ts +6 -3
  265. package/dist/concurrency.js +4 -5
  266. package/dist/concurrency.js.map +1 -1
  267. package/dist/context/index.cjs +6 -6
  268. package/dist/context/index.js +3 -3
  269. package/dist/context-NI33FS2R.cjs +23 -0
  270. package/dist/{context-WFLTTMK3.cjs.map → context-NI33FS2R.cjs.map} +1 -1
  271. package/dist/context-Y7B7SI5X.js +6 -0
  272. package/dist/{context-WI2DFG7V.js.map → context-Y7B7SI5X.js.map} +1 -1
  273. package/dist/create-skill.d.ts +4 -1
  274. package/dist/{cron-BuiRPrvt.d.cts → cron-C3PhZED0.d.cts} +8 -2
  275. package/dist/{cron-C2SIi31n.d.ts → cron-crfMMdAw.d.ts} +8 -2
  276. package/dist/cron.cjs +46 -45
  277. package/dist/cron.d.cts +5 -4
  278. package/dist/cron.d.ts +5 -4
  279. package/dist/cron.js +45 -44
  280. package/dist/{errors-BgJH9PHi.d.cts → errors-CLOAyuiv.d.ts} +133 -95
  281. package/dist/{errors-C5fJUqLk.d.ts → errors-DrDEgyz1.d.cts} +133 -95
  282. package/dist/errors-base-B5g01neU.d.cts +75 -0
  283. package/dist/errors-base-B5g01neU.d.ts +75 -0
  284. package/dist/errors-base.d.ts +73 -0
  285. package/dist/errors.cjs +25 -22
  286. package/dist/errors.d.cts +3 -2
  287. package/dist/errors.d.ts +3 -2
  288. package/dist/errors.js +2 -3
  289. package/dist/eval.cjs +74 -78
  290. package/dist/eval.cjs.map +1 -1
  291. package/dist/eval.js +64 -68
  292. package/dist/eval.js.map +1 -1
  293. package/dist/{executor-6CYCA7MI.cjs → executor-XQAOQOHD.cjs} +60 -54
  294. package/dist/executor-XQAOQOHD.cjs.map +1 -0
  295. package/dist/{executor-QSEC3MRH.js → executor-ZNDQDX6Q.js} +43 -37
  296. package/dist/executor-ZNDQDX6Q.js.map +1 -0
  297. package/dist/filesystem/index.cjs +24 -26
  298. package/dist/filesystem/index.cjs.map +1 -1
  299. package/dist/filesystem/index.js +20 -22
  300. package/dist/filesystem/index.js.map +1 -1
  301. package/dist/filesystem/types.d.cts +11 -5
  302. package/dist/filesystem/types.d.ts +11 -5
  303. package/dist/{fork-agent-RSV4E3EA.js → fork-agent-S2EPIML7.js} +3 -3
  304. package/dist/fork-agent-S2EPIML7.js.map +1 -0
  305. package/dist/{fork-agent-Y2IK2RYU.cjs → fork-agent-WAEQI2DL.cjs} +4 -4
  306. package/dist/fork-agent-WAEQI2DL.cjs.map +1 -0
  307. package/dist/fs-session-store-77JU46UZ.js +10 -0
  308. package/dist/{fs-session-store-NM6YSTE2.js.map → fs-session-store-77JU46UZ.js.map} +1 -1
  309. package/dist/fs-session-store-E4U3P56L.cjs +19 -0
  310. package/dist/{fs-session-store-4PIHT5UX.cjs.map → fs-session-store-E4U3P56L.cjs.map} +1 -1
  311. package/dist/generate-object-BXV7BZRP.js +7 -0
  312. package/dist/{generate-object-GUNAUVBX.js.map → generate-object-BXV7BZRP.js.map} +1 -1
  313. package/dist/generate-object-YBI2TDJ3.cjs +20 -0
  314. package/dist/{generate-object-R7HTMW7F.cjs.map → generate-object-YBI2TDJ3.cjs.map} +1 -1
  315. package/dist/generate-object.d.ts +2 -4
  316. package/dist/index-manager-DXR2RSFI.cjs +26 -0
  317. package/dist/{index-manager-2SRX45WJ.cjs.map → index-manager-DXR2RSFI.cjs.map} +1 -1
  318. package/dist/index-manager-QH6OXEV5.js +17 -0
  319. package/dist/{index-manager-SP4ISSDX.js.map → index-manager-QH6OXEV5.js.map} +1 -1
  320. package/dist/index.cjs +234 -194
  321. package/dist/index.cjs.map +1 -1
  322. package/dist/index.d.cts +243 -41
  323. package/dist/index.d.ts +243 -41
  324. package/dist/index.js +140 -102
  325. package/dist/index.js.map +1 -1
  326. package/dist/{inject-session-DAR7OUCW.js → inject-session-SUM6TDJF.js} +9 -9
  327. package/dist/{inject-session-DAR7OUCW.js.map → inject-session-SUM6TDJF.js.map} +1 -1
  328. package/dist/inject-session-W6A46J3E.cjs +29 -0
  329. package/dist/{inject-session-WQKMC3GR.cjs.map → inject-session-W6A46J3E.cjs.map} +1 -1
  330. package/dist/interactive/index.cjs +12 -6
  331. package/dist/interactive/index.cjs.map +1 -1
  332. package/dist/interactive/index.js +12 -6
  333. package/dist/interactive/index.js.map +1 -1
  334. package/dist/interactive/types.d.cts +14 -4
  335. package/dist/interactive/types.d.ts +14 -4
  336. package/dist/internal/agent-loop/loop-context-init.d.ts +1 -1
  337. package/dist/internal/agent-loop/loop-finalize.d.ts +25 -0
  338. package/dist/internal/agent-loop/loop.d.ts +1 -1
  339. package/dist/internal/agent-loop/message-builders.d.ts +1 -1
  340. package/dist/internal/agent-loop/tool-dispatch.d.ts +2 -2
  341. package/dist/internal/agent-loop/usage-and-cost.d.ts +1 -1
  342. package/dist/internal/auth/credential-availability.d.ts +61 -0
  343. package/dist/internal/auth/credential-store.d.ts +1 -1
  344. package/dist/internal/auth/oauth-device.d.ts +1 -1
  345. package/dist/internal/auth/oauth-engine.d.ts +1 -1
  346. package/dist/internal/auth/resolve-credential.d.ts +1 -1
  347. package/dist/internal/base-url.d.ts +14 -0
  348. package/dist/internal/cloud-agent/cloud-config-serializer.d.ts +1 -1
  349. package/dist/internal/{runtime/concurrency → concurrency}/subagent-credentials.d.ts +2 -2
  350. package/dist/internal/emit-run-event.d.ts +16 -0
  351. package/dist/internal/error-mappers/shared.d.ts +14 -1
  352. package/dist/internal/eval/assert.d.ts +2 -1
  353. package/dist/internal/eval/single-flight.d.ts +2 -1
  354. package/dist/internal/global-singleton.d.ts +6 -3
  355. package/dist/internal/llm/responses.d.ts +10 -0
  356. package/dist/internal/local-agent/local-agent-bootstrap.d.ts +5 -3
  357. package/dist/internal/local-agent/local-agent-capabilities.d.ts +38 -0
  358. package/dist/internal/local-agent/local-agent-dispatch.d.ts +2 -2
  359. package/dist/internal/local-agent/local-agent-memory-provider.d.ts +1 -1
  360. package/dist/internal/local-agent/local-agent-personality-extensions.d.ts +25 -1
  361. package/dist/internal/local-agent/local-agent-send.d.ts +42 -1
  362. package/dist/internal/local-agent/real-local-run-mcp.d.ts +26 -0
  363. package/dist/internal/local-agent/real-local-run-options.d.ts +26 -0
  364. package/dist/internal/local-agent/real-local-run-tools.d.ts +21 -4
  365. package/dist/internal/local-agent/real-local-run.d.ts +2 -2
  366. package/dist/internal/mcp/handshake-timeout.d.ts +53 -0
  367. package/dist/internal/memory/active-memory.d.ts +1 -1
  368. package/dist/internal/memory/adapters/index.cjs +10 -10
  369. package/dist/internal/memory/adapters/index.js +9 -9
  370. package/dist/internal/memory/adapters/openai-embedding.d.cts +10 -0
  371. package/dist/internal/memory/adapters/openai-embedding.d.ts +10 -0
  372. package/dist/internal/memory/corpus-sync.d.ts +23 -0
  373. package/dist/internal/memory/index-db.d.ts +15 -1
  374. package/dist/internal/memory/index-manager-contract.d.ts +12 -0
  375. package/dist/internal/memory/index-manager.d.ts +4 -10
  376. package/dist/internal/memory/index-repository.d.ts +58 -0
  377. package/dist/internal/memory/lance-memory-adapter.d.ts +16 -14
  378. package/dist/internal/memory/memory-index.d.ts +15 -0
  379. package/dist/internal/memory/sdk-memory-peer-loader.d.ts +54 -1
  380. package/dist/internal/memory/storage/index.cjs +39 -40
  381. package/dist/internal/memory/storage/index.js +10 -11
  382. package/dist/internal/memory/storage/memory-root.d.cts +2 -3
  383. package/dist/internal/memory/storage/memory-root.d.ts +2 -3
  384. package/dist/internal/persistence/atomic-write.d.cts +4 -4
  385. package/dist/internal/persistence/atomic-write.d.ts +4 -4
  386. package/dist/internal/persistence/index.cjs +24 -25
  387. package/dist/internal/persistence/index.cjs.map +1 -1
  388. package/dist/internal/persistence/index.js +7 -8
  389. package/dist/internal/persistence/index.js.map +1 -1
  390. package/dist/internal/persistence/jsonl.d.cts +3 -1
  391. package/dist/internal/persistence/jsonl.d.ts +3 -1
  392. package/dist/internal/persistence/paths.d.cts +25 -12
  393. package/dist/internal/persistence/paths.d.ts +25 -12
  394. package/dist/internal/persistence/transcript-ops.d.cts +11 -2
  395. package/dist/internal/persistence/transcript-ops.d.ts +11 -2
  396. package/dist/internal/plugins/context.d.cts +0 -10
  397. package/dist/internal/plugins/context.d.ts +0 -10
  398. package/dist/internal/plugins/types.d.cts +1 -1
  399. package/dist/internal/plugins/types.d.ts +1 -1
  400. package/dist/internal/providers/catalog-schema.d.ts +94 -0
  401. package/dist/internal/providers/catalog-source-models-dev.d.ts +11 -0
  402. package/dist/internal/runtime/compat/compat-config-file.d.ts +31 -0
  403. package/dist/internal/runtime/compat/foreign-config-sources.d.ts +58 -34
  404. package/dist/internal/runtime/compression/compression-model-registry.d.ts +1 -1
  405. package/dist/internal/runtime/compression/compression-summarizer.d.ts +5 -1
  406. package/dist/internal/runtime/fixtures/fixture-events.d.ts +1 -1
  407. package/dist/internal/runtime/fixtures/fixture-mode.d.ts +8 -14
  408. package/dist/internal/runtime/fixtures/fixture-run-base.d.ts +1 -1
  409. package/dist/internal/runtime/fixtures/fixture-scripts.d.ts +2 -2
  410. package/dist/internal/runtime/hooks/hooks-executor.d.ts +6 -1
  411. package/dist/internal/runtime/lifecycle/wrap-completion-check-run.d.ts +1 -1
  412. package/dist/internal/runtime/{memory → memory-glue}/memory-provider.d.ts +1 -1
  413. package/dist/internal/runtime/{plugins → plugin-loader}/plugin-bundles.d.ts +4 -1
  414. package/dist/internal/runtime/processors/wrap-output-run.d.ts +1 -1
  415. package/dist/internal/runtime/registry/live-agent-registry.d.ts +9 -1
  416. package/dist/internal/runtime/system-prompt/local-assembly.d.ts +2 -1
  417. package/dist/internal/scorers/llm-judge.d.ts +12 -0
  418. package/dist/internal/security/index.cjs +14 -15
  419. package/dist/internal/security/index.d.cts +6 -1
  420. package/dist/internal/security/index.d.ts +6 -1
  421. package/dist/internal/security/index.js +4 -5
  422. package/dist/internal/security/path-containment.d.ts +24 -0
  423. package/dist/internal/session/agent-session-store.d.ts +1 -1
  424. package/dist/internal/session/agent-session.d.ts +1 -1
  425. package/dist/internal/session/index.d.ts +1 -1
  426. package/dist/internal/session/session-cache.d.ts +9 -3
  427. package/dist/internal/task/registry.d.ts +1 -1
  428. package/dist/internal/task/store.d.ts +1 -1
  429. package/dist/internal/task/subscribe.d.ts +1 -1
  430. package/dist/internal/task/task-id.d.ts +22 -0
  431. package/dist/internal/telemetry/adapter-registry.d.ts +12 -2
  432. package/dist/internal/telemetry/adapters/braintrust.d.ts +6 -1
  433. package/dist/internal/telemetry/adapters/langsmith.d.ts +6 -1
  434. package/dist/internal/workflow/executor.d.ts +2 -1
  435. package/dist/internal/workflow/snapshot-store.d.ts +1 -1
  436. package/dist/internal/workflow/step-branch.d.ts +2 -2
  437. package/dist/internal/workflow/step-dowhile.d.ts +2 -2
  438. package/dist/internal/workflow/step-execution.d.ts +25 -0
  439. package/dist/internal/workflow/step-foreach.d.ts +2 -2
  440. package/dist/internal/workflow/step-parallel.d.ts +2 -2
  441. package/dist/judge-call-6MVARKU2.js +5 -0
  442. package/dist/{judge-call-LVXABPS3.js.map → judge-call-6MVARKU2.js.map} +1 -1
  443. package/dist/judge-call-I3P4D5QR.cjs +22 -0
  444. package/dist/{judge-call-LAHMBJ57.cjs.map → judge-call-I3P4D5QR.cjs.map} +1 -1
  445. package/dist/mcp-auth.cjs +14 -15
  446. package/dist/mcp-auth.cjs.map +1 -1
  447. package/dist/mcp-auth.d.cts +2 -0
  448. package/dist/mcp-auth.d.ts +2 -0
  449. package/dist/mcp-auth.js +4 -5
  450. package/dist/mcp-auth.js.map +1 -1
  451. package/dist/models.cjs +52 -42
  452. package/dist/models.cjs.map +1 -1
  453. package/dist/models.js +39 -29
  454. package/dist/models.js.map +1 -1
  455. package/dist/oauth-transaction-store-5RIR6D5C.js +5 -0
  456. package/dist/{oauth-transaction-store-W52KVHQ4.js.map → oauth-transaction-store-5RIR6D5C.js.map} +1 -1
  457. package/dist/oauth-transaction-store-SXIE57OD.cjs +38 -0
  458. package/dist/{oauth-transaction-store-BT4GLTLK.cjs.map → oauth-transaction-store-SXIE57OD.cjs.map} +1 -1
  459. package/dist/path-safety.cjs +11 -12
  460. package/dist/path-safety.d.cts +2 -0
  461. package/dist/path-safety.d.ts +2 -0
  462. package/dist/path-safety.js +4 -5
  463. package/dist/permission-engine.d.ts +10 -17
  464. package/dist/persistence.cjs +31 -31
  465. package/dist/persistence.cjs.map +1 -1
  466. package/dist/persistence.d.cts +9 -1
  467. package/dist/persistence.d.ts +9 -1
  468. package/dist/persistence.js +12 -13
  469. package/dist/persistence.js.map +1 -1
  470. package/dist/project.cjs +5 -6
  471. package/dist/project.cjs.map +1 -1
  472. package/dist/project.js +3 -4
  473. package/dist/project.js.map +1 -1
  474. package/dist/providers.cjs +10 -10
  475. package/dist/providers.d.cts +2 -0
  476. package/dist/providers.d.ts +2 -0
  477. package/dist/providers.js +8 -8
  478. package/dist/registry-BZQFYRTL.cjs +46 -0
  479. package/dist/{registry-V7BDQ6QB.cjs.map → registry-BZQFYRTL.cjs.map} +1 -1
  480. package/dist/registry-DMWCJKRF.js +9 -0
  481. package/dist/{registry-75W33OGL.js.map → registry-DMWCJKRF.js.map} +1 -1
  482. package/dist/retry.cjs +4 -5
  483. package/dist/retry.d.cts +20 -5
  484. package/dist/retry.d.ts +20 -5
  485. package/dist/retry.js +3 -4
  486. package/dist/{run-BYSHf58D.d.ts → run-CTAdRU3U.d.cts} +120 -152
  487. package/dist/{run-BYSHf58D.d.cts → run-CTAdRU3U.d.ts} +120 -152
  488. package/dist/{run-until-HEQOUVU6.js → run-until-6D6TQ4JN.js} +27 -59
  489. package/dist/run-until-6D6TQ4JN.js.map +1 -0
  490. package/dist/{run-until-U2B5FJJI.cjs → run-until-DG2KXWB2.cjs} +27 -59
  491. package/dist/run-until-DG2KXWB2.cjs.map +1 -0
  492. package/dist/sandbox/bwrap.d.cts +11 -1
  493. package/dist/sandbox/bwrap.d.ts +11 -1
  494. package/dist/sandbox/index.cjs +26 -30
  495. package/dist/sandbox/index.cjs.map +1 -1
  496. package/dist/sandbox/index.d.cts +8 -1
  497. package/dist/sandbox/index.d.ts +8 -1
  498. package/dist/sandbox/index.js +10 -14
  499. package/dist/sandbox/index.js.map +1 -1
  500. package/dist/sandbox/linux-sandbox.d.cts +20 -4
  501. package/dist/sandbox/linux-sandbox.d.ts +20 -4
  502. package/dist/sandbox/types.d.cts +18 -2
  503. package/dist/sandbox/types.d.ts +18 -2
  504. package/dist/sanitize/index.cjs +2 -2
  505. package/dist/sanitize/index.js +1 -1
  506. package/dist/sanitize/types.d.cts +15 -2
  507. package/dist/sanitize/types.d.ts +15 -2
  508. package/dist/{sdk-agent-D8qJVkuV.d.ts → sdk-agent-BOiKqOgL.d.cts} +197 -117
  509. package/dist/{sdk-agent-DEoKhA8a.d.cts → sdk-agent-D4a_BR_6.d.ts} +197 -117
  510. package/dist/server/auth/errors.d.cts +4 -3
  511. package/dist/server/auth/errors.d.ts +4 -3
  512. package/dist/server/auth/index.cjs +28 -28
  513. package/dist/server/auth/index.cjs.map +1 -1
  514. package/dist/server/auth/index.d.cts +28 -5
  515. package/dist/server/auth/index.d.ts +28 -5
  516. package/dist/server/auth/index.js +13 -13
  517. package/dist/server/auth/index.js.map +1 -1
  518. package/dist/server/auth/oauth-transaction-store.d.cts +2 -1
  519. package/dist/server/auth/oauth-transaction-store.d.ts +2 -1
  520. package/dist/server/auth/orchestrator.d.cts +4 -1
  521. package/dist/server/auth/orchestrator.d.ts +4 -1
  522. package/dist/server/auth/types.d.cts +18 -0
  523. package/dist/server/auth/types.d.ts +18 -0
  524. package/dist/server/errors-envelope.cjs +14 -15
  525. package/dist/server/errors-envelope.cjs.map +1 -1
  526. package/dist/server/errors-envelope.d.cts +3 -3
  527. package/dist/server/errors-envelope.d.ts +3 -3
  528. package/dist/server/errors-envelope.js +3 -4
  529. package/dist/server/errors-envelope.js.map +1 -1
  530. package/dist/session-transcript-LGHSNVY5.cjs +62 -0
  531. package/dist/{session-transcript-6WNITKRE.cjs.map → session-transcript-LGHSNVY5.cjs.map} +1 -1
  532. package/dist/session-transcript-VTBTCGQX.js +5 -0
  533. package/dist/{session-transcript-XAEKW6P7.js.map → session-transcript-VTBTCGQX.js.map} +1 -1
  534. package/dist/skills.cjs +8 -9
  535. package/dist/skills.js +6 -7
  536. package/dist/stream-object-HBFMIZLD.js +7 -0
  537. package/dist/{stream-object-UF4QRQRU.js.map → stream-object-HBFMIZLD.js.map} +1 -1
  538. package/dist/stream-object-QSKHISDJ.cjs +20 -0
  539. package/dist/{stream-object-ZJTQNKY3.cjs.map → stream-object-QSKHISDJ.cjs.map} +1 -1
  540. package/dist/stream-object.d.ts +2 -4
  541. package/dist/subagents-loader-TPZLTXYZ.cjs +16 -0
  542. package/dist/{subagents-loader-UCNO7FUH.cjs.map → subagents-loader-TPZLTXYZ.cjs.map} +1 -1
  543. package/dist/subagents-loader-Y6JFYXAY.js +7 -0
  544. package/dist/{subagents-loader-XP5ERVDZ.js.map → subagents-loader-Y6JFYXAY.js.map} +1 -1
  545. package/dist/subagents-loader.cjs +7 -8
  546. package/dist/subagents-loader.cjs.map +1 -1
  547. package/dist/subagents-loader.d.cts +5 -3
  548. package/dist/subagents-loader.d.ts +5 -3
  549. package/dist/subagents-loader.js +5 -6
  550. package/dist/subagents-loader.js.map +1 -1
  551. package/dist/subagents.cjs +2 -2
  552. package/dist/subagents.cjs.map +1 -1
  553. package/dist/subagents.js +1 -1
  554. package/dist/subagents.js.map +1 -1
  555. package/dist/subscription/define-subscription.d.cts +4 -1
  556. package/dist/subscription/define-subscription.d.ts +4 -1
  557. package/dist/subscription/index.cjs +4 -5
  558. package/dist/subscription/index.cjs.map +1 -1
  559. package/dist/subscription/index.d.cts +2 -0
  560. package/dist/subscription/index.d.ts +2 -0
  561. package/dist/subscription/index.js +3 -4
  562. package/dist/subscription/index.js.map +1 -1
  563. package/dist/subscription/internal/server-integration.d.cts +5 -0
  564. package/dist/subscription/internal/server-integration.d.ts +5 -0
  565. package/dist/subscription/internal/subscription-runtime.d.cts +13 -1
  566. package/dist/subscription/internal/subscription-runtime.d.ts +13 -1
  567. package/dist/task-errors.d.ts +58 -0
  568. package/dist/task-store.cjs +7 -8
  569. package/dist/task-store.d.cts +2 -0
  570. package/dist/task-store.d.ts +2 -0
  571. package/dist/task-store.js +4 -5
  572. package/dist/types/agent-prims.d.ts +21 -0
  573. package/dist/types/agent.d.ts +109 -15
  574. package/dist/types/batch.d.ts +3 -0
  575. package/dist/types/budget-tracker.d.ts +3 -0
  576. package/dist/types/budget.d.ts +12 -3
  577. package/dist/types/content-blocks.d.ts +3 -0
  578. package/dist/types/context.d.ts +3 -0
  579. package/dist/types/conversation.d.ts +5 -0
  580. package/dist/types/cron.d.ts +5 -0
  581. package/dist/types/env-policy.d.ts +3 -0
  582. package/dist/types/eval.d.ts +3 -0
  583. package/dist/types/fork.d.ts +3 -0
  584. package/dist/types/goal-events.d.ts +3 -0
  585. package/dist/types/mcp.d.ts +5 -0
  586. package/dist/types/memory-adapter.d.ts +3 -0
  587. package/dist/types/memory-provider.d.ts +44 -5
  588. package/dist/types/messages-base.d.ts +4 -0
  589. package/dist/types/messages.d.ts +5 -0
  590. package/dist/types/plugin.d.ts +32 -4
  591. package/dist/types/processors.d.ts +3 -0
  592. package/dist/types/provider-profile.d.ts +3 -0
  593. package/dist/types/providers.d.ts +3 -0
  594. package/dist/types/run-events.d.ts +36 -9
  595. package/dist/types/run.d.ts +29 -2
  596. package/dist/types/sdk-agent.d.ts +71 -1
  597. package/dist/types/session-message.d.ts +3 -0
  598. package/dist/types/session-record.d.ts +3 -0
  599. package/dist/types/session-store.d.ts +45 -0
  600. package/dist/types/task.d.ts +3 -11
  601. package/dist/types/theokit.d.ts +3 -0
  602. package/dist/types/trajectory.d.ts +3 -0
  603. package/dist/types/updates.d.ts +5 -0
  604. package/dist/types/usage.d.ts +4 -1
  605. package/dist/types/workflow.d.ts +13 -135
  606. package/dist/workflow-as-tool.d.ts +66 -0
  607. package/dist/workflow-errors.d.ts +164 -0
  608. package/dist/workflow.cjs +29 -30
  609. package/dist/workflow.d.cts +135 -74
  610. package/dist/workflow.d.ts +135 -74
  611. package/dist/workflow.js +8 -9
  612. package/docs/adr/README.md +2604 -0
  613. package/docs/error-codes.md +139 -105
  614. package/docs/harness-capability-map.md +32 -20
  615. package/docs/memory-decisions.md +1 -1
  616. package/package.json +3 -7
  617. package/bin/theokit-migrate-config.mjs +0 -278
  618. package/bin/theokit-migrate-memory.mjs +0 -116
  619. package/dist/agent-A5XMIVNP.js +0 -57
  620. package/dist/agent-UX7WFI6B.cjs +0 -66
  621. package/dist/agent-session-store-6EL5NPA4.cjs +0 -24
  622. package/dist/agent-session-store-OPGRB4XM.js +0 -7
  623. package/dist/batch-BXYTW2DP.cjs.map +0 -1
  624. package/dist/batch-L4ZXS46M.js.map +0 -1
  625. package/dist/chunk-247ZTLNU.js +0 -73
  626. package/dist/chunk-247ZTLNU.js.map +0 -1
  627. package/dist/chunk-2D34UTDC.js.map +0 -1
  628. package/dist/chunk-2GUYQR5P.js.map +0 -1
  629. package/dist/chunk-2QDYBS2A.js.map +0 -1
  630. package/dist/chunk-32WTYBUH.js.map +0 -1
  631. package/dist/chunk-3FFAEAUJ.cjs.map +0 -1
  632. package/dist/chunk-3O42QOMJ.js.map +0 -1
  633. package/dist/chunk-3OR54XG4.js.map +0 -1
  634. package/dist/chunk-43ZQRWAP.cjs.map +0 -1
  635. package/dist/chunk-4FFBAUFS.js.map +0 -1
  636. package/dist/chunk-4O5TGQBW.cjs.map +0 -1
  637. package/dist/chunk-4OTIXDMU.cjs.map +0 -1
  638. package/dist/chunk-4PYZ5AX3.cjs.map +0 -1
  639. package/dist/chunk-4QZSA2HJ.js.map +0 -1
  640. package/dist/chunk-4ZHTIJNE.cjs.map +0 -1
  641. package/dist/chunk-52NKC5HT.cjs.map +0 -1
  642. package/dist/chunk-6HKGLTJI.cjs.map +0 -1
  643. package/dist/chunk-6JSIEDKL.cjs.map +0 -1
  644. package/dist/chunk-7AD3ZTZL.js.map +0 -1
  645. package/dist/chunk-7BG5UH3T.cjs.map +0 -1
  646. package/dist/chunk-7VT4P3Z4.cjs.map +0 -1
  647. package/dist/chunk-7YGCPMGB.js.map +0 -1
  648. package/dist/chunk-A46SWMIF.js.map +0 -1
  649. package/dist/chunk-A4JVILQU.js.map +0 -1
  650. package/dist/chunk-ACDLHN3W.js.map +0 -1
  651. package/dist/chunk-AKJP2STZ.cjs +0 -81
  652. package/dist/chunk-AKJP2STZ.cjs.map +0 -1
  653. package/dist/chunk-AWO27VRZ.js.map +0 -1
  654. package/dist/chunk-B2J4ZMZL.cjs.map +0 -1
  655. package/dist/chunk-B4EOJWOY.cjs.map +0 -1
  656. package/dist/chunk-BU4KFWXF.js.map +0 -1
  657. package/dist/chunk-BZRFXJHA.js.map +0 -1
  658. package/dist/chunk-C3NT3PVE.js.map +0 -1
  659. package/dist/chunk-C72AZW7J.js.map +0 -1
  660. package/dist/chunk-D4CUGAKZ.js.map +0 -1
  661. package/dist/chunk-DN2PACRI.js.map +0 -1
  662. package/dist/chunk-DXGZ2NUG.cjs.map +0 -1
  663. package/dist/chunk-EG4QM7ZJ.cjs +0 -39
  664. package/dist/chunk-EG4QM7ZJ.cjs.map +0 -1
  665. package/dist/chunk-GMLBYDW4.cjs.map +0 -1
  666. package/dist/chunk-HCZD23VS.cjs.map +0 -1
  667. package/dist/chunk-HS7AVXTF.js.map +0 -1
  668. package/dist/chunk-IAHZCGBE.cjs.map +0 -1
  669. package/dist/chunk-J24VJOH3.cjs.map +0 -1
  670. package/dist/chunk-JPBKYL3B.cjs +0 -18
  671. package/dist/chunk-JPBKYL3B.cjs.map +0 -1
  672. package/dist/chunk-KQ7TS7WW.cjs.map +0 -1
  673. package/dist/chunk-KQRW2GPZ.js.map +0 -1
  674. package/dist/chunk-KYAJINUI.cjs.map +0 -1
  675. package/dist/chunk-L3MTL4NA.js.map +0 -1
  676. package/dist/chunk-L4BDVXIM.js.map +0 -1
  677. package/dist/chunk-LKBEROHN.js.map +0 -1
  678. package/dist/chunk-LYRDF5TQ.cjs.map +0 -1
  679. package/dist/chunk-LYTOXSRH.js.map +0 -1
  680. package/dist/chunk-N2U4AZGB.js.map +0 -1
  681. package/dist/chunk-NDGGJQTZ.js.map +0 -1
  682. package/dist/chunk-O7DK5PBJ.cjs.map +0 -1
  683. package/dist/chunk-O7LZFG6O.cjs.map +0 -1
  684. package/dist/chunk-OFRFZRQ4.cjs.map +0 -1
  685. package/dist/chunk-OSEG74VJ.js.map +0 -1
  686. package/dist/chunk-RFMBZPOW.cjs.map +0 -1
  687. package/dist/chunk-RFXWMRFC.js.map +0 -1
  688. package/dist/chunk-RIAM53CP.js.map +0 -1
  689. package/dist/chunk-RMWTPV3M.cjs.map +0 -1
  690. package/dist/chunk-RNB4APBZ.js.map +0 -1
  691. package/dist/chunk-SAVIWMZB.js.map +0 -1
  692. package/dist/chunk-SZVR77EJ.cjs.map +0 -1
  693. package/dist/chunk-TAZVKYWJ.js.map +0 -1
  694. package/dist/chunk-U54XCYG3.js.map +0 -1
  695. package/dist/chunk-U6IFHFWK.js.map +0 -1
  696. package/dist/chunk-UALX2J2Q.cjs.map +0 -1
  697. package/dist/chunk-UBDMVMBZ.js.map +0 -1
  698. package/dist/chunk-UGT7GK7I.cjs.map +0 -1
  699. package/dist/chunk-UNYXQ4M5.js.map +0 -1
  700. package/dist/chunk-UTSRIDKZ.js.map +0 -1
  701. package/dist/chunk-UU36SHFY.cjs.map +0 -1
  702. package/dist/chunk-V2BOS4WF.cjs.map +0 -1
  703. package/dist/chunk-VCLBZAZU.cjs.map +0 -1
  704. package/dist/chunk-VJ26EKGJ.cjs.map +0 -1
  705. package/dist/chunk-VKJ7V7EB.cjs.map +0 -1
  706. package/dist/chunk-VLVVJLDH.cjs.map +0 -1
  707. package/dist/chunk-WLQNMXQE.js.map +0 -1
  708. package/dist/chunk-WNO3C3N2.cjs.map +0 -1
  709. package/dist/chunk-WTMU7J4U.js +0 -14
  710. package/dist/chunk-WTMU7J4U.js.map +0 -1
  711. package/dist/chunk-XEQ3TM66.js +0 -35
  712. package/dist/chunk-XEQ3TM66.js.map +0 -1
  713. package/dist/chunk-XJCXEKMD.cjs.map +0 -1
  714. package/dist/chunk-XL7Q7HB2.cjs.map +0 -1
  715. package/dist/chunk-XWTLIGO3.cjs.map +0 -1
  716. package/dist/chunk-YML4ME27.cjs.map +0 -1
  717. package/dist/chunk-ZSWPZ23K.cjs.map +0 -1
  718. package/dist/chunk-ZZMZWBR6.js.map +0 -1
  719. package/dist/compact-session-QV57KR66.cjs +0 -59
  720. package/dist/compact-session-RIGOWC4Y.js +0 -22
  721. package/dist/context-WFLTTMK3.cjs +0 -24
  722. package/dist/context-WI2DFG7V.js +0 -7
  723. package/dist/executor-6CYCA7MI.cjs.map +0 -1
  724. package/dist/executor-QSEC3MRH.js.map +0 -1
  725. package/dist/fork-agent-RSV4E3EA.js.map +0 -1
  726. package/dist/fork-agent-Y2IK2RYU.cjs.map +0 -1
  727. package/dist/fs-session-store-4PIHT5UX.cjs +0 -20
  728. package/dist/fs-session-store-NM6YSTE2.js +0 -11
  729. package/dist/generate-object-GUNAUVBX.js +0 -8
  730. package/dist/generate-object-R7HTMW7F.cjs +0 -21
  731. package/dist/index-manager-2SRX45WJ.cjs +0 -27
  732. package/dist/index-manager-SP4ISSDX.js +0 -18
  733. package/dist/inject-session-WQKMC3GR.cjs +0 -29
  734. package/dist/internal/persistence/credential-pool-store.d.cts +0 -32
  735. package/dist/internal/persistence/credential-pool-store.d.ts +0 -32
  736. package/dist/internal/runtime/memory/memory-path-selector.d.ts +0 -73
  737. package/dist/judge-call-LAHMBJ57.cjs +0 -23
  738. package/dist/judge-call-LVXABPS3.js +0 -6
  739. package/dist/oauth-transaction-store-BT4GLTLK.cjs +0 -36
  740. package/dist/oauth-transaction-store-W52KVHQ4.js +0 -3
  741. package/dist/registry-75W33OGL.js +0 -10
  742. package/dist/registry-V7BDQ6QB.cjs +0 -47
  743. package/dist/run-until-HEQOUVU6.js.map +0 -1
  744. package/dist/run-until-U2B5FJJI.cjs.map +0 -1
  745. package/dist/server/adapter/express.d.cts +0 -9
  746. package/dist/server/adapter/express.d.ts +0 -9
  747. package/dist/server/adapter/fastify.d.cts +0 -9
  748. package/dist/server/adapter/fastify.d.ts +0 -9
  749. package/dist/server/adapter/hono.d.cts +0 -9
  750. package/dist/server/adapter/hono.d.ts +0 -9
  751. package/dist/server/adapter/shared-handler.d.cts +0 -9
  752. package/dist/server/adapter/shared-handler.d.ts +0 -9
  753. package/dist/server/adapter/types.d.cts +0 -33
  754. package/dist/server/adapter/types.d.ts +0 -33
  755. package/dist/session-transcript-6WNITKRE.cjs +0 -63
  756. package/dist/session-transcript-XAEKW6P7.js +0 -6
  757. package/dist/stream-object-UF4QRQRU.js +0 -8
  758. package/dist/stream-object-ZJTQNKY3.cjs +0 -21
  759. package/dist/subagents-loader-UCNO7FUH.cjs +0 -17
  760. package/dist/subagents-loader-XP5ERVDZ.js +0 -8
  761. /package/dist/{batch.d.ts → internal/agent/batch.d.ts} +0 -0
  762. /package/dist/{agent-helpers.d.ts → internal/agent/helpers.d.ts} +0 -0
  763. /package/dist/internal/agent-loop/{loop-types.d.ts → types.d.ts} +0 -0
  764. /package/dist/internal/auth/{auth-types.d.ts → types.d.ts} +0 -0
  765. /package/dist/internal/cloud-agent/{cloud-payload-types.d.ts → types.d.ts} +0 -0
  766. /package/dist/internal/{runtime/concurrency → concurrency}/abort-utils.d.ts +0 -0
  767. /package/dist/internal/{runtime/concurrency → concurrency}/async-local-storage.d.ts +0 -0
  768. /package/dist/internal/{runtime/concurrency → concurrency}/async-semaphore.d.ts +0 -0
  769. /package/dist/internal/{runtime/concurrency → concurrency}/delegation-depth.d.ts +0 -0
  770. /package/dist/internal/{runtime/concurrency → concurrency}/map-with-concurrency.d.ts +0 -0
  771. /package/dist/internal/{runtime/retry → error-mappers}/default-retriable.d.ts +0 -0
  772. /package/dist/internal/{runtime/fixtures/fixture-types.d.ts → memory/storage/list-markdown.d.cts} +0 -0
  773. /package/dist/internal/{runtime/plugins/plugins-manager.d.ts → memory/storage/list-markdown.d.ts} +0 -0
  774. /package/dist/internal/{resilience → retry}/circuit-breaker.d.ts +0 -0
  775. /package/dist/internal/{runtime/retry → retry}/with-retry.d.ts +0 -0
  776. /package/dist/internal/{security/secret-redactor.d.cts → runtime/fixtures/types.d.ts} +0 -0
  777. /package/dist/internal/runtime/{memory → memory-glue}/memory-store.d.ts +0 -0
  778. /package/dist/internal/runtime/{memory → memory-glue}/select-facts.d.ts +0 -0
  779. /package/dist/internal/runtime/{plugins → plugin-loader}/plugin-frontmatter.d.ts +0 -0
  780. /package/dist/internal/{security/secret-redactor.d.ts → runtime/plugin-loader/plugins-manager.d.ts} +0 -0
  781. /package/dist/internal/runtime/{reasoning → system-prompt}/native-reasoning.d.ts +0 -0
  782. /package/dist/internal/{runtime/context/path-containment.d.ts → security/path-containment.d.cts} +0 -0
  783. /package/dist/internal/session/{session-types.d.ts → types.d.ts} +0 -0
  784. /package/dist/internal/{zod/to-json-schema.d.ts → zod-to-json-schema.d.ts} +0 -0
  785. /package/dist/subscription/internal/{adapter-types.d.cts → types.d.cts} +0 -0
  786. /package/dist/subscription/internal/{adapter-types.d.ts → types.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,44 +1,535 @@
1
1
  # Changelog
2
2
 
3
- ## 4.63.4
3
+ ## 5.0.0-next.2
4
+
5
+ ### Minor Changes
6
+
7
+ - 88e87d0: A foreign configuration source can now be admitted to some surfaces and not others.
8
+
9
+ `compatSources: ["claude-code"]` was all-or-nothing: declaring it admitted `.claude/` to hooks,
10
+ plugins, skills AND subagents at once. The four carry very different risk — a skill is text that
11
+ enters the system prompt, a plugin is code loading, a hook is command execution — so a consumer who
12
+ wanted to reuse the skills they had already written was handed arbitrary command execution along
13
+ with them, and had no way to say otherwise.
14
+
15
+ ```ts
16
+ local: {
17
+ compatSources: [{ kind: "claude-code", import: ["skills", "subagents"] }],
18
+ }
19
+ ```
20
+
21
+ Hooks and plugins then resolve `.theokit/` alone. `CompatSurface` and `CompatSourceAdapter` are
22
+ exported.
23
+
24
+ Three rules, each failing closed:
25
+
26
+ - **The bare `"claude-code"` string still admits every surface.** It is what `5.0.0-next.1`
27
+ published, and narrowing it silently would turn a working opt-in into a no-op that says nothing —
28
+ the defect this option exists to fix, one level up.
29
+ - **An adapter with no `import` list admits nothing.** Safe to apply strictly because the object
30
+ form is new and nobody can be relying on it yet.
31
+ - **An unrecognised surface name is dropped**, exactly as an unrecognised `kind` already is. A typo
32
+ must narrow access, never widen it.
33
+
34
+ The `plugins` surface governs reading a foreign plugin directory even when the caller wants the
35
+ SKILLS a bundle carries: a bundle is code, and its skills arrive attached to it, so admitting
36
+ `skills` alone must not reach inside one. Otherwise the narrower permission would silently grant
37
+ the wider one.
38
+
39
+ Closes the per-surface half of usetheokit/theokit-sdk#524. The visibility half — skills, subagents
40
+ and plugins carrying the root they came from, the way hooks already carry `sourcePath` — and the
41
+ declarative `.theokit/config.toml` form are not in this change.
42
+ - 33aa170: A project can now declare its foreign compat sources in `.theokit/config.json`, instead of only in
43
+ code.
44
+
45
+ ```json
46
+ {
47
+ "compat": {
48
+ "adapters": [{ "kind": "claude-code", "import": ["skills", "subagents"] }]
49
+ }
50
+ }
51
+ ```
52
+
53
+ The DECLARATIVE half usetheokit/theokit-sdk#524 asked for, in a `## Sketch` written against TOML.
54
+ It ships as JSON: this SDK already reads JSON everywhere a project declares something
55
+ (`settings.json`, `mcp.json`, `context.json`) and carries no TOML parser or dependency for one —
56
+ adding one for a single optional section would be the opposite of what #522/#524 are about, reading
57
+ in a new format nobody asked this SDK to speak. The shape is unchanged: `compat.adapters` accepts
58
+ exactly what `local.compatSources` already does in code — a bare kind string, or `{ kind, import }`.
59
+
60
+ **Precedence, decided here because the issue does not state it:** explicit `local.compatSources` in
61
+ code wins over the file. The file is the default for a caller who declared nothing. A test or a
62
+ one-off script can therefore always override the file without editing or deleting it.
63
+
64
+ Read with `readFileSync`, not this package's usual async reader: the caller is `Agent`'s
65
+ synchronous constructor, which resolves `compatSources` before any submanager exists to await a
66
+ promise. `existsSync` already runs in the same constructor for the same reason.
67
+
68
+ One resolver, `resolveCompatSources(options, cwd)`, replaces five call sites that each wrote
69
+ `options.local?.compatSources ?? []` by hand — the same duplication `theokitConfigRoot` closed one
70
+ layer down, closed here one layer up, so the file form reaches all four surfaces (hooks, skills,
71
+ plugins, subagents) through the one place rather than needing five separate edits that could drift.
72
+
73
+ Closes the declarative half of #524. `#524` itself stays open until it is verified in an installed
74
+ release, per this project's issue-lifecycle convention.
75
+ - e7cf2dd: A skill, subagent or plugin now says which directory it was read from.
76
+
77
+ usetheokit/theokit-sdk#524 asks for it in one line — *"whatever is imported should be reportable […]
78
+ silent inheritance is what made this take a debugging session to notice"* — and a consumer listing
79
+ its own skills could not tell that one had arrived from `.claude/skills/` rather than the project's
80
+ own directory.
81
+
82
+ What is new is not the data. It existed on all three and did not reach the caller:
83
+
84
+ - `Skill.source` was already the absolute path to the `SKILL.md`, and the projection that builds
85
+ `agent.skills` mapped it away along with the body. The projection is right to drop the BODY —
86
+ that is what `get()` is for — and dropping the PATH with it answered a question nobody asked.
87
+ - `agent.plugins.list()` has always returned `source` at runtime; the internal type's own docblock
88
+ says it carries provenance "so callers can audit where the plugin came from". `SDKPluginMetadata`
89
+ simply never declared it, so the caller received the field and the compiler denied it existed.
90
+ - `readSubagentsFrom` computes the file path on the line it reads the file, then dropped it.
91
+ `AgentDefinition.source` keeps it.
92
+
93
+ `source` is optional on all three, and absence means something specific: declared in code, not read
94
+ from disk. A subagent passed through `AgentOptions.subagents` has no file and `source` is absent.
95
+ An inline `createSkill` skill has no file either, but already carried the synthetic `inline://<name>`
96
+ marker before this change (`create-skill.ts`) — so a skill's `source` is now populated for every
97
+ entry `list()` returns, either a disk path or that marker, and a first version of this fix wrongly
98
+ described it as absent for that case. An existing regression test (`agent-skills-get.test.ts`,
99
+ SE21) asserted `list()` must NOT carry `source` at all; it predates #524 and is updated here to
100
+ assert the marker instead, while still proving the skill's body and references never leak.
101
+
102
+ `SkillsHandle.list` is now typed as the public `SystemPromptSkillRef` instead of restating
103
+ `{ name; description }` inline. The two had drifted, and an internal handle declaring a narrower
104
+ shape than the contract it serves silently deletes fields the projection produces — which is exactly
105
+ how `source` reached the caller at runtime while not existing to the compiler.
106
+
107
+ Closes the visibility half of #524. The declarative `.theokit/config.toml` form is not in this
108
+ change.
4
109
 
5
110
  ### Patch Changes
6
111
 
7
- - ff121b5: A hook or lifecycle command that exits without reading its stdin no longer raises an uncaught
8
- `EPIPE` in the SDK's own process.
112
+ - 070ee92: A foreign plugin's entry file is now checked against the root it was actually discovered under.
113
+
114
+ `refresh()` iterates every root a compat source admits — `.theokit/plugins`, and `.claude/plugins`
115
+ once `compatSources` names the `plugins` surface — and checks each plugin's declared `entry` file
116
+ exists. That check reconstructed the plugin's directory as `.theokit/plugins/<folder>`
117
+ unconditionally, regardless of which root the plugin was actually found under.
118
+
119
+ A plugin discovered at `.claude/plugins/my-plugin/` was therefore checked against
120
+ `.theokit/plugins/my-plugin/` — a directory it never lived in. With nothing there, a legitimate
121
+ foreign plugin was refused as "entry file is missing." Had a same-named folder existed under
122
+ `.theokit/plugins/` instead, its entry file would have been read in place of the real one — a path
123
+ confusion the ADR D79-D80 traversal guard this check calls does not catch, because the guard runs
124
+ against the wrong root rather than against none.
125
+
126
+ This was reachable through the bare `compatSources: ["claude-code"]` form, which has always admitted
127
+ the `plugins` surface — not something the per-surface work landing alongside this introduced.
128
+
129
+ Found while testing the per-surface admission work for usetheokit/theokit-sdk#524.
130
+ - 131ab8b: A foreign plugin's `source` field is now a real relative path instead of a single character.
131
+
132
+ Both manifest loaders (Claude Code's `.claude-plugin/plugin.json` form and this SDK's own
133
+ `PLUGIN.md`/`plugin.json`) built `source` by searching the manifest path for the literal substring
134
+ `.theokit/` and slicing from there. A manifest read from `.claude/plugins/<name>/…` contains no such
135
+ substring: `indexOf` returns `-1`, and `.slice(-1)` silently returned the manifest path's LAST
136
+ CHARACTER — `"n"` from `.json`, `"d"` from `PLUGIN.md` — instead of a path.
137
+
138
+ `source` is exactly the audit trail the visibility half of usetheokit/theokit-sdk#524 exists to
139
+ provide, and this was broken for precisely the case that matters most: a plugin admitted from a
140
+ foreign root. Replaced the substring search with `path.relative(cwd, manifestPath)` — the stdlib
141
+ does this correctly, and it is what the substring search was trying to approximate.
142
+
143
+ Found alongside the entry-file root confusion, testing the same per-surface admission work.
144
+ - 7b4063b: One resolver now answers "where does this project's configuration live?" — `theokitConfigRoot(cwd)`,
145
+ in `internal/persistence/paths.ts`, semver-exempt.
146
+
147
+ Five readers hand-rolled `join(cwd, ".theokit", ...)` independently: `mcp.json`, the context
148
+ directory + `context.json`, the hooks-root fallback check, `registry.json`, and the personality
149
+ `PROJECT_SUBDIR`. `projectConfigRoots` (hooks/skills/subagents/plugins, per usetheokit/theokit-sdk#524)
150
+ already resolved its native root the same way, inline, making six independent copies of one
151
+ constant.
152
+
153
+ No filename, format or resulting path changes — this is a pure consolidation, and the project's own
154
+ lint gate (`no-hardcoded-theokit-path.test.ts`, ratcheted 23 → 14) is the proof: every literal this
155
+ change removed was already flagged as migration debt, and the full suite is unchanged.
156
+
157
+ Deliberately does NOT touch homedir-anchored state (sessions, credentials, the personality
158
+ `USER_SUBDIR`, provider discovery) — those follow `getTheokitHome`/`THEOKIT_HOME` by design, and
159
+ folding them into this resolver would be the exact silent behaviour change
160
+ `theokitConfigRoot`'s own docblock warns against: a project's committed configuration must never
161
+ follow an operator's relocated state directory. A regression test pins this — swapping the
162
+ resolver's body for `getTheokitHome`'s would move all six readers under `THEOKIT_HOME` at once, in
163
+ one line, with no caller-side signal.
164
+
165
+ ## 5.0.0-next.1
166
+
167
+ ### Major Changes
168
+
169
+ - 667bd3d: **BREAKING:** a project's `.claude/` directory is no longer read unless the consumer declares it.
170
+ Pass `local: { compatSources: ["claude-code"] }` to restore today's behaviour.
171
+
172
+ Four subsystems — hooks, skills, subagents and plugin bundles — resolved `<cwd>/.claude` alongside
173
+ `<cwd>/.theokit` with no opt-in anywhere. A directory containing only `.claude/`, and no
174
+ configuration of this SDK at all, had its hooks executed, its subagents registered, and its skill
175
+ text folded into the system prompt.
176
+
177
+ **Trust is not consent.** A consumer's trust gate answers "do I trust the code in this directory?",
178
+ and it was doing double duty as the answer to a different question: "do I want another product's
179
+ configuration imported into this one?" Those come apart in the ordinary case — `.claude/` is
180
+ populated in exactly the repository one trusts most, for a different tool, under a different
181
+ contract, often by a teammate who never heard of this SDK. The measured cost of conflating them was
182
+ the defect fixed one commit earlier: every turn denied by a `PreToolUse` hook nobody had declared.
183
+
184
+ The skills path is the quieter half. A skill's text enters the system prompt, so importing prompt
185
+ content from a directory this SDK does not own is a prompt-injection surface that no consumer opted
186
+ into and none could see.
187
+
188
+ A workspace holding an undeclared `.claude/` now says so once, on the diagnostics channel, naming
189
+ the directory and the line that turns it back on. It goes there rather than to stderr because
190
+ ignoring an undeclared directory is the intended behaviour, not a failure — every repository that
191
+ has Claude Code set up and does *not* want it imported would otherwise pay a line on a TUI host's
192
+ render surface for behaving as instructed.
193
+
194
+ An unrecognised name in `compatSources` is dropped rather than turned into `<cwd>/<name>`: a typo
195
+ must fail closed, since a directory name was never enough to describe a dialect.
196
+
197
+ ### Minor Changes
198
+
199
+ - edfa59c: `Agent` can now be asked which operations it supports, instead of being told by an exception.
200
+
201
+ `SDKAgent` is one handle over two runtimes that do not offer the same operations, and the type did
202
+ not model the difference. `downloadArtifact` is a **required** member that rejects for every input on
203
+ a local agent; `listArtifacts` is required and returns `[]` for every state, so "no artifacts" and
204
+ "this runtime has no artifacts" were the same value. On a cloud agent, five members declared
205
+ _optional_ are present-but-throwing — so `typeof agent.fork === "function"` is `true` and calling it
206
+ throws. Neither requiredness nor optionality expresses "exists here, not there", which left a caller
207
+ no way to branch except a `try`/`catch` around a call it did not want to make.
208
+
209
+ Two additive members answer the question first, mirroring `Run.supports(op)` /
210
+ `Run.unsupportedReason(op)`, which already solved this one layer down:
211
+
212
+ ```ts
213
+ if (agent.supports("downloadArtifact")) {
214
+ await agent.downloadArtifact(id);
215
+ } else {
216
+ logger.info(agent.unsupportedReason("downloadArtifact"));
217
+ }
218
+ ```
219
+
220
+ The new `AgentOperation` union is exported. Nothing was removed and no signature changed, so a
221
+ caller that never asks behaves exactly as before.
222
+
223
+ This is a mitigation. The structural fix is to split `SDKAgent` into a common core plus
224
+ `LocalCapableAgent` / `CloudCapableAgent`, so the compiler refuses the call rather than the runtime.
225
+ That is breaking on a published 4.x surface and is deliberately not done here.
226
+ - 912e3b9: Three silent downgrades now tell you they happened. Behaviour is unchanged; visibility is not.
227
+
228
+ **A failing `MemoryProvider` no longer disappears quietly.** `initLoopContext` caught every provider
229
+ failure into an empty value: an `init` failure meant no memory tool was registered, a `buildTools`
230
+ failure meant no provider tools, an `activePass` failure meant no recalled context in the system
231
+ prompt. The agent answered without the memory it was configured with, and nothing recorded it. There
232
+ is now a `memory_degraded` run event — new `RunMemoryDegradedEvent`, carrying the stage and the
233
+ provider's own message — alongside a stderr diagnostic, so a host can show "memory degraded" instead
234
+ of a healthy run. Degrading to a working agent is still what happens.
235
+
236
+ **The memory FTS fallback is gated on the case it was written for.** Any SQL failure used to become a
237
+ `LIKE '%query%'` scan over the whole table, returning plausible hits at a fixed score — so a corrupt
238
+ database, a missing FTS table and a disk error all looked like a successful search with worse
239
+ relevance. The fallback still runs, and a non-CJK failure now reports that the index may be missing
240
+ or corrupt.
241
+
242
+ **A `@theokit/sdk-memory` peer that fails to load says so.** Absent is expected and stays silent;
243
+ present-but-unloadable — a module-format interop failure, a broken native dependency, a bundler
244
+ rewrite — is reported instead of falling back to the legacy path in silence.
245
+ - 16a996f: Every error this SDK throws is now catchable as `TheokitAgentError`.
246
+
247
+ The README tells you to catch `TheokitAgentError`, and twenty-four exported error classes were not
248
+ one — they extended bare `Error`, so that catch silently missed them and none of them told you
249
+ whether the failure was worth retrying. Among them: `GenerateObjectError`, `StreamObjectError`,
250
+ `FileNotFoundError` and its four siblings, `SandboxSecurityError`, `SandboxNotAvailableError`, the
251
+ three `Auth*Error`s, `A2ARequestTimeoutError`, `MaxDelegationDepthError`, `WorkflowToolError`, and the
252
+ two errors on the `./interactive` subpath.
253
+
254
+ All twenty-four now extend `TheokitAgentError`, carry a `code`, and answer `isRetryable`. The answer
255
+ was decided per class rather than defaulted, and the reasoning is in the source. Two are retryable —
256
+ `A2ARequestTimeoutError` (a peer that missed one deadline may answer the next) and
257
+ `CompressionFailedError` (a single LLM call that failed or came back empty) — plus `FilesystemError`,
258
+ where the underlying I/O failure genuinely can be transient. The rest are not, and say why.
259
+
260
+ This is additive: `instanceof Error` still holds, every `code` value is unchanged, and no signature
261
+ moved. Code that already caught these by their specific class keeps working.
262
+
263
+ `generateObject` and `streamObject` also stop declaring the same failure contract twice with
264
+ byte-identical messages. They share one internal base class and keep their two distinct public names,
265
+ so `streamObjectError instanceof GenerateObjectError` remains false.
266
+ - 374dd5f: The `MemoryProvider` port is now the only memory path. `THEOKIT_PORT_MEMORY_PATH`
267
+ is gone, and the adapter over the built-in memory runs by default; a
268
+ consumer-supplied `memoryProvider` still takes precedence.
269
+
270
+ No typed API was removed — the flag was internal and never appeared in your
271
+ TypeScript types — but three behaviours change:
272
+
273
+ - **Recalled memory is now escaped before it reaches the model.** The port path
274
+ concatenated the recall summary into the system prompt raw, while the assembly
275
+ pipeline has always wrapped it as `<active-memory>` with XML escaping. A recalled
276
+ fact containing `</active-memory>` could close the block early and have everything
277
+ after it read as a system instruction. Both paths now wrap and escape.
278
+ - **Memory tools receive the run's abort signal and transcript projection.** They
279
+ arrive through the same channel as your own tools, so a long memory search is now
280
+ cancellable with the run.
281
+ - **`.theokit/memory` is no longer created by a send that never reaches the agent
282
+ loop** — a fixture-mode send with a `theo_test_*` key used to leave an empty
283
+ SQLite index behind. Real runs are unchanged: the index is created and searchable
284
+ exactly as before.
285
+ - 374dd5f: `MemoryProvider.buildTools(handle, agent)` now declares its second parameter as
286
+ `MemoryProviderAgentRef` — `{ agentId, model }` — which is all the SDK has ever
287
+ passed it.
288
+
289
+ It declared `SDKAgent`, a 33-member interface, and satisfied that with a cast over
290
+ a two-field object. Any implementation reaching for one of the other 31 members —
291
+ `send()`, `fork()`, `dispose()` — got `undefined is not a function` at runtime, with
292
+ no compile-time warning, because the cast removed exactly that check.
293
+
294
+ Non-breaking in both directions: an `SDKAgent` still satisfies the new type, and an
295
+ existing implementation typed `agent: SDKAgent` still compiles. `MemoryProviderAgentRef`
296
+ is exported from the package root so you can name it.
297
+ - 618cd02: `ctx.on(...)` now returns a disposer, so a plugin can detach one hook.
298
+
299
+ It returned `void`, which made the plugin Observer a one-way door: a handler attached through
300
+ `initialize()` had no removal path and ran for the life of the process. The only documented dynamic
301
+ case — a permission plugin re-installed on every prompt — worked because the registry keys plugins by
302
+ name, so re-registering the whole plugin was the only way to remove one hook.
303
+
304
+ ```ts
305
+ const off = ctx.on("pre_tool_call", handler);
306
+ // ...later
307
+ off();
308
+ ```
309
+
310
+ The disposer detaches the registration it was given — attaching the same function twice and disposing
311
+ once leaves one — and is idempotent. A handler the SDK refused (a non-function, which is warned and
312
+ ignored) still returns a working no-op disposer, so a caller never has to branch on whether the
313
+ registration took.
314
+
315
+ Two observers in the SDK already worked this way (`Run.onDidChangeStatus`, `MessageBus.unregister`);
316
+ this closes the gap. The new `PluginHookDisposer` type is exported.
317
+ - 31fea8f: `Retry.run(fn, options)` is the new name for `Retry.create(fn, options)`.
318
+
319
+ `create` never created anything — it runs `fn` with retry and resolves to `fn`'s
320
+ result — and the name said otherwise. It is deprecated, still honoured, and
321
+ removed in the next major.
322
+ - 691d8e6: `SandboxBackend`'s derived `glob`, `grep` and `listDir` now throw when the command could not run.
323
+
324
+ They returned `[]` on any non-zero exit, so a search that could not execute reported the same thing as
325
+ a search that found nothing — opposite facts, one normal and one meaning the agent is looking at a
326
+ filesystem it cannot read. That is the failure a backend whose `execute` is not a POSIX shell hits,
327
+ which the class docblock warns about in prose and could not enforce.
328
+
329
+ A genuine no-match still returns `[]`, and the distinction is the one the tools themselves draw:
330
+ `grep` exits 1 for no match and ≥2 for an error, `find` exits 0 with empty output.
331
+
332
+ If you have a custom backend that is not a POSIX shell and relied on these silently returning nothing,
333
+ they now throw a `ConfigurationError` with code `sandbox_derived_helper_failed`, telling you to
334
+ override them — which the docblock already asked for.
335
+ - 0ceeddc: `sanitizeToolInput` now reaches values inside arrays.
336
+
337
+ It never did. `{ tag: " a " }` came back trimmed and `{ tags: [" a "] }` came back untouched, with
338
+ nothing in the type or the documentation distinguishing them — the `@public` docblock on `deep` said
339
+ "recurse into nested objects/arrays", and array elements were not reached by any rung, including
340
+ `trim`, which is on by default.
341
+
342
+ Elements follow the same rules as fields: a string element is sanitized by whichever rungs are on, an
343
+ object element is descended only under `deep`. Array descent itself is not gated by `deep`, because a
344
+ value does not stop being a string by sitting in a list; `maxDepth` counts every hop and is what
345
+ bounds it. Arrays stay arrays.
346
+
347
+ If you were relying on array contents passing through a sanitizer untouched, they no longer do.
348
+ - 558dd30: `SessionStore` declares the three lifecycle hooks the SDK was already calling.
349
+
350
+ The port declared two methods, and the SDK probed for `acquire`, `release` and `dispose` through
351
+ `as unknown` casts. They worked — but nothing in the interface mentioned them, so a store author
352
+ implementing the documented two-method contract got no writer lease, no release and no disposal, with
353
+ no way to discover that those hooks existed.
354
+
355
+ They are now optional members with their contracts written down, including the one that matters:
356
+ a rejection from `acquire` whose `name` is `SessionBusyError` **propagates to the caller**, because
357
+ another process holding the session is a decision the caller has to make. Every other rejection is
358
+ treated as "no lease here" and the turn proceeds.
359
+
360
+ Optional means optional: an existing two-method store keeps working unchanged. What changes is that
361
+ the capability is now readable in the type you implement.
362
+ - 94722e8: `StructuredOutputError` distinguishes the causes it already knew apart.
363
+
364
+ Three different failures reported `no_tool_call`: an agent run that errored
365
+ before producing an answer, a run that was cancelled, and a tool-only completion
366
+ with no text to structure. Only the free-text message differed, so a caller could
367
+ not branch on which had happened without parsing English.
368
+
369
+ They are now `upstream_run_failed`, `run_cancelled` and `no_text_answer`.
370
+ `no_tool_call` keeps its original meaning — the model did not call the forced
371
+ output tool — and `parse_failed` is unchanged.
372
+
373
+ BEHAVIOUR CHANGE for a caller matching `no_tool_call`: three of the five cases it
374
+ used to catch now carry their own code. A caller that branched on it for a
375
+ cancelled run was branching on a defect, but the string it matched does change.
376
+
377
+ The union is exported as `StructuredOutputErrorCode`.
378
+ - 266ffc8: Nine failures that used to arrive as a bare `Error` now carry a type and a code.
379
+
380
+ `docs/error-codes.md` says to branch on `code`, never on the message — messages carry context and
381
+ change with it. These nine gave you no code to branch on:
382
+
383
+ - `MessageBus.send` / `request` against an unregistered peer now reject with the new
384
+ `A2APeerNotRegisteredError` (`a2a_peer_not_registered`), carrying `to`. The timeout branch of those
385
+ same two methods was typed under #380; this was the branch above it.
386
+ - The ChatGPT provider's missing-credential path now throws `AuthenticationError`
387
+ (`missing_credential`), matching the router path that handles the same condition.
388
+ - `createSkill`, `createTokenLimiter`, `defineSkillReadTool`, the two `Workflow` builder guards, and
389
+ `Security.addPattern` now throw `ConfigurationError` with a code each.
390
+
391
+ Because `isTransientError` is `err instanceof TheokitAgentError && err.isRetryable`, a bare `Error`
392
+ was also permanently invisible to retry logic. These now answer the question.
393
+
394
+ ### Patch Changes
9
395
 
396
+ - 667bd3d: A hook or lifecycle command that exits without reading its stdin no longer raises an uncaught
397
+ `EPIPE` in the SDK's own process.
398
+
10
399
  `spawnAndCollect` writes the JSON payload to the child's stdin. A child that never reads it —
11
400
  `exit 1`, a hook that only inspects the environment, any command that ignores the payload — closes
12
401
  the pipe first, and the write then raises `EPIPE` on a stream with no `error` listener, which Node
13
402
  promotes to an uncaught exception. The child was behaving perfectly legitimately; the host process
14
403
  took the fault.
15
-
404
+
16
405
  The error is swallowed rather than surfaced: the child's exit code and stderr are the result, and
17
406
  both are collected either way. A payload nobody read is not a failure of the spawn.
18
-
19
- - f9e12e2: An unrecognised key under `local` is now reported on the diagnostics channel instead of being
407
+ - 4415f83: An unrecognised key under `local` is now reported on the diagnostics channel instead of being
20
408
  accepted in silence.
21
-
22
- Measured before this: `Agent.create({ local: { settingSourcess: [...] } })` — one letter wrong —
409
+
410
+ Measured before this: `Agent.create({ local: { compatSourcess: [...] } })` — one letter wrong —
23
411
  created the agent with no throw, no warning, and nothing anywhere. That made two very different
24
412
  failures identical: a typo and an SDK too old to know the option both produced the default
25
- behaviour and no complaint. The second half is the expensive one, because it is invisible from
26
- inside a correct-looking call site.
27
-
413
+ behaviour and no complaint.
414
+
415
+ It is the reason `usetheokit/theokit#634` is blocked rather than merely unimplemented — a forward
416
+ of `compatSources` written against a published SDK would be inert, and no consumer could tell.
417
+ The same shape produced the `$CLAUDE_PROJECT_DIR` defect and motivated the `compatSources` opt-in:
418
+ a surface that accepts input and does nothing with it, where the absence of a complaint reads as
419
+ acceptance.
420
+
28
421
  The message names the key and the nearest known one, so one letter wrong is one line to read
29
422
  rather than a trip to the documentation. It is a warning, never a refusal: rejecting an unknown key
30
423
  would break every consumer passing a forward-compatible extra — the ordinary way to write code that
31
424
  runs against two SDK versions — and turn a diagnostic problem into an outage. A correct
32
425
  configuration emits nothing, and there is a test for that, because a warning that fires on valid
33
426
  input stops being read.
34
-
35
- The original of this change is on the 5.x line, where it was measured against `compatSources`, an
36
- option this line does not have. What is backported here is the behaviour, over the options that do
37
- exist on 4.x.
38
-
39
- - a890b8c: Hooks imported from `.claude/settings.json` now run with `$CLAUDE_PROJECT_DIR` defined, so a
427
+ - 9181434: A failed atomic write no longer leaves its temp file behind.
428
+
429
+ `replaceFileAtomic` which backs the agent registry, session transcripts, MCP token storage and
430
+ everything else the SDK persists — cleaned up its `.tmp` on a rename failure and on no other. A
431
+ failure between the open and the rename, meaning a write error, a full disk, or an fsync failure,
432
+ closed the file handle and propagated with the temp still on disk.
433
+
434
+ Every failure after the open now removes it. A process killed mid-write still leaves one, which no
435
+ code inside that process can prevent; `sweepStaleAtomicTemps` reaps those on the next registry load.
436
+ - edfa59c: `Agent.batch(prompts, { task })` now rejects when the batch task fails, instead of resolving with an
437
+ empty array.
438
+
439
+ The task-wrapped path assigned its results inside the task's `work` callback and then returned that
440
+ variable unconditionally, so three different failures produced one indistinguishable value: the work
441
+ threw, the task was cancelled, or a fixed 5000-iteration poll budget elapsed. Each returned `[]` on
442
+ a **resolved** promise — which a caller cannot tell apart from `Agent.batch([])` on empty input.
443
+ Nothing threw and nothing was logged, and the registry's own `{ code, message }` for the failure was
444
+ discarded by a loop that read only the task's `state`.
445
+
446
+ The poll is gone. The wait is now the task's terminal event, which carries the failure detail:
447
+
448
+ - work threw → rejects with `code: "batch_task_failed"`, the registry's code on `protoErrorCode`
449
+ - cancelled → rejects with `code: "batch_task_cancelled"` and the reason, when one was given
450
+
451
+ The removed budget was not a safety net: 5000 iterations of a 5 ms sleep is roughly 25 seconds, so a
452
+ batch legitimately longer than that would trip it and return `[]`. The bound generated the failure
453
+ it appeared to guard against.
454
+
455
+ If you were checking `results.length === 0` to detect a failed batch, catch the rejection instead —
456
+ an empty array now means only what it says.
457
+ - edfa59c: Corrected the published JSDoc for `AgentOptions.budgetTracker` and `AgentOptions.memoryProvider`,
458
+ which told consumers the opposite of what the SDK does.
459
+
460
+ Both carried a paragraph stating the option was "wired to the type surface only" and that a consumer
461
+ supplying one "gets the type guarantee but NOT runtime enforcement". Neither has been true for some
462
+ time. `budgetTracker` is read by the agent loop before every iteration (`evaluateBudgetGate`),
463
+ advanced with `nextIteration()`, and charged with `track(...)` after each completion.
464
+ `memoryProvider` has its full lifecycle driven — `init`, `buildTools`, `runActivePass`, `sync`,
465
+ `dispose`.
466
+
467
+ No behaviour changes here; the code was already correct. What changes is what the published `.d.ts`
468
+ tells you, and it was wrong in the expensive direction: a consumer reading it was told the SDK would
469
+ not enforce their cost ceiling, so the rational response was to build a second control outside the
470
+ SDK, or to stop passing the option at all.
471
+
472
+ Six occurrences of the claim were corrected across `types/agent.ts`, `index.ts` and the loop's own
473
+ input types, and a lint now requires any "not implemented yet" note to carry a tracking reference and
474
+ a date, so the next one expires instead of outliving the work it describes.
475
+ - 4be7411: `Budget.create` now refuses `scope: "agent"` and `scope: "call"` with a
476
+ `ConfigurationError` (`unimplemented_budget_scope`).
477
+
478
+ Only `"process"` was ever implemented. Nothing outside the registry read `scope`,
479
+ so the other two were accepted and silently ignored: a caller asking for
480
+ per-agent accounting got process-wide accounting with no signal. A cost control
481
+ that reports the wrong number is worse than a missing feature.
482
+
483
+ `FnStep.compensate` is marked deprecated. It was never implemented — setting it
484
+ arms `WorkflowCompensateNotImplementedError`, so the step fails at run time.
485
+
486
+ `AgentLoopInputs` declares `maxConsecutiveToolErrors` and `maxConcurrentTools`,
487
+ which were read through inline casts and appeared in no type. A typo in either
488
+ name now fails to compile instead of silently taking the default.
489
+ - 24fb692: `Cron.create()` now reports when the job will actually next fire.
490
+
491
+ It reported `now + 1 hour` for every expression. The function behind it read neither the cron
492
+ expression nor the timezone — a `@yearly` job said it would run within the hour, and so did a
493
+ `*/5 * * * *` one. Its own docstring scoped it to fixture mode ("real scheduling uses a proper
494
+ evaluator wired in by the local scheduler"), and its only caller was `Cron.create()`.
495
+
496
+ The local scheduler overwrote the value for jobs it picked up, which is why this survived: the wrong
497
+ number was visible between creating a job and the scheduler reaching it, and permanently for a job
498
+ the scheduler never runs — a job created against a cloud runtime, or created while the scheduler is
499
+ stopped.
500
+
501
+ `nextRunAt` is now computed with croner, which was already a dependency and already doing exactly
502
+ this inside the scheduler. When an expression has no next run — `0 0 30 2 *`, a date that never
503
+ occurs — the field is absent rather than filled with a number, which is what the optional
504
+ `CronJob.nextRunAt` already meant.
505
+ - edfa59c: Two abstractions with no implementers and no consumers are gone. Nothing published changes.
506
+
507
+ `internal/security/secret-redactor.ts` declared a `SecretRedactor` interface that `redactSecrets`
508
+ happened to satisfy. It was added to raise the module's abstractness out of a coupling metric's "zone
509
+ of pain", and nothing ever held it — no implementer, no consumer, absent from every barrel. An
510
+ interface nobody holds does not change what any module depends on, so the number it was added to move
511
+ could not have moved either. Its README section now records that, and keeps the reasoning that
512
+ rejects chasing the metric in the first place.
513
+
514
+ `server/adapter/express.ts`, `fastify.ts` and `hono.ts` were byte-identical below their docblocks:
515
+ two imports and a one-line delegation each, with no framework type imported or adapted anywhere. They
516
+ are replaced by a single `server/adapter/index.ts` whose docblock says what the function actually
517
+ returns — a route descriptor the host binds itself, not middleware. The three per-framework docblocks
518
+ claimed an adaptation that did not exist, which is the half of this that could mislead a reader.
519
+
520
+ Their three test files, which had quietly drifted into three different levels of coverage, are one
521
+ file carrying the union of their cases plus one new case asserting the descriptor contract directly.
522
+ - 374dd5f: Embedding requests now retry with the same jittered exponential backoff the rest of
523
+ the SDK uses, and honour the provider's `Retry-After` header.
524
+
525
+ They used to back off linearly at `50ms * attempt` and ignore `Retry-After`, so two
526
+ clients hitting a rate-limited embedding endpoint retried in lockstep and neither
527
+ waited as long as the provider asked. The delay is tuned tighter than the LLM
528
+ transport's — 250ms base, 4s cap rather than 500ms/32s — because an embedding retry
529
+ sits inside a memory write on the run's critical path.
530
+ - 63617cd: Hooks imported from `.claude/settings.json` now run with `$CLAUDE_PROJECT_DIR` defined, so a
40
531
  repository that also uses Claude Code stops denying every turn.
41
-
532
+
42
533
  Reading that file is a deliberate compatibility decision, but the commands inside it are written for
43
534
  Claude Code's runtime, which defines that variable and whose documentation tells hook authors to
44
535
  reach project files through it. This SDK did not define it, so `sh` expanded it to the empty string
@@ -46,15 +537,232 @@
46
537
  file that does not exist, which a hook runner correctly reads as a refusal. The result was every
47
538
  tool call denied, in any repository whose only unusual property was having Claude Code set up, with
48
539
  a message naming a script that was present and executable all along.
49
-
540
+
50
541
  A denial caused by an undefined variable now names the variable. `$CLAUDE_PLUGIN_ROOT` and the rest
51
542
  of that runtime's surface are still not supplied — inventing a value would send a script somewhere
52
543
  real and wrong — but a hook that needs one fails saying which, instead of reporting a path that
53
544
  failed ten characters later.
54
-
55
- - 8dbda42: A resumed session now replays its history as structured tool calls instead of flat text, so the
545
+ - edfa59c: HTTP 408 is now classified as a retryable timeout instead of a configuration error.
546
+
547
+ `mapHttpStatusToError` in `internal/http.ts` had no arm for 408, so a Request Timeout fell through
548
+ to the generic `4xx` branch and came back as a `ConfigurationError` — `isRetryable: false`. Every
549
+ one of the four provider-specific mappers already did the opposite: `openai-compatible`, `anthropic`,
550
+ `bedrock` and `vertex` all map 408 to a `NetworkError` carrying a `timeout` code, which is retryable.
551
+ The generic ladder is a fifth copy of the same knowledge and it was the copy that drifted.
552
+
553
+ The failure was silent and pointed the wrong way. Nothing threw: a caller branching on
554
+ `isTransientError` simply refused to retry a request that would very likely have succeeded, and did
555
+ so only on the paths that went through the generic mapper rather than a provider one.
556
+
557
+ If you were catching `ConfigurationError` to handle 408 specifically, catch `NetworkError` instead —
558
+ or branch on `code`, which is what `docs/error-codes.md` asks for.
559
+ - edfa59c: The HTTP status ladder now has one definition instead of four, and two drifted copies are repaired.
560
+
561
+ `401/403 → auth_failed`, `402 → quota_exceeded`, `408 → timeout`, `429 → rate_limit`,
562
+ `400 → invalid_request`, `5xx → server_error` is RFC 9110 semantics, not a vendor contract: a 429
563
+ means the same thing whichever provider sent it. It was nevertheless written out in all four
564
+ provider mappers, and the copies had already diverged in two ways that reached users:
565
+
566
+ - **HTTP 402 reached one mapper of four.** `quota_exceeded` was wired into the OpenAI-compatible
567
+ mapper only, so a Bedrock, Vertex or Anthropic endpoint answering 402 fell through every arm and
568
+ surfaced as `unknown`. The canonical bucket existed and three of four mappers could not reach it.
569
+ - **The server arm had two different upper bounds.** Anthropic and OpenAI-compatible guarded
570
+ `>= 500 && < 600`; Bedrock and Vertex guarded `>= 500` with no ceiling, so a malformed or
571
+ proxy-injected 6xx was `server_error` in two mappers and `unknown` in the other two.
572
+
573
+ The ladder now lives once, in `internal/error-mappers/shared.ts`, beside the other dialect-agnostic
574
+ helpers. Each mapper keeps its own body dialect — Anthropic's `context_too_long`, OpenAI's
575
+ `insufficient_quota`, Bedrock's AWS `__type` strings and 404 rule, Vertex's `google.rpc` enum with
576
+ its finer `unauthenticated`/`permission` split — because those *are* per-vendor contracts. The
577
+ shape is now `classifyVendorBody(body) ?? httpStatusToErrorCode(status)`.
578
+
579
+ Visible changes: 402 now yields `quota_exceeded` (was `unknown`) on Anthropic, Bedrock and Vertex,
580
+ and a status of 600 or above now yields `unknown` (was `server_error`) on Bedrock and Vertex. HTTP
581
+ 404 is deliberately unchanged everywhere.
582
+ - 926cb81: Removed `LanceMemoryAdapter.unwrap()`, which handed callers the raw `LanceIndex`
583
+ behind the adapter. It had no callers anywhere in the monorepo — including the
584
+ migration tool and benchmark script its own docblock named, both of which open a
585
+ `LanceIndex` directly and never go through the adapter.
586
+
587
+ A caller that needs `addFacts` / `countFacts` / `removeFacts` needs a
588
+ `LanceIndex`, and opening one is the honest way to get it.
589
+ - 7f91326: The Lance memory backend now honours `SearchOptions.vectorWeight` and
590
+ `textWeight`. It blended hits with hard-coded 0.7 / 0.3 literals and never read
591
+ the options, so a caller that tuned the weights had its tuning applied on the
592
+ SQLite backend and silently dropped on Lance.
593
+
594
+ Unweighted Lance results shift slightly as a consequence: the shared defaults are
595
+ 0.6 / 0.4, and one of the two hard-coded numbers was never the contract's.
596
+
597
+ Workflow step logging (`ctx.log.debug` / `.info` / `.warn`) now goes through the
598
+ SDK's diagnostics channel instead of `console`, so a host that installs a
599
+ diagnostics sink — a TUI, for instance — receives it instead of having its frame
600
+ written over.
601
+ - edfa59c: Two internal modules moved to the layer they belong to. No public API changed.
602
+
603
+ `src/errors.ts` is the package's leaf — fifteen files under `internal/runtime/` import the typed
604
+ error hierarchy from it — and it imported back up into `internal/runtime/retry/` for one helper. The
605
+ helper encodes which error codes are retriable, which is a property of the error taxonomy rather
606
+ than of the retry runtime, so it now lives in `internal/error-mappers/` beside the other mapping
607
+ knowledge. One import path changed; the file itself was moved, not rewritten.
608
+
609
+ `internal/security/` is the most-depended-upon module in the tree and held node builtins and
610
+ `errors.js` and one exception: a path-containment primitive it reached for in
611
+ `internal/runtime/context/`. That primitive had four consumers and only two were in the folder it
612
+ sat in — it lived there because that is where it was extracted from, not because it belonged there.
613
+ It is now `internal/security/path-containment.ts`, and all four consumers import downward into
614
+ `security/`, the direction the rest of the tree already runs.
615
+ - 243bd2c: The live-agent registry and the session cache survive a package loaded twice.
616
+
617
+ `liveAgentRegistry` and the session cache's two maps were plain module-level `const`s, which are
618
+ singletons per module INSTANCE. A package can be loaded more than once in one process — two copies in
619
+ `node_modules`, ESM and CJS side by side, a monorepo with distinct versions — and each copy then gets
620
+ its own registry. For the live-agent registry, the public one, that means two views of which agents
621
+ are running, and a caller reading the wrong one sees none.
622
+
623
+ All three now go through the same `Symbol.for`-keyed helper the rest of the SDK uses.
624
+
625
+ The session cache's docblock asserted that the instances "remain the only ones in the process, because
626
+ an ES module is a singleton". That is the claim the helper exists to refute; the docblock now says so.
627
+ - edfa59c: `LiveSessionError` from `@theokit/sdk/persistence` is renamed to `LiveTranscriptError`. The old name
628
+ still works and is deprecated.
629
+
630
+ Two different classes were called `LiveSessionError`, exported from two declared subpaths that one
631
+ consumer can hold at once. They have incompatible shapes: the root barrel's is
632
+ `new LiveSessionError(sessionId, reason)` with a `reason` field and no `code`; the persistence one
633
+ was `new LiveSessionError(path)` with a `path` field and `code: "live_session_protected"`.
634
+
635
+ The failure was quiet in the way that costs most. `instanceof` is class identity, so a `catch`
636
+ checking the class imported from the root silently did not match the one thrown from persistence, and
637
+ the fallback ran for a condition the code believed it had handled. A `name` check looked like it
638
+ worked — `err.name === "LiveSessionError"` matched *both* — and then read `err.reason`, which only
639
+ one of them has.
640
+
641
+ The names now say what each refusal is about: refusing to destroy a **session**, and refusing to
642
+ overwrite a **transcript** file. `LiveSessionError` remains exported from `@theokit/sdk/persistence`
643
+ as a deprecated alias so existing imports keep working; it will be removed in the next major.
644
+ - ba6549f: An MCP client with a tight `requestTimeoutMs` can reconnect after a drop.
645
+
646
+ `reconnect()` recovers by spawning a fresh child and running the `initialize` handshake, and that
647
+ handshake was bounded by the same `requestTimeoutMs` the caller set for ordinary requests. Setting a
648
+ tight request budget — an ordinary thing to do for a latency SLO — silently made a client unable to
649
+ recover: every reconnect attempt spawned a process that could not finish inside a steady-state budget,
650
+ the bounded loop exhausted, and the client surfaced `mcp_disconnected`. That is the wedge the bounded
651
+ loop exists to prevent.
652
+
653
+ The reconnect handshake now takes `max(requestTimeoutMs, 10s)`.
654
+
655
+ The **first** connect is unchanged and keeps your budget exactly. The difference is which failure is
656
+ visible: a `requestTimeoutMs` too small to connect at all fails at the call you made, immediately, and
657
+ is yours to correct. The reconnect is the SDK's own recovery, which you never sized and never see
658
+ until a drop happens.
659
+ - edfa59c: `MemoryIndex.sync()` and `.status()` now say whether their numbers were measured.
660
+
661
+ `MemoryIndex` has two implementations. `IndexManager` walks a markdown corpus and counts rows with
662
+ `SELECT COUNT(*)`. The Lance backend has no corpus — it is a vector store fed by explicit writes —
663
+ and it answered with a frozen all-zeros `SyncResult` and a hardcoded `filesIndexed: 0,
664
+ chunksIndexed: 0`. Those are indistinguishable from a real sync that found nothing to do and a real
665
+ index that is empty, and the comment above them stated that as the goal: *"Returns zero counts so
666
+ callers' existing logging does not break."*
667
+
668
+ The consequence was a false negative rather than a crash. A caller deciding "is the index
669
+ populated?" from `chunksIndexed > 0` got `false` on every Lance run, however many rows the table
670
+ held.
671
+
672
+ Two required fields make the difference visible:
673
+
674
+ - `SyncResult.supported` — `true` from `IndexManager`, `false` from Lance
675
+ - `IndexStatus.countsExact` — `true` when counted, `false` when the number is a placeholder
676
+
677
+ The counts stay zero. Inventing a number would have traded one false claim for another; what changed
678
+ is that a caller can no longer read a placeholder as a measurement. Both fields are also on the
679
+ public `MemoryIndexHandle`, so a consumer holding the handle can see them. If you need the real Lance
680
+ count, `unwrap().countFacts()` still returns it.
681
+ - 21be5cb: `migrateSqliteToLance` now rejects a `batchSize` its loop cannot advance with,
682
+ before touching the workspace.
683
+
684
+ A `0` or a negative made the migration spin forever, calling `addFacts([])` and
685
+ logging a progress line every iteration. `NaN` — which `Number("abc")` produces —
686
+ made it migrate nothing and report "Validation FAILED. SQLite preserved.",
687
+ blaming the migration for a typo. Both now raise a `ConfigurationError` with code
688
+ `invalid_batch_size`, naming the value received.
689
+ - edfa59c: A dropped connection to Ollama is now retried instead of surfacing on the first attempt.
690
+
691
+ `OllamaNativeClient` rethrew the raw `fetch` rejection when its own body-dialect mapper did not
692
+ recognise the failure, and threw a bare `new Error` for any HTTP status the dialect did not cover.
693
+ Both land outside the SDK error hierarchy, and that decides retry behaviour by contract rather than
694
+ by chance: `isTransientError` is `err instanceof TheokitAgentError && err.isRetryable === true`, and
695
+ the router wraps every resolved client in `RetryingLlmClient`. A foreign error is therefore
696
+ non-transient by definition — so the most ordinary failure a local Ollama can produce, a dropped
697
+ connection, was never retried.
698
+
699
+ The repository had already found and fixed this for the other transports; `openai.ts` records the
700
+ measurement and names Ollama as the one still carrying it. Transport failures now go through
701
+ `wrapTransportError` (which passes `AbortError` and any already-mapped SDK error through untouched,
702
+ so nothing gets relabelled), and unrecognised statuses go through the shared HTTP status ladder
703
+ rather than a bare `Error`.
704
+
705
+ Visible change: these two paths now reject with `NetworkError` (`code: "transport_failure"`) and a
706
+ typed error carrying the status, instead of a `TypeError` and an `Error`. A caller branching on
707
+ `instanceof Error` is unaffected; a caller branching on `isTransientError` starts getting retries.
708
+ - 5d174f2: Three pieces of duplicated logic now have one owner each. One internal error message improves.
709
+
710
+ The `~4 chars per token` estimate had two `@public` implementations reachable from two entry points —
711
+ `built-in-processors.ts` with a named constant, `compaction.ts` with the ratio inlined. Tuning it, or
712
+ switching to code points instead of UTF-16 units (a caveat both docblocks already carried), would have
713
+ silently diverged them. It lives in `compaction.ts` now, with `CHARS_PER_TOKEN` exported beside it;
714
+ `built-in-processors.ts` re-exports both under the same names, so nothing published changes.
715
+
716
+ The error-body reader duplicated character-for-character in the Bedrock and Vertex mappers is one
717
+ `parseErrorBody` in their shared module. It describes how `fetch` surfaces a body, which is the same
718
+ whoever sent it.
719
+
720
+ `abortError` had three copies — including inside the two files the extraction's own docblock named as
721
+ the ones that should stop having one. **One of the three behaved differently**: the pool-aware client
722
+ discarded a non-`Error` abort reason and raised a generic `"AbortError"`. All three are now the shared
723
+ implementation, which carries the caller's reason through. If you cancel with
724
+ `controller.abort("shutting down")` and the pool-aware client is in the path, the rejection message is
725
+ now `shutting down` rather than `AbortError`.
726
+ - 0c4df84: The `PermissionRule` documentation described a bug that was fixed, and told you to work around it.
727
+
728
+ The public docblock warned that a predicate matcher is invoked with `undefined` when the call omitted
729
+ the argument — so an allow-rule written to narrow would authorize an argument-less call, and a
730
+ deny-rule would throw a `TypeError` out of the permission gate. It closed by telling you to guard the
731
+ parameter in every predicate you write.
732
+
733
+ None of that has been true since `argMatches` started checking for a missing argument first, for
734
+ every matcher form. **A rule that declares an argument the call did not supply does not match, and
735
+ the predicate is not invoked.** You do not need the hand-written guards.
736
+
737
+ The fixed behaviour also had no test — deleting the guard left the entire suite green — so three
738
+ cases now cover it, including the two the old docblock described.
739
+ - edfa59c: The Responses-API transport's SSE state machine is a class, and the eight event kinds it handles are
740
+ now covered by tests.
741
+
742
+ `ResponsesApiClient.stream` inlined the whole dispatch: one 165-line generator, ten mutable locals
743
+ and eight `else if` arms, carrying a suppression that described it as "mirroring
744
+ `OpenAIStreamAccumulator.consume`". It mirrored what that method does, not how it is organised —
745
+ `consume` is seven lines delegating to small private methods. The state machine now lives in a
746
+ `ResponsesStreamAccumulator` shaped like its sibling, the suppression is gone, and every function in
747
+ the file is under the complexity threshold the project sets for itself.
748
+
749
+ The refactor is behaviour-preserving, and that claim was measured rather than asserted. Each arm of
750
+ the dispatch was mutated in turn before the change: three of eight killed a test, five did not — the
751
+ reasoning deltas, the incremental tool-argument accumulation, `response.incomplete` → `max_tokens`,
752
+ the reasoning/cache token counters, and the in-stream failure path. Notably, a comment in the
753
+ existing suite claimed the argument deltas were exercised "because the parsed input below can only
754
+ be right if they were accumulated"; deleting the accumulation left that suite green, because the
755
+ recorded fixture repeats the full arguments on the terminal event.
756
+
757
+ Eight characterisation tests close those gaps, and re-running the battery after the extraction kills
758
+ all eleven mutants. Two behaviours documented for the first time by that battery: the tool name is
759
+ taken from the frame that announced the call when the completion frame omits it, and frames sent
760
+ after `[DONE]` are ignored.
761
+
762
+ No public API changed.
763
+ - d1182ae: A resumed session now replays its history as structured tool calls instead of flat text, so the
56
764
  model stops learning to type `[tool call] <name>` as prose.
57
-
765
+
58
766
  Hydration has always produced two projections of each stored turn: `text`, in which a tool call
59
767
  folds to the marker `[tool call] NAME`, and structured `parts`, which carries the call id, the tool
60
768
  name and the arguments. The replay read `text` alone. So a resumed session showed the model its own
@@ -62,10 +770,126 @@
62
770
  is shown — it wrote the marker instead of calling the tool. Downstream that surfaced as an assistant
63
771
  message ending `"…report its output.[tool call] run_shell"` with no tool call behind it: the tool
64
772
  did not run, nothing errored, and the transcript read as the model narrating an action it never took.
65
-
773
+
66
774
  A turn with no `parts` replays exactly as before, so sessions stored by an older SDK keep the
67
775
  behaviour they were written under. Tool results replay as a user message, which is the convention
68
776
  the live loop already uses.
777
+
778
+ **An already-affected session recovers on its next turn.** No need to start a new one or delete
779
+ anything: the stored `parts` were always correct — only the `text` projection carried the marker —
780
+ so reading structure instead of prose heals a contaminated transcript rather than merely stopping
781
+ new contamination. Verified against a session that had accumulated seven occurrences of the marker.
782
+ - 1499923: `@theokit/sdk/sandbox` marks `resetInteractiveWarnLatch` and `resetSandboxWarnLatch`
783
+ as deprecated. Both are test seams for WARN-once latches that were re-exported
784
+ under plain camelCase, reading like ordinary API. They still work and are removed
785
+ in the next major; there is no replacement, because production code has no reason
786
+ to reset a warn-once latch.
787
+
788
+ `resetBwrapMemo` is NOT deprecated and now documents why it is public: it is the
789
+ companion to `detectBwrapMemoized`, and the only way to make a long-lived host
790
+ re-probe after `bwrap` is installed.
791
+ - f64ab2b: `SessionManager` gains an optional `getCookieSecret()`, the member `defineAuth`
792
+ uses to encrypt the OAuth transaction cookie.
793
+
794
+ It is additive: a manager without it falls back to `THEOKIT_OAUTH_TX_SECRET`
795
+ exactly as before. What changes is that the orchestrator no longer casts its own
796
+ port away to read an undeclared `secret` field — a shape no conforming
797
+ implementation could supply.
798
+ - 6aeeadb: Telemetry auto-instrumentation now logs what each adapter actually wired.
799
+
800
+ Five of the seven adapters install something concrete — an OTel span processor,
801
+ an event processor, a vendor client. Braintrust and LangSmith cannot: those
802
+ vendors auto-instrument from an env var, so loading the module is the whole
803
+ contribution. Both are legitimate, but the registry printed
804
+ `Braintrust auto-instrumented.` for the second kind, which read as a wired
805
+ telemetry pipeline when nothing had been installed.
806
+
807
+ `register()` now returns what it wired and the registry reports that instead of
808
+ asserting a single outcome for all seven. A vendor that is detected but cannot
809
+ be wired says so too, rather than being logged as instrumented.
810
+ - 7f2bce4: Test-only: the MCP token-store fixtures create their temporary directories atomically.
811
+
812
+ CodeQL reported an insecure temporary file at high severity, and the report was right. The
813
+ directories were built from a predictable name — `theokit-mcp-tokens-${hrtime}` under a
814
+ world-writable `/tmp` — and one of them was created world-writable and populated afterwards. On a
815
+ shared machine another local user can predict the path, win the race to create it, and plant a file
816
+ the test is about to trust; the restrictive mode passed to `mkdirSync` arrives after the name has
817
+ already been claimed.
818
+
819
+ `mkdtempSync` creates with a random suffix and mode 0700 in one atomic step. The one fixture whose
820
+ loose modes ARE the subject — the case proving the gate refuses a world-writable store — creates
821
+ restricted and loosens with `chmod`, so the state under test is identical and the window is closed.
822
+
823
+ No production code is affected and no assertion changed.
824
+ - edfa59c: The "no transport" error no longer tells you to install a package that cannot exist.
825
+
826
+ When a provider declares an `apiMode` the SDK has no transport for, the thrown `ConfigurationError`
827
+ advised: *"Install a third-party transport plugin (`@theokit-transport-{apiMode}`)"*. There is no
828
+ plugin mechanism to install into — `registerTransport` and `transportRegistry` appear nowhere in the
829
+ package, and the only other mention of `theokit-transport` was a docblock describing that very
830
+ message. Someone could publish the package; nothing would load it.
831
+
832
+ The message now says transports are a built-in, closed set, and names all four of them —
833
+ `chat_completions`, `anthropic_messages`, `bedrock_anthropic`, `responses_api` — instead of two. The
834
+ `transport_unavailable` code is unchanged, so anything branching on `code` is unaffected.
835
+ - e0a1ab9: Three public failure paths now carry a type and a code instead of a sentence.
836
+
837
+ `normalizeSchema` threw bare `Error` for both of its failures — a missing
838
+ `@valibot/to-json-schema` peer and an unsupported schema — so a caller could
839
+ branch on nothing but the message. Both are `ConfigurationError` now, with codes
840
+ `valibot_converter_missing` and `unsupported_schema`. It also detects the missing
841
+ peer from `err.code === "ERR_MODULE_NOT_FOUND"` before falling back to matching
842
+ the message text.
843
+
844
+ Resuming an agent whose persisted workspace path exists but is a file now says
845
+ so, instead of reporting it as "missing or inaccessible".
846
+
847
+ Subscription error frames carry the server error's own `code` over the wire, and
848
+ the WebSocket client prefers it over its blanket `ws_server_error`. A caller can
849
+ tell an invalid input from a disconnect without parsing English.
850
+ - edfa59c: Workflow errors now carry `code` and `isRetryable`, so the SDK's own retry helper can see them.
851
+
852
+ Eleven public workflow error classes extended plain `Error`. `isTransientError` is
853
+ `err instanceof TheokitAgentError && err.isRetryable === true`, and it is the default predicate of
854
+ `Retry.create` — so a class outside the hierarchy is permanent *by contract*, whatever it actually
855
+ represents. Wrapping `workflow.run()` in the SDK's own retry helper therefore got `false` for every
856
+ workflow failure, including `WorkflowAlreadyRunningError`, which is precisely the
857
+ try-again-in-a-moment condition.
858
+
859
+ They now extend `TheokitAgentError`, each with a stable `code`:
860
+
861
+ | code | retryable |
862
+ |---|---|
863
+ | `workflow_already_running` | **yes** — another run holds the single-flight lock |
864
+ | `workflow_duplicate_step_id`, `workflow_input_invalid`, `workflow_output_invalid`, `workflow_state_invalid`, `workflow_nested_failed`, `workflow_snapshot_not_found`, `workflow_max_iterations_exceeded`, `workflow_not_serializable`, `workflow_resume_step_not_found`, `workflow_compensate_not_implemented` | no |
865
+
866
+ Source-compatible: `TheokitAgentError extends Error`, so `instanceof Error` and `err.name` are
867
+ unchanged, and every existing field (`stepId`, `workflowName`, `detail`, …) stays where it was.
868
+
869
+ `WorkflowParallelError` is deliberately unchanged — it extends `AggregateError`, and the standard
870
+ `errors` array is why callers catch it. It stays outside the hierarchy, and therefore stays
871
+ non-retryable; inspect `err.errors` and decide per branch.
872
+
873
+ ## 4.63.4-next.0
874
+
875
+ ### Patch Changes
876
+
877
+ - 01630ec: The README explains that three unrelated things in this ecosystem are called "plugin", and that
878
+ two of them share one option.
879
+
880
+ A **framework plugin** (`@theokit/plugin-canvas`, `@theokit/auth-github`, …) extends a `theokit`
881
+ application — routes, UI, devtools, CLI verbs. An **SDK code plugin** (`PermissionPlugin.create(…)`,
882
+ `Handoff.asPlugin(…)`) extends an agent and is passed as `Agent.create({ plugins: [ … ] })`. The
883
+ same option also accepts `{ enabled: ["name"] }`, which selects **file-discovered** plugins under
884
+ `.theokit/plugins/` and is mutually exclusive with the array form.
885
+
886
+ Reaching for the wrong one raises no error; it simply has no effect. Installing `plugin-payments`
887
+ does nothing for an agent, and passing `PermissionPlugin` does nothing for a route.
888
+
889
+ It also records the observation that sends people looking for a bug that is not there:
890
+ `agent.pluginsManager` only ever holds the file-discovered form, so it reports `plugins: []` while
891
+ a code plugin is registered and working. An empty manager beside a populated `options.plugins` is
892
+ the normal shape.
69
893
 
70
894
  ## 4.63.3
71
895