@opencode/ai 2.1.2 → 2.1.4

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 (140) hide show
  1. package/dist/cache-policy.js +6 -5
  2. package/dist/experimental/evaluation.d.ts +7 -6
  3. package/dist/experimental/evaluation.js +3 -11
  4. package/dist/experimental/realtime.d.ts +59 -0
  5. package/dist/experimental/realtime.js +21 -13
  6. package/dist/experimental.d.ts +1 -1
  7. package/dist/generation.js +1 -1
  8. package/dist/image-client.d.ts +11 -9
  9. package/dist/image.d.ts +158 -150
  10. package/dist/image.js +2 -2
  11. package/dist/llm.d.ts +2 -4
  12. package/dist/llm.js +2 -2
  13. package/dist/media-model.d.ts +2 -2
  14. package/dist/media-model.js +1 -1
  15. package/dist/promise.d.ts +121 -121
  16. package/dist/promise.js +3 -5
  17. package/dist/protocols/alibaba-chat.d.ts +18 -18
  18. package/dist/protocols/alibaba-chat.js +3 -3
  19. package/dist/protocols/alibaba-messages.d.ts +12 -12
  20. package/dist/protocols/alibaba-messages.js +1 -1
  21. package/dist/protocols/alibaba-responses.d.ts +38 -38
  22. package/dist/protocols/anthropic-messages.d.ts +40 -44
  23. package/dist/protocols/anthropic-messages.js +13 -15
  24. package/dist/protocols/bedrock-converse.d.ts +36 -85
  25. package/dist/protocols/bedrock-converse.js +6 -6
  26. package/dist/protocols/bedrock-event-stream.d.ts +6 -1
  27. package/dist/protocols/bedrock-event-stream.js +9 -8
  28. package/dist/protocols/cartesia-speech.d.ts +32 -32
  29. package/dist/protocols/cohere-chat.d.ts +13 -10
  30. package/dist/protocols/cohere-chat.js +2 -2
  31. package/dist/protocols/deepgram-speech.d.ts +32 -32
  32. package/dist/protocols/elevenlabs-speech.d.ts +32 -32
  33. package/dist/protocols/gemini.d.ts +46 -36
  34. package/dist/protocols/gemini.js +12 -15
  35. package/dist/protocols/google-interactions.d.ts +14 -13
  36. package/dist/protocols/google-interactions.js +16 -11
  37. package/dist/protocols/google-speech.d.ts +32 -32
  38. package/dist/protocols/google-transcription.d.ts +32 -32
  39. package/dist/protocols/meta-messages.d.ts +23 -23
  40. package/dist/protocols/meta-responses.d.ts +84 -84
  41. package/dist/protocols/mistral-chat.d.ts +81 -78
  42. package/dist/protocols/mistral-chat.js +3 -5
  43. package/dist/protocols/open-responses-channel.js +47 -46
  44. package/dist/protocols/open-responses-continuation.d.ts +8 -2
  45. package/dist/protocols/open-responses-continuation.js +3 -1
  46. package/dist/protocols/open-responses.d.ts +419 -419
  47. package/dist/protocols/open-responses.js +11 -10
  48. package/dist/protocols/openai-chat.d.ts +68 -67
  49. package/dist/protocols/openai-chat.js +7 -8
  50. package/dist/protocols/openai-compatible-chat.d.ts +13 -14
  51. package/dist/protocols/openai-compatible-responses.d.ts +39 -40
  52. package/dist/protocols/openai-images.d.ts +32 -32
  53. package/dist/protocols/openai-responses.d.ts +253 -253
  54. package/dist/protocols/openai-responses.js +1 -1
  55. package/dist/protocols/openai-speech.d.ts +32 -32
  56. package/dist/protocols/openai-transcription.d.ts +32 -32
  57. package/dist/protocols/openai-transcription.js +12 -7
  58. package/dist/protocols/utils/open-responses-options.d.ts +8 -8
  59. package/dist/protocols/utils/open-responses-options.js +4 -6
  60. package/dist/protocols/utils/partial-json-options.d.ts +0 -1
  61. package/dist/protocols/utils/partial-json-options.js +0 -1
  62. package/dist/protocols/utils/partial-json.js +5 -4
  63. package/dist/protocols/utils/tool-schema.d.ts +0 -3
  64. package/dist/protocols/utils/tool-schema.js +0 -4
  65. package/dist/protocols/utils/tool-stream.d.ts +1 -1
  66. package/dist/protocols/venice-chat.d.ts +52 -53
  67. package/dist/protocols/venice-chat.js +6 -5
  68. package/dist/protocols/xai-images.js +3 -4
  69. package/dist/protocols/xai-responses.d.ts +81 -81
  70. package/dist/protocols/zai-chat.d.ts +33 -30
  71. package/dist/protocols/zai-chat.js +8 -3
  72. package/dist/protocols/zai-messages.d.ts +21 -19
  73. package/dist/protocols/zai-messages.js +3 -2
  74. package/dist/provider-error.js +8 -7
  75. package/dist/providers/alibaba.d.ts +74 -74
  76. package/dist/providers/amazon-bedrock-mantle.d.ts +202 -202
  77. package/dist/providers/amazon-bedrock.d.ts +16 -13
  78. package/dist/providers/anthropic-compatible.d.ts +13 -13
  79. package/dist/providers/anthropic.d.ts +13 -13
  80. package/dist/providers/azure.d.ts +112 -112
  81. package/dist/providers/baseten.d.ts +24 -24
  82. package/dist/providers/cerebras.d.ts +24 -24
  83. package/dist/providers/cloudflare-ai-gateway.d.ts +237 -234
  84. package/dist/providers/cloudflare-ai-gateway.js +3 -6
  85. package/dist/providers/cloudflare-workers-ai.d.ts +24 -24
  86. package/dist/providers/cohere.d.ts +78 -74
  87. package/dist/providers/deepinfra.d.ts +24 -24
  88. package/dist/providers/deepseek.d.ts +24 -24
  89. package/dist/providers/digitalocean.d.ts +36 -36
  90. package/dist/providers/fireworks.d.ts +24 -24
  91. package/dist/providers/google-vertex-chat.d.ts +12 -12
  92. package/dist/providers/google-vertex-interactions.d.ts +3 -3
  93. package/dist/providers/google-vertex-messages.d.ts +20 -20
  94. package/dist/providers/google-vertex-mistral.d.ts +14 -14
  95. package/dist/providers/google-vertex-responses.d.ts +38 -38
  96. package/dist/providers/google-vertex.d.ts +17 -17
  97. package/dist/providers/google-vertex.js +2 -2
  98. package/dist/providers/google.d.ts +79 -79
  99. package/dist/providers/groq.d.ts +24 -24
  100. package/dist/providers/meta.d.ts +189 -189
  101. package/dist/providers/minimax.d.ts +202 -202
  102. package/dist/providers/mistral.d.ts +28 -28
  103. package/dist/providers/moonshot.d.ts +202 -202
  104. package/dist/providers/open-responses-options.d.ts +0 -1
  105. package/dist/providers/open-responses-options.js +1 -1
  106. package/dist/providers/openai-compatible-responses.d.ts +38 -38
  107. package/dist/providers/openai-compatible.d.ts +12 -12
  108. package/dist/providers/openai-compatible.js +1 -1
  109. package/dist/providers/openai-options.d.ts +3 -4
  110. package/dist/providers/openai-options.js +0 -1
  111. package/dist/providers/openai.d.ts +103 -103
  112. package/dist/providers/openrouter.d.ts +171 -112
  113. package/dist/providers/openrouter.js +40 -33
  114. package/dist/providers/togetherai.d.ts +24 -24
  115. package/dist/providers/venice.d.ts +195 -20
  116. package/dist/providers/xai.d.ts +12 -12
  117. package/dist/providers/zai-coding-plan.d.ts +152 -72
  118. package/dist/providers/zai.d.ts +84 -19
  119. package/dist/route/auth-options.d.ts +0 -3
  120. package/dist/route/auth.d.ts +0 -2
  121. package/dist/route/auth.js +0 -2
  122. package/dist/route/client.d.ts +0 -218
  123. package/dist/route/client.js +3 -7
  124. package/dist/route/executor-service.js +1 -1
  125. package/dist/route/transport/http.js +5 -8
  126. package/dist/schema/errors.d.ts +1 -1
  127. package/dist/schema/errors.js +1 -1
  128. package/dist/schema/messages.js +4 -7
  129. package/dist/speech-client.d.ts +11 -9
  130. package/dist/speech.d.ts +158 -150
  131. package/dist/speech.js +2 -2
  132. package/dist/transcription-client.d.ts +11 -9
  133. package/dist/transcription.d.ts +158 -150
  134. package/dist/transcription.js +2 -2
  135. package/dist/video-client.d.ts +11 -9
  136. package/dist/video.d.ts +124 -116
  137. package/dist/video.js +2 -2
  138. package/package.json +7 -6
  139. package/dist/protocols/utils/openai-options.d.ts +0 -16
  140. package/dist/protocols/utils/openai-options.js +0 -15
