@theokit/sdk 4.40.0 → 4.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +2 -2
  3. package/dist/{agent-BzZwYFiw.d.ts → agent-BiCINq25.d.ts} +2 -2
  4. package/dist/agent-JDJEBJHU.cjs +55 -0
  5. package/dist/{agent-OOXJJD6A.cjs.map → agent-JDJEBJHU.cjs.map} +1 -1
  6. package/dist/agent-LVKAYADR.js +46 -0
  7. package/dist/{agent-MSR3DHO4.js.map → agent-LVKAYADR.js.map} +1 -1
  8. package/dist/{agent-DxEL4fHh.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-2UBBO2MD.js → chunk-AUMSEL33.js} +5 -5
  54. package/dist/{chunk-2UBBO2MD.js.map → chunk-AUMSEL33.js.map} +1 -1
  55. package/dist/{chunk-XKGOIGTJ.js → chunk-AZ6FKDQR.js} +3 -3
  56. package/dist/{chunk-XKGOIGTJ.js.map → chunk-AZ6FKDQR.js.map} +1 -1
  57. package/dist/{chunk-WPZTYOUX.cjs → chunk-BBZYXVLZ.cjs} +2 -2
  58. package/dist/chunk-BBZYXVLZ.cjs.map +1 -0
  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-SKWVAQAY.js → chunk-DEZ75ET5.js} +3 -3
  64. package/dist/{chunk-SKWVAQAY.js.map → chunk-DEZ75ET5.js.map} +1 -1
  65. package/dist/{chunk-ZRQZOJ3N.js → chunk-DHLVOLUX.js} +77 -56
  66. package/dist/chunk-DHLVOLUX.js.map +1 -0
  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-SEWAPWAF.cjs → chunk-FMIKUGF2.cjs} +124 -124
  72. package/dist/chunk-FMIKUGF2.cjs.map +1 -0
  73. package/dist/{chunk-XZ7PO2FM.js → chunk-FRQ6F44U.js} +4 -4
  74. package/dist/{chunk-XZ7PO2FM.js.map → chunk-FRQ6F44U.js.map} +1 -1
  75. package/dist/{chunk-3LK3ZDL5.cjs → chunk-FZ4YMZA3.cjs} +5 -5
  76. package/dist/{chunk-3LK3ZDL5.cjs.map → chunk-FZ4YMZA3.cjs.map} +1 -1
  77. package/dist/{chunk-MM2JKFQV.cjs → chunk-GC44RATP.cjs} +10 -10
  78. package/dist/{chunk-MM2JKFQV.cjs.map → chunk-GC44RATP.cjs.map} +1 -1
  79. package/dist/{chunk-LNTQRD23.cjs → chunk-GH52NOCL.cjs} +26 -26
  80. package/dist/chunk-GH52NOCL.cjs.map +1 -0
  81. package/dist/{chunk-T6KFGMNY.cjs → chunk-GLEKLAUW.cjs} +12 -12
  82. package/dist/chunk-GLEKLAUW.cjs.map +1 -0
  83. package/dist/{chunk-UIPTINIF.js → chunk-GNMPCZNN.js} +6 -6
  84. package/dist/chunk-GNMPCZNN.js.map +1 -0
  85. package/dist/{chunk-6AE4QTSF.cjs → chunk-GTLH2NI2.cjs} +24 -24
  86. package/dist/{chunk-6AE4QTSF.cjs.map → chunk-GTLH2NI2.cjs.map} +1 -1
  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-BVGJXMSB.cjs → chunk-RPL3POFZ.cjs} +336 -315
  144. package/dist/chunk-RPL3POFZ.cjs.map +1 -0
  145. package/dist/{chunk-U53AYSHS.cjs → chunk-S4Q5OMIK.cjs} +11 -11
  146. package/dist/{chunk-U53AYSHS.cjs.map → chunk-S4Q5OMIK.cjs.map} +1 -1
  147. package/dist/{chunk-FUP3ZA5T.js → chunk-SNKY3C2L.js} +4 -4
  148. package/dist/{chunk-FUP3ZA5T.js.map → chunk-SNKY3C2L.js.map} +1 -1
  149. package/dist/{chunk-BBMN4O6E.js → chunk-TJRPNBY5.js} +4 -4
  150. package/dist/{chunk-BBMN4O6E.js.map → chunk-TJRPNBY5.js.map} +1 -1
  151. package/dist/{chunk-27E4EMR6.cjs → chunk-UJMEWGO6.cjs} +4 -4
  152. package/dist/{chunk-27E4EMR6.cjs.map → chunk-UJMEWGO6.cjs.map} +1 -1
  153. package/dist/{chunk-X627TO3A.js → chunk-UTYCG4RB.js} +12 -12
  154. package/dist/chunk-UTYCG4RB.js.map +1 -0
  155. package/dist/{chunk-5XPKYDK7.js → chunk-VQFSEKU5.js} +12 -5
  156. package/dist/chunk-VQFSEKU5.js.map +1 -0
  157. package/dist/{chunk-NJVV5OAV.cjs → chunk-WCXOKGOQ.cjs} +8 -8
  158. package/dist/chunk-WCXOKGOQ.cjs.map +1 -0
  159. package/dist/{chunk-PIBXDEZM.cjs → chunk-WIGJGFH4.cjs} +5 -5
  160. package/dist/{chunk-PIBXDEZM.cjs.map → chunk-WIGJGFH4.cjs.map} +1 -1
  161. package/dist/{chunk-LOTWA65Z.cjs → chunk-X2YQP452.cjs} +11 -11
  162. package/dist/{chunk-LOTWA65Z.cjs.map → chunk-X2YQP452.cjs.map} +1 -1
  163. package/dist/{chunk-ZAKTZ5B4.cjs → chunk-XA3TSBAH.cjs} +8 -8
  164. package/dist/{chunk-ZAKTZ5B4.cjs.map → chunk-XA3TSBAH.cjs.map} +1 -1
  165. package/dist/{chunk-H2V6CXM7.cjs → chunk-XR4LPBXH.cjs} +9 -9
  166. package/dist/{chunk-H2V6CXM7.cjs.map → chunk-XR4LPBXH.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-BGR0HOz9.d.cts → cron-DgHJnMAK.d.cts} +2 -2
  194. package/dist/{cron-CDAIWCrL.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-DxQe4_Qy.d.ts → errors-BSoXcl3F.d.cts} +3 -3
  200. package/dist/{errors-L1bxHHO0.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/context/context-discovery-runner.d.ts +9 -0
  258. package/dist/internal/runtime/context/context-import-resolver.d.ts +17 -0
  259. package/dist/internal/runtime/lifecycle/env-policy.d.ts +1 -1
  260. package/dist/internal/security/index.cjs +13 -13
  261. package/dist/internal/security/index.js +3 -3
  262. package/dist/internal/session/agent-session.d.ts +1 -1
  263. package/dist/internal/session/compact-session.d.ts +1 -1
  264. package/dist/internal/session/session-cache.d.ts +1 -1
  265. package/dist/judge-call-3QZO5H5N.js +5 -0
  266. package/dist/{judge-call-NPRU7JIQ.js.map → judge-call-3QZO5H5N.js.map} +1 -1
  267. package/dist/judge-call-J5EETJL3.cjs +22 -0
  268. package/dist/{judge-call-AIT3EULV.cjs.map → judge-call-J5EETJL3.cjs.map} +1 -1
  269. package/dist/models.cjs +20 -20
  270. package/dist/models.cjs.map +1 -1
  271. package/dist/models.js +5 -5
  272. package/dist/models.js.map +1 -1
  273. package/dist/path-safety.cjs +10 -10
  274. package/dist/path-safety.js +3 -3
  275. package/dist/persistence.cjs +44 -30
  276. package/dist/persistence.cjs.map +1 -1
  277. package/dist/persistence.d.cts +4 -3
  278. package/dist/persistence.d.ts +4 -3
  279. package/dist/persistence.js +22 -12
  280. package/dist/persistence.js.map +1 -1
  281. package/dist/project.cjs +5 -5
  282. package/dist/project.js +3 -3
  283. package/dist/registry-KB3TS6BM.cjs +46 -0
  284. package/dist/{registry-VKDFTK6L.cjs.map → registry-KB3TS6BM.cjs.map} +1 -1
  285. package/dist/registry-PPFMCM4A.js +9 -0
  286. package/dist/{registry-AXQXPLFH.js.map → registry-PPFMCM4A.js.map} +1 -1
  287. package/dist/retry.cjs +4 -4
  288. package/dist/retry.js +3 -3
  289. package/dist/{run-XXnwwGOT.d.ts → run-C8FBAC8o.d.cts} +21 -2
  290. package/dist/{run-XXnwwGOT.d.cts → run-C8FBAC8o.d.ts} +21 -2
  291. package/dist/{run-until-BK56WG4P.js → run-until-HEQOUVU6.js} +2 -2
  292. package/dist/run-until-HEQOUVU6.js.map +1 -0
  293. package/dist/{run-until-L5KQD3PV.cjs → run-until-U2B5FJJI.cjs} +2 -2
  294. package/dist/run-until-U2B5FJJI.cjs.map +1 -0
  295. package/dist/sandbox/bwrap.d.cts +15 -1
  296. package/dist/sandbox/bwrap.d.ts +15 -1
  297. package/dist/sandbox/index.cjs +39 -24
  298. package/dist/sandbox/index.cjs.map +1 -1
  299. package/dist/sandbox/index.d.cts +1 -1
  300. package/dist/sandbox/index.d.ts +1 -1
  301. package/dist/sandbox/index.js +24 -10
  302. package/dist/sandbox/index.js.map +1 -1
  303. package/dist/sandbox/provision.d.cts +1 -1
  304. package/dist/sandbox/provision.d.ts +1 -1
  305. package/dist/server/errors-envelope.cjs +14 -14
  306. package/dist/server/errors-envelope.d.cts +3 -3
  307. package/dist/server/errors-envelope.d.ts +3 -3
  308. package/dist/server/errors-envelope.js +3 -3
  309. package/dist/session-transcript-7FWTO4BK.js +5 -0
  310. package/dist/{session-transcript-X3UMSVL2.js.map → session-transcript-7FWTO4BK.js.map} +1 -1
  311. package/dist/session-transcript-FYRKWRWV.cjs +50 -0
  312. package/dist/{session-transcript-SLQRKQ72.cjs.map → session-transcript-FYRKWRWV.cjs.map} +1 -1
  313. package/dist/skills.cjs +7 -7
  314. package/dist/skills.js +5 -5
  315. package/dist/stream-object-3R3HZPQN.cjs +20 -0
  316. package/dist/{stream-object-3HEUGMQY.cjs.map → stream-object-3R3HZPQN.cjs.map} +1 -1
  317. package/dist/stream-object-NPJXDZXO.js +7 -0
  318. package/dist/{stream-object-VWYW7FJ2.js.map → stream-object-NPJXDZXO.js.map} +1 -1
  319. package/dist/subagents-loader-5KQVYUNS.js +6 -0
  320. package/dist/{subagents-loader-QUIK6GMV.js.map → subagents-loader-5KQVYUNS.js.map} +1 -1
  321. package/dist/subagents-loader-FDXPBBRA.cjs +15 -0
  322. package/dist/{subagents-loader-F52ARQ62.cjs.map → subagents-loader-FDXPBBRA.cjs.map} +1 -1
  323. package/dist/subagents-loader.cjs +15 -15
  324. package/dist/subagents-loader.cjs.map +1 -1
  325. package/dist/subagents-loader.d.cts +2 -2
  326. package/dist/subagents-loader.d.ts +2 -2
  327. package/dist/subagents-loader.js +14 -14
  328. package/dist/subagents-loader.js.map +1 -1
  329. package/dist/subscription/index.cjs +3 -3
  330. package/dist/subscription/index.js +2 -2
  331. package/dist/task-store.cjs +7 -7
  332. package/dist/task-store.js +4 -4
  333. package/dist/types/run-events.d.ts +20 -1
  334. package/dist/types/session-record.d.ts +1 -1
  335. package/dist/types/usage.d.ts +1 -1
  336. package/dist/workflow.cjs +27 -27
  337. package/dist/workflow.js +6 -6
  338. package/docs/error-codes.md +22 -0
  339. package/docs/harness-capability-map.md +22 -0
  340. package/package.json +1 -1
  341. package/dist/agent-MSR3DHO4.js +0 -46
  342. package/dist/agent-OOXJJD6A.cjs +0 -55
  343. package/dist/agent-session-store-EGTTYSKS.js +0 -6
  344. package/dist/agent-session-store-RHTLZ5OX.cjs +0 -23
  345. package/dist/chunk-23HI77BZ.js.map +0 -1
  346. package/dist/chunk-33B2BSME.cjs.map +0 -1
  347. package/dist/chunk-5KOW3GLE.js.map +0 -1
  348. package/dist/chunk-5XPKYDK7.js.map +0 -1
  349. package/dist/chunk-7GFX45DD.js.map +0 -1
  350. package/dist/chunk-AKMPQJPX.js.map +0 -1
  351. package/dist/chunk-BURYFNOM.cjs.map +0 -1
  352. package/dist/chunk-BVGJXMSB.cjs.map +0 -1
  353. package/dist/chunk-EYUZZXHZ.js.map +0 -1
  354. package/dist/chunk-KRPEPZQY.js.map +0 -1
  355. package/dist/chunk-LNTQRD23.cjs.map +0 -1
  356. package/dist/chunk-N4JNY5DT.cjs.map +0 -1
  357. package/dist/chunk-NJVV5OAV.cjs.map +0 -1
  358. package/dist/chunk-ONVIALVV.js.map +0 -1
  359. package/dist/chunk-QMIG7TKG.cjs.map +0 -1
  360. package/dist/chunk-RNCN2TTP.js.map +0 -1
  361. package/dist/chunk-SEWAPWAF.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/chunk-ZRQZOJ3N.js.map +0 -1
  368. package/dist/compact-session-AZU2LEAE.js +0 -18
  369. package/dist/compact-session-TRCEYCPG.cjs +0 -55
  370. package/dist/context-DNFT4B5D.cjs +0 -22
  371. package/dist/context-LYE6TJL5.js +0 -5
  372. package/dist/fs-session-store-I6GUIFRO.js +0 -10
  373. package/dist/fs-session-store-KRZZIG3O.cjs +0 -19
  374. package/dist/generate-object-DLHT5RXH.js +0 -7
  375. package/dist/generate-object-QILSGTEJ.cjs +0 -20
  376. package/dist/index-manager-LEMQ73A7.cjs +0 -20
  377. package/dist/index-manager-SXF3FAQV.js +0 -11
  378. package/dist/judge-call-AIT3EULV.cjs +0 -22
  379. package/dist/judge-call-NPRU7JIQ.js +0 -5
  380. package/dist/registry-AXQXPLFH.js +0 -9
  381. package/dist/registry-VKDFTK6L.cjs +0 -46
  382. package/dist/run-until-BK56WG4P.js.map +0 -1
  383. package/dist/run-until-L5KQD3PV.cjs.map +0 -1
  384. package/dist/session-transcript-SLQRKQ72.cjs +0 -50
  385. package/dist/session-transcript-X3UMSVL2.js +0 -5
  386. package/dist/stream-object-3HEUGMQY.cjs +0 -20
  387. package/dist/stream-object-VWYW7FJ2.js +0 -7
  388. package/dist/subagents-loader-F52ARQ62.cjs +0 -15
  389. 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-BVGJXMSB.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-RPL3POFZ.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-BVGJXMSB.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-RPL3POFZ.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
  );
