@radheim/ai 0.0.0-stage → 2.4.3

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 (560) hide show
  1. package/README.md +1890 -3
  2. package/dist/ai.d.ts +36 -0
  3. package/dist/ai.js +46 -0
  4. package/dist/cache-policy.d.ts +6 -0
  5. package/dist/cache-policy.js +205 -0
  6. package/dist/decision-client.d.ts +10 -0
  7. package/dist/decision-client.js +42 -0
  8. package/dist/decision.d.ts +378 -0
  9. package/dist/decision.js +171 -0
  10. package/dist/effect.d.ts +59 -0
  11. package/dist/effect.js +33 -0
  12. package/dist/effort-updates.d.ts +12 -0
  13. package/dist/effort-updates.js +23 -0
  14. package/dist/embedding-client.d.ts +10 -0
  15. package/dist/embedding-client.js +17 -0
  16. package/dist/embedding.d.ts +113 -0
  17. package/dist/embedding.js +76 -0
  18. package/dist/experimental/cloudflare-run-extraction.d.ts +17 -0
  19. package/dist/experimental/cloudflare-run-extraction.js +85 -0
  20. package/dist/experimental/extraction.d.ts +153 -0
  21. package/dist/experimental/extraction.js +103 -0
  22. package/dist/experimental/realtime.d.ts +80 -0
  23. package/dist/experimental/realtime.js +96 -0
  24. package/dist/experimental.d.ts +10 -0
  25. package/dist/experimental.js +6 -0
  26. package/dist/fetch-middleware.d.ts +7 -0
  27. package/dist/fetch-middleware.js +41 -0
  28. package/dist/generation.d.ts +77 -0
  29. package/dist/generation.js +109 -0
  30. package/dist/image-client.d.ts +14 -0
  31. package/dist/image-client.js +39 -0
  32. package/dist/image.d.ts +323 -0
  33. package/dist/image.js +103 -0
  34. package/dist/index.d.ts +300 -0
  35. package/dist/index.js +179 -0
  36. package/dist/llm.d.ts +109 -0
  37. package/dist/llm.js +177 -0
  38. package/dist/loop.d.ts +38 -0
  39. package/dist/loop.js +139 -0
  40. package/dist/media-client.d.ts +30 -0
  41. package/dist/media-client.js +44 -0
  42. package/dist/media-model.d.ts +49 -0
  43. package/dist/media-model.js +55 -0
  44. package/dist/media.d.ts +237 -0
  45. package/dist/media.js +285 -0
  46. package/dist/promise-media.d.ts +20 -0
  47. package/dist/promise-media.js +16 -0
  48. package/dist/protocols/alibaba-chat.d.ts +315 -0
  49. package/dist/protocols/alibaba-chat.js +78 -0
  50. package/dist/protocols/alibaba-images.d.ts +22 -0
  51. package/dist/protocols/alibaba-images.js +77 -0
  52. package/dist/protocols/alibaba-messages.d.ts +413 -0
  53. package/dist/protocols/alibaba-messages.js +44 -0
  54. package/dist/protocols/alibaba-responses.d.ts +298 -0
  55. package/dist/protocols/alibaba-responses.js +67 -0
  56. package/dist/protocols/anthropic-messages.d.ts +1213 -0
  57. package/dist/protocols/anthropic-messages.js +1412 -0
  58. package/dist/protocols/assemblyai-transcription.d.ts +41 -0
  59. package/dist/protocols/assemblyai-transcription.js +137 -0
  60. package/dist/protocols/bedrock-converse.d.ts +548 -0
  61. package/dist/protocols/bedrock-converse.js +801 -0
  62. package/dist/protocols/bedrock-event-stream.d.ts +14 -0
  63. package/dist/protocols/bedrock-event-stream.js +100 -0
  64. package/dist/protocols/cartesia-speech.d.ts +117 -0
  65. package/dist/protocols/cartesia-speech.js +120 -0
  66. package/dist/protocols/cloudflare-run-decisions.d.ts +9 -0
  67. package/dist/protocols/cloudflare-run-decisions.js +36 -0
  68. package/dist/protocols/cloudflare-workers-ai-images.d.ts +23 -0
  69. package/dist/protocols/cloudflare-workers-ai-images.js +80 -0
  70. package/dist/protocols/cohere-chat.d.ts +184 -0
  71. package/dist/protocols/cohere-chat.js +317 -0
  72. package/dist/protocols/deepgram-speech.d.ts +109 -0
  73. package/dist/protocols/deepgram-speech.js +93 -0
  74. package/dist/protocols/deepgram-transcription.d.ts +26 -0
  75. package/dist/protocols/deepgram-transcription.js +119 -0
  76. package/dist/protocols/elevenlabs-speech.d.ts +112 -0
  77. package/dist/protocols/elevenlabs-speech.js +111 -0
  78. package/dist/protocols/elevenlabs-transcription.d.ts +28 -0
  79. package/dist/protocols/elevenlabs-transcription.js +137 -0
  80. package/dist/protocols/gemini.d.ts +388 -0
  81. package/dist/protocols/gemini.js +741 -0
  82. package/dist/protocols/google-decisions.d.ts +13 -0
  83. package/dist/protocols/google-decisions.js +133 -0
  84. package/dist/protocols/google-embed-content.d.ts +34 -0
  85. package/dist/protocols/google-embed-content.js +110 -0
  86. package/dist/protocols/google-images.d.ts +18 -0
  87. package/dist/protocols/google-images.js +169 -0
  88. package/dist/protocols/google-interactions-video.d.ts +38 -0
  89. package/dist/protocols/google-interactions-video.js +185 -0
  90. package/dist/protocols/google-interactions.d.ts +554 -0
  91. package/dist/protocols/google-interactions.js +756 -0
  92. package/dist/protocols/google-speech.d.ts +120 -0
  93. package/dist/protocols/google-speech.js +94 -0
  94. package/dist/protocols/google-transcription.d.ts +148 -0
  95. package/dist/protocols/google-transcription.js +129 -0
  96. package/dist/protocols/google-vertex-predict-embeddings.d.ts +18 -0
  97. package/dist/protocols/google-vertex-predict-embeddings.js +74 -0
  98. package/dist/protocols/index.d.ts +21 -0
  99. package/dist/protocols/index.js +21 -0
  100. package/dist/protocols/meta-images.d.ts +26 -0
  101. package/dist/protocols/meta-images.js +101 -0
  102. package/dist/protocols/meta-messages.d.ts +423 -0
  103. package/dist/protocols/meta-messages.js +63 -0
  104. package/dist/protocols/meta-responses.d.ts +533 -0
  105. package/dist/protocols/meta-responses.js +189 -0
  106. package/dist/protocols/minimax-images.d.ts +25 -0
  107. package/dist/protocols/minimax-images.js +150 -0
  108. package/dist/protocols/minimax-video.d.ts +45 -0
  109. package/dist/protocols/minimax-video.js +296 -0
  110. package/dist/protocols/mistral-chat.d.ts +565 -0
  111. package/dist/protocols/mistral-chat.js +606 -0
  112. package/dist/protocols/open-responses-channel.d.ts +25 -0
  113. package/dist/protocols/open-responses-channel.js +137 -0
  114. package/dist/protocols/open-responses-continuation.d.ts +18 -0
  115. package/dist/protocols/open-responses-continuation.js +172 -0
  116. package/dist/protocols/open-responses.d.ts +2509 -0
  117. package/dist/protocols/open-responses.js +1335 -0
  118. package/dist/protocols/openai-chat.d.ts +2571 -0
  119. package/dist/protocols/openai-chat.js +1140 -0
  120. package/dist/protocols/openai-compatible-chat.d.ts +184 -0
  121. package/dist/protocols/openai-compatible-chat.js +19 -0
  122. package/dist/protocols/openai-compatible-responses.d.ts +231 -0
  123. package/dist/protocols/openai-compatible-responses.js +18 -0
  124. package/dist/protocols/openai-decisions.d.ts +22 -0
  125. package/dist/protocols/openai-decisions.js +141 -0
  126. package/dist/protocols/openai-embeddings.d.ts +16 -0
  127. package/dist/protocols/openai-embeddings.js +76 -0
  128. package/dist/protocols/openai-freeform.d.ts +78 -0
  129. package/dist/protocols/openai-freeform.js +222 -0
  130. package/dist/protocols/openai-images.d.ts +148 -0
  131. package/dist/protocols/openai-images.js +303 -0
  132. package/dist/protocols/openai-responses.d.ts +1600 -0
  133. package/dist/protocols/openai-responses.js +360 -0
  134. package/dist/protocols/openai-speech.d.ts +110 -0
  135. package/dist/protocols/openai-speech.js +112 -0
  136. package/dist/protocols/openai-transcription.d.ts +185 -0
  137. package/dist/protocols/openai-transcription.js +206 -0
  138. package/dist/protocols/openrouter-video.d.ts +36 -0
  139. package/dist/protocols/openrouter-video.js +139 -0
  140. package/dist/protocols/seedance-video.d.ts +45 -0
  141. package/dist/protocols/seedance-video.js +217 -0
  142. package/dist/protocols/shared.d.ts +249 -0
  143. package/dist/protocols/shared.js +446 -0
  144. package/dist/protocols/system-one.d.ts +145 -0
  145. package/dist/protocols/system-one.js +272 -0
  146. package/dist/protocols/utils/bedrock-auth.d.ts +60 -0
  147. package/dist/protocols/utils/bedrock-auth.js +86 -0
  148. package/dist/protocols/utils/bedrock-cache.d.ts +19 -0
  149. package/dist/protocols/utils/bedrock-cache.js +49 -0
  150. package/dist/protocols/utils/bedrock-media.d.ts +53 -0
  151. package/dist/protocols/utils/bedrock-media.js +98 -0
  152. package/dist/protocols/utils/cache.d.ts +25 -0
  153. package/dist/protocols/utils/cache.js +33 -0
  154. package/dist/protocols/utils/claude-model.d.ts +8 -0
  155. package/dist/protocols/utils/claude-model.js +15 -0
  156. package/dist/protocols/utils/gateway-protocol.d.ts +17 -0
  157. package/dist/protocols/utils/gateway-protocol.js +59 -0
  158. package/dist/protocols/utils/gemini-generate-content.d.ts +75 -0
  159. package/dist/protocols/utils/gemini-generate-content.js +96 -0
  160. package/dist/protocols/utils/gemini-json-schema.d.ts +8 -0
  161. package/dist/protocols/utils/gemini-json-schema.js +76 -0
  162. package/dist/protocols/utils/image-sizing.d.ts +31 -0
  163. package/dist/protocols/utils/image-sizing.js +73 -0
  164. package/dist/protocols/utils/lifecycle.d.ts +24 -0
  165. package/dist/protocols/utils/lifecycle.js +62 -0
  166. package/dist/protocols/utils/media-input.d.ts +32 -0
  167. package/dist/protocols/utils/media-input.js +62 -0
  168. package/dist/protocols/utils/mistral-tool-id.d.ts +5 -0
  169. package/dist/protocols/utils/mistral-tool-id.js +31 -0
  170. package/dist/protocols/utils/open-responses-options.d.ts +54 -0
  171. package/dist/protocols/utils/open-responses-options.js +59 -0
  172. package/dist/protocols/utils/partial-json-options.d.ts +61 -0
  173. package/dist/protocols/utils/partial-json-options.js +51 -0
  174. package/dist/protocols/utils/partial-json.d.ts +8 -0
  175. package/dist/protocols/utils/partial-json.js +280 -0
  176. package/dist/protocols/utils/responses-checkpoint.d.ts +4 -0
  177. package/dist/protocols/utils/responses-checkpoint.js +103 -0
  178. package/dist/protocols/utils/responses-compaction.d.ts +6 -0
  179. package/dist/protocols/utils/responses-compaction.js +162 -0
  180. package/dist/protocols/utils/responses-hosted-tools.d.ts +122 -0
  181. package/dist/protocols/utils/responses-hosted-tools.js +63 -0
  182. package/dist/protocols/utils/speaker-turns.d.ts +3 -0
  183. package/dist/protocols/utils/speaker-turns.js +9 -0
  184. package/dist/protocols/utils/speech-stream.d.ts +49 -0
  185. package/dist/protocols/utils/speech-stream.js +64 -0
  186. package/dist/protocols/utils/tool-schema.d.ts +10 -0
  187. package/dist/protocols/utils/tool-schema.js +109 -0
  188. package/dist/protocols/utils/tool-stream.d.ts +478 -0
  189. package/dist/protocols/utils/tool-stream.js +153 -0
  190. package/dist/protocols/venice-chat.d.ts +340 -0
  191. package/dist/protocols/venice-chat.js +283 -0
  192. package/dist/protocols/xai-images.d.ts +25 -0
  193. package/dist/protocols/xai-images.js +87 -0
  194. package/dist/protocols/xai-responses.d.ts +294 -0
  195. package/dist/protocols/xai-responses.js +86 -0
  196. package/dist/protocols/xai-video.d.ts +35 -0
  197. package/dist/protocols/xai-video.js +159 -0
  198. package/dist/protocols/zai-chat.d.ts +296 -0
  199. package/dist/protocols/zai-chat.js +56 -0
  200. package/dist/protocols/zai-images.d.ts +20 -0
  201. package/dist/protocols/zai-images.js +79 -0
  202. package/dist/protocols/zai-messages.d.ts +409 -0
  203. package/dist/protocols/zai-messages.js +30 -0
  204. package/dist/protocols.d.ts +1 -0
  205. package/dist/protocols.js +1 -0
  206. package/dist/provider-error.d.ts +22 -0
  207. package/dist/provider-error.js +228 -0
  208. package/dist/provider-package.d.ts +17 -0
  209. package/dist/provider-package.js +1 -0
  210. package/dist/providers/alibaba/chat.d.ts +1 -0
  211. package/dist/providers/alibaba/chat.js +1 -0
  212. package/dist/providers/alibaba/embeddings.d.ts +2 -0
  213. package/dist/providers/alibaba/embeddings.js +1 -0
  214. package/dist/providers/alibaba/images.d.ts +2 -0
  215. package/dist/providers/alibaba/images.js +1 -0
  216. package/dist/providers/alibaba/messages.d.ts +3 -0
  217. package/dist/providers/alibaba/messages.js +1 -0
  218. package/dist/providers/alibaba/responses.d.ts +3 -0
  219. package/dist/providers/alibaba/responses.js +1 -0
  220. package/dist/providers/alibaba.d.ts +905 -0
  221. package/dist/providers/alibaba.js +119 -0
  222. package/dist/providers/amazon-bedrock/mantle/chat.d.ts +2 -0
  223. package/dist/providers/amazon-bedrock/mantle/chat.js +1 -0
  224. package/dist/providers/amazon-bedrock/mantle/messages.d.ts +2 -0
  225. package/dist/providers/amazon-bedrock/mantle/messages.js +1 -0
  226. package/dist/providers/amazon-bedrock/mantle/responses.d.ts +2 -0
  227. package/dist/providers/amazon-bedrock/mantle/responses.js +1 -0
  228. package/dist/providers/amazon-bedrock/mantle.d.ts +2 -0
  229. package/dist/providers/amazon-bedrock/mantle.js +1 -0
  230. package/dist/providers/amazon-bedrock-mantle.d.ts +789 -0
  231. package/dist/providers/amazon-bedrock-mantle.js +107 -0
  232. package/dist/providers/amazon-bedrock.d.ts +190 -0
  233. package/dist/providers/amazon-bedrock.js +44 -0
  234. package/dist/providers/anthropic-compatible.d.ts +364 -0
  235. package/dist/providers/anthropic-compatible.js +47 -0
  236. package/dist/providers/anthropic.d.ts +362 -0
  237. package/dist/providers/anthropic.js +36 -0
  238. package/dist/providers/assemblyai.d.ts +19 -0
  239. package/dist/providers/assemblyai.js +19 -0
  240. package/dist/providers/azure/chat.d.ts +2 -0
  241. package/dist/providers/azure/chat.js +1 -0
  242. package/dist/providers/azure/embeddings.d.ts +2 -0
  243. package/dist/providers/azure/embeddings.js +1 -0
  244. package/dist/providers/azure/images.d.ts +2 -0
  245. package/dist/providers/azure/images.js +1 -0
  246. package/dist/providers/azure/messages.d.ts +2 -0
  247. package/dist/providers/azure/messages.js +1 -0
  248. package/dist/providers/azure/responses.d.ts +2 -0
  249. package/dist/providers/azure/responses.js +1 -0
  250. package/dist/providers/azure.d.ts +1074 -0
  251. package/dist/providers/azure.js +150 -0
  252. package/dist/providers/baseten/decisions.d.ts +2 -0
  253. package/dist/providers/baseten/decisions.js +1 -0
  254. package/dist/providers/baseten.d.ts +384 -0
  255. package/dist/providers/baseten.js +56 -0
  256. package/dist/providers/byteplus/videos.d.ts +2 -0
  257. package/dist/providers/byteplus/videos.js +1 -0
  258. package/dist/providers/byteplus.d.ts +24 -0
  259. package/dist/providers/byteplus.js +21 -0
  260. package/dist/providers/cartesia.d.ts +18 -0
  261. package/dist/providers/cartesia.js +17 -0
  262. package/dist/providers/cerebras.d.ts +375 -0
  263. package/dist/providers/cerebras.js +33 -0
  264. package/dist/providers/cloudflare-ai-gateway/decisions.d.ts +2 -0
  265. package/dist/providers/cloudflare-ai-gateway/decisions.js +1 -0
  266. package/dist/providers/cloudflare-ai-gateway.d.ts +1581 -0
  267. package/dist/providers/cloudflare-ai-gateway.js +120 -0
  268. package/dist/providers/cloudflare-shared.d.ts +9 -0
  269. package/dist/providers/cloudflare-shared.js +25 -0
  270. package/dist/providers/cloudflare-workers-ai/decisions.d.ts +2 -0
  271. package/dist/providers/cloudflare-workers-ai/decisions.js +1 -0
  272. package/dist/providers/cloudflare-workers-ai/images.d.ts +2 -0
  273. package/dist/providers/cloudflare-workers-ai/images.js +1 -0
  274. package/dist/providers/cloudflare-workers-ai.d.ts +391 -0
  275. package/dist/providers/cloudflare-workers-ai.js +69 -0
  276. package/dist/providers/cohere/chat.d.ts +4 -0
  277. package/dist/providers/cohere/chat.js +3 -0
  278. package/dist/providers/cohere/embeddings.d.ts +2 -0
  279. package/dist/providers/cohere/embeddings.js +1 -0
  280. package/dist/providers/cohere.d.ts +502 -0
  281. package/dist/providers/cohere.js +55 -0
  282. package/dist/providers/deepgram.d.ts +22 -0
  283. package/dist/providers/deepgram.js +20 -0
  284. package/dist/providers/deepinfra/embeddings.d.ts +2 -0
  285. package/dist/providers/deepinfra/embeddings.js +1 -0
  286. package/dist/providers/deepinfra.d.ts +378 -0
  287. package/dist/providers/deepinfra.js +52 -0
  288. package/dist/providers/deepseek.d.ts +376 -0
  289. package/dist/providers/deepseek.js +30 -0
  290. package/dist/providers/digitalocean/decisions.d.ts +2 -0
  291. package/dist/providers/digitalocean/decisions.js +1 -0
  292. package/dist/providers/digitalocean/embeddings.d.ts +2 -0
  293. package/dist/providers/digitalocean/embeddings.js +1 -0
  294. package/dist/providers/digitalocean/images.d.ts +2 -0
  295. package/dist/providers/digitalocean/images.js +1 -0
  296. package/dist/providers/digitalocean/responses.d.ts +4 -0
  297. package/dist/providers/digitalocean/responses.js +1 -0
  298. package/dist/providers/digitalocean.d.ts +874 -0
  299. package/dist/providers/digitalocean.js +106 -0
  300. package/dist/providers/elevenlabs.d.ts +22 -0
  301. package/dist/providers/elevenlabs.js +22 -0
  302. package/dist/providers/fireworks/embeddings.d.ts +2 -0
  303. package/dist/providers/fireworks/embeddings.js +1 -0
  304. package/dist/providers/fireworks.d.ts +379 -0
  305. package/dist/providers/fireworks.js +40 -0
  306. package/dist/providers/google/decisions.d.ts +2 -0
  307. package/dist/providers/google/decisions.js +1 -0
  308. package/dist/providers/google/embeddings.d.ts +2 -0
  309. package/dist/providers/google/embeddings.js +1 -0
  310. package/dist/providers/google/images.d.ts +2 -0
  311. package/dist/providers/google/images.js +1 -0
  312. package/dist/providers/google/interactions.d.ts +7 -0
  313. package/dist/providers/google/interactions.js +3 -0
  314. package/dist/providers/google/videos.d.ts +2 -0
  315. package/dist/providers/google/videos.js +1 -0
  316. package/dist/providers/google-vertex/chat.d.ts +2 -0
  317. package/dist/providers/google-vertex/chat.js +1 -0
  318. package/dist/providers/google-vertex/embeddings.d.ts +2 -0
  319. package/dist/providers/google-vertex/embeddings.js +1 -0
  320. package/dist/providers/google-vertex/gemini.d.ts +2 -0
  321. package/dist/providers/google-vertex/gemini.js +1 -0
  322. package/dist/providers/google-vertex/images.d.ts +2 -0
  323. package/dist/providers/google-vertex/images.js +1 -0
  324. package/dist/providers/google-vertex/interactions.d.ts +2 -0
  325. package/dist/providers/google-vertex/interactions.js +1 -0
  326. package/dist/providers/google-vertex/messages.d.ts +2 -0
  327. package/dist/providers/google-vertex/messages.js +1 -0
  328. package/dist/providers/google-vertex/mistral.d.ts +2 -0
  329. package/dist/providers/google-vertex/mistral.js +1 -0
  330. package/dist/providers/google-vertex/responses.d.ts +2 -0
  331. package/dist/providers/google-vertex/responses.js +1 -0
  332. package/dist/providers/google-vertex-chat.d.ts +204 -0
  333. package/dist/providers/google-vertex-chat.js +29 -0
  334. package/dist/providers/google-vertex-interactions.d.ts +111 -0
  335. package/dist/providers/google-vertex-interactions.js +62 -0
  336. package/dist/providers/google-vertex-messages.d.ts +362 -0
  337. package/dist/providers/google-vertex-messages.js +51 -0
  338. package/dist/providers/google-vertex-mistral.d.ts +120 -0
  339. package/dist/providers/google-vertex-mistral.js +43 -0
  340. package/dist/providers/google-vertex-responses.d.ts +253 -0
  341. package/dist/providers/google-vertex-responses.js +30 -0
  342. package/dist/providers/google-vertex-shared.d.ts +58 -0
  343. package/dist/providers/google-vertex-shared.js +128 -0
  344. package/dist/providers/google-vertex.d.ts +132 -0
  345. package/dist/providers/google-vertex.js +161 -0
  346. package/dist/providers/google.d.ts +246 -0
  347. package/dist/providers/google.js +80 -0
  348. package/dist/providers/groq.d.ts +470 -0
  349. package/dist/providers/groq.js +63 -0
  350. package/dist/providers/index.d.ts +45 -0
  351. package/dist/providers/index.js +45 -0
  352. package/dist/providers/meta/chat.d.ts +2 -0
  353. package/dist/providers/meta/chat.js +1 -0
  354. package/dist/providers/meta/images.d.ts +2 -0
  355. package/dist/providers/meta/images.js +1 -0
  356. package/dist/providers/meta/messages.d.ts +2 -0
  357. package/dist/providers/meta/messages.js +1 -0
  358. package/dist/providers/meta/responses.d.ts +2 -0
  359. package/dist/providers/meta/responses.js +1 -0
  360. package/dist/providers/meta.d.ts +804 -0
  361. package/dist/providers/meta.js +96 -0
  362. package/dist/providers/minimax/chat.d.ts +4 -0
  363. package/dist/providers/minimax/chat.js +3 -0
  364. package/dist/providers/minimax/images.d.ts +3 -0
  365. package/dist/providers/minimax/images.js +1 -0
  366. package/dist/providers/minimax/messages.d.ts +1 -0
  367. package/dist/providers/minimax/messages.js +1 -0
  368. package/dist/providers/minimax/responses.d.ts +4 -0
  369. package/dist/providers/minimax/responses.js +3 -0
  370. package/dist/providers/minimax/videos.d.ts +3 -0
  371. package/dist/providers/minimax/videos.js +1 -0
  372. package/dist/providers/minimax.d.ts +798 -0
  373. package/dist/providers/minimax.js +99 -0
  374. package/dist/providers/mistral.d.ts +208 -0
  375. package/dist/providers/mistral.js +17 -0
  376. package/dist/providers/moonshot/chat.d.ts +1 -0
  377. package/dist/providers/moonshot/chat.js +1 -0
  378. package/dist/providers/moonshot/messages.d.ts +4 -0
  379. package/dist/providers/moonshot/messages.js +3 -0
  380. package/dist/providers/moonshot/responses.d.ts +4 -0
  381. package/dist/providers/moonshot/responses.js +3 -0
  382. package/dist/providers/moonshot.d.ts +785 -0
  383. package/dist/providers/moonshot.js +78 -0
  384. package/dist/providers/open-responses-options.d.ts +5 -0
  385. package/dist/providers/open-responses-options.js +1 -0
  386. package/dist/providers/openai/chat.d.ts +2 -0
  387. package/dist/providers/openai/chat.js +1 -0
  388. package/dist/providers/openai/embeddings.d.ts +2 -0
  389. package/dist/providers/openai/embeddings.js +1 -0
  390. package/dist/providers/openai/images.d.ts +2 -0
  391. package/dist/providers/openai/images.js +1 -0
  392. package/dist/providers/openai/responses.d.ts +2 -0
  393. package/dist/providers/openai/responses.js +1 -0
  394. package/dist/providers/openai-compatible/decisions.d.ts +2 -0
  395. package/dist/providers/openai-compatible/decisions.js +1 -0
  396. package/dist/providers/openai-compatible/embeddings.d.ts +2 -0
  397. package/dist/providers/openai-compatible/embeddings.js +1 -0
  398. package/dist/providers/openai-compatible/images.d.ts +2 -0
  399. package/dist/providers/openai-compatible/images.js +1 -0
  400. package/dist/providers/openai-compatible/responses.d.ts +1 -0
  401. package/dist/providers/openai-compatible/responses.js +1 -0
  402. package/dist/providers/openai-compatible-responses.d.ts +250 -0
  403. package/dist/providers/openai-compatible-responses.js +26 -0
  404. package/dist/providers/openai-compatible.d.ts +208 -0
  405. package/dist/providers/openai-compatible.js +71 -0
  406. package/dist/providers/openai-options.d.ts +21 -0
  407. package/dist/providers/openai-options.js +37 -0
  408. package/dist/providers/openai.d.ts +522 -0
  409. package/dist/providers/openai.js +118 -0
  410. package/dist/providers/opencode/decisions.d.ts +2 -0
  411. package/dist/providers/opencode/decisions.js +1 -0
  412. package/dist/providers/opencode.d.ts +23 -0
  413. package/dist/providers/opencode.js +25 -0
  414. package/dist/providers/openrouter/decisions.d.ts +2 -0
  415. package/dist/providers/openrouter/decisions.js +1 -0
  416. package/dist/providers/openrouter/embeddings.d.ts +2 -0
  417. package/dist/providers/openrouter/embeddings.js +1 -0
  418. package/dist/providers/openrouter/images.d.ts +2 -0
  419. package/dist/providers/openrouter/images.js +1 -0
  420. package/dist/providers/openrouter/responses.d.ts +3 -0
  421. package/dist/providers/openrouter/responses.js +1 -0
  422. package/dist/providers/openrouter/videos.d.ts +2 -0
  423. package/dist/providers/openrouter/videos.js +1 -0
  424. package/dist/providers/openrouter.d.ts +1204 -0
  425. package/dist/providers/openrouter.js +210 -0
  426. package/dist/providers/settings.d.ts +40 -0
  427. package/dist/providers/settings.js +18 -0
  428. package/dist/providers/togetherai.d.ts +375 -0
  429. package/dist/providers/togetherai.js +30 -0
  430. package/dist/providers/typesafe-ai/decisions.d.ts +2 -0
  431. package/dist/providers/typesafe-ai/decisions.js +1 -0
  432. package/dist/providers/typesafe-ai.d.ts +23 -0
  433. package/dist/providers/typesafe-ai.js +25 -0
  434. package/dist/providers/venice/responses.d.ts +4 -0
  435. package/dist/providers/venice/responses.js +1 -0
  436. package/dist/providers/venice.d.ts +632 -0
  437. package/dist/providers/venice.js +57 -0
  438. package/dist/providers/vercel-ai-gateway/chat.d.ts +2 -0
  439. package/dist/providers/vercel-ai-gateway/chat.js +1 -0
  440. package/dist/providers/vercel-ai-gateway/decisions.d.ts +2 -0
  441. package/dist/providers/vercel-ai-gateway/decisions.js +1 -0
  442. package/dist/providers/vercel-ai-gateway/embeddings.d.ts +2 -0
  443. package/dist/providers/vercel-ai-gateway/embeddings.js +1 -0
  444. package/dist/providers/vercel-ai-gateway/images.d.ts +2 -0
  445. package/dist/providers/vercel-ai-gateway/images.js +1 -0
  446. package/dist/providers/vercel-ai-gateway/messages.d.ts +2 -0
  447. package/dist/providers/vercel-ai-gateway/messages.js +1 -0
  448. package/dist/providers/vercel-ai-gateway/responses.d.ts +2 -0
  449. package/dist/providers/vercel-ai-gateway/responses.js +1 -0
  450. package/dist/providers/vercel-ai-gateway.d.ts +111 -0
  451. package/dist/providers/vercel-ai-gateway.js +181 -0
  452. package/dist/providers/volcengine/videos.d.ts +2 -0
  453. package/dist/providers/volcengine/videos.js +1 -0
  454. package/dist/providers/volcengine.d.ts +24 -0
  455. package/dist/providers/volcengine.js +21 -0
  456. package/dist/providers/xai/images.d.ts +2 -0
  457. package/dist/providers/xai/images.js +1 -0
  458. package/dist/providers/xai/videos.d.ts +2 -0
  459. package/dist/providers/xai/videos.js +1 -0
  460. package/dist/providers/xai.d.ts +235 -0
  461. package/dist/providers/xai.js +89 -0
  462. package/dist/providers/zai/chat.d.ts +1 -0
  463. package/dist/providers/zai/chat.js +1 -0
  464. package/dist/providers/zai/images.d.ts +2 -0
  465. package/dist/providers/zai/images.js +1 -0
  466. package/dist/providers/zai-coding-plan/chat.d.ts +1 -0
  467. package/dist/providers/zai-coding-plan/chat.js +1 -0
  468. package/dist/providers/zai-coding-plan/messages.d.ts +4 -0
  469. package/dist/providers/zai-coding-plan/messages.js +3 -0
  470. package/dist/providers/zai-coding-plan/responses.d.ts +4 -0
  471. package/dist/providers/zai-coding-plan/responses.js +3 -0
  472. package/dist/providers/zai-coding-plan.d.ts +846 -0
  473. package/dist/providers/zai-coding-plan.js +56 -0
  474. package/dist/providers/zai.d.ts +285 -0
  475. package/dist/providers/zai.js +44 -0
  476. package/dist/providers.d.ts +1 -0
  477. package/dist/providers.js +1 -0
  478. package/dist/public.d.ts +18 -0
  479. package/dist/public.js +7 -0
  480. package/dist/route/auth-options.d.ts +35 -0
  481. package/dist/route/auth-options.js +17 -0
  482. package/dist/route/auth.d.ts +52 -0
  483. package/dist/route/auth.js +92 -0
  484. package/dist/route/client.d.ts +229 -0
  485. package/dist/route/client.js +293 -0
  486. package/dist/route/decision.d.ts +55 -0
  487. package/dist/route/decision.js +73 -0
  488. package/dist/route/embedding.d.ts +58 -0
  489. package/dist/route/embedding.js +85 -0
  490. package/dist/route/endpoint.d.ts +29 -0
  491. package/dist/route/endpoint.js +21 -0
  492. package/dist/route/executor-service.d.ts +54 -0
  493. package/dist/route/executor-service.js +115 -0
  494. package/dist/route/executor.d.ts +37 -0
  495. package/dist/route/executor.js +225 -0
  496. package/dist/route/framing.d.ts +44 -0
  497. package/dist/route/framing.js +63 -0
  498. package/dist/route/index.d.ts +21 -0
  499. package/dist/route/index.js +18 -0
  500. package/dist/route/media-protocol.d.ts +187 -0
  501. package/dist/route/media-protocol.js +117 -0
  502. package/dist/route/media.d.ts +91 -0
  503. package/dist/route/media.js +251 -0
  504. package/dist/route/protocol.d.ts +85 -0
  505. package/dist/route/protocol.js +19 -0
  506. package/dist/route/transport/http.d.ts +34 -0
  507. package/dist/route/transport/http.js +67 -0
  508. package/dist/route/transport/index.d.ts +42 -0
  509. package/dist/route/transport/index.js +4 -0
  510. package/dist/route/transport/websocket-channel.d.ts +56 -0
  511. package/dist/route/transport/websocket-channel.js +1 -0
  512. package/dist/route/transport/websocket.d.ts +32 -0
  513. package/dist/route/transport/websocket.js +315 -0
  514. package/dist/route.d.ts +1 -0
  515. package/dist/route.js +1 -0
  516. package/dist/schema/errors.d.ts +194 -0
  517. package/dist/schema/errors.js +217 -0
  518. package/dist/schema/events.d.ts +11001 -0
  519. package/dist/schema/events.js +542 -0
  520. package/dist/schema/ids.d.ts +17 -0
  521. package/dist/schema/ids.js +10 -0
  522. package/dist/schema/index.d.ts +5 -0
  523. package/dist/schema/index.js +5 -0
  524. package/dist/schema/messages.d.ts +2706 -0
  525. package/dist/schema/messages.js +344 -0
  526. package/dist/schema/options.d.ts +270 -0
  527. package/dist/schema/options.js +198 -0
  528. package/dist/speech.d.ts +266 -0
  529. package/dist/speech.js +114 -0
  530. package/dist/test-ai.d.ts +15 -0
  531. package/dist/test-ai.js +49 -0
  532. package/dist/testing.d.ts +1585 -0
  533. package/dist/testing.js +108 -0
  534. package/dist/tool-history.d.ts +2 -0
  535. package/dist/tool-history.js +91 -0
  536. package/dist/tool-runtime.d.ts +22 -0
  537. package/dist/tool-runtime.js +55 -0
  538. package/dist/tool-updates.d.ts +34 -0
  539. package/dist/tool-updates.js +93 -0
  540. package/dist/tool.d.ts +150 -0
  541. package/dist/tool.js +159 -0
  542. package/dist/transcription.d.ts +254 -0
  543. package/dist/transcription.js +119 -0
  544. package/dist/utils/bytes.d.ts +1 -0
  545. package/dist/utils/bytes.js +10 -0
  546. package/dist/utils/json.d.ts +4 -0
  547. package/dist/utils/json.js +4 -0
  548. package/dist/utils/media-type.d.ts +8 -0
  549. package/dist/utils/media-type.js +93 -0
  550. package/dist/utils/provider-codes.d.ts +3 -0
  551. package/dist/utils/provider-codes.js +41 -0
  552. package/dist/utils/record.d.ts +2 -0
  553. package/dist/utils/record.js +2 -0
  554. package/dist/utils/sanitize.d.ts +5 -0
  555. package/dist/utils/sanitize.js +31 -0
  556. package/dist/video-client.d.ts +12 -0
  557. package/dist/video-client.js +24 -0
  558. package/dist/video.d.ts +178 -0
  559. package/dist/video.js +79 -0
  560. package/package.json +648 -4
