@theokit/sdk 5.11.1 → 5.12.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 (408) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/dist/a2a/index.cjs +8 -8
  3. package/dist/a2a/index.js +3 -3
  4. package/dist/agent-BVKIUP7F.cjs +71 -0
  5. package/dist/{agent-OKP4LHG2.cjs.map → agent-BVKIUP7F.cjs.map} +1 -1
  6. package/dist/{agent-CmKwSyyD.d.ts → agent-CVzDy_Oj.d.ts} +17 -8
  7. package/dist/{agent-XMkGzff_.d.cts → agent-Cn0sphpA.d.cts} +17 -8
  8. package/dist/agent-IG7BP6GN.js +62 -0
  9. package/dist/{agent-DFV52V6E.js.map → agent-IG7BP6GN.js.map} +1 -1
  10. package/dist/agent-prims-CZyxfCmS.d.cts +206 -0
  11. package/dist/agent-prims-CZyxfCmS.d.ts +206 -0
  12. package/dist/agent-session-store-22GKA7O4.js +6 -0
  13. package/dist/{agent-session-store-ODD3IZCW.js.map → agent-session-store-22GKA7O4.js.map} +1 -1
  14. package/dist/agent-session-store-WP6NGDVX.cjs +23 -0
  15. package/dist/{agent-session-store-SVEJHSUA.cjs.map → agent-session-store-WP6NGDVX.cjs.map} +1 -1
  16. package/dist/auth/index.cjs +33 -33
  17. package/dist/auth/index.js +6 -6
  18. package/dist/{batch-427O54FQ.js → batch-EP3FCL6D.js} +9 -9
  19. package/dist/{batch-427O54FQ.js.map → batch-EP3FCL6D.js.map} +1 -1
  20. package/dist/{batch-U4SO4RLX.cjs → batch-IZ5EDKJ5.cjs} +29 -29
  21. package/dist/{batch-U4SO4RLX.cjs.map → batch-IZ5EDKJ5.cjs.map} +1 -1
  22. package/dist/{chunk-IIYJMXYW.cjs → chunk-27V5I2WW.cjs} +4 -4
  23. package/dist/{chunk-IIYJMXYW.cjs.map → chunk-27V5I2WW.cjs.map} +1 -1
  24. package/dist/{chunk-DPY2M74T.js → chunk-2C24NSNV.js} +5 -5
  25. package/dist/{chunk-DPY2M74T.js.map → chunk-2C24NSNV.js.map} +1 -1
  26. package/dist/{chunk-7F7XE6CM.js → chunk-2S4HQCDF.js} +3 -3
  27. package/dist/{chunk-7F7XE6CM.js.map → chunk-2S4HQCDF.js.map} +1 -1
  28. package/dist/{chunk-LZJXEPEQ.js → chunk-2SFLLOMN.js} +3 -3
  29. package/dist/{chunk-LZJXEPEQ.js.map → chunk-2SFLLOMN.js.map} +1 -1
  30. package/dist/{chunk-RGQICWFU.js → chunk-354F3OF5.js} +3 -3
  31. package/dist/{chunk-RGQICWFU.js.map → chunk-354F3OF5.js.map} +1 -1
  32. package/dist/{chunk-TX56N7FR.js → chunk-3FSBE4PS.js} +4 -4
  33. package/dist/{chunk-TX56N7FR.js.map → chunk-3FSBE4PS.js.map} +1 -1
  34. package/dist/{chunk-RQMCOFAI.cjs → chunk-3HA7N2BB.cjs} +8 -8
  35. package/dist/{chunk-RQMCOFAI.cjs.map → chunk-3HA7N2BB.cjs.map} +1 -1
  36. package/dist/{chunk-GM54F4FE.cjs → chunk-3KIUY67P.cjs} +9 -9
  37. package/dist/{chunk-GM54F4FE.cjs.map → chunk-3KIUY67P.cjs.map} +1 -1
  38. package/dist/{chunk-CZJ6Q7CW.js → chunk-3OY6H3I7.js} +66 -7
  39. package/dist/chunk-3OY6H3I7.js.map +1 -0
  40. package/dist/{chunk-ZWACQM5U.cjs → chunk-3WKWBYPO.cjs} +9 -9
  41. package/dist/{chunk-ZWACQM5U.cjs.map → chunk-3WKWBYPO.cjs.map} +1 -1
  42. package/dist/{chunk-Q34EBNYG.js → chunk-4GUFNDZR.js} +5 -5
  43. package/dist/{chunk-Q34EBNYG.js.map → chunk-4GUFNDZR.js.map} +1 -1
  44. package/dist/{chunk-XDUGSTYJ.cjs → chunk-4YD2WI57.cjs} +15 -15
  45. package/dist/{chunk-XDUGSTYJ.cjs.map → chunk-4YD2WI57.cjs.map} +1 -1
  46. package/dist/{chunk-SKDNCTXG.cjs → chunk-5A4UFBHW.cjs} +15 -15
  47. package/dist/{chunk-SKDNCTXG.cjs.map → chunk-5A4UFBHW.cjs.map} +1 -1
  48. package/dist/{chunk-SUVCHX4L.js → chunk-5AR6O7GW.js} +3 -3
  49. package/dist/{chunk-SUVCHX4L.js.map → chunk-5AR6O7GW.js.map} +1 -1
  50. package/dist/{chunk-SVCPJRUB.js → chunk-5HSMH2ZZ.js} +6 -6
  51. package/dist/{chunk-SVCPJRUB.js.map → chunk-5HSMH2ZZ.js.map} +1 -1
  52. package/dist/{chunk-GTX6FEDP.js → chunk-5IRDK5BC.js} +3 -3
  53. package/dist/{chunk-GTX6FEDP.js.map → chunk-5IRDK5BC.js.map} +1 -1
  54. package/dist/{chunk-H3CVJSFC.js → chunk-5IUDICRK.js} +3 -3
  55. package/dist/{chunk-H3CVJSFC.js.map → chunk-5IUDICRK.js.map} +1 -1
  56. package/dist/{chunk-FYEHYQ7T.cjs → chunk-6CXRYPG7.cjs} +15 -15
  57. package/dist/{chunk-FYEHYQ7T.cjs.map → chunk-6CXRYPG7.cjs.map} +1 -1
  58. package/dist/{chunk-NQVWSSX2.cjs → chunk-6OCJWGVD.cjs} +12 -12
  59. package/dist/{chunk-NQVWSSX2.cjs.map → chunk-6OCJWGVD.cjs.map} +1 -1
  60. package/dist/{chunk-MPR2ISL2.cjs → chunk-6XQLTQB6.cjs} +4 -4
  61. package/dist/{chunk-MPR2ISL2.cjs.map → chunk-6XQLTQB6.cjs.map} +1 -1
  62. package/dist/{chunk-72CPLZPC.cjs → chunk-7INPXUJI.cjs} +5 -5
  63. package/dist/{chunk-72CPLZPC.cjs.map → chunk-7INPXUJI.cjs.map} +1 -1
  64. package/dist/{chunk-HG5LKFG7.cjs → chunk-7WARNHWW.cjs} +16 -16
  65. package/dist/{chunk-HG5LKFG7.cjs.map → chunk-7WARNHWW.cjs.map} +1 -1
  66. package/dist/{chunk-KIKKTW5O.cjs → chunk-7YUPSBDV.cjs} +4 -4
  67. package/dist/{chunk-KIKKTW5O.cjs.map → chunk-7YUPSBDV.cjs.map} +1 -1
  68. package/dist/{chunk-IZDDSLL2.js → chunk-AB4OPJLD.js} +6 -6
  69. package/dist/{chunk-IZDDSLL2.js.map → chunk-AB4OPJLD.js.map} +1 -1
  70. package/dist/{chunk-XERM7PDQ.js → chunk-AGO5S5WD.js} +3 -3
  71. package/dist/{chunk-XERM7PDQ.js.map → chunk-AGO5S5WD.js.map} +1 -1
  72. package/dist/{chunk-ZWFTECOE.js → chunk-AHKS3DKI.js} +3 -3
  73. package/dist/{chunk-ZWFTECOE.js.map → chunk-AHKS3DKI.js.map} +1 -1
  74. package/dist/{chunk-ECD6ER3E.cjs → chunk-AIZ6WXSL.cjs} +4 -4
  75. package/dist/{chunk-ECD6ER3E.cjs.map → chunk-AIZ6WXSL.cjs.map} +1 -1
  76. package/dist/{chunk-KO6SHCEH.js → chunk-AQW54OWQ.js} +3 -3
  77. package/dist/{chunk-KO6SHCEH.js.map → chunk-AQW54OWQ.js.map} +1 -1
  78. package/dist/{chunk-P22BZE7G.cjs → chunk-AT2PESXB.cjs} +7 -7
  79. package/dist/{chunk-P22BZE7G.cjs.map → chunk-AT2PESXB.cjs.map} +1 -1
  80. package/dist/{chunk-MHIBYKWA.js → chunk-BJ7BPLQK.js} +131 -72
  81. package/dist/chunk-BJ7BPLQK.js.map +1 -0
  82. package/dist/{chunk-HV4V63CO.js → chunk-BO3PV3OP.js} +4 -4
  83. package/dist/{chunk-HV4V63CO.js.map → chunk-BO3PV3OP.js.map} +1 -1
  84. package/dist/{chunk-7NQ7HJ3E.cjs → chunk-BRWI4HLK.cjs} +6 -6
  85. package/dist/{chunk-7NQ7HJ3E.cjs.map → chunk-BRWI4HLK.cjs.map} +1 -1
  86. package/dist/{chunk-GHHIJEFX.cjs → chunk-BWYC7RZG.cjs} +9 -9
  87. package/dist/{chunk-GHHIJEFX.cjs.map → chunk-BWYC7RZG.cjs.map} +1 -1
  88. package/dist/{chunk-UNFBHV46.cjs → chunk-CEGU5AVD.cjs} +9 -9
  89. package/dist/chunk-CEGU5AVD.cjs.map +1 -0
  90. package/dist/{chunk-JV7JA7BM.cjs → chunk-CGH4BCIY.cjs} +11 -11
  91. package/dist/{chunk-JV7JA7BM.cjs.map → chunk-CGH4BCIY.cjs.map} +1 -1
  92. package/dist/{chunk-L3C6CCBG.cjs → chunk-CWQPQTUZ.cjs} +21 -21
  93. package/dist/{chunk-L3C6CCBG.cjs.map → chunk-CWQPQTUZ.cjs.map} +1 -1
  94. package/dist/{chunk-X3LOJJMO.js → chunk-DF77RBF4.js} +9 -9
  95. package/dist/{chunk-X3LOJJMO.js.map → chunk-DF77RBF4.js.map} +1 -1
  96. package/dist/{chunk-GMSRRJ53.js → chunk-EEK7S77K.js} +3 -3
  97. package/dist/{chunk-GMSRRJ53.js.map → chunk-EEK7S77K.js.map} +1 -1
  98. package/dist/{chunk-NKIQTLFA.cjs → chunk-EQ5IDL6W.cjs} +4 -4
  99. package/dist/{chunk-NKIQTLFA.cjs.map → chunk-EQ5IDL6W.cjs.map} +1 -1
  100. package/dist/{chunk-D5KXKBEN.cjs → chunk-FEAWEBWN.cjs} +5 -5
  101. package/dist/{chunk-D5KXKBEN.cjs.map → chunk-FEAWEBWN.cjs.map} +1 -1
  102. package/dist/{chunk-NJSIAJEK.cjs → chunk-FLDMPVUC.cjs} +4 -4
  103. package/dist/{chunk-NJSIAJEK.cjs.map → chunk-FLDMPVUC.cjs.map} +1 -1
  104. package/dist/{chunk-ASK2OQM5.cjs → chunk-G7XBVM3T.cjs} +5 -5
  105. package/dist/{chunk-ASK2OQM5.cjs.map → chunk-G7XBVM3T.cjs.map} +1 -1
  106. package/dist/{chunk-U27XHOEF.js → chunk-H7G65PNI.js} +5 -5
  107. package/dist/{chunk-U27XHOEF.js.map → chunk-H7G65PNI.js.map} +1 -1
  108. package/dist/{chunk-JW3GVLM6.cjs → chunk-H7HD6RXO.cjs} +4 -4
  109. package/dist/{chunk-JW3GVLM6.cjs.map → chunk-H7HD6RXO.cjs.map} +1 -1
  110. package/dist/{chunk-ZHWKT2NI.js → chunk-HJ2LV464.js} +3 -3
  111. package/dist/{chunk-ZHWKT2NI.js.map → chunk-HJ2LV464.js.map} +1 -1
  112. package/dist/{chunk-KGZ66JVZ.cjs → chunk-HN4IKB6X.cjs} +14 -14
  113. package/dist/{chunk-KGZ66JVZ.cjs.map → chunk-HN4IKB6X.cjs.map} +1 -1
  114. package/dist/{chunk-XKMVJ443.js → chunk-HWMGR3HA.js} +6 -6
  115. package/dist/{chunk-XKMVJ443.js.map → chunk-HWMGR3HA.js.map} +1 -1
  116. package/dist/{chunk-EQ5NCH2Y.cjs → chunk-IO4RI5ZJ.cjs} +24 -24
  117. package/dist/{chunk-EQ5NCH2Y.cjs.map → chunk-IO4RI5ZJ.cjs.map} +1 -1
  118. package/dist/{chunk-OLSEWLK5.cjs → chunk-IOFMRS6T.cjs} +6 -6
  119. package/dist/{chunk-OLSEWLK5.cjs.map → chunk-IOFMRS6T.cjs.map} +1 -1
  120. package/dist/{chunk-7QJYKVP6.js → chunk-KCM3RMKR.js} +3 -3
  121. package/dist/{chunk-7QJYKVP6.js.map → chunk-KCM3RMKR.js.map} +1 -1
  122. package/dist/{chunk-7KIN3L2S.js → chunk-KU5O7WPK.js} +3 -3
  123. package/dist/{chunk-7KIN3L2S.js.map → chunk-KU5O7WPK.js.map} +1 -1
  124. package/dist/{chunk-J5623RIV.cjs → chunk-KX5QXLBS.cjs} +10 -10
  125. package/dist/{chunk-J5623RIV.cjs.map → chunk-KX5QXLBS.cjs.map} +1 -1
  126. package/dist/{chunk-J6GXS5A2.cjs → chunk-L7JPXZ2C.cjs} +17 -17
  127. package/dist/{chunk-J6GXS5A2.cjs.map → chunk-L7JPXZ2C.cjs.map} +1 -1
  128. package/dist/{chunk-P7NNKEWO.cjs → chunk-L7V4DDIE.cjs} +4 -4
  129. package/dist/{chunk-P7NNKEWO.cjs.map → chunk-L7V4DDIE.cjs.map} +1 -1
  130. package/dist/chunk-LO6LIUZ6.cjs +18 -0
  131. package/dist/{chunk-SGC7LSHF.cjs.map → chunk-LO6LIUZ6.cjs.map} +1 -1
  132. package/dist/{chunk-P5N3Q2NH.cjs → chunk-LSWHDOCL.cjs} +192 -148
  133. package/dist/chunk-LSWHDOCL.cjs.map +1 -0
  134. package/dist/{chunk-3JHIFQ4I.js → chunk-M4U24U6G.js} +3 -3
  135. package/dist/{chunk-3JHIFQ4I.js.map → chunk-M4U24U6G.js.map} +1 -1
  136. package/dist/{chunk-GGRPAQ3B.js → chunk-MLGETTYX.js} +5 -5
  137. package/dist/{chunk-GGRPAQ3B.js.map → chunk-MLGETTYX.js.map} +1 -1
  138. package/dist/{chunk-XZHJYSPB.js → chunk-MLJDW2YK.js} +4 -4
  139. package/dist/{chunk-XZHJYSPB.js.map → chunk-MLJDW2YK.js.map} +1 -1
  140. package/dist/{chunk-5Q4RTLMP.js → chunk-MS3TQSXU.js} +3 -3
  141. package/dist/{chunk-5Q4RTLMP.js.map → chunk-MS3TQSXU.js.map} +1 -1
  142. package/dist/{chunk-W2ZVTEOD.js → chunk-MSEL5E5P.js} +6 -6
  143. package/dist/{chunk-W2ZVTEOD.js.map → chunk-MSEL5E5P.js.map} +1 -1
  144. package/dist/{chunk-ZAM7BJXJ.cjs → chunk-MSW7LB2V.cjs} +5 -5
  145. package/dist/{chunk-ZAM7BJXJ.cjs.map → chunk-MSW7LB2V.cjs.map} +1 -1
  146. package/dist/{chunk-7HUCU3KK.js → chunk-NHOEXFZT.js} +5 -5
  147. package/dist/{chunk-7HUCU3KK.js.map → chunk-NHOEXFZT.js.map} +1 -1
  148. package/dist/{chunk-6G4IRQUD.js → chunk-NJBJ3CUG.js} +6 -6
  149. package/dist/{chunk-6G4IRQUD.js.map → chunk-NJBJ3CUG.js.map} +1 -1
  150. package/dist/{chunk-I2ORT6QD.js → chunk-NKQVLWDF.js} +3 -3
  151. package/dist/{chunk-I2ORT6QD.js.map → chunk-NKQVLWDF.js.map} +1 -1
  152. package/dist/{chunk-N7KS3TIR.cjs → chunk-NP362THY.cjs} +28 -15
  153. package/dist/chunk-NP362THY.cjs.map +1 -0
  154. package/dist/{chunk-NWS2CS3Y.cjs → chunk-NWWTYBD3.cjs} +5 -5
  155. package/dist/{chunk-NWS2CS3Y.cjs.map → chunk-NWWTYBD3.cjs.map} +1 -1
  156. package/dist/{chunk-SVQIW5RJ.js → chunk-OLJOI4LK.js} +4 -4
  157. package/dist/{chunk-SVQIW5RJ.js.map → chunk-OLJOI4LK.js.map} +1 -1
  158. package/dist/{chunk-7JAKO3NM.js → chunk-ORLTGPOS.js} +3 -3
  159. package/dist/{chunk-7JAKO3NM.js.map → chunk-ORLTGPOS.js.map} +1 -1
  160. package/dist/{chunk-5DD4NJN3.js → chunk-PKRPV3R7.js} +3 -3
  161. package/dist/{chunk-5DD4NJN3.js.map → chunk-PKRPV3R7.js.map} +1 -1
  162. package/dist/{chunk-R5YPDAKD.cjs → chunk-POBZXULR.cjs} +4 -4
  163. package/dist/{chunk-R5YPDAKD.cjs.map → chunk-POBZXULR.cjs.map} +1 -1
  164. package/dist/{chunk-35KBC4BX.cjs → chunk-Q6WT5535.cjs} +446 -387
  165. package/dist/chunk-Q6WT5535.cjs.map +1 -0
  166. package/dist/{chunk-MQGSOKR3.js → chunk-Q7UG242V.js} +3 -3
  167. package/dist/{chunk-MQGSOKR3.js.map → chunk-Q7UG242V.js.map} +1 -1
  168. package/dist/{chunk-XKZFIP7Z.cjs → chunk-QG4SXZ2A.cjs} +4 -4
  169. package/dist/{chunk-XKZFIP7Z.cjs.map → chunk-QG4SXZ2A.cjs.map} +1 -1
  170. package/dist/{chunk-NAGPKWOD.cjs → chunk-QISSETTG.cjs} +4 -4
  171. package/dist/{chunk-NAGPKWOD.cjs.map → chunk-QISSETTG.cjs.map} +1 -1
  172. package/dist/{chunk-OR6XIWLB.js → chunk-QK2ERTO3.js} +4 -4
  173. package/dist/{chunk-OR6XIWLB.js.map → chunk-QK2ERTO3.js.map} +1 -1
  174. package/dist/{chunk-ZDYDBXSD.js → chunk-RN3XDZGS.js} +6 -6
  175. package/dist/{chunk-ZDYDBXSD.js.map → chunk-RN3XDZGS.js.map} +1 -1
  176. package/dist/{chunk-6LHQPOMI.cjs → chunk-RNXXYF22.cjs} +66 -7
  177. package/dist/chunk-RNXXYF22.cjs.map +1 -0
  178. package/dist/{chunk-TMKTSYDS.cjs → chunk-RS7YQR4X.cjs} +6 -6
  179. package/dist/{chunk-TMKTSYDS.cjs.map → chunk-RS7YQR4X.cjs.map} +1 -1
  180. package/dist/{chunk-HU666T3Q.cjs → chunk-S46WJTDL.cjs} +14 -14
  181. package/dist/{chunk-HU666T3Q.cjs.map → chunk-S46WJTDL.cjs.map} +1 -1
  182. package/dist/{chunk-ZD66GFH5.cjs → chunk-SDZ4XDWS.cjs} +35 -35
  183. package/dist/{chunk-ZD66GFH5.cjs.map → chunk-SDZ4XDWS.cjs.map} +1 -1
  184. package/dist/{chunk-ZJZ7LV3A.js → chunk-SV63WTA2.js} +3 -3
  185. package/dist/{chunk-ZJZ7LV3A.js.map → chunk-SV63WTA2.js.map} +1 -1
  186. package/dist/{chunk-CQYBJOB2.cjs → chunk-SXH37C7X.cjs} +4 -4
  187. package/dist/{chunk-CQYBJOB2.cjs.map → chunk-SXH37C7X.cjs.map} +1 -1
  188. package/dist/{chunk-GMRFAX4I.js → chunk-SZQFCHU6.js} +4 -4
  189. package/dist/{chunk-GMRFAX4I.js.map → chunk-SZQFCHU6.js.map} +1 -1
  190. package/dist/{chunk-6PB5AQCY.cjs → chunk-TLVI2OQK.cjs} +16 -16
  191. package/dist/{chunk-6PB5AQCY.cjs.map → chunk-TLVI2OQK.cjs.map} +1 -1
  192. package/dist/{chunk-B5MHRQJZ.js → chunk-TNFOU6SB.js} +3 -3
  193. package/dist/chunk-TNFOU6SB.js.map +1 -0
  194. package/dist/{chunk-N6OEX5TN.cjs → chunk-UDAKAE4Z.cjs} +16 -16
  195. package/dist/{chunk-N6OEX5TN.cjs.map → chunk-UDAKAE4Z.cjs.map} +1 -1
  196. package/dist/{chunk-26NEAJ6T.js → chunk-VVGFZQZC.js} +4 -4
  197. package/dist/{chunk-26NEAJ6T.js.map → chunk-VVGFZQZC.js.map} +1 -1
  198. package/dist/{chunk-XCQ432OX.js → chunk-VZGE7NAI.js} +3 -3
  199. package/dist/{chunk-XCQ432OX.js.map → chunk-VZGE7NAI.js.map} +1 -1
  200. package/dist/{chunk-C7GKRGKN.cjs → chunk-WDVG5R2Q.cjs} +19 -19
  201. package/dist/{chunk-C7GKRGKN.cjs.map → chunk-WDVG5R2Q.cjs.map} +1 -1
  202. package/dist/{chunk-FTZTZBCU.js → chunk-XESYJ4JC.js} +4 -4
  203. package/dist/{chunk-FTZTZBCU.js.map → chunk-XESYJ4JC.js.map} +1 -1
  204. package/dist/{chunk-OPAKPEPG.js → chunk-XJ3WU5CZ.js} +5 -5
  205. package/dist/{chunk-OPAKPEPG.js.map → chunk-XJ3WU5CZ.js.map} +1 -1
  206. package/dist/{chunk-BBJ77S62.js → chunk-XJ4C4NFX.js} +64 -20
  207. package/dist/chunk-XJ4C4NFX.js.map +1 -0
  208. package/dist/{chunk-AY43232P.js → chunk-XRPMZ7TO.js} +4 -4
  209. package/dist/{chunk-AY43232P.js.map → chunk-XRPMZ7TO.js.map} +1 -1
  210. package/dist/{chunk-X6DUEDAF.js → chunk-XZKIAENA.js} +3 -3
  211. package/dist/{chunk-X6DUEDAF.js.map → chunk-XZKIAENA.js.map} +1 -1
  212. package/dist/{chunk-X7EUUHXU.js → chunk-YMVTUV5K.js} +3 -3
  213. package/dist/{chunk-X7EUUHXU.js.map → chunk-YMVTUV5K.js.map} +1 -1
  214. package/dist/{chunk-3JANYJYS.cjs → chunk-YOVZMN4P.cjs} +8 -8
  215. package/dist/{chunk-3JANYJYS.cjs.map → chunk-YOVZMN4P.cjs.map} +1 -1
  216. package/dist/{chunk-TY56BKSK.cjs → chunk-YQ3XC6C2.cjs} +4 -4
  217. package/dist/{chunk-TY56BKSK.cjs.map → chunk-YQ3XC6C2.cjs.map} +1 -1
  218. package/dist/{chunk-JLIRFWUG.js → chunk-ZJAYFSVI.js} +22 -9
  219. package/dist/chunk-ZJAYFSVI.js.map +1 -0
  220. package/dist/{chunk-MU7IAA7G.js → chunk-ZLFFDPXC.js} +9 -9
  221. package/dist/{chunk-MU7IAA7G.js.map → chunk-ZLFFDPXC.js.map} +1 -1
  222. package/dist/{chunk-JLRLCBJ4.cjs → chunk-ZOFRNNZD.cjs} +4 -4
  223. package/dist/{chunk-JLRLCBJ4.cjs.map → chunk-ZOFRNNZD.cjs.map} +1 -1
  224. package/dist/{chunk-MPQJE3G4.cjs → chunk-ZWLFHSON.cjs} +15 -15
  225. package/dist/{chunk-MPQJE3G4.cjs.map → chunk-ZWLFHSON.cjs.map} +1 -1
  226. package/dist/compact-session-3U2JYTVG.js +25 -0
  227. package/dist/{compact-session-4HAUP3HK.js.map → compact-session-3U2JYTVG.js.map} +1 -1
  228. package/dist/{compact-session-Y56D3S57.cjs → compact-session-NM56BREJ.cjs} +24 -24
  229. package/dist/{compact-session-Y56D3S57.cjs.map → compact-session-NM56BREJ.cjs.map} +1 -1
  230. package/dist/compaction.cjs +18 -18
  231. package/dist/compaction.js +3 -3
  232. package/dist/concurrency.cjs +6 -6
  233. package/dist/concurrency.js +4 -4
  234. package/dist/context/index.cjs +9 -9
  235. package/dist/context/index.js +6 -6
  236. package/dist/context-4RSI3AXT.cjs +24 -0
  237. package/dist/{context-B5J4GX2F.cjs.map → context-4RSI3AXT.cjs.map} +1 -1
  238. package/dist/context-7EBZST3L.js +7 -0
  239. package/dist/{context-3FZRAO5K.js.map → context-7EBZST3L.js.map} +1 -1
  240. package/dist/{cron-Blj6wMYg.d.cts → cron-BWDYetbq.d.cts} +2 -2
  241. package/dist/{cron-BPccQCO8.d.ts → cron-CHn-F0fC.d.ts} +2 -2
  242. package/dist/cron.cjs +42 -42
  243. package/dist/cron.d.cts +4 -4
  244. package/dist/cron.d.ts +4 -4
  245. package/dist/cron.js +41 -41
  246. package/dist/{errors-BWOJeWTZ.d.cts → errors-BiDQFWTG.d.cts} +10 -7
  247. package/dist/{errors-DDvG18IB.d.ts → errors-Pf22PJJ-.d.ts} +10 -7
  248. package/dist/errors.cjs +23 -23
  249. package/dist/errors.d.cts +2 -3
  250. package/dist/errors.d.ts +2 -3
  251. package/dist/errors.js +2 -2
  252. package/dist/eval.cjs +54 -54
  253. package/dist/eval.js +42 -42
  254. package/dist/{executor-3NI7KNL4.js → executor-3D2UDJHW.js} +8 -8
  255. package/dist/{executor-3NI7KNL4.js.map → executor-3D2UDJHW.js.map} +1 -1
  256. package/dist/{executor-2SUGI3ZT.cjs → executor-HKHT4CWS.cjs} +26 -26
  257. package/dist/{executor-2SUGI3ZT.cjs.map → executor-HKHT4CWS.cjs.map} +1 -1
  258. package/dist/filesystem/index.cjs +12 -12
  259. package/dist/filesystem/index.js +3 -3
  260. package/dist/fs-session-store-6ZCCJX3K.js +11 -0
  261. package/dist/{fs-session-store-3VI4CPTX.js.map → fs-session-store-6ZCCJX3K.js.map} +1 -1
  262. package/dist/fs-session-store-S2AXVJIX.cjs +20 -0
  263. package/dist/{fs-session-store-IQ6PEHYF.cjs.map → fs-session-store-S2AXVJIX.cjs.map} +1 -1
  264. package/dist/generate-object-S7MNVF2V.js +7 -0
  265. package/dist/{generate-object-NTKAWE7D.js.map → generate-object-S7MNVF2V.js.map} +1 -1
  266. package/dist/generate-object-XBWD2PU7.cjs +20 -0
  267. package/dist/{generate-object-YHTWG5DB.cjs.map → generate-object-XBWD2PU7.cjs.map} +1 -1
  268. package/dist/index-manager-HO456AVW.cjs +27 -0
  269. package/dist/{index-manager-YGXRFJMZ.cjs.map → index-manager-HO456AVW.cjs.map} +1 -1
  270. package/dist/index-manager-QDH56FER.js +18 -0
  271. package/dist/{index-manager-JVYIVTZG.js.map → index-manager-QDH56FER.js.map} +1 -1
  272. package/dist/index.cjs +172 -172
  273. package/dist/index.d.cts +9 -9
  274. package/dist/index.d.ts +9 -9
  275. package/dist/index.js +59 -59
  276. package/dist/{inject-session-R73PRM7B.cjs → inject-session-JVTZNQF6.cjs} +9 -9
  277. package/dist/{inject-session-R73PRM7B.cjs.map → inject-session-JVTZNQF6.cjs.map} +1 -1
  278. package/dist/{inject-session-LJX5JGV5.js → inject-session-THABTKJY.js} +7 -7
  279. package/dist/{inject-session-LJX5JGV5.js.map → inject-session-THABTKJY.js.map} +1 -1
  280. package/dist/interactive/index.cjs +4 -4
  281. package/dist/interactive/index.js +2 -2
  282. package/dist/internal/budget/normalize-usage.d.ts +5 -1
  283. package/dist/internal/error-mappers/openai-compatible.d.ts +3 -1
  284. package/dist/internal/memory/adapters/index.cjs +8 -8
  285. package/dist/internal/memory/adapters/index.js +7 -7
  286. package/dist/internal/memory/storage/index.cjs +42 -42
  287. package/dist/internal/memory/storage/index.js +10 -10
  288. package/dist/internal/persistence/index.cjs +25 -25
  289. package/dist/internal/persistence/index.js +8 -8
  290. package/dist/internal/providers/catalog-schema.d.ts +1 -1
  291. package/dist/internal/runtime/lifecycle/throw-on-error-run.d.ts +18 -0
  292. package/dist/internal/runtime/model-selection.d.ts +1 -1
  293. package/dist/internal/runtime/system-prompt/native-reasoning.d.ts +2 -2
  294. package/dist/internal/runtime/typed-run-error.d.ts +16 -0
  295. package/dist/internal/security/index.cjs +13 -13
  296. package/dist/internal/security/index.js +3 -3
  297. package/dist/judge-call-4LR4IFVT.js +5 -0
  298. package/dist/{judge-call-LOL5FQEX.js.map → judge-call-4LR4IFVT.js.map} +1 -1
  299. package/dist/judge-call-ZTUQMQRL.cjs +22 -0
  300. package/dist/{judge-call-AQQYK6VT.cjs.map → judge-call-ZTUQMQRL.cjs.map} +1 -1
  301. package/dist/mcp-auth.cjs +14 -14
  302. package/dist/mcp-auth.js +4 -4
  303. package/dist/models.cjs +22 -22
  304. package/dist/models.js +8 -8
  305. package/dist/oauth-transaction-store-OMX436YB.cjs +38 -0
  306. package/dist/{oauth-transaction-store-ZINDV7AF.cjs.map → oauth-transaction-store-OMX436YB.cjs.map} +1 -1
  307. package/dist/oauth-transaction-store-U34YLEGP.js +5 -0
  308. package/dist/{oauth-transaction-store-NP2YHZ6D.js.map → oauth-transaction-store-U34YLEGP.js.map} +1 -1
  309. package/dist/path-safety.cjs +10 -10
  310. package/dist/path-safety.js +3 -3
  311. package/dist/persistence.cjs +31 -31
  312. package/dist/persistence.js +10 -10
  313. package/dist/project.cjs +5 -5
  314. package/dist/project.js +3 -3
  315. package/dist/providers.cjs +9 -9
  316. package/dist/providers.js +7 -7
  317. package/dist/registry-5TDAF7RK.js +9 -0
  318. package/dist/{registry-5FK42CRV.js.map → registry-5TDAF7RK.js.map} +1 -1
  319. package/dist/registry-W7TSCLQO.cjs +46 -0
  320. package/dist/{registry-BVTNO73E.cjs.map → registry-W7TSCLQO.cjs.map} +1 -1
  321. package/dist/retry.cjs +4 -4
  322. package/dist/retry.js +3 -3
  323. package/dist/{run-until-DG2KXWB2.cjs → run-until-4KHVF7YC.cjs} +8 -4
  324. package/dist/run-until-4KHVF7YC.cjs.map +1 -0
  325. package/dist/{run-until-6D6TQ4JN.js → run-until-G6BW2DWM.js} +8 -4
  326. package/dist/run-until-G6BW2DWM.js.map +1 -0
  327. package/dist/sandbox/index.cjs +22 -22
  328. package/dist/sandbox/index.js +4 -4
  329. package/dist/{run-DsA5Ip2i.d.cts → sdk-agent-4-dXI2GS.d.cts} +1500 -753
  330. package/dist/{run-DsA5Ip2i.d.ts → sdk-agent-CTOJlWA_.d.ts} +1500 -753
  331. package/dist/server/auth/index.cjs +22 -22
  332. package/dist/server/auth/index.js +7 -7
  333. package/dist/server/errors-envelope.cjs +14 -14
  334. package/dist/server/errors-envelope.d.cts +2 -3
  335. package/dist/server/errors-envelope.d.ts +2 -3
  336. package/dist/server/errors-envelope.js +3 -3
  337. package/dist/session-transcript-7TZ6HXSX.cjs +62 -0
  338. package/dist/{session-transcript-RACG7BK2.cjs.map → session-transcript-7TZ6HXSX.cjs.map} +1 -1
  339. package/dist/session-transcript-BSHZYYY6.js +5 -0
  340. package/dist/{session-transcript-AR7IBICT.js.map → session-transcript-BSHZYYY6.js.map} +1 -1
  341. package/dist/skills.cjs +8 -8
  342. package/dist/skills.js +5 -5
  343. package/dist/stream-object-R6SMYV4R.js +7 -0
  344. package/dist/{stream-object-QAEHG4YO.js.map → stream-object-R6SMYV4R.js.map} +1 -1
  345. package/dist/stream-object-TEEK3CAX.cjs +20 -0
  346. package/dist/{stream-object-TKVGGA54.cjs.map → stream-object-TEEK3CAX.cjs.map} +1 -1
  347. package/dist/subagents-loader-TXOA5EJJ.cjs +16 -0
  348. package/dist/{subagents-loader-5TZCAIYQ.cjs.map → subagents-loader-TXOA5EJJ.cjs.map} +1 -1
  349. package/dist/subagents-loader-Z744TAKD.js +7 -0
  350. package/dist/{subagents-loader-PEV3PD4Q.js.map → subagents-loader-Z744TAKD.js.map} +1 -1
  351. package/dist/subagents-loader.cjs +7 -7
  352. package/dist/subagents-loader.d.cts +4 -3
  353. package/dist/subagents-loader.d.ts +4 -3
  354. package/dist/subagents-loader.js +5 -5
  355. package/dist/subscription/index.cjs +3 -3
  356. package/dist/subscription/index.js +2 -2
  357. package/dist/task-store.cjs +7 -7
  358. package/dist/task-store.js +4 -4
  359. package/dist/types/agent-prims.d.ts +16 -0
  360. package/dist/types/agent.d.ts +15 -6
  361. package/dist/types/run.d.ts +14 -14
  362. package/dist/workflow.cjs +27 -27
  363. package/dist/workflow.d.cts +2 -2
  364. package/dist/workflow.d.ts +2 -2
  365. package/dist/workflow.js +6 -6
  366. package/docs/error-codes.md +24 -23
  367. package/docs/harness-capability-map.md +4 -4
  368. package/package.json +1 -1
  369. package/dist/agent-DFV52V6E.js +0 -62
  370. package/dist/agent-OKP4LHG2.cjs +0 -71
  371. package/dist/agent-session-store-ODD3IZCW.js +0 -6
  372. package/dist/agent-session-store-SVEJHSUA.cjs +0 -23
  373. package/dist/chunk-35KBC4BX.cjs.map +0 -1
  374. package/dist/chunk-6LHQPOMI.cjs.map +0 -1
  375. package/dist/chunk-B5MHRQJZ.js.map +0 -1
  376. package/dist/chunk-BBJ77S62.js.map +0 -1
  377. package/dist/chunk-CZJ6Q7CW.js.map +0 -1
  378. package/dist/chunk-JLIRFWUG.js.map +0 -1
  379. package/dist/chunk-MHIBYKWA.js.map +0 -1
  380. package/dist/chunk-N7KS3TIR.cjs.map +0 -1
  381. package/dist/chunk-P5N3Q2NH.cjs.map +0 -1
  382. package/dist/chunk-SGC7LSHF.cjs +0 -18
  383. package/dist/chunk-UNFBHV46.cjs.map +0 -1
  384. package/dist/compact-session-4HAUP3HK.js +0 -25
  385. package/dist/context-3FZRAO5K.js +0 -7
  386. package/dist/context-B5J4GX2F.cjs +0 -24
  387. package/dist/fs-session-store-3VI4CPTX.js +0 -11
  388. package/dist/fs-session-store-IQ6PEHYF.cjs +0 -20
  389. package/dist/generate-object-NTKAWE7D.js +0 -7
  390. package/dist/generate-object-YHTWG5DB.cjs +0 -20
  391. package/dist/index-manager-JVYIVTZG.js +0 -18
  392. package/dist/index-manager-YGXRFJMZ.cjs +0 -27
  393. package/dist/judge-call-AQQYK6VT.cjs +0 -22
  394. package/dist/judge-call-LOL5FQEX.js +0 -5
  395. package/dist/oauth-transaction-store-NP2YHZ6D.js +0 -5
  396. package/dist/oauth-transaction-store-ZINDV7AF.cjs +0 -38
  397. package/dist/registry-5FK42CRV.js +0 -9
  398. package/dist/registry-BVTNO73E.cjs +0 -46
  399. package/dist/run-until-6D6TQ4JN.js.map +0 -1
  400. package/dist/run-until-DG2KXWB2.cjs.map +0 -1
  401. package/dist/sdk-agent-dNwjwCt5.d.cts +0 -940
  402. package/dist/sdk-agent-wEOLXD3F.d.ts +0 -940
  403. package/dist/session-transcript-AR7IBICT.js +0 -5
  404. package/dist/session-transcript-RACG7BK2.cjs +0 -62
  405. package/dist/stream-object-QAEHG4YO.js +0 -7
  406. package/dist/stream-object-TKVGGA54.cjs +0 -20
  407. package/dist/subagents-loader-5TZCAIYQ.cjs +0 -16
  408. package/dist/subagents-loader-PEV3PD4Q.js +0 -7
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var chunkCQYBJOB2_cjs = require('./chunk-CQYBJOB2.cjs');
3
+ var chunkSXH37C7X_cjs = require('./chunk-SXH37C7X.cjs');
4
4
  var chunkYJNYDJ2T_cjs = require('./chunk-YJNYDJ2T.cjs');
