@theokit/sdk 4.39.4 → 4.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +2 -2
  3. package/dist/agent-35MGOZVH.js +46 -0
  4. package/dist/{agent-UNWZCXBS.js.map → agent-35MGOZVH.js.map} +1 -1
  5. package/dist/agent-6C2ODKFU.cjs +55 -0
  6. package/dist/{agent-DB245YMC.cjs.map → agent-6C2ODKFU.cjs.map} +1 -1
  7. package/dist/{agent-ZCZa7YQv.d.ts → agent-BiCINq25.d.ts} +2 -2
  8. package/dist/{agent-D7bRK9Kg.d.cts → agent-Zta1kvGH.d.cts} +2 -2
  9. package/dist/agent-session-store-EPUERCUU.cjs +23 -0
  10. package/dist/{agent-session-store-RHTLZ5OX.cjs.map → agent-session-store-EPUERCUU.cjs.map} +1 -1
  11. package/dist/agent-session-store-TXP5ZVOD.js +6 -0
  12. package/dist/{agent-session-store-EGTTYSKS.js.map → agent-session-store-TXP5ZVOD.js.map} +1 -1
  13. package/dist/auth/index.cjs +19 -15
  14. package/dist/auth/index.d.cts +1 -1
  15. package/dist/auth/index.d.ts +1 -1
  16. package/dist/auth/index.js +4 -4
  17. package/dist/{batch-WX2HLXX2.js → batch-OUF4N2TM.js} +9 -9
  18. package/dist/{batch-WX2HLXX2.js.map → batch-OUF4N2TM.js.map} +1 -1
  19. package/dist/{batch-FO2KZN7W.cjs → batch-URTEXK77.cjs} +26 -26
  20. package/dist/{batch-FO2KZN7W.cjs.map → batch-URTEXK77.cjs.map} +1 -1
  21. package/dist/{chunk-PDOLUFGY.cjs → chunk-27DYRARU.cjs} +4 -4
  22. package/dist/{chunk-PDOLUFGY.cjs.map → chunk-27DYRARU.cjs.map} +1 -1
  23. package/dist/{chunk-LYD3ALDT.js → chunk-2S6B5B2A.js} +5 -5
  24. package/dist/{chunk-LYD3ALDT.js.map → chunk-2S6B5B2A.js.map} +1 -1
  25. package/dist/{chunk-VTDQRUAJ.js → chunk-2WB6EIYW.js} +4 -4
  26. package/dist/{chunk-VTDQRUAJ.js.map → chunk-2WB6EIYW.js.map} +1 -1
  27. package/dist/{chunk-3CAQCFVZ.js → chunk-35NFZ7QB.js} +3 -3
  28. package/dist/{chunk-3CAQCFVZ.js.map → chunk-35NFZ7QB.js.map} +1 -1
  29. package/dist/{chunk-HCRCNI7A.js → chunk-3KY7MHR4.js} +3 -3
  30. package/dist/{chunk-HCRCNI7A.js.map → chunk-3KY7MHR4.js.map} +1 -1
  31. package/dist/{chunk-BURYFNOM.cjs → chunk-4JBHSLQO.cjs} +2 -2
  32. package/dist/chunk-4JBHSLQO.cjs.map +1 -0
  33. package/dist/{chunk-V7CA3CX5.cjs → chunk-4JRRFRV4.cjs} +5 -4
  34. package/dist/chunk-4JRRFRV4.cjs.map +1 -0
  35. package/dist/{chunk-5KOW3GLE.js → chunk-4QEC4CCS.js} +2 -2
  36. package/dist/chunk-4QEC4CCS.js.map +1 -0
  37. package/dist/{chunk-ALDFVGQQ.cjs → chunk-57KX5WTP.cjs} +9 -9
  38. package/dist/{chunk-ALDFVGQQ.cjs.map → chunk-57KX5WTP.cjs.map} +1 -1
  39. package/dist/{chunk-CJHBSSAF.cjs → chunk-64TJCXY5.cjs} +15 -15
  40. package/dist/{chunk-CJHBSSAF.cjs.map → chunk-64TJCXY5.cjs.map} +1 -1
  41. package/dist/{chunk-IEKSEAIV.js → chunk-6FSQ3CHQ.js} +3 -3
  42. package/dist/{chunk-IEKSEAIV.js.map → chunk-6FSQ3CHQ.js.map} +1 -1
  43. package/dist/{chunk-ZVQJHY4Y.cjs → chunk-6W4U2G3J.cjs} +5 -5
  44. package/dist/{chunk-ZVQJHY4Y.cjs.map → chunk-6W4U2G3J.cjs.map} +1 -1
  45. package/dist/{chunk-FMDZZRYE.cjs → chunk-6X2HUT4A.cjs} +8 -8
  46. package/dist/{chunk-FMDZZRYE.cjs.map → chunk-6X2HUT4A.cjs.map} +1 -1
  47. package/dist/{chunk-X2LDDKFM.cjs → chunk-7PESI6YD.cjs} +10 -10
  48. package/dist/{chunk-X2LDDKFM.cjs.map → chunk-7PESI6YD.cjs.map} +1 -1
  49. package/dist/{chunk-EYUZZXHZ.js → chunk-AF4BBKIF.js} +4 -4
  50. package/dist/chunk-AF4BBKIF.js.map +1 -0
  51. package/dist/{chunk-7GFX45DD.js → chunk-AM2CNBKE.js} +2 -2
  52. package/dist/chunk-AM2CNBKE.js.map +1 -0
  53. package/dist/{chunk-XKGOIGTJ.js → chunk-AZ6FKDQR.js} +3 -3
  54. package/dist/{chunk-XKGOIGTJ.js.map → chunk-AZ6FKDQR.js.map} +1 -1
  55. package/dist/{chunk-WPZTYOUX.cjs → chunk-BBZYXVLZ.cjs} +2 -2
  56. package/dist/chunk-BBZYXVLZ.cjs.map +1 -0
  57. package/dist/{chunk-P3ZVI46Y.js → chunk-BHWHE453.js} +5 -5
  58. package/dist/{chunk-P3ZVI46Y.js.map → chunk-BHWHE453.js.map} +1 -1
  59. package/dist/{chunk-LY4KEOOY.cjs → chunk-BRHRQOJA.cjs} +4 -4
  60. package/dist/{chunk-LY4KEOOY.cjs.map → chunk-BRHRQOJA.cjs.map} +1 -1
  61. package/dist/{chunk-4H2QARXM.cjs → chunk-BV42CCRP.cjs} +7 -7
  62. package/dist/{chunk-4H2QARXM.cjs.map → chunk-BV42CCRP.cjs.map} +1 -1
  63. package/dist/{chunk-SGGH3B2W.js → chunk-DCKIS53K.js} +63 -52
  64. package/dist/chunk-DCKIS53K.js.map +1 -0
  65. package/dist/{chunk-SKWVAQAY.js → chunk-DEZ75ET5.js} +3 -3
  66. package/dist/{chunk-SKWVAQAY.js.map → chunk-DEZ75ET5.js.map} +1 -1
  67. package/dist/{chunk-WJOLIPEM.js → chunk-EON4YTR6.js} +8 -8
  68. package/dist/{chunk-WJOLIPEM.js.map → chunk-EON4YTR6.js.map} +1 -1
  69. package/dist/{chunk-MI3OKONE.js → chunk-F4RUADRC.js} +3 -3
  70. package/dist/{chunk-MI3OKONE.js.map → chunk-F4RUADRC.js.map} +1 -1
  71. package/dist/{chunk-SHQEZ6Q2.cjs → chunk-F5DSDDBY.cjs} +323 -312
  72. package/dist/chunk-F5DSDDBY.cjs.map +1 -0
  73. package/dist/{chunk-SEWAPWAF.cjs → chunk-FMIKUGF2.cjs} +124 -124
  74. package/dist/chunk-FMIKUGF2.cjs.map +1 -0
  75. package/dist/{chunk-XZ7PO2FM.js → chunk-FRQ6F44U.js} +4 -4
  76. package/dist/{chunk-XZ7PO2FM.js.map → chunk-FRQ6F44U.js.map} +1 -1
  77. package/dist/{chunk-3LK3ZDL5.cjs → chunk-FZ4YMZA3.cjs} +5 -5
  78. package/dist/{chunk-3LK3ZDL5.cjs.map → chunk-FZ4YMZA3.cjs.map} +1 -1
  79. package/dist/{chunk-MM2JKFQV.cjs → chunk-GC44RATP.cjs} +10 -10
  80. package/dist/{chunk-MM2JKFQV.cjs.map → chunk-GC44RATP.cjs.map} +1 -1
  81. package/dist/{chunk-LNTQRD23.cjs → chunk-GH52NOCL.cjs} +26 -26
  82. package/dist/chunk-GH52NOCL.cjs.map +1 -0
  83. package/dist/{chunk-T6KFGMNY.cjs → chunk-GLEKLAUW.cjs} +12 -12
  84. package/dist/chunk-GLEKLAUW.cjs.map +1 -0
  85. package/dist/{chunk-UIPTINIF.js → chunk-GNMPCZNN.js} +6 -6
  86. package/dist/chunk-GNMPCZNN.js.map +1 -0
  87. package/dist/{chunk-K6TWHNT4.cjs → chunk-HECR7KF5.cjs} +11 -11
  88. package/dist/{chunk-K6TWHNT4.cjs.map → chunk-HECR7KF5.cjs.map} +1 -1
  89. package/dist/{chunk-NHXPQN44.js → chunk-HK4HRLWE.js} +3 -3
  90. package/dist/{chunk-NHXPQN44.js.map → chunk-HK4HRLWE.js.map} +1 -1
  91. package/dist/{chunk-LWVKI75U.js → chunk-HKSSM5RK.js} +3 -3
  92. package/dist/{chunk-LWVKI75U.js.map → chunk-HKSSM5RK.js.map} +1 -1
  93. package/dist/{chunk-ELYGL52R.cjs → chunk-HLNLYLNN.cjs} +4 -4
  94. package/dist/{chunk-ELYGL52R.cjs.map → chunk-HLNLYLNN.cjs.map} +1 -1
  95. package/dist/{chunk-ONVIALVV.js → chunk-IMX5YODO.js} +15 -15
  96. package/dist/chunk-IMX5YODO.js.map +1 -0
  97. package/dist/{chunk-C64E2EJS.js → chunk-J5RW43IR.js} +4 -4
  98. package/dist/{chunk-C64E2EJS.js.map → chunk-J5RW43IR.js.map} +1 -1
  99. package/dist/{chunk-4E3HLSYE.cjs → chunk-JA4FEA5Z.cjs} +4 -4
  100. package/dist/{chunk-4E3HLSYE.cjs.map → chunk-JA4FEA5Z.cjs.map} +1 -1
  101. package/dist/{chunk-EJNFZET4.cjs → chunk-JO76RWCA.cjs} +11 -11
  102. package/dist/{chunk-EJNFZET4.cjs.map → chunk-JO76RWCA.cjs.map} +1 -1
  103. package/dist/{chunk-QMIG7TKG.cjs → chunk-KCQUYQ3V.cjs} +17 -17
  104. package/dist/chunk-KCQUYQ3V.cjs.map +1 -0
  105. package/dist/{chunk-AKMPQJPX.js → chunk-L4JFQCG4.js} +5 -5
  106. package/dist/chunk-L4JFQCG4.js.map +1 -0
  107. package/dist/{chunk-HJMFPIRM.js → chunk-LLE7HPRI.js} +5 -5
  108. package/dist/{chunk-HJMFPIRM.js.map → chunk-LLE7HPRI.js.map} +1 -1
  109. package/dist/{chunk-4H2DCO6P.js → chunk-LXKNENHK.js} +3 -3
  110. package/dist/{chunk-4H2DCO6P.js.map → chunk-LXKNENHK.js.map} +1 -1
  111. package/dist/{chunk-PY7G7YWK.cjs → chunk-MMZX557L.cjs} +5 -5
  112. package/dist/{chunk-PY7G7YWK.cjs.map → chunk-MMZX557L.cjs.map} +1 -1
  113. package/dist/{chunk-VQ33XLC6.js → chunk-MRKSSN36.js} +3 -3
  114. package/dist/{chunk-VQ33XLC6.js.map → chunk-MRKSSN36.js.map} +1 -1
  115. package/dist/{chunk-33B2BSME.cjs → chunk-NETYW4V3.cjs} +13 -5
  116. package/dist/chunk-NETYW4V3.cjs.map +1 -0
  117. package/dist/{chunk-OVGNXGCK.cjs → chunk-NNNUQELM.cjs} +9 -9
  118. package/dist/{chunk-OVGNXGCK.cjs.map → chunk-NNNUQELM.cjs.map} +1 -1
  119. package/dist/{chunk-BM7VYZED.js → chunk-NOM2YWFP.js} +5 -5
  120. package/dist/{chunk-BM7VYZED.js.map → chunk-NOM2YWFP.js.map} +1 -1
  121. package/dist/{chunk-WMWZAJMJ.cjs → chunk-NRA36JKG.cjs} +11 -11
  122. package/dist/{chunk-WMWZAJMJ.cjs.map → chunk-NRA36JKG.cjs.map} +1 -1
  123. package/dist/{chunk-4HKAZRTC.js → chunk-O3IZ7JEL.js} +3 -3
  124. package/dist/{chunk-4HKAZRTC.js.map → chunk-O3IZ7JEL.js.map} +1 -1
  125. package/dist/{chunk-RHQJX3EI.cjs → chunk-OEFFPR2S.cjs} +4 -4
  126. package/dist/{chunk-RHQJX3EI.cjs.map → chunk-OEFFPR2S.cjs.map} +1 -1
  127. package/dist/{chunk-4GGXF7YM.js → chunk-OLLOUAUJ.js} +3 -3
  128. package/dist/{chunk-4GGXF7YM.js.map → chunk-OLLOUAUJ.js.map} +1 -1
  129. package/dist/{chunk-RA2UZBYP.js → chunk-PAV4ZPSW.js} +3 -3
  130. package/dist/{chunk-RA2UZBYP.js.map → chunk-PAV4ZPSW.js.map} +1 -1
  131. package/dist/{chunk-RNCN2TTP.js → chunk-PBML2FHN.js} +2 -2
  132. package/dist/{chunk-A76OFN2B.cjs.map → chunk-PBML2FHN.js.map} +1 -1
  133. package/dist/{chunk-XRKFWV7K.js → chunk-PYM5OUL4.js} +5 -5
  134. package/dist/{chunk-XRKFWV7K.js.map → chunk-PYM5OUL4.js.map} +1 -1
  135. package/dist/{chunk-F4SQTWVR.js → chunk-Q4DTGCSD.js} +3 -3
  136. package/dist/{chunk-F4SQTWVR.js.map → chunk-Q4DTGCSD.js.map} +1 -1
  137. package/dist/{chunk-S7OEXQMI.cjs → chunk-R3CKCRK3.cjs} +4 -4
  138. package/dist/{chunk-S7OEXQMI.cjs.map → chunk-R3CKCRK3.cjs.map} +1 -1
  139. package/dist/{chunk-5COPO3H4.cjs → chunk-RBQYHEZD.cjs} +4 -4
  140. package/dist/{chunk-5COPO3H4.cjs.map → chunk-RBQYHEZD.cjs.map} +1 -1
  141. package/dist/{chunk-KRPEPZQY.js → chunk-RJBHWM6D.js} +7 -7
  142. package/dist/chunk-RJBHWM6D.js.map +1 -0
  143. package/dist/{chunk-U53AYSHS.cjs → chunk-S4Q5OMIK.cjs} +11 -11
  144. package/dist/{chunk-U53AYSHS.cjs.map → chunk-S4Q5OMIK.cjs.map} +1 -1
  145. package/dist/{chunk-FUP3ZA5T.js → chunk-SNKY3C2L.js} +4 -4
  146. package/dist/{chunk-FUP3ZA5T.js.map → chunk-SNKY3C2L.js.map} +1 -1
  147. package/dist/{chunk-BBMN4O6E.js → chunk-TJRPNBY5.js} +4 -4
  148. package/dist/{chunk-BBMN4O6E.js.map → chunk-TJRPNBY5.js.map} +1 -1
  149. package/dist/{chunk-27E4EMR6.cjs → chunk-UJMEWGO6.cjs} +4 -4
  150. package/dist/{chunk-27E4EMR6.cjs.map → chunk-UJMEWGO6.cjs.map} +1 -1
  151. package/dist/{chunk-X627TO3A.js → chunk-UTYCG4RB.js} +12 -12
  152. package/dist/chunk-UTYCG4RB.js.map +1 -0
  153. package/dist/{chunk-5XPKYDK7.js → chunk-VQFSEKU5.js} +12 -5
  154. package/dist/chunk-VQFSEKU5.js.map +1 -0
  155. package/dist/{chunk-NJVV5OAV.cjs → chunk-WCXOKGOQ.cjs} +8 -8
  156. package/dist/chunk-WCXOKGOQ.cjs.map +1 -0
  157. package/dist/{chunk-PIBXDEZM.cjs → chunk-WIGJGFH4.cjs} +5 -5
  158. package/dist/{chunk-PIBXDEZM.cjs.map → chunk-WIGJGFH4.cjs.map} +1 -1
  159. package/dist/{chunk-LOTWA65Z.cjs → chunk-X2YQP452.cjs} +11 -11
  160. package/dist/{chunk-LOTWA65Z.cjs.map → chunk-X2YQP452.cjs.map} +1 -1
  161. package/dist/{chunk-ZAKTZ5B4.cjs → chunk-XA3TSBAH.cjs} +8 -8
  162. package/dist/{chunk-ZAKTZ5B4.cjs.map → chunk-XA3TSBAH.cjs.map} +1 -1
  163. package/dist/{chunk-H2V6CXM7.cjs → chunk-XR4LPBXH.cjs} +9 -9
  164. package/dist/{chunk-H2V6CXM7.cjs.map → chunk-XR4LPBXH.cjs.map} +1 -1
  165. package/dist/{chunk-KV3HR7KL.cjs → chunk-Y33IGXCJ.cjs} +24 -24
  166. package/dist/{chunk-KV3HR7KL.cjs.map → chunk-Y33IGXCJ.cjs.map} +1 -1
  167. package/dist/{chunk-E7WWIX34.cjs → chunk-YULF6FPB.cjs} +8 -8
  168. package/dist/{chunk-E7WWIX34.cjs.map → chunk-YULF6FPB.cjs.map} +1 -1
  169. package/dist/{chunk-23HI77BZ.js → chunk-Z6N6SDNR.js} +4 -4
  170. package/dist/chunk-Z6N6SDNR.js.map +1 -0
  171. package/dist/{chunk-A76OFN2B.cjs → chunk-ZHPET3LZ.cjs} +2 -2
  172. package/dist/chunk-ZHPET3LZ.cjs.map +1 -0
  173. package/dist/{chunk-5VKUZ26Q.js → chunk-ZNW2TXLO.js} +3 -3
  174. package/dist/{chunk-5VKUZ26Q.js.map → chunk-ZNW2TXLO.js.map} +1 -1
  175. package/dist/{chunk-N4JNY5DT.cjs → chunk-ZO2L5U6F.cjs} +32 -32
  176. package/dist/chunk-ZO2L5U6F.cjs.map +1 -0
  177. package/dist/{chunk-RMCHJZNZ.js → chunk-ZS6SLELQ.js} +4 -4
  178. package/dist/{chunk-RMCHJZNZ.js.map → chunk-ZS6SLELQ.js.map} +1 -1
  179. package/dist/{chunk-7PBAJ2WA.js → chunk-ZTEAJAE6.js} +3 -3
  180. package/dist/{chunk-7PBAJ2WA.js.map → chunk-ZTEAJAE6.js.map} +1 -1
  181. package/dist/compact-session-65XCKO6H.js +18 -0
  182. package/dist/{compact-session-AZU2LEAE.js.map → compact-session-65XCKO6H.js.map} +1 -1
  183. package/dist/compact-session-OU6SRPVJ.cjs +55 -0
  184. package/dist/{compact-session-TRCEYCPG.cjs.map → compact-session-OU6SRPVJ.cjs.map} +1 -1
  185. package/dist/compaction.cjs +16 -16
  186. package/dist/compaction.js +3 -3
  187. package/dist/concurrency.cjs +6 -6
  188. package/dist/concurrency.js +4 -4
  189. package/dist/context-2G4375BZ.cjs +22 -0
  190. package/dist/{context-DNFT4B5D.cjs.map → context-2G4375BZ.cjs.map} +1 -1
  191. package/dist/context-GSQYVVMJ.js +5 -0
  192. package/dist/{context-LYE6TJL5.js.map → context-GSQYVVMJ.js.map} +1 -1
  193. package/dist/{cron-D-DVjGQe.d.cts → cron-DgHJnMAK.d.cts} +2 -2
  194. package/dist/{cron-Bx7tzm5R.d.ts → cron-DyWQsEG6.d.ts} +2 -2
  195. package/dist/cron.cjs +33 -33
  196. package/dist/cron.d.cts +3 -3
  197. package/dist/cron.d.ts +3 -3
  198. package/dist/cron.js +32 -32
  199. package/dist/{errors-DjBQ4Tn8.d.ts → errors-BSoXcl3F.d.cts} +3 -3
  200. package/dist/{errors-DMY-gLSK.d.cts → errors-CHllybaU.d.ts} +3 -3
  201. package/dist/errors.cjs +21 -21
  202. package/dist/errors.d.cts +2 -2
  203. package/dist/errors.d.ts +2 -2
  204. package/dist/errors.js +2 -2
  205. package/dist/eval.cjs +43 -43
  206. package/dist/eval.cjs.map +1 -1
  207. package/dist/eval.js +33 -33
  208. package/dist/eval.js.map +1 -1
  209. package/dist/{executor-TQ3FSZ7F.cjs → executor-CB75B5BH.cjs} +24 -24
  210. package/dist/{executor-TQ3FSZ7F.cjs.map → executor-CB75B5BH.cjs.map} +1 -1
  211. package/dist/{executor-PCRX3533.js → executor-VQLTQY53.js} +7 -7
  212. package/dist/{executor-PCRX3533.js.map → executor-VQLTQY53.js.map} +1 -1
  213. package/dist/filesystem/index.cjs +7 -7
  214. package/dist/filesystem/index.js +3 -3
  215. package/dist/fs-session-store-MAZV5FXJ.cjs +19 -0
  216. package/dist/{fs-session-store-KRZZIG3O.cjs.map → fs-session-store-MAZV5FXJ.cjs.map} +1 -1
  217. package/dist/fs-session-store-ZNUYZHYI.js +10 -0
  218. package/dist/{fs-session-store-I6GUIFRO.js.map → fs-session-store-ZNUYZHYI.js.map} +1 -1
  219. package/dist/generate-object-6PWGH5DZ.cjs +20 -0
  220. package/dist/{generate-object-QILSGTEJ.cjs.map → generate-object-6PWGH5DZ.cjs.map} +1 -1
  221. package/dist/generate-object-IXMJ7FUX.js +7 -0
  222. package/dist/{generate-object-DLHT5RXH.js.map → generate-object-IXMJ7FUX.js.map} +1 -1
  223. package/dist/index-manager-X5IPG2JL.js +11 -0
  224. package/dist/{index-manager-SXF3FAQV.js.map → index-manager-X5IPG2JL.js.map} +1 -1
  225. package/dist/index-manager-YFFEPISE.cjs +20 -0
  226. package/dist/{index-manager-LEMQ73A7.cjs.map → index-manager-YFFEPISE.cjs.map} +1 -1
  227. package/dist/index.cjs +139 -139
  228. package/dist/index.cjs.map +1 -1
  229. package/dist/index.d.cts +13 -13
  230. package/dist/index.d.ts +13 -13
  231. package/dist/index.js +53 -53
  232. package/dist/index.js.map +1 -1
  233. package/dist/{inject-session-BVSERZCI.cjs → inject-session-DDC36KKP.cjs} +11 -11
  234. package/dist/{inject-session-BVSERZCI.cjs.map → inject-session-DDC36KKP.cjs.map} +1 -1
  235. package/dist/{inject-session-E75EP3LL.js → inject-session-UBM4KVSV.js} +8 -8
  236. package/dist/{inject-session-E75EP3LL.js.map → inject-session-UBM4KVSV.js.map} +1 -1
  237. package/dist/internal/auth/credential-store.d.ts +13 -0
  238. package/dist/internal/diagnostics.d.ts +2 -2
  239. package/dist/internal/error-mappers/anthropic.d.ts +1 -1
  240. package/dist/internal/eval/code-runner.d.ts +1 -1
  241. package/dist/internal/global-singleton.d.ts +1 -1
  242. package/dist/internal/judge/judge-call.d.ts +1 -1
  243. package/dist/internal/memory/adapters/index.cjs +8 -8
  244. package/dist/internal/memory/adapters/index.js +7 -7
  245. package/dist/internal/memory/embedding-adapter.d.ts +1 -1
  246. package/dist/internal/memory/memory-index.d.ts +1 -1
  247. package/dist/internal/persistence/atomic-write.d.cts +14 -1
  248. package/dist/internal/persistence/atomic-write.d.ts +14 -1
  249. package/dist/internal/persistence/index.cjs +25 -25
  250. package/dist/internal/persistence/index.js +6 -6
  251. package/dist/internal/persistence/jsonl.d.cts +2 -2
  252. package/dist/internal/persistence/jsonl.d.ts +2 -2
  253. package/dist/internal/persistence/session-artifacts.d.cts +27 -0
  254. package/dist/internal/persistence/session-artifacts.d.ts +27 -0
  255. package/dist/internal/persistence/session-transcript.d.cts +1 -1
  256. package/dist/internal/persistence/session-transcript.d.ts +1 -1
  257. package/dist/internal/runtime/lifecycle/env-policy.d.ts +1 -1
  258. package/dist/internal/security/index.cjs +13 -13
  259. package/dist/internal/security/index.js +3 -3
  260. package/dist/internal/session/agent-session.d.ts +1 -1
  261. package/dist/internal/session/compact-session.d.ts +1 -1
  262. package/dist/internal/session/session-cache.d.ts +1 -1
  263. package/dist/judge-call-3QZO5H5N.js +5 -0
  264. package/dist/{judge-call-NPRU7JIQ.js.map → judge-call-3QZO5H5N.js.map} +1 -1
  265. package/dist/judge-call-J5EETJL3.cjs +22 -0
  266. package/dist/{judge-call-AIT3EULV.cjs.map → judge-call-J5EETJL3.cjs.map} +1 -1
  267. package/dist/models.cjs +20 -20
  268. package/dist/models.cjs.map +1 -1
  269. package/dist/models.js +5 -5
  270. package/dist/models.js.map +1 -1
  271. package/dist/path-safety.cjs +10 -10
  272. package/dist/path-safety.js +3 -3
  273. package/dist/persistence.cjs +44 -30
  274. package/dist/persistence.cjs.map +1 -1
  275. package/dist/persistence.d.cts +4 -3
  276. package/dist/persistence.d.ts +4 -3
  277. package/dist/persistence.js +22 -12
  278. package/dist/persistence.js.map +1 -1
  279. package/dist/project.cjs +5 -5
  280. package/dist/project.js +3 -3
  281. package/dist/registry-KB3TS6BM.cjs +46 -0
  282. package/dist/{registry-VKDFTK6L.cjs.map → registry-KB3TS6BM.cjs.map} +1 -1
  283. package/dist/registry-PPFMCM4A.js +9 -0
  284. package/dist/{registry-AXQXPLFH.js.map → registry-PPFMCM4A.js.map} +1 -1
  285. package/dist/retry.cjs +4 -4
  286. package/dist/retry.js +3 -3
  287. package/dist/{run-i2-fUohR.d.ts → run-C8FBAC8o.d.cts} +36 -2
  288. package/dist/{run-i2-fUohR.d.cts → run-C8FBAC8o.d.ts} +36 -2
  289. package/dist/{run-until-BK56WG4P.js → run-until-HEQOUVU6.js} +2 -2
  290. package/dist/run-until-HEQOUVU6.js.map +1 -0
  291. package/dist/{run-until-L5KQD3PV.cjs → run-until-U2B5FJJI.cjs} +2 -2
  292. package/dist/run-until-U2B5FJJI.cjs.map +1 -0
  293. package/dist/sandbox/bwrap.d.cts +15 -1
  294. package/dist/sandbox/bwrap.d.ts +15 -1
  295. package/dist/sandbox/index.cjs +39 -24
  296. package/dist/sandbox/index.cjs.map +1 -1
  297. package/dist/sandbox/index.d.cts +1 -1
  298. package/dist/sandbox/index.d.ts +1 -1
  299. package/dist/sandbox/index.js +24 -10
  300. package/dist/sandbox/index.js.map +1 -1
  301. package/dist/sandbox/provision.d.cts +1 -1
  302. package/dist/sandbox/provision.d.ts +1 -1
  303. package/dist/server/errors-envelope.cjs +14 -14
  304. package/dist/server/errors-envelope.d.cts +3 -3
  305. package/dist/server/errors-envelope.d.ts +3 -3
  306. package/dist/server/errors-envelope.js +3 -3
  307. package/dist/session-transcript-7FWTO4BK.js +5 -0
  308. package/dist/{session-transcript-X3UMSVL2.js.map → session-transcript-7FWTO4BK.js.map} +1 -1
  309. package/dist/session-transcript-FYRKWRWV.cjs +50 -0
  310. package/dist/{session-transcript-SLQRKQ72.cjs.map → session-transcript-FYRKWRWV.cjs.map} +1 -1
  311. package/dist/skills.cjs +7 -7
  312. package/dist/skills.js +5 -5
  313. package/dist/stream-object-3R3HZPQN.cjs +20 -0
  314. package/dist/{stream-object-3HEUGMQY.cjs.map → stream-object-3R3HZPQN.cjs.map} +1 -1
  315. package/dist/stream-object-NPJXDZXO.js +7 -0
  316. package/dist/{stream-object-VWYW7FJ2.js.map → stream-object-NPJXDZXO.js.map} +1 -1
  317. package/dist/subagents-loader-5KQVYUNS.js +6 -0
  318. package/dist/{subagents-loader-QUIK6GMV.js.map → subagents-loader-5KQVYUNS.js.map} +1 -1
  319. package/dist/subagents-loader-FDXPBBRA.cjs +15 -0
  320. package/dist/{subagents-loader-F52ARQ62.cjs.map → subagents-loader-FDXPBBRA.cjs.map} +1 -1
  321. package/dist/subagents-loader.cjs +15 -15
  322. package/dist/subagents-loader.cjs.map +1 -1
  323. package/dist/subagents-loader.d.cts +2 -2
  324. package/dist/subagents-loader.d.ts +2 -2
  325. package/dist/subagents-loader.js +14 -14
  326. package/dist/subagents-loader.js.map +1 -1
  327. package/dist/subscription/index.cjs +3 -3
  328. package/dist/subscription/index.js +2 -2
  329. package/dist/task-store.cjs +7 -7
  330. package/dist/task-store.js +4 -4
  331. package/dist/types/run-events.d.ts +20 -1
  332. package/dist/types/run.d.ts +15 -0
  333. package/dist/types/session-record.d.ts +1 -1
  334. package/dist/types/usage.d.ts +1 -1
  335. package/dist/workflow.cjs +27 -27
  336. package/dist/workflow.js +6 -6
  337. package/docs/error-codes.md +22 -0
  338. package/docs/harness-capability-map.md +22 -0
  339. package/package.json +1 -1
  340. package/dist/agent-DB245YMC.cjs +0 -55
  341. package/dist/agent-UNWZCXBS.js +0 -46
  342. package/dist/agent-session-store-EGTTYSKS.js +0 -6
  343. package/dist/agent-session-store-RHTLZ5OX.cjs +0 -23
  344. package/dist/chunk-23HI77BZ.js.map +0 -1
  345. package/dist/chunk-33B2BSME.cjs.map +0 -1
  346. package/dist/chunk-5KOW3GLE.js.map +0 -1
  347. package/dist/chunk-5XPKYDK7.js.map +0 -1
  348. package/dist/chunk-7GFX45DD.js.map +0 -1
  349. package/dist/chunk-AKMPQJPX.js.map +0 -1
  350. package/dist/chunk-BURYFNOM.cjs.map +0 -1
  351. package/dist/chunk-EYUZZXHZ.js.map +0 -1
  352. package/dist/chunk-KRPEPZQY.js.map +0 -1
  353. package/dist/chunk-LNTQRD23.cjs.map +0 -1
  354. package/dist/chunk-N4JNY5DT.cjs.map +0 -1
  355. package/dist/chunk-NJVV5OAV.cjs.map +0 -1
  356. package/dist/chunk-ONVIALVV.js.map +0 -1
  357. package/dist/chunk-QMIG7TKG.cjs.map +0 -1
  358. package/dist/chunk-RNCN2TTP.js.map +0 -1
  359. package/dist/chunk-SEWAPWAF.cjs.map +0 -1
  360. package/dist/chunk-SGGH3B2W.js.map +0 -1
  361. package/dist/chunk-SHQEZ6Q2.cjs.map +0 -1
  362. package/dist/chunk-T6KFGMNY.cjs.map +0 -1
  363. package/dist/chunk-UIPTINIF.js.map +0 -1
  364. package/dist/chunk-V7CA3CX5.cjs.map +0 -1
  365. package/dist/chunk-WPZTYOUX.cjs.map +0 -1
  366. package/dist/chunk-X627TO3A.js.map +0 -1
  367. package/dist/compact-session-AZU2LEAE.js +0 -18
  368. package/dist/compact-session-TRCEYCPG.cjs +0 -55
  369. package/dist/context-DNFT4B5D.cjs +0 -22
  370. package/dist/context-LYE6TJL5.js +0 -5
  371. package/dist/fs-session-store-I6GUIFRO.js +0 -10
  372. package/dist/fs-session-store-KRZZIG3O.cjs +0 -19
  373. package/dist/generate-object-DLHT5RXH.js +0 -7
  374. package/dist/generate-object-QILSGTEJ.cjs +0 -20
  375. package/dist/index-manager-LEMQ73A7.cjs +0 -20
  376. package/dist/index-manager-SXF3FAQV.js +0 -11
  377. package/dist/judge-call-AIT3EULV.cjs +0 -22
  378. package/dist/judge-call-NPRU7JIQ.js +0 -5
  379. package/dist/registry-AXQXPLFH.js +0 -9
  380. package/dist/registry-VKDFTK6L.cjs +0 -46
  381. package/dist/run-until-BK56WG4P.js.map +0 -1
  382. package/dist/run-until-L5KQD3PV.cjs.map +0 -1
  383. package/dist/session-transcript-SLQRKQ72.cjs +0 -50
  384. package/dist/session-transcript-X3UMSVL2.js +0 -5
  385. package/dist/stream-object-3HEUGMQY.cjs +0 -20
  386. package/dist/stream-object-VWYW7FJ2.js +0 -7
  387. package/dist/subagents-loader-F52ARQ62.cjs +0 -15
  388. package/dist/subagents-loader-QUIK6GMV.js +0 -6
