@nyte-ai/ai 0.0.0-stage → 0.0.19

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 (314) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +170 -2
  3. package/THIRD-PARTY-NOTICES.md +866 -0
  4. package/dist/chunks/account-limits-cache-031vfpt3.js +37 -0
  5. package/dist/chunks/account-limits-cache-09vs98g6.js +41 -0
  6. package/dist/chunks/account-limits-cache-0af5gqeg.js +15 -0
  7. package/dist/chunks/account-limits-cache-0yd6bde8.js +103 -0
  8. package/dist/chunks/account-limits-cache-1jv43fhh.js +22 -0
  9. package/dist/chunks/account-limits-cache-3ykqmnj5.js +88 -0
  10. package/dist/chunks/account-limits-cache-4b8ckwqw.js +293 -0
  11. package/dist/chunks/account-limits-cache-4fn5w63p.js +295 -0
  12. package/dist/chunks/account-limits-cache-4hptgd2h.js +49 -0
  13. package/dist/chunks/account-limits-cache-53e64mhx.js +417 -0
  14. package/dist/chunks/account-limits-cache-5jdhn0e1.js +562 -0
  15. package/dist/chunks/account-limits-cache-5rx2pfm5.js +8 -0
  16. package/dist/chunks/account-limits-cache-5ygxyyss.js +19 -0
  17. package/dist/chunks/account-limits-cache-6250ykn6.js +21 -0
  18. package/dist/chunks/account-limits-cache-6x05n06z.js +49 -0
  19. package/dist/chunks/account-limits-cache-736tdyme.js +6 -0
  20. package/dist/chunks/account-limits-cache-75smws02.js +213 -0
  21. package/dist/chunks/account-limits-cache-7z9s8j16.js +139 -0
  22. package/dist/chunks/account-limits-cache-8137j3zp.js +37 -0
  23. package/dist/chunks/account-limits-cache-8qzk56vj.js +160 -0
  24. package/dist/chunks/account-limits-cache-8s8bz4dr.js +36 -0
  25. package/dist/chunks/account-limits-cache-8vzx8k6r.js +166 -0
  26. package/dist/chunks/account-limits-cache-8wfqg73s.js +135 -0
  27. package/dist/chunks/account-limits-cache-90c9c2eb.js +50 -0
  28. package/dist/chunks/account-limits-cache-9wqk28n5.js +25 -0
  29. package/dist/chunks/account-limits-cache-a1jyaq00.js +56 -0
  30. package/dist/chunks/account-limits-cache-a558rjbg.js +138 -0
  31. package/dist/chunks/account-limits-cache-a55e14fr.js +70 -0
  32. package/dist/chunks/account-limits-cache-a6cgeagz.js +77 -0
  33. package/dist/chunks/account-limits-cache-ag5b8dja.js +38 -0
  34. package/dist/chunks/account-limits-cache-b0x2sfya.js +45 -0
  35. package/dist/chunks/account-limits-cache-b23sbrke.js +26 -0
  36. package/dist/chunks/account-limits-cache-b4edaybk.js +8 -0
  37. package/dist/chunks/account-limits-cache-bsknrh6t.js +74 -0
  38. package/dist/chunks/account-limits-cache-csbxvam7.js +12 -0
  39. package/dist/chunks/account-limits-cache-cw7q7vfy.js +293 -0
  40. package/dist/chunks/account-limits-cache-d1ypzqzp.js +27 -0
  41. package/dist/chunks/account-limits-cache-d2a51dka.js +17 -0
  42. package/dist/chunks/account-limits-cache-dejeygdt.js +114 -0
  43. package/dist/chunks/account-limits-cache-eejm0vth.js +11 -0
  44. package/dist/chunks/account-limits-cache-ehy0ze2b.js +33 -0
  45. package/dist/chunks/account-limits-cache-emg5b4hj.js +53 -0
  46. package/dist/chunks/account-limits-cache-eqwweapz.js +6 -0
  47. package/dist/chunks/account-limits-cache-eyx1jcxc.js +8 -0
  48. package/dist/chunks/account-limits-cache-f9z00x8c.js +36 -0
  49. package/dist/chunks/account-limits-cache-fbkaq46e.js +113 -0
  50. package/dist/chunks/account-limits-cache-fdwad56n.js +399 -0
  51. package/dist/chunks/account-limits-cache-fht68jp2.js +22 -0
  52. package/dist/chunks/account-limits-cache-fp03ztsw.js +17 -0
  53. package/dist/chunks/account-limits-cache-fsktnetm.js +69 -0
  54. package/dist/chunks/account-limits-cache-fvadc36m.js +110 -0
  55. package/dist/chunks/account-limits-cache-gknnm1kv.js +13 -0
  56. package/dist/chunks/account-limits-cache-gqsrbky9.js +40 -0
  57. package/dist/chunks/account-limits-cache-gr671dr2.js +0 -0
  58. package/dist/chunks/account-limits-cache-gs8a3fhw.js +32 -0
  59. package/dist/chunks/account-limits-cache-gsa5tzck.js +37 -0
  60. package/dist/chunks/account-limits-cache-h92bzz1j.js +235 -0
  61. package/dist/chunks/account-limits-cache-hemxtapd.js +142 -0
  62. package/dist/chunks/account-limits-cache-hj1h48sc.js +92 -0
  63. package/dist/chunks/account-limits-cache-hj3ek3ty.js +128 -0
  64. package/dist/chunks/account-limits-cache-hwehc67r.js +509 -0
  65. package/dist/chunks/account-limits-cache-hyzn1jmk.js +46 -0
  66. package/dist/chunks/account-limits-cache-j2bt392s.js +63 -0
  67. package/dist/chunks/account-limits-cache-k0pkzhbx.js +74 -0
  68. package/dist/chunks/account-limits-cache-kjx405q0.js +277 -0
  69. package/dist/chunks/account-limits-cache-ks1sjym9.js +37 -0
  70. package/dist/chunks/account-limits-cache-me1x57bs.js +89 -0
  71. package/dist/chunks/account-limits-cache-n3yk6g5c.js +314 -0
  72. package/dist/chunks/account-limits-cache-nbhht7xz.js +72 -0
  73. package/dist/chunks/account-limits-cache-nbkyhs6v.js +42 -0
  74. package/dist/chunks/account-limits-cache-nn9jebsj.js +26 -0
  75. package/dist/chunks/account-limits-cache-nxkprk3g.js +13 -0
  76. package/dist/chunks/account-limits-cache-nyy770yd.js +38 -0
  77. package/dist/chunks/account-limits-cache-pfa86y8e.js +45 -0
  78. package/dist/chunks/account-limits-cache-pfr14mcn.js +59 -0
  79. package/dist/chunks/account-limits-cache-q1ebtvet.js +8 -0
  80. package/dist/chunks/account-limits-cache-q63mc41j.js +51 -0
  81. package/dist/chunks/account-limits-cache-re8hpzwn.js +104 -0
  82. package/dist/chunks/account-limits-cache-rz8p1g5y.js +9 -0
  83. package/dist/chunks/account-limits-cache-skbfmzqe.js +7 -0
  84. package/dist/chunks/account-limits-cache-tc38g0ca.js +20 -0
  85. package/dist/chunks/account-limits-cache-v4n30az2.js +24 -0
  86. package/dist/chunks/account-limits-cache-vwgfz727.js +281 -0
  87. package/dist/chunks/account-limits-cache-wtg64ez7.js +69 -0
  88. package/dist/chunks/account-limits-cache-x9fvb3s5.js +8 -0
  89. package/dist/chunks/account-limits-cache-xds88kxd.js +209 -0
  90. package/dist/chunks/account-limits-cache-xz65wyd1.js +428 -0
  91. package/dist/chunks/account-limits-cache-ydq8p8qp.js +39 -0
  92. package/dist/chunks/account-limits-cache-ykbqsvv6.js +134 -0
  93. package/dist/chunks/account-limits-cache-yzyp0c2h.js +251 -0
  94. package/dist/chunks/account-limits-cache-za42x8a3.js +25 -0
  95. package/dist/chunks/account-limits-cache-zcbkmrvy.js +79 -0
  96. package/dist/chunks/account-limits-cache-zgzptd0z.js +62 -0
  97. package/dist/chunks/account-limits-cache-zn01kscn.js +252 -0
  98. package/dist/chunks/account-limits-cache-zpjmeyt0.js +113 -0
  99. package/dist/chunks/account-limits-cache-zqdb4yh4.js +8 -0
  100. package/dist/src/account-limits-cache.d.ts +16 -0
  101. package/dist/src/account-limits-cache.js +7 -0
  102. package/dist/src/api/anthropic-client.d.ts +25 -0
  103. package/dist/src/api/anthropic-client.js +30 -0
  104. package/dist/src/api/anthropic-convert.d.ts +17 -0
  105. package/dist/src/api/anthropic-convert.js +14 -0
  106. package/dist/src/api/anthropic-events.d.ts +101 -0
  107. package/dist/src/api/anthropic-events.js +11 -0
  108. package/dist/src/api/anthropic-messages.d.ts +88 -0
  109. package/dist/src/api/anthropic-messages.js +578 -0
  110. package/dist/src/api/anthropic-messages.lazy.d.ts +2 -0
  111. package/dist/src/api/anthropic-messages.lazy.js +11 -0
  112. package/dist/src/api/assistant-stream.d.ts +23 -0
  113. package/dist/src/api/assistant-stream.js +15 -0
  114. package/dist/src/api/claude-code.d.ts +12 -0
  115. package/dist/src/api/claude-code.js +12 -0
  116. package/dist/src/api/cloudflare.d.ts +8 -0
  117. package/dist/src/api/cloudflare.js +11 -0
  118. package/dist/src/api/constrained-sampling.d.ts +24 -0
  119. package/dist/src/api/constrained-sampling.js +16 -0
  120. package/dist/src/api/deferred.d.ts +7 -0
  121. package/dist/src/api/deferred.js +10 -0
  122. package/dist/src/api/github-copilot-headers.d.ts +15 -0
  123. package/dist/src/api/github-copilot-headers.js +12 -0
  124. package/dist/src/api/google-generative-ai.d.ts +22 -0
  125. package/dist/src/api/google-generative-ai.js +583 -0
  126. package/dist/src/api/google-generative-ai.lazy.d.ts +2 -0
  127. package/dist/src/api/google-generative-ai.lazy.js +11 -0
  128. package/dist/src/api/lazy.d.ts +18 -0
  129. package/dist/src/api/lazy.js +12 -0
  130. package/dist/src/api/openai-codex-compact.d.ts +14 -0
  131. package/dist/src/api/openai-codex-compact.js +389 -0
  132. package/dist/src/api/openai-codex-compaction-error.d.ts +7 -0
  133. package/dist/src/api/openai-codex-compaction-error.js +6 -0
  134. package/dist/src/api/openai-codex-protocol.d.ts +125 -0
  135. package/dist/src/api/openai-codex-protocol.js +48 -0
  136. package/dist/src/api/openai-codex-responses.d.ts +4 -0
  137. package/dist/src/api/openai-codex-responses.js +175 -0
  138. package/dist/src/api/openai-codex-responses.lazy.d.ts +2 -0
  139. package/dist/src/api/openai-codex-responses.lazy.js +11 -0
  140. package/dist/src/api/openai-codex-websocket.d.ts +13 -0
  141. package/dist/src/api/openai-codex-websocket.js +37 -0
  142. package/dist/src/api/openai-codex-wire.d.ts +44 -0
  143. package/dist/src/api/openai-codex-wire.js +34 -0
  144. package/dist/src/api/openai-compact.d.ts +9 -0
  145. package/dist/src/api/openai-compact.js +12 -0
  146. package/dist/src/api/openai-completions-convert.d.ts +58 -0
  147. package/dist/src/api/openai-completions-convert.js +21 -0
  148. package/dist/src/api/openai-completions-params.d.ts +29 -0
  149. package/dist/src/api/openai-completions-params.js +20 -0
  150. package/dist/src/api/openai-completions-reasoning.d.ts +54 -0
  151. package/dist/src/api/openai-completions-reasoning.js +22 -0
  152. package/dist/src/api/openai-completions.d.ts +22 -0
  153. package/dist/src/api/openai-completions.js +484 -0
  154. package/dist/src/api/openai-completions.lazy.d.ts +5 -0
  155. package/dist/src/api/openai-completions.lazy.js +11 -0
  156. package/dist/src/api/openai-prompt-cache.d.ts +1 -0
  157. package/dist/src/api/openai-prompt-cache.js +6 -0
  158. package/dist/src/api/openai-responses-convert.d.ts +58 -0
  159. package/dist/src/api/openai-responses-convert.js +16 -0
  160. package/dist/src/api/openai-responses-events.d.ts +379 -0
  161. package/dist/src/api/openai-responses-events.js +12 -0
  162. package/dist/src/api/openai-responses-stream.d.ts +36 -0
  163. package/dist/src/api/openai-responses-stream.js +25 -0
  164. package/dist/src/api/openai-responses.d.ts +18 -0
  165. package/dist/src/api/openai-responses.js +276 -0
  166. package/dist/src/api/openai-responses.lazy.d.ts +2 -0
  167. package/dist/src/api/openai-responses.lazy.js +11 -0
  168. package/dist/src/api/simple-options.d.ts +17 -0
  169. package/dist/src/api/simple-options.js +18 -0
  170. package/dist/src/api/token-count.d.ts +5 -0
  171. package/dist/src/api/token-count.js +8 -0
  172. package/dist/src/api/transform-messages.d.ts +9 -0
  173. package/dist/src/api/transform-messages.js +6 -0
  174. package/dist/src/api-options.d.ts +27 -0
  175. package/dist/src/api-options.js +0 -0
  176. package/dist/src/auth/context.d.ts +11 -0
  177. package/dist/src/auth/context.js +6 -0
  178. package/dist/src/auth/credential-store.d.ts +17 -0
  179. package/dist/src/auth/credential-store.js +7 -0
  180. package/dist/src/auth/helpers.d.ts +24 -0
  181. package/dist/src/auth/helpers.js +8 -0
  182. package/dist/src/auth/oauth/anthropic.d.ts +7 -0
  183. package/dist/src/auth/oauth/anthropic.js +12 -0
  184. package/dist/src/auth/oauth/authorization-input.d.ts +14 -0
  185. package/dist/src/auth/oauth/authorization-input.js +6 -0
  186. package/dist/src/auth/oauth/device-code.d.ts +29 -0
  187. package/dist/src/auth/oauth/device-code.js +9 -0
  188. package/dist/src/auth/oauth/github-copilot.d.ts +23 -0
  189. package/dist/src/auth/oauth/github-copilot.js +12 -0
  190. package/dist/src/auth/oauth/load.d.ts +14 -0
  191. package/dist/src/auth/oauth/load.js +10 -0
  192. package/dist/src/auth/oauth/oauth-page.d.ts +13 -0
  193. package/dist/src/auth/oauth/oauth-page.js +8 -0
  194. package/dist/src/auth/oauth/openai-codex.d.ts +10 -0
  195. package/dist/src/auth/oauth/openai-codex.js +18 -0
  196. package/dist/src/auth/oauth/pkce.d.ts +12 -0
  197. package/dist/src/auth/oauth/pkce.js +6 -0
  198. package/dist/src/auth/resolve.d.ts +38 -0
  199. package/dist/src/auth/resolve.js +12 -0
  200. package/dist/src/auth/store.d.ts +29 -0
  201. package/dist/src/auth/store.js +10 -0
  202. package/dist/src/auth/types.d.ts +291 -0
  203. package/dist/src/auth/types.js +8 -0
  204. package/dist/src/auth/verify.d.ts +13 -0
  205. package/dist/src/auth/verify.js +7 -0
  206. package/dist/src/bun-oauth.d.ts +2 -0
  207. package/dist/src/bun-oauth.js +25 -0
  208. package/dist/src/env-api-keys.d.ts +32 -0
  209. package/dist/src/env-api-keys.js +27 -0
  210. package/dist/src/file-models-store.d.ts +18 -0
  211. package/dist/src/file-models-store.js +9 -0
  212. package/dist/src/index.d.ts +62 -0
  213. package/dist/src/index.js +372 -0
  214. package/dist/src/model-capabilities.d.ts +21 -0
  215. package/dist/src/model-capabilities.js +14 -0
  216. package/dist/src/model-pricing.d.ts +6 -0
  217. package/dist/src/model-pricing.js +10 -0
  218. package/dist/src/model-variants.d.ts +21 -0
  219. package/dist/src/model-variants.js +19 -0
  220. package/dist/src/models-refresh.d.ts +27 -0
  221. package/dist/src/models-refresh.js +9 -0
  222. package/dist/src/models-store.d.ts +31 -0
  223. package/dist/src/models-store.js +6 -0
  224. package/dist/src/models-types.d.ts +206 -0
  225. package/dist/src/models-types.js +0 -0
  226. package/dist/src/models.d.ts +7 -0
  227. package/dist/src/models.js +44 -0
  228. package/dist/src/prompt-cache.d.ts +5 -0
  229. package/dist/src/prompt-cache.js +9 -0
  230. package/dist/src/provider.d.ts +23 -0
  231. package/dist/src/provider.js +14 -0
  232. package/dist/src/providers/account-limits.d.ts +13 -0
  233. package/dist/src/providers/account-limits.js +8 -0
  234. package/dist/src/providers/anthropic-limits.d.ts +9 -0
  235. package/dist/src/providers/anthropic-limits.js +10 -0
  236. package/dist/src/providers/anthropic.d.ts +2 -0
  237. package/dist/src/providers/anthropic.js +25 -0
  238. package/dist/src/providers/github-copilot-catalog.d.ts +5 -0
  239. package/dist/src/providers/github-copilot-catalog.js +7 -0
  240. package/dist/src/providers/github-copilot.d.ts +2 -0
  241. package/dist/src/providers/github-copilot.js +23 -0
  242. package/dist/src/providers/nyte-catalog.d.ts +15 -0
  243. package/dist/src/providers/nyte-catalog.js +63 -0
  244. package/dist/src/providers/openai-codex-limits.d.ts +8 -0
  245. package/dist/src/providers/openai-codex-limits.js +14 -0
  246. package/dist/src/providers/openai-codex.d.ts +2 -0
  247. package/dist/src/providers/openai-codex.js +23 -0
  248. package/dist/src/providers/openai.d.ts +2 -0
  249. package/dist/src/providers/openai.js +19 -0
  250. package/dist/src/providers/opencode-go.d.ts +5 -0
  251. package/dist/src/providers/opencode-go.js +22 -0
  252. package/dist/src/providers/opencode-headers.d.ts +5 -0
  253. package/dist/src/providers/opencode-headers.js +6 -0
  254. package/dist/src/providers/opencode.d.ts +14 -0
  255. package/dist/src/providers/opencode.js +23 -0
  256. package/dist/src/providers/openrouter.d.ts +2 -0
  257. package/dist/src/providers/openrouter.js +19 -0
  258. package/dist/src/providers/vercel-ai-gateway.d.ts +3 -0
  259. package/dist/src/providers/vercel-ai-gateway.js +19 -0
  260. package/dist/src/session-resources.d.ts +9 -0
  261. package/dist/src/session-resources.js +10 -0
  262. package/dist/src/types.d.ts +210 -0
  263. package/dist/src/types.js +1 -0
  264. package/dist/src/utils/abort.d.ts +12 -0
  265. package/dist/src/utils/abort.js +10 -0
  266. package/dist/src/utils/deferred-tools.d.ts +11 -0
  267. package/dist/src/utils/deferred-tools.js +6 -0
  268. package/dist/src/utils/diagnostics.d.ts +11 -0
  269. package/dist/src/utils/diagnostics.js +12 -0
  270. package/dist/src/utils/error-body.d.ts +26 -0
  271. package/dist/src/utils/error-body.js +10 -0
  272. package/dist/src/utils/estimate.d.ts +20 -0
  273. package/dist/src/utils/estimate.js +14 -0
  274. package/dist/src/utils/event-stream.d.ts +22 -0
  275. package/dist/src/utils/event-stream.js +11 -0
  276. package/dist/src/utils/failure.d.ts +49 -0
  277. package/dist/src/utils/failure.js +10 -0
  278. package/dist/src/utils/fifo-queue.d.ts +11 -0
  279. package/dist/src/utils/fifo-queue.js +6 -0
  280. package/dist/src/utils/hash.d.ts +5 -0
  281. package/dist/src/utils/hash.js +6 -0
  282. package/dist/src/utils/headers.d.ts +12 -0
  283. package/dist/src/utils/headers.js +14 -0
  284. package/dist/src/utils/json-parse.d.ts +33 -0
  285. package/dist/src/utils/json-parse.js +12 -0
  286. package/dist/src/utils/node-http-proxy.d.ts +6 -0
  287. package/dist/src/utils/node-http-proxy.js +9 -0
  288. package/dist/src/utils/nyte-home.d.ts +2 -0
  289. package/dist/src/utils/nyte-home.js +6 -0
  290. package/dist/src/utils/nyte-user-agent.d.ts +1 -0
  291. package/dist/src/utils/nyte-user-agent.js +6 -0
  292. package/dist/src/utils/overflow.d.ts +18 -0
  293. package/dist/src/utils/overflow.js +9 -0
  294. package/dist/src/utils/provider-env.d.ts +9 -0
  295. package/dist/src/utils/provider-env.js +6 -0
  296. package/dist/src/utils/provider-retry.d.ts +22 -0
  297. package/dist/src/utils/provider-retry.js +9 -0
  298. package/dist/src/utils/retry.d.ts +66 -0
  299. package/dist/src/utils/retry.js +18 -0
  300. package/dist/src/utils/sanitize-unicode.d.ts +24 -0
  301. package/dist/src/utils/sanitize-unicode.js +6 -0
  302. package/dist/src/utils/sse.d.ts +21 -0
  303. package/dist/src/utils/sse.js +6 -0
  304. package/dist/src/utils/text.d.ts +5 -0
  305. package/dist/src/utils/text.js +10 -0
  306. package/dist/src/utils/transcript.d.ts +5 -0
  307. package/dist/src/utils/transcript.js +36 -0
  308. package/dist/src/utils/typebox-helpers.d.ts +19 -0
  309. package/dist/src/utils/typebox-helpers.js +6 -0
  310. package/dist/src/utils/uuid.d.ts +2 -0
  311. package/dist/src/utils/uuid.js +6 -0
  312. package/dist/src/utils/validation.d.ts +13 -0
  313. package/dist/src/utils/validation.js +8 -0
  314. package/package.json +152 -3