5
- var chunkN7KS3TIR_cjs = require('./chunk-N7KS3TIR.cjs');
5
+ var chunkNP362THY_cjs = require('./chunk-NP362THY.cjs');
6
6
  var chunkQOGNZMHD_cjs = require('./chunk-QOGNZMHD.cjs');
7
7
  var chunkYSTXFWQE_cjs = require('./chunk-YSTXFWQE.cjs');
8
8
  var chunkFRITRLZQ_cjs = require('./chunk-FRITRLZQ.cjs');
9
- var chunkZWACQM5U_cjs = require('./chunk-ZWACQM5U.cjs');
10
- var chunkJ5623RIV_cjs = require('./chunk-J5623RIV.cjs');
9
+ var chunk3WKWBYPO_cjs = require('./chunk-3WKWBYPO.cjs');
10
+ var chunkKX5QXLBS_cjs = require('./chunk-KX5QXLBS.cjs');
11
11
  var chunk3EE6LVWT_cjs = require('./chunk-3EE6LVWT.cjs');
12
- var chunkHU666T3Q_cjs = require('./chunk-HU666T3Q.cjs');
12
+ var chunkS46WJTDL_cjs = require('./chunk-S46WJTDL.cjs');
13
13
  var chunkNVXXWAU7_cjs = require('./chunk-NVXXWAU7.cjs');
