@theokit/sdk 4.53.0 → 4.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (719) hide show
  1. package/CHANGELOG.md +1096 -8
  2. package/LICENSE +2 -2
  3. package/README.md +14 -9
  4. package/bin/theokit-migrate-config.mjs +11 -2
  5. package/dist/a2a/agent-mailbox.d.cts +27 -0
  6. package/dist/a2a/agent-mailbox.d.ts +27 -0
  7. package/dist/a2a/index.cjs +9 -4
  8. package/dist/a2a/index.cjs.map +1 -1
  9. package/dist/a2a/index.js +7 -2
  10. package/dist/a2a/index.js.map +1 -1
  11. package/dist/a2a/message-bus.d.cts +39 -0
  12. package/dist/a2a/message-bus.d.ts +39 -0
  13. package/dist/a2a/subagent.d.cts +68 -7
  14. package/dist/a2a/subagent.d.ts +68 -7
  15. package/dist/a2a/types.d.cts +26 -0
  16. package/dist/a2a/types.d.ts +26 -0
  17. package/dist/{agent-BiCINq25.d.ts → agent-CIUgz7cN.d.cts} +211 -858
  18. package/dist/{agent-Zta1kvGH.d.cts → agent-DSec-E0c.d.ts} +211 -858
  19. package/dist/agent-NOEGF4GI.cjs +61 -0
  20. package/dist/{agent-JX5SBYDE.cjs.map → agent-NOEGF4GI.cjs.map} +1 -1
  21. package/dist/agent-VGD5WL4N.js +52 -0
  22. package/dist/{agent-ZAGG6ZBS.js.map → agent-VGD5WL4N.js.map} +1 -1
  23. package/dist/agent-builder.d.ts +19 -0
  24. package/dist/agent-session-store-P6V3FINW.js +7 -0
  25. package/dist/{agent-session-store-JMU7ASDB.js.map → agent-session-store-P6V3FINW.js.map} +1 -1
  26. package/dist/agent-session-store-ZJ3JSRS4.cjs +24 -0
  27. package/dist/{agent-session-store-EPX2WQI4.cjs.map → agent-session-store-ZJ3JSRS4.cjs.map} +1 -1
  28. package/dist/agent.d.ts +25 -7
  29. package/dist/auth/index.cjs +53 -36
  30. package/dist/auth/index.cjs.map +1 -1
  31. package/dist/auth/index.d.cts +1 -1
  32. package/dist/auth/index.d.ts +1 -1
  33. package/dist/auth/index.js +27 -10
  34. package/dist/auth/index.js.map +1 -1
  35. package/dist/{batch-NLIS4QTW.js → batch-2TGJMNCJ.js} +14 -13
  36. package/dist/batch-2TGJMNCJ.js.map +1 -0
  37. package/dist/{batch-WQ3AJCDV.cjs → batch-ND32UKZS.cjs} +31 -30
  38. package/dist/batch-ND32UKZS.cjs.map +1 -0
  39. package/dist/{chunk-TR4V2LHV.cjs → chunk-2ADR2GSO.cjs} +8 -8
  40. package/dist/chunk-2ADR2GSO.cjs.map +1 -0
  41. package/dist/{chunk-7HQVDLFI.cjs → chunk-2C72DXQF.cjs} +65 -27
  42. package/dist/chunk-2C72DXQF.cjs.map +1 -0
  43. package/dist/{chunk-DEZ75ET5.js → chunk-2D34UTDC.js} +21 -5
  44. package/dist/chunk-2D34UTDC.js.map +1 -0
  45. package/dist/{chunk-XGYI2KQH.js → chunk-2QKTVKH3.js} +4 -4
  46. package/dist/{chunk-XGYI2KQH.js.map → chunk-2QKTVKH3.js.map} +1 -1
  47. package/dist/{chunk-BBZYXVLZ.cjs → chunk-2ZPEDVLM.cjs} +2 -2
  48. package/dist/chunk-2ZPEDVLM.cjs.map +1 -0
  49. package/dist/{chunk-DHVNJYTO.js → chunk-3E77SX4H.js} +4 -4
  50. package/dist/{chunk-DHVNJYTO.js.map → chunk-3E77SX4H.js.map} +1 -1
  51. package/dist/{chunk-VYHJZVL5.cjs → chunk-3EE6LVWT.cjs} +2 -2
  52. package/dist/chunk-3EE6LVWT.cjs.map +1 -0
  53. package/dist/chunk-3KGLRRFC.cjs +18 -0
  54. package/dist/chunk-3KGLRRFC.cjs.map +1 -0
  55. package/dist/{chunk-5NBUH3NO.js → chunk-3OR54XG4.js} +2 -2
  56. package/dist/{chunk-C6Y6CWYD.cjs.map → chunk-3OR54XG4.js.map} +1 -1
  57. package/dist/{chunk-FUASIT3E.cjs → chunk-3YJNUKYN.cjs} +15 -15
  58. package/dist/{chunk-FUASIT3E.cjs.map → chunk-3YJNUKYN.cjs.map} +1 -1
  59. package/dist/{chunk-R7TKOQMJ.js → chunk-44JAAH4X.js} +3 -3
  60. package/dist/chunk-44JAAH4X.js.map +1 -0
  61. package/dist/{chunk-XRI6DXPZ.js → chunk-44MBDIHG.js} +4 -4
  62. package/dist/chunk-44MBDIHG.js.map +1 -0
  63. package/dist/{chunk-BXVSBYGW.js → chunk-4ERPXIVB.js} +5 -5
  64. package/dist/{chunk-BXVSBYGW.js.map → chunk-4ERPXIVB.js.map} +1 -1
  65. package/dist/{chunk-T6QUCG7L.cjs → chunk-4I55V454.cjs} +4 -4
  66. package/dist/chunk-4I55V454.cjs.map +1 -0
  67. package/dist/{chunk-B4YA6BRS.cjs → chunk-4O5TGQBW.cjs} +30 -7
  68. package/dist/chunk-4O5TGQBW.cjs.map +1 -0
  69. package/dist/{chunk-4JBHSLQO.cjs → chunk-4OTIXDMU.cjs} +2 -2
  70. package/dist/{chunk-4JBHSLQO.cjs.map → chunk-4OTIXDMU.cjs.map} +1 -1
  71. package/dist/{chunk-C6Y6CWYD.cjs → chunk-52NKC5HT.cjs} +2 -2
  72. package/dist/chunk-52NKC5HT.cjs.map +1 -0
  73. package/dist/{chunk-3YYDHUNH.cjs → chunk-53CBTBWO.cjs} +11 -11
  74. package/dist/{chunk-3YYDHUNH.cjs.map → chunk-53CBTBWO.cjs.map} +1 -1
  75. package/dist/{chunk-2QMK627M.cjs → chunk-5BJV5UPY.cjs} +27 -27
  76. package/dist/chunk-5BJV5UPY.cjs.map +1 -0
  77. package/dist/{chunk-OZXPA3ME.js → chunk-5JLFFPCH.js} +4 -4
  78. package/dist/{chunk-OZXPA3ME.js.map → chunk-5JLFFPCH.js.map} +1 -1
  79. package/dist/{chunk-34XOCZJO.js → chunk-5PHVENFV.js} +3 -3
  80. package/dist/chunk-5PHVENFV.js.map +1 -0
  81. package/dist/{chunk-EQMLJ52C.cjs → chunk-5UOVYM3P.cjs} +36 -31
  82. package/dist/chunk-5UOVYM3P.cjs.map +1 -0
  83. package/dist/{chunk-33L2NVTJ.cjs → chunk-5USCYPPI.cjs} +15 -15
  84. package/dist/chunk-5USCYPPI.cjs.map +1 -0
  85. package/dist/{chunk-I732VEDW.js → chunk-AEOZTXVW.js} +3 -3
  86. package/dist/{chunk-I732VEDW.js.map → chunk-AEOZTXVW.js.map} +1 -1
  87. package/dist/{chunk-5XXUYU3M.js → chunk-AG5JPQIY.js} +3 -3
  88. package/dist/{chunk-5XXUYU3M.js.map → chunk-AG5JPQIY.js.map} +1 -1
  89. package/dist/{chunk-3SHW7XKK.js → chunk-AGSBJD2L.js} +27 -29
  90. package/dist/chunk-AGSBJD2L.js.map +1 -0
  91. package/dist/{chunk-KZBB4YKU.js → chunk-AQLGBKNT.js} +3 -3
  92. package/dist/chunk-AQLGBKNT.js.map +1 -0
  93. package/dist/{chunk-7W7ZWMLQ.js → chunk-AWO27VRZ.js} +3 -3
  94. package/dist/chunk-AWO27VRZ.js.map +1 -0
  95. package/dist/{chunk-VYCKUKPA.cjs → chunk-B2J4ZMZL.cjs} +3 -2
  96. package/dist/chunk-B2J4ZMZL.cjs.map +1 -0
  97. package/dist/{chunk-UJ3SXRZZ.js → chunk-BMAZLQQ4.js} +3 -3
  98. package/dist/{chunk-UJ3SXRZZ.js.map → chunk-BMAZLQQ4.js.map} +1 -1
  99. package/dist/{chunk-NUEL6RCZ.cjs → chunk-BVZW2B5V.cjs} +4 -4
  100. package/dist/chunk-BVZW2B5V.cjs.map +1 -0
  101. package/dist/{chunk-W4FV7JBH.js → chunk-CQ2TQ32Y.js} +4 -4
  102. package/dist/chunk-CQ2TQ32Y.js.map +1 -0
  103. package/dist/{chunk-NFATC6ZF.cjs → chunk-CQGYNZ3K.cjs} +4 -4
  104. package/dist/{chunk-NFATC6ZF.cjs.map → chunk-CQGYNZ3K.cjs.map} +1 -1
  105. package/dist/{chunk-3R4ZCQAZ.cjs → chunk-CTCGWIUD.cjs} +5 -5
  106. package/dist/{chunk-3R4ZCQAZ.cjs.map → chunk-CTCGWIUD.cjs.map} +1 -1
  107. package/dist/{chunk-HTK54K2J.js → chunk-CV7XMBHP.js} +4 -4
  108. package/dist/chunk-CV7XMBHP.js.map +1 -0
  109. package/dist/{chunk-NOS7PTKP.js → chunk-DAPSQZT4.js} +15 -10
  110. package/dist/chunk-DAPSQZT4.js.map +1 -0
  111. package/dist/{chunk-E3OCRJU6.cjs → chunk-DQKERTND.cjs} +11 -11
  112. package/dist/{chunk-E3OCRJU6.cjs.map → chunk-DQKERTND.cjs.map} +1 -1
  113. package/dist/{chunk-I5OTK2RP.js → chunk-DUIF54UP.js} +6 -6
  114. package/dist/chunk-DUIF54UP.js.map +1 -0
  115. package/dist/{chunk-C4EU627W.js → chunk-DZBSJX6J.js} +4 -4
  116. package/dist/{chunk-C4EU627W.js.map → chunk-DZBSJX6J.js.map} +1 -1
  117. package/dist/{chunk-ADVZIC43.cjs → chunk-EI2Q7SJ5.cjs} +12 -12
  118. package/dist/chunk-EI2Q7SJ5.cjs.map +1 -0
  119. package/dist/{chunk-UCFONJBG.js → chunk-EPSICJLZ.js} +2 -2
  120. package/dist/{chunk-UCFONJBG.js.map → chunk-EPSICJLZ.js.map} +1 -1
  121. package/dist/{chunk-RAACTJ7C.cjs → chunk-F3YZMOAU.cjs} +8 -8
  122. package/dist/{chunk-RAACTJ7C.cjs.map → chunk-F3YZMOAU.cjs.map} +1 -1
  123. package/dist/{chunk-KIX45IKP.js → chunk-F7AQV62G.js} +5 -4
  124. package/dist/chunk-F7AQV62G.js.map +1 -0
  125. package/dist/{chunk-2YWWPCGX.js → chunk-FXEUP75G.js} +10 -12
  126. package/dist/chunk-FXEUP75G.js.map +1 -0
  127. package/dist/{chunk-2RW7K6FN.cjs → chunk-GHX4P3V2.cjs} +2 -2
  128. package/dist/chunk-GHX4P3V2.cjs.map +1 -0
  129. package/dist/{chunk-634YVZLU.js → chunk-GJ6RK75E.js} +5 -5
  130. package/dist/chunk-GJ6RK75E.js.map +1 -0
  131. package/dist/{chunk-Z5U2JGEK.cjs → chunk-GNT35C5U.cjs} +13 -13
  132. package/dist/chunk-GNT35C5U.cjs.map +1 -0
  133. package/dist/{chunk-4NAKHID5.js → chunk-GTKFV7O5.js} +2 -2
  134. package/dist/chunk-GTKFV7O5.js.map +1 -0
  135. package/dist/{chunk-BWGXYOBZ.cjs → chunk-GWC3HADL.cjs} +4 -4
  136. package/dist/{chunk-BWGXYOBZ.cjs.map → chunk-GWC3HADL.cjs.map} +1 -1
  137. package/dist/{chunk-OXNYIMZZ.js → chunk-H73MEMQB.js} +2 -2
  138. package/dist/chunk-H73MEMQB.js.map +1 -0
  139. package/dist/{chunk-RTLUZKDL.cjs → chunk-HJBMA5MB.cjs} +11 -11
  140. package/dist/{chunk-RTLUZKDL.cjs.map → chunk-HJBMA5MB.cjs.map} +1 -1
  141. package/dist/{chunk-AM2CNBKE.js → chunk-HKCKOAIO.js} +2 -2
  142. package/dist/chunk-HKCKOAIO.js.map +1 -0
  143. package/dist/{chunk-PVBANCWU.cjs → chunk-HY57ULY2.cjs} +5 -5
  144. package/dist/{chunk-PVBANCWU.cjs.map → chunk-HY57ULY2.cjs.map} +1 -1
  145. package/dist/{chunk-CAH3G4IS.js → chunk-HY66GLM6.js} +2 -2
  146. package/dist/chunk-HY66GLM6.js.map +1 -0
  147. package/dist/{chunk-2CFEET3Y.cjs → chunk-I6TGFUCO.cjs} +4 -4
  148. package/dist/chunk-I6TGFUCO.cjs.map +1 -0
  149. package/dist/{chunk-HI4ZW62S.js → chunk-IDCKSLYH.js} +4 -4
  150. package/dist/chunk-IDCKSLYH.js.map +1 -0
  151. package/dist/{chunk-KNZU4YO5.cjs → chunk-ILCGLTSA.cjs} +4 -4
  152. package/dist/{chunk-KNZU4YO5.cjs.map → chunk-ILCGLTSA.cjs.map} +1 -1
  153. package/dist/{chunk-44IISBRZ.cjs → chunk-IWBGCBR6.cjs} +4 -4
  154. package/dist/{chunk-44IISBRZ.cjs.map → chunk-IWBGCBR6.cjs.map} +1 -1
  155. package/dist/{chunk-R3CKCRK3.cjs → chunk-J24VJOH3.cjs} +22 -6
  156. package/dist/chunk-J24VJOH3.cjs.map +1 -0
  157. package/dist/{chunk-ECPL5RV6.cjs → chunk-JHPGF3FP.cjs} +8 -8
  158. package/dist/{chunk-ECPL5RV6.cjs.map → chunk-JHPGF3FP.cjs.map} +1 -1
  159. package/dist/{chunk-SXSPMRSV.cjs → chunk-JTB5Q42C.cjs} +21 -19
  160. package/dist/chunk-JTB5Q42C.cjs.map +1 -0
  161. package/dist/{chunk-2YGIBOUH.cjs → chunk-K3FW2XZD.cjs} +9 -9
  162. package/dist/chunk-K3FW2XZD.cjs.map +1 -0
  163. package/dist/{chunk-6DCTL32L.cjs → chunk-NGESVVJN.cjs} +17 -17
  164. package/dist/chunk-NGESVVJN.cjs.map +1 -0
  165. package/dist/{chunk-MV4TOCUK.js → chunk-NLTVXLGT.js} +3 -3
  166. package/dist/{chunk-MV4TOCUK.js.map → chunk-NLTVXLGT.js.map} +1 -1
  167. package/dist/chunk-NUKRL3I6.cjs +23 -0
  168. package/dist/chunk-NUKRL3I6.cjs.map +1 -0
  169. package/dist/{chunk-ZSJPRPN7.js → chunk-OC4NTGMN.js} +3 -3
  170. package/dist/{chunk-ZSJPRPN7.js.map → chunk-OC4NTGMN.js.map} +1 -1
  171. package/dist/{chunk-K42QGAKM.cjs → chunk-P6A3M6VD.cjs} +10 -10
  172. package/dist/{chunk-K42QGAKM.cjs.map → chunk-P6A3M6VD.cjs.map} +1 -1
  173. package/dist/{chunk-OKLYRPKL.cjs → chunk-Q47R5E2X.cjs} +8 -8
  174. package/dist/chunk-Q47R5E2X.cjs.map +1 -0
  175. package/dist/{chunk-2XLKLVVR.js → chunk-Q5EWJPRY.js} +2 -2
  176. package/dist/chunk-Q5EWJPRY.js.map +1 -0
  177. package/dist/{chunk-XWCTBGYK.js → chunk-QARJGQSA.js} +16 -7
  178. package/dist/chunk-QARJGQSA.js.map +1 -0
  179. package/dist/{chunk-EUBGGYPH.cjs → chunk-QDED6YO6.cjs} +5 -5
  180. package/dist/{chunk-EUBGGYPH.cjs.map → chunk-QDED6YO6.cjs.map} +1 -1
  181. package/dist/{chunk-VK7MAV65.cjs → chunk-QKLOP4VC.cjs} +2 -2
  182. package/dist/{chunk-VK7MAV65.cjs.map → chunk-QKLOP4VC.cjs.map} +1 -1
  183. package/dist/{chunk-PLUCC4N5.js → chunk-QRSUA2CV.js} +3 -3
  184. package/dist/{chunk-PLUCC4N5.js.map → chunk-QRSUA2CV.js.map} +1 -1
  185. package/dist/{chunk-YTO5BRBD.cjs → chunk-R3UPQFKK.cjs} +21 -12
  186. package/dist/chunk-R3UPQFKK.cjs.map +1 -0
  187. package/dist/{chunk-X2FR4OIT.js → chunk-R7WIIPUR.js} +2 -2
  188. package/dist/chunk-R7WIIPUR.js.map +1 -0
  189. package/dist/{chunk-BC5EUG7R.cjs → chunk-RM7Y65IG.cjs} +18 -20
  190. package/dist/chunk-RM7Y65IG.cjs.map +1 -0
  191. package/dist/{chunk-RP5HQVLD.js → chunk-RNB4APBZ.js} +30 -7
  192. package/dist/chunk-RNB4APBZ.js.map +1 -0
  193. package/dist/{chunk-V45L2OYP.cjs → chunk-ROYPRJH4.cjs} +9 -9
  194. package/dist/{chunk-V45L2OYP.cjs.map → chunk-ROYPRJH4.cjs.map} +1 -1
  195. package/dist/{chunk-JJZ4NIAG.js → chunk-RUDY2GTT.js} +61 -24
  196. package/dist/chunk-RUDY2GTT.js.map +1 -0
  197. package/dist/{chunk-QLAWEGTZ.cjs → chunk-SKXBJ2NU.cjs} +7 -7
  198. package/dist/chunk-SKXBJ2NU.cjs.map +1 -0
  199. package/dist/chunk-SSQZA3DZ.js +15 -0
  200. package/dist/chunk-SSQZA3DZ.js.map +1 -0
  201. package/dist/{chunk-7TB5U7RK.js → chunk-SUKXXLWD.js} +6 -6
  202. package/dist/chunk-SUKXXLWD.js.map +1 -0
  203. package/dist/{chunk-N43XLTHZ.js → chunk-T73NA43R.js} +3 -3
  204. package/dist/{chunk-N43XLTHZ.js.map → chunk-T73NA43R.js.map} +1 -1
  205. package/dist/chunk-T7O6K6PX.js +20 -0
  206. package/dist/chunk-T7O6K6PX.js.map +1 -0
  207. package/dist/{chunk-4X3SBHPK.js → chunk-T7XEKOVW.js} +18 -17
  208. package/dist/chunk-T7XEKOVW.js.map +1 -0
  209. package/dist/{chunk-NZOR3N4E.js → chunk-TPTZA6NI.js} +293 -126
  210. package/dist/chunk-TPTZA6NI.js.map +1 -0
  211. package/dist/{chunk-QN5N3ZVT.cjs → chunk-TTHBHAJI.cjs} +44 -46
  212. package/dist/chunk-TTHBHAJI.cjs.map +1 -0
  213. package/dist/{chunk-CZHPR2G7.cjs → chunk-U2AC6JUP.cjs} +8 -8
  214. package/dist/chunk-U2AC6JUP.cjs.map +1 -0
  215. package/dist/{chunk-ITQ4NO4P.js → chunk-UC3HT2S4.js} +3 -3
  216. package/dist/{chunk-ITQ4NO4P.js.map → chunk-UC3HT2S4.js.map} +1 -1
  217. package/dist/{chunk-2VFZQEDW.cjs → chunk-UFAO4T7Z.cjs} +565 -399
  218. package/dist/chunk-UFAO4T7Z.cjs.map +1 -0
  219. package/dist/{chunk-DM6Y5B2G.cjs → chunk-UNDROG5N.cjs} +201 -154
  220. package/dist/chunk-UNDROG5N.cjs.map +1 -0
  221. package/dist/{chunk-L7EGRCKJ.js → chunk-UPRJR6IP.js} +4 -4
  222. package/dist/chunk-UPRJR6IP.js.map +1 -0
  223. package/dist/{chunk-23VZBRDQ.js → chunk-UQGQFBRL.js} +3 -3
  224. package/dist/chunk-UQGQFBRL.js.map +1 -0
  225. package/dist/{chunk-2Y5NO2SY.js → chunk-VDEWG5TV.js} +88 -43
  226. package/dist/chunk-VDEWG5TV.js.map +1 -0
  227. package/dist/{chunk-CHVSMEKM.js → chunk-VF7EWVDG.js} +3 -3
  228. package/dist/chunk-VF7EWVDG.js.map +1 -0
  229. package/dist/{chunk-PNVDQL5Y.cjs → chunk-VTYY7XL5.cjs} +2 -2
  230. package/dist/chunk-VTYY7XL5.cjs.map +1 -0
  231. package/dist/{chunk-E6T264NS.js → chunk-WKRSH2VR.js} +3 -3
  232. package/dist/{chunk-E6T264NS.js.map → chunk-WKRSH2VR.js.map} +1 -1
  233. package/dist/{chunk-4QEC4CCS.js → chunk-WTMU7J4U.js} +2 -2
  234. package/dist/{chunk-4QEC4CCS.js.map → chunk-WTMU7J4U.js.map} +1 -1
  235. package/dist/{chunk-EFXJ5C7X.js → chunk-XN7NOENA.js} +6 -6
  236. package/dist/chunk-XN7NOENA.js.map +1 -0
  237. package/dist/{chunk-AMYY3JHQ.cjs → chunk-XSX2UU6Y.cjs} +10 -9
  238. package/dist/chunk-XSX2UU6Y.cjs.map +1 -0
  239. package/dist/{chunk-6PTCKXD3.js → chunk-XV4IZNV4.js} +9 -9
  240. package/dist/chunk-XV4IZNV4.js.map +1 -0
  241. package/dist/{chunk-FBZMSLDC.cjs → chunk-XWL6O3SW.cjs} +4 -4
  242. package/dist/chunk-XWL6O3SW.cjs.map +1 -0
  243. package/dist/{chunk-OIBHY6JQ.js → chunk-YMA4S2WO.js} +4 -4
  244. package/dist/{chunk-OIBHY6JQ.js.map → chunk-YMA4S2WO.js.map} +1 -1
  245. package/dist/{chunk-T5ZWI3MC.cjs → chunk-YPJ5NH5N.cjs} +11 -11
  246. package/dist/chunk-YPJ5NH5N.cjs.map +1 -0
  247. package/dist/{chunk-YLQQX5W2.cjs → chunk-ZF2LDKQQ.cjs} +2 -2
  248. package/dist/chunk-ZF2LDKQQ.cjs.map +1 -0
  249. package/dist/{chunk-L5YO6PWL.cjs → chunk-ZNW6V4Y6.cjs} +2 -2
  250. package/dist/chunk-ZNW6V4Y6.cjs.map +1 -0
  251. package/dist/client/index.cjs.map +1 -1
  252. package/dist/client/index.js.map +1 -1
  253. package/dist/client/theokit-client.d.cts +36 -0
  254. package/dist/client/theokit-client.d.ts +36 -0
  255. package/dist/client/types.d.cts +30 -0
  256. package/dist/client/types.d.ts +30 -0
  257. package/dist/compact-session-K5LXTBPJ.js +22 -0
  258. package/dist/{compact-session-EJ36VH5I.js.map → compact-session-K5LXTBPJ.js.map} +1 -1
  259. package/dist/compact-session-YCT6JMBX.cjs +59 -0
  260. package/dist/{compact-session-6GKIS4SD.cjs.map → compact-session-YCT6JMBX.cjs.map} +1 -1
  261. package/dist/compaction.cjs +17 -16
  262. package/dist/compaction.d.cts +13 -13
  263. package/dist/compaction.d.ts +13 -13
  264. package/dist/compaction.js +4 -3
  265. package/dist/concurrency.cjs +7 -6
  266. package/dist/concurrency.cjs.map +1 -1
  267. package/dist/concurrency.js +5 -4
  268. package/dist/concurrency.js.map +1 -1
  269. package/dist/context/index.cjs +7 -7
  270. package/dist/context/index.js +3 -3
  271. package/dist/context-FDOON2DB.js +6 -0
  272. package/dist/{context-DCECDKWN.js.map → context-FDOON2DB.js.map} +1 -1
  273. package/dist/context-VMIE4BMD.cjs +23 -0
  274. package/dist/{context-4HGPCOH6.cjs.map → context-VMIE4BMD.cjs.map} +1 -1
  275. package/dist/cron-CRwy2JBF.d.ts +240 -0
  276. package/dist/cron-DxxeQ-sK.d.cts +240 -0
  277. package/dist/cron.cjs +44 -42
  278. package/dist/cron.d.cts +5 -3
  279. package/dist/cron.d.ts +5 -3
  280. package/dist/cron.js +43 -41
  281. package/dist/define-tool.d.ts +14 -6
  282. package/dist/{errors-CHllybaU.d.ts → errors-BgJH9PHi.d.cts} +39 -24
  283. package/dist/{errors-BSoXcl3F.d.cts → errors-C5fJUqLk.d.ts} +39 -24
  284. package/dist/errors.cjs +22 -21
  285. package/dist/errors.d.cts +2 -2
  286. package/dist/errors.d.ts +2 -2
  287. package/dist/errors.js +3 -2
  288. package/dist/eval.cjs +62 -59
  289. package/dist/eval.cjs.map +1 -1
  290. package/dist/eval.d.cts +38 -0
  291. package/dist/eval.d.ts +38 -0
  292. package/dist/eval.js +52 -49
  293. package/dist/eval.js.map +1 -1
  294. package/dist/event-bus.d.ts +16 -0
  295. package/dist/{executor-3CGPLVJL.js → executor-BMEHFOXZ.js} +8 -7
  296. package/dist/executor-BMEHFOXZ.js.map +1 -0
  297. package/dist/{executor-4SW7QGZ4.cjs → executor-ZERJ3DGN.cjs} +25 -24
  298. package/dist/executor-ZERJ3DGN.cjs.map +1 -0
  299. package/dist/filesystem/index.cjs +8 -7
  300. package/dist/filesystem/index.cjs.map +1 -1
  301. package/dist/filesystem/index.js +4 -3
  302. package/dist/filesystem/index.js.map +1 -1
  303. package/dist/filesystem/local-filesystem.d.cts +18 -0
  304. package/dist/filesystem/local-filesystem.d.ts +18 -0
  305. package/dist/filesystem/types.d.cts +12 -0
  306. package/dist/filesystem/types.d.ts +12 -0
  307. package/dist/fs-session-store-3MOJQGP2.cjs +20 -0
  308. package/dist/{fs-session-store-VXXDIBGM.cjs.map → fs-session-store-3MOJQGP2.cjs.map} +1 -1
  309. package/dist/fs-session-store-IN7JTTXD.js +11 -0
  310. package/dist/{fs-session-store-LIKYT24K.js.map → fs-session-store-IN7JTTXD.js.map} +1 -1
  311. package/dist/generate-object-N5MDZUJI.js +8 -0
  312. package/dist/{generate-object-TVQCW2IZ.js.map → generate-object-N5MDZUJI.js.map} +1 -1
  313. package/dist/generate-object-PGSP5U7N.cjs +21 -0
  314. package/dist/{generate-object-E465DX5I.cjs.map → generate-object-PGSP5U7N.cjs.map} +1 -1
  315. package/dist/generate-object.d.ts +20 -0
  316. package/dist/index-manager-NG5YENWO.cjs +22 -0
  317. package/dist/{index-manager-HGGL4DD5.cjs.map → index-manager-NG5YENWO.cjs.map} +1 -1
  318. package/dist/index-manager-ZMRJ6ZII.js +13 -0
  319. package/dist/{index-manager-EA6FGIQG.js.map → index-manager-ZMRJ6ZII.js.map} +1 -1
  320. package/dist/index.cjs +176 -154
  321. package/dist/index.cjs.map +1 -1
  322. package/dist/index.d.cts +761 -57
  323. package/dist/index.d.ts +761 -57
  324. package/dist/index.js +62 -59
  325. package/dist/index.js.map +1 -1
  326. package/dist/{inject-session-HO7FYVCX.js → inject-session-DDR6X6PC.js} +9 -8
  327. package/dist/inject-session-DDR6X6PC.js.map +1 -0
  328. package/dist/inject-session-XLO3KTBM.cjs +29 -0
  329. package/dist/inject-session-XLO3KTBM.cjs.map +1 -0
  330. package/dist/internal/auth/auth-types.d.ts +84 -2
  331. package/dist/internal/auth/credential-store.d.ts +34 -6
  332. package/dist/internal/auth/oauth-device.d.ts +2 -3
  333. package/dist/internal/auth/resolve-credential.d.ts +40 -0
  334. package/dist/internal/budget/tracker/budget.d.ts +12 -14
  335. package/dist/internal/budget/usage-accumulator.d.ts +15 -0
  336. package/dist/internal/llm/anthropic-shared.d.ts +8 -4
  337. package/dist/internal/llm/model-identifier.d.ts +26 -0
  338. package/dist/internal/llm/openai.d.ts +8 -0
  339. package/dist/internal/llm/router.d.ts +8 -0
  340. package/dist/internal/llm/types.d.ts +12 -1
  341. package/dist/internal/local-agent/mcp-pool.d.ts +2 -4
  342. package/dist/internal/local-agent/real-local-run-provider.d.ts +8 -3
  343. package/dist/internal/local-agent/real-local-run-tools.d.ts +8 -0
  344. package/dist/internal/mcp/oauth.d.ts +19 -1
  345. package/dist/internal/mcp/token-storage.d.ts +52 -1
  346. package/dist/internal/memory/adapters/index.cjs +12 -11
  347. package/dist/internal/memory/adapters/index.d.cts +3 -1
  348. package/dist/internal/memory/adapters/index.d.ts +3 -1
  349. package/dist/internal/memory/adapters/index.js +9 -8
  350. package/dist/internal/memory/adapters/openai-compatible.d.cts +45 -0
  351. package/dist/internal/memory/adapters/openai-compatible.d.ts +45 -0
  352. package/dist/internal/memory/embedding-cache.d.ts +42 -1
  353. package/dist/internal/memory/escape-like-pattern.d.ts +22 -0
  354. package/dist/internal/memory/sqlite-vec-loader.d.ts +1 -3
  355. package/dist/internal/memory/storage/markdown-store.d.ts +0 -5
  356. package/dist/internal/persistence/atomic-write.d.cts +93 -0
  357. package/dist/internal/persistence/atomic-write.d.ts +93 -0
  358. package/dist/internal/persistence/cwd-mutex.d.cts +34 -0
  359. package/dist/internal/persistence/cwd-mutex.d.ts +34 -0
  360. package/dist/internal/persistence/exclusive-create.d.cts +31 -0
  361. package/dist/internal/persistence/exclusive-create.d.ts +31 -0
  362. package/dist/internal/persistence/file-lock.d.cts +41 -1
  363. package/dist/internal/persistence/file-lock.d.ts +41 -1
  364. package/dist/internal/persistence/fs-session-store.d.cts +3 -0
  365. package/dist/internal/persistence/fs-session-store.d.ts +3 -0
  366. package/dist/internal/persistence/fts5-sanitize.d.cts +29 -1
  367. package/dist/internal/persistence/fts5-sanitize.d.ts +29 -1
  368. package/dist/internal/persistence/index.cjs +40 -39
  369. package/dist/internal/persistence/index.cjs.map +1 -1
  370. package/dist/internal/persistence/index.d.cts +6 -1
  371. package/dist/internal/persistence/index.d.ts +6 -1
  372. package/dist/internal/persistence/index.js +9 -8
  373. package/dist/internal/persistence/index.js.map +1 -1
  374. package/dist/internal/persistence/paths.d.cts +54 -1
  375. package/dist/internal/persistence/paths.d.ts +54 -1
  376. package/dist/internal/persistence/persistence-schema.d.cts +9 -1
  377. package/dist/internal/persistence/persistence-schema.d.ts +9 -1
  378. package/dist/internal/persistence/schema-version.d.cts +215 -1
  379. package/dist/internal/persistence/schema-version.d.ts +215 -1
  380. package/dist/internal/persistence/session-dir.d.cts +1 -0
  381. package/dist/internal/persistence/session-dir.d.ts +1 -0
  382. package/dist/internal/persistence/session-writer.d.cts +20 -7
  383. package/dist/internal/persistence/session-writer.d.ts +20 -7
  384. package/dist/internal/persistence/sqlite-cas.d.cts +37 -1
  385. package/dist/internal/persistence/sqlite-cas.d.ts +37 -1
  386. package/dist/internal/persistence/sqlite-open.d.cts +14 -0
  387. package/dist/internal/persistence/sqlite-open.d.ts +14 -0
  388. package/dist/internal/persistence/sqlite-wal.d.cts +53 -0
  389. package/dist/internal/persistence/sqlite-wal.d.ts +53 -0
  390. package/dist/internal/persistence/transcript-ops.d.cts +7 -1
  391. package/dist/internal/persistence/transcript-ops.d.ts +7 -1
  392. package/dist/internal/plugins/types.d.cts +1 -1
  393. package/dist/internal/plugins/types.d.ts +1 -1
  394. package/dist/internal/providers/builtin/cerebras.d.ts +2 -2
  395. package/dist/internal/providers/builtin/deepinfra.d.ts +1 -1
  396. package/dist/internal/providers/builtin/openai-chatgpt.d.ts +12 -0
  397. package/dist/internal/providers/catalog-loader.d.ts +8 -0
  398. package/dist/internal/providers/catalog-schema.d.ts +55 -0
  399. package/dist/internal/providers/catalog-source-models-dev.d.ts +37 -1
  400. package/dist/internal/runtime/concurrency/delegation-depth.d.ts +27 -0
  401. package/dist/internal/runtime/concurrency/subagent-credentials.d.ts +33 -1
  402. package/dist/internal/runtime/context/context-discovery-runner.d.ts +44 -0
  403. package/dist/internal/runtime/context/context-discovery.d.ts +58 -0
  404. package/dist/internal/runtime/context/context-rules-frontmatter.d.ts +70 -1
  405. package/dist/internal/runtime/fixtures/fixture-mode.d.ts +15 -1
  406. package/dist/internal/runtime/lifecycle/env-policy.d.ts +1 -3
  407. package/dist/internal/runtime/lifecycle/post-run-lifecycle.d.ts +15 -0
  408. package/dist/internal/runtime/registry/agent-registry-store.d.ts +12 -0
  409. package/dist/internal/runtime/registry/live-agent-registry.d.ts +37 -0
  410. package/dist/internal/scorers/llm-judge.d.ts +6 -1
  411. package/dist/internal/security/index.cjs +14 -13
  412. package/dist/internal/security/index.d.cts +4 -1
  413. package/dist/internal/security/index.d.ts +4 -1
  414. package/dist/internal/security/index.js +4 -3
  415. package/dist/internal/security/path-guard.d.cts +107 -0
  416. package/dist/internal/security/path-guard.d.ts +107 -0
  417. package/dist/internal/security/redact.d.cts +71 -0
  418. package/dist/internal/security/redact.d.ts +71 -0
  419. package/dist/internal/session/agent-session.d.ts +15 -4
  420. package/dist/internal/session/compact-session.d.ts +2 -2
  421. package/dist/internal/session/session-cache.d.ts +5 -0
  422. package/dist/internal/task/store.d.ts +91 -5
  423. package/dist/internal/telemetry/span-names.d.ts +0 -1
  424. package/dist/internal/telemetry/tracer.d.ts +38 -0
  425. package/dist/job-queue.d.ts +18 -0
  426. package/dist/judge-call-DWHAJATE.js +6 -0
  427. package/dist/{judge-call-QMKGC2ZK.js.map → judge-call-DWHAJATE.js.map} +1 -1
  428. package/dist/judge-call-EGYRC2RE.cjs +23 -0
  429. package/dist/{judge-call-GVIJWQVE.cjs.map → judge-call-EGYRC2RE.cjs.map} +1 -1
  430. package/dist/mcp-auth.cjs +41 -25
  431. package/dist/mcp-auth.cjs.map +1 -1
  432. package/dist/mcp-auth.js +34 -18
  433. package/dist/mcp-auth.js.map +1 -1
  434. package/dist/models.cjs +43 -28
  435. package/dist/models.cjs.map +1 -1
  436. package/dist/models.js +26 -11
  437. package/dist/models.js.map +1 -1
  438. package/dist/oauth-transaction-store-BT4GLTLK.cjs +36 -0
  439. package/dist/{oauth-transaction-store-7CKHPQRN.cjs.map → oauth-transaction-store-BT4GLTLK.cjs.map} +1 -1
  440. package/dist/oauth-transaction-store-W52KVHQ4.js +3 -0
  441. package/dist/{oauth-transaction-store-W74I6EFD.js.map → oauth-transaction-store-W52KVHQ4.js.map} +1 -1
  442. package/dist/path-safety.cjs +11 -10
  443. package/dist/path-safety.js +4 -3
  444. package/dist/permission-engine.d.ts +55 -0
  445. package/dist/persistence.cjs +43 -42
  446. package/dist/persistence.cjs.map +1 -1
  447. package/dist/persistence.js +13 -12
  448. package/dist/persistence.js.map +1 -1
  449. package/dist/project.cjs +9 -8
  450. package/dist/project.cjs.map +1 -1
  451. package/dist/project.js +5 -4
  452. package/dist/project.js.map +1 -1
  453. package/dist/providers.cjs +23 -0
  454. package/dist/providers.cjs.map +1 -0
  455. package/dist/providers.d.cts +29 -0
  456. package/dist/providers.d.ts +29 -0
  457. package/dist/providers.js +10 -0
  458. package/dist/providers.js.map +1 -0
  459. package/dist/registry-VFKX7WOP.cjs +47 -0
  460. package/dist/{registry-UBY26R4I.cjs.map → registry-VFKX7WOP.cjs.map} +1 -1
  461. package/dist/registry-VFP3WWQP.js +10 -0
  462. package/dist/{registry-GC7BQMSV.js.map → registry-VFP3WWQP.js.map} +1 -1
  463. package/dist/retry.cjs +5 -4
  464. package/dist/retry.js +4 -3
  465. package/dist/{run-C8FBAC8o.d.ts → run-BYSHf58D.d.cts} +185 -33
  466. package/dist/{run-C8FBAC8o.d.cts → run-BYSHf58D.d.ts} +185 -33
  467. package/dist/{run-to-completion-JDPIUKSH.js → run-to-completion-DRO77625.js} +3 -3
  468. package/dist/{run-to-completion-JDPIUKSH.js.map → run-to-completion-DRO77625.js.map} +1 -1
  469. package/dist/{run-to-completion-J73I6IY4.cjs → run-to-completion-X4OWM673.cjs} +13 -13
  470. package/dist/{run-to-completion-J73I6IY4.cjs.map → run-to-completion-X4OWM673.cjs.map} +1 -1
  471. package/dist/sandbox/bwrap.d.cts +27 -14
  472. package/dist/sandbox/bwrap.d.ts +27 -14
  473. package/dist/sandbox/index.cjs +21 -20
  474. package/dist/sandbox/index.cjs.map +1 -1
  475. package/dist/sandbox/index.js +6 -5
  476. package/dist/sandbox/index.js.map +1 -1
  477. package/dist/sandbox/linux-sandbox.d.cts +72 -0
  478. package/dist/sandbox/linux-sandbox.d.ts +72 -0
  479. package/dist/sandbox/local-sandbox.d.cts +41 -0
  480. package/dist/sandbox/local-sandbox.d.ts +41 -0
  481. package/dist/sandbox/seccomp.d.cts +6 -0
  482. package/dist/sandbox/seccomp.d.ts +6 -0
  483. package/dist/sandbox/types.d.cts +64 -0
  484. package/dist/sandbox/types.d.ts +64 -0
  485. package/dist/scorers.d.ts +38 -7
  486. package/dist/sdk-agent-D8qJVkuV.d.ts +860 -0
  487. package/dist/sdk-agent-DEoKhA8a.d.cts +860 -0
  488. package/dist/server/auth/errors.d.cts +1 -1
  489. package/dist/server/auth/errors.d.ts +1 -1
  490. package/dist/server/auth/index.cjs +29 -21
  491. package/dist/server/auth/index.cjs.map +1 -1
  492. package/dist/server/auth/index.d.cts +25 -15
  493. package/dist/server/auth/index.d.ts +25 -15
  494. package/dist/server/auth/index.js +15 -7
  495. package/dist/server/auth/index.js.map +1 -1
  496. package/dist/server/auth/oauth-transaction-store.d.cts +13 -1
  497. package/dist/server/auth/oauth-transaction-store.d.ts +13 -1
  498. package/dist/server/auth/orchestrator.d.cts +1 -1
  499. package/dist/server/auth/orchestrator.d.ts +1 -1
  500. package/dist/server/auth/types.d.cts +1 -1
  501. package/dist/server/auth/types.d.ts +1 -1
  502. package/dist/server/auth/validate-return-to.d.cts +21 -11
  503. package/dist/server/auth/validate-return-to.d.ts +21 -11
  504. package/dist/server/errors-envelope.cjs +15 -14
  505. package/dist/server/errors-envelope.cjs.map +1 -1
  506. package/dist/server/errors-envelope.d.cts +4 -4
  507. package/dist/server/errors-envelope.d.ts +4 -4
  508. package/dist/server/errors-envelope.js +4 -3
  509. package/dist/server/errors-envelope.js.map +1 -1
  510. package/dist/session-transcript-AKDYYGXQ.js +6 -0
  511. package/dist/{session-transcript-SKIRBEJE.js.map → session-transcript-AKDYYGXQ.js.map} +1 -1
  512. package/dist/session-transcript-JXHFTB7G.cjs +51 -0
  513. package/dist/{session-transcript-TNAJ4O3M.cjs.map → session-transcript-JXHFTB7G.cjs.map} +1 -1
  514. package/dist/skills.cjs +8 -7
  515. package/dist/skills.js +6 -5
  516. package/dist/stream-object-BUCF5PHO.cjs +21 -0
  517. package/dist/{stream-object-T4DAMNVB.cjs.map → stream-object-BUCF5PHO.cjs.map} +1 -1
  518. package/dist/stream-object-L57K4OFS.js +8 -0
  519. package/dist/{stream-object-QMNR3YFF.js.map → stream-object-L57K4OFS.js.map} +1 -1
  520. package/dist/{stream-to-completion-DFJ5T3BK.js → stream-to-completion-QV5HCL3J.js} +3 -3
  521. package/dist/{stream-to-completion-DFJ5T3BK.js.map → stream-to-completion-QV5HCL3J.js.map} +1 -1
  522. package/dist/{stream-to-completion-H2MHISSK.cjs → stream-to-completion-SRISU5AB.cjs} +10 -10
  523. package/dist/{stream-to-completion-H2MHISSK.cjs.map → stream-to-completion-SRISU5AB.cjs.map} +1 -1
  524. package/dist/subagents-loader-AZIXJ7D3.cjs +16 -0
  525. package/dist/{subagents-loader-3CXBQWWY.cjs.map → subagents-loader-AZIXJ7D3.cjs.map} +1 -1
  526. package/dist/subagents-loader-J54ESLDV.js +7 -0
  527. package/dist/{subagents-loader-WN2SB6PV.js.map → subagents-loader-J54ESLDV.js.map} +1 -1
  528. package/dist/subagents-loader.cjs +7 -6
  529. package/dist/subagents-loader.cjs.map +1 -1
  530. package/dist/subagents-loader.d.cts +3 -2
  531. package/dist/subagents-loader.d.ts +3 -2
  532. package/dist/subagents-loader.js +5 -4
  533. package/dist/subagents-loader.js.map +1 -1
  534. package/dist/subscription/define-subscription.d.cts +1 -1
  535. package/dist/subscription/define-subscription.d.ts +1 -1
  536. package/dist/subscription/index.cjs +22 -9
  537. package/dist/subscription/index.cjs.map +1 -1
  538. package/dist/subscription/index.d.cts +1 -1
  539. package/dist/subscription/index.d.ts +1 -1
  540. package/dist/subscription/index.js +21 -8
  541. package/dist/subscription/index.js.map +1 -1
  542. package/dist/subscription/internal/adapter-types.d.cts +1 -1
  543. package/dist/subscription/internal/adapter-types.d.ts +1 -1
  544. package/dist/subscription/internal/server-integration.d.cts +1 -1
  545. package/dist/subscription/internal/server-integration.d.ts +1 -1
  546. package/dist/subscription/internal/sse-encoder.d.cts +1 -1
  547. package/dist/subscription/internal/sse-encoder.d.ts +1 -1
  548. package/dist/subscription/internal/sse-parser.d.cts +1 -1
  549. package/dist/subscription/internal/sse-parser.d.ts +1 -1
  550. package/dist/subscription/internal/subscription-runtime.d.cts +1 -1
  551. package/dist/subscription/internal/subscription-runtime.d.ts +1 -1
  552. package/dist/subscription/internal/ws-adapter-node.d.cts +1 -1
  553. package/dist/subscription/internal/ws-adapter-node.d.ts +1 -1
  554. package/dist/subscription/theokit-subscribe.d.cts +14 -1
  555. package/dist/subscription/theokit-subscribe.d.ts +14 -1
  556. package/dist/subscription/types.d.cts +19 -1
  557. package/dist/subscription/types.d.ts +19 -1
  558. package/dist/task-store.cjs +8 -7
  559. package/dist/task-store.js +5 -4
  560. package/dist/types/agent-prims.d.ts +14 -0
  561. package/dist/types/agent.d.ts +69 -17
  562. package/dist/types/batch.d.ts +7 -1
  563. package/dist/types/conversation.d.ts +18 -5
  564. package/dist/types/goal-events.d.ts +4 -8
  565. package/dist/types/memory-adapter.d.ts +12 -1
  566. package/dist/types/plugin.d.ts +101 -0
  567. package/dist/types/provider-profile.d.ts +21 -2
  568. package/dist/types/run-events.d.ts +28 -1
  569. package/dist/types/run.d.ts +35 -23
  570. package/dist/types/sdk-agent.d.ts +14 -0
  571. package/dist/types/session-record.d.ts +18 -1
  572. package/dist/types/task.d.ts +15 -1
  573. package/dist/types/theokit.d.ts +10 -1
  574. package/dist/types/updates.d.ts +35 -4
  575. package/dist/types/workflow.d.ts +155 -0
  576. package/dist/workflow.cjs +29 -28
  577. package/dist/workflow.d.cts +666 -17
  578. package/dist/workflow.d.ts +666 -17
  579. package/dist/workflow.js +8 -7
  580. package/docs/error-codes.md +208 -172
  581. package/docs/harness-capability-map.md +1357 -304
  582. package/package.json +21 -8
  583. package/bin/init-claude.mjs +0 -68
  584. package/claude-template/AGENTS.md +0 -157
  585. package/claude-template/CLAUDE.md +0 -66
  586. package/claude-template/dot-claude/rules/theokit-conventions.md +0 -32
  587. package/claude-template/dot-claude/settings.json +0 -16
  588. package/claude-template/dot-claude/skills/theokit-agent-core/SKILL.md +0 -209
  589. package/claude-template/dot-claude/skills/theokit-auth/SKILL.md +0 -102
  590. package/claude-template/dot-claude/skills/theokit-budget/SKILL.md +0 -176
  591. package/claude-template/dot-claude/skills/theokit-client/SKILL.md +0 -58
  592. package/claude-template/dot-claude/skills/theokit-compaction/SKILL.md +0 -102
  593. package/claude-template/dot-claude/skills/theokit-concurrency/SKILL.md +0 -68
  594. package/claude-template/dot-claude/skills/theokit-config/SKILL.md +0 -139
  595. package/claude-template/dot-claude/skills/theokit-cron/SKILL.md +0 -148
  596. package/claude-template/dot-claude/skills/theokit-di/SKILL.md +0 -233
  597. package/claude-template/dot-claude/skills/theokit-di-agent/SKILL.md +0 -294
  598. package/claude-template/dot-claude/skills/theokit-errors/SKILL.md +0 -172
  599. package/claude-template/dot-claude/skills/theokit-eval/SKILL.md +0 -179
  600. package/claude-template/dot-claude/skills/theokit-filesystem/SKILL.md +0 -74
  601. package/claude-template/dot-claude/skills/theokit-gateways/SKILL.md +0 -209
  602. package/claude-template/dot-claude/skills/theokit-memory/SKILL.md +0 -176
  603. package/claude-template/dot-claude/skills/theokit-messages/SKILL.md +0 -58
  604. package/claude-template/dot-claude/skills/theokit-models/SKILL.md +0 -79
  605. package/claude-template/dot-claude/skills/theokit-path-safety/SKILL.md +0 -60
  606. package/claude-template/dot-claude/skills/theokit-persistence/SKILL.md +0 -85
  607. package/claude-template/dot-claude/skills/theokit-project/SKILL.md +0 -55
  608. package/claude-template/dot-claude/skills/theokit-retry/SKILL.md +0 -50
  609. package/claude-template/dot-claude/skills/theokit-sandbox/SKILL.md +0 -93
  610. package/claude-template/dot-claude/skills/theokit-sanitize/SKILL.md +0 -66
  611. package/claude-template/dot-claude/skills/theokit-skills/SKILL.md +0 -68
  612. package/claude-template/dot-claude/skills/theokit-streaming/SKILL.md +0 -156
  613. package/claude-template/dot-claude/skills/theokit-subagents/SKILL.md +0 -109
  614. package/claude-template/dot-claude/skills/theokit-subscriptions/SKILL.md +0 -148
  615. package/claude-template/dot-claude/skills/theokit-task-store/SKILL.md +0 -75
  616. package/claude-template/dot-claude/skills/theokit-tools/SKILL.md +0 -170
  617. package/claude-template/dot-claude/skills/theokit-workflows/SKILL.md +0 -218
  618. package/dist/agent-JX5SBYDE.cjs +0 -59
  619. package/dist/agent-ZAGG6ZBS.js +0 -50
  620. package/dist/agent-session-store-EPX2WQI4.cjs +0 -23
  621. package/dist/agent-session-store-JMU7ASDB.js +0 -6
  622. package/dist/batch-NLIS4QTW.js.map +0 -1
  623. package/dist/batch-WQ3AJCDV.cjs.map +0 -1
  624. package/dist/chunk-23VZBRDQ.js.map +0 -1
  625. package/dist/chunk-2CFEET3Y.cjs.map +0 -1
  626. package/dist/chunk-2QMK627M.cjs.map +0 -1
  627. package/dist/chunk-2RW7K6FN.cjs.map +0 -1
  628. package/dist/chunk-2VFZQEDW.cjs.map +0 -1
  629. package/dist/chunk-2XLKLVVR.js.map +0 -1
  630. package/dist/chunk-2Y5NO2SY.js.map +0 -1
  631. package/dist/chunk-2YGIBOUH.cjs.map +0 -1
  632. package/dist/chunk-2YWWPCGX.js.map +0 -1
  633. package/dist/chunk-33L2NVTJ.cjs.map +0 -1
  634. package/dist/chunk-34XOCZJO.js.map +0 -1
  635. package/dist/chunk-3SHW7XKK.js.map +0 -1
  636. package/dist/chunk-4NAKHID5.js.map +0 -1
  637. package/dist/chunk-4X3SBHPK.js.map +0 -1
  638. package/dist/chunk-5NBUH3NO.js.map +0 -1
  639. package/dist/chunk-634YVZLU.js.map +0 -1
  640. package/dist/chunk-6DCTL32L.cjs.map +0 -1
  641. package/dist/chunk-6PTCKXD3.js.map +0 -1
  642. package/dist/chunk-7HQVDLFI.cjs.map +0 -1
  643. package/dist/chunk-7TB5U7RK.js.map +0 -1
  644. package/dist/chunk-7W7ZWMLQ.js.map +0 -1
  645. package/dist/chunk-ADVZIC43.cjs.map +0 -1
  646. package/dist/chunk-AM2CNBKE.js.map +0 -1
  647. package/dist/chunk-AMYY3JHQ.cjs.map +0 -1
  648. package/dist/chunk-B4YA6BRS.cjs.map +0 -1
  649. package/dist/chunk-BBZYXVLZ.cjs.map +0 -1
  650. package/dist/chunk-BC5EUG7R.cjs.map +0 -1
  651. package/dist/chunk-CAH3G4IS.js.map +0 -1
  652. package/dist/chunk-CHVSMEKM.js.map +0 -1
  653. package/dist/chunk-CZHPR2G7.cjs.map +0 -1
  654. package/dist/chunk-DEZ75ET5.js.map +0 -1
  655. package/dist/chunk-DM6Y5B2G.cjs.map +0 -1
  656. package/dist/chunk-EFXJ5C7X.js.map +0 -1
  657. package/dist/chunk-EQMLJ52C.cjs.map +0 -1
  658. package/dist/chunk-FBZMSLDC.cjs.map +0 -1
  659. package/dist/chunk-HI4ZW62S.js.map +0 -1
  660. package/dist/chunk-HTK54K2J.js.map +0 -1
  661. package/dist/chunk-I5OTK2RP.js.map +0 -1
  662. package/dist/chunk-JJZ4NIAG.js.map +0 -1
  663. package/dist/chunk-KIX45IKP.js.map +0 -1
  664. package/dist/chunk-KZBB4YKU.js.map +0 -1
  665. package/dist/chunk-L5YO6PWL.cjs.map +0 -1
  666. package/dist/chunk-L7EGRCKJ.js.map +0 -1
  667. package/dist/chunk-NOS7PTKP.js.map +0 -1
  668. package/dist/chunk-NUEL6RCZ.cjs.map +0 -1
  669. package/dist/chunk-NZOR3N4E.js.map +0 -1
  670. package/dist/chunk-OKLYRPKL.cjs.map +0 -1
  671. package/dist/chunk-OXNYIMZZ.js.map +0 -1
  672. package/dist/chunk-PNVDQL5Y.cjs.map +0 -1
  673. package/dist/chunk-QLAWEGTZ.cjs.map +0 -1
  674. package/dist/chunk-QN5N3ZVT.cjs.map +0 -1
  675. package/dist/chunk-R3CKCRK3.cjs.map +0 -1
  676. package/dist/chunk-R7TKOQMJ.js.map +0 -1
  677. package/dist/chunk-RP5HQVLD.js.map +0 -1
  678. package/dist/chunk-SXSPMRSV.cjs.map +0 -1
  679. package/dist/chunk-T5ZWI3MC.cjs.map +0 -1
  680. package/dist/chunk-T6QUCG7L.cjs.map +0 -1
  681. package/dist/chunk-TR4V2LHV.cjs.map +0 -1
  682. package/dist/chunk-VYCKUKPA.cjs.map +0 -1
  683. package/dist/chunk-VYHJZVL5.cjs.map +0 -1
  684. package/dist/chunk-W4FV7JBH.js.map +0 -1
  685. package/dist/chunk-X2FR4OIT.js.map +0 -1
  686. package/dist/chunk-XRI6DXPZ.js.map +0 -1
  687. package/dist/chunk-XWCTBGYK.js.map +0 -1
  688. package/dist/chunk-YLQQX5W2.cjs.map +0 -1
  689. package/dist/chunk-YTO5BRBD.cjs.map +0 -1
  690. package/dist/chunk-Z5U2JGEK.cjs.map +0 -1
  691. package/dist/compact-session-6GKIS4SD.cjs +0 -58
  692. package/dist/compact-session-EJ36VH5I.js +0 -21
  693. package/dist/context-4HGPCOH6.cjs +0 -22
  694. package/dist/context-DCECDKWN.js +0 -5
  695. package/dist/cron-DgHJnMAK.d.cts +0 -631
  696. package/dist/cron-DyWQsEG6.d.ts +0 -631
  697. package/dist/executor-3CGPLVJL.js.map +0 -1
  698. package/dist/executor-4SW7QGZ4.cjs.map +0 -1
  699. package/dist/fs-session-store-LIKYT24K.js +0 -10
  700. package/dist/fs-session-store-VXXDIBGM.cjs +0 -19
  701. package/dist/generate-object-E465DX5I.cjs +0 -20
  702. package/dist/generate-object-TVQCW2IZ.js +0 -7
  703. package/dist/index-manager-EA6FGIQG.js +0 -12
  704. package/dist/index-manager-HGGL4DD5.cjs +0 -21
  705. package/dist/inject-session-67SF65FC.cjs +0 -28
  706. package/dist/inject-session-67SF65FC.cjs.map +0 -1
  707. package/dist/inject-session-HO7FYVCX.js.map +0 -1
  708. package/dist/judge-call-GVIJWQVE.cjs +0 -22
  709. package/dist/judge-call-QMKGC2ZK.js +0 -5
  710. package/dist/oauth-transaction-store-7CKHPQRN.cjs +0 -32
  711. package/dist/oauth-transaction-store-W74I6EFD.js +0 -3
  712. package/dist/registry-GC7BQMSV.js +0 -9
  713. package/dist/registry-UBY26R4I.cjs +0 -46
  714. package/dist/session-transcript-SKIRBEJE.js +0 -5
  715. package/dist/session-transcript-TNAJ4O3M.cjs +0 -50
  716. package/dist/stream-object-QMNR3YFF.js +0 -7
  717. package/dist/stream-object-T4DAMNVB.cjs +0 -20
  718. package/dist/subagents-loader-3CXBQWWY.cjs +0 -15
  719. package/dist/subagents-loader-WN2SB6PV.js +0 -6
