@opencode/ai 0.0.0-reserved → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/README.md +879 -2
  2. package/dist/cache-policy.d.ts +2 -0
  3. package/dist/cache-policy.js +129 -0
  4. package/dist/image-client.d.ts +19 -0
  5. package/dist/image-client.js +28 -0
  6. package/dist/image.d.ts +110 -0
  7. package/dist/image.js +103 -0
  8. package/dist/index.d.ts +18 -0
  9. package/dist/index.js +12 -0
  10. package/dist/llm.d.ts +252 -0
  11. package/dist/llm.js +74 -0
  12. package/dist/protocols/alibaba-chat.d.ts +225 -0
  13. package/dist/protocols/alibaba-chat.js +75 -0
  14. package/dist/protocols/alibaba-messages.d.ts +350 -0
  15. package/dist/protocols/alibaba-messages.js +40 -0
  16. package/dist/protocols/alibaba-responses.d.ts +255 -0
  17. package/dist/protocols/alibaba-responses.js +80 -0
  18. package/dist/protocols/anthropic-messages.d.ts +980 -0
  19. package/dist/protocols/anthropic-messages.js +1460 -0
  20. package/dist/protocols/bedrock-converse.d.ts +499 -0
  21. package/dist/protocols/bedrock-converse.js +643 -0
  22. package/dist/protocols/bedrock-event-stream.d.ts +9 -0
  23. package/dist/protocols/bedrock-event-stream.js +97 -0
  24. package/dist/protocols/gemini.d.ts +285 -0
  25. package/dist/protocols/gemini.js +671 -0
  26. package/dist/protocols/google-images.d.ts +30 -0
  27. package/dist/protocols/google-images.js +181 -0
  28. package/dist/protocols/index.d.ts +12 -0
  29. package/dist/protocols/index.js +12 -0
  30. package/dist/protocols/meta-images.d.ts +26 -0
  31. package/dist/protocols/meta-images.js +89 -0
  32. package/dist/protocols/meta-messages.d.ts +356 -0
  33. package/dist/protocols/meta-messages.js +41 -0
  34. package/dist/protocols/meta-responses.d.ts +473 -0
  35. package/dist/protocols/meta-responses.js +173 -0
  36. package/dist/protocols/mistral-chat.d.ts +540 -0
  37. package/dist/protocols/mistral-chat.js +624 -0
  38. package/dist/protocols/open-responses-channel.d.ts +25 -0
  39. package/dist/protocols/open-responses-channel.js +141 -0
  40. package/dist/protocols/open-responses-continuation.d.ts +16 -0
  41. package/dist/protocols/open-responses-continuation.js +170 -0
  42. package/dist/protocols/open-responses.d.ts +1715 -0
  43. package/dist/protocols/open-responses.js +1228 -0
  44. package/dist/protocols/openai-chat.d.ts +860 -0
  45. package/dist/protocols/openai-chat.js +966 -0
  46. package/dist/protocols/openai-compatible-chat.d.ts +109 -0
  47. package/dist/protocols/openai-compatible-chat.js +19 -0
  48. package/dist/protocols/openai-compatible-responses.d.ts +172 -0
  49. package/dist/protocols/openai-compatible-responses.js +18 -0
  50. package/dist/protocols/openai-images.d.ts +32 -0
  51. package/dist/protocols/openai-images.js +183 -0
  52. package/dist/protocols/openai-responses.d.ts +1389 -0
  53. package/dist/protocols/openai-responses.js +260 -0
  54. package/dist/protocols/shared.d.ts +193 -0
  55. package/dist/protocols/shared.js +290 -0
  56. package/dist/protocols/utils/bedrock-auth.d.ts +60 -0
  57. package/dist/protocols/utils/bedrock-auth.js +85 -0
  58. package/dist/protocols/utils/bedrock-cache.d.ts +19 -0
  59. package/dist/protocols/utils/bedrock-cache.js +49 -0
  60. package/dist/protocols/utils/bedrock-media.d.ts +55 -0
  61. package/dist/protocols/utils/bedrock-media.js +73 -0
  62. package/dist/protocols/utils/cache.d.ts +6 -0
  63. package/dist/protocols/utils/cache.js +5 -0
  64. package/dist/protocols/utils/gemini-tool-schema.d.ts +2 -0
  65. package/dist/protocols/utils/gemini-tool-schema.js +103 -0
  66. package/dist/protocols/utils/image-input.d.ts +21 -0
  67. package/dist/protocols/utils/image-input.js +20 -0
  68. package/dist/protocols/utils/lifecycle.d.ts +24 -0
  69. package/dist/protocols/utils/lifecycle.js +72 -0
  70. package/dist/protocols/utils/meta-image.d.ts +2 -0
  71. package/dist/protocols/utils/meta-image.js +13 -0
  72. package/dist/protocols/utils/open-responses-options.d.ts +56 -0
  73. package/dist/protocols/utils/open-responses-options.js +61 -0
  74. package/dist/protocols/utils/openai-image.d.ts +5 -0
  75. package/dist/protocols/utils/openai-image.js +18 -0
  76. package/dist/protocols/utils/openai-options.d.ts +16 -0
  77. package/dist/protocols/utils/openai-options.js +14 -0
  78. package/dist/protocols/utils/partial-json-options.d.ts +62 -0
  79. package/dist/protocols/utils/partial-json-options.js +52 -0
  80. package/dist/protocols/utils/partial-json.d.ts +8 -0
  81. package/dist/protocols/utils/partial-json.js +279 -0
  82. package/dist/protocols/utils/responses-checkpoint.d.ts +4 -0
  83. package/dist/protocols/utils/responses-checkpoint.js +107 -0
  84. package/dist/protocols/utils/responses-compaction.d.ts +4 -0
  85. package/dist/protocols/utils/responses-compaction.js +129 -0
  86. package/dist/protocols/utils/responses-hosted-tools.d.ts +26 -0
  87. package/dist/protocols/utils/responses-hosted-tools.js +32 -0
  88. package/dist/protocols/utils/tool-schema.d.ts +8 -0
  89. package/dist/protocols/utils/tool-schema.js +54 -0
  90. package/dist/protocols/utils/tool-stream.d.ts +710 -0
  91. package/dist/protocols/utils/tool-stream.js +155 -0
  92. package/dist/protocols/xai-images.d.ts +26 -0
  93. package/dist/protocols/xai-images.js +106 -0
  94. package/dist/protocols/xai-responses.d.ts +250 -0
  95. package/dist/protocols/xai-responses.js +81 -0
  96. package/dist/protocols/zai-chat.d.ts +202 -0
  97. package/dist/protocols/zai-chat.js +49 -0
  98. package/dist/protocols/zai-images.d.ts +22 -0
  99. package/dist/protocols/zai-images.js +79 -0
  100. package/dist/protocols/zai-messages.d.ts +344 -0
  101. package/dist/protocols/zai-messages.js +27 -0
  102. package/dist/protocols.d.ts +1 -0
  103. package/dist/protocols.js +1 -0
  104. package/dist/provider-error.d.ts +15 -0
  105. package/dist/provider-error.js +125 -0
  106. package/dist/provider-package.d.ts +15 -0
  107. package/dist/provider-package.js +1 -0
  108. package/dist/provider.d.ts +23 -0
  109. package/dist/provider.js +2 -0
  110. package/dist/providers/alibaba/chat.d.ts +1 -0
  111. package/dist/providers/alibaba/chat.js +1 -0
  112. package/dist/providers/alibaba/messages.d.ts +3 -0
  113. package/dist/providers/alibaba/messages.js +1 -0
  114. package/dist/providers/alibaba/responses.d.ts +3 -0
  115. package/dist/providers/alibaba/responses.js +1 -0
  116. package/dist/providers/alibaba.d.ts +711 -0
  117. package/dist/providers/alibaba.js +94 -0
  118. package/dist/providers/amazon-bedrock/mantle/chat.d.ts +2 -0
  119. package/dist/providers/amazon-bedrock/mantle/chat.js +1 -0
  120. package/dist/providers/amazon-bedrock/mantle/responses.d.ts +2 -0
  121. package/dist/providers/amazon-bedrock/mantle/responses.js +1 -0
  122. package/dist/providers/amazon-bedrock/mantle.d.ts +2 -0
  123. package/dist/providers/amazon-bedrock/mantle.js +1 -0
  124. package/dist/providers/amazon-bedrock-mantle.d.ts +313 -0
  125. package/dist/providers/amazon-bedrock-mantle.js +79 -0
  126. package/dist/providers/amazon-bedrock.d.ts +173 -0
  127. package/dist/providers/amazon-bedrock.js +41 -0
  128. package/dist/providers/anthropic-compatible.d.ts +309 -0
  129. package/dist/providers/anthropic-compatible.js +50 -0
  130. package/dist/providers/anthropic.d.ts +307 -0
  131. package/dist/providers/anthropic.js +42 -0
  132. package/dist/providers/azure/chat.d.ts +2 -0
  133. package/dist/providers/azure/chat.js +1 -0
  134. package/dist/providers/azure/responses.d.ts +2 -0
  135. package/dist/providers/azure/responses.js +1 -0
  136. package/dist/providers/azure.d.ts +598 -0
  137. package/dist/providers/azure.js +115 -0
  138. package/dist/providers/baseten.d.ts +228 -0
  139. package/dist/providers/baseten.js +38 -0
  140. package/dist/providers/cerebras.d.ts +227 -0
  141. package/dist/providers/cerebras.js +40 -0
  142. package/dist/providers/cloudflare-ai-gateway.d.ts +237 -0
  143. package/dist/providers/cloudflare-ai-gateway.js +65 -0
  144. package/dist/providers/cloudflare-workers-ai.d.ts +231 -0
  145. package/dist/providers/cloudflare-workers-ai.js +51 -0
  146. package/dist/providers/deepinfra.d.ts +227 -0
  147. package/dist/providers/deepinfra.js +43 -0
  148. package/dist/providers/deepseek.d.ts +228 -0
  149. package/dist/providers/deepseek.js +41 -0
  150. package/dist/providers/fireworks.d.ts +228 -0
  151. package/dist/providers/fireworks.js +38 -0
  152. package/dist/providers/google-vertex/chat.d.ts +2 -0
  153. package/dist/providers/google-vertex/chat.js +1 -0
  154. package/dist/providers/google-vertex/gemini.d.ts +2 -0
  155. package/dist/providers/google-vertex/gemini.js +1 -0
  156. package/dist/providers/google-vertex/messages.d.ts +2 -0
  157. package/dist/providers/google-vertex/messages.js +1 -0
  158. package/dist/providers/google-vertex/responses.d.ts +2 -0
  159. package/dist/providers/google-vertex/responses.js +1 -0
  160. package/dist/providers/google-vertex-chat.d.ts +132 -0
  161. package/dist/providers/google-vertex-chat.js +55 -0
  162. package/dist/providers/google-vertex-messages.d.ts +306 -0
  163. package/dist/providers/google-vertex-messages.js +75 -0
  164. package/dist/providers/google-vertex-responses.d.ts +197 -0
  165. package/dist/providers/google-vertex-responses.js +56 -0
  166. package/dist/providers/google-vertex-shared.d.ts +22 -0
  167. package/dist/providers/google-vertex-shared.js +72 -0
  168. package/dist/providers/google-vertex.d.ts +119 -0
  169. package/dist/providers/google-vertex.js +98 -0
  170. package/dist/providers/google.d.ts +114 -0
  171. package/dist/providers/google.js +42 -0
  172. package/dist/providers/groq.d.ts +314 -0
  173. package/dist/providers/groq.js +81 -0
  174. package/dist/providers/index.d.ts +31 -0
  175. package/dist/providers/index.js +31 -0
  176. package/dist/providers/meta/chat.d.ts +2 -0
  177. package/dist/providers/meta/chat.js +1 -0
  178. package/dist/providers/meta/messages.d.ts +2 -0
  179. package/dist/providers/meta/messages.js +1 -0
  180. package/dist/providers/meta/responses.d.ts +2 -0
  181. package/dist/providers/meta/responses.js +1 -0
  182. package/dist/providers/meta.d.ts +636 -0
  183. package/dist/providers/meta.js +113 -0
  184. package/dist/providers/minimax/chat.d.ts +4 -0
  185. package/dist/providers/minimax/chat.js +8 -0
  186. package/dist/providers/minimax/messages.d.ts +1 -0
  187. package/dist/providers/minimax/messages.js +1 -0
  188. package/dist/providers/minimax/responses.d.ts +4 -0
  189. package/dist/providers/minimax/responses.js +8 -0
  190. package/dist/providers/minimax.d.ts +598 -0
  191. package/dist/providers/minimax.js +89 -0
  192. package/dist/providers/mistral.d.ts +207 -0
  193. package/dist/providers/mistral.js +28 -0
  194. package/dist/providers/moonshot/chat.d.ts +1 -0
  195. package/dist/providers/moonshot/chat.js +1 -0
  196. package/dist/providers/moonshot/messages.d.ts +4 -0
  197. package/dist/providers/moonshot/messages.js +8 -0
  198. package/dist/providers/moonshot/responses.d.ts +4 -0
  199. package/dist/providers/moonshot/responses.js +8 -0
  200. package/dist/providers/moonshot.d.ts +596 -0
  201. package/dist/providers/moonshot.js +90 -0
  202. package/dist/providers/open-responses-options.d.ts +6 -0
  203. package/dist/providers/open-responses-options.js +1 -0
  204. package/dist/providers/openai/chat.d.ts +2 -0
  205. package/dist/providers/openai/chat.js +1 -0
  206. package/dist/providers/openai/responses.d.ts +2 -0
  207. package/dist/providers/openai/responses.js +1 -0
  208. package/dist/providers/openai-compatible/responses.d.ts +1 -0
  209. package/dist/providers/openai-compatible/responses.js +1 -0
  210. package/dist/providers/openai-compatible-responses.d.ts +195 -0
  211. package/dist/providers/openai-compatible-responses.js +32 -0
  212. package/dist/providers/openai-compatible.d.ts +130 -0
  213. package/dist/providers/openai-compatible.js +33 -0
  214. package/dist/providers/openai-options.d.ts +26 -0
  215. package/dist/providers/openai-options.js +41 -0
  216. package/dist/providers/openai.d.ts +404 -0
  217. package/dist/providers/openai.js +82 -0
  218. package/dist/providers/openrouter.d.ts +563 -0
  219. package/dist/providers/openrouter.js +114 -0
  220. package/dist/providers/togetherai.d.ts +227 -0
  221. package/dist/providers/togetherai.js +40 -0
  222. package/dist/providers/xai.d.ts +163 -0
  223. package/dist/providers/xai.js +88 -0
  224. package/dist/providers/zai/chat.d.ts +1 -0
  225. package/dist/providers/zai/chat.js +1 -0
  226. package/dist/providers/zai-coding-plan/chat.d.ts +1 -0
  227. package/dist/providers/zai-coding-plan/chat.js +1 -0
  228. package/dist/providers/zai-coding-plan/messages.d.ts +4 -0
  229. package/dist/providers/zai-coding-plan/messages.js +8 -0
  230. package/dist/providers/zai-coding-plan/responses.d.ts +4 -0
  231. package/dist/providers/zai-coding-plan/responses.js +8 -0
  232. package/dist/providers/zai-coding-plan.d.ts +577 -0
  233. package/dist/providers/zai-coding-plan.js +63 -0
  234. package/dist/providers/zai.d.ts +149 -0
  235. package/dist/providers/zai.js +53 -0
  236. package/dist/providers.d.ts +1 -0
  237. package/dist/providers.js +1 -0
  238. package/dist/route/auth-options.d.ts +34 -0
  239. package/dist/route/auth-options.js +14 -0
  240. package/dist/route/auth.d.ts +51 -0
  241. package/dist/route/auth.js +87 -0
  242. package/dist/route/client.d.ts +430 -0
  243. package/dist/route/client.js +307 -0
  244. package/dist/route/endpoint.d.ts +28 -0
  245. package/dist/route/endpoint.js +21 -0
  246. package/dist/route/executor.d.ts +27 -0
  247. package/dist/route/executor.js +183 -0
  248. package/dist/route/framing.d.ts +29 -0
  249. package/dist/route/framing.js +14 -0
  250. package/dist/route/index.d.ts +16 -0
  251. package/dist/route/index.js +9 -0
  252. package/dist/route/protocol.d.ts +76 -0
  253. package/dist/route/protocol.js +16 -0
  254. package/dist/route/transport/http.d.ts +34 -0
  255. package/dist/route/transport/http.js +68 -0
  256. package/dist/route/transport/index.d.ts +41 -0
  257. package/dist/route/transport/index.js +4 -0
  258. package/dist/route/transport/websocket-channel.d.ts +57 -0
  259. package/dist/route/transport/websocket-channel.js +1 -0
  260. package/dist/route/transport/websocket.d.ts +56 -0
  261. package/dist/route/transport/websocket.js +370 -0
  262. package/dist/route.d.ts +1 -0
  263. package/dist/route.js +1 -0
  264. package/dist/schema/errors.d.ts +170 -0
  265. package/dist/schema/errors.js +131 -0
  266. package/dist/schema/events.d.ts +8123 -0
  267. package/dist/schema/events.js +550 -0
  268. package/dist/schema/ids.d.ts +17 -0
  269. package/dist/schema/ids.js +10 -0
  270. package/dist/schema/index.d.ts +5 -0
  271. package/dist/schema/index.js +5 -0
  272. package/dist/schema/messages.d.ts +646 -0
  273. package/dist/schema/messages.js +301 -0
  274. package/dist/schema/options.d.ts +159 -0
  275. package/dist/schema/options.js +189 -0
  276. package/dist/testing.d.ts +1693 -0
  277. package/dist/testing.js +129 -0
  278. package/dist/tool-history.d.ts +2 -0
  279. package/dist/tool-history.js +84 -0
  280. package/dist/tool-runtime.d.ts +15 -0
  281. package/dist/tool-runtime.js +62 -0
  282. package/dist/tool.d.ts +136 -0
  283. package/dist/tool.js +66 -0
  284. package/dist/utils/record.d.ts +2 -0
  285. package/dist/utils/record.js +2 -0
  286. package/dist/utils/sanitize.d.ts +1 -0
  287. package/dist/utils/sanitize.js +12 -0
  288. package/package.json +43 -10
