@theokit/sdk 4.50.0 → 4.51.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 (308) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/agent-2KSLHB6B.cjs +57 -0
  3. package/dist/{agent-JA4ILE5O.cjs.map → agent-2KSLHB6B.cjs.map} +1 -1
  4. package/dist/agent-QWNWBCQZ.js +48 -0
  5. package/dist/{agent-GKX5FE5K.js.map → agent-QWNWBCQZ.js.map} +1 -1
  6. package/dist/agent-session-store-EPX2WQI4.cjs +23 -0
  7. package/dist/{agent-session-store-EPUERCUU.cjs.map → agent-session-store-EPX2WQI4.cjs.map} +1 -1
  8. package/dist/agent-session-store-JMU7ASDB.js +6 -0
  9. package/dist/{agent-session-store-TXP5ZVOD.js.map → agent-session-store-JMU7ASDB.js.map} +1 -1
  10. package/dist/auth/index.cjs +16 -16
  11. package/dist/auth/index.js +4 -4
  12. package/dist/{batch-OUF4N2TM.js → batch-NLIS4QTW.js} +9 -9
  13. package/dist/{batch-OUF4N2TM.js.map → batch-NLIS4QTW.js.map} +1 -1
  14. package/dist/{batch-URTEXK77.cjs → batch-WQ3AJCDV.cjs} +26 -26
  15. package/dist/{batch-URTEXK77.cjs.map → batch-WQ3AJCDV.cjs.map} +1 -1
  16. package/dist/{chunk-NETYW4V3.cjs → chunk-2CFEET3Y.cjs} +4 -4
  17. package/dist/{chunk-NETYW4V3.cjs.map → chunk-2CFEET3Y.cjs.map} +1 -1
  18. package/dist/{chunk-74VVGK7P.cjs → chunk-2S7IB4O3.cjs} +24 -24
  19. package/dist/{chunk-74VVGK7P.cjs.map → chunk-2S7IB4O3.cjs.map} +1 -1
  20. package/dist/{chunk-YULF6FPB.cjs → chunk-2YGIBOUH.cjs} +8 -8
  21. package/dist/{chunk-YULF6FPB.cjs.map → chunk-2YGIBOUH.cjs.map} +1 -1
  22. package/dist/{chunk-3NLOQEJR.js → chunk-34XOCZJO.js} +5 -16
  23. package/dist/chunk-34XOCZJO.js.map +1 -0
  24. package/dist/{chunk-FAUKVJCC.cjs → chunk-3BKWFISQ.cjs} +8 -8
  25. package/dist/{chunk-FAUKVJCC.cjs.map → chunk-3BKWFISQ.cjs.map} +1 -1
  26. package/dist/{chunk-FZ4YMZA3.cjs → chunk-3R4ZCQAZ.cjs} +5 -5
  27. package/dist/{chunk-FZ4YMZA3.cjs.map → chunk-3R4ZCQAZ.cjs.map} +1 -1
  28. package/dist/{chunk-HECR7KF5.cjs → chunk-3YYDHUNH.cjs} +11 -11
  29. package/dist/{chunk-HECR7KF5.cjs.map → chunk-3YYDHUNH.cjs.map} +1 -1
  30. package/dist/{chunk-BRHRQOJA.cjs → chunk-44IISBRZ.cjs} +4 -4
  31. package/dist/{chunk-BRHRQOJA.cjs.map → chunk-44IISBRZ.cjs.map} +1 -1
  32. package/dist/{chunk-PBML2FHN.js → chunk-4X3SBHPK.js} +2 -2
  33. package/dist/chunk-4X3SBHPK.js.map +1 -0
  34. package/dist/{chunk-OLLOUAUJ.js → chunk-5XXUYU3M.js} +3 -3
  35. package/dist/{chunk-OLLOUAUJ.js.map → chunk-5XXUYU3M.js.map} +1 -1
  36. package/dist/{chunk-XARLSCKA.js → chunk-6CSIUJ5W.js} +38 -38
  37. package/dist/chunk-6CSIUJ5W.js.map +1 -0
  38. package/dist/{chunk-KCQUYQ3V.cjs → chunk-6DCTL32L.cjs} +17 -17
  39. package/dist/{chunk-KCQUYQ3V.cjs.map → chunk-6DCTL32L.cjs.map} +1 -1
  40. package/dist/{chunk-EON4YTR6.js → chunk-6PTCKXD3.js} +8 -8
  41. package/dist/{chunk-EON4YTR6.js.map → chunk-6PTCKXD3.js.map} +1 -1
  42. package/dist/{chunk-XR4LPBXH.cjs → chunk-7HQVDLFI.cjs} +9 -9
  43. package/dist/{chunk-XR4LPBXH.cjs.map → chunk-7HQVDLFI.cjs.map} +1 -1
  44. package/dist/{chunk-GNMPCZNN.js → chunk-7TB5U7RK.js} +6 -6
  45. package/dist/{chunk-GNMPCZNN.js.map → chunk-7TB5U7RK.js.map} +1 -1
  46. package/dist/{chunk-7PESI6YD.cjs → chunk-ADVZIC43.cjs} +10 -10
  47. package/dist/{chunk-7PESI6YD.cjs.map → chunk-ADVZIC43.cjs.map} +1 -1
  48. package/dist/{chunk-NNNUQELM.cjs → chunk-AMYY3JHQ.cjs} +9 -9
  49. package/dist/{chunk-NNNUQELM.cjs.map → chunk-AMYY3JHQ.cjs.map} +1 -1
  50. package/dist/{chunk-L4JFQCG4.js → chunk-BKRTYDVN.js} +3 -3
  51. package/dist/{chunk-L4JFQCG4.js.map → chunk-BKRTYDVN.js.map} +1 -1
  52. package/dist/{chunk-MZQHVN7C.js → chunk-BVT6LFQ3.js} +5 -5
  53. package/dist/{chunk-MZQHVN7C.js.map → chunk-BVT6LFQ3.js.map} +1 -1
  54. package/dist/{chunk-UJMEWGO6.cjs → chunk-BWGXYOBZ.cjs} +4 -4
  55. package/dist/{chunk-UJMEWGO6.cjs.map → chunk-BWGXYOBZ.cjs.map} +1 -1
  56. package/dist/{chunk-2S6B5B2A.js → chunk-BXVSBYGW.js} +5 -5
  57. package/dist/{chunk-2S6B5B2A.js.map → chunk-BXVSBYGW.js.map} +1 -1
  58. package/dist/{chunk-AF4BBKIF.js → chunk-C4EU627W.js} +4 -4
  59. package/dist/{chunk-AF4BBKIF.js.map → chunk-C4EU627W.js.map} +1 -1
  60. package/dist/{chunk-VQFSEKU5.js → chunk-CHVSMEKM.js} +3 -3
  61. package/dist/{chunk-VQFSEKU5.js.map → chunk-CHVSMEKM.js.map} +1 -1
  62. package/dist/{chunk-6X2HUT4A.cjs → chunk-CZHPR2G7.cjs} +8 -8
  63. package/dist/{chunk-6X2HUT4A.cjs.map → chunk-CZHPR2G7.cjs.map} +1 -1
  64. package/dist/{chunk-F4RUADRC.js → chunk-DHVNJYTO.js} +3 -3
  65. package/dist/{chunk-F4RUADRC.js.map → chunk-DHVNJYTO.js.map} +1 -1
  66. package/dist/{chunk-UJ7HK7BX.js → chunk-DRRSUUI5.js} +5 -5
  67. package/dist/{chunk-UJ7HK7BX.js.map → chunk-DRRSUUI5.js.map} +1 -1
  68. package/dist/{chunk-S4Q5OMIK.cjs → chunk-E3OCRJU6.cjs} +11 -11
  69. package/dist/{chunk-S4Q5OMIK.cjs.map → chunk-E3OCRJU6.cjs.map} +1 -1
  70. package/dist/{chunk-3KY7MHR4.js → chunk-E6T264NS.js} +3 -3
  71. package/dist/{chunk-3KY7MHR4.js.map → chunk-E6T264NS.js.map} +1 -1
  72. package/dist/{chunk-WCXOKGOQ.cjs → chunk-ECPL5RV6.cjs} +8 -8
  73. package/dist/{chunk-WCXOKGOQ.cjs.map → chunk-ECPL5RV6.cjs.map} +1 -1
  74. package/dist/{chunk-LLE7HPRI.js → chunk-EFXJ5C7X.js} +5 -5
  75. package/dist/{chunk-LLE7HPRI.js.map → chunk-EFXJ5C7X.js.map} +1 -1
  76. package/dist/{chunk-GH52NOCL.cjs → chunk-EQMLJ52C.cjs} +26 -26
  77. package/dist/{chunk-GH52NOCL.cjs.map → chunk-EQMLJ52C.cjs.map} +1 -1
  78. package/dist/{chunk-WIGJGFH4.cjs → chunk-EUBGGYPH.cjs} +5 -5
  79. package/dist/{chunk-WIGJGFH4.cjs.map → chunk-EUBGGYPH.cjs.map} +1 -1
  80. package/dist/{chunk-RBQYHEZD.cjs → chunk-FBZMSLDC.cjs} +4 -4
  81. package/dist/{chunk-RBQYHEZD.cjs.map → chunk-FBZMSLDC.cjs.map} +1 -1
  82. package/dist/{chunk-64TJCXY5.cjs → chunk-FUASIT3E.cjs} +15 -15
  83. package/dist/{chunk-64TJCXY5.cjs.map → chunk-FUASIT3E.cjs.map} +1 -1
  84. package/dist/{chunk-MRKSSN36.js → chunk-HI4ZW62S.js} +3 -3
  85. package/dist/{chunk-MRKSSN36.js.map → chunk-HI4ZW62S.js.map} +1 -1
  86. package/dist/{chunk-O3IZ7JEL.js → chunk-I732VEDW.js} +3 -3
  87. package/dist/{chunk-O3IZ7JEL.js.map → chunk-I732VEDW.js.map} +1 -1
  88. package/dist/{chunk-AZ6FKDQR.js → chunk-ITQ4NO4P.js} +3 -3
  89. package/dist/{chunk-AZ6FKDQR.js.map → chunk-ITQ4NO4P.js.map} +1 -1
  90. package/dist/{chunk-PYM5OUL4.js → chunk-J4RY5DTI.js} +5 -5
  91. package/dist/{chunk-PYM5OUL4.js.map → chunk-J4RY5DTI.js.map} +1 -1
  92. package/dist/{chunk-NOM2YWFP.js → chunk-JJZ4NIAG.js} +5 -5
  93. package/dist/{chunk-NOM2YWFP.js.map → chunk-JJZ4NIAG.js.map} +1 -1
  94. package/dist/{chunk-GC44RATP.cjs → chunk-K42QGAKM.cjs} +10 -10
  95. package/dist/{chunk-GC44RATP.cjs.map → chunk-K42QGAKM.cjs.map} +1 -1
  96. package/dist/{chunk-FRQ6F44U.js → chunk-KIX45IKP.js} +4 -4
  97. package/dist/{chunk-FRQ6F44U.js.map → chunk-KIX45IKP.js.map} +1 -1
  98. package/dist/{chunk-OEFFPR2S.cjs → chunk-KNZU4YO5.cjs} +4 -4
  99. package/dist/{chunk-OEFFPR2S.cjs.map → chunk-KNZU4YO5.cjs.map} +1 -1
  100. package/dist/{chunk-HK4HRLWE.js → chunk-KZBB4YKU.js} +3 -3
  101. package/dist/{chunk-HK4HRLWE.js.map → chunk-KZBB4YKU.js.map} +1 -1
  102. package/dist/{chunk-ZS6SLELQ.js → chunk-L7EGRCKJ.js} +4 -4
  103. package/dist/{chunk-ZS6SLELQ.js.map → chunk-L7EGRCKJ.js.map} +1 -1
  104. package/dist/{chunk-LXKNENHK.js → chunk-MV4TOCUK.js} +3 -3
  105. package/dist/{chunk-LXKNENHK.js.map → chunk-MV4TOCUK.js.map} +1 -1
  106. package/dist/{chunk-PAV4ZPSW.js → chunk-N43XLTHZ.js} +3 -3
  107. package/dist/{chunk-PAV4ZPSW.js.map → chunk-N43XLTHZ.js.map} +1 -1
  108. package/dist/{chunk-QFFNMJAS.cjs → chunk-N6NUMXAJ.cjs} +121 -121
  109. package/dist/{chunk-QFFNMJAS.cjs.map → chunk-N6NUMXAJ.cjs.map} +1 -1
  110. package/dist/{chunk-ZNW2TXLO.js → chunk-NACDF3PK.js} +3 -3
  111. package/dist/{chunk-ZNW2TXLO.js.map → chunk-NACDF3PK.js.map} +1 -1
  112. package/dist/{chunk-27DYRARU.cjs → chunk-NFATC6ZF.cjs} +4 -4
  113. package/dist/{chunk-27DYRARU.cjs.map → chunk-NFATC6ZF.cjs.map} +1 -1
  114. package/dist/{chunk-RJBHWM6D.js → chunk-NOS7PTKP.js} +7 -7
  115. package/dist/{chunk-RJBHWM6D.js.map → chunk-NOS7PTKP.js.map} +1 -1
  116. package/dist/{chunk-NRA36JKG.cjs → chunk-OI6RHLGC.cjs} +11 -11
  117. package/dist/{chunk-NRA36JKG.cjs.map → chunk-OI6RHLGC.cjs.map} +1 -1
  118. package/dist/{chunk-J5RW43IR.js → chunk-OIBHY6JQ.js} +4 -4
  119. package/dist/{chunk-J5RW43IR.js.map → chunk-OIBHY6JQ.js.map} +1 -1
  120. package/dist/{chunk-UU7MAO2D.cjs → chunk-OKLYRPKL.cjs} +4 -16
  121. package/dist/chunk-OKLYRPKL.cjs.map +1 -0
  122. package/dist/{chunk-SNKY3C2L.js → chunk-OZXPA3ME.js} +4 -4
  123. package/dist/{chunk-SNKY3C2L.js.map → chunk-OZXPA3ME.js.map} +1 -1
  124. package/dist/{chunk-35NFZ7QB.js → chunk-PLUCC4N5.js} +3 -3
  125. package/dist/{chunk-35NFZ7QB.js.map → chunk-PLUCC4N5.js.map} +1 -1
  126. package/dist/{chunk-MMZX557L.cjs → chunk-PVBANCWU.cjs} +5 -5
  127. package/dist/{chunk-MMZX557L.cjs.map → chunk-PVBANCWU.cjs.map} +1 -1
  128. package/dist/{chunk-BV42CCRP.cjs → chunk-QLAWEGTZ.cjs} +7 -7
  129. package/dist/{chunk-BV42CCRP.cjs.map → chunk-QLAWEGTZ.cjs.map} +1 -1
  130. package/dist/{chunk-TDDRPFO3.js → chunk-QVIUICFM.js} +9 -9
  131. package/dist/{chunk-TDDRPFO3.js.map → chunk-QVIUICFM.js.map} +1 -1
  132. package/dist/{chunk-HKSSM5RK.js → chunk-R7TKOQMJ.js} +3 -3
  133. package/dist/{chunk-HKSSM5RK.js.map → chunk-R7TKOQMJ.js.map} +1 -1
  134. package/dist/{chunk-HLNLYLNN.cjs → chunk-RAACTJ7C.cjs} +4 -4
  135. package/dist/{chunk-HLNLYLNN.cjs.map → chunk-RAACTJ7C.cjs.map} +1 -1
  136. package/dist/chunk-RIAM53CP.js +22 -0
  137. package/dist/chunk-RIAM53CP.js.map +1 -0
  138. package/dist/{chunk-X2YQP452.cjs → chunk-RTLUZKDL.cjs} +11 -11
  139. package/dist/{chunk-X2YQP452.cjs.map → chunk-RTLUZKDL.cjs.map} +1 -1
  140. package/dist/{chunk-6W4U2G3J.cjs → chunk-SDJYLCJK.cjs} +5 -5
  141. package/dist/{chunk-6W4U2G3J.cjs.map → chunk-SDJYLCJK.cjs.map} +1 -1
  142. package/dist/{chunk-ZHPET3LZ.cjs → chunk-SXSPMRSV.cjs} +2 -2
  143. package/dist/chunk-SXSPMRSV.cjs.map +1 -0
  144. package/dist/{chunk-JA4FEA5Z.cjs → chunk-T6QUCG7L.cjs} +4 -4
  145. package/dist/{chunk-JA4FEA5Z.cjs.map → chunk-T6QUCG7L.cjs.map} +1 -1
  146. package/dist/{chunk-GLEKLAUW.cjs → chunk-T6ZCG5AP.cjs} +12 -12
  147. package/dist/{chunk-GLEKLAUW.cjs.map → chunk-T6ZCG5AP.cjs.map} +1 -1
  148. package/dist/{chunk-ZTEAJAE6.js → chunk-UJ3SXRZZ.js} +3 -3
  149. package/dist/{chunk-ZTEAJAE6.js.map → chunk-UJ3SXRZZ.js.map} +1 -1
  150. package/dist/{chunk-Z6N6SDNR.js → chunk-V2EJLKGA.js} +4 -4
  151. package/dist/{chunk-Z6N6SDNR.js.map → chunk-V2EJLKGA.js.map} +1 -1
  152. package/dist/{chunk-57KX5WTP.cjs → chunk-V45L2OYP.cjs} +9 -9
  153. package/dist/{chunk-57KX5WTP.cjs.map → chunk-V45L2OYP.cjs.map} +1 -1
  154. package/dist/chunk-VKJ7V7EB.cjs +25 -0
  155. package/dist/chunk-VKJ7V7EB.cjs.map +1 -0
  156. package/dist/{chunk-2WB6EIYW.js → chunk-W4FV7JBH.js} +4 -4
  157. package/dist/{chunk-2WB6EIYW.js.map → chunk-W4FV7JBH.js.map} +1 -1
  158. package/dist/{chunk-TJRPNBY5.js → chunk-XGYI2KQH.js} +4 -4
  159. package/dist/{chunk-TJRPNBY5.js.map → chunk-XGYI2KQH.js.map} +1 -1
  160. package/dist/{chunk-TSK4VVBW.cjs → chunk-XI4L45SS.cjs} +301 -301
  161. package/dist/chunk-XI4L45SS.cjs.map +1 -0
  162. package/dist/{chunk-4JRRFRV4.cjs → chunk-XK54DTRF.cjs} +4 -4
  163. package/dist/{chunk-4JRRFRV4.cjs.map → chunk-XK54DTRF.cjs.map} +1 -1
  164. package/dist/{chunk-6FSQ3CHQ.js → chunk-XWCTBGYK.js} +6 -7
  165. package/dist/chunk-XWCTBGYK.js.map +1 -0
  166. package/dist/{chunk-XA3TSBAH.cjs → chunk-YTO5BRBD.cjs} +10 -11
  167. package/dist/chunk-YTO5BRBD.cjs.map +1 -0
  168. package/dist/{chunk-JO76RWCA.cjs → chunk-Z5U2JGEK.cjs} +11 -11
  169. package/dist/{chunk-JO76RWCA.cjs.map → chunk-Z5U2JGEK.cjs.map} +1 -1
  170. package/dist/{chunk-Q4DTGCSD.js → chunk-ZSJPRPN7.js} +3 -3
  171. package/dist/{chunk-Q4DTGCSD.js.map → chunk-ZSJPRPN7.js.map} +1 -1
  172. package/dist/compact-session-AAFICMPQ.cjs +56 -0
  173. package/dist/{compact-session-UUCBTBCZ.cjs.map → compact-session-AAFICMPQ.cjs.map} +1 -1
  174. package/dist/compact-session-LR73ESZX.js +19 -0
  175. package/dist/{compact-session-GF2CBKXB.js.map → compact-session-LR73ESZX.js.map} +1 -1
  176. package/dist/compaction.cjs +16 -16
  177. package/dist/compaction.js +3 -3
  178. package/dist/concurrency.cjs +6 -6
  179. package/dist/concurrency.js +4 -4
  180. package/dist/context/index.cjs +6 -5
  181. package/dist/context/index.cjs.map +1 -1
  182. package/dist/context/index.js +3 -2
  183. package/dist/context/index.js.map +1 -1
  184. package/dist/context-4HGPCOH6.cjs +22 -0
  185. package/dist/{context-2G4375BZ.cjs.map → context-4HGPCOH6.cjs.map} +1 -1
  186. package/dist/context-DCECDKWN.js +5 -0
  187. package/dist/{context-GSQYVVMJ.js.map → context-DCECDKWN.js.map} +1 -1
  188. package/dist/cron.cjs +33 -32
  189. package/dist/cron.js +32 -31
  190. package/dist/errors.cjs +21 -21
  191. package/dist/errors.js +2 -2
  192. package/dist/eval.cjs +38 -37
  193. package/dist/eval.cjs.map +1 -1
  194. package/dist/eval.js +32 -31
  195. package/dist/eval.js.map +1 -1
  196. package/dist/{executor-VQLTQY53.js → executor-3CGPLVJL.js} +7 -7
  197. package/dist/{executor-VQLTQY53.js.map → executor-3CGPLVJL.js.map} +1 -1
  198. package/dist/{executor-CB75B5BH.cjs → executor-4SW7QGZ4.cjs} +24 -24
  199. package/dist/{executor-CB75B5BH.cjs.map → executor-4SW7QGZ4.cjs.map} +1 -1
  200. package/dist/filesystem/index.cjs +8 -7
  201. package/dist/filesystem/index.cjs.map +1 -1
  202. package/dist/filesystem/index.js +4 -3
  203. package/dist/filesystem/index.js.map +1 -1
  204. package/dist/fs-session-store-2TF3ZWMT.js +10 -0
  205. package/dist/{fs-session-store-ZNUYZHYI.js.map → fs-session-store-2TF3ZWMT.js.map} +1 -1
  206. package/dist/fs-session-store-TL4RJTXZ.cjs +19 -0
  207. package/dist/{fs-session-store-MAZV5FXJ.cjs.map → fs-session-store-TL4RJTXZ.cjs.map} +1 -1
  208. package/dist/generate-object-E465DX5I.cjs +20 -0
  209. package/dist/{generate-object-6PWGH5DZ.cjs.map → generate-object-E465DX5I.cjs.map} +1 -1
  210. package/dist/generate-object-TVQCW2IZ.js +7 -0
  211. package/dist/{generate-object-IXMJ7FUX.js.map → generate-object-TVQCW2IZ.js.map} +1 -1
  212. package/dist/index-manager-EA6FGIQG.js +12 -0
  213. package/dist/{index-manager-X5IPG2JL.js.map → index-manager-EA6FGIQG.js.map} +1 -1
  214. package/dist/index-manager-HGGL4DD5.cjs +21 -0
  215. package/dist/{index-manager-YFFEPISE.cjs.map → index-manager-HGGL4DD5.cjs.map} +1 -1
  216. package/dist/index.cjs +226 -134
  217. package/dist/index.cjs.map +1 -1
  218. package/dist/index.d.cts +239 -1
  219. package/dist/index.d.ts +239 -1
  220. package/dist/index.js +131 -46
  221. package/dist/index.js.map +1 -1
  222. package/dist/{inject-session-NR64GB3T.js → inject-session-6ZAFN7F7.js} +7 -7
  223. package/dist/{inject-session-NR64GB3T.js.map → inject-session-6ZAFN7F7.js.map} +1 -1
  224. package/dist/{inject-session-I3HK3AHB.cjs → inject-session-KOGUD6KM.cjs} +9 -9
  225. package/dist/{inject-session-I3HK3AHB.cjs.map → inject-session-KOGUD6KM.cjs.map} +1 -1
  226. package/dist/internal/memory/adapters/index.cjs +9 -8
  227. package/dist/internal/memory/adapters/index.js +8 -7
  228. package/dist/internal/persistence/index.cjs +25 -25
  229. package/dist/internal/persistence/index.js +6 -6
  230. package/dist/internal/security/index.cjs +14 -13
  231. package/dist/internal/security/index.js +4 -3
  232. package/dist/judge-call-GVIJWQVE.cjs +22 -0
  233. package/dist/{judge-call-J5EETJL3.cjs.map → judge-call-GVIJWQVE.cjs.map} +1 -1
  234. package/dist/judge-call-QMKGC2ZK.js +5 -0
  235. package/dist/{judge-call-3QZO5H5N.js.map → judge-call-QMKGC2ZK.js.map} +1 -1
  236. package/dist/models.cjs +20 -20
  237. package/dist/models.js +5 -5
  238. package/dist/path-safety.cjs +11 -10
  239. package/dist/path-safety.js +4 -3
  240. package/dist/persistence.cjs +28 -28
  241. package/dist/persistence.js +8 -8
  242. package/dist/project.cjs +5 -5
  243. package/dist/project.js +3 -3
  244. package/dist/registry-GC7BQMSV.js +9 -0
  245. package/dist/{registry-PPFMCM4A.js.map → registry-GC7BQMSV.js.map} +1 -1
  246. package/dist/registry-UBY26R4I.cjs +46 -0
  247. package/dist/{registry-KB3TS6BM.cjs.map → registry-UBY26R4I.cjs.map} +1 -1
  248. package/dist/retry.cjs +4 -4
  249. package/dist/retry.js +3 -3
  250. package/dist/sandbox/index.cjs +6 -6
  251. package/dist/sandbox/index.js +2 -2
  252. package/dist/server/errors-envelope.cjs +14 -14
  253. package/dist/server/errors-envelope.js +3 -3
  254. package/dist/session-transcript-SKIRBEJE.js +5 -0
  255. package/dist/{session-transcript-7FWTO4BK.js.map → session-transcript-SKIRBEJE.js.map} +1 -1
  256. package/dist/session-transcript-TNAJ4O3M.cjs +50 -0
  257. package/dist/{session-transcript-FYRKWRWV.cjs.map → session-transcript-TNAJ4O3M.cjs.map} +1 -1
  258. package/dist/skills.cjs +8 -7
  259. package/dist/skills.js +6 -5
  260. package/dist/stream-object-QMNR3YFF.js +7 -0
  261. package/dist/{stream-object-NPJXDZXO.js.map → stream-object-QMNR3YFF.js.map} +1 -1
  262. package/dist/stream-object-T4DAMNVB.cjs +20 -0
  263. package/dist/{stream-object-3R3HZPQN.cjs.map → stream-object-T4DAMNVB.cjs.map} +1 -1
  264. package/dist/subagents-loader-3CXBQWWY.cjs +15 -0
  265. package/dist/{subagents-loader-FDXPBBRA.cjs.map → subagents-loader-3CXBQWWY.cjs.map} +1 -1
  266. package/dist/subagents-loader-WN2SB6PV.js +6 -0
  267. package/dist/{subagents-loader-5KQVYUNS.js.map → subagents-loader-WN2SB6PV.js.map} +1 -1
  268. package/dist/subagents-loader.cjs +6 -6
  269. package/dist/subagents-loader.js +4 -4
  270. package/dist/subscription/index.cjs +3 -3
  271. package/dist/subscription/index.js +2 -2
  272. package/dist/task-store.cjs +7 -7
  273. package/dist/task-store.js +4 -4
  274. package/dist/workflow.cjs +28 -27
  275. package/dist/workflow.js +7 -6
  276. package/package.json +1 -1
  277. package/dist/agent-GKX5FE5K.js +0 -47
  278. package/dist/agent-JA4ILE5O.cjs +0 -56
  279. package/dist/agent-session-store-EPUERCUU.cjs +0 -23
  280. package/dist/agent-session-store-TXP5ZVOD.js +0 -6
  281. package/dist/chunk-3NLOQEJR.js.map +0 -1
  282. package/dist/chunk-6FSQ3CHQ.js.map +0 -1
  283. package/dist/chunk-PBML2FHN.js.map +0 -1
  284. package/dist/chunk-TSK4VVBW.cjs.map +0 -1
  285. package/dist/chunk-UU7MAO2D.cjs.map +0 -1
  286. package/dist/chunk-XA3TSBAH.cjs.map +0 -1
  287. package/dist/chunk-XARLSCKA.js.map +0 -1
  288. package/dist/chunk-ZHPET3LZ.cjs.map +0 -1
  289. package/dist/compact-session-GF2CBKXB.js +0 -18
  290. package/dist/compact-session-UUCBTBCZ.cjs +0 -55
  291. package/dist/context-2G4375BZ.cjs +0 -22
  292. package/dist/context-GSQYVVMJ.js +0 -5
  293. package/dist/fs-session-store-MAZV5FXJ.cjs +0 -19
  294. package/dist/fs-session-store-ZNUYZHYI.js +0 -10
  295. package/dist/generate-object-6PWGH5DZ.cjs +0 -20
  296. package/dist/generate-object-IXMJ7FUX.js +0 -7
  297. package/dist/index-manager-X5IPG2JL.js +0 -11
  298. package/dist/index-manager-YFFEPISE.cjs +0 -20
  299. package/dist/judge-call-3QZO5H5N.js +0 -5
  300. package/dist/judge-call-J5EETJL3.cjs +0 -22
  301. package/dist/registry-KB3TS6BM.cjs +0 -46
  302. package/dist/registry-PPFMCM4A.js +0 -9
  303. package/dist/session-transcript-7FWTO4BK.js +0 -5
  304. package/dist/session-transcript-FYRKWRWV.cjs +0 -50
  305. package/dist/stream-object-3R3HZPQN.cjs +0 -20
  306. package/dist/stream-object-NPJXDZXO.js +0 -7
  307. package/dist/subagents-loader-5KQVYUNS.js +0 -6
  308. package/dist/subagents-loader-FDXPBBRA.cjs +0 -15
