@theokit/sdk 4.53.0 → 4.53.1

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 (373) hide show
  1. package/CHANGELOG.md +8 -8
  2. package/LICENSE +2 -2
  3. package/README.md +5 -5
  4. package/bin/theokit-migrate-config.mjs +11 -2
  5. package/dist/{agent-BiCINq25.d.ts → agent-B9HXlwID.d.ts} +21 -8
  6. package/dist/agent-FFVV4U5N.js +50 -0
  7. package/dist/{agent-ZAGG6ZBS.js.map → agent-FFVV4U5N.js.map} +1 -1
  8. package/dist/agent-YLAHVHEH.cjs +59 -0
  9. package/dist/{agent-JX5SBYDE.cjs.map → agent-YLAHVHEH.cjs.map} +1 -1
  10. package/dist/{agent-Zta1kvGH.d.cts → agent-nLqeXKIX.d.cts} +21 -8
  11. package/dist/agent-session-store-DUGBAX5V.cjs +23 -0
  12. package/dist/{agent-session-store-EPX2WQI4.cjs.map → agent-session-store-DUGBAX5V.cjs.map} +1 -1
  13. package/dist/agent-session-store-TNCGL5RN.js +6 -0
  14. package/dist/{agent-session-store-JMU7ASDB.js.map → agent-session-store-TNCGL5RN.js.map} +1 -1
  15. package/dist/agent.d.ts +16 -1
  16. package/dist/auth/index.cjs +18 -18
  17. package/dist/auth/index.cjs.map +1 -1
  18. package/dist/auth/index.d.cts +1 -1
  19. package/dist/auth/index.d.ts +1 -1
  20. package/dist/auth/index.js +6 -6
  21. package/dist/auth/index.js.map +1 -1
  22. package/dist/{batch-NLIS4QTW.js → batch-UPKN4SG6.js} +9 -9
  23. package/dist/{batch-NLIS4QTW.js.map → batch-UPKN4SG6.js.map} +1 -1
  24. package/dist/{batch-WQ3AJCDV.cjs → batch-ZEFN5SO7.cjs} +26 -26
  25. package/dist/{batch-WQ3AJCDV.cjs.map → batch-ZEFN5SO7.cjs.map} +1 -1
  26. package/dist/{chunk-2QMK627M.cjs → chunk-2D43RD5D.cjs} +8 -8
  27. package/dist/{chunk-2QMK627M.cjs.map → chunk-2D43RD5D.cjs.map} +1 -1
  28. package/dist/{chunk-DM6Y5B2G.cjs → chunk-2FYEVT2B.cjs} +121 -121
  29. package/dist/{chunk-DM6Y5B2G.cjs.map → chunk-2FYEVT2B.cjs.map} +1 -1
  30. package/dist/{chunk-BBZYXVLZ.cjs → chunk-2ZPEDVLM.cjs} +2 -2
  31. package/dist/chunk-2ZPEDVLM.cjs.map +1 -0
  32. package/dist/{chunk-T6QUCG7L.cjs → chunk-3BK6YR5P.cjs} +4 -4
  33. package/dist/{chunk-T6QUCG7L.cjs.map → chunk-3BK6YR5P.cjs.map} +1 -1
  34. package/dist/{chunk-23VZBRDQ.js → chunk-3V7UJLQT.js} +3 -3
  35. package/dist/chunk-3V7UJLQT.js.map +1 -0
  36. package/dist/{chunk-ITQ4NO4P.js → chunk-3WVMJY7F.js} +3 -3
  37. package/dist/{chunk-ITQ4NO4P.js.map → chunk-3WVMJY7F.js.map} +1 -1
  38. package/dist/{chunk-RAACTJ7C.cjs → chunk-3X6PM7DU.cjs} +4 -4
  39. package/dist/{chunk-RAACTJ7C.cjs.map → chunk-3X6PM7DU.cjs.map} +1 -1
  40. package/dist/{chunk-DEZ75ET5.js → chunk-4Q4K4WB5.js} +3 -3
  41. package/dist/{chunk-DEZ75ET5.js.map → chunk-4Q4K4WB5.js.map} +1 -1
  42. package/dist/{chunk-4X3SBHPK.js → chunk-5F5NWKPN.js} +20 -4
  43. package/dist/chunk-5F5NWKPN.js.map +1 -0
  44. package/dist/{chunk-NUEL6RCZ.cjs → chunk-5YKNEMXR.cjs} +4 -4
  45. package/dist/chunk-5YKNEMXR.cjs.map +1 -0
  46. package/dist/{chunk-3YYDHUNH.cjs → chunk-665SFFFR.cjs} +11 -11
  47. package/dist/{chunk-3YYDHUNH.cjs.map → chunk-665SFFFR.cjs.map} +1 -1
  48. package/dist/{chunk-CHVSMEKM.js → chunk-6AZDM6LK.js} +3 -3
  49. package/dist/chunk-6AZDM6LK.js.map +1 -0
  50. package/dist/{chunk-AMYY3JHQ.cjs → chunk-ADLLFY3H.cjs} +9 -9
  51. package/dist/{chunk-AMYY3JHQ.cjs.map → chunk-ADLLFY3H.cjs.map} +1 -1
  52. package/dist/{chunk-634YVZLU.js → chunk-B6HOIWQ6.js} +5 -5
  53. package/dist/{chunk-634YVZLU.js.map → chunk-B6HOIWQ6.js.map} +1 -1
  54. package/dist/{chunk-EQMLJ52C.cjs → chunk-BDTVFIPB.cjs} +26 -26
  55. package/dist/{chunk-EQMLJ52C.cjs.map → chunk-BDTVFIPB.cjs.map} +1 -1
  56. package/dist/{chunk-UJ3SXRZZ.js → chunk-BERBYXFH.js} +3 -3
  57. package/dist/{chunk-UJ3SXRZZ.js.map → chunk-BERBYXFH.js.map} +1 -1
  58. package/dist/{chunk-KZBB4YKU.js → chunk-BFYGJGC5.js} +3 -3
  59. package/dist/{chunk-KZBB4YKU.js.map → chunk-BFYGJGC5.js.map} +1 -1
  60. package/dist/{chunk-SXSPMRSV.cjs → chunk-BM6N4KHO.cjs} +21 -3
  61. package/dist/chunk-BM6N4KHO.cjs.map +1 -0
  62. package/dist/{chunk-2CFEET3Y.cjs → chunk-C4H6PB5J.cjs} +4 -4
  63. package/dist/chunk-C4H6PB5J.cjs.map +1 -0
  64. package/dist/{chunk-NFATC6ZF.cjs → chunk-C5DEO6OI.cjs} +4 -4
  65. package/dist/{chunk-NFATC6ZF.cjs.map → chunk-C5DEO6OI.cjs.map} +1 -1
  66. package/dist/{chunk-EUBGGYPH.cjs → chunk-CZ2GKKYL.cjs} +5 -5
  67. package/dist/{chunk-EUBGGYPH.cjs.map → chunk-CZ2GKKYL.cjs.map} +1 -1
  68. package/dist/{chunk-I732VEDW.js → chunk-D24WJWN2.js} +3 -3
  69. package/dist/{chunk-I732VEDW.js.map → chunk-D24WJWN2.js.map} +1 -1
  70. package/dist/{chunk-3R4ZCQAZ.cjs → chunk-D75S2X6I.cjs} +5 -5
  71. package/dist/{chunk-3R4ZCQAZ.cjs.map → chunk-D75S2X6I.cjs.map} +1 -1
  72. package/dist/{chunk-5XXUYU3M.js → chunk-DGOG5NXR.js} +3 -3
  73. package/dist/{chunk-5XXUYU3M.js.map → chunk-DGOG5NXR.js.map} +1 -1
  74. package/dist/{chunk-RTLUZKDL.cjs → chunk-E7FJOO4G.cjs} +11 -11
  75. package/dist/{chunk-RTLUZKDL.cjs.map → chunk-E7FJOO4G.cjs.map} +1 -1
  76. package/dist/{chunk-BWGXYOBZ.cjs → chunk-ELKO4ZLR.cjs} +4 -4
  77. package/dist/{chunk-BWGXYOBZ.cjs.map → chunk-ELKO4ZLR.cjs.map} +1 -1
  78. package/dist/{chunk-FBZMSLDC.cjs → chunk-EZ2YEF4F.cjs} +4 -4
  79. package/dist/{chunk-FBZMSLDC.cjs.map → chunk-EZ2YEF4F.cjs.map} +1 -1
  80. package/dist/{chunk-2VFZQEDW.cjs → chunk-F77UENR6.cjs} +343 -324
  81. package/dist/chunk-F77UENR6.cjs.map +1 -0
  82. package/dist/{chunk-OZXPA3ME.js → chunk-FFM3SJTQ.js} +4 -4
  83. package/dist/{chunk-OZXPA3ME.js.map → chunk-FFM3SJTQ.js.map} +1 -1
  84. package/dist/{chunk-PLUCC4N5.js → chunk-FIOCJYLA.js} +3 -3
  85. package/dist/{chunk-PLUCC4N5.js.map → chunk-FIOCJYLA.js.map} +1 -1
  86. package/dist/{chunk-Z5U2JGEK.cjs → chunk-FOXKFTVZ.cjs} +11 -11
  87. package/dist/{chunk-Z5U2JGEK.cjs.map → chunk-FOXKFTVZ.cjs.map} +1 -1
  88. package/dist/{chunk-K42QGAKM.cjs → chunk-FPYT5WZP.cjs} +10 -10
  89. package/dist/{chunk-K42QGAKM.cjs.map → chunk-FPYT5WZP.cjs.map} +1 -1
  90. package/dist/{chunk-NZOR3N4E.js → chunk-G3JWXOGY.js} +78 -58
  91. package/dist/chunk-G3JWXOGY.js.map +1 -0
  92. package/dist/{chunk-DHVNJYTO.js → chunk-GBBDINFK.js} +3 -3
  93. package/dist/{chunk-DHVNJYTO.js.map → chunk-GBBDINFK.js.map} +1 -1
  94. package/dist/{chunk-V45L2OYP.cjs → chunk-GD63JPGC.cjs} +9 -9
  95. package/dist/{chunk-V45L2OYP.cjs.map → chunk-GD63JPGC.cjs.map} +1 -1
  96. package/dist/{chunk-I5OTK2RP.js → chunk-GOVJO4YE.js} +5 -5
  97. package/dist/{chunk-I5OTK2RP.js.map → chunk-GOVJO4YE.js.map} +1 -1
  98. package/dist/{chunk-CZHPR2G7.cjs → chunk-HAWE74GQ.cjs} +8 -8
  99. package/dist/{chunk-CZHPR2G7.cjs.map → chunk-HAWE74GQ.cjs.map} +1 -1
  100. package/dist/{chunk-KIX45IKP.js → chunk-HE4BIAOS.js} +4 -4
  101. package/dist/{chunk-KIX45IKP.js.map → chunk-HE4BIAOS.js.map} +1 -1
  102. package/dist/{chunk-AM2CNBKE.js → chunk-HKCKOAIO.js} +2 -2
  103. package/dist/chunk-HKCKOAIO.js.map +1 -0
  104. package/dist/{chunk-2YWWPCGX.js → chunk-HSQ5Q3I5.js} +10 -12
  105. package/dist/chunk-HSQ5Q3I5.js.map +1 -0
  106. package/dist/{chunk-QLAWEGTZ.cjs → chunk-JIQRXKTA.cjs} +7 -7
  107. package/dist/chunk-JIQRXKTA.cjs.map +1 -0
  108. package/dist/{chunk-EFXJ5C7X.js → chunk-KSWHTR54.js} +5 -5
  109. package/dist/{chunk-EFXJ5C7X.js.map → chunk-KSWHTR54.js.map} +1 -1
  110. package/dist/{chunk-6PTCKXD3.js → chunk-LD4MOBFX.js} +8 -8
  111. package/dist/{chunk-6PTCKXD3.js.map → chunk-LD4MOBFX.js.map} +1 -1
  112. package/dist/{chunk-2YGIBOUH.cjs → chunk-LPVIRJVF.cjs} +9 -9
  113. package/dist/chunk-LPVIRJVF.cjs.map +1 -0
  114. package/dist/{chunk-2Y5NO2SY.js → chunk-LS3LMQ23.js} +9 -9
  115. package/dist/{chunk-2Y5NO2SY.js.map → chunk-LS3LMQ23.js.map} +1 -1
  116. package/dist/{chunk-N43XLTHZ.js → chunk-LTSTGCL6.js} +3 -3
  117. package/dist/{chunk-N43XLTHZ.js.map → chunk-LTSTGCL6.js.map} +1 -1
  118. package/dist/{chunk-W4FV7JBH.js → chunk-MSFLYJDY.js} +4 -4
  119. package/dist/chunk-MSFLYJDY.js.map +1 -0
  120. package/dist/{chunk-C4EU627W.js → chunk-N5CR3TJZ.js} +4 -4
  121. package/dist/{chunk-C4EU627W.js.map → chunk-N5CR3TJZ.js.map} +1 -1
  122. package/dist/{chunk-HTK54K2J.js → chunk-NZL4BNFQ.js} +3 -3
  123. package/dist/{chunk-HTK54K2J.js.map → chunk-NZL4BNFQ.js.map} +1 -1
  124. package/dist/{chunk-T5ZWI3MC.cjs → chunk-OUOXM36O.cjs} +11 -11
  125. package/dist/{chunk-T5ZWI3MC.cjs.map → chunk-OUOXM36O.cjs.map} +1 -1
  126. package/dist/{chunk-BXVSBYGW.js → chunk-OY7O3Q6R.js} +5 -5
  127. package/dist/{chunk-BXVSBYGW.js.map → chunk-OY7O3Q6R.js.map} +1 -1
  128. package/dist/{chunk-L7EGRCKJ.js → chunk-PBZ7HMBP.js} +4 -4
  129. package/dist/{chunk-L7EGRCKJ.js.map → chunk-PBZ7HMBP.js.map} +1 -1
  130. package/dist/{chunk-OIBHY6JQ.js → chunk-PGP7IOJ2.js} +4 -4
  131. package/dist/{chunk-OIBHY6JQ.js.map → chunk-PGP7IOJ2.js.map} +1 -1
  132. package/dist/{chunk-R7TKOQMJ.js → chunk-POWRZSK4.js} +3 -3
  133. package/dist/{chunk-R7TKOQMJ.js.map → chunk-POWRZSK4.js.map} +1 -1
  134. package/dist/{chunk-R3CKCRK3.cjs → chunk-Q4RESANI.cjs} +4 -4
  135. package/dist/{chunk-R3CKCRK3.cjs.map → chunk-Q4RESANI.cjs.map} +1 -1
  136. package/dist/{chunk-QN5N3ZVT.cjs → chunk-QBTVATSF.cjs} +25 -24
  137. package/dist/chunk-QBTVATSF.cjs.map +1 -0
  138. package/dist/{chunk-ZSJPRPN7.js → chunk-R5YZACGK.js} +3 -3
  139. package/dist/{chunk-ZSJPRPN7.js.map → chunk-R5YZACGK.js.map} +1 -1
  140. package/dist/{chunk-ADVZIC43.cjs → chunk-RAHSWE5C.cjs} +10 -10
  141. package/dist/{chunk-ADVZIC43.cjs.map → chunk-RAHSWE5C.cjs.map} +1 -1
  142. package/dist/{chunk-NOS7PTKP.js → chunk-SEL2ZQMT.js} +7 -7
  143. package/dist/{chunk-NOS7PTKP.js.map → chunk-SEL2ZQMT.js.map} +1 -1
  144. package/dist/{chunk-XWCTBGYK.js → chunk-SK4QLUBK.js} +3 -3
  145. package/dist/chunk-SK4QLUBK.js.map +1 -0
  146. package/dist/{chunk-XRI6DXPZ.js → chunk-SSDD676S.js} +3 -3
  147. package/dist/chunk-SSDD676S.js.map +1 -0
  148. package/dist/{chunk-E3OCRJU6.cjs → chunk-SVO5WPZX.cjs} +11 -11
  149. package/dist/{chunk-E3OCRJU6.cjs.map → chunk-SVO5WPZX.cjs.map} +1 -1
  150. package/dist/{chunk-44IISBRZ.cjs → chunk-SZHU7A5B.cjs} +4 -4
  151. package/dist/{chunk-44IISBRZ.cjs.map → chunk-SZHU7A5B.cjs.map} +1 -1
  152. package/dist/{chunk-TR4V2LHV.cjs → chunk-TTJ54H3E.cjs} +5 -5
  153. package/dist/{chunk-TR4V2LHV.cjs.map → chunk-TTJ54H3E.cjs.map} +1 -1
  154. package/dist/{chunk-HI4ZW62S.js → chunk-U4UJHOSH.js} +4 -4
  155. package/dist/chunk-U4UJHOSH.js.map +1 -0
  156. package/dist/{chunk-XGYI2KQH.js → chunk-UFIXH26P.js} +4 -4
  157. package/dist/{chunk-XGYI2KQH.js.map → chunk-UFIXH26P.js.map} +1 -1
  158. package/dist/{chunk-JJZ4NIAG.js → chunk-V26QVGUG.js} +7 -6
  159. package/dist/chunk-V26QVGUG.js.map +1 -0
  160. package/dist/{chunk-3SHW7XKK.js → chunk-V6HWJQQV.js} +6 -5
  161. package/dist/chunk-V6HWJQQV.js.map +1 -0
  162. package/dist/{chunk-MV4TOCUK.js → chunk-VC5ABJXC.js} +3 -3
  163. package/dist/{chunk-MV4TOCUK.js.map → chunk-VC5ABJXC.js.map} +1 -1
  164. package/dist/{chunk-33L2NVTJ.cjs → chunk-VF7X6HDR.cjs} +8 -8
  165. package/dist/chunk-VF7X6HDR.cjs.map +1 -0
  166. package/dist/{chunk-7HQVDLFI.cjs → chunk-VGPXHHF3.cjs} +11 -9
  167. package/dist/chunk-VGPXHHF3.cjs.map +1 -0
  168. package/dist/{chunk-BC5EUG7R.cjs → chunk-VUKQL3L2.cjs} +18 -20
  169. package/dist/chunk-VUKQL3L2.cjs.map +1 -0
  170. package/dist/{chunk-PVBANCWU.cjs → chunk-VW6M4B3Z.cjs} +5 -5
  171. package/dist/{chunk-PVBANCWU.cjs.map → chunk-VW6M4B3Z.cjs.map} +1 -1
  172. package/dist/{chunk-KNZU4YO5.cjs → chunk-WQ53UQL4.cjs} +4 -4
  173. package/dist/{chunk-KNZU4YO5.cjs.map → chunk-WQ53UQL4.cjs.map} +1 -1
  174. package/dist/{chunk-6DCTL32L.cjs → chunk-XPR366DL.cjs} +17 -17
  175. package/dist/{chunk-6DCTL32L.cjs.map → chunk-XPR366DL.cjs.map} +1 -1
  176. package/dist/{chunk-7TB5U7RK.js → chunk-XROIW6BH.js} +6 -6
  177. package/dist/{chunk-7TB5U7RK.js.map → chunk-XROIW6BH.js.map} +1 -1
  178. package/dist/{chunk-ECPL5RV6.cjs → chunk-Y4AXQOT4.cjs} +8 -8
  179. package/dist/{chunk-ECPL5RV6.cjs.map → chunk-Y4AXQOT4.cjs.map} +1 -1
  180. package/dist/{chunk-E6T264NS.js → chunk-Y4I4EQFK.js} +3 -3
  181. package/dist/{chunk-E6T264NS.js.map → chunk-Y4I4EQFK.js.map} +1 -1
  182. package/dist/{chunk-FUASIT3E.cjs → chunk-ZN2DGEY3.cjs} +15 -15
  183. package/dist/{chunk-FUASIT3E.cjs.map → chunk-ZN2DGEY3.cjs.map} +1 -1
  184. package/dist/{chunk-YTO5BRBD.cjs → chunk-ZT57WTUJ.cjs} +8 -8
  185. package/dist/chunk-ZT57WTUJ.cjs.map +1 -0
  186. package/dist/compact-session-4MNKNMO2.js +21 -0
  187. package/dist/{compact-session-EJ36VH5I.js.map → compact-session-4MNKNMO2.js.map} +1 -1
  188. package/dist/compact-session-EPFBQ46Z.cjs +58 -0
  189. package/dist/{compact-session-6GKIS4SD.cjs.map → compact-session-EPFBQ46Z.cjs.map} +1 -1
  190. package/dist/compaction.cjs +16 -16
  191. package/dist/compaction.js +3 -3
  192. package/dist/concurrency.cjs +6 -6
  193. package/dist/concurrency.js +4 -4
  194. package/dist/context-7USNN6LP.cjs +22 -0
  195. package/dist/{context-4HGPCOH6.cjs.map → context-7USNN6LP.cjs.map} +1 -1
  196. package/dist/context-ENXZNF6J.js +5 -0
  197. package/dist/{context-DCECDKWN.js.map → context-ENXZNF6J.js.map} +1 -1
  198. package/dist/{cron-DyWQsEG6.d.ts → cron-BMjgFH-_.d.ts} +1 -1
  199. package/dist/{cron-DgHJnMAK.d.cts → cron-DFDdCdMM.d.cts} +1 -1
  200. package/dist/cron.cjs +33 -33
  201. package/dist/cron.d.cts +2 -2
  202. package/dist/cron.d.ts +2 -2
  203. package/dist/cron.js +32 -32
  204. package/dist/errors.cjs +21 -21
  205. package/dist/errors.js +2 -2
  206. package/dist/eval.cjs +43 -43
  207. package/dist/eval.js +33 -33
  208. package/dist/{executor-4SW7QGZ4.cjs → executor-2Z3LGG3I.cjs} +24 -24
  209. package/dist/{executor-4SW7QGZ4.cjs.map → executor-2Z3LGG3I.cjs.map} +1 -1
  210. package/dist/{executor-3CGPLVJL.js → executor-2Z6XJJJG.js} +7 -7
  211. package/dist/{executor-3CGPLVJL.js.map → executor-2Z6XJJJG.js.map} +1 -1
  212. package/dist/filesystem/index.cjs +7 -7
  213. package/dist/filesystem/index.js +3 -3
  214. package/dist/fs-session-store-R5FD3EN6.js +10 -0
  215. package/dist/{fs-session-store-LIKYT24K.js.map → fs-session-store-R5FD3EN6.js.map} +1 -1
  216. package/dist/fs-session-store-VVY2AHWG.cjs +19 -0
  217. package/dist/{fs-session-store-VXXDIBGM.cjs.map → fs-session-store-VVY2AHWG.cjs.map} +1 -1
  218. package/dist/generate-object-AVXOJK2I.cjs +20 -0
  219. package/dist/{generate-object-E465DX5I.cjs.map → generate-object-AVXOJK2I.cjs.map} +1 -1
  220. package/dist/generate-object-WQRCXFD2.js +7 -0
  221. package/dist/{generate-object-TVQCW2IZ.js.map → generate-object-WQRCXFD2.js.map} +1 -1
  222. package/dist/index-manager-VRU3A2YL.cjs +21 -0
  223. package/dist/{index-manager-HGGL4DD5.cjs.map → index-manager-VRU3A2YL.cjs.map} +1 -1
  224. package/dist/index-manager-WS7TVKUW.js +12 -0
  225. package/dist/{index-manager-EA6FGIQG.js.map → index-manager-WS7TVKUW.js.map} +1 -1
  226. package/dist/index.cjs +143 -135
  227. package/dist/index.d.cts +64 -8
  228. package/dist/index.d.ts +64 -8
  229. package/dist/index.js +45 -45
  230. package/dist/{inject-session-67SF65FC.cjs → inject-session-AUQLBDRS.cjs} +9 -9
  231. package/dist/{inject-session-67SF65FC.cjs.map → inject-session-AUQLBDRS.cjs.map} +1 -1
  232. package/dist/{inject-session-HO7FYVCX.js → inject-session-GMBMJVNZ.js} +7 -7
  233. package/dist/{inject-session-HO7FYVCX.js.map → inject-session-GMBMJVNZ.js.map} +1 -1
  234. package/dist/internal/auth/auth-types.d.ts +1 -1
  235. package/dist/internal/auth/oauth-device.d.ts +2 -2
  236. package/dist/internal/local-agent/mcp-pool.d.ts +2 -4
  237. package/dist/internal/mcp/oauth.d.ts +14 -1
  238. package/dist/internal/mcp/token-storage.d.ts +18 -1
  239. package/dist/internal/memory/adapters/index.cjs +8 -8
  240. package/dist/internal/memory/adapters/index.js +7 -7
  241. package/dist/internal/persistence/atomic-write.d.cts +93 -0
  242. package/dist/internal/persistence/atomic-write.d.ts +93 -0
  243. package/dist/internal/persistence/file-lock.d.cts +13 -1
  244. package/dist/internal/persistence/file-lock.d.ts +13 -1
  245. package/dist/internal/persistence/fts5-sanitize.d.cts +9 -1
  246. package/dist/internal/persistence/fts5-sanitize.d.ts +9 -1
  247. package/dist/internal/persistence/index.cjs +25 -25
  248. package/dist/internal/persistence/index.js +6 -6
  249. package/dist/internal/persistence/session-dir.d.cts +1 -0
  250. package/dist/internal/persistence/session-dir.d.ts +1 -0
  251. package/dist/internal/persistence/session-writer.d.cts +13 -0
  252. package/dist/internal/persistence/session-writer.d.ts +13 -0
  253. package/dist/internal/persistence/sqlite-wal.d.cts +9 -1
  254. package/dist/internal/persistence/sqlite-wal.d.ts +9 -1
  255. package/dist/internal/providers/builtin/cerebras.d.ts +2 -2
  256. package/dist/internal/providers/builtin/deepinfra.d.ts +1 -1
  257. package/dist/internal/providers/catalog-source-models-dev.d.ts +1 -1
  258. package/dist/internal/runtime/lifecycle/env-policy.d.ts +1 -3
  259. package/dist/internal/security/index.cjs +13 -13
  260. package/dist/internal/security/index.js +3 -3
  261. package/dist/internal/security/path-guard.d.cts +61 -0
  262. package/dist/internal/security/path-guard.d.ts +61 -0
  263. package/dist/internal/session/compact-session.d.ts +2 -2
  264. package/dist/internal/telemetry/tracer.d.ts +24 -0
  265. package/dist/judge-call-G5SGV2M2.cjs +22 -0
  266. package/dist/{judge-call-GVIJWQVE.cjs.map → judge-call-G5SGV2M2.cjs.map} +1 -1
  267. package/dist/judge-call-MDIPTBJI.js +5 -0
  268. package/dist/{judge-call-QMKGC2ZK.js.map → judge-call-MDIPTBJI.js.map} +1 -1
  269. package/dist/mcp-auth.cjs +14 -14
  270. package/dist/mcp-auth.cjs.map +1 -1
  271. package/dist/mcp-auth.js +4 -4
  272. package/dist/mcp-auth.js.map +1 -1
  273. package/dist/models.cjs +22 -22
  274. package/dist/models.cjs.map +1 -1
  275. package/dist/models.js +7 -7
  276. package/dist/models.js.map +1 -1
  277. package/dist/path-safety.cjs +10 -10
  278. package/dist/path-safety.js +3 -3
  279. package/dist/persistence.cjs +28 -28
  280. package/dist/persistence.js +8 -8
  281. package/dist/project.cjs +5 -5
  282. package/dist/project.js +3 -3
  283. package/dist/registry-63ASMXT4.cjs +46 -0
  284. package/dist/{registry-UBY26R4I.cjs.map → registry-63ASMXT4.cjs.map} +1 -1
  285. package/dist/registry-O7FJ2MPM.js +9 -0
  286. package/dist/{registry-GC7BQMSV.js.map → registry-O7FJ2MPM.js.map} +1 -1
  287. package/dist/retry.cjs +4 -4
  288. package/dist/retry.js +3 -3
  289. package/dist/sandbox/bwrap.d.cts +1 -2
  290. package/dist/sandbox/bwrap.d.ts +1 -2
  291. package/dist/sandbox/index.cjs +20 -20
  292. package/dist/sandbox/index.cjs.map +1 -1
  293. package/dist/sandbox/index.js +5 -5
  294. package/dist/sandbox/index.js.map +1 -1
  295. package/dist/server/errors-envelope.cjs +14 -14
  296. package/dist/server/errors-envelope.js +3 -3
  297. package/dist/session-transcript-DOM3UTXR.cjs +50 -0
  298. package/dist/{session-transcript-TNAJ4O3M.cjs.map → session-transcript-DOM3UTXR.cjs.map} +1 -1
  299. package/dist/session-transcript-RAKEK76V.js +5 -0
  300. package/dist/{session-transcript-SKIRBEJE.js.map → session-transcript-RAKEK76V.js.map} +1 -1
  301. package/dist/skills.cjs +7 -7
  302. package/dist/skills.js +5 -5
  303. package/dist/stream-object-L3Q7PBMF.cjs +20 -0
  304. package/dist/{stream-object-T4DAMNVB.cjs.map → stream-object-L3Q7PBMF.cjs.map} +1 -1
  305. package/dist/stream-object-ZYXWS4B2.js +7 -0
  306. package/dist/{stream-object-QMNR3YFF.js.map → stream-object-ZYXWS4B2.js.map} +1 -1
  307. package/dist/subagents-loader-I56GSKAQ.js +6 -0
  308. package/dist/{subagents-loader-WN2SB6PV.js.map → subagents-loader-I56GSKAQ.js.map} +1 -1
  309. package/dist/subagents-loader-VRW73QQT.cjs +15 -0
  310. package/dist/{subagents-loader-3CXBQWWY.cjs.map → subagents-loader-VRW73QQT.cjs.map} +1 -1
  311. package/dist/subagents-loader.cjs +6 -6
  312. package/dist/subagents-loader.d.cts +1 -1
  313. package/dist/subagents-loader.d.ts +1 -1
  314. package/dist/subagents-loader.js +4 -4
  315. package/dist/subscription/index.cjs +3 -3
  316. package/dist/subscription/index.js +2 -2
  317. package/dist/task-store.cjs +7 -7
  318. package/dist/task-store.js +4 -4
  319. package/dist/types/agent.d.ts +19 -6
  320. package/dist/types/provider-profile.d.ts +2 -2
  321. package/dist/workflow.cjs +27 -27
  322. package/dist/workflow.js +6 -6
  323. package/package.json +18 -18
  324. package/dist/agent-JX5SBYDE.cjs +0 -59
  325. package/dist/agent-ZAGG6ZBS.js +0 -50
  326. package/dist/agent-session-store-EPX2WQI4.cjs +0 -23
  327. package/dist/agent-session-store-JMU7ASDB.js +0 -6
  328. package/dist/chunk-23VZBRDQ.js.map +0 -1
  329. package/dist/chunk-2CFEET3Y.cjs.map +0 -1
  330. package/dist/chunk-2VFZQEDW.cjs.map +0 -1
  331. package/dist/chunk-2YGIBOUH.cjs.map +0 -1
  332. package/dist/chunk-2YWWPCGX.js.map +0 -1
  333. package/dist/chunk-33L2NVTJ.cjs.map +0 -1
  334. package/dist/chunk-3SHW7XKK.js.map +0 -1
  335. package/dist/chunk-4X3SBHPK.js.map +0 -1
  336. package/dist/chunk-7HQVDLFI.cjs.map +0 -1
  337. package/dist/chunk-AM2CNBKE.js.map +0 -1
  338. package/dist/chunk-BBZYXVLZ.cjs.map +0 -1
  339. package/dist/chunk-BC5EUG7R.cjs.map +0 -1
  340. package/dist/chunk-CHVSMEKM.js.map +0 -1
  341. package/dist/chunk-HI4ZW62S.js.map +0 -1
  342. package/dist/chunk-JJZ4NIAG.js.map +0 -1
  343. package/dist/chunk-NUEL6RCZ.cjs.map +0 -1
  344. package/dist/chunk-NZOR3N4E.js.map +0 -1
  345. package/dist/chunk-QLAWEGTZ.cjs.map +0 -1
  346. package/dist/chunk-QN5N3ZVT.cjs.map +0 -1
  347. package/dist/chunk-SXSPMRSV.cjs.map +0 -1
  348. package/dist/chunk-W4FV7JBH.js.map +0 -1
  349. package/dist/chunk-XRI6DXPZ.js.map +0 -1
  350. package/dist/chunk-XWCTBGYK.js.map +0 -1
  351. package/dist/chunk-YTO5BRBD.cjs.map +0 -1
  352. package/dist/compact-session-6GKIS4SD.cjs +0 -58
  353. package/dist/compact-session-EJ36VH5I.js +0 -21
  354. package/dist/context-4HGPCOH6.cjs +0 -22
  355. package/dist/context-DCECDKWN.js +0 -5
  356. package/dist/fs-session-store-LIKYT24K.js +0 -10
  357. package/dist/fs-session-store-VXXDIBGM.cjs +0 -19
  358. package/dist/generate-object-E465DX5I.cjs +0 -20
  359. package/dist/generate-object-TVQCW2IZ.js +0 -7
  360. package/dist/index-manager-EA6FGIQG.js +0 -12
  361. package/dist/index-manager-HGGL4DD5.cjs +0 -21
  362. package/dist/judge-call-GVIJWQVE.cjs +0 -22
  363. package/dist/judge-call-QMKGC2ZK.js +0 -5
  364. package/dist/registry-GC7BQMSV.js +0 -9
  365. package/dist/registry-UBY26R4I.cjs +0 -46
  366. package/dist/session-transcript-SKIRBEJE.js +0 -5
  367. package/dist/session-transcript-TNAJ4O3M.cjs +0 -50
  368. package/dist/stream-object-QMNR3YFF.js +0 -7
  369. package/dist/stream-object-T4DAMNVB.cjs +0 -20
  370. package/dist/subagents-loader-3CXBQWWY.cjs +0 -15
  371. package/dist/subagents-loader-WN2SB6PV.js +0 -6
  372. package/docs/error-codes.md +0 -179
  373. package/docs/harness-capability-map.md +0 -304
