@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,36 +1,36 @@
1
1
  'use strict';
2
2
 
3
- var chunk2QMK627M_cjs = require('./chunk-2QMK627M.cjs');
4
- var chunk3YYDHUNH_cjs = require('./chunk-3YYDHUNH.cjs');
3
+ var chunk2D43RD5D_cjs = require('./chunk-2D43RD5D.cjs');
4
+ var chunk665SFFFR_cjs = require('./chunk-665SFFFR.cjs');
5
5
  var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
6
- var chunk6DCTL32L_cjs = require('./chunk-6DCTL32L.cjs');
7
- var chunkT5ZWI3MC_cjs = require('./chunk-T5ZWI3MC.cjs');
8
- var chunkDM6Y5B2G_cjs = require('./chunk-DM6Y5B2G.cjs');
9
- var chunkEQMLJ52C_cjs = require('./chunk-EQMLJ52C.cjs');
10
- var chunkBBZYXVLZ_cjs = require('./chunk-BBZYXVLZ.cjs');
6
+ var chunkXPR366DL_cjs = require('./chunk-XPR366DL.cjs');
7
+ var chunkOUOXM36O_cjs = require('./chunk-OUOXM36O.cjs');
8
+ var chunk2FYEVT2B_cjs = require('./chunk-2FYEVT2B.cjs');
9
+ var chunkBDTVFIPB_cjs = require('./chunk-BDTVFIPB.cjs');
10
+ var chunk2ZPEDVLM_cjs = require('./chunk-2ZPEDVLM.cjs');
11
11
  var chunkOKLYRPKL_cjs = require('./chunk-OKLYRPKL.cjs');
12
- var chunkCZHPR2G7_cjs = require('./chunk-CZHPR2G7.cjs');
13
- var chunkADVZIC43_cjs = require('./chunk-ADVZIC43.cjs');
12
+ var chunkHAWE74GQ_cjs = require('./chunk-HAWE74GQ.cjs');
13
+ var chunkRAHSWE5C_cjs = require('./chunk-RAHSWE5C.cjs');
14
14
  var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
15
15
  var chunkB4YA6BRS_cjs = require('./chunk-B4YA6BRS.cjs');
16
16
  var chunkNINIJCHU_cjs = require('./chunk-NINIJCHU.cjs');
17
17
  var chunkVJ26EKGJ_cjs = require('./chunk-VJ26EKGJ.cjs');
18
- var chunkKNZU4YO5_cjs = require('./chunk-KNZU4YO5.cjs');
19
- var chunkECPL5RV6_cjs = require('./chunk-ECPL5RV6.cjs');
20
- var chunkTR4V2LHV_cjs = require('./chunk-TR4V2LHV.cjs');
18
+ var chunkWQ53UQL4_cjs = require('./chunk-WQ53UQL4.cjs');
19
+ var chunkY4AXQOT4_cjs = require('./chunk-Y4AXQOT4.cjs');
20
+ var chunkTTJ54H3E_cjs = require('./chunk-TTJ54H3E.cjs');
21
21
  var chunkYLQQX5W2_cjs = require('./chunk-YLQQX5W2.cjs');
22
22
  var chunkWJVHMTKB_cjs = require('./chunk-WJVHMTKB.cjs');
23
- var chunk2CFEET3Y_cjs = require('./chunk-2CFEET3Y.cjs');
24
- var chunkRTLUZKDL_cjs = require('./chunk-RTLUZKDL.cjs');
25
- var chunkAMYY3JHQ_cjs = require('./chunk-AMYY3JHQ.cjs');
23
+ var chunkC4H6PB5J_cjs = require('./chunk-C4H6PB5J.cjs');
24
+ var chunkE7FJOO4G_cjs = require('./chunk-E7FJOO4G.cjs');
25
+ var chunkADLLFY3H_cjs = require('./chunk-ADLLFY3H.cjs');
26
26
  var chunkVYHJZVL5_cjs = require('./chunk-VYHJZVL5.cjs');
27
- var chunkBC5EUG7R_cjs = require('./chunk-BC5EUG7R.cjs');
28
- var chunkFUASIT3E_cjs = require('./chunk-FUASIT3E.cjs');
29
- var chunkYTO5BRBD_cjs = require('./chunk-YTO5BRBD.cjs');
27
+ var chunkVUKQL3L2_cjs = require('./chunk-VUKQL3L2.cjs');
28
+ var chunkZN2DGEY3_cjs = require('./chunk-ZN2DGEY3.cjs');
29
+ var chunkZT57WTUJ_cjs = require('./chunk-ZT57WTUJ.cjs');
30
30
  var chunkVKJ7V7EB_cjs = require('./chunk-VKJ7V7EB.cjs');
31
- var chunk44IISBRZ_cjs = require('./chunk-44IISBRZ.cjs');
32
- var chunk2YGIBOUH_cjs = require('./chunk-2YGIBOUH.cjs');
33
- var chunkSXSPMRSV_cjs = require('./chunk-SXSPMRSV.cjs');
31
+ var chunkSZHU7A5B_cjs = require('./chunk-SZHU7A5B.cjs');
32
+ var chunkLPVIRJVF_cjs = require('./chunk-LPVIRJVF.cjs');
33
+ var chunkBM6N4KHO_cjs = require('./chunk-BM6N4KHO.cjs');
34
34
  var promises = require('fs/promises');
35
35
  var crypto = require('crypto');
36
36
  var path = require('path');
@@ -226,7 +226,7 @@ async function agentGenerate(agent, agentModel, agentApiKey, agentLocal, input,
226
226
  const { output, maxRetries, errorStrategy, ...sendOptions } = options;
227
227
  const run = await agent.send(input, sendOptions);
228
228
  const result = await run.wait();
229
- const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-E465DX5I.cjs');
229
+ const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-AVXOJK2I.cjs');
230
230
  const answer = structurableAnswerOrThrow(result, GenerateObjectError);
231
231
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
232
232
  const facade = getAgentFacade();
@@ -280,19 +280,6 @@ function structurableAnswerOrThrow(result, GenerateObjectError) {
280
280
  }
281
281
  return answer;
282
282
  }
