@hebo-ai/gateway 0.9.3 → 0.10.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 (37) hide show
  1. package/README.md +23 -12
  2. package/dist/endpoints/chat-completions/otel.js +0 -1
  3. package/dist/endpoints/chat-completions/schema.d.ts +289 -57
  4. package/dist/endpoints/conversations/schema.d.ts +200 -40
  5. package/dist/endpoints/messages/converters.d.ts +24 -0
  6. package/dist/endpoints/messages/converters.js +661 -0
  7. package/dist/endpoints/messages/handler.d.ts +2 -0
  8. package/dist/endpoints/messages/handler.js +142 -0
  9. package/dist/endpoints/messages/index.d.ts +4 -0
  10. package/dist/endpoints/messages/index.js +4 -0
  11. package/dist/endpoints/messages/otel.d.ts +6 -0
  12. package/dist/endpoints/messages/otel.js +171 -0
  13. package/dist/endpoints/messages/schema.d.ts +623 -0
  14. package/dist/endpoints/messages/schema.js +185 -0
  15. package/dist/endpoints/responses/otel.js +0 -1
  16. package/dist/endpoints/responses/schema.d.ts +237 -45
  17. package/dist/endpoints/shared/schema.d.ts +23 -2
  18. package/dist/endpoints/shared/schema.js +3 -1
  19. package/dist/errors/anthropic.d.ts +10 -0
  20. package/dist/errors/anthropic.js +46 -0
  21. package/dist/errors/openai.js +1 -10
  22. package/dist/errors/utils.d.ts +3 -1
  23. package/dist/errors/utils.js +9 -0
  24. package/dist/gateway.d.ts +1 -0
  25. package/dist/gateway.js +2 -0
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.js +1 -0
  28. package/dist/lifecycle.js +12 -3
  29. package/dist/models/anthropic/middleware.js +5 -0
  30. package/dist/providers/bedrock/middleware.js +16 -1
  31. package/dist/providers/registry.d.ts +1 -1
  32. package/dist/telemetry/gen-ai.js +4 -0
  33. package/dist/types.d.ts +6 -5
  34. package/dist/utils/response.d.ts +1 -0
  35. package/dist/utils/stream.d.ts +1 -0
  36. package/dist/utils/stream.js +10 -3
  37. package/package.json +14 -3