@@ -1,35 +1,35 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
4
- var chunkQMIG7TKG_cjs = require('./chunk-QMIG7TKG.cjs');
5
- var chunkN4JNY5DT_cjs = require('./chunk-N4JNY5DT.cjs');
6
- var chunkWMWZAJMJ_cjs = require('./chunk-WMWZAJMJ.cjs');
7
- var chunkSEWAPWAF_cjs = require('./chunk-SEWAPWAF.cjs');
8
- var chunkLNTQRD23_cjs = require('./chunk-LNTQRD23.cjs');
9
- var chunkK6TWHNT4_cjs = require('./chunk-K6TWHNT4.cjs');
10
- var chunkWPZTYOUX_cjs = require('./chunk-WPZTYOUX.cjs');
11
- var chunkFMDZZRYE_cjs = require('./chunk-FMDZZRYE.cjs');
12
- var chunkX2LDDKFM_cjs = require('./chunk-X2LDDKFM.cjs');
4
+ var chunkKCQUYQ3V_cjs = require('./chunk-KCQUYQ3V.cjs');
5
+ var chunkZO2L5U6F_cjs = require('./chunk-ZO2L5U6F.cjs');
6
+ var chunkNRA36JKG_cjs = require('./chunk-NRA36JKG.cjs');
7
+ var chunkFMIKUGF2_cjs = require('./chunk-FMIKUGF2.cjs');
8
+ var chunkGH52NOCL_cjs = require('./chunk-GH52NOCL.cjs');
9
+ var chunkHECR7KF5_cjs = require('./chunk-HECR7KF5.cjs');
10
+ var chunkBBZYXVLZ_cjs = require('./chunk-BBZYXVLZ.cjs');
11
+ var chunk6X2HUT4A_cjs = require('./chunk-6X2HUT4A.cjs');
12
+ var chunk7PESI6YD_cjs = require('./chunk-7PESI6YD.cjs');
13
13
  var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
14
14
  var chunkB4YA6BRS_cjs = require('./chunk-B4YA6BRS.cjs');
15
15
  var chunkNINIJCHU_cjs = require('./chunk-NINIJCHU.cjs');
16
16
  var chunkYPEPCZHF_cjs = require('./chunk-YPEPCZHF.cjs');
17
17
  var chunkVJ26EKGJ_cjs = require('./chunk-VJ26EKGJ.cjs');
18
- var chunkRHQJX3EI_cjs = require('./chunk-RHQJX3EI.cjs');
19
- var chunkNJVV5OAV_cjs = require('./chunk-NJVV5OAV.cjs');
20
- var chunkZVQJHY4Y_cjs = require('./chunk-ZVQJHY4Y.cjs');
18
+ var chunkOEFFPR2S_cjs = require('./chunk-OEFFPR2S.cjs');
19
+ var chunkWCXOKGOQ_cjs = require('./chunk-WCXOKGOQ.cjs');
20
+ var chunk6W4U2G3J_cjs = require('./chunk-6W4U2G3J.cjs');
21
21
  var chunkYLQQX5W2_cjs = require('./chunk-YLQQX5W2.cjs');
22
22
  var chunkWJVHMTKB_cjs = require('./chunk-WJVHMTKB.cjs');
23
- var chunk33B2BSME_cjs = require('./chunk-33B2BSME.cjs');
24
- var chunkLOTWA65Z_cjs = require('./chunk-LOTWA65Z.cjs');
25
- var chunkOVGNXGCK_cjs = require('./chunk-OVGNXGCK.cjs');
23
+ var chunkNETYW4V3_cjs = require('./chunk-NETYW4V3.cjs');
24
+ var chunkX2YQP452_cjs = require('./chunk-X2YQP452.cjs');
25
+ var chunkNNNUQELM_cjs = require('./chunk-NNNUQELM.cjs');
26
26
  var chunkVYHJZVL5_cjs = require('./chunk-VYHJZVL5.cjs');
27
- var chunkT6KFGMNY_cjs = require('./chunk-T6KFGMNY.cjs');
28
- var chunkCJHBSSAF_cjs = require('./chunk-CJHBSSAF.cjs');
29
- var chunkZAKTZ5B4_cjs = require('./chunk-ZAKTZ5B4.cjs');
30
- var chunkLY4KEOOY_cjs = require('./chunk-LY4KEOOY.cjs');
31
- var chunkE7WWIX34_cjs = require('./chunk-E7WWIX34.cjs');
32
- var chunkA76OFN2B_cjs = require('./chunk-A76OFN2B.cjs');
27
+ var chunkGLEKLAUW_cjs = require('./chunk-GLEKLAUW.cjs');
28
+ var chunk64TJCXY5_cjs = require('./chunk-64TJCXY5.cjs');
29
+ var chunkXA3TSBAH_cjs = require('./chunk-XA3TSBAH.cjs');
30
+ var chunkBRHRQOJA_cjs = require('./chunk-BRHRQOJA.cjs');
31
+ var chunkYULF6FPB_cjs = require('./chunk-YULF6FPB.cjs');
32
+ var chunkZHPET3LZ_cjs = require('./chunk-ZHPET3LZ.cjs');
33
33
  var promises = require('fs/promises');
34
34
  var crypto = require('crypto');
35
35
  var path = require('path');