@@ -1,35 +1,36 @@
1
1
  'use strict';
2
2
 
3
- var chunkFAUKVJCC_cjs = require('./chunk-FAUKVJCC.cjs');
3
+ var chunk3BKWFISQ_cjs = require('./chunk-3BKWFISQ.cjs');
4
4
  var chunkBV2MWEMV_cjs = require('./chunk-BV2MWEMV.cjs');
5
- var chunkKCQUYQ3V_cjs = require('./chunk-KCQUYQ3V.cjs');
6
- var chunkNRA36JKG_cjs = require('./chunk-NRA36JKG.cjs');
7
- var chunkQFFNMJAS_cjs = require('./chunk-QFFNMJAS.cjs');
8
- var chunkGH52NOCL_cjs = require('./chunk-GH52NOCL.cjs');
9
- var chunkHECR7KF5_cjs = require('./chunk-HECR7KF5.cjs');
5
+ var chunk6DCTL32L_cjs = require('./chunk-6DCTL32L.cjs');
6
+ var chunkOI6RHLGC_cjs = require('./chunk-OI6RHLGC.cjs');
7
+ var chunkN6NUMXAJ_cjs = require('./chunk-N6NUMXAJ.cjs');
8
+ var chunkEQMLJ52C_cjs = require('./chunk-EQMLJ52C.cjs');
9
+ var chunk3YYDHUNH_cjs = require('./chunk-3YYDHUNH.cjs');
10
10
  var chunkBBZYXVLZ_cjs = require('./chunk-BBZYXVLZ.cjs');
11
- var chunkUU7MAO2D_cjs = require('./chunk-UU7MAO2D.cjs');
12
- var chunk6X2HUT4A_cjs = require('./chunk-6X2HUT4A.cjs');
13
- var chunk7PESI6YD_cjs = require('./chunk-7PESI6YD.cjs');
11
+ var chunkOKLYRPKL_cjs = require('./chunk-OKLYRPKL.cjs');
12
+ var chunkCZHPR2G7_cjs = require('./chunk-CZHPR2G7.cjs');
13
+ var chunkADVZIC43_cjs = require('./chunk-ADVZIC43.cjs');
14
14
  var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
15
15
  var chunkB4YA6BRS_cjs = require('./chunk-B4YA6BRS.cjs');
16
16
  var chunkNINIJCHU_cjs = require('./chunk-NINIJCHU.cjs');
17
17
  var chunkVJ26EKGJ_cjs = require('./chunk-VJ26EKGJ.cjs');
18
- var chunkOEFFPR2S_cjs = require('./chunk-OEFFPR2S.cjs');
19
- var chunkWCXOKGOQ_cjs = require('./chunk-WCXOKGOQ.cjs');
20
- var chunk6W4U2G3J_cjs = require('./chunk-6W4U2G3J.cjs');
18
+ var chunkKNZU4YO5_cjs = require('./chunk-KNZU4YO5.cjs');
19
+ var chunkECPL5RV6_cjs = require('./chunk-ECPL5RV6.cjs');
20
+ var chunkSDJYLCJK_cjs = require('./chunk-SDJYLCJK.cjs');
21
21
  var chunkYLQQX5W2_cjs = require('./chunk-YLQQX5W2.cjs');
22
22
  var chunkWJVHMTKB_cjs = require('./chunk-WJVHMTKB.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');
23
+ var chunk2CFEET3Y_cjs = require('./chunk-2CFEET3Y.cjs');
24
+ var chunkRTLUZKDL_cjs = require('./chunk-RTLUZKDL.cjs');
25
+ var chunkAMYY3JHQ_cjs = require('./chunk-AMYY3JHQ.cjs');
26
26
  var chunkVYHJZVL5_cjs = require('./chunk-VYHJZVL5.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');
27
+ var chunkT6ZCG5AP_cjs = require('./chunk-T6ZCG5AP.cjs');
28
+ var chunkFUASIT3E_cjs = require('./chunk-FUASIT3E.cjs');
29
+ var chunkYTO5BRBD_cjs = require('./chunk-YTO5BRBD.cjs');
30
+ var chunkVKJ7V7EB_cjs = require('./chunk-VKJ7V7EB.cjs');
31
+ var chunk44IISBRZ_cjs = require('./chunk-44IISBRZ.cjs');
32
+ var chunk2YGIBOUH_cjs = require('./chunk-2YGIBOUH.cjs');
33
+ var chunkSXSPMRSV_cjs = require('./chunk-SXSPMRSV.cjs');
33
34
  var promises = require('fs/promises');
34
35
  var crypto = require('crypto');
35
36
  var path = require('path');