@@ -1,304 +0,0 @@
1
- ---
2
- type: API Reference
3
- title: Theo Harness Capability Map
4
- description: Every public primitive of @theokit/sdk and @theokit/sdk-tools with its real import path and a minimal example.
5
- resource: https://github.com/usetheodev/theokit-sdk/blob/main/wiki/reference/harness-capability-map.md
6
- tags: [api, imports, discovery, shipped-to-npm]
7
- generated: { by: human:paulohenriquevn, at: 2026-08-05T00:00:00Z }
8
- status: stable
9
- sources:
10
- - id: types
11
- resource: packages/sdk/src/types/
12
- title: Exported TypeScript types — the canonical public contract
13
- - id: resolve-check
14
- resource: scripts/check-capability-map.mjs
15
- title: Committed resolve-check that verifies every import in this file
16
- ---
17
-
18
- # Theo Harness Capability Map
19
-
20
- A single navigable index of **what the Theo harness gives you** — every public
21
- primitive with its real import path, a one-line description, and a minimal
22
- example. The goal: find `compactTranscript`, `buildRepoMap`, `isTransientError`,
23
- or any other capability **without reading source**.
24
-
25
- - Every `import` line below resolves against the published packages — verified by the committed resolve-check `scripts/check-capability-map.mjs` (run it after `pnpm --filter @theokit/sdk build`; intended to be wired into CI).
26
- - Public `@theokit/sdk/*` and `@theokit/sdk-tools` sub-paths are **semver-protected**. The `@theokit/sdk/internal/*` sub-paths are **semver-exempt** (may break) — prefer the public homes listed here.
27
- - The exported TypeScript types are the canonical, exhaustive API contract; this map is the discovery front-door, organized by capability.
28
-
29
- > Scope: this map covers the **Harness** packages in this repo — `@theokit/sdk` and `@theokit/sdk-tools`. Capabilities that live in sibling repos (UI, the `theokit` HTTP framework, ORM, memory adapters) are listed under [Out-of-repo capabilities](#out-of-repo-capabilities) with a pointer.
30
-
31
- ---
32
-
33
- ## Agent runtime core — `@theokit/sdk`
34
-
35
- ```typescript
36
- import {
37
- Agent, // Agent.create({ model, apiKey, tools, ... }) → agent; agent.send(msg) → run
38
- AgentFactory, // AgentFactory.create(defaults) → reusable agent builder (SE36)
39
- AgentBuilder, // fluent agent construction
40
- Tool, // Tool.create({ name, description, inputSchema, handler }) → CustomTool (SE36)
41
- Plugin, // Plugin.create({ hooks }) → Plugin (pre/post tool-call, etc.) (SE36)
42
- Provider, // Provider.create(...) → custom LLM provider (SE36)
43
- PermissionEngine, // permission decisions for tool calls (default-allow; pluggable)
44
- PermissionPlugin, // PermissionPlugin.create(...) → wrap a permission policy as a Plugin (SE36)
45
- createCounterBudgetTracker, // createCounterBudgetTracker({ maxIterations }) → BudgetTracker (enforced step cap)
46
- Budget, UsageAccumulator, // usage/cost accounting
47
- computeCost, normalizeUsage, getPricingEntry, // cost helpers (never 0 when pricing unknown)
48
- Squad, Task, // Squad.create(...) multi-agent + task primitives (SE36)
49
- Theokit, Cron, // top-level namespaces (Theokit.models.list(), Cron.create(...))
50
- type SessionMessage, // one turn of a persisted transcript: { role, text, parts? }
51
- type SessionMessagePart, // structured part: text | tool_use (id/name/input) | tool_result (toolUseId/content)
52
- type AgentDescription, // Agent.describe(id) → { agentId, runtime, model?, tools, subagents }
53
- type AgentToolDescription, // { name, description, inputSchema } — handler stripped
54
- type AgentSubagentDescription, // { name, description, model?, tools? } — prompt stripped
55
- } from "@theokit/sdk";
56
-
57
- // Step cap fail-closed in one line:
58
- const agent = await Agent.create({
59
- model: { id: "anthropic/claude-3-5-sonnet" },
60
- apiKey: process.env.OPENROUTER_API_KEY,
61
- budgetTracker: createCounterBudgetTracker({ maxIterations: 50 }), // stops + sets RunResult.stoppedAtIterationLimit
62
- });
63
-
64
- // Re-render a resumed session as tool CARDS, not prose (theokit#146). `text` is the flat
65
- // projection the model replay uses; `parts` keeps the call id, tool name and arguments, plus the
66
- // `toolUseId` that correlates a result back to its call. Local sessions only; read-only.
67
- for (const message of await Agent.transcript("agent-abc123")) {
68
- for (const part of message.parts ?? []) {
69
- if (part.type === "tool_use") renderCard(part.name, part.input, part.id);
70
- }
71
- }
72
-
73
- // Reflect the live registry — what an agent can call, without reading source (theokit#123).
74
- // A projection: tool handlers and subagent prompts never leave the process.
75
- const { tools, subagents } = await Agent.describe("agent-abc123");
76
-
77
- // A committed workflow describes its own shape (theokit#161). No registry exists on purpose — the
78
- // host holds the workflows it defined, so it maps over its own and calls this.
79
- const { name, steps } = myWorkflow.describe(); // steps: [{ id, kind, steps? }]
80
- ```
81
-
82
- ## Errors & transient classification — `@theokit/sdk/errors`
83
-
84
- ```typescript
85
- import {
86
- isTransientError, // isTransientError(err) → boolean (429/5xx/network/ECONNRESET on TheokitAgentError) — the single retry taxonomy
87
- TheokitAgentError, // base error class (all SDK errors extend it)
88
- RateLimitError, NetworkError, AuthenticationError, ConfigurationError, // typed subclasses
89
- } from "@theokit/sdk/errors"; // NOTE: import isTransientError + classes from this subpath OR the barrel — use ONE entry consistently (cross-entry instanceof is class-identity sensitive)
90
-
91
- if (isTransientError(err)) await retry();
92
- ```
93
-
94
- ## Retry — `@theokit/sdk/retry`
95
-
96
- ```typescript
97
- import { Retry } from "@theokit/sdk/retry";
98
- // Retry.create(fn, { retries, isRetryable, initialDelayMs, maxDelayMs, backoffMultiplier, sleep, signal }) (SE36)
99
- const res = await Retry.create(() => callApi(), { retries: 3, isRetryable: isTransientError, initialDelayMs: 200 });
100
- ```
101
-
102
- ## Concurrency — `@theokit/sdk/concurrency`
103
-
104
- ```typescript
105
- import { mapWithConcurrency, Semaphore } from "@theokit/sdk/concurrency";
106
- // mapWithConcurrency(items, concurrency, fn) → ordered results, bounded pool; Semaphore.create(n) → gate (SE36)
107
- const out = await mapWithConcurrency(tasks, 8, async (t) => run(t));
108
- ```
109
-
110
- ## Context & compaction — `@theokit/sdk/compaction`
111
-
112
- ```typescript
113
- import {
114
- estimateTokens, // estimateTokens(text) → ceil(len/4) tokenizer-free estimate
115
- shouldCompact, // shouldCompact({ estimated, contextWindow, buffer }) → boolean (pre-call gate)
116
- compactTranscript, // compactTranscript(messages, { keepRecent, summarize }) → CompressibleMessage[]
117
- buildCheckpoint, // buildCheckpoint(label?) → a checkpoint system turn
118
- filterFromLatestCheckpoint,// filterFromLatestCheckpoint(messages) → turns after the latest checkpoint
119
- CHECKPOINT_MARKER, // sentinel prefix for checkpoint turns
120
- isContextOverflowError, // isContextOverflowError(err) → boolean (typed context_too_long, not regex)
121
- } from "@theokit/sdk/compaction";
122
-
123
- if (shouldCompact({ estimated: estimateTokens(joined), contextWindow: 200_000, buffer: 20_000 })) {
124
- messages = await compactTranscript(messages, { keepRecent: 6, summarize });
125
- }
126
- ```
127
-
128
- ## SDKMessage readers — `@theokit/sdk/messages`
129
-
130
- ```typescript
131
- import { assistantText, extractToolUses, costAmountUsd } from "@theokit/sdk/messages";
132
- // assistantText(msg) → string|undefined; extractToolUses(msg) → tool calls; costAmountUsd(msg) → number|undefined (never 0 when unknown)
133
- for await (const msg of run.stream()) { const text = assistantText(msg); if (text) ui.append(text); }
134
- ```
135
-
136
- ## Model catalog — `@theokit/sdk/models`
137
-
138
- ```typescript
139
- import { resolveModelCapabilities, parseModelId, humanizeModelName, toModelOption } from "@theokit/sdk/models";
140
- // resolveModelCapabilities(modelId) → { contextWindow, ... } | undefined (sync, offline)
141
- const caps = resolveModelCapabilities("anthropic/claude-3-5-sonnet");
142
- const label = humanizeModelName("openai/gpt-4o"); // → "GPT-4o"
143
- ```
144
-
145
- ## Skills discovery — `@theokit/sdk/skills`
146
-
147
- ```typescript
148
- import { discoverSkills, buildSkillsBlock } from "@theokit/sdk/skills";
149
- // discoverSkills(dir) → Skill[] from an arbitrary directory convention; buildSkillsBlock(skills) → <skills> prompt block
150
- const block = buildSkillsBlock(await discoverSkills(".theo/skills"));
151
- ```
152
-
153
- ## Project instructions — `@theokit/sdk/project`
154
-
155
- ```typescript
156
- import { readProjectInstructions, writeProjectInstructions } from "@theokit/sdk/project";
157
- // readProjectInstructions(cwd, { filename, scope, maxBytes }) → string (git-root-walk); writeProjectInstructions(...) atomic + path-guarded
158
- const instructions = readProjectInstructions(process.cwd(), { filename: "THEO.md" });
159
- ```
160
-
161
- ## Subagent tool scoping — `@theokit/sdk/subagents`
162
-
163
- ```typescript
164
- import { withSubagentToolScope, subagentToolWhitelist } from "@theokit/sdk/subagents";
165
- // restrict a subagent to a tool whitelist (enforced, not prompt-soft)
166
- const scoped = withSubagentToolScope(agentDef, ["read_file", "search_text"]);
167
- ```
168
-
169
- ## Path safety — `@theokit/sdk/path-safety`
170
-
171
- ```typescript
172
- import { safePathJoin, sanitizeIdentifier, safeFilenameForId, assertNoSymlinkEscape, isForbiddenPath } from "@theokit/sdk/path-safety";
173
- // safeFilenameForId(id, { maxLen }) → deterministic safe filename for any opaque id; safePathJoin(root, ...parts) → path that cannot escape root
174
- const file = safePathJoin(root, safeFilenameForId(sessionId) + ".md");
175
- ```
176
-
177
- ## Persistence — `@theokit/sdk/persistence`
178
-
179
- ```typescript
180
- import {
181
- appendJsonl, // appendJsonl(path, record) → append one \n-terminated JSON line (mkdirs parent; crash-safe per-line flush)
182
- readJsonlIds, // readJsonlIds(path, keyFn) → Set<string> of done keys (tolerates a trailing partial line) — resume
183
- loadJsonl, // loadJsonl(path, { map? }) → rows (throws JsonlParseError with line number); also at @theokit/sdk/eval
184
- replaceFileAtomic, // replaceFileAtomic(path, content) → Promise<void> (temp + fsync + 0o600 + rename; never torn)
185
- atomicWriteText, atomicWriteJson,
186
- withFileLock, // withFileLock(path, fn) → run an async critical section under a cross-process lock
187
- openSqliteResilient, applyWalWithFallback, isCorruptionError, // resilient SQLite bootstrap
188
- } from "@theokit/sdk/persistence";
189
-
190
- // Durable, resumable batch run:
191
- appendJsonl("out/preds.jsonl", { id, patch });
192
- const done = readJsonlIds("out/preds.jsonl", (r) => (r.patch ? String(r.id) : undefined));
193
- ```
194
-
195
- ## Eval & sandbox — `@theokit/sdk/eval`, `@theokit/sdk/sandbox`
196
-
197
- ```typescript
198
- import { Eval, Scorers, assertEval, EvalThresholdError, loadJsonl, captureArtifact } from "@theokit/sdk/eval";
199
- import { LocalSandbox, provisionRepo, RepoProvisionError } from "@theokit/sdk/sandbox";
200
- // Scorers: exactMatch, containsExpected, regex, jsonShape(zod), llmJudge, verifyGate,
201
- // levenshtein({ threshold?, caseSensitive? }), numericDiff({ tolerance? }),
202
- // embeddingSimilarity({ apiKey?, model?, threshold?, embed? }) ← SE41
203
- const ev = Eval.create({ name: "qa", dataset, scorers: [Scorers.levenshtein({ threshold: 0.8 })], agent, trials: 3 });
204
- const run = await ev.run();
205
- // CI gate (SE41): throws EvalThresholdError with every unmet threshold, else void.
206
- assertEval(run, { minMeanScore: 0.8, minPassRatio: 0.9, maxErrorRatio: 0, perScorer: { "levenshtein(>=0.8)": 0.7 } });
207
- ```
208
-
209
- ## Workflow, task store, cron, subscription, A2A, client
210
-
211
- ```typescript
212
- import { Workflow, WorkflowBuilder, agentStep, fn } from "@theokit/sdk/workflow"; // typed multi-step workflows
213
- import { InMemoryTaskStore, JsonFileTaskStore, getTaskStoreFor } from "@theokit/sdk/task-store"; // durable task persistence
214
- import { Cron } from "@theokit/sdk/cron"; // Cron.create(...) scheduled agent runs
215
- import { Subscription, subscribe, tracked } from "@theokit/sdk/subscription"; // Subscription.create(...) streaming + resume tokens (SE36)
216
- import { AgentMailbox, MessageBus, SubAgent } from "@theokit/sdk/a2a"; // SubAgent.create(...) agent-to-agent messaging (SE36)
217
- import { TheoKitClient } from "@theokit/sdk/client"; // typed client for the cloud runtime
218
- ```
219
-
220
- ## Server-side (cloud runtime) — `@theokit/sdk/server/*`
221
-
222
- For building the server that backs the cloud runtime (OAuth callbacks + a canonical error envelope across HTTP surfaces).
223
-
224
- ```typescript
225
- import { Auth, validateReturnTo } from "@theokit/sdk/server/auth";
226
- // Auth.create({ providers, ... }) → auth handler (SE36); validateReturnTo(url, allowlist) → safe redirect target
227
- // + typed errors: AuthCallbackError, AuthCancelledError, AuthConfigError, AuthProviderNotFoundError, AuthSecretTooShortError
228
-
229
- import { toEnvelope, fromEnvelope } from "@theokit/sdk/server/errors-envelope";
230
- // toEnvelope(err) → a canonical wire error envelope; fromEnvelope(envelope) → a typed error (cross-surface error contract)
231
- ```
232
-
233
- ---
234
-
235
- ## Code-assistant toolbox — `@theokit/sdk-tools`
236
-
237
- ```typescript
238
- import {
239
- // File / shell / search tools (factories returning CustomTool):
240
- createReadFileTool, createWriteFileTool, createEditFileTool, createApplyPatchTool,
241
- createListDirTool, createGlobTool, createSearchTextTool, createGitDiffTool,
242
- createShellTool, createRunVitestTool, createTodolistTool, createPlanModeTool, createQuestionTool,
243
- // Web fetch + search (SSRF-guarded):
244
- createWebFetchTool, createWebSearchTool, createBraveWebSearchAdapter,
245
- // SSRF guard primitives:
246
- isBlockedIp, // isBlockedIp(ip) → boolean (private/loopback/link-local/metadata)
247
- resolveAndScreen, // resolveAndScreen(host) → screened addresses (throws SsrfBlockedError)
248
- screenedFetch, // screenedFetch(url, opts) → Response (redirect:'manual' + re-screen each hop)
249
- // Catastrophic shell screen:
250
- catastrophicShellReason, // catastrophicShellReason(cmd) → reason | null (rm -rf /, curl|sh, force-push, exfil, ...)
251
- denyCatastrophicCommands, commandDenialReason, isCommandAllowed,
252
- // Context builders:
253
- buildRepoMap, // buildRepoMap(cwd, { budget, ignore }) → directory map string (orient the LLM in one call)
254
- buildEnvContext, // buildEnvContext(cwd) → env/git orientation block
255
- // ACI / tool-result ergonomics:
256
- withDescription, renderToolList, withToolResultGuidance, injectGuidance, withDefaultGuidance,
257
- todoItemsToPlanNodes, // todoItemsToPlanNodes(items) → PlanNode[]
258
- createSessionArtifactStore, // durable plan/artifact persistence
259
- // Output formatting + truncation:
260
- formatDiff, formatCode, formatError, formatFileList, truncateOutput,
261
- } from "@theokit/sdk-tools";
262
-
263
- const map = buildRepoMap(process.cwd(), { budget: 4000 }); // codebase orientation in one call
264
- const reason = catastrophicShellReason("rm -rf /"); // → a non-null deny reason
265
- ```
266
-
267
- ---
268
-
269
- ## Out-of-repo capabilities
270
-
271
- These GAP_AUDIT primitives target packages that live in **sibling repos**, not in `theokit-sdk`. Look for them there:
272
-
273
- | Capability | Target package | Where |
274
- |---|---|---|
275
- | `AgentToolRenderer`, `ToolCallCard`, `AgentStream`, `useStickToBottom`, tool-result→props adapters, `TokenUsageChart` | `@theokit/ui` | `theokit-tools/theo-ui/` (React presentation library) |
276
- | `liveText`/`error` on the stream hook, `foldAgentToolCards`/`useAgentToolCards` | `theokit/client` | `theokit-tools/theokit/` (the `theokit` framework, `theokit/client` subpath) |
277
- | `defineHealthRoute`/`defineReadyRoute`, 404 typed exceptions in `defineRoute`, programmatic boot (`theokit/boot`) | `theokit` (packages/theo) | `theokit-tools/theokit/` |
278
- | `createRepository(db, table)` (sync-aware Drizzle CRUD) | `@theokit/orm` | separate package (not yet installed by default) |
279
- | `createCategorizedMemory({ categories })` (typed markdown memory) | `@theokit/sdk-memory` | `packages/sdk-memory/` |
280
- | Honest-null cost aggregation | `@theokit/sdk-budget` | `packages/sdk-budget/` |
281
- | `catastrophicShellReason` + `denyCatastrophicCommands` composition in the permission path | `@theokit/agents` | sibling repo (the mechanism is public in `@theokit/sdk-tools`) |
282
-
283
- ---
284
-
285
- ## Behavior wired, but not a standalone export
286
-
287
- A few GAP_AUDIT items are runtime behaviors the harness performs internally — there is no single exported symbol to import. The relevant public pieces are linked:
288
-
289
- - **Enforced iteration cap.** The cap is enforced by `createCounterBudgetTracker({ maxIterations })` (above) + `RunResult.stoppedAtIterationLimit`; there is no separate `nextIteration` export to call.
290
- - **Continuation over the internal step cap.** Local agents ship the public `agent.runToCompletion()` driver: when a `send` stops at the loop's iteration cap (`RunResult.stoppedAtIterationLimit`) it re-sends a short continuation prompt until a genuine terminal — the agent's native session transcript preserves the conversation across rounds (no manual history rebuild). (The v3 `buildReplayHistory` primitive was removed in v4.0.)
291
- - **Bounded reflection ladder.** This is a consumer-side policy; the harness exposes the stream/hook surface but not a packaged reflection ladder.
292
-
293
- ---
294
-
295
- ## See also
296
-
297
- - The exported TypeScript types — the canonical, exhaustive public API contract.
298
- - [Error codes](./error-codes.md) — the `AgentRunError.code` table and provider mapping.
299
- - [`packages/sdk/README.md`](https://github.com/usetheodev/theokit-sdk/blob/main/packages/sdk/README.md) — `@theokit/sdk` front door.
300
- - [`packages/sdk-tools/README.md`](https://github.com/usetheodev/theokit-sdk/blob/main/packages/sdk-tools/README.md) — `@theokit/sdk-tools` front door.
301
-
302
- In the wiki: [import map](https://github.com/usetheodev/theokit-sdk/blob/main/wiki/sdk/import-map.md) groups these same entries by task,
303
- [run signals](https://github.com/usetheodev/theokit-sdk/blob/main/wiki/sdk/run-signals.md) covers what a run reports back, and
304
- [failure taxonomy](https://github.com/usetheodev/theokit-sdk/blob/main/wiki/sdk/failure-taxonomy.md) says which of the codes above are worth a retry.