@@ -1,15 +1,15 @@
1
1
  'use strict';
2
2
 
3
- var chunkRAACTJ7C_cjs = require('./chunk-RAACTJ7C.cjs');
4
- var chunk4JBHSLQO_cjs = require('./chunk-4JBHSLQO.cjs');
5
- var chunkE3OCRJU6_cjs = require('./chunk-E3OCRJU6.cjs');
3
+ var chunkF3YZMOAU_cjs = require('./chunk-F3YZMOAU.cjs');
4
+ var chunk4OTIXDMU_cjs = require('./chunk-4OTIXDMU.cjs');
5
+ var chunkDQKERTND_cjs = require('./chunk-DQKERTND.cjs');
6
6
  var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
7
7
  var chunkFRITRLZQ_cjs = require('./chunk-FRITRLZQ.cjs');
8
- var chunkECPL5RV6_cjs = require('./chunk-ECPL5RV6.cjs');
9
- var chunkAMYY3JHQ_cjs = require('./chunk-AMYY3JHQ.cjs');
10
- var chunkBC5EUG7R_cjs = require('./chunk-BC5EUG7R.cjs');
11
- var chunk2YGIBOUH_cjs = require('./chunk-2YGIBOUH.cjs');
12
- var chunkSXSPMRSV_cjs = require('./chunk-SXSPMRSV.cjs');
8
+ var chunkJHPGF3FP_cjs = require('./chunk-JHPGF3FP.cjs');
9
+ var chunkXSX2UU6Y_cjs = require('./chunk-XSX2UU6Y.cjs');
10
+ var chunkRM7Y65IG_cjs = require('./chunk-RM7Y65IG.cjs');
11
+ var chunkK3FW2XZD_cjs = require('./chunk-K3FW2XZD.cjs');
12
+ var chunkNUKRL3I6_cjs = require('./chunk-NUKRL3I6.cjs');
13
13
  var fs = require('fs');