@@ -225,7 +226,7 @@ async function agentGenerate(agent, agentModel, agentApiKey, agentLocal, input,
225
226
  const { output, maxRetries, errorStrategy, ...sendOptions } = options;
226
227
  const run = await agent.send(input, sendOptions);
227
228
  const result = await run.wait();
228
- const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-6PWGH5DZ.cjs');
229
+ const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-E465DX5I.cjs');
229
230
  const answer = structurableAnswerOrThrow(result, GenerateObjectError);
230
231
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
231
232
  const facade = getAgentFacade();
@@ -327,7 +328,7 @@ function normalizeModel(m) {
327
328
  if (m === void 0 || typeof m !== "string") return m;
328
329
  const id = m.trim();
329
330
  if (id.length === 0) {
330
- throw new chunkYULF6FPB_cjs.ConfigurationError(
331
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
331
332
  'model must be a non-empty "provider/model" id string or a ModelSelection object',
332
333
  { code: "invalid_model_selection" }
333
334
  );
@@ -463,7 +464,7 @@ function registryPath(cwd) {
463
464
  return path.join(cwd, REGISTRY_RELATIVE_PATH);
464
465
  }
465
466
  async function loadRegistry(cwd) {
466
- return chunk6X2HUT4A_cjs.readVersionedJson({
467
+ return chunkCZHPR2G7_cjs.readVersionedJson({
467
468
  path: registryPath(cwd),
468
469
  currentVersion: SCHEMA_VERSION,
469
470
  defaultValue: () => ({}),
@@ -487,7 +488,7 @@ async function saveRegistry(cwd, agents2) {
487
488
  }
488
489
  const path = registryPath(cwd);
489
490
  await chunkYLQQX5W2_cjs.withCwdMutex(`registry:${cwd}`, async () => {
490
- await chunk6X2HUT4A_cjs.writeVersionedJson(path, serialized, SCHEMA_VERSION);
491
+ await chunkCZHPR2G7_cjs.writeVersionedJson(path, serialized, SCHEMA_VERSION);
491
492
  });
492
493
  }
493
494
  function toSerialized(agent) {
@@ -554,7 +555,7 @@ function scheduleSaveForCwd(cwd) {
554
555
  }
555
556
  } catch (cause) {
556
557
  const msg = cause instanceof Error ? cause.message : String(cause);
557
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] registry persist failed (${cwd}): ${msg}
558
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] registry persist failed (${cwd}): ${msg}
558
559
  `);
559
560
  } finally {
560
561
  pendingSaves.delete(cwd);
@@ -893,14 +894,14 @@ async function readLegacyFacts(jsonPath) {
893
894
  }
894
895
  async function writeMigratedFacts(cwd, jsonPath, facts) {
895
896
  try {
896
- for (const fact of facts) await chunkGH52NOCL_cjs.appendFactToMarkdown(cwd, fact);
897
+ for (const fact of facts) await chunkEQMLJ52C_cjs.appendFactToMarkdown(cwd, fact);
897
898
  await promises.unlink(jsonPath).catch(() => void 0);
898
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
899
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] migrated ${facts.length} fact(s) from ${jsonPath} to MEMORY.md
899
900
  `);
900
901
  return { migrated: true, factCount: facts.length };
901
902
  } catch (cause) {
902
903
  const message = cause instanceof Error ? cause.message : String(cause);
903
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] memory migration failed (readonly fs?): ${message}
904
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] memory migration failed (readonly fs?): ${message}
904
905
  `);
905
906
  return { migrated: false, factCount: 0, reason: "readonly-fs" };
906
907
  }
@@ -910,12 +911,12 @@ async function migrateLegacyJson(cwd, config) {
910
911
  const key = `${cwd}::${config.namespace ?? "default"}::${config.scope ?? "agent"}::${config.userId ?? "default"}`;
911
912
  if (migrationRun.has(key)) return { migrated: false, factCount: 0, reason: "already-migrated" };
912
913
  migrationRun.add(key);
913
- const jsonPath = chunkGH52NOCL_cjs.legacyMemoryJsonPath(cwd, config);
914
+ const jsonPath = chunkEQMLJ52C_cjs.legacyMemoryJsonPath(cwd, config);
914
915
  if (!await fileExists(jsonPath)) {
915
916
  return { migrated: false, factCount: 0, reason: "no-legacy-json" };
916
917
  }
917
- if (await fileExists(chunkGH52NOCL_cjs.memoryMdPath(cwd))) {
918
- chunkZHPET3LZ_cjs.diag(
918
+ if (await fileExists(chunkEQMLJ52C_cjs.memoryMdPath(cwd))) {
919
+ chunkSXSPMRSV_cjs.diag(
919
920
  `[theokit-sdk] memory migration skipped: both MEMORY.md and legacy JSON exist at ${jsonPath}; leaving both intact
920
921
  `
921
922
  );
@@ -939,13 +940,13 @@ function extractMemoryFact(message) {
939
940
  async function readMemoryFacts(cwd, config) {
940
941
  if (!config.enabled) return [];
941
942
  await migrateLegacyJson(cwd, config);
942
- return chunkGH52NOCL_cjs.readFacts(cwd, config);
943
+ return chunkEQMLJ52C_cjs.readFacts(cwd, config);
943
944
  }
944
945
  async function appendMemoryFact(cwd, config, fact) {
945
946
  if (!config.enabled) return;
946
947
  await migrateLegacyJson(cwd, config);
947
- const sanitized = { text: chunkZHPET3LZ_cjs.redactSecrets(fact.text) };
948
- await chunkGH52NOCL_cjs.appendFact(cwd, config, sanitized);
948
+ const sanitized = { text: chunkSXSPMRSV_cjs.redactSecrets(fact.text) };
949
+ await chunkEQMLJ52C_cjs.appendFact(cwd, config, sanitized);
949
950
  }
950
951
 
951
952
  // src/internal/runtime/fixtures/fixture-scripts.ts
@@ -1293,7 +1294,7 @@ function redactScriptSecrets(script) {
1293
1294
  function redactEventSecrets(event) {
1294
1295
  const serialized = JSON.stringify(event);
1295
1296
  const localStripped = serialized.replace(FIXTURE_SENTINEL, "***");
1296
- const redacted = chunkZHPET3LZ_cjs.redactSecrets(localStripped);
1297
+ const redacted = chunkSXSPMRSV_cjs.redactSecrets(localStripped);
1297
1298
  if (redacted === serialized) return event;
1298
1299
  return JSON.parse(redacted);
1299
1300
  }
@@ -1616,7 +1617,7 @@ function createRealCloudRun(options) {
1616
1617
  conversation: []
1617
1618
  };
1618
1619
  const apiKey = resolveApiKey(options.agentOptions.apiKey);
1619
- const baseUrl = chunkQFFNMJAS_cjs.getConfiguredBaseUrl();
1620
+ const baseUrl = chunkN6NUMXAJ_cjs.getConfiguredBaseUrl();
1620
1621
  const handle = new RealCloudRun(
1621
1622
  {
1622
1623
  id,
@@ -1689,7 +1690,7 @@ var RealCloudRun = class extends FixtureRunBase {
1689
1690
  });
1690
1691
  if (!response.ok) {
1691
1692
  const text = await response.text().catch(() => "");
1692
- throw new chunkYULF6FPB_cjs.NetworkError(
1693
+ throw new chunk2YGIBOUH_cjs.NetworkError(
1693
1694
  `Cloud Run endpoint returned ${response.status}: ${text.slice(0, 200)}`,
1694
1695
  { code: "cloud_run_http_error" }
1695
1696
  );
@@ -1699,7 +1700,7 @@ var RealCloudRun = class extends FixtureRunBase {
1699
1700
  async consumeStream(response) {
1700
1701
  let finalStatus = "finished";
1701
1702
  let finalText = "";
1702
- for await (const record of chunkQFFNMJAS_cjs.parseSseStream(response.body, this.controller.signal)) {
1703
+ for await (const record of chunkN6NUMXAJ_cjs.parseSseStream(response.body, this.controller.signal)) {
1703
1704
  const parsed = safeParse(record.data);
1704
1705
  if (parsed === void 0) continue;
1705
1706
  const update = this.applyRecord(record.event, parsed);
@@ -1808,7 +1809,7 @@ var CloudAgent = class {
1808
1809
  */
1809
1810
  isFixtureMode() {
1810
1811
  const apiKey = resolveApiKey(this.options.apiKey);
1811
- return chunkQFFNMJAS_cjs.isFixtureApiKey(apiKey) && chunkQFFNMJAS_cjs.getConfiguredBaseUrl() === void 0;
1812
+ return chunkN6NUMXAJ_cjs.isFixtureApiKey(apiKey) && chunkN6NUMXAJ_cjs.getConfiguredBaseUrl() === void 0;
1812
1813
  }
1813
1814
  // SE9 — integrated structured output; delegates to the shared helper.
1814
1815
  generate(message, options) {
@@ -1823,7 +1824,7 @@ var CloudAgent = class {
1823
1824
  }
1824
1825
  async send(message, options = {}) {
1825
1826
  if (options.tools !== void 0 && options.tools.length > 0) {
1826
- throw new chunkYULF6FPB_cjs.ConfigurationError(
1827
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
1827
1828
  "Custom inline tools are local-only in SDK v1.0 \u2014 cloud agents cannot serialize handler functions",
1828
1829
  { code: "cloud_custom_tools_rejected" }
1829
1830
  );
@@ -1859,7 +1860,7 @@ var CloudAgent = class {
1859
1860
  const userText = typeof message === "string" ? message : message.text;
1860
1861
  const systemPrompt = await this.resolveSystemPromptForSend(userText, options);
1861
1862
  const apiKey = resolveApiKey(this.options.apiKey);
1862
- const useRealRuntime = apiKey !== void 0 && !chunkQFFNMJAS_cjs.isFixtureApiKey(apiKey) && chunkQFFNMJAS_cjs.getConfiguredBaseUrl() !== void 0;
1863
+ const useRealRuntime = apiKey !== void 0 && !chunkN6NUMXAJ_cjs.isFixtureApiKey(apiKey) && chunkN6NUMXAJ_cjs.getConfiguredBaseUrl() !== void 0;
1863
1864
  return useRealRuntime ? createRealCloudRun({
1864
1865
  agentId: this.agentId,
1865
1866
  model: this.model ?? { id: DEFAULT_AGENTIC_MODEL_ID },
@@ -1908,7 +1909,7 @@ var CloudAgent = class {
1908
1909
  listArtifacts() {
1909
1910
  if (!this.isFixtureMode()) {
1910
1911
  return Promise.reject(
1911
- new chunkYULF6FPB_cjs.ConfigurationError(
1912
+ new chunk2YGIBOUH_cjs.ConfigurationError(
1912
1913
  "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
1914
  { code: "cloud_runtime_pre_release" }
1914
1915
  )
@@ -1918,11 +1919,11 @@ var CloudAgent = class {
1918
1919
  }
1919
1920
  downloadArtifact(path) {
1920
1921
  try {
1921
- chunkXA3TSBAH_cjs.validateArtifactPath(path);
1922
+ chunkYTO5BRBD_cjs.validateArtifactPath(path);
1922
1923
  } catch (cause) {
1923
- if (cause instanceof chunkXA3TSBAH_cjs.PathTraversalError) {
1924
+ if (cause instanceof chunkYTO5BRBD_cjs.PathTraversalError) {
1924
1925
  return Promise.reject(
1925
- new chunkYULF6FPB_cjs.ConfigurationError(`Artifact path must stay inside the workspace: ${path}`, {
1926
+ new chunk2YGIBOUH_cjs.ConfigurationError(`Artifact path must stay inside the workspace: ${path}`, {
1926
1927
  code: "artifact_path_traversal",
1927
1928
  cause
1928
1929
  })
@@ -1932,7 +1933,7 @@ var CloudAgent = class {
1932
1933
  }
1933
1934
  if (!this.isFixtureMode()) {
1934
1935
  return Promise.reject(
1935
- new chunkYULF6FPB_cjs.ConfigurationError(
1936
+ new chunk2YGIBOUH_cjs.ConfigurationError(
1936
1937
  "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
1938
  { code: "cloud_runtime_pre_release" }
1938
1939
  )
@@ -1941,7 +1942,7 @@ var CloudAgent = class {
1941
1942
  const match = buildFixtureArtifacts().find((artifact) => artifact.path === path);
1942
1943
  if (match === void 0) {
1943
1944
  return Promise.reject(
1944
- new chunkYULF6FPB_cjs.UnknownAgentError(`Artifact ${path} not found`, { code: "unknown_artifact" })
1945
+ new chunk2YGIBOUH_cjs.UnknownAgentError(`Artifact ${path} not found`, { code: "unknown_artifact" })
1945
1946
  );
1946
1947
  }
1947
1948
  return Promise.resolve(Buffer.from(`fixture artifact content for ${path}
@@ -1955,7 +1956,7 @@ var CloudAgent = class {
1955
1956
  * @public
1956
1957
  */
1957
1958
  runUntil() {
1958
- throw new chunkYULF6FPB_cjs.UnsupportedRunOperationError(
1959
+ throw new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
1959
1960
  "Agent.runUntil() is not supported on cloud agents. Cloud runtime manages goal loops server-side. Use a local agent for autonomous Ralph loops.",
1960
1961
  "runUntil"
1961
1962
  );
@@ -1966,7 +1967,7 @@ var CloudAgent = class {
1966
1967
  * @public
1967
1968
  */
1968
1969
  fork() {
1969
- throw new chunkYULF6FPB_cjs.UnsupportedRunOperationError(
1970
+ throw new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
1970
1971
  "Agent.fork() is not supported on cloud agents. Fork inheritance requires local credential + system-prompt access. Use a local agent.",
1971
1972
  "fork"
1972
1973
  );
@@ -1978,7 +1979,7 @@ var CloudAgent = class {
1978
1979
  * @public
1979
1980
  */
1980
1981
  runToCompletion() {
1981
- throw new chunkYULF6FPB_cjs.UnsupportedRunOperationError(
1982
+ throw new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
1982
1983
  "Agent.runToCompletion() is not supported on cloud agents. Cloud runtime manages continuation server-side. Use a local agent.",
1983
1984
  "runToCompletion"
1984
1985
  );
@@ -1990,7 +1991,7 @@ var CloudAgent = class {
1990
1991
  * @public
1991
1992
  */
1992
1993
  streamToCompletion() {
1993
- throw new chunkYULF6FPB_cjs.UnsupportedRunOperationError(
1994
+ throw new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
1994
1995
  "Agent.streamToCompletion() is not supported on cloud agents. Cloud runtime manages continuation server-side. Use a local agent.",
1995
1996
  "streamToCompletion"
1996
1997
  );
@@ -2004,7 +2005,7 @@ var CloudAgent = class {
2004
2005
  */
2005
2006
  usePersonality() {
2006
2007
  return Promise.reject(
2007
- new chunkYULF6FPB_cjs.UnsupportedRunOperationError(
2008
+ new chunk2YGIBOUH_cjs.UnsupportedRunOperationError(
2008
2009
  "Agent.usePersonality() is not supported on cloud agents (pre-release). Use a local agent or wait for cloud GA.",
2009
2010
  "usePersonality"
2010
2011
  )
@@ -2032,7 +2033,7 @@ function validateCloudToolParity(options) {
2032
2033
  function rejectProcessors(options) {
2033
2034
  const hasProcessors = (options.inputProcessors?.length ?? 0) > 0 || (options.outputProcessors?.length ?? 0) > 0;
2034
2035
  if (hasProcessors) {
2035
- throw new chunkYULF6FPB_cjs.ConfigurationError(
2036
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
2036
2037
  "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
2038
  { code: "cloud_incompatible_function_resolver" }
2038
2039
  );
@@ -2040,7 +2041,7 @@ function rejectProcessors(options) {
2040
2041
  }
2041
2042
  function rejectFunctionSystemPrompt(options) {
2042
2043
  if (typeof options.systemPrompt === "function") {
2043
- throw new chunkYULF6FPB_cjs.ConfigurationError(
2044
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
2044
2045
  "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
2046
  { code: "cloud_incompatible_function_resolver" }
2046
2047
  );
@@ -2048,7 +2049,7 @@ function rejectFunctionSystemPrompt(options) {
2048
2049
  }
2049
2050
  function rejectFunctionSkills(options) {
2050
2051
  if (typeof options.skills === "function") {
2051
- throw new chunkYULF6FPB_cjs.ConfigurationError(
2052
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
2052
2053
  "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
2054
  { code: "cloud_incompatible_function_resolver" }
2054
2055
  );
@@ -2060,7 +2061,7 @@ function rejectStdioMcpLocalPaths(options) {
2060
2061
  if (!isStdioCommandConfig(config)) continue;
2061
2062
  const command = config.command ?? "";
2062
2063
  if (isLocalPath(command)) {
2063
- throw new chunkYULF6FPB_cjs.ConfigurationError(
2064
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
2064
2065
  `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
2066
  { code: "cloud_incompatible_mcp_stdio_local" }
2066
2067
  );
@@ -2100,14 +2101,14 @@ async function readState(filePath) {
2100
2101
  try {
2101
2102
  parsed = JSON.parse(raw);
2102
2103
  } catch {
2103
- chunkHECR7KF5_cjs.warnOnce(
2104
+ chunk3YYDHUNH_cjs.warnOnce(
2104
2105
  "personality-store-json-parse",
2105
2106
  "[theokit-sdk] personality.json is malformed; treating as empty"
2106
2107
  );
2107
2108
  return emptyState();
2108
2109
  }
2109
2110
  if (!isStateV1(parsed)) {
2110
- chunkHECR7KF5_cjs.warnOnce(
2111
+ chunk3YYDHUNH_cjs.warnOnce(
2111
2112
  "personality-store-bad-version",
2112
2113
  `[theokit-sdk] personality.json has unknown version; treating as empty (file kept untouched)`
2113
2114
  );
@@ -2138,9 +2139,9 @@ var PersonalityStore = class {
2138
2139
  try {
2139
2140
  await this.#persist(agentId, slug);
2140
2141
  } catch (err) {
2141
- chunkHECR7KF5_cjs.warnOnce(
2142
+ chunk3YYDHUNH_cjs.warnOnce(
2142
2143
  `personality-store-persist-failure-${agentId}`,
2143
- `[theokit-sdk] personality persist failed for ${chunkZHPET3LZ_cjs.redactSecrets(agentId)}: ${chunkZHPET3LZ_cjs.redactSecrets(
2144
+ `[theokit-sdk] personality persist failed for ${chunkSXSPMRSV_cjs.redactSecrets(agentId)}: ${chunkSXSPMRSV_cjs.redactSecrets(
2144
2145
  err.message
2145
2146
  )}`
2146
2147
  );
@@ -2155,9 +2156,9 @@ var PersonalityStore = class {
2155
2156
  try {
2156
2157
  state = await readState(filePath);
2157
2158
  } catch (err) {
2158
- chunkHECR7KF5_cjs.warnOnce(
2159
+ chunk3YYDHUNH_cjs.warnOnce(
2159
2160
  `personality-store-hydrate-failure-${agentId}`,
2160
- `[theokit-sdk] personality hydrate failed for ${chunkZHPET3LZ_cjs.redactSecrets(agentId)}: ${chunkZHPET3LZ_cjs.redactSecrets(
2161
+ `[theokit-sdk] personality hydrate failed for ${chunkSXSPMRSV_cjs.redactSecrets(agentId)}: ${chunkSXSPMRSV_cjs.redactSecrets(
2161
2162
  err.message
2162
2163
  )}`
2163
2164
  );
@@ -2174,17 +2175,17 @@ var PersonalityStore = class {
2174
2175
  async #persist(agentId, slug) {
2175
2176
  const filePath = this.#filePath();
2176
2177
  await promises.mkdir(path.dirname(filePath), { recursive: true });
2177
- await chunk6W4U2G3J_cjs.withFileLock(filePath, async () => {
2178
+ await chunkSDJYLCJK_cjs.withFileLock(filePath, async () => {
2178
2179
  const current = await readState(filePath);
2179
2180
  const nextAgents = { ...current.agents };
2180
2181
  if (slug === void 0) delete nextAgents[agentId];
2181
2182
  else nextAgents[agentId] = slug;
2182
2183
  const next = { version: SCHEMA_VERSION2, agents: nextAgents };
2183
- await chunkNETYW4V3_cjs.atomicWriteJson(filePath, next);
2184
+ await chunk2CFEET3Y_cjs.atomicWriteJson(filePath, next);
2184
2185
  });
2185
2186
  }
2186
2187
  #filePath() {
2187
- return path.join(chunk6X2HUT4A_cjs.getTheokitHome(this.#cwd), FILE_NAME);
2188
+ return path.join(chunkCZHPR2G7_cjs.getTheokitHome(this.#cwd), FILE_NAME);
2188
2189
  }
2189
2190
  };
2190
2191
 
@@ -2207,7 +2208,7 @@ function createPluginContext() {
2207
2208
  },
2208
2209
  on(hook, handler) {
2209
2210
  if (typeof handler !== "function") {
2210
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] ignoring non-function handler for hook "${hook}"
2211
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] ignoring non-function handler for hook "${hook}"
2211
2212
  `);
2212
2213
  return;
2213
2214
  }
@@ -2260,7 +2261,7 @@ var PluginManager = class {
2260
2261
  const seen = /* @__PURE__ */ new Set();
2261
2262
  for (const plugin of plugins) {
2262
2263
  if (seen.has(plugin.name)) {
2263
- chunkZHPET3LZ_cjs.diag(
2264
+ chunkSXSPMRSV_cjs.diag(
2264
2265
  `[theokit-sdk] duplicate plugin name "${plugin.name}" \u2014 both will register independently
2265
2266
  `
2266
2267
  );
@@ -2287,7 +2288,7 @@ var PluginManager = class {
2287
2288
  */
2288
2289
  async register(plugin) {
2289
2290
  if (plugin.kind !== "general") {
2290
- throw new chunkYULF6FPB_cjs.ConfigurationError(
2291
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
2291
2292
  `late register supports general plugins only (got "${plugin.kind}" for "${plugin.name}")`,
2292
2293
  { code: "plugin_late_register_kind" }
2293
2294
  );
@@ -2344,7 +2345,7 @@ var PluginManager = class {
2344
2345
  parts.push(result.recalledContext);
2345
2346
  }
2346
2347
  } catch (err) {
2347
- chunkZHPET3LZ_cjs.diag(
2348
+ chunkSXSPMRSV_cjs.diag(
2348
2349
  `[theokit-sdk] pre_user_send hook failed: ${err instanceof Error ? err.message : String(err)}
2349
2350
  `
2350
2351
  );
@@ -2372,7 +2373,7 @@ var PluginManager = class {
2372
2373
  try {
2373
2374
  await h(ctx);
2374
2375
  } catch (err) {
2375
- chunkZHPET3LZ_cjs.diag(
2376
+ chunkSXSPMRSV_cjs.diag(
2376
2377
  `[theokit-sdk] post_assistant_reply hook failed: ${err instanceof Error ? err.message : String(err)}
2377
2378
  `
2378
2379
  );
@@ -2388,7 +2389,7 @@ var PluginManager = class {
2388
2389
  try {
2389
2390
  await h(ctx);
2390
2391
  } catch (err) {
2391
- chunkZHPET3LZ_cjs.diag(
2392
+ chunkSXSPMRSV_cjs.diag(
2392
2393
  `[theokit-sdk] ${name} hook failed: ${err instanceof Error ? err.message : String(err)}
2393
2394
  `
2394
2395
  );
@@ -2403,7 +2404,7 @@ var PluginManager = class {
2403
2404
  const out = await h(current, ctx);
2404
2405
  if (out !== void 0) current = out;
2405
2406
  } catch (err) {
2406
- chunkZHPET3LZ_cjs.diag(
2407
+ chunkSXSPMRSV_cjs.diag(
2407
2408
  `[theokit-sdk] ${name} hook failed: ${err instanceof Error ? err.message : String(err)}
2408
2409
  `
2409
2410
  );
@@ -2545,7 +2546,7 @@ var HooksExecutor = class {
2545
2546
  this.config = {};
2546
2547
  return;
2547
2548
  }
2548
- this.config = await chunkHECR7KF5_cjs.loadHookConfig(this.cwd);
2549
+ this.config = await chunk3YYDHUNH_cjs.loadHookConfig(this.cwd);
2549
2550
  }
2550
2551
  /** Fire every hook registered for `event` and aggregate the decisions. */
2551
2552
  async run(payload) {
@@ -2651,11 +2652,11 @@ function buildContextBudgetEvent(model, resolved) {
2651
2652
  // src/internal/runtime/lifecycle/post-run-lifecycle.ts
2652
2653
  function resolveWindowForRun(model, contextWindow) {
2653
2654
  const override = contextWindow !== void 0 && contextWindow > 0 ? contextWindow : void 0;
2654
- return chunkNNNUQELM_cjs.resolveEffectiveContextWindow({
2655
+ return chunkAMYY3JHQ_cjs.resolveEffectiveContextWindow({
2655
2656
  ...override !== void 0 ? { override } : {},
2656
- catalog: chunkGLEKLAUW_cjs.getCatalogModelInfo(model)?.limit?.context,
2657
- margin: chunkNNNUQELM_cjs.CONTEXT_WINDOW_MARGIN,
2658
- floor: chunkNNNUQELM_cjs.CONTEXT_WINDOW_FLOOR
2657
+ catalog: chunkT6ZCG5AP_cjs.getCatalogModelInfo(model)?.limit?.context,
2658
+ margin: chunkAMYY3JHQ_cjs.CONTEXT_WINDOW_MARGIN,
2659
+ floor: chunkAMYY3JHQ_cjs.CONTEXT_WINDOW_FLOOR
2659
2660
  });
2660
2661
  }
2661
2662
  async function runPostRunLifecycle(inputs) {
@@ -2679,32 +2680,32 @@ async function runPostRunLifecycle(inputs) {
2679
2680
  try {
2680
2681
  const partial = await safeConversation(run);
2681
2682
  if (partial !== void 0) {
2682
- chunkFAUKVJCC_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
2683
+ chunk3BKWFISQ_cjs.persistTurnToTranscript(sessionStore, { cwd: workspaceCwd, agentId, model }, agentId, {
2683
2684
  userText,
2684
2685
  conversation: partial
2685
2686
  });
2686
2687
  }
2687
2688
  } catch (cause) {
2688
2689
  const msg = cause instanceof Error ? cause.message : String(cause);
2689
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
2690
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] partial transcript write failed (${agentId}): ${msg}
2690
2691
  `);
2691
2692
  }
2692
- await chunkFAUKVJCC_cjs.flushSessionWrites();
2693
+ await chunk3BKWFISQ_cjs.flushSessionWrites();
2693
2694
  return;
2694
2695
  }
2695
2696
  if (result.result !== void 0) {
2696
- chunkFAUKVJCC_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
2697
+ chunk3BKWFISQ_cjs.appendSessionMessage(agentId, { role: "assistant", text: result.result });
2697
2698
  }
2698
2699
  const conversation = await safeConversation(run);
2699
2700
  const resolvedWindow = resolveWindowForRun(model, contextWindow);
2700
2701
  const effectiveWindow = resolvedWindow.window;
2701
2702
  const budgetEvent = buildContextBudgetEvent(model, resolvedWindow);
2702
2703
  if (budgetEvent !== void 0 && onRunEvent !== void 0) {
2703
- chunkKCQUYQ3V_cjs.emitRunEvent(onRunEvent, budgetEvent);
2704
+ chunk6DCTL32L_cjs.emitRunEvent(onRunEvent, budgetEvent);
2704
2705
  }
2705
2706
  const lastRequestUsage = result.usage?.requests?.at(-1)?.totalTokens;
2706
2707
  const usageForTrigger = lastRequestUsage ?? result.usage?.totalTokens;
2707
- chunkFAUKVJCC_cjs.persistTurnToTranscript(
2708
+ chunk3BKWFISQ_cjs.persistTurnToTranscript(
2708
2709
  sessionStore,
2709
2710
  { cwd: workspaceCwd, agentId, model },
2710
2711
  agentId,
@@ -2716,13 +2717,13 @@ async function runPostRunLifecycle(inputs) {
2716
2717
  // The EFFECTIVE window (after override, clamp and margin) — not the declared one. Swapping for
2717
2718
  // `contextWindow` here would budget against a number the clamp already rejected.
2718
2719
  contextWindow: effectiveWindow,
2719
- summarize: chunkQFFNMJAS_cjs.buildDefaultSummarizer({
2720
+ summarize: chunkN6NUMXAJ_cjs.buildDefaultSummarizer({
2720
2721
  agentModel: model,
2721
2722
  ...inputs.apiKey !== void 0 ? { apiKey: inputs.apiKey } : {}
2722
2723
  })
2723
2724
  }
2724
2725
  },
2725
- onRunEvent !== void 0 ? () => chunkKCQUYQ3V_cjs.emitRunEvent(onRunEvent, { type: "compact_boundary", trigger: "auto" }) : void 0
2726
+ onRunEvent !== void 0 ? () => chunk6DCTL32L_cjs.emitRunEvent(onRunEvent, { type: "compact_boundary", trigger: "auto" }) : void 0
2726
2727
  );
2727
2728
  if (result.status === "finished" && result.result !== void 0) {
2728
2729
  const summaryArgs = {
@@ -2738,14 +2739,14 @@ async function runPostRunLifecycle(inputs) {
2738
2739
  if (memoryProvider?.recordSessionSummary !== void 0) {
2739
2740
  await memoryProvider.recordSessionSummary(summaryArgs);
2740
2741
  } else {
2741
- await chunkGH52NOCL_cjs.writeSessionSummary(summaryArgs);
2742
+ await chunkEQMLJ52C_cjs.writeSessionSummary(summaryArgs);
2742
2743
  }
2743
2744
  if (!shouldUsePortMemoryPath()) {
2744
2745
  void memoryGlue.syncIfReady();
2745
2746
  }
2746
2747
  } catch (cause) {
2747
2748
  const message = cause instanceof Error ? cause.message : String(cause);
2748
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] session summary write failed (${result.id}): ${message}
2749
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] session summary write failed (${result.id}): ${message}
2749
2750
  `);
2750
2751
  }
2751
2752
  }
@@ -2758,7 +2759,7 @@ async function runPostRunLifecycle(inputs) {
2758
2759
  agentId,
2759
2760
  runId: result.id
2760
2761
  });
2761
- await chunkFAUKVJCC_cjs.flushSessionWrites();
2762
+ await chunk3BKWFISQ_cjs.flushSessionWrites();
2762
2763
  }
2763
2764
  async function safeConversation(run) {
2764
2765
  try {
@@ -2833,7 +2834,7 @@ var warned = /* @__PURE__ */ new Set();
2833
2834
  function warnDoubleReasoningOnce() {
2834
2835
  if (warned.has("double-reasoning")) return;
2835
2836
  warned.add("double-reasoning");
2836
- chunkZHPET3LZ_cjs.diag(
2837
+ chunkSXSPMRSV_cjs.diag(
2837
2838
  "[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
2839
  );
2839
2840
  }
@@ -2866,9 +2867,9 @@ var SkillsManager = class {
2866
2867
  }
2867
2868
  async refresh() {
2868
2869
  const skillsRoot = this.skillsDir ?? path.join(this.cwd, ".theokit", "skills");
2869
- const discovered = await chunk64TJCXY5_cjs.discoverSkills(skillsRoot, {
2870
+ const discovered = await chunkFUASIT3E_cjs.discoverSkills(skillsRoot, {
2870
2871
  onInvalidSkill: (info) => {
2871
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
2872
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] skill ${info.name} skipped (${info.code}): ${info.message}
2872
2873
  `);
2873
2874
  }
2874
2875
  });
@@ -2892,7 +2893,7 @@ var SkillsManager = class {
2892
2893
  async get(name) {
2893
2894
  const skill = this.skills.find((s) => s.name === name);
2894
2895
  if (skill === void 0) return void 0;
2895
- const instructions = typeof skill.instructions === "string" ? skill.instructions : chunk64TJCXY5_cjs.stripSkillFrontmatter(await promises.readFile(skill.source, "utf8"));
2896
+ const instructions = typeof skill.instructions === "string" ? skill.instructions : chunkFUASIT3E_cjs.stripSkillFrontmatter(await promises.readFile(skill.source, "utf8"));
2896
2897
  const references = skill.references;
2897
2898
  return {
2898
2899
  name: skill.name,
@@ -2978,7 +2979,7 @@ async function safeCall(fn, fallback, label = "safeCall") {
2978
2979
  return await fn();
2979
2980
  } catch (cause) {
2980
2981
  const message = cause instanceof Error ? cause.message : String(cause);
2981
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] ${label} failed: ${message}
2982
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] ${label} failed: ${message}
2982
2983
  `);
2983
2984
  return fallback;
2984
2985
  }
@@ -2992,7 +2993,7 @@ var ActiveMemoryPromptProvider = class {
2992
2993
  if (ctx.activeMemorySummary === void 0 || ctx.activeMemorySummary.length === 0) {
2993
2994
  return Promise.resolve(void 0);
2994
2995
  }
2995
- const body = chunk64TJCXY5_cjs.escapeBlockBody(ctx.activeMemorySummary);
2996
+ const body = chunkFUASIT3E_cjs.escapeBlockBody(ctx.activeMemorySummary);
2996
2997
  return Promise.resolve(`<active-memory>
2997
2998
  ${body}
2998
2999
  </active-memory>`);
@@ -3045,7 +3046,7 @@ function formatSource(name, tokens) {
3045
3046
  if (tokens.length === 0) {
3046
3047
  return ` <source name="${escapeAttribute(name)}" />`;
3047
3048
  }
3048
- const body = chunk64TJCXY5_cjs.escapeBlockBody(tokens.join(" "));
3049
+ const body = chunkFUASIT3E_cjs.escapeBlockBody(tokens.join(" "));
3049
3050
  return ` <source name="${escapeAttribute(name)}">
3050
3051
  ${body}
3051
3052
  </source>`;
@@ -3061,7 +3062,7 @@ var MemoryPromptProvider = class {
3061
3062
  contribute(ctx) {
3062
3063
  if (ctx.memoryAutoInject === false) return Promise.resolve(void 0);
3063
3064
  if (ctx.memory.length === 0) return Promise.resolve(void 0);
3064
- const lines = ctx.memory.map((fact) => ` - ${chunk64TJCXY5_cjs.escapeBlockBody(fact.text)}`);
3065
+ const lines = ctx.memory.map((fact) => ` - ${chunkFUASIT3E_cjs.escapeBlockBody(fact.text)}`);
3065
3066
  return Promise.resolve(`<memory>
3066
3067
  ${lines.join("\n")}
3067
3068
  </memory>`);
@@ -3083,7 +3084,7 @@ var SkillsPromptProvider = class {
3083
3084
  priority = 20;
3084
3085
  contribute(ctx) {
3085
3086
  if (ctx.skillsAutoInject === false) return Promise.resolve(void 0);
3086
- return Promise.resolve(chunk64TJCXY5_cjs.buildSkillsBlock(ctx.skills));
3087
+ return Promise.resolve(chunkFUASIT3E_cjs.buildSkillsBlock(ctx.skills));
3087
3088
  }
3088
3089
  };
3089
3090
 
@@ -3095,7 +3096,7 @@ var SystemPromptPipeline = class _SystemPromptPipeline {
3095
3096
  for (const p of providers) {
3096
3097
  const key = `${p.priority}:${p.id}`;
3097
3098
  if (seen.has(key)) {
3098
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Duplicate system-prompt provider ${key}`, {
3099
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Duplicate system-prompt provider ${key}`, {
3099
3100
  code: "pipeline_duplicate_provider"
3100
3101
  });
3101
3102
  }
@@ -3142,7 +3143,7 @@ function validateAgentOptions(options) {
3142
3143
  ensureRuntimeShape(options);
3143
3144
  if (options.local !== void 0) {
3144
3145
  if (options.model === void 0) {
3145
- throw new chunkYULF6FPB_cjs.ConfigurationError("Local agents require a model selection", {
3146
+ throw new chunk2YGIBOUH_cjs.ConfigurationError("Local agents require a model selection", {
3146
3147
  code: "missing_model"
3147
3148
  });
3148
3149
  }
@@ -3166,7 +3167,7 @@ function validateCredentialPoolShape(options) {
3166
3167
  ([, arr]) => Array.isArray(arr) && arr.some((k) => typeof k === "string" && k.length > 0)
3167
3168
  );
3168
3169
  if (populated.length === 0) return;
3169
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3170
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3170
3171
  "Ambiguous credential configuration: use either `apiKey: '...'` (single-key, simplest) OR `apiKeys: { provider: [...] }` (multi-key pool), not both.",
3171
3172
  { code: "credential_pool_ambiguous" }
3172
3173
  );
@@ -3175,7 +3176,7 @@ function validatePlugins(options) {
3175
3176
  const plugins = options.plugins;
3176
3177
  if (plugins?.paths === void 0) return;
3177
3178
  if (options.cloud !== void 0 && plugins.paths.length > 0) {
3178
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3179
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3179
3180
  "Cloud agents require committed plugin manifests; local plugin paths are not supported",
3180
3181
  { code: "cloud_plugin_path_rejected" }
3181
3182
  );
@@ -3183,7 +3184,7 @@ function validatePlugins(options) {
3183
3184
  }
3184
3185
  function ensureRuntimeShape(options) {
3185
3186
  if (options.local !== void 0 && options.cloud !== void 0) {
3186
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3187
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3187
3188
  "Pass either local or cloud \u2014 they are mutually exclusive runtimes",
3188
3189
  { code: "runtime_exclusive" }
3189
3190
  );
@@ -3191,7 +3192,7 @@ function ensureRuntimeShape(options) {
3191
3192
  }
3192
3193
  function rejectProgrammaticHooks(options) {
3193
3194
  if (options.hooks !== void 0) {
3194
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3195
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3195
3196
  "Programmatic hooks are not supported \u2014 hooks are file-based only (.theokit/hooks.json)",
3196
3197
  { code: "programmatic_hooks_rejected" }
3197
3198
  );
@@ -3201,7 +3202,7 @@ function validateCloud(cloud) {
3201
3202
  if (cloud.envVars !== void 0) {
3202
3203
  for (const key of Object.keys(cloud.envVars)) {
3203
3204
  if (key.startsWith("THEOKIT_")) {
3204
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3205
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3205
3206
  `Cloud envVars cannot use the reserved THEOKIT_ prefix (got "${key}")`,
3206
3207
  { code: "reserved_env_prefix" }
3207
3208
  );
@@ -3213,7 +3214,7 @@ function validateMcpServers(options) {
3213
3214
  if (options.mcpServers === void 0) return;
3214
3215
  for (const [name, config] of Object.entries(options.mcpServers)) {
3215
3216
  if (options.cloud !== void 0 && isStdioWithCwd(config)) {
3216
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3217
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3217
3218
  `MCP server "${name}" uses stdio with cwd, which is rejected for cloud agents`,
3218
3219
  { code: "cloud_stdio_cwd_rejected" }
3219
3220
  );
@@ -3232,12 +3233,12 @@ function validateSubagents(agents2) {
3232
3233
  if (agents2 === void 0) return;
3233
3234
  for (const [name, definition] of Object.entries(agents2)) {
3234
3235
  if (typeof definition.description !== "string" || definition.description.length === 0) {
3235
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty description`, {
3236
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty description`, {
3236
3237
  code: "subagent_missing_description"
3237
3238
  });
3238
3239
  }
3239
3240
  if (typeof definition.prompt !== "string" || definition.prompt.length === 0) {
3240
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty prompt`, {
3241
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Subagent "${name}" requires a non-empty prompt`, {
3241
3242
  code: "subagent_missing_prompt"
3242
3243
  });
3243
3244
  }
@@ -3250,7 +3251,7 @@ function validateToolCatalog(tools) {
3250
3251
  for (const tool of tools) {
3251
3252
  validateSingleTool(tool);
3252
3253
  if (seen.has(tool.name)) {
3253
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Duplicate custom tool name "${tool.name}"`, {
3254
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Duplicate custom tool name "${tool.name}"`, {
3254
3255
  code: "duplicate_tool_name"
3255
3256
  });
3256
3257
  }
@@ -3261,7 +3262,7 @@ function validateCustomTools(options) {
3261
3262
  const tools = options.tools;
3262
3263
  if (tools === void 0 || tools.length === 0) return;
3263
3264
  if (options.cloud !== void 0) {
3264
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3265
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3265
3266
  "Custom inline tools are local-only in SDK v1.0 \u2014 cloud agents cannot serialize handler functions",
3266
3267
  { code: "cloud_custom_tools_rejected" }
3267
3268
  );
@@ -3273,25 +3274,25 @@ function validateSingleTool(tool) {
3273
3274
  validateToolDescription(tool);
3274
3275
  validateToolSchema(tool);
3275
3276
  if (typeof tool.handler !== "function") {
3276
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a handler function`, {
3277
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a handler function`, {
3277
3278
  code: "tool_missing_handler"
3278
3279
  });
3279
3280
  }
3280
3281
  }
3281
3282
  function validateToolName(tool) {
3282
3283
  if (typeof tool.name !== "string" || tool.name.length === 0) {
3283
- throw new chunkYULF6FPB_cjs.ConfigurationError("Custom tool requires a non-empty name", {
3284
+ throw new chunk2YGIBOUH_cjs.ConfigurationError("Custom tool requires a non-empty name", {
3284
3285
  code: "tool_missing_name"
3285
3286
  });
3286
3287
  }
3287
3288
  if (!TOOL_NAME_PATTERN.test(tool.name)) {
3288
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3289
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3289
3290
  `Custom tool name "${tool.name}" must match /^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/`,
3290
3291
  { code: "tool_invalid_name" }
3291
3292
  );
3292
3293
  }
3293
3294
  if (RESERVED_TOOL_NAMES.has(tool.name) || tool.name.startsWith("mcp_")) {
3294
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3295
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3295
3296
  `Custom tool name "${tool.name}" collides with a reserved SDK tool name`,
3296
3297
  { code: "tool_reserved_name" }
3297
3298
  );
@@ -3299,7 +3300,7 @@ function validateToolName(tool) {
3299
3300
  }
3300
3301
  function validateToolDescription(tool) {
3301
3302
  if (typeof tool.description !== "string" || tool.description.length === 0) {
3302
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a non-empty description`, {
3303
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Custom tool "${tool.name}" requires a non-empty description`, {
3303
3304
  code: "tool_missing_description"
3304
3305
  });
3305
3306
  }
@@ -3307,12 +3308,12 @@ function validateToolDescription(tool) {
3307
3308
  function validateToolSchema(tool) {
3308
3309
  const schema = tool.inputSchema;
3309
3310
  if (schema === null || schema === void 0 || typeof schema !== "object") {
3310
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Custom tool "${tool.name}" requires an inputSchema object`, {
3311
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Custom tool "${tool.name}" requires an inputSchema object`, {
3311
3312
  code: "tool_missing_schema"
3312
3313
  });
3313
3314
  }
3314
3315
  if (schema.type !== "object") {
3315
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3316
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3316
3317
  `Custom tool "${tool.name}" inputSchema must declare \`type: "object"\``,
3317
3318
  { code: "tool_invalid_schema_type" }
3318
3319
  );
@@ -3323,7 +3324,7 @@ function validateMemory(options) {
3323
3324
  if (memory?.storePath === void 0) return;
3324
3325
  const storePath = memory.storePath;
3325
3326
  if (storePath.includes("..") || storePath.startsWith("/") || /^[A-Z]:/i.test(storePath)) {
3326
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3327
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3327
3328
  `Memory storePath must stay inside the workspace; got "${storePath}"`,
3328
3329
  { code: "memory_path_traversal" }
3329
3330
  );
@@ -3345,7 +3346,7 @@ var HISTOGRAM_NAMES = {
3345
3346
  };
3346
3347
  function safeRequire(moduleName) {
3347
3348
  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-TSK4VVBW.cjs', document.baseURI).href)));
3349
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-XI4L45SS.cjs', document.baseURI).href)));
3349
3350
  return r(moduleName);
3350
3351
  } catch {
3351
3352
  return void 0;
@@ -3424,7 +3425,7 @@ var langfuseAdapter = {
3424
3425
  }
3425
3426
  }
3426
3427
  if (lf.LangfuseSpanProcessor === void 0) {
3427
- chunkZHPET3LZ_cjs.diag(
3428
+ chunkSXSPMRSV_cjs.diag(
3428
3429
  "[theokit-sdk] @langfuse/node detected but LangfuseSpanProcessor not found (v2?). Use Langfuse v3+ for auto-instrumentation.\n"
3429
3430
  );
3430
3431
  return;
@@ -3553,11 +3554,11 @@ function tryAutoRegisterAdapters(settings) {
3553
3554
  try {
3554
3555
  adapter.register();
3555
3556
  registered.add(adapter.moduleName);
3556
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] telemetry: ${adapter.displayName} auto-instrumented.
3557
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] telemetry: ${adapter.displayName} auto-instrumented.
3557
3558
  `);
3558
3559
  } catch (cause) {
3559
3560
  const message = cause instanceof Error ? cause.message : String(cause);
3560
- chunkZHPET3LZ_cjs.diag(
3561
+ chunkSXSPMRSV_cjs.diag(
3561
3562
  `[theokit-sdk] telemetry: ${adapter.displayName} detected but failed to register: ${message}
3562
3563
  `
3563
3564
  );
@@ -3570,7 +3571,7 @@ var cachedOtel;
3570
3571
  function loadOtel() {
3571
3572
  if (cachedOtel === void 0) {
3572
3573
  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-TSK4VVBW.cjs', document.baseURI).href)));
3574
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-XI4L45SS.cjs', document.baseURI).href)));
3574
3575
  const mod = r("@opentelemetry/api");
3575
3576
  cachedOtel = mod;
3576
3577
  } catch {
@@ -3613,7 +3614,7 @@ function safe(op, fallback) {
3613
3614
  if (!warnedOnce) {
3614
3615
  warnedOnce = true;
3615
3616
  const message = cause instanceof Error ? cause.message : String(cause);
3616
- chunkZHPET3LZ_cjs.diag(
3617
+ chunkSXSPMRSV_cjs.diag(
3617
3618
  `[theokit-sdk] telemetry exporter error (suppressed; agent.send continues): ${message}
3618
3619
  `
3619
3620
  );
@@ -3627,7 +3628,7 @@ function createTelemetry(settings) {
3627
3628
  if (otel === null) {
3628
3629
  if (!warnedOnce) {
3629
3630
  warnedOnce = true;
3630
- chunkZHPET3LZ_cjs.diag(
3631
+ chunkSXSPMRSV_cjs.diag(
3631
3632
  "[theokit-sdk] telemetry.enabled = true but `@opentelemetry/api` is not installed; telemetry is a no-op.\n"
3632
3633
  );
3633
3634
  }
@@ -3721,12 +3722,12 @@ function wrapSpan(span, openSpans) {
3721
3722
  }
3722
3723
  function redactAttrValue(value) {
3723
3724
  if (typeof value !== "string") return value;
3724
- return chunkZHPET3LZ_cjs.redactSecrets(value);
3725
+ return chunkSXSPMRSV_cjs.redactSecrets(value);
3725
3726
  }
3726
3727
  function redactAttrs(attrs) {
3727
3728
  const out = {};
3728
3729
  for (const [k, v] of Object.entries(attrs)) {
3729
- out[k] = typeof v === "string" ? chunkZHPET3LZ_cjs.redactSecrets(v) : v;
3730
+ out[k] = typeof v === "string" ? chunkSXSPMRSV_cjs.redactSecrets(v) : v;
3730
3731
  }
3731
3732
  return out;
3732
3733
  }
@@ -3808,10 +3809,10 @@ async function loadMarkdownEntities(opts) {
3808
3809
  const raw = await promises.readFile(resolved.source, "utf8").catch(() => null);
3809
3810
  if (raw === null) continue;
3810
3811
  const split = splitFrontmatter(raw, resolved.source, errorCodePrefix);
3811
- const fields = chunkBRHRQOJA_cjs.parseSimpleYaml(split.frontmatter);
3812
+ const fields = chunk44IISBRZ_cjs.parseSimpleYaml(split.frontmatter);
3812
3813
  const parsed = schema.safeParse(fields);
3813
3814
  if (!parsed.success) {
3814
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3815
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3815
3816
  `Invalid frontmatter in ${resolved.source}: ${parsed.error.message}`,
3816
3817
  { code: `${errorCodePrefix}_frontmatter_invalid` }
3817
3818
  );
@@ -3829,13 +3830,13 @@ async function assertFileSizeUnderCap(source, errorCodePrefix) {
3829
3830
  try {
3830
3831
  const info = await promises.stat(source);
3831
3832
  if (info.size > MAX_MD_FILE_BYTES) {
3832
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3833
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3833
3834
  `Config file ${source} exceeds 1 MB size limit (${info.size} bytes). Reduce the file or split into multiple entities.`,
3834
3835
  { code: `${errorCodePrefix}_file_too_large` }
3835
3836
  );
3836
3837
  }
3837
3838
  } catch (cause) {
3838
- if (cause instanceof chunkYULF6FPB_cjs.ConfigurationError) throw cause;
3839
+ if (cause instanceof chunk2YGIBOUH_cjs.ConfigurationError) throw cause;
3839
3840
  }
3840
3841
  }
3841
3842
  async function readDirSafe(dir, errorCodePrefix) {
@@ -3844,7 +3845,7 @@ async function readDirSafe(dir, errorCodePrefix) {
3844
3845
  } catch (cause) {
3845
3846
  const code = cause.code;
3846
3847
  if (code === "ENOENT") return null;
3847
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Failed to read ${dir}`, {
3848
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Failed to read ${dir}`, {
3848
3849
  code: `${errorCodePrefix}_dir_read_error`,
3849
3850
  cause
3850
3851
  });
@@ -3861,7 +3862,7 @@ function resolveEntryPath(entry, pattern, dir) {
3861
3862
  function splitFrontmatter(raw, source, errorCodePrefix) {
3862
3863
  const match = /^---\s*\n([\s\S]*?)\n---\s*(?:\n|$)/.exec(raw);
3863
3864
  if (match === null) {
3864
- throw new chunkYULF6FPB_cjs.ConfigurationError(
3865
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
3865
3866
  `Missing or malformed frontmatter in ${source} (expected \`---\` delimited block at file head)`,
3866
3867
  { code: `${errorCodePrefix}_missing_frontmatter` }
3867
3868
  );
@@ -3890,7 +3891,7 @@ function applyAggregateCap(sources, maxTotal) {
3890
3891
  }
3891
3892
  const remaining = maxTotal - totalBytes;
3892
3893
  if (remaining > 0) {
3893
- const { finalContent } = chunkUU7MAO2D_cjs.truncateWithMarker(s.content, remaining);
3894
+ const { finalContent } = chunkOKLYRPKL_cjs.truncateWithMarker(s.content, remaining);
3894
3895
  kept.push({ ...s, content: finalContent, truncated: true });
3895
3896
  totalBytes = maxTotal;
3896
3897
  } else {
@@ -3964,9 +3965,9 @@ var FileContextManager = class {
3964
3965
  this.lastScope = [...touchedFiles];
3965
3966
  const config = await loadContextConfig(this.cwd);
3966
3967
  const legacy = await loadSources(config, this.cwd);
3967
- const maxBytesPerFile = this.settings.maxBytesPerFile ?? chunkUU7MAO2D_cjs.DEFAULT_MAX_BYTES_PER_FILE;
3968
+ const maxBytesPerFile = this.settings.maxBytesPerFile ?? chunkOKLYRPKL_cjs.DEFAULT_MAX_BYTES_PER_FILE;
3968
3969
  const maxBytesTotal = this.settings.maxBytesTotal ?? DEFAULT_MAX_BYTES_TOTAL;
3969
- const discovered = await chunkUU7MAO2D_cjs.runDiscovery({
3970
+ const discovered = await chunkOKLYRPKL_cjs.runDiscovery({
3970
3971
  cwd: this.cwd,
3971
3972
  maxBytesPerFile,
3972
3973
  skipLegacyTheokitContext: true,
@@ -4035,7 +4036,7 @@ async function loadContextConfig(cwd) {
4035
4036
  });
4036
4037
  if (mdEntities.length > 0) {
4037
4038
  if (fs.existsSync(jsonPath)) {
4038
- chunkHECR7KF5_cjs.warnOnce(
4039
+ chunk3YYDHUNH_cjs.warnOnce(
4039
4040
  "context-both-present",
4040
4041
  "[theokit-sdk] both .theokit/context/ and .theokit/context.json detected \u2014 using markdown; remove context.json"
4041
4042
  );
@@ -4045,7 +4046,7 @@ async function loadContextConfig(cwd) {
4045
4046
  };
4046
4047
  }
4047
4048
  if (!fs.existsSync(jsonPath)) return { sources: [] };
4048
- chunkHECR7KF5_cjs.warnOnce(
4049
+ chunk3YYDHUNH_cjs.warnOnce(
4049
4050
  "context-json-deprecated",
4050
4051
  "[theokit-sdk] .theokit/context.json is deprecated; migrate to .theokit/context/<name>.md via theokit-migrate-config"
4051
4052
  );
@@ -4053,7 +4054,7 @@ async function loadContextConfig(cwd) {
4053
4054
  try {
4054
4055
  raw = await promises.readFile(jsonPath, "utf8");
4055
4056
  } catch (cause) {
4056
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Failed to read context config: ${jsonPath}`, {
4057
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Failed to read context config: ${jsonPath}`, {
4057
4058
  code: "context_read_error",
4058
4059
  cause
4059
4060
  });
@@ -4065,13 +4066,13 @@ function parseConfig(raw, configPath) {
4065
4066
  try {
4066
4067
  parsed = JSON.parse(raw);
4067
4068
  } catch (cause) {
4068
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Invalid JSON in context config: ${configPath}`, {
4069
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Invalid JSON in context config: ${configPath}`, {
4069
4070
  code: "context_json_invalid",
4070
4071
  cause
4071
4072
  });
4072
4073
  }
4073
4074
  if (!parsed || typeof parsed !== "object") {
4074
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Context config must be an object: ${configPath}`, {
4075
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Context config must be an object: ${configPath}`, {
4075
4076
  code: "context_config_shape"
4076
4077
  });
4077
4078
  }
@@ -4086,7 +4087,7 @@ function parseConfig(raw, configPath) {
4086
4087
  }
4087
4088
  function readSources(sourcesRaw, configPath) {
4088
4089
  if (!Array.isArray(sourcesRaw)) {
4089
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Context config sources must be an array: ${configPath}`, {
4090
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Context config sources must be an array: ${configPath}`, {
4090
4091
  code: "context_sources_shape"
4091
4092
  });
4092
4093
  }
@@ -4106,7 +4107,7 @@ async function loadSources(config, cwd) {
4106
4107
  continue;
4107
4108
  }
4108
4109
  const absolute = path.resolve(cwd, source.path);
4109
- if (!chunkUU7MAO2D_cjs.insideRoot(absolute, cwd)) {
4110
+ if (!chunkVKJ7V7EB_cjs.insideRoot(absolute, cwd)) {
4110
4111
  results.push({ ...source, status: "excluded", tokens: [] });
4111
4112
  continue;
4112
4113
  }
@@ -4184,7 +4185,7 @@ var PluginsManager = class {
4184
4185
  async refresh() {
4185
4186
  this.plugins = [];
4186
4187
  const pluginsRoot = path.join(this.cwd, ".theokit", "plugins");
4187
- const entries = await chunkBRHRQOJA_cjs.readWorkspaceDir(pluginsRoot, "plugins_read_error", "plugins directory");
4188
+ const entries = await chunk44IISBRZ_cjs.readWorkspaceDir(pluginsRoot, "plugins_read_error", "plugins directory");
4188
4189
  for (const entry of entries) {
4189
4190
  if (!entry.isDirectory()) continue;
4190
4191
  const folderName = entry.name;
@@ -4192,13 +4193,13 @@ var PluginsManager = class {
4192
4193
  const jsonPath = path.join(pluginsRoot, folderName, "plugin.json");
4193
4194
  const metadata = fs.existsSync(mdPath) ? await loadPluginManifestFromMarkdown(pluginsRoot, folderName) : await loadPluginManifestFromJson(jsonPath, folderName);
4194
4195
  if (fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4195
- chunkHECR7KF5_cjs.warnOnce(
4196
+ chunk3YYDHUNH_cjs.warnOnce(
4196
4197
  `plugin-${folderName}-both`,
4197
4198
  `[theokit-sdk] both ${folderName}/PLUGIN.md and ${folderName}/plugin.json detected \u2014 using markdown; remove plugin.json`
4198
4199
  );
4199
4200
  }
4200
4201
  if (!fs.existsSync(mdPath) && fs.existsSync(jsonPath)) {
4201
- chunkHECR7KF5_cjs.warnOnce(
4202
+ chunk3YYDHUNH_cjs.warnOnce(
4202
4203
  "plugin-json-deprecated",
4203
4204
  "[theokit-sdk] plugin.json manifests are deprecated; migrate to PLUGIN.md via theokit-migrate-config"
4204
4205
  );
@@ -4216,11 +4217,11 @@ var PluginsManager = class {
4216
4217
  const entry = metadata.entry;
4217
4218
  if (entry === void 0) return;
4218
4219
  const pluginRoot = path.join(this.cwd, ".theokit", "plugins", folderName);
4219
- const entryPath = chunkXA3TSBAH_cjs.safePathJoin(pluginRoot, entry);
4220
+ const entryPath = chunkYTO5BRBD_cjs.safePathJoin(pluginRoot, entry);
4220
4221
  try {
4221
4222
  await promises.readFile(entryPath, "utf8");
4222
4223
  } catch (cause) {
4223
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${metadata.name} entry file is missing: ${entry}`, {
4224
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${metadata.name} entry file is missing: ${entry}`, {
4224
4225
  code: "plugin_entry_missing",
4225
4226
  cause
4226
4227
  });
@@ -4229,7 +4230,7 @@ var PluginsManager = class {
4229
4230
  assertCloudRules() {
4230
4231
  if (!this.cloud) return;
4231
4232
  if (this.localPaths !== void 0 && this.localPaths.length > 0) {
4232
- throw new chunkYULF6FPB_cjs.ConfigurationError(
4233
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
4233
4234
  "Cloud agents reject local plugin paths \u2014 plugins must come from committed repo files",
4234
4235
  { code: "cloud_plugin_path_rejected" }
4235
4236
  );
@@ -4241,7 +4242,7 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
4241
4242
  try {
4242
4243
  raw = await promises.readFile(manifestPath, "utf8");
4243
4244
  } catch (cause) {
4244
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} is missing plugin.json`, {
4245
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} is missing plugin.json`, {
4245
4246
  code: "plugin_missing_manifest",
4246
4247
  cause
4247
4248
  });
@@ -4250,13 +4251,13 @@ async function loadPluginManifestFromJson(manifestPath, folderName) {
4250
4251
  try {
4251
4252
  parsed = JSON.parse(raw);
4252
4253
  } catch (cause) {
4253
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} manifest is invalid JSON`, {
4254
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} manifest is invalid JSON`, {
4254
4255
  code: "plugin_manifest_invalid",
4255
4256
  cause
4256
4257
  });
4257
4258
  }
4258
4259
  if (!parsed || typeof parsed !== "object") {
4259
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} manifest must be an object`, {
4260
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} manifest must be an object`, {
4260
4261
  code: "plugin_manifest_shape"
4261
4262
  });
4262
4263
  }
@@ -4275,7 +4276,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
4275
4276
  try {
4276
4277
  raw = await promises.readFile(mdPath, "utf8");
4277
4278
  } catch (cause) {
4278
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} is missing PLUGIN.md`, {
4279
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} is missing PLUGIN.md`, {
4279
4280
  code: "plugin_missing_manifest",
4280
4281
  cause
4281
4282
  });
@@ -4290,7 +4291,7 @@ async function loadPluginManifestFromMarkdown(pluginsRoot, folderName) {
4290
4291
  });
4291
4292
  const entity = entities.find((e) => e.slug === "PLUGIN");
4292
4293
  if (entity === void 0) {
4293
- throw new chunkYULF6FPB_cjs.ConfigurationError(`Plugin ${folderName} PLUGIN.md not parseable`, {
4294
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`Plugin ${folderName} PLUGIN.md not parseable`, {
4294
4295
  code: "plugin_missing_manifest"
4295
4296
  });
4296
4297
  }
@@ -4564,7 +4565,7 @@ function assertValidThresholds(soft, hard) {
4564
4565
  ["hardThreshold", hard]
4565
4566
  ]) {
4566
4567
  if (!Number.isInteger(value) || value < 1) {
4567
- throw new chunkYULF6FPB_cjs.ConfigurationError(
4568
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
4568
4569
  `doomLoop.${label} must be a positive integer (received ${value}).`,
4569
4570
  { code: "invalid_doom_loop_threshold" }
4570
4571
  );
@@ -4877,9 +4878,9 @@ async function safeListTools(client, serverName, sink) {
4877
4878
  } catch (cause) {
4878
4879
  const message = cause instanceof Error ? cause.message : String(cause);
4879
4880
  const server = serverName ?? "unknown";
4880
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] mcp listTools failed (server=${server}): ${message}
4881
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] mcp listTools failed (server=${server}): ${message}
4881
4882
  `);
4882
- chunkKCQUYQ3V_cjs.emitRunEvent(sink, { type: "mcp_server_failed", serverName: server, message });
4883
+ chunk6DCTL32L_cjs.emitRunEvent(sink, { type: "mcp_server_failed", serverName: server, message });
4883
4884
  return [];
4884
4885
  }
4885
4886
  }
@@ -4947,7 +4948,7 @@ function emitLlmMetrics(inputs, result, startAt) {
4947
4948
  inputs.telemetry?.recordHistogram(HISTOGRAM_NAMES.LLM_USAGE_MISSING, 1, {
4948
4949
  provider: inputs.llm.name
4949
4950
  });
4950
- chunkZHPET3LZ_cjs.diag(
4951
+ chunkSXSPMRSV_cjs.diag(
4951
4952
  `[theokit-sdk] llm usage missing from ${inputs.llm.name} finish \u2014 budget may undercount
4952
4953
  `
4953
4954
  );
@@ -5243,7 +5244,7 @@ function coerceArgsToSchema(args, schema) {
5243
5244
  }
5244
5245
 
5245
5246
  // src/tool-error.ts
5246
- var ToolError = class extends chunkYULF6FPB_cjs.TheokitAgentError {
5247
+ var ToolError = class extends chunk2YGIBOUH_cjs.TheokitAgentError {
5247
5248
  name = "ToolError";
5248
5249
  /** The error content surfaced to the model: a string, or text/image blocks. */
5249
5250
  content;
@@ -5437,7 +5438,7 @@ function raceToolExecution(exec, opts) {
5437
5438
  // src/internal/agent-loop/tool-dispatch.ts
5438
5439
  async function dispatchTools(inputs, tools, toolCalls, events, parentSpan) {
5439
5440
  const maxConcurrent = inputs.maxConcurrentTools ?? 4;
5440
- return chunkOEFFPR2S_cjs.mapWithConcurrency(
5441
+ return chunkKNZU4YO5_cjs.mapWithConcurrency(
5441
5442
  toolCalls,
5442
5443
  maxConcurrent,
5443
5444
  (call) => dispatchSingleCall(inputs, tools, call, events, parentSpan)
@@ -5465,7 +5466,7 @@ async function dispatchSingleCall(inputs, tools, call, events, parentSpan) {
5465
5466
  toolSpan?.end();
5466
5467
  return fileVeto;
5467
5468
  }
5468
- chunkKCQUYQ3V_cjs.emitRunEvent(inputs.runEventSink, {
5469
+ chunk6DCTL32L_cjs.emitRunEvent(inputs.runEventSink, {
5469
5470
  type: "tool_progress",
5470
5471
  toolName: workingCall.name,
5471
5472
  toolCallId: callId
@@ -5496,7 +5497,7 @@ function applyRepairAndExtractCall(tools, call) {
5496
5497
  function vetoFromForkWhitelist(inputs, call, callId, events) {
5497
5498
  const whitelistDecision = chunkVJ26EKGJ_cjs.checkToolWhitelist(call.name);
5498
5499
  if (whitelistDecision.allowed) return void 0;
5499
- chunkKCQUYQ3V_cjs.emitRunEvent(inputs.runEventSink, {
5500
+ chunk6DCTL32L_cjs.emitRunEvent(inputs.runEventSink, {
5500
5501
  type: "permission_denied",
5501
5502
  toolName: call.name,
5502
5503
  toolCallId: callId,
@@ -5541,7 +5542,7 @@ async function vetoFromPluginPreHook(inputs, call, callId, events) {
5541
5542
  ...inputs.permissionMode !== void 0 ? { permissionMode: inputs.permissionMode } : {}
5542
5543
  });
5543
5544
  if (pluginVeto === void 0) return void 0;
5544
- chunkKCQUYQ3V_cjs.emitRunEvent(inputs.runEventSink, {
5545
+ chunk6DCTL32L_cjs.emitRunEvent(inputs.runEventSink, {
5545
5546
  type: "permission_denied",
5546
5547
  toolName: call.name,
5547
5548
  toolCallId: callId,
@@ -5570,7 +5571,7 @@ async function vetoFromFileHookPreDecision(inputs, call, callId, events) {
5570
5571
  runId: inputs.runId
5571
5572
  });
5572
5573
  if (!preDecision.blocked) return void 0;
5573
- chunkKCQUYQ3V_cjs.emitRunEvent(inputs.runEventSink, {
5574
+ chunk6DCTL32L_cjs.emitRunEvent(inputs.runEventSink, {
5574
5575
  type: "permission_denied",
5575
5576
  toolName: call.name,
5576
5577
  toolCallId: callId,
@@ -5671,7 +5672,7 @@ function finalizeSpanAndPostHook(inputs, call, callId, result, events, toolSpan)
5671
5672
  agentId: inputs.agentId,
5672
5673
  runId: inputs.runId
5673
5674
  }).catch((err) => {
5674
- chunkZHPET3LZ_cjs.diag(
5675
+ chunkSXSPMRSV_cjs.diag(
5675
5676
  `[theokit-sdk] postToolUse hook error (swallowed): ${err instanceof Error ? err.message : String(err)}
5676
5677
  `
5677
5678
  );
@@ -5690,7 +5691,7 @@ async function emitToolLifecycleDelta(inputs, update) {
5690
5691
  try {
5691
5692
  await inputs.onDelta({ update });
5692
5693
  } catch (err) {
5693
- chunkZHPET3LZ_cjs.diag(
5694
+ chunkSXSPMRSV_cjs.diag(
5694
5695
  `[theokit-sdk] onDelta tool-lifecycle emit error (swallowed): ${err instanceof Error ? err.message : String(err)}
5695
5696
  `
5696
5697
  );
@@ -5702,7 +5703,7 @@ async function safeEmitToolHook(callback, event) {
5702
5703
  await callback(event);
5703
5704
  } catch (cause) {
5704
5705
  const msg = cause instanceof Error ? cause.message : String(cause);
5705
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] tool lifecycle hook threw: ${msg}
5706
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] tool lifecycle hook threw: ${msg}
5706
5707
  `);
5707
5708
  }
5708
5709
  }
@@ -5769,7 +5770,7 @@ function applyToolResultGuard(parts, opts) {
5769
5770
  (p) => (
5770
5771
  // SE7 — guard the TEXT of a tool result (string or the text blocks of a
5771
5772
  // structured content); image blocks pass through untouched.
5772
- p.type === "tool_result" ? { ...p, content: chunkQFFNMJAS_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
5773
+ p.type === "tool_result" ? { ...p, content: chunkN6NUMXAJ_cjs.renderToolResultContentText(p.content, (t) => guardText(t, opts)) } : p
5773
5774
  )
5774
5775
  );
5775
5776
  }
@@ -5964,7 +5965,7 @@ function catalogCostFallback(provider, cleanedModel) {
5964
5965
  const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
5965
5966
  if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
5966
5967
  for (const key of candidates) {
5967
- const info = chunkGLEKLAUW_cjs.getCatalogModelInfo(key);
5968
+ const info = chunkT6ZCG5AP_cjs.getCatalogModelInfo(key);
5968
5969
  const cost = info?.cost;
5969
5970
  if (cost === void 0) continue;
5970
5971
  const [prov, ...modelParts] = key.split("/");
@@ -5976,7 +5977,7 @@ function catalogCostFallback(provider, cleanedModel) {
5976
5977
  ...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
5977
5978
  ...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
5978
5979
  // M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
5979
- pricingVersion: chunkGLEKLAUW_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
5980
+ pricingVersion: chunkT6ZCG5AP_cjs.isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
5980
5981
  };
5981
5982
  }
5982
5983
  return void 0;
@@ -6429,15 +6430,15 @@ var FallbackLlmClient = class {
6429
6430
  let lastError;
6430
6431
  for (const client of this.clients) {
6431
6432
  if (signal.aborted) throw abortError(signal);
6432
- const attempt = await chunkQFFNMJAS_cjs.tryFirstEvent(client, request, signal, true);
6433
+ const attempt = await chunkN6NUMXAJ_cjs.tryFirstEvent(client, request, signal, true);
6433
6434
  if (attempt.kind === "handshake_error") {
6434
6435
  lastError = attempt.error;
6435
6436
  continue;
6436
6437
  }
6437
- return yield* chunkQFFNMJAS_cjs.relayStream(attempt.generator, attempt.firstResult);
6438
+ return yield* chunkN6NUMXAJ_cjs.relayStream(attempt.generator, attempt.firstResult);
6438
6439
  }
6439
6440
  if (lastError !== void 0) throw lastError;
6440
- throw new chunkYULF6FPB_cjs.NetworkError("FallbackLlmClient has no providers configured", {
6441
+ throw new chunk2YGIBOUH_cjs.NetworkError("FallbackLlmClient has no providers configured", {
6441
6442
  code: "fallback_empty_chain"
6442
6443
  });
6443
6444
  }
@@ -6460,7 +6461,7 @@ function reconnectDelay(attempt) {
6460
6461
  return ms <= 0 ? Promise.resolve() : new Promise((resolve) => setTimeout(resolve, ms));
6461
6462
  }
6462
6463
  function mcpTimeoutError(name, timeoutMs) {
6463
- return new chunkYULF6FPB_cjs.NetworkError(`MCP ${name} request timed out after ${timeoutMs}ms`, {
6464
+ return new chunk2YGIBOUH_cjs.NetworkError(`MCP ${name} request timed out after ${timeoutMs}ms`, {
6464
6465
  code: "mcp_timeout"
6465
6466
  });
6466
6467
  }
@@ -6543,7 +6544,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6543
6544
  child.stdin.on("error", () => void 0);
6544
6545
  child.on("error", () => {
6545
6546
  this.rejectAllPending(
6546
- new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} process crashed`, { code: "mcp_crashed" })
6547
+ new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} process crashed`, { code: "mcp_crashed" })
6547
6548
  );
6548
6549
  });
6549
6550
  child.on("exit", () => {
@@ -6551,7 +6552,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6551
6552
  this.child = void 0;
6552
6553
  this.dropped = true;
6553
6554
  this.rejectAllPending(
6554
- new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6555
+ new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6555
6556
  );
6556
6557
  });
6557
6558
  }
@@ -6579,7 +6580,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6579
6580
  if (this.child !== void 0) return Promise.resolve();
6580
6581
  if (!this.dropped) {
6581
6582
  return Promise.reject(
6582
- new chunkYULF6FPB_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6583
+ new chunk2YGIBOUH_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6583
6584
  );
6584
6585
  }
6585
6586
  this.reconnectPromise ??= this.reconnect().finally(() => {
@@ -6600,13 +6601,13 @@ var StdioMcpClient = class extends BaseMcpClient {
6600
6601
  lastErr = err;
6601
6602
  }
6602
6603
  }
6603
- throw new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} reconnect exhausted`, {
6604
+ throw new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} reconnect exhausted`, {
6604
6605
  code: "mcp_disconnected",
6605
6606
  ...lastErr instanceof Error ? { cause: lastErr } : {}
6606
6607
  });
6607
6608
  }
6608
6609
  async close() {
6609
- this.rejectAllPending(new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} closed`, { code: "mcp_closed" }));
6610
+ this.rejectAllPending(new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} closed`, { code: "mcp_closed" }));
6610
6611
  const child = this.child;
6611
6612
  this.child = void 0;
6612
6613
  this.dropped = false;
@@ -6625,7 +6626,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6625
6626
  if (this.buffer.length > MAX_STDIO_BUFFER_BYTES) {
6626
6627
  this.buffer = "";
6627
6628
  this.rejectAllPending(
6628
- new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} exceeded stdout buffer limit`, {
6629
+ new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} exceeded stdout buffer limit`, {
6629
6630
  code: "mcp_buffer_overflow"
6630
6631
  })
6631
6632
  );
@@ -6660,7 +6661,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6660
6661
  if (child !== void 0) return this.send(child, method, params);
6661
6662
  if (this.dropped) return this.reconnectAndRequest(method, params);
6662
6663
  return Promise.reject(
6663
- new chunkYULF6FPB_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6664
+ new chunk2YGIBOUH_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" })
6664
6665
  );
6665
6666
  }
6666
6667
  /** M2 #59 — reconnect a dropped client, then send. Separate async path so the
@@ -6669,7 +6670,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6669
6670
  await this.ensureConnected();
6670
6671
  const child = this.child;
6671
6672
  if (child === void 0) {
6672
- throw new chunkYULF6FPB_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" });
6673
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(`MCP ${this.name} is not initialized`, { code: "mcp_not_init" });
6673
6674
  }
6674
6675
  return this.send(child, method, params);
6675
6676
  }
@@ -6686,7 +6687,7 @@ var StdioMcpClient = class extends BaseMcpClient {
6686
6687
  this.child = void 0;
6687
6688
  this.dropped = true;
6688
6689
  this.rejectAllPending(
6689
- new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6690
+ new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} disconnected`, { code: "mcp_disconnected" })
6690
6691
  );
6691
6692
  }, this.timeoutMs);
6692
6693
  this.pending.set(id, { resolve, reject, timer });
@@ -6764,7 +6765,7 @@ var HttpMcpClient = class extends BaseMcpClient {
6764
6765
  if (payload === "") continue;
6765
6766
  return JSON.parse(payload);
6766
6767
  }
6767
- throw new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} returned an event stream with no data payload`, {
6768
+ throw new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} returned an event stream with no data payload`, {
6768
6769
  code: "mcp_http_error"
6769
6770
  });
6770
6771
  }
@@ -6792,7 +6793,7 @@ var HttpMcpClient = class extends BaseMcpClient {
6792
6793
  throw cause;
6793
6794
  }
6794
6795
  if (!response.ok) {
6795
- throw new chunkYULF6FPB_cjs.NetworkError(`MCP ${this.name} returned ${response.status}`, {
6796
+ throw new chunk2YGIBOUH_cjs.NetworkError(`MCP ${this.name} returned ${response.status}`, {
6796
6797
  code: "mcp_http_error"
6797
6798
  });
6798
6799
  }
@@ -6808,14 +6809,14 @@ var HttpMcpClient = class extends BaseMcpClient {
6808
6809
  function resolveMcpCwd(configCwd) {
6809
6810
  if (configCwd === void 0) return process.cwd();
6810
6811
  if (path.isAbsolute(configCwd)) return configCwd;
6811
- return chunkXA3TSBAH_cjs.safePathJoin(process.cwd(), configCwd);
6812
+ return chunkYTO5BRBD_cjs.safePathJoin(process.cwd(), configCwd);
6812
6813
  }
6813
6814
 
6814
6815
  // src/internal/providers/register-plugin-providers.ts
6815
6816
  function registerPluginProviderProfiles(entries) {
6816
6817
  let registered2 = 0;
6817
6818
  for (const entry of entries) {
6818
- chunkGLEKLAUW_cjs.registerProvider(entry.profile);
6819
+ chunkT6ZCG5AP_cjs.registerProvider(entry.profile);
6819
6820
  registered2 += 1;
6820
6821
  }
6821
6822
  return registered2;
@@ -6895,7 +6896,7 @@ function applyPersonalityFilter(exposedTools, whitelist, opts) {
6895
6896
  if (exposedSet.has(name)) continue;
6896
6897
  const hint = suggestClosest(name, exposedSet);
6897
6898
  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)`;
6898
- chunkHECR7KF5_cjs.warnOnce(
6899
+ chunk3YYDHUNH_cjs.warnOnce(
6899
6900
  `personality-tool-missing|${opts?.agentId ?? "?"}|${opts?.personalityName ?? "?"}|${name}`,
6900
6901
  message
6901
6902
  );
@@ -7004,25 +7005,25 @@ function createRealLocalRun(options) {
7004
7005
  }
7005
7006
  var pluginProvidersAnnounced = false;
7006
7007
  function resolveRunProvider(options) {
7007
- chunkGLEKLAUW_cjs.registerBuiltins();
7008
+ chunkT6ZCG5AP_cjs.registerBuiltins();
7008
7009
  const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
7009
7010
  const registered2 = registerPluginProviderProfiles(profiles);
7010
7011
  if (registered2 > 0 && !pluginProvidersAnnounced) {
7011
7012
  pluginProvidersAnnounced = true;
7012
7013
  const names = profiles.map((e) => e.profile.name).join(", ");
7013
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] registered ${registered2} plugin provider profile(s): ${names}
7014
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] registered ${registered2} plugin provider profile(s): ${names}
7014
7015
  `);
7015
7016
  }
7016
7017
  const parsedModel = chunkVYHJZVL5_cjs.parseModelId(options.model?.id);
7017
- const modelInferredProvider = parsedModel.provider !== void 0 && chunkGLEKLAUW_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
7018
- const keyInferredProvider = chunkQFFNMJAS_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
7019
- const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkQFFNMJAS_cjs.detectPrimaryProvider();
7018
+ const modelInferredProvider = parsedModel.provider !== void 0 && chunkT6ZCG5AP_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
7019
+ const keyInferredProvider = chunkN6NUMXAJ_cjs.inferProviderFromApiKey(options.agentOptions.apiKey);
7020
+ const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? chunkN6NUMXAJ_cjs.detectPrimaryProvider();
7020
7021
  const effectiveModelId = modelInferredProvider !== void 0 && modelInferredProvider === primary ? parsedModel.name : options.model?.id ?? "claude-sonnet-4-6";
7021
7022
  return { primary, effectiveModelId };
7022
7023
  }
7023
7024
  function mergeExplicitApiKey(pools, primary, apiKey) {
7024
7025
  if (apiKey === void 0 || apiKey.length === 0) return pools;
7025
- if (chunkQFFNMJAS_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
7026
+ if (chunkN6NUMXAJ_cjs.isFixtureApiKey(apiKey) || apiKey === LOCAL_RUNTIME_MOCK_KEY) return pools;
7026
7027
  const existing = pools?.[primary];
7027
7028
  if (existing !== void 0 && existing.length > 0) return pools;
7028
7029
  return { ...pools ?? {}, [primary]: [apiKey] };
@@ -7030,7 +7031,7 @@ function mergeExplicitApiKey(pools, primary, apiKey) {
7030
7031
  function buildLoopInputs(options, runId, userText, userImages) {
7031
7032
  const maxIterations = options.sendOptions.maxIterations;
7032
7033
  if (maxIterations !== void 0 && (!Number.isInteger(maxIterations) || maxIterations < 1)) {
7033
- throw new chunkYULF6FPB_cjs.ConfigurationError(
7034
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
7034
7035
  `SendOptions.maxIterations must be a positive integer, got ${maxIterations}`,
7035
7036
  { code: "invalid_max_iterations" }
7036
7037
  );
@@ -7045,14 +7046,14 @@ function buildLoopInputs(options, runId, userText, userImages) {
7045
7046
  const credentialPoolStrategy = options.agentOptions.providers?.credentialPoolStrategy;
7046
7047
  const extractToolCallsFromContent = options.agentOptions.providers?.routes?.[0]?.extractToolCallsFromContent;
7047
7048
  const rateLimitSink = options.sendOptions.onRunEvent;
7048
- const chain = chunkQFFNMJAS_cjs.resolveProviderChain({
7049
+ const chain = chunkN6NUMXAJ_cjs.resolveProviderChain({
7049
7050
  primary,
7050
7051
  ...fallback !== void 0 ? { fallback } : {},
7051
7052
  ...apiKeys !== void 0 ? { apiKeys } : {},
7052
7053
  ...credentialPoolStrategy !== void 0 ? { credentialPoolStrategy } : {},
7053
7054
  ...extractToolCallsFromContent === true ? { extractToolCallsFromContent: true } : {},
7054
7055
  ...rateLimitSink !== void 0 ? {
7055
- onRateLimit: (info) => chunkKCQUYQ3V_cjs.emitRunEvent(rateLimitSink, { type: "rate_limit", ...info })
7056
+ onRateLimit: (info) => chunk6DCTL32L_cjs.emitRunEvent(rateLimitSink, { type: "rate_limit", ...info })
7056
7057
  } : {}
7057
7058
  });
7058
7059
  const llm = chain.length === 1 ? chain[0] : new FallbackLlmClient(chain);
@@ -7327,7 +7328,7 @@ function buildRealRunOptions(args) {
7327
7328
  };
7328
7329
  }
7329
7330
  async function createFixtureRunHelper(args) {
7330
- const sessionMessages = chunkFAUKVJCC_cjs.getSessionMessages(args.inputs.agentId);
7331
+ const sessionMessages = chunk3BKWFISQ_cjs.getSessionMessages(args.inputs.agentId);
7331
7332
  const projectMcpServers = args.inputs.settingSourcesIncludeProject ? await readProjectMcpServers(args.inputs.workspaceCwd) : {};
7332
7333
  return createLocalRun({
7333
7334
  agentId: args.inputs.agentId,
@@ -7346,7 +7347,7 @@ async function createFixtureRunHelper(args) {
7346
7347
  }
7347
7348
  async function dispatchLocalRun(args) {
7348
7349
  const apiKey = resolveApiKey(args.inputs.options.apiKey);
7349
- if (chunkQFFNMJAS_cjs.shouldUseRealLocalRuntime(apiKey)) {
7350
+ if (chunkN6NUMXAJ_cjs.shouldUseRealLocalRuntime(apiKey)) {
7350
7351
  return createRealLocalRun(
7351
7352
  buildRealRunOptions({
7352
7353
  inputs: args.inputs,
@@ -7381,20 +7382,20 @@ async function readProjectMcpServers(cwd) {
7381
7382
 
7382
7383
  // src/internal/local-agent/local-agent-invalidate.ts
7383
7384
  async function applyDeferredInvalidation(agentId, pending, refresh) {
7384
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] applying deferred cache invalidation (${agentId}): ${pending.reason}
7385
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] applying deferred cache invalidation (${agentId}): ${pending.reason}
7385
7386
  `);
7386
7387
  try {
7387
7388
  await refresh();
7388
7389
  } catch (err) {
7389
7390
  const msg = err instanceof Error ? err.message : String(err);
7390
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] invalidateCache reload failed (continuing): ${msg}
7391
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] invalidateCache reload failed (continuing): ${msg}
7391
7392
  `);
7392
7393
  }
7393
7394
  }
7394
7395
  async function invalidateCacheImpl(agentId, reason, options, disposed, dispose, setPending) {
7395
7396
  if (disposed) return;
7396
7397
  if (options.applyNow === true) {
7397
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] invalidateCache applyNow disposing agent (${agentId}): ${reason}
7398
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] invalidateCache applyNow disposing agent (${agentId}): ${reason}
7398
7399
  `);
7399
7400
  await dispose();
7400
7401
  return;
@@ -7455,7 +7456,7 @@ var LiveAgentRegistry = class {
7455
7456
  const existing = this.#agents.get(id);
7456
7457
  if (existing !== void 0 && existing.agent !== agent) {
7457
7458
  void existing.agent.dispose().catch(() => {
7458
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] dispose during overwrite failed (${id})
7459
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] dispose during overwrite failed (${id})
7459
7460
  `);
7460
7461
  });
7461
7462
  }
@@ -7559,7 +7560,7 @@ var LiveAgentRegistry = class {
7559
7560
  await agent.dispose();
7560
7561
  } catch (cause) {
7561
7562
  const msg = cause instanceof Error ? cause.message : String(cause);
7562
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] dispose during eviction failed (${id}): ${msg}
7563
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] dispose during eviction failed (${id}): ${msg}
7563
7564
  `);
7564
7565
  }
7565
7566
  if (this.#onEvict !== void 0) {
@@ -7567,7 +7568,7 @@ var LiveAgentRegistry = class {
7567
7568
  this.#onEvict(id, reason);
7568
7569
  } catch (cause) {
7569
7570
  const msg = cause instanceof Error ? cause.message : String(cause);
7570
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] onEvict listener threw (${id}): ${msg}
7571
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] onEvict listener threw (${id}): ${msg}
7571
7572
  `);
7572
7573
  }
7573
7574
  }
@@ -7583,7 +7584,7 @@ async function acquireLeaseIfPossible(store, agentId) {
7583
7584
  await a.call(store, agentId);
7584
7585
  } catch (err) {
7585
7586
  if (err instanceof Error && err.name === "SessionBusyError") throw err;
7586
- chunkZHPET3LZ_cjs.diag(
7587
+ chunkSXSPMRSV_cjs.diag(
7587
7588
  `[theokit-sdk] writer lease unavailable for ${agentId} (${err instanceof Error ? err.message : String(err)}) \u2014 proceeding without single-writer protection
7588
7589
  `
7589
7590
  );
@@ -7602,16 +7603,16 @@ async function disposeLocalAgentSession(agent) {
7602
7603
  agent.lifecycleAbortController.abort();
7603
7604
  await chunkYLQQX5W2_cjs.withCwdMutex(`agent-send:${agent.agentId}`, () => Promise.resolve());
7604
7605
  disposeSessionMcpClients(agent.agentId);
7605
- await chunkFAUKVJCC_cjs.flushSessionWrites();
7606
+ await chunk3BKWFISQ_cjs.flushSessionWrites();
7606
7607
  await flushRegistrySaves(agent.workspaceCwd);
7607
7608
  await disposeSessionStore(agent.sessionStore);
7608
- chunkFAUKVJCC_cjs.discardSession(agent.workspaceCwd, agent.agentId);
7609
+ chunk3BKWFISQ_cjs.discardSession(agent.workspaceCwd, agent.agentId);
7609
7610
  }
7610
7611
  async function reloadLocalAgent(agent) {
7611
7612
  if (agent.context !== void 0) await agent.context.refresh();
7612
7613
  if (agent.skillsManager !== void 0) await agent.skillsManager.refresh();
7613
7614
  if (agent.pluginsManager !== void 0) await agent.pluginsManager.refresh();
7614
- return await chunkX2YQP452_cjs.loadSubagents(
7615
+ return await chunkRTLUZKDL_cjs.loadSubagents(
7615
7616
  agent.workspaceCwd,
7616
7617
  agent.settingSourcesIncludeProject,
7617
7618
  agent.options.agents
@@ -7619,12 +7620,12 @@ async function reloadLocalAgent(agent) {
7619
7620
  }
7620
7621
  async function persistActiveMemoryTranscript(cwd, transcript) {
7621
7622
  try {
7622
- const dir = path.join(chunkGH52NOCL_cjs.memoryDir(cwd), "transcripts", "active-memory");
7623
+ const dir = path.join(chunkEQMLJ52C_cjs.memoryDir(cwd), "transcripts", "active-memory");
7623
7624
  const file = path.join(dir, `${transcript.runId}.json`);
7624
- await chunkNETYW4V3_cjs.atomicWriteJson(file, transcript);
7625
+ await chunk2CFEET3Y_cjs.atomicWriteJson(file, transcript);
7625
7626
  } catch (cause) {
7626
7627
  const message = cause instanceof Error ? cause.message : String(cause);
7627
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] active-memory transcript persist failed: ${message}
7628
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] active-memory transcript persist failed: ${message}
7628
7629
  `);
7629
7630
  }
7630
7631
  }
@@ -7745,7 +7746,7 @@ async function searchOnce(args, cfg, query, started) {
7745
7746
  return { summary, durationMs: Date.now() - started, status: "ok", hits };
7746
7747
  } catch (cause) {
7747
7748
  const message = cause instanceof Error ? cause.message : String(cause);
7748
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] active-memory recall failed: ${message}
7749
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] active-memory recall failed: ${message}
7749
7750
  `);
7750
7751
  return { summary: void 0, durationMs: Date.now() - started, status: "error", hits: [] };
7751
7752
  }
@@ -7865,7 +7866,7 @@ var azureOpenAiMemoryEmbeddingProviderAdapter = {
7865
7866
  transport: "remote",
7866
7867
  authProviderId: "azure-openai",
7867
7868
  autoSelectPriority: 25,
7868
- create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
7869
+ create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
7869
7870
  {
7870
7871
  id: "azure-openai",
7871
7872
  defaultBaseUrl: "https://your-resource.openai.azure.com",
@@ -7901,7 +7902,7 @@ var cohereMemoryEmbeddingProviderAdapter = {
7901
7902
  transport: "remote",
7902
7903
  authProviderId: "cohere",
7903
7904
  autoSelectPriority: 30,
7904
- create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
7905
+ create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
7905
7906
  {
7906
7907
  id: "cohere",
7907
7908
  defaultBaseUrl: "https://api.cohere.com",
@@ -7947,7 +7948,7 @@ var deepinfraMemoryEmbeddingProviderAdapter = {
7947
7948
  transport: "remote",
7948
7949
  authProviderId: "deepinfra",
7949
7950
  autoSelectPriority: 13,
7950
- create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
7951
+ create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
7951
7952
  {
7952
7953
  id: "deepinfra",
7953
7954
  defaultBaseUrl: "https://api.deepinfra.com",
@@ -7973,7 +7974,7 @@ var geminiMemoryEmbeddingProviderAdapter = {
7973
7974
  transport: "remote",
7974
7975
  authProviderId: "gemini",
7975
7976
  autoSelectPriority: 30,
7976
- create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
7977
+ create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
7977
7978
  {
7978
7979
  id: "gemini",
7979
7980
  defaultBaseUrl: "https://generativelanguage.googleapis.com",
@@ -8001,7 +8002,7 @@ var jinaMemoryEmbeddingProviderAdapter = {
8001
8002
  transport: "remote",
8002
8003
  authProviderId: "jina",
8003
8004
  autoSelectPriority: 35,
8004
- create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8005
+ create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
8005
8006
  {
8006
8007
  id: "jina",
8007
8008
  defaultBaseUrl: "https://api.jina.ai",
@@ -8024,7 +8025,7 @@ var mistralMemoryEmbeddingProviderAdapter = {
8024
8025
  transport: "remote",
8025
8026
  authProviderId: "mistral",
8026
8027
  autoSelectPriority: 18,
8027
- create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8028
+ create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
8028
8029
  {
8029
8030
  id: "mistral",
8030
8031
  defaultBaseUrl: "https://api.mistral.ai",
@@ -8066,7 +8067,7 @@ var ollamaMemoryEmbeddingProviderAdapter = {
8066
8067
  autoSelectPriority: 10,
8067
8068
  create: (options) => {
8068
8069
  const apiKey = options.apiKey ?? process.env.OLLAMA_API_KEY ?? OLLAMA_LOCAL_SENTINEL_KEY;
8069
- return chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8070
+ return chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
8070
8071
  {
8071
8072
  id: "ollama",
8072
8073
  defaultBaseUrl: "http://localhost:11434",
@@ -8093,7 +8094,7 @@ var openAiMemoryEmbeddingProviderAdapter = {
8093
8094
  transport: "remote",
8094
8095
  authProviderId: "openai",
8095
8096
  autoSelectPriority: 20,
8096
- create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8097
+ create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
8097
8098
  {
8098
8099
  id: "openai",
8099
8100
  defaultBaseUrl: "https://api.openai.com",
@@ -8120,7 +8121,7 @@ var openRouterMemoryEmbeddingProviderAdapter = {
8120
8121
  transport: "remote",
8121
8122
  authProviderId: "openrouter",
8122
8123
  autoSelectPriority: 15,
8123
- create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8124
+ create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
8124
8125
  {
8125
8126
  id: "openrouter",
8126
8127
  defaultBaseUrl: "https://openrouter.ai/api",
@@ -8148,7 +8149,7 @@ var voyageMemoryEmbeddingProviderAdapter = {
8148
8149
  transport: "remote",
8149
8150
  authProviderId: "voyage",
8150
8151
  autoSelectPriority: 14,
8151
- create: (options) => chunk7PESI6YD_cjs.createOpenAiCompatibleRuntime(
8152
+ create: (options) => chunkADVZIC43_cjs.createOpenAiCompatibleRuntime(
8152
8153
  {
8153
8154
  id: "voyage",
8154
8155
  defaultBaseUrl: "https://api.voyageai.com",
@@ -8249,7 +8250,7 @@ function createMemorySearchTool(opts) {
8249
8250
  };
8250
8251
  }
8251
8252
  function createMemoryGetTool(opts) {
8252
- const memoryRoot = path.resolve(chunkGH52NOCL_cjs.memoryDir(opts.cwd));
8253
+ const memoryRoot = path.resolve(chunkEQMLJ52C_cjs.memoryDir(opts.cwd));
8253
8254
  return {
8254
8255
  name: "memory_get",
8255
8256
  description: GET_DESCRIPTION,
@@ -8260,7 +8261,7 @@ function createMemoryGetTool(opts) {
8260
8261
  const lines = readNumber(input.lines);
8261
8262
  const resolved = path.resolve(memoryRoot, relPath);
8262
8263
  if (!isPathInside(memoryRoot, resolved)) {
8263
- throw new chunkYULF6FPB_cjs.ConfigurationError(
8264
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
8264
8265
  `memory_get rejected path that escapes memory root: ${relPath}`,
8265
8266
  { code: "memory_path_escapes_root" }
8266
8267
  );
@@ -8280,7 +8281,7 @@ function readString(value, errorIfMissing, allowUndefined = false) {
8280
8281
  if (typeof value === "string") return value;
8281
8282
  if (allowUndefined && (value === void 0 || value === null)) return "";
8282
8283
  if (errorIfMissing !== void 0) {
8283
- throw new chunkYULF6FPB_cjs.ConfigurationError(errorIfMissing, { code: "memory_tool_bad_args" });
8284
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(errorIfMissing, { code: "memory_tool_bad_args" });
8284
8285
  }
8285
8286
  return "";
8286
8287
  }
@@ -8314,8 +8315,7 @@ function capByTotalChars(hits, maxTotalChars) {
8314
8315
  return { hits: kept, truncated: false };
8315
8316
  }
8316
8317
  function isPathInside(root, candidate) {
8317
- const normalizedRoot = root.endsWith("/") ? root : `${root}/`;
8318
- return candidate === root || candidate.startsWith(normalizedRoot);
8318
+ return chunkVKJ7V7EB_cjs.atOrInsideRoot(candidate, root);
8319
8319
  }
8320
8320
 
8321
8321
  // src/internal/local-agent/local-agent-memory.ts
@@ -8356,7 +8356,7 @@ var LocalAgentMemory = class {
8356
8356
  const openOpts = { cwd: this.workspaceCwd };
8357
8357
  if (embedding !== void 0) openOpts.embedding = embedding;
8358
8358
  if (cfg?.backend !== void 0) openOpts.backend = cfg.backend;
8359
- this.index = await chunkGH52NOCL_cjs.IndexManager.open(openOpts);
8359
+ this.index = await chunkEQMLJ52C_cjs.IndexManager.open(openOpts);
8360
8360
  await this.index.sync();
8361
8361
  this.toolsCache = [
8362
8362
  createMemorySearchTool({ index: this.index }),
@@ -8371,7 +8371,7 @@ var LocalAgentMemory = class {
8371
8371
  const warned2 = g[sym];
8372
8372
  if (!warned2.has(message)) {
8373
8373
  warned2.add(message);
8374
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] memory tools unavailable: ${message}
8374
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] memory tools unavailable: ${message}
8375
8375
  `);
8376
8376
  }
8377
8377
  return void 0;
@@ -8380,7 +8380,7 @@ var LocalAgentMemory = class {
8380
8380
  async runActiveMemoryIfEnabled(userText, priorMessages, telemetry) {
8381
8381
  const cfg = this.options.memory?.activeRecall;
8382
8382
  if (cfg?.enabled !== true || this.index === void 0) return void 0;
8383
- if (this.breaker === void 0) this.breaker = new chunkQFFNMJAS_cjs.CircuitBreaker();
8383
+ if (this.breaker === void 0) this.breaker = new chunkN6NUMXAJ_cjs.CircuitBreaker();
8384
8384
  if (this.cache === void 0) this.cache = new ActiveMemoryCache();
8385
8385
  const result = await runActiveMemory({
8386
8386
  userText,
@@ -8430,7 +8430,7 @@ var LocalAgentMemory = class {
8430
8430
  await this.index.sync();
8431
8431
  } catch (cause) {
8432
8432
  const message = cause instanceof Error ? cause.message : String(cause);
8433
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] session index sync failed: ${message}
8433
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] session index sync failed: ${message}
8434
8434
  `);
8435
8435
  }
8436
8436
  }
@@ -8443,7 +8443,7 @@ var LocalAgentMemory = class {
8443
8443
  return await adapter.create(cfg.model !== void 0 ? { model: cfg.model } : {});
8444
8444
  } catch (cause) {
8445
8445
  const message = cause instanceof Error ? cause.message : String(cause);
8446
- chunkZHPET3LZ_cjs.diag(`[theokit-sdk] memory embedding ${cfg.provider} unavailable: ${message}
8446
+ chunkSXSPMRSV_cjs.diag(`[theokit-sdk] memory embedding ${cfg.provider} unavailable: ${message}
8447
8447
  `);
8448
8448
  return void 0;
8449
8449
  }
@@ -8479,7 +8479,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
8479
8479
  ...partial?.metadata !== void 0 ? { metadata: partial.metadata } : defaultContext?.metadata !== void 0 ? { metadata: defaultContext.metadata } : {}
8480
8480
  };
8481
8481
  if (merged.userId === "") {
8482
- throw new chunkYULF6FPB_cjs.ConfigurationError(
8482
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
8483
8483
  "agent.memory requires a userId \u2014 either set AgentOptions.memoryContext.userId or pass ctx.userId at call time.",
8484
8484
  { code: "memory_context_missing_user_id" }
8485
8485
  );
@@ -8489,7 +8489,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
8489
8489
  async function requireAdapters() {
8490
8490
  const r = await ensure();
8491
8491
  if (r.adapters.length === 0) {
8492
- throw new chunkYULF6FPB_cjs.ConfigurationError(
8492
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
8493
8493
  "No memory adapter registered. Pass a memory plugin in AgentOptions.plugins (e.g. supermemoryMemory({...})).",
8494
8494
  { code: "no_memory_adapter" }
8495
8495
  );
@@ -8530,7 +8530,7 @@ function buildAgentMemory(pluginManager, workspaceCwd, defaultContext) {
8530
8530
  const prefix = id.split(":", 1)[0] ?? "";
8531
8531
  const target = adapters.find((a) => a.id === prefix);
8532
8532
  if (target === void 0) {
8533
- throw new chunkYULF6FPB_cjs.ConfigurationError(
8533
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
8534
8534
  `No adapter found for MemoryId prefix "${prefix}" (registered: ${adapters.map((a) => a.id).join(", ")}).`,
8535
8535
  { code: "no_memory_adapter" }
8536
8536
  );
@@ -8603,7 +8603,7 @@ function createLocalAgentMemoryProvider(opts) {
8603
8603
  return { facts: [], systemPromptAdditions: summary };
8604
8604
  },
8605
8605
  async recordSessionSummary(args) {
8606
- await chunkGH52NOCL_cjs.writeSessionSummary(args);
8606
+ await chunkEQMLJ52C_cjs.writeSessionSummary(args);
8607
8607
  },
8608
8608
  async sync(handle) {
8609
8609
  const state = handle[INTERNAL_LAM_KEY];
@@ -8681,19 +8681,19 @@ var PersonalityRegistry = class _PersonalityRegistry {
8681
8681
  function addEntity(byName, entity, origin, collisionMap) {
8682
8682
  const fm = entity.frontmatter;
8683
8683
  if (PersonalityRegistry.isReservedClearSlug(fm.name)) {
8684
- throw new chunkYULF6FPB_cjs.ConfigurationError(
8684
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
8685
8685
  `Personality name "${fm.name}" is reserved (used to clear active preset)`,
8686
8686
  { code: "personality_reserved_name" }
8687
8687
  );
8688
8688
  }
8689
8689
  if (entity.body.trim().length === 0) {
8690
- throw new chunkYULF6FPB_cjs.ConfigurationError(
8690
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
8691
8691
  `Personality "${fm.name}" has empty body (system prompt required)`,
8692
8692
  { code: "personality_empty_body" }
8693
8693
  );
8694
8694
  }
8695
8695
  if (origin === "project" && collisionMap?.has(fm.name)) {
8696
- chunkHECR7KF5_cjs.warnOnce(
8696
+ chunk3YYDHUNH_cjs.warnOnce(
8697
8697
  `personality-collision-${fm.name}`,
8698
8698
  `[theokit-sdk] personality "${fm.name}" overridden by project preset`
8699
8699
  );
@@ -8722,7 +8722,7 @@ async function performPersonalitySwitch(args) {
8722
8722
  const preset = args.registry.get(args.requestedName);
8723
8723
  if (preset === void 0) {
8724
8724
  const available = args.registry.all().map((p) => p.name).join(", ") || "(none)";
8725
- throw new chunkYULF6FPB_cjs.ConfigurationError(
8725
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
8726
8726
  `Personality "${args.requestedName}" not found. Available: ${available}`,
8727
8727
  { code: "personality_not_found" }
8728
8728
  );
@@ -8743,14 +8743,14 @@ async function performPersonalitySwitch(args) {
8743
8743
 
8744
8744
  // src/internal/local-agent/local-agent-personality-extensions.ts
8745
8745
  function resolveActivePersonalityPreset(args) {
8746
- const forkCtx = chunkHECR7KF5_cjs.currentPersonalityContext();
8746
+ const forkCtx = chunk3YYDHUNH_cjs.currentPersonalityContext();
8747
8747
  const slug = forkCtx !== void 0 ? forkCtx.slug : args.personalityStore.active(args.agentId);
8748
8748
  if (slug === void 0) return void 0;
8749
8749
  return args.personalityRegistry?.get(slug);
8750
8750
  }
8751
8751
  async function ensurePersonalityRegistryIfNeeded(args) {
8752
8752
  if (args.personalityRegistry !== void 0) return args.personalityRegistry;
8753
- const forkSlug = chunkHECR7KF5_cjs.currentPersonalityContext()?.slug;
8753
+ const forkSlug = chunk3YYDHUNH_cjs.currentPersonalityContext()?.slug;
8754
8754
  const ownSlug = args.personalityStore.active(args.agentId);
8755
8755
  if (forkSlug === void 0 && ownSlug === void 0) return void 0;
8756
8756
  return await PersonalityRegistry.load(args.workspaceCwd);
@@ -8764,8 +8764,8 @@ ${preset.systemPrompt}`;
8764
8764
  }
8765
8765
  async function localAgentUsePersonality(args) {
8766
8766
  if (args.disposed) throw new Error("Agent has been disposed");
8767
- if (chunkHECR7KF5_cjs.currentPersonalityContext() !== void 0) {
8768
- chunkHECR7KF5_cjs.warnPersonalitySwitchInsideFork(args.agentId);
8767
+ if (chunk3YYDHUNH_cjs.currentPersonalityContext() !== void 0) {
8768
+ chunk3YYDHUNH_cjs.warnPersonalitySwitchInsideFork(args.agentId);
8769
8769
  return null;
8770
8770
  }
8771
8771
  let registry = args.personalityRegistry;
@@ -8782,8 +8782,8 @@ async function localAgentUsePersonality(args) {
8782
8782
  registry,
8783
8783
  store: args.personalityStore,
8784
8784
  invalidateCache: (reason) => args.invalidateCache(reason),
8785
- appendSessionMessage: (msg) => chunkFAUKVJCC_cjs.appendSessionMessage(args.agentId, msg),
8786
- clearSession: () => chunkFAUKVJCC_cjs.clearSession(args.agentId),
8785
+ appendSessionMessage: (msg) => chunk3BKWFISQ_cjs.appendSessionMessage(args.agentId, msg),
8786
+ clearSession: () => chunk3BKWFISQ_cjs.clearSession(args.agentId),
8787
8787
  opts: args.opts ?? {}
8788
8788
  })
8789
8789
  );
@@ -8794,7 +8794,7 @@ function localAgentRunUntil(agent, goal, options) {
8794
8794
  async function* wrap() {
8795
8795
  const { runUntilImpl } = await import('./run-until-U2B5FJJI.cjs');
8796
8796
  const buildDeps = async () => {
8797
- const { judgeCallImpl } = await import('./judge-call-J5EETJL3.cjs');
8797
+ const { judgeCallImpl } = await import('./judge-call-GVIJWQVE.cjs');
8798
8798
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
8799
8799
  const create = getAgentFacade().create;
8800
8800
  return {
@@ -8827,7 +8827,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
8827
8827
  async function localAgentFork(parent, options) {
8828
8828
  const { forkAgentImpl } = await import('./fork-agent-Y2IK2RYU.cjs');
8829
8829
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
8830
- const { withPersonalityContext } = await import('./context-2G4375BZ.cjs');
8830
+ const { withPersonalityContext } = await import('./context-4HGPCOH6.cjs');
8831
8831
  const create = getAgentFacade().create;
8832
8832
  return withPersonalityContext(
8833
8833
  { slug: parent.personalitySlugSnapshot, isFork: true },
@@ -8887,7 +8887,7 @@ function wrapRunWithCompletionCheck(args) {
8887
8887
  judgeOpts
8888
8888
  );
8889
8889
  const complete = !verdict.parseFailed && verdict.verdict === "done";
8890
- chunkKCQUYQ3V_cjs.emitRunEvent(args.onRunEvent, {
8890
+ chunk6DCTL32L_cjs.emitRunEvent(args.onRunEvent, {
8891
8891
  type: "completion_check",
8892
8892
  complete,
8893
8893
  reason: verdict.reason
@@ -9034,7 +9034,7 @@ function wrapRunWithOutputProcessors(args) {
9034
9034
  if (result.status !== "finished" || result.result === void 0) return result;
9035
9035
  const res = await runOutputProcessors(args.processors, result.result, args.agentId);
9036
9036
  if (res.kind === "ok") return { ...result, result: res.value };
9037
- chunkKCQUYQ3V_cjs.emitRunEvent(args.onRunEvent, {
9037
+ chunk6DCTL32L_cjs.emitRunEvent(args.onRunEvent, {
9038
9038
  type: "tripwire",
9039
9039
  reason: res.tripwire.reason,
9040
9040
  processorId: res.tripwire.processorId
@@ -9109,7 +9109,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
9109
9109
  }
9110
9110
  const res = await runInputProcessors(processors, rawUserText, inputs.agentId);
9111
9111
  if (res.kind === "tripwire") {
9112
- chunkKCQUYQ3V_cjs.emitRunEvent(options.onRunEvent, {
9112
+ chunk6DCTL32L_cjs.emitRunEvent(options.onRunEvent, {
9113
9113
  type: "tripwire",
9114
9114
  reason: res.tripwire.reason,
9115
9115
  processorId: res.tripwire.processorId
@@ -9126,7 +9126,7 @@ async function applyInputProcessors(inputs, message, rawUserText, options, sendM
9126
9126
  return { userText: res.value, effectiveMessage };
9127
9127
  }
9128
9128
  async function executeSendLocked(inputs, message, options) {
9129
- if (inputs.disposed) throw new chunkYULF6FPB_cjs.AgentDisposedError(inputs.agentId);
9129
+ if (inputs.disposed) throw new chunk2YGIBOUH_cjs.AgentDisposedError(inputs.agentId);
9130
9130
  await consumePending(inputs.agentId, inputs.invalidationPending, inputs.clearInvalidation, inputs.reload);
9131
9131
  const sendModel = normalizeModel(options.model);
9132
9132
  inputs.applyModelOverride(sendModel);
@@ -9137,7 +9137,7 @@ async function executeSendLocked(inputs, message, options) {
9137
9137
  if (inputs.options.onBeforeSend !== void 0) {
9138
9138
  await inputs.options.onBeforeSend({
9139
9139
  conversationId: inputs.agentId,
9140
- previousMessageCount: chunkFAUKVJCC_cjs.getSessionMessages(inputs.agentId).length
9140
+ previousMessageCount: chunk3BKWFISQ_cjs.getSessionMessages(inputs.agentId).length
9141
9141
  });
9142
9142
  }
9143
9143
  await inputs.runPreHook(userText);
@@ -9149,8 +9149,8 @@ async function executeSendLocked(inputs, message, options) {
9149
9149
  userText,
9150
9150
  sendOptions: options
9151
9151
  });
9152
- const priorMessages = [...chunkFAUKVJCC_cjs.getSessionMessages(inputs.agentId)];
9153
- chunkFAUKVJCC_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
9152
+ const priorMessages = [...chunk3BKWFISQ_cjs.getSessionMessages(inputs.agentId)];
9153
+ chunk3BKWFISQ_cjs.appendSessionMessage(inputs.agentId, { role: "user", text: userText });
9154
9154
  await persistMemoryFactIfWritePrompt(inputs.workspaceCwd, inputs.options.memory, userText);
9155
9155
  const memoryFacts = await readMemoryForSend(inputs.workspaceCwd, inputs.options.memory);
9156
9156
  const portPathActive = shouldUsePortMemoryPath();
@@ -9208,7 +9208,7 @@ async function executeSendLocked(inputs, message, options) {
9208
9208
  function buildCompletionCheckDeps() {
9209
9209
  return {
9210
9210
  judge: async (ctx, opts) => {
9211
- const { judgeCallImpl } = await import('./judge-call-J5EETJL3.cjs');
9211
+ const { judgeCallImpl } = await import('./judge-call-GVIJWQVE.cjs');
9212
9212
  const { getAgentFacade } = await import('./agent-factory-registry-UU46BUMU.cjs');
9213
9213
  return judgeCallImpl(ctx, opts, { create: getAgentFacade().create });
9214
9214
  }
@@ -9228,7 +9228,7 @@ function registerRunAsTask(run, agentId, taskOpt, userText) {
9228
9228
  promptPreview: userText.slice(0, 120),
9229
9229
  ...opts.meta ?? {}
9230
9230
  };
9231
- void chunkKCQUYQ3V_cjs.submit({
9231
+ void chunk6DCTL32L_cjs.submit({
9232
9232
  kind: "run",
9233
9233
  work: async (ctx) => {
9234
9234
  ctx.signal.addEventListener(
@@ -9312,7 +9312,7 @@ var LocalAgent = class {
9312
9312
  this.options = options;
9313
9313
  this.workspaceCwd = resolveCwd(options.local?.cwd);
9314
9314
  this.transcriptBaseDir = resolveBaseDir(options.local?.baseDir);
9315
- this.sessionStore = options.local?.sessionStore ?? new chunkNRA36JKG_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
9315
+ this.sessionStore = options.local?.sessionStore ?? new chunkOI6RHLGC_cjs.FsSessionStore({ baseDir: this.transcriptBaseDir, cwd: this.workspaceCwd });
9316
9316
  this.settingSourcesIncludeProject = includesSetting(options, "project");
9317
9317
  this.settingSourcesIncludePlugins = includesSetting(options, "plugins");
9318
9318
  const sub = bootstrapSubmanagers({
@@ -9355,14 +9355,14 @@ var LocalAgent = class {
9355
9355
  if (this.pluginsManager !== void 0) await this.pluginsManager.initialize();
9356
9356
  const codePlugins = chunkBV2MWEMV_cjs.extractCodePlugins(this.options.plugins);
9357
9357
  await this.pluginManagerCode.initialize(codePlugins);
9358
- this.resolvedSubagents = await chunkX2YQP452_cjs.loadSubagents(
9358
+ this.resolvedSubagents = await chunkRTLUZKDL_cjs.loadSubagents(
9359
9359
  this.workspaceCwd,
9360
9360
  this.settingSourcesIncludeProject,
9361
9361
  this.options.agents
9362
9362
  );
9363
9363
  await acquireLeaseIfPossible(this.sessionStore, this.agentId);
9364
9364
  try {
9365
- await chunkFAUKVJCC_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
9365
+ await chunk3BKWFISQ_cjs.hydrateSession(this.agentId, { store: this.sessionStore, cwd: this.workspaceCwd });
9366
9366
  await this.personalityStore.hydrate(this.agentId);
9367
9367
  } catch (err) {
9368
9368
  await releaseLeaseIfPossible(this.sessionStore, this.agentId);
@@ -9511,7 +9511,7 @@ var LocalAgent = class {
9511
9511
  agentId: this.agentId
9512
9512
  });
9513
9513
  if (preRun.blocked) {
9514
- throw new chunkYULF6FPB_cjs.ConfigurationError(
9514
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
9515
9515
  `preRun hook denied execution: ${preRun.reason ?? "unspecified"}`,
9516
9516
  { code: "hook_denied" }
9517
9517
  );
@@ -9592,7 +9592,7 @@ var LocalAgent = class {
9592
9592
  }
9593
9593
  // biome-ignore format: G8 budget — see listArtifacts.
9594
9594
  downloadArtifact(_path) {
9595
- return Promise.reject(new chunkYULF6FPB_cjs.UnsupportedRunOperationError("Artifacts are not supported for local agents", "downloadArtifact"));
9595
+ return Promise.reject(new chunk2YGIBOUH_cjs.UnsupportedRunOperationError("Artifacts are not supported for local agents", "downloadArtifact"));
9596
9596
  }
9597
9597
  // biome-ignore format: G8 budget — delegates to `local-agent-runtime-extensions.ts`; kept 1-line.
9598
9598
  runUntil(goal, options) {
@@ -9615,7 +9615,7 @@ function resolveCwd(cwd) {
9615
9615
  return (Array.isArray(cwd) ? cwd[0] : cwd) ?? process.cwd();
9616
9616
  }
9617
9617
  function resolveBaseDir(baseDir) {
9618
- return baseDir === void 0 ? chunkWCXOKGOQ_cjs.defaultBaseDir() : chunkWCXOKGOQ_cjs.expandTilde(baseDir);
9618
+ return baseDir === void 0 ? chunkECPL5RV6_cjs.defaultBaseDir() : chunkECPL5RV6_cjs.expandTilde(baseDir);
9619
9619
  }
9620
9620
  function includesSetting(options, source) {
9621
9621
  const sources = options.local?.settingSources;
@@ -9640,7 +9640,7 @@ async function guardAgainstIdCollision(options) {
9640
9640
  const persistenceCwd = resolveAgentPersistenceCwd(options);
9641
9641
  await hydrateRegistryFromDisk(persistenceCwd);
9642
9642
  if (getRegisteredAgent(options.agentId) !== void 0) {
9643
- throw new chunkYULF6FPB_cjs.ConfigurationError(
9643
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
9644
9644
  `Agent "${options.agentId}" already exists. Use Agent.resume("${options.agentId}") to reattach, or pick a different agentId.`,
9645
9645
  { code: "agent_id_already_exists" }
9646
9646
  );
@@ -9673,7 +9673,7 @@ async function maybeInjectHandoffTools(options) {
9673
9673
  const spec = "@theokit/sdk-handoff/internal/tool-injector";
9674
9674
  mod = await import(spec);
9675
9675
  } catch (err) {
9676
- throw new chunkYULF6FPB_cjs.ConfigurationError(
9676
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
9677
9677
  "Agent.create({ handoffs: [...] }) requires @theokit/sdk-handoff. Install it: pnpm add @theokit/sdk-handoff. Or migrate to the preferred plugin pattern: plugins: [Handoff.asPlugin({ targets: [...] })] (see docs/migration/1-x-to-2-0.md#handoff).",
9678
9678
  { code: "handoff_package_missing", cause: err }
9679
9679
  );
@@ -9693,9 +9693,9 @@ async function maybeInjectHandoffTools(options) {
9693
9693
  async function createLocalAgent(options) {
9694
9694
  const apiKey = resolveApiKey(options.apiKey);
9695
9695
  if (apiKey === void 0) {
9696
- throw new chunkYULF6FPB_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
9696
+ throw new chunk2YGIBOUH_cjs.AuthenticationError("Missing API key", { code: "missing_api_key" });
9697
9697
  }
9698
- const willFlowToProvider = !chunkQFFNMJAS_cjs.isFixtureApiKey(apiKey) && !chunkQFFNMJAS_cjs.shouldUseRealLocalRuntime(apiKey);
9698
+ const willFlowToProvider = !chunkN6NUMXAJ_cjs.isFixtureApiKey(apiKey) && !chunkN6NUMXAJ_cjs.shouldUseRealLocalRuntime(apiKey);
9699
9699
  const shape = validateApiKeyShape(apiKey, {
9700
9700
  strict: willFlowToProvider,
9701
9701
  // `options.model` is already normalized by `runCreateUnderSpan`; `normalizeModel`
@@ -9704,10 +9704,10 @@ async function createLocalAgent(options) {
9704
9704
  ...willFlowToProvider ? { provider: providerFromModelId(normalizeModel(options.model)?.id) } : {}
9705
9705
  });
9706
9706
  if (shape.malformed) {
9707
- throw new chunkYULF6FPB_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
9707
+ throw new chunk2YGIBOUH_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
9708
9708
  }
9709
- if (!chunkQFFNMJAS_cjs.isFixtureApiKey(apiKey) && chunkQFFNMJAS_cjs.getConfiguredBaseUrl() === void 0 && !chunkQFFNMJAS_cjs.shouldUseRealLocalRuntime(apiKey)) {
9710
- throw new chunkYULF6FPB_cjs.AuthenticationError("Invalid API key", {
9709
+ if (!chunkN6NUMXAJ_cjs.isFixtureApiKey(apiKey) && chunkN6NUMXAJ_cjs.getConfiguredBaseUrl() === void 0 && !chunkN6NUMXAJ_cjs.shouldUseRealLocalRuntime(apiKey)) {
9710
+ throw new chunk2YGIBOUH_cjs.AuthenticationError("Invalid API key", {
9711
9711
  code: "authentication_error"
9712
9712
  });
9713
9713
  }
@@ -9718,19 +9718,19 @@ async function createLocalAgent(options) {
9718
9718
  async function createCloudAgent(options) {
9719
9719
  const apiKey = resolveApiKey(options.apiKey);
9720
9720
  if (apiKey === void 0) {
9721
- throw new chunkYULF6FPB_cjs.ConfigurationError("Missing API key for cloud agent", {
9721
+ throw new chunk2YGIBOUH_cjs.ConfigurationError("Missing API key for cloud agent", {
9722
9722
  code: "missing_api_key"
9723
9723
  });
9724
9724
  }
9725
9725
  const shape = validateApiKeyShape(apiKey);
9726
9726
  if (shape.malformed) {
9727
- throw new chunkYULF6FPB_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
9727
+ throw new chunk2YGIBOUH_cjs.AuthenticationError(shape.message, { code: "malformed_api_key" });
9728
9728
  }
9729
- const baseUrl = chunkQFFNMJAS_cjs.getConfiguredBaseUrl();
9729
+ const baseUrl = chunkN6NUMXAJ_cjs.getConfiguredBaseUrl();
9730
9730
  if (baseUrl === void 0) {
9731
9731
  return new CloudAgent(options);
9732
9732
  }
9733
- const response = await chunkQFFNMJAS_cjs.httpRequest("/v1/agents", {
9733
+ const response = await chunkN6NUMXAJ_cjs.httpRequest("/v1/agents", {
9734
9734
  apiKey,
9735
9735
  method: "POST",
9736
9736
  body: {
@@ -9755,7 +9755,7 @@ function resolveAgentPersistenceCwd(options) {
9755
9755
  return process.cwd();
9756
9756
  }
9757
9757
  async function rehydrateExistingAgent(agentId, existing, options) {
9758
- await chunkQFFNMJAS_cjs.discoverProviderPlugins();
9758
+ await chunkN6NUMXAJ_cjs.discoverProviderPlugins();
9759
9759
  await validateRehydratedAgent(agentId, existing);
9760
9760
  const mergedLocal = options.local !== void 0 && existing.options.local !== void 0 ? { ...existing.options.local, ...options.local } : options.local ?? existing.options.local;
9761
9761
  const mergedOptions = {
@@ -9786,7 +9786,7 @@ async function validateRehydratedAgent(agentId, entry) {
9786
9786
  throw new Error(`Workspace path is not a directory: ${candidate}`);
9787
9787
  }
9788
9788
  } catch (cause) {
9789
- throw new chunkYULF6FPB_cjs.UnknownAgentError(
9789
+ throw new chunk2YGIBOUH_cjs.UnknownAgentError(
9790
9790
  `Agent "${agentId}" cannot be rehydrated \u2014 workspace cwd "${candidate}" is missing or inaccessible.`,
9791
9791
  { code: "agent_rehydration_failed", cause }
9792
9792
  );
@@ -9838,7 +9838,7 @@ async function getRegisteredAgentOrThrow(agentId) {
9838
9838
  agent = getRegisteredAgent(agentId);
9839
9839
  }
9840
9840
  if (agent === void 0) {
9841
- throw new chunkYULF6FPB_cjs.UnknownAgentError(`Agent ${agentId} not found`, { code: "unknown_agent" });
9841
+ throw new chunk2YGIBOUH_cjs.UnknownAgentError(`Agent ${agentId} not found`, { code: "unknown_agent" });
9842
9842
  }
9843
9843
  return agent;
9844
9844
  }
@@ -9883,7 +9883,7 @@ var Agent = class _Agent {
9883
9883
  pluginCount: enabledPluginNames(options.plugins).length
9884
9884
  });
9885
9885
  try {
9886
- await chunkQFFNMJAS_cjs.discoverProviderPlugins();
9886
+ await chunkN6NUMXAJ_cjs.discoverProviderPlugins();
9887
9887
  const agent = await runCreateUnderSpan(options, span);
9888
9888
  return agent;
9889
9889
  } catch (err) {
@@ -9909,8 +9909,8 @@ var Agent = class _Agent {
9909
9909
  const run = await agent.send(message);
9910
9910
  const result = await run.wait();
9911
9911
  if (options.throwOnError === true && result.status === "error" && result.error !== void 0) {
9912
- throw new chunkYULF6FPB_cjs.AgentRunError(result.error.message, {
9913
- code: chunkYULF6FPB_cjs.coerceToKnownAgentRunErrorCode(result.error.code),
9912
+ throw new chunk2YGIBOUH_cjs.AgentRunError(result.error.message, {
9913
+ code: chunk2YGIBOUH_cjs.coerceToKnownAgentRunErrorCode(result.error.code),
9914
9914
  cause: result.error.cause
9915
9915
  });
9916
9916
  }
@@ -9937,7 +9937,7 @@ var Agent = class _Agent {
9937
9937
  if (existing !== void 0) {
9938
9938
  return await rehydrateExistingAgent(agentId, existing, options);
9939
9939
  }
9940
- throw new chunkYULF6FPB_cjs.UnknownAgentError(
9940
+ throw new chunk2YGIBOUH_cjs.UnknownAgentError(
9941
9941
  `Agent "${agentId}" not found. Use Agent.create({ agentId, ... }) for first-time setup, or catch UnknownAgentError to branch resume-vs-create.`,
9942
9942
  { code: "unknown_agent" }
9943
9943
  );
@@ -9966,7 +9966,7 @@ var Agent = class _Agent {
9966
9966
  * @public
9967
9967
  */
9968
9968
  static async generateObject(options) {
9969
- const { generateObjectImpl } = await import('./generate-object-6PWGH5DZ.cjs');
9969
+ const { generateObjectImpl } = await import('./generate-object-E465DX5I.cjs');
9970
9970
  return generateObjectImpl(options, {
9971
9971
  create: (opts) => _Agent.create(opts),
9972
9972
  delete: (agentId) => _Agent.delete(agentId)
@@ -9990,7 +9990,7 @@ var Agent = class _Agent {
9990
9990
  delete: (agentId) => _Agent.delete(agentId)
9991
9991
  };
9992
9992
  async function* wrapper() {
9993
- streamObjectImport ??= import('./stream-object-3R3HZPQN.cjs');
9993
+ streamObjectImport ??= import('./stream-object-T4DAMNVB.cjs');
9994
9994
  const { streamObjectImpl } = await streamObjectImport;
9995
9995
  yield* streamObjectImpl(options, deps);
9996
9996
  }
@@ -10014,7 +10014,7 @@ var Agent = class _Agent {
10014
10014
  * @public
10015
10015
  */
10016
10016
  static async batch(prompts, options) {
10017
- const { batchImpl } = await import('./batch-URTEXK77.cjs');
10017
+ const { batchImpl } = await import('./batch-WQ3AJCDV.cjs');
10018
10018
  return batchImpl(prompts, options, { create: (opts) => _Agent.create(opts) });
10019
10019
  }
10020
10020
  /**
@@ -10094,14 +10094,14 @@ var Agent = class _Agent {
10094
10094
  */
10095
10095
  static async getRun(runId, options = {}) {
10096
10096
  if (options.runtime === "cloud") {
10097
- throw new chunkYULF6FPB_cjs.ConfigurationError(
10097
+ throw new chunk2YGIBOUH_cjs.ConfigurationError(
10098
10098
  "Cloud runtime is pre-release. Theo PaaS endpoints are not wired yet \u2014 getRun({ runtime: 'cloud' }) will be enabled when the PaaS ships.",
10099
10099
  { code: "cloud_runtime_pre_release" }
10100
10100
  );
10101
10101
  }
10102
10102
  const existing = getRun(runId);
10103
10103
  if (existing !== void 0) return existing;
10104
- throw new chunkYULF6FPB_cjs.UnknownAgentError(
10104
+ throw new chunk2YGIBOUH_cjs.UnknownAgentError(
10105
10105
  `Run ${runId} is not in this process's registry. It may have been disposed, persisted in a previous process, or never created.`,
10106
10106
  { code: "run_not_found" }
10107
10107
  );
@@ -10148,13 +10148,13 @@ var Agent = class _Agent {
10148
10148
  reg = getRegisteredAgent(agentId);
10149
10149
  }
10150
10150
  if (reg === void 0 || reg.runtime !== "local") {
10151
- throw new chunkYULF6FPB_cjs.UnknownAgentError(
10151
+ throw new chunk2YGIBOUH_cjs.UnknownAgentError(
10152
10152
  `No local agent "${agentId}" registered \u2014 compact targets local sessions.`
10153
10153
  );
10154
10154
  }
10155
- const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-UUCBTBCZ.cjs');
10155
+ const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-AAFICMPQ.cjs');
10156
10156
  const { cwd, model, store } = await openLocalStore(reg);
10157
- return chunkFAUKVJCC_cjs.enqueueSessionWrite(
10157
+ return chunk3BKWFISQ_cjs.enqueueSessionWrite(
10158
10158
  cwd,
10159
10159
  agentId,
10160
10160
  () => compactSessionTranscript({
@@ -10184,11 +10184,11 @@ var Agent = class _Agent {
10184
10184
  reg = getRegisteredAgent(agentId);
10185
10185
  }
10186
10186
  if (reg === void 0 || reg.runtime !== "local") {
10187
- throw new chunkYULF6FPB_cjs.UnknownAgentError(
10187
+ throw new chunk2YGIBOUH_cjs.UnknownAgentError(
10188
10188
  `No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
10189
10189
  );
10190
10190
  }
10191
- const { injectSessionTurn } = await import('./inject-session-I3HK3AHB.cjs');
10191
+ const { injectSessionTurn } = await import('./inject-session-KOGUD6KM.cjs');
10192
10192
  const { cwd, model, store } = await openLocalStore(reg);
10193
10193
  await injectSessionTurn({
10194
10194
  store,
@@ -10223,11 +10223,11 @@ var Agent = class _Agent {
10223
10223
  reg = getRegisteredAgent(agentId);
10224
10224
  }
10225
10225
  if (reg === void 0 || reg.runtime !== "local") {
10226
- throw new chunkYULF6FPB_cjs.UnknownAgentError(
10226
+ throw new chunk2YGIBOUH_cjs.UnknownAgentError(
10227
10227
  `No local agent "${agentId}" registered \u2014 transcript targets local sessions.`
10228
10228
  );
10229
10229
  }
10230
- const { readSessionMessages } = await import('./agent-session-store-EPUERCUU.cjs');
10230
+ const { readSessionMessages } = await import('./agent-session-store-EPX2WQI4.cjs');
10231
10231
  const { store } = await openLocalStore(reg);
10232
10232
  return readSessionMessages(store, agentId);
10233
10233
  }
@@ -10248,7 +10248,7 @@ var Agent = class _Agent {
10248
10248
  */
10249
10249
  static async describe(agentId) {
10250
10250
  const agent = await getRegisteredAgentOrThrow(agentId);
10251
- const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-FDXPBBRA.cjs');
10251
+ const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-3CXBQWWY.cjs');
10252
10252
  const settingSources = agent.options.local?.settingSources;
10253
10253
  const subagents = await loadSubagents2(
10254
10254
  agent.cwd ?? process.cwd(),
@@ -10292,12 +10292,12 @@ async function getOrCreateUncached(agentId, options) {
10292
10292
  try {
10293
10293
  return await Agent.resume(agentId, options);
10294
10294
  } catch (err) {
10295
- if (!(err instanceof chunkYULF6FPB_cjs.UnknownAgentError)) throw err;
10295
+ if (!(err instanceof chunk2YGIBOUH_cjs.UnknownAgentError)) throw err;
10296
10296
  }
10297
10297
  try {
10298
10298
  return await Agent.create({ ...options, agentId });
10299
10299
  } catch (err) {
10300
- if (err instanceof chunkYULF6FPB_cjs.ConfigurationError && err.code === "agent_id_already_exists") {
10300
+ if (err instanceof chunk2YGIBOUH_cjs.ConfigurationError && err.code === "agent_id_already_exists") {
10301
10301
  return await Agent.resume(agentId, options);
10302
10302
  }
10303
10303
  throw err;
@@ -10315,8 +10315,8 @@ async function openLocalStore(reg) {
10315
10315
  const cwd = reg.cwd ?? process.cwd();
10316
10316
  const optModel = reg.options.model;
10317
10317
  const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
10318
- const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-MAZV5FXJ.cjs');
10319
- const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-FYRKWRWV.cjs');
10318
+ const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-TL4RJTXZ.cjs');
10319
+ const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-TNAJ4O3M.cjs');
10320
10320
  const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
10321
10321
  return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
10322
10322
  }
@@ -10333,5 +10333,5 @@ exports.generateCronId = generateCronId;
10333
10333
  exports.getPricingEntry = getPricingEntry;
10334
10334
  exports.openRouterMemoryEmbeddingProviderAdapter = openRouterMemoryEmbeddingProviderAdapter;
10335
10335
  exports.resolveApiKey = resolveApiKey;
10336
- //# sourceMappingURL=chunk-TSK4VVBW.cjs.map
10337
- //# sourceMappingURL=chunk-TSK4VVBW.cjs.map
10336
+ //# sourceMappingURL=chunk-XI4L45SS.cjs.map
10337
+ //# sourceMappingURL=chunk-XI4L45SS.cjs.map