@@ -225,7 +225,7 @@ async function agentGenerate(agent, agentModel, agentApiKey, agentLocal, input,
225
225
  const { output, maxRetries, errorStrategy, ...sendOptions } = options;
226
226
  const run = await agent.send(input, sendOptions);
227
227
  const result = await run.wait();
228
- const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-QILSGTEJ.cjs');
228
+ const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-6PWGH5DZ.cjs');
229
229
  const answer = structurableAnswerOrThrow(result, GenerateObjectError);
230
230
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
231
231
  const facade = getAgentFacade();
@@ -327,7 +327,7 @@ function normalizeModel(m) {
327
327
  if (m === void 0 || typeof m !== "string") return m;
328
328
  const id = m.trim();
329
329
  if (id.length === 0) {
330
- throw new chunkE7WWIX34_cjs.ConfigurationError(
330
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
331
331
  'model must be a non-empty "provider/model" id string or a ModelSelection object',
332
332
  { code: "invalid_model_selection" }
333
333
  );
@@ -463,7 +463,7 @@ function registryPath(cwd) {
463
463
  return path.join(cwd, REGISTRY_RELATIVE_PATH);
464
464
  }
465
465
  async function loadRegistry(cwd) {
466
- return chunkFMDZZRYE_cjs.readVersionedJson({
466
+ return chunk6X2HUT4A_cjs.readVersionedJson({
467
467
  path: registryPath(cwd),
468
468
  currentVersion: SCHEMA_VERSION,
469
469
  defaultValue: () => ({}),
@@ -487,7 +487,7 @@ async function saveRegistry(cwd, agents2) {
487
487
  }
488
488
  const path = registryPath(cwd);
489
489
  await chunkYLQQX5W2_cjs.withCwdMutex(`registry:${cwd}`, async () => {
490
- await chunkFMDZZRYE_cjs.writeVersionedJson(path, serialized, SCHEMA_VERSION);
490
+ await chunk6X2HUT4A_cjs.writeVersionedJson(path, serialized, SCHEMA_VERSION);
491
491
  });
492
492
  }
493
493
  function toSerialized(agent) {
@@ -554,7 +554,7 @@ function scheduleSaveForCwd(cwd) {
554
554
  }
555
555
  } catch (cause) {
556
556
  const msg = cause instanceof Error ? cause.message : String(cause);
557
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] registry persist failed (${cwd}): ${msg}
557
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] registry persist failed (${cwd}): ${msg}
558
558
  `);
559
559
  } finally {
560
560
  pendingSaves.delete(cwd);
@@ -597,9 +597,9 @@ function removeRegisteredAgent(agentId) {
597
597
  return removed;
598
598
  }
599
599
  async function hydrateRegistryFromDisk(cwd) {
600
- const emAndamento = hydrations.get(cwd);
601
- if (emAndamento !== void 0) return emAndamento;
602
- const hidratacao = (async () => {
600
+ const inFlight = hydrations.get(cwd);
601
+ if (inFlight !== void 0) return inFlight;
602
+ const hydration = (async () => {
603
603
  const persisted = await loadRegistry(cwd);
604
604
  for (const [id, entry] of Object.entries(persisted)) {
605
605
  if (!agents.has(id)) {
@@ -610,8 +610,8 @@ async function hydrateRegistryFromDisk(cwd) {
610
610
  hydrations.delete(cwd);
611
611
  throw cause;
612
612
  });
613
- hydrations.set(cwd, hidratacao);
614
- return hidratacao;
613
+ hydrations.set(cwd, hydration);
614
+ return hydration;
615
615
  }
616
616
  async function flushRegistrySaves(cwd) {
617
617
  if (cwd !== void 0) {
@@ -893,14 +893,14 @@ async function readLegacyFacts(jsonPath) {
893
893
  }
894
894
  async function writeMigratedFacts(cwd, jsonPath, facts) {
895
895
  try {
896
- for (const fact of facts) await chunkLNTQRD23_cjs.appendFactToMarkdown(cwd, fact);
896
+ for (const fact of facts) await chunkGH52NOCL_cjs.appendFactToMarkdown(cwd, fact);
897
897
  await promises.unlink(jsonPath).catch(() => void 0);
898
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
898
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
899
899
  `);
900
900
  return { migrated: true, factCount: facts.length };
901
901
  } catch (cause) {
902
902
  const message = cause instanceof Error ? cause.message : String(cause);
903
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] memory migration failed (readonly fs?): ${message}
903
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] memory migration failed (readonly fs?): ${message}
904
904
  `);
905
905
  return { migrated: false, factCount: 0, reason: "readonly-fs" };
906
906
  }
@@ -910,12 +910,12 @@ async function migrateLegacyJson(cwd, config) {
910
910
  const key = `${cwd}::${config.namespace ?? "default"}::${config.scope ?? "agent"}::${config.userId ?? "default"}`;
911
911
  if (migrationRun.has(key)) return { migrated: false, factCount: 0, reason: "already-migrated" };
912
912
  migrationRun.add(key);
913
- const jsonPath = chunkLNTQRD23_cjs.legacyMemoryJsonPath(cwd, config);
913
+ const jsonPath = chunkGH52NOCL_cjs.legacyMemoryJsonPath(cwd, config);
914
914
  if (!await fileExists(jsonPath)) {
915
915
  return { migrated: false, factCount: 0, reason: "no-legacy-json" };
916
916
  }
917
- if (await fileExists(chunkLNTQRD23_cjs.memoryMdPath(cwd))) {
918
- chunkA76OFN2B_cjs.diag(
917
+ if (await fileExists(chunkGH52NOCL_cjs.memoryMdPath(cwd))) {
918
+ chunkZHPET3LZ_cjs.diag(
919
919
  `[theokit-sdk] memory migration skipped: both MEMORY.md and legacy JSON exist at ${jsonPath}; leaving both intact
920
920
  `
921
921
  );
@@ -939,13 +939,13 @@ function extractMemoryFact(message) {
939
939
  async function readMemoryFacts(cwd, config) {
940
940
  if (!config.enabled) return [];
941
941
  await migrateLegacyJson(cwd, config);
942
- return chunkLNTQRD23_cjs.readFacts(cwd, config);
942
+ return chunkGH52NOCL_cjs.readFacts(cwd, config);
943
943
  }
944
944
  async function appendMemoryFact(cwd, config, fact) {
945
945
  if (!config.enabled) return;
946
946
  await migrateLegacyJson(cwd, config);
947
- const sanitized = { text: chunkA76OFN2B_cjs.redactSecrets(fact.text) };
948
- await chunkLNTQRD23_cjs.appendFact(cwd, config, sanitized);
947
+ const sanitized = { text: chunkZHPET3LZ_cjs.redactSecrets(fact.text) };
948
+ await chunkGH52NOCL_cjs.appendFact(cwd, config, sanitized);
949
949
  }
950
950
 
951
951
  // src/internal/runtime/fixtures/fixture-scripts.ts
@@ -1293,7 +1293,7 @@ function redactScriptSecrets(script) {
1293
1293
  function redactEventSecrets(event) {
1294
1294
  const serialized = JSON.stringify(event);
1295
1295
  const localStripped = serialized.replace(FIXTURE_SENTINEL, "***");
1296
- const redacted = chunkA76OFN2B_cjs.redactSecrets(localStripped);
1296
+ const redacted = chunkZHPET3LZ_cjs.redactSecrets(localStripped);
1297
1297
  if (redacted === serialized) return event;
1298
1298
  return JSON.parse(redacted);
1299
1299
  }
@@ -1616,7 +1616,7 @@ function createRealCloudRun(options) {
1616
1616
  conversation: []
1617
1617
  };
1618
1618
  const apiKey = resolveApiKey(options.agentOptions.apiKey);
1619
- const baseUrl = chunkSEWAPWAF_cjs.getConfiguredBaseUrl();
1619
+ const baseUrl = chunkFMIKUGF2_cjs.getConfiguredBaseUrl();
1620
1620
  const handle = new RealCloudRun(
1621
1621
  {
1622
1622
  id,
@@ -1689,7 +1689,7 @@ var RealCloudRun = class extends FixtureRunBase {
1689
1689
  });
1690
1690
  if (!response.ok) {
1691
1691
  const text = await response.text().catch(() => "");
1692
- throw new chunkE7WWIX34_cjs.NetworkError(
1692
+ throw new chunkYULF6FPB_cjs.NetworkError(
1693
1693
  `Cloud Run endpoint returned ${response.status}: ${text.slice(0, 200)}`,
1694
1694
  { code: "cloud_run_http_error" }
1695
1695
  );
@@ -1699,7 +1699,7 @@ var RealCloudRun = class extends FixtureRunBase {
1699
1699
  async consumeStream(response) {
1700
1700
  let finalStatus = "finished";
1701
1701
  let finalText = "";
1702
- for await (const record of chunkSEWAPWAF_cjs.parseSseStream(response.body, this.controller.signal)) {
1702
+ for await (const record of chunkFMIKUGF2_cjs.parseSseStream(response.body, this.controller.signal)) {
1703
1703
  const parsed = safeParse(record.data);
1704
1704
  if (parsed === void 0) continue;
1705
1705
  const update = this.applyRecord(record.event, parsed);
@@ -1808,7 +1808,7 @@ var CloudAgent = class {
1808
1808
  */
1809
1809
  isFixtureMode() {
1810
1810
  const apiKey = resolveApiKey(this.options.apiKey);
1811
- return chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) && chunkSEWAPWAF_cjs.getConfiguredBaseUrl() === void 0;
1811
+ return chunkFMIKUGF2_cjs.isFixtureApiKey(apiKey) && chunkFMIKUGF2_cjs.getConfiguredBaseUrl() === void 0;
1812
1812
  }
1813
1813
  // SE9 — integrated structured output; delegates to the shared helper.
1814
1814
  generate(message, options) {
@@ -1823,7 +1823,7 @@ var CloudAgent = class {
1823
1823
  }
1824
1824
  async send(message, options = {}) {
1825
1825
  if (options.tools !== void 0 && options.tools.length > 0) {
1826
- throw new chunkE7WWIX34_cjs.ConfigurationError(
1826
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
1827
1827
  "Custom inline tools are local-only in SDK v1.0 \u2014 cloud agents cannot serialize handler functions",
1828
1828
  { code: "cloud_custom_tools_rejected" }
1829
1829
  );
@@ -1859,7 +1859,7 @@ var CloudAgent = class {
1859
1859
  const userText = typeof message === "string" ? message : message.text;
1860
1860
  const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
1861
1861
  const apiKey = resolveApiKey(this.options.apiKey);
1862
- const useRealRuntime = apiKey !== void 0 && !chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) && chunkSEWAPWAF_cjs.getConfiguredBaseUrl() !== void 0;
1862
+ const useRealRuntime = apiKey !== void 0 && !chunkFMIKUGF2_cjs.isFixtureApiKey(apiKey) && chunkFMIKUGF2_cjs.getConfiguredBaseUrl() !== void 0;
1863
1863
  return useRealRuntime ? createRealCloudRun({
1864
1864
  agentId: this.agentId,
1865
1865
  model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
@@ -1908,7 +1908,7 @@ var CloudAgent = class {
1908
1908
  listArtifacts() {
1909
1909
  if (!this.isFixtureMode()) {
1910
1910
  return Promise.reject(
1911
- new chunkE7WWIX34_cjs.ConfigurationError(
1911
+ new chunkYULF6FPB_cjs.ConfigurationError(
1912
1912
  "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).",
1913
1913
  { code: "cloud_runtime_pre_release" }
1914
1914
  )
@@ -1918,11 +1918,11 @@ var CloudAgent = class {
1918
1918
  }
1919
1919
  downloadArtifact(path) {
1920
1920
  try {
1921
- chunkZAKTZ5B4_cjs.validateArtifactPath(path);
1921
+ chunkXA3TSBAH_cjs.validateArtifactPath(path);
1922
1922
  } catch (cause) {
1923
- if (cause instanceof chunkZAKTZ5B4_cjs.PathTraversalError) {
1923
+ if (cause instanceof chunkXA3TSBAH_cjs.PathTraversalError) {
1924
1924
  return Promise.reject(
1925
- new chunkE7WWIX34_cjs.ConfigurationError(`Artifact path must stay inside the workspace: ${path}`, {
1925
+ new chunkYULF6FPB_cjs.ConfigurationError(`Artifact path must stay inside the workspace: ${path}`, {
1926
1926
  code: "artifact_path_traversal",
1927
1927
  cause
1928
1928
  })
@@ -1932,7 +1932,7 @@ var CloudAgent = class {
1932
1932
  }
1933
1933
  if (!this.isFixtureMode()) {
1934
1934
  return Promise.reject(
1935
- new chunkE7WWIX34_cjs.ConfigurationError(
1935
+ new chunkYULF6FPB_cjs.ConfigurationError(
1936
1936
  "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).",
1937
1937
  { code: "cloud_runtime_pre_release" }
1938
1938
  )
@@ -1941,7 +1941,7 @@ var CloudAgent = class {
1941
1941
  const match = buildFixtureArtifacts().find((artifact) => artifact.path === path);
1942
1942
  if (match === void 0) {
1943
1943
  return Promise.reject(
1944
- new chunkE7WWIX34_cjs.UnknownAgentError(`Artifact ${path} not found`, { code: "unknown_artifact" })
1944
+ new chunkYULF6FPB_cjs.UnknownAgentError(`Artifact ${path} not found`, { code: "unknown_artifact" })
1945
1945
  );
1946
1946
  }
1947
1947
  return Promise.resolve(Buffer.from(`fixture artifact content for ${path}
@@ -1955,7 +1955,7 @@ var CloudAgent = class {
1955
1955
  * @public
1956
1956
  */
1957
1957
  runUntil() {
1958
- throw new chunkE7WWIX34_cjs.UnsupportedRunOperationError(
1958
+ throw new chunkYULF6FPB_cjs.UnsupportedRunOperationError(
1959
1959
  "Agent.runUntil() is not supported on cloud agents. Cloud runtime manages goal loops server-side. Use a local agent for autonomous Ralph loops.",
1960
1960
  "runUntil"
1961
1961
  );
@@ -1966,7 +1966,7 @@ var CloudAgent = class {
1966
1966
  * @public
1967
1967
  */
1968
1968
  fork() {
1969
- throw new chunkE7WWIX34_cjs.UnsupportedRunOperationError(
1969
+ throw new chunkYULF6FPB_cjs.UnsupportedRunOperationError(
1970
1970
  "Agent.fork() is not supported on cloud agents. Fork inheritance requires local credential + system-prompt access. Use a local agent.",
1971
1971
  "fork"
1972
1972
  );
@@ -1978,7 +1978,7 @@ var CloudAgent = class {
1978
1978
  * @public
1979
1979
  */
1980
1980
  runToCompletion() {
1981
- throw new chunkE7WWIX34_cjs.UnsupportedRunOperationError(
1981
+ throw new chunkYULF6FPB_cjs.UnsupportedRunOperationError(
1982
1982
  "Agent.runToCompletion() is not supported on cloud agents. Cloud runtime manages continuation server-side. Use a local agent.",
1983
1983
  "runToCompletion"
1984
1984
  );
@@ -1990,7 +1990,7 @@ var CloudAgent = class {
1990
1990
  * @public
1991
1991
  */
1992
1992
  streamToCompletion() {
1993
- throw new chunkE7WWIX34_cjs.UnsupportedRunOperationError(
1993
+ throw new chunkYULF6FPB_cjs.UnsupportedRunOperationError(
1994
1994
  "Agent.streamToCompletion() is not supported on cloud agents. Cloud runtime manages continuation server-side. Use a local agent.",
1995
1995
  "streamToCompletion"
1996
1996
  );
@@ -2004,7 +2004,7 @@ var CloudAgent = class {
2004
2004
  */
2005
2005
  usePersonality() {
2006
2006
  return Promise.reject(
2007
- new chunkE7WWIX34_cjs.UnsupportedRunOperationError(
2007
+ new chunkYULF6FPB_cjs.UnsupportedRunOperationError(
2008
2008
  "Agent.usePersonality() is not supported on cloud agents (pre-release). Use a local agent or wait for cloud GA.",
2009
2009
  "usePersonality"
2010
2010
  )
@@ -2032,7 +2032,7 @@ function validateCloudToolParity(options) {
2032
2032
  function rejectProcessors(options) {
2033
2033
  const hasProcessors = (options.inputProcessors?.length ?? 0) > 0 || (options.outputProcessors?.length ?? 0) > 0;
2034
2034
  if (hasProcessors) {
2035
- throw new chunkE7WWIX34_cjs.ConfigurationError(
2035
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
2036
2036
  "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.",
2037
2037
  { code: "cloud_incompatible_function_resolver" }
2038
2038
  );
@@ -2040,7 +2040,7 @@ function rejectProcessors(options) {
2040
2040
  }
2041
2041
  function rejectFunctionSystemPrompt(options) {
2042
2042
  if (typeof options.systemPrompt === "function") {
2043
- throw new chunkE7WWIX34_cjs.ConfigurationError(
2043
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
2044
2044
  "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.",
2045
2045
  { code: "cloud_incompatible_function_resolver" }
2046
2046
  );
@@ -2048,7 +2048,7 @@ function rejectFunctionSystemPrompt(options) {
2048
2048
  }
2049
2049
  function rejectFunctionSkills(options) {
2050
2050
  if (typeof options.skills === "function") {
2051
- throw new chunkE7WWIX34_cjs.ConfigurationError(
2051
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
2052
2052
  "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.",
2053
2053
  { code: "cloud_incompatible_function_resolver" }
2054
2054
  );
@@ -2060,7 +2060,7 @@ function rejectStdioMcpLocalPaths(options) {
2060
2060
  if (!isStdioCommandConfig(config)) continue;
2061
2061
  const command = config.command ?? "";
2062
2062
  if (isLocalPath(command)) {
2063
- throw new chunkE7WWIX34_cjs.ConfigurationError(
2063
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
2064
2064
  `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.`,
2065
2065
  { code: "cloud_incompatible_mcp_stdio_local" }
2066
2066
  );
@@ -2100,14 +2100,14 @@ async function readState(filePath) {
2100
2100
  try {
2101
2101
  parsed = JSON.parse(raw);
2102
2102
  } catch {
2103
- chunkK6TWHNT4_cjs.warnOnce(
2103
+ chunkHECR7KF5_cjs.warnOnce(
2104
2104
  "personality-store-json-parse",
2105
2105
  "[theokit-sdk] personality.json is malformed; treating as empty"
2106
2106
  );
2107
2107
  return emptyState();
2108
2108
  }
2109
2109
  if (!isStateV1(parsed)) {
2110
- chunkK6TWHNT4_cjs.warnOnce(
2110
+ chunkHECR7KF5_cjs.warnOnce(
2111
2111
  "personality-store-bad-version",
2112
2112
  `[theokit-sdk] personality.json has unknown version; treating as empty (file kept untouched)`
2113
2113
  );
@@ -2138,9 +2138,9 @@ var PersonalityStore = class {
2138
2138
  try {
2139
2139
  await this.#persist(agentId, slug);
2140
2140
  } catch (err) {
2141
- chunkK6TWHNT4_cjs.warnOnce(
2141
+ chunkHECR7KF5_cjs.warnOnce(
2142
2142
  `personality-store-persist-failure-${agentId}`,
2143
- `[theokit-sdk] personality persist failed for ${chunkA76OFN2B_cjs.redactSecrets(agentId)}: ${chunkA76OFN2B_cjs.redactSecrets(
2143
+ `[theokit-sdk] personality persist failed for ${chunkZHPET3LZ_cjs.redactSecrets(agentId)}: ${chunkZHPET3LZ_cjs.redactSecrets(
2144
2144
  err.message
2145
2145
  )}`
2146
2146
  );
@@ -2155,9 +2155,9 @@ var PersonalityStore = class {
2155
2155
  try {
2156
2156
  state = await readState(filePath);
2157
2157
  } catch (err) {
2158
- chunkK6TWHNT4_cjs.warnOnce(
2158
+ chunkHECR7KF5_cjs.warnOnce(
2159
2159
  `personality-store-hydrate-failure-${agentId}`,
2160
- `[theokit-sdk] personality hydrate failed for ${chunkA76OFN2B_cjs.redactSecrets(agentId)}: ${chunkA76OFN2B_cjs.redactSecrets(
2160
+ `[theokit-sdk] personality hydrate failed for ${chunkZHPET3LZ_cjs.redactSecrets(agentId)}: ${chunkZHPET3LZ_cjs.redactSecrets(
2161
2161
  err.message
2162
2162
  )}`
2163
2163
  );
@@ -2174,17 +2174,17 @@ var PersonalityStore = class {
2174
2174
  async #persist(agentId, slug) {
2175
2175
  const filePath = this.#filePath();
2176
2176
  await promises.mkdir(path.dirname(filePath), { recursive: true });
2177
- await chunkZVQJHY4Y_cjs.withFileLock(filePath, async () => {
2177
+ await chunk6W4U2G3J_cjs.withFileLock(filePath, async () => {
2178
2178
  const current = await readState(filePath);
2179
2179
  const nextAgents = { ...current.agents };
2180
2180
  if (slug === void 0) delete nextAgents[agentId];
2181
2181
  else nextAgents[agentId] = slug;
2182
2182
  const next = { version: SCHEMA_VERSION2, agents: nextAgents };
2183
- await chunk33B2BSME_cjs.atomicWriteJson(filePath, next);
2183
+ await chunkNETYW4V3_cjs.atomicWriteJson(filePath, next);
2184
2184
  });
2185
2185
  }
2186
2186
  #filePath() {
2187
- return path.join(chunkFMDZZRYE_cjs.getTheokitHome(this.#cwd), FILE_NAME);
2187
+ return path.join(chunk6X2HUT4A_cjs.getTheokitHome(this.#cwd), FILE_NAME);
2188
2188
  }
2189
2189
  };
2190
2190
 
@@ -2207,7 +2207,7 @@ function createPluginContext() {
2207
2207
  },
2208
2208
  on(hook, handler) {
2209
2209
  if (typeof handler !== "function") {
2210
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] ignoring non-function handler for hook "${hook}"
2210
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] ignoring non-function handler for hook "${hook}"
2211
2211
  `);
2212
2212
  return;
2213
2213
  }
@@ -2260,7 +2260,7 @@ var PluginManager = class {
2260
2260
  const seen = /* @__PURE__ */ new Set();
2261
2261
  for (const plugin of plugins) {
2262
2262
  if (seen.has(plugin.name)) {
2263
- chunkA76OFN2B_cjs.diag(
2263
+ chunkZHPET3LZ_cjs.diag(
2264
2264
  `[theokit-sdk] duplicate plugin name "${plugin.name}" \u2014 both will register independently
2265
2265
  `
2266
2266
  );
@@ -2287,7 +2287,7 @@ var PluginManager = class {
2287
2287
  */
2288
2288
  async register(plugin) {
2289
2289
  if (plugin.kind !== "general") {
2290
- throw new chunkE7WWIX34_cjs.ConfigurationError(
2290
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
2291
2291
  `late register supports general plugins only (got "${plugin.kind}" for "${plugin.name}")`,
2292
2292
  { code: "plugin_late_register_kind" }
2293
2293
  );
@@ -2344,7 +2344,7 @@ var PluginManager = class {
2344
2344
  parts.push(result.recalledContext);
2345
2345
  }
2346
2346
  } catch (err) {
2347
- chunkA76OFN2B_cjs.diag(
2347
+ chunkZHPET3LZ_cjs.diag(
2348
2348
  `[theokit-sdk] pre_user_send hook failed: ${err instanceof Error ? err.message : String(err)}
2349
2349
  `
2350
2350
  );
@@ -2372,7 +2372,7 @@ var PluginManager = class {
2372
2372
  try {
2373
2373
  await h(ctx);
2374
2374
  } catch (err) {
2375
- chunkA76OFN2B_cjs.diag(
2375
+ chunkZHPET3LZ_cjs.diag(
2376
2376
  `[theokit-sdk] post_assistant_reply hook failed: ${err instanceof Error ? err.message : String(err)}
2377
2377
  `
2378
2378
  );
@@ -2388,7 +2388,7 @@ var PluginManager = class {
2388
2388
  try {
2389
2389
  await h(ctx);
2390
2390
  } catch (err) {
2391
- chunkA76OFN2B_cjs.diag(
2391
+ chunkZHPET3LZ_cjs.diag(
2392
2392
  `[theokit-sdk] ${name} hook failed: ${err instanceof Error ? err.message : String(err)}
2393
2393
  `
2394
2394
  );
@@ -2403,7 +2403,7 @@ var PluginManager = class {
2403
2403
  const out = await h(current, ctx);
2404
2404
  if (out !== void 0) current = out;
2405
2405
  } catch (err) {
2406
- chunkA76OFN2B_cjs.diag(
2406
+ chunkZHPET3LZ_cjs.diag(
2407
2407
  `[theokit-sdk] ${name} hook failed: ${err instanceof Error ? err.message : String(err)}
2408
2408
  `
2409
2409
  );
@@ -2493,7 +2493,7 @@ function spawnAndCollect(options) {
2493
2493
  const spawnOptions = {
2494
2494
  cwd: options.cwd,
2495
2495
  // #54 — scrub secret-like parent env by default; `options.env` still wins.
2496
- env: chunkWPZTYOUX_cjs.resolveChildEnv({ policy: options.envPolicy, overrides: options.env })
2496
+ env: chunkBBZYXVLZ_cjs.resolveChildEnv({ policy: options.envPolicy, overrides: options.env })
2497
2497
  };
2498
2498
  const child = child_process.spawn(options.command, options.args ?? [], spawnOptions);
2499
2499
  let stdout = "";
@@ -2545,7 +2545,7 @@ var HooksExecutor = class {
2545
2545
  this.config = {};
2546
2546
  return;
2547
2547
  }
2548
- this.config = await chunkK6TWHNT4_cjs.loadHookConfig(this.cwd);
2548
+ this.config = await chunkHECR7KF5_cjs.loadHookConfig(this.cwd);
2549
2549
  }
2550
2550
  /** Fire every hook registered for `event` and aggregate the decisions. */
2551
2551
  async run(payload) {
@@ -2651,11 +2651,11 @@ function buildContextBudgetEvent(model, resolved) {
2651
2651
  // src/internal/runtime/lifecycle/post-run-lifecycle.ts
2652
2652
  function resolveWindowForRun(model, contextWindow) {
2653
2653
  const override = contextWindow !== void 0 && contextWindow > 0 ? contextWindow : void 0;
2654
- return chunkOVGNXGCK_cjs.resolveEffectiveContextWindow({
2654
+ return chunkNNNUQELM_cjs.resolveEffectiveContextWindow({
2655
2655
  ...override !== void 0 ? { override } : {},
2656
- catalog: chunkT6KFGMNY_cjs.getCatalogModelInfo(model)?.limit?.context,
2657
- margin: chunkOVGNXGCK_cjs.CONTEXT_WINDOW_MARGIN,
2658
- floor: chunkOVGNXGCK_cjs.CONTEXT_WINDOW_FLOOR
2656
+ catalog: chunkGLEKLAUW_cjs.getCatalogModelInfo(model)?.limit?.context,
2657
+ margin: chunkNNNUQELM_cjs.CONTEXT_WINDOW_MARGIN,
2658
+ floor: chunkNNNUQELM_cjs.CONTEXT_WINDOW_FLOOR
2659
2659
  });
2660
2660
  }
2661
2661
  async function runPostRunLifecycle(inputs) {
@@ -2677,34 +2677,34 @@ async function runPostRunLifecycle(inputs) {
2677
2677
  result = await run.wait();
2678
2678
  } catch {
2679
2679
  try {
2680
- const parcial = await safeConversation(run);
2681
- if (parcial !== void 0) {
2682
- chunkN4JNY5DT_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
2680
+ const partial = await safeConversation(run);
2681
+ if (partial !== void 0) {
2682
+ chunkZO2L5U6F_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
2683
2683
  userText,
2684
- conversation: parcial
2684
+ conversation: partial
2685
2685
  });
2686
2686
  }
2687
2687
  } catch (cause) {
2688
2688
  const msg = cause instanceof Error ? cause.message : String(cause);
2689
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
2689
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
2690
2690
  `);
2691
2691
  }
2692
- await chunkN4JNY5DT_cjs.flushSessionWrites();
2692
+ await chunkZO2L5U6F_cjs.flushSessionWrites();
2693
2693
  return;
2694
2694
  }
2695
2695
  if (result.result !== void 0) {
2696
- chunkN4JNY5DT_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
2696
+ chunkZO2L5U6F_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
2697
2697
  }
2698
2698
  const conversation = await safeConversation(run);
2699
2699
  const resolvedWindow = resolveWindowForRun(model, contextWindow);
2700
2700
  const effectiveWindow = resolvedWindow.window;
2701
2701
  const budgetEvent = buildContextBudgetEvent(model, resolvedWindow);
2702
2702
  if (budgetEvent !== void 0 && onRunEvent !== void 0) {
2703
- chunkQMIG7TKG_cjs.emitRunEvent(onRunEvent, budgetEvent);
2703
+ chunkKCQUYQ3V_cjs.emitRunEvent(onRunEvent, budgetEvent);
2704
2704
  }
2705
2705
  const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
2706
2706
  const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
2707
- chunkN4JNY5DT_cjs.persistTurnToTranscript(
2707
+ chunkZO2L5U6F_cjs.persistTurnToTranscript(
2708
2708
  sessionStore,
2709
2709
  { cwd: workspaceCwd, agentId, model },
2710
2710
  agentId,
@@ -2716,13 +2716,13 @@ async function runPostRunLifecycle(inputs) {
2716
2716
  // The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
2717
2717
  // `contextWindow` here would budget against a number the clamp already rejected.
2718
2718
  contextWindow: effectiveWindow,
2719
- summarize: chunkSEWAPWAF_cjs.buildDefaultSummarizer({
2719
+ summarize: chunkFMIKUGF2_cjs.buildDefaultSummarizer({
2720
2720
  agentModel: model,
2721
2721
  ...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
2722
2722
  })
2723
2723
  }
2724
2724
  },
2725
- onRunEvent !== void 0 ? () => chunkQMIG7TKG_cjs.emitRunEvent(onRunEvent, { type: "compact_boundary", trigger: "auto" }) : void 0
2725
+ onRunEvent !== void 0 ? () => chunkKCQUYQ3V_cjs.emitRunEvent(onRunEvent, { type: "compact_boundary", trigger: "auto" }) : void 0
2726
2726
  );
2727
2727
  if (result.status === "finished" && result.result !== void 0) {
2728
2728
  const summaryArgs = {
@@ -2738,14 +2738,14 @@ async function runPostRunLifecycle(inputs) {
2738
2738
  if (memoryProvider?.recordSessionSummary !== void 0) {
2739
2739
  await memoryProvider.recordSessionSummary(summaryArgs);
2740
2740
  } else {
2741
- await chunkLNTQRD23_cjs.writeSessionSummary(summaryArgs);
2741
+ await chunkGH52NOCL_cjs.writeSessionSummary(summaryArgs);
2742
2742
  }
2743
2743
  if (!shouldUsePortMemoryPath()) {
2744
2744
  void memoryGlue.syncIfReady();
2745
2745
  }
2746
2746
  } catch (cause) {
2747
2747
  const message = cause instanceof Error ? cause.message : String(cause);
2748
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] session summary write failed (${result.id}): ${message}
2748
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] session summary write failed (${result.id}): ${message}
2749
2749
  `);
2750
2750
  }
2751
2751
  }
@@ -2758,7 +2758,7 @@ async function runPostRunLifecycle(inputs) {
2758
2758
  agentId,
2759
2759
  runId: result.id
2760
2760
  });
2761
- await chunkN4JNY5DT_cjs.flushSessionWrites();
2761
+ await chunkZO2L5U6F_cjs.flushSessionWrites();
2762
2762
  }
2763
2763
  async function safeConversation(run) {
2764
2764
  try {
@@ -2833,7 +2833,7 @@ var warned = /* @__PURE__ */ new Set();
2833
2833
  function warnDoubleReasoningOnce() {
2834
2834
  if (warned.has("double-reasoning")) return;
2835
2835
  warned.add("double-reasoning");
2836
- chunkA76OFN2B_cjs.diag(
2836
+ chunkZHPET3LZ_cjs.diag(
2837
2837
  "[theokit-sdk] `reasoning: true` skipped \u2014 a native reasoning model is configured (model.params thinking/reasoning); native reasoning wins. Remove one to silence.\n"
2838
2838
  );
2839
2839
  }
@@ -2866,9 +2866,9 @@ var SkillsManager = class {
2866
2866
  }
2867
2867
  async refresh() {
2868
2868
  const skillsRoot = this.skillsDir ?? path.join(this.cwd, ".theokit", "skills");
2869
- const discovered = await chunkCJHBSSAF_cjs.discoverSkills(skillsRoot, {
2869
+ const discovered = await chunk64TJCXY5_cjs.discoverSkills(skillsRoot, {
2870
2870
  onInvalidSkill: (info) => {
2871
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
2871
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
2872
2872
  `);
2873
2873
  }
2874
2874
  });
@@ -2892,7 +2892,7 @@ var SkillsManager = class {
2892
2892
  async get(name) {
2893
2893
  const skill = this.skills.find((s) => s.name === name);
2894
2894
  if (skill === void 0) return void 0;
2895
- const instructions = typeof skill.instructions === "string" ? skill.instructions : chunkCJHBSSAF_cjs.stripSkillFrontmatter(await promises.readFile(skill.source, "utf8"));
2895
+ const instructions = typeof skill.instructions === "string" ? skill.instructions : chunk64TJCXY5_cjs.stripSkillFrontmatter(await promises.readFile(skill.source, "utf8"));
2896
2896
  const references = skill.references;
2897
2897
  return {
2898
2898
  name: skill.name,
@@ -2978,7 +2978,7 @@ async function safeCall(fn, fallback, label = "safeCall") {
2978
2978
  return await fn();
2979
2979
  } catch (cause) {
2980
2980
  const message = cause instanceof Error ? cause.message : String(cause);
2981
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] ${label} failed: ${message}
2981
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] ${label} failed: ${message}
2982
2982
  `);
2983
2983
  return fallback;
2984
2984
  }
@@ -2992,7 +2992,7 @@ var ActiveMemoryPromptProvider = class {
2992
2992
  if (ctx.activeMemorySummary === void 0 || ctx.activeMemorySummary.length === 0) {
2993
2993
  return Promise.resolve(void 0);
2994
2994
  }
2995
- const body = chunkCJHBSSAF_cjs.escapeBlockBody(ctx.activeMemorySummary);
2995
+ const body = chunk64TJCXY5_cjs.escapeBlockBody(ctx.activeMemorySummary);
2996
2996
  return Promise.resolve(`<active-memory>
2997
2997
  ${body}
2998
2998
  </active-memory>`);
@@ -3045,7 +3045,7 @@ function formatSource(name, tokens) {
3045
3045
  if (tokens.length === 0) {
3046
3046
  return ` <source name="${escapeAttribute(name)}" />`;
3047
3047
  }
3048
- const body = chunkCJHBSSAF_cjs.escapeBlockBody(tokens.join(" "));
3048
+ const body = chunk64TJCXY5_cjs.escapeBlockBody(tokens.join(" "));
3049
3049
  return ` <source name="${escapeAttribute(name)}">
3050
3050
  ${body}
3051
3051
  </source>`;
@@ -3061,7 +3061,7 @@ var MemoryPromptProvider = class {
3061
3061
  contribute(ctx) {
3062
3062
  if (ctx.memoryAutoInject === false) return Promise.resolve(void 0);
3063
3063
  if (ctx.memory.length === 0) return Promise.resolve(void 0);
3064
- const lines = ctx.memory.map((fact) => ` - ${chunkCJHBSSAF_cjs.escapeBlockBody(fact.text)}`);
3064
+ const lines = ctx.memory.map((fact) => ` - ${chunk64TJCXY5_cjs.escapeBlockBody(fact.text)}`);
3065
3065
  return Promise.resolve(`<memory>
3066
3066
  ${lines.join("\n")}
3067
3067
  </memory>`);
@@ -3083,7 +3083,7 @@ var SkillsPromptProvider = class {
3083
3083
  priority = 20;
3084
3084
  contribute(ctx) {
3085
3085
  if (ctx.skillsAutoInject === false) return Promise.resolve(void 0);
3086
- return Promise.resolve(chunkCJHBSSAF_cjs.buildSkillsBlock(ctx.skills));
3086
+ return Promise.resolve(chunk64TJCXY5_cjs.buildSkillsBlock(ctx.skills));
3087
3087
  }
3088
3088
  };
3089
3089
 
@@ -3095,7 +3095,7 @@ var SystemPromptPipeline = class _SystemPromptPipeline {
3095
3095
  for (const p of providers) {
3096
3096
  const key = `${p.priority}:${p.id}`;
3097
3097
  if (seen.has(key)) {
3098
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Duplicate system-prompt provider ${key}`, {
3098
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Duplicate system-prompt provider ${key}`, {
3099
3099
  code: "pipeline_duplicate_provider"
3100
3100
  });
3101
3101
  }
@@ -3142,7 +3142,7 @@ function validateAgentOptions(options) {
3142
3142
  ensureRuntimeShape(options);
3143
3143
  if (options.local !== void 0) {
3144
3144
  if (options.model === void 0) {
3145
- throw new chunkE7WWIX34_cjs.ConfigurationError("Local agents require a model selection", {
3145
+ throw new chunkYULF6FPB_cjs.ConfigurationError("Local agents require a model selection", {
3146
3146
  code: "missing_model"
3147
3147
  });
3148
3148
  }
@@ -3166,7 +3166,7 @@ function validateCredentialPoolShape(options) {
3166
3166
  ([, arr]) => Array.isArray(arr) && arr.some((k) => typeof k === "string" && k.length > 0)
3167
3167
  );
3168
3168
  if (populated.length === 0) return;
3169
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3169
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3170
3170
  "Ambiguous credential configuration: use either `apiKey: '...'` (single-key, simplest) OR `apiKeys: { provider: [...] }` (multi-key pool), not both.",
3171
3171
  { code: "credential_pool_ambiguous" }
3172
3172
  );
@@ -3175,7 +3175,7 @@ function validatePlugins(options) {
3175
3175
  const plugins = options.plugins;
3176
3176
  if (plugins?.paths === void 0) return;
3177
3177
  if (options.cloud !== void 0 && plugins.paths.length > 0) {
3178
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3178
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3179
3179
  "Cloud agents require committed plugin manifests; local plugin paths are not supported",
3180
3180
  { code: "cloud_plugin_path_rejected" }
3181
3181
  );
@@ -3183,7 +3183,7 @@ function validatePlugins(options) {
3183
3183
  }
3184
3184
  function ensureRuntimeShape(options) {
3185
3185
  if (options.local !== void 0 && options.cloud !== void 0) {
3186
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3186
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3187
3187
  "Pass either local or cloud \u2014 they are mutually exclusive runtimes",
3188
3188
  { code: "runtime_exclusive" }
3189
3189
  );
@@ -3191,7 +3191,7 @@ function ensureRuntimeShape(options) {
3191
3191
  }
3192
3192
  function rejectProgrammaticHooks(options) {
3193
3193
  if (options.hooks !== void 0) {
3194
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3194
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3195
3195
  "Programmatic hooks are not supported \u2014 hooks are file-based only (.theokit/hooks.json)",
3196
3196
  { code: "programmatic_hooks_rejected" }
3197
3197
  );
@@ -3201,7 +3201,7 @@ function validateCloud(cloud) {
3201
3201
  if (cloud.envVars !== void 0) {
3202
3202
  for (const key of Object.keys(cloud.envVars)) {
3203
3203
  if (key.startsWith("THEOKIT_")) {
3204
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3204
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3205
3205
  `Cloud envVars cannot use the reserved THEOKIT_ prefix (got "${key}")`,
3206
3206
  { code: "reserved_env_prefix" }
3207
3207
  );
@@ -3213,7 +3213,7 @@ function validateMcpServers(options) {
3213
3213
  if (options.mcpServers === void 0) return;
3214
3214
  for (const [name, config] of Object.entries(options.mcpServers)) {
3215
3215
  if (options.cloud !== void 0 && isStdioWithCwd(config)) {
3216
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3216
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3217
3217
  `MCP server "${name}" uses stdio with cwd, which is rejected for cloud agents`,
3218
3218
  { code: "cloud_stdio_cwd_rejected" }
3219
3219
  );
@@ -3232,12 +3232,12 @@ function validateSubagents(agents2) {
3232
3232
  if (agents2 === void 0) return;
3233
3233
  for (const [name, definition] of Object.entries(agents2)) {
3234
3234
  if (typeof definition.description !== "string" || definition.description.length === 0) {
3235
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty description`, {
3235
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty description`, {
3236
3236
  code: "subagent_missing_description"
3237
3237
  });
3238
3238
  }
3239
3239
  if (typeof definition.prompt !== "string" || definition.prompt.length === 0) {
3240
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty prompt`, {
3240
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty prompt`, {
3241
3241
  code: "subagent_missing_prompt"
3242
3242
  });
3243
3243
  }
@@ -3250,7 +3250,7 @@ function validateToolCatalog(tools) {
3250
3250
  for (const tool of tools) {
3251
3251
  validateSingleTool(tool);
3252
3252
  if (seen.has(tool.name)) {
3253
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Duplicate custom tool name "${tool.name}"`, {
3253
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Duplicate custom tool name "${tool.name}"`, {
3254
3254
  code: "duplicate_tool_name"
3255
3255
  });
3256
3256
  }
@@ -3261,7 +3261,7 @@ function validateCustomTools(options) {
3261
3261
  const tools = options.tools;
3262
3262
  if (tools === void 0 || tools.length === 0) return;
3263
3263
  if (options.cloud !== void 0) {
3264
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3264
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3265
3265
  "Custom inline tools are local-only in SDK v1.0 \u2014 cloud agents cannot serialize handler functions",
3266
3266
  { code: "cloud_custom_tools_rejected" }
3267
3267
  );
@@ -3273,25 +3273,25 @@ function validateSingleTool(tool) {
3273
3273
  validateToolDescription(tool);
3274
3274
  validateToolSchema(tool);
3275
3275
  if (typeof tool.handler !== "function") {
3276
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a handler function`, {
3276
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a handler function`, {
3277
3277
  code: "tool_missing_handler"
3278
3278
  });
3279
3279
  }
3280
3280
  }
3281
3281
  function validateToolName(tool) {
3282
3282
  if (typeof tool.name !== "string" || tool.name.length === 0) {
3283
- throw new chunkE7WWIX34_cjs.ConfigurationError("Custom tool requires a non-empty name", {
3283
+ throw new chunkYULF6FPB_cjs.ConfigurationError("Custom tool requires a non-empty name", {
3284
3284
  code: "tool_missing_name"
3285
3285
  });
3286
3286
  }
3287
3287
  if (!TOOL_NAME_PATTERN.test(tool.name)) {
3288
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3288
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3289
3289
  `Custom tool name "${tool.name}" must match /^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/`,
3290
3290
  { code: "tool_invalid_name" }
3291
3291
  );
3292
3292
  }
3293
3293
  if (RESERVED_TOOL_NAMES.has(tool.name) || tool.name.startsWith("mcp_")) {
3294
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3294
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3295
3295
  `Custom tool name "${tool.name}" collides with a reserved SDK tool name`,
3296
3296
  { code: "tool_reserved_name" }
3297
3297
  );
@@ -3299,7 +3299,7 @@ function validateToolName(tool) {
3299
3299
  }
3300
3300
  function validateToolDescription(tool) {
3301
3301
  if (typeof tool.description !== "string" || tool.description.length === 0) {
3302
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a non-empty description`, {
3302
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a non-empty description`, {
3303
3303
  code: "tool_missing_description"
3304
3304
  });
3305
3305
  }
@@ -3307,12 +3307,12 @@ function validateToolDescription(tool) {
3307
3307
  function validateToolSchema(tool) {
3308
3308
  const schema = tool.inputSchema;
3309
3309
  if (schema === null || schema === void 0 || typeof schema !== "object") {
3310
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Custom tool "${tool.name}" requires an inputSchema object`, {
3310
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Custom tool "${tool.name}" requires an inputSchema object`, {
3311
3311
  code: "tool_missing_schema"
3312
3312
  });
3313
3313
  }
3314
3314
  if (schema.type !== "object") {
3315
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3315
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3316
3316
  `Custom tool "${tool.name}" inputSchema must declare \`type: "object"\``,
3317
3317
  { code: "tool_invalid_schema_type" }
3318
3318
  );
@@ -3323,7 +3323,7 @@ function validateMemory(options) {
3323
3323
  if (memory?.storePath === void 0) return;
3324
3324
  const storePath = memory.storePath;
3325
3325
  if (storePath.includes("..") || storePath.startsWith("/") || /^[A-Z]:/i.test(storePath)) {
3326
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3326
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3327
3327
  `Memory storePath must stay inside the workspace; got "${storePath}"`,
3328
3328
  { code: "memory_path_traversal" }
3329
3329
  );
@@ -3345,7 +3345,7 @@ var HISTOGRAM_NAMES = {
3345
3345
  };
3346
3346
  function safeRequire(moduleName) {
3347
3347
  try {
3348
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-SHQEZ6Q2.cjs', document.baseURI).href)));
3348
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-F5DSDDBY.cjs', document.baseURI).href)));
3349
3349
  return r(moduleName);
3350
3350
  } catch {
3351
3351
  return void 0;
@@ -3424,7 +3424,7 @@ var langfuseAdapter = {
3424
3424
  }
3425
3425
  }
3426
3426
  if (lf.LangfuseSpanProcessor === void 0) {
3427
- chunkA76OFN2B_cjs.diag(
3427
+ chunkZHPET3LZ_cjs.diag(
3428
3428
  "[theokit-sdk] @langfuse/node detected but LangfuseSpanProcessor not found (v2?). Use Langfuse v3+ for auto-instrumentation.\n"
3429
3429
  );
3430
3430
  return;
@@ -3553,11 +3553,11 @@ function tryAutoRegisterAdapters(settings) {
3553
3553
  try {
3554
3554
  adapter.register();
3555
3555
  registered.add(adapter.moduleName);
3556
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] telemetry: ${adapter.displayName} auto-instrumented.
3556
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] telemetry: ${adapter.displayName} auto-instrumented.
3557
3557
  `);
3558
3558
  } catch (cause) {
3559
3559
  const message = cause instanceof Error ? cause.message : String(cause);
3560
- chunkA76OFN2B_cjs.diag(
3560
+ chunkZHPET3LZ_cjs.diag(
3561
3561
  `[theokit-sdk] telemetry: ${adapter.displayName} detected but failed to register: ${message}
3562
3562
  `
3563
3563
  );
@@ -3570,7 +3570,7 @@ var cachedOtel;
3570
3570
  function loadOtel() {
3571
3571
  if (cachedOtel === void 0) {
3572
3572
  try {
3573
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-SHQEZ6Q2.cjs', document.baseURI).href)));
3573
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-F5DSDDBY.cjs', document.baseURI).href)));
3574
3574
  const mod = r("@opentelemetry/api");
3575
3575
  cachedOtel = mod;
3576
3576
  } catch {
@@ -3613,7 +3613,7 @@ function safe(op, fallback) {
3613
3613
  if (!warnedOnce) {
3614
3614
  warnedOnce = true;
3615
3615
  const message = cause instanceof Error ? cause.message : String(cause);
3616
- chunkA76OFN2B_cjs.diag(
3616
+ chunkZHPET3LZ_cjs.diag(
3617
3617
  `[theokit-sdk] telemetry exporter error (suppressed; agent.send continues): ${message}
3618
3618
  `
3619
3619
  );
@@ -3627,7 +3627,7 @@ function createTelemetry(settings) {
3627
3627
  if (otel === null) {
3628
3628
  if (!warnedOnce) {
3629
3629
  warnedOnce = true;
3630
- chunkA76OFN2B_cjs.diag(
3630
+ chunkZHPET3LZ_cjs.diag(
3631
3631
  "[theokit-sdk] telemetry.enabled = true but `@opentelemetry/api` is not installed; telemetry is a no-op.\n"
3632
3632
  );
3633
3633
  }
@@ -3721,12 +3721,12 @@ function wrapSpan(span, openSpans) {
3721
3721
  }
3722
3722
  function redactAttrValue(value) {
3723
3723
  if (typeof value !== "string") return value;
3724
- return chunkA76OFN2B_cjs.redactSecrets(value);
3724
+ return chunkZHPET3LZ_cjs.redactSecrets(value);
3725
3725
  }
3726
3726
  function redactAttrs(attrs) {
3727
3727
  const out = {};
3728
3728
  for (const [k, v] of Object.entries(attrs)) {
3729
- out[k] = typeof v === "string" ? chunkA76OFN2B_cjs.redactSecrets(v) : v;
3729
+ out[k] = typeof v === "string" ? chunkZHPET3LZ_cjs.redactSecrets(v) : v;
3730
3730
  }
3731
3731
  return out;
3732
3732
  }
@@ -3808,10 +3808,10 @@ async function loadMarkdownEntities(opts) {
3808
3808
  const raw = await promises.readFile(resolved.source, "utf8").catch(() => null);
3809
3809
  if (raw === null) continue;
3810
3810
  const split = splitFrontmatter(raw, resolved.source, errorCodePrefix);
3811
- const fields = chunkLY4KEOOY_cjs.parseSimpleYaml(split.frontmatter);
3811
+ const fields = chunkBRHRQOJA_cjs.parseSimpleYaml(split.frontmatter);
3812
3812
  const parsed = schema.safeParse(fields);
3813
3813
  if (!parsed.success) {
3814
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3814
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3815
3815
  `Invalid frontmatter in ${resolved.source}: ${parsed.error.message}`,
3816
3816
  { code: `${errorCodePrefix}_frontmatter_invalid` }
3817
3817
  );
@@ -3829,13 +3829,13 @@ async function assertFileSizeUnderCap(source, errorCodePrefix) {
3829
3829
  try {
3830
3830
  const info = await promises.stat(source);
3831
3831
  if (info.size > MAX_MD_FILE_BYTES) {
3832
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3832
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3833
3833
  `Config file ${source} exceeds 1 MB size limit (${info.size} bytes). Reduce the file or split into multiple entities.`,
3834
3834
  { code: `${errorCodePrefix}_file_too_large` }
3835
3835
  );
3836
3836
  }
3837
3837
  } catch (cause) {
3838
- if (cause instanceof chunkE7WWIX34_cjs.ConfigurationError) throw cause;
3838
+ if (cause instanceof chunkYULF6FPB_cjs.ConfigurationError) throw cause;
3839
3839
  }
3840
3840
  }
3841
3841
  async function readDirSafe(dir, errorCodePrefix) {
@@ -3844,7 +3844,7 @@ async function readDirSafe(dir, errorCodePrefix) {
3844
3844
  } catch (cause) {
3845
3845
  const code = cause.code;
3846
3846
  if (code === "ENOENT") return null;
3847
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Failed to read ${dir}`, {
3847
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Failed to read ${dir}`, {
3848
3848
  code: `${errorCodePrefix}_dir_read_error`,
3849
3849
  cause
3850
3850
  });
@@ -3861,7 +3861,7 @@ function resolveEntryPath(entry, pattern, dir) {
3861
3861
  function splitFrontmatter(raw, source, errorCodePrefix) {
3862
3862
  const match = /^---\s*\n([\s\S]*?)\n---\s*(?:\n|$)/.exec(raw);
3863
3863
  if (match === null) {
3864
- throw new chunkE7WWIX34_cjs.ConfigurationError(
3864
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
3865
3865
  `Missing or malformed frontmatter in ${source} (expected \`---\` delimited block at file head)`,
3866
3866
  { code: `${errorCodePrefix}_missing_frontmatter` }
3867
3867
  );
@@ -4345,7 +4345,7 @@ async function loadContextConfig(cwd) {
4345
4345
  });
4346
4346
  if (mdEntities.length > 0) {
4347
4347
  if (fs.existsSync(jsonPath)) {
4348
- chunkK6TWHNT4_cjs.warnOnce(
4348
+ chunkHECR7KF5_cjs.warnOnce(
4349
4349
  "context-both-present",
4350
4350
  "[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
4351
4351
  );
@@ -4355,7 +4355,7 @@ async function loadContextConfig(cwd) {
4355
4355
  };
4356
4356
  }
4357
4357
  if (!fs.existsSync(jsonPath)) return { sources: [] };
4358
- chunkK6TWHNT4_cjs.warnOnce(
4358
+ chunkHECR7KF5_cjs.warnOnce(
4359
4359
  "context-json-deprecated",
4360
4360
  "[theokit-sdk] .theokit/context.json is deprecated; migrate to .theokit/context/<name>.md via theokit-migrate-config"
4361
4361
  );
@@ -4363,7 +4363,7 @@ async function loadContextConfig(cwd) {
4363
4363
  try {
4364
4364
  raw = await promises.readFile(jsonPath, "utf8");
4365
4365
  } catch (cause) {
4366
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Failed to read context config: ${jsonPath}`, {
4366
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Failed to read context config: ${jsonPath}`, {
4367
4367
  code: "context_read_error",
4368
4368
  cause
4369
4369
  });
@@ -4375,13 +4375,13 @@ function parseConfig(raw, configPath) {
4375
4375
  try {
4376
4376
  parsed = JSON.parse(raw);
4377
4377
  } catch (cause) {
4378
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Invalid JSON in context config: ${configPath}`, {
4378
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Invalid JSON in context config: ${configPath}`, {
4379
4379
  code: "context_json_invalid",
4380
4380
  cause
4381
4381
  });
4382
4382
  }
4383
4383
  if (!parsed || typeof parsed !== "object") {
4384
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Context config must be an object: ${configPath}`, {
4384
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Context config must be an object: ${configPath}`, {
4385
4385
  code: "context_config_shape"
4386
4386
  });
4387
4387
  }
@@ -4396,7 +4396,7 @@ function parseConfig(raw, configPath) {
4396
4396
  }
4397
4397
  function readSources(sourcesRaw, configPath) {
4398
4398
  if (!Array.isArray(sourcesRaw)) {
4399
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Context config sources must be an array: ${configPath}`, {
4399
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Context config sources must be an array: ${configPath}`, {
4400
4400
  code: "context_sources_shape"
4401
4401
  });
4402
4402
  }
@@ -4494,7 +4494,7 @@ var PluginsManager = class {
4494
4494
  async refresh() {
4495
4495
  this.plugins = [];
4496
4496
  const pluginsRoot = path.join(this.cwd, ".theokit", "plugins");
4497
- const entries = await chunkLY4KEOOY_cjs.readWorkspaceDir(pluginsRoot, "plugins_read_error", "plugins directory");
4497
+ const entries = await chunkBRHRQOJA_cjs.readWorkspaceDir(pluginsRoot, "plugins_read_error", "plugins directory");
4498
4498
  for (const entry of entries) {
4499
4499
  if (!entry.isDirectory()) continue;
4500
4500
  const folderName = entry.name;
@@ -4502,13 +4502,13 @@ var PluginsManager = class {
4502
4502
  const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
4503
4503
  const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(pluginsRoot, folderName) : await loadPluginManifestFromJson(jsonPath, folderName);
4504
4504
  if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4505
- chunkK6TWHNT4_cjs.warnOnce(
4505
+ chunkHECR7KF5_cjs.warnOnce(
4506
4506
  `plugin-${folderName}-both`,
4507
4507
  `[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
4508
4508
  );
4509
4509
  }
4510
4510
  if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4511
- chunkK6TWHNT4_cjs.warnOnce(
4511
+ chunkHECR7KF5_cjs.warnOnce(
4512
4512
  "plugin-json-deprecated",
4513
4513
  "[theokit-sdk] plugin.json manifests are deprecated; migrate to PLUGIN.md via theokit-migrate-config"
4514
4514
  );
@@ -4526,11 +4526,11 @@ var PluginsManager = class {
4526
4526
  const entry = metadata.entry;
4527
4527
  if (entry === void 0) return;
4528
4528
  const pluginRoot = path.join(this.cwd, ".theokit", "plugins", folderName);
4529
- const entryPath = chunkZAKTZ5B4_cjs.safePathJoin(pluginRoot, entry);
4529
+ const entryPath = chunkXA3TSBAH_cjs.safePathJoin(pluginRoot, entry);
4530
4530
  try {
4531
4531
  await promises.readFile(entryPath, "utf8");
4532
4532
  } catch (cause) {
4533
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${metadata.name} entry file is missing: ${entry}`, {
4533
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${metadata.name} entry file is missing: ${entry}`, {
4534
4534
  code: "plugin_entry_missing",
4535
4535
  cause
4536
4536
  });
@@ -4539,7 +4539,7 @@ var PluginsManager = class {
4539
4539
  assertCloudRules() {
4540
4540
  if (!this.cloud) return;
4541
4541
  if (this.localPaths !== void 0 && this.localPaths.length > 0) {
4542
- throw new chunkE7WWIX34_cjs.ConfigurationError(
4542
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
4543
4543
  "Cloud agents reject local plugin paths \u2014 plugins must come from committed repo files",
4544
4544
  { code: "cloud_plugin_path_rejected" }
4545
4545
  );
@@ -4551,7 +4551,7 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
4551
4551
  try {
4552
4552
  raw = await promises.readFile(manifestPath, "utf8");
4553
4553
  } catch (cause) {
4554
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} is missing plugin.json`, {
4554
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} is missing plugin.json`, {
4555
4555
  code: "plugin_missing_manifest",
4556
4556
  cause
4557
4557
  });
@@ -4560,13 +4560,13 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
4560
4560
  try {
4561
4561
  parsed = JSON.parse(raw);
4562
4562
  } catch (cause) {
4563
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} manifest is invalid JSON`, {
4563
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} manifest is invalid JSON`, {
4564
4564
  code: "plugin_manifest_invalid",
4565
4565
  cause
4566
4566
  });
4567
4567
  }
4568
4568
  if (!parsed || typeof parsed !== "object") {
4569
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} manifest must be an object`, {
4569
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} manifest must be an object`, {
4570
4570
  code: "plugin_manifest_shape"
4571
4571
  });
4572
4572
  }
@@ -4585,7 +4585,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
4585
4585
  try {
4586
4586
  raw = await promises.readFile(mdPath, "utf8");
4587
4587
  } catch (cause) {
4588
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} is missing PLUGIN.md`, {
4588
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} is missing PLUGIN.md`, {
4589
4589
  code: "plugin_missing_manifest",
4590
4590
  cause
4591
4591
  });
@@ -4600,7 +4600,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
4600
4600
  });
4601
4601
  const entity = entities.find((e) => e.slug === "PLUGIN");
4602
4602
  if (entity === void 0) {
4603
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} PLUGIN.md not parseable`, {
4603
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} PLUGIN.md not parseable`, {
4604
4604
  code: "plugin_missing_manifest"
4605
4605
  });
4606
4606
  }
@@ -4874,7 +4874,7 @@ function assertValidThresholds(soft, hard) {
4874
4874
  ["hardThreshold", hard]
4875
4875
  ]) {
4876
4876
  if (!Number.isInteger(value) || value < 1) {
4877
- throw new chunkE7WWIX34_cjs.ConfigurationError(
4877
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
4878
4878
  `doomLoop.${label} must be a positive integer (received ${value}).`,
4879
4879
  { code: "invalid_doom_loop_threshold" }
4880
4880
  );
@@ -5097,7 +5097,7 @@ async function initLoopContext(inputs) {
5097
5097
  memoryProviderHandle = void 0;
5098
5098
  }
5099
5099
  }
5100
- const tools = await collectTools(inputs.mcp);
5100
+ const tools = await collectTools(inputs.mcp, inputs.runEventSink);
5101
5101
  for (const memTool of inputs.memoryTools ?? []) {
5102
5102
  tools.push({
5103
5103
  name: memTool.name,
@@ -5181,18 +5181,19 @@ async function initLoopContext(inputs) {
5181
5181
  ...memorySystemPromptAdditions !== void 0 ? { memorySystemPromptAdditions } : {}
5182
5182
  };
5183
5183
  }
5184
- async function safeListTools(client, serverName) {
5184
+ async function safeListTools(client, serverName, sink) {
5185
5185
  try {
5186
5186
  return await client.listTools();
5187
5187
  } catch (cause) {
5188
5188
  const message = cause instanceof Error ? cause.message : String(cause);
5189
5189
  const server = serverName ?? "unknown";
5190
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] mcp listTools failed (server=${server}): ${message}
5190
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] mcp listTools failed (server=${server}): ${message}
5191
5191
  `);
5192
+ chunkKCQUYQ3V_cjs.emitRunEvent(sink, { type: "mcp_server_failed", serverName: server, message });
5192
5193
  return [];
5193
5194
  }
5194
5195
  }
5195
- async function collectTools(mcp) {
5196
+ async function collectTools(mcp, sink) {
5196
5197
  const tools = [
5197
5198
  {
5198
5199
  name: "shell",
@@ -5206,7 +5207,7 @@ async function collectTools(mcp) {
5206
5207
  }
5207
5208
  ];
5208
5209
  for (const [serverName, client] of mcp.entries()) {
5209
- const mcpTools = await safeListTools(client, serverName);
5210
+ const mcpTools = await safeListTools(client, serverName, sink);
5210
5211
  for (const tool of mcpTools) {
5211
5212
  tools.push({
5212
5213
  name: `mcp_${sanitize(serverName)}_${sanitize(tool.name)}`,
@@ -5256,7 +5257,7 @@ function emitLlmMetrics(inputs, result, startAt) {
5256
5257
  inputs.telemetry?.recordHistogram(HISTOGRAM_NAMES.LLM_USAGE_MISSING, 1, {
5257
5258
  provider: inputs.llm.name
5258
5259
  });
5259
- chunkA76OFN2B_cjs.diag(
5260
+ chunkZHPET3LZ_cjs.diag(
5260
5261
  `[theokit-sdk] llm usage missing from ${inputs.llm.name} finish \u2014 budget may undercount
5261
5262
  `
5262
5263
  );
@@ -5552,7 +5553,7 @@ function coerceArgsToSchema(args, schema) {
5552
5553
  }
5553
5554
 
5554
5555
  // src/tool-error.ts
5555
- var ToolError = class extends chunkE7WWIX34_cjs.TheokitAgentError {
5556
+ var ToolError = class extends chunkYULF6FPB_cjs.TheokitAgentError {
5556
5557
  name = "ToolError";
5557
5558
  /** The error content surfaced to the model: a string, or text/image blocks. */
5558
5559
  content;
@@ -5746,7 +5747,7 @@ function raceToolExecution(exec, opts) {
5746
5747
  // src/internal/agent-loop/tool-dispatch.ts
5747
5748
  async function dispatchTools(inputs, tools, toolCalls, events, parentSpan) {
5748
5749
  const maxConcurrent = inputs.maxConcurrentTools ?? 4;
5749
- return chunkRHQJX3EI_cjs.mapWithConcurrency(
5750
+ return chunkOEFFPR2S_cjs.mapWithConcurrency(
5750
5751
  toolCalls,
5751
5752
  maxConcurrent,
5752
5753
  (call) => dispatchSingleCall(inputs, tools, call, events, parentSpan)
@@ -5774,7 +5775,7 @@ async function dispatchSingleCall(inputs, tools, call, events, parentSpan) {
5774
5775
  toolSpan?.end();
5775
5776
  return fileVeto;
5776
5777
  }
5777
- chunkQMIG7TKG_cjs.emitRunEvent(inputs.runEventSink, {
5778
+ chunkKCQUYQ3V_cjs.emitRunEvent(inputs.runEventSink, {
5778
5779
  type: "tool_progress",
5779
5780
  toolName: workingCall.name,
5780
5781
  toolCallId: callId
@@ -5805,7 +5806,7 @@ function applyRepairAndExtractCall(tools, call) {
5805
5806
  function vetoFromForkWhitelist(inputs, call, callId, events) {
5806
5807
  const whitelistDecision = chunkVJ26EKGJ_cjs.checkToolWhitelist(call.name);
5807
5808
  if (whitelistDecision.allowed) return void 0;
5808
- chunkQMIG7TKG_cjs.emitRunEvent(inputs.runEventSink, {
5809
+ chunkKCQUYQ3V_cjs.emitRunEvent(inputs.runEventSink, {
5809
5810
  type: "permission_denied",
5810
5811
  toolName: call.name,
5811
5812
  toolCallId: callId,
@@ -5850,7 +5851,7 @@ async function vetoFromPluginPreHook(inputs, call, callId, events) {
5850
5851
  ...inputs.permissionMode !== void 0 ? { permissionMode: inputs.permissionMode } : {}
5851
5852
  });
5852
5853
  if (pluginVeto === void 0) return void 0;
5853
- chunkQMIG7TKG_cjs.emitRunEvent(inputs.runEventSink, {
5854
+ chunkKCQUYQ3V_cjs.emitRunEvent(inputs.runEventSink, {
5854
5855
  type: "permission_denied",
5855
5856
  toolName: call.name,
5856
5857
  toolCallId: callId,
@@ -5879,7 +5880,7 @@ async function vetoFromFileHookPreDecision(inputs, call, callId, events) {
5879
5880
  runId: inputs.runId
5880
5881
  });
5881
5882
  if (!preDecision.blocked) return void 0;
5882
- chunkQMIG7TKG_cjs.emitRunEvent(inputs.runEventSink, {
5883
+ chunkKCQUYQ3V_cjs.emitRunEvent(inputs.runEventSink, {
5883
5884
  type: "permission_denied",
5884
5885
  toolName: call.name,
5885
5886
  toolCallId: callId,
@@ -5980,7 +5981,7 @@ function finalizeSpanAndPostHook(inputs, call, callId, result, events, toolSpan)
5980
5981
  agentId: inputs.agentId,
5981
5982
  runId: inputs.runId
5982
5983
  }).catch((err) => {
5983
- chunkA76OFN2B_cjs.diag(
5984
+ chunkZHPET3LZ_cjs.diag(
5984
5985
  `[theokit-sdk] postToolUse hook error (swallowed): ${err instanceof Error ? err.message : String(err)}
5985
5986
  `
5986
5987
  );
@@ -5999,7 +6000,7 @@ async function emitToolLifecycleDelta(inputs, update) {
5999
6000
  try {
6000
6001
  await inputs.onDelta({ update });
6001
6002
  } catch (err) {
6002
- chunkA76OFN2B_cjs.diag(
6003
+ chunkZHPET3LZ_cjs.diag(
6003
6004
  `[theokit-sdk] onDelta tool-lifecycle emit error (swallowed): ${err instanceof Error ? err.message : String(err)}
6004
6005
  `
6005
6006
  );
@@ -6011,7 +6012,7 @@ async function safeEmitToolHook(callback, event) {
6011
6012
  await callback(event);
6012
6013
  } catch (cause) {
6013
6014
  const msg = cause instanceof Error ? cause.message : String(cause);
6014
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] tool lifecycle hook threw: ${msg}
6015
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] tool lifecycle hook threw: ${msg}
6015
6016
  `);
6016
6017
  }
6017
6018
  }
@@ -6078,7 +6079,7 @@ function applyToolResultGuard(parts, opts) {
6078
6079
  (p) => (
6079
6080
  // SE7 — guard the TEXT of a tool result (string or the text blocks of a
6080
6081
  // structured content); image blocks pass through untouched.
6081
- p.type === "tool_result" ? { ...p, content: chunkSEWAPWAF_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
6082
+ p.type === "tool_result" ? { ...p, content: chunkFMIKUGF2_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
6082
6083
  )
6083
6084
  );
6084
6085
  }
@@ -6273,7 +6274,7 @@ function catalogCostFallback(provider, cleanedModel) {
6273
6274
  const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
6274
6275
  if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
6275
6276
  for (const key of candidates) {
6276
- const info = chunkT6KFGMNY_cjs.getCatalogModelInfo(key);
6277
+ const info = chunkGLEKLAUW_cjs.getCatalogModelInfo(key);
6277
6278
  const cost = info?.cost;
6278
6279
  if (cost === void 0) continue;
6279
6280
  const [prov, ...modelParts] = key.split("/");
@@ -6285,7 +6286,7 @@ function catalogCostFallback(provider, cleanedModel) {
6285
6286
  ...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
6286
6287
  ...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
6287
6288
  // M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
6288
- pricingVersion: chunkT6KFGMNY_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
6289
+ pricingVersion: chunkGLEKLAUW_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
6289
6290
  };
6290
6291
  }
6291
6292
  return void 0;
@@ -6738,15 +6739,15 @@ var FallbackLlmClient = class {
6738
6739
  let lastError;
6739
6740
  for (const client of this.clients) {
6740
6741
  if (signal.aborted) throw abortError(signal);
6741
- const attempt = await chunkSEWAPWAF_cjs.tryFirstEvent(client, request, signal, true);
6742
+ const attempt = await chunkFMIKUGF2_cjs.tryFirstEvent(client, request, signal, true);
6742
6743
  if (attempt.kind === "handshake_error") {
6743
6744
  lastError = attempt.error;
6744
6745
  continue;
6745
6746
  }
6746
- return yield* chunkSEWAPWAF_cjs.relayStream(attempt.generator, attempt.firstResult);
6747
+ return yield* chunkFMIKUGF2_cjs.relayStream(attempt.generator, attempt.firstResult);
6747
6748
  }
6748
6749
  if (lastError !== void 0) throw lastError;
6749
- throw new chunkE7WWIX34_cjs.NetworkError("FallbackLlmClient has no providers configured", {
6750
+ throw new chunkYULF6FPB_cjs.NetworkError("FallbackLlmClient has no providers configured", {
6750
6751
  code: "fallback_empty_chain"
6751
6752
  });
6752
6753
  }
@@ -6769,7 +6770,7 @@ function reconnectDelay(attempt) {
6769
6770
  return ms <= 0 ? Promise.resolve() : new Promise((resolve) => setTimeout(resolve, ms));
6770
6771
  }
6771
6772
  function mcpTimeoutError(name, timeoutMs) {
6772
- return new chunkE7WWIX34_cjs.NetworkError(`MCP ${name} request timed out after ${timeoutMs}ms`, {
6773
+ return new chunkYULF6FPB_cjs.NetworkError(`MCP ${name} request timed out after ${timeoutMs}ms`, {
6773
6774
  code: "mcp_timeout"
6774
6775
  });
6775
6776
  }
@@ -6844,7 +6845,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6844
6845
  cwd: resolvedCwd,
6845
6846
  // #54 (F-H1) — a third-party MCP server binary must not inherit host
6846
6847
  // secrets. Scrub secret-like vars by default; `config.env` still wins.
6847
- env: chunkWPZTYOUX_cjs.resolveChildEnv({ policy: this.config.envPolicy, overrides: this.config.env })
6848
+ env: chunkBBZYXVLZ_cjs.resolveChildEnv({ policy: this.config.envPolicy, overrides: this.config.env })
6848
6849
  });
6849
6850
  this.child = child;
6850
6851
  child.stdout.on("data", (chunk) => this.consume(chunk));
@@ -6852,7 +6853,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6852
6853
  child.stdin.on("error", () => void 0);
6853
6854
  child.on("error", () => {
6854
6855
  this.rejectAllPending(
6855
- new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} process crashed`, { code: "mcp_crashed" })
6856
+ new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} process crashed`, { code: "mcp_crashed" })
6856
6857
  );
6857
6858
  });
6858
6859
  child.on("exit", () => {
@@ -6860,7 +6861,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6860
6861
  this.child = void 0;
6861
6862
  this.dropped = true;
6862
6863
  this.rejectAllPending(
6863
- new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6864
+ new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6864
6865
  );
6865
6866
  });
6866
6867
  }
@@ -6888,7 +6889,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6888
6889
  if (this.child !== void 0) return Promise.resolve();
6889
6890
  if (!this.dropped) {
6890
6891
  return Promise.reject(
6891
- new chunkE7WWIX34_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6892
+ new chunkYULF6FPB_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6892
6893
  );
6893
6894
  }
6894
6895
  this.reconnectPromise ??= this.reconnect().finally(() => {
@@ -6909,13 +6910,13 @@ var StdioMcpClient = class extends BaseMcpClient {
6909
6910
  lastErr = err;
6910
6911
  }
6911
6912
  }
6912
- throw new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} reconnect exhausted`, {
6913
+ throw new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} reconnect exhausted`, {
6913
6914
  code: "mcp_disconnected",
6914
6915
  ...lastErr instanceof Error ? { cause: lastErr } : {}
6915
6916
  });
6916
6917
  }
6917
6918
  async close() {
6918
- this.rejectAllPending(new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} closed`, { code: "mcp_closed" }));
6919
+ this.rejectAllPending(new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} closed`, { code: "mcp_closed" }));
6919
6920
  const child = this.child;
6920
6921
  this.child = void 0;
6921
6922
  this.dropped = false;
@@ -6934,7 +6935,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6934
6935
  if (this.buffer.length > MAX_STDIO_BUFFER_BYTES) {
6935
6936
  this.buffer = "";
6936
6937
  this.rejectAllPending(
6937
- new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} exceeded stdout buffer limit`, {
6938
+ new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} exceeded stdout buffer limit`, {
6938
6939
  code: "mcp_buffer_overflow"
6939
6940
  })
6940
6941
  );
@@ -6969,7 +6970,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6969
6970
  if (child !== void 0) return this.send(child, method, params);
6970
6971
  if (this.dropped) return this.reconnectAndRequest(method, params);
6971
6972
  return Promise.reject(
6972
- new chunkE7WWIX34_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6973
+ new chunkYULF6FPB_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6973
6974
  );
6974
6975
  }
6975
6976
  /** M2 #59 — reconnect a dropped client, then send. Separate async path so the
@@ -6978,7 +6979,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6978
6979
  await this.ensureConnected();
6979
6980
  const child = this.child;
6980
6981
  if (child === void 0) {
6981
- throw new chunkE7WWIX34_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" });
6982
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" });
6982
6983
  }
6983
6984
  return this.send(child, method, params);
6984
6985
  }
@@ -6995,7 +6996,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6995
6996
  this.child = void 0;
6996
6997
  this.dropped = true;
6997
6998
  this.rejectAllPending(
6998
- new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6999
+ new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6999
7000
  );
7000
7001
  }, this.timeoutMs);
7001
7002
  this.pending.set(id, { resolve, reject, timer });
@@ -7064,8 +7065,8 @@ var HttpMcpClient = class extends BaseMcpClient {
7064
7065
  * A single JSON-RPC reply arrives as one event, so the FIRST parseable `data:` is the answer.
7065
7066
  */
7066
7067
  async readBody(response) {
7067
- const tipo = response.headers.get("content-type") ?? "";
7068
- if (!tipo.includes("text/event-stream")) return await response.json();
7068
+ const contentType = response.headers.get("content-type") ?? "";
7069
+ if (!contentType.includes("text/event-stream")) return await response.json();
7069
7070
  const text = await response.text();
7070
7071
  for (const line of text.split(/\r?\n/)) {
7071
7072
  if (!line.startsWith("data:")) continue;
@@ -7073,7 +7074,7 @@ var HttpMcpClient = class extends BaseMcpClient {
7073
7074
  if (payload === "") continue;
7074
7075
  return JSON.parse(payload);
7075
7076
  }
7076
- throw new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} returned an event stream with no data payload`, {
7077
+ throw new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} returned an event stream with no data payload`, {
7077
7078
  code: "mcp_http_error"
7078
7079
  });
7079
7080
  }
@@ -7101,7 +7102,7 @@ var HttpMcpClient = class extends BaseMcpClient {
7101
7102
  throw cause;
7102
7103
  }
7103
7104
  if (!response.ok) {
7104
- throw new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} returned ${response.status}`, {
7105
+ throw new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} returned ${response.status}`, {
7105
7106
  code: "mcp_http_error"
7106
7107
  });
7107
7108
  }
@@ -7117,14 +7118,14 @@ var HttpMcpClient = class extends BaseMcpClient {
7117
7118
  function resolveMcpCwd(configCwd) {
7118
7119
  if (configCwd === void 0) return process.cwd();
7119
7120
  if (path.isAbsolute(configCwd)) return configCwd;
7120
- return chunkZAKTZ5B4_cjs.safePathJoin(process.cwd(), configCwd);
7121
+ return chunkXA3TSBAH_cjs.safePathJoin(process.cwd(), configCwd);
7121
7122
  }
7122
7123
 
7123
7124
  // src/internal/providers/register-plugin-providers.ts
7124
7125
  function registerPluginProviderProfiles(entries) {
7125
7126
  let registered2 = 0;
7126
7127
  for (const entry of entries) {
7127
- chunkT6KFGMNY_cjs.registerProvider(entry.profile);
7128
+ chunkGLEKLAUW_cjs.registerProvider(entry.profile);
7128
7129
  registered2 += 1;
7129
7130
  }
7130
7131
  return registered2;
@@ -7204,7 +7205,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
7204
7205
  if (exposedSet.has(name)) continue;
7205
7206
  const hint = suggestClosest(name, exposedSet);
7206
7207
  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)`;
7207
- chunkK6TWHNT4_cjs.warnOnce(
7208
+ chunkHECR7KF5_cjs.warnOnce(
7208
7209
  `personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
7209
7210
  message
7210
7211
  );
@@ -7313,25 +7314,25 @@ function createRealLocalRun(options) {
7313
7314
  }
7314
7315
  var pluginProvidersAnnounced = false;
7315
7316
  function resolveRunProvider(options) {
7316
- chunkT6KFGMNY_cjs.registerBuiltins();
7317
+ chunkGLEKLAUW_cjs.registerBuiltins();
7317
7318
  const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
7318
7319
  const registered2 = registerPluginProviderProfiles(profiles);
7319
7320
  if (registered2 > 0 && !pluginProvidersAnnounced) {
7320
7321
  pluginProvidersAnnounced = true;
7321
7322
  const names = profiles.map((e) => e.profile.name).join(", ");
7322
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] registered ${registered2} plugin provider profile(s): ${names}
7323
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] registered ${registered2} plugin provider profile(s): ${names}
7323
7324
  `);
7324
7325
  }
7325
7326
  const parsedModel = chunkVYHJZVL5_cjs.parseModelId(options.model?.id);
7326
- const modelInferredProvider = parsedModel.provider !== void 0 && chunkT6KFGMNY_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
7327
- const keyInferredProvider = chunkSEWAPWAF_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
7328
- const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkSEWAPWAF_cjs.detectPrimaryProvider();
7327
+ const modelInferredProvider = parsedModel.provider !== void 0 && chunkGLEKLAUW_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
7328
+ const keyInferredProvider = chunkFMIKUGF2_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
7329
+ const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkFMIKUGF2_cjs.detectPrimaryProvider();
7329
7330
  const effectiveModelId = modelInferredProvider !== void 0 && modelInferredProvider === primary ? parsedModel.name : options.model?.id ?? "claude-sonnet-4-6";
7330
7331
  return { primary, effectiveModelId };
7331
7332
  }
7332
7333
  function mergeExplicitApiKey(pools, primary, apiKey) {
7333
7334
  if (apiKey === void 0 || apiKey.length === 0) return pools;
7334
- if (chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
7335
+ if (chunkFMIKUGF2_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
7335
7336
  const existing = pools?.[primary];
7336
7337
  if (existing !== void 0 && existing.length > 0) return pools;
7337
7338
  return { ...pools ?? {}, [primary]: [apiKey] };
@@ -7339,7 +7340,7 @@ function mergeExplicitApiKey(pools, primary, apiKey) {
7339
7340
  function buildLoopInputs(options, runId, userText, userImages) {
7340
7341
  const maxIterations = options.sendOptions.maxIterations;
7341
7342
  if (maxIterations !== void 0 && (!Number.isInteger(maxIterations) || maxIterations < 1)) {
7342
- throw new chunkE7WWIX34_cjs.ConfigurationError(
7343
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
7343
7344
  `SendOptions.maxIterations must be a positive integer, got ${maxIterations}`,
7344
7345
  { code: "invalid_max_iterations" }
7345
7346
  );
@@ -7354,14 +7355,14 @@ function buildLoopInputs(options, runId, userText, userImages) {
7354
7355
  const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
7355
7356
  const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
7356
7357
  const rateLimitSink = options.sendOptions.onRunEvent;
7357
- const chain = chunkSEWAPWAF_cjs.resolveProviderChain({
7358
+ const chain = chunkFMIKUGF2_cjs.resolveProviderChain({
7358
7359
  primary,
7359
7360
  ...fallback !== void 0 ? { fallback } : {},
7360
7361
  ...apiKeys !== void 0 ? { apiKeys } : {},
7361
7362
  ...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {},
7362
7363
  ...extractToolCallsFromContent === true ? { extractToolCallsFromContent: true } : {},
7363
7364
  ...rateLimitSink !== void 0 ? {
7364
- onRateLimit: (info) => chunkQMIG7TKG_cjs.emitRunEvent(rateLimitSink, { type: "rate_limit", ...info })
7365
+ onRateLimit: (info) => chunkKCQUYQ3V_cjs.emitRunEvent(rateLimitSink, { type: "rate_limit", ...info })
7365
7366
  } : {}
7366
7367
  });
7367
7368
  const llm = chain.length === 1 ? chain[0] : new FallbackLlmClient(chain);
@@ -7520,15 +7521,25 @@ var RealLocalRun = class extends FixtureRunBase {
7520
7521
  */
7521
7522
  liveDelivered = /* @__PURE__ */ new Set();
7522
7523
  async executeAgentLoop(inputs) {
7524
+ let textStreamedSinceLastMessage = false;
7523
7525
  inputs.onLoopEvent = (event) => {
7524
7526
  this.liveDelivered.add(event);
7525
7527
  this.script.events.push(event);
7526
- this.pushTimeline({ kind: "message", message: event });
7528
+ const carriesText = event.type === "assistant" && event.message.content.some((b) => b.type === "text");
7529
+ this.pushTimeline(
7530
+ carriesText ? { kind: "message", message: event, textAlreadyStreamed: textStreamedSinceLastMessage } : (
7531
+ // No text ⇒ the question does not apply. Marking a tool-only or structural message
7532
+ // would be a claim the consumer acts on by HIDING content it was never shown.
7533
+ { kind: "message", message: event }
7534
+ )
7535
+ );
7536
+ if (carriesText) textStreamedSinceLastMessage = false;
7527
7537
  this.notifyNewEvents();
7528
7538
  };
7529
7539
  const callerOnDelta = inputs.onDelta;
7530
7540
  inputs.onDelta = (delta) => {
7531
7541
  callerOnDelta?.(delta);
7542
+ if (delta.update.type === "text-delta") textStreamedSinceLastMessage = true;
7532
7543
  this.pushTimeline({ kind: "delta", update: delta.update });
7533
7544
  };
7534
7545
  try {
@@ -7626,7 +7637,7 @@ function buildRealRunOptions(args) {
7626
7637
  };
7627
7638
  }
7628
7639
  async function createFixtureRunHelper(args) {
7629
- const sessionMessages = chunkN4JNY5DT_cjs.getSessionMessages(args.inputs.agentId);
7640
+ const sessionMessages = chunkZO2L5U6F_cjs.getSessionMessages(args.inputs.agentId);
7630
7641
  const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
7631
7642
  return createLocalRun({
7632
7643
  agentId: args.inputs.agentId,
@@ -7645,7 +7656,7 @@ async function createFixtureRunHelper(args) {
7645
7656
  }
7646
7657
  async function dispatchLocalRun(args) {
7647
7658
  const apiKey = resolveApiKey(args.inputs.options.apiKey);
7648
- if (chunkSEWAPWAF_cjs.shouldUseRealLocalRuntime(apiKey)) {
7659
+ if (chunkFMIKUGF2_cjs.shouldUseRealLocalRuntime(apiKey)) {
7649
7660
  return createRealLocalRun(
7650
7661
  buildRealRunOptions({
7651
7662
  inputs: args.inputs,
@@ -7680,20 +7691,20 @@ async function readProjectMcpServers(cwd) {
7680
7691
 
7681
7692
  // src/internal/local-agent/local-agent-invalidate.ts
7682
7693
  async function applyDeferredInvalidation(agentId, pending, refresh) {
7683
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] applying deferred cache invalidation (${agentId}): ${pending.reason}
7694
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] applying deferred cache invalidation (${agentId}): ${pending.reason}
7684
7695
  `);
7685
7696
  try {
7686
7697
  await refresh();
7687
7698
  } catch (err) {
7688
7699
  const msg = err instanceof Error ? err.message : String(err);
7689
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] invalidateCache reload failed (continuing): ${msg}
7700
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] invalidateCache reload failed (continuing): ${msg}
7690
7701
  `);
7691
7702
  }
7692
7703
  }
7693
7704
  async function invalidateCacheImpl(agentId, reason, options, disposed, dispose, setPending) {
7694
7705
  if (disposed) return;
7695
7706
  if (options.applyNow === true) {
7696
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] invalidateCache applyNow disposing agent (${agentId}): ${reason}
7707
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] invalidateCache applyNow disposing agent (${agentId}): ${reason}
7697
7708
  `);
7698
7709
  await dispose();
7699
7710
  return;
@@ -7754,7 +7765,7 @@ var LiveAgentRegistry = class {
7754
7765
  const existing = this.#agents.get(id);
7755
7766
  if (existing !== void 0 && existing.agent !== agent) {
7756
7767
  void existing.agent.dispose().catch(() => {
7757
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] dispose during overwrite failed (${id})
7768
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] dispose during overwrite failed (${id})
7758
7769
  `);
7759
7770
  });
7760
7771
  }
@@ -7858,7 +7869,7 @@ var LiveAgentRegistry = class {
7858
7869
  await agent.dispose();
7859
7870
  } catch (cause) {
7860
7871
  const msg = cause instanceof Error ? cause.message : String(cause);
7861
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] dispose during eviction failed (${id}): ${msg}
7872
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] dispose during eviction failed (${id}): ${msg}
7862
7873
  `);
7863
7874
  }
7864
7875
  if (this.#onEvict !== void 0) {
@@ -7866,7 +7877,7 @@ var LiveAgentRegistry = class {
7866
7877
  this.#onEvict(id, reason);
7867
7878
  } catch (cause) {
7868
7879
  const msg = cause instanceof Error ? cause.message : String(cause);
7869
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] onEvict listener threw (${id}): ${msg}
7880
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] onEvict listener threw (${id}): ${msg}
7870
7881
  `);
7871
7882
  }
7872
7883
  }
@@ -7882,7 +7893,7 @@ async function acquireLeaseIfPossible(store, agentId) {
7882
7893
  await a.call(store, agentId);
7883
7894
  } catch (err) {
7884
7895
  if (err instanceof Error && err.name === "SessionBusyError") throw err;
7885
- chunkA76OFN2B_cjs.diag(
7896
+ chunkZHPET3LZ_cjs.diag(
7886
7897
  `[theokit-sdk] writer lease unavailable for ${agentId} (${err instanceof Error ? err.message : String(err)}) \u2014 proceeding without single-writer protection
7887
7898
  `
7888
7899
  );
@@ -7901,16 +7912,16 @@ async function disposeLocalAgentSession(agent) {
7901
7912
  agent.lifecycleAbortController.abort();
7902
7913
  await chunkYLQQX5W2_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
7903
7914
  disposeSessionMcpClients(agent.agentId);
7904
- await chunkN4JNY5DT_cjs.flushSessionWrites();
7915
+ await chunkZO2L5U6F_cjs.flushSessionWrites();
7905
7916
  await flushRegistrySaves(agent.workspaceCwd);
7906
7917
  await disposeSessionStore(agent.sessionStore);
7907
- chunkN4JNY5DT_cjs.discardSession(agent.workspaceCwd, agent.agentId);
7918
+ chunkZO2L5U6F_cjs.discardSession(agent.workspaceCwd, agent.agentId);
7908
7919
  }
7909
7920
  async function reloadLocalAgent(agent) {
7910
7921
  if (agent.context !== void 0) await agent.context.refresh();
7911
7922
  if (agent.skillsManager !== void 0) await agent.skillsManager.refresh();
7912
7923
  if (agent.pluginsManager !== void 0) await agent.pluginsManager.refresh();
7913
- return await chunkLOTWA65Z_cjs.loadSubagents(
7924
+ return await chunkX2YQP452_cjs.loadSubagents(
7914
7925
  agent.workspaceCwd,
7915
7926
  agent.settingSourcesIncludeProject,
7916
7927
  agent.options.agents
@@ -7918,12 +7929,12 @@ async function reloadLocalAgent(agent) {
7918
7929
  }
7919
7930
  async function persistActiveMemoryTranscript(cwd, transcript) {
7920
7931
  try {
7921
- const dir = path.join(chunkLNTQRD23_cjs.memoryDir(cwd), "transcripts", "active-memory");
7932
+ const dir = path.join(chunkGH52NOCL_cjs.memoryDir(cwd), "transcripts", "active-memory");
7922
7933
  const file = path.join(dir, `${transcript.runId}.json`);
7923
- await chunk33B2BSME_cjs.atomicWriteJson(file, transcript);
7934
+ await chunkNETYW4V3_cjs.atomicWriteJson(file, transcript);
7924
7935
  } catch (cause) {
7925
7936
  const message = cause instanceof Error ? cause.message : String(cause);
7926
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] active-memory transcript persist failed: ${message}
7937
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] active-memory transcript persist failed: ${message}
7927
7938
  `);
7928
7939
  }
7929
7940
  }
@@ -8044,7 +8055,7 @@ async function searchOnce(args, cfg, query, started) {
8044
8055
  return { summary, durationMs: Date.now() - started, status: "ok", hits };
8045
8056
  } catch (cause) {
8046
8057
  const message = cause instanceof Error ? cause.message : String(cause);
8047
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] active-memory recall failed: ${message}
8058
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] active-memory recall failed: ${message}
8048
8059
  `);
8049
8060
  return { summary: void 0, durationMs: Date.now() - started, status: "error", hits: [] };
8050
8061
  }
@@ -8164,7 +8175,7 @@ var azureOpenAiMemoryEmbeddingProviderAdapter = {
8164
8175
  transport: "remote",
8165
8176
  authProviderId: "azure-openai",
8166
8177
  autoSelectPriority: 25,
8167
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8178
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8168
8179
  {
8169
8180
  id: "azure-openai",
8170
8181
  defaultBaseUrl: "https://your-resource.openai.azure.com",
@@ -8200,7 +8211,7 @@ var cohereMemoryEmbeddingProviderAdapter = {
8200
8211
  transport: "remote",
8201
8212
  authProviderId: "cohere",
8202
8213
  autoSelectPriority: 30,
8203
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8214
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8204
8215
  {
8205
8216
  id: "cohere",
8206
8217
  defaultBaseUrl: "https://api.cohere.com",
@@ -8246,7 +8257,7 @@ var deepinfraMemoryEmbeddingProviderAdapter = {
8246
8257
  transport: "remote",
8247
8258
  authProviderId: "deepinfra",
8248
8259
  autoSelectPriority: 13,
8249
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8260
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8250
8261
  {
8251
8262
  id: "deepinfra",
8252
8263
  defaultBaseUrl: "https://api.deepinfra.com",
@@ -8272,7 +8283,7 @@ var geminiMemoryEmbeddingProviderAdapter = {
8272
8283
  transport: "remote",
8273
8284
  authProviderId: "gemini",
8274
8285
  autoSelectPriority: 30,
8275
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8286
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8276
8287
  {
8277
8288
  id: "gemini",
8278
8289
  defaultBaseUrl: "https://generativelanguage.googleapis.com",
@@ -8300,7 +8311,7 @@ var jinaMemoryEmbeddingProviderAdapter = {
8300
8311
  transport: "remote",
8301
8312
  authProviderId: "jina",
8302
8313
  autoSelectPriority: 35,
8303
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8314
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8304
8315
  {
8305
8316
  id: "jina",
8306
8317
  defaultBaseUrl: "https://api.jina.ai",
@@ -8323,7 +8334,7 @@ var mistralMemoryEmbeddingProviderAdapter = {
8323
8334
  transport: "remote",
8324
8335
  authProviderId: "mistral",
8325
8336
  autoSelectPriority: 18,
8326
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8337
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8327
8338
  {
8328
8339
  id: "mistral",
8329
8340
  defaultBaseUrl: "https://api.mistral.ai",
@@ -8365,7 +8376,7 @@ var ollamaMemoryEmbeddingProviderAdapter = {
8365
8376
  autoSelectPriority: 10,
8366
8377
  create: (options) => {
8367
8378
  const apiKey = options.apiKey ?? process.env.OLLAMA_API_KEY ?? OLLAMA_LOCAL_SENTINEL_KEY;
8368
- return chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8379
+ return chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8369
8380
  {
8370
8381
  id: "ollama",
8371
8382
  defaultBaseUrl: "http://localhost:11434",
@@ -8392,7 +8403,7 @@ var openAiMemoryEmbeddingProviderAdapter = {
8392
8403
  transport: "remote",
8393
8404
  authProviderId: "openai",
8394
8405
  autoSelectPriority: 20,
8395
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8406
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8396
8407
  {
8397
8408
  id: "openai",
8398
8409
  defaultBaseUrl: "https://api.openai.com",
@@ -8419,7 +8430,7 @@ var openRouterMemoryEmbeddingProviderAdapter = {
8419
8430
  transport: "remote",
8420
8431
  authProviderId: "openrouter",
8421
8432
  autoSelectPriority: 15,
8422
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8433
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8423
8434
  {
8424
8435
  id: "openrouter",
8425
8436
  defaultBaseUrl: "https://openrouter.ai/api",
@@ -8447,7 +8458,7 @@ var voyageMemoryEmbeddingProviderAdapter = {
8447
8458
  transport: "remote",
8448
8459
  authProviderId: "voyage",
8449
8460
  autoSelectPriority: 14,
8450
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8461
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8451
8462
  {
8452
8463
  id: "voyage",
8453
8464
  defaultBaseUrl: "https://api.voyageai.com",
@@ -8548,7 +8559,7 @@ function createMemorySearchTool(opts) {
8548
8559
  };
8549
8560
  }
8550
8561
  function createMemoryGetTool(opts) {
8551
- const memoryRoot = path.resolve(chunkLNTQRD23_cjs.memoryDir(opts.cwd));
8562
+ const memoryRoot = path.resolve(chunkGH52NOCL_cjs.memoryDir(opts.cwd));
8552
8563
  return {
8553
8564
  name: "memory_get",
8554
8565
  description: GET_DESCRIPTION,
@@ -8559,7 +8570,7 @@ function createMemoryGetTool(opts) {
8559
8570
  const lines = readNumber(input.lines);
8560
8571
  const resolved = path.resolve(memoryRoot, relPath);
8561
8572
  if (!isPathInside(memoryRoot, resolved)) {
8562
- throw new chunkE7WWIX34_cjs.ConfigurationError(
8573
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
8563
8574
  `memory_get rejected path that escapes memory root: ${relPath}`,
8564
8575
  { code: "memory_path_escapes_root" }
8565
8576
  );
@@ -8579,7 +8590,7 @@ function readString(value, errorIfMissing, allowUndefined = false) {
8579
8590
  if (typeof value === "string") return value;
8580
8591
  if (allowUndefined && (value === void 0 || value === null)) return "";
8581
8592
  if (errorIfMissing !== void 0) {
8582
- throw new chunkE7WWIX34_cjs.ConfigurationError(errorIfMissing, { code: "memory_tool_bad_args" });
8593
+ throw new chunkYULF6FPB_cjs.ConfigurationError(errorIfMissing, { code: "memory_tool_bad_args" });
8583
8594
  }
8584
8595
  return "";
8585
8596
  }
@@ -8655,7 +8666,7 @@ var LocalAgentMemory = class {
8655
8666
  const openOpts = { cwd: this.workspaceCwd };
8656
8667
  if (embedding !== void 0) openOpts.embedding = embedding;
8657
8668
  if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
8658
- this.index = await chunkLNTQRD23_cjs.IndexManager.open(openOpts);
8669
+ this.index = await chunkGH52NOCL_cjs.IndexManager.open(openOpts);
8659
8670
  await this.index.sync();
8660
8671
  this.toolsCache = [
8661
8672
  createMemorySearchTool({ index: this.index }),
@@ -8670,7 +8681,7 @@ var LocalAgentMemory = class {
8670
8681
  const warned2 = g[sym];
8671
8682
  if (!warned2.has(message)) {
8672
8683
  warned2.add(message);
8673
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] memory tools unavailable: ${message}
8684
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] memory tools unavailable: ${message}
8674
8685
  `);
8675
8686
  }
8676
8687
  return void 0;
@@ -8679,7 +8690,7 @@ var LocalAgentMemory = class {
8679
8690
  async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
8680
8691
  const cfg = this.options.memory?.activeRecall;
8681
8692
  if (cfg?.enabled !== true || this.index === void 0) return void 0;
8682
- if (this.breaker === void 0) this.breaker = new chunkSEWAPWAF_cjs.CircuitBreaker();
8693
+ if (this.breaker === void 0) this.breaker = new chunkFMIKUGF2_cjs.CircuitBreaker();
8683
8694
  if (this.cache === void 0) this.cache = new ActiveMemoryCache();
8684
8695
  const result = await runActiveMemory({
8685
8696
  userText,
@@ -8729,7 +8740,7 @@ var LocalAgentMemory = class {
8729
8740
  await this.index.sync();
8730
8741
  } catch (cause) {
8731
8742
  const message = cause instanceof Error ? cause.message : String(cause);
8732
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] session index sync failed: ${message}
8743
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] session index sync failed: ${message}
8733
8744
  `);
8734
8745
  }
8735
8746
  }
@@ -8742,7 +8753,7 @@ var LocalAgentMemory = class {
8742
8753
  return await adapter.create(cfg.model !== void 0 ? { model: cfg.model } : {});
8743
8754
  } catch (cause) {
8744
8755
  const message = cause instanceof Error ? cause.message : String(cause);
8745
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] memory embedding ${cfg.provider} unavailable: ${message}
8756
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] memory embedding ${cfg.provider} unavailable: ${message}
8746
8757
  `);
8747
8758
  return void 0;
8748
8759
  }
@@ -8778,7 +8789,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
8778
8789
  ...partial?.metadata !== void 0 ? { metadata: partial.metadata } : defaultContext?.metadata !== void 0 ? { metadata: defaultContext.metadata } : {}
8779
8790
  };
8780
8791
  if (merged.userId === "") {
8781
- throw new chunkE7WWIX34_cjs.ConfigurationError(
8792
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
8782
8793
  "agent.memory requires a userId \u2014 either set AgentOptions.memoryContext.userId or pass ctx.userId at call time.",
8783
8794
  { code: "memory_context_missing_user_id" }
8784
8795
  );
@@ -8788,7 +8799,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
8788
8799
  async function requireAdapters() {
8789
8800
  const r = await ensure();
8790
8801
  if (r.adapters.length === 0) {
8791
- throw new chunkE7WWIX34_cjs.ConfigurationError(
8802
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
8792
8803
  "No memory adapter registered. Pass a memory plugin in AgentOptions.plugins (e.g. supermemoryMemory({...})).",
8793
8804
  { code: "no_memory_adapter" }
8794
8805
  );
@@ -8829,7 +8840,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
8829
8840
  const prefix = id.split(":", 1)[0] ?? "";
8830
8841
  const target = adapters.find((a) => a.id === prefix);
8831
8842
  if (target === void 0) {
8832
- throw new chunkE7WWIX34_cjs.ConfigurationError(
8843
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
8833
8844
  `No adapter found for MemoryId prefix "${prefix}" (registered: ${adapters.map((a) => a.id).join(", ")}).`,
8834
8845
  { code: "no_memory_adapter" }
8835
8846
  );
@@ -8902,7 +8913,7 @@ function createLocalAgentMemoryProvider(opts) {
8902
8913
  return { facts: [], systemPromptAdditions: summary };
8903
8914
  },
8904
8915
  async recordSessionSummary(args) {
8905
- await chunkLNTQRD23_cjs.writeSessionSummary(args);
8916
+ await chunkGH52NOCL_cjs.writeSessionSummary(args);
8906
8917
  },
8907
8918
  async sync(handle) {
8908
8919
  const state = handle[INTERNAL_LAM_KEY];
@@ -8980,19 +8991,19 @@ var PersonalityRegistry = class _PersonalityRegistry {
8980
8991
  function addEntity(byName, entity, origin, collisionMap) {
8981
8992
  const fm = entity.frontmatter;
8982
8993
  if (PersonalityRegistry.isReservedClearSlug(fm.name)) {
8983
- throw new chunkE7WWIX34_cjs.ConfigurationError(
8994
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
8984
8995
  `Personality name "${fm.name}" is reserved (used to clear active preset)`,
8985
8996
  { code: "personality_reserved_name" }
8986
8997
  );
8987
8998
  }
8988
8999
  if (entity.body.trim().length === 0) {
8989
- throw new chunkE7WWIX34_cjs.ConfigurationError(
9000
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
8990
9001
  `Personality "${fm.name}" has empty body (system prompt required)`,
8991
9002
  { code: "personality_empty_body" }
8992
9003
  );
8993
9004
  }
8994
9005
  if (origin === "project" && collisionMap?.has(fm.name)) {
8995
- chunkK6TWHNT4_cjs.warnOnce(
9006
+ chunkHECR7KF5_cjs.warnOnce(
8996
9007
  `personality-collision-${fm.name}`,
8997
9008
  `[theokit-sdk] personality "${fm.name}" overridden by project preset`
8998
9009
  );
@@ -9021,7 +9032,7 @@ async function performPersonalitySwitch(args) {
9021
9032
  const preset = args.registry.get(args.requestedName);
9022
9033
  if (preset === void 0) {
9023
9034
  const available = args.registry.all().map((p) => p.name).join(", ") || "(none)";
9024
- throw new chunkE7WWIX34_cjs.ConfigurationError(
9035
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
9025
9036
  `Personality "${args.requestedName}" not found. Available: ${available}`,
9026
9037
  { code: "personality_not_found" }
9027
9038
  );
@@ -9042,14 +9053,14 @@ async function performPersonalitySwitch(args) {
9042
9053
 
9043
9054
  // src/internal/local-agent/local-agent-personality-extensions.ts
9044
9055
  function resolveActivePersonalityPreset(args) {
9045
- const forkCtx = chunkK6TWHNT4_cjs.currentPersonalityContext();
9056
+ const forkCtx = chunkHECR7KF5_cjs.currentPersonalityContext();
9046
9057
  const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
9047
9058
  if (slug === void 0) return void 0;
9048
9059
  return args.personalityRegistry?.get(slug);
9049
9060
  }
9050
9061
  async function ensurePersonalityRegistryIfNeeded(args) {
9051
9062
  if (args.personalityRegistry !== void 0) return args.personalityRegistry;
9052
- const forkSlug = chunkK6TWHNT4_cjs.currentPersonalityContext()?.slug;
9063
+ const forkSlug = chunkHECR7KF5_cjs.currentPersonalityContext()?.slug;
9053
9064
  const ownSlug = args.personalityStore.active(args.agentId);
9054
9065
  if (forkSlug === void 0 && ownSlug === void 0) return void 0;
9055
9066
  return await PersonalityRegistry.load(args.workspaceCwd);
@@ -9063,8 +9074,8 @@ ${preset.systemPrompt}`;
9063
9074
  }
9064
9075
  async function localAgentUsePersonality(args) {
9065
9076
  if (args.disposed) throw new Error("Agent has been disposed");
9066
- if (chunkK6TWHNT4_cjs.currentPersonalityContext() !== void 0) {
9067
- chunkK6TWHNT4_cjs.warnPersonalitySwitchInsideFork(args.agentId);
9077
+ if (chunkHECR7KF5_cjs.currentPersonalityContext() !== void 0) {
9078
+ chunkHECR7KF5_cjs.warnPersonalitySwitchInsideFork(args.agentId);
9068
9079
  return null;
9069
9080
  }
9070
9081
  let registry = args.personalityRegistry;
@@ -9081,8 +9092,8 @@ async function localAgentUsePersonality(args) {
9081
9092
  registry,
9082
9093
  store: args.personalityStore,
9083
9094
  invalidateCache: (reason) => args.invalidateCache(reason),
9084
- appendSessionMessage: (msg) => chunkN4JNY5DT_cjs.appendSessionMessage(args.agentId, msg),
9085
- clearSession: () => chunkN4JNY5DT_cjs.clearSession(args.agentId),
9095
+ appendSessionMessage: (msg) => chunkZO2L5U6F_cjs.appendSessionMessage(args.agentId, msg),
9096
+ clearSession: () => chunkZO2L5U6F_cjs.clearSession(args.agentId),
9086
9097
  opts: args.opts ?? {}
9087
9098
  })
9088
9099
  );
@@ -9091,9 +9102,9 @@ async function localAgentUsePersonality(args) {
9091
9102
  // src/internal/local-agent/local-agent-runtime-extensions.ts
9092
9103
  function localAgentRunUntil(agent, goal, options) {
9093
9104
  async function* wrap() {
9094
- const { runUntilImpl } = await import('./run-until-L5KQD3PV.cjs');
9105
+ const { runUntilImpl } = await import('./run-until-U2B5FJJI.cjs');
9095
9106
  const buildDeps = async () => {
9096
- const { judgeCallImpl } = await import('./judge-call-AIT3EULV.cjs');
9107
+ const { judgeCallImpl } = await import('./judge-call-J5EETJL3.cjs');
9097
9108
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
9098
9109
  const create = getAgentFacade().create;
9099
9110
  return {
@@ -9126,7 +9137,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
9126
9137
  async function localAgentFork(parent, options) {
9127
9138
  const { forkAgentImpl } = await import('./fork-agent-Y2IK2RYU.cjs');
9128
9139
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
9129
- const { withPersonalityContext } = await import('./context-DNFT4B5D.cjs');
9140
+ const { withPersonalityContext } = await import('./context-2G4375BZ.cjs');
9130
9141
  const create = getAgentFacade().create;
9131
9142
  return withPersonalityContext(
9132
9143
  { slug: parent.personalitySlugSnapshot, isFork: true },
@@ -9186,7 +9197,7 @@ function wrapRunWithCompletionCheck(args) {
9186
9197
  judgeOpts
9187
9198
  );
9188
9199
  const complete = !verdict.parseFailed && verdict.verdict === "done";
9189
- chunkQMIG7TKG_cjs.emitRunEvent(args.onRunEvent, {
9200
+ chunkKCQUYQ3V_cjs.emitRunEvent(args.onRunEvent, {
9190
9201
  type: "completion_check",
9191
9202
  complete,
9192
9203
  reason: verdict.reason
@@ -9333,7 +9344,7 @@ function wrapRunWithOutputProcessors(args) {
9333
9344
  if (result.status !== "finished" || result.result === void 0) return result;
9334
9345
  const res = await runOutputProcessors(args.processors, result.result, args.agentId);
9335
9346
  if (res.kind === "ok") return { ...result, result: res.value };
9336
- chunkQMIG7TKG_cjs.emitRunEvent(args.onRunEvent, {
9347
+ chunkKCQUYQ3V_cjs.emitRunEvent(args.onRunEvent, {
9337
9348
  type: "tripwire",
9338
9349
  reason: res.tripwire.reason,
9339
9350
  processorId: res.tripwire.processorId
@@ -9408,7 +9419,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
9408
9419
  }
9409
9420
  const res = await runInputProcessors(processors, rawUserText, inputs.agentId);
9410
9421
  if (res.kind === "tripwire") {
9411
- chunkQMIG7TKG_cjs.emitRunEvent(options.onRunEvent, {
9422
+ chunkKCQUYQ3V_cjs.emitRunEvent(options.onRunEvent, {
9412
9423
  type: "tripwire",
9413
9424
  reason: res.tripwire.reason,
9414
9425
  processorId: res.tripwire.processorId
@@ -9425,7 +9436,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
9425
9436
  return { userText: res.value, effectiveMessage };
9426
9437
  }
9427
9438
  async function executeSendLocked(inputs, message, options) {
9428
- if (inputs.disposed) throw new chunkE7WWIX34_cjs.AgentDisposedError(inputs.agentId);
9439
+ if (inputs.disposed) throw new chunkYULF6FPB_cjs.AgentDisposedError(inputs.agentId);
9429
9440
  await consumePending(inputs.agentId, inputs.invalidationPending, inputs.clearInvalidation, inputs.reload);
9430
9441
  const sendModel = normalizeModel(options.model);
9431
9442
  inputs.applyModelOverride(sendModel);
@@ -9436,7 +9447,7 @@ async function executeSendLocked(inputs, message, options) {
9436
9447
  if (inputs.options.onBeforeSend !== void 0) {
9437
9448
  await inputs.options.onBeforeSend({
9438
9449
  conversationId: inputs.agentId,
9439
- previousMessageCount: chunkN4JNY5DT_cjs.getSessionMessages(inputs.agentId).length
9450
+ previousMessageCount: chunkZO2L5U6F_cjs.getSessionMessages(inputs.agentId).length
9440
9451
  });
9441
9452
  }
9442
9453
  await inputs.runPreHook(userText);
@@ -9448,8 +9459,8 @@ async function executeSendLocked(inputs, message, options) {
9448
9459
  userText,
9449
9460
  sendOptions: options
9450
9461
  });
9451
- const priorMessages = [...chunkN4JNY5DT_cjs.getSessionMessages(inputs.agentId)];
9452
- chunkN4JNY5DT_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
9462
+ const priorMessages = [...chunkZO2L5U6F_cjs.getSessionMessages(inputs.agentId)];
9463
+ chunkZO2L5U6F_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
9453
9464
  await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
9454
9465
  const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory);
9455
9466
  const portPathActive = shouldUsePortMemoryPath();
@@ -9507,7 +9518,7 @@ async function executeSendLocked(inputs, message, options) {
9507
9518
  function buildCompletionCheckDeps() {
9508
9519
  return {
9509
9520
  judge: async (ctx, opts) => {
9510
- const { judgeCallImpl } = await import('./judge-call-AIT3EULV.cjs');
9521
+ const { judgeCallImpl } = await import('./judge-call-J5EETJL3.cjs');
9511
9522
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
9512
9523
  return judgeCallImpl(ctx, opts, { create: getAgentFacade().create });
9513
9524
  }
@@ -9527,7 +9538,7 @@ function registerRunAsTask(run, agentId, taskOpt, userText) {
9527
9538
  promptPreview: userText.slice(0, 120),
9528
9539
  ...opts.meta ?? {}
9529
9540
  };
9530
- void chunkQMIG7TKG_cjs.submit({
9541
+ void chunkKCQUYQ3V_cjs.submit({
9531
9542
  kind: "run",
9532
9543
  work: async (ctx) => {
9533
9544
  ctx.signal.addEventListener(
@@ -9611,7 +9622,7 @@ var LocalAgent = class {
9611
9622
  this.options = options;
9612
9623
  this.workspaceCwd = resolveCwd(options.local?.cwd);
9613
9624
  this.transcriptBaseDir = resolveBaseDir(options.local?.baseDir);
9614
- this.sessionStore = options.local?.sessionStore ?? new chunkWMWZAJMJ_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
9625
+ this.sessionStore = options.local?.sessionStore ?? new chunkNRA36JKG_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
9615
9626
  this.settingSourcesIncludeProject = includesSetting(options, "project");
9616
9627
  this.settingSourcesIncludePlugins = includesSetting(options, "plugins");
9617
9628
  const sub = bootstrapSubmanagers({
@@ -9654,14 +9665,14 @@ var LocalAgent = class {
9654
9665
  if (this.pluginsManager !== void 0) await this.pluginsManager.initialize();
9655
9666
  const codePlugins = chunkBV2MWEMV_cjs.extractCodePlugins(this.options.plugins);
9656
9667
  await this.pluginManagerCode.initialize(codePlugins);
9657
- this.resolvedSubagents = await chunkLOTWA65Z_cjs.loadSubagents(
9668
+ this.resolvedSubagents = await chunkX2YQP452_cjs.loadSubagents(
9658
9669
  this.workspaceCwd,
9659
9670
  this.settingSourcesIncludeProject,
9660
9671
  this.options.agents
9661
9672
  );
9662
9673
  await acquireLeaseIfPossible(this.sessionStore, this.agentId);
9663
9674
  try {
9664
- await chunkN4JNY5DT_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
9675
+ await chunkZO2L5U6F_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
9665
9676
  await this.personalityStore.hydrate(this.agentId);
9666
9677
  } catch (err) {
9667
9678
  await releaseLeaseIfPossible(this.sessionStore, this.agentId);
@@ -9810,7 +9821,7 @@ var LocalAgent = class {
9810
9821
  agentId: this.agentId
9811
9822
  });
9812
9823
  if (preRun.blocked) {
9813
- throw new chunkE7WWIX34_cjs.ConfigurationError(
9824
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
9814
9825
  `preRun hook denied execution: ${preRun.reason ?? "unspecified"}`,
9815
9826
  { code: "hook_denied" }
9816
9827
  );
@@ -9891,7 +9902,7 @@ var LocalAgent = class {
9891
9902
  }
9892
9903
  // biome-ignore format: G8 budget — see listArtifacts.
9893
9904
  downloadArtifact(_path) {
9894
- return Promise.reject(new chunkE7WWIX34_cjs.UnsupportedRunOperationError("Artifacts are not supported for local agents", "downloadArtifact"));
9905
+ return Promise.reject(new chunkYULF6FPB_cjs.UnsupportedRunOperationError("Artifacts are not supported for local agents", "downloadArtifact"));
9895
9906
  }
9896
9907
  // biome-ignore format: G8 budget — delegates to `local-agent-runtime-extensions.ts`; kept 1-line.
9897
9908
  runUntil(goal, options) {
@@ -9914,7 +9925,7 @@ function resolveCwd(cwd) {
9914
9925
  return (Array.isArray(cwd) ? cwd[0] : cwd) ?? process.cwd();
9915
9926
  }
9916
9927
  function resolveBaseDir(baseDir) {
9917
- return baseDir === void 0 ? chunkNJVV5OAV_cjs.defaultBaseDir() : chunkNJVV5OAV_cjs.expandTilde(baseDir);
9928
+ return baseDir === void 0 ? chunkWCXOKGOQ_cjs.defaultBaseDir() : chunkWCXOKGOQ_cjs.expandTilde(baseDir);
9918
9929
  }
9919
9930
  function includesSetting(options, source) {
9920
9931
  const sources = options.local?.settingSources;
@@ -9939,7 +9950,7 @@ async function guardAgainstIdCollision(options) {
9939
9950
  const persistenceCwd = resolveAgentPersistenceCwd(options);
9940
9951
  await hydrateRegistryFromDisk(persistenceCwd);
9941
9952
  if (getRegisteredAgent(options.agentId) !== void 0) {
9942
- throw new chunkE7WWIX34_cjs.ConfigurationError(
9953
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
9943
9954
  `Agent "${options.agentId}" already exists. Use Agent.resume("${options.agentId}") to reattach, or pick a different agentId.`,
9944
9955
  { code: "agent_id_already_exists" }
9945
9956
  );
@@ -9972,7 +9983,7 @@ async function maybeInjectHandoffTools(options) {
9972
9983
  const spec = "@theokit/sdk-handoff/internal/tool-injector";
9973
9984
  mod = await import(spec);
9974
9985
  } catch (err) {
9975
- throw new chunkE7WWIX34_cjs.ConfigurationError(
9986
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
9976
9987
  "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).",
9977
9988
  { code: "handoff_package_missing", cause: err }
9978
9989
  );
@@ -9992,9 +10003,9 @@ async function maybeInjectHandoffTools(options) {
9992
10003
  async function createLocalAgent(options) {
9993
10004
  const apiKey = resolveApiKey(options.apiKey);
9994
10005
  if (apiKey === void 0) {
9995
- throw new chunkE7WWIX34_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
10006
+ throw new chunkYULF6FPB_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
9996
10007
  }
9997
- const willFlowToProvider = !chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) && !chunkSEWAPWAF_cjs.shouldUseRealLocalRuntime(apiKey);
10008
+ const willFlowToProvider = !chunkFMIKUGF2_cjs.isFixtureApiKey(apiKey) && !chunkFMIKUGF2_cjs.shouldUseRealLocalRuntime(apiKey);
9998
10009
  const shape = validateApiKeyShape(apiKey, {
9999
10010
  strict: willFlowToProvider,
10000
10011
  // `options.model` is already normalized by `runCreateUnderSpan`; `normalizeModel`
@@ -10003,10 +10014,10 @@ async function createLocalAgent(options) {
10003
10014
  ...willFlowToProvider ? { provider: providerFromModelId(normalizeModel(options.model)?.id) } : {}
10004
10015
  });
10005
10016
  if (shape.malformed) {
10006
- throw new chunkE7WWIX34_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
10017
+ throw new chunkYULF6FPB_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
10007
10018
  }
10008
- if (!chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) && chunkSEWAPWAF_cjs.getConfiguredBaseUrl() === void 0 && !chunkSEWAPWAF_cjs.shouldUseRealLocalRuntime(apiKey)) {
10009
- throw new chunkE7WWIX34_cjs.AuthenticationError("Invalid API key", {
10019
+ if (!chunkFMIKUGF2_cjs.isFixtureApiKey(apiKey) && chunkFMIKUGF2_cjs.getConfiguredBaseUrl() === void 0 && !chunkFMIKUGF2_cjs.shouldUseRealLocalRuntime(apiKey)) {
10020
+ throw new chunkYULF6FPB_cjs.AuthenticationError("Invalid API key", {
10010
10021
  code: "authentication_error"
10011
10022
  });
10012
10023
  }
@@ -10017,19 +10028,19 @@ async function createLocalAgent(options) {
10017
10028
  async function createCloudAgent(options) {
10018
10029
  const apiKey = resolveApiKey(options.apiKey);
10019
10030
  if (apiKey === void 0) {
10020
- throw new chunkE7WWIX34_cjs.ConfigurationError("Missing API key for cloud agent", {
10031
+ throw new chunkYULF6FPB_cjs.ConfigurationError("Missing API key for cloud agent", {
10021
10032
  code: "missing_api_key"
10022
10033
  });
10023
10034
  }
10024
10035
  const shape = validateApiKeyShape(apiKey);
10025
10036
  if (shape.malformed) {
10026
- throw new chunkE7WWIX34_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
10037
+ throw new chunkYULF6FPB_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
10027
10038
  }
10028
- const baseUrl = chunkSEWAPWAF_cjs.getConfiguredBaseUrl();
10039
+ const baseUrl = chunkFMIKUGF2_cjs.getConfiguredBaseUrl();
10029
10040
  if (baseUrl === void 0) {
10030
10041
  return new CloudAgent(options);
10031
10042
  }
10032
- const response = await chunkSEWAPWAF_cjs.httpRequest("/v1/agents", {
10043
+ const response = await chunkFMIKUGF2_cjs.httpRequest("/v1/agents", {
10033
10044
  apiKey,
10034
10045
  method: "POST",
10035
10046
  body: {
@@ -10054,7 +10065,7 @@ function resolveAgentPersistenceCwd(options) {
10054
10065
  return process.cwd();
10055
10066
  }
10056
10067
  async function rehydrateExistingAgent(agentId, existing, options) {
10057
- await chunkSEWAPWAF_cjs.discoverProviderPlugins();
10068
+ await chunkFMIKUGF2_cjs.discoverProviderPlugins();
10058
10069
  await validateRehydratedAgent(agentId, existing);
10059
10070
  const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
10060
10071
  const mergedOptions = {
@@ -10085,7 +10096,7 @@ async function validateRehydratedAgent(agentId, entry) {
10085
10096
  throw new Error(`Workspace path is not a directory: ${candidate}`);
10086
10097
  }
10087
10098
  } catch (cause) {
10088
- throw new chunkE7WWIX34_cjs.UnknownAgentError(
10099
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(
10089
10100
  `Agent "${agentId}" cannot be rehydrated \u2014 workspace cwd "${candidate}" is missing or inaccessible.`,
10090
10101
  { code: "agent_rehydration_failed", cause }
10091
10102
  );
@@ -10137,7 +10148,7 @@ async function getRegisteredAgentOrThrow(agentId) {
10137
10148
  agent = getRegisteredAgent(agentId);
10138
10149
  }
10139
10150
  if (agent === void 0) {
10140
- throw new chunkE7WWIX34_cjs.UnknownAgentError(`Agent ${agentId} not found`, { code: "unknown_agent" });
10151
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(`Agent ${agentId} not found`, { code: "unknown_agent" });
10141
10152
  }
10142
10153
  return agent;
10143
10154
  }
@@ -10182,7 +10193,7 @@ var Agent = class _Agent {
10182
10193
  pluginCount: enabledPluginNames(options.plugins).length
10183
10194
  });
10184
10195
  try {
10185
- await chunkSEWAPWAF_cjs.discoverProviderPlugins();
10196
+ await chunkFMIKUGF2_cjs.discoverProviderPlugins();
10186
10197
  const agent = await runCreateUnderSpan(options, span);
10187
10198
  return agent;
10188
10199
  } catch (err) {
@@ -10208,8 +10219,8 @@ var Agent = class _Agent {
10208
10219
  const run = await agent.send(message);
10209
10220
  const result = await run.wait();
10210
10221
  if (options.throwOnError === true && result.status === "error" && result.error !== void 0) {
10211
- throw new chunkE7WWIX34_cjs.AgentRunError(result.error.message, {
10212
- code: chunkE7WWIX34_cjs.coerceToKnownAgentRunErrorCode(result.error.code),
10222
+ throw new chunkYULF6FPB_cjs.AgentRunError(result.error.message, {
10223
+ code: chunkYULF6FPB_cjs.coerceToKnownAgentRunErrorCode(result.error.code),
10213
10224
  cause: result.error.cause
10214
10225
  });
10215
10226
  }
@@ -10236,7 +10247,7 @@ var Agent = class _Agent {
10236
10247
  if (existing !== void 0) {
10237
10248
  return await rehydrateExistingAgent(agentId, existing, options);
10238
10249
  }
10239
- throw new chunkE7WWIX34_cjs.UnknownAgentError(
10250
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(
10240
10251
  `Agent "${agentId}" not found. Use Agent.create({ agentId, ... }) for first-time setup, or catch UnknownAgentError to branch resume-vs-create.`,
10241
10252
  { code: "unknown_agent" }
10242
10253
  );
@@ -10265,7 +10276,7 @@ var Agent = class _Agent {
10265
10276
  * @public
10266
10277
  */
10267
10278
  static async generateObject(options) {
10268
- const { generateObjectImpl } = await import('./generate-object-QILSGTEJ.cjs');
10279
+ const { generateObjectImpl } = await import('./generate-object-6PWGH5DZ.cjs');
10269
10280
  return generateObjectImpl(options, {
10270
10281
  create: (opts) => _Agent.create(opts),
10271
10282
  delete: (agentId) => _Agent.delete(agentId)
@@ -10289,7 +10300,7 @@ var Agent = class _Agent {
10289
10300
  delete: (agentId) => _Agent.delete(agentId)
10290
10301
  };
10291
10302
  async function* wrapper() {
10292
- streamObjectImport ??= import('./stream-object-3HEUGMQY.cjs');
10303
+ streamObjectImport ??= import('./stream-object-3R3HZPQN.cjs');
10293
10304
  const { streamObjectImpl } = await streamObjectImport;
10294
10305
  yield* streamObjectImpl(options, deps);
10295
10306
  }
@@ -10313,7 +10324,7 @@ var Agent = class _Agent {
10313
10324
  * @public
10314
10325
  */
10315
10326
  static async batch(prompts, options) {
10316
- const { batchImpl } = await import('./batch-FO2KZN7W.cjs');
10327
+ const { batchImpl } = await import('./batch-URTEXK77.cjs');
10317
10328
  return batchImpl(prompts, options, { create: (opts) => _Agent.create(opts) });
10318
10329
  }
10319
10330
  /**
@@ -10393,14 +10404,14 @@ var Agent = class _Agent {
10393
10404
  */
10394
10405
  static async getRun(runId, options = {}) {
10395
10406
  if (options.runtime === "cloud") {
10396
- throw new chunkE7WWIX34_cjs.ConfigurationError(
10407
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
10397
10408
  "Cloud runtime is pre-release. Theo PaaS endpoints are not wired yet \u2014 getRun({ runtime: 'cloud' }) will be enabled when the PaaS ships.",
10398
10409
  { code: "cloud_runtime_pre_release" }
10399
10410
  );
10400
10411
  }
10401
10412
  const existing = getRun(runId);
10402
10413
  if (existing !== void 0) return existing;
10403
- throw new chunkE7WWIX34_cjs.UnknownAgentError(
10414
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(
10404
10415
  `Run ${runId} is not in this process's registry. It may have been disposed, persisted in a previous process, or never created.`,
10405
10416
  { code: "run_not_found" }
10406
10417
  );
@@ -10447,13 +10458,13 @@ var Agent = class _Agent {
10447
10458
  reg = getRegisteredAgent(agentId);
10448
10459
  }
10449
10460
  if (reg === void 0 || reg.runtime !== "local") {
10450
- throw new chunkE7WWIX34_cjs.UnknownAgentError(
10461
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(
10451
10462
  `No local agent "${agentId}" registered \u2014 compact targets local sessions.`
10452
10463
  );
10453
10464
  }
10454
- const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-TRCEYCPG.cjs');
10465
+ const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-OU6SRPVJ.cjs');
10455
10466
  const { cwd, model, store } = await openLocalStore(reg);
10456
- return chunkN4JNY5DT_cjs.enqueueSessionWrite(
10467
+ return chunkZO2L5U6F_cjs.enqueueSessionWrite(
10457
10468
  cwd,
10458
10469
  agentId,
10459
10470
  () => compactSessionTranscript({
@@ -10483,11 +10494,11 @@ var Agent = class _Agent {
10483
10494
  reg = getRegisteredAgent(agentId);
10484
10495
  }
10485
10496
  if (reg === void 0 || reg.runtime !== "local") {
10486
- throw new chunkE7WWIX34_cjs.UnknownAgentError(
10497
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(
10487
10498
  `No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
10488
10499
  );
10489
10500
  }
10490
- const { injectSessionTurn } = await import('./inject-session-BVSERZCI.cjs');
10501
+ const { injectSessionTurn } = await import('./inject-session-DDC36KKP.cjs');
10491
10502
  const { cwd, model, store } = await openLocalStore(reg);
10492
10503
  await injectSessionTurn({
10493
10504
  store,
@@ -10522,11 +10533,11 @@ var Agent = class _Agent {
10522
10533
  reg = getRegisteredAgent(agentId);
10523
10534
  }
10524
10535
  if (reg === void 0 || reg.runtime !== "local") {
10525
- throw new chunkE7WWIX34_cjs.UnknownAgentError(
10536
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(
10526
10537
  `No local agent "${agentId}" registered \u2014 transcript targets local sessions.`
10527
10538
  );
10528
10539
  }
10529
- const { readSessionMessages } = await import('./agent-session-store-RHTLZ5OX.cjs');
10540
+ const { readSessionMessages } = await import('./agent-session-store-EPUERCUU.cjs');
10530
10541
  const { store } = await openLocalStore(reg);
10531
10542
  return readSessionMessages(store, agentId);
10532
10543
  }
@@ -10547,7 +10558,7 @@ var Agent = class _Agent {
10547
10558
  */
10548
10559
  static async describe(agentId) {
10549
10560
  const agent = await getRegisteredAgentOrThrow(agentId);
10550
- const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-F52ARQ62.cjs');
10561
+ const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-FDXPBBRA.cjs');
10551
10562
  const settingSources = agent.options.local?.settingSources;
10552
10563
  const subagents = await loadSubagents2(
10553
10564
  agent.cwd ?? process.cwd(),
@@ -10591,12 +10602,12 @@ async function getOrCreateUncached(agentId, options) {
10591
10602
  try {
10592
10603
  return await Agent.resume(agentId, options);
10593
10604
  } catch (err) {
10594
- if (!(err instanceof chunkE7WWIX34_cjs.UnknownAgentError)) throw err;
10605
+ if (!(err instanceof chunkYULF6FPB_cjs.UnknownAgentError)) throw err;
10595
10606
  }
10596
10607
  try {
10597
10608
  return await Agent.create({ ...options, agentId });
10598
10609
  } catch (err) {
10599
- if (err instanceof chunkE7WWIX34_cjs.ConfigurationError && err.code === "agent_id_already_exists") {
10610
+ if (err instanceof chunkYULF6FPB_cjs.ConfigurationError && err.code === "agent_id_already_exists") {
10600
10611
  return await Agent.resume(agentId, options);
10601
10612
  }
10602
10613
  throw err;
@@ -10614,8 +10625,8 @@ async function openLocalStore(reg) {
10614
10625
  const cwd = reg.cwd ?? process.cwd();
10615
10626
  const optModel = reg.options.model;
10616
10627
  const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
10617
- const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-KRZZIG3O.cjs');
10618
- const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-SLQRKQ72.cjs');
10628
+ const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-MAZV5FXJ.cjs');
10629
+ const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-FYRKWRWV.cjs');
10619
10630
  const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
10620
10631
  return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
10621
10632
  }
@@ -10632,5 +10643,5 @@ exports.generateCronId = generateCronId;
10632
10643
  exports.getPricingEntry = getPricingEntry;
10633
10644
  exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
10634
10645
  exports.resolveApiKey = resolveApiKey;
10635
- //# sourceMappingURL=chunk-SHQEZ6Q2.cjs.map
10636
- //# sourceMappingURL=chunk-SHQEZ6Q2.cjs.map
10646
+ //# sourceMappingURL=chunk-F5DSDDBY.cjs.map
10647
+ //# sourceMappingURL=chunk-F5DSDDBY.cjs.map