14
14
  var promises = require('fs/promises');
15
15
  var os = require('os');
@@ -18,7 +18,7 @@ var url = require('url');
18
18
  var module$1 = require('module');
19
19
 
20
20
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
21
- var discoveryState = chunkBC5EUG7R_cjs.globalSingleton("theokit-sdk.providers.discovered", () => ({
21
+ var discoveryState = chunkRM7Y65IG_cjs.globalSingleton("theokit-sdk.providers.discovered", () => ({
22
22
  done: false
23
23
  }));
24
24
  function pluginsRoot() {
@@ -40,19 +40,19 @@ function loadTrustedNames() {
40
40
  else discarded += 1;
41
41
  }
42
42
  if (discarded > 0) {
43
- chunkSXSPMRSV_cjs.diag(
43
+ chunkNUKRL3I6_cjs.diag(
44
44
  `[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be plugin-name strings)
45
45
  `
46
46
  );
47
47
  }
48
48
  } else {
49
- chunkSXSPMRSV_cjs.diag(
49
+ chunkNUKRL3I6_cjs.diag(
50
50
  `[theokit-sdk] WARN: ${path} is not a JSON array \u2014 trusting NO provider plugins (fail-closed)
51
51
  `
52
52
  );
53
53
  }
54
54
  } catch {
55
- chunkSXSPMRSV_cjs.diag(
55
+ chunkNUKRL3I6_cjs.diag(
56
56
  `[theokit-sdk] WARN: ${path} is not valid JSON \u2014 trusting NO provider plugins (fail-closed)
57
57
  `
58
58
  );
@@ -78,7 +78,7 @@ async function discoverProviderPlugins() {
78
78
  const trusted = loadTrustedNames();
79
79
  for (const entry of entries) {
80
80
  if (!trusted.has(entry)) {
81
- chunkSXSPMRSV_cjs.diag(
81
+ chunkNUKRL3I6_cjs.diag(
82
82
  `[theokit-sdk] WARN: provider plugin "${entry}" is present but NOT trusted \u2014 skipped. To trust it, add "${entry}" to ${trustFilePath()} (JSON array of names) or THEOKIT_TRUSTED_PROVIDERS (comma-separated), then restart the process.
83
83
  `
84
84
  );
@@ -97,13 +97,13 @@ async function loadOne(dir, entryName) {
97
97
  if (plugin !== null && typeof plugin === "object" && plugin.kind === "model-provider") {
98
98
  const profile = plugin.profile;
99
99
  if (profile !== void 0 && typeof profile === "object") {
100
- chunkBC5EUG7R_cjs.registerProvider(profile);
100
+ chunkRM7Y65IG_cjs.registerProvider(profile);
101
101
  }
102
102
  }
103
103
  return;
104
104
  } catch (err) {
105
105
  const msg = err instanceof Error ? err.message : String(err);
106
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] failed to load provider plugin "${entryName}": ${msg}
106
+ chunkNUKRL3I6_cjs.diag(`[theokit-sdk] failed to load provider plugin "${entryName}": ${msg}
107
107
  `);
108
108
  return;
109
109
  }
@@ -115,7 +115,7 @@ function mapAnthropicError(args) {
115
115
  const { status, body, headers, endpoint } = args;
116
116
  const code = mapAnthropicStatusToCode(status, body);
117
117
  const message = formatMessage(status, code);
118
- const metadata = chunkE3OCRJU6_cjs.buildErrorMetadata({
118
+ const metadata = chunkDQKERTND_cjs.buildErrorMetadata({
119
119
  provider: "anthropic",
120
120
  endpoint,
121
121
  code,
@@ -124,24 +124,24 @@ function mapAnthropicError(args) {
124
124
  body
125
125
  });
126
126
  if (status === 401 || status === 403) {
127
- return new chunk2YGIBOUH_cjs.AuthenticationError(message, { code: "anthropic_auth_failed", metadata });
127
+ return new chunkK3FW2XZD_cjs.AuthenticationError(message, { code: "anthropic_auth_failed", metadata });
128
128
  }
129
129
  if (status === 429) {
130
- return new chunk2YGIBOUH_cjs.RateLimitError(message, { code: "anthropic_rate_limit", metadata });
130
+ return new chunkK3FW2XZD_cjs.RateLimitError(message, { code: "anthropic_rate_limit", metadata });
131
131
  }
132
132
  if (status === 400) {
133
- return new chunk2YGIBOUH_cjs.ConfigurationError(message, {
133
+ return new chunkK3FW2XZD_cjs.ConfigurationError(message, {
134
134
  code: `anthropic_${code}`,
135
135
  metadata
136
136
  });
137
137
  }
138
138
  if (status === 408) {
139
- return new chunk2YGIBOUH_cjs.NetworkError(message, { code: "anthropic_timeout", metadata });
139
+ return new chunkK3FW2XZD_cjs.NetworkError(message, { code: "anthropic_timeout", metadata });
140
140
  }
141
141
  if (status >= 500 && status < 600) {
142
- return new chunk2YGIBOUH_cjs.NetworkError(message, { code: "anthropic_server_error", metadata });
142
+ return new chunkK3FW2XZD_cjs.NetworkError(message, { code: "anthropic_server_error", metadata });
143
143
  }
144
- return new chunk2YGIBOUH_cjs.UnknownAgentError(message, { code: "anthropic_unknown", metadata });
144
+ return new chunkK3FW2XZD_cjs.UnknownAgentError(message, { code: "anthropic_unknown", metadata });
145
145
  }
146
146
  function mapAnthropicStatusToCode(status, body) {
147
147
  if (status === 401 || status === 403) return "auth_failed";
@@ -190,17 +190,34 @@ function mapOpenAIFinish(reason) {
190
190
  return "end_turn";
191
191
  }
192
192
  }
193
+ function asTokenCount(value) {
194
+ const n = typeof value === "string" ? Number(value) : value;
195
+ if (typeof n !== "number" || !Number.isFinite(n) || n < 0) return void 0;
196
+ return Math.floor(n);
197
+ }
198
+ function assign(finish, key, value) {
199
+ if (value === void 0) return;
200
+ const count = asTokenCount(value);
201
+ if (count === void 0) {
202
+ chunkNUKRL3I6_cjs.diag(
203
+ `[theokit-sdk] provider reported an unusable ${key} (${String(value)}) \u2014 dropping it. Usage and cost for this turn will be incomplete.
204
+ `
205
+ );
206
+ return;
207
+ }
208
+ finish[key] = count;
209
+ }
193
210
  function makeLlmFinish(state) {
194
211
  const finish = {
195
212
  stopReason: state.stopReason,
196
213
  text: state.text,
197
214
  toolCalls: state.toolCalls
198
215
  };
199
- if (state.inputTokens !== void 0) finish.inputTokens = state.inputTokens;
200
- if (state.outputTokens !== void 0) finish.outputTokens = state.outputTokens;
201
- if (state.cacheReadTokens !== void 0) finish.cacheReadTokens = state.cacheReadTokens;
202
- if (state.cacheWriteTokens !== void 0) finish.cacheWriteTokens = state.cacheWriteTokens;
203
- if (state.reasoningTokens !== void 0) finish.reasoningTokens = state.reasoningTokens;
216
+ assign(finish, "inputTokens", state.inputTokens);
217
+ assign(finish, "outputTokens", state.outputTokens);
218
+ assign(finish, "cacheReadTokens", state.cacheReadTokens);
219
+ assign(finish, "cacheWriteTokens", state.cacheWriteTokens);
220
+ assign(finish, "reasoningTokens", state.reasoningTokens);
204
221
  if (state.thinking !== void 0) finish.thinking = state.thinking;
205
222
  return finish;
206
223
  }
@@ -212,7 +229,7 @@ function toBlockToolResultContent(content) {
212
229
  function toStringToolResultContent(content, providerName) {
213
230
  if (typeof content === "string") return content;
214
231
  if (content.some((block) => block.type === "image")) {
215
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
232
+ throw new chunkK3FW2XZD_cjs.ConfigurationError(
216
233
  `provider "${providerName}" does not support image content in tool results`
217
234
  );
218
235
  }
@@ -391,7 +408,7 @@ function readWithIdleTimeout(reader, idleTimeoutMs) {
391
408
  (resolve, reject) => {
392
409
  const timer = setTimeout(() => {
393
410
  reject(
394
- new chunk2YGIBOUH_cjs.NetworkError(`SSE stream idle for ${idleTimeoutMs}ms \u2014 upstream stalled`, {
411
+ new chunkK3FW2XZD_cjs.NetworkError(`SSE stream idle for ${idleTimeoutMs}ms \u2014 upstream stalled`, {
395
412
  code: "stream_idle_timeout"
396
413
  })
397
414
  );
@@ -468,9 +485,9 @@ function ehAbort(err) {
468
485
  }
469
486
  function wrapTransportError(err, ctx) {
470
487
  if (ehAbort(err)) return err;
471
- if (err instanceof chunk2YGIBOUH_cjs.NetworkError) return err;
488
+ if (err instanceof chunkK3FW2XZD_cjs.TheokitAgentError) return err;
472
489
  const detail = err instanceof Error ? err.message : String(err);
473
- return new chunk2YGIBOUH_cjs.NetworkError(`${ctx.providerId} transport failure on ${ctx.endpoint}: ${detail}`, {
490
+ return new chunkK3FW2XZD_cjs.NetworkError(`${ctx.providerId} transport failure on ${ctx.endpoint}: ${detail}`, {
474
491
  code: "transport_failure",
475
492
  cause: err
476
493
  });
@@ -534,7 +551,7 @@ var AnthropicClient = class {
534
551
  for (const event of events) yield event;
535
552
  }
536
553
  if (!accumulator.finishReasonSeen) {
537
- throw new chunk2YGIBOUH_cjs.NetworkError("Anthropic SSE stream truncated (no stop_reason)", {
554
+ throw new chunkK3FW2XZD_cjs.NetworkError("Anthropic SSE stream truncated (no stop_reason)", {
538
555
  code: "stream_truncated"
539
556
  });
540
557
  }
@@ -687,7 +704,7 @@ function classifyBedrockError(args, awsType, message) {
687
704
  return "unknown";
688
705
  }
689
706
  function buildBedrockMetadata(args, code) {
690
- return chunkE3OCRJU6_cjs.buildErrorMetadata({
707
+ return chunkDQKERTND_cjs.buildErrorMetadata({
691
708
  provider: "bedrock",
692
709
  endpoint: args.endpoint,
693
710
  code,
@@ -704,19 +721,19 @@ function mapBedrockError(args) {
704
721
  const metadata = buildBedrockMetadata(args, code);
705
722
  switch (code) {
706
723
  case "rate_limit":
707
- return new chunk2YGIBOUH_cjs.RateLimitError(`Bedrock throttled: ${message}`, { metadata });
724
+ return new chunkK3FW2XZD_cjs.RateLimitError(`Bedrock throttled: ${message}`, { metadata });
708
725
  case "auth_failed":
709
- return new chunk2YGIBOUH_cjs.AuthenticationError(`Bedrock auth: ${message}`, { metadata });
726
+ return new chunkK3FW2XZD_cjs.AuthenticationError(`Bedrock auth: ${message}`, { metadata });
710
727
  case "invalid_request": {
711
728
  const friendly = message.includes("use case details") ? `Bedrock account setup required: ${message} (AWS Console \u2192 Bedrock \u2192 Model access \u2192 Anthropic \u2192 Submit use case form, then retry in 15 min.)` : `Bedrock validation: ${message}`;
712
- return new chunk2YGIBOUH_cjs.ConfigurationError(friendly, { metadata });
729
+ return new chunkK3FW2XZD_cjs.ConfigurationError(friendly, { metadata });
713
730
  }
714
731
  case "timeout":
715
- return new chunk2YGIBOUH_cjs.NetworkError(`Bedrock timeout: ${message}`, { metadata });
732
+ return new chunkK3FW2XZD_cjs.NetworkError(`Bedrock timeout: ${message}`, { metadata });
716
733
  case "server_error":
717
- return new chunk2YGIBOUH_cjs.NetworkError(`Bedrock server error: ${message}`, { metadata });
734
+ return new chunkK3FW2XZD_cjs.NetworkError(`Bedrock server error: ${message}`, { metadata });
718
735
  default:
719
- return new chunk2YGIBOUH_cjs.UnknownAgentError(`Bedrock unknown: ${message}`, { metadata });
736
+ return new chunkK3FW2XZD_cjs.UnknownAgentError(`Bedrock unknown: ${message}`, { metadata });
720
737
  }
721
738
  }
722
739
  function parseBody(body) {
@@ -740,7 +757,7 @@ async function resolveBedrockToken(region) {
740
757
  return cachedToken.value;
741
758
  }
742
759
  try {
743
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-DM6Y5B2G.cjs', document.baseURI).href)));
760
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-UNDROG5N.cjs', document.baseURI).href)));
744
761
  const gen = r("@aws/bedrock-token-generator");
745
762
  if (typeof gen.getToken !== "function") return void 0;
746
763
  const providers = r("@aws-sdk/credential-providers");
@@ -768,16 +785,16 @@ var BedrockAnthropicClient = class {
768
785
  if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
769
786
  const fromEnv = await resolveBedrockToken(region);
770
787
  if (fromEnv !== void 0 && fromEnv.length > 0) return fromEnv;
771
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
788
+ throw new chunkK3FW2XZD_cjs.ConfigurationError(
772
789
  "Bedrock requires AWS_BEARER_TOKEN_BEDROCK env var, or install `@aws/bedrock-token-generator` for auto-refresh, or pass apiKey explicitly.",
773
790
  { code: "auth_failed" }
774
791
  );
775
792
  }
776
793
  async *stream(request, signal) {
777
- const region = chunkBC5EUG7R_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
794
+ const region = chunkRM7Y65IG_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
778
795
  const token = await this.resolveTokenOrThrow(region);
779
- const bareModel = chunkBC5EUG7R_cjs.stripBedrockPrefix(request.model);
780
- const baseUrl = this.options.baseUrl ?? chunkBC5EUG7R_cjs.resolveBedrockBaseUrl(request.model);
796
+ const bareModel = chunkRM7Y65IG_cjs.stripBedrockPrefix(request.model);
797
+ const baseUrl = this.options.baseUrl ?? chunkRM7Y65IG_cjs.resolveBedrockBaseUrl(request.model);
781
798
  const endpoint = `/model/${encodeURIComponent(bareModel)}/invoke`;
782
799
  const url = `${baseUrl}${endpoint}`;
783
800
  const response = await postAnthropicRequest({
@@ -832,7 +849,7 @@ var FaultInjectingLlmClient = class {
832
849
  return yield* this.inner.stream(request, signal);
833
850
  }
834
851
  if (parsed.status >= 400) {
835
- throw chunkE3OCRJU6_cjs.mapOpenAICompatibleError({
852
+ throw chunkDQKERTND_cjs.mapOpenAICompatibleError({
836
853
  providerId: this.name,
837
854
  status: parsed.status,
838
855
  body: parsed.body,
@@ -879,7 +896,7 @@ function parseOverrideOrWarnOnce() {
879
896
  function warnInvalidJsonOnce(_raw) {
880
897
  if (warnedInvalidJson) return;
881
898
  warnedInvalidJson = true;
882
- chunkSXSPMRSV_cjs.diag(
899
+ chunkNUKRL3I6_cjs.diag(
883
900
  `[theokit-sdk] ${ENV_OVERRIDE_KEY} is set but value is not valid JSON of shape \`{"status": number, "body": object | string}\`. Falling back to real LLM call. This warning is shown once per process.
884
901
  `
885
902
  );
@@ -907,7 +924,7 @@ function mapOllamaTransportError(args) {
907
924
  if (args.providerId !== "ollama") return void 0;
908
925
  const causeCode = extractCauseCode(args.cause);
909
926
  if (causeCode !== "ECONNREFUSED" && causeCode !== "ENOTFOUND") return void 0;
910
- const metadata = chunkE3OCRJU6_cjs.buildErrorMetadata({
927
+ const metadata = chunkDQKERTND_cjs.buildErrorMetadata({
911
928
  provider: "ollama",
912
929
  endpoint: args.endpoint,
913
930
  code: "network",
@@ -915,7 +932,7 @@ function mapOllamaTransportError(args) {
915
932
  headers: void 0,
916
933
  body: { cause: causeCode }
917
934
  });
918
- return new chunk2YGIBOUH_cjs.ConfigurationError(
935
+ return new chunkK3FW2XZD_cjs.ConfigurationError(
919
936
  "Ollama is not reachable. Run `ollama serve` to start the local runtime, or set OLLAMA_HOST to point at a remote Ollama server.",
920
937
  { code: "ollama_unreachable", metadata }
921
938
  );
@@ -925,7 +942,7 @@ function mapOllamaHttpError(args) {
925
942
  const errString = extractErrorString(args.body).toLowerCase();
926
943
  if (args.status === 404 && errString.includes("not found") && errString.includes("pull")) {
927
944
  const modelHint = extractModelName(errString);
928
- const metadata = chunkE3OCRJU6_cjs.buildErrorMetadata({
945
+ const metadata = chunkDQKERTND_cjs.buildErrorMetadata({
929
946
  provider: "ollama",
930
947
  endpoint: args.endpoint,
931
948
  code: "model_unavailable",
@@ -934,13 +951,13 @@ function mapOllamaHttpError(args) {
934
951
  body: args.body
935
952
  });
936
953
  const pullCmd = modelHint !== void 0 ? `ollama pull ${modelHint}` : "ollama pull <model>";
937
- return new chunk2YGIBOUH_cjs.ConfigurationError(
954
+ return new chunkK3FW2XZD_cjs.ConfigurationError(
938
955
  `Ollama model is not pulled. Run \`${pullCmd}\` to download it first.`,
939
956
  { code: "ollama_model_not_pulled", metadata }
940
957
  );
941
958
  }
942
959
  if (args.status === 503 && errString.includes("model is loading")) {
943
- const metadata = chunkE3OCRJU6_cjs.buildErrorMetadata({
960
+ const metadata = chunkDQKERTND_cjs.buildErrorMetadata({
944
961
  provider: "ollama",
945
962
  endpoint: args.endpoint,
946
963
  code: "server_error",
@@ -948,7 +965,7 @@ function mapOllamaHttpError(args) {
948
965
  headers: args.headers,
949
966
  body: args.body
950
967
  });
951
- return new chunk2YGIBOUH_cjs.NetworkError(
968
+ return new chunkK3FW2XZD_cjs.NetworkError(
952
969
  "Ollama model is loading. Retry in a few seconds \u2014 Ollama is warming up the model into memory.",
953
970
  { code: "ollama_model_loading", metadata }
954
971
  );
@@ -1169,7 +1186,7 @@ function toOllamaMessages(message) {
1169
1186
  }
1170
1187
  if (message.role === "user") {
1171
1188
  if (message.content.some((p) => p.type === "image")) {
1172
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
1189
+ throw new chunkK3FW2XZD_cjs.ConfigurationError(
1173
1190
  "image input is not supported on the ollama-native provider; use an OpenAI/OpenRouter model for multimodal turns",
1174
1191
  { code: "ollama_image_unsupported" }
1175
1192
  );
@@ -1230,10 +1247,21 @@ function shouldUseFixtureMode(apiKey) {
1230
1247
  if (getConfiguredBaseUrl() !== void 0) return false;
1231
1248
  return isFixtureApiKey(apiKey);
1232
1249
  }
1250
+ var PROVIDER_CREDENTIAL_ENV_VARS = [
1251
+ "ANTHROPIC_API_KEY",
1252
+ "OPENAI_API_KEY",
1253
+ "OPENROUTER_API_KEY"
1254
+ ];
1255
+ function presentProviderCredentialEnvVars() {
1256
+ return PROVIDER_CREDENTIAL_ENV_VARS.filter((name) => {
1257
+ const value = process.env[name];
1258
+ return typeof value === "string" && value.length > 0;
1259
+ });
1260
+ }
1233
1261
  function shouldUseRealLocalRuntime(apiKey) {
1234
1262
  if (isFixtureApiKey(apiKey)) return false;
1235
1263
  if (apiKey === void 0 || apiKey.length === 0) return false;
1236
- return typeof process.env.ANTHROPIC_API_KEY === "string" && process.env.ANTHROPIC_API_KEY.length > 0 || typeof process.env.OPENAI_API_KEY === "string" && process.env.OPENAI_API_KEY.length > 0 || typeof process.env.OPENROUTER_API_KEY === "string" && process.env.OPENROUTER_API_KEY.length > 0 || isAwsBedrockAuthAvailable() || isGcpVertexAuthAvailable() || isLocalNoAuthProviderAvailable();
1264
+ return presentProviderCredentialEnvVars().length > 0 || isAwsBedrockAuthAvailable() || isGcpVertexAuthAvailable() || isLocalNoAuthProviderAvailable();
1237
1265
  }
1238
1266
  function isAwsBedrockAuthAvailable() {
1239
1267
  if (typeof process.env.AWS_BEARER_TOKEN_BEDROCK === "string" && process.env.AWS_BEARER_TOKEN_BEDROCK.length > 0) {
@@ -1298,7 +1326,7 @@ async function safeFetch(fetchFn, url, init) {
1298
1326
  try {
1299
1327
  return await fetchFn(url, init);
1300
1328
  } catch (cause) {
1301
- throw new chunk2YGIBOUH_cjs.NetworkError("HTTP request failed", { code: "network_error", cause });
1329
+ throw new chunkK3FW2XZD_cjs.NetworkError("HTTP request failed", { code: "network_error", cause });
1302
1330
  }
1303
1331
  }
1304
1332
  async function safeParseJsonResponse(response) {
@@ -1325,7 +1353,7 @@ function mapHttpStatusToError(status, body) {
1325
1353
  cause: body
1326
1354
  };
1327
1355
  if (envelope.code === "integration_not_connected") {
1328
- return new chunk2YGIBOUH_cjs.IntegrationNotConnectedError(message, {
1356
+ return new chunkK3FW2XZD_cjs.IntegrationNotConnectedError(message, {
1329
1357
  provider: envelope.provider ?? "unknown",
1330
1358
  helpUrl: envelope.helpUrl ?? "",
1331
1359
  code: envelope.code,
@@ -1333,18 +1361,18 @@ function mapHttpStatusToError(status, body) {
1333
1361
  });
1334
1362
  }
1335
1363
  if (status === 401 || status === 403) {
1336
- return new chunk2YGIBOUH_cjs.AuthenticationError(message, errorOptions);
1364
+ return new chunkK3FW2XZD_cjs.AuthenticationError(message, errorOptions);
1337
1365
  }
1338
1366
  if (status === 429) {
1339
- return new chunk2YGIBOUH_cjs.RateLimitError(message, errorOptions);
1367
+ return new chunkK3FW2XZD_cjs.RateLimitError(message, errorOptions);
1340
1368
  }
1341
1369
  if (status >= 400 && status < 500) {
1342
- return new chunk2YGIBOUH_cjs.ConfigurationError(message, errorOptions);
1370
+ return new chunkK3FW2XZD_cjs.ConfigurationError(message, errorOptions);
1343
1371
  }
1344
1372
  if (status >= 500) {
1345
- return new chunk2YGIBOUH_cjs.NetworkError(message, errorOptions);
1373
+ return new chunkK3FW2XZD_cjs.NetworkError(message, errorOptions);
1346
1374
  }
1347
- return new chunk2YGIBOUH_cjs.UnknownAgentError(message, errorOptions);
1375
+ return new chunkK3FW2XZD_cjs.UnknownAgentError(message, errorOptions);
1348
1376
  }
1349
1377
  function extractErrorEnvelope(body) {
1350
1378
  if (!body || typeof body !== "object") return {};
@@ -1598,7 +1626,7 @@ var OpenAIClient = class {
1598
1626
  endpoint: "/v1/chat/completions"
1599
1627
  });
1600
1628
  if (ollamaMapped !== void 0) throw ollamaMapped;
1601
- throw chunkE3OCRJU6_cjs.mapOpenAICompatibleError({
1629
+ throw chunkDQKERTND_cjs.mapOpenAICompatibleError({
1602
1630
  providerId,
1603
1631
  status: response.status,
1604
1632
  body,
@@ -1614,7 +1642,14 @@ var OpenAIClient = class {
1614
1642
  new Set(request.tools?.map((tool) => tool.name) ?? [])
1615
1643
  );
1616
1644
  let sawDone = false;
1617
- for await (const record of parseSseStream(response.body, signal)) {
1645
+ const records = (async function* () {
1646
+ try {
1647
+ yield* parseSseStream(response.body, signal);
1648
+ } catch (readErr) {
1649
+ throw wrapTransportError(readErr, { providerId, endpoint: "/v1/chat/completions" });
1650
+ }
1651
+ })();
1652
+ for await (const record of records) {
1618
1653
  if (record.data === "[DONE]") {
1619
1654
  sawDone = true;
1620
1655
  break;
@@ -1627,7 +1662,7 @@ var OpenAIClient = class {
1627
1662
  }
1628
1663
  if (chunk.error !== void 0 && chunk.error !== null) {
1629
1664
  const status = typeof chunk.error.code === "number" ? chunk.error.code : 502;
1630
- throw chunkE3OCRJU6_cjs.mapOpenAICompatibleError({
1665
+ throw chunkDQKERTND_cjs.mapOpenAICompatibleError({
1631
1666
  providerId,
1632
1667
  status,
1633
1668
  body: chunk,
@@ -1639,7 +1674,7 @@ var OpenAIClient = class {
1639
1674
  for (const event of events) yield event;
1640
1675
  }
1641
1676
  if (!sawDone && !accumulator.finishReasonSeen) {
1642
- throw new chunk2YGIBOUH_cjs.NetworkError("SSE stream truncated (no finish_reason / [DONE])", {
1677
+ throw new chunkK3FW2XZD_cjs.NetworkError("SSE stream truncated (no finish_reason / [DONE])", {
1643
1678
  code: "stream_truncated"
1644
1679
  });
1645
1680
  }
@@ -1771,13 +1806,13 @@ var OpenAIStreamAccumulator = class {
1771
1806
  toolCalls.push(...recovered.toolCalls);
1772
1807
  text = recovered.residualText;
1773
1808
  stopReason = "tool_use";
1774
- chunkSXSPMRSV_cjs.diag(
1809
+ chunkNUKRL3I6_cjs.diag(
1775
1810
  `[theokit-sdk] recovered ${recovered.toolCalls.length} leaked tool call(s) from assistant content (provider="${this.providerName}", names=${recovered.toolCalls.map((c) => c.name).join(",")})
1776
1811
  `
1777
1812
  );
1778
1813
  }
1779
1814
  if (recovered.droppedNames.length > 0) {
1780
- chunkSXSPMRSV_cjs.diag(
1815
+ chunkNUKRL3I6_cjs.diag(
1781
1816
  `[theokit-sdk] dropped ${recovered.droppedNames.length} leaked block(s) whose name is not a tool in the request (provider="${this.providerName}", names=${recovered.droppedNames.join(",")})
1782
1817
  `
1783
1818
  );
@@ -1899,10 +1934,10 @@ async function tryFirstEvent(client, request, signal, logFallback = false) {
1899
1934
  const firstResult = await generator.next();
1900
1935
  return { kind: "ok", generator, firstResult };
1901
1936
  } catch (cause) {
1902
- if (cause instanceof chunk2YGIBOUH_cjs.NetworkError || cause instanceof chunk2YGIBOUH_cjs.RateLimitError || cause instanceof chunk2YGIBOUH_cjs.AuthenticationError) {
1937
+ if (cause instanceof chunkK3FW2XZD_cjs.NetworkError || cause instanceof chunkK3FW2XZD_cjs.RateLimitError || cause instanceof chunkK3FW2XZD_cjs.AuthenticationError) {
1903
1938
  if (logFallback) {
1904
1939
  const errCode = cause.metadata?.code ?? cause.code ?? "unknown";
1905
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] provider ${client.name} failed (${errCode}): falling back
1940
+ chunkNUKRL3I6_cjs.diag(`[theokit-sdk] provider ${client.name} failed (${errCode}): falling back
1906
1941
  `);
1907
1942
  }
1908
1943
  return { kind: "handshake_error", error: cause };
@@ -1944,7 +1979,7 @@ var PoolAwareLlmClient = class {
1944
1979
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: stream() must serialize pool-select → build client → first-event probe → classify → retry/rotate/propagate. Extracting helpers fragments the linear narrative; the comments above each branch keep it readable.
1945
1980
  async *stream(request, signal) {
1946
1981
  if (this.breaker.shouldSkip(this.pool.provider)) {
1947
- throw new chunk2YGIBOUH_cjs.NetworkError(`${this.pool.provider} circuit open \u2014 failing fast`, {
1982
+ throw new chunkK3FW2XZD_cjs.NetworkError(`${this.pool.provider} circuit open \u2014 failing fast`, {
1948
1983
  code: "circuit_open"
1949
1984
  });
1950
1985
  }
@@ -1963,7 +1998,7 @@ var PoolAwareLlmClient = class {
1963
1998
  }
1964
1999
  if (entry === null) {
1965
2000
  this.breaker.recordTimeout(this.pool.provider);
1966
- throw new chunk2YGIBOUH_cjs.CredentialPoolExhaustedError(
2001
+ throw new chunkK3FW2XZD_cjs.CredentialPoolExhaustedError(
1967
2002
  `All ${this.pool.provider} credentials exhausted; next retry available at ${this.nextRetryHint() ?? "unknown"}`,
1968
2003
  { provider: this.pool.provider, nextRetryAt: this.nextRetryHint() }
1969
2004
  );
@@ -1977,13 +2012,13 @@ var PoolAwareLlmClient = class {
1977
2012
  }
1978
2013
  const decision = classifyAndDecide(attempt.error, hasRetried429);
1979
2014
  if (decision === "retry") {
1980
- const backoffMs = chunkRAACTJ7C_cjs.computeBackoffMs({
2015
+ const backoffMs = chunkF3YZMOAU_cjs.computeBackoffMs({
1981
2016
  attempt: 0,
1982
2017
  ...this.backoffBaseMs !== void 0 ? { baseMs: this.backoffBaseMs } : {},
1983
2018
  ...this.rng !== void 0 ? { rng: this.rng } : {}
1984
2019
  });
1985
2020
  this.onRateLimit?.({ attempt: 1, retryAfterMs: backoffMs });
1986
- await chunkRAACTJ7C_cjs.sleepWithAbort(backoffMs, signal);
2021
+ await chunkF3YZMOAU_cjs.sleepWithAbort(backoffMs, signal);
1987
2022
  hasRetried429 = true;
1988
2023
  continue;
1989
2024
  }
@@ -1995,7 +2030,7 @@ var PoolAwareLlmClient = class {
1995
2030
  ...parseRetryAfterMs(attempt.error) !== void 0 ? { resetAtMs: parseRetryAfterMs(attempt.error) } : {}
1996
2031
  });
1997
2032
  } catch (persistErr) {
1998
- chunkSXSPMRSV_cjs.diag(
2033
+ chunkNUKRL3I6_cjs.diag(
1999
2034
  `[theokit-sdk] credential-pool: persist failed during rotate; continuing in-memory: ${persistErr instanceof Error ? persistErr.message : String(persistErr)}
2000
2035
  `
2001
2036
  );
@@ -2017,8 +2052,8 @@ var PoolAwareLlmClient = class {
2017
2052
  }
2018
2053
  };
2019
2054
  function classifyAndDecide(error, hasRetried429) {
2020
- if (error instanceof chunk2YGIBOUH_cjs.NetworkError) return "propagate";
2021
- if (error instanceof chunk2YGIBOUH_cjs.AuthenticationError) return "rotate";
2055
+ if (error instanceof chunkK3FW2XZD_cjs.NetworkError) return "propagate";
2056
+ if (error instanceof chunkK3FW2XZD_cjs.AuthenticationError) return "rotate";
2022
2057
  const status = error.metadata?.statusCode ?? 429;
2023
2058
  if (status === 402) return "rotate";
2024
2059
  return hasRetried429 ? "rotate" : "retry";
@@ -2031,8 +2066,8 @@ function parseRetryAfterMs(error) {
2031
2066
  return void 0;
2032
2067
  }
2033
2068
  function inferStatusCode(error) {
2034
- if (error instanceof chunk2YGIBOUH_cjs.AuthenticationError) return 401;
2035
- if (error instanceof chunk2YGIBOUH_cjs.RateLimitError) return 429;
2069
+ if (error instanceof chunkK3FW2XZD_cjs.AuthenticationError) return 401;
2070
+ if (error instanceof chunkK3FW2XZD_cjs.RateLimitError) return 429;
2036
2071
  return 0;
2037
2072
  }
2038
2073
  function abortError(signal) {
@@ -2140,7 +2175,7 @@ var ResponsesApiClient = class {
2140
2175
  body = JSON.parse(text2);
2141
2176
  } catch {
2142
2177
  }
2143
- throw chunkE3OCRJU6_cjs.mapOpenAICompatibleError({
2178
+ throw chunkDQKERTND_cjs.mapOpenAICompatibleError({
2144
2179
  providerId,
2145
2180
  status: response.status,
2146
2181
  body,
@@ -2211,7 +2246,7 @@ var ResponsesApiClient = class {
2211
2246
  } else if (t === "response.failed" || t === "error") {
2212
2247
  const msg = event.response?.error?.message ?? event.message ?? "responses stream failed";
2213
2248
  yield { type: "error", message: msg };
2214
- throw chunkE3OCRJU6_cjs.mapOpenAICompatibleError({
2249
+ throw chunkDQKERTND_cjs.mapOpenAICompatibleError({
2215
2250
  providerId,
2216
2251
  status: 502,
2217
2252
  body: { error: { message: msg } },
@@ -2242,14 +2277,14 @@ function abortError2(signal) {
2242
2277
  // src/internal/llm/retrying-client.ts
2243
2278
  var MAX_ATTEMPTS = 3;
2244
2279
  function isRetriableError(err) {
2245
- if (!chunk2YGIBOUH_cjs.isTransientError(err)) return false;
2246
- if (err instanceof chunk2YGIBOUH_cjs.CredentialPoolExhaustedError) return false;
2247
- if (err instanceof chunk2YGIBOUH_cjs.TheokitAgentError && err.code === "circuit_open") return false;
2248
- if (err instanceof chunk2YGIBOUH_cjs.RateLimitError && err.metadata?.statusCode === 402) return false;
2280
+ if (!chunkK3FW2XZD_cjs.isTransientError(err)) return false;
2281
+ if (err instanceof chunkK3FW2XZD_cjs.CredentialPoolExhaustedError) return false;
2282
+ if (err instanceof chunkK3FW2XZD_cjs.TheokitAgentError && err.code === "circuit_open") return false;
2283
+ if (err instanceof chunkK3FW2XZD_cjs.RateLimitError && err.metadata?.statusCode === 402) return false;
2249
2284
  return true;
2250
2285
  }
2251
2286
  function retryAfterHintMs(err) {
2252
- if (!(err instanceof chunk2YGIBOUH_cjs.RateLimitError)) return void 0;
2287
+ if (!(err instanceof chunkK3FW2XZD_cjs.RateLimitError)) return void 0;
2253
2288
  const seconds = err.metadata?.retryAfter;
2254
2289
  return typeof seconds === "number" && seconds > 0 ? seconds * 1e3 : void 0;
2255
2290
  }
@@ -2295,16 +2330,16 @@ var RetryingLlmClient = class {
2295
2330
  */
2296
2331
  async #waitBackoff(err, attempt, signal) {
2297
2332
  const hint = retryAfterHintMs(err);
2298
- const ms = chunkRAACTJ7C_cjs.computeBackoffMs({
2333
+ const ms = chunkF3YZMOAU_cjs.computeBackoffMs({
2299
2334
  attempt,
2300
2335
  ...hint !== void 0 ? { retryAfterMs: hint } : {},
2301
2336
  ...this.#rng !== void 0 ? { rng: this.#rng } : {}
2302
2337
  });
2303
2338
  const cause = err instanceof Error ? err.name : typeof err;
2304
- chunkSXSPMRSV_cjs.diag(
2339
+ chunkNUKRL3I6_cjs.diag(
2305
2340
  `retry ${attempt + 1}/${MAX_ATTEMPTS} in ${String(ms)}ms \u2014 ${cause}` + (hint !== void 0 ? ` (Retry-After: ${String(hint)}ms)` : "")
2306
2341
  );
2307
- await chunkRAACTJ7C_cjs.sleepWithAbort(ms, signal);
2342
+ await chunkF3YZMOAU_cjs.sleepWithAbort(ms, signal);
2308
2343
  }
2309
2344
  async *stream(request, signal) {
2310
2345
  let lastError;
@@ -2342,7 +2377,7 @@ function classifyVertexError(args, errStatus) {
2342
2377
  return "unknown";
2343
2378
  }
2344
2379
  function vertexMetadata(args, code) {
2345
- return chunkE3OCRJU6_cjs.buildErrorMetadata({
2380
+ return chunkDQKERTND_cjs.buildErrorMetadata({
2346
2381
  provider: "vertex",
2347
2382
  endpoint: args.endpoint,
2348
2383
  code,
@@ -2352,23 +2387,23 @@ function vertexMetadata(args, code) {
2352
2387
  });
2353
2388
  }
2354
2389
  var VERTEX_ERROR_BUILDERS = {
2355
- rate_limit: (args, msg) => new chunk2YGIBOUH_cjs.RateLimitError(`Vertex quota exhausted: ${msg}`, {
2390
+ rate_limit: (args, msg) => new chunkK3FW2XZD_cjs.RateLimitError(`Vertex quota exhausted: ${msg}`, {
2356
2391
  metadata: vertexMetadata(args, "rate_limit")
2357
2392
  }),
2358
- auth_unauthenticated: (args, msg) => new chunk2YGIBOUH_cjs.AuthenticationError(`Vertex unauthenticated: ${msg}`, {
2393
+ auth_unauthenticated: (args, msg) => new chunkK3FW2XZD_cjs.AuthenticationError(`Vertex unauthenticated: ${msg}`, {
2359
2394
  metadata: vertexMetadata(args, "auth_failed")
2360
2395
  }),
2361
- auth_permission: (args, msg) => new chunk2YGIBOUH_cjs.AuthenticationError(`Vertex permission denied: ${msg}`, {
2396
+ auth_permission: (args, msg) => new chunkK3FW2XZD_cjs.AuthenticationError(`Vertex permission denied: ${msg}`, {
2362
2397
  metadata: vertexMetadata(args, "auth_failed")
2363
2398
  }),
2364
- invalid_request: (args, msg) => new chunk2YGIBOUH_cjs.ConfigurationError(`Vertex validation: ${msg}`, {
2399
+ invalid_request: (args, msg) => new chunkK3FW2XZD_cjs.ConfigurationError(`Vertex validation: ${msg}`, {
2365
2400
  metadata: vertexMetadata(args, "invalid_request")
2366
2401
  }),
2367
- timeout: (args, msg) => new chunk2YGIBOUH_cjs.NetworkError(`Vertex timeout: ${msg}`, { metadata: vertexMetadata(args, "timeout") }),
2368
- server_error: (args, msg) => new chunk2YGIBOUH_cjs.NetworkError(`Vertex server error: ${msg}`, {
2402
+ timeout: (args, msg) => new chunkK3FW2XZD_cjs.NetworkError(`Vertex timeout: ${msg}`, { metadata: vertexMetadata(args, "timeout") }),
2403
+ server_error: (args, msg) => new chunkK3FW2XZD_cjs.NetworkError(`Vertex server error: ${msg}`, {
2369
2404
  metadata: vertexMetadata(args, "server_error")
2370
2405
  }),
2371
- unknown: (args, msg) => new chunk2YGIBOUH_cjs.UnknownAgentError(`Vertex unknown: ${msg}`, { metadata: vertexMetadata(args, "unknown") })
2406
+ unknown: (args, msg) => new chunkK3FW2XZD_cjs.UnknownAgentError(`Vertex unknown: ${msg}`, { metadata: vertexMetadata(args, "unknown") })
2372
2407
  };
2373
2408
  function mapVertexError(args) {
2374
2409
  const parsed = parseBody2(args.body);
@@ -2404,12 +2439,12 @@ async function resolveVertexAccessToken() {
2404
2439
  async function getAuthClientOrThrow() {
2405
2440
  let mod;
2406
2441
  try {
2407
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-DM6Y5B2G.cjs', document.baseURI).href)));
2442
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-UNDROG5N.cjs', document.baseURI).href)));
2408
2443
  mod = r("google-auth-library");
2409
2444
  } catch (err) {
2410
2445
  const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
2411
2446
  if (isModuleMissing) {
2412
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2447
+ throw new chunkK3FW2XZD_cjs.ConfigurationError(
2413
2448
  "Vertex provider requires `google-auth-library`. Install: `pnpm add google-auth-library`.",
2414
2449
  { code: "auth_failed", cause: err }
2415
2450
  );
@@ -2420,7 +2455,7 @@ async function getAuthClientOrThrow() {
2420
2455
  const auth = new mod.GoogleAuth({ scopes: [SCOPE_CLOUD_PLATFORM] });
2421
2456
  return await auth.getClient();
2422
2457
  } catch (err) {
2423
- chunkSXSPMRSV_cjs.diag(
2458
+ chunkNUKRL3I6_cjs.diag(
2424
2459
  `[theokit-sdk] Vertex ADC initialization failed: ${err instanceof Error ? err.message : String(err)}
2425
2460
  `
2426
2461
  );
@@ -2446,7 +2481,7 @@ var VertexAnthropicClient = class {
2446
2481
  resolveProjectOrThrow() {
2447
2482
  const projectId = this.options.projectId ?? resolveVertexProjectId();
2448
2483
  if (projectId !== void 0) return projectId;
2449
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2484
+ throw new chunkK3FW2XZD_cjs.ConfigurationError(
2450
2485
  "Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
2451
2486
  { code: "auth_failed" }
2452
2487
  );
@@ -2456,7 +2491,7 @@ var VertexAnthropicClient = class {
2456
2491
  if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
2457
2492
  const fromAdc = await resolveVertexAccessToken();
2458
2493
  if (fromAdc !== void 0 && fromAdc.length > 0) return fromAdc;
2459
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2494
+ throw new chunkK3FW2XZD_cjs.ConfigurationError(
2460
2495
  "Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
2461
2496
  { code: "auth_failed" }
2462
2497
  );
@@ -2465,8 +2500,8 @@ var VertexAnthropicClient = class {
2465
2500
  const projectId = this.resolveProjectOrThrow();
2466
2501
  const location = this.options.location ?? resolveVertexLocation();
2467
2502
  const accessToken = await this.resolveTokenOrThrow();
2468
- const baseUrl = chunkBC5EUG7R_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
2469
- const bareModel = chunkBC5EUG7R_cjs.stripVertexPrefix(request.model);
2503
+ const baseUrl = chunkRM7Y65IG_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
2504
+ const bareModel = chunkRM7Y65IG_cjs.stripVertexPrefix(request.model);
2470
2505
  const endpoint = `/models/${encodeURIComponent(bareModel)}:rawPredict`;
2471
2506
  const url = `${baseUrl}${endpoint}`;
2472
2507
  const response = await postAnthropicRequest({
@@ -2502,7 +2537,7 @@ var VertexGeminiClient = class {
2502
2537
  async *stream(request, signal) {
2503
2538
  const projectId = this.options.projectId ?? resolveVertexProjectId();
2504
2539
  if (projectId === void 0) {
2505
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2540
+ throw new chunkK3FW2XZD_cjs.ConfigurationError(
2506
2541
  "Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
2507
2542
  { code: "auth_failed" }
2508
2543
  );
@@ -2510,19 +2545,15 @@ var VertexGeminiClient = class {
2510
2545
  const location = this.options.location ?? resolveVertexLocation();
2511
2546
  const accessToken = this.options.apiKey !== void 0 && this.options.apiKey.length > 0 ? this.options.apiKey : await resolveVertexAccessToken();
2512
2547
  if (accessToken === void 0 || accessToken.length === 0) {
2513
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2548
+ throw new chunkK3FW2XZD_cjs.ConfigurationError(
2514
2549
  "Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
2515
2550
  { code: "auth_failed" }
2516
2551
  );
2517
2552
  }
2518
- const baseUrl = chunkBC5EUG7R_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
2553
+ const baseUrl = chunkRM7Y65IG_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
2519
2554
  const url = `${baseUrl}/chat/completions`;
2520
2555
  const innerFetch = this.options.fetch ?? fetch;
2521
- const rewriteFetch = (input, init) => {
2522
- const requested = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
2523
- const targetUrl = requested.endsWith("/v1/chat/completions") ? url : requested;
2524
- return innerFetch(targetUrl, init);
2525
- };
2556
+ const rewriteFetch = (_input, init) => innerFetch(url, init);
2526
2557
  const inner = new OpenAIClient({
2527
2558
  apiKey: accessToken,
2528
2559
  baseUrl: "https://_vertex_placeholder",
@@ -2541,7 +2572,7 @@ var VertexRouterClient = class {
2541
2572
  options;
2542
2573
  name = "vertex";
2543
2574
  async *stream(request, signal) {
2544
- const dialect = chunkBC5EUG7R_cjs.inferModelDialect(request.model);
2575
+ const dialect = chunkRM7Y65IG_cjs.inferModelDialect(request.model);
2545
2576
  if (dialect === "anthropic") {
2546
2577
  const inner2 = new VertexAnthropicClient(this.options);
2547
2578
  return yield* inner2.stream(request, signal);
@@ -2553,73 +2584,73 @@ var VertexRouterClient = class {
2553
2584
 
2554
2585
  // src/internal/llm/router.ts
2555
2586
  function resolveProviderChain(options) {
2556
- chunkBC5EUG7R_cjs.registerBuiltins();
2587
+ chunkRM7Y65IG_cjs.registerBuiltins();
2557
2588
  return buildChain(options);
2558
2589
  }
2559
2590
  function buildChain(options) {
2560
2591
  warnUnknownProvidersInApiKeys(options.apiKeys);
2561
2592
  const seen = /* @__PURE__ */ new Set();
2562
2593
  const clients = [];
2563
- const addClient = (name) => {
2594
+ const addClient = (name, perCallBaseUrl) => {
2564
2595
  const lowered = name.toLowerCase();
2565
2596
  if (seen.has(lowered)) return;
2566
2597
  seen.add(lowered);
2567
- const client = buildClient(lowered, options);
2598
+ const client = buildClient(lowered, options, perCallBaseUrl);
2568
2599
  if (client !== void 0) clients.push(maybeWrapWithFaultInjection(client));
2569
2600
  };
2570
- addClient(options.primary);
2601
+ addClient(options.primary, options.baseUrl);
2571
2602
  for (const fallback of options.fallback ?? []) addClient(fallback);
2572
2603
  if (clients.length === 0) {
2573
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2604
+ throw new chunkK3FW2XZD_cjs.ConfigurationError(
2574
2605
  `No provider client could be resolved (primary=${options.primary}). Set ANTHROPIC_API_KEY or OPENAI_API_KEY / OPENROUTER_API_KEY.`,
2575
2606
  { code: "provider_unresolved" }
2576
2607
  );
2577
2608
  }
2578
2609
  return clients;
2579
2610
  }
2580
- function buildClient(name, routerOptions) {
2581
- const baseProfile = chunkBC5EUG7R_cjs.getProviderProfile(name);
2611
+ function buildClient(name, routerOptions, perCallBaseUrl) {
2612
+ const baseProfile = chunkRM7Y65IG_cjs.getProviderProfile(name);
2582
2613
  if (baseProfile === void 0) return void 0;
2583
2614
  const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
2584
2615
  const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
2585
- const ambient = chunkRAACTJ7C_cjs.currentCredentialPool(name);
2616
+ const ambient = chunkF3YZMOAU_cjs.currentCredentialPool(name);
2586
2617
  if (ambient !== void 0) {
2587
2618
  return new RetryingLlmClient(
2588
2619
  new PoolAwareLlmClient(
2589
2620
  ambient,
2590
- (apiKey) => selectTransport(profile, apiKey),
2621
+ (apiKey) => selectTransport(profile, apiKey, perCallBaseUrl),
2591
2622
  void 0,
2592
2623
  resilience
2593
2624
  )
2594
2625
  );
2595
2626
  }
2596
2627
  const poolKeys = filterPoolKeys(routerOptions.apiKeys?.[name]);
2597
- const noAuthOverride = maybeBuildNoAuthTransport(profile, poolKeys);
2628
+ const noAuthOverride = maybeBuildNoAuthTransport(profile, poolKeys, perCallBaseUrl);
2598
2629
  if (noAuthOverride !== void 0) return noAuthOverride;
2599
- return buildPoolOrSingle({ name, profile, poolKeys, routerOptions });
2630
+ return buildPoolOrSingle({ name, profile, poolKeys, routerOptions, perCallBaseUrl });
2600
2631
  }
2601
- function maybeBuildNoAuthTransport(profile, poolKeys) {
2632
+ function maybeBuildNoAuthTransport(profile, poolKeys, baseUrl) {
2602
2633
  if (profile.authType !== "none" || poolKeys === void 0 || poolKeys.length === 0) {
2603
2634
  return void 0;
2604
2635
  }
2605
2636
  warnNoAuthApiKeysIgnoredOnce(profile.name);
2606
2637
  const sentinel = sentinelForNoAuth(profile);
2607
2638
  if (sentinel === void 0) return void 0;
2608
- return selectTransport(profile, sentinel);
2639
+ return selectTransport(profile, sentinel, baseUrl);
2609
2640
  }
2610
2641
  function buildPoolOrSingle(args) {
2611
- const { name, profile, poolKeys, routerOptions } = args;
2642
+ const { name, profile, poolKeys, routerOptions, perCallBaseUrl } = args;
2612
2643
  if (poolKeys !== void 0 && poolKeys.length >= 2) {
2613
2644
  const strategy = routerOptions.credentialPoolStrategy?.[name] ?? "fill_first";
2614
2645
  const entries = poolKeys.map(
2615
- (accessToken, priority) => chunkRAACTJ7C_cjs.newPooledCredential({ provider: name, accessToken, priority, source: "manual" })
2646
+ (accessToken, priority) => chunkF3YZMOAU_cjs.newPooledCredential({ provider: name, accessToken, priority, source: "manual" })
2616
2647
  );
2617
- const pool = new chunkRAACTJ7C_cjs.CredentialPool(name, entries, strategy);
2648
+ const pool = new chunkF3YZMOAU_cjs.CredentialPool(name, entries, strategy);
2618
2649
  const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
2619
2650
  return new RetryingLlmClient(
2620
2651
  new PoolAwareLlmClient(
2621
2652
  pool,
2622
- (apiKey2) => selectTransport(profile, apiKey2),
2653
+ (apiKey2) => selectTransport(profile, apiKey2, perCallBaseUrl),
2623
2654
  void 0,
2624
2655
  resilience
2625
2656
  )
@@ -2627,7 +2658,7 @@ function buildPoolOrSingle(args) {
2627
2658
  }
2628
2659
  const apiKey = poolKeys?.[0] ?? resolveApiKey(profile.envVars) ?? sentinelForNoAuth(profile) ?? sentinelForLazyAuth(profile);
2629
2660
  if (apiKey === void 0) return void 0;
2630
- return new RetryingLlmClient(selectTransport(profile, apiKey));
2661
+ return new RetryingLlmClient(selectTransport(profile, apiKey, perCallBaseUrl));
2631
2662
  }
2632
2663
  function resolveBaseUrlEnvOverride(providerName) {
2633
2664
  switch (providerName) {
@@ -2635,8 +2666,6 @@ function resolveBaseUrlEnvOverride(providerName) {
2635
2666
  return process.env.OPENAI_API_BASE_URL;
2636
2667
  case "openrouter":
2637
2668
  return process.env.OPENROUTER_API_BASE_URL;
2638
- case "ollama":
2639
- return process.env.OLLAMA_HOST;
2640
2669
  case "lmstudio":
2641
2670
  return process.env.LMSTUDIO_HOST;
2642
2671
  case "llamacpp":
@@ -2649,7 +2678,7 @@ var warnedNoAuthApiKeys = /* @__PURE__ */ new Set();
2649
2678
  function warnNoAuthApiKeysIgnoredOnce(provider) {
2650
2679
  if (warnedNoAuthApiKeys.has(provider)) return;
2651
2680
  warnedNoAuthApiKeys.add(provider);
2652
- chunkSXSPMRSV_cjs.diag(
2681
+ chunkNUKRL3I6_cjs.diag(
2653
2682
  `[theokit-sdk] provider "${provider}" has authType: "none" \u2014 apiKeys ignored (no auth required for local runtime).
2654
2683
  `
2655
2684
  );
@@ -2675,10 +2704,10 @@ function warnUnknownProvidersInApiKeys(apiKeys) {
2675
2704
  if (apiKeys === void 0) return;
2676
2705
  for (const name of Object.keys(apiKeys)) {
2677
2706
  if (warnedProviders.has(name)) continue;
2678
- const profile = chunkBC5EUG7R_cjs.getProviderProfile(name);
2707
+ const profile = chunkRM7Y65IG_cjs.getProviderProfile(name);
2679
2708
  if (profile === void 0) {
2680
2709
  warnedProviders.add(name);
2681
- chunkSXSPMRSV_cjs.diag(
2710
+ chunkNUKRL3I6_cjs.diag(
2682
2711
  `[theokit-sdk] credential-pool: unknown provider "${name}" in apiKeys (no profile registered)
2683
2712
  `
2684
2713
  );
@@ -2692,7 +2721,7 @@ function resolveApiKey(envVars) {
2692
2721
  }
2693
2722
  return void 0;
2694
2723
  }
2695
- function selectTransport(profile, apiKey) {
2724
+ function selectTransport(profile, apiKey, baseUrl) {
2696
2725
  const applyTransform = () => {
2697
2726
  if (profile.transform === void 0) return {};
2698
2727
  const ctx = { apiKey };
@@ -2710,14 +2739,14 @@ function selectTransport(profile, apiKey) {
2710
2739
  if (apiKey !== "__oauth_lazy_token__") return;
2711
2740
  const auth = t.headers?.authorization ?? t.headers?.Authorization;
2712
2741
  if (t.fetch === void 0 && auth === void 0) {
2713
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2742
+ throw new chunkK3FW2XZD_cjs.ConfigurationError(
2714
2743
  `provider "${profile.name}" uses OAuth (authType: ${profile.authType}) but no credential was resolved. Register a ProviderProfile.transform whose fetch (or headers.authorization) supplies the bearer \u2014 typically via resolveCredential() from "@theokit/sdk/auth".`
2715
2744
  );
2716
2745
  }
2717
2746
  };
2718
2747
  if (profile.apiMode === "chat_completions") {
2719
2748
  if (profile.name === "ollama") {
2720
- const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
2749
+ const ollamaBase = baseUrl ?? process.env.OLLAMA_HOST ?? profile.baseUrl;
2721
2750
  return new OllamaNativeClient({ apiKey, baseUrl: ollamaBase });
2722
2751
  }
2723
2752
  const opts = { apiKey };
@@ -2734,6 +2763,7 @@ function selectTransport(profile, apiKey) {
2734
2763
  }
2735
2764
  const envOverride = resolveBaseUrlEnvOverride(profile.name);
2736
2765
  if (envOverride !== void 0) opts.baseUrl = envOverride;
2766
+ if (baseUrl !== void 0) opts.baseUrl = baseUrl;
2737
2767
  return comTransform(opts, (o) => new OpenAIClient(o));
2738
2768
  }
2739
2769
  if (profile.apiMode === "anthropic_messages") {
@@ -2742,12 +2772,15 @@ function selectTransport(profile, apiKey) {
2742
2772
  return new VertexRouterClient(realKey !== void 0 ? { apiKey: realKey } : {});
2743
2773
  }
2744
2774
  const opts = { apiKey };
2745
- opts.baseUrl = process.env.ANTHROPIC_API_BASE_URL ?? profile.baseUrl;
2775
+ opts.baseUrl = baseUrl ?? process.env.ANTHROPIC_API_BASE_URL ?? profile.baseUrl;
2746
2776
  return comTransform(opts, (o) => new AnthropicClient(o));
2747
2777
  }
2748
2778
  if (profile.apiMode === "bedrock_anthropic") {
2749
2779
  const realKey = apiKey === "__bedrock_lazy_token__" ? void 0 : apiKey;
2750
- return new BedrockAnthropicClient(realKey !== void 0 ? { apiKey: realKey } : {});
2780
+ return new BedrockAnthropicClient({
2781
+ ...realKey !== void 0 ? { apiKey: realKey } : {},
2782
+ ...baseUrl !== void 0 ? { baseUrl } : {}
2783
+ });
2751
2784
  }
2752
2785
  if (profile.apiMode === "responses_api") {
2753
2786
  const t = applyTransform();
@@ -2755,13 +2788,14 @@ function selectTransport(profile, apiKey) {
2755
2788
  const mergedHeaders = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
2756
2789
  return new ResponsesApiClient({
2757
2790
  apiKey,
2758
- ...profile.baseUrl !== void 0 ? { baseUrl: profile.baseUrl } : {},
2791
+ // Per-call URL first, same contract as every other branch (B-150).
2792
+ ...(baseUrl ?? profile.baseUrl) !== void 0 ? { baseUrl: baseUrl ?? profile.baseUrl } : {},
2759
2793
  ...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
2760
2794
  ...t.fetch !== void 0 ? { fetch: t.fetch } : {},
2761
2795
  providerName: profile.name
2762
2796
  });
2763
2797
  }
2764
- throw new chunk2YGIBOUH_cjs.ConfigurationError(
2798
+ throw new chunkK3FW2XZD_cjs.ConfigurationError(
2765
2799
  `Provider "${profile.name}" requires apiMode "${profile.apiMode}" but no transport is registered. Install a third-party transport plugin (@theokit-transport-${profile.apiMode}) or use a provider with apiMode "chat_completions" or "anthropic_messages".`,
2766
2800
  { code: "transport_unavailable" }
2767
2801
  );
@@ -2771,7 +2805,7 @@ function selectTransport(profile, apiKey) {
2771
2805
  function inferProviderFromApiKey(apiKey) {
2772
2806
  const provider = chunkFRITRLZQ_cjs.providerFromApiKeyPrefix(apiKey);
2773
2807
  if (provider === void 0) return void 0;
2774
- return chunkBC5EUG7R_cjs.getProviderProfile(provider) === void 0 ? void 0 : provider;
2808
+ return chunkRM7Y65IG_cjs.getProviderProfile(provider) === void 0 ? void 0 : provider;
2775
2809
  }
2776
2810
  function detectPrimaryProvider() {
2777
2811
  if (process.env.ANTHROPIC_API_KEY !== void 0 && process.env.ANTHROPIC_API_KEY.length > 0) {
@@ -2785,6 +2819,17 @@ function detectPrimaryProvider() {
2785
2819
  }
2786
2820
  return "openai";
2787
2821
  }
2822
+ var warnedProviderPrecedence = /* @__PURE__ */ new Set();
2823
+ function warnProviderPrecedenceOnce(asked, used) {
2824
+ if (asked === void 0 || asked === used) return;
2825
+ const key = `${asked}->${used}`;
2826
+ if (warnedProviderPrecedence.has(key)) return;
2827
+ warnedProviderPrecedence.add(key);
2828
+ chunkNUKRL3I6_cjs.diag(
2829
+ `[theokit-sdk] model id names provider "${asked}", but "${used}" was used \u2014 an explicit \`providers.routes[0]\` or the API key's own prefix outranks the model id's prefix. Pass \`providers.routes\` to choose deliberately.
2830
+ `
2831
+ );
2832
+ }
2788
2833
 
2789
2834
  // src/internal/runtime/compression/compression-model-registry.ts
2790
2835
  var EXACT_REGISTRY = /* @__PURE__ */ new Map([
@@ -2906,7 +2951,7 @@ function plainText(content) {
2906
2951
  }
2907
2952
  async function compactSessionTranscript(opts) {
2908
2953
  const prior = await opts.store.readRecords(opts.loc.agentId);
2909
- const history = chunkECPL5RV6_cjs.reconstructMessages(prior);
2954
+ const history = chunkJHPGF3FP_cjs.reconstructMessages(prior);
2910
2955
  const compressible = [];
2911
2956
  for (const m of history) {
2912
2957
  const text = plainText(m.content);
@@ -2914,14 +2959,14 @@ async function compactSessionTranscript(opts) {
2914
2959
  compressible.push({ role: m.role, content: text });
2915
2960
  }
2916
2961
  }
2917
- const preTokens = chunkAMYY3JHQ_cjs.estimateTokens(compressible.map((m) => m.content).join("\n"));
2962
+ const preTokens = chunkXSX2UU6Y_cjs.estimateTokens(compressible.map((m) => m.content).join("\n"));
2918
2963
  const summaryBody = await opts.summarize(compressible);
2919
2964
  const preserved = [];
2920
2965
  let budget = 0;
2921
2966
  for (let i = compressible.length - 1; i >= 0; i--) {
2922
2967
  const m = compressible[i];
2923
2968
  if (m === void 0 || m.role !== "user" || isCompactSummary(m.content)) continue;
2924
- const cost = chunkAMYY3JHQ_cjs.estimateTokens(m.content);
2969
+ const cost = chunkXSX2UU6Y_cjs.estimateTokens(m.content);
2925
2970
  if (budget + cost > COMPACT_USER_MESSAGE_MAX_TOKENS) {
2926
2971
  const remaining = COMPACT_USER_MESSAGE_MAX_TOKENS - budget;
2927
2972
  if (remaining > 50) {
@@ -2935,7 +2980,7 @@ async function compactSessionTranscript(opts) {
2935
2980
  }
2936
2981
  const summary = `${COMPACT_SUMMARY_MARKER}
2937
2982
  ${summaryBody}`;
2938
- const transcript = chunkECPL5RV6_cjs.SessionTranscript.fromRecords(prior, {
2983
+ const transcript = chunkJHPGF3FP_cjs.SessionTranscript.fromRecords(prior, {
2939
2984
  cwd: opts.loc.cwd,
2940
2985
  sessionId: opts.sessionId,
2941
2986
  model: opts.loc.model ?? "unknown"
@@ -2945,8 +2990,8 @@ ${summaryBody}`;
2945
2990
  transcript.appendUserTurn(summary);
2946
2991
  const delta = transcript.records().slice(prior.length);
2947
2992
  await opts.store.appendRecords(opts.loc.agentId, delta);
2948
- chunk4JBHSLQO_cjs.invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
2949
- const postTokens = chunkAMYY3JHQ_cjs.estimateTokens([...preserved, summary].join("\n"));
2993
+ chunk4OTIXDMU_cjs.invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
2994
+ const postTokens = chunkXSX2UU6Y_cjs.estimateTokens([...preserved, summary].join("\n"));
2950
2995
  return { preTokens, postTokens };
2951
2996
  }
2952
2997
  function resolveSummarizerRoute(opts) {
@@ -2955,9 +3000,9 @@ function resolveSummarizerRoute(opts) {
2955
3000
  }
2956
3001
  function buildDefaultSummarizer(opts) {
2957
3002
  return async (messages) => {
2958
- chunkBC5EUG7R_cjs.registerBuiltins();
3003
+ chunkRM7Y65IG_cjs.registerBuiltins();
2959
3004
  const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
2960
- const prefixProfile = modelPrefix !== void 0 ? chunkBC5EUG7R_cjs.getProviderProfile(modelPrefix) : void 0;
3005
+ const prefixProfile = modelPrefix !== void 0 ? chunkRM7Y65IG_cjs.getProviderProfile(modelPrefix) : void 0;
2961
3006
  const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
2962
3007
  const route = resolveSummarizerRoute({
2963
3008
  keyProvider: inferProviderFromApiKey(opts.apiKey),
@@ -3028,7 +3073,7 @@ async function autoCompactIfNeeded(opts) {
3028
3073
  return true;
3029
3074
  } catch (cause) {
3030
3075
  const msg = cause instanceof Error ? cause.message : String(cause);
3031
- chunkSXSPMRSV_cjs.diag(`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
3076
+ chunkNUKRL3I6_cjs.diag(`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
3032
3077
  `);
3033
3078
  return false;
3034
3079
  }
@@ -3050,6 +3095,7 @@ exports.isFixtureApiKey = isFixtureApiKey;
3050
3095
  exports.mapOllamaHttpError = mapOllamaHttpError;
3051
3096
  exports.mapOllamaTransportError = mapOllamaTransportError;
3052
3097
  exports.parseSseStream = parseSseStream;
3098
+ exports.presentProviderCredentialEnvVars = presentProviderCredentialEnvVars;
3053
3099
  exports.readErrorResponseBody = readErrorResponseBody;
3054
3100
  exports.relayStream = relayStream;
3055
3101
  exports.renderToolResultContentText = renderToolResultContentText;
@@ -3059,5 +3105,6 @@ exports.shouldAutoCompact = shouldAutoCompact;
3059
3105
  exports.shouldUseFixtureMode = shouldUseFixtureMode;
3060
3106
  exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
3061
3107
  exports.tryFirstEvent = tryFirstEvent;
3062
- //# sourceMappingURL=chunk-DM6Y5B2G.cjs.map
3063
- //# sourceMappingURL=chunk-DM6Y5B2G.cjs.map
3108
+ exports.warnProviderPrecedenceOnce = warnProviderPrecedenceOnce;
3109
+ //# sourceMappingURL=chunk-UNDROG5N.cjs.map
3110
+ //# sourceMappingURL=chunk-UNDROG5N.cjs.map