@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,583 @@
1
+ import {
2
+ calculateCost2,
3
+ clampThinkingLevel2
4
+ } from "../../chunks/account-limits-cache-zgzptd0z.js";
5
+ import {
6
+ providerHeadersToRecord2
7
+ } from "../../chunks/account-limits-cache-ag5b8dja.js";
8
+ import {
9
+ getNyteUserAgent2
10
+ } from "../../chunks/account-limits-cache-gknnm1kv.js";
11
+ import"../../chunks/account-limits-cache-j2bt392s.js";
12
+ import {
13
+ retryProviderRequest2
14
+ } from "../../chunks/account-limits-cache-nbhht7xz.js";
15
+ import {
16
+ sanitizeSurrogates2
17
+ } from "../../chunks/account-limits-cache-eqwweapz.js";
18
+ import {
19
+ getSystemMessageText2
20
+ } from "../../chunks/account-limits-cache-b4edaybk.js";
21
+ import {
22
+ collapseSystemMessages2,
23
+ getCurrentTools2,
24
+ getInitialSystemMessage2,
25
+ withoutInitialSystemMessage2
26
+ } from "../../chunks/account-limits-cache-6250ykn6.js";
27
+ import"../../chunks/account-limits-cache-zcbkmrvy.js";
28
+ import"../../chunks/account-limits-cache-nn9jebsj.js";
29
+ import"../../chunks/account-limits-cache-a6cgeagz.js";
30
+ import {
31
+ emptyCost2,
32
+ runAssistantStream2
33
+ } from "../../chunks/account-limits-cache-fsktnetm.js";
34
+ import {
35
+ getJsonSchemaToolParameters2,
36
+ resolveJsonSchemaStrictSampling2
37
+ } from "../../chunks/account-limits-cache-h92bzz1j.js";
38
+ import"../../chunks/account-limits-cache-dejeygdt.js";
39
+ import {
40
+ buildBaseOptions2
41
+ } from "../../chunks/account-limits-cache-k0pkzhbx.js";
42
+ import {
43
+ transformMessages2
44
+ } from "../../chunks/account-limits-cache-8qzk56vj.js";
45
+
46
+ // src/api/google-generative-ai.ts
47
+ import {
48
+ FinishReason,
49
+ FunctionCallingConfigMode,
50
+ GoogleGenAI,
51
+ ThinkingLevel as GoogleThinkingLevel
52
+ } from "@google/genai";
53
+ var toolCallCounter = 0;
54
+ var stream = (model, context, options) => {
55
+ const normalizedContext = collapseSystemMessages2(context);
56
+ return runAssistantStream2(model, options?.signal, "Google", async (output, stream) => {
57
+ if (options?.fetch && options.fetch !== globalThis.fetch) {
58
+ throw new Error("Custom fetch is not supported by the Google Generative AI adapter");
59
+ }
60
+ const apiKey = options?.apiKey;
61
+ if (!apiKey) {
62
+ throw new Error(`No API key for provider: ${model.provider}`);
63
+ }
64
+ const client = createClient(model, apiKey, options?.headers);
65
+ const params = buildParams(model, normalizedContext, options);
66
+ await options?.onPayload?.(params, model);
67
+ const googleStream = await retryGoogleRequest(() => client.models.generateContentStream(params), options);
68
+ stream.push({ type: "start", partial: output });
69
+ let currentBlock = null;
70
+ const blocks = output.content;
71
+ const blockIndex = () => blocks.length - 1;
72
+ for await (const chunk of googleStream) {
73
+ output.responseId ||= chunk.responseId;
74
+ const candidate = chunk.candidates?.[0];
75
+ if (candidate?.content?.parts) {
76
+ for (const part of candidate.content.parts) {
77
+ if (part.text !== undefined) {
78
+ const isThinking = part.thought === true;
79
+ if (!currentBlock || isThinking && currentBlock.type !== "thinking" || !isThinking && currentBlock.type !== "text") {
80
+ if (currentBlock) {
81
+ if (currentBlock.type === "text") {
82
+ stream.push({
83
+ type: "text_end",
84
+ contentIndex: blocks.length - 1,
85
+ content: currentBlock.text,
86
+ partial: output
87
+ });
88
+ } else {
89
+ stream.push({
90
+ type: "thinking_end",
91
+ contentIndex: blockIndex(),
92
+ content: currentBlock.thinking,
93
+ partial: output
94
+ });
95
+ }
96
+ }
97
+ if (isThinking) {
98
+ currentBlock = { type: "thinking", thinking: "", thinkingSignature: undefined };
99
+ output.content.push(currentBlock);
100
+ stream.push({
101
+ type: "thinking_start",
102
+ contentIndex: blockIndex(),
103
+ partial: output
104
+ });
105
+ } else {
106
+ currentBlock = { type: "text", text: "" };
107
+ output.content.push(currentBlock);
108
+ stream.push({ type: "text_start", contentIndex: blockIndex(), partial: output });
109
+ }
110
+ }
111
+ if (currentBlock.type === "thinking") {
112
+ currentBlock.thinking += part.text;
113
+ currentBlock.thinkingSignature = retainThoughtSignature(currentBlock.thinkingSignature, part.thoughtSignature);
114
+ stream.push({
115
+ type: "thinking_delta",
116
+ contentIndex: blockIndex(),
117
+ delta: part.text,
118
+ partial: output
119
+ });
120
+ } else {
121
+ currentBlock.text += part.text;
122
+ currentBlock.textSignature = retainThoughtSignature(currentBlock.textSignature, part.thoughtSignature);
123
+ stream.push({
124
+ type: "text_delta",
125
+ contentIndex: blockIndex(),
126
+ delta: part.text,
127
+ partial: output
128
+ });
129
+ }
130
+ }
131
+ if (part.functionCall) {
132
+ if (currentBlock) {
133
+ if (currentBlock.type === "text") {
134
+ stream.push({
135
+ type: "text_end",
136
+ contentIndex: blockIndex(),
137
+ content: currentBlock.text,
138
+ partial: output
139
+ });
140
+ } else {
141
+ stream.push({
142
+ type: "thinking_end",
143
+ contentIndex: blockIndex(),
144
+ content: currentBlock.thinking,
145
+ partial: output
146
+ });
147
+ }
148
+ currentBlock = null;
149
+ }
150
+ const providedId = part.functionCall.id;
151
+ const needsNewId = !providedId || output.content.some((b) => b.type === "toolCall" && b.id === providedId);
152
+ const toolCallId = needsNewId ? `${part.functionCall.name}_${Date.now()}_${++toolCallCounter}` : providedId;
153
+ const toolCall = {
154
+ type: "toolCall",
155
+ id: toolCallId,
156
+ name: part.functionCall.name || "",
157
+ arguments: part.functionCall.args ?? {},
158
+ ...part.thoughtSignature && { thoughtSignature: part.thoughtSignature }
159
+ };
160
+ output.content.push(toolCall);
161
+ stream.push({ type: "toolcall_start", contentIndex: blockIndex(), partial: output });
162
+ stream.push({
163
+ type: "toolcall_delta",
164
+ contentIndex: blockIndex(),
165
+ delta: JSON.stringify(toolCall.arguments),
166
+ partial: output
167
+ });
168
+ stream.push({
169
+ type: "toolcall_end",
170
+ contentIndex: blockIndex(),
171
+ toolCall,
172
+ partial: output
173
+ });
174
+ }
175
+ }
176
+ }
177
+ if (candidate?.finishReason) {
178
+ output.rawStopReason = candidate.finishReason;
179
+ output.stopReason = mapStopReason(candidate.finishReason);
180
+ if (output.content.some((b) => b.type === "toolCall") && output.stopReason === "stop") {
181
+ output.stopReason = "toolUse";
182
+ }
183
+ }
184
+ if (chunk.usageMetadata) {
185
+ output.usage = {
186
+ input: (chunk.usageMetadata.promptTokenCount || 0) - (chunk.usageMetadata.cachedContentTokenCount || 0),
187
+ output: (chunk.usageMetadata.candidatesTokenCount || 0) + (chunk.usageMetadata.thoughtsTokenCount || 0),
188
+ cacheRead: chunk.usageMetadata.cachedContentTokenCount || 0,
189
+ cacheWrite: 0,
190
+ reasoning: chunk.usageMetadata.thoughtsTokenCount || 0,
191
+ totalTokens: chunk.usageMetadata.totalTokenCount || 0,
192
+ cost: emptyCost2()
193
+ };
194
+ calculateCost2(model, output.usage);
195
+ }
196
+ }
197
+ if (currentBlock) {
198
+ if (currentBlock.type === "text") {
199
+ stream.push({
200
+ type: "text_end",
201
+ contentIndex: blockIndex(),
202
+ content: currentBlock.text,
203
+ partial: output
204
+ });
205
+ } else {
206
+ stream.push({
207
+ type: "thinking_end",
208
+ contentIndex: blockIndex(),
209
+ content: currentBlock.thinking,
210
+ partial: output
211
+ });
212
+ }
213
+ }
214
+ if (output.stopReason === "error" && output.rawStopReason) {
215
+ output.errorMessage = `Provider stopped with: ${output.rawStopReason}`;
216
+ }
217
+ });
218
+ };
219
+ var streamSimple = (model, context, options) => {
220
+ const apiKey = options?.apiKey;
221
+ if (!apiKey) {
222
+ throw new Error(`No API key for provider: ${model.provider}`);
223
+ }
224
+ const base = buildBaseOptions2(model, context, options);
225
+ if (!options?.reasoning) {
226
+ return stream(model, context, {
227
+ ...base,
228
+ thinking: { enabled: false }
229
+ });
230
+ }
231
+ const clampedReasoning = clampThinkingLevel2(model, options.reasoning);
232
+ if (clampedReasoning === "off") {
233
+ return stream(model, context, {
234
+ ...base,
235
+ thinking: { enabled: false }
236
+ });
237
+ }
238
+ const resolvedLevel = resolveGoogleThinkingLevel(model, clampedReasoning);
239
+ if (usesGoogleThinkingLevel(model)) {
240
+ return stream(model, context, {
241
+ ...base,
242
+ thinking: {
243
+ enabled: true,
244
+ level: toGoogleThinkingLevel(resolvedLevel)
245
+ }
246
+ });
247
+ }
248
+ return stream(model, context, {
249
+ ...base,
250
+ thinking: {
251
+ enabled: true,
252
+ budgetTokens: getGoogleBudget(model, resolvedLevel, options.thinkingBudgets)
253
+ }
254
+ });
255
+ };
256
+ function createClient(model, apiKey, optionsHeaders) {
257
+ const httpOptions = {};
258
+ if (model.baseUrl) {
259
+ httpOptions.baseUrl = model.baseUrl;
260
+ httpOptions.apiVersion = "";
261
+ }
262
+ const headers = providerHeadersToRecord2({ "User-Agent": getNyteUserAgent2() }, model.headers, optionsHeaders);
263
+ if (headers) {
264
+ httpOptions.headers = headers;
265
+ }
266
+ return new GoogleGenAI({
267
+ apiKey,
268
+ httpOptions: Object.keys(httpOptions).length > 0 ? httpOptions : undefined
269
+ });
270
+ }
271
+ function buildParams(model, context, options = {}) {
272
+ const contents = convertMessages(model, context);
273
+ const initialSystemMessage = getInitialSystemMessage2(context.messages);
274
+ const currentTools = getCurrentTools2(context.messages);
275
+ const generationConfig = {};
276
+ if (options.temperature !== undefined) {
277
+ generationConfig.temperature = options.temperature;
278
+ }
279
+ if (options.maxTokens !== undefined) {
280
+ generationConfig.maxOutputTokens = options.maxTokens;
281
+ }
282
+ const supportsStrictMode = atLeastGemini3(model.id);
283
+ const functionCallingMode = currentTools.length > 0 ? resolveGoogleFunctionCallingMode(currentTools, options.toolChoice, supportsStrictMode) : undefined;
284
+ const systemInstruction = initialSystemMessage ? getSystemMessageText2(initialSystemMessage) : "";
285
+ const config = {
286
+ ...Object.keys(generationConfig).length > 0 && generationConfig,
287
+ ...systemInstruction && { systemInstruction: sanitizeSurrogates2(systemInstruction) },
288
+ ...currentTools.length > 0 && {
289
+ tools: convertTools(currentTools, supportsStrictMode)
290
+ },
291
+ ...functionCallingMode !== undefined && {
292
+ toolConfig: { functionCallingConfig: { mode: functionCallingMode } }
293
+ }
294
+ };
295
+ if (options.thinking?.enabled && model.reasoning) {
296
+ const thinkingConfig = { includeThoughts: true };
297
+ if (options.thinking.level !== undefined) {
298
+ thinkingConfig.thinkingLevel = options.thinking.level;
299
+ } else if (options.thinking.budgetTokens !== undefined) {
300
+ thinkingConfig.thinkingBudget = options.thinking.budgetTokens;
301
+ }
302
+ config.thinkingConfig = thinkingConfig;
303
+ } else if (model.reasoning && options.thinking && !options.thinking.enabled) {
304
+ config.thinkingConfig = getDisabledThinkingConfig(model);
305
+ }
306
+ if (options.signal) {
307
+ if (options.signal.aborted) {
308
+ throw new Error("Request aborted");
309
+ }
310
+ config.abortSignal = options.signal;
311
+ }
312
+ const params = {
313
+ model: model.id,
314
+ contents,
315
+ config
316
+ };
317
+ return params;
318
+ }
319
+ function usesGoogleThinkingLevel(model) {
320
+ const id = model.id.toLowerCase();
321
+ return /gemini-3(?:\.\d+)?-(?:pro|flash)/.test(id) || id === "gemini-flash-latest" || id === "gemini-flash-lite-latest" || /gemma-?4/.test(id);
322
+ }
323
+ function getDisabledThinkingConfig(model) {
324
+ if (!usesGoogleThinkingLevel(model))
325
+ return { thinkingBudget: 0 };
326
+ const fallback = clampThinkingLevel2(model, "off");
327
+ if (fallback === "off")
328
+ return { thinkingBudget: 0 };
329
+ return { thinkingLevel: toGoogleThinkingLevel(resolveGoogleThinkingLevel(model, fallback)) };
330
+ }
331
+ function toGoogleThinkingLevel(level) {
332
+ switch (level) {
333
+ case "minimal":
334
+ return GoogleThinkingLevel.MINIMAL;
335
+ case "low":
336
+ return GoogleThinkingLevel.LOW;
337
+ case "medium":
338
+ return GoogleThinkingLevel.MEDIUM;
339
+ case "high":
340
+ return GoogleThinkingLevel.HIGH;
341
+ }
342
+ }
343
+ function getGoogleBudget(model, level, customBudgets) {
344
+ if (customBudgets?.[level] !== undefined) {
345
+ return customBudgets[level];
346
+ }
347
+ if (model.id.includes("2.5-pro")) {
348
+ const budgets = {
349
+ minimal: 128,
350
+ low: 2048,
351
+ medium: 8192,
352
+ high: 32768
353
+ };
354
+ return budgets[level];
355
+ }
356
+ if (model.id.includes("2.5-flash-lite")) {
357
+ const budgets = {
358
+ minimal: 512,
359
+ low: 2048,
360
+ medium: 8192,
361
+ high: 24576
362
+ };
363
+ return budgets[level];
364
+ }
365
+ if (model.id.includes("2.5-flash")) {
366
+ const budgets = {
367
+ minimal: 128,
368
+ low: 2048,
369
+ medium: 8192,
370
+ high: 24576
371
+ };
372
+ return budgets[level];
373
+ }
374
+ return -1;
375
+ }
376
+ function resolveGoogleThinkingLevel(model, level) {
377
+ const mapped = model.thinkingLevelMap?.[level];
378
+ const resolvedLevel = mapped?.toLowerCase() ?? level;
379
+ switch (resolvedLevel) {
380
+ case "minimal":
381
+ case "low":
382
+ case "medium":
383
+ case "high":
384
+ return resolvedLevel;
385
+ default:
386
+ throw new Error(`Unsupported Google thinking level mapping for ${model.provider}/${model.id}: ${level} -> ${String(mapped)}`);
387
+ }
388
+ }
389
+ function retainThoughtSignature(existing, incoming) {
390
+ return incoming || existing;
391
+ }
392
+ var base64SignaturePattern = /^[A-Za-z0-9+/]+={0,2}$/;
393
+ function resolveThoughtSignature(isSameProviderAndModel, signature) {
394
+ return isSameProviderAndModel && signature !== undefined && signature.length > 0 && signature.length % 4 === 0 && base64SignaturePattern.test(signature) ? signature : undefined;
395
+ }
396
+ function getGeminiMajorVersion(modelId) {
397
+ const match = modelId.toLowerCase().match(/^gemini(?:-live)?-(\d+)/);
398
+ return match ? Number.parseInt(match[1], 10) : undefined;
399
+ }
400
+ function atLeastGemini3(modelId) {
401
+ const majorVersion = getGeminiMajorVersion(modelId);
402
+ return majorVersion !== undefined && majorVersion >= 3;
403
+ }
404
+ function supportsMultimodalFunctionResponse(modelId) {
405
+ const majorVersion = getGeminiMajorVersion(modelId);
406
+ return majorVersion === undefined || majorVersion >= 3;
407
+ }
408
+ function convertMessages(model, context) {
409
+ const conversation = withoutInitialSystemMessage2(collapseSystemMessages2(context).messages);
410
+ const contents = [];
411
+ const normalizeToolCallId = (id) => {
412
+ if (!atLeastGemini3(model.id))
413
+ return id;
414
+ return id.replace(/[^a-zA-Z0-9_-]/g, "_").slice(0, 64);
415
+ };
416
+ const transformedMessages = transformMessages2(conversation, model, normalizeToolCallId);
417
+ for (const message of transformedMessages) {
418
+ if (message.role === "system")
419
+ continue;
420
+ if (message.role === "user") {
421
+ if (!Array.isArray(message.content)) {
422
+ contents.push({
423
+ role: "user",
424
+ parts: [{ text: sanitizeSurrogates2(message.content) }]
425
+ });
426
+ } else {
427
+ const parts = message.content.map((item) => item.type === "text" ? { text: sanitizeSurrogates2(item.text) } : { inlineData: { mimeType: item.mimeType, data: item.data } });
428
+ if (parts.length > 0) {
429
+ contents.push({ role: "user", parts });
430
+ }
431
+ }
432
+ continue;
433
+ }
434
+ if (message.role === "assistant") {
435
+ const parts = [];
436
+ const isSameProviderAndModel = message.provider === model.provider && message.model === model.id;
437
+ for (const block of message.content) {
438
+ if (block.type === "text") {
439
+ const thoughtSignature = resolveThoughtSignature(isSameProviderAndModel, block.textSignature);
440
+ if (block.text.trim() === "" && !thoughtSignature)
441
+ continue;
442
+ parts.push({
443
+ text: sanitizeSurrogates2(block.text),
444
+ ...thoughtSignature && { thoughtSignature }
445
+ });
446
+ continue;
447
+ }
448
+ if (block.type === "thinking") {
449
+ if (isSameProviderAndModel) {
450
+ const thoughtSignature = resolveThoughtSignature(isSameProviderAndModel, block.thinkingSignature);
451
+ if (block.thinking.trim() === "" && !thoughtSignature)
452
+ continue;
453
+ parts.push({
454
+ thought: true,
455
+ text: sanitizeSurrogates2(block.thinking),
456
+ ...thoughtSignature && { thoughtSignature }
457
+ });
458
+ } else if (block.thinking.trim() !== "") {
459
+ parts.push({ text: sanitizeSurrogates2(block.thinking) });
460
+ }
461
+ continue;
462
+ }
463
+ const thoughtSignature = resolveThoughtSignature(isSameProviderAndModel, block.thoughtSignature);
464
+ parts.push({
465
+ functionCall: {
466
+ name: block.name,
467
+ args: block.arguments ?? {},
468
+ ...atLeastGemini3(model.id) && { id: block.id }
469
+ },
470
+ ...thoughtSignature && { thoughtSignature }
471
+ });
472
+ }
473
+ if (parts.length > 0) {
474
+ contents.push({ role: "model", parts });
475
+ }
476
+ continue;
477
+ }
478
+ const textResult = message.content.filter((content) => content.type === "text").map((content) => content.text).join(`
479
+ `);
480
+ const imageContent = model.input.includes("image") ? message.content.filter((content) => content.type === "image") : [];
481
+ const hasImages = imageContent.length > 0;
482
+ const supportsMultimodalResponse = supportsMultimodalFunctionResponse(model.id);
483
+ const responseValue = textResult.length > 0 ? sanitizeSurrogates2(textResult) : hasImages ? "(see attached image)" : "";
484
+ const imageParts = imageContent.map((image) => ({
485
+ inlineData: { mimeType: image.mimeType, data: image.data }
486
+ }));
487
+ const functionResponsePart = {
488
+ functionResponse: {
489
+ name: message.toolName,
490
+ response: message.isError ? { error: responseValue } : { output: responseValue },
491
+ ...hasImages && supportsMultimodalResponse && { parts: imageParts },
492
+ ...atLeastGemini3(model.id) && { id: message.toolCallId }
493
+ }
494
+ };
495
+ const lastContent = contents[contents.length - 1];
496
+ if (lastContent?.role === "user" && lastContent.parts?.some((part) => part.functionResponse)) {
497
+ lastContent.parts.push(functionResponsePart);
498
+ } else {
499
+ contents.push({ role: "user", parts: [functionResponsePart] });
500
+ }
501
+ if (hasImages && !supportsMultimodalResponse) {
502
+ contents.push({
503
+ role: "user",
504
+ parts: [{ text: "Tool result image:" }, ...imageParts]
505
+ });
506
+ }
507
+ }
508
+ return contents;
509
+ }
510
+ function convertTools(tools, supportsStrictMode) {
511
+ if (tools.length === 0)
512
+ return;
513
+ return [
514
+ {
515
+ functionDeclarations: tools.map((tool) => {
516
+ const strict = resolveJsonSchemaStrictSampling2(tool, supportsStrictMode);
517
+ return {
518
+ name: tool.name,
519
+ description: tool.description,
520
+ parametersJsonSchema: getJsonSchemaToolParameters2(tool, strict)
521
+ };
522
+ })
523
+ }
524
+ ];
525
+ }
526
+ function resolveGoogleFunctionCallingMode(tools, toolChoice, supportsStrictMode) {
527
+ if (toolChoice === "none")
528
+ return FunctionCallingConfigMode.NONE;
529
+ if (toolChoice === "any")
530
+ return FunctionCallingConfigMode.ANY;
531
+ if (tools.some((tool) => resolveJsonSchemaStrictSampling2(tool, supportsStrictMode))) {
532
+ return FunctionCallingConfigMode.VALIDATED;
533
+ }
534
+ return toolChoice === "auto" ? FunctionCallingConfigMode.AUTO : undefined;
535
+ }
536
+ function mapStopReason(reason) {
537
+ switch (reason) {
538
+ case FinishReason.STOP:
539
+ return "stop";
540
+ case FinishReason.MAX_TOKENS:
541
+ return "length";
542
+ case FinishReason.BLOCKLIST:
543
+ case FinishReason.PROHIBITED_CONTENT:
544
+ case FinishReason.SPII:
545
+ case FinishReason.SAFETY:
546
+ case FinishReason.IMAGE_SAFETY:
547
+ case FinishReason.IMAGE_PROHIBITED_CONTENT:
548
+ case FinishReason.IMAGE_RECITATION:
549
+ case FinishReason.IMAGE_OTHER:
550
+ case FinishReason.RECITATION:
551
+ case FinishReason.FINISH_REASON_UNSPECIFIED:
552
+ case FinishReason.OTHER:
553
+ case FinishReason.LANGUAGE:
554
+ case FinishReason.MALFORMED_FUNCTION_CALL:
555
+ case FinishReason.UNEXPECTED_TOOL_CALL:
556
+ case FinishReason.NO_IMAGE:
557
+ return "error";
558
+ default: {
559
+ const exhaustive = reason;
560
+ throw new Error(`Unhandled stop reason: ${exhaustive}`);
561
+ }
562
+ }
563
+ }
564
+ function retryGoogleRequest(request, options) {
565
+ return retryProviderRequest2(async () => {
566
+ try {
567
+ return await request();
568
+ } catch (error) {
569
+ if (error instanceof Error && "status" in error && !("headers" in error)) {
570
+ Object.assign(error, { headers: undefined });
571
+ }
572
+ throw error;
573
+ }
574
+ }, {
575
+ maxRetries: options?.maxRetries,
576
+ maxRetryDelayMs: options?.maxRetryDelayMs,
577
+ signal: options?.signal
578
+ });
579
+ }
580
+ export {
581
+ stream,
582
+ streamSimple
583
+ };
@@ -0,0 +1,2 @@
1
+ import type { ProviderStreams } from "../types.ts";
2
+ export declare const googleGenerativeAIApi: () => ProviderStreams;
@@ -0,0 +1,11 @@
1
+ import {
2
+ googleGenerativeAIApi2
3
+ } from "../../chunks/account-limits-cache-x9fvb3s5.js";
4
+ import"../../chunks/account-limits-cache-90c9c2eb.js";
5
+ import"../../chunks/account-limits-cache-fsktnetm.js";
6
+ import"../../chunks/account-limits-cache-zcbkmrvy.js";
7
+ import"../../chunks/account-limits-cache-a6cgeagz.js";
8
+ import"../../chunks/account-limits-cache-nn9jebsj.js";
9
+ export {
10
+ googleGenerativeAIApi2 as googleGenerativeAIApi
11
+ };
@@ -0,0 +1,18 @@
1
+ import type { Api, Model, ProviderStreams } from "../types.ts";
2
+ import { AssistantMessageEventStream } from "../utils/event-stream.ts";
3
+ /**
4
+ * Returns a stream synchronously while running async setup (auth resolution,
5
+ * lazy module loading) behind it. Setup failures terminate the stream with an
6
+ * error event.
7
+ */
8
+ export declare function lazyStream(model: Model<Api>, setup: () => Promise<AssistantMessageEventStream>): AssistantMessageEventStream;
9
+ /**
10
+ * Wraps a dynamically imported API implementation module as `ProviderStreams`.
11
+ * The module loads on first stream call; the host's import cache deduplicates
12
+ * loads. Load failures terminate the returned stream with an error event.
13
+ */
14
+ export interface LazyApiCapabilities {
15
+ fetchDeferred?: boolean;
16
+ cancelDeferred?: boolean;
17
+ }
18
+ export declare function lazyApi(load: () => Promise<ProviderStreams>, capabilities?: LazyApiCapabilities): ProviderStreams;
@@ -0,0 +1,12 @@
1
+ import {
2
+ lazyStream2,
3
+ lazyApi2
4
+ } from "../../chunks/account-limits-cache-90c9c2eb.js";
5
+ import"../../chunks/account-limits-cache-fsktnetm.js";
6
+ import"../../chunks/account-limits-cache-zcbkmrvy.js";
7
+ import"../../chunks/account-limits-cache-a6cgeagz.js";
8
+ import"../../chunks/account-limits-cache-nn9jebsj.js";
9
+ export {
10
+ lazyApi2 as lazyApi,
11
+ lazyStream2 as lazyStream
12
+ };
@@ -0,0 +1,14 @@
1
+ import type { Context, Model } from "../types.ts";
2
+ import { type OpenAICodexResponsesOptions } from "./openai-codex-protocol.ts";
3
+ import type { OpenAICompactResult } from "./openai-compact.ts";
4
+ export type OpenAICodexCompactResult = OpenAICompactResult;
5
+ /**
6
+ * Codex V2 uses the ordinary Responses stream, not /responses/compact.
7
+ * History retention follows openai/codex@121f91fd5d9dc66017866ce9bdc49f1e182721df,
8
+ * core/src/compact_remote_v2.rs and compact_remote_v2_images.rs.
9
+ * timeoutMs bounds header wait and stream idleness, not total duration.
10
+ * It defaults to five minutes; zero disables it. A failure throws an
11
+ * {@link OpenAICodexCompactionError} without a cause, response body, or raw SSE payload,
12
+ * since those may echo prompts or credentials.
13
+ */
14
+ export declare function compactOpenAICodexContext(model: Model<"openai-codex-responses">, context: Context, requested?: OpenAICodexResponsesOptions): Promise<OpenAICodexCompactResult>;