@@ -27,14 +27,6 @@ interface ParserState extends OpenResponses.ParserState {
27
27
  export declare const protocol: Protocol<{
28
28
  readonly model: string;
29
29
  readonly input: readonly ({
30
- readonly [x: string]: unknown;
31
- readonly type: string;
32
- readonly id: string;
33
- } | {
34
- readonly type: "compaction";
35
- readonly id?: string | null | undefined;
36
- readonly encrypted_content: string;
37
- } | {
38
30
  readonly type: "configuration_update";
39
31
  readonly reasoning: {
40
32
  readonly effort: import("../schema/options.js").ReasoningEffort;
@@ -47,10 +39,45 @@ export declare const protocol: Protocol<{
47
39
  readonly type: "message";
48
40
  readonly role: "developer";
49
41
  readonly content: string;
42
+ } | {
43
+ readonly type: "function_call_output";
44
+ readonly call_id: string;
45
+ readonly output: string | readonly ({
46
+ readonly type: "input_text";
47
+ readonly text: string;
48
+ } | {
49
+ readonly type: "input_video";
50
+ readonly video_url: string;
51
+ } | {
52
+ readonly type: "input_image";
53
+ readonly image_url: string;
54
+ readonly detail?: string | undefined;
55
+ } | {
56
+ readonly type: "input_file";
57
+ readonly filename: string;
58
+ readonly detail?: string | undefined;
59
+ readonly file_data?: string | undefined;
60
+ readonly file_url?: string | undefined;
61
+ })[];
62
+ } | {
63
+ readonly type: "reasoning";
64
+ readonly id?: string | undefined;
65
+ readonly summary: readonly {
66
+ readonly type: "summary_text";
67
+ readonly text: string;
68
+ }[];
69
+ readonly encrypted_content?: string | null | undefined;
70
+ } | {
71
+ readonly type: "compaction";
72
+ readonly id?: string | null | undefined;
73
+ readonly encrypted_content: string;
50
74
  } | {
51
75
  readonly type: "message";
52
76
  readonly role: "user";
53
77
  readonly content: readonly ({
78
+ readonly type: "input_text";
79
+ readonly text: string;
80
+ } | {
54
81
  readonly type: "input_image";
55
82
  readonly image_url: string;
56
83
  readonly detail?: string | undefined;
@@ -60,9 +87,6 @@ export declare const protocol: Protocol<{
60
87
  readonly detail?: string | undefined;
61
88
  readonly file_data?: string | undefined;
62
89
  readonly file_url?: string | undefined;
63
- } | {
64
- readonly type: "input_text";
65
- readonly text: string;
66
90
  })[];
67
91
  readonly id?: string | undefined;
68
92
  readonly status?: string | undefined;
@@ -76,14 +100,6 @@ export declare const protocol: Protocol<{
76
100
  }[];
77
101
  readonly phase?: "commentary" | "final_answer" | null | undefined;
78
102
  readonly status?: string | undefined;
79
- } | {
80
- readonly type: "reasoning";
81
- readonly id?: string | undefined;
82
- readonly summary: readonly {
83
- readonly type: "summary_text";
84
- readonly text: string;
85
- }[];
86
- readonly encrypted_content?: string | null | undefined;
87
103
  } | {
88
104
  readonly type: "function_call";
89
105
  readonly id?: string | undefined;
@@ -91,26 +107,6 @@ export declare const protocol: Protocol<{
91
107
  readonly name: string;
92
108
  readonly namespace?: string | undefined;
93
109
  readonly arguments: string;
94
- } | {
95
- readonly type: "function_call_output";
96
- readonly call_id: string;
97
- readonly output: string | readonly ({
98
- readonly type: "input_image";
99
- readonly image_url: string;
100
- readonly detail?: string | undefined;
101
- } | {
102
- readonly type: "input_file";
103
- readonly filename: string;
104
- readonly detail?: string | undefined;
105
- readonly file_data?: string | undefined;
106
- readonly file_url?: string | undefined;
107
- } | {
108
- readonly type: "input_text";
109
- readonly text: string;
110
- } | {
111
- readonly type: "input_video";
112
- readonly video_url: string;
113
- })[];
114
110
  } | {
115
111
  readonly [x: string]: unknown;
116
112
  readonly type: "web_search_call";
@@ -148,6 +144,10 @@ export declare const protocol: Protocol<{
148
144
  readonly arguments?: string | undefined;
149
145
  readonly output?: string | null | undefined;
150
146
  readonly error?: unknown;
147
+ } | {
148
+ readonly [x: string]: unknown;
149
+ readonly type: string;
150
+ readonly id: string;
151
151
  })[];
152
152
  readonly instructions?: string | undefined;
153
153
  readonly tools?: readonly ({
@@ -183,15 +183,15 @@ export declare const protocol: Protocol<{
183
183
  } | undefined;
184
184
  readonly top_logprobs?: number | undefined;
185
185
  readonly truncation?: "auto" | "disabled" | undefined;
186
- readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
186
+ readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
187
187
  readonly prompt_cache_key?: string | undefined;
188
- readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined;
188
+ readonly include?: readonly import("../schema/options.js").OpenString<"code_interpreter_call.outputs" | "computer_call_output.output.image_url" | "file_search_call.results" | "message.input_image.image_url" | "message.output_text.logprobs" | "reasoning.encrypted_content" | "web_search_call.action.sources" | "web_search_call.results">[] | undefined;
189
189
  readonly reasoning?: {
190
190
  readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
191
191
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
192
192
  } | undefined;
193
193
  readonly text?: {
194
- readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
194
+ readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
195
195
  } | undefined;
196
196
  readonly max_output_tokens?: number | undefined;
197
197
  readonly max_tool_calls?: number | undefined;
@@ -263,14 +263,6 @@ export declare const protocol: Protocol<{
263
263
  export declare const httpTransport: import("../route/transport/http.js").HttpJsonTransport<{
264
264
  readonly model: string;
265
265
  readonly input: readonly ({
266
- readonly [x: string]: unknown;
267
- readonly type: string;
268
- readonly id: string;
269
- } | {
270
- readonly type: "compaction";
271
- readonly id?: string | null | undefined;
272
- readonly encrypted_content: string;
273
- } | {
274
266
  readonly type: "configuration_update";
275
267
  readonly reasoning: {
276
268
  readonly effort: import("../schema/options.js").ReasoningEffort;
@@ -283,10 +275,45 @@ export declare const httpTransport: import("../route/transport/http.js").HttpJso
283
275
  readonly type: "message";
284
276
  readonly role: "developer";
285
277
  readonly content: string;
278
+ } | {
279
+ readonly type: "function_call_output";
280
+ readonly call_id: string;
281
+ readonly output: string | readonly ({
282
+ readonly type: "input_text";
283
+ readonly text: string;
284
+ } | {
285
+ readonly type: "input_video";
286
+ readonly video_url: string;
287
+ } | {
288
+ readonly type: "input_image";
289
+ readonly image_url: string;
290
+ readonly detail?: string | undefined;
291
+ } | {
292
+ readonly type: "input_file";
293
+ readonly filename: string;
294
+ readonly detail?: string | undefined;
295
+ readonly file_data?: string | undefined;
296
+ readonly file_url?: string | undefined;
297
+ })[];
298
+ } | {
299
+ readonly type: "reasoning";
300
+ readonly id?: string | undefined;
301
+ readonly summary: readonly {
302
+ readonly type: "summary_text";
303
+ readonly text: string;
304
+ }[];
305
+ readonly encrypted_content?: string | null | undefined;
306
+ } | {
307
+ readonly type: "compaction";
308
+ readonly id?: string | null | undefined;
309
+ readonly encrypted_content: string;
286
310
  } | {
287
311
  readonly type: "message";
288
312
  readonly role: "user";
289
313
  readonly content: readonly ({
314
+ readonly type: "input_text";
315
+ readonly text: string;
316
+ } | {
290
317
  readonly type: "input_image";
291
318
  readonly image_url: string;
292
319
  readonly detail?: string | undefined;
@@ -296,9 +323,6 @@ export declare const httpTransport: import("../route/transport/http.js").HttpJso
296
323
  readonly detail?: string | undefined;
297
324
  readonly file_data?: string | undefined;
298
325
  readonly file_url?: string | undefined;
299
- } | {
300
- readonly type: "input_text";
301
- readonly text: string;
302
326
  })[];
303
327
  readonly id?: string | undefined;
304
328
  readonly status?: string | undefined;
@@ -312,14 +336,6 @@ export declare const httpTransport: import("../route/transport/http.js").HttpJso
312
336
  }[];
313
337
  readonly phase?: "commentary" | "final_answer" | null | undefined;
314
338
  readonly status?: string | undefined;
315
- } | {
316
- readonly type: "reasoning";
317
- readonly id?: string | undefined;
318
- readonly summary: readonly {
319
- readonly type: "summary_text";
320
- readonly text: string;
321
- }[];
322
- readonly encrypted_content?: string | null | undefined;
323
339
  } | {
324
340
  readonly type: "function_call";
325
341
  readonly id?: string | undefined;
@@ -327,26 +343,6 @@ export declare const httpTransport: import("../route/transport/http.js").HttpJso
327
343
  readonly name: string;
328
344
  readonly namespace?: string | undefined;
329
345
  readonly arguments: string;
330
- } | {
331
- readonly type: "function_call_output";
332
- readonly call_id: string;
333
- readonly output: string | readonly ({
334
- readonly type: "input_image";
335
- readonly image_url: string;
336
- readonly detail?: string | undefined;
337
- } | {
338
- readonly type: "input_file";
339
- readonly filename: string;
340
- readonly detail?: string | undefined;
341
- readonly file_data?: string | undefined;
342
- readonly file_url?: string | undefined;
343
- } | {
344
- readonly type: "input_text";
345
- readonly text: string;
346
- } | {
347
- readonly type: "input_video";
348
- readonly video_url: string;
349
- })[];
350
346
  } | {
351
347
  readonly [x: string]: unknown;
352
348
  readonly type: "web_search_call";
@@ -384,6 +380,10 @@ export declare const httpTransport: import("../route/transport/http.js").HttpJso
384
380
  readonly arguments?: string | undefined;
385
381
  readonly output?: string | null | undefined;
386
382
  readonly error?: unknown;
383
+ } | {
384
+ readonly [x: string]: unknown;
385
+ readonly type: string;
386
+ readonly id: string;
387
387
  })[];
388
388
  readonly instructions?: string | undefined;
389
389
  readonly tools?: readonly ({
@@ -419,15 +419,15 @@ export declare const httpTransport: import("../route/transport/http.js").HttpJso
419
419
  } | undefined;
420
420
  readonly top_logprobs?: number | undefined;
421
421
  readonly truncation?: "auto" | "disabled" | undefined;
422
- readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
422
+ readonly service_tier?: import("../schema/options.js").OpenString<"auto" | "default" | "flex" | "priority"> | undefined;
423
423
  readonly prompt_cache_key?: string | undefined;
424
- readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined;
424
+ readonly include?: readonly import("../schema/options.js").OpenString<"code_interpreter_call.outputs" | "computer_call_output.output.image_url" | "file_search_call.results" | "message.input_image.image_url" | "message.output_text.logprobs" | "reasoning.encrypted_content" | "web_search_call.action.sources" | "web_search_call.results">[] | undefined;
425
425
  readonly reasoning?: {
426
426
  readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
427
427
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
428
428
  } | undefined;
429
429
  readonly text?: {
430
- readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
430
+ readonly verbosity?: import("../schema/options.js").OpenString<"high" | "low" | "medium"> | undefined;
431
431
  } | undefined;
432
432
  readonly max_output_tokens?: number | undefined;
433
433
  readonly max_tool_calls?: number | undefined;
@@ -21,15 +21,18 @@ declare const MistralThinkingContent: Schema.StructWithRest<Schema.Struct<{
21
21
  }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
22
22
  }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
23
23
  type MistralThinkingContent = Schema.Schema.Type<typeof MistralThinkingContent>;
24
- export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | (string & {});
25
- export type ProviderOptionsInput = {
26
- readonly safePrompt?: boolean;
27
- readonly documentImageLimit?: number;
28
- readonly documentPageLimit?: number;
29
- readonly parallelToolCalls?: boolean;
30
- readonly reasoningEffort?: ReasoningEffort;
31
- readonly promptMode?: "reasoning";
32
- readonly promptCacheKey?: string;
24
+ declare const ReasoningEffort: Schema.declare<import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal" | "none" | "xhigh">, import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal" | "none" | "xhigh">>;
25
+ export type ReasoningEffort = typeof ReasoningEffort.Type;
26
+ declare const MistralOptions: Schema.Struct<{
27
+ readonly safePrompt: Schema.optional<Schema.Boolean>;
28
+ readonly documentImageLimit: Schema.optional<Schema.Number>;
29
+ readonly documentPageLimit: Schema.optional<Schema.Number>;
30
+ readonly parallelToolCalls: Schema.optional<Schema.Boolean>;
31
+ readonly reasoningEffort: Schema.optional<Schema.declare<import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal" | "none" | "xhigh">, import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal" | "none" | "xhigh">>>;
32
+ readonly promptMode: Schema.optional<Schema.Literal<"reasoning">>;
33
+ readonly promptCacheKey: Schema.optional<Schema.String>;
34
+ }>;
35
+ export type ProviderOptionsInput = typeof MistralOptions.Type & {
33
36
  readonly [key: string]: unknown;
34
37
  };
35
38
  export declare const MistralBody: Schema.Struct<{
@@ -142,9 +145,26 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
142
145
  readonly type: "document_url";
143
146
  readonly document_url: string;
144
147
  })[];
148
+ } | {
149
+ readonly role: "tool";
150
+ readonly tool_call_id: string;
151
+ readonly name: string;
152
+ readonly content: string | readonly ({
153
+ readonly type: "text";
154
+ readonly text: string;
155
+ } | {
156
+ readonly type: "image_url";
157
+ readonly image_url: string;
158
+ } | {
159
+ readonly type: "document_url";
160
+ readonly document_url: string;
161
+ })[];
145
162
  } | {
146
163
  readonly role: "assistant";
147
164
  readonly content: string | readonly ({
165
+ readonly type: "text";
166
+ readonly text: string;
167
+ } | {
148
168
  readonly [x: string]: unknown;
149
169
  readonly type: "thinking";
150
170
  readonly thinking: readonly {
@@ -152,9 +172,6 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
152
172
  readonly type?: string | undefined;
153
173
  readonly text?: string | undefined;
154
174
  }[];
155
- } | {
156
- readonly type: "text";
157
- readonly text: string;
158
175
  })[];
159
176
  readonly tool_calls?: readonly {
160
177
  readonly id: string;
@@ -165,20 +182,6 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
165
182
  };
166
183
  }[] | undefined;
167
184
  readonly prefix?: true | undefined;
168
- } | {
169
- readonly role: "tool";
170
- readonly tool_call_id: string;
171
- readonly name: string;
172
- readonly content: string | readonly ({
173
- readonly type: "text";
174
- readonly text: string;
175
- } | {
176
- readonly type: "image_url";
177
- readonly image_url: string;
178
- } | {
179
- readonly type: "document_url";
180
- readonly document_url: string;
181
- })[];
182
185
  })[];
183
186
  tools: {
184
187
  readonly type: "function";
@@ -210,7 +213,7 @@ export declare const fromRequest: (request: LLMRequest<import("../schema/options
210
213
  document_image_limit: number | undefined;
211
214
  document_page_limit: number | undefined;
212
215
  parallel_tool_calls: boolean | undefined;
213
- reasoning_effort: string | undefined;
216
+ reasoning_effort: import("../schema/options.js").OpenString<"high" | "low" | "medium" | "minimal" | "none" | "xhigh"> | undefined;
214
217
  prompt_mode: "reasoning" | undefined;
215
218
  }, AIError, never>;
216
219
  type ToolKey = string | number;
@@ -259,9 +262,26 @@ export declare const protocol: Protocol<{
259
262
  readonly type: "document_url";
260
263
  readonly document_url: string;
261
264
  })[];
265
+ } | {
266
+ readonly role: "tool";
267
+ readonly tool_call_id: string;
268
+ readonly name: string;
269
+ readonly content: string | readonly ({
270
+ readonly type: "text";
271
+ readonly text: string;
272
+ } | {
273
+ readonly type: "image_url";
274
+ readonly image_url: string;
275
+ } | {
276
+ readonly type: "document_url";
277
+ readonly document_url: string;
278
+ })[];
262
279
  } | {
263
280
  readonly role: "assistant";
264
281
  readonly content: string | readonly ({
282
+ readonly type: "text";
283
+ readonly text: string;
284
+ } | {
265
285
  readonly [x: string]: unknown;
266
286
  readonly type: "thinking";
267
287
  readonly thinking: readonly {
@@ -269,9 +289,6 @@ export declare const protocol: Protocol<{
269
289
  readonly type?: string | undefined;
270
290
  readonly text?: string | undefined;
271
291
  }[];
272
- } | {
273
- readonly type: "text";
274
- readonly text: string;
275
292
  })[];
276
293
  readonly tool_calls?: readonly {
277
294
  readonly id: string;
@@ -282,20 +299,6 @@ export declare const protocol: Protocol<{
282
299
  };
283
300
  }[] | undefined;
284
301
  readonly prefix?: true | undefined;
285
- } | {
286
- readonly role: "tool";
287
- readonly tool_call_id: string;
288
- readonly name: string;
289
- readonly content: string | readonly ({
290
- readonly type: "text";
291
- readonly text: string;
292
- } | {
293
- readonly type: "image_url";
294
- readonly image_url: string;
295
- } | {
296
- readonly type: "document_url";
297
- readonly document_url: string;
298
- })[];
299
302
  })[];
300
303
  readonly tools?: readonly {
301
304
  readonly type: "function";
@@ -396,9 +399,26 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
396
399
  readonly type: "document_url";
397
400
  readonly document_url: string;
398
401
  })[];
402
+ } | {
403
+ readonly role: "tool";
404
+ readonly tool_call_id: string;
405
+ readonly name: string;
406
+ readonly content: string | readonly ({
407
+ readonly type: "text";
408
+ readonly text: string;
409
+ } | {
410
+ readonly type: "image_url";
411
+ readonly image_url: string;
412
+ } | {
413
+ readonly type: "document_url";
414
+ readonly document_url: string;
415
+ })[];
399
416
  } | {
400
417
  readonly role: "assistant";
401
418
  readonly content: string | readonly ({
419
+ readonly type: "text";
420
+ readonly text: string;
421
+ } | {
402
422
  readonly [x: string]: unknown;
403
423
  readonly type: "thinking";
404
424
  readonly thinking: readonly {
@@ -406,9 +426,6 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
406
426
  readonly type?: string | undefined;
407
427
  readonly text?: string | undefined;
408
428
  }[];
409
- } | {
410
- readonly type: "text";
411
- readonly text: string;
412
429
  })[];
413
430
  readonly tool_calls?: readonly {
414
431
  readonly id: string;
@@ -419,20 +436,6 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
419
436
  };
420
437
  }[] | undefined;
421
438
  readonly prefix?: true | undefined;
422
- } | {
423
- readonly role: "tool";
424
- readonly tool_call_id: string;
425
- readonly name: string;
426
- readonly content: string | readonly ({
427
- readonly type: "text";
428
- readonly text: string;
429
- } | {
430
- readonly type: "image_url";
431
- readonly image_url: string;
432
- } | {
433
- readonly type: "document_url";
434
- readonly document_url: string;
435
- })[];
436
439
  })[];
437
440
  readonly tools?: readonly {
438
441
  readonly type: "function";
@@ -487,9 +490,26 @@ export declare const route: Route<{
487
490
  readonly type: "document_url";
488
491
  readonly document_url: string;
489
492
  })[];
493
+ } | {
494
+ readonly role: "tool";
495
+ readonly tool_call_id: string;
496
+ readonly name: string;
497
+ readonly content: string | readonly ({
498
+ readonly type: "text";
499
+ readonly text: string;
500
+ } | {
501
+ readonly type: "image_url";
502
+ readonly image_url: string;
503
+ } | {
504
+ readonly type: "document_url";
505
+ readonly document_url: string;
506
+ })[];
490
507
  } | {
491
508
  readonly role: "assistant";
492
509
  readonly content: string | readonly ({
510
+ readonly type: "text";
511
+ readonly text: string;
512
+ } | {
493
513
  readonly [x: string]: unknown;
494
514
  readonly type: "thinking";
495
515
  readonly thinking: readonly {
@@ -497,9 +517,6 @@ export declare const route: Route<{
497
517
  readonly type?: string | undefined;
498
518
  readonly text?: string | undefined;
499
519
  }[];
500
- } | {
501
- readonly type: "text";
502
- readonly text: string;
503
520
  })[];
504
521
  readonly tool_calls?: readonly {
505
522
  readonly id: string;
@@ -510,20 +527,6 @@ export declare const route: Route<{
510
527
  };
511
528
  }[] | undefined;
512
529
  readonly prefix?: true | undefined;
513
- } | {
514
- readonly role: "tool";
515
- readonly tool_call_id: string;
516
- readonly name: string;
517
- readonly content: string | readonly ({
518
- readonly type: "text";
519
- readonly text: string;
520
- } | {
521
- readonly type: "image_url";
522
- readonly image_url: string;
523
- } | {
524
- readonly type: "document_url";
525
- readonly document_url: string;
526
- })[];
527
530
  })[];
528
531
  readonly tools?: readonly {
529
532
  readonly type: "function";
@@ -69,12 +69,13 @@ const MistralTool = Schema.Struct({
69
69
  strict: Schema.Literal(false),
70
70
  }),
71
71
  });
72
+ const ReasoningEffort = ProviderShared.knownString();
72
73
  const MistralOptions = Schema.Struct({
73
74
  safePrompt: Schema.optional(Schema.Boolean),
74
75
  documentImageLimit: Schema.optional(Schema.Number),
75
76
  documentPageLimit: Schema.optional(Schema.Number),
76
77
  parallelToolCalls: Schema.optional(Schema.Boolean),
77
- reasoningEffort: Schema.optional(Schema.String),
78
+ reasoningEffort: Schema.optional(ReasoningEffort),
78
79
  promptMode: Schema.optional(Schema.Literal("reasoning")),
79
80
  promptCacheKey: Schema.optional(Schema.String),
80
81
  });
@@ -290,9 +291,6 @@ const lowerTool = (tool) => ({
290
291
  });
291
292
  export const fromRequest = Effect.fn("MistralChat.fromRequest")(function* (request) {
292
293
  const options = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(MistralOptions))(request.providerOptions ?? {});
293
- const selected = request.toolChoice?.type === "tool" ? request.toolChoice.name : undefined;
294
- if (request.toolChoice?.type === "tool" && !selected)
295
- return yield* ProviderShared.invalidRequest("Mistral Chat tool choice requires a tool name");
296
294
  if (options.reasoningEffort !== undefined && options.promptMode !== undefined)
297
295
  return yield* ProviderShared.invalidRequest("Mistral Chat reasoningEffort and promptMode provider options are mutually exclusive");
298
296
  const toolChoice = request.toolChoice
@@ -372,7 +370,7 @@ const thinkingUnits = (value) => {
372
370
  return [];
373
371
  return value.filter(Schema.is(MistralThinkingUnit));
374
372
  };
375
- const thinkingText = (thinking) => thinking.flatMap((unit) => (typeof unit.text === "string" ? [unit.text] : [])).join("");
373
+ const thinkingText = (thinking) => thinking.flatMap((unit) => (unit.text !== undefined ? [unit.text] : [])).join("");
376
374
  const thinkingMetadata = (thinking) => ({ mistral: { thinking } });
377
375
  const closeActive = (state, events) => {
378
376
  if (!state.active)