@@ -0,0 +1,300 @@
1
+ import { Effect, Layer, Schema } from "effect";
2
+ import { AI } from "./ai.js";
3
+ import { type DecisionModel, type DecisionQuestions, type DecisionRequestInput } from "./decision.js";
4
+ import { type EmbeddingModel, type EmbeddingRequestInput } from "./embedding.js";
5
+ import { type FetchMiddleware } from "./fetch-middleware.js";
6
+ import type { AwaitOptions, Event, Snapshot } from "./generation.js";
7
+ import { type ImageModel, type ImageRequest, type ImageRequestInput } from "./image.js";
8
+ import { LLM } from "./llm.js";
9
+ import { Media } from "./promise-media.js";
10
+ import { type CheckpointRequest, type CompactionRequest, type EndpointCompactOptions, type StreamOptions, type TriggerCompactOptions } from "./route/client.js";
11
+ import { RequestExecutor } from "./route/executor.js";
12
+ import { LanguageModel, type TextResponse, type CompactionCheckpointResponse, type CompactionResponse, type StreamEvent, type ToolChoice } from "./schema/index.js";
13
+ import type { LoopObjectEvent, ObjectEvent, ObjectResponse, OutputSchema, OutputType, LLMLoopInput, LLMRequestInput, RequestTools } from "./llm.js";
14
+ import { type SpeechModel, type SpeechRequest, type SpeechRequestInput } from "./speech.js";
15
+ import { type TranscriptionModel, type TranscriptionRequest, type TranscriptionRequestInput } from "./transcription.js";
16
+ import type { ExecutableTool, NoExecute, ToolExecuteContext, ToolInput, ToolInputType, ToolOptions, ToolOutputSchema, ToolOutputValue } from "./tool.js";
17
+ import { type VideoModel, type VideoRequest, type VideoRequestInput } from "./video.js";
18
+ /**
19
+ * Promise-first entrypoint for scripts and non-Effect callers. One `ManagedRuntime` hosts the LLM, image, video, speech,
20
+ * transcription, decision and embedding clients over a request executor; every method runs the corresponding Effect API
21
+ * and rethrows `AIError` unchanged. `file` and `write` load `node:fs/promises` on first use, so importing this module does not.
22
+ */
23
+ export interface Options {
24
+ /** Executor layer; defaults to `RequestExecutor.fetchLayer`. Inject a recorder or `RequestExecutor.middleware(fn)` here. */
25
+ readonly layer?: Layer.Layer<RequestExecutor.Service>;
26
+ }
27
+ export interface RunOptions {
28
+ readonly signal?: AbortSignal;
29
+ /**
30
+ * Runs on every provider request the call makes, like `RequestExecutor.withMiddleware`: submits, polls, results and
31
+ * cancels included. A handle the call returns keeps it for its own calls.
32
+ */
33
+ readonly middleware?: FetchMiddleware;
34
+ }
35
+ /** Options for reading or writing an asset. Downloads use the asset's own `middleware`, never a caller's. */
36
+ export type AssetRunOptions = Omit<RunOptions, "middleware">;
37
+ /** Options of an Effect API call, with its Effect-typed `http` middleware replaced by `RunOptions.middleware`. */
38
+ type PromiseOptions<Options> = Options extends unknown ? Omit<Options, "http"> & RunOptions : never;
39
+ export type Services = AI.Services;
40
+ /**
41
+ * Promise view of a `Generation`. Its fields are a snapshot taken when the handle was created; `refresh()` resolves to a
42
+ * new handle rather than updating this one.
43
+ */
44
+ export type GenerationHandle<Response> = Snapshot & {
45
+ readonly snapshot: Snapshot;
46
+ readonly terminal: boolean;
47
+ /** Serializable JSON; pass it back to `resume` from another process. */
48
+ readonly token: unknown;
49
+ readonly await: (options?: AwaitOptions & RunOptions) => Promise<Response>;
50
+ /** Status observations until the first terminal one, polling like `await`; abort throws `signal.reason`. */
51
+ readonly events: (options?: AwaitOptions & RunOptions) => AsyncIterable<Event>;
52
+ /** The result without polling; fails when the generation has not completed. */
53
+ readonly result: (options?: RunOptions) => Promise<Response>;
54
+ readonly refresh: (options?: RunOptions) => Promise<GenerationHandle<Response>>;
55
+ readonly cancel: (options?: RunOptions) => Promise<void>;
56
+ };
57
+ export declare const make: (options?: Options) => {
58
+ run: <A, E>(effect: Effect.Effect<A, E, Services>, options?: RunOptions) => Promise<A>;
59
+ /** Decoded asset bytes, downloading `url` sources through the executor. */
60
+ bytes: (asset: Media.Asset, options?: AssetRunOptions) => Promise<Uint8Array<ArrayBufferLike>>;
61
+ base64: (asset: Media.Asset, options?: AssetRunOptions) => Promise<string>;
62
+ /** Pull a `url` asset into owned bytes before the provider URL expires. */
63
+ materialize: (asset: Media.Asset, options?: AssetRunOptions) => Promise<Media.Asset>;
64
+ /** Read a file into an asset like `Media.file`: sniffed media type, then the extension's. */
65
+ file: (path: string, options?: Media.AssetOptions & AssetRunOptions) => Promise<Media.Asset>;
66
+ /** Write an asset's bytes like `Media.write`: streamed through a temporary file that replaces `path` on success. */
67
+ write: (asset: Media.Asset, path: string, options?: AssetRunOptions) => Promise<void>;
68
+ request: typeof LLM.request;
69
+ generate: {
70
+ <const Model extends LanguageModel, S extends OutputSchema, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice> & {
71
+ readonly schema: S;
72
+ }, options?: PromiseOptions<StreamOptions>): Promise<ObjectResponse<OutputType<S>>>;
73
+ <const Model extends LanguageModel, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice>, options?: PromiseOptions<StreamOptions>): Promise<TextResponse>;
74
+ };
75
+ /** Run one model call and return the text of its answer. */
76
+ text: <const Model extends LanguageModel, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice>, options?: PromiseOptions<StreamOptions>) => Promise<string>;
77
+ /** Run one model call that must answer with `schema`, and return the decoded value. */
78
+ object: <const Model extends LanguageModel, S extends OutputSchema, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice> & {
79
+ readonly schema: S;
80
+ }, options?: PromiseOptions<StreamOptions>) => Promise<OutputType<S>>;
81
+ stream: {
82
+ <const Model extends LanguageModel, S extends OutputSchema, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice> & {
83
+ readonly schema: S;
84
+ }, options?: PromiseOptions<StreamOptions>): AsyncIterable<ObjectEvent<OutputType<S>>>;
85
+ <const Model extends LanguageModel, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice>, options?: PromiseOptions<StreamOptions>): AsyncIterable<StreamEvent>;
86
+ };
87
+ /** Stream model calls, running their tool calls, until the model stops calling tools or `until` is true. */
88
+ loop: {
89
+ <const Model extends LanguageModel, S extends OutputSchema, Tools extends ReadonlyArray<ExecutableTool> = readonly ExecutableTool[], const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMLoopInput<Model, Tools, Choice> & {
90
+ readonly schema: S;
91
+ }, options?: PromiseOptions<StreamOptions>): AsyncIterable<LoopObjectEvent<OutputType<S>>>;
92
+ <const Model extends LanguageModel, Tools extends ReadonlyArray<ExecutableTool> = readonly ExecutableTool[], const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMLoopInput<Model, Tools, Choice>, options?: PromiseOptions<StreamOptions>): AsyncIterable<StreamEvent>;
93
+ };
94
+ collect: <Event extends StreamEvent>(events: AsyncIterable<Event>, options?: RunOptions) => Promise<LLM.CollectResult<Event>>;
95
+ /** Compact a Responses request: a replacement window, or a checkpoint with `mechanism: "trigger"`. */
96
+ compact: {
97
+ (request: CheckpointRequest, options: PromiseOptions<TriggerCompactOptions>): Promise<CompactionCheckpointResponse>;
98
+ (request: CompactionRequest, options?: PromiseOptions<EndpointCompactOptions>): Promise<CompactionResponse>;
99
+ };
100
+ canCompact: typeof LLM.canCompact;
101
+ image: {
102
+ request: typeof import("./image.js").request;
103
+ generate: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: AwaitOptions & RunOptions) => Promise<import("./image.js").ImageResponse>;
104
+ stream: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
105
+ readonly type: "image-partial";
106
+ readonly index: number;
107
+ readonly image: Media.Asset;
108
+ } | {
109
+ readonly type: "image";
110
+ readonly index: number;
111
+ readonly image: Media.Asset;
112
+ } | {
113
+ readonly type: "generation-progress";
114
+ readonly id: string;
115
+ readonly progress?: number | undefined;
116
+ } | {
117
+ readonly type: "finish";
118
+ readonly usage?: {
119
+ readonly type: "seconds";
120
+ readonly seconds: number;
121
+ } | {
122
+ readonly type: "characters";
123
+ readonly characters: number;
124
+ } | {
125
+ readonly type: "credits";
126
+ readonly credits: number;
127
+ } | {
128
+ readonly type: "compute";
129
+ readonly seconds: number;
130
+ } | {
131
+ readonly type: "tokens";
132
+ readonly input?: number | undefined;
133
+ readonly output?: number | undefined;
134
+ readonly total?: number | undefined;
135
+ readonly details?: {
136
+ readonly [x: string]: unknown;
137
+ } | undefined;
138
+ } | undefined;
139
+ readonly providerMetadata?: {
140
+ readonly [x: string]: {
141
+ readonly [x: string]: unknown;
142
+ };
143
+ } | undefined;
144
+ }>;
145
+ /** Submit a generation on a queued route and return its `{ id }` at once; nothing polls. */
146
+ start: <const Model extends ImageModel>(input: ImageRequestInput<Model> | ImageRequest, options?: RunOptions) => Promise<import("./image.js").ImageJob>;
147
+ /** One status read for a job ID. */
148
+ status: (model: ImageModel, id: string, options?: RunOptions) => Promise<import("./image.js").ImageStatus>;
149
+ /** The finished images; fails while the job is still running. */
150
+ result: (model: ImageModel, id: string, options?: RunOptions) => Promise<import("./image.js").ImageResponse>;
151
+ cancel: (model: ImageModel, id: string, options?: RunOptions) => Promise<void>;
152
+ };
153
+ decision: {
154
+ request: typeof import("./decision.js").request;
155
+ generate: <const Model extends DecisionModel, const Questions extends DecisionQuestions>(input: DecisionRequestInput<Model, Questions>, options?: RunOptions) => Promise<import("./decision.js").DecisionResponseFor<Questions>>;
156
+ };
157
+ embedding: {
158
+ request: typeof import("./embedding.js").request;
159
+ generate: <const Model extends EmbeddingModel>(input: EmbeddingRequestInput<Model>, options?: RunOptions) => Promise<import("./embedding.js").EmbeddingResponse>;
160
+ };
161
+ video: {
162
+ request: typeof import("./video.js").request;
163
+ /** Submit a generation and return its `{ id }` at once; nothing polls. */
164
+ start: <const Model extends VideoModel>(input: VideoRequestInput<Model> | VideoRequest, options?: RunOptions) => Promise<import("./video.js").VideoJob>;
165
+ /** One status read for a job ID. */
166
+ status: (model: VideoModel, id: string, options?: RunOptions) => Promise<import("./video.js").VideoStatus>;
167
+ /** The finished videos; fails while the job is still running. */
168
+ result: (model: VideoModel, id: string, options?: RunOptions) => Promise<import("./video.js").VideoResponse>;
169
+ cancel: (model: VideoModel, id: string, options?: RunOptions) => Promise<void>;
170
+ };
171
+ /** Experimental: may change without compatibility guarantees. */
172
+ experimental: {
173
+ speech: {
174
+ request: typeof import("./speech.js").request;
175
+ generate: <const Model extends SpeechModel>(input: SpeechRequestInput<Model> | SpeechRequest, options?: RunOptions) => Promise<import("./speech.js").SpeechResponse>;
176
+ stream: <const Model extends SpeechModel>(input: SpeechRequestInput<Model> | SpeechRequest, options?: RunOptions) => AsyncIterable<{
177
+ readonly type: "audio-delta";
178
+ readonly chunk: Uint8Array<ArrayBufferLike>;
179
+ } | {
180
+ readonly type: "timestamps";
181
+ readonly items: readonly {
182
+ readonly text: string;
183
+ readonly startSeconds: number;
184
+ readonly endSeconds: number;
185
+ }[];
186
+ } | {
187
+ readonly type: "generation-progress";
188
+ readonly id: string;
189
+ readonly progress?: number | undefined;
190
+ } | {
191
+ readonly type: "finish";
192
+ readonly audio: Media.Asset;
193
+ readonly usage?: {
194
+ readonly type: "seconds";
195
+ readonly seconds: number;
196
+ } | {
197
+ readonly type: "characters";
198
+ readonly characters: number;
199
+ } | {
200
+ readonly type: "credits";
201
+ readonly credits: number;
202
+ } | {
203
+ readonly type: "compute";
204
+ readonly seconds: number;
205
+ } | {
206
+ readonly type: "tokens";
207
+ readonly input?: number | undefined;
208
+ readonly output?: number | undefined;
209
+ readonly total?: number | undefined;
210
+ readonly details?: {
211
+ readonly [x: string]: unknown;
212
+ } | undefined;
213
+ } | undefined;
214
+ readonly providerMetadata?: {
215
+ readonly [x: string]: {
216
+ readonly [x: string]: unknown;
217
+ };
218
+ } | undefined;
219
+ }>;
220
+ };
221
+ transcription: {
222
+ request: typeof import("./transcription.js").request;
223
+ generate: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: AwaitOptions & RunOptions) => Promise<import("./transcription.js").TranscriptionResponse>;
224
+ stream: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: AwaitOptions & RunOptions) => AsyncIterable<{
225
+ readonly type: "text-delta";
226
+ readonly delta: string;
227
+ } | {
228
+ readonly type: "segment";
229
+ readonly segment: {
230
+ readonly text: string;
231
+ readonly startSeconds: number;
232
+ readonly endSeconds: number;
233
+ readonly speaker?: string | undefined;
234
+ };
235
+ } | {
236
+ readonly type: "generation-progress";
237
+ readonly id: string;
238
+ readonly progress?: number | undefined;
239
+ } | {
240
+ readonly text: string;
241
+ readonly segments?: readonly {
242
+ readonly text: string;
243
+ readonly startSeconds: number;
244
+ readonly endSeconds: number;
245
+ readonly speaker?: string | undefined;
246
+ }[] | undefined;
247
+ readonly words?: readonly {
248
+ readonly text: string;
249
+ readonly startSeconds: number;
250
+ readonly endSeconds: number;
251
+ readonly speaker?: string | undefined;
252
+ readonly confidence?: number | undefined;
253
+ }[] | undefined;
254
+ readonly language?: string | undefined;
255
+ readonly durationSeconds?: number | undefined;
256
+ readonly usage?: {
257
+ readonly type: "seconds";
258
+ readonly seconds: number;
259
+ } | {
260
+ readonly type: "characters";
261
+ readonly characters: number;
262
+ } | {
263
+ readonly type: "credits";
264
+ readonly credits: number;
265
+ } | {
266
+ readonly type: "compute";
267
+ readonly seconds: number;
268
+ } | {
269
+ readonly type: "tokens";
270
+ readonly input?: number | undefined;
271
+ readonly output?: number | undefined;
272
+ readonly total?: number | undefined;
273
+ readonly details?: {
274
+ readonly [x: string]: unknown;
275
+ } | undefined;
276
+ } | undefined;
277
+ readonly providerMetadata?: {
278
+ readonly [x: string]: {
279
+ readonly [x: string]: unknown;
280
+ };
281
+ } | undefined;
282
+ readonly type: "finish";
283
+ }>;
284
+ start: <const Model extends TranscriptionModel>(input: TranscriptionRequestInput<Model> | TranscriptionRequest, options?: RunOptions) => Promise<GenerationHandle<import("./transcription.js").TranscriptionResponse>>;
285
+ resume: (model: TranscriptionModel, token: unknown, options?: RunOptions) => Promise<GenerationHandle<import("./transcription.js").TranscriptionResponse>>;
286
+ };
287
+ };
288
+ dispose: () => Promise<void>;
289
+ };
290
+ export type Client = ReturnType<typeof make>;
291
+ /** `tool` from `@radheim/ai/effect`, with an `execute` that returns a value or a Promise and throws to fail. */
292
+ export declare const tool: <Input extends ToolInput = typeof Schema.Unknown, Success extends ToolOutputSchema = typeof Schema.Unknown, Result extends ToolOutputValue<Success> | PromiseLike<ToolOutputValue<Success>> | NoExecute = NoExecute, const Name extends string = string>(config: ToolOptions<Input, Success, (input: ToolInputType<Input>, context: Partial<ToolExecuteContext> & {
293
+ signal: AbortSignal;
294
+ }) => Result, Name>) => 0 extends 1 & Result ? ExecutableTool<Input, Success, Name> : [Result, NoExecute] extends [NoExecute, Result] ? import("./tool.js").Tool<Input, Success, Name> : ExecutableTool<Input, Success, Name>;
295
+ /** Default client over `RequestExecutor.fetchLayer`; the runtime builds its layer on first use and holds nothing to dispose. */
296
+ export declare const ai: Omit<Client, "dispose">;
297
+ export type { FetchMiddleware } from "./fetch-middleware.js";
298
+ export { Media };
299
+ export * as AI from "./index.js";
300
+ export * from "./public.js";
package/dist/index.js ADDED
@@ -0,0 +1,179 @@
1
+ import { Effect, Layer, ManagedRuntime, Schema, Stream } from "effect";
2
+ import { AI } from "./ai.js";
3
+ import { Decision } from "./decision.js";
4
+ import { Embedding } from "./embedding.js";
5
+ import { fromFetch } from "./fetch-middleware.js";
6
+ import { Image } from "./image.js";
7
+ import { LLM } from "./llm.js";
8
+ import { Media } from "./promise-media.js";
9
+ import {} from "./route/client.js";
10
+ import { RequestExecutor } from "./route/executor.js";
11
+ import { AIError, InvalidRequestError, LanguageModel, } from "./schema/index.js";
12
+ import { Speech } from "./speech.js";
13
+ import { Transcription, } from "./transcription.js";
14
+ import { ToolFailure, build } from "./tool.js";
15
+ import { fileMediaType } from "./utils/media-type.js";
16
+ import { Video } from "./video.js";
17
+ // Fails with `signal.reason` so aborted calls reject and aborted streams throw like `fetch`: an `AbortError` by default.
18
+ const abortEffect = (signal) => signal === undefined
19
+ ? Effect.never
20
+ : Effect.callback((resume) => {
21
+ if (signal.aborted) {
22
+ resume(Effect.fail(signal.reason));
23
+ return;
24
+ }
25
+ const onAbort = () => resume(Effect.fail(signal.reason));
26
+ signal.addEventListener("abort", onAbort, { once: true });
27
+ return Effect.sync(() => signal.removeEventListener("abort", onAbort));
28
+ });
29
+ export const make = (options = {}) => {
30
+ const runtime = ManagedRuntime.make(AI.layerWith(options.layer ?? RequestExecutor.fetchLayer));
31
+ /** Run any package Effect (for example `ai.compact(...)` from `@radheim/ai/effect`) inside this runtime. */
32
+ const run = (effect, options) => runtime.runPromise(Effect.raceFirst(scoped(effect, options?.middleware), abortEffect(options?.signal)));
33
+ const iterate = (stream, options) => Stream.toAsyncIterable(Stream.unwrap(runtime.contextEffect.pipe(Effect.map((context) => scoped(stream, options?.middleware).pipe(Stream.interruptWhen(abortEffect(options?.signal)), Stream.provideContext(context))))));
34
+ // `run` and `iterate` apply `middleware` around the whole call, so the LLM call gets none of its own.
35
+ function generate(input, options) {
36
+ return run(LLM.generate(input, { ...options, http: undefined }), options);
37
+ }
38
+ function stream(input, options) {
39
+ return iterate(LLM.stream(input, { ...options, http: undefined }), options);
40
+ }
41
+ function loop(input, options) {
42
+ return iterate(LLM.loop(input, { ...options, http: undefined }), options);
43
+ }
44
+ /** Read `events` from `stream` or `loop` to the end and fold them into the final result. */
45
+ const collect = (events, options) => run(LLM.collect(Stream.fromAsyncIterable(events, (error) => error)), options);
46
+ // The overloads pair each request type with its mechanism; `LLM.compact` checks the route's capability at runtime.
47
+ function compact(request, options) {
48
+ return options?.mechanism === "trigger"
49
+ ? run(LLM.compact(request, { ...options, http: undefined }), options)
50
+ : run(LLM.compact(request, { ...options, http: undefined }), options);
51
+ }
52
+ const handle = (middleware) => (generation) => ({
53
+ ...generation.snapshot,
54
+ snapshot: generation.snapshot,
55
+ terminal: generation.terminal,
56
+ token: generation.token,
57
+ await: (options) => run(generation.await(options), { middleware, ...options }),
58
+ events: (options) => iterate(generation.events(options), { middleware, ...options }),
59
+ result: (options) => run(generation.result(), { middleware, ...options }),
60
+ refresh: (options) => run(generation.refresh(), { middleware, ...options }).then(handle(options?.middleware ?? middleware)),
61
+ cancel: (options) => run(generation.cancel(), { middleware, ...options }),
62
+ });
63
+ return {
64
+ run,
65
+ /** Decoded asset bytes, downloading `url` sources through the executor. */
66
+ bytes: (asset, options) => run(asset.bytes(), options),
67
+ base64: (asset, options) => run(asset.base64(), options),
68
+ /** Pull a `url` asset into owned bytes before the provider URL expires. */
69
+ materialize: (asset, options) => run(asset.materialize(), options),
70
+ /** Read a file into an asset like `Media.file`: sniffed media type, then the extension's. */
71
+ file: async (path, options) => {
72
+ const { readFile } = await import("node:fs/promises");
73
+ return run(Effect.tryPromise({
74
+ try: (signal) => readFile(path, { signal }),
75
+ catch: (cause) => fileError(`Failed to read media file ${path}`, cause),
76
+ }).pipe(Effect.map((buffer) => {
77
+ const data = new Uint8Array(buffer);
78
+ return Media.bytes(data, fileMediaType(data, path), options);
79
+ })), { signal: options?.signal });
80
+ },
81
+ /** Write an asset's bytes like `Media.write`: streamed through a temporary file that replaces `path` on success. */
82
+ write: async (asset, path, options) => {
83
+ const { open, rename, rm } = await import("node:fs/promises");
84
+ const temporary = `${path}.${crypto.randomUUID()}.tmp`;
85
+ try {
86
+ const file = await open(temporary, "w");
87
+ try {
88
+ for await (const chunk of iterate(asset.stream(), options))
89
+ await file.write(chunk);
90
+ }
91
+ finally {
92
+ await file.close();
93
+ }
94
+ await rename(temporary, path);
95
+ }
96
+ catch (cause) {
97
+ await rm(temporary, { force: true });
98
+ if (cause instanceof AIError || cause === options?.signal?.reason)
99
+ throw cause;
100
+ throw fileError(`Failed to write media file ${path}`, cause);
101
+ }
102
+ },
103
+ request: LLM.request,
104
+ generate,
105
+ /** Run one model call and return the text of its answer. */
106
+ text: (input, options) => run(LLM.text(input, { ...options, http: undefined }), options),
107
+ /** Run one model call that must answer with `schema`, and return the decoded value. */
108
+ object: (input, options) => run(LLM.object(input, { ...options, http: undefined }), options),
109
+ stream,
110
+ /** Stream model calls, running their tool calls, until the model stops calling tools or `until` is true. */
111
+ loop,
112
+ collect,
113
+ /** Compact a Responses request: a replacement window, or a checkpoint with `mechanism: "trigger"`. */
114
+ compact,
115
+ canCompact: LLM.canCompact,
116
+ image: {
117
+ request: Image.request,
118
+ generate: (input, options) => run(Image.generate(input, options), options),
119
+ stream: (input, options) => iterate(Image.stream(input, options), options),
120
+ /** Submit a generation on a queued route and return its `{ id }` at once; nothing polls. */
121
+ start: (input, options) => run(Image.start(input), options),
122
+ /** One status read for a job ID. */
123
+ status: (model, id, options) => run(Image.status(model, id), options),
124
+ /** The finished images; fails while the job is still running. */
125
+ result: (model, id, options) => run(Image.result(model, id), options),
126
+ cancel: (model, id, options) => run(Image.cancel(model, id), options),
127
+ },
128
+ decision: {
129
+ request: Decision.request,
130
+ generate: (input, options) => run(Decision.generate(input), options),
131
+ },
132
+ embedding: {
133
+ request: Embedding.request,
134
+ generate: (input, options) => run(Embedding.generate(input), options),
135
+ },
136
+ video: {
137
+ request: Video.request,
138
+ /** Submit a generation and return its `{ id }` at once; nothing polls. */
139
+ start: (input, options) => run(Video.start(input), options),
140
+ /** One status read for a job ID. */
141
+ status: (model, id, options) => run(Video.status(model, id), options),
142
+ /** The finished videos; fails while the job is still running. */
143
+ result: (model, id, options) => run(Video.result(model, id), options),
144
+ cancel: (model, id, options) => run(Video.cancel(model, id), options),
145
+ },
146
+ /** Experimental: may change without compatibility guarantees. */
147
+ experimental: {
148
+ speech: {
149
+ request: Speech.request,
150
+ generate: (input, options) => run(Speech.generate(input), options),
151
+ stream: (input, options) => iterate(Speech.stream(input), options),
152
+ },
153
+ transcription: {
154
+ request: Transcription.request,
155
+ generate: (input, options) => run(Transcription.generate(input, { poll: options?.poll }), options),
156
+ stream: (input, options) => iterate(Transcription.stream(input, { poll: options?.poll }), options),
157
+ start: (input, options) => run(Transcription.start(input), options).then(handle(options?.middleware)),
158
+ resume: (model, token, options) => run(Transcription.resume(model, token), options).then(handle(options?.middleware)),
159
+ },
160
+ },
161
+ dispose: () => runtime.dispose(),
162
+ };
163
+ };
164
+ const scoped = (self, middleware) => (middleware === undefined ? self : RequestExecutor.withMiddleware(fromFetch(middleware))(self));
165
+ const fileError = (message, cause) => new AIError({ reason: new InvalidRequestError({ message, cause }) });
166
+ /** `tool` from `@radheim/ai/effect`, with an `execute` that returns a value or a Promise and throws to fail. */
167
+ export const tool = (config) => {
168
+ const execute = config.execute;
169
+ return build(config, execute &&
170
+ ((input, context) => Effect.tryPromise({
171
+ try: async (signal) => execute(input, { ...context, signal }),
172
+ catch: (error) => new ToolFailure({ message: error instanceof Error ? error.message : String(error), error }),
173
+ })));
174
+ };
175
+ /** Default client over `RequestExecutor.fetchLayer`; the runtime builds its layer on first use and holds nothing to dispose. */
176
+ export const ai = make();
177
+ export { Media };
178
+ export * as AI from "./index.js";
179
+ export * from "./public.js";
package/dist/llm.d.ts ADDED
@@ -0,0 +1,109 @@
1
+ import { Effect, JsonSchema, Schema, Stream } from "effect";
2
+ import { AI } from "./ai.js";
3
+ import { canCompact, type CheckpointRequest, type CompactionRequest, type EndpointCompactOptions, type StreamOptions, type TriggerCompactOptions } from "./route/client.js";
4
+ import { AIError, StreamEvent, type TextResponse, Message, LanguageModel, SystemPart, type BaseRequest, type CachePolicy, type CompactionCheckpointResponse, type CompactionResponse, type Finish, ToolChoice, type LanguageModelProviderOptions, type GenerationOptionsFields, type LLMRequest, type ToolEntryInput } from "./schema/index.js";
5
+ import { type ExecutableTool, type Tool, type ToolSchema } from "./tool.js";
6
+ /** Input accepted by `ai.request`, `ai.generate`, `ai.stream` and `ai.compact`. An `LLMRequest` is also a valid input. */
7
+ export type LLMRequestInput<Model extends LanguageModel = LanguageModel, Tools extends RequestTools = RequestTools, Choice extends ToolChoice.Input = ToolChoice.Input> = TextRequestFields<Model, Tools, Choice> & PromptOrMessages;
8
+ /** What a request's `tools` takes. */
9
+ export type RequestTools = ReadonlyArray<Tool | ToolEntryInput>;
10
+ /**
11
+ * The names a request's `toolChoice` may force: the literal name of each `tool(...)`, or any string when a tool's name
12
+ * is not known statically (raw definitions, dynamic arrays).
13
+ */
14
+ export type ToolNames<Tools> = Tools extends ReadonlyArray<infer Entry> ? (Entry extends Tool<any, any, infer Name> ? Name : string) : string;
15
+ type CheckedChoice<Choice, Tools> = Choice extends {
16
+ readonly type: "tool";
17
+ readonly name: infer Name;
18
+ } ? string extends Name ? unknown : Name extends ToolNames<Tools> ? unknown : {
19
+ readonly name: ToolNames<Tools>;
20
+ } : unknown;
21
+ /** Exactly one of `prompt`, a single user message, or `messages`, the full conversation. */
22
+ export type PromptOrMessages = {
23
+ readonly prompt: Message.UserContentInput;
24
+ readonly messages?: never;
25
+ } | {
26
+ readonly messages: ReadonlyArray<Message | Message.Input>;
27
+ readonly prompt?: never;
28
+ };
29
+ interface TextRequestFields<Model extends LanguageModel, Tools extends RequestTools = RequestTools, Choice extends ToolChoice.Input = ToolChoice.Input> extends BaseRequest<Model, NoInfer<LanguageModelProviderOptions<Model>>>, GenerationOptionsFields {
30
+ readonly system?: string | SystemPart | ReadonlyArray<SystemPart>;
31
+ /**
32
+ * Sent in array order. Pass `tool(...)` values or wire entries such as hosted provider tools. The same as a
33
+ * `Message.tools({ add: tools })` leading the history.
34
+ */
35
+ readonly tools?: Tools;
36
+ /** A mode, or `{ type: "tool", name }` to force one of `tools`. A string is always a mode. */
37
+ readonly toolChoice?: Choice & CheckedChoice<NoInfer<Choice>, NoInfer<Tools>>;
38
+ readonly cache?: CachePolicy;
39
+ /** Stable cache affinity for protocols that support provider-managed prompt caching. */
40
+ readonly affinity?: string;
41
+ /** Emit a `raw` event with each provider frame before the events parsed from it. */
42
+ readonly includeRaw?: boolean;
43
+ }
44
+ /** An Effect Schema decodes and types `object`; a raw JSON Schema leaves it `unknown`. */
45
+ export type OutputSchema = ToolSchema<any> | JsonSchema.JsonSchema;
46
+ export type OutputType<S extends OutputSchema> = S extends Schema.Top ? Schema.Schema.Type<S> : unknown;
47
+ export type ObjectResponse<T> = TextResponse & {
48
+ readonly object: T;
49
+ };
50
+ /** Stream events for a request with `schema`: the `finish` event carries the decoded `object`. */
51
+ export type ObjectEvent<T> = Exclude<StreamEvent, Finish> | (Finish & {
52
+ readonly object: T;
53
+ });
54
+ /** Loop events for a request with `schema`: the loop's `finish` event carries the decoded `object`. */
55
+ export type LoopObjectEvent<T> = Exclude<StreamEvent, Finish> | (Finish & {
56
+ readonly object?: T;
57
+ });
58
+ /**
59
+ * Run one model call and return its assistant `message`, `usage` and `finish`. With `schema`, the model must answer
60
+ * through a forced tool call decoded into `object`; in `message` that call becomes the JSON text of the answer, so the
61
+ * message can go straight into the history.
62
+ */
63
+ export declare function generate<const Model extends LanguageModel, S extends OutputSchema, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice> & {
64
+ readonly schema: S;
65
+ }, options?: StreamOptions): Effect.Effect<ObjectResponse<OutputType<S>>, AIError, AI.Service>;
66
+ export declare function generate<const Model extends LanguageModel, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice>, options?: StreamOptions): Effect.Effect<TextResponse, AIError, AI.Service>;
67
+ /** Run one model call and return the text of its answer. */
68
+ export declare const text: <const Model extends LanguageModel, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice>, options?: StreamOptions) => Effect.Effect<string, AIError, AI.AIService>;
69
+ /** Run one model call that must answer with `schema`, and return the decoded value. */
70
+ export declare const object: <const Model extends LanguageModel, S extends OutputSchema, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice> & {
71
+ readonly schema: S;
72
+ }, options?: StreamOptions) => Effect.Effect<OutputType<S>, AIError, AI.AIService>;
73
+ /**
74
+ * Stream one model call. The `finish` event carries the assistant `message` and `usage`; with `schema`, also the
75
+ * decoded `object`.
76
+ */
77
+ export declare function stream<const Model extends LanguageModel, S extends OutputSchema, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice> & {
78
+ readonly schema: S;
79
+ }, options?: StreamOptions): Stream.Stream<ObjectEvent<OutputType<S>>, AIError, AI.Service>;
80
+ export declare function stream<const Model extends LanguageModel, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice>, options?: StreamOptions): Stream.Stream<StreamEvent, AIError, AI.Service>;
81
+ export type LLMLoopInput<Model extends LanguageModel = LanguageModel, Tools extends ReadonlyArray<ExecutableTool> = ReadonlyArray<ExecutableTool>, Choice extends ToolChoice.Input = ToolChoice.Input> = Omit<TextRequestFields<Model, Tools, Choice>, "tools"> & PromptOrMessages & {
82
+ readonly tools: Tools;
83
+ /**
84
+ * Called after each step that has tool calls, with every step's response; returning `true` ends the loop without
85
+ * running them.
86
+ */
87
+ readonly until?: (state: {
88
+ readonly steps: ReadonlyArray<TextResponse>;
89
+ }) => boolean;
90
+ };
91
+ /**
92
+ * Stream model calls, running the model's tool calls between them, until a step has no client-executed tool calls,
93
+ * hits the output token limit, or `until` returns `true`. Tool calls whose input is not valid JSON get an error result
94
+ * so the model can retry. A forced `toolChoice` applies to the first step only. Each step is wrapped in `step-start` and `step-finish`, which carry its step index and usage; one `finish` ends
95
+ * the loop with the final step's reason and `message` and the usage summed across steps. With `schema`, the model ends
96
+ * by calling the hidden answer tool, decoded into `object` on the `finish`.
97
+ */
98
+ export declare function loop<const Model extends LanguageModel, S extends OutputSchema, Tools extends ReadonlyArray<ExecutableTool> = ReadonlyArray<ExecutableTool>, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMLoopInput<Model, Tools, Choice> & {
99
+ readonly schema: S;
100
+ }, options?: StreamOptions): Stream.Stream<LoopObjectEvent<OutputType<S>>, AIError, AI.Service>;
101
+ export declare function loop<const Model extends LanguageModel, Tools extends ReadonlyArray<ExecutableTool> = ReadonlyArray<ExecutableTool>, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMLoopInput<Model, Tools, Choice>, options?: StreamOptions): Stream.Stream<StreamEvent, AIError, AI.Service>;
102
+ export { collect, type Collected, type CollectResult } from "./loop.js";
103
+ /** Normalize text request input into a plain `LLMRequest`, with `prompt` turned into the one user message. */
104
+ export declare const request: <const Model extends LanguageModel, Tools extends RequestTools = RequestTools, const Choice extends ToolChoice.Input = ToolChoice.Input>(input: LLMRequestInput<Model, Tools, Choice>) => LLMRequest<Model>;
105
+ /** Compact a text request: a replacement window, or a checkpoint with `mechanism: "trigger"`. */
106
+ export declare function compact(input: CheckpointRequest, options: TriggerCompactOptions): Effect.Effect<CompactionCheckpointResponse, AIError, AI.Service>;
107
+ export declare function compact(input: CompactionRequest, options?: EndpointCompactOptions): Effect.Effect<CompactionResponse, AIError, AI.Service>;
108
+ export { canCompact };
109
+ export * as LLM from "./llm.js";