@@ -0,0 +1,540 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { Route } from "../route/client.js";
3
+ import { Framing } from "../route/framing.js";
4
+ import { Protocol } from "../route/protocol.js";
5
+ import { HttpTransport } from "../route/transport/index.js";
6
+ import { AIError, LLMEvent, Usage, type FinishReasonDetails, type LLMRequest } from "../schema/index.js";
7
+ import { Lifecycle } from "./utils/lifecycle.js";
8
+ import { ToolStream } from "./utils/tool-stream.js";
9
+ export declare const DEFAULT_BASE_URL = "https://api.mistral.ai/v1";
10
+ export declare const PATH = "/chat/completions";
11
+ declare const MistralThinkingContent: Schema.StructWithRest<Schema.Struct<{
12
+ readonly type: Schema.Literal<"thinking">;
13
+ readonly thinking: Schema.$Array<Schema.StructWithRest<Schema.Struct<{
14
+ readonly type: Schema.optional<Schema.String>;
15
+ readonly text: Schema.optional<Schema.String>;
16
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
17
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
18
+ type MistralThinkingContent = Schema.Schema.Type<typeof MistralThinkingContent>;
19
+ export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | (string & {});
20
+ export type ProviderOptionsInput = {
21
+ readonly safePrompt?: boolean;
22
+ readonly documentImageLimit?: number;
23
+ readonly documentPageLimit?: number;
24
+ readonly parallelToolCalls?: boolean;
25
+ readonly reasoningEffort?: ReasoningEffort;
26
+ readonly promptMode?: "reasoning";
27
+ readonly promptCacheKey?: string;
28
+ readonly [key: string]: unknown;
29
+ };
30
+ declare const MistralBody: Schema.Struct<{
31
+ readonly model: Schema.String;
32
+ readonly messages: Schema.$Array<Schema.toTaggedUnion<"role", readonly [Schema.Struct<{
33
+ readonly role: Schema.Literal<"system">;
34
+ readonly content: Schema.String;
35
+ }>, Schema.Struct<{
36
+ readonly role: Schema.Literal<"user">;
37
+ readonly content: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
38
+ readonly type: Schema.Literal<"text">;
39
+ readonly text: Schema.String;
40
+ }>, Schema.Struct<{
41
+ readonly type: Schema.Literal<"image_url">;
42
+ readonly image_url: Schema.String;
43
+ }>, Schema.Struct<{
44
+ readonly type: Schema.Literal<"document_url">;
45
+ readonly document_url: Schema.String;
46
+ }>]>>]>;
47
+ }>, Schema.Struct<{
48
+ readonly role: Schema.Literal<"assistant">;
49
+ readonly content: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
50
+ readonly type: Schema.Literal<"text">;
51
+ readonly text: Schema.String;
52
+ }>, Schema.StructWithRest<Schema.Struct<{
53
+ readonly type: Schema.Literal<"thinking">;
54
+ readonly thinking: Schema.$Array<Schema.StructWithRest<Schema.Struct<{
55
+ readonly type: Schema.optional<Schema.String>;
56
+ readonly text: Schema.optional<Schema.String>;
57
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
58
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>>]>;
59
+ readonly tool_calls: Schema.optional<Schema.$Array<Schema.Struct<{
60
+ readonly id: Schema.String;
61
+ readonly type: Schema.Literal<"function">;
62
+ readonly function: Schema.Struct<{
63
+ readonly name: Schema.String;
64
+ readonly arguments: Schema.String;
65
+ }>;
66
+ }>>>;
67
+ readonly prefix: Schema.optional<Schema.Literal<true>>;
68
+ }>, Schema.Struct<{
69
+ readonly role: Schema.Literal<"tool">;
70
+ readonly tool_call_id: Schema.String;
71
+ readonly name: Schema.String;
72
+ readonly content: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
73
+ readonly type: Schema.Literal<"text">;
74
+ readonly text: Schema.String;
75
+ }>, Schema.Struct<{
76
+ readonly type: Schema.Literal<"image_url">;
77
+ readonly image_url: Schema.String;
78
+ }>, Schema.Struct<{
79
+ readonly type: Schema.Literal<"document_url">;
80
+ readonly document_url: Schema.String;
81
+ }>]>>]>;
82
+ }>]>>;
83
+ readonly tools: Schema.optional<Schema.$Array<Schema.Struct<{
84
+ readonly type: Schema.Literal<"function">;
85
+ readonly function: Schema.Struct<{
86
+ readonly name: Schema.String;
87
+ readonly description: Schema.String;
88
+ readonly parameters: Schema.$Record<Schema.String, Schema.Unknown>;
89
+ readonly strict: Schema.Literal<false>;
90
+ }>;
91
+ }>>>;
92
+ readonly tool_choice: Schema.optional<Schema.Union<readonly [Schema.Literals<readonly ["auto", "none", "any"]>, Schema.Struct<{
93
+ readonly type: Schema.Literal<"function">;
94
+ readonly function: Schema.Struct<{
95
+ readonly name: Schema.String;
96
+ }>;
97
+ }>]>>;
98
+ readonly stream: Schema.Literal<true>;
99
+ readonly max_tokens: Schema.optional<Schema.Number>;
100
+ readonly random_seed: Schema.optional<Schema.Number>;
101
+ readonly temperature: Schema.optional<Schema.Number>;
102
+ readonly top_p: Schema.optional<Schema.Number>;
103
+ readonly frequency_penalty: Schema.optional<Schema.Number>;
104
+ readonly presence_penalty: Schema.optional<Schema.Number>;
105
+ readonly stop: Schema.optional<Schema.$Array<Schema.String>>;
106
+ readonly prompt_cache_key: Schema.optional<Schema.String>;
107
+ readonly safe_prompt: Schema.optional<Schema.Boolean>;
108
+ readonly document_image_limit: Schema.optional<Schema.Number>;
109
+ readonly document_page_limit: Schema.optional<Schema.Number>;
110
+ readonly parallel_tool_calls: Schema.optional<Schema.Boolean>;
111
+ readonly reasoning_effort: Schema.optional<Schema.String>;
112
+ readonly prompt_mode: Schema.optional<Schema.Literal<"reasoning">>;
113
+ }>;
114
+ export type MistralBody = Schema.Schema.Type<typeof MistralBody>;
115
+ export declare const fromRequest: (request: LLMRequest<import("../schema/options.js").LanguageModel<{
116
+ readonly [x: string]: unknown;
117
+ }, import("../route/client.js").CompactionOperations | undefined>>) => Effect.Effect<{
118
+ model: string & import("effect/Brand").Brand<"AI.ModelID">;
119
+ messages: ({
120
+ readonly role: "system";
121
+ readonly content: string;
122
+ } | {
123
+ readonly role: "user";
124
+ readonly content: string | readonly ({
125
+ readonly type: "text";
126
+ readonly text: string;
127
+ } | {
128
+ readonly type: "image_url";
129
+ readonly image_url: string;
130
+ } | {
131
+ readonly type: "document_url";
132
+ readonly document_url: string;
133
+ })[];
134
+ } | {
135
+ readonly content: string | readonly ({
136
+ readonly [x: string]: unknown;
137
+ readonly type: "thinking";
138
+ readonly thinking: readonly {
139
+ readonly [x: string]: unknown;
140
+ readonly type?: string | undefined;
141
+ readonly text?: string | undefined;
142
+ }[];
143
+ } | {
144
+ readonly type: "text";
145
+ readonly text: string;
146
+ })[];
147
+ readonly role: "assistant";
148
+ readonly tool_calls?: readonly {
149
+ readonly id: string;
150
+ readonly type: "function";
151
+ readonly function: {
152
+ readonly name: string;
153
+ readonly arguments: string;
154
+ };
155
+ }[] | undefined;
156
+ readonly prefix?: true | undefined;
157
+ } | {
158
+ readonly role: "tool";
159
+ readonly tool_call_id: string;
160
+ readonly name: string;
161
+ readonly content: string | readonly ({
162
+ readonly type: "text";
163
+ readonly text: string;
164
+ } | {
165
+ readonly type: "image_url";
166
+ readonly image_url: string;
167
+ } | {
168
+ readonly type: "document_url";
169
+ readonly document_url: string;
170
+ })[];
171
+ })[];
172
+ tools: {
173
+ readonly type: "function";
174
+ readonly function: {
175
+ readonly name: string;
176
+ readonly description: string;
177
+ readonly parameters: {
178
+ readonly [x: string]: unknown;
179
+ };
180
+ readonly strict: false;
181
+ };
182
+ }[] | undefined;
183
+ tool_choice: "auto" | "none" | "any" | {
184
+ type: "function";
185
+ function: {
186
+ name: string;
187
+ };
188
+ } | undefined;
189
+ stream: true;
190
+ max_tokens: number | undefined;
191
+ random_seed: number | undefined;
192
+ temperature: number | undefined;
193
+ top_p: number | undefined;
194
+ frequency_penalty: number | undefined;
195
+ presence_penalty: number | undefined;
196
+ stop: readonly string[] | undefined;
197
+ prompt_cache_key: string | undefined;
198
+ safe_prompt: boolean | undefined;
199
+ document_image_limit: number | undefined;
200
+ document_page_limit: number | undefined;
201
+ parallel_tool_calls: boolean | undefined;
202
+ reasoning_effort: string | undefined;
203
+ prompt_mode: "reasoning" | undefined;
204
+ }, AIError, never>;
205
+ type ToolKey = string | number;
206
+ interface PendingTool {
207
+ readonly id: string;
208
+ readonly name?: string;
209
+ readonly input: string;
210
+ }
211
+ interface ActiveContent {
212
+ readonly type: "text" | "reasoning";
213
+ readonly id: string;
214
+ readonly thinking?: MistralThinkingContent;
215
+ }
216
+ export interface ParserState {
217
+ readonly tools: ToolStream.State<ToolKey>;
218
+ readonly pendingTools: Partial<Record<ToolKey, PendingTool>>;
219
+ readonly toolIDs: ReadonlyMap<string, string>;
220
+ readonly usedToolIDs: ReadonlySet<string>;
221
+ readonly completedTools: ReadonlyArray<LLMEvent>;
222
+ readonly latestToolKey?: ToolKey;
223
+ readonly generatedTools: number;
224
+ readonly lifecycle: Lifecycle.State;
225
+ readonly active?: ActiveContent;
226
+ readonly nextContent: number;
227
+ readonly usage?: Usage;
228
+ readonly finishReason?: FinishReasonDetails;
229
+ }
230
+ export declare const protocol: Protocol<{
231
+ readonly model: string;
232
+ readonly messages: readonly ({
233
+ readonly role: "system";
234
+ readonly content: string;
235
+ } | {
236
+ readonly role: "user";
237
+ readonly content: string | readonly ({
238
+ readonly type: "text";
239
+ readonly text: string;
240
+ } | {
241
+ readonly type: "image_url";
242
+ readonly image_url: string;
243
+ } | {
244
+ readonly type: "document_url";
245
+ readonly document_url: string;
246
+ })[];
247
+ } | {
248
+ readonly content: string | readonly ({
249
+ readonly [x: string]: unknown;
250
+ readonly type: "thinking";
251
+ readonly thinking: readonly {
252
+ readonly [x: string]: unknown;
253
+ readonly type?: string | undefined;
254
+ readonly text?: string | undefined;
255
+ }[];
256
+ } | {
257
+ readonly type: "text";
258
+ readonly text: string;
259
+ })[];
260
+ readonly role: "assistant";
261
+ readonly tool_calls?: readonly {
262
+ readonly id: string;
263
+ readonly type: "function";
264
+ readonly function: {
265
+ readonly name: string;
266
+ readonly arguments: string;
267
+ };
268
+ }[] | undefined;
269
+ readonly prefix?: true | undefined;
270
+ } | {
271
+ readonly role: "tool";
272
+ readonly tool_call_id: string;
273
+ readonly name: string;
274
+ readonly content: string | readonly ({
275
+ readonly type: "text";
276
+ readonly text: string;
277
+ } | {
278
+ readonly type: "image_url";
279
+ readonly image_url: string;
280
+ } | {
281
+ readonly type: "document_url";
282
+ readonly document_url: string;
283
+ })[];
284
+ })[];
285
+ readonly stream: true;
286
+ readonly max_tokens?: number | undefined;
287
+ readonly tools?: readonly {
288
+ readonly type: "function";
289
+ readonly function: {
290
+ readonly name: string;
291
+ readonly description: string;
292
+ readonly parameters: {
293
+ readonly [x: string]: unknown;
294
+ };
295
+ readonly strict: false;
296
+ };
297
+ }[] | undefined;
298
+ readonly stop?: readonly string[] | undefined;
299
+ readonly temperature?: number | undefined;
300
+ readonly tool_choice?: "auto" | "none" | "any" | {
301
+ readonly type: "function";
302
+ readonly function: {
303
+ readonly name: string;
304
+ };
305
+ } | undefined;
306
+ readonly top_p?: number | undefined;
307
+ readonly random_seed?: number | undefined;
308
+ readonly frequency_penalty?: number | undefined;
309
+ readonly presence_penalty?: number | undefined;
310
+ readonly prompt_cache_key?: string | undefined;
311
+ readonly safe_prompt?: boolean | undefined;
312
+ readonly document_image_limit?: number | undefined;
313
+ readonly document_page_limit?: number | undefined;
314
+ readonly parallel_tool_calls?: boolean | undefined;
315
+ readonly reasoning_effort?: string | undefined;
316
+ readonly prompt_mode?: "reasoning" | undefined;
317
+ }, string, "[DONE]" | {
318
+ readonly [x: string]: unknown;
319
+ readonly error?: {
320
+ readonly [x: string]: unknown;
321
+ readonly message: string;
322
+ readonly code?: string | number | null | undefined;
323
+ } | null | undefined;
324
+ readonly usage?: {
325
+ readonly [x: string]: unknown;
326
+ readonly prompt_tokens?: number | null | undefined;
327
+ readonly completion_tokens?: number | null | undefined;
328
+ readonly total_tokens?: number | null | undefined;
329
+ readonly num_cached_tokens?: number | null | undefined;
330
+ readonly prompt_token_details?: {
331
+ readonly [x: string]: unknown;
332
+ readonly cached_tokens?: number | null | undefined;
333
+ } | null | undefined;
334
+ readonly prompt_tokens_details?: {
335
+ readonly [x: string]: unknown;
336
+ readonly cached_tokens?: number | null | undefined;
337
+ } | null | undefined;
338
+ } | null | undefined;
339
+ readonly choices?: readonly {
340
+ readonly [x: string]: unknown;
341
+ readonly delta?: {
342
+ readonly [x: string]: unknown;
343
+ readonly content?: string | readonly {
344
+ readonly [x: string]: unknown;
345
+ readonly type: string;
346
+ readonly text?: string | null | undefined;
347
+ readonly thinking?: unknown;
348
+ }[] | null | undefined;
349
+ readonly tool_calls?: readonly {
350
+ readonly function?: {
351
+ readonly name?: string | null | undefined;
352
+ readonly arguments?: string | {
353
+ readonly [x: string]: unknown;
354
+ } | null | undefined;
355
+ } | null | undefined;
356
+ readonly id?: string | null | undefined;
357
+ readonly index?: number | null | undefined;
358
+ }[] | null | undefined;
359
+ } | null | undefined;
360
+ readonly finish_reason?: string | null | undefined;
361
+ }[] | null | undefined;
362
+ }, ParserState>;
363
+ export declare const framing: Framing.Definition<string>;
364
+ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
365
+ readonly model: string;
366
+ readonly messages: readonly ({
367
+ readonly role: "system";
368
+ readonly content: string;
369
+ } | {
370
+ readonly role: "user";
371
+ readonly content: string | readonly ({
372
+ readonly type: "text";
373
+ readonly text: string;
374
+ } | {
375
+ readonly type: "image_url";
376
+ readonly image_url: string;
377
+ } | {
378
+ readonly type: "document_url";
379
+ readonly document_url: string;
380
+ })[];
381
+ } | {
382
+ readonly content: string | readonly ({
383
+ readonly [x: string]: unknown;
384
+ readonly type: "thinking";
385
+ readonly thinking: readonly {
386
+ readonly [x: string]: unknown;
387
+ readonly type?: string | undefined;
388
+ readonly text?: string | undefined;
389
+ }[];
390
+ } | {
391
+ readonly type: "text";
392
+ readonly text: string;
393
+ })[];
394
+ readonly role: "assistant";
395
+ readonly tool_calls?: readonly {
396
+ readonly id: string;
397
+ readonly type: "function";
398
+ readonly function: {
399
+ readonly name: string;
400
+ readonly arguments: string;
401
+ };
402
+ }[] | undefined;
403
+ readonly prefix?: true | undefined;
404
+ } | {
405
+ readonly role: "tool";
406
+ readonly tool_call_id: string;
407
+ readonly name: string;
408
+ readonly content: string | readonly ({
409
+ readonly type: "text";
410
+ readonly text: string;
411
+ } | {
412
+ readonly type: "image_url";
413
+ readonly image_url: string;
414
+ } | {
415
+ readonly type: "document_url";
416
+ readonly document_url: string;
417
+ })[];
418
+ })[];
419
+ readonly stream: true;
420
+ readonly max_tokens?: number | undefined;
421
+ readonly tools?: readonly {
422
+ readonly type: "function";
423
+ readonly function: {
424
+ readonly name: string;
425
+ readonly description: string;
426
+ readonly parameters: {
427
+ readonly [x: string]: unknown;
428
+ };
429
+ readonly strict: false;
430
+ };
431
+ }[] | undefined;
432
+ readonly stop?: readonly string[] | undefined;
433
+ readonly temperature?: number | undefined;
434
+ readonly tool_choice?: "auto" | "none" | "any" | {
435
+ readonly type: "function";
436
+ readonly function: {
437
+ readonly name: string;
438
+ };
439
+ } | undefined;
440
+ readonly top_p?: number | undefined;
441
+ readonly random_seed?: number | undefined;
442
+ readonly frequency_penalty?: number | undefined;
443
+ readonly presence_penalty?: number | undefined;
444
+ readonly prompt_cache_key?: string | undefined;
445
+ readonly safe_prompt?: boolean | undefined;
446
+ readonly document_image_limit?: number | undefined;
447
+ readonly document_page_limit?: number | undefined;
448
+ readonly parallel_tool_calls?: boolean | undefined;
449
+ readonly reasoning_effort?: string | undefined;
450
+ readonly prompt_mode?: "reasoning" | undefined;
451
+ }, string>;
452
+ export declare const route: Route<{
453
+ readonly model: string;
454
+ readonly messages: readonly ({
455
+ readonly role: "system";
456
+ readonly content: string;
457
+ } | {
458
+ readonly role: "user";
459
+ readonly content: string | readonly ({
460
+ readonly type: "text";
461
+ readonly text: string;
462
+ } | {
463
+ readonly type: "image_url";
464
+ readonly image_url: string;
465
+ } | {
466
+ readonly type: "document_url";
467
+ readonly document_url: string;
468
+ })[];
469
+ } | {
470
+ readonly content: string | readonly ({
471
+ readonly [x: string]: unknown;
472
+ readonly type: "thinking";
473
+ readonly thinking: readonly {
474
+ readonly [x: string]: unknown;
475
+ readonly type?: string | undefined;
476
+ readonly text?: string | undefined;
477
+ }[];
478
+ } | {
479
+ readonly type: "text";
480
+ readonly text: string;
481
+ })[];
482
+ readonly role: "assistant";
483
+ readonly tool_calls?: readonly {
484
+ readonly id: string;
485
+ readonly type: "function";
486
+ readonly function: {
487
+ readonly name: string;
488
+ readonly arguments: string;
489
+ };
490
+ }[] | undefined;
491
+ readonly prefix?: true | undefined;
492
+ } | {
493
+ readonly role: "tool";
494
+ readonly tool_call_id: string;
495
+ readonly name: string;
496
+ readonly content: string | readonly ({
497
+ readonly type: "text";
498
+ readonly text: string;
499
+ } | {
500
+ readonly type: "image_url";
501
+ readonly image_url: string;
502
+ } | {
503
+ readonly type: "document_url";
504
+ readonly document_url: string;
505
+ })[];
506
+ })[];
507
+ readonly stream: true;
508
+ readonly max_tokens?: number | undefined;
509
+ readonly tools?: readonly {
510
+ readonly type: "function";
511
+ readonly function: {
512
+ readonly name: string;
513
+ readonly description: string;
514
+ readonly parameters: {
515
+ readonly [x: string]: unknown;
516
+ };
517
+ readonly strict: false;
518
+ };
519
+ }[] | undefined;
520
+ readonly stop?: readonly string[] | undefined;
521
+ readonly temperature?: number | undefined;
522
+ readonly tool_choice?: "auto" | "none" | "any" | {
523
+ readonly type: "function";
524
+ readonly function: {
525
+ readonly name: string;
526
+ };
527
+ } | undefined;
528
+ readonly top_p?: number | undefined;
529
+ readonly random_seed?: number | undefined;
530
+ readonly frequency_penalty?: number | undefined;
531
+ readonly presence_penalty?: number | undefined;
532
+ readonly prompt_cache_key?: string | undefined;
533
+ readonly safe_prompt?: boolean | undefined;
534
+ readonly document_image_limit?: number | undefined;
535
+ readonly document_page_limit?: number | undefined;
536
+ readonly parallel_tool_calls?: boolean | undefined;
537
+ readonly reasoning_effort?: string | undefined;
538
+ readonly prompt_mode?: "reasoning" | undefined;
539
+ }, HttpTransport.HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
540
+ export * as MistralChat from "./mistral-chat.js";