14
- var chunkNAGPKWOD_cjs = require('./chunk-NAGPKWOD.cjs');
14
+ var chunkQISSETTG_cjs = require('./chunk-QISSETTG.cjs');
15
15
  var chunkEHD25JBZ_cjs = require('./chunk-EHD25JBZ.cjs');
16
- var chunkUNFBHV46_cjs = require('./chunk-UNFBHV46.cjs');
17
- var chunk6LHQPOMI_cjs = require('./chunk-6LHQPOMI.cjs');
16
+ var chunkCEGU5AVD_cjs = require('./chunk-CEGU5AVD.cjs');
17
+ var chunkRNXXYF22_cjs = require('./chunk-RNXXYF22.cjs');
18
18
  var fs = require('fs');
19
19
  var promises = require('fs/promises');
20
20
  var os = require('os');
@@ -45,19 +45,19 @@ function loadTrustedNames() {
45
45
  else discarded += 1;
46
46
  }
47
47
  if (discarded > 0) {
48
- chunk6LHQPOMI_cjs.diag(
48
+ chunkRNXXYF22_cjs.diag(
49
49
  `[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be plugin-name strings)
50
50
  `
51
51
  );
52
52
  }
53
53
  } else {
54
- chunk6LHQPOMI_cjs.diag(
54
+ chunkRNXXYF22_cjs.diag(
55
55
  `[theokit-sdk] WARN: ${path} is not a JSON array \u2014 trusting NO provider plugins (fail-closed)
56
56
  `
57
57
  );
58
58
  }
59
59
  } catch {
60
- chunk6LHQPOMI_cjs.diag(
60
+ chunkRNXXYF22_cjs.diag(
61
61
  `[theokit-sdk] WARN: ${path} is not valid JSON \u2014 trusting NO provider plugins (fail-closed)
62
62
  `
63
63
  );
@@ -83,7 +83,7 @@ async function discoverProviderPlugins() {
83
83
  const trusted = loadTrustedNames();
84
84
  for (const entry of entries) {
85
85
  if (!trusted.has(entry)) {
86
- chunk6LHQPOMI_cjs.diag(
86
+ chunkRNXXYF22_cjs.diag(
87
87
  `[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.
88
88
  `
89
89
  );
@@ -102,13 +102,13 @@ async function loadOne(dir, entryName) {
102
102
  if (plugin !== null && typeof plugin === "object" && plugin.kind === "model-provider") {
103
103
  const profile = plugin.profile;
104
104
  if (profile !== void 0 && typeof profile === "object") {
105
- chunkHU666T3Q_cjs.registerProvider(profile);
105
+ chunkS46WJTDL_cjs.registerProvider(profile);
106
106
  }
107
107
  }
108
108
  return;
109
109
  } catch (err) {
110
110
  const msg = err instanceof Error ? err.message : String(err);
111
- chunk6LHQPOMI_cjs.diag(`[theokit-sdk] failed to load provider plugin "${entryName}": ${msg}
111
+ chunkRNXXYF22_cjs.diag(`[theokit-sdk] failed to load provider plugin "${entryName}": ${msg}
112
112
  `);
113
113
  return;
114
114
  }
@@ -120,7 +120,7 @@ function mapAnthropicError(args) {
120
120
  const { status, body, headers, endpoint } = args;
121
121
  const code = mapAnthropicStatusToCode(status, body);
122
122
  const message = formatMessage(status, code);
123
- const metadata = chunkN7KS3TIR_cjs.buildErrorMetadata({
123
+ const metadata = chunkNP362THY_cjs.buildErrorMetadata({
124
124
  provider: "anthropic",
125
125
  endpoint,
126
126
  code,
@@ -129,24 +129,24 @@ function mapAnthropicError(args) {
129
129
  body
130
130
  });
131
131
  if (status === 401 || status === 403) {
132
- return new chunkUNFBHV46_cjs.AuthenticationError(message, { code: "anthropic_auth_failed", metadata });
132
+ return new chunkCEGU5AVD_cjs.AuthenticationError(message, { code: "anthropic_auth_failed", metadata });
133
133
  }
134
134
  if (status === 429) {
135
- return new chunkUNFBHV46_cjs.RateLimitError(message, { code: "anthropic_rate_limit", metadata });
135
+ return new chunkCEGU5AVD_cjs.RateLimitError(message, { code: "anthropic_rate_limit", metadata });
136
136
  }
137
137
  if (status === 400) {
138
- return new chunkUNFBHV46_cjs.ConfigurationError(message, {
138
+ return new chunkCEGU5AVD_cjs.ConfigurationError(message, {
139
139
  code: `anthropic_${code}`,
140
140
  metadata
141
141
  });
142
142
  }
143
143
  if (status === 408) {
144
- return new chunkUNFBHV46_cjs.NetworkError(message, { code: "anthropic_timeout", metadata });
144
+ return new chunkCEGU5AVD_cjs.NetworkError(message, { code: "anthropic_timeout", metadata });
145
145
  }
146
146
  if (status >= 500 && status < 600) {
147
- return new chunkUNFBHV46_cjs.NetworkError(message, { code: "anthropic_server_error", metadata });
147
+ return new chunkCEGU5AVD_cjs.NetworkError(message, { code: "anthropic_server_error", metadata });
148
148
  }
149
- return new chunkUNFBHV46_cjs.UnknownAgentError(message, { code: "anthropic_unknown", metadata });
149
+ return new chunkCEGU5AVD_cjs.UnknownAgentError(message, { code: "anthropic_unknown", metadata });
150
150
  }
151
151
  function mapAnthropicStatusToCode(status, body) {
152
152
  if (status === 400) {
@@ -159,7 +159,7 @@ function mapAnthropicStatusToCode(status, body) {
159
159
  }
160
160
  return "invalid_request";
161
161
  }
162
- return chunkN7KS3TIR_cjs.httpStatusToErrorCode(status);
162
+ return chunkNP362THY_cjs.httpStatusToErrorCode(status);
163
163
  }
164
164
  function formatMessage(status, code) {
165
165
  return `Anthropic API error: ${code} (HTTP ${status})`;
@@ -200,7 +200,7 @@ function assign(finish, key, value) {
200
200
  if (value === void 0) return;
201
201
  const count = asTokenCount(value);
202
202
  if (count === void 0) {
203
- chunk6LHQPOMI_cjs.diag(
203
+ chunkRNXXYF22_cjs.diag(
204
204
  `[theokit-sdk] provider reported an unusable ${key} (${String(value)}) \u2014 dropping it. Usage and cost for this turn will be incomplete.
205
205
  `
206
206
  );
@@ -230,7 +230,7 @@ function toBlockToolResultContent(content) {
230
230
  function toStringToolResultContent(content, providerName, toolUseId) {
231
231
  if (typeof content === "string") return content;
232
232
  if (content.some((block) => block.type === "image")) {
233
- throw new chunkUNFBHV46_cjs.ConfigurationError(
233
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(
234
234
  `provider "${providerName}" does not support image content in tool results` + (toolUseId === void 0 ? "" : ` \u2014 the result of tool call ${toolUseId} carried an image`) + `, and this wire carries tool results as text only`
235
235
  );
236
236
  }
@@ -412,7 +412,7 @@ function readWithIdleTimeout(reader, idleTimeoutMs) {
412
412
  (resolve, reject) => {
413
413
  const timer = setTimeout(() => {
414
414
  reject(
415
- new chunkUNFBHV46_cjs.NetworkError(`SSE stream idle for ${idleTimeoutMs}ms \u2014 upstream stalled`, {
415
+ new chunkCEGU5AVD_cjs.NetworkError(`SSE stream idle for ${idleTimeoutMs}ms \u2014 upstream stalled`, {
416
416
  code: "stream_idle_timeout"
417
417
  })
418
418
  );
@@ -489,9 +489,9 @@ function isAbortError(err) {
489
489
  }
490
490
  function wrapTransportError(err, ctx) {
491
491
  if (isAbortError(err)) return err;
492
- if (err instanceof chunkUNFBHV46_cjs.TheokitAgentError) return err;
492
+ if (err instanceof chunkCEGU5AVD_cjs.TheokitAgentError) return err;
493
493
  const detail = err instanceof Error ? err.message : String(err);
494
- return new chunkUNFBHV46_cjs.NetworkError(`${ctx.providerId} transport failure on ${ctx.endpoint}: ${detail}`, {
494
+ return new chunkCEGU5AVD_cjs.NetworkError(`${ctx.providerId} transport failure on ${ctx.endpoint}: ${detail}`, {
495
495
  code: "transport_failure",
496
496
  cause: err
497
497
  });
@@ -551,7 +551,7 @@ var AnthropicClient = class {
551
551
  for (const event of events) yield event;
552
552
  }
553
553
  if (!accumulator.finishReasonSeen) {
554
- throw new chunkUNFBHV46_cjs.NetworkError("Anthropic SSE stream truncated (no stop_reason)", {
554
+ throw new chunkCEGU5AVD_cjs.NetworkError("Anthropic SSE stream truncated (no stop_reason)", {
555
555
  code: "stream_truncated"
556
556
  });
557
557
  }
@@ -570,12 +570,12 @@ function parseAnthropicFrame(record) {
570
570
  const event = record.event;
571
571
  const size = `${record.data.length} chars`;
572
572
  if (CONTENT_FRAMES.has(event)) {
573
- throw new chunkUNFBHV46_cjs.NetworkError(
573
+ throw new chunkCEGU5AVD_cjs.NetworkError(
574
574
  `Anthropic SSE ${event} frame (${size}) is not valid JSON; the turn would lose content`,
575
575
  { code: "stream_malformed_frame", cause: parseErr }
576
576
  );
577
577
  }
578
- chunk6LHQPOMI_cjs.diag(
578
+ chunkRNXXYF22_cjs.diag(
579
579
  `[theokit-sdk] skipped an Anthropic SSE ${event} frame (${size}) that is not valid JSON
580
580
  `
581
581
  );
@@ -741,10 +741,10 @@ function classifyBedrockError(args, awsType, message) {
741
741
  return "invalid_request";
742
742
  }
743
743
  if (awsType.includes("Timeout")) return "timeout";
744
- return chunkN7KS3TIR_cjs.httpStatusToErrorCode(args.status);
744
+ return chunkNP362THY_cjs.httpStatusToErrorCode(args.status);
745
745
  }
746
746
  function buildBedrockMetadata(args, code) {
747
- return chunkN7KS3TIR_cjs.buildErrorMetadata({
747
+ return chunkNP362THY_cjs.buildErrorMetadata({
748
748
  provider: "bedrock",
749
749
  endpoint: args.endpoint,
750
750
  code,
@@ -754,28 +754,28 @@ function buildBedrockMetadata(args, code) {
754
754
  });
755
755
  }
756
756
  function mapBedrockError(args) {
757
- const parsed = chunkN7KS3TIR_cjs.parseErrorBody(args.body);
757
+ const parsed = chunkNP362THY_cjs.parseErrorBody(args.body);
758
758
  const awsType = parsed.__type ?? "";
759
759
  const message = parsed.message ?? parsed.Message ?? "Bedrock request failed";
760
760
  const code = classifyBedrockError(args, awsType, message);
761
761
  const metadata = buildBedrockMetadata(args, code);
762
762
  switch (code) {
763
763
  case "rate_limit":
764
- return new chunkUNFBHV46_cjs.RateLimitError(`Bedrock throttled: ${message}`, { metadata });
764
+ return new chunkCEGU5AVD_cjs.RateLimitError(`Bedrock throttled: ${message}`, { metadata });
765
765
  case "auth_failed":
766
- return new chunkUNFBHV46_cjs.AuthenticationError(`Bedrock auth: ${message}`, { metadata });
766
+ return new chunkCEGU5AVD_cjs.AuthenticationError(`Bedrock auth: ${message}`, { metadata });
767
767
  case "invalid_request": {
768
768
  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}`;
769
- return new chunkUNFBHV46_cjs.ConfigurationError(friendly, { metadata });
769
+ return new chunkCEGU5AVD_cjs.ConfigurationError(friendly, { metadata });
770
770
  }
771
771
  case "quota_exceeded":
772
- return new chunkUNFBHV46_cjs.RateLimitError(`Bedrock quota exceeded: ${message}`, { metadata });
772
+ return new chunkCEGU5AVD_cjs.RateLimitError(`Bedrock quota exceeded: ${message}`, { metadata });
773
773
  case "timeout":
774
- return new chunkUNFBHV46_cjs.NetworkError(`Bedrock timeout: ${message}`, { metadata });
774
+ return new chunkCEGU5AVD_cjs.NetworkError(`Bedrock timeout: ${message}`, { metadata });
775
775
  case "server_error":
776
- return new chunkUNFBHV46_cjs.NetworkError(`Bedrock server error: ${message}`, { metadata });
776
+ return new chunkCEGU5AVD_cjs.NetworkError(`Bedrock server error: ${message}`, { metadata });
777
777
  default:
778
- return new chunkUNFBHV46_cjs.UnknownAgentError(`Bedrock unknown: ${message}`, { metadata });
778
+ return new chunkCEGU5AVD_cjs.UnknownAgentError(`Bedrock unknown: ${message}`, { metadata });
779
779
  }
780
780
  }
781
781
  var cachedToken = null;
@@ -788,7 +788,7 @@ async function resolveBedrockToken(region) {
788
788
  return cachedToken.value;
789
789
  }
790
790
  try {
791
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-P5N3Q2NH.cjs', document.baseURI).href)));
791
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LSWHDOCL.cjs', document.baseURI).href)));
792
792
  const gen = r("@aws/bedrock-token-generator");
793
793
  if (typeof gen.getToken !== "function") return void 0;
794
794
  const providers = r("@aws-sdk/credential-providers");
@@ -816,16 +816,16 @@ var BedrockAnthropicClient = class {
816
816
  if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
817
817
  const fromEnv = await resolveBedrockToken(region);
818
818
  if (fromEnv !== void 0 && fromEnv.length > 0) return fromEnv;
819
- throw new chunkUNFBHV46_cjs.ConfigurationError(
819
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(
820
820
  "Bedrock requires AWS_BEARER_TOKEN_BEDROCK env var, or install `@aws/bedrock-token-generator` for auto-refresh, or pass apiKey explicitly.",
821
821
  { code: "auth_failed" }
822
822
  );
823
823
  }
824
824
  async *stream(request, signal) {
825
- const region = chunkHU666T3Q_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
825
+ const region = chunkS46WJTDL_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
826
826
  const token = await this.resolveTokenOrThrow(region);
827
- const bareModel = chunkHU666T3Q_cjs.stripBedrockPrefix(request.model);
828
- const baseUrl = this.options.baseUrl ?? chunkHU666T3Q_cjs.resolveBedrockBaseUrl(request.model);
827
+ const bareModel = chunkS46WJTDL_cjs.stripBedrockPrefix(request.model);
828
+ const baseUrl = this.options.baseUrl ?? chunkS46WJTDL_cjs.resolveBedrockBaseUrl(request.model);
829
829
  const endpoint = `/model/${encodeURIComponent(bareModel)}/invoke`;
830
830
  const url = `${baseUrl}${endpoint}`;
831
831
  const response = await postAnthropicRequest({
@@ -880,7 +880,7 @@ var FaultInjectingLlmClient = class {
880
880
  return yield* this.inner.stream(request, signal);
881
881
  }
882
882
  if (parsed.status >= 400) {
883
- throw chunkN7KS3TIR_cjs.mapOpenAICompatibleError({
883
+ throw chunkNP362THY_cjs.mapOpenAICompatibleError({
884
884
  providerId: this.name,
885
885
  status: parsed.status,
886
886
  body: parsed.body,
@@ -927,7 +927,7 @@ function parseOverrideOrWarnOnce() {
927
927
  function warnInvalidJsonOnce(_raw) {
928
928
  if (warnedInvalidJson) return;
929
929
  warnedInvalidJson = true;
930
- chunk6LHQPOMI_cjs.diag(
930
+ chunkRNXXYF22_cjs.diag(
931
931
  `[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.
932
932
  `
933
933
  );
@@ -955,7 +955,7 @@ function mapOllamaTransportError(args) {
955
955
  if (args.providerId !== "ollama") return void 0;
956
956
  const causeCode = extractCauseCode(args.cause);
957
957
  if (causeCode !== "ECONNREFUSED" && causeCode !== "ENOTFOUND") return void 0;
958
- const metadata = chunkN7KS3TIR_cjs.buildErrorMetadata({
958
+ const metadata = chunkNP362THY_cjs.buildErrorMetadata({
959
959
  provider: "ollama",
960
960
  endpoint: args.endpoint,
961
961
  code: "network",
@@ -963,7 +963,7 @@ function mapOllamaTransportError(args) {
963
963
  headers: void 0,
964
964
  body: { cause: causeCode }
965
965
  });
966
- return new chunkUNFBHV46_cjs.ConfigurationError(
966
+ return new chunkCEGU5AVD_cjs.ConfigurationError(
967
967
  "Ollama is not reachable. Run `ollama serve` to start the local runtime, or set OLLAMA_HOST to point at a remote Ollama server.",
968
968
  { code: "ollama_unreachable", metadata }
969
969
  );
@@ -973,7 +973,7 @@ function mapOllamaHttpError(args) {
973
973
  const errString = extractErrorString(args.body).toLowerCase();
974
974
  if (args.status === 404 && errString.includes("not found") && errString.includes("pull")) {
975
975
  const modelHint = extractModelName(errString);
976
- const metadata = chunkN7KS3TIR_cjs.buildErrorMetadata({
976
+ const metadata = chunkNP362THY_cjs.buildErrorMetadata({
977
977
  provider: "ollama",
978
978
  endpoint: args.endpoint,
979
979
  code: "model_unavailable",
@@ -982,13 +982,13 @@ function mapOllamaHttpError(args) {
982
982
  body: args.body
983
983
  });
984
984
  const pullCmd = modelHint !== void 0 ? `ollama pull ${modelHint}` : "ollama pull <model>";
985
- return new chunkUNFBHV46_cjs.ConfigurationError(
985
+ return new chunkCEGU5AVD_cjs.ConfigurationError(
986
986
  `Ollama model is not pulled. Run \`${pullCmd}\` to download it first.`,
987
987
  { code: "ollama_model_not_pulled", metadata }
988
988
  );
989
989
  }
990
990
  if (args.status === 503 && errString.includes("model is loading")) {
991
- const metadata = chunkN7KS3TIR_cjs.buildErrorMetadata({
991
+ const metadata = chunkNP362THY_cjs.buildErrorMetadata({
992
992
  provider: "ollama",
993
993
  endpoint: args.endpoint,
994
994
  code: "server_error",
@@ -996,7 +996,7 @@ function mapOllamaHttpError(args) {
996
996
  headers: args.headers,
997
997
  body: args.body
998
998
  });
999
- return new chunkUNFBHV46_cjs.NetworkError(
999
+ return new chunkCEGU5AVD_cjs.NetworkError(
1000
1000
  "Ollama model is loading. Retry in a few seconds \u2014 Ollama is warming up the model into memory.",
1001
1001
  { code: "ollama_model_loading", metadata }
1002
1002
  );
@@ -1075,7 +1075,7 @@ var OllamaNativeClient = class {
1075
1075
  endpoint: "/api/chat"
1076
1076
  });
1077
1077
  if (mapped !== void 0) throw mapped;
1078
- throw chunkN7KS3TIR_cjs.mapOpenAICompatibleError({
1078
+ throw chunkNP362THY_cjs.mapOpenAICompatibleError({
1079
1079
  providerId: "ollama",
1080
1080
  status: response.status,
1081
1081
  body: bodyJson,
@@ -1223,7 +1223,7 @@ function toOllamaMessages(message) {
1223
1223
  }
1224
1224
  if (message.role === "user") {
1225
1225
  if (message.content.some((p) => p.type === "image")) {
1226
- throw new chunkUNFBHV46_cjs.ConfigurationError(
1226
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(
1227
1227
  "image input is not supported on the ollama-native provider; use an OpenAI/OpenRouter model for multimodal turns",
1228
1228
  { code: "ollama_image_unsupported" }
1229
1229
  );
@@ -1351,25 +1351,40 @@ function normalizeOpenAIResponses(raw) {
1351
1351
  function sent(v) {
1352
1352
  return v !== void 0 && v !== null;
1353
1353
  }
1354
+ function strictCount(v) {
1355
+ const n = typeof v === "string" ? Number.parseInt(v, 10) : v;
1356
+ return typeof n === "number" && Number.isFinite(n) && n >= 0 ? Math.trunc(n) : Number.NaN;
1357
+ }
1358
+ function usableOr0(count) {
1359
+ return count === void 0 || Number.isNaN(count) ? 0 : count;
1360
+ }
1361
+ function cacheBucket(nested, topLevel) {
1362
+ if (!sent(nested) && !sent(topLevel)) return void 0;
1363
+ const fromNested = sent(nested) ? strictCount(nested) : 0;
1364
+ if (fromNested !== 0) return fromNested;
1365
+ return sent(topLevel) ? strictCount(topLevel) : 0;
1366
+ }
1354
1367
  function splitChatCompletionsPrompt(raw) {
1355
1368
  const details = raw.prompt_tokens_details ?? {};
1356
- const bucket = (nested, topLevel) => sent(nested) || sent(topLevel) ? int(nested) || int(topLevel) : void 0;
1357
- const cacheReadTokens = bucket(details.cached_tokens, raw.cache_read_input_tokens);
1358
- const cacheWriteTokens = bucket(details.cache_write_tokens, raw.cache_creation_input_tokens);
1359
- const cached = (cacheReadTokens ?? 0) + (cacheWriteTokens ?? 0);
1369
+ const cacheReadTokens = cacheBucket(details.cached_tokens, raw.cache_read_input_tokens);
1370
+ const cacheWriteTokens = cacheBucket(details.cache_write_tokens, raw.cache_creation_input_tokens);
1371
+ const cached = usableOr0(cacheReadTokens) + usableOr0(cacheWriteTokens);
1360
1372
  return {
1361
- ...sent(raw.prompt_tokens) ? { inputTokens: Math.max(0, int(raw.prompt_tokens) - cached) } : {},
1373
+ ...sent(raw.prompt_tokens) ? { inputTokens: Math.max(0, strictCount(raw.prompt_tokens) - cached) } : {},
1362
1374
  ...cacheReadTokens !== void 0 ? { cacheReadTokens } : {},
1363
1375
  ...cacheWriteTokens !== void 0 ? { cacheWriteTokens } : {}
1364
1376
  };
1365
1377
  }
1378
+ function netOfCache(total, cacheReadTokens, cacheWriteTokens) {
1379
+ return total === void 0 ? void 0 : Math.max(0, total - (cacheReadTokens ?? 0) - (cacheWriteTokens ?? 0));
1380
+ }
1366
1381
  function normalizeOpenAIChat(raw) {
1367
1382
  const outputTokens = int(raw.completion_tokens);
1368
1383
  const completionDetails = raw.completion_tokens_details ?? {};
1369
1384
  const split = splitChatCompletionsPrompt(raw);
1370
- const inputTokens = split.inputTokens ?? 0;
1371
- const cacheReadTokens = split.cacheReadTokens ?? 0;
1372
- const cacheWriteTokens = split.cacheWriteTokens ?? 0;
1385
+ const inputTokens = int(split.inputTokens);
1386
+ const cacheReadTokens = int(split.cacheReadTokens);
1387
+ const cacheWriteTokens = int(split.cacheWriteTokens);
1373
1388
  const reasoningTokens = int(completionDetails.reasoning_tokens);
1374
1389
  const usage = {
1375
1390
  inputTokens,
@@ -1418,7 +1433,7 @@ async function safeFetch(fetchFn, url, init) {
1418
1433
  try {
1419
1434
  return await fetchFn(url, init);
1420
1435
  } catch (cause) {
1421
- throw new chunkUNFBHV46_cjs.NetworkError("HTTP request failed", { code: "network_error", cause });
1436
+ throw new chunkCEGU5AVD_cjs.NetworkError("HTTP request failed", { code: "network_error", cause });
1422
1437
  }
1423
1438
  }
1424
1439
  async function safeParseJsonResponse(response) {
@@ -1445,7 +1460,7 @@ function mapHttpStatusToError(status, body) {
1445
1460
  cause: body
1446
1461
  };
1447
1462
  if (envelope.code === "integration_not_connected") {
1448
- return new chunkUNFBHV46_cjs.IntegrationNotConnectedError(message, {
1463
+ return new chunkCEGU5AVD_cjs.IntegrationNotConnectedError(message, {
1449
1464
  provider: envelope.provider ?? "unknown",
1450
1465
  helpUrl: envelope.helpUrl ?? "",
1451
1466
  code: envelope.code,
@@ -1456,21 +1471,21 @@ function mapHttpStatusToError(status, body) {
1456
1471
  }
1457
1472
  function statusToError(status, message, errorOptions) {
1458
1473
  if (status === 401 || status === 403) {
1459
- return new chunkUNFBHV46_cjs.AuthenticationError(message, errorOptions);
1474
+ return new chunkCEGU5AVD_cjs.AuthenticationError(message, errorOptions);
1460
1475
  }
1461
1476
  if (status === 429) {
1462
- return new chunkUNFBHV46_cjs.RateLimitError(message, errorOptions);
1477
+ return new chunkCEGU5AVD_cjs.RateLimitError(message, errorOptions);
1463
1478
  }
1464
1479
  if (status === 408) {
1465
- return new chunkUNFBHV46_cjs.NetworkError(message, { ...errorOptions, code: errorOptions.code ?? "timeout" });
1480
+ return new chunkCEGU5AVD_cjs.NetworkError(message, { ...errorOptions, code: errorOptions.code ?? "timeout" });
1466
1481
  }
1467
1482
  if (status >= 400 && status < 500) {
1468
- return new chunkUNFBHV46_cjs.ConfigurationError(message, errorOptions);
1483
+ return new chunkCEGU5AVD_cjs.ConfigurationError(message, errorOptions);
1469
1484
  }
1470
1485
  if (status >= 500) {
1471
- return new chunkUNFBHV46_cjs.NetworkError(message, errorOptions);
1486
+ return new chunkCEGU5AVD_cjs.NetworkError(message, errorOptions);
1472
1487
  }
1473
- return new chunkUNFBHV46_cjs.UnknownAgentError(message, errorOptions);
1488
+ return new chunkCEGU5AVD_cjs.UnknownAgentError(message, errorOptions);
1474
1489
  }
1475
1490
  function extractErrorEnvelope(body) {
1476
1491
  if (!body || typeof body !== "object") return {};
@@ -1734,7 +1749,7 @@ var OpenAIClient = class {
1734
1749
  endpoint: "/v1/chat/completions"
1735
1750
  });
1736
1751
  if (ollamaMapped !== void 0) throw ollamaMapped;
1737
- throw chunkN7KS3TIR_cjs.mapOpenAICompatibleError({
1752
+ throw chunkNP362THY_cjs.mapOpenAICompatibleError({
1738
1753
  providerId,
1739
1754
  status: response.status,
1740
1755
  body,
@@ -1770,7 +1785,7 @@ var OpenAIClient = class {
1770
1785
  }
1771
1786
  if (chunk.error !== void 0 && chunk.error !== null) {
1772
1787
  const status = typeof chunk.error.code === "number" ? chunk.error.code : 502;
1773
- throw chunkN7KS3TIR_cjs.mapOpenAICompatibleError({
1788
+ throw chunkNP362THY_cjs.mapOpenAICompatibleError({
1774
1789
  providerId,
1775
1790
  status,
1776
1791
  body: chunk,
@@ -1782,7 +1797,7 @@ var OpenAIClient = class {
1782
1797
  for (const event of events) yield event;
1783
1798
  }
1784
1799
  if (!sawDone && !accumulator.finishReasonSeen) {
1785
- throw new chunkUNFBHV46_cjs.NetworkError("SSE stream truncated (no finish_reason / [DONE])", {
1800
+ throw new chunkCEGU5AVD_cjs.NetworkError("SSE stream truncated (no finish_reason / [DONE])", {
1786
1801
  code: "stream_truncated"
1787
1802
  });
1788
1803
  }
@@ -1900,13 +1915,13 @@ var OpenAIStreamAccumulator = class {
1900
1915
  toolCalls.push(...recovered.toolCalls);
1901
1916
  text = recovered.residualText;
1902
1917
  stopReason = "tool_use";
1903
- chunk6LHQPOMI_cjs.diag(
1918
+ chunkRNXXYF22_cjs.diag(
1904
1919
  `[theokit-sdk] recovered ${recovered.toolCalls.length} leaked tool call(s) from assistant content (provider="${this.providerName}", names=${recovered.toolCalls.map((c) => c.name).join(",")})
1905
1920
  `
1906
1921
  );
1907
1922
  }
1908
1923
  if (recovered.droppedNames.length > 0) {
1909
- chunk6LHQPOMI_cjs.diag(
1924
+ chunkRNXXYF22_cjs.diag(
1910
1925
  `[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(",")})
1911
1926
  `
1912
1927
  );
@@ -2033,10 +2048,10 @@ async function tryFirstEvent(client, request, signal, logFallback = false) {
2033
2048
  const firstResult = await generator.next();
2034
2049
  return { kind: "ok", generator, firstResult };
2035
2050
  } catch (cause) {
2036
- if (cause instanceof chunkUNFBHV46_cjs.NetworkError || cause instanceof chunkUNFBHV46_cjs.RateLimitError || cause instanceof chunkUNFBHV46_cjs.AuthenticationError) {
2051
+ if (cause instanceof chunkCEGU5AVD_cjs.NetworkError || cause instanceof chunkCEGU5AVD_cjs.RateLimitError || cause instanceof chunkCEGU5AVD_cjs.AuthenticationError) {
2037
2052
  if (logFallback) {
2038
2053
  const errCode = cause.metadata?.code ?? cause.code ?? "unknown";
2039
- chunk6LHQPOMI_cjs.diag(`[theokit-sdk] provider ${client.name} failed (${errCode}): falling back
2054
+ chunkRNXXYF22_cjs.diag(`[theokit-sdk] provider ${client.name} failed (${errCode}): falling back
2040
2055
  `);
2041
2056
  }
2042
2057
  return { kind: "handshake_error", error: cause };
@@ -2078,7 +2093,7 @@ var PoolAwareLlmClient = class {
2078
2093
  // 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.
2079
2094
  async *stream(request, signal) {
2080
2095
  if (this.breaker.shouldSkip(this.pool.provider)) {
2081
- throw new chunkUNFBHV46_cjs.NetworkError(`${this.pool.provider} circuit open \u2014 failing fast`, {
2096
+ throw new chunkCEGU5AVD_cjs.NetworkError(`${this.pool.provider} circuit open \u2014 failing fast`, {
2082
2097
  code: "circuit_open"
2083
2098
  });
2084
2099
  }
@@ -2097,7 +2112,7 @@ var PoolAwareLlmClient = class {
2097
2112
  }
2098
2113
  if (entry === null) {
2099
2114
  this.breaker.recordTimeout(this.pool.provider);
2100
- throw new chunkUNFBHV46_cjs.CredentialPoolExhaustedError(
2115
+ throw new chunkCEGU5AVD_cjs.CredentialPoolExhaustedError(
2101
2116
  `All ${this.pool.provider} credentials exhausted; next retry available at ${this.nextRetryHint() ?? "unknown"}`,
2102
2117
  { provider: this.pool.provider, nextRetryAt: this.nextRetryHint() }
2103
2118
  );
@@ -2129,7 +2144,7 @@ var PoolAwareLlmClient = class {
2129
2144
  ...parseRetryAfterMs(attempt.error) !== void 0 ? { resetAtMs: parseRetryAfterMs(attempt.error) } : {}
2130
2145
  });
2131
2146
  } catch (persistErr) {
2132
- chunk6LHQPOMI_cjs.diag(
2147
+ chunkRNXXYF22_cjs.diag(
2133
2148
  `[theokit-sdk] credential-pool: persist failed during rotate; continuing in-memory: ${persistErr instanceof Error ? persistErr.message : String(persistErr)}
2134
2149
  `
2135
2150
  );
@@ -2151,8 +2166,8 @@ var PoolAwareLlmClient = class {
2151
2166
  }
2152
2167
  };
2153
2168
  function classifyAndDecide(error, hasRetried429) {
2154
- if (error instanceof chunkUNFBHV46_cjs.NetworkError) return "propagate";
2155
- if (error instanceof chunkUNFBHV46_cjs.AuthenticationError) return "rotate";
2169
+ if (error instanceof chunkCEGU5AVD_cjs.NetworkError) return "propagate";
2170
+ if (error instanceof chunkCEGU5AVD_cjs.AuthenticationError) return "rotate";
2156
2171
  const status = error.metadata?.statusCode ?? 429;
2157
2172
  if (status === 402) return "rotate";
2158
2173
  return hasRetried429 ? "rotate" : "retry";
@@ -2165,8 +2180,8 @@ function parseRetryAfterMs(error) {
2165
2180
  return void 0;
2166
2181
  }
2167
2182
  function inferStatusCode(error) {
2168
- if (error instanceof chunkUNFBHV46_cjs.AuthenticationError) return 401;
2169
- if (error instanceof chunkUNFBHV46_cjs.RateLimitError) return 429;
2183
+ if (error instanceof chunkCEGU5AVD_cjs.AuthenticationError) return 401;
2184
+ if (error instanceof chunkCEGU5AVD_cjs.RateLimitError) return 429;
2170
2185
  return 0;
2171
2186
  }
2172
2187
 
@@ -2384,11 +2399,11 @@ var ResponsesStreamAccumulator = class {
2384
2399
  }
2385
2400
  applyUsage(usage) {
2386
2401
  if (usage === void 0) return;
2387
- this.inputTokens = usage.input_tokens;
2388
2402
  this.outputTokens = usage.output_tokens;
2389
2403
  this.reasoningTokens = usage.output_tokens_details?.reasoning_tokens;
2390
2404
  this.cacheReadTokens = usage.input_tokens_details?.cached_tokens;
2391
2405
  this.cacheWriteTokens = usage.input_tokens_details?.cache_write_tokens;
2406
+ this.inputTokens = netOfCache(usage.input_tokens, this.cacheReadTokens, this.cacheWriteTokens);
2392
2407
  }
2393
2408
  };
2394
2409
  var MAX_REMEMBERED_REASONING_CALLS = 256;
@@ -2454,7 +2469,7 @@ var ResponsesApiClient = class {
2454
2469
  body = JSON.parse(text);
2455
2470
  } catch {
2456
2471
  }
2457
- return chunkN7KS3TIR_cjs.mapOpenAICompatibleError({
2472
+ return chunkNP362THY_cjs.mapOpenAICompatibleError({
2458
2473
  providerId,
2459
2474
  status: response.status,
2460
2475
  body,
@@ -2490,7 +2505,7 @@ var ResponsesApiClient = class {
2490
2505
  const failure = ResponsesStreamAccumulator.failureMessage(event);
2491
2506
  if (failure !== void 0) {
2492
2507
  yield { type: "error", message: failure };
2493
- throw chunkN7KS3TIR_cjs.mapOpenAICompatibleError({
2508
+ throw chunkNP362THY_cjs.mapOpenAICompatibleError({
2494
2509
  providerId,
2495
2510
  status: 502,
2496
2511
  body: { error: { message: failure } },
@@ -2508,14 +2523,14 @@ var ResponsesApiClient = class {
2508
2523
  // src/internal/llm/retrying-client.ts
2509
2524
  var MAX_ATTEMPTS = 3;
2510
2525
  function isRetriableError(err) {
2511
- if (!chunkUNFBHV46_cjs.isTransientError(err)) return false;
2512
- if (err instanceof chunkUNFBHV46_cjs.CredentialPoolExhaustedError) return false;
2513
- if (err instanceof chunkUNFBHV46_cjs.TheokitAgentError && err.code === "circuit_open") return false;
2514
- if (err instanceof chunkUNFBHV46_cjs.RateLimitError && err.metadata?.statusCode === 402) return false;
2526
+ if (!chunkCEGU5AVD_cjs.isTransientError(err)) return false;
2527
+ if (err instanceof chunkCEGU5AVD_cjs.CredentialPoolExhaustedError) return false;
2528
+ if (err instanceof chunkCEGU5AVD_cjs.TheokitAgentError && err.code === "circuit_open") return false;
2529
+ if (err instanceof chunkCEGU5AVD_cjs.RateLimitError && err.metadata?.statusCode === 402) return false;
2515
2530
  return true;
2516
2531
  }
2517
2532
  function retryAfterHintMs(err) {
2518
- if (!(err instanceof chunkUNFBHV46_cjs.RateLimitError)) return void 0;
2533
+ if (!(err instanceof chunkCEGU5AVD_cjs.RateLimitError)) return void 0;
2519
2534
  const seconds = err.metadata?.retryAfter;
2520
2535
  return typeof seconds === "number" && seconds > 0 ? seconds * 1e3 : void 0;
2521
2536
  }
@@ -2567,7 +2582,7 @@ var RetryingLlmClient = class {
2567
2582
  ...this.#rng !== void 0 ? { rng: this.#rng } : {}
2568
2583
  });
2569
2584
  const cause = err instanceof Error ? err.name : typeof err;
2570
- chunk6LHQPOMI_cjs.diag(
2585
+ chunkRNXXYF22_cjs.diag(
2571
2586
  `retry ${attempt + 1}/${MAX_ATTEMPTS} in ${String(ms)}ms \u2014 ${cause}` + (hint !== void 0 ? ` (Retry-After: ${String(hint)}ms)` : "")
2572
2587
  );
2573
2588
  await chunkQOGNZMHD_cjs.sleepWithAbort(ms, signal);
@@ -2604,11 +2619,11 @@ function classifyVertexError(args, errStatus) {
2604
2619
  for (const rule of VERTEX_RULES) {
2605
2620
  if (rule.test(args.status, errStatus)) return rule.code;
2606
2621
  }
2607
- const shared = chunkN7KS3TIR_cjs.httpStatusToErrorCode(args.status);
2622
+ const shared = chunkNP362THY_cjs.httpStatusToErrorCode(args.status);
2608
2623
  return shared === "auth_failed" ? "auth_permission" : shared;
2609
2624
  }
2610
2625
  function vertexMetadata(args, code) {
2611
- return chunkN7KS3TIR_cjs.buildErrorMetadata({
2626
+ return chunkNP362THY_cjs.buildErrorMetadata({
2612
2627
  provider: "vertex",
2613
2628
  endpoint: args.endpoint,
2614
2629
  code,
@@ -2618,29 +2633,29 @@ function vertexMetadata(args, code) {
2618
2633
  });
2619
2634
  }
2620
2635
  var VERTEX_ERROR_BUILDERS = {
2621
- rate_limit: (args, msg) => new chunkUNFBHV46_cjs.RateLimitError(`Vertex quota exhausted: ${msg}`, {
2636
+ rate_limit: (args, msg) => new chunkCEGU5AVD_cjs.RateLimitError(`Vertex quota exhausted: ${msg}`, {
2622
2637
  metadata: vertexMetadata(args, "rate_limit")
2623
2638
  }),
2624
- auth_unauthenticated: (args, msg) => new chunkUNFBHV46_cjs.AuthenticationError(`Vertex unauthenticated: ${msg}`, {
2639
+ auth_unauthenticated: (args, msg) => new chunkCEGU5AVD_cjs.AuthenticationError(`Vertex unauthenticated: ${msg}`, {
2625
2640
  metadata: vertexMetadata(args, "auth_failed")
2626
2641
  }),
2627
- auth_permission: (args, msg) => new chunkUNFBHV46_cjs.AuthenticationError(`Vertex permission denied: ${msg}`, {
2642
+ auth_permission: (args, msg) => new chunkCEGU5AVD_cjs.AuthenticationError(`Vertex permission denied: ${msg}`, {
2628
2643
  metadata: vertexMetadata(args, "auth_failed")
2629
2644
  }),
2630
- invalid_request: (args, msg) => new chunkUNFBHV46_cjs.ConfigurationError(`Vertex validation: ${msg}`, {
2645
+ invalid_request: (args, msg) => new chunkCEGU5AVD_cjs.ConfigurationError(`Vertex validation: ${msg}`, {
2631
2646
  metadata: vertexMetadata(args, "invalid_request")
2632
2647
  }),
2633
- quota_exceeded: (args, msg) => new chunkUNFBHV46_cjs.RateLimitError(`Vertex quota exceeded: ${msg}`, {
2648
+ quota_exceeded: (args, msg) => new chunkCEGU5AVD_cjs.RateLimitError(`Vertex quota exceeded: ${msg}`, {
2634
2649
  metadata: vertexMetadata(args, "quota_exceeded")
2635
2650
  }),
2636
- timeout: (args, msg) => new chunkUNFBHV46_cjs.NetworkError(`Vertex timeout: ${msg}`, { metadata: vertexMetadata(args, "timeout") }),
2637
- server_error: (args, msg) => new chunkUNFBHV46_cjs.NetworkError(`Vertex server error: ${msg}`, {
2651
+ timeout: (args, msg) => new chunkCEGU5AVD_cjs.NetworkError(`Vertex timeout: ${msg}`, { metadata: vertexMetadata(args, "timeout") }),
2652
+ server_error: (args, msg) => new chunkCEGU5AVD_cjs.NetworkError(`Vertex server error: ${msg}`, {
2638
2653
  metadata: vertexMetadata(args, "server_error")
2639
2654
  }),
2640
- unknown: (args, msg) => new chunkUNFBHV46_cjs.UnknownAgentError(`Vertex unknown: ${msg}`, { metadata: vertexMetadata(args, "unknown") })
2655
+ unknown: (args, msg) => new chunkCEGU5AVD_cjs.UnknownAgentError(`Vertex unknown: ${msg}`, { metadata: vertexMetadata(args, "unknown") })
2641
2656
  };
2642
2657
  function mapVertexError(args) {
2643
- const parsed = chunkN7KS3TIR_cjs.parseErrorBody(args.body);
2658
+ const parsed = chunkNP362THY_cjs.parseErrorBody(args.body);
2644
2659
  const errStatus = parsed.error?.status ?? "";
2645
2660
  const message = parsed.error?.message ?? "Vertex request failed";
2646
2661
  const code = classifyVertexError(args, errStatus);
@@ -2662,12 +2677,12 @@ async function resolveVertexAccessToken() {
2662
2677
  async function getAuthClientOrThrow() {
2663
2678
  let mod;
2664
2679
  try {
2665
- const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-P5N3Q2NH.cjs', document.baseURI).href)));
2680
+ const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-LSWHDOCL.cjs', document.baseURI).href)));
2666
2681
  mod = r("google-auth-library");
2667
2682
  } catch (err) {
2668
2683
  const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
2669
2684
  if (isModuleMissing) {
2670
- throw new chunkUNFBHV46_cjs.ConfigurationError(
2685
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(
2671
2686
  "Vertex provider requires `google-auth-library`. Install: `pnpm add google-auth-library`.",
2672
2687
  { code: "auth_failed", cause: err }
2673
2688
  );
@@ -2678,7 +2693,7 @@ async function getAuthClientOrThrow() {
2678
2693
  const auth = new mod.GoogleAuth({ scopes: [SCOPE_CLOUD_PLATFORM] });
2679
2694
  return await auth.getClient();
2680
2695
  } catch (err) {
2681
- chunk6LHQPOMI_cjs.diag(
2696
+ chunkRNXXYF22_cjs.diag(
2682
2697
  `[theokit-sdk] Vertex ADC initialization failed: ${err instanceof Error ? err.message : String(err)}
2683
2698
  `
2684
2699
  );
@@ -2704,7 +2719,7 @@ var VertexAnthropicClient = class {
2704
2719
  resolveProjectOrThrow() {
2705
2720
  const projectId = this.options.projectId ?? resolveVertexProjectId();
2706
2721
  if (projectId !== void 0) return projectId;
2707
- throw new chunkUNFBHV46_cjs.ConfigurationError(
2722
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(
2708
2723
  "Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
2709
2724
  { code: "auth_failed" }
2710
2725
  );
@@ -2714,7 +2729,7 @@ var VertexAnthropicClient = class {
2714
2729
  if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
2715
2730
  const fromAdc = await resolveVertexAccessToken();
2716
2731
  if (fromAdc !== void 0 && fromAdc.length > 0) return fromAdc;
2717
- throw new chunkUNFBHV46_cjs.ConfigurationError(
2732
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(
2718
2733
  "Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
2719
2734
  { code: "auth_failed" }
2720
2735
  );
@@ -2723,8 +2738,8 @@ var VertexAnthropicClient = class {
2723
2738
  const projectId = this.resolveProjectOrThrow();
2724
2739
  const location = this.options.location ?? resolveVertexLocation();
2725
2740
  const accessToken = await this.resolveTokenOrThrow();
2726
- const baseUrl = chunkHU666T3Q_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
2727
- const bareModel = chunkHU666T3Q_cjs.stripVertexPrefix(request.model);
2741
+ const baseUrl = chunkS46WJTDL_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
2742
+ const bareModel = chunkS46WJTDL_cjs.stripVertexPrefix(request.model);
2728
2743
  const endpoint = `/models/${encodeURIComponent(bareModel)}:rawPredict`;
2729
2744
  const url = `${baseUrl}${endpoint}`;
2730
2745
  const response = await postAnthropicRequest({
@@ -2760,7 +2775,7 @@ var VertexGeminiClient = class {
2760
2775
  async *stream(request, signal) {
2761
2776
  const projectId = this.options.projectId ?? resolveVertexProjectId();
2762
2777
  if (projectId === void 0) {
2763
- throw new chunkUNFBHV46_cjs.ConfigurationError(
2778
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(
2764
2779
  "Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
2765
2780
  { code: "auth_failed" }
2766
2781
  );
@@ -2768,12 +2783,12 @@ var VertexGeminiClient = class {
2768
2783
  const location = this.options.location ?? resolveVertexLocation();
2769
2784
  const accessToken = this.options.apiKey !== void 0 && this.options.apiKey.length > 0 ? this.options.apiKey : await resolveVertexAccessToken();
2770
2785
  if (accessToken === void 0 || accessToken.length === 0) {
2771
- throw new chunkUNFBHV46_cjs.ConfigurationError(
2786
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(
2772
2787
  "Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
2773
2788
  { code: "auth_failed" }
2774
2789
  );
2775
2790
  }
2776
- const baseUrl = chunkHU666T3Q_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
2791
+ const baseUrl = chunkS46WJTDL_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
2777
2792
  const url = `${baseUrl}/chat/completions`;
2778
2793
  const innerFetch = chunkEHD25JBZ_cjs.boundFetch(this.options.fetch);
2779
2794
  const rewriteFetch = (_input, init) => innerFetch(url, init);
@@ -2795,7 +2810,7 @@ var VertexRouterClient = class {
2795
2810
  options;
2796
2811
  name = "vertex";
2797
2812
  async *stream(request, signal) {
2798
- const dialect = chunkHU666T3Q_cjs.inferModelDialect(request.model);
2813
+ const dialect = chunkS46WJTDL_cjs.inferModelDialect(request.model);
2799
2814
  if (dialect === "anthropic") {
2800
2815
  const inner2 = new VertexAnthropicClient(this.options);
2801
2816
  return yield* inner2.stream(request, signal);
@@ -2807,7 +2822,7 @@ var VertexRouterClient = class {
2807
2822
 
2808
2823
  // src/internal/llm/router.ts
2809
2824
  function resolveProviderChain(options) {
2810
- chunkHU666T3Q_cjs.registerBuiltins();
2825
+ chunkS46WJTDL_cjs.registerBuiltins();
2811
2826
  return buildChain(options);
2812
2827
  }
2813
2828
  function buildChain(options) {
@@ -2815,7 +2830,7 @@ function buildChain(options) {
2815
2830
  const seen = /* @__PURE__ */ new Set();
2816
2831
  const clients = [];
2817
2832
  const addClient = (name, perCallBaseUrl) => {
2818
- const lowered = name.toLowerCase();
2833
+ const lowered = normalizeProviderName(name);
2819
2834
  if (seen.has(lowered)) return;
2820
2835
  seen.add(lowered);
2821
2836
  const client = buildClient(lowered, options, perCallBaseUrl);
@@ -2824,19 +2839,48 @@ function buildChain(options) {
2824
2839
  addClient(options.primary, options.baseUrl);
2825
2840
  for (const fallback of options.fallback ?? []) addClient(fallback);
2826
2841
  if (clients.length === 0) {
2827
- throw new chunkUNFBHV46_cjs.ConfigurationError(
2842
+ if (chunkS46WJTDL_cjs.getProviderProfile(normalizeProviderName(options.primary)) === void 0) {
2843
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(unregisteredProviderMessage(options.primary), {
2844
+ code: "provider_unresolved"
2845
+ });
2846
+ }
2847
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(
2828
2848
  `No provider client could be resolved (primary=${options.primary}). Set ANTHROPIC_API_KEY or OPENAI_API_KEY / OPENROUTER_API_KEY.`,
2829
2849
  { code: "provider_unresolved" }
2830
2850
  );
2831
2851
  }
2832
2852
  return clients;
2833
2853
  }
2854
+ function normalizeProviderName(name) {
2855
+ return name.toLowerCase();
2856
+ }
2857
+ function unregisteredProviderMessage(name) {
2858
+ const normalized = normalizeProviderName(name);
2859
+ const caseOnlyMatch = chunkS46WJTDL_cjs.listProviders().find(
2860
+ (profile) => normalizeProviderName(profile.name) === normalized
2861
+ );
2862
+ if (caseOnlyMatch !== void 0) {
2863
+ return `No provider client could be resolved: "${name}" matches the registered provider "${caseOnlyMatch.name}" only when case is ignored, and routes look provider names up in lowercase. Register the provider as "${normalized}".`;
2864
+ }
2865
+ const aliasMessage = caseOnlyAliasMessage(name, normalized);
2866
+ if (aliasMessage !== void 0) return aliasMessage;
2867
+ const registered = chunkS46WJTDL_cjs.listProviders().map((profile) => profile.name).sort((a, b) => a.localeCompare(b)).join(", ");
2868
+ return `No provider client could be resolved: "${name}" is not a known provider. Registered providers: ${registered}.`;
2869
+ }
2870
+ function caseOnlyAliasMessage(name, normalized) {
2871
+ for (const profile of chunkS46WJTDL_cjs.listProviders()) {
2872
+ const alias = profile.aliases?.find((entry) => normalizeProviderName(entry) === normalized);
2873
+ if (alias === void 0) continue;
2874
+ return `No provider client could be resolved: "${name}" matches the alias "${alias}" of the registered provider "${profile.name}" only when case is ignored, and routes look provider names up in lowercase. Register the alias as "${normalized}", or route to "${profile.name}".`;
2875
+ }
2876
+ return void 0;
2877
+ }
2834
2878
  function buildTransport(name, routerOptions, perCallBaseUrl) {
2835
- const baseProfile = chunkHU666T3Q_cjs.getProviderProfile(name);
2879
+ const baseProfile = chunkS46WJTDL_cjs.getProviderProfile(name);
2836
2880
  if (baseProfile === void 0) return void 0;
2837
2881
  const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
2838
2882
  const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
2839
- const ambient = chunkCQYBJOB2_cjs.currentCredentialPool(name);
2883
+ const ambient = chunkSXH37C7X_cjs.currentCredentialPool(name);
2840
2884
  if (ambient !== void 0) {
2841
2885
  return new PoolAwareLlmClient(
2842
2886
  ambient,
@@ -2868,9 +2912,9 @@ function buildPoolOrSingle(args) {
2868
2912
  if (poolKeys !== void 0 && poolKeys.length >= 2) {
2869
2913
  const strategy = routerOptions.credentialPoolStrategy?.[name] ?? "fill_first";
2870
2914
  const entries = poolKeys.map(
2871
- (accessToken, priority) => chunkCQYBJOB2_cjs.newPooledCredential({ provider: name, accessToken, priority, source: "manual" })
2915
+ (accessToken, priority) => chunkSXH37C7X_cjs.newPooledCredential({ provider: name, accessToken, priority, source: "manual" })
2872
2916
  );
2873
- const pool = new chunkCQYBJOB2_cjs.CredentialPool(name, entries, strategy);
2917
+ const pool = new chunkSXH37C7X_cjs.CredentialPool(name, entries, strategy);
2874
2918
  const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
2875
2919
  return new PoolAwareLlmClient(
2876
2920
  pool,
@@ -2901,7 +2945,7 @@ var warnedNoAuthApiKeys = /* @__PURE__ */ new Set();
2901
2945
  function warnNoAuthApiKeysIgnoredOnce(provider) {
2902
2946
  if (warnedNoAuthApiKeys.has(provider)) return;
2903
2947
  warnedNoAuthApiKeys.add(provider);
2904
- chunk6LHQPOMI_cjs.diag(
2948
+ chunkRNXXYF22_cjs.diag(
2905
2949
  `[theokit-sdk] provider "${provider}" has authType: "none" \u2014 apiKeys ignored (no auth required for local runtime).
2906
2950
  `
2907
2951
  );
@@ -2927,10 +2971,10 @@ function warnUnknownProvidersInApiKeys(apiKeys) {
2927
2971
  if (apiKeys === void 0) return;
2928
2972
  for (const name of Object.keys(apiKeys)) {
2929
2973
  if (warnedProviders.has(name)) continue;
2930
- const profile = chunkHU666T3Q_cjs.getProviderProfile(name);
2974
+ const profile = chunkS46WJTDL_cjs.getProviderProfile(name);
2931
2975
  if (profile === void 0) {
2932
2976
  warnedProviders.add(name);
2933
- chunk6LHQPOMI_cjs.diag(
2977
+ chunkRNXXYF22_cjs.diag(
2934
2978
  `[theokit-sdk] credential-pool: unknown provider "${name}" in apiKeys (no profile registered)
2935
2979
  `
2936
2980
  );
@@ -2962,7 +3006,7 @@ function selectTransport(profile, apiKey, baseUrl) {
2962
3006
  if (apiKey !== "__oauth_lazy_token__") return;
2963
3007
  const auth = t.headers?.authorization ?? t.headers?.Authorization;
2964
3008
  if (t.fetch === void 0 && auth === void 0) {
2965
- throw new chunkUNFBHV46_cjs.ConfigurationError(
3009
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(
2966
3010
  `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".`
2967
3011
  );
2968
3012
  }
@@ -3021,7 +3065,7 @@ function selectTransport(profile, apiKey, baseUrl) {
3021
3065
  providerName: profile.name
3022
3066
  });
3023
3067
  }
3024
- throw new chunkUNFBHV46_cjs.ConfigurationError(
3068
+ throw new chunkCEGU5AVD_cjs.ConfigurationError(
3025
3069
  `Provider "${profile.name}" declares apiMode "${profile.apiMode}", which this SDK has no transport for. Transports are built in and cannot be extended by a plugin; the supported modes are "chat_completions", "anthropic_messages", "bedrock_anthropic" and "responses_api". Change the provider's apiMode to one of those, or open an issue if the provider genuinely speaks a fifth protocol.`,
3026
3070
  { code: "transport_unavailable" }
3027
3071
  );
@@ -3102,7 +3146,7 @@ function checkProviderPrefix(key, provider) {
3102
3146
  function registerPluginProviderProfiles(entries) {
3103
3147
  let registered = 0;
3104
3148
  for (const entry of entries) {
3105
- chunkHU666T3Q_cjs.registerProvider(entry.profile);
3149
+ chunkS46WJTDL_cjs.registerProvider(entry.profile);
3106
3150
  registered += 1;
3107
3151
  }
3108
3152
  return registered;
@@ -3126,7 +3170,7 @@ var AMBIENT_STORE = {
3126
3170
  };
3127
3171
  function isStoredOAuthAvailable(env = process.env) {
3128
3172
  try {
3129
- return chunkNAGPKWOD_cjs.readStoredOAuth(AMBIENT_STORE, env) !== void 0;
3173
+ return chunkQISSETTG_cjs.readStoredOAuth(AMBIENT_STORE, env) !== void 0;
3130
3174
  } catch {
3131
3175
  return false;
3132
3176
  }
@@ -3186,7 +3230,7 @@ function shouldUseRealLocalRuntime(apiKey) {
3186
3230
  function inferProviderFromApiKey(apiKey) {
3187
3231
  const provider = chunkFRITRLZQ_cjs.providerFromApiKeyPrefix(apiKey);
3188
3232
  if (provider === void 0) return void 0;
3189
- return chunkHU666T3Q_cjs.getProviderProfile(provider) === void 0 ? void 0 : provider;
3233
+ return chunkS46WJTDL_cjs.getProviderProfile(provider) === void 0 ? void 0 : provider;
3190
3234
  }
3191
3235
  function detectPrimaryProvider() {
3192
3236
  if (process.env.ANTHROPIC_API_KEY !== void 0 && process.env.ANTHROPIC_API_KEY.length > 0) {
@@ -3206,24 +3250,24 @@ function warnProviderPrecedenceOnce(asked, used) {
3206
3250
  const key = `${asked}->${used}`;
3207
3251
  if (warnedProviderPrecedence.has(key)) return;
3208
3252
  warnedProviderPrecedence.add(key);
3209
- chunk6LHQPOMI_cjs.diag(
3253
+ chunkRNXXYF22_cjs.diag(
3210
3254
  `[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.
3211
3255
  `
3212
3256
  );
3213
3257
  }
3214
3258
  var pluginProvidersAnnounced = false;
3215
3259
  function resolveRunProvider(options) {
3216
- chunkHU666T3Q_cjs.registerBuiltins();
3260
+ chunkS46WJTDL_cjs.registerBuiltins();
3217
3261
  const profiles = options.pluginManager?.aggregated.providerProfiles ?? [];
3218
3262
  const registered = registerPluginProviderProfiles(profiles);
3219
3263
  if (registered > 0 && !pluginProvidersAnnounced) {
3220
3264
  pluginProvidersAnnounced = true;
3221
3265
  const names = profiles.map((e) => e.profile.name).join(", ");
3222
- chunk6LHQPOMI_cjs.diag(`[theokit-sdk] registered ${registered} plugin provider profile(s): ${names}
3266
+ chunkRNXXYF22_cjs.diag(`[theokit-sdk] registered ${registered} plugin provider profile(s): ${names}
3223
3267
  `);
3224
3268
  }
3225
3269
  const parsedModel = chunk3EE6LVWT_cjs.parseModelId(options.model?.id);
3226
- const modelInferredProvider = parsedModel.provider !== void 0 && chunkHU666T3Q_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
3270
+ const modelInferredProvider = parsedModel.provider !== void 0 && chunkS46WJTDL_cjs.getProviderProfile(parsedModel.provider) !== void 0 ? parsedModel.provider : void 0;
3227
3271
  const keyInferredProvider = inferProviderFromApiKey(options.agentOptions.apiKey);
3228
3272
  const primary = options.agentOptions.providers?.routes?.[0]?.provider ?? keyInferredProvider ?? modelInferredProvider ?? detectPrimaryProvider();
3229
3273
  warnProviderPrecedenceOnce(modelInferredProvider, primary);
@@ -3254,13 +3298,13 @@ async function compressConversationWindow(opts) {
3254
3298
  try {
3255
3299
  summary = await opts.callLlm(opts.model, COMPRESSION_SYSTEM, userPrompt);
3256
3300
  } catch (cause) {
3257
- throw new chunkUNFBHV46_cjs.CompressionFailedError(
3301
+ throw new chunkCEGU5AVD_cjs.CompressionFailedError(
3258
3302
  `Compression LLM call failed: ${cause instanceof Error ? cause.message : String(cause)}`,
3259
3303
  { cause: cause instanceof Error ? cause : void 0 }
3260
3304
  );
3261
3305
  }
3262
3306
  if (!summary || summary.trim().length === 0) {
3263
- throw new chunkUNFBHV46_cjs.CompressionFailedError(
3307
+ throw new chunkCEGU5AVD_cjs.CompressionFailedError(
3264
3308
  "Compression LLM returned empty summary \u2014 reduction ineffective."
3265
3309
  );
3266
3310
  }
@@ -3306,7 +3350,7 @@ async function runPreCompactBounded(handler, ctx, timeoutMs, onError) {
3306
3350
  }
3307
3351
  async function compactSessionTranscript(opts) {
3308
3352
  const prior = await opts.store.readRecords(opts.loc.agentId);
3309
- const history = chunkZWACQM5U_cjs.reconstructMessages(prior);
3353
+ const history = chunk3WKWBYPO_cjs.reconstructMessages(prior);
3310
3354
  const compressible = [];
3311
3355
  for (const m of history) {
3312
3356
  const text = plainText(m.content);
@@ -3314,7 +3358,7 @@ async function compactSessionTranscript(opts) {
3314
3358
  compressible.push({ role: m.role, content: text });
3315
3359
  }
3316
3360
  }
3317
- const preTokens = chunkJ5623RIV_cjs.estimateTokens(compressible.map((m) => m.content).join("\n"));
3361
+ const preTokens = chunkKX5QXLBS_cjs.estimateTokens(compressible.map((m) => m.content).join("\n"));
3318
3362
  if (opts.onPreCompact !== void 0) {
3319
3363
  await runPreCompactBounded(
3320
3364
  opts.onPreCompact,
@@ -3329,7 +3373,7 @@ async function compactSessionTranscript(opts) {
3329
3373
  for (let i = compressible.length - 1; i >= 0; i--) {
3330
3374
  const m = compressible[i];
3331
3375
  if (m === void 0 || m.role !== "user" || isCompactSummary(m.content)) continue;
3332
- const cost = chunkJ5623RIV_cjs.estimateTokens(m.content);
3376
+ const cost = chunkKX5QXLBS_cjs.estimateTokens(m.content);
3333
3377
  if (budget + cost > COMPACT_USER_MESSAGE_MAX_TOKENS) {
3334
3378
  const remaining = COMPACT_USER_MESSAGE_MAX_TOKENS - budget;
3335
3379
  if (remaining > 50) {
@@ -3343,7 +3387,7 @@ async function compactSessionTranscript(opts) {
3343
3387
  }
3344
3388
  const summary = `${COMPACT_SUMMARY_MARKER}
3345
3389
  ${summaryBody}`;
3346
- const transcript = chunkZWACQM5U_cjs.SessionTranscript.fromRecords(prior, {
3390
+ const transcript = chunk3WKWBYPO_cjs.SessionTranscript.fromRecords(prior, {
3347
3391
  cwd: opts.loc.cwd,
3348
3392
  sessionId: opts.sessionId,
3349
3393
  model: opts.loc.model ?? "unknown"
@@ -3354,7 +3398,7 @@ ${summaryBody}`;
3354
3398
  const delta = transcript.records().slice(prior.length);
3355
3399
  await opts.store.appendRecords(opts.loc.agentId, delta);
3356
3400
  chunkYJNYDJ2T_cjs.invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
3357
- const postTokens = chunkJ5623RIV_cjs.estimateTokens([...preserved, summary].join("\n"));
3401
+ const postTokens = chunkKX5QXLBS_cjs.estimateTokens([...preserved, summary].join("\n"));
3358
3402
  return { preTokens, postTokens };
3359
3403
  }
3360
3404
  function resolveSummarizerRoute(opts) {
@@ -3363,9 +3407,9 @@ function resolveSummarizerRoute(opts) {
3363
3407
  }
3364
3408
  function buildDefaultSummarizer(opts) {
3365
3409
  return async (messages) => {
3366
- chunkHU666T3Q_cjs.registerBuiltins();
3410
+ chunkS46WJTDL_cjs.registerBuiltins();
3367
3411
  const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
3368
- const prefixProfile = modelPrefix !== void 0 ? chunkHU666T3Q_cjs.getProviderProfile(modelPrefix) : void 0;
3412
+ const prefixProfile = modelPrefix !== void 0 ? chunkS46WJTDL_cjs.getProviderProfile(modelPrefix) : void 0;
3369
3413
  const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
3370
3414
  const route = resolveSummarizerRoute({
3371
3415
  keyProvider: inferProviderFromApiKey(opts.apiKey),
@@ -3379,7 +3423,7 @@ function buildDefaultSummarizer(opts) {
3379
3423
  model = opts.agentModel;
3380
3424
  } else {
3381
3425
  try {
3382
- model = chunkJ5623RIV_cjs.resolveCompressionModel(opts.agentModel);
3426
+ model = chunkKX5QXLBS_cjs.resolveCompressionModel(opts.agentModel);
3383
3427
  } catch {
3384
3428
  model = opts.agentModel;
3385
3429
  }
@@ -3434,7 +3478,7 @@ async function autoCompactIfNeeded(opts) {
3434
3478
  return true;
3435
3479
  } catch (cause) {
3436
3480
  const msg = cause instanceof Error ? cause.message : String(cause);
3437
- chunk6LHQPOMI_cjs.diag(`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
3481
+ chunkRNXXYF22_cjs.diag(`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
3438
3482
  `);
3439
3483
  return false;
3440
3484
  }
@@ -3471,5 +3515,5 @@ exports.shouldUseFixtureMode = shouldUseFixtureMode;
3471
3515
  exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
3472
3516
  exports.tryFirstEvent = tryFirstEvent;
3473
3517
  exports.validateApiKeyShape = validateApiKeyShape;
3474
- //# sourceMappingURL=chunk-P5N3Q2NH.cjs.map
3475
- //# sourceMappingURL=chunk-P5N3Q2NH.cjs.map
3518
+ //# sourceMappingURL=chunk-LSWHDOCL.cjs.map
3519
+ //# sourceMappingURL=chunk-LSWHDOCL.cjs.map