@@ -0,0 +1,623 @@
1
+ import * as z from "zod";
2
+ import type { SseFrame } from "../../utils/stream";
3
+ import type { ProviderMetadata } from "../shared/schema";
4
+ declare const UserContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
+ type: z.ZodLiteral<"text">;
6
+ text: z.ZodString;
7
+ cache_control: z.ZodOptional<z.ZodObject<{
8
+ type: z.ZodLiteral<"ephemeral">;
9
+ ttl: z.ZodOptional<z.ZodEnum<{
10
+ "5m": "5m";
11
+ "1h": "1h";
12
+ "24h": "24h";
13
+ }>>;
14
+ }, z.core.$strip>>;
15
+ }, z.core.$strip>, z.ZodObject<{
16
+ type: z.ZodLiteral<"image">;
17
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
18
+ type: z.ZodLiteral<"base64">;
19
+ media_type: z.ZodString;
20
+ data: z.ZodString;
21
+ }, z.core.$strip>, z.ZodObject<{
22
+ type: z.ZodLiteral<"url">;
23
+ url: z.ZodString;
24
+ }, z.core.$strip>], "type">;
25
+ cache_control: z.ZodOptional<z.ZodObject<{
26
+ type: z.ZodLiteral<"ephemeral">;
27
+ ttl: z.ZodOptional<z.ZodEnum<{
28
+ "5m": "5m";
29
+ "1h": "1h";
30
+ "24h": "24h";
31
+ }>>;
32
+ }, z.core.$strip>>;
33
+ }, z.core.$strip>, z.ZodObject<{
34
+ type: z.ZodLiteral<"tool_result">;
35
+ tool_use_id: z.ZodString;
36
+ content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
37
+ type: z.ZodLiteral<"text">;
38
+ text: z.ZodString;
39
+ cache_control: z.ZodOptional<z.ZodObject<{
40
+ type: z.ZodLiteral<"ephemeral">;
41
+ ttl: z.ZodOptional<z.ZodEnum<{
42
+ "5m": "5m";
43
+ "1h": "1h";
44
+ "24h": "24h";
45
+ }>>;
46
+ }, z.core.$strip>>;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ type: z.ZodLiteral<"image">;
49
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
50
+ type: z.ZodLiteral<"base64">;
51
+ media_type: z.ZodString;
52
+ data: z.ZodString;
53
+ }, z.core.$strip>, z.ZodObject<{
54
+ type: z.ZodLiteral<"url">;
55
+ url: z.ZodString;
56
+ }, z.core.$strip>], "type">;
57
+ cache_control: z.ZodOptional<z.ZodObject<{
58
+ type: z.ZodLiteral<"ephemeral">;
59
+ ttl: z.ZodOptional<z.ZodEnum<{
60
+ "5m": "5m";
61
+ "1h": "1h";
62
+ "24h": "24h";
63
+ }>>;
64
+ }, z.core.$strip>>;
65
+ }, z.core.$strip>]>>]>>;
66
+ is_error: z.ZodOptional<z.ZodBoolean>;
67
+ cache_control: z.ZodOptional<z.ZodObject<{
68
+ type: z.ZodLiteral<"ephemeral">;
69
+ ttl: z.ZodOptional<z.ZodEnum<{
70
+ "5m": "5m";
71
+ "1h": "1h";
72
+ "24h": "24h";
73
+ }>>;
74
+ }, z.core.$strip>>;
75
+ }, z.core.$strip>, z.ZodObject<{
76
+ type: z.ZodLiteral<"document">;
77
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
78
+ type: z.ZodLiteral<"base64">;
79
+ media_type: z.ZodString;
80
+ data: z.ZodString;
81
+ }, z.core.$strip>, z.ZodObject<{
82
+ type: z.ZodLiteral<"url">;
83
+ url: z.ZodString;
84
+ }, z.core.$strip>, z.ZodObject<{
85
+ type: z.ZodLiteral<"text">;
86
+ data: z.ZodString;
87
+ media_type: z.ZodLiteral<"text/plain">;
88
+ }, z.core.$strip>], "type">;
89
+ title: z.ZodOptional<z.ZodString>;
90
+ context: z.ZodOptional<z.ZodString>;
91
+ cache_control: z.ZodOptional<z.ZodObject<{
92
+ type: z.ZodLiteral<"ephemeral">;
93
+ ttl: z.ZodOptional<z.ZodEnum<{
94
+ "5m": "5m";
95
+ "1h": "1h";
96
+ "24h": "24h";
97
+ }>>;
98
+ }, z.core.$strip>>;
99
+ }, z.core.$strip>], "type">;
100
+ export type UserContentBlock = z.infer<typeof UserContentBlockSchema>;
101
+ declare const AssistantContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
102
+ type: z.ZodLiteral<"text">;
103
+ text: z.ZodString;
104
+ cache_control: z.ZodOptional<z.ZodObject<{
105
+ type: z.ZodLiteral<"ephemeral">;
106
+ ttl: z.ZodOptional<z.ZodEnum<{
107
+ "5m": "5m";
108
+ "1h": "1h";
109
+ "24h": "24h";
110
+ }>>;
111
+ }, z.core.$strip>>;
112
+ }, z.core.$strip>, z.ZodObject<{
113
+ type: z.ZodLiteral<"tool_use">;
114
+ id: z.ZodString;
115
+ name: z.ZodString;
116
+ input: z.ZodAny;
117
+ caller: z.ZodOptional<z.ZodString>;
118
+ extra_content: z.ZodOptional<z.ZodType<import("@ai-sdk/provider").SharedV3ProviderMetadata, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").SharedV3ProviderMetadata, unknown>>>;
119
+ }, z.core.$strip>, z.ZodObject<{
120
+ type: z.ZodLiteral<"thinking">;
121
+ thinking: z.ZodString;
122
+ signature: z.ZodString;
123
+ }, z.core.$strip>, z.ZodObject<{
124
+ type: z.ZodLiteral<"redacted_thinking">;
125
+ data: z.ZodString;
126
+ }, z.core.$strip>], "type">;
127
+ export type AssistantContentBlock = z.infer<typeof AssistantContentBlockSchema>;
128
+ declare const MessagesMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
129
+ role: z.ZodLiteral<"user">;
130
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
131
+ type: z.ZodLiteral<"text">;
132
+ text: z.ZodString;
133
+ cache_control: z.ZodOptional<z.ZodObject<{
134
+ type: z.ZodLiteral<"ephemeral">;
135
+ ttl: z.ZodOptional<z.ZodEnum<{
136
+ "5m": "5m";
137
+ "1h": "1h";
138
+ "24h": "24h";
139
+ }>>;
140
+ }, z.core.$strip>>;
141
+ }, z.core.$strip>, z.ZodObject<{
142
+ type: z.ZodLiteral<"image">;
143
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
144
+ type: z.ZodLiteral<"base64">;
145
+ media_type: z.ZodString;
146
+ data: z.ZodString;
147
+ }, z.core.$strip>, z.ZodObject<{
148
+ type: z.ZodLiteral<"url">;
149
+ url: z.ZodString;
150
+ }, z.core.$strip>], "type">;
151
+ cache_control: z.ZodOptional<z.ZodObject<{
152
+ type: z.ZodLiteral<"ephemeral">;
153
+ ttl: z.ZodOptional<z.ZodEnum<{
154
+ "5m": "5m";
155
+ "1h": "1h";
156
+ "24h": "24h";
157
+ }>>;
158
+ }, z.core.$strip>>;
159
+ }, z.core.$strip>, z.ZodObject<{
160
+ type: z.ZodLiteral<"tool_result">;
161
+ tool_use_id: z.ZodString;
162
+ content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
163
+ type: z.ZodLiteral<"text">;
164
+ text: z.ZodString;
165
+ cache_control: z.ZodOptional<z.ZodObject<{
166
+ type: z.ZodLiteral<"ephemeral">;
167
+ ttl: z.ZodOptional<z.ZodEnum<{
168
+ "5m": "5m";
169
+ "1h": "1h";
170
+ "24h": "24h";
171
+ }>>;
172
+ }, z.core.$strip>>;
173
+ }, z.core.$strip>, z.ZodObject<{
174
+ type: z.ZodLiteral<"image">;
175
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
176
+ type: z.ZodLiteral<"base64">;
177
+ media_type: z.ZodString;
178
+ data: z.ZodString;
179
+ }, z.core.$strip>, z.ZodObject<{
180
+ type: z.ZodLiteral<"url">;
181
+ url: z.ZodString;
182
+ }, z.core.$strip>], "type">;
183
+ cache_control: z.ZodOptional<z.ZodObject<{
184
+ type: z.ZodLiteral<"ephemeral">;
185
+ ttl: z.ZodOptional<z.ZodEnum<{
186
+ "5m": "5m";
187
+ "1h": "1h";
188
+ "24h": "24h";
189
+ }>>;
190
+ }, z.core.$strip>>;
191
+ }, z.core.$strip>]>>]>>;
192
+ is_error: z.ZodOptional<z.ZodBoolean>;
193
+ cache_control: z.ZodOptional<z.ZodObject<{
194
+ type: z.ZodLiteral<"ephemeral">;
195
+ ttl: z.ZodOptional<z.ZodEnum<{
196
+ "5m": "5m";
197
+ "1h": "1h";
198
+ "24h": "24h";
199
+ }>>;
200
+ }, z.core.$strip>>;
201
+ }, z.core.$strip>, z.ZodObject<{
202
+ type: z.ZodLiteral<"document">;
203
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
204
+ type: z.ZodLiteral<"base64">;
205
+ media_type: z.ZodString;
206
+ data: z.ZodString;
207
+ }, z.core.$strip>, z.ZodObject<{
208
+ type: z.ZodLiteral<"url">;
209
+ url: z.ZodString;
210
+ }, z.core.$strip>, z.ZodObject<{
211
+ type: z.ZodLiteral<"text">;
212
+ data: z.ZodString;
213
+ media_type: z.ZodLiteral<"text/plain">;
214
+ }, z.core.$strip>], "type">;
215
+ title: z.ZodOptional<z.ZodString>;
216
+ context: z.ZodOptional<z.ZodString>;
217
+ cache_control: z.ZodOptional<z.ZodObject<{
218
+ type: z.ZodLiteral<"ephemeral">;
219
+ ttl: z.ZodOptional<z.ZodEnum<{
220
+ "5m": "5m";
221
+ "1h": "1h";
222
+ "24h": "24h";
223
+ }>>;
224
+ }, z.core.$strip>>;
225
+ }, z.core.$strip>], "type">>]>;
226
+ }, z.core.$strip>, z.ZodObject<{
227
+ role: z.ZodLiteral<"assistant">;
228
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
229
+ type: z.ZodLiteral<"text">;
230
+ text: z.ZodString;
231
+ cache_control: z.ZodOptional<z.ZodObject<{
232
+ type: z.ZodLiteral<"ephemeral">;
233
+ ttl: z.ZodOptional<z.ZodEnum<{
234
+ "5m": "5m";
235
+ "1h": "1h";
236
+ "24h": "24h";
237
+ }>>;
238
+ }, z.core.$strip>>;
239
+ }, z.core.$strip>, z.ZodObject<{
240
+ type: z.ZodLiteral<"tool_use">;
241
+ id: z.ZodString;
242
+ name: z.ZodString;
243
+ input: z.ZodAny;
244
+ caller: z.ZodOptional<z.ZodString>;
245
+ extra_content: z.ZodOptional<z.ZodType<import("@ai-sdk/provider").SharedV3ProviderMetadata, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").SharedV3ProviderMetadata, unknown>>>;
246
+ }, z.core.$strip>, z.ZodObject<{
247
+ type: z.ZodLiteral<"thinking">;
248
+ thinking: z.ZodString;
249
+ signature: z.ZodString;
250
+ }, z.core.$strip>, z.ZodObject<{
251
+ type: z.ZodLiteral<"redacted_thinking">;
252
+ data: z.ZodString;
253
+ }, z.core.$strip>], "type">>]>;
254
+ }, z.core.$strip>], "role">;
255
+ export type MessagesMessage = z.infer<typeof MessagesMessageSchema>;
256
+ declare const MessagesToolSchema: z.ZodObject<{
257
+ name: z.ZodString;
258
+ description: z.ZodOptional<z.ZodString>;
259
+ input_schema: z.ZodAny;
260
+ strict: z.ZodOptional<z.ZodBoolean>;
261
+ }, z.core.$strip>;
262
+ export type MessagesTool = z.infer<typeof MessagesToolSchema>;
263
+ declare const MessagesToolChoiceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
264
+ type: z.ZodLiteral<"auto">;
265
+ disable_parallel_tool_use: z.ZodOptional<z.ZodBoolean>;
266
+ }, z.core.$strip>, z.ZodObject<{
267
+ type: z.ZodLiteral<"any">;
268
+ disable_parallel_tool_use: z.ZodOptional<z.ZodBoolean>;
269
+ }, z.core.$strip>, z.ZodObject<{
270
+ type: z.ZodLiteral<"none">;
271
+ }, z.core.$strip>, z.ZodObject<{
272
+ type: z.ZodLiteral<"tool">;
273
+ name: z.ZodString;
274
+ disable_parallel_tool_use: z.ZodOptional<z.ZodBoolean>;
275
+ }, z.core.$strip>], "type">;
276
+ export type MessagesToolChoice = z.infer<typeof MessagesToolChoiceSchema>;
277
+ declare const MessagesThinkingConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
278
+ type: z.ZodLiteral<"enabled">;
279
+ budget_tokens: z.ZodNumber;
280
+ display: z.ZodOptional<z.ZodEnum<{
281
+ summarized: "summarized";
282
+ omitted: "omitted";
283
+ }>>;
284
+ }, z.core.$strip>, z.ZodObject<{
285
+ type: z.ZodLiteral<"disabled">;
286
+ }, z.core.$strip>, z.ZodObject<{
287
+ type: z.ZodLiteral<"adaptive">;
288
+ display: z.ZodOptional<z.ZodEnum<{
289
+ summarized: "summarized";
290
+ omitted: "omitted";
291
+ }>>;
292
+ }, z.core.$strip>], "type">;
293
+ export type MessagesThinkingConfig = z.infer<typeof MessagesThinkingConfigSchema>;
294
+ declare const MessagesServiceTierSchema: z.ZodEnum<{
295
+ auto: "auto";
296
+ standard_only: "standard_only";
297
+ }>;
298
+ export type MessagesServiceTier = z.infer<typeof MessagesServiceTierSchema>;
299
+ declare const MessagesOutputConfigSchema: z.ZodObject<{
300
+ format: z.ZodOptional<z.ZodObject<{
301
+ type: z.ZodLiteral<"json_schema">;
302
+ schema: z.ZodAny;
303
+ }, z.core.$strip>>;
304
+ effort: z.ZodOptional<z.ZodEnum<{
305
+ low: "low";
306
+ medium: "medium";
307
+ high: "high";
308
+ max: "max";
309
+ }>>;
310
+ }, z.core.$strip>;
311
+ export type MessagesOutputConfig = z.infer<typeof MessagesOutputConfigSchema>;
312
+ export declare const MessagesBodySchema: z.ZodObject<{
313
+ model: z.ZodString;
314
+ max_tokens: z.ZodNumber;
315
+ messages: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
316
+ role: z.ZodLiteral<"user">;
317
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
318
+ type: z.ZodLiteral<"text">;
319
+ text: z.ZodString;
320
+ cache_control: z.ZodOptional<z.ZodObject<{
321
+ type: z.ZodLiteral<"ephemeral">;
322
+ ttl: z.ZodOptional<z.ZodEnum<{
323
+ "5m": "5m";
324
+ "1h": "1h";
325
+ "24h": "24h";
326
+ }>>;
327
+ }, z.core.$strip>>;
328
+ }, z.core.$strip>, z.ZodObject<{
329
+ type: z.ZodLiteral<"image">;
330
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
331
+ type: z.ZodLiteral<"base64">;
332
+ media_type: z.ZodString;
333
+ data: z.ZodString;
334
+ }, z.core.$strip>, z.ZodObject<{
335
+ type: z.ZodLiteral<"url">;
336
+ url: z.ZodString;
337
+ }, z.core.$strip>], "type">;
338
+ cache_control: z.ZodOptional<z.ZodObject<{
339
+ type: z.ZodLiteral<"ephemeral">;
340
+ ttl: z.ZodOptional<z.ZodEnum<{
341
+ "5m": "5m";
342
+ "1h": "1h";
343
+ "24h": "24h";
344
+ }>>;
345
+ }, z.core.$strip>>;
346
+ }, z.core.$strip>, z.ZodObject<{
347
+ type: z.ZodLiteral<"tool_result">;
348
+ tool_use_id: z.ZodString;
349
+ content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
350
+ type: z.ZodLiteral<"text">;
351
+ text: z.ZodString;
352
+ cache_control: z.ZodOptional<z.ZodObject<{
353
+ type: z.ZodLiteral<"ephemeral">;
354
+ ttl: z.ZodOptional<z.ZodEnum<{
355
+ "5m": "5m";
356
+ "1h": "1h";
357
+ "24h": "24h";
358
+ }>>;
359
+ }, z.core.$strip>>;
360
+ }, z.core.$strip>, z.ZodObject<{
361
+ type: z.ZodLiteral<"image">;
362
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
363
+ type: z.ZodLiteral<"base64">;
364
+ media_type: z.ZodString;
365
+ data: z.ZodString;
366
+ }, z.core.$strip>, z.ZodObject<{
367
+ type: z.ZodLiteral<"url">;
368
+ url: z.ZodString;
369
+ }, z.core.$strip>], "type">;
370
+ cache_control: z.ZodOptional<z.ZodObject<{
371
+ type: z.ZodLiteral<"ephemeral">;
372
+ ttl: z.ZodOptional<z.ZodEnum<{
373
+ "5m": "5m";
374
+ "1h": "1h";
375
+ "24h": "24h";
376
+ }>>;
377
+ }, z.core.$strip>>;
378
+ }, z.core.$strip>]>>]>>;
379
+ is_error: z.ZodOptional<z.ZodBoolean>;
380
+ cache_control: z.ZodOptional<z.ZodObject<{
381
+ type: z.ZodLiteral<"ephemeral">;
382
+ ttl: z.ZodOptional<z.ZodEnum<{
383
+ "5m": "5m";
384
+ "1h": "1h";
385
+ "24h": "24h";
386
+ }>>;
387
+ }, z.core.$strip>>;
388
+ }, z.core.$strip>, z.ZodObject<{
389
+ type: z.ZodLiteral<"document">;
390
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
391
+ type: z.ZodLiteral<"base64">;
392
+ media_type: z.ZodString;
393
+ data: z.ZodString;
394
+ }, z.core.$strip>, z.ZodObject<{
395
+ type: z.ZodLiteral<"url">;
396
+ url: z.ZodString;
397
+ }, z.core.$strip>, z.ZodObject<{
398
+ type: z.ZodLiteral<"text">;
399
+ data: z.ZodString;
400
+ media_type: z.ZodLiteral<"text/plain">;
401
+ }, z.core.$strip>], "type">;
402
+ title: z.ZodOptional<z.ZodString>;
403
+ context: z.ZodOptional<z.ZodString>;
404
+ cache_control: z.ZodOptional<z.ZodObject<{
405
+ type: z.ZodLiteral<"ephemeral">;
406
+ ttl: z.ZodOptional<z.ZodEnum<{
407
+ "5m": "5m";
408
+ "1h": "1h";
409
+ "24h": "24h";
410
+ }>>;
411
+ }, z.core.$strip>>;
412
+ }, z.core.$strip>], "type">>]>;
413
+ }, z.core.$strip>, z.ZodObject<{
414
+ role: z.ZodLiteral<"assistant">;
415
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
416
+ type: z.ZodLiteral<"text">;
417
+ text: z.ZodString;
418
+ cache_control: z.ZodOptional<z.ZodObject<{
419
+ type: z.ZodLiteral<"ephemeral">;
420
+ ttl: z.ZodOptional<z.ZodEnum<{
421
+ "5m": "5m";
422
+ "1h": "1h";
423
+ "24h": "24h";
424
+ }>>;
425
+ }, z.core.$strip>>;
426
+ }, z.core.$strip>, z.ZodObject<{
427
+ type: z.ZodLiteral<"tool_use">;
428
+ id: z.ZodString;
429
+ name: z.ZodString;
430
+ input: z.ZodAny;
431
+ caller: z.ZodOptional<z.ZodString>;
432
+ extra_content: z.ZodOptional<z.ZodType<import("@ai-sdk/provider").SharedV3ProviderMetadata, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").SharedV3ProviderMetadata, unknown>>>;
433
+ }, z.core.$strip>, z.ZodObject<{
434
+ type: z.ZodLiteral<"thinking">;
435
+ thinking: z.ZodString;
436
+ signature: z.ZodString;
437
+ }, z.core.$strip>, z.ZodObject<{
438
+ type: z.ZodLiteral<"redacted_thinking">;
439
+ data: z.ZodString;
440
+ }, z.core.$strip>], "type">>]>;
441
+ }, z.core.$strip>], "role">>;
442
+ system: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
443
+ type: z.ZodLiteral<"text">;
444
+ text: z.ZodString;
445
+ cache_control: z.ZodOptional<z.ZodObject<{
446
+ type: z.ZodLiteral<"ephemeral">;
447
+ ttl: z.ZodOptional<z.ZodEnum<{
448
+ "5m": "5m";
449
+ "1h": "1h";
450
+ "24h": "24h";
451
+ }>>;
452
+ }, z.core.$strip>>;
453
+ }, z.core.$strip>>]>>;
454
+ stream: z.ZodOptional<z.ZodBoolean>;
455
+ temperature: z.ZodOptional<z.ZodNumber>;
456
+ top_p: z.ZodOptional<z.ZodNumber>;
457
+ stop_sequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
458
+ tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
459
+ name: z.ZodString;
460
+ description: z.ZodOptional<z.ZodString>;
461
+ input_schema: z.ZodAny;
462
+ strict: z.ZodOptional<z.ZodBoolean>;
463
+ }, z.core.$strip>>>;
464
+ tool_choice: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
465
+ type: z.ZodLiteral<"auto">;
466
+ disable_parallel_tool_use: z.ZodOptional<z.ZodBoolean>;
467
+ }, z.core.$strip>, z.ZodObject<{
468
+ type: z.ZodLiteral<"any">;
469
+ disable_parallel_tool_use: z.ZodOptional<z.ZodBoolean>;
470
+ }, z.core.$strip>, z.ZodObject<{
471
+ type: z.ZodLiteral<"none">;
472
+ }, z.core.$strip>, z.ZodObject<{
473
+ type: z.ZodLiteral<"tool">;
474
+ name: z.ZodString;
475
+ disable_parallel_tool_use: z.ZodOptional<z.ZodBoolean>;
476
+ }, z.core.$strip>], "type">>;
477
+ thinking: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
478
+ type: z.ZodLiteral<"enabled">;
479
+ budget_tokens: z.ZodNumber;
480
+ display: z.ZodOptional<z.ZodEnum<{
481
+ summarized: "summarized";
482
+ omitted: "omitted";
483
+ }>>;
484
+ }, z.core.$strip>, z.ZodObject<{
485
+ type: z.ZodLiteral<"disabled">;
486
+ }, z.core.$strip>, z.ZodObject<{
487
+ type: z.ZodLiteral<"adaptive">;
488
+ display: z.ZodOptional<z.ZodEnum<{
489
+ summarized: "summarized";
490
+ omitted: "omitted";
491
+ }>>;
492
+ }, z.core.$strip>], "type">>;
493
+ metadata: z.ZodOptional<z.ZodObject<{
494
+ user_id: z.ZodOptional<z.ZodString>;
495
+ }, z.core.$strip>>;
496
+ service_tier: z.ZodOptional<z.ZodEnum<{
497
+ auto: "auto";
498
+ standard_only: "standard_only";
499
+ }>>;
500
+ cache_control: z.ZodOptional<z.ZodObject<{
501
+ type: z.ZodLiteral<"ephemeral">;
502
+ ttl: z.ZodOptional<z.ZodEnum<{
503
+ "5m": "5m";
504
+ "1h": "1h";
505
+ "24h": "24h";
506
+ }>>;
507
+ }, z.core.$strip>>;
508
+ output_config: z.ZodOptional<z.ZodObject<{
509
+ format: z.ZodOptional<z.ZodObject<{
510
+ type: z.ZodLiteral<"json_schema">;
511
+ schema: z.ZodAny;
512
+ }, z.core.$strip>>;
513
+ effort: z.ZodOptional<z.ZodEnum<{
514
+ low: "low";
515
+ medium: "medium";
516
+ high: "high";
517
+ max: "max";
518
+ }>>;
519
+ }, z.core.$strip>>;
520
+ }, z.core.$strip>;
521
+ export type MessagesBody = z.infer<typeof MessagesBodySchema>;
522
+ export type MessagesInputs = Omit<MessagesBody, "model" | "stream">;
523
+ export type MessagesResponseContentBlock = {
524
+ type: "text";
525
+ text: string;
526
+ } | {
527
+ type: "tool_use";
528
+ id: string;
529
+ name: string;
530
+ input: unknown;
531
+ extra_content?: ProviderMetadata;
532
+ } | {
533
+ type: "thinking";
534
+ thinking: string;
535
+ signature: string;
536
+ } | {
537
+ type: "redacted_thinking";
538
+ data: string;
539
+ };
540
+ export type MessagesUsage = {
541
+ input_tokens: number;
542
+ output_tokens: number;
543
+ cache_creation_input_tokens?: number;
544
+ cache_read_input_tokens?: number;
545
+ };
546
+ export type MessagesStopReason = "end_turn" | "max_tokens" | "stop_sequence" | "tool_use" | null;
547
+ export type Messages = {
548
+ id: string;
549
+ type: "message";
550
+ role: "assistant";
551
+ content: MessagesResponseContentBlock[];
552
+ model: string;
553
+ stop_reason: MessagesStopReason;
554
+ stop_sequence: string | null;
555
+ usage: MessagesUsage;
556
+ service_tier?: MessagesServiceTier;
557
+ };
558
+ export type MessageStartEvent = SseFrame<{
559
+ type: "message_start";
560
+ message: Messages;
561
+ }, "message_start">;
562
+ export type ContentBlockStartEvent = SseFrame<{
563
+ type: "content_block_start";
564
+ index: number;
565
+ content_block: {
566
+ type: "text";
567
+ text: string;
568
+ } | {
569
+ type: "thinking";
570
+ thinking: string;
571
+ } | {
572
+ type: "tool_use";
573
+ id: string;
574
+ name: string;
575
+ input: Record<string, never>;
576
+ extra_content?: ProviderMetadata;
577
+ };
578
+ }, "content_block_start">;
579
+ export type ContentBlockDeltaEvent = SseFrame<{
580
+ type: "content_block_delta";
581
+ index: number;
582
+ delta: {
583
+ type: "text_delta";
584
+ text: string;
585
+ } | {
586
+ type: "thinking_delta";
587
+ thinking: string;
588
+ } | {
589
+ type: "signature_delta";
590
+ signature: string;
591
+ } | {
592
+ type: "input_json_delta";
593
+ partial_json: string;
594
+ };
595
+ }, "content_block_delta">;
596
+ export type ContentBlockStopEvent = SseFrame<{
597
+ type: "content_block_stop";
598
+ index: number;
599
+ }, "content_block_stop">;
600
+ export type MessageDeltaEvent = SseFrame<{
601
+ type: "message_delta";
602
+ delta: {
603
+ stop_reason: MessagesStopReason;
604
+ stop_sequence: string | null;
605
+ };
606
+ usage: {
607
+ output_tokens: number;
608
+ input_tokens?: number;
609
+ };
610
+ }, "message_delta">;
611
+ export type MessageStopEvent = SseFrame<{
612
+ type: "message_stop";
613
+ }, "message_stop">;
614
+ export type MessageErrorEvent = SseFrame<{
615
+ type: "error";
616
+ error: {
617
+ type: string;
618
+ message: string;
619
+ };
620
+ }, "error">;
621
+ export type MessagesStreamEvent = MessageStartEvent | ContentBlockStartEvent | ContentBlockDeltaEvent | ContentBlockStopEvent | MessageDeltaEvent | MessageStopEvent | MessageErrorEvent;
622
+ export type MessagesStream = ReadableStream<MessagesStreamEvent>;
623
+ export {};