283
-
284
- // src/internal/env.ts
285
- var API_KEY_ENV_VAR = "THEOKIT_API_KEY";
286
- function resolveApiKey(explicit) {
287
- if (explicit !== void 0 && explicit.length > 0) {
288
- return explicit;
289
- }
290
- const fromEnv = process.env[API_KEY_ENV_VAR];
291
- if (fromEnv !== void 0 && fromEnv.length > 0) {
292
- return fromEnv;
293
- }
294
- return void 0;
295
- }
296
283
  var PREFIX = {
297
284
  localAgent: "agent-",
298
285
  cloudAgent: "bc-",
@@ -328,7 +315,7 @@ function normalizeModel(m) {
328
315
  if (m === void 0 || typeof m !== "string") return m;
329
316
  const id = m.trim();
330
317
  if (id.length === 0) {
331
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
318
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
332
319
  'model must be a non-empty "provider/model" id string or a ModelSelection object',
333
320
  { code: "invalid_model_selection" }
334
321
  );
@@ -464,7 +451,7 @@ function registryPath(cwd) {
464
451
  return path.join(cwd, REGISTRY_RELATIVE_PATH);
465
452
  }
466
453
  async function loadRegistry(cwd) {
467
- return chunkCZHPR2G7_cjs.readVersionedJson({
454
+ return chunkHAWE74GQ_cjs.readVersionedJson({
468
455
  path: registryPath(cwd),
469
456
  currentVersion: SCHEMA_VERSION,
470
457
  defaultValue: () => ({}),
@@ -488,7 +475,7 @@ async function saveRegistry(cwd, agents2) {
488
475
  }
489
476
  const path = registryPath(cwd);
490
477
  await chunkYLQQX5W2_cjs.withCwdMutex(`registry:${cwd}`, async () => {
491
- await chunkCZHPR2G7_cjs.writeVersionedJson(path, serialized, SCHEMA_VERSION);
478
+ await chunkHAWE74GQ_cjs.writeVersionedJson(path, serialized, SCHEMA_VERSION);
492
479
  });
493
480
  }
494
481
  function toSerialized(agent) {
@@ -555,7 +542,7 @@ function scheduleSaveForCwd(cwd) {
555
542
  }
556
543
  } catch (cause) {
557
544
  const msg = cause instanceof Error ? cause.message : String(cause);
558
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] registry persist failed (${cwd}): ${msg}
545
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] registry persist failed (${cwd}): ${msg}
559
546
  `);
560
547
  } finally {
561
548
  pendingSaves.delete(cwd);
@@ -894,14 +881,14 @@ async function readLegacyFacts(jsonPath) {
894
881
  }
895
882
  async function writeMigratedFacts(cwd, jsonPath, facts) {
896
883
  try {
897
- for (const fact of facts) await chunkEQMLJ52C_cjs.appendFactToMarkdown(cwd, fact);
884
+ for (const fact of facts) await chunkBDTVFIPB_cjs.appendFactToMarkdown(cwd, fact);
898
885
  await promises.unlink(jsonPath).catch(() => void 0);
899
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
886
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
900
887
  `);
901
888
  return { migrated: true, factCount: facts.length };
902
889
  } catch (cause) {
903
890
  const message = cause instanceof Error ? cause.message : String(cause);
904
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] memory migration failed (readonly fs?): ${message}
891
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] memory migration failed (readonly fs?): ${message}
905
892
  `);
906
893
  return { migrated: false, factCount: 0, reason: "readonly-fs" };
907
894
  }
@@ -911,12 +898,12 @@ async function migrateLegacyJson(cwd, config) {
911
898
  const key = `${cwd}::${config.namespace ?? "default"}::${config.scope ?? "agent"}::${config.userId ?? "default"}`;
912
899
  if (migrationRun.has(key)) return { migrated: false, factCount: 0, reason: "already-migrated" };
913
900
  migrationRun.add(key);
914
- const jsonPath = chunkEQMLJ52C_cjs.legacyMemoryJsonPath(cwd, config);
901
+ const jsonPath = chunkBDTVFIPB_cjs.legacyMemoryJsonPath(cwd, config);
915
902
  if (!await fileExists(jsonPath)) {
916
903
  return { migrated: false, factCount: 0, reason: "no-legacy-json" };
917
904
  }
918
- if (await fileExists(chunkEQMLJ52C_cjs.memoryMdPath(cwd))) {
919
- chunkSXSPMRSV_cjs.diag(
905
+ if (await fileExists(chunkBDTVFIPB_cjs.memoryMdPath(cwd))) {
906
+ chunkBM6N4KHO_cjs.diag(
920
907
  `[theokit-sdk] memory migration skipped: both MEMORY.md and legacy JSON exist at ${jsonPath}; leaving both intact
921
908
  `
922
909
  );
@@ -940,13 +927,13 @@ function extractMemoryFact(message) {
940
927
  async function readMemoryFacts(cwd, config) {
941
928
  if (!config.enabled) return [];
942
929
  await migrateLegacyJson(cwd, config);
943
- return chunkEQMLJ52C_cjs.readFacts(cwd, config);
930
+ return chunkBDTVFIPB_cjs.readFacts(cwd, config);
944
931
  }
945
932
  async function appendMemoryFact(cwd, config, fact) {
946
933
  if (!config.enabled) return;
947
934
  await migrateLegacyJson(cwd, config);
948
- const sanitized = { text: chunkSXSPMRSV_cjs.redactSecrets(fact.text) };
949
- await chunkEQMLJ52C_cjs.appendFact(cwd, config, sanitized);
935
+ const sanitized = { text: chunkBM6N4KHO_cjs.redactSecrets(fact.text) };
936
+ await chunkBDTVFIPB_cjs.appendFact(cwd, config, sanitized);
950
937
  }
951
938
 
952
939
  // src/internal/runtime/fixtures/fixture-scripts.ts
@@ -1294,7 +1281,7 @@ function redactScriptSecrets(script) {
1294
1281
  function redactEventSecrets(event) {
1295
1282
  const serialized = JSON.stringify(event);
1296
1283
  const localStripped = serialized.replace(FIXTURE_SENTINEL, "***");
1297
- const redacted = chunkSXSPMRSV_cjs.redactSecrets(localStripped);
1284
+ const redacted = chunkBM6N4KHO_cjs.redactSecrets(localStripped);
1298
1285
  if (redacted === serialized) return event;
1299
1286
  return JSON.parse(redacted);
1300
1287
  }
@@ -1616,8 +1603,8 @@ function createRealCloudRun(options) {
1616
1603
  cancellable: false,
1617
1604
  conversation: []
1618
1605
  };
1619
- const apiKey = resolveApiKey(options.agentOptions.apiKey);
1620
- const baseUrl = chunkDM6Y5B2G_cjs.getConfiguredBaseUrl();
1606
+ const apiKey = chunkBM6N4KHO_cjs.resolveApiKey(options.agentOptions.apiKey);
1607
+ const baseUrl = chunk2FYEVT2B_cjs.getConfiguredBaseUrl();
1621
1608
  const handle = new RealCloudRun(
1622
1609
  {
1623
1610
  id,
@@ -1690,7 +1677,7 @@ var RealCloudRun = class extends FixtureRunBase {
1690
1677
  });
1691
1678
  if (!response.ok) {
1692
1679
  const text = await response.text().catch(() => "");
1693
- throw new chunk2YGIBOUH_cjs.NetworkError(
1680
+ throw new chunkLPVIRJVF_cjs.NetworkError(
1694
1681
  `Cloud Run endpoint returned ${response.status}: ${text.slice(0, 200)}`,
1695
1682
  { code: "cloud_run_http_error" }
1696
1683
  );
@@ -1700,7 +1687,7 @@ var RealCloudRun = class extends FixtureRunBase {
1700
1687
  async consumeStream(response) {
1701
1688
  let finalStatus = "finished";
1702
1689
  let finalText = "";
1703
- for await (const record of chunkDM6Y5B2G_cjs.parseSseStream(response.body, this.controller.signal)) {
1690
+ for await (const record of chunk2FYEVT2B_cjs.parseSseStream(response.body, this.controller.signal)) {
1704
1691
  const parsed = safeParse(record.data);
1705
1692
  if (parsed === void 0) continue;
1706
1693
  const update = this.applyRecord(record.event, parsed);
@@ -1808,8 +1795,8 @@ var CloudAgent = class {
1808
1795
  * cloud operations are pre-release and must surface explicit errors.
1809
1796
  */
1810
1797
  isFixtureMode() {
1811
- const apiKey = resolveApiKey(this.options.apiKey);
1812
- return chunkDM6Y5B2G_cjs.isFixtureApiKey(apiKey) && chunkDM6Y5B2G_cjs.getConfiguredBaseUrl() === void 0;
1798
+ const apiKey = chunkBM6N4KHO_cjs.resolveApiKey(this.options.apiKey);
1799
+ return chunk2FYEVT2B_cjs.isFixtureApiKey(apiKey) && chunk2FYEVT2B_cjs.getConfiguredBaseUrl() === void 0;
1813
1800
  }
1814
1801
  // SE9 — integrated structured output; delegates to the shared helper.
1815
1802
  generate(message, options) {
@@ -1824,7 +1811,7 @@ var CloudAgent = class {
1824
1811
  }
1825
1812
  async send(message, options = {}) {
1826
1813
  if (options.tools !== void 0 && options.tools.length > 0) {
1827
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
1814
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
1828
1815
  "Custom inline tools are local-only in SDK v1.0 \u2014 cloud agents cannot serialize handler functions",
1829
1816
  { code: "cloud_custom_tools_rejected" }
1830
1817
  );
@@ -1859,8 +1846,8 @@ var CloudAgent = class {
1859
1846
  }
1860
1847
  const userText = typeof message === "string" ? message : message.text;
1861
1848
  const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
1862
- const apiKey = resolveApiKey(this.options.apiKey);
1863
- const useRealRuntime = apiKey !== void 0 && !chunkDM6Y5B2G_cjs.isFixtureApiKey(apiKey) && chunkDM6Y5B2G_cjs.getConfiguredBaseUrl() !== void 0;
1849
+ const apiKey = chunkBM6N4KHO_cjs.resolveApiKey(this.options.apiKey);
1850
+ const useRealRuntime = apiKey !== void 0 && !chunk2FYEVT2B_cjs.isFixtureApiKey(apiKey) && chunk2FYEVT2B_cjs.getConfiguredBaseUrl() !== void 0;
1864
1851
  return useRealRuntime ? createRealCloudRun({
1865
1852
  agentId: this.agentId,
1866
1853
  model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
@@ -1909,7 +1896,7 @@ var CloudAgent = class {
1909
1896
  listArtifacts() {
1910
1897
  if (!this.isFixtureMode()) {
1911
1898
  return Promise.reject(
1912
- new chunk2YGIBOUH_cjs.ConfigurationError(
1899
+ new chunkLPVIRJVF_cjs.ConfigurationError(
1913
1900
  "Cloud runtime is pre-release. listArtifacts() will return real artifacts when Theo PaaS ships; today it is only available in fixture mode (theo_test_* keys).",
1914
1901
  { code: "cloud_runtime_pre_release" }
1915
1902
  )
@@ -1919,11 +1906,11 @@ var CloudAgent = class {
1919
1906
  }
1920
1907
  downloadArtifact(path) {
1921
1908
  try {
1922
- chunkYTO5BRBD_cjs.validateArtifactPath(path);
1909
+ chunkZT57WTUJ_cjs.validateArtifactPath(path);
1923
1910
  } catch (cause) {
1924
- if (cause instanceof chunkYTO5BRBD_cjs.PathTraversalError) {
1911
+ if (cause instanceof chunkZT57WTUJ_cjs.PathTraversalError) {
1925
1912
  return Promise.reject(
1926
- new chunk2YGIBOUH_cjs.ConfigurationError(`Artifact path must stay inside the workspace: ${path}`, {
1913
+ new chunkLPVIRJVF_cjs.ConfigurationError(`Artifact path must stay inside the workspace: ${path}`, {
1927
1914
  code: "artifact_path_traversal",
1928
1915
  cause
1929
1916
  })
@@ -1933,7 +1920,7 @@ var CloudAgent = class {
1933
1920
  }
1934
1921
  if (!this.isFixtureMode()) {
1935
1922
  return Promise.reject(
1936
- new chunk2YGIBOUH_cjs.ConfigurationError(
1923
+ new chunkLPVIRJVF_cjs.ConfigurationError(
1937
1924
  "Cloud runtime is pre-release. downloadArtifact() will fetch real PaaS artifacts when the cloud runtime ships; today it is only available in fixture mode (theo_test_* keys).",
1938
1925
  { code: "cloud_runtime_pre_release" }
1939
1926
  )
@@ -1942,7 +1929,7 @@ var CloudAgent = class {
1942
1929
  const match = buildFixtureArtifacts().find((artifact) => artifact.path === path);
1943
1930
  if (match === void 0) {
1944
1931
  return Promise.reject(
1945
- new chunk2YGIBOUH_cjs.UnknownAgentError(`Artifact ${path} not found`, { code: "unknown_artifact" })
1932
+ new chunkLPVIRJVF_cjs.UnknownAgentError(`Artifact ${path} not found`, { code: "unknown_artifact" })
1946
1933
  );
1947
1934
  }
1948
1935
  return Promise.resolve(Buffer.from(`fixture artifact content for ${path}
@@ -1956,7 +1943,7 @@ var CloudAgent = class {
1956
1943
  * @public
1957
1944
  */
1958
1945
  runUntil() {
1959
- throw new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
1946
+ throw new chunkLPVIRJVF_cjs.UnsupportedRunOperationError(
1960
1947
  "Agent.runUntil() is not supported on cloud agents. Cloud runtime manages goal loops server-side. Use a local agent for autonomous Ralph loops.",
1961
1948
  "runUntil"
1962
1949
  );
@@ -1967,7 +1954,7 @@ var CloudAgent = class {
1967
1954
  * @public
1968
1955
  */
1969
1956
  fork() {
1970
- throw new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
1957
+ throw new chunkLPVIRJVF_cjs.UnsupportedRunOperationError(
1971
1958
  "Agent.fork() is not supported on cloud agents. Fork inheritance requires local credential + system-prompt access. Use a local agent.",
1972
1959
  "fork"
1973
1960
  );
@@ -1979,7 +1966,7 @@ var CloudAgent = class {
1979
1966
  * @public
1980
1967
  */
1981
1968
  runToCompletion() {
1982
- throw new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
1969
+ throw new chunkLPVIRJVF_cjs.UnsupportedRunOperationError(
1983
1970
  "Agent.runToCompletion() is not supported on cloud agents. Cloud runtime manages continuation server-side. Use a local agent.",
1984
1971
  "runToCompletion"
1985
1972
  );
@@ -1991,7 +1978,7 @@ var CloudAgent = class {
1991
1978
  * @public
1992
1979
  */
1993
1980
  streamToCompletion() {
1994
- throw new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
1981
+ throw new chunkLPVIRJVF_cjs.UnsupportedRunOperationError(
1995
1982
  "Agent.streamToCompletion() is not supported on cloud agents. Cloud runtime manages continuation server-side. Use a local agent.",
1996
1983
  "streamToCompletion"
1997
1984
  );
@@ -2005,7 +1992,7 @@ var CloudAgent = class {
2005
1992
  */
2006
1993
  usePersonality() {
2007
1994
  return Promise.reject(
2008
- new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
1995
+ new chunkLPVIRJVF_cjs.UnsupportedRunOperationError(
2009
1996
  "Agent.usePersonality() is not supported on cloud agents (pre-release). Use a local agent or wait for cloud GA.",
2010
1997
  "usePersonality"
2011
1998
  )
@@ -2033,7 +2020,7 @@ function validateCloudToolParity(options) {
2033
2020
  function rejectProcessors(options) {
2034
2021
  const hasProcessors = (options.inputProcessors?.length ?? 0) > 0 || (options.outputProcessors?.length ?? 0) > 0;
2035
2022
  if (hasProcessors) {
2036
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2023
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
2037
2024
  "Cloud agents can't run guardrail processors \u2014 a Processor carries function handlers that don't survive serialization to PaaS. Run processors on a local agent, or move the guardrail into a server-side gateway in front of TheoCloud.",
2038
2025
  { code: "cloud_incompatible_function_resolver" }
2039
2026
  );
@@ -2041,7 +2028,7 @@ function rejectProcessors(options) {
2041
2028
  }
2042
2029
  function rejectFunctionSystemPrompt(options) {
2043
2030
  if (typeof options.systemPrompt === "function") {
2044
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2031
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
2045
2032
  "Cloud agents require systemPrompt as a serializable string. SystemPromptResolver functions can't run on PaaS \u2014 resolve to a string before Agent.create() or move the dynamic logic into a hook rule.",
2046
2033
  { code: "cloud_incompatible_function_resolver" }
2047
2034
  );
@@ -2049,7 +2036,7 @@ function rejectFunctionSystemPrompt(options) {
2049
2036
  }
2050
2037
  function rejectFunctionSkills(options) {
2051
2038
  if (typeof options.skills === "function") {
2052
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2039
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
2053
2040
  "Cloud agents require skills as a static settings object. SkillsResolver functions can't run on PaaS \u2014 resolve to a SkillsSettings object before Agent.create() or move the dynamic logic into a hook rule.",
2054
2041
  { code: "cloud_incompatible_function_resolver" }
2055
2042
  );
@@ -2061,7 +2048,7 @@ function rejectStdioMcpLocalPaths(options) {
2061
2048
  if (!isStdioCommandConfig(config)) continue;
2062
2049
  const command = config.command ?? "";
2063
2050
  if (isLocalPath(command)) {
2064
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2051
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
2065
2052
  `MCP server "${name}" uses a local-FS command path (${command}). Cloud agents can't reach local binaries \u2014 use a bare command (npx, uvx, node, \u2026) that the PaaS VM image provides, or switch to an HTTP MCP server.`,
2066
2053
  { code: "cloud_incompatible_mcp_stdio_local" }
2067
2054
  );
@@ -2076,6 +2063,25 @@ function isStdioCommandConfig(config) {
2076
2063
  function isLocalPath(command) {
2077
2064
  return command.startsWith("/") || command.startsWith("~/") || command.startsWith("./") || command.startsWith("../");
2078
2065
  }
2066
+
2067
+ // src/internal/persistence/session-dir.ts
2068
+ function resolveSessionDir(local) {
2069
+ if (local?.sessionDir !== void 0) {
2070
+ if (local.baseDir !== void 0) {
2071
+ chunkBM6N4KHO_cjs.diag(
2072
+ "[theokit-sdk] local.sessionDir and local.baseDir are both set; using sessionDir. baseDir is the deprecated name for the same option (#301)."
2073
+ );
2074
+ }
2075
+ return chunkY4AXQOT4_cjs.expandTilde(local.sessionDir);
2076
+ }
2077
+ if (local?.baseDir !== void 0) {
2078
+ chunkBM6N4KHO_cjs.diag(
2079
+ "[theokit-sdk] local.baseDir is deprecated; rename it to local.sessionDir (#301). It is the directory for session transcripts, not the working directory \u2014 that is local.cwd."
2080
+ );
2081
+ return chunkY4AXQOT4_cjs.expandTilde(local.baseDir);
2082
+ }
2083
+ return chunkY4AXQOT4_cjs.defaultBaseDir();
2084
+ }
2079
2085
  var SCHEMA_VERSION2 = 1;
2080
2086
  var FILE_NAME = "personality.json";
2081
2087
  function emptyState() {
@@ -2101,14 +2107,14 @@ async function readState(filePath) {
2101
2107
  try {
2102
2108
  parsed = JSON.parse(raw);
2103
2109
  } catch {
2104
- chunk3YYDHUNH_cjs.warnOnce(
2110
+ chunk665SFFFR_cjs.warnOnce(
2105
2111
  "personality-store-json-parse",
2106
2112
  "[theokit-sdk] personality.json is malformed; treating as empty"
2107
2113
  );
2108
2114
  return emptyState();
2109
2115
  }
2110
2116
  if (!isStateV1(parsed)) {
2111
- chunk3YYDHUNH_cjs.warnOnce(
2117
+ chunk665SFFFR_cjs.warnOnce(
2112
2118
  "personality-store-bad-version",
2113
2119
  `[theokit-sdk] personality.json has unknown version; treating as empty (file kept untouched)`
2114
2120
  );
@@ -2139,9 +2145,9 @@ var PersonalityStore = class {
2139
2145
  try {
2140
2146
  await this.#persist(agentId, slug);
2141
2147
  } catch (err) {
2142
- chunk3YYDHUNH_cjs.warnOnce(
2148
+ chunk665SFFFR_cjs.warnOnce(
2143
2149
  `personality-store-persist-failure-${agentId}`,
2144
- `[theokit-sdk] personality persist failed for ${chunkSXSPMRSV_cjs.redactSecrets(agentId)}: ${chunkSXSPMRSV_cjs.redactSecrets(
2150
+ `[theokit-sdk] personality persist failed for ${chunkBM6N4KHO_cjs.redactSecrets(agentId)}: ${chunkBM6N4KHO_cjs.redactSecrets(
2145
2151
  err.message
2146
2152
  )}`
2147
2153
  );
@@ -2156,9 +2162,9 @@ var PersonalityStore = class {
2156
2162
  try {
2157
2163
  state = await readState(filePath);
2158
2164
  } catch (err) {
2159
- chunk3YYDHUNH_cjs.warnOnce(
2165
+ chunk665SFFFR_cjs.warnOnce(
2160
2166
  `personality-store-hydrate-failure-${agentId}`,
2161
- `[theokit-sdk] personality hydrate failed for ${chunkSXSPMRSV_cjs.redactSecrets(agentId)}: ${chunkSXSPMRSV_cjs.redactSecrets(
2167
+ `[theokit-sdk] personality hydrate failed for ${chunkBM6N4KHO_cjs.redactSecrets(agentId)}: ${chunkBM6N4KHO_cjs.redactSecrets(
2162
2168
  err.message
2163
2169
  )}`
2164
2170
  );
@@ -2175,17 +2181,17 @@ var PersonalityStore = class {
2175
2181
  async #persist(agentId, slug) {
2176
2182
  const filePath = this.#filePath();
2177
2183
  await promises.mkdir(path.dirname(filePath), { recursive: true });
2178
- await chunkTR4V2LHV_cjs.withFileLock(filePath, async () => {
2184
+ await chunkTTJ54H3E_cjs.withFileLock(filePath, async () => {
2179
2185
  const current = await readState(filePath);
2180
2186
  const nextAgents = { ...current.agents };
2181
2187
  if (slug === void 0) delete nextAgents[agentId];
2182
2188
  else nextAgents[agentId] = slug;
2183
2189
  const next = { version: SCHEMA_VERSION2, agents: nextAgents };
2184
- await chunk2CFEET3Y_cjs.atomicWriteJson(filePath, next);
2190
+ await chunkC4H6PB5J_cjs.atomicWriteJson(filePath, next);
2185
2191
  });
2186
2192
  }
2187
2193
  #filePath() {
2188
- return path.join(chunkCZHPR2G7_cjs.getTheokitHome(this.#cwd), FILE_NAME);
2194
+ return path.join(chunkHAWE74GQ_cjs.getTheokitHome(this.#cwd), FILE_NAME);
2189
2195
  }
2190
2196
  };
2191
2197
 
@@ -2208,7 +2214,7 @@ function createPluginContext() {
2208
2214
  },
2209
2215
  on(hook, handler) {
2210
2216
  if (typeof handler !== "function") {
2211
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] ignoring non-function handler for hook "${hook}"
2217
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] ignoring non-function handler for hook "${hook}"
2212
2218
  `);
2213
2219
  return;
2214
2220
  }
@@ -2261,7 +2267,7 @@ var PluginManager = class {
2261
2267
  const seen = /* @__PURE__ */ new Set();
2262
2268
  for (const plugin of plugins) {
2263
2269
  if (seen.has(plugin.name)) {
2264
- chunkSXSPMRSV_cjs.diag(
2270
+ chunkBM6N4KHO_cjs.diag(
2265
2271
  `[theokit-sdk] duplicate plugin name "${plugin.name}" \u2014 both will register independently
2266
2272
  `
2267
2273
  );
@@ -2288,7 +2294,7 @@ var PluginManager = class {
2288
2294
  */
2289
2295
  async register(plugin) {
2290
2296
  if (plugin.kind !== "general") {
2291
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2297
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
2292
2298
  `late register supports general plugins only (got "${plugin.kind}" for "${plugin.name}")`,
2293
2299
  { code: "plugin_late_register_kind" }
2294
2300
  );
@@ -2345,7 +2351,7 @@ var PluginManager = class {
2345
2351
  parts.push(result.recalledContext);
2346
2352
  }
2347
2353
  } catch (err) {
2348
- chunkSXSPMRSV_cjs.diag(
2354
+ chunkBM6N4KHO_cjs.diag(
2349
2355
  `[theokit-sdk] pre_user_send hook failed: ${err instanceof Error ? err.message : String(err)}
2350
2356
  `
2351
2357
  );
@@ -2373,7 +2379,7 @@ var PluginManager = class {
2373
2379
  try {
2374
2380
  await h(ctx);
2375
2381
  } catch (err) {
2376
- chunkSXSPMRSV_cjs.diag(
2382
+ chunkBM6N4KHO_cjs.diag(
2377
2383
  `[theokit-sdk] post_assistant_reply hook failed: ${err instanceof Error ? err.message : String(err)}
2378
2384
  `
2379
2385
  );
@@ -2389,7 +2395,7 @@ var PluginManager = class {
2389
2395
  try {
2390
2396
  await h(ctx);
2391
2397
  } catch (err) {
2392
- chunkSXSPMRSV_cjs.diag(
2398
+ chunkBM6N4KHO_cjs.diag(
2393
2399
  `[theokit-sdk] ${name} hook failed: ${err instanceof Error ? err.message : String(err)}
2394
2400
  `
2395
2401
  );
@@ -2404,7 +2410,7 @@ var PluginManager = class {
2404
2410
  const out = await h(current, ctx);
2405
2411
  if (out !== void 0) current = out;
2406
2412
  } catch (err) {
2407
- chunkSXSPMRSV_cjs.diag(
2413
+ chunkBM6N4KHO_cjs.diag(
2408
2414
  `[theokit-sdk] ${name} hook failed: ${err instanceof Error ? err.message : String(err)}
2409
2415
  `
2410
2416
  );
@@ -2494,7 +2500,7 @@ function spawnAndCollect(options) {
2494
2500
  const spawnOptions = {
2495
2501
  cwd: options.cwd,
2496
2502
  // #54 — scrub secret-like parent env by default; `options.env` still wins.
2497
- env: chunkBBZYXVLZ_cjs.resolveChildEnv({ policy: options.envPolicy, overrides: options.env })
2503
+ env: chunk2ZPEDVLM_cjs.resolveChildEnv({ policy: options.envPolicy, overrides: options.env })
2498
2504
  };
2499
2505
  const child = child_process.spawn(options.command, options.args ?? [], spawnOptions);
2500
2506
  let stdout = "";
@@ -2546,7 +2552,7 @@ var HooksExecutor = class {
2546
2552
  this.config = {};
2547
2553
  return;
2548
2554
  }
2549
- this.config = await chunk3YYDHUNH_cjs.loadHookConfig(this.cwd);
2555
+ this.config = await chunk665SFFFR_cjs.loadHookConfig(this.cwd);
2550
2556
  }
2551
2557
  /** Fire every hook registered for `event` and aggregate the decisions. */
2552
2558
  async run(payload) {
@@ -2652,11 +2658,11 @@ function buildContextBudgetEvent(model, resolved) {
2652
2658
  // src/internal/runtime/lifecycle/post-run-lifecycle.ts
2653
2659
  function resolveWindowForRun(model, contextWindow) {
2654
2660
  const override = contextWindow !== void 0 && contextWindow > 0 ? contextWindow : void 0;
2655
- return chunkAMYY3JHQ_cjs.resolveEffectiveContextWindow({
2661
+ return chunkADLLFY3H_cjs.resolveEffectiveContextWindow({
2656
2662
  ...override !== void 0 ? { override } : {},
2657
- catalog: chunkBC5EUG7R_cjs.getCatalogModelInfo(model)?.limit?.context,
2658
- margin: chunkAMYY3JHQ_cjs.CONTEXT_WINDOW_MARGIN,
2659
- floor: chunkAMYY3JHQ_cjs.CONTEXT_WINDOW_FLOOR
2663
+ catalog: chunkVUKQL3L2_cjs.getCatalogModelInfo(model)?.limit?.context,
2664
+ margin: chunkADLLFY3H_cjs.CONTEXT_WINDOW_MARGIN,
2665
+ floor: chunkADLLFY3H_cjs.CONTEXT_WINDOW_FLOOR
2660
2666
  });
2661
2667
  }
2662
2668
  async function runPostRunLifecycle(inputs) {
@@ -2680,32 +2686,32 @@ async function runPostRunLifecycle(inputs) {
2680
2686
  try {
2681
2687
  const partial = await safeConversation(run);
2682
2688
  if (partial !== void 0) {
2683
- chunk2QMK627M_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
2689
+ chunk2D43RD5D_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
2684
2690
  userText,
2685
2691
  conversation: partial
2686
2692
  });
2687
2693
  }
2688
2694
  } catch (cause) {
2689
2695
  const msg = cause instanceof Error ? cause.message : String(cause);
2690
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
2696
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
2691
2697
  `);
2692
2698
  }
2693
- await chunk2QMK627M_cjs.flushSessionWrites();
2699
+ await chunk2D43RD5D_cjs.flushSessionWrites();
2694
2700
  return;
2695
2701
  }
2696
2702
  if (result.result !== void 0) {
2697
- chunk2QMK627M_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
2703
+ chunk2D43RD5D_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
2698
2704
  }
2699
2705
  const conversation = await safeConversation(run);
2700
2706
  const resolvedWindow = resolveWindowForRun(model, contextWindow);
2701
2707
  const effectiveWindow = resolvedWindow.window;
2702
2708
  const budgetEvent = buildContextBudgetEvent(model, resolvedWindow);
2703
2709
  if (budgetEvent !== void 0 && onRunEvent !== void 0) {
2704
- chunk6DCTL32L_cjs.emitRunEvent(onRunEvent, budgetEvent);
2710
+ chunkXPR366DL_cjs.emitRunEvent(onRunEvent, budgetEvent);
2705
2711
  }
2706
2712
  const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
2707
2713
  const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
2708
- chunk2QMK627M_cjs.persistTurnToTranscript(
2714
+ chunk2D43RD5D_cjs.persistTurnToTranscript(
2709
2715
  sessionStore,
2710
2716
  { cwd: workspaceCwd, agentId, model },
2711
2717
  agentId,
@@ -2717,13 +2723,13 @@ async function runPostRunLifecycle(inputs) {
2717
2723
  // The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
2718
2724
  // `contextWindow` here would budget against a number the clamp already rejected.
2719
2725
  contextWindow: effectiveWindow,
2720
- summarize: chunkDM6Y5B2G_cjs.buildDefaultSummarizer({
2726
+ summarize: chunk2FYEVT2B_cjs.buildDefaultSummarizer({
2721
2727
  agentModel: model,
2722
2728
  ...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
2723
2729
  })
2724
2730
  }
2725
2731
  },
2726
- onRunEvent !== void 0 ? () => chunk6DCTL32L_cjs.emitRunEvent(onRunEvent, { type: "compact_boundary", trigger: "auto" }) : void 0
2732
+ onRunEvent !== void 0 ? () => chunkXPR366DL_cjs.emitRunEvent(onRunEvent, { type: "compact_boundary", trigger: "auto" }) : void 0
2727
2733
  );
2728
2734
  if (result.status === "finished" && result.result !== void 0) {
2729
2735
  const summaryArgs = {
@@ -2739,14 +2745,14 @@ async function runPostRunLifecycle(inputs) {
2739
2745
  if (memoryProvider?.recordSessionSummary !== void 0) {
2740
2746
  await memoryProvider.recordSessionSummary(summaryArgs);
2741
2747
  } else {
2742
- await chunkEQMLJ52C_cjs.writeSessionSummary(summaryArgs);
2748
+ await chunkBDTVFIPB_cjs.writeSessionSummary(summaryArgs);
2743
2749
  }
2744
2750
  if (!shouldUsePortMemoryPath()) {
2745
2751
  void memoryGlue.syncIfReady();
2746
2752
  }
2747
2753
  } catch (cause) {
2748
2754
  const message = cause instanceof Error ? cause.message : String(cause);
2749
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] session summary write failed (${result.id}): ${message}
2755
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] session summary write failed (${result.id}): ${message}
2750
2756
  `);
2751
2757
  }
2752
2758
  }
@@ -2759,7 +2765,7 @@ async function runPostRunLifecycle(inputs) {
2759
2765
  agentId,
2760
2766
  runId: result.id
2761
2767
  });
2762
- await chunk2QMK627M_cjs.flushSessionWrites();
2768
+ await chunk2D43RD5D_cjs.flushSessionWrites();
2763
2769
  }
2764
2770
  async function safeConversation(run) {
2765
2771
  try {
@@ -2834,7 +2840,7 @@ var warned = /* @__PURE__ */ new Set();
2834
2840
  function warnDoubleReasoningOnce() {
2835
2841
  if (warned.has("double-reasoning")) return;
2836
2842
  warned.add("double-reasoning");
2837
- chunkSXSPMRSV_cjs.diag(
2843
+ chunkBM6N4KHO_cjs.diag(
2838
2844
  "[theokit-sdk] `reasoning: true` skipped \u2014 a native reasoning model is configured (model.params thinking/reasoning); native reasoning wins. Remove one to silence.\n"
2839
2845
  );
2840
2846
  }
@@ -2867,9 +2873,9 @@ var SkillsManager = class {
2867
2873
  }
2868
2874
  async refresh() {
2869
2875
  const skillsRoot = this.skillsDir ?? path.join(this.cwd, ".theokit", "skills");
2870
- const discovered = await chunkFUASIT3E_cjs.discoverSkills(skillsRoot, {
2876
+ const discovered = await chunkZN2DGEY3_cjs.discoverSkills(skillsRoot, {
2871
2877
  onInvalidSkill: (info) => {
2872
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
2878
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
2873
2879
  `);
2874
2880
  }
2875
2881
  });
@@ -2893,7 +2899,7 @@ var SkillsManager = class {
2893
2899
  async get(name) {
2894
2900
  const skill = this.skills.find((s) => s.name === name);
2895
2901
  if (skill === void 0) return void 0;
2896
- const instructions = typeof skill.instructions === "string" ? skill.instructions : chunkFUASIT3E_cjs.stripSkillFrontmatter(await promises.readFile(skill.source, "utf8"));
2902
+ const instructions = typeof skill.instructions === "string" ? skill.instructions : chunkZN2DGEY3_cjs.stripSkillFrontmatter(await promises.readFile(skill.source, "utf8"));
2897
2903
  const references = skill.references;
2898
2904
  return {
2899
2905
  name: skill.name,
@@ -2979,7 +2985,7 @@ async function safeCall(fn, fallback, label = "safeCall") {
2979
2985
  return await fn();
2980
2986
  } catch (cause) {
2981
2987
  const message = cause instanceof Error ? cause.message : String(cause);
2982
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] ${label} failed: ${message}
2988
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] ${label} failed: ${message}
2983
2989
  `);
2984
2990
  return fallback;
2985
2991
  }
@@ -2993,7 +2999,7 @@ var ActiveMemoryPromptProvider = class {
2993
2999
  if (ctx.activeMemorySummary === void 0 || ctx.activeMemorySummary.length === 0) {
2994
3000
  return Promise.resolve(void 0);
2995
3001
  }
2996
- const body = chunkFUASIT3E_cjs.escapeBlockBody(ctx.activeMemorySummary);
3002
+ const body = chunkZN2DGEY3_cjs.escapeBlockBody(ctx.activeMemorySummary);
2997
3003
  return Promise.resolve(`<active-memory>
2998
3004
  ${body}
2999
3005
  </active-memory>`);
@@ -3046,7 +3052,7 @@ function formatSource(name, tokens) {
3046
3052
  if (tokens.length === 0) {
3047
3053
  return ` <source name="${escapeAttribute(name)}" />`;
3048
3054
  }
3049
- const body = chunkFUASIT3E_cjs.escapeBlockBody(tokens.join(" "));
3055
+ const body = chunkZN2DGEY3_cjs.escapeBlockBody(tokens.join(" "));
3050
3056
  return ` <source name="${escapeAttribute(name)}">
3051
3057
  ${body}
3052
3058
  </source>`;
@@ -3062,7 +3068,7 @@ var MemoryPromptProvider = class {
3062
3068
  contribute(ctx) {
3063
3069
  if (ctx.memoryAutoInject === false) return Promise.resolve(void 0);
3064
3070
  if (ctx.memory.length === 0) return Promise.resolve(void 0);
3065
- const lines = ctx.memory.map((fact) => ` - ${chunkFUASIT3E_cjs.escapeBlockBody(fact.text)}`);
3071
+ const lines = ctx.memory.map((fact) => ` - ${chunkZN2DGEY3_cjs.escapeBlockBody(fact.text)}`);
3066
3072
  return Promise.resolve(`<memory>
3067
3073
  ${lines.join("\n")}
3068
3074
  </memory>`);
@@ -3084,7 +3090,7 @@ var SkillsPromptProvider = class {
3084
3090
  priority = 20;
3085
3091
  contribute(ctx) {
3086
3092
  if (ctx.skillsAutoInject === false) return Promise.resolve(void 0);
3087
- return Promise.resolve(chunkFUASIT3E_cjs.buildSkillsBlock(ctx.skills));
3093
+ return Promise.resolve(chunkZN2DGEY3_cjs.buildSkillsBlock(ctx.skills));
3088
3094
  }
3089
3095
  };
3090
3096
 
@@ -3096,7 +3102,7 @@ var SystemPromptPipeline = class _SystemPromptPipeline {
3096
3102
  for (const p of providers) {
3097
3103
  const key = `${p.priority}:${p.id}`;
3098
3104
  if (seen.has(key)) {
3099
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Duplicate system-prompt provider ${key}`, {
3105
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Duplicate system-prompt provider ${key}`, {
3100
3106
  code: "pipeline_duplicate_provider"
3101
3107
  });
3102
3108
  }
@@ -3143,7 +3149,7 @@ function validateAgentOptions(options) {
3143
3149
  ensureRuntimeShape(options);
3144
3150
  if (options.local !== void 0) {
3145
3151
  if (options.model === void 0) {
3146
- throw new chunk2YGIBOUH_cjs.ConfigurationError("Local agents require a model selection", {
3152
+ throw new chunkLPVIRJVF_cjs.ConfigurationError("Local agents require a model selection", {
3147
3153
  code: "missing_model"
3148
3154
  });
3149
3155
  }
@@ -3167,7 +3173,7 @@ function validateCredentialPoolShape(options) {
3167
3173
  ([, arr]) => Array.isArray(arr) && arr.some((k) => typeof k === "string" && k.length > 0)
3168
3174
  );
3169
3175
  if (populated.length === 0) return;
3170
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3176
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3171
3177
  "Ambiguous credential configuration: use either `apiKey: '...'` (single-key, simplest) OR `apiKeys: { provider: [...] }` (multi-key pool), not both.",
3172
3178
  { code: "credential_pool_ambiguous" }
3173
3179
  );
@@ -3176,7 +3182,7 @@ function validatePlugins(options) {
3176
3182
  const plugins = options.plugins;
3177
3183
  if (plugins?.paths === void 0) return;
3178
3184
  if (options.cloud !== void 0 && plugins.paths.length > 0) {
3179
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3185
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3180
3186
  "Cloud agents require committed plugin manifests; local plugin paths are not supported",
3181
3187
  { code: "cloud_plugin_path_rejected" }
3182
3188
  );
@@ -3184,7 +3190,7 @@ function validatePlugins(options) {
3184
3190
  }
3185
3191
  function ensureRuntimeShape(options) {
3186
3192
  if (options.local !== void 0 && options.cloud !== void 0) {
3187
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3193
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3188
3194
  "Pass either local or cloud \u2014 they are mutually exclusive runtimes",
3189
3195
  { code: "runtime_exclusive" }
3190
3196
  );
@@ -3192,7 +3198,7 @@ function ensureRuntimeShape(options) {
3192
3198
  }
3193
3199
  function rejectProgrammaticHooks(options) {
3194
3200
  if (options.hooks !== void 0) {
3195
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3201
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3196
3202
  "Programmatic hooks are not supported \u2014 hooks are file-based only (.theokit/hooks.json)",
3197
3203
  { code: "programmatic_hooks_rejected" }
3198
3204
  );
@@ -3202,7 +3208,7 @@ function validateCloud(cloud) {
3202
3208
  if (cloud.envVars !== void 0) {
3203
3209
  for (const key of Object.keys(cloud.envVars)) {
3204
3210
  if (key.startsWith("THEOKIT_")) {
3205
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3211
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3206
3212
  `Cloud envVars cannot use the reserved THEOKIT_ prefix (got "${key}")`,
3207
3213
  { code: "reserved_env_prefix" }
3208
3214
  );
@@ -3214,7 +3220,7 @@ function validateMcpServers(options) {
3214
3220
  if (options.mcpServers === void 0) return;
3215
3221
  for (const [name, config] of Object.entries(options.mcpServers)) {
3216
3222
  if (options.cloud !== void 0 && isStdioWithCwd(config)) {
3217
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3223
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3218
3224
  `MCP server "${name}" uses stdio with cwd, which is rejected for cloud agents`,
3219
3225
  { code: "cloud_stdio_cwd_rejected" }
3220
3226
  );
@@ -3233,12 +3239,12 @@ function validateSubagents(agents2) {
3233
3239
  if (agents2 === void 0) return;
3234
3240
  for (const [name, definition] of Object.entries(agents2)) {
3235
3241
  if (typeof definition.description !== "string" || definition.description.length === 0) {
3236
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty description`, {
3242
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty description`, {
3237
3243
  code: "subagent_missing_description"
3238
3244
  });
3239
3245
  }
3240
3246
  if (typeof definition.prompt !== "string" || definition.prompt.length === 0) {
3241
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty prompt`, {
3247
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty prompt`, {
3242
3248
  code: "subagent_missing_prompt"
3243
3249
  });
3244
3250
  }
@@ -3251,7 +3257,7 @@ function validateToolCatalog(tools) {
3251
3257
  for (const tool of tools) {
3252
3258
  validateSingleTool(tool);
3253
3259
  if (seen.has(tool.name)) {
3254
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Duplicate custom tool name "${tool.name}"`, {
3260
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Duplicate custom tool name "${tool.name}"`, {
3255
3261
  code: "duplicate_tool_name"
3256
3262
  });
3257
3263
  }
@@ -3262,7 +3268,7 @@ function validateCustomTools(options) {
3262
3268
  const tools = options.tools;
3263
3269
  if (tools === void 0 || tools.length === 0) return;
3264
3270
  if (options.cloud !== void 0) {
3265
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3271
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3266
3272
  "Custom inline tools are local-only in SDK v1.0 \u2014 cloud agents cannot serialize handler functions",
3267
3273
  { code: "cloud_custom_tools_rejected" }
3268
3274
  );
@@ -3274,25 +3280,25 @@ function validateSingleTool(tool) {
3274
3280
  validateToolDescription(tool);
3275
3281
  validateToolSchema(tool);
3276
3282
  if (typeof tool.handler !== "function") {
3277
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a handler function`, {
3283
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a handler function`, {
3278
3284
  code: "tool_missing_handler"
3279
3285
  });
3280
3286
  }
3281
3287
  }
3282
3288
  function validateToolName(tool) {
3283
3289
  if (typeof tool.name !== "string" || tool.name.length === 0) {
3284
- throw new chunk2YGIBOUH_cjs.ConfigurationError("Custom tool requires a non-empty name", {
3290
+ throw new chunkLPVIRJVF_cjs.ConfigurationError("Custom tool requires a non-empty name", {
3285
3291
  code: "tool_missing_name"
3286
3292
  });
3287
3293
  }
3288
3294
  if (!TOOL_NAME_PATTERN.test(tool.name)) {
3289
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3295
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3290
3296
  `Custom tool name "${tool.name}" must match /^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/`,
3291
3297
  { code: "tool_invalid_name" }
3292
3298
  );
3293
3299
  }
3294
3300
  if (RESERVED_TOOL_NAMES.has(tool.name) || tool.name.startsWith("mcp_")) {
3295
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3301
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3296
3302
  `Custom tool name "${tool.name}" collides with a reserved SDK tool name`,
3297
3303
  { code: "tool_reserved_name" }
3298
3304
  );
@@ -3300,7 +3306,7 @@ function validateToolName(tool) {
3300
3306
  }
3301
3307
  function validateToolDescription(tool) {
3302
3308
  if (typeof tool.description !== "string" || tool.description.length === 0) {
3303
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a non-empty description`, {
3309
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a non-empty description`, {
3304
3310
  code: "tool_missing_description"
3305
3311
  });
3306
3312
  }
@@ -3308,12 +3314,12 @@ function validateToolDescription(tool) {
3308
3314
  function validateToolSchema(tool) {
3309
3315
  const schema = tool.inputSchema;
3310
3316
  if (schema === null || schema === void 0 || typeof schema !== "object") {
3311
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Custom tool "${tool.name}" requires an inputSchema object`, {
3317
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Custom tool "${tool.name}" requires an inputSchema object`, {
3312
3318
  code: "tool_missing_schema"
3313
3319
  });
3314
3320
  }
3315
3321
  if (schema.type !== "object") {
3316
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3322
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3317
3323
  `Custom tool "${tool.name}" inputSchema must declare \`type: "object"\``,
3318
3324
  { code: "tool_invalid_schema_type" }
3319
3325
  );
@@ -3324,7 +3330,7 @@ function validateMemory(options) {
3324
3330
  if (memory?.storePath === void 0) return;
3325
3331
  const storePath = memory.storePath;
3326
3332
  if (storePath.includes("..") || storePath.startsWith("/") || /^[A-Z]:/i.test(storePath)) {
3327
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3333
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3328
3334
  `Memory storePath must stay inside the workspace; got "${storePath}"`,
3329
3335
  { code: "memory_path_traversal" }
3330
3336
  );
@@ -3346,7 +3352,7 @@ var HISTOGRAM_NAMES = {
3346
3352
  };
3347
3353
  function safeRequire(moduleName) {
3348
3354
  try {
3349
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-2VFZQEDW.cjs', document.baseURI).href)));
3355
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-F77UENR6.cjs', document.baseURI).href)));
3350
3356
  return r(moduleName);
3351
3357
  } catch {
3352
3358
  return void 0;
@@ -3425,7 +3431,7 @@ var langfuseAdapter = {
3425
3431
  }
3426
3432
  }
3427
3433
  if (lf.LangfuseSpanProcessor === void 0) {
3428
- chunkSXSPMRSV_cjs.diag(
3434
+ chunkBM6N4KHO_cjs.diag(
3429
3435
  "[theokit-sdk] @langfuse/node detected but LangfuseSpanProcessor not found (v2?). Use Langfuse v3+ for auto-instrumentation.\n"
3430
3436
  );
3431
3437
  return;
@@ -3554,11 +3560,11 @@ function tryAutoRegisterAdapters(settings) {
3554
3560
  try {
3555
3561
  adapter.register();
3556
3562
  registered.add(adapter.moduleName);
3557
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] telemetry: ${adapter.displayName} auto-instrumented.
3563
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] telemetry: ${adapter.displayName} auto-instrumented.
3558
3564
  `);
3559
3565
  } catch (cause) {
3560
3566
  const message = cause instanceof Error ? cause.message : String(cause);
3561
- chunkSXSPMRSV_cjs.diag(
3567
+ chunkBM6N4KHO_cjs.diag(
3562
3568
  `[theokit-sdk] telemetry: ${adapter.displayName} detected but failed to register: ${message}
3563
3569
  `
3564
3570
  );
@@ -3571,7 +3577,7 @@ var cachedOtel;
3571
3577
  function loadOtel() {
3572
3578
  if (cachedOtel === void 0) {
3573
3579
  try {
3574
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-2VFZQEDW.cjs', document.baseURI).href)));
3580
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-F77UENR6.cjs', document.baseURI).href)));
3575
3581
  const mod = r("@opentelemetry/api");
3576
3582
  cachedOtel = mod;
3577
3583
  } catch {
@@ -3614,7 +3620,7 @@ function safe(op, fallback) {
3614
3620
  if (!warnedOnce) {
3615
3621
  warnedOnce = true;
3616
3622
  const message = cause instanceof Error ? cause.message : String(cause);
3617
- chunkSXSPMRSV_cjs.diag(
3623
+ chunkBM6N4KHO_cjs.diag(
3618
3624
  `[theokit-sdk] telemetry exporter error (suppressed; agent.send continues): ${message}
3619
3625
  `
3620
3626
  );
@@ -3628,7 +3634,7 @@ function createTelemetry(settings) {
3628
3634
  if (otel === null) {
3629
3635
  if (!warnedOnce) {
3630
3636
  warnedOnce = true;
3631
- chunkSXSPMRSV_cjs.diag(
3637
+ chunkBM6N4KHO_cjs.diag(
3632
3638
  "[theokit-sdk] telemetry.enabled = true but `@opentelemetry/api` is not installed; telemetry is a no-op.\n"
3633
3639
  );
3634
3640
  }
@@ -3722,12 +3728,12 @@ function wrapSpan(span, openSpans) {
3722
3728
  }
3723
3729
  function redactAttrValue(value) {
3724
3730
  if (typeof value !== "string") return value;
3725
- return chunkSXSPMRSV_cjs.redactSecrets(value);
3731
+ return chunkBM6N4KHO_cjs.redactSecrets(value);
3726
3732
  }
3727
3733
  function redactAttrs(attrs) {
3728
3734
  const out = {};
3729
3735
  for (const [k, v] of Object.entries(attrs)) {
3730
- out[k] = typeof v === "string" ? chunkSXSPMRSV_cjs.redactSecrets(v) : v;
3736
+ out[k] = typeof v === "string" ? chunkBM6N4KHO_cjs.redactSecrets(v) : v;
3731
3737
  }
3732
3738
  return out;
3733
3739
  }
@@ -3809,10 +3815,10 @@ async function loadMarkdownEntities(opts) {
3809
3815
  const raw = await promises.readFile(resolved.source, "utf8").catch(() => null);
3810
3816
  if (raw === null) continue;
3811
3817
  const split = splitFrontmatter(raw, resolved.source, errorCodePrefix);
3812
- const fields = chunk44IISBRZ_cjs.parseSimpleYaml(split.frontmatter);
3818
+ const fields = chunkSZHU7A5B_cjs.parseSimpleYaml(split.frontmatter);
3813
3819
  const parsed = schema.safeParse(fields);
3814
3820
  if (!parsed.success) {
3815
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3821
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3816
3822
  `Invalid frontmatter in ${resolved.source}: ${parsed.error.message}`,
3817
3823
  { code: `${errorCodePrefix}_frontmatter_invalid` }
3818
3824
  );
@@ -3830,13 +3836,13 @@ async function assertFileSizeUnderCap(source, errorCodePrefix) {
3830
3836
  try {
3831
3837
  const info = await promises.stat(source);
3832
3838
  if (info.size > MAX_MD_FILE_BYTES) {
3833
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3839
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3834
3840
  `Config file ${source} exceeds 1 MB size limit (${info.size} bytes). Reduce the file or split into multiple entities.`,
3835
3841
  { code: `${errorCodePrefix}_file_too_large` }
3836
3842
  );
3837
3843
  }
3838
3844
  } catch (cause) {
3839
- if (cause instanceof chunk2YGIBOUH_cjs.ConfigurationError) throw cause;
3845
+ if (cause instanceof chunkLPVIRJVF_cjs.ConfigurationError) throw cause;
3840
3846
  }
3841
3847
  }
3842
3848
  async function readDirSafe(dir, errorCodePrefix) {
@@ -3845,7 +3851,7 @@ async function readDirSafe(dir, errorCodePrefix) {
3845
3851
  } catch (cause) {
3846
3852
  const code = cause.code;
3847
3853
  if (code === "ENOENT") return null;
3848
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Failed to read ${dir}`, {
3854
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Failed to read ${dir}`, {
3849
3855
  code: `${errorCodePrefix}_dir_read_error`,
3850
3856
  cause
3851
3857
  });
@@ -3862,7 +3868,7 @@ function resolveEntryPath(entry, pattern, dir) {
3862
3868
  function splitFrontmatter(raw, source, errorCodePrefix) {
3863
3869
  const match = /^---\s*\n([\s\S]*?)\n---\s*(?:\n|$)/.exec(raw);
3864
3870
  if (match === null) {
3865
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
3871
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
3866
3872
  `Missing or malformed frontmatter in ${source} (expected \`---\` delimited block at file head)`,
3867
3873
  { code: `${errorCodePrefix}_missing_frontmatter` }
3868
3874
  );
@@ -4036,7 +4042,7 @@ async function loadContextConfig(cwd) {
4036
4042
  });
4037
4043
  if (mdEntities.length > 0) {
4038
4044
  if (fs.existsSync(jsonPath)) {
4039
- chunk3YYDHUNH_cjs.warnOnce(
4045
+ chunk665SFFFR_cjs.warnOnce(
4040
4046
  "context-both-present",
4041
4047
  "[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
4042
4048
  );
@@ -4046,7 +4052,7 @@ async function loadContextConfig(cwd) {
4046
4052
  };
4047
4053
  }
4048
4054
  if (!fs.existsSync(jsonPath)) return { sources: [] };
4049
- chunk3YYDHUNH_cjs.warnOnce(
4055
+ chunk665SFFFR_cjs.warnOnce(
4050
4056
  "context-json-deprecated",
4051
4057
  "[theokit-sdk] .theokit/context.json is deprecated; migrate to .theokit/context/<name>.md via theokit-migrate-config"
4052
4058
  );
@@ -4054,7 +4060,7 @@ async function loadContextConfig(cwd) {
4054
4060
  try {
4055
4061
  raw = await promises.readFile(jsonPath, "utf8");
4056
4062
  } catch (cause) {
4057
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Failed to read context config: ${jsonPath}`, {
4063
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Failed to read context config: ${jsonPath}`, {
4058
4064
  code: "context_read_error",
4059
4065
  cause
4060
4066
  });
@@ -4066,13 +4072,13 @@ function parseConfig(raw, configPath) {
4066
4072
  try {
4067
4073
  parsed = JSON.parse(raw);
4068
4074
  } catch (cause) {
4069
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Invalid JSON in context config: ${configPath}`, {
4075
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Invalid JSON in context config: ${configPath}`, {
4070
4076
  code: "context_json_invalid",
4071
4077
  cause
4072
4078
  });
4073
4079
  }
4074
4080
  if (!parsed || typeof parsed !== "object") {
4075
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Context config must be an object: ${configPath}`, {
4081
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Context config must be an object: ${configPath}`, {
4076
4082
  code: "context_config_shape"
4077
4083
  });
4078
4084
  }
@@ -4087,7 +4093,7 @@ function parseConfig(raw, configPath) {
4087
4093
  }
4088
4094
  function readSources(sourcesRaw, configPath) {
4089
4095
  if (!Array.isArray(sourcesRaw)) {
4090
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Context config sources must be an array: ${configPath}`, {
4096
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Context config sources must be an array: ${configPath}`, {
4091
4097
  code: "context_sources_shape"
4092
4098
  });
4093
4099
  }
@@ -4185,7 +4191,7 @@ var PluginsManager = class {
4185
4191
  async refresh() {
4186
4192
  this.plugins = [];
4187
4193
  const pluginsRoot = path.join(this.cwd, ".theokit", "plugins");
4188
- const entries = await chunk44IISBRZ_cjs.readWorkspaceDir(pluginsRoot, "plugins_read_error", "plugins directory");
4194
+ const entries = await chunkSZHU7A5B_cjs.readWorkspaceDir(pluginsRoot, "plugins_read_error", "plugins directory");
4189
4195
  for (const entry of entries) {
4190
4196
  if (!entry.isDirectory()) continue;
4191
4197
  const folderName = entry.name;
@@ -4193,13 +4199,13 @@ var PluginsManager = class {
4193
4199
  const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
4194
4200
  const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(pluginsRoot, folderName) : await loadPluginManifestFromJson(jsonPath, folderName);
4195
4201
  if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4196
- chunk3YYDHUNH_cjs.warnOnce(
4202
+ chunk665SFFFR_cjs.warnOnce(
4197
4203
  `plugin-${folderName}-both`,
4198
4204
  `[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
4199
4205
  );
4200
4206
  }
4201
4207
  if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4202
- chunk3YYDHUNH_cjs.warnOnce(
4208
+ chunk665SFFFR_cjs.warnOnce(
4203
4209
  "plugin-json-deprecated",
4204
4210
  "[theokit-sdk] plugin.json manifests are deprecated; migrate to PLUGIN.md via theokit-migrate-config"
4205
4211
  );
@@ -4217,11 +4223,11 @@ var PluginsManager = class {
4217
4223
  const entry = metadata.entry;
4218
4224
  if (entry === void 0) return;
4219
4225
  const pluginRoot = path.join(this.cwd, ".theokit", "plugins", folderName);
4220
- const entryPath = chunkYTO5BRBD_cjs.safePathJoin(pluginRoot, entry);
4226
+ const entryPath = chunkZT57WTUJ_cjs.safePathJoin(pluginRoot, entry);
4221
4227
  try {
4222
4228
  await promises.readFile(entryPath, "utf8");
4223
4229
  } catch (cause) {
4224
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${metadata.name} entry file is missing: ${entry}`, {
4230
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Plugin ${metadata.name} entry file is missing: ${entry}`, {
4225
4231
  code: "plugin_entry_missing",
4226
4232
  cause
4227
4233
  });
@@ -4230,7 +4236,7 @@ var PluginsManager = class {
4230
4236
  assertCloudRules() {
4231
4237
  if (!this.cloud) return;
4232
4238
  if (this.localPaths !== void 0 && this.localPaths.length > 0) {
4233
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
4239
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
4234
4240
  "Cloud agents reject local plugin paths \u2014 plugins must come from committed repo files",
4235
4241
  { code: "cloud_plugin_path_rejected" }
4236
4242
  );
@@ -4242,7 +4248,7 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
4242
4248
  try {
4243
4249
  raw = await promises.readFile(manifestPath, "utf8");
4244
4250
  } catch (cause) {
4245
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} is missing plugin.json`, {
4251
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Plugin ${folderName} is missing plugin.json`, {
4246
4252
  code: "plugin_missing_manifest",
4247
4253
  cause
4248
4254
  });
@@ -4251,13 +4257,13 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
4251
4257
  try {
4252
4258
  parsed = JSON.parse(raw);
4253
4259
  } catch (cause) {
4254
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} manifest is invalid JSON`, {
4260
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Plugin ${folderName} manifest is invalid JSON`, {
4255
4261
  code: "plugin_manifest_invalid",
4256
4262
  cause
4257
4263
  });
4258
4264
  }
4259
4265
  if (!parsed || typeof parsed !== "object") {
4260
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} manifest must be an object`, {
4266
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Plugin ${folderName} manifest must be an object`, {
4261
4267
  code: "plugin_manifest_shape"
4262
4268
  });
4263
4269
  }
@@ -4276,7 +4282,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
4276
4282
  try {
4277
4283
  raw = await promises.readFile(mdPath, "utf8");
4278
4284
  } catch (cause) {
4279
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} is missing PLUGIN.md`, {
4285
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Plugin ${folderName} is missing PLUGIN.md`, {
4280
4286
  code: "plugin_missing_manifest",
4281
4287
  cause
4282
4288
  });
@@ -4291,7 +4297,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
4291
4297
  });
4292
4298
  const entity = entities.find((e) => e.slug === "PLUGIN");
4293
4299
  if (entity === void 0) {
4294
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} PLUGIN.md not parseable`, {
4300
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`Plugin ${folderName} PLUGIN.md not parseable`, {
4295
4301
  code: "plugin_missing_manifest"
4296
4302
  });
4297
4303
  }
@@ -4565,7 +4571,7 @@ function assertValidThresholds(soft, hard) {
4565
4571
  ["hardThreshold", hard]
4566
4572
  ]) {
4567
4573
  if (!Number.isInteger(value) || value < 1) {
4568
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
4574
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
4569
4575
  `doomLoop.${label} must be a positive integer (received ${value}).`,
4570
4576
  { code: "invalid_doom_loop_threshold" }
4571
4577
  );
@@ -4878,9 +4884,9 @@ async function safeListTools(client, serverName, sink) {
4878
4884
  } catch (cause) {
4879
4885
  const message = cause instanceof Error ? cause.message : String(cause);
4880
4886
  const server = serverName ?? "unknown";
4881
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] mcp listTools failed (server=${server}): ${message}
4887
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] mcp listTools failed (server=${server}): ${message}
4882
4888
  `);
4883
- chunk6DCTL32L_cjs.emitRunEvent(sink, { type: "mcp_server_failed", serverName: server, message });
4889
+ chunkXPR366DL_cjs.emitRunEvent(sink, { type: "mcp_server_failed", serverName: server, message });
4884
4890
  return [];
4885
4891
  }
4886
4892
  }
@@ -4948,7 +4954,7 @@ function emitLlmMetrics(inputs, result, startAt) {
4948
4954
  inputs.telemetry?.recordHistogram(HISTOGRAM_NAMES.LLM_USAGE_MISSING, 1, {
4949
4955
  provider: inputs.llm.name
4950
4956
  });
4951
- chunkSXSPMRSV_cjs.diag(
4957
+ chunkBM6N4KHO_cjs.diag(
4952
4958
  `[theokit-sdk] llm usage missing from ${inputs.llm.name} finish \u2014 budget may undercount
4953
4959
  `
4954
4960
  );
@@ -5244,7 +5250,7 @@ function coerceArgsToSchema(args, schema) {
5244
5250
  }
5245
5251
 
5246
5252
  // src/tool-error.ts
5247
- var ToolError = class extends chunk2YGIBOUH_cjs.TheokitAgentError {
5253
+ var ToolError = class extends chunkLPVIRJVF_cjs.TheokitAgentError {
5248
5254
  name = "ToolError";
5249
5255
  /** The error content surfaced to the model: a string, or text/image blocks. */
5250
5256
  content;
@@ -5438,7 +5444,7 @@ function raceToolExecution(exec, opts) {
5438
5444
  // src/internal/agent-loop/tool-dispatch.ts
5439
5445
  async function dispatchTools(inputs, tools, toolCalls, events, parentSpan) {
5440
5446
  const maxConcurrent = inputs.maxConcurrentTools ?? 4;
5441
- return chunkKNZU4YO5_cjs.mapWithConcurrency(
5447
+ return chunkWQ53UQL4_cjs.mapWithConcurrency(
5442
5448
  toolCalls,
5443
5449
  maxConcurrent,
5444
5450
  (call) => dispatchSingleCall(inputs, tools, call, events, parentSpan)
@@ -5466,7 +5472,7 @@ async function dispatchSingleCall(inputs, tools, call, events, parentSpan) {
5466
5472
  toolSpan?.end();
5467
5473
  return fileVeto;
5468
5474
  }
5469
- chunk6DCTL32L_cjs.emitRunEvent(inputs.runEventSink, {
5475
+ chunkXPR366DL_cjs.emitRunEvent(inputs.runEventSink, {
5470
5476
  type: "tool_progress",
5471
5477
  toolName: workingCall.name,
5472
5478
  toolCallId: callId
@@ -5497,7 +5503,7 @@ function applyRepairAndExtractCall(tools, call) {
5497
5503
  function vetoFromForkWhitelist(inputs, call, callId, events) {
5498
5504
  const whitelistDecision = chunkVJ26EKGJ_cjs.checkToolWhitelist(call.name);
5499
5505
  if (whitelistDecision.allowed) return void 0;
5500
- chunk6DCTL32L_cjs.emitRunEvent(inputs.runEventSink, {
5506
+ chunkXPR366DL_cjs.emitRunEvent(inputs.runEventSink, {
5501
5507
  type: "permission_denied",
5502
5508
  toolName: call.name,
5503
5509
  toolCallId: callId,
@@ -5542,7 +5548,7 @@ async function vetoFromPluginPreHook(inputs, call, callId, events) {
5542
5548
  ...inputs.permissionMode !== void 0 ? { permissionMode: inputs.permissionMode } : {}
5543
5549
  });
5544
5550
  if (pluginVeto === void 0) return void 0;
5545
- chunk6DCTL32L_cjs.emitRunEvent(inputs.runEventSink, {
5551
+ chunkXPR366DL_cjs.emitRunEvent(inputs.runEventSink, {
5546
5552
  type: "permission_denied",
5547
5553
  toolName: call.name,
5548
5554
  toolCallId: callId,
@@ -5571,7 +5577,7 @@ async function vetoFromFileHookPreDecision(inputs, call, callId, events) {
5571
5577
  runId: inputs.runId
5572
5578
  });
5573
5579
  if (!preDecision.blocked) return void 0;
5574
- chunk6DCTL32L_cjs.emitRunEvent(inputs.runEventSink, {
5580
+ chunkXPR366DL_cjs.emitRunEvent(inputs.runEventSink, {
5575
5581
  type: "permission_denied",
5576
5582
  toolName: call.name,
5577
5583
  toolCallId: callId,
@@ -5672,7 +5678,7 @@ function finalizeSpanAndPostHook(inputs, call, callId, result, events, toolSpan)
5672
5678
  agentId: inputs.agentId,
5673
5679
  runId: inputs.runId
5674
5680
  }).catch((err) => {
5675
- chunkSXSPMRSV_cjs.diag(
5681
+ chunkBM6N4KHO_cjs.diag(
5676
5682
  `[theokit-sdk] postToolUse hook error (swallowed): ${err instanceof Error ? err.message : String(err)}
5677
5683
  `
5678
5684
  );
@@ -5691,7 +5697,7 @@ async function emitToolLifecycleDelta(inputs, update) {
5691
5697
  try {
5692
5698
  await inputs.onDelta({ update });
5693
5699
  } catch (err) {
5694
- chunkSXSPMRSV_cjs.diag(
5700
+ chunkBM6N4KHO_cjs.diag(
5695
5701
  `[theokit-sdk] onDelta tool-lifecycle emit error (swallowed): ${err instanceof Error ? err.message : String(err)}
5696
5702
  `
5697
5703
  );
@@ -5703,7 +5709,7 @@ async function safeEmitToolHook(callback, event) {
5703
5709
  await callback(event);
5704
5710
  } catch (cause) {
5705
5711
  const msg = cause instanceof Error ? cause.message : String(cause);
5706
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] tool lifecycle hook threw: ${msg}
5712
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] tool lifecycle hook threw: ${msg}
5707
5713
  `);
5708
5714
  }
5709
5715
  }
@@ -5770,7 +5776,7 @@ function applyToolResultGuard(parts, opts) {
5770
5776
  (p) => (
5771
5777
  // SE7 — guard the TEXT of a tool result (string or the text blocks of a
5772
5778
  // structured content); image blocks pass through untouched.
5773
- p.type === "tool_result" ? { ...p, content: chunkDM6Y5B2G_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
5779
+ p.type === "tool_result" ? { ...p, content: chunk2FYEVT2B_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
5774
5780
  )
5775
5781
  );
5776
5782
  }
@@ -5965,7 +5971,7 @@ function catalogCostFallback(provider, cleanedModel) {
5965
5971
  const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
5966
5972
  if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
5967
5973
  for (const key of candidates) {
5968
- const info = chunkBC5EUG7R_cjs.getCatalogModelInfo(key);
5974
+ const info = chunkVUKQL3L2_cjs.getCatalogModelInfo(key);
5969
5975
  const cost = info?.cost;
5970
5976
  if (cost === void 0) continue;
5971
5977
  const [prov, ...modelParts] = key.split("/");
@@ -5977,7 +5983,7 @@ function catalogCostFallback(provider, cleanedModel) {
5977
5983
  ...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
5978
5984
  ...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
5979
5985
  // M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
5980
- pricingVersion: chunkBC5EUG7R_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
5986
+ pricingVersion: chunkVUKQL3L2_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
5981
5987
  };
5982
5988
  }
5983
5989
  return void 0;
@@ -6430,15 +6436,15 @@ var FallbackLlmClient = class {
6430
6436
  let lastError;
6431
6437
  for (const client of this.clients) {
6432
6438
  if (signal.aborted) throw abortError(signal);
6433
- const attempt = await chunkDM6Y5B2G_cjs.tryFirstEvent(client, request, signal, true);
6439
+ const attempt = await chunk2FYEVT2B_cjs.tryFirstEvent(client, request, signal, true);
6434
6440
  if (attempt.kind === "handshake_error") {
6435
6441
  lastError = attempt.error;
6436
6442
  continue;
6437
6443
  }
6438
- return yield* chunkDM6Y5B2G_cjs.relayStream(attempt.generator, attempt.firstResult);
6444
+ return yield* chunk2FYEVT2B_cjs.relayStream(attempt.generator, attempt.firstResult);
6439
6445
  }
6440
6446
  if (lastError !== void 0) throw lastError;
6441
- throw new chunk2YGIBOUH_cjs.NetworkError("FallbackLlmClient has no providers configured", {
6447
+ throw new chunkLPVIRJVF_cjs.NetworkError("FallbackLlmClient has no providers configured", {
6442
6448
  code: "fallback_empty_chain"
6443
6449
  });
6444
6450
  }
@@ -6461,7 +6467,7 @@ function reconnectDelay(attempt) {
6461
6467
  return ms <= 0 ? Promise.resolve() : new Promise((resolve) => setTimeout(resolve, ms));
6462
6468
  }
6463
6469
  function mcpTimeoutError(name, timeoutMs) {
6464
- return new chunk2YGIBOUH_cjs.NetworkError(`MCP ${name} request timed out after ${timeoutMs}ms`, {
6470
+ return new chunkLPVIRJVF_cjs.NetworkError(`MCP ${name} request timed out after ${timeoutMs}ms`, {
6465
6471
  code: "mcp_timeout"
6466
6472
  });
6467
6473
  }
@@ -6536,7 +6542,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6536
6542
  cwd: resolvedCwd,
6537
6543
  // #54 (F-H1) — a third-party MCP server binary must not inherit host
6538
6544
  // secrets. Scrub secret-like vars by default; `config.env` still wins.
6539
- env: chunkBBZYXVLZ_cjs.resolveChildEnv({ policy: this.config.envPolicy, overrides: this.config.env })
6545
+ env: chunk2ZPEDVLM_cjs.resolveChildEnv({ policy: this.config.envPolicy, overrides: this.config.env })
6540
6546
  });
6541
6547
  this.child = child;
6542
6548
  child.stdout.on("data", (chunk) => this.consume(chunk));
@@ -6544,7 +6550,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6544
6550
  child.stdin.on("error", () => void 0);
6545
6551
  child.on("error", () => {
6546
6552
  this.rejectAllPending(
6547
- new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} process crashed`, { code: "mcp_crashed" })
6553
+ new chunkLPVIRJVF_cjs.NetworkError(`MCP ${this.name} process crashed`, { code: "mcp_crashed" })
6548
6554
  );
6549
6555
  });
6550
6556
  child.on("exit", () => {
@@ -6552,7 +6558,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6552
6558
  this.child = void 0;
6553
6559
  this.dropped = true;
6554
6560
  this.rejectAllPending(
6555
- new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6561
+ new chunkLPVIRJVF_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6556
6562
  );
6557
6563
  });
6558
6564
  }
@@ -6580,7 +6586,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6580
6586
  if (this.child !== void 0) return Promise.resolve();
6581
6587
  if (!this.dropped) {
6582
6588
  return Promise.reject(
6583
- new chunk2YGIBOUH_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6589
+ new chunkLPVIRJVF_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6584
6590
  );
6585
6591
  }
6586
6592
  this.reconnectPromise ??= this.reconnect().finally(() => {
@@ -6601,13 +6607,13 @@ var StdioMcpClient = class extends BaseMcpClient {
6601
6607
  lastErr = err;
6602
6608
  }
6603
6609
  }
6604
- throw new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} reconnect exhausted`, {
6610
+ throw new chunkLPVIRJVF_cjs.NetworkError(`MCP ${this.name} reconnect exhausted`, {
6605
6611
  code: "mcp_disconnected",
6606
6612
  ...lastErr instanceof Error ? { cause: lastErr } : {}
6607
6613
  });
6608
6614
  }
6609
6615
  async close() {
6610
- this.rejectAllPending(new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} closed`, { code: "mcp_closed" }));
6616
+ this.rejectAllPending(new chunkLPVIRJVF_cjs.NetworkError(`MCP ${this.name} closed`, { code: "mcp_closed" }));
6611
6617
  const child = this.child;
6612
6618
  this.child = void 0;
6613
6619
  this.dropped = false;
@@ -6626,7 +6632,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6626
6632
  if (this.buffer.length > MAX_STDIO_BUFFER_BYTES) {
6627
6633
  this.buffer = "";
6628
6634
  this.rejectAllPending(
6629
- new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} exceeded stdout buffer limit`, {
6635
+ new chunkLPVIRJVF_cjs.NetworkError(`MCP ${this.name} exceeded stdout buffer limit`, {
6630
6636
  code: "mcp_buffer_overflow"
6631
6637
  })
6632
6638
  );
@@ -6661,7 +6667,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6661
6667
  if (child !== void 0) return this.send(child, method, params);
6662
6668
  if (this.dropped) return this.reconnectAndRequest(method, params);
6663
6669
  return Promise.reject(
6664
- new chunk2YGIBOUH_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6670
+ new chunkLPVIRJVF_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6665
6671
  );
6666
6672
  }
6667
6673
  /** M2 #59 — reconnect a dropped client, then send. Separate async path so the
@@ -6670,7 +6676,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6670
6676
  await this.ensureConnected();
6671
6677
  const child = this.child;
6672
6678
  if (child === void 0) {
6673
- throw new chunk2YGIBOUH_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" });
6679
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" });
6674
6680
  }
6675
6681
  return this.send(child, method, params);
6676
6682
  }
@@ -6687,7 +6693,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6687
6693
  this.child = void 0;
6688
6694
  this.dropped = true;
6689
6695
  this.rejectAllPending(
6690
- new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6696
+ new chunkLPVIRJVF_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6691
6697
  );
6692
6698
  }, this.timeoutMs);
6693
6699
  this.pending.set(id, { resolve, reject, timer });
@@ -6765,7 +6771,7 @@ var HttpMcpClient = class extends BaseMcpClient {
6765
6771
  if (payload === "") continue;
6766
6772
  return JSON.parse(payload);
6767
6773
  }
6768
- throw new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} returned an event stream with no data payload`, {
6774
+ throw new chunkLPVIRJVF_cjs.NetworkError(`MCP ${this.name} returned an event stream with no data payload`, {
6769
6775
  code: "mcp_http_error"
6770
6776
  });
6771
6777
  }
@@ -6793,7 +6799,7 @@ var HttpMcpClient = class extends BaseMcpClient {
6793
6799
  throw cause;
6794
6800
  }
6795
6801
  if (!response.ok) {
6796
- throw new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} returned ${response.status}`, {
6802
+ throw new chunkLPVIRJVF_cjs.NetworkError(`MCP ${this.name} returned ${response.status}`, {
6797
6803
  code: "mcp_http_error"
6798
6804
  });
6799
6805
  }
@@ -6809,14 +6815,14 @@ var HttpMcpClient = class extends BaseMcpClient {
6809
6815
  function resolveMcpCwd(configCwd) {
6810
6816
  if (configCwd === void 0) return process.cwd();
6811
6817
  if (path.isAbsolute(configCwd)) return configCwd;
6812
- return chunkYTO5BRBD_cjs.safePathJoin(process.cwd(), configCwd);
6818
+ return chunkZT57WTUJ_cjs.safePathJoin(process.cwd(), configCwd);
6813
6819
  }
6814
6820
 
6815
6821
  // src/internal/providers/register-plugin-providers.ts
6816
6822
  function registerPluginProviderProfiles(entries) {
6817
6823
  let registered2 = 0;
6818
6824
  for (const entry of entries) {
6819
- chunkBC5EUG7R_cjs.registerProvider(entry.profile);
6825
+ chunkVUKQL3L2_cjs.registerProvider(entry.profile);
6820
6826
  registered2 += 1;
6821
6827
  }
6822
6828
  return registered2;
@@ -6896,7 +6902,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
6896
6902
  if (exposedSet.has(name)) continue;
6897
6903
  const hint = suggestClosest(name, exposedSet);
6898
6904
  const message = hint !== void 0 ? `[theokit-sdk] personality "${opts?.personalityName ?? "?"}" references unknown tool "${name}"; did you mean "${hint}"?` : `[theokit-sdk] personality "${opts?.personalityName ?? "?"}" references unknown tool "${name}" (not exposed)`;
6899
- chunk3YYDHUNH_cjs.warnOnce(
6905
+ chunk665SFFFR_cjs.warnOnce(
6900
6906
  `personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
6901
6907
  message
6902
6908
  );
@@ -7005,25 +7011,25 @@ function createRealLocalRun(options) {
7005
7011
  }
7006
7012
  var pluginProvidersAnnounced = false;
7007
7013
  function resolveRunProvider(options) {
7008
- chunkBC5EUG7R_cjs.registerBuiltins();
7014
+ chunkVUKQL3L2_cjs.registerBuiltins();
7009
7015
  const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
7010
7016
  const registered2 = registerPluginProviderProfiles(profiles);
7011
7017
  if (registered2 > 0 && !pluginProvidersAnnounced) {
7012
7018
  pluginProvidersAnnounced = true;
7013
7019
  const names = profiles.map((e) => e.profile.name).join(", ");
7014
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] registered ${registered2} plugin provider profile(s): ${names}
7020
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] registered ${registered2} plugin provider profile(s): ${names}
7015
7021
  `);
7016
7022
  }
7017
7023
  const parsedModel = chunkVYHJZVL5_cjs.parseModelId(options.model?.id);
7018
- const modelInferredProvider = parsedModel.provider !== void 0 && chunkBC5EUG7R_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
7019
- const keyInferredProvider = chunkDM6Y5B2G_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
7020
- const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkDM6Y5B2G_cjs.detectPrimaryProvider();
7024
+ const modelInferredProvider = parsedModel.provider !== void 0 && chunkVUKQL3L2_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
7025
+ const keyInferredProvider = chunk2FYEVT2B_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
7026
+ const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunk2FYEVT2B_cjs.detectPrimaryProvider();
7021
7027
  const effectiveModelId = modelInferredProvider !== void 0 && modelInferredProvider === primary ? parsedModel.name : options.model?.id ?? "claude-sonnet-4-6";
7022
7028
  return { primary, effectiveModelId };
7023
7029
  }
7024
7030
  function mergeExplicitApiKey(pools, primary, apiKey) {
7025
7031
  if (apiKey === void 0 || apiKey.length === 0) return pools;
7026
- if (chunkDM6Y5B2G_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
7032
+ if (chunk2FYEVT2B_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
7027
7033
  const existing = pools?.[primary];
7028
7034
  if (existing !== void 0 && existing.length > 0) return pools;
7029
7035
  return { ...pools ?? {}, [primary]: [apiKey] };
@@ -7031,7 +7037,7 @@ function mergeExplicitApiKey(pools, primary, apiKey) {
7031
7037
  function buildLoopInputs(options, runId, userText, userImages) {
7032
7038
  const maxIterations = options.sendOptions.maxIterations;
7033
7039
  if (maxIterations !== void 0 && (!Number.isInteger(maxIterations) || maxIterations < 1)) {
7034
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
7040
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
7035
7041
  `SendOptions.maxIterations must be a positive integer, got ${maxIterations}`,
7036
7042
  { code: "invalid_max_iterations" }
7037
7043
  );
@@ -7046,14 +7052,14 @@ function buildLoopInputs(options, runId, userText, userImages) {
7046
7052
  const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
7047
7053
  const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
7048
7054
  const rateLimitSink = options.sendOptions.onRunEvent;
7049
- const chain = chunkDM6Y5B2G_cjs.resolveProviderChain({
7055
+ const chain = chunk2FYEVT2B_cjs.resolveProviderChain({
7050
7056
  primary,
7051
7057
  ...fallback !== void 0 ? { fallback } : {},
7052
7058
  ...apiKeys !== void 0 ? { apiKeys } : {},
7053
7059
  ...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {},
7054
7060
  ...extractToolCallsFromContent === true ? { extractToolCallsFromContent: true } : {},
7055
7061
  ...rateLimitSink !== void 0 ? {
7056
- onRateLimit: (info) => chunk6DCTL32L_cjs.emitRunEvent(rateLimitSink, { type: "rate_limit", ...info })
7062
+ onRateLimit: (info) => chunkXPR366DL_cjs.emitRunEvent(rateLimitSink, { type: "rate_limit", ...info })
7057
7063
  } : {}
7058
7064
  });
7059
7065
  const llm = chain.length === 1 ? chain[0] : new FallbackLlmClient(chain);
@@ -7328,7 +7334,7 @@ function buildRealRunOptions(args) {
7328
7334
  };
7329
7335
  }
7330
7336
  async function createFixtureRunHelper(args) {
7331
- const sessionMessages = chunk2QMK627M_cjs.getSessionMessages(args.inputs.agentId);
7337
+ const sessionMessages = chunk2D43RD5D_cjs.getSessionMessages(args.inputs.agentId);
7332
7338
  const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
7333
7339
  return createLocalRun({
7334
7340
  agentId: args.inputs.agentId,
@@ -7346,8 +7352,8 @@ async function createFixtureRunHelper(args) {
7346
7352
  });
7347
7353
  }
7348
7354
  async function dispatchLocalRun(args) {
7349
- const apiKey = resolveApiKey(args.inputs.options.apiKey);
7350
- if (chunkDM6Y5B2G_cjs.shouldUseRealLocalRuntime(apiKey)) {
7355
+ const apiKey = chunkBM6N4KHO_cjs.resolveApiKey(args.inputs.options.apiKey);
7356
+ if (chunk2FYEVT2B_cjs.shouldUseRealLocalRuntime(apiKey)) {
7351
7357
  return createRealLocalRun(
7352
7358
  buildRealRunOptions({
7353
7359
  inputs: args.inputs,
@@ -7382,20 +7388,20 @@ async function readProjectMcpServers(cwd) {
7382
7388
 
7383
7389
  // src/internal/local-agent/local-agent-invalidate.ts
7384
7390
  async function applyDeferredInvalidation(agentId, pending, refresh) {
7385
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] applying deferred cache invalidation (${agentId}): ${pending.reason}
7391
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] applying deferred cache invalidation (${agentId}): ${pending.reason}
7386
7392
  `);
7387
7393
  try {
7388
7394
  await refresh();
7389
7395
  } catch (err) {
7390
7396
  const msg = err instanceof Error ? err.message : String(err);
7391
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] invalidateCache reload failed (continuing): ${msg}
7397
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] invalidateCache reload failed (continuing): ${msg}
7392
7398
  `);
7393
7399
  }
7394
7400
  }
7395
7401
  async function invalidateCacheImpl(agentId, reason, options, disposed, dispose, setPending) {
7396
7402
  if (disposed) return;
7397
7403
  if (options.applyNow === true) {
7398
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] invalidateCache applyNow disposing agent (${agentId}): ${reason}
7404
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] invalidateCache applyNow disposing agent (${agentId}): ${reason}
7399
7405
  `);
7400
7406
  await dispose();
7401
7407
  return;
@@ -7456,7 +7462,7 @@ var LiveAgentRegistry = class {
7456
7462
  const existing = this.#agents.get(id);
7457
7463
  if (existing !== void 0 && existing.agent !== agent) {
7458
7464
  void existing.agent.dispose().catch(() => {
7459
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] dispose during overwrite failed (${id})
7465
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] dispose during overwrite failed (${id})
7460
7466
  `);
7461
7467
  });
7462
7468
  }
@@ -7560,7 +7566,7 @@ var LiveAgentRegistry = class {
7560
7566
  await agent.dispose();
7561
7567
  } catch (cause) {
7562
7568
  const msg = cause instanceof Error ? cause.message : String(cause);
7563
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] dispose during eviction failed (${id}): ${msg}
7569
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] dispose during eviction failed (${id}): ${msg}
7564
7570
  `);
7565
7571
  }
7566
7572
  if (this.#onEvict !== void 0) {
@@ -7568,7 +7574,7 @@ var LiveAgentRegistry = class {
7568
7574
  this.#onEvict(id, reason);
7569
7575
  } catch (cause) {
7570
7576
  const msg = cause instanceof Error ? cause.message : String(cause);
7571
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] onEvict listener threw (${id}): ${msg}
7577
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] onEvict listener threw (${id}): ${msg}
7572
7578
  `);
7573
7579
  }
7574
7580
  }
@@ -7584,7 +7590,7 @@ async function acquireLeaseIfPossible(store, agentId) {
7584
7590
  await a.call(store, agentId);
7585
7591
  } catch (err) {
7586
7592
  if (err instanceof Error && err.name === "SessionBusyError") throw err;
7587
- chunkSXSPMRSV_cjs.diag(
7593
+ chunkBM6N4KHO_cjs.diag(
7588
7594
  `[theokit-sdk] writer lease unavailable for ${agentId} (${err instanceof Error ? err.message : String(err)}) \u2014 proceeding without single-writer protection
7589
7595
  `
7590
7596
  );
@@ -7603,16 +7609,16 @@ async function disposeLocalAgentSession(agent) {
7603
7609
  agent.lifecycleAbortController.abort();
7604
7610
  await chunkYLQQX5W2_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
7605
7611
  disposeSessionMcpClients(agent.agentId);
7606
- await chunk2QMK627M_cjs.flushSessionWrites();
7612
+ await chunk2D43RD5D_cjs.flushSessionWrites();
7607
7613
  await flushRegistrySaves(agent.workspaceCwd);
7608
7614
  await disposeSessionStore(agent.sessionStore);
7609
- chunk2QMK627M_cjs.discardSession(agent.workspaceCwd, agent.agentId);
7615
+ chunk2D43RD5D_cjs.discardSession(agent.workspaceCwd, agent.agentId);
7610
7616
  }
7611
7617
  async function reloadLocalAgent(agent) {
7612
7618
  if (agent.context !== void 0) await agent.context.refresh();
7613
7619
  if (agent.skillsManager !== void 0) await agent.skillsManager.refresh();
7614
7620
  if (agent.pluginsManager !== void 0) await agent.pluginsManager.refresh();
7615
- return await chunkRTLUZKDL_cjs.loadSubagents(
7621
+ return await chunkE7FJOO4G_cjs.loadSubagents(
7616
7622
  agent.workspaceCwd,
7617
7623
  agent.settingSourcesIncludeProject,
7618
7624
  agent.options.agents
@@ -7620,12 +7626,12 @@ async function reloadLocalAgent(agent) {
7620
7626
  }
7621
7627
  async function persistActiveMemoryTranscript(cwd, transcript) {
7622
7628
  try {
7623
- const dir = path.join(chunkEQMLJ52C_cjs.memoryDir(cwd), "transcripts", "active-memory");
7629
+ const dir = path.join(chunkBDTVFIPB_cjs.memoryDir(cwd), "transcripts", "active-memory");
7624
7630
  const file = path.join(dir, `${transcript.runId}.json`);
7625
- await chunk2CFEET3Y_cjs.atomicWriteJson(file, transcript);
7631
+ await chunkC4H6PB5J_cjs.atomicWriteJson(file, transcript);
7626
7632
  } catch (cause) {
7627
7633
  const message = cause instanceof Error ? cause.message : String(cause);
7628
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] active-memory transcript persist failed: ${message}
7634
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] active-memory transcript persist failed: ${message}
7629
7635
  `);
7630
7636
  }
7631
7637
  }
@@ -7746,7 +7752,7 @@ async function searchOnce(args, cfg, query, started) {
7746
7752
  return { summary, durationMs: Date.now() - started, status: "ok", hits };
7747
7753
  } catch (cause) {
7748
7754
  const message = cause instanceof Error ? cause.message : String(cause);
7749
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] active-memory recall failed: ${message}
7755
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] active-memory recall failed: ${message}
7750
7756
  `);
7751
7757
  return { summary: void 0, durationMs: Date.now() - started, status: "error", hits: [] };
7752
7758
  }
@@ -7866,7 +7872,7 @@ var azureOpenAiMemoryEmbeddingProviderAdapter = {
7866
7872
  transport: "remote",
7867
7873
  authProviderId: "azure-openai",
7868
7874
  autoSelectPriority: 25,
7869
- create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
7875
+ create: (options) => chunkRAHSWE5C_cjs.createOpenAiCompatibleRuntime(
7870
7876
  {
7871
7877
  id: "azure-openai",
7872
7878
  defaultBaseUrl: "https://your-resource.openai.azure.com",
@@ -7902,7 +7908,7 @@ var cohereMemoryEmbeddingProviderAdapter = {
7902
7908
  transport: "remote",
7903
7909
  authProviderId: "cohere",
7904
7910
  autoSelectPriority: 30,
7905
- create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
7911
+ create: (options) => chunkRAHSWE5C_cjs.createOpenAiCompatibleRuntime(
7906
7912
  {
7907
7913
  id: "cohere",
7908
7914
  defaultBaseUrl: "https://api.cohere.com",
@@ -7948,7 +7954,7 @@ var deepinfraMemoryEmbeddingProviderAdapter = {
7948
7954
  transport: "remote",
7949
7955
  authProviderId: "deepinfra",
7950
7956
  autoSelectPriority: 13,
7951
- create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
7957
+ create: (options) => chunkRAHSWE5C_cjs.createOpenAiCompatibleRuntime(
7952
7958
  {
7953
7959
  id: "deepinfra",
7954
7960
  defaultBaseUrl: "https://api.deepinfra.com",
@@ -7974,7 +7980,7 @@ var geminiMemoryEmbeddingProviderAdapter = {
7974
7980
  transport: "remote",
7975
7981
  authProviderId: "gemini",
7976
7982
  autoSelectPriority: 30,
7977
- create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
7983
+ create: (options) => chunkRAHSWE5C_cjs.createOpenAiCompatibleRuntime(
7978
7984
  {
7979
7985
  id: "gemini",
7980
7986
  defaultBaseUrl: "https://generativelanguage.googleapis.com",
@@ -8002,7 +8008,7 @@ var jinaMemoryEmbeddingProviderAdapter = {
8002
8008
  transport: "remote",
8003
8009
  authProviderId: "jina",
8004
8010
  autoSelectPriority: 35,
8005
- create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
8011
+ create: (options) => chunkRAHSWE5C_cjs.createOpenAiCompatibleRuntime(
8006
8012
  {
8007
8013
  id: "jina",
8008
8014
  defaultBaseUrl: "https://api.jina.ai",
@@ -8025,7 +8031,7 @@ var mistralMemoryEmbeddingProviderAdapter = {
8025
8031
  transport: "remote",
8026
8032
  authProviderId: "mistral",
8027
8033
  autoSelectPriority: 18,
8028
- create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
8034
+ create: (options) => chunkRAHSWE5C_cjs.createOpenAiCompatibleRuntime(
8029
8035
  {
8030
8036
  id: "mistral",
8031
8037
  defaultBaseUrl: "https://api.mistral.ai",
@@ -8067,7 +8073,7 @@ var ollamaMemoryEmbeddingProviderAdapter = {
8067
8073
  autoSelectPriority: 10,
8068
8074
  create: (options) => {
8069
8075
  const apiKey = options.apiKey ?? process.env.OLLAMA_API_KEY ?? OLLAMA_LOCAL_SENTINEL_KEY;
8070
- return chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
8076
+ return chunkRAHSWE5C_cjs.createOpenAiCompatibleRuntime(
8071
8077
  {
8072
8078
  id: "ollama",
8073
8079
  defaultBaseUrl: "http://localhost:11434",
@@ -8094,7 +8100,7 @@ var openAiMemoryEmbeddingProviderAdapter = {
8094
8100
  transport: "remote",
8095
8101
  authProviderId: "openai",
8096
8102
  autoSelectPriority: 20,
8097
- create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
8103
+ create: (options) => chunkRAHSWE5C_cjs.createOpenAiCompatibleRuntime(
8098
8104
  {
8099
8105
  id: "openai",
8100
8106
  defaultBaseUrl: "https://api.openai.com",
@@ -8121,7 +8127,7 @@ var openRouterMemoryEmbeddingProviderAdapter = {
8121
8127
  transport: "remote",
8122
8128
  authProviderId: "openrouter",
8123
8129
  autoSelectPriority: 15,
8124
- create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
8130
+ create: (options) => chunkRAHSWE5C_cjs.createOpenAiCompatibleRuntime(
8125
8131
  {
8126
8132
  id: "openrouter",
8127
8133
  defaultBaseUrl: "https://openrouter.ai/api",
@@ -8149,7 +8155,7 @@ var voyageMemoryEmbeddingProviderAdapter = {
8149
8155
  transport: "remote",
8150
8156
  authProviderId: "voyage",
8151
8157
  autoSelectPriority: 14,
8152
- create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
8158
+ create: (options) => chunkRAHSWE5C_cjs.createOpenAiCompatibleRuntime(
8153
8159
  {
8154
8160
  id: "voyage",
8155
8161
  defaultBaseUrl: "https://api.voyageai.com",
@@ -8250,7 +8256,7 @@ function createMemorySearchTool(opts) {
8250
8256
  };
8251
8257
  }
8252
8258
  function createMemoryGetTool(opts) {
8253
- const memoryRoot = path.resolve(chunkEQMLJ52C_cjs.memoryDir(opts.cwd));
8259
+ const memoryRoot = path.resolve(chunkBDTVFIPB_cjs.memoryDir(opts.cwd));
8254
8260
  return {
8255
8261
  name: "memory_get",
8256
8262
  description: GET_DESCRIPTION,
@@ -8261,7 +8267,7 @@ function createMemoryGetTool(opts) {
8261
8267
  const lines = readNumber(input.lines);
8262
8268
  const resolved = path.resolve(memoryRoot, relPath);
8263
8269
  if (!isPathInside(memoryRoot, resolved)) {
8264
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
8270
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
8265
8271
  `memory_get rejected path that escapes memory root: ${relPath}`,
8266
8272
  { code: "memory_path_escapes_root" }
8267
8273
  );
@@ -8281,7 +8287,7 @@ function readString(value, errorIfMissing, allowUndefined = false) {
8281
8287
  if (typeof value === "string") return value;
8282
8288
  if (allowUndefined && (value === void 0 || value === null)) return "";
8283
8289
  if (errorIfMissing !== void 0) {
8284
- throw new chunk2YGIBOUH_cjs.ConfigurationError(errorIfMissing, { code: "memory_tool_bad_args" });
8290
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(errorIfMissing, { code: "memory_tool_bad_args" });
8285
8291
  }
8286
8292
  return "";
8287
8293
  }
@@ -8356,7 +8362,7 @@ var LocalAgentMemory = class {
8356
8362
  const openOpts = { cwd: this.workspaceCwd };
8357
8363
  if (embedding !== void 0) openOpts.embedding = embedding;
8358
8364
  if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
8359
- this.index = await chunkEQMLJ52C_cjs.IndexManager.open(openOpts);
8365
+ this.index = await chunkBDTVFIPB_cjs.IndexManager.open(openOpts);
8360
8366
  await this.index.sync();
8361
8367
  this.toolsCache = [
8362
8368
  createMemorySearchTool({ index: this.index }),
@@ -8371,7 +8377,7 @@ var LocalAgentMemory = class {
8371
8377
  const warned2 = g[sym];
8372
8378
  if (!warned2.has(message)) {
8373
8379
  warned2.add(message);
8374
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] memory tools unavailable: ${message}
8380
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] memory tools unavailable: ${message}
8375
8381
  `);
8376
8382
  }
8377
8383
  return void 0;
@@ -8380,7 +8386,7 @@ var LocalAgentMemory = class {
8380
8386
  async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
8381
8387
  const cfg = this.options.memory?.activeRecall;
8382
8388
  if (cfg?.enabled !== true || this.index === void 0) return void 0;
8383
- if (this.breaker === void 0) this.breaker = new chunkDM6Y5B2G_cjs.CircuitBreaker();
8389
+ if (this.breaker === void 0) this.breaker = new chunk2FYEVT2B_cjs.CircuitBreaker();
8384
8390
  if (this.cache === void 0) this.cache = new ActiveMemoryCache();
8385
8391
  const result = await runActiveMemory({
8386
8392
  userText,
@@ -8430,7 +8436,7 @@ var LocalAgentMemory = class {
8430
8436
  await this.index.sync();
8431
8437
  } catch (cause) {
8432
8438
  const message = cause instanceof Error ? cause.message : String(cause);
8433
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] session index sync failed: ${message}
8439
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] session index sync failed: ${message}
8434
8440
  `);
8435
8441
  }
8436
8442
  }
@@ -8443,7 +8449,7 @@ var LocalAgentMemory = class {
8443
8449
  return await adapter.create(cfg.model !== void 0 ? { model: cfg.model } : {});
8444
8450
  } catch (cause) {
8445
8451
  const message = cause instanceof Error ? cause.message : String(cause);
8446
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] memory embedding ${cfg.provider} unavailable: ${message}
8452
+ chunkBM6N4KHO_cjs.diag(`[theokit-sdk] memory embedding ${cfg.provider} unavailable: ${message}
8447
8453
  `);
8448
8454
  return void 0;
8449
8455
  }
@@ -8479,7 +8485,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
8479
8485
  ...partial?.metadata !== void 0 ? { metadata: partial.metadata } : defaultContext?.metadata !== void 0 ? { metadata: defaultContext.metadata } : {}
8480
8486
  };
8481
8487
  if (merged.userId === "") {
8482
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
8488
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
8483
8489
  "agent.memory requires a userId \u2014 either set AgentOptions.memoryContext.userId or pass ctx.userId at call time.",
8484
8490
  { code: "memory_context_missing_user_id" }
8485
8491
  );
@@ -8489,7 +8495,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
8489
8495
  async function requireAdapters() {
8490
8496
  const r = await ensure();
8491
8497
  if (r.adapters.length === 0) {
8492
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
8498
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
8493
8499
  "No memory adapter registered. Pass a memory plugin in AgentOptions.plugins (e.g. supermemoryMemory({...})).",
8494
8500
  { code: "no_memory_adapter" }
8495
8501
  );
@@ -8530,7 +8536,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
8530
8536
  const prefix = id.split(":", 1)[0] ?? "";
8531
8537
  const target = adapters.find((a) => a.id === prefix);
8532
8538
  if (target === void 0) {
8533
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
8539
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
8534
8540
  `No adapter found for MemoryId prefix "${prefix}" (registered: ${adapters.map((a) => a.id).join(", ")}).`,
8535
8541
  { code: "no_memory_adapter" }
8536
8542
  );
@@ -8603,7 +8609,7 @@ function createLocalAgentMemoryProvider(opts) {
8603
8609
  return { facts: [], systemPromptAdditions: summary };
8604
8610
  },
8605
8611
  async recordSessionSummary(args) {
8606
- await chunkEQMLJ52C_cjs.writeSessionSummary(args);
8612
+ await chunkBDTVFIPB_cjs.writeSessionSummary(args);
8607
8613
  },
8608
8614
  async sync(handle) {
8609
8615
  const state = handle[INTERNAL_LAM_KEY];
@@ -8681,19 +8687,19 @@ var PersonalityRegistry = class _PersonalityRegistry {
8681
8687
  function addEntity(byName, entity, origin, collisionMap) {
8682
8688
  const fm = entity.frontmatter;
8683
8689
  if (PersonalityRegistry.isReservedClearSlug(fm.name)) {
8684
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
8690
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
8685
8691
  `Personality name "${fm.name}" is reserved (used to clear active preset)`,
8686
8692
  { code: "personality_reserved_name" }
8687
8693
  );
8688
8694
  }
8689
8695
  if (entity.body.trim().length === 0) {
8690
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
8696
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
8691
8697
  `Personality "${fm.name}" has empty body (system prompt required)`,
8692
8698
  { code: "personality_empty_body" }
8693
8699
  );
8694
8700
  }
8695
8701
  if (origin === "project" && collisionMap?.has(fm.name)) {
8696
- chunk3YYDHUNH_cjs.warnOnce(
8702
+ chunk665SFFFR_cjs.warnOnce(
8697
8703
  `personality-collision-${fm.name}`,
8698
8704
  `[theokit-sdk] personality "${fm.name}" overridden by project preset`
8699
8705
  );
@@ -8722,7 +8728,7 @@ async function performPersonalitySwitch(args) {
8722
8728
  const preset = args.registry.get(args.requestedName);
8723
8729
  if (preset === void 0) {
8724
8730
  const available = args.registry.all().map((p) => p.name).join(", ") || "(none)";
8725
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
8731
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
8726
8732
  `Personality "${args.requestedName}" not found. Available: ${available}`,
8727
8733
  { code: "personality_not_found" }
8728
8734
  );
@@ -8743,14 +8749,14 @@ async function performPersonalitySwitch(args) {
8743
8749
 
8744
8750
  // src/internal/local-agent/local-agent-personality-extensions.ts
8745
8751
  function resolveActivePersonalityPreset(args) {
8746
- const forkCtx = chunk3YYDHUNH_cjs.currentPersonalityContext();
8752
+ const forkCtx = chunk665SFFFR_cjs.currentPersonalityContext();
8747
8753
  const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
8748
8754
  if (slug === void 0) return void 0;
8749
8755
  return args.personalityRegistry?.get(slug);
8750
8756
  }
8751
8757
  async function ensurePersonalityRegistryIfNeeded(args) {
8752
8758
  if (args.personalityRegistry !== void 0) return args.personalityRegistry;
8753
- const forkSlug = chunk3YYDHUNH_cjs.currentPersonalityContext()?.slug;
8759
+ const forkSlug = chunk665SFFFR_cjs.currentPersonalityContext()?.slug;
8754
8760
  const ownSlug = args.personalityStore.active(args.agentId);
8755
8761
  if (forkSlug === void 0 && ownSlug === void 0) return void 0;
8756
8762
  return await PersonalityRegistry.load(args.workspaceCwd);
@@ -8764,8 +8770,8 @@ ${preset.systemPrompt}`;
8764
8770
  }
8765
8771
  async function localAgentUsePersonality(args) {
8766
8772
  if (args.disposed) throw new Error("Agent has been disposed");
8767
- if (chunk3YYDHUNH_cjs.currentPersonalityContext() !== void 0) {
8768
- chunk3YYDHUNH_cjs.warnPersonalitySwitchInsideFork(args.agentId);
8773
+ if (chunk665SFFFR_cjs.currentPersonalityContext() !== void 0) {
8774
+ chunk665SFFFR_cjs.warnPersonalitySwitchInsideFork(args.agentId);
8769
8775
  return null;
8770
8776
  }
8771
8777
  let registry = args.personalityRegistry;
@@ -8782,8 +8788,8 @@ async function localAgentUsePersonality(args) {
8782
8788
  registry,
8783
8789
  store: args.personalityStore,
8784
8790
  invalidateCache: (reason) => args.invalidateCache(reason),
8785
- appendSessionMessage: (msg) => chunk2QMK627M_cjs.appendSessionMessage(args.agentId, msg),
8786
- clearSession: () => chunk2QMK627M_cjs.clearSession(args.agentId),
8791
+ appendSessionMessage: (msg) => chunk2D43RD5D_cjs.appendSessionMessage(args.agentId, msg),
8792
+ clearSession: () => chunk2D43RD5D_cjs.clearSession(args.agentId),
8787
8793
  opts: args.opts ?? {}
8788
8794
  })
8789
8795
  );
@@ -8794,7 +8800,7 @@ function localAgentRunUntil(agent, goal, options) {
8794
8800
  async function* wrap() {
8795
8801
  const { runUntilImpl } = await import('./run-until-U2B5FJJI.cjs');
8796
8802
  const buildDeps = async () => {
8797
- const { judgeCallImpl } = await import('./judge-call-GVIJWQVE.cjs');
8803
+ const { judgeCallImpl } = await import('./judge-call-G5SGV2M2.cjs');
8798
8804
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
8799
8805
  const create = getAgentFacade().create;
8800
8806
  return {
@@ -8827,7 +8833,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
8827
8833
  async function localAgentFork(parent, options) {
8828
8834
  const { forkAgentImpl } = await import('./fork-agent-Y2IK2RYU.cjs');
8829
8835
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
8830
- const { withPersonalityContext } = await import('./context-4HGPCOH6.cjs');
8836
+ const { withPersonalityContext } = await import('./context-7USNN6LP.cjs');
8831
8837
  const create = getAgentFacade().create;
8832
8838
  return withPersonalityContext(
8833
8839
  { slug: parent.personalitySlugSnapshot, isFork: true },
@@ -8887,7 +8893,7 @@ function wrapRunWithCompletionCheck(args) {
8887
8893
  judgeOpts
8888
8894
  );
8889
8895
  const complete = !verdict.parseFailed && verdict.verdict === "done";
8890
- chunk6DCTL32L_cjs.emitRunEvent(args.onRunEvent, {
8896
+ chunkXPR366DL_cjs.emitRunEvent(args.onRunEvent, {
8891
8897
  type: "completion_check",
8892
8898
  complete,
8893
8899
  reason: verdict.reason
@@ -9034,7 +9040,7 @@ function wrapRunWithOutputProcessors(args) {
9034
9040
  if (result.status !== "finished" || result.result === void 0) return result;
9035
9041
  const res = await runOutputProcessors(args.processors, result.result, args.agentId);
9036
9042
  if (res.kind === "ok") return { ...result, result: res.value };
9037
- chunk6DCTL32L_cjs.emitRunEvent(args.onRunEvent, {
9043
+ chunkXPR366DL_cjs.emitRunEvent(args.onRunEvent, {
9038
9044
  type: "tripwire",
9039
9045
  reason: res.tripwire.reason,
9040
9046
  processorId: res.tripwire.processorId
@@ -9109,7 +9115,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
9109
9115
  }
9110
9116
  const res = await runInputProcessors(processors, rawUserText, inputs.agentId);
9111
9117
  if (res.kind === "tripwire") {
9112
- chunk6DCTL32L_cjs.emitRunEvent(options.onRunEvent, {
9118
+ chunkXPR366DL_cjs.emitRunEvent(options.onRunEvent, {
9113
9119
  type: "tripwire",
9114
9120
  reason: res.tripwire.reason,
9115
9121
  processorId: res.tripwire.processorId
@@ -9126,7 +9132,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
9126
9132
  return { userText: res.value, effectiveMessage };
9127
9133
  }
9128
9134
  async function executeSendLocked(inputs, message, options) {
9129
- if (inputs.disposed) throw new chunk2YGIBOUH_cjs.AgentDisposedError(inputs.agentId);
9135
+ if (inputs.disposed) throw new chunkLPVIRJVF_cjs.AgentDisposedError(inputs.agentId);
9130
9136
  await consumePending(inputs.agentId, inputs.invalidationPending, inputs.clearInvalidation, inputs.reload);
9131
9137
  const sendModel = normalizeModel(options.model);
9132
9138
  inputs.applyModelOverride(sendModel);
@@ -9137,7 +9143,7 @@ async function executeSendLocked(inputs, message, options) {
9137
9143
  if (inputs.options.onBeforeSend !== void 0) {
9138
9144
  await inputs.options.onBeforeSend({
9139
9145
  conversationId: inputs.agentId,
9140
- previousMessageCount: chunk2QMK627M_cjs.getSessionMessages(inputs.agentId).length
9146
+ previousMessageCount: chunk2D43RD5D_cjs.getSessionMessages(inputs.agentId).length
9141
9147
  });
9142
9148
  }
9143
9149
  await inputs.runPreHook(userText);
@@ -9149,8 +9155,8 @@ async function executeSendLocked(inputs, message, options) {
9149
9155
  userText,
9150
9156
  sendOptions: options
9151
9157
  });
9152
- const priorMessages = [...chunk2QMK627M_cjs.getSessionMessages(inputs.agentId)];
9153
- chunk2QMK627M_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
9158
+ const priorMessages = [...chunk2D43RD5D_cjs.getSessionMessages(inputs.agentId)];
9159
+ chunk2D43RD5D_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
9154
9160
  await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
9155
9161
  const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory);
9156
9162
  const portPathActive = shouldUsePortMemoryPath();
@@ -9208,7 +9214,7 @@ async function executeSendLocked(inputs, message, options) {
9208
9214
  function buildCompletionCheckDeps() {
9209
9215
  return {
9210
9216
  judge: async (ctx, opts) => {
9211
- const { judgeCallImpl } = await import('./judge-call-GVIJWQVE.cjs');
9217
+ const { judgeCallImpl } = await import('./judge-call-G5SGV2M2.cjs');
9212
9218
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
9213
9219
  return judgeCallImpl(ctx, opts, { create: getAgentFacade().create });
9214
9220
  }
@@ -9228,7 +9234,7 @@ function registerRunAsTask(run, agentId, taskOpt, userText) {
9228
9234
  promptPreview: userText.slice(0, 120),
9229
9235
  ...opts.meta ?? {}
9230
9236
  };
9231
- void chunk6DCTL32L_cjs.submit({
9237
+ void chunkXPR366DL_cjs.submit({
9232
9238
  kind: "run",
9233
9239
  work: async (ctx) => {
9234
9240
  ctx.signal.addEventListener(
@@ -9260,8 +9266,9 @@ var LocalAgent = class {
9260
9266
  options;
9261
9267
  workspaceCwd;
9262
9268
  /**
9263
- * SE40 — base dir for the native Claude-shaped session transcript. Default
9264
- * `~/.theokit`; set `local.baseDir: "~/.claude"` for Claude Code CLI interop.
9269
+ * Directory for the native Claude-shaped session transcript. Default
9270
+ * `~/.theokit`; set `local.sessionDir: "~/.claude"` for Claude Code CLI interop.
9271
+ * (`local.baseDir` is the deprecated name for the same option — #301.)
9265
9272
  */
9266
9273
  transcriptBaseDir;
9267
9274
  /**
@@ -9311,8 +9318,8 @@ var LocalAgent = class {
9311
9318
  this.model = normalizeModel(options.model);
9312
9319
  this.options = options;
9313
9320
  this.workspaceCwd = resolveCwd(options.local?.cwd);
9314
- this.transcriptBaseDir = resolveBaseDir(options.local?.baseDir);
9315
- this.sessionStore = options.local?.sessionStore ?? new chunkT5ZWI3MC_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
9321
+ this.transcriptBaseDir = resolveSessionDir(options.local);
9322
+ this.sessionStore = options.local?.sessionStore ?? new chunkOUOXM36O_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
9316
9323
  this.settingSourcesIncludeProject = includesSetting(options, "project");
9317
9324
  this.settingSourcesIncludePlugins = includesSetting(options, "plugins");
9318
9325
  const sub = bootstrapSubmanagers({
@@ -9355,14 +9362,14 @@ var LocalAgent = class {
9355
9362
  if (this.pluginsManager !== void 0) await this.pluginsManager.initialize();
9356
9363
  const codePlugins = chunkBV2MWEMV_cjs.extractCodePlugins(this.options.plugins);
9357
9364
  await this.pluginManagerCode.initialize(codePlugins);
9358
- this.resolvedSubagents = await chunkRTLUZKDL_cjs.loadSubagents(
9365
+ this.resolvedSubagents = await chunkE7FJOO4G_cjs.loadSubagents(
9359
9366
  this.workspaceCwd,
9360
9367
  this.settingSourcesIncludeProject,
9361
9368
  this.options.agents
9362
9369
  );
9363
9370
  await acquireLeaseIfPossible(this.sessionStore, this.agentId);
9364
9371
  try {
9365
- await chunk2QMK627M_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
9372
+ await chunk2D43RD5D_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
9366
9373
  await this.personalityStore.hydrate(this.agentId);
9367
9374
  } catch (err) {
9368
9375
  await releaseLeaseIfPossible(this.sessionStore, this.agentId);
@@ -9511,7 +9518,7 @@ var LocalAgent = class {
9511
9518
  agentId: this.agentId
9512
9519
  });
9513
9520
  if (preRun.blocked) {
9514
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
9521
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
9515
9522
  `preRun hook denied execution: ${preRun.reason ?? "unspecified"}`,
9516
9523
  { code: "hook_denied" }
9517
9524
  );
@@ -9592,7 +9599,7 @@ var LocalAgent = class {
9592
9599
  }
9593
9600
  // biome-ignore format: G8 budget — see listArtifacts.
9594
9601
  downloadArtifact(_path) {
9595
- return Promise.reject(new chunk2YGIBOUH_cjs.UnsupportedRunOperationError("Artifacts are not supported for local agents", "downloadArtifact"));
9602
+ return Promise.reject(new chunkLPVIRJVF_cjs.UnsupportedRunOperationError("Artifacts are not supported for local agents", "downloadArtifact"));
9596
9603
  }
9597
9604
  // biome-ignore format: G8 budget — delegates to `local-agent-runtime-extensions.ts`; kept 1-line.
9598
9605
  runUntil(goal, options) {
@@ -9614,9 +9621,6 @@ var LocalAgent = class {
9614
9621
  function resolveCwd(cwd) {
9615
9622
  return (Array.isArray(cwd) ? cwd[0] : cwd) ?? process.cwd();
9616
9623
  }
9617
- function resolveBaseDir(baseDir) {
9618
- return baseDir === void 0 ? chunkECPL5RV6_cjs.defaultBaseDir() : chunkECPL5RV6_cjs.expandTilde(baseDir);
9619
- }
9620
9624
  function includesSetting(options, source) {
9621
9625
  const sources = options.local?.settingSources;
9622
9626
  return sources !== void 0 && (sources.includes(source) || sources.includes("all"));
@@ -9640,7 +9644,7 @@ async function guardAgainstIdCollision(options) {
9640
9644
  const persistenceCwd = resolveAgentPersistenceCwd(options);
9641
9645
  await hydrateRegistryFromDisk(persistenceCwd);
9642
9646
  if (getRegisteredAgent(options.agentId) !== void 0) {
9643
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
9647
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
9644
9648
  `Agent "${options.agentId}" already exists. Use Agent.resume("${options.agentId}") to reattach, or pick a different agentId.`,
9645
9649
  { code: "agent_id_already_exists" }
9646
9650
  );
@@ -9673,7 +9677,7 @@ async function maybeInjectHandoffTools(options) {
9673
9677
  const spec = "@theokit/sdk-handoff/internal/tool-injector";
9674
9678
  mod = await import(spec);
9675
9679
  } catch (err) {
9676
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
9680
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
9677
9681
  "Agent.create({ handoffs: [...] }) requires @theokit/sdk-handoff. Install it: pnpm add @theokit/sdk-handoff. Or migrate to the preferred plugin pattern: plugins: [Handoff.asPlugin({ targets: [...] })] (see docs/migration/1-x-to-2-0.md#handoff).",
9678
9682
  { code: "handoff_package_missing", cause: err }
9679
9683
  );
@@ -9691,11 +9695,11 @@ async function maybeInjectHandoffTools(options) {
9691
9695
  };
9692
9696
  }
9693
9697
  async function createLocalAgent(options) {
9694
- const apiKey = resolveApiKey(options.apiKey);
9698
+ const apiKey = chunkBM6N4KHO_cjs.resolveApiKey(options.apiKey);
9695
9699
  if (apiKey === void 0) {
9696
- throw new chunk2YGIBOUH_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
9700
+ throw new chunkLPVIRJVF_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
9697
9701
  }
9698
- const willFlowToProvider = !chunkDM6Y5B2G_cjs.isFixtureApiKey(apiKey) && !chunkDM6Y5B2G_cjs.shouldUseRealLocalRuntime(apiKey);
9702
+ const willFlowToProvider = !chunk2FYEVT2B_cjs.isFixtureApiKey(apiKey) && !chunk2FYEVT2B_cjs.shouldUseRealLocalRuntime(apiKey);
9699
9703
  const shape = validateApiKeyShape(apiKey, {
9700
9704
  strict: willFlowToProvider,
9701
9705
  // `options.model` is already normalized by `runCreateUnderSpan`; `normalizeModel`
@@ -9704,10 +9708,10 @@ async function createLocalAgent(options) {
9704
9708
  ...willFlowToProvider ? { provider: providerFromModelId(normalizeModel(options.model)?.id) } : {}
9705
9709
  });
9706
9710
  if (shape.malformed) {
9707
- throw new chunk2YGIBOUH_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
9711
+ throw new chunkLPVIRJVF_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
9708
9712
  }
9709
- if (!chunkDM6Y5B2G_cjs.isFixtureApiKey(apiKey) && chunkDM6Y5B2G_cjs.getConfiguredBaseUrl() === void 0 && !chunkDM6Y5B2G_cjs.shouldUseRealLocalRuntime(apiKey)) {
9710
- throw new chunk2YGIBOUH_cjs.AuthenticationError("Invalid API key", {
9713
+ if (!chunk2FYEVT2B_cjs.isFixtureApiKey(apiKey) && chunk2FYEVT2B_cjs.getConfiguredBaseUrl() === void 0 && !chunk2FYEVT2B_cjs.shouldUseRealLocalRuntime(apiKey)) {
9714
+ throw new chunkLPVIRJVF_cjs.AuthenticationError("Invalid API key", {
9711
9715
  code: "authentication_error"
9712
9716
  });
9713
9717
  }
@@ -9716,21 +9720,21 @@ async function createLocalAgent(options) {
9716
9720
  return agent;
9717
9721
  }
9718
9722
  async function createCloudAgent(options) {
9719
- const apiKey = resolveApiKey(options.apiKey);
9723
+ const apiKey = chunkBM6N4KHO_cjs.resolveApiKey(options.apiKey);
9720
9724
  if (apiKey === void 0) {
9721
- throw new chunk2YGIBOUH_cjs.ConfigurationError("Missing API key for cloud agent", {
9725
+ throw new chunkLPVIRJVF_cjs.ConfigurationError("Missing API key for cloud agent", {
9722
9726
  code: "missing_api_key"
9723
9727
  });
9724
9728
  }
9725
9729
  const shape = validateApiKeyShape(apiKey);
9726
9730
  if (shape.malformed) {
9727
- throw new chunk2YGIBOUH_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
9731
+ throw new chunkLPVIRJVF_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
9728
9732
  }
9729
- const baseUrl = chunkDM6Y5B2G_cjs.getConfiguredBaseUrl();
9733
+ const baseUrl = chunk2FYEVT2B_cjs.getConfiguredBaseUrl();
9730
9734
  if (baseUrl === void 0) {
9731
9735
  return new CloudAgent(options);
9732
9736
  }
9733
- const response = await chunkDM6Y5B2G_cjs.httpRequest("/v1/agents", {
9737
+ const response = await chunk2FYEVT2B_cjs.httpRequest("/v1/agents", {
9734
9738
  apiKey,
9735
9739
  method: "POST",
9736
9740
  body: {
@@ -9755,7 +9759,7 @@ function resolveAgentPersistenceCwd(options) {
9755
9759
  return process.cwd();
9756
9760
  }
9757
9761
  async function rehydrateExistingAgent(agentId, existing, options) {
9758
- await chunkDM6Y5B2G_cjs.discoverProviderPlugins();
9762
+ await chunk2FYEVT2B_cjs.discoverProviderPlugins();
9759
9763
  await validateRehydratedAgent(agentId, existing);
9760
9764
  const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
9761
9765
  const mergedOptions = {
@@ -9786,7 +9790,7 @@ async function validateRehydratedAgent(agentId, entry) {
9786
9790
  throw new Error(`Workspace path is not a directory: ${candidate}`);
9787
9791
  }
9788
9792
  } catch (cause) {
9789
- throw new chunk2YGIBOUH_cjs.UnknownAgentError(
9793
+ throw new chunkLPVIRJVF_cjs.UnknownAgentError(
9790
9794
  `Agent "${agentId}" cannot be rehydrated \u2014 workspace cwd "${candidate}" is missing or inaccessible.`,
9791
9795
  { code: "agent_rehydration_failed", cause }
9792
9796
  );
@@ -9838,7 +9842,7 @@ async function getRegisteredAgentOrThrow(agentId) {
9838
9842
  agent = getRegisteredAgent(agentId);
9839
9843
  }
9840
9844
  if (agent === void 0) {
9841
- throw new chunk2YGIBOUH_cjs.UnknownAgentError(`Agent ${agentId} not found`, { code: "unknown_agent" });
9845
+ throw new chunkLPVIRJVF_cjs.UnknownAgentError(`Agent ${agentId} not found`, { code: "unknown_agent" });
9842
9846
  }
9843
9847
  return agent;
9844
9848
  }
@@ -9883,7 +9887,7 @@ var Agent = class _Agent {
9883
9887
  pluginCount: enabledPluginNames(options.plugins).length
9884
9888
  });
9885
9889
  try {
9886
- await chunkDM6Y5B2G_cjs.discoverProviderPlugins();
9890
+ await chunk2FYEVT2B_cjs.discoverProviderPlugins();
9887
9891
  const agent = await runCreateUnderSpan(options, span);
9888
9892
  return agent;
9889
9893
  } catch (err) {
@@ -9895,7 +9899,22 @@ var Agent = class _Agent {
9895
9899
  }
9896
9900
  }
9897
9901
  /**
9898
- * One-shot prompt: create an agent, send a single message, wait, dispose.
9902
+ * One-shot prompt: create an agent, send a single message, wait, **dispose**.
9903
+ *
9904
+ * `Agent.prompt` is STATIC and owns the agent's whole lifecycle. To send to an
9905
+ * agent you already hold, use the instance method — `agent.send(message)` —
9906
+ * which keeps the conversation and does not dispose anything:
9907
+ *
9908
+ * ```ts
9909
+ * const agent = await Agent.create({ ... });
9910
+ * const run = await agent.send("first"); // NOT agent.prompt(...)
9911
+ * const run2 = await agent.send("follow-up"); // full context retained
9912
+ * ```
9913
+ *
9914
+ * There is no `agent.prompt()` (#302). The natural sentence for the second
9915
+ * operation is "prompt the agent", so it is the method people reach for; the
9916
+ * two differ in whether the agent survives the call, which is why they do not
9917
+ * share a name.
9899
9918
  *
9900
9919
  * When `options.throwOnError === true`, rejects with `AgentRunError` if
9901
9920
  * the run terminates with `status: 'error'` (instead of resolving with the
@@ -9909,8 +9928,8 @@ var Agent = class _Agent {
9909
9928
  const run = await agent.send(message);
9910
9929
  const result = await run.wait();
9911
9930
  if (options.throwOnError === true && result.status === "error" && result.error !== void 0) {
9912
- throw new chunk2YGIBOUH_cjs.AgentRunError(result.error.message, {
9913
- code: chunk2YGIBOUH_cjs.coerceToKnownAgentRunErrorCode(result.error.code),
9931
+ throw new chunkLPVIRJVF_cjs.AgentRunError(result.error.message, {
9932
+ code: chunkLPVIRJVF_cjs.coerceToKnownAgentRunErrorCode(result.error.code),
9914
9933
  cause: result.error.cause
9915
9934
  });
9916
9935
  }
@@ -9937,7 +9956,7 @@ var Agent = class _Agent {
9937
9956
  if (existing !== void 0) {
9938
9957
  return await rehydrateExistingAgent(agentId, existing, options);
9939
9958
  }
9940
- throw new chunk2YGIBOUH_cjs.UnknownAgentError(
9959
+ throw new chunkLPVIRJVF_cjs.UnknownAgentError(
9941
9960
  `Agent "${agentId}" not found. Use Agent.create({ agentId, ... }) for first-time setup, or catch UnknownAgentError to branch resume-vs-create.`,
9942
9961
  { code: "unknown_agent" }
9943
9962
  );
@@ -9966,7 +9985,7 @@ var Agent = class _Agent {
9966
9985
  * @public
9967
9986
  */
9968
9987
  static async generateObject(options) {
9969
- const { generateObjectImpl } = await import('./generate-object-E465DX5I.cjs');
9988
+ const { generateObjectImpl } = await import('./generate-object-AVXOJK2I.cjs');
9970
9989
  return generateObjectImpl(options, {
9971
9990
  create: (opts) => _Agent.create(opts),
9972
9991
  delete: (agentId) => _Agent.delete(agentId)
@@ -9990,7 +10009,7 @@ var Agent = class _Agent {
9990
10009
  delete: (agentId) => _Agent.delete(agentId)
9991
10010
  };
9992
10011
  async function* wrapper() {
9993
- streamObjectImport ??= import('./stream-object-T4DAMNVB.cjs');
10012
+ streamObjectImport ??= import('./stream-object-L3Q7PBMF.cjs');
9994
10013
  const { streamObjectImpl } = await streamObjectImport;
9995
10014
  yield* streamObjectImpl(options, deps);
9996
10015
  }
@@ -10014,7 +10033,7 @@ var Agent = class _Agent {
10014
10033
  * @public
10015
10034
  */
10016
10035
  static async batch(prompts, options) {
10017
- const { batchImpl } = await import('./batch-WQ3AJCDV.cjs');
10036
+ const { batchImpl } = await import('./batch-ZEFN5SO7.cjs');
10018
10037
  return batchImpl(prompts, options, { create: (opts) => _Agent.create(opts) });
10019
10038
  }
10020
10039
  /**
@@ -10094,14 +10113,14 @@ var Agent = class _Agent {
10094
10113
  */
10095
10114
  static async getRun(runId, options = {}) {
10096
10115
  if (options.runtime === "cloud") {
10097
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
10116
+ throw new chunkLPVIRJVF_cjs.ConfigurationError(
10098
10117
  "Cloud runtime is pre-release. Theo PaaS endpoints are not wired yet \u2014 getRun({ runtime: 'cloud' }) will be enabled when the PaaS ships.",
10099
10118
  { code: "cloud_runtime_pre_release" }
10100
10119
  );
10101
10120
  }
10102
10121
  const existing = getRun(runId);
10103
10122
  if (existing !== void 0) return existing;
10104
- throw new chunk2YGIBOUH_cjs.UnknownAgentError(
10123
+ throw new chunkLPVIRJVF_cjs.UnknownAgentError(
10105
10124
  `Run ${runId} is not in this process's registry. It may have been disposed, persisted in a previous process, or never created.`,
10106
10125
  { code: "run_not_found" }
10107
10126
  );
@@ -10148,13 +10167,13 @@ var Agent = class _Agent {
10148
10167
  reg = getRegisteredAgent(agentId);
10149
10168
  }
10150
10169
  if (reg === void 0 || reg.runtime !== "local") {
10151
- throw new chunk2YGIBOUH_cjs.UnknownAgentError(
10170
+ throw new chunkLPVIRJVF_cjs.UnknownAgentError(
10152
10171
  `No local agent "${agentId}" registered \u2014 compact targets local sessions.`
10153
10172
  );
10154
10173
  }
10155
- const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-6GKIS4SD.cjs');
10174
+ const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-EPFBQ46Z.cjs');
10156
10175
  const { cwd, model, store } = await openLocalStore(reg);
10157
- return chunk2QMK627M_cjs.enqueueSessionWrite(
10176
+ return chunk2D43RD5D_cjs.enqueueSessionWrite(
10158
10177
  cwd,
10159
10178
  agentId,
10160
10179
  () => compactSessionTranscript({
@@ -10184,11 +10203,11 @@ var Agent = class _Agent {
10184
10203
  reg = getRegisteredAgent(agentId);
10185
10204
  }
10186
10205
  if (reg === void 0 || reg.runtime !== "local") {
10187
- throw new chunk2YGIBOUH_cjs.UnknownAgentError(
10206
+ throw new chunkLPVIRJVF_cjs.UnknownAgentError(
10188
10207
  `No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
10189
10208
  );
10190
10209
  }
10191
- const { injectSessionTurn } = await import('./inject-session-67SF65FC.cjs');
10210
+ const { injectSessionTurn } = await import('./inject-session-AUQLBDRS.cjs');
10192
10211
  const { cwd, model, store } = await openLocalStore(reg);
10193
10212
  await injectSessionTurn({
10194
10213
  store,
@@ -10223,11 +10242,11 @@ var Agent = class _Agent {
10223
10242
  reg = getRegisteredAgent(agentId);
10224
10243
  }
10225
10244
  if (reg === void 0 || reg.runtime !== "local") {
10226
- throw new chunk2YGIBOUH_cjs.UnknownAgentError(
10245
+ throw new chunkLPVIRJVF_cjs.UnknownAgentError(
10227
10246
  `No local agent "${agentId}" registered \u2014 transcript targets local sessions.`
10228
10247
  );
10229
10248
  }
10230
- const { readSessionMessages } = await import('./agent-session-store-EPX2WQI4.cjs');
10249
+ const { readSessionMessages } = await import('./agent-session-store-DUGBAX5V.cjs');
10231
10250
  const { store } = await openLocalStore(reg);
10232
10251
  return readSessionMessages(store, agentId);
10233
10252
  }
@@ -10248,7 +10267,7 @@ var Agent = class _Agent {
10248
10267
  */
10249
10268
  static async describe(agentId) {
10250
10269
  const agent = await getRegisteredAgentOrThrow(agentId);
10251
- const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-3CXBQWWY.cjs');
10270
+ const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-VRW73QQT.cjs');
10252
10271
  const settingSources = agent.options.local?.settingSources;
10253
10272
  const subagents = await loadSubagents2(
10254
10273
  agent.cwd ?? process.cwd(),
@@ -10292,12 +10311,12 @@ async function getOrCreateUncached(agentId, options) {
10292
10311
  try {
10293
10312
  return await Agent.resume(agentId, options);
10294
10313
  } catch (err) {
10295
- if (!(err instanceof chunk2YGIBOUH_cjs.UnknownAgentError)) throw err;
10314
+ if (!(err instanceof chunkLPVIRJVF_cjs.UnknownAgentError)) throw err;
10296
10315
  }
10297
10316
  try {
10298
10317
  return await Agent.create({ ...options, agentId });
10299
10318
  } catch (err) {
10300
- if (err instanceof chunk2YGIBOUH_cjs.ConfigurationError && err.code === "agent_id_already_exists") {
10319
+ if (err instanceof chunkLPVIRJVF_cjs.ConfigurationError && err.code === "agent_id_already_exists") {
10301
10320
  return await Agent.resume(agentId, options);
10302
10321
  }
10303
10322
  throw err;
@@ -10315,9 +10334,10 @@ async function openLocalStore(reg) {
10315
10334
  const cwd = reg.cwd ?? process.cwd();
10316
10335
  const optModel = reg.options.model;
10317
10336
  const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
10318
- const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-VXXDIBGM.cjs');
10319
- const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-TNAJ4O3M.cjs');
10320
- const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
10337
+ const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-VVY2AHWG.cjs');
10338
+ const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-DOM3UTXR.cjs');
10339
+ const configuredSessionDir = reg.options.local?.sessionDir ?? reg.options.local?.baseDir;
10340
+ const baseDir = configuredSessionDir !== void 0 ? expandTilde2(configuredSessionDir) : defaultBaseDir2();
10321
10341
  return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
10322
10342
  }
10323
10343
 
@@ -10332,6 +10352,5 @@ exports.computeCost = computeCost;
10332
10352
  exports.generateCronId = generateCronId;
10333
10353
  exports.getPricingEntry = getPricingEntry;
10334
10354
  exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
10335
- exports.resolveApiKey = resolveApiKey;
10336
- //# sourceMappingURL=chunk-2VFZQEDW.cjs.map
10337
- //# sourceMappingURL=chunk-2VFZQEDW.cjs.map
10355
+ //# sourceMappingURL=chunk-F77UENR6.cjs.map
10356
+ //# sourceMappingURL=chunk-F77UENR6.cjs.map