@@ -0,0 +1,252 @@
1
+ import {
2
+ resolveCacheRetention2
3
+ } from "./account-limits-cache-d2a51dka.js";
4
+ import {
5
+ getDeclaredTools2,
6
+ resolveTranscriptTools2
7
+ } from "./account-limits-cache-6250ykn6.js";
8
+ import {
9
+ createGrammarToolInputProperties2
10
+ } from "./account-limits-cache-h92bzz1j.js";
11
+ import {
12
+ clampOpenAIPromptCacheKey2
13
+ } from "./account-limits-cache-csbxvam7.js";
14
+ import {
15
+ thinkingBudgetForLevel2,
16
+ clampThinkingBudgetToAnswerRoom2
17
+ } from "./account-limits-cache-k0pkzhbx.js";
18
+ import {
19
+ resolveCompat2,
20
+ getCompatCacheControl2,
21
+ applyAnthropicCacheControl2,
22
+ convertMessages2,
23
+ convertTools2
24
+ } from "./account-limits-cache-fdwad56n.js";
25
+
26
+ // src/api/openai-completions-params.ts
27
+ function hasToolHistory(messages) {
28
+ for (const msg of messages) {
29
+ if (msg.role === "toolResult") {
30
+ return true;
31
+ }
32
+ if (msg.role === "assistant") {
33
+ if (msg.content.some((block) => block.type === "toolCall")) {
34
+ return true;
35
+ }
36
+ }
37
+ }
38
+ return false;
39
+ }
40
+ function getDeferredToolNames(messages) {
41
+ const names = new Set;
42
+ for (const message of messages) {
43
+ if (message.role === "toolResult") {
44
+ for (const name of message.addedToolNames ?? []) {
45
+ names.add(name);
46
+ }
47
+ }
48
+ }
49
+ return names;
50
+ }
51
+ function buildParams2(model, context, options, compat = resolveCompat2(model), cacheRetention = resolveCacheRetention2(options?.cacheRetention, options?.env), grammarToolInputProperties = createGrammarToolInputProperties2(getDeclaredTools2(context.messages), compat.supportsOpenAIGrammarTools)) {
52
+ const transcriptTools = resolveTranscriptTools2(context.messages, compat.supportsMidConvoSystemMessages === true && compat.supportsMidConvoToolAdditions === true);
53
+ const messages = convertMessages2(model, context, compat, { grammarToolInputProperties });
54
+ const cacheControl = getCompatCacheControl2(compat, cacheRetention);
55
+ const params = {
56
+ model: model.id,
57
+ messages,
58
+ stream: true,
59
+ prompt_cache_key: model.baseUrl.includes("api.openai.com") && cacheRetention !== "none" || cacheRetention === "long" && compat.supportsLongCacheRetention ? clampOpenAIPromptCacheKey2(options?.sessionId) : undefined,
60
+ prompt_cache_retention: cacheRetention === "long" && compat.supportsLongCacheRetention ? "24h" : undefined
61
+ };
62
+ if (compat.supportsUsageInStreaming !== false) {
63
+ params.stream_options = { include_usage: true };
64
+ }
65
+ if (compat.supportsStore) {
66
+ params.store = false;
67
+ }
68
+ if (options?.maxTokens) {
69
+ if (compat.maxTokensField === "max_tokens") {
70
+ params.max_tokens = options.maxTokens;
71
+ } else {
72
+ params.max_completion_tokens = options.maxTokens;
73
+ }
74
+ }
75
+ if (options?.temperature !== undefined) {
76
+ params.temperature = options.temperature;
77
+ }
78
+ const deferredToolNames = compat.deferredToolsMode === "kimi" ? getDeferredToolNames(context.messages) : new Set;
79
+ const activeTools = transcriptTools.requestTools.filter((tool) => !deferredToolNames.has(tool.name));
80
+ if (activeTools.length > 0) {
81
+ params.tools = convertTools2(activeTools, compat);
82
+ if (compat.zaiToolStream) {
83
+ Object.assign(params, { tool_stream: true });
84
+ }
85
+ } else if (hasToolHistory(context.messages)) {
86
+ params.tools = [];
87
+ }
88
+ if (cacheControl) {
89
+ applyAnthropicCacheControl2(messages, params.tools, cacheControl);
90
+ }
91
+ if (options?.toolChoice) {
92
+ params.tool_choice = options.toolChoice;
93
+ }
94
+ const thinkingTokenBudgetField = resolveThinkingTokenBudgetField(compat);
95
+ const thinkingBudget = resolveClampedThinkingBudget(model, options, params);
96
+ if (compat.thinkingFormat === "zai" && model.reasoning) {
97
+ Object.assign(params, {
98
+ thinking: options?.reasoningEffort ? { type: "enabled", clear_thinking: false } : { type: "disabled" }
99
+ });
100
+ if (options?.reasoningEffort && compat.supportsReasoningEffort) {
101
+ const mappedEffort = model.thinkingLevelMap?.[options.reasoningEffort];
102
+ const effort = mappedEffort === undefined ? options.reasoningEffort : mappedEffort;
103
+ if (effort !== null)
104
+ Object.assign(params, { reasoning_effort: effort });
105
+ }
106
+ } else if (compat.thinkingFormat === "qwen" && model.reasoning) {
107
+ Object.assign(params, { enable_thinking: !!options?.reasoningEffort });
108
+ if (options?.reasoningEffort && compat.supportsReasoningEffort) {
109
+ Object.assign(params, {
110
+ reasoning_effort: model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort
111
+ });
112
+ }
113
+ } else if (compat.thinkingFormat === "qwen-chat-template" && model.reasoning) {
114
+ Object.assign(params, {
115
+ chat_template_kwargs: {
116
+ enable_thinking: !!options?.reasoningEffort,
117
+ preserve_thinking: true
118
+ }
119
+ });
120
+ } else if (compat.thinkingFormat === "chat-template" && model.reasoning) {
121
+ const chatTemplateKwargs = buildChatTemplateValues(model, options, compat.chatTemplateKwargs, thinkingBudget);
122
+ if (chatTemplateKwargs) {
123
+ Object.assign(params, { chat_template_kwargs: chatTemplateKwargs });
124
+ }
125
+ } else if (compat.thinkingFormat === "baseten" && model.reasoning) {
126
+ const chatTemplateArgs = buildChatTemplateValues(model, options, compat.chatTemplateArgs, thinkingBudget);
127
+ if (chatTemplateArgs) {
128
+ Object.assign(params, { chat_template_args: chatTemplateArgs });
129
+ }
130
+ if (compat.supportsReasoningEffort) {
131
+ const requestedEffort = options?.reasoningEffort;
132
+ const mappedEffort = requestedEffort ? model.thinkingLevelMap?.[requestedEffort] : model.thinkingLevelMap?.off;
133
+ const effort = mappedEffort === undefined ? requestedEffort : mappedEffort;
134
+ if (effort !== null && effort !== undefined) {
135
+ Object.assign(params, { reasoning_effort: effort });
136
+ }
137
+ }
138
+ } else if (compat.thinkingFormat === "deepseek" && model.reasoning) {
139
+ if (options?.reasoningEffort) {
140
+ Object.assign(params, { thinking: { type: "enabled" } });
141
+ } else if (model.thinkingLevelMap?.off !== null) {
142
+ Object.assign(params, { thinking: { type: "disabled" } });
143
+ }
144
+ if (options?.reasoningEffort && compat.supportsReasoningEffort) {
145
+ Object.assign(params, {
146
+ reasoning_effort: model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort
147
+ });
148
+ }
149
+ } else if (compat.thinkingFormat === "openrouter" && model.reasoning) {
150
+ if (options?.reasoningEffort) {
151
+ Object.assign(params, {
152
+ reasoning: {
153
+ effort: model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort
154
+ }
155
+ });
156
+ } else if (model.thinkingLevelMap?.off !== null) {
157
+ Object.assign(params, { reasoning: { effort: model.thinkingLevelMap?.off ?? "none" } });
158
+ }
159
+ } else if (compat.thinkingFormat === "ant-ling" && model.reasoning && options?.reasoningEffort) {
160
+ const effort = model.thinkingLevelMap?.[options.reasoningEffort];
161
+ if (effort !== null && effort !== undefined)
162
+ Object.assign(params, { reasoning: { effort } });
163
+ } else if (compat.thinkingFormat === "together" && model.reasoning) {
164
+ Object.assign(params, { reasoning: { enabled: !!options?.reasoningEffort } });
165
+ if (options?.reasoningEffort && compat.supportsReasoningEffort) {
166
+ Object.assign(params, {
167
+ reasoning_effort: model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort
168
+ });
169
+ }
170
+ } else if (compat.thinkingFormat === "string-thinking" && model.reasoning) {
171
+ if (options?.reasoningEffort) {
172
+ Object.assign(params, {
173
+ thinking: model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort
174
+ });
175
+ } else if (model.thinkingLevelMap?.off !== null) {
176
+ Object.assign(params, { thinking: model.thinkingLevelMap?.off ?? "none" });
177
+ }
178
+ } else if (options?.reasoningEffort && model.reasoning && compat.supportsReasoningEffort) {
179
+ Object.assign(params, {
180
+ reasoning_effort: model.thinkingLevelMap?.[options.reasoningEffort] ?? options.reasoningEffort
181
+ });
182
+ } else if (!options?.reasoningEffort && model.reasoning && compat.supportsReasoningEffort) {
183
+ const offValue = model.thinkingLevelMap?.off;
184
+ if (offValue !== null && offValue !== undefined) {
185
+ Object.assign(params, { reasoning_effort: offValue });
186
+ }
187
+ }
188
+ if (thinkingTokenBudgetField && thinkingBudget !== undefined) {
189
+ Object.assign(params, { [thinkingTokenBudgetField]: thinkingBudget });
190
+ }
191
+ if (model.compat?.openRouterRouting) {
192
+ Object.assign(params, { provider: model.compat.openRouterRouting });
193
+ }
194
+ if (model.compat?.vercelGatewayRouting) {
195
+ const routing = model.compat.vercelGatewayRouting;
196
+ if (routing.only || routing.order) {
197
+ const gatewayOptions = {};
198
+ if (routing.only)
199
+ gatewayOptions.only = routing.only;
200
+ if (routing.order)
201
+ gatewayOptions.order = routing.order;
202
+ Object.assign(params, { providerOptions: { gateway: gatewayOptions } });
203
+ }
204
+ }
205
+ if (options?.samplingParams) {
206
+ Object.assign(params, options.samplingParams);
207
+ }
208
+ return params;
209
+ }
210
+ function resolveThinkingTokenBudgetField(compat) {
211
+ if (compat.thinkingTokenBudgetField)
212
+ return compat.thinkingTokenBudgetField;
213
+ if (compat.supportsThinkingTokenBudget)
214
+ return "thinking_token_budget";
215
+ return;
216
+ }
217
+ function resolveClampedThinkingBudget(model, options, params) {
218
+ if (!options?.reasoningEffort || !model.reasoning)
219
+ return;
220
+ const ceiling = params.max_tokens ?? params.max_completion_tokens ?? model.maxTokens;
221
+ const budget = clampThinkingBudgetToAnswerRoom2(thinkingBudgetForLevel2(options.reasoningEffort, options.thinkingBudgets), ceiling);
222
+ return budget > 0 ? budget : undefined;
223
+ }
224
+ function buildChatTemplateValues(model, options, values, thinkingBudget) {
225
+ const resolvedValues = {};
226
+ for (const [key, value] of Object.entries(values)) {
227
+ const resolved = resolveChatTemplateKwargValue(model, options, value, thinkingBudget);
228
+ if (resolved !== undefined) {
229
+ resolvedValues[key] = resolved;
230
+ }
231
+ }
232
+ return Object.keys(resolvedValues).length > 0 ? resolvedValues : undefined;
233
+ }
234
+ function resolveChatTemplateKwargValue(model, options, value, thinkingBudget) {
235
+ if (typeof value !== "object" || value === null) {
236
+ return value;
237
+ }
238
+ const reasoningEffort = options?.reasoningEffort;
239
+ if (!reasoningEffort && value.omitWhenOff) {
240
+ return;
241
+ }
242
+ if (value.$var === "thinking.enabled") {
243
+ return !!reasoningEffort;
244
+ }
245
+ if (value.$var === "thinking.budget") {
246
+ return thinkingBudget;
247
+ }
248
+ const mappedValue = reasoningEffort ? model.thinkingLevelMap?.[reasoningEffort] : model.thinkingLevelMap?.off;
249
+ return mappedValue === undefined ? reasoningEffort : mappedValue ?? undefined;
250
+ }
251
+
252
+ export { buildParams2 };
@@ -0,0 +1,113 @@
1
+ import {
2
+ raceWithAbortSignal2
3
+ } from "./account-limits-cache-j2bt392s.js";
4
+ import {
5
+ ModelsError2
6
+ } from "./account-limits-cache-7z9s8j16.js";
7
+
8
+ // src/models-refresh.ts
9
+ import { keyedSerial } from "@nyte-ai/schema/serial";
10
+ class CatalogRefreshes2 {
11
+ generations = new Map;
12
+ controllers = new Map;
13
+ restorations = new Map;
14
+ publications = keyedSerial();
15
+ modelsStore;
16
+ catalog;
17
+ constructor(modelsStore, catalog) {
18
+ this.modelsStore = modelsStore;
19
+ this.catalog = catalog;
20
+ }
21
+ supersede(providerId) {
22
+ const generation = (this.generations.get(providerId) ?? 0) + 1;
23
+ this.generations.set(providerId, generation);
24
+ const previous = this.controllers.get(providerId);
25
+ if (previous) {
26
+ this.controllers.delete(providerId);
27
+ previous.abort();
28
+ }
29
+ return generation;
30
+ }
31
+ running() {
32
+ return this.controllers.keys();
33
+ }
34
+ publish(providerId, generation, signal, publication) {
35
+ const queued = this.publications.run(providerId, async () => {
36
+ if (signal.aborted || this.generations.get(providerId) !== generation)
37
+ return false;
38
+ if (publication.persist === null) {
39
+ await this.modelsStore.delete(providerId, { signal });
40
+ } else if (publication.persist !== undefined) {
41
+ await this.modelsStore.write(providerId, structuredClone(publication.persist), { signal });
42
+ }
43
+ if (signal.aborted || this.generations.get(providerId) !== generation)
44
+ return false;
45
+ publication.update?.();
46
+ return true;
47
+ });
48
+ return raceWithAbortSignal2(queued, signal);
49
+ }
50
+ async runPhase(provider, credential, allowNetwork, force, generation, signal) {
51
+ const stored = await this.modelsStore.read(provider.id, { signal });
52
+ await provider.refreshModels?.({
53
+ credential,
54
+ stored: stored ? structuredClone(stored) : undefined,
55
+ publish: (publication) => this.publish(provider.id, generation, signal, publication),
56
+ allowNetwork,
57
+ force: allowNetwork ? force : undefined,
58
+ catalog: this.catalog,
59
+ signal
60
+ });
61
+ }
62
+ async run(provider, allowNetwork, force, callerSignal, readAccounts, resolveCredential) {
63
+ const running = this.restorations.get(provider.id);
64
+ if (!allowNetwork && running !== undefined) {
65
+ await raceWithAbortSignal2(running, callerSignal).catch(() => {
66
+ return;
67
+ });
68
+ return;
69
+ }
70
+ const generation = this.supersede(provider.id);
71
+ const controller = new AbortController;
72
+ this.controllers.set(provider.id, controller);
73
+ const signal = AbortSignal.any([callerSignal, controller.signal]);
74
+ const restored = Promise.withResolvers();
75
+ this.restorations.set(provider.id, restored.promise);
76
+ const operation = (async () => {
77
+ let storedAccounts;
78
+ let credentialError;
79
+ try {
80
+ storedAccounts = allowNetwork ? await readAccounts(signal) : undefined;
81
+ } catch (error) {
82
+ credentialError = error;
83
+ }
84
+ await this.runPhase(provider, storedAccounts?.accounts.find((account) => account.id === storedAccounts.active)?.credential, false, undefined, generation, signal);
85
+ restored.resolve();
86
+ if (credentialError !== undefined)
87
+ throw credentialError;
88
+ if (!allowNetwork || signal.aborted)
89
+ return;
90
+ const credential = await resolveCredential(storedAccounts, signal);
91
+ await this.runPhase(provider, credential, true, force, generation, signal);
92
+ })();
93
+ try {
94
+ await raceWithAbortSignal2(operation, signal);
95
+ return;
96
+ } catch (error) {
97
+ if (signal.aborted)
98
+ return;
99
+ return error instanceof Error ? error : new ModelsError2("model_source", `Model refresh failed for ${provider.id}`, {
100
+ cause: error
101
+ });
102
+ } finally {
103
+ restored.resolve();
104
+ if (this.controllers.get(provider.id) === controller)
105
+ this.controllers.delete(provider.id);
106
+ if (this.restorations.get(provider.id) === restored.promise) {
107
+ this.restorations.delete(provider.id);
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ export { CatalogRefreshes2 };
@@ -0,0 +1,8 @@
1
+ import {
2
+ lazyApi2
3
+ } from "./account-limits-cache-90c9c2eb.js";
4
+
5
+ // src/api/anthropic-messages.lazy.ts
6
+ var anthropicMessagesApi2 = () => lazyApi2(() => import("../src/api/anthropic-messages.js"));
7
+
8
+ export { anthropicMessagesApi2 };
@@ -0,0 +1,16 @@
1
+ import type { AccountLimits, AccountLimitsResult } from "./types.ts";
2
+ /** A request's account observations cannot outlive the credential selection it started with. */
3
+ interface AccountLimitsScope {
4
+ observe(accountId: string | undefined, limits: AccountLimits): void;
5
+ fetch(accountId: string | undefined, load: (signal: AbortSignal) => Promise<AccountLimits | undefined>, options?: {
6
+ readonly signal?: AbortSignal;
7
+ }): Promise<AccountLimitsResult>;
8
+ }
9
+ /** Owns account quota freshness, shared requests, and credential lifecycle invalidation. */
10
+ export declare class AccountLimitsCache {
11
+ private readonly providers;
12
+ get(providerId: string, accountId?: string | null): AccountLimits | undefined;
13
+ invalidate(providerId: string): void;
14
+ scope(providerId: string): AccountLimitsScope;
15
+ }
16
+ export {};
@@ -0,0 +1,7 @@
1
+ import {
2
+ AccountLimitsCache2
3
+ } from "../chunks/account-limits-cache-hemxtapd.js";
4
+ import"../chunks/account-limits-cache-j2bt392s.js";
5
+ export {
6
+ AccountLimitsCache2 as AccountLimitsCache
7
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The Anthropic SDK client for a request: compat defaults, beta headers,
3
+ * authentication (API key, OAuth, Copilot, OIDC federation) and header merging.
4
+ */
5
+ import Anthropic, { type ClientOptions } from "@anthropic-ai/sdk";
6
+ import type { AnthropicMessagesCompat, Model, ProviderEnv, ProviderHeaders, TranscriptContext } from "../types.ts";
7
+ export declare const FAST_MODE_BETA = "fast-mode-2026-02-01";
8
+ export declare const MID_CONVERSATION_TOOL_CHANGES_BETA = "mid-conversation-tool-changes-2026-07-01";
9
+ export declare function shouldUseServerSideFallbackBeta(model: Model<"anthropic-messages">): boolean;
10
+ export declare function getAnthropicCompat(model: Model<"anthropic-messages">): Required<Omit<AnthropicMessagesCompat, "forceAdaptiveThinking" | "allowedFallbackModels">>;
11
+ export declare function mergeAnthropicHeaders(...headerSources: (ProviderHeaders | undefined)[]): ProviderHeaders;
12
+ export declare function appendAnthropicBeta(headers: ProviderHeaders, beta: string | undefined): ProviderHeaders;
13
+ export declare function assertRequestAuth(provider: string, apiKey: string | undefined, headers: ProviderHeaders | undefined): void;
14
+ type AnthropicFederationConfig = NonNullable<ClientOptions["config"]>;
15
+ export declare function getAnthropicFederation(model: Model<"anthropic-messages">, apiKey: string | undefined, headers: ProviderHeaders | undefined, env: ProviderEnv | undefined): AnthropicFederationConfig | undefined;
16
+ /**
17
+ * The SDK client and whether it signs in as Claude Code. Adaptive thinking models have
18
+ * interleaved thinking built in, so they skip the interleaved-thinking beta header.
19
+ */
20
+ export declare function createClient(model: Model<"anthropic-messages">, apiKey: string | undefined, interleavedThinking: boolean, useFineGrainedToolStreamingBeta: boolean, useServerSideFallbackBeta: boolean, useFastModeBeta: boolean, useMidConversationToolChangesBeta: boolean, optionsHeaders?: ProviderHeaders, fetch?: typeof globalThis.fetch, dynamicHeaders?: ProviderHeaders, sessionId?: string, federation?: AnthropicFederationConfig): {
21
+ client: Anthropic;
22
+ isOAuthToken: boolean;
23
+ };
24
+ export declare function shouldUseFineGrainedToolStreamingBeta(model: Model<"anthropic-messages">, context: TranscriptContext): boolean;
25
+ export {};
@@ -0,0 +1,30 @@
1
+ import {
2
+ FAST_MODE_BETA2,
3
+ MID_CONVERSATION_TOOL_CHANGES_BETA2,
4
+ shouldUseServerSideFallbackBeta2,
5
+ getAnthropicCompat2,
6
+ mergeAnthropicHeaders2,
7
+ appendAnthropicBeta2,
8
+ assertRequestAuth2,
9
+ getAnthropicFederation2,
10
+ createClient2,
11
+ shouldUseFineGrainedToolStreamingBeta2
12
+ } from "../../chunks/account-limits-cache-75smws02.js";
13
+ import"../../chunks/account-limits-cache-ks1sjym9.js";
14
+ import"../../chunks/account-limits-cache-6250ykn6.js";
15
+ import"../../chunks/account-limits-cache-gknnm1kv.js";
16
+ import"../../chunks/account-limits-cache-ag5b8dja.js";
17
+ import"../../chunks/account-limits-cache-hyzn1jmk.js";
18
+ import"../../chunks/account-limits-cache-b23sbrke.js";
19
+ export {
20
+ FAST_MODE_BETA2 as FAST_MODE_BETA,
21
+ MID_CONVERSATION_TOOL_CHANGES_BETA2 as MID_CONVERSATION_TOOL_CHANGES_BETA,
22
+ appendAnthropicBeta2 as appendAnthropicBeta,
23
+ assertRequestAuth2 as assertRequestAuth,
24
+ createClient2 as createClient,
25
+ getAnthropicCompat2 as getAnthropicCompat,
26
+ getAnthropicFederation2 as getAnthropicFederation,
27
+ mergeAnthropicHeaders2 as mergeAnthropicHeaders,
28
+ shouldUseFineGrainedToolStreamingBeta2 as shouldUseFineGrainedToolStreamingBeta,
29
+ shouldUseServerSideFallbackBeta2 as shouldUseServerSideFallbackBeta
30
+ };
@@ -0,0 +1,17 @@
1
+ import type { BetaTool, BetaCacheControlEphemeral, BetaMessageParam } from "@anthropic-ai/sdk/resources/beta/messages/messages.js";
2
+ import type { Message, Tool } from "../types.ts";
3
+ export declare function normalizeToolCallId(id: string): string;
4
+ /**
5
+ * The transcript as Anthropic messages.
6
+ *
7
+ * - Anthropic requires `tool_result` immediately after `tool_use`, so system updates are held
8
+ * until the next assistant message or the end of the transcript.
9
+ * - A thinking block whose signature is missing or empty, e.g. from an aborted stream, becomes
10
+ * plain text; models marked `allowEmptySignature` emit and accept empty signatures, so they
11
+ * keep the block.
12
+ * - Consecutive tool results go into one user message, which the z.ai Anthropic endpoint needs;
13
+ * content displaced by tool references follows every `tool_result` block.
14
+ * - The last user or system message carries `cache_control`, caching the conversation history.
15
+ */
16
+ export declare function convertMessages(transformedMessages: Message[], isOAuthToken: boolean, cacheControl?: BetaCacheControlEphemeral, allowEmptySignature?: boolean, deferredToolNames?: ReadonlySet<string>, normalizeToolName?: (name: string) => string, nativeToolChanges?: boolean): BetaMessageParam[];
17
+ export declare function convertTools(tools: Tool[], isOAuthToken: boolean, supportsEagerToolInputStreaming: boolean, supportsStrictTools: boolean, cacheControl?: BetaCacheControlEphemeral, deferLoading?: boolean): BetaTool[];
@@ -0,0 +1,14 @@
1
+ import {
2
+ normalizeToolCallId2,
3
+ convertMessages3,
4
+ convertTools3
5
+ } from "../../chunks/account-limits-cache-4b8ckwqw.js";
6
+ import"../../chunks/account-limits-cache-h92bzz1j.js";
7
+ import"../../chunks/account-limits-cache-eqwweapz.js";
8
+ import"../../chunks/account-limits-cache-ks1sjym9.js";
9
+ import"../../chunks/account-limits-cache-b4edaybk.js";
10
+ export {
11
+ convertMessages3 as convertMessages,
12
+ convertTools3 as convertTools,
13
+ normalizeToolCallId2 as normalizeToolCallId
14
+ };
@@ -0,0 +1,101 @@
1
+ import { Type, type Static } from "typebox";
2
+ export declare const AnthropicEventSchema: Type.TUnion<[Type.TObject<{
3
+ type: Type.TLiteral<"message_start">;
4
+ message: Type.TObject<{
5
+ id: Type.TString;
6
+ model: Type.TString;
7
+ usage: Type.TObject<{
8
+ input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
9
+ output_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
10
+ cache_read_input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
11
+ cache_creation_input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
12
+ cache_creation: Type.TOptional<Type.TUnion<[Type.TObject<{
13
+ ephemeral_1h_input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
14
+ }>, Type.TNull]>>;
15
+ output_tokens_details: Type.TOptional<Type.TUnion<[Type.TObject<{
16
+ thinking_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
17
+ }>, Type.TNull]>>;
18
+ speed: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
19
+ }>;
20
+ }>;
21
+ }>, Type.TObject<{
22
+ type: Type.TLiteral<"message_delta">;
23
+ delta: Type.TObject<{
24
+ stop_reason: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
25
+ stop_details: Type.TOptional<Type.TUnion<[Type.TObject<{
26
+ explanation: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
27
+ }>, Type.TNull]>>;
28
+ }>;
29
+ usage: Type.TOptional<Type.TUnion<[Type.TObject<{
30
+ input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
31
+ output_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
32
+ cache_read_input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
33
+ cache_creation_input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
34
+ cache_creation: Type.TOptional<Type.TUnion<[Type.TObject<{
35
+ ephemeral_1h_input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
36
+ }>, Type.TNull]>>;
37
+ output_tokens_details: Type.TOptional<Type.TUnion<[Type.TObject<{
38
+ thinking_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
39
+ }>, Type.TNull]>>;
40
+ speed: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
41
+ }>, Type.TNull]>>;
42
+ }>, Type.TObject<{
43
+ type: Type.TLiteral<"message_stop">;
44
+ }>, Type.TObject<{
45
+ type: Type.TLiteral<"content_block_start">;
46
+ index: Type.TInteger;
47
+ content_block: Type.TUnion<[Type.TObject<{
48
+ type: Type.TLiteral<"text">;
49
+ text: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
50
+ }>, Type.TObject<{
51
+ type: Type.TLiteral<"thinking">;
52
+ thinking: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
53
+ signature: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
54
+ }>, Type.TObject<{
55
+ type: Type.TLiteral<"redacted_thinking">;
56
+ data: Type.TString;
57
+ }>, Type.TObject<{
58
+ type: Type.TLiteral<"tool_use">;
59
+ id: Type.TString;
60
+ name: Type.TString;
61
+ input: Type.TOptional<Type.TUnion<[Type.TRecord<"^.*$", Type.TUnknown>, Type.TNull]>>;
62
+ }>]>;
63
+ }>, Type.TObject<{
64
+ type: Type.TLiteral<"content_block_delta">;
65
+ index: Type.TInteger;
66
+ delta: Type.TUnion<[Type.TObject<{
67
+ type: Type.TLiteral<"text_delta">;
68
+ text: Type.TString;
69
+ }>, Type.TObject<{
70
+ type: Type.TLiteral<"thinking_delta">;
71
+ thinking: Type.TString;
72
+ }>, Type.TObject<{
73
+ type: Type.TLiteral<"input_json_delta">;
74
+ partial_json: Type.TString;
75
+ }>, Type.TObject<{
76
+ type: Type.TLiteral<"signature_delta">;
77
+ signature: Type.TString;
78
+ }>]>;
79
+ }>, Type.TObject<{
80
+ type: Type.TLiteral<"content_block_stop">;
81
+ index: Type.TInteger;
82
+ }>]>;
83
+ export type AnthropicEvent = Static<typeof AnthropicEventSchema>;
84
+ export declare const AnthropicEventTypeSchema: Type.TUnion<[Type.TLiteral<"message_start">, Type.TLiteral<"message_delta">, Type.TLiteral<"message_stop">, Type.TLiteral<"content_block_start">, Type.TLiteral<"content_block_delta">, Type.TLiteral<"content_block_stop">]>;
85
+ /**
86
+ * Unknown block variants are forward-compatible. Malformed *known* variants must
87
+ * not fall through this alternative, so its exclusions derive from the schemas above.
88
+ */
89
+ export declare const IgnoredAnthropicEventSchema: Type.TUnion<[Type.TObject<{
90
+ type: Type.TLiteral<"content_block_start">;
91
+ index: Type.TInteger;
92
+ content_block: Type.TObject<{
93
+ type: Type.TString;
94
+ }>;
95
+ }>, Type.TObject<{
96
+ type: Type.TLiteral<"content_block_delta">;
97
+ index: Type.TInteger;
98
+ delta: Type.TObject<{
99
+ type: Type.TString;
100
+ }>;
101
+ }>]>;
@@ -0,0 +1,11 @@
1
+ import {
2
+ AnthropicEventSchema2,
3
+ AnthropicEventTypeSchema2,
4
+ IgnoredAnthropicEventSchema2
5
+ } from "../../chunks/account-limits-cache-3ykqmnj5.js";
6
+ import"../../chunks/account-limits-cache-736tdyme.js";
7
+ export {
8
+ AnthropicEventSchema2 as AnthropicEventSchema,
9
+ AnthropicEventTypeSchema2 as AnthropicEventTypeSchema,
10
+ IgnoredAnthropicEventSchema2 as IgnoredAnthropicEventSchema
11
+ };