@@ -3958,6 +3958,17 @@ function emitTotalDropCounter(droppedSources) {
3958
3958
  }
3959
3959
  var IMPORT_RE = /^@(\S+)\s*$/gm;
3960
3960
  var MAX_HOPS = 5;
3961
+ function realOrResolved(path) {
3962
+ try {
3963
+ return fs.realpathSync(path);
3964
+ } catch {
3965
+ return path;
3966
+ }
3967
+ }
3968
+ function insideRoot(target, root) {
3969
+ const rel = path.relative(realOrResolved(root), realOrResolved(target));
3970
+ return rel !== "" && !rel.startsWith("..") && !path.isAbsolute(rel);
3971
+ }
3961
3972
  async function resolveImports(content, basePath, opts) {
3962
3973
  if (opts.depth >= MAX_HOPS) {
3963
3974
  return `${content}
@@ -3969,6 +3980,9 @@ async function resolveImports(content, basePath, opts) {
3969
3980
  const baseDir = path.dirname(basePath);
3970
3981
  return replaceAsync(content, IMPORT_RE, async (raw) => {
3971
3982
  const absolute = resolveImportPath(raw, baseDir);
3983
+ if (opts.projectRoot !== void 0 && !insideRoot(absolute, opts.projectRoot)) {
3984
+ return `[@import outside the project root, refused: ${raw}]`;
3985
+ }
3972
3986
  if (opts.visited.has(absolute)) {
3973
3987
  return `[@import cycle detected: ${raw}]`;
3974
3988
  }
@@ -3980,7 +3994,8 @@ async function resolveImports(content, basePath, opts) {
3980
3994
  return resolveImports(loaded.content, absolute, {
3981
3995
  visited: opts.visited,
3982
3996
  depth: opts.depth + 1,
3983
- maxBytesPerFile: opts.maxBytesPerFile
3997
+ maxBytesPerFile: opts.maxBytesPerFile,
3998
+ ...opts.projectRoot === void 0 ? {} : { projectRoot: opts.projectRoot }
3984
3999
  });
3985
4000
  });
3986
4001
  }
@@ -4171,7 +4186,7 @@ async function loadOneSource(spec, path$1, opts, gitRoot) {
4171
4186
  if (spec.parser === "frontmatter-zod") {
4172
4187
  return void 0;
4173
4188
  }
4174
- return loadPlainMarkdownSource(spec, path$1, id, opts);
4189
+ return loadPlainMarkdownSource(spec, path$1, id, opts, gitRoot);
4175
4190
  }
4176
4191
  async function loadParsedSource(spec, path, id, parse, isActive) {
4177
4192
  let raw;
@@ -4202,7 +4217,7 @@ function loadRulesSource(spec, path, id, opts) {
4202
4217
  (fm) => shouldActivateRule(fm, opts.touchedFiles ?? [])
4203
4218
  );
4204
4219
  }
4205
- async function loadPlainMarkdownSource(spec, path, id, opts) {
4220
+ async function loadPlainMarkdownSource(spec, path, id, opts, gitRoot) {
4206
4221
  const loaded = await loadPlainMarkdown(path, { maxBytesPerFile: opts.maxBytesPerFile });
4207
4222
  if (loaded === void 0) return void 0;
4208
4223
  let content = loaded.content;
@@ -4210,7 +4225,12 @@ async function loadPlainMarkdownSource(spec, path, id, opts) {
4210
4225
  content = await resolveImports(content, path, {
4211
4226
  visited: /* @__PURE__ */ new Set([path]),
4212
4227
  depth: 0,
4213
- maxBytesPerFile: opts.maxBytesPerFile
4228
+ maxBytesPerFile: opts.maxBytesPerFile,
4229
+ // The document carrying the import is repository-controlled, so the repository is the
4230
+ // boundary it may not cross. Without this, `CLAUDE.md` / `GEMINI.md` — the two specs
4231
+ // with `followImports: true` — could name any absolute or `~/` path and have it
4232
+ // inlined into the system prompt.
4233
+ projectRoot: opts.importRoot ?? gitRoot ?? opts.cwd
4214
4234
  });
4215
4235
  }
4216
4236
  return {
@@ -4345,7 +4365,7 @@ async function loadContextConfig(cwd) {
4345
4365
  });
4346
4366
  if (mdEntities.length > 0) {
4347
4367
  if (fs.existsSync(jsonPath)) {
4348
- chunkK6TWHNT4_cjs.warnOnce(
4368
+ chunkHECR7KF5_cjs.warnOnce(
4349
4369
  "context-both-present",
4350
4370
  "[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
4351
4371
  );
@@ -4355,7 +4375,7 @@ async function loadContextConfig(cwd) {
4355
4375
  };
4356
4376
  }
4357
4377
  if (!fs.existsSync(jsonPath)) return { sources: [] };
4358
- chunkK6TWHNT4_cjs.warnOnce(
4378
+ chunkHECR7KF5_cjs.warnOnce(
4359
4379
  "context-json-deprecated",
4360
4380
  "[theokit-sdk] .theokit/context.json is deprecated; migrate to .theokit/context/<name>.md via theokit-migrate-config"
4361
4381
  );
@@ -4363,7 +4383,7 @@ async function loadContextConfig(cwd) {
4363
4383
  try {
4364
4384
  raw = await promises.readFile(jsonPath, "utf8");
4365
4385
  } catch (cause) {
4366
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Failed to read context config: ${jsonPath}`, {
4386
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Failed to read context config: ${jsonPath}`, {
4367
4387
  code: "context_read_error",
4368
4388
  cause
4369
4389
  });
@@ -4375,13 +4395,13 @@ function parseConfig(raw, configPath) {
4375
4395
  try {
4376
4396
  parsed = JSON.parse(raw);
4377
4397
  } catch (cause) {
4378
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Invalid JSON in context config: ${configPath}`, {
4398
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Invalid JSON in context config: ${configPath}`, {
4379
4399
  code: "context_json_invalid",
4380
4400
  cause
4381
4401
  });
4382
4402
  }
4383
4403
  if (!parsed || typeof parsed !== "object") {
4384
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Context config must be an object: ${configPath}`, {
4404
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Context config must be an object: ${configPath}`, {
4385
4405
  code: "context_config_shape"
4386
4406
  });
4387
4407
  }
@@ -4396,7 +4416,7 @@ function parseConfig(raw, configPath) {
4396
4416
  }
4397
4417
  function readSources(sourcesRaw, configPath) {
4398
4418
  if (!Array.isArray(sourcesRaw)) {
4399
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Context config sources must be an array: ${configPath}`, {
4419
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Context config sources must be an array: ${configPath}`, {
4400
4420
  code: "context_sources_shape"
4401
4421
  });
4402
4422
  }
@@ -4494,7 +4514,7 @@ var PluginsManager = class {
4494
4514
  async refresh() {
4495
4515
  this.plugins = [];
4496
4516
  const pluginsRoot = path.join(this.cwd, ".theokit", "plugins");
4497
- const entries = await chunkLY4KEOOY_cjs.readWorkspaceDir(pluginsRoot, "plugins_read_error", "plugins directory");
4517
+ const entries = await chunkBRHRQOJA_cjs.readWorkspaceDir(pluginsRoot, "plugins_read_error", "plugins directory");
4498
4518
  for (const entry of entries) {
4499
4519
  if (!entry.isDirectory()) continue;
4500
4520
  const folderName = entry.name;
@@ -4502,13 +4522,13 @@ var PluginsManager = class {
4502
4522
  const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
4503
4523
  const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(pluginsRoot, folderName) : await loadPluginManifestFromJson(jsonPath, folderName);
4504
4524
  if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4505
- chunkK6TWHNT4_cjs.warnOnce(
4525
+ chunkHECR7KF5_cjs.warnOnce(
4506
4526
  `plugin-${folderName}-both`,
4507
4527
  `[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
4508
4528
  );
4509
4529
  }
4510
4530
  if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4511
- chunkK6TWHNT4_cjs.warnOnce(
4531
+ chunkHECR7KF5_cjs.warnOnce(
4512
4532
  "plugin-json-deprecated",
4513
4533
  "[theokit-sdk] plugin.json manifests are deprecated; migrate to PLUGIN.md via theokit-migrate-config"
4514
4534
  );
@@ -4526,11 +4546,11 @@ var PluginsManager = class {
4526
4546
  const entry = metadata.entry;
4527
4547
  if (entry === void 0) return;
4528
4548
  const pluginRoot = path.join(this.cwd, ".theokit", "plugins", folderName);
4529
- const entryPath = chunkZAKTZ5B4_cjs.safePathJoin(pluginRoot, entry);
4549
+ const entryPath = chunkXA3TSBAH_cjs.safePathJoin(pluginRoot, entry);
4530
4550
  try {
4531
4551
  await promises.readFile(entryPath, "utf8");
4532
4552
  } catch (cause) {
4533
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${metadata.name} entry file is missing: ${entry}`, {
4553
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${metadata.name} entry file is missing: ${entry}`, {
4534
4554
  code: "plugin_entry_missing",
4535
4555
  cause
4536
4556
  });
@@ -4539,7 +4559,7 @@ var PluginsManager = class {
4539
4559
  assertCloudRules() {
4540
4560
  if (!this.cloud) return;
4541
4561
  if (this.localPaths !== void 0 && this.localPaths.length > 0) {
4542
- throw new chunkE7WWIX34_cjs.ConfigurationError(
4562
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
4543
4563
  "Cloud agents reject local plugin paths \u2014 plugins must come from committed repo files",
4544
4564
  { code: "cloud_plugin_path_rejected" }
4545
4565
  );
@@ -4551,7 +4571,7 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
4551
4571
  try {
4552
4572
  raw = await promises.readFile(manifestPath, "utf8");
4553
4573
  } catch (cause) {
4554
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} is missing plugin.json`, {
4574
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} is missing plugin.json`, {
4555
4575
  code: "plugin_missing_manifest",
4556
4576
  cause
4557
4577
  });
@@ -4560,13 +4580,13 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
4560
4580
  try {
4561
4581
  parsed = JSON.parse(raw);
4562
4582
  } catch (cause) {
4563
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} manifest is invalid JSON`, {
4583
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} manifest is invalid JSON`, {
4564
4584
  code: "plugin_manifest_invalid",
4565
4585
  cause
4566
4586
  });
4567
4587
  }
4568
4588
  if (!parsed || typeof parsed !== "object") {
4569
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} manifest must be an object`, {
4589
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} manifest must be an object`, {
4570
4590
  code: "plugin_manifest_shape"
4571
4591
  });
4572
4592
  }
@@ -4585,7 +4605,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
4585
4605
  try {
4586
4606
  raw = await promises.readFile(mdPath, "utf8");
4587
4607
  } catch (cause) {
4588
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} is missing PLUGIN.md`, {
4608
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} is missing PLUGIN.md`, {
4589
4609
  code: "plugin_missing_manifest",
4590
4610
  cause
4591
4611
  });
@@ -4600,7 +4620,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
4600
4620
  });
4601
4621
  const entity = entities.find((e) => e.slug === "PLUGIN");
4602
4622
  if (entity === void 0) {
4603
- throw new chunkE7WWIX34_cjs.ConfigurationError(`Plugin ${folderName} PLUGIN.md not parseable`, {
4623
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} PLUGIN.md not parseable`, {
4604
4624
  code: "plugin_missing_manifest"
4605
4625
  });
4606
4626
  }
@@ -4874,7 +4894,7 @@ function assertValidThresholds(soft, hard) {
4874
4894
  ["hardThreshold", hard]
4875
4895
  ]) {
4876
4896
  if (!Number.isInteger(value) || value < 1) {
4877
- throw new chunkE7WWIX34_cjs.ConfigurationError(
4897
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
4878
4898
  `doomLoop.${label} must be a positive integer (received ${value}).`,
4879
4899
  { code: "invalid_doom_loop_threshold" }
4880
4900
  );
@@ -5097,7 +5117,7 @@ async function initLoopContext(inputs) {
5097
5117
  memoryProviderHandle = void 0;
5098
5118
  }
5099
5119
  }
5100
- const tools = await collectTools(inputs.mcp);
5120
+ const tools = await collectTools(inputs.mcp, inputs.runEventSink);
5101
5121
  for (const memTool of inputs.memoryTools ?? []) {
5102
5122
  tools.push({
5103
5123
  name: memTool.name,
@@ -5181,18 +5201,19 @@ async function initLoopContext(inputs) {
5181
5201
  ...memorySystemPromptAdditions !== void 0 ? { memorySystemPromptAdditions } : {}
5182
5202
  };
5183
5203
  }
5184
- async function safeListTools(client, serverName) {
5204
+ async function safeListTools(client, serverName, sink) {
5185
5205
  try {
5186
5206
  return await client.listTools();
5187
5207
  } catch (cause) {
5188
5208
  const message = cause instanceof Error ? cause.message : String(cause);
5189
5209
  const server = serverName ?? "unknown";
5190
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] mcp listTools failed (server=${server}): ${message}
5210
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] mcp listTools failed (server=${server}): ${message}
5191
5211
  `);
5212
+ chunkKCQUYQ3V_cjs.emitRunEvent(sink, { type: "mcp_server_failed", serverName: server, message });
5192
5213
  return [];
5193
5214
  }
5194
5215
  }
5195
- async function collectTools(mcp) {
5216
+ async function collectTools(mcp, sink) {
5196
5217
  const tools = [
5197
5218
  {
5198
5219
  name: "shell",
@@ -5206,7 +5227,7 @@ async function collectTools(mcp) {
5206
5227
  }
5207
5228
  ];
5208
5229
  for (const [serverName, client] of mcp.entries()) {
5209
- const mcpTools = await safeListTools(client, serverName);
5230
+ const mcpTools = await safeListTools(client, serverName, sink);
5210
5231
  for (const tool of mcpTools) {
5211
5232
  tools.push({
5212
5233
  name: `mcp_${sanitize(serverName)}_${sanitize(tool.name)}`,
@@ -5256,7 +5277,7 @@ function emitLlmMetrics(inputs, result, startAt) {
5256
5277
  inputs.telemetry?.recordHistogram(HISTOGRAM_NAMES.LLM_USAGE_MISSING, 1, {
5257
5278
  provider: inputs.llm.name
5258
5279
  });
5259
- chunkA76OFN2B_cjs.diag(
5280
+ chunkZHPET3LZ_cjs.diag(
5260
5281
  `[theokit-sdk] llm usage missing from ${inputs.llm.name} finish \u2014 budget may undercount
5261
5282
  `
5262
5283
  );
@@ -5552,7 +5573,7 @@ function coerceArgsToSchema(args, schema) {
5552
5573
  }
5553
5574
 
5554
5575
  // src/tool-error.ts
5555
- var ToolError = class extends chunkE7WWIX34_cjs.TheokitAgentError {
5576
+ var ToolError = class extends chunkYULF6FPB_cjs.TheokitAgentError {
5556
5577
  name = "ToolError";
5557
5578
  /** The error content surfaced to the model: a string, or text/image blocks. */
5558
5579
  content;
@@ -5746,7 +5767,7 @@ function raceToolExecution(exec, opts) {
5746
5767
  // src/internal/agent-loop/tool-dispatch.ts
5747
5768
  async function dispatchTools(inputs, tools, toolCalls, events, parentSpan) {
5748
5769
  const maxConcurrent = inputs.maxConcurrentTools ?? 4;
5749
- return chunkRHQJX3EI_cjs.mapWithConcurrency(
5770
+ return chunkOEFFPR2S_cjs.mapWithConcurrency(
5750
5771
  toolCalls,
5751
5772
  maxConcurrent,
5752
5773
  (call) => dispatchSingleCall(inputs, tools, call, events, parentSpan)
@@ -5774,7 +5795,7 @@ async function dispatchSingleCall(inputs, tools, call, events, parentSpan) {
5774
5795
  toolSpan?.end();
5775
5796
  return fileVeto;
5776
5797
  }
5777
- chunkQMIG7TKG_cjs.emitRunEvent(inputs.runEventSink, {
5798
+ chunkKCQUYQ3V_cjs.emitRunEvent(inputs.runEventSink, {
5778
5799
  type: "tool_progress",
5779
5800
  toolName: workingCall.name,
5780
5801
  toolCallId: callId
@@ -5805,7 +5826,7 @@ function applyRepairAndExtractCall(tools, call) {
5805
5826
  function vetoFromForkWhitelist(inputs, call, callId, events) {
5806
5827
  const whitelistDecision = chunkVJ26EKGJ_cjs.checkToolWhitelist(call.name);
5807
5828
  if (whitelistDecision.allowed) return void 0;
5808
- chunkQMIG7TKG_cjs.emitRunEvent(inputs.runEventSink, {
5829
+ chunkKCQUYQ3V_cjs.emitRunEvent(inputs.runEventSink, {
5809
5830
  type: "permission_denied",
5810
5831
  toolName: call.name,
5811
5832
  toolCallId: callId,
@@ -5850,7 +5871,7 @@ async function vetoFromPluginPreHook(inputs, call, callId, events) {
5850
5871
  ...inputs.permissionMode !== void 0 ? { permissionMode: inputs.permissionMode } : {}
5851
5872
  });
5852
5873
  if (pluginVeto === void 0) return void 0;
5853
- chunkQMIG7TKG_cjs.emitRunEvent(inputs.runEventSink, {
5874
+ chunkKCQUYQ3V_cjs.emitRunEvent(inputs.runEventSink, {
5854
5875
  type: "permission_denied",
5855
5876
  toolName: call.name,
5856
5877
  toolCallId: callId,
@@ -5879,7 +5900,7 @@ async function vetoFromFileHookPreDecision(inputs, call, callId, events) {
5879
5900
  runId: inputs.runId
5880
5901
  });
5881
5902
  if (!preDecision.blocked) return void 0;
5882
- chunkQMIG7TKG_cjs.emitRunEvent(inputs.runEventSink, {
5903
+ chunkKCQUYQ3V_cjs.emitRunEvent(inputs.runEventSink, {
5883
5904
  type: "permission_denied",
5884
5905
  toolName: call.name,
5885
5906
  toolCallId: callId,
@@ -5980,7 +6001,7 @@ function finalizeSpanAndPostHook(inputs, call, callId, result, events, toolSpan)
5980
6001
  agentId: inputs.agentId,
5981
6002
  runId: inputs.runId
5982
6003
  }).catch((err) => {
5983
- chunkA76OFN2B_cjs.diag(
6004
+ chunkZHPET3LZ_cjs.diag(
5984
6005
  `[theokit-sdk] postToolUse hook error (swallowed): ${err instanceof Error ? err.message : String(err)}
5985
6006
  `
5986
6007
  );
@@ -5999,7 +6020,7 @@ async function emitToolLifecycleDelta(inputs, update) {
5999
6020
  try {
6000
6021
  await inputs.onDelta({ update });
6001
6022
  } catch (err) {
6002
- chunkA76OFN2B_cjs.diag(
6023
+ chunkZHPET3LZ_cjs.diag(
6003
6024
  `[theokit-sdk] onDelta tool-lifecycle emit error (swallowed): ${err instanceof Error ? err.message : String(err)}
6004
6025
  `
6005
6026
  );
@@ -6011,7 +6032,7 @@ async function safeEmitToolHook(callback, event) {
6011
6032
  await callback(event);
6012
6033
  } catch (cause) {
6013
6034
  const msg = cause instanceof Error ? cause.message : String(cause);
6014
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] tool lifecycle hook threw: ${msg}
6035
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] tool lifecycle hook threw: ${msg}
6015
6036
  `);
6016
6037
  }
6017
6038
  }
@@ -6078,7 +6099,7 @@ function applyToolResultGuard(parts, opts) {
6078
6099
  (p) => (
6079
6100
  // SE7 — guard the TEXT of a tool result (string or the text blocks of a
6080
6101
  // structured content); image blocks pass through untouched.
6081
- p.type === "tool_result" ? { ...p, content: chunkSEWAPWAF_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
6102
+ p.type === "tool_result" ? { ...p, content: chunkFMIKUGF2_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
6082
6103
  )
6083
6104
  );
6084
6105
  }
@@ -6273,7 +6294,7 @@ function catalogCostFallback(provider, cleanedModel) {
6273
6294
  const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
6274
6295
  if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
6275
6296
  for (const key of candidates) {
6276
- const info = chunkT6KFGMNY_cjs.getCatalogModelInfo(key);
6297
+ const info = chunkGLEKLAUW_cjs.getCatalogModelInfo(key);
6277
6298
  const cost = info?.cost;
6278
6299
  if (cost === void 0) continue;
6279
6300
  const [prov, ...modelParts] = key.split("/");
@@ -6285,7 +6306,7 @@ function catalogCostFallback(provider, cleanedModel) {
6285
6306
  ...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
6286
6307
  ...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
6287
6308
  // 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"
6309
+ pricingVersion: chunkGLEKLAUW_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
6289
6310
  };
6290
6311
  }
6291
6312
  return void 0;
@@ -6738,15 +6759,15 @@ var FallbackLlmClient = class {
6738
6759
  let lastError;
6739
6760
  for (const client of this.clients) {
6740
6761
  if (signal.aborted) throw abortError(signal);
6741
- const attempt = await chunkSEWAPWAF_cjs.tryFirstEvent(client, request, signal, true);
6762
+ const attempt = await chunkFMIKUGF2_cjs.tryFirstEvent(client, request, signal, true);
6742
6763
  if (attempt.kind === "handshake_error") {
6743
6764
  lastError = attempt.error;
6744
6765
  continue;
6745
6766
  }
6746
- return yield* chunkSEWAPWAF_cjs.relayStream(attempt.generator, attempt.firstResult);
6767
+ return yield* chunkFMIKUGF2_cjs.relayStream(attempt.generator, attempt.firstResult);
6747
6768
  }
6748
6769
  if (lastError !== void 0) throw lastError;
6749
- throw new chunkE7WWIX34_cjs.NetworkError("FallbackLlmClient has no providers configured", {
6770
+ throw new chunkYULF6FPB_cjs.NetworkError("FallbackLlmClient has no providers configured", {
6750
6771
  code: "fallback_empty_chain"
6751
6772
  });
6752
6773
  }
@@ -6769,7 +6790,7 @@ function reconnectDelay(attempt) {
6769
6790
  return ms <= 0 ? Promise.resolve() : new Promise((resolve) => setTimeout(resolve, ms));
6770
6791
  }
6771
6792
  function mcpTimeoutError(name, timeoutMs) {
6772
- return new chunkE7WWIX34_cjs.NetworkError(`MCP ${name} request timed out after ${timeoutMs}ms`, {
6793
+ return new chunkYULF6FPB_cjs.NetworkError(`MCP ${name} request timed out after ${timeoutMs}ms`, {
6773
6794
  code: "mcp_timeout"
6774
6795
  });
6775
6796
  }
@@ -6844,7 +6865,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6844
6865
  cwd: resolvedCwd,
6845
6866
  // #54 (F-H1) — a third-party MCP server binary must not inherit host
6846
6867
  // secrets. Scrub secret-like vars by default; `config.env` still wins.
6847
- env: chunkWPZTYOUX_cjs.resolveChildEnv({ policy: this.config.envPolicy, overrides: this.config.env })
6868
+ env: chunkBBZYXVLZ_cjs.resolveChildEnv({ policy: this.config.envPolicy, overrides: this.config.env })
6848
6869
  });
6849
6870
  this.child = child;
6850
6871
  child.stdout.on("data", (chunk) => this.consume(chunk));
@@ -6852,7 +6873,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6852
6873
  child.stdin.on("error", () => void 0);
6853
6874
  child.on("error", () => {
6854
6875
  this.rejectAllPending(
6855
- new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} process crashed`, { code: "mcp_crashed" })
6876
+ new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} process crashed`, { code: "mcp_crashed" })
6856
6877
  );
6857
6878
  });
6858
6879
  child.on("exit", () => {
@@ -6860,7 +6881,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6860
6881
  this.child = void 0;
6861
6882
  this.dropped = true;
6862
6883
  this.rejectAllPending(
6863
- new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6884
+ new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6864
6885
  );
6865
6886
  });
6866
6887
  }
@@ -6888,7 +6909,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6888
6909
  if (this.child !== void 0) return Promise.resolve();
6889
6910
  if (!this.dropped) {
6890
6911
  return Promise.reject(
6891
- new chunkE7WWIX34_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6912
+ new chunkYULF6FPB_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6892
6913
  );
6893
6914
  }
6894
6915
  this.reconnectPromise ??= this.reconnect().finally(() => {
@@ -6909,13 +6930,13 @@ var StdioMcpClient = class extends BaseMcpClient {
6909
6930
  lastErr = err;
6910
6931
  }
6911
6932
  }
6912
- throw new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} reconnect exhausted`, {
6933
+ throw new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} reconnect exhausted`, {
6913
6934
  code: "mcp_disconnected",
6914
6935
  ...lastErr instanceof Error ? { cause: lastErr } : {}
6915
6936
  });
6916
6937
  }
6917
6938
  async close() {
6918
- this.rejectAllPending(new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} closed`, { code: "mcp_closed" }));
6939
+ this.rejectAllPending(new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} closed`, { code: "mcp_closed" }));
6919
6940
  const child = this.child;
6920
6941
  this.child = void 0;
6921
6942
  this.dropped = false;
@@ -6934,7 +6955,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6934
6955
  if (this.buffer.length > MAX_STDIO_BUFFER_BYTES) {
6935
6956
  this.buffer = "";
6936
6957
  this.rejectAllPending(
6937
- new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} exceeded stdout buffer limit`, {
6958
+ new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} exceeded stdout buffer limit`, {
6938
6959
  code: "mcp_buffer_overflow"
6939
6960
  })
6940
6961
  );
@@ -6969,7 +6990,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6969
6990
  if (child !== void 0) return this.send(child, method, params);
6970
6991
  if (this.dropped) return this.reconnectAndRequest(method, params);
6971
6992
  return Promise.reject(
6972
- new chunkE7WWIX34_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6993
+ new chunkYULF6FPB_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6973
6994
  );
6974
6995
  }
6975
6996
  /** M2 #59 — reconnect a dropped client, then send. Separate async path so the
@@ -6978,7 +6999,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6978
6999
  await this.ensureConnected();
6979
7000
  const child = this.child;
6980
7001
  if (child === void 0) {
6981
- throw new chunkE7WWIX34_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" });
7002
+ throw new chunkYULF6FPB_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" });
6982
7003
  }
6983
7004
  return this.send(child, method, params);
6984
7005
  }
@@ -6995,7 +7016,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6995
7016
  this.child = void 0;
6996
7017
  this.dropped = true;
6997
7018
  this.rejectAllPending(
6998
- new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
7019
+ new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6999
7020
  );
7000
7021
  }, this.timeoutMs);
7001
7022
  this.pending.set(id, { resolve, reject, timer });
@@ -7064,8 +7085,8 @@ var HttpMcpClient = class extends BaseMcpClient {
7064
7085
  * A single JSON-RPC reply arrives as one event, so the FIRST parseable `data:` is the answer.
7065
7086
  */
7066
7087
  async readBody(response) {
7067
- const tipo = response.headers.get("content-type") ?? "";
7068
- if (!tipo.includes("text/event-stream")) return await response.json();
7088
+ const contentType = response.headers.get("content-type") ?? "";
7089
+ if (!contentType.includes("text/event-stream")) return await response.json();
7069
7090
  const text = await response.text();
7070
7091
  for (const line of text.split(/\r?\n/)) {
7071
7092
  if (!line.startsWith("data:")) continue;
@@ -7073,7 +7094,7 @@ var HttpMcpClient = class extends BaseMcpClient {
7073
7094
  if (payload === "") continue;
7074
7095
  return JSON.parse(payload);
7075
7096
  }
7076
- throw new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} returned an event stream with no data payload`, {
7097
+ throw new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} returned an event stream with no data payload`, {
7077
7098
  code: "mcp_http_error"
7078
7099
  });
7079
7100
  }
@@ -7101,7 +7122,7 @@ var HttpMcpClient = class extends BaseMcpClient {
7101
7122
  throw cause;
7102
7123
  }
7103
7124
  if (!response.ok) {
7104
- throw new chunkE7WWIX34_cjs.NetworkError(`MCP ${this.name} returned ${response.status}`, {
7125
+ throw new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} returned ${response.status}`, {
7105
7126
  code: "mcp_http_error"
7106
7127
  });
7107
7128
  }
@@ -7117,14 +7138,14 @@ var HttpMcpClient = class extends BaseMcpClient {
7117
7138
  function resolveMcpCwd(configCwd) {
7118
7139
  if (configCwd === void 0) return process.cwd();
7119
7140
  if (path.isAbsolute(configCwd)) return configCwd;
7120
- return chunkZAKTZ5B4_cjs.safePathJoin(process.cwd(), configCwd);
7141
+ return chunkXA3TSBAH_cjs.safePathJoin(process.cwd(), configCwd);
7121
7142
  }
7122
7143
 
7123
7144
  // src/internal/providers/register-plugin-providers.ts
7124
7145
  function registerPluginProviderProfiles(entries) {
7125
7146
  let registered2 = 0;
7126
7147
  for (const entry of entries) {
7127
- chunkT6KFGMNY_cjs.registerProvider(entry.profile);
7148
+ chunkGLEKLAUW_cjs.registerProvider(entry.profile);
7128
7149
  registered2 += 1;
7129
7150
  }
7130
7151
  return registered2;
@@ -7204,7 +7225,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
7204
7225
  if (exposedSet.has(name)) continue;
7205
7226
  const hint = suggestClosest(name, exposedSet);
7206
7227
  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(
7228
+ chunkHECR7KF5_cjs.warnOnce(
7208
7229
  `personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
7209
7230
  message
7210
7231
  );
@@ -7313,25 +7334,25 @@ function createRealLocalRun(options) {
7313
7334
  }
7314
7335
  var pluginProvidersAnnounced = false;
7315
7336
  function resolveRunProvider(options) {
7316
- chunkT6KFGMNY_cjs.registerBuiltins();
7337
+ chunkGLEKLAUW_cjs.registerBuiltins();
7317
7338
  const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
7318
7339
  const registered2 = registerPluginProviderProfiles(profiles);
7319
7340
  if (registered2 > 0 && !pluginProvidersAnnounced) {
7320
7341
  pluginProvidersAnnounced = true;
7321
7342
  const names = profiles.map((e) => e.profile.name).join(", ");
7322
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] registered ${registered2} plugin provider profile(s): ${names}
7343
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] registered ${registered2} plugin provider profile(s): ${names}
7323
7344
  `);
7324
7345
  }
7325
7346
  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();
7347
+ const modelInferredProvider = parsedModel.provider !== void 0 && chunkGLEKLAUW_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
7348
+ const keyInferredProvider = chunkFMIKUGF2_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
7349
+ const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkFMIKUGF2_cjs.detectPrimaryProvider();
7329
7350
  const effectiveModelId = modelInferredProvider !== void 0 && modelInferredProvider === primary ? parsedModel.name : options.model?.id ?? "claude-sonnet-4-6";
7330
7351
  return { primary, effectiveModelId };
7331
7352
  }
7332
7353
  function mergeExplicitApiKey(pools, primary, apiKey) {
7333
7354
  if (apiKey === void 0 || apiKey.length === 0) return pools;
7334
- if (chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
7355
+ if (chunkFMIKUGF2_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
7335
7356
  const existing = pools?.[primary];
7336
7357
  if (existing !== void 0 && existing.length > 0) return pools;
7337
7358
  return { ...pools ?? {}, [primary]: [apiKey] };
@@ -7339,7 +7360,7 @@ function mergeExplicitApiKey(pools, primary, apiKey) {
7339
7360
  function buildLoopInputs(options, runId, userText, userImages) {
7340
7361
  const maxIterations = options.sendOptions.maxIterations;
7341
7362
  if (maxIterations !== void 0 && (!Number.isInteger(maxIterations) || maxIterations < 1)) {
7342
- throw new chunkE7WWIX34_cjs.ConfigurationError(
7363
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
7343
7364
  `SendOptions.maxIterations must be a positive integer, got ${maxIterations}`,
7344
7365
  { code: "invalid_max_iterations" }
7345
7366
  );
@@ -7354,14 +7375,14 @@ function buildLoopInputs(options, runId, userText, userImages) {
7354
7375
  const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
7355
7376
  const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
7356
7377
  const rateLimitSink = options.sendOptions.onRunEvent;
7357
- const chain = chunkSEWAPWAF_cjs.resolveProviderChain({
7378
+ const chain = chunkFMIKUGF2_cjs.resolveProviderChain({
7358
7379
  primary,
7359
7380
  ...fallback !== void 0 ? { fallback } : {},
7360
7381
  ...apiKeys !== void 0 ? { apiKeys } : {},
7361
7382
  ...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {},
7362
7383
  ...extractToolCallsFromContent === true ? { extractToolCallsFromContent: true } : {},
7363
7384
  ...rateLimitSink !== void 0 ? {
7364
- onRateLimit: (info) => chunkQMIG7TKG_cjs.emitRunEvent(rateLimitSink, { type: "rate_limit", ...info })
7385
+ onRateLimit: (info) => chunkKCQUYQ3V_cjs.emitRunEvent(rateLimitSink, { type: "rate_limit", ...info })
7365
7386
  } : {}
7366
7387
  });
7367
7388
  const llm = chain.length === 1 ? chain[0] : new FallbackLlmClient(chain);
@@ -7636,7 +7657,7 @@ function buildRealRunOptions(args) {
7636
7657
  };
7637
7658
  }
7638
7659
  async function createFixtureRunHelper(args) {
7639
- const sessionMessages = chunkN4JNY5DT_cjs.getSessionMessages(args.inputs.agentId);
7660
+ const sessionMessages = chunkZO2L5U6F_cjs.getSessionMessages(args.inputs.agentId);
7640
7661
  const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
7641
7662
  return createLocalRun({
7642
7663
  agentId: args.inputs.agentId,
@@ -7655,7 +7676,7 @@ async function createFixtureRunHelper(args) {
7655
7676
  }
7656
7677
  async function dispatchLocalRun(args) {
7657
7678
  const apiKey = resolveApiKey(args.inputs.options.apiKey);
7658
- if (chunkSEWAPWAF_cjs.shouldUseRealLocalRuntime(apiKey)) {
7679
+ if (chunkFMIKUGF2_cjs.shouldUseRealLocalRuntime(apiKey)) {
7659
7680
  return createRealLocalRun(
7660
7681
  buildRealRunOptions({
7661
7682
  inputs: args.inputs,
@@ -7690,20 +7711,20 @@ async function readProjectMcpServers(cwd) {
7690
7711
 
7691
7712
  // src/internal/local-agent/local-agent-invalidate.ts
7692
7713
  async function applyDeferredInvalidation(agentId, pending, refresh) {
7693
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] applying deferred cache invalidation (${agentId}): ${pending.reason}
7714
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] applying deferred cache invalidation (${agentId}): ${pending.reason}
7694
7715
  `);
7695
7716
  try {
7696
7717
  await refresh();
7697
7718
  } catch (err) {
7698
7719
  const msg = err instanceof Error ? err.message : String(err);
7699
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] invalidateCache reload failed (continuing): ${msg}
7720
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] invalidateCache reload failed (continuing): ${msg}
7700
7721
  `);
7701
7722
  }
7702
7723
  }
7703
7724
  async function invalidateCacheImpl(agentId, reason, options, disposed, dispose, setPending) {
7704
7725
  if (disposed) return;
7705
7726
  if (options.applyNow === true) {
7706
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] invalidateCache applyNow disposing agent (${agentId}): ${reason}
7727
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] invalidateCache applyNow disposing agent (${agentId}): ${reason}
7707
7728
  `);
7708
7729
  await dispose();
7709
7730
  return;
@@ -7764,7 +7785,7 @@ var LiveAgentRegistry = class {
7764
7785
  const existing = this.#agents.get(id);
7765
7786
  if (existing !== void 0 && existing.agent !== agent) {
7766
7787
  void existing.agent.dispose().catch(() => {
7767
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] dispose during overwrite failed (${id})
7788
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] dispose during overwrite failed (${id})
7768
7789
  `);
7769
7790
  });
7770
7791
  }
@@ -7868,7 +7889,7 @@ var LiveAgentRegistry = class {
7868
7889
  await agent.dispose();
7869
7890
  } catch (cause) {
7870
7891
  const msg = cause instanceof Error ? cause.message : String(cause);
7871
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] dispose during eviction failed (${id}): ${msg}
7892
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] dispose during eviction failed (${id}): ${msg}
7872
7893
  `);
7873
7894
  }
7874
7895
  if (this.#onEvict !== void 0) {
@@ -7876,7 +7897,7 @@ var LiveAgentRegistry = class {
7876
7897
  this.#onEvict(id, reason);
7877
7898
  } catch (cause) {
7878
7899
  const msg = cause instanceof Error ? cause.message : String(cause);
7879
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] onEvict listener threw (${id}): ${msg}
7900
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] onEvict listener threw (${id}): ${msg}
7880
7901
  `);
7881
7902
  }
7882
7903
  }
@@ -7892,7 +7913,7 @@ async function acquireLeaseIfPossible(store, agentId) {
7892
7913
  await a.call(store, agentId);
7893
7914
  } catch (err) {
7894
7915
  if (err instanceof Error && err.name === "SessionBusyError") throw err;
7895
- chunkA76OFN2B_cjs.diag(
7916
+ chunkZHPET3LZ_cjs.diag(
7896
7917
  `[theokit-sdk] writer lease unavailable for ${agentId} (${err instanceof Error ? err.message : String(err)}) \u2014 proceeding without single-writer protection
7897
7918
  `
7898
7919
  );
@@ -7911,16 +7932,16 @@ async function disposeLocalAgentSession(agent) {
7911
7932
  agent.lifecycleAbortController.abort();
7912
7933
  await chunkYLQQX5W2_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
7913
7934
  disposeSessionMcpClients(agent.agentId);
7914
- await chunkN4JNY5DT_cjs.flushSessionWrites();
7935
+ await chunkZO2L5U6F_cjs.flushSessionWrites();
7915
7936
  await flushRegistrySaves(agent.workspaceCwd);
7916
7937
  await disposeSessionStore(agent.sessionStore);
7917
- chunkN4JNY5DT_cjs.discardSession(agent.workspaceCwd, agent.agentId);
7938
+ chunkZO2L5U6F_cjs.discardSession(agent.workspaceCwd, agent.agentId);
7918
7939
  }
7919
7940
  async function reloadLocalAgent(agent) {
7920
7941
  if (agent.context !== void 0) await agent.context.refresh();
7921
7942
  if (agent.skillsManager !== void 0) await agent.skillsManager.refresh();
7922
7943
  if (agent.pluginsManager !== void 0) await agent.pluginsManager.refresh();
7923
- return await chunkLOTWA65Z_cjs.loadSubagents(
7944
+ return await chunkX2YQP452_cjs.loadSubagents(
7924
7945
  agent.workspaceCwd,
7925
7946
  agent.settingSourcesIncludeProject,
7926
7947
  agent.options.agents
@@ -7928,12 +7949,12 @@ async function reloadLocalAgent(agent) {
7928
7949
  }
7929
7950
  async function persistActiveMemoryTranscript(cwd, transcript) {
7930
7951
  try {
7931
- const dir = path.join(chunkLNTQRD23_cjs.memoryDir(cwd), "transcripts", "active-memory");
7952
+ const dir = path.join(chunkGH52NOCL_cjs.memoryDir(cwd), "transcripts", "active-memory");
7932
7953
  const file = path.join(dir, `${transcript.runId}.json`);
7933
- await chunk33B2BSME_cjs.atomicWriteJson(file, transcript);
7954
+ await chunkNETYW4V3_cjs.atomicWriteJson(file, transcript);
7934
7955
  } catch (cause) {
7935
7956
  const message = cause instanceof Error ? cause.message : String(cause);
7936
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] active-memory transcript persist failed: ${message}
7957
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] active-memory transcript persist failed: ${message}
7937
7958
  `);
7938
7959
  }
7939
7960
  }
@@ -8054,7 +8075,7 @@ async function searchOnce(args, cfg, query, started) {
8054
8075
  return { summary, durationMs: Date.now() - started, status: "ok", hits };
8055
8076
  } catch (cause) {
8056
8077
  const message = cause instanceof Error ? cause.message : String(cause);
8057
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] active-memory recall failed: ${message}
8078
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] active-memory recall failed: ${message}
8058
8079
  `);
8059
8080
  return { summary: void 0, durationMs: Date.now() - started, status: "error", hits: [] };
8060
8081
  }
@@ -8174,7 +8195,7 @@ var azureOpenAiMemoryEmbeddingProviderAdapter = {
8174
8195
  transport: "remote",
8175
8196
  authProviderId: "azure-openai",
8176
8197
  autoSelectPriority: 25,
8177
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8198
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8178
8199
  {
8179
8200
  id: "azure-openai",
8180
8201
  defaultBaseUrl: "https://your-resource.openai.azure.com",
@@ -8210,7 +8231,7 @@ var cohereMemoryEmbeddingProviderAdapter = {
8210
8231
  transport: "remote",
8211
8232
  authProviderId: "cohere",
8212
8233
  autoSelectPriority: 30,
8213
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8234
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8214
8235
  {
8215
8236
  id: "cohere",
8216
8237
  defaultBaseUrl: "https://api.cohere.com",
@@ -8256,7 +8277,7 @@ var deepinfraMemoryEmbeddingProviderAdapter = {
8256
8277
  transport: "remote",
8257
8278
  authProviderId: "deepinfra",
8258
8279
  autoSelectPriority: 13,
8259
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8280
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8260
8281
  {
8261
8282
  id: "deepinfra",
8262
8283
  defaultBaseUrl: "https://api.deepinfra.com",
@@ -8282,7 +8303,7 @@ var geminiMemoryEmbeddingProviderAdapter = {
8282
8303
  transport: "remote",
8283
8304
  authProviderId: "gemini",
8284
8305
  autoSelectPriority: 30,
8285
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8306
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8286
8307
  {
8287
8308
  id: "gemini",
8288
8309
  defaultBaseUrl: "https://generativelanguage.googleapis.com",
@@ -8310,7 +8331,7 @@ var jinaMemoryEmbeddingProviderAdapter = {
8310
8331
  transport: "remote",
8311
8332
  authProviderId: "jina",
8312
8333
  autoSelectPriority: 35,
8313
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8334
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8314
8335
  {
8315
8336
  id: "jina",
8316
8337
  defaultBaseUrl: "https://api.jina.ai",
@@ -8333,7 +8354,7 @@ var mistralMemoryEmbeddingProviderAdapter = {
8333
8354
  transport: "remote",
8334
8355
  authProviderId: "mistral",
8335
8356
  autoSelectPriority: 18,
8336
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8357
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8337
8358
  {
8338
8359
  id: "mistral",
8339
8360
  defaultBaseUrl: "https://api.mistral.ai",
@@ -8375,7 +8396,7 @@ var ollamaMemoryEmbeddingProviderAdapter = {
8375
8396
  autoSelectPriority: 10,
8376
8397
  create: (options) => {
8377
8398
  const apiKey = options.apiKey ?? process.env.OLLAMA_API_KEY ?? OLLAMA_LOCAL_SENTINEL_KEY;
8378
- return chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8399
+ return chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8379
8400
  {
8380
8401
  id: "ollama",
8381
8402
  defaultBaseUrl: "http://localhost:11434",
@@ -8402,7 +8423,7 @@ var openAiMemoryEmbeddingProviderAdapter = {
8402
8423
  transport: "remote",
8403
8424
  authProviderId: "openai",
8404
8425
  autoSelectPriority: 20,
8405
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8426
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8406
8427
  {
8407
8428
  id: "openai",
8408
8429
  defaultBaseUrl: "https://api.openai.com",
@@ -8429,7 +8450,7 @@ var openRouterMemoryEmbeddingProviderAdapter = {
8429
8450
  transport: "remote",
8430
8451
  authProviderId: "openrouter",
8431
8452
  autoSelectPriority: 15,
8432
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8453
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8433
8454
  {
8434
8455
  id: "openrouter",
8435
8456
  defaultBaseUrl: "https://openrouter.ai/api",
@@ -8457,7 +8478,7 @@ var voyageMemoryEmbeddingProviderAdapter = {
8457
8478
  transport: "remote",
8458
8479
  authProviderId: "voyage",
8459
8480
  autoSelectPriority: 14,
8460
- create: (options) => chunkX2LDDKFM_cjs.createOpenAiCompatibleRuntime(
8481
+ create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8461
8482
  {
8462
8483
  id: "voyage",
8463
8484
  defaultBaseUrl: "https://api.voyageai.com",
@@ -8558,7 +8579,7 @@ function createMemorySearchTool(opts) {
8558
8579
  };
8559
8580
  }
8560
8581
  function createMemoryGetTool(opts) {
8561
- const memoryRoot = path.resolve(chunkLNTQRD23_cjs.memoryDir(opts.cwd));
8582
+ const memoryRoot = path.resolve(chunkGH52NOCL_cjs.memoryDir(opts.cwd));
8562
8583
  return {
8563
8584
  name: "memory_get",
8564
8585
  description: GET_DESCRIPTION,
@@ -8569,7 +8590,7 @@ function createMemoryGetTool(opts) {
8569
8590
  const lines = readNumber(input.lines);
8570
8591
  const resolved = path.resolve(memoryRoot, relPath);
8571
8592
  if (!isPathInside(memoryRoot, resolved)) {
8572
- throw new chunkE7WWIX34_cjs.ConfigurationError(
8593
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
8573
8594
  `memory_get rejected path that escapes memory root: ${relPath}`,
8574
8595
  { code: "memory_path_escapes_root" }
8575
8596
  );
@@ -8589,7 +8610,7 @@ function readString(value, errorIfMissing, allowUndefined = false) {
8589
8610
  if (typeof value === "string") return value;
8590
8611
  if (allowUndefined && (value === void 0 || value === null)) return "";
8591
8612
  if (errorIfMissing !== void 0) {
8592
- throw new chunkE7WWIX34_cjs.ConfigurationError(errorIfMissing, { code: "memory_tool_bad_args" });
8613
+ throw new chunkYULF6FPB_cjs.ConfigurationError(errorIfMissing, { code: "memory_tool_bad_args" });
8593
8614
  }
8594
8615
  return "";
8595
8616
  }
@@ -8665,7 +8686,7 @@ var LocalAgentMemory = class {
8665
8686
  const openOpts = { cwd: this.workspaceCwd };
8666
8687
  if (embedding !== void 0) openOpts.embedding = embedding;
8667
8688
  if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
8668
- this.index = await chunkLNTQRD23_cjs.IndexManager.open(openOpts);
8689
+ this.index = await chunkGH52NOCL_cjs.IndexManager.open(openOpts);
8669
8690
  await this.index.sync();
8670
8691
  this.toolsCache = [
8671
8692
  createMemorySearchTool({ index: this.index }),
@@ -8680,7 +8701,7 @@ var LocalAgentMemory = class {
8680
8701
  const warned2 = g[sym];
8681
8702
  if (!warned2.has(message)) {
8682
8703
  warned2.add(message);
8683
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] memory tools unavailable: ${message}
8704
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] memory tools unavailable: ${message}
8684
8705
  `);
8685
8706
  }
8686
8707
  return void 0;
@@ -8689,7 +8710,7 @@ var LocalAgentMemory = class {
8689
8710
  async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
8690
8711
  const cfg = this.options.memory?.activeRecall;
8691
8712
  if (cfg?.enabled !== true || this.index === void 0) return void 0;
8692
- if (this.breaker === void 0) this.breaker = new chunkSEWAPWAF_cjs.CircuitBreaker();
8713
+ if (this.breaker === void 0) this.breaker = new chunkFMIKUGF2_cjs.CircuitBreaker();
8693
8714
  if (this.cache === void 0) this.cache = new ActiveMemoryCache();
8694
8715
  const result = await runActiveMemory({
8695
8716
  userText,
@@ -8739,7 +8760,7 @@ var LocalAgentMemory = class {
8739
8760
  await this.index.sync();
8740
8761
  } catch (cause) {
8741
8762
  const message = cause instanceof Error ? cause.message : String(cause);
8742
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] session index sync failed: ${message}
8763
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] session index sync failed: ${message}
8743
8764
  `);
8744
8765
  }
8745
8766
  }
@@ -8752,7 +8773,7 @@ var LocalAgentMemory = class {
8752
8773
  return await adapter.create(cfg.model !== void 0 ? { model: cfg.model } : {});
8753
8774
  } catch (cause) {
8754
8775
  const message = cause instanceof Error ? cause.message : String(cause);
8755
- chunkA76OFN2B_cjs.diag(`[theokit-sdk] memory embedding ${cfg.provider} unavailable: ${message}
8776
+ chunkZHPET3LZ_cjs.diag(`[theokit-sdk] memory embedding ${cfg.provider} unavailable: ${message}
8756
8777
  `);
8757
8778
  return void 0;
8758
8779
  }
@@ -8788,7 +8809,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
8788
8809
  ...partial?.metadata !== void 0 ? { metadata: partial.metadata } : defaultContext?.metadata !== void 0 ? { metadata: defaultContext.metadata } : {}
8789
8810
  };
8790
8811
  if (merged.userId === "") {
8791
- throw new chunkE7WWIX34_cjs.ConfigurationError(
8812
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
8792
8813
  "agent.memory requires a userId \u2014 either set AgentOptions.memoryContext.userId or pass ctx.userId at call time.",
8793
8814
  { code: "memory_context_missing_user_id" }
8794
8815
  );
@@ -8798,7 +8819,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
8798
8819
  async function requireAdapters() {
8799
8820
  const r = await ensure();
8800
8821
  if (r.adapters.length === 0) {
8801
- throw new chunkE7WWIX34_cjs.ConfigurationError(
8822
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
8802
8823
  "No memory adapter registered. Pass a memory plugin in AgentOptions.plugins (e.g. supermemoryMemory({...})).",
8803
8824
  { code: "no_memory_adapter" }
8804
8825
  );
@@ -8839,7 +8860,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
8839
8860
  const prefix = id.split(":", 1)[0] ?? "";
8840
8861
  const target = adapters.find((a) => a.id === prefix);
8841
8862
  if (target === void 0) {
8842
- throw new chunkE7WWIX34_cjs.ConfigurationError(
8863
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
8843
8864
  `No adapter found for MemoryId prefix "${prefix}" (registered: ${adapters.map((a) => a.id).join(", ")}).`,
8844
8865
  { code: "no_memory_adapter" }
8845
8866
  );
@@ -8912,7 +8933,7 @@ function createLocalAgentMemoryProvider(opts) {
8912
8933
  return { facts: [], systemPromptAdditions: summary };
8913
8934
  },
8914
8935
  async recordSessionSummary(args) {
8915
- await chunkLNTQRD23_cjs.writeSessionSummary(args);
8936
+ await chunkGH52NOCL_cjs.writeSessionSummary(args);
8916
8937
  },
8917
8938
  async sync(handle) {
8918
8939
  const state = handle[INTERNAL_LAM_KEY];
@@ -8990,19 +9011,19 @@ var PersonalityRegistry = class _PersonalityRegistry {
8990
9011
  function addEntity(byName, entity, origin, collisionMap) {
8991
9012
  const fm = entity.frontmatter;
8992
9013
  if (PersonalityRegistry.isReservedClearSlug(fm.name)) {
8993
- throw new chunkE7WWIX34_cjs.ConfigurationError(
9014
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
8994
9015
  `Personality name "${fm.name}" is reserved (used to clear active preset)`,
8995
9016
  { code: "personality_reserved_name" }
8996
9017
  );
8997
9018
  }
8998
9019
  if (entity.body.trim().length === 0) {
8999
- throw new chunkE7WWIX34_cjs.ConfigurationError(
9020
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
9000
9021
  `Personality "${fm.name}" has empty body (system prompt required)`,
9001
9022
  { code: "personality_empty_body" }
9002
9023
  );
9003
9024
  }
9004
9025
  if (origin === "project" && collisionMap?.has(fm.name)) {
9005
- chunkK6TWHNT4_cjs.warnOnce(
9026
+ chunkHECR7KF5_cjs.warnOnce(
9006
9027
  `personality-collision-${fm.name}`,
9007
9028
  `[theokit-sdk] personality "${fm.name}" overridden by project preset`
9008
9029
  );
@@ -9031,7 +9052,7 @@ async function performPersonalitySwitch(args) {
9031
9052
  const preset = args.registry.get(args.requestedName);
9032
9053
  if (preset === void 0) {
9033
9054
  const available = args.registry.all().map((p) => p.name).join(", ") || "(none)";
9034
- throw new chunkE7WWIX34_cjs.ConfigurationError(
9055
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
9035
9056
  `Personality "${args.requestedName}" not found. Available: ${available}`,
9036
9057
  { code: "personality_not_found" }
9037
9058
  );
@@ -9052,14 +9073,14 @@ async function performPersonalitySwitch(args) {
9052
9073
 
9053
9074
  // src/internal/local-agent/local-agent-personality-extensions.ts
9054
9075
  function resolveActivePersonalityPreset(args) {
9055
- const forkCtx = chunkK6TWHNT4_cjs.currentPersonalityContext();
9076
+ const forkCtx = chunkHECR7KF5_cjs.currentPersonalityContext();
9056
9077
  const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
9057
9078
  if (slug === void 0) return void 0;
9058
9079
  return args.personalityRegistry?.get(slug);
9059
9080
  }
9060
9081
  async function ensurePersonalityRegistryIfNeeded(args) {
9061
9082
  if (args.personalityRegistry !== void 0) return args.personalityRegistry;
9062
- const forkSlug = chunkK6TWHNT4_cjs.currentPersonalityContext()?.slug;
9083
+ const forkSlug = chunkHECR7KF5_cjs.currentPersonalityContext()?.slug;
9063
9084
  const ownSlug = args.personalityStore.active(args.agentId);
9064
9085
  if (forkSlug === void 0 && ownSlug === void 0) return void 0;
9065
9086
  return await PersonalityRegistry.load(args.workspaceCwd);
@@ -9073,8 +9094,8 @@ ${preset.systemPrompt}`;
9073
9094
  }
9074
9095
  async function localAgentUsePersonality(args) {
9075
9096
  if (args.disposed) throw new Error("Agent has been disposed");
9076
- if (chunkK6TWHNT4_cjs.currentPersonalityContext() !== void 0) {
9077
- chunkK6TWHNT4_cjs.warnPersonalitySwitchInsideFork(args.agentId);
9097
+ if (chunkHECR7KF5_cjs.currentPersonalityContext() !== void 0) {
9098
+ chunkHECR7KF5_cjs.warnPersonalitySwitchInsideFork(args.agentId);
9078
9099
  return null;
9079
9100
  }
9080
9101
  let registry = args.personalityRegistry;
@@ -9091,8 +9112,8 @@ async function localAgentUsePersonality(args) {
9091
9112
  registry,
9092
9113
  store: args.personalityStore,
9093
9114
  invalidateCache: (reason) => args.invalidateCache(reason),
9094
- appendSessionMessage: (msg) => chunkN4JNY5DT_cjs.appendSessionMessage(args.agentId, msg),
9095
- clearSession: () => chunkN4JNY5DT_cjs.clearSession(args.agentId),
9115
+ appendSessionMessage: (msg) => chunkZO2L5U6F_cjs.appendSessionMessage(args.agentId, msg),
9116
+ clearSession: () => chunkZO2L5U6F_cjs.clearSession(args.agentId),
9096
9117
  opts: args.opts ?? {}
9097
9118
  })
9098
9119
  );
@@ -9101,9 +9122,9 @@ async function localAgentUsePersonality(args) {
9101
9122
  // src/internal/local-agent/local-agent-runtime-extensions.ts
9102
9123
  function localAgentRunUntil(agent, goal, options) {
9103
9124
  async function* wrap() {
9104
- const { runUntilImpl } = await import('./run-until-L5KQD3PV.cjs');
9125
+ const { runUntilImpl } = await import('./run-until-U2B5FJJI.cjs');
9105
9126
  const buildDeps = async () => {
9106
- const { judgeCallImpl } = await import('./judge-call-AIT3EULV.cjs');
9127
+ const { judgeCallImpl } = await import('./judge-call-J5EETJL3.cjs');
9107
9128
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
9108
9129
  const create = getAgentFacade().create;
9109
9130
  return {
@@ -9136,7 +9157,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
9136
9157
  async function localAgentFork(parent, options) {
9137
9158
  const { forkAgentImpl } = await import('./fork-agent-Y2IK2RYU.cjs');
9138
9159
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
9139
- const { withPersonalityContext } = await import('./context-DNFT4B5D.cjs');
9160
+ const { withPersonalityContext } = await import('./context-2G4375BZ.cjs');
9140
9161
  const create = getAgentFacade().create;
9141
9162
  return withPersonalityContext(
9142
9163
  { slug: parent.personalitySlugSnapshot, isFork: true },
@@ -9196,7 +9217,7 @@ function wrapRunWithCompletionCheck(args) {
9196
9217
  judgeOpts
9197
9218
  );
9198
9219
  const complete = !verdict.parseFailed && verdict.verdict === "done";
9199
- chunkQMIG7TKG_cjs.emitRunEvent(args.onRunEvent, {
9220
+ chunkKCQUYQ3V_cjs.emitRunEvent(args.onRunEvent, {
9200
9221
  type: "completion_check",
9201
9222
  complete,
9202
9223
  reason: verdict.reason
@@ -9343,7 +9364,7 @@ function wrapRunWithOutputProcessors(args) {
9343
9364
  if (result.status !== "finished" || result.result === void 0) return result;
9344
9365
  const res = await runOutputProcessors(args.processors, result.result, args.agentId);
9345
9366
  if (res.kind === "ok") return { ...result, result: res.value };
9346
- chunkQMIG7TKG_cjs.emitRunEvent(args.onRunEvent, {
9367
+ chunkKCQUYQ3V_cjs.emitRunEvent(args.onRunEvent, {
9347
9368
  type: "tripwire",
9348
9369
  reason: res.tripwire.reason,
9349
9370
  processorId: res.tripwire.processorId
@@ -9418,7 +9439,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
9418
9439
  }
9419
9440
  const res = await runInputProcessors(processors, rawUserText, inputs.agentId);
9420
9441
  if (res.kind === "tripwire") {
9421
- chunkQMIG7TKG_cjs.emitRunEvent(options.onRunEvent, {
9442
+ chunkKCQUYQ3V_cjs.emitRunEvent(options.onRunEvent, {
9422
9443
  type: "tripwire",
9423
9444
  reason: res.tripwire.reason,
9424
9445
  processorId: res.tripwire.processorId
@@ -9435,7 +9456,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
9435
9456
  return { userText: res.value, effectiveMessage };
9436
9457
  }
9437
9458
  async function executeSendLocked(inputs, message, options) {
9438
- if (inputs.disposed) throw new chunkE7WWIX34_cjs.AgentDisposedError(inputs.agentId);
9459
+ if (inputs.disposed) throw new chunkYULF6FPB_cjs.AgentDisposedError(inputs.agentId);
9439
9460
  await consumePending(inputs.agentId, inputs.invalidationPending, inputs.clearInvalidation, inputs.reload);
9440
9461
  const sendModel = normalizeModel(options.model);
9441
9462
  inputs.applyModelOverride(sendModel);
@@ -9446,7 +9467,7 @@ async function executeSendLocked(inputs, message, options) {
9446
9467
  if (inputs.options.onBeforeSend !== void 0) {
9447
9468
  await inputs.options.onBeforeSend({
9448
9469
  conversationId: inputs.agentId,
9449
- previousMessageCount: chunkN4JNY5DT_cjs.getSessionMessages(inputs.agentId).length
9470
+ previousMessageCount: chunkZO2L5U6F_cjs.getSessionMessages(inputs.agentId).length
9450
9471
  });
9451
9472
  }
9452
9473
  await inputs.runPreHook(userText);
@@ -9458,8 +9479,8 @@ async function executeSendLocked(inputs, message, options) {
9458
9479
  userText,
9459
9480
  sendOptions: options
9460
9481
  });
9461
- const priorMessages = [...chunkN4JNY5DT_cjs.getSessionMessages(inputs.agentId)];
9462
- chunkN4JNY5DT_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
9482
+ const priorMessages = [...chunkZO2L5U6F_cjs.getSessionMessages(inputs.agentId)];
9483
+ chunkZO2L5U6F_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
9463
9484
  await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
9464
9485
  const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory);
9465
9486
  const portPathActive = shouldUsePortMemoryPath();
@@ -9517,7 +9538,7 @@ async function executeSendLocked(inputs, message, options) {
9517
9538
  function buildCompletionCheckDeps() {
9518
9539
  return {
9519
9540
  judge: async (ctx, opts) => {
9520
- const { judgeCallImpl } = await import('./judge-call-AIT3EULV.cjs');
9541
+ const { judgeCallImpl } = await import('./judge-call-J5EETJL3.cjs');
9521
9542
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
9522
9543
  return judgeCallImpl(ctx, opts, { create: getAgentFacade().create });
9523
9544
  }
@@ -9537,7 +9558,7 @@ function registerRunAsTask(run, agentId, taskOpt, userText) {
9537
9558
  promptPreview: userText.slice(0, 120),
9538
9559
  ...opts.meta ?? {}
9539
9560
  };
9540
- void chunkQMIG7TKG_cjs.submit({
9561
+ void chunkKCQUYQ3V_cjs.submit({
9541
9562
  kind: "run",
9542
9563
  work: async (ctx) => {
9543
9564
  ctx.signal.addEventListener(
@@ -9621,7 +9642,7 @@ var LocalAgent = class {
9621
9642
  this.options = options;
9622
9643
  this.workspaceCwd = resolveCwd(options.local?.cwd);
9623
9644
  this.transcriptBaseDir = resolveBaseDir(options.local?.baseDir);
9624
- this.sessionStore = options.local?.sessionStore ?? new chunkWMWZAJMJ_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
9645
+ this.sessionStore = options.local?.sessionStore ?? new chunkNRA36JKG_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
9625
9646
  this.settingSourcesIncludeProject = includesSetting(options, "project");
9626
9647
  this.settingSourcesIncludePlugins = includesSetting(options, "plugins");
9627
9648
  const sub = bootstrapSubmanagers({
@@ -9664,14 +9685,14 @@ var LocalAgent = class {
9664
9685
  if (this.pluginsManager !== void 0) await this.pluginsManager.initialize();
9665
9686
  const codePlugins = chunkBV2MWEMV_cjs.extractCodePlugins(this.options.plugins);
9666
9687
  await this.pluginManagerCode.initialize(codePlugins);
9667
- this.resolvedSubagents = await chunkLOTWA65Z_cjs.loadSubagents(
9688
+ this.resolvedSubagents = await chunkX2YQP452_cjs.loadSubagents(
9668
9689
  this.workspaceCwd,
9669
9690
  this.settingSourcesIncludeProject,
9670
9691
  this.options.agents
9671
9692
  );
9672
9693
  await acquireLeaseIfPossible(this.sessionStore, this.agentId);
9673
9694
  try {
9674
- await chunkN4JNY5DT_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
9695
+ await chunkZO2L5U6F_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
9675
9696
  await this.personalityStore.hydrate(this.agentId);
9676
9697
  } catch (err) {
9677
9698
  await releaseLeaseIfPossible(this.sessionStore, this.agentId);
@@ -9820,7 +9841,7 @@ var LocalAgent = class {
9820
9841
  agentId: this.agentId
9821
9842
  });
9822
9843
  if (preRun.blocked) {
9823
- throw new chunkE7WWIX34_cjs.ConfigurationError(
9844
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
9824
9845
  `preRun hook denied execution: ${preRun.reason ?? "unspecified"}`,
9825
9846
  { code: "hook_denied" }
9826
9847
  );
@@ -9901,7 +9922,7 @@ var LocalAgent = class {
9901
9922
  }
9902
9923
  // biome-ignore format: G8 budget — see listArtifacts.
9903
9924
  downloadArtifact(_path) {
9904
- return Promise.reject(new chunkE7WWIX34_cjs.UnsupportedRunOperationError("Artifacts are not supported for local agents", "downloadArtifact"));
9925
+ return Promise.reject(new chunkYULF6FPB_cjs.UnsupportedRunOperationError("Artifacts are not supported for local agents", "downloadArtifact"));
9905
9926
  }
9906
9927
  // biome-ignore format: G8 budget — delegates to `local-agent-runtime-extensions.ts`; kept 1-line.
9907
9928
  runUntil(goal, options) {
@@ -9924,7 +9945,7 @@ function resolveCwd(cwd) {
9924
9945
  return (Array.isArray(cwd) ? cwd[0] : cwd) ?? process.cwd();
9925
9946
  }
9926
9947
  function resolveBaseDir(baseDir) {
9927
- return baseDir === void 0 ? chunkNJVV5OAV_cjs.defaultBaseDir() : chunkNJVV5OAV_cjs.expandTilde(baseDir);
9948
+ return baseDir === void 0 ? chunkWCXOKGOQ_cjs.defaultBaseDir() : chunkWCXOKGOQ_cjs.expandTilde(baseDir);
9928
9949
  }
9929
9950
  function includesSetting(options, source) {
9930
9951
  const sources = options.local?.settingSources;
@@ -9949,7 +9970,7 @@ async function guardAgainstIdCollision(options) {
9949
9970
  const persistenceCwd = resolveAgentPersistenceCwd(options);
9950
9971
  await hydrateRegistryFromDisk(persistenceCwd);
9951
9972
  if (getRegisteredAgent(options.agentId) !== void 0) {
9952
- throw new chunkE7WWIX34_cjs.ConfigurationError(
9973
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
9953
9974
  `Agent "${options.agentId}" already exists. Use Agent.resume("${options.agentId}") to reattach, or pick a different agentId.`,
9954
9975
  { code: "agent_id_already_exists" }
9955
9976
  );
@@ -9982,7 +10003,7 @@ async function maybeInjectHandoffTools(options) {
9982
10003
  const spec = "@theokit/sdk-handoff/internal/tool-injector";
9983
10004
  mod = await import(spec);
9984
10005
  } catch (err) {
9985
- throw new chunkE7WWIX34_cjs.ConfigurationError(
10006
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
9986
10007
  "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).",
9987
10008
  { code: "handoff_package_missing", cause: err }
9988
10009
  );
@@ -10002,9 +10023,9 @@ async function maybeInjectHandoffTools(options) {
10002
10023
  async function createLocalAgent(options) {
10003
10024
  const apiKey = resolveApiKey(options.apiKey);
10004
10025
  if (apiKey === void 0) {
10005
- throw new chunkE7WWIX34_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
10026
+ throw new chunkYULF6FPB_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
10006
10027
  }
10007
- const willFlowToProvider = !chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) && !chunkSEWAPWAF_cjs.shouldUseRealLocalRuntime(apiKey);
10028
+ const willFlowToProvider = !chunkFMIKUGF2_cjs.isFixtureApiKey(apiKey) && !chunkFMIKUGF2_cjs.shouldUseRealLocalRuntime(apiKey);
10008
10029
  const shape = validateApiKeyShape(apiKey, {
10009
10030
  strict: willFlowToProvider,
10010
10031
  // `options.model` is already normalized by `runCreateUnderSpan`; `normalizeModel`
@@ -10013,10 +10034,10 @@ async function createLocalAgent(options) {
10013
10034
  ...willFlowToProvider ? { provider: providerFromModelId(normalizeModel(options.model)?.id) } : {}
10014
10035
  });
10015
10036
  if (shape.malformed) {
10016
- throw new chunkE7WWIX34_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
10037
+ throw new chunkYULF6FPB_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
10017
10038
  }
10018
- if (!chunkSEWAPWAF_cjs.isFixtureApiKey(apiKey) && chunkSEWAPWAF_cjs.getConfiguredBaseUrl() === void 0 && !chunkSEWAPWAF_cjs.shouldUseRealLocalRuntime(apiKey)) {
10019
- throw new chunkE7WWIX34_cjs.AuthenticationError("Invalid API key", {
10039
+ if (!chunkFMIKUGF2_cjs.isFixtureApiKey(apiKey) && chunkFMIKUGF2_cjs.getConfiguredBaseUrl() === void 0 && !chunkFMIKUGF2_cjs.shouldUseRealLocalRuntime(apiKey)) {
10040
+ throw new chunkYULF6FPB_cjs.AuthenticationError("Invalid API key", {
10020
10041
  code: "authentication_error"
10021
10042
  });
10022
10043
  }
@@ -10027,19 +10048,19 @@ async function createLocalAgent(options) {
10027
10048
  async function createCloudAgent(options) {
10028
10049
  const apiKey = resolveApiKey(options.apiKey);
10029
10050
  if (apiKey === void 0) {
10030
- throw new chunkE7WWIX34_cjs.ConfigurationError("Missing API key for cloud agent", {
10051
+ throw new chunkYULF6FPB_cjs.ConfigurationError("Missing API key for cloud agent", {
10031
10052
  code: "missing_api_key"
10032
10053
  });
10033
10054
  }
10034
10055
  const shape = validateApiKeyShape(apiKey);
10035
10056
  if (shape.malformed) {
10036
- throw new chunkE7WWIX34_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
10057
+ throw new chunkYULF6FPB_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
10037
10058
  }
10038
- const baseUrl = chunkSEWAPWAF_cjs.getConfiguredBaseUrl();
10059
+ const baseUrl = chunkFMIKUGF2_cjs.getConfiguredBaseUrl();
10039
10060
  if (baseUrl === void 0) {
10040
10061
  return new CloudAgent(options);
10041
10062
  }
10042
- const response = await chunkSEWAPWAF_cjs.httpRequest("/v1/agents", {
10063
+ const response = await chunkFMIKUGF2_cjs.httpRequest("/v1/agents", {
10043
10064
  apiKey,
10044
10065
  method: "POST",
10045
10066
  body: {
@@ -10064,7 +10085,7 @@ function resolveAgentPersistenceCwd(options) {
10064
10085
  return process.cwd();
10065
10086
  }
10066
10087
  async function rehydrateExistingAgent(agentId, existing, options) {
10067
- await chunkSEWAPWAF_cjs.discoverProviderPlugins();
10088
+ await chunkFMIKUGF2_cjs.discoverProviderPlugins();
10068
10089
  await validateRehydratedAgent(agentId, existing);
10069
10090
  const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
10070
10091
  const mergedOptions = {
@@ -10095,7 +10116,7 @@ async function validateRehydratedAgent(agentId, entry) {
10095
10116
  throw new Error(`Workspace path is not a directory: ${candidate}`);
10096
10117
  }
10097
10118
  } catch (cause) {
10098
- throw new chunkE7WWIX34_cjs.UnknownAgentError(
10119
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(
10099
10120
  `Agent "${agentId}" cannot be rehydrated \u2014 workspace cwd "${candidate}" is missing or inaccessible.`,
10100
10121
  { code: "agent_rehydration_failed", cause }
10101
10122
  );
@@ -10147,7 +10168,7 @@ async function getRegisteredAgentOrThrow(agentId) {
10147
10168
  agent = getRegisteredAgent(agentId);
10148
10169
  }
10149
10170
  if (agent === void 0) {
10150
- throw new chunkE7WWIX34_cjs.UnknownAgentError(`Agent ${agentId} not found`, { code: "unknown_agent" });
10171
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(`Agent ${agentId} not found`, { code: "unknown_agent" });
10151
10172
  }
10152
10173
  return agent;
10153
10174
  }
@@ -10192,7 +10213,7 @@ var Agent = class _Agent {
10192
10213
  pluginCount: enabledPluginNames(options.plugins).length
10193
10214
  });
10194
10215
  try {
10195
- await chunkSEWAPWAF_cjs.discoverProviderPlugins();
10216
+ await chunkFMIKUGF2_cjs.discoverProviderPlugins();
10196
10217
  const agent = await runCreateUnderSpan(options, span);
10197
10218
  return agent;
10198
10219
  } catch (err) {
@@ -10218,8 +10239,8 @@ var Agent = class _Agent {
10218
10239
  const run = await agent.send(message);
10219
10240
  const result = await run.wait();
10220
10241
  if (options.throwOnError === true && result.status === "error" && result.error !== void 0) {
10221
- throw new chunkE7WWIX34_cjs.AgentRunError(result.error.message, {
10222
- code: chunkE7WWIX34_cjs.coerceToKnownAgentRunErrorCode(result.error.code),
10242
+ throw new chunkYULF6FPB_cjs.AgentRunError(result.error.message, {
10243
+ code: chunkYULF6FPB_cjs.coerceToKnownAgentRunErrorCode(result.error.code),
10223
10244
  cause: result.error.cause
10224
10245
  });
10225
10246
  }
@@ -10246,7 +10267,7 @@ var Agent = class _Agent {
10246
10267
  if (existing !== void 0) {
10247
10268
  return await rehydrateExistingAgent(agentId, existing, options);
10248
10269
  }
10249
- throw new chunkE7WWIX34_cjs.UnknownAgentError(
10270
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(
10250
10271
  `Agent "${agentId}" not found. Use Agent.create({ agentId, ... }) for first-time setup, or catch UnknownAgentError to branch resume-vs-create.`,
10251
10272
  { code: "unknown_agent" }
10252
10273
  );
@@ -10275,7 +10296,7 @@ var Agent = class _Agent {
10275
10296
  * @public
10276
10297
  */
10277
10298
  static async generateObject(options) {
10278
- const { generateObjectImpl } = await import('./generate-object-QILSGTEJ.cjs');
10299
+ const { generateObjectImpl } = await import('./generate-object-6PWGH5DZ.cjs');
10279
10300
  return generateObjectImpl(options, {
10280
10301
  create: (opts) => _Agent.create(opts),
10281
10302
  delete: (agentId) => _Agent.delete(agentId)
@@ -10299,7 +10320,7 @@ var Agent = class _Agent {
10299
10320
  delete: (agentId) => _Agent.delete(agentId)
10300
10321
  };
10301
10322
  async function* wrapper() {
10302
- streamObjectImport ??= import('./stream-object-3HEUGMQY.cjs');
10323
+ streamObjectImport ??= import('./stream-object-3R3HZPQN.cjs');
10303
10324
  const { streamObjectImpl } = await streamObjectImport;
10304
10325
  yield* streamObjectImpl(options, deps);
10305
10326
  }
@@ -10323,7 +10344,7 @@ var Agent = class _Agent {
10323
10344
  * @public
10324
10345
  */
10325
10346
  static async batch(prompts, options) {
10326
- const { batchImpl } = await import('./batch-FO2KZN7W.cjs');
10347
+ const { batchImpl } = await import('./batch-URTEXK77.cjs');
10327
10348
  return batchImpl(prompts, options, { create: (opts) => _Agent.create(opts) });
10328
10349
  }
10329
10350
  /**
@@ -10403,14 +10424,14 @@ var Agent = class _Agent {
10403
10424
  */
10404
10425
  static async getRun(runId, options = {}) {
10405
10426
  if (options.runtime === "cloud") {
10406
- throw new chunkE7WWIX34_cjs.ConfigurationError(
10427
+ throw new chunkYULF6FPB_cjs.ConfigurationError(
10407
10428
  "Cloud runtime is pre-release. Theo PaaS endpoints are not wired yet \u2014 getRun({ runtime: 'cloud' }) will be enabled when the PaaS ships.",
10408
10429
  { code: "cloud_runtime_pre_release" }
10409
10430
  );
10410
10431
  }
10411
10432
  const existing = getRun(runId);
10412
10433
  if (existing !== void 0) return existing;
10413
- throw new chunkE7WWIX34_cjs.UnknownAgentError(
10434
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(
10414
10435
  `Run ${runId} is not in this process's registry. It may have been disposed, persisted in a previous process, or never created.`,
10415
10436
  { code: "run_not_found" }
10416
10437
  );
@@ -10457,13 +10478,13 @@ var Agent = class _Agent {
10457
10478
  reg = getRegisteredAgent(agentId);
10458
10479
  }
10459
10480
  if (reg === void 0 || reg.runtime !== "local") {
10460
- throw new chunkE7WWIX34_cjs.UnknownAgentError(
10481
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(
10461
10482
  `No local agent "${agentId}" registered \u2014 compact targets local sessions.`
10462
10483
  );
10463
10484
  }
10464
- const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-TRCEYCPG.cjs');
10485
+ const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-OU6SRPVJ.cjs');
10465
10486
  const { cwd, model, store } = await openLocalStore(reg);
10466
- return chunkN4JNY5DT_cjs.enqueueSessionWrite(
10487
+ return chunkZO2L5U6F_cjs.enqueueSessionWrite(
10467
10488
  cwd,
10468
10489
  agentId,
10469
10490
  () => compactSessionTranscript({
@@ -10493,11 +10514,11 @@ var Agent = class _Agent {
10493
10514
  reg = getRegisteredAgent(agentId);
10494
10515
  }
10495
10516
  if (reg === void 0 || reg.runtime !== "local") {
10496
- throw new chunkE7WWIX34_cjs.UnknownAgentError(
10517
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(
10497
10518
  `No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
10498
10519
  );
10499
10520
  }
10500
- const { injectSessionTurn } = await import('./inject-session-BVSERZCI.cjs');
10521
+ const { injectSessionTurn } = await import('./inject-session-DDC36KKP.cjs');
10501
10522
  const { cwd, model, store } = await openLocalStore(reg);
10502
10523
  await injectSessionTurn({
10503
10524
  store,
@@ -10532,11 +10553,11 @@ var Agent = class _Agent {
10532
10553
  reg = getRegisteredAgent(agentId);
10533
10554
  }
10534
10555
  if (reg === void 0 || reg.runtime !== "local") {
10535
- throw new chunkE7WWIX34_cjs.UnknownAgentError(
10556
+ throw new chunkYULF6FPB_cjs.UnknownAgentError(
10536
10557
  `No local agent "${agentId}" registered \u2014 transcript targets local sessions.`
10537
10558
  );
10538
10559
  }
10539
- const { readSessionMessages } = await import('./agent-session-store-RHTLZ5OX.cjs');
10560
+ const { readSessionMessages } = await import('./agent-session-store-EPUERCUU.cjs');
10540
10561
  const { store } = await openLocalStore(reg);
10541
10562
  return readSessionMessages(store, agentId);
10542
10563
  }
@@ -10557,7 +10578,7 @@ var Agent = class _Agent {
10557
10578
  */
10558
10579
  static async describe(agentId) {
10559
10580
  const agent = await getRegisteredAgentOrThrow(agentId);
10560
- const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-F52ARQ62.cjs');
10581
+ const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-FDXPBBRA.cjs');
10561
10582
  const settingSources = agent.options.local?.settingSources;
10562
10583
  const subagents = await loadSubagents2(
10563
10584
  agent.cwd ?? process.cwd(),
@@ -10601,12 +10622,12 @@ async function getOrCreateUncached(agentId, options) {
10601
10622
  try {
10602
10623
  return await Agent.resume(agentId, options);
10603
10624
  } catch (err) {
10604
- if (!(err instanceof chunkE7WWIX34_cjs.UnknownAgentError)) throw err;
10625
+ if (!(err instanceof chunkYULF6FPB_cjs.UnknownAgentError)) throw err;
10605
10626
  }
10606
10627
  try {
10607
10628
  return await Agent.create({ ...options, agentId });
10608
10629
  } catch (err) {
10609
- if (err instanceof chunkE7WWIX34_cjs.ConfigurationError && err.code === "agent_id_already_exists") {
10630
+ if (err instanceof chunkYULF6FPB_cjs.ConfigurationError && err.code === "agent_id_already_exists") {
10610
10631
  return await Agent.resume(agentId, options);
10611
10632
  }
10612
10633
  throw err;
@@ -10624,8 +10645,8 @@ async function openLocalStore(reg) {
10624
10645
  const cwd = reg.cwd ?? process.cwd();
10625
10646
  const optModel = reg.options.model;
10626
10647
  const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
10627
- const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-KRZZIG3O.cjs');
10628
- const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-SLQRKQ72.cjs');
10648
+ const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-MAZV5FXJ.cjs');
10649
+ const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-FYRKWRWV.cjs');
10629
10650
  const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
10630
10651
  return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
10631
10652
  }
@@ -10642,5 +10663,5 @@ exports.generateCronId = generateCronId;
10642
10663
  exports.getPricingEntry = getPricingEntry;
10643
10664
  exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
10644
10665
  exports.resolveApiKey = resolveApiKey;
10645
- //# sourceMappingURL=chunk-BVGJXMSB.cjs.map
10646
- //# sourceMappingURL=chunk-BVGJXMSB.cjs.map
10666
+ //# sourceMappingURL=chunk-RPL3POFZ.cjs.map
10667
+ //# sourceMappingURL=chunk-RPL3POFZ.cjs.map