@convex-dev/agent 0.3.2 → 0.6.0-alpha.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 (99) hide show
  1. package/dist/UIMessages.d.ts +3 -2
  2. package/dist/UIMessages.d.ts.map +1 -1
  3. package/dist/UIMessages.js +100 -19
  4. package/dist/UIMessages.js.map +1 -1
  5. package/dist/client/createTool.d.ts +129 -25
  6. package/dist/client/createTool.d.ts.map +1 -1
  7. package/dist/client/createTool.js +65 -8
  8. package/dist/client/createTool.js.map +1 -1
  9. package/dist/client/definePlaygroundAPI.d.ts +560 -35
  10. package/dist/client/definePlaygroundAPI.d.ts.map +1 -1
  11. package/dist/client/files.d.ts.map +1 -1
  12. package/dist/client/files.js +4 -2
  13. package/dist/client/files.js.map +1 -1
  14. package/dist/client/index.d.ts +462 -37
  15. package/dist/client/index.d.ts.map +1 -1
  16. package/dist/client/index.js +26 -7
  17. package/dist/client/index.js.map +1 -1
  18. package/dist/client/messages.d.ts +114 -9
  19. package/dist/client/messages.d.ts.map +1 -1
  20. package/dist/client/mockModel.d.ts +17 -17
  21. package/dist/client/mockModel.d.ts.map +1 -1
  22. package/dist/client/mockModel.js +8 -6
  23. package/dist/client/mockModel.js.map +1 -1
  24. package/dist/client/saveInputMessages.d.ts +1 -1
  25. package/dist/client/saveInputMessages.d.ts.map +1 -1
  26. package/dist/client/saveInputMessages.js +1 -1
  27. package/dist/client/saveInputMessages.js.map +1 -1
  28. package/dist/client/search.d.ts +132 -14
  29. package/dist/client/search.d.ts.map +1 -1
  30. package/dist/client/search.js +66 -19
  31. package/dist/client/search.js.map +1 -1
  32. package/dist/client/streamText.d.ts +4 -4
  33. package/dist/client/streamText.d.ts.map +1 -1
  34. package/dist/client/streamText.js.map +1 -1
  35. package/dist/client/streaming.d.ts +1491 -87
  36. package/dist/client/streaming.d.ts.map +1 -1
  37. package/dist/client/types.d.ts +26 -6
  38. package/dist/client/types.d.ts.map +1 -1
  39. package/dist/component/_generated/component.d.ts +862 -19
  40. package/dist/component/_generated/component.d.ts.map +1 -1
  41. package/dist/component/files.d.ts +12 -6
  42. package/dist/component/files.d.ts.map +1 -1
  43. package/dist/component/files.js +10 -2
  44. package/dist/component/files.js.map +1 -1
  45. package/dist/component/messages.d.ts +1247 -92
  46. package/dist/component/messages.d.ts.map +1 -1
  47. package/dist/component/schema.d.ts +2823 -217
  48. package/dist/component/schema.d.ts.map +1 -1
  49. package/dist/component/schema.js +3 -1
  50. package/dist/component/schema.js.map +1 -1
  51. package/dist/component/streams.js +1 -1
  52. package/dist/component/streams.js.map +1 -1
  53. package/dist/component/threads.d.ts +10 -10
  54. package/dist/component/vector/index.d.ts +1 -1
  55. package/dist/deltas.d.ts.map +1 -1
  56. package/dist/deltas.js +40 -5
  57. package/dist/deltas.js.map +1 -1
  58. package/dist/mapping.d.ts.map +1 -1
  59. package/dist/mapping.js +117 -25
  60. package/dist/mapping.js.map +1 -1
  61. package/dist/react/useThreadMessages.d.ts.map +1 -1
  62. package/dist/react/useThreadMessages.js +17 -9
  63. package/dist/react/useThreadMessages.js.map +1 -1
  64. package/dist/shared.d.ts +2 -2
  65. package/dist/shared.d.ts.map +1 -1
  66. package/dist/shared.js.map +1 -1
  67. package/dist/validators.d.ts +12196 -624
  68. package/dist/validators.d.ts.map +1 -1
  69. package/dist/validators.js +152 -9
  70. package/dist/validators.js.map +1 -1
  71. package/package.json +24 -22
  72. package/src/UIMessages.combineUIMessages.test.ts +239 -0
  73. package/src/UIMessages.ts +184 -66
  74. package/src/client/createTool.ts +291 -67
  75. package/src/client/files.ts +4 -2
  76. package/src/client/index.test.ts +1 -0
  77. package/src/client/index.ts +46 -25
  78. package/src/client/mockModel.ts +36 -34
  79. package/src/client/saveInputMessages.ts +2 -2
  80. package/src/client/search.test.ts +166 -0
  81. package/src/client/search.ts +121 -38
  82. package/src/client/streamText.ts +5 -5
  83. package/src/client/types.ts +31 -18
  84. package/src/component/_generated/component.ts +2329 -338
  85. package/src/component/files.ts +11 -2
  86. package/src/component/messages.test.ts +7 -7
  87. package/src/component/schema.ts +3 -1
  88. package/src/component/setup.test.ts +7 -0
  89. package/src/component/streams.ts +1 -1
  90. package/src/deltas.test.ts +90 -0
  91. package/src/deltas.ts +47 -8
  92. package/src/fromUIMessages.test.ts +32 -27
  93. package/src/mapping.test.ts +48 -0
  94. package/src/mapping.ts +234 -142
  95. package/src/react/useThreadMessages.ts +21 -9
  96. package/src/shared.ts +2 -0
  97. package/src/toUIMessages.test.ts +539 -1
  98. package/src/validators.ts +179 -20
  99. package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
@@ -35,7 +35,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
35
35
  addFile: FunctionReference<"mutation", "internal", {
36
36
  filename?: string;
37
37
  hash: string;
38
- mimeType: string;
38
+ mediaType?: string;
39
+ mimeType?: string;
39
40
  storageId: string;
40
41
  }, {
41
42
  fileId: string;
@@ -56,7 +57,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
56
57
  filename?: string;
57
58
  hash: string;
58
59
  lastTouchedAt: number;
59
- mimeType: string;
60
+ mediaType?: string;
61
+ mimeType?: string;
60
62
  refcount: number;
61
63
  storageId: string;
62
64
  }, Name>;
@@ -78,7 +80,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
78
80
  filename?: string;
79
81
  hash: string;
80
82
  lastTouchedAt: number;
81
- mimeType: string;
83
+ mediaType?: string;
84
+ mimeType?: string;
82
85
  refcount: number;
83
86
  storageId: string;
84
87
  }>;
@@ -113,13 +116,15 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
113
116
  type: "text";
114
117
  } | {
115
118
  image: string | ArrayBuffer;
119
+ mediaType?: string;
116
120
  mimeType?: string;
117
121
  providerOptions?: Record<string, Record<string, any>>;
118
122
  type: "image";
119
123
  } | {
120
124
  data: string | ArrayBuffer;
121
125
  filename?: string;
122
- mimeType: string;
126
+ mediaType?: string;
127
+ mimeType?: string;
123
128
  providerMetadata?: Record<string, Record<string, any>>;
124
129
  providerOptions?: Record<string, Record<string, any>>;
125
130
  type: "file";
@@ -135,7 +140,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
135
140
  } | {
136
141
  data: string | ArrayBuffer;
137
142
  filename?: string;
138
- mimeType: string;
143
+ mediaType?: string;
144
+ mimeType?: string;
139
145
  providerMetadata?: Record<string, Record<string, any>>;
140
146
  providerOptions?: Record<string, Record<string, any>>;
141
147
  type: "file";
@@ -150,8 +156,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
150
156
  providerMetadata?: Record<string, Record<string, any>>;
151
157
  providerOptions?: Record<string, Record<string, any>>;
152
158
  type: "redacted-reasoning";
159
+ } | {
160
+ args?: any;
161
+ input: any;
162
+ providerExecuted?: boolean;
163
+ providerMetadata?: Record<string, Record<string, any>>;
164
+ providerOptions?: Record<string, Record<string, any>>;
165
+ toolCallId: string;
166
+ toolName: string;
167
+ type: "tool-call";
153
168
  } | {
154
169
  args: any;
170
+ input?: any;
155
171
  providerExecuted?: boolean;
156
172
  providerMetadata?: Record<string, Record<string, any>>;
157
173
  providerOptions?: Record<string, Record<string, any>>;
@@ -170,26 +186,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
170
186
  }>;
171
187
  isError?: boolean;
172
188
  output?: {
189
+ providerOptions?: Record<string, Record<string, any>>;
173
190
  type: "text";
174
191
  value: string;
175
192
  } | {
193
+ providerOptions?: Record<string, Record<string, any>>;
176
194
  type: "json";
177
195
  value: any;
178
196
  } | {
197
+ providerOptions?: Record<string, Record<string, any>>;
179
198
  type: "error-text";
180
199
  value: string;
181
200
  } | {
201
+ providerOptions?: Record<string, Record<string, any>>;
182
202
  type: "error-json";
183
203
  value: any;
204
+ } | {
205
+ providerOptions?: Record<string, Record<string, any>>;
206
+ reason?: string;
207
+ type: "execution-denied";
184
208
  } | {
185
209
  type: "content";
186
210
  value: Array<{
211
+ providerOptions?: Record<string, Record<string, any>>;
187
212
  text: string;
188
213
  type: "text";
189
214
  } | {
190
215
  data: string;
191
216
  mediaType: string;
192
217
  type: "media";
218
+ } | {
219
+ data: string;
220
+ filename?: string;
221
+ mediaType: string;
222
+ providerOptions?: Record<string, Record<string, any>>;
223
+ type: "file-data";
224
+ } | {
225
+ providerOptions?: Record<string, Record<string, any>>;
226
+ type: "file-url";
227
+ url: string;
228
+ } | {
229
+ fileId: string | Record<string, string>;
230
+ providerOptions?: Record<string, Record<string, any>>;
231
+ type: "file-id";
232
+ } | {
233
+ data: string;
234
+ mediaType: string;
235
+ providerOptions?: Record<string, Record<string, any>>;
236
+ type: "image-data";
237
+ } | {
238
+ providerOptions?: Record<string, Record<string, any>>;
239
+ type: "image-url";
240
+ url: string;
241
+ } | {
242
+ fileId: string | Record<string, string>;
243
+ providerOptions?: Record<string, Record<string, any>>;
244
+ type: "image-file-id";
245
+ } | {
246
+ providerOptions?: Record<string, Record<string, any>>;
247
+ type: "custom";
193
248
  }>;
194
249
  };
195
250
  providerExecuted?: boolean;
@@ -216,6 +271,12 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
216
271
  sourceType: "document";
217
272
  title: string;
218
273
  type: "source";
274
+ } | {
275
+ approvalId: string;
276
+ providerMetadata?: Record<string, Record<string, any>>;
277
+ providerOptions?: Record<string, Record<string, any>>;
278
+ toolCallId: string;
279
+ type: "tool-approval-request";
219
280
  }>;
220
281
  providerOptions?: Record<string, Record<string, any>>;
221
282
  role: "assistant";
@@ -232,26 +293,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
232
293
  }>;
233
294
  isError?: boolean;
234
295
  output?: {
296
+ providerOptions?: Record<string, Record<string, any>>;
235
297
  type: "text";
236
298
  value: string;
237
299
  } | {
300
+ providerOptions?: Record<string, Record<string, any>>;
238
301
  type: "json";
239
302
  value: any;
240
303
  } | {
304
+ providerOptions?: Record<string, Record<string, any>>;
241
305
  type: "error-text";
242
306
  value: string;
243
307
  } | {
308
+ providerOptions?: Record<string, Record<string, any>>;
244
309
  type: "error-json";
245
310
  value: any;
311
+ } | {
312
+ providerOptions?: Record<string, Record<string, any>>;
313
+ reason?: string;
314
+ type: "execution-denied";
246
315
  } | {
247
316
  type: "content";
248
317
  value: Array<{
318
+ providerOptions?: Record<string, Record<string, any>>;
249
319
  text: string;
250
320
  type: "text";
251
321
  } | {
252
322
  data: string;
253
323
  mediaType: string;
254
324
  type: "media";
325
+ } | {
326
+ data: string;
327
+ filename?: string;
328
+ mediaType: string;
329
+ providerOptions?: Record<string, Record<string, any>>;
330
+ type: "file-data";
331
+ } | {
332
+ providerOptions?: Record<string, Record<string, any>>;
333
+ type: "file-url";
334
+ url: string;
335
+ } | {
336
+ fileId: string | Record<string, string>;
337
+ providerOptions?: Record<string, Record<string, any>>;
338
+ type: "file-id";
339
+ } | {
340
+ data: string;
341
+ mediaType: string;
342
+ providerOptions?: Record<string, Record<string, any>>;
343
+ type: "image-data";
344
+ } | {
345
+ providerOptions?: Record<string, Record<string, any>>;
346
+ type: "image-url";
347
+ url: string;
348
+ } | {
349
+ fileId: string | Record<string, string>;
350
+ providerOptions?: Record<string, Record<string, any>>;
351
+ type: "image-file-id";
352
+ } | {
353
+ providerOptions?: Record<string, Record<string, any>>;
354
+ type: "custom";
255
355
  }>;
256
356
  };
257
357
  providerExecuted?: boolean;
@@ -261,6 +361,14 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
261
361
  toolCallId: string;
262
362
  toolName: string;
263
363
  type: "tool-result";
364
+ } | {
365
+ approvalId: string;
366
+ approved: boolean;
367
+ providerExecuted?: boolean;
368
+ providerMetadata?: Record<string, Record<string, any>>;
369
+ providerOptions?: Record<string, Record<string, any>>;
370
+ reason?: string;
371
+ type: "tool-approval-response";
264
372
  }>;
265
373
  providerOptions?: Record<string, Record<string, any>>;
266
374
  role: "tool";
@@ -349,13 +457,15 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
349
457
  type: "text";
350
458
  } | {
351
459
  image: string | ArrayBuffer;
460
+ mediaType?: string;
352
461
  mimeType?: string;
353
462
  providerOptions?: Record<string, Record<string, any>>;
354
463
  type: "image";
355
464
  } | {
356
465
  data: string | ArrayBuffer;
357
466
  filename?: string;
358
- mimeType: string;
467
+ mediaType?: string;
468
+ mimeType?: string;
359
469
  providerMetadata?: Record<string, Record<string, any>>;
360
470
  providerOptions?: Record<string, Record<string, any>>;
361
471
  type: "file";
@@ -371,7 +481,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
371
481
  } | {
372
482
  data: string | ArrayBuffer;
373
483
  filename?: string;
374
- mimeType: string;
484
+ mediaType?: string;
485
+ mimeType?: string;
375
486
  providerMetadata?: Record<string, Record<string, any>>;
376
487
  providerOptions?: Record<string, Record<string, any>>;
377
488
  type: "file";
@@ -386,8 +497,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
386
497
  providerMetadata?: Record<string, Record<string, any>>;
387
498
  providerOptions?: Record<string, Record<string, any>>;
388
499
  type: "redacted-reasoning";
500
+ } | {
501
+ args?: any;
502
+ input: any;
503
+ providerExecuted?: boolean;
504
+ providerMetadata?: Record<string, Record<string, any>>;
505
+ providerOptions?: Record<string, Record<string, any>>;
506
+ toolCallId: string;
507
+ toolName: string;
508
+ type: "tool-call";
389
509
  } | {
390
510
  args: any;
511
+ input?: any;
391
512
  providerExecuted?: boolean;
392
513
  providerMetadata?: Record<string, Record<string, any>>;
393
514
  providerOptions?: Record<string, Record<string, any>>;
@@ -406,26 +527,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
406
527
  }>;
407
528
  isError?: boolean;
408
529
  output?: {
530
+ providerOptions?: Record<string, Record<string, any>>;
409
531
  type: "text";
410
532
  value: string;
411
533
  } | {
534
+ providerOptions?: Record<string, Record<string, any>>;
412
535
  type: "json";
413
536
  value: any;
414
537
  } | {
538
+ providerOptions?: Record<string, Record<string, any>>;
415
539
  type: "error-text";
416
540
  value: string;
417
541
  } | {
542
+ providerOptions?: Record<string, Record<string, any>>;
418
543
  type: "error-json";
419
544
  value: any;
545
+ } | {
546
+ providerOptions?: Record<string, Record<string, any>>;
547
+ reason?: string;
548
+ type: "execution-denied";
420
549
  } | {
421
550
  type: "content";
422
551
  value: Array<{
552
+ providerOptions?: Record<string, Record<string, any>>;
423
553
  text: string;
424
554
  type: "text";
425
555
  } | {
426
556
  data: string;
427
557
  mediaType: string;
428
558
  type: "media";
559
+ } | {
560
+ data: string;
561
+ filename?: string;
562
+ mediaType: string;
563
+ providerOptions?: Record<string, Record<string, any>>;
564
+ type: "file-data";
565
+ } | {
566
+ providerOptions?: Record<string, Record<string, any>>;
567
+ type: "file-url";
568
+ url: string;
569
+ } | {
570
+ fileId: string | Record<string, string>;
571
+ providerOptions?: Record<string, Record<string, any>>;
572
+ type: "file-id";
573
+ } | {
574
+ data: string;
575
+ mediaType: string;
576
+ providerOptions?: Record<string, Record<string, any>>;
577
+ type: "image-data";
578
+ } | {
579
+ providerOptions?: Record<string, Record<string, any>>;
580
+ type: "image-url";
581
+ url: string;
582
+ } | {
583
+ fileId: string | Record<string, string>;
584
+ providerOptions?: Record<string, Record<string, any>>;
585
+ type: "image-file-id";
586
+ } | {
587
+ providerOptions?: Record<string, Record<string, any>>;
588
+ type: "custom";
429
589
  }>;
430
590
  };
431
591
  providerExecuted?: boolean;
@@ -452,6 +612,12 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
452
612
  sourceType: "document";
453
613
  title: string;
454
614
  type: "source";
615
+ } | {
616
+ approvalId: string;
617
+ providerMetadata?: Record<string, Record<string, any>>;
618
+ providerOptions?: Record<string, Record<string, any>>;
619
+ toolCallId: string;
620
+ type: "tool-approval-request";
455
621
  }>;
456
622
  providerOptions?: Record<string, Record<string, any>>;
457
623
  role: "assistant";
@@ -468,26 +634,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
468
634
  }>;
469
635
  isError?: boolean;
470
636
  output?: {
637
+ providerOptions?: Record<string, Record<string, any>>;
471
638
  type: "text";
472
639
  value: string;
473
640
  } | {
641
+ providerOptions?: Record<string, Record<string, any>>;
474
642
  type: "json";
475
643
  value: any;
476
644
  } | {
645
+ providerOptions?: Record<string, Record<string, any>>;
477
646
  type: "error-text";
478
647
  value: string;
479
648
  } | {
649
+ providerOptions?: Record<string, Record<string, any>>;
480
650
  type: "error-json";
481
651
  value: any;
652
+ } | {
653
+ providerOptions?: Record<string, Record<string, any>>;
654
+ reason?: string;
655
+ type: "execution-denied";
482
656
  } | {
483
657
  type: "content";
484
658
  value: Array<{
659
+ providerOptions?: Record<string, Record<string, any>>;
485
660
  text: string;
486
661
  type: "text";
487
662
  } | {
488
663
  data: string;
489
664
  mediaType: string;
490
665
  type: "media";
666
+ } | {
667
+ data: string;
668
+ filename?: string;
669
+ mediaType: string;
670
+ providerOptions?: Record<string, Record<string, any>>;
671
+ type: "file-data";
672
+ } | {
673
+ providerOptions?: Record<string, Record<string, any>>;
674
+ type: "file-url";
675
+ url: string;
676
+ } | {
677
+ fileId: string | Record<string, string>;
678
+ providerOptions?: Record<string, Record<string, any>>;
679
+ type: "file-id";
680
+ } | {
681
+ data: string;
682
+ mediaType: string;
683
+ providerOptions?: Record<string, Record<string, any>>;
684
+ type: "image-data";
685
+ } | {
686
+ providerOptions?: Record<string, Record<string, any>>;
687
+ type: "image-url";
688
+ url: string;
689
+ } | {
690
+ fileId: string | Record<string, string>;
691
+ providerOptions?: Record<string, Record<string, any>>;
692
+ type: "image-file-id";
693
+ } | {
694
+ providerOptions?: Record<string, Record<string, any>>;
695
+ type: "custom";
491
696
  }>;
492
697
  };
493
698
  providerExecuted?: boolean;
@@ -497,6 +702,14 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
497
702
  toolCallId: string;
498
703
  toolName: string;
499
704
  type: "tool-result";
705
+ } | {
706
+ approvalId: string;
707
+ approved: boolean;
708
+ providerExecuted?: boolean;
709
+ providerMetadata?: Record<string, Record<string, any>>;
710
+ providerOptions?: Record<string, Record<string, any>>;
711
+ reason?: string;
712
+ type: "tool-approval-response";
500
713
  }>;
501
714
  providerOptions?: Record<string, Record<string, any>>;
502
715
  role: "tool";
@@ -623,13 +836,15 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
623
836
  type: "text";
624
837
  } | {
625
838
  image: string | ArrayBuffer;
839
+ mediaType?: string;
626
840
  mimeType?: string;
627
841
  providerOptions?: Record<string, Record<string, any>>;
628
842
  type: "image";
629
843
  } | {
630
844
  data: string | ArrayBuffer;
631
845
  filename?: string;
632
- mimeType: string;
846
+ mediaType?: string;
847
+ mimeType?: string;
633
848
  providerMetadata?: Record<string, Record<string, any>>;
634
849
  providerOptions?: Record<string, Record<string, any>>;
635
850
  type: "file";
@@ -645,7 +860,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
645
860
  } | {
646
861
  data: string | ArrayBuffer;
647
862
  filename?: string;
648
- mimeType: string;
863
+ mediaType?: string;
864
+ mimeType?: string;
649
865
  providerMetadata?: Record<string, Record<string, any>>;
650
866
  providerOptions?: Record<string, Record<string, any>>;
651
867
  type: "file";
@@ -660,8 +876,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
660
876
  providerMetadata?: Record<string, Record<string, any>>;
661
877
  providerOptions?: Record<string, Record<string, any>>;
662
878
  type: "redacted-reasoning";
879
+ } | {
880
+ args?: any;
881
+ input: any;
882
+ providerExecuted?: boolean;
883
+ providerMetadata?: Record<string, Record<string, any>>;
884
+ providerOptions?: Record<string, Record<string, any>>;
885
+ toolCallId: string;
886
+ toolName: string;
887
+ type: "tool-call";
663
888
  } | {
664
889
  args: any;
890
+ input?: any;
665
891
  providerExecuted?: boolean;
666
892
  providerMetadata?: Record<string, Record<string, any>>;
667
893
  providerOptions?: Record<string, Record<string, any>>;
@@ -680,26 +906,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
680
906
  }>;
681
907
  isError?: boolean;
682
908
  output?: {
909
+ providerOptions?: Record<string, Record<string, any>>;
683
910
  type: "text";
684
911
  value: string;
685
912
  } | {
913
+ providerOptions?: Record<string, Record<string, any>>;
686
914
  type: "json";
687
915
  value: any;
688
916
  } | {
917
+ providerOptions?: Record<string, Record<string, any>>;
689
918
  type: "error-text";
690
919
  value: string;
691
920
  } | {
921
+ providerOptions?: Record<string, Record<string, any>>;
692
922
  type: "error-json";
693
923
  value: any;
924
+ } | {
925
+ providerOptions?: Record<string, Record<string, any>>;
926
+ reason?: string;
927
+ type: "execution-denied";
694
928
  } | {
695
929
  type: "content";
696
930
  value: Array<{
931
+ providerOptions?: Record<string, Record<string, any>>;
697
932
  text: string;
698
933
  type: "text";
699
934
  } | {
700
935
  data: string;
701
936
  mediaType: string;
702
937
  type: "media";
938
+ } | {
939
+ data: string;
940
+ filename?: string;
941
+ mediaType: string;
942
+ providerOptions?: Record<string, Record<string, any>>;
943
+ type: "file-data";
944
+ } | {
945
+ providerOptions?: Record<string, Record<string, any>>;
946
+ type: "file-url";
947
+ url: string;
948
+ } | {
949
+ fileId: string | Record<string, string>;
950
+ providerOptions?: Record<string, Record<string, any>>;
951
+ type: "file-id";
952
+ } | {
953
+ data: string;
954
+ mediaType: string;
955
+ providerOptions?: Record<string, Record<string, any>>;
956
+ type: "image-data";
957
+ } | {
958
+ providerOptions?: Record<string, Record<string, any>>;
959
+ type: "image-url";
960
+ url: string;
961
+ } | {
962
+ fileId: string | Record<string, string>;
963
+ providerOptions?: Record<string, Record<string, any>>;
964
+ type: "image-file-id";
965
+ } | {
966
+ providerOptions?: Record<string, Record<string, any>>;
967
+ type: "custom";
703
968
  }>;
704
969
  };
705
970
  providerExecuted?: boolean;
@@ -726,6 +991,12 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
726
991
  sourceType: "document";
727
992
  title: string;
728
993
  type: "source";
994
+ } | {
995
+ approvalId: string;
996
+ providerMetadata?: Record<string, Record<string, any>>;
997
+ providerOptions?: Record<string, Record<string, any>>;
998
+ toolCallId: string;
999
+ type: "tool-approval-request";
729
1000
  }>;
730
1001
  providerOptions?: Record<string, Record<string, any>>;
731
1002
  role: "assistant";
@@ -742,26 +1013,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
742
1013
  }>;
743
1014
  isError?: boolean;
744
1015
  output?: {
1016
+ providerOptions?: Record<string, Record<string, any>>;
745
1017
  type: "text";
746
1018
  value: string;
747
1019
  } | {
1020
+ providerOptions?: Record<string, Record<string, any>>;
748
1021
  type: "json";
749
1022
  value: any;
750
1023
  } | {
1024
+ providerOptions?: Record<string, Record<string, any>>;
751
1025
  type: "error-text";
752
1026
  value: string;
753
1027
  } | {
1028
+ providerOptions?: Record<string, Record<string, any>>;
754
1029
  type: "error-json";
755
1030
  value: any;
1031
+ } | {
1032
+ providerOptions?: Record<string, Record<string, any>>;
1033
+ reason?: string;
1034
+ type: "execution-denied";
756
1035
  } | {
757
1036
  type: "content";
758
1037
  value: Array<{
1038
+ providerOptions?: Record<string, Record<string, any>>;
759
1039
  text: string;
760
1040
  type: "text";
761
1041
  } | {
762
1042
  data: string;
763
1043
  mediaType: string;
764
1044
  type: "media";
1045
+ } | {
1046
+ data: string;
1047
+ filename?: string;
1048
+ mediaType: string;
1049
+ providerOptions?: Record<string, Record<string, any>>;
1050
+ type: "file-data";
1051
+ } | {
1052
+ providerOptions?: Record<string, Record<string, any>>;
1053
+ type: "file-url";
1054
+ url: string;
1055
+ } | {
1056
+ fileId: string | Record<string, string>;
1057
+ providerOptions?: Record<string, Record<string, any>>;
1058
+ type: "file-id";
1059
+ } | {
1060
+ data: string;
1061
+ mediaType: string;
1062
+ providerOptions?: Record<string, Record<string, any>>;
1063
+ type: "image-data";
1064
+ } | {
1065
+ providerOptions?: Record<string, Record<string, any>>;
1066
+ type: "image-url";
1067
+ url: string;
1068
+ } | {
1069
+ fileId: string | Record<string, string>;
1070
+ providerOptions?: Record<string, Record<string, any>>;
1071
+ type: "image-file-id";
1072
+ } | {
1073
+ providerOptions?: Record<string, Record<string, any>>;
1074
+ type: "custom";
765
1075
  }>;
766
1076
  };
767
1077
  providerExecuted?: boolean;
@@ -771,6 +1081,14 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
771
1081
  toolCallId: string;
772
1082
  toolName: string;
773
1083
  type: "tool-result";
1084
+ } | {
1085
+ approvalId: string;
1086
+ approved: boolean;
1087
+ providerExecuted?: boolean;
1088
+ providerMetadata?: Record<string, Record<string, any>>;
1089
+ providerOptions?: Record<string, Record<string, any>>;
1090
+ reason?: string;
1091
+ type: "tool-approval-response";
774
1092
  }>;
775
1093
  providerOptions?: Record<string, Record<string, any>>;
776
1094
  role: "tool";
@@ -884,13 +1202,15 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
884
1202
  type: "text";
885
1203
  } | {
886
1204
  image: string | ArrayBuffer;
1205
+ mediaType?: string;
887
1206
  mimeType?: string;
888
1207
  providerOptions?: Record<string, Record<string, any>>;
889
1208
  type: "image";
890
1209
  } | {
891
1210
  data: string | ArrayBuffer;
892
1211
  filename?: string;
893
- mimeType: string;
1212
+ mediaType?: string;
1213
+ mimeType?: string;
894
1214
  providerMetadata?: Record<string, Record<string, any>>;
895
1215
  providerOptions?: Record<string, Record<string, any>>;
896
1216
  type: "file";
@@ -906,7 +1226,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
906
1226
  } | {
907
1227
  data: string | ArrayBuffer;
908
1228
  filename?: string;
909
- mimeType: string;
1229
+ mediaType?: string;
1230
+ mimeType?: string;
910
1231
  providerMetadata?: Record<string, Record<string, any>>;
911
1232
  providerOptions?: Record<string, Record<string, any>>;
912
1233
  type: "file";
@@ -921,8 +1242,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
921
1242
  providerMetadata?: Record<string, Record<string, any>>;
922
1243
  providerOptions?: Record<string, Record<string, any>>;
923
1244
  type: "redacted-reasoning";
1245
+ } | {
1246
+ args?: any;
1247
+ input: any;
1248
+ providerExecuted?: boolean;
1249
+ providerMetadata?: Record<string, Record<string, any>>;
1250
+ providerOptions?: Record<string, Record<string, any>>;
1251
+ toolCallId: string;
1252
+ toolName: string;
1253
+ type: "tool-call";
924
1254
  } | {
925
1255
  args: any;
1256
+ input?: any;
926
1257
  providerExecuted?: boolean;
927
1258
  providerMetadata?: Record<string, Record<string, any>>;
928
1259
  providerOptions?: Record<string, Record<string, any>>;
@@ -941,26 +1272,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
941
1272
  }>;
942
1273
  isError?: boolean;
943
1274
  output?: {
1275
+ providerOptions?: Record<string, Record<string, any>>;
944
1276
  type: "text";
945
1277
  value: string;
946
1278
  } | {
1279
+ providerOptions?: Record<string, Record<string, any>>;
947
1280
  type: "json";
948
1281
  value: any;
949
1282
  } | {
1283
+ providerOptions?: Record<string, Record<string, any>>;
950
1284
  type: "error-text";
951
1285
  value: string;
952
1286
  } | {
1287
+ providerOptions?: Record<string, Record<string, any>>;
953
1288
  type: "error-json";
954
1289
  value: any;
1290
+ } | {
1291
+ providerOptions?: Record<string, Record<string, any>>;
1292
+ reason?: string;
1293
+ type: "execution-denied";
955
1294
  } | {
956
1295
  type: "content";
957
1296
  value: Array<{
1297
+ providerOptions?: Record<string, Record<string, any>>;
958
1298
  text: string;
959
1299
  type: "text";
960
1300
  } | {
961
1301
  data: string;
962
1302
  mediaType: string;
963
1303
  type: "media";
1304
+ } | {
1305
+ data: string;
1306
+ filename?: string;
1307
+ mediaType: string;
1308
+ providerOptions?: Record<string, Record<string, any>>;
1309
+ type: "file-data";
1310
+ } | {
1311
+ providerOptions?: Record<string, Record<string, any>>;
1312
+ type: "file-url";
1313
+ url: string;
1314
+ } | {
1315
+ fileId: string | Record<string, string>;
1316
+ providerOptions?: Record<string, Record<string, any>>;
1317
+ type: "file-id";
1318
+ } | {
1319
+ data: string;
1320
+ mediaType: string;
1321
+ providerOptions?: Record<string, Record<string, any>>;
1322
+ type: "image-data";
1323
+ } | {
1324
+ providerOptions?: Record<string, Record<string, any>>;
1325
+ type: "image-url";
1326
+ url: string;
1327
+ } | {
1328
+ fileId: string | Record<string, string>;
1329
+ providerOptions?: Record<string, Record<string, any>>;
1330
+ type: "image-file-id";
1331
+ } | {
1332
+ providerOptions?: Record<string, Record<string, any>>;
1333
+ type: "custom";
964
1334
  }>;
965
1335
  };
966
1336
  providerExecuted?: boolean;
@@ -987,6 +1357,12 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
987
1357
  sourceType: "document";
988
1358
  title: string;
989
1359
  type: "source";
1360
+ } | {
1361
+ approvalId: string;
1362
+ providerMetadata?: Record<string, Record<string, any>>;
1363
+ providerOptions?: Record<string, Record<string, any>>;
1364
+ toolCallId: string;
1365
+ type: "tool-approval-request";
990
1366
  }>;
991
1367
  providerOptions?: Record<string, Record<string, any>>;
992
1368
  role: "assistant";
@@ -1003,26 +1379,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1003
1379
  }>;
1004
1380
  isError?: boolean;
1005
1381
  output?: {
1382
+ providerOptions?: Record<string, Record<string, any>>;
1006
1383
  type: "text";
1007
1384
  value: string;
1008
1385
  } | {
1386
+ providerOptions?: Record<string, Record<string, any>>;
1009
1387
  type: "json";
1010
1388
  value: any;
1011
1389
  } | {
1390
+ providerOptions?: Record<string, Record<string, any>>;
1012
1391
  type: "error-text";
1013
1392
  value: string;
1014
1393
  } | {
1394
+ providerOptions?: Record<string, Record<string, any>>;
1015
1395
  type: "error-json";
1016
1396
  value: any;
1397
+ } | {
1398
+ providerOptions?: Record<string, Record<string, any>>;
1399
+ reason?: string;
1400
+ type: "execution-denied";
1017
1401
  } | {
1018
1402
  type: "content";
1019
1403
  value: Array<{
1404
+ providerOptions?: Record<string, Record<string, any>>;
1020
1405
  text: string;
1021
1406
  type: "text";
1022
1407
  } | {
1023
1408
  data: string;
1024
1409
  mediaType: string;
1025
1410
  type: "media";
1411
+ } | {
1412
+ data: string;
1413
+ filename?: string;
1414
+ mediaType: string;
1415
+ providerOptions?: Record<string, Record<string, any>>;
1416
+ type: "file-data";
1417
+ } | {
1418
+ providerOptions?: Record<string, Record<string, any>>;
1419
+ type: "file-url";
1420
+ url: string;
1421
+ } | {
1422
+ fileId: string | Record<string, string>;
1423
+ providerOptions?: Record<string, Record<string, any>>;
1424
+ type: "file-id";
1425
+ } | {
1426
+ data: string;
1427
+ mediaType: string;
1428
+ providerOptions?: Record<string, Record<string, any>>;
1429
+ type: "image-data";
1430
+ } | {
1431
+ providerOptions?: Record<string, Record<string, any>>;
1432
+ type: "image-url";
1433
+ url: string;
1434
+ } | {
1435
+ fileId: string | Record<string, string>;
1436
+ providerOptions?: Record<string, Record<string, any>>;
1437
+ type: "image-file-id";
1438
+ } | {
1439
+ providerOptions?: Record<string, Record<string, any>>;
1440
+ type: "custom";
1026
1441
  }>;
1027
1442
  };
1028
1443
  providerExecuted?: boolean;
@@ -1032,6 +1447,14 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1032
1447
  toolCallId: string;
1033
1448
  toolName: string;
1034
1449
  type: "tool-result";
1450
+ } | {
1451
+ approvalId: string;
1452
+ approved: boolean;
1453
+ providerExecuted?: boolean;
1454
+ providerMetadata?: Record<string, Record<string, any>>;
1455
+ providerOptions?: Record<string, Record<string, any>>;
1456
+ reason?: string;
1457
+ type: "tool-approval-response";
1035
1458
  }>;
1036
1459
  providerOptions?: Record<string, Record<string, any>>;
1037
1460
  role: "tool";
@@ -1139,13 +1562,15 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1139
1562
  type: "text";
1140
1563
  } | {
1141
1564
  image: string | ArrayBuffer;
1565
+ mediaType?: string;
1142
1566
  mimeType?: string;
1143
1567
  providerOptions?: Record<string, Record<string, any>>;
1144
1568
  type: "image";
1145
1569
  } | {
1146
1570
  data: string | ArrayBuffer;
1147
1571
  filename?: string;
1148
- mimeType: string;
1572
+ mediaType?: string;
1573
+ mimeType?: string;
1149
1574
  providerMetadata?: Record<string, Record<string, any>>;
1150
1575
  providerOptions?: Record<string, Record<string, any>>;
1151
1576
  type: "file";
@@ -1161,7 +1586,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1161
1586
  } | {
1162
1587
  data: string | ArrayBuffer;
1163
1588
  filename?: string;
1164
- mimeType: string;
1589
+ mediaType?: string;
1590
+ mimeType?: string;
1165
1591
  providerMetadata?: Record<string, Record<string, any>>;
1166
1592
  providerOptions?: Record<string, Record<string, any>>;
1167
1593
  type: "file";
@@ -1176,8 +1602,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1176
1602
  providerMetadata?: Record<string, Record<string, any>>;
1177
1603
  providerOptions?: Record<string, Record<string, any>>;
1178
1604
  type: "redacted-reasoning";
1605
+ } | {
1606
+ args?: any;
1607
+ input: any;
1608
+ providerExecuted?: boolean;
1609
+ providerMetadata?: Record<string, Record<string, any>>;
1610
+ providerOptions?: Record<string, Record<string, any>>;
1611
+ toolCallId: string;
1612
+ toolName: string;
1613
+ type: "tool-call";
1179
1614
  } | {
1180
1615
  args: any;
1616
+ input?: any;
1181
1617
  providerExecuted?: boolean;
1182
1618
  providerMetadata?: Record<string, Record<string, any>>;
1183
1619
  providerOptions?: Record<string, Record<string, any>>;
@@ -1196,26 +1632,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1196
1632
  }>;
1197
1633
  isError?: boolean;
1198
1634
  output?: {
1635
+ providerOptions?: Record<string, Record<string, any>>;
1199
1636
  type: "text";
1200
1637
  value: string;
1201
1638
  } | {
1639
+ providerOptions?: Record<string, Record<string, any>>;
1202
1640
  type: "json";
1203
1641
  value: any;
1204
1642
  } | {
1643
+ providerOptions?: Record<string, Record<string, any>>;
1205
1644
  type: "error-text";
1206
1645
  value: string;
1207
1646
  } | {
1647
+ providerOptions?: Record<string, Record<string, any>>;
1208
1648
  type: "error-json";
1209
1649
  value: any;
1650
+ } | {
1651
+ providerOptions?: Record<string, Record<string, any>>;
1652
+ reason?: string;
1653
+ type: "execution-denied";
1210
1654
  } | {
1211
1655
  type: "content";
1212
1656
  value: Array<{
1657
+ providerOptions?: Record<string, Record<string, any>>;
1213
1658
  text: string;
1214
1659
  type: "text";
1215
1660
  } | {
1216
1661
  data: string;
1217
1662
  mediaType: string;
1218
1663
  type: "media";
1664
+ } | {
1665
+ data: string;
1666
+ filename?: string;
1667
+ mediaType: string;
1668
+ providerOptions?: Record<string, Record<string, any>>;
1669
+ type: "file-data";
1670
+ } | {
1671
+ providerOptions?: Record<string, Record<string, any>>;
1672
+ type: "file-url";
1673
+ url: string;
1674
+ } | {
1675
+ fileId: string | Record<string, string>;
1676
+ providerOptions?: Record<string, Record<string, any>>;
1677
+ type: "file-id";
1678
+ } | {
1679
+ data: string;
1680
+ mediaType: string;
1681
+ providerOptions?: Record<string, Record<string, any>>;
1682
+ type: "image-data";
1683
+ } | {
1684
+ providerOptions?: Record<string, Record<string, any>>;
1685
+ type: "image-url";
1686
+ url: string;
1687
+ } | {
1688
+ fileId: string | Record<string, string>;
1689
+ providerOptions?: Record<string, Record<string, any>>;
1690
+ type: "image-file-id";
1691
+ } | {
1692
+ providerOptions?: Record<string, Record<string, any>>;
1693
+ type: "custom";
1219
1694
  }>;
1220
1695
  };
1221
1696
  providerExecuted?: boolean;
@@ -1242,6 +1717,12 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1242
1717
  sourceType: "document";
1243
1718
  title: string;
1244
1719
  type: "source";
1720
+ } | {
1721
+ approvalId: string;
1722
+ providerMetadata?: Record<string, Record<string, any>>;
1723
+ providerOptions?: Record<string, Record<string, any>>;
1724
+ toolCallId: string;
1725
+ type: "tool-approval-request";
1245
1726
  }>;
1246
1727
  providerOptions?: Record<string, Record<string, any>>;
1247
1728
  role: "assistant";
@@ -1258,26 +1739,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1258
1739
  }>;
1259
1740
  isError?: boolean;
1260
1741
  output?: {
1742
+ providerOptions?: Record<string, Record<string, any>>;
1261
1743
  type: "text";
1262
1744
  value: string;
1263
1745
  } | {
1746
+ providerOptions?: Record<string, Record<string, any>>;
1264
1747
  type: "json";
1265
1748
  value: any;
1266
1749
  } | {
1750
+ providerOptions?: Record<string, Record<string, any>>;
1267
1751
  type: "error-text";
1268
1752
  value: string;
1269
1753
  } | {
1754
+ providerOptions?: Record<string, Record<string, any>>;
1270
1755
  type: "error-json";
1271
1756
  value: any;
1757
+ } | {
1758
+ providerOptions?: Record<string, Record<string, any>>;
1759
+ reason?: string;
1760
+ type: "execution-denied";
1272
1761
  } | {
1273
1762
  type: "content";
1274
1763
  value: Array<{
1764
+ providerOptions?: Record<string, Record<string, any>>;
1275
1765
  text: string;
1276
1766
  type: "text";
1277
1767
  } | {
1278
1768
  data: string;
1279
1769
  mediaType: string;
1280
1770
  type: "media";
1771
+ } | {
1772
+ data: string;
1773
+ filename?: string;
1774
+ mediaType: string;
1775
+ providerOptions?: Record<string, Record<string, any>>;
1776
+ type: "file-data";
1777
+ } | {
1778
+ providerOptions?: Record<string, Record<string, any>>;
1779
+ type: "file-url";
1780
+ url: string;
1781
+ } | {
1782
+ fileId: string | Record<string, string>;
1783
+ providerOptions?: Record<string, Record<string, any>>;
1784
+ type: "file-id";
1785
+ } | {
1786
+ data: string;
1787
+ mediaType: string;
1788
+ providerOptions?: Record<string, Record<string, any>>;
1789
+ type: "image-data";
1790
+ } | {
1791
+ providerOptions?: Record<string, Record<string, any>>;
1792
+ type: "image-url";
1793
+ url: string;
1794
+ } | {
1795
+ fileId: string | Record<string, string>;
1796
+ providerOptions?: Record<string, Record<string, any>>;
1797
+ type: "image-file-id";
1798
+ } | {
1799
+ providerOptions?: Record<string, Record<string, any>>;
1800
+ type: "custom";
1281
1801
  }>;
1282
1802
  };
1283
1803
  providerExecuted?: boolean;
@@ -1287,6 +1807,14 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1287
1807
  toolCallId: string;
1288
1808
  toolName: string;
1289
1809
  type: "tool-result";
1810
+ } | {
1811
+ approvalId: string;
1812
+ approved: boolean;
1813
+ providerExecuted?: boolean;
1814
+ providerMetadata?: Record<string, Record<string, any>>;
1815
+ providerOptions?: Record<string, Record<string, any>>;
1816
+ reason?: string;
1817
+ type: "tool-approval-response";
1290
1818
  }>;
1291
1819
  providerOptions?: Record<string, Record<string, any>>;
1292
1820
  role: "tool";
@@ -1382,13 +1910,15 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1382
1910
  type: "text";
1383
1911
  } | {
1384
1912
  image: string | ArrayBuffer;
1913
+ mediaType?: string;
1385
1914
  mimeType?: string;
1386
1915
  providerOptions?: Record<string, Record<string, any>>;
1387
1916
  type: "image";
1388
1917
  } | {
1389
1918
  data: string | ArrayBuffer;
1390
1919
  filename?: string;
1391
- mimeType: string;
1920
+ mediaType?: string;
1921
+ mimeType?: string;
1392
1922
  providerMetadata?: Record<string, Record<string, any>>;
1393
1923
  providerOptions?: Record<string, Record<string, any>>;
1394
1924
  type: "file";
@@ -1404,7 +1934,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1404
1934
  } | {
1405
1935
  data: string | ArrayBuffer;
1406
1936
  filename?: string;
1407
- mimeType: string;
1937
+ mediaType?: string;
1938
+ mimeType?: string;
1408
1939
  providerMetadata?: Record<string, Record<string, any>>;
1409
1940
  providerOptions?: Record<string, Record<string, any>>;
1410
1941
  type: "file";
@@ -1419,8 +1950,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1419
1950
  providerMetadata?: Record<string, Record<string, any>>;
1420
1951
  providerOptions?: Record<string, Record<string, any>>;
1421
1952
  type: "redacted-reasoning";
1953
+ } | {
1954
+ args?: any;
1955
+ input: any;
1956
+ providerExecuted?: boolean;
1957
+ providerMetadata?: Record<string, Record<string, any>>;
1958
+ providerOptions?: Record<string, Record<string, any>>;
1959
+ toolCallId: string;
1960
+ toolName: string;
1961
+ type: "tool-call";
1422
1962
  } | {
1423
1963
  args: any;
1964
+ input?: any;
1424
1965
  providerExecuted?: boolean;
1425
1966
  providerMetadata?: Record<string, Record<string, any>>;
1426
1967
  providerOptions?: Record<string, Record<string, any>>;
@@ -1439,26 +1980,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1439
1980
  }>;
1440
1981
  isError?: boolean;
1441
1982
  output?: {
1983
+ providerOptions?: Record<string, Record<string, any>>;
1442
1984
  type: "text";
1443
1985
  value: string;
1444
1986
  } | {
1987
+ providerOptions?: Record<string, Record<string, any>>;
1445
1988
  type: "json";
1446
1989
  value: any;
1447
1990
  } | {
1991
+ providerOptions?: Record<string, Record<string, any>>;
1448
1992
  type: "error-text";
1449
1993
  value: string;
1450
1994
  } | {
1995
+ providerOptions?: Record<string, Record<string, any>>;
1451
1996
  type: "error-json";
1452
1997
  value: any;
1998
+ } | {
1999
+ providerOptions?: Record<string, Record<string, any>>;
2000
+ reason?: string;
2001
+ type: "execution-denied";
1453
2002
  } | {
1454
2003
  type: "content";
1455
2004
  value: Array<{
2005
+ providerOptions?: Record<string, Record<string, any>>;
1456
2006
  text: string;
1457
2007
  type: "text";
1458
2008
  } | {
1459
2009
  data: string;
1460
2010
  mediaType: string;
1461
2011
  type: "media";
2012
+ } | {
2013
+ data: string;
2014
+ filename?: string;
2015
+ mediaType: string;
2016
+ providerOptions?: Record<string, Record<string, any>>;
2017
+ type: "file-data";
2018
+ } | {
2019
+ providerOptions?: Record<string, Record<string, any>>;
2020
+ type: "file-url";
2021
+ url: string;
2022
+ } | {
2023
+ fileId: string | Record<string, string>;
2024
+ providerOptions?: Record<string, Record<string, any>>;
2025
+ type: "file-id";
2026
+ } | {
2027
+ data: string;
2028
+ mediaType: string;
2029
+ providerOptions?: Record<string, Record<string, any>>;
2030
+ type: "image-data";
2031
+ } | {
2032
+ providerOptions?: Record<string, Record<string, any>>;
2033
+ type: "image-url";
2034
+ url: string;
2035
+ } | {
2036
+ fileId: string | Record<string, string>;
2037
+ providerOptions?: Record<string, Record<string, any>>;
2038
+ type: "image-file-id";
2039
+ } | {
2040
+ providerOptions?: Record<string, Record<string, any>>;
2041
+ type: "custom";
1462
2042
  }>;
1463
2043
  };
1464
2044
  providerExecuted?: boolean;
@@ -1485,6 +2065,12 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1485
2065
  sourceType: "document";
1486
2066
  title: string;
1487
2067
  type: "source";
2068
+ } | {
2069
+ approvalId: string;
2070
+ providerMetadata?: Record<string, Record<string, any>>;
2071
+ providerOptions?: Record<string, Record<string, any>>;
2072
+ toolCallId: string;
2073
+ type: "tool-approval-request";
1488
2074
  }>;
1489
2075
  providerOptions?: Record<string, Record<string, any>>;
1490
2076
  role: "assistant";
@@ -1501,26 +2087,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1501
2087
  }>;
1502
2088
  isError?: boolean;
1503
2089
  output?: {
2090
+ providerOptions?: Record<string, Record<string, any>>;
1504
2091
  type: "text";
1505
2092
  value: string;
1506
2093
  } | {
2094
+ providerOptions?: Record<string, Record<string, any>>;
1507
2095
  type: "json";
1508
2096
  value: any;
1509
2097
  } | {
2098
+ providerOptions?: Record<string, Record<string, any>>;
1510
2099
  type: "error-text";
1511
2100
  value: string;
1512
2101
  } | {
2102
+ providerOptions?: Record<string, Record<string, any>>;
1513
2103
  type: "error-json";
1514
2104
  value: any;
2105
+ } | {
2106
+ providerOptions?: Record<string, Record<string, any>>;
2107
+ reason?: string;
2108
+ type: "execution-denied";
1515
2109
  } | {
1516
2110
  type: "content";
1517
2111
  value: Array<{
2112
+ providerOptions?: Record<string, Record<string, any>>;
1518
2113
  text: string;
1519
2114
  type: "text";
1520
2115
  } | {
1521
2116
  data: string;
1522
2117
  mediaType: string;
1523
2118
  type: "media";
2119
+ } | {
2120
+ data: string;
2121
+ filename?: string;
2122
+ mediaType: string;
2123
+ providerOptions?: Record<string, Record<string, any>>;
2124
+ type: "file-data";
2125
+ } | {
2126
+ providerOptions?: Record<string, Record<string, any>>;
2127
+ type: "file-url";
2128
+ url: string;
2129
+ } | {
2130
+ fileId: string | Record<string, string>;
2131
+ providerOptions?: Record<string, Record<string, any>>;
2132
+ type: "file-id";
2133
+ } | {
2134
+ data: string;
2135
+ mediaType: string;
2136
+ providerOptions?: Record<string, Record<string, any>>;
2137
+ type: "image-data";
2138
+ } | {
2139
+ providerOptions?: Record<string, Record<string, any>>;
2140
+ type: "image-url";
2141
+ url: string;
2142
+ } | {
2143
+ fileId: string | Record<string, string>;
2144
+ providerOptions?: Record<string, Record<string, any>>;
2145
+ type: "image-file-id";
2146
+ } | {
2147
+ providerOptions?: Record<string, Record<string, any>>;
2148
+ type: "custom";
1524
2149
  }>;
1525
2150
  };
1526
2151
  providerExecuted?: boolean;
@@ -1530,6 +2155,14 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1530
2155
  toolCallId: string;
1531
2156
  toolName: string;
1532
2157
  type: "tool-result";
2158
+ } | {
2159
+ approvalId: string;
2160
+ approved: boolean;
2161
+ providerExecuted?: boolean;
2162
+ providerMetadata?: Record<string, Record<string, any>>;
2163
+ providerOptions?: Record<string, Record<string, any>>;
2164
+ reason?: string;
2165
+ type: "tool-approval-response";
1533
2166
  }>;
1534
2167
  providerOptions?: Record<string, Record<string, any>>;
1535
2168
  role: "tool";
@@ -1616,13 +2249,15 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1616
2249
  type: "text";
1617
2250
  } | {
1618
2251
  image: string | ArrayBuffer;
2252
+ mediaType?: string;
1619
2253
  mimeType?: string;
1620
2254
  providerOptions?: Record<string, Record<string, any>>;
1621
2255
  type: "image";
1622
2256
  } | {
1623
2257
  data: string | ArrayBuffer;
1624
2258
  filename?: string;
1625
- mimeType: string;
2259
+ mediaType?: string;
2260
+ mimeType?: string;
1626
2261
  providerMetadata?: Record<string, Record<string, any>>;
1627
2262
  providerOptions?: Record<string, Record<string, any>>;
1628
2263
  type: "file";
@@ -1638,7 +2273,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1638
2273
  } | {
1639
2274
  data: string | ArrayBuffer;
1640
2275
  filename?: string;
1641
- mimeType: string;
2276
+ mediaType?: string;
2277
+ mimeType?: string;
1642
2278
  providerMetadata?: Record<string, Record<string, any>>;
1643
2279
  providerOptions?: Record<string, Record<string, any>>;
1644
2280
  type: "file";
@@ -1653,8 +2289,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1653
2289
  providerMetadata?: Record<string, Record<string, any>>;
1654
2290
  providerOptions?: Record<string, Record<string, any>>;
1655
2291
  type: "redacted-reasoning";
2292
+ } | {
2293
+ args?: any;
2294
+ input: any;
2295
+ providerExecuted?: boolean;
2296
+ providerMetadata?: Record<string, Record<string, any>>;
2297
+ providerOptions?: Record<string, Record<string, any>>;
2298
+ toolCallId: string;
2299
+ toolName: string;
2300
+ type: "tool-call";
1656
2301
  } | {
1657
2302
  args: any;
2303
+ input?: any;
1658
2304
  providerExecuted?: boolean;
1659
2305
  providerMetadata?: Record<string, Record<string, any>>;
1660
2306
  providerOptions?: Record<string, Record<string, any>>;
@@ -1673,26 +2319,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1673
2319
  }>;
1674
2320
  isError?: boolean;
1675
2321
  output?: {
2322
+ providerOptions?: Record<string, Record<string, any>>;
1676
2323
  type: "text";
1677
2324
  value: string;
1678
2325
  } | {
2326
+ providerOptions?: Record<string, Record<string, any>>;
1679
2327
  type: "json";
1680
2328
  value: any;
1681
2329
  } | {
2330
+ providerOptions?: Record<string, Record<string, any>>;
1682
2331
  type: "error-text";
1683
2332
  value: string;
1684
2333
  } | {
2334
+ providerOptions?: Record<string, Record<string, any>>;
1685
2335
  type: "error-json";
1686
2336
  value: any;
2337
+ } | {
2338
+ providerOptions?: Record<string, Record<string, any>>;
2339
+ reason?: string;
2340
+ type: "execution-denied";
1687
2341
  } | {
1688
2342
  type: "content";
1689
2343
  value: Array<{
2344
+ providerOptions?: Record<string, Record<string, any>>;
1690
2345
  text: string;
1691
2346
  type: "text";
1692
2347
  } | {
1693
2348
  data: string;
1694
2349
  mediaType: string;
1695
2350
  type: "media";
2351
+ } | {
2352
+ data: string;
2353
+ filename?: string;
2354
+ mediaType: string;
2355
+ providerOptions?: Record<string, Record<string, any>>;
2356
+ type: "file-data";
2357
+ } | {
2358
+ providerOptions?: Record<string, Record<string, any>>;
2359
+ type: "file-url";
2360
+ url: string;
2361
+ } | {
2362
+ fileId: string | Record<string, string>;
2363
+ providerOptions?: Record<string, Record<string, any>>;
2364
+ type: "file-id";
2365
+ } | {
2366
+ data: string;
2367
+ mediaType: string;
2368
+ providerOptions?: Record<string, Record<string, any>>;
2369
+ type: "image-data";
2370
+ } | {
2371
+ providerOptions?: Record<string, Record<string, any>>;
2372
+ type: "image-url";
2373
+ url: string;
2374
+ } | {
2375
+ fileId: string | Record<string, string>;
2376
+ providerOptions?: Record<string, Record<string, any>>;
2377
+ type: "image-file-id";
2378
+ } | {
2379
+ providerOptions?: Record<string, Record<string, any>>;
2380
+ type: "custom";
1696
2381
  }>;
1697
2382
  };
1698
2383
  providerExecuted?: boolean;
@@ -1719,6 +2404,12 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1719
2404
  sourceType: "document";
1720
2405
  title: string;
1721
2406
  type: "source";
2407
+ } | {
2408
+ approvalId: string;
2409
+ providerMetadata?: Record<string, Record<string, any>>;
2410
+ providerOptions?: Record<string, Record<string, any>>;
2411
+ toolCallId: string;
2412
+ type: "tool-approval-request";
1722
2413
  }>;
1723
2414
  providerOptions?: Record<string, Record<string, any>>;
1724
2415
  role: "assistant";
@@ -1735,26 +2426,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1735
2426
  }>;
1736
2427
  isError?: boolean;
1737
2428
  output?: {
2429
+ providerOptions?: Record<string, Record<string, any>>;
1738
2430
  type: "text";
1739
2431
  value: string;
1740
2432
  } | {
2433
+ providerOptions?: Record<string, Record<string, any>>;
1741
2434
  type: "json";
1742
2435
  value: any;
1743
2436
  } | {
2437
+ providerOptions?: Record<string, Record<string, any>>;
1744
2438
  type: "error-text";
1745
2439
  value: string;
1746
2440
  } | {
2441
+ providerOptions?: Record<string, Record<string, any>>;
1747
2442
  type: "error-json";
1748
2443
  value: any;
2444
+ } | {
2445
+ providerOptions?: Record<string, Record<string, any>>;
2446
+ reason?: string;
2447
+ type: "execution-denied";
1749
2448
  } | {
1750
2449
  type: "content";
1751
2450
  value: Array<{
2451
+ providerOptions?: Record<string, Record<string, any>>;
1752
2452
  text: string;
1753
2453
  type: "text";
1754
2454
  } | {
1755
2455
  data: string;
1756
2456
  mediaType: string;
1757
2457
  type: "media";
2458
+ } | {
2459
+ data: string;
2460
+ filename?: string;
2461
+ mediaType: string;
2462
+ providerOptions?: Record<string, Record<string, any>>;
2463
+ type: "file-data";
2464
+ } | {
2465
+ providerOptions?: Record<string, Record<string, any>>;
2466
+ type: "file-url";
2467
+ url: string;
2468
+ } | {
2469
+ fileId: string | Record<string, string>;
2470
+ providerOptions?: Record<string, Record<string, any>>;
2471
+ type: "file-id";
2472
+ } | {
2473
+ data: string;
2474
+ mediaType: string;
2475
+ providerOptions?: Record<string, Record<string, any>>;
2476
+ type: "image-data";
2477
+ } | {
2478
+ providerOptions?: Record<string, Record<string, any>>;
2479
+ type: "image-url";
2480
+ url: string;
2481
+ } | {
2482
+ fileId: string | Record<string, string>;
2483
+ providerOptions?: Record<string, Record<string, any>>;
2484
+ type: "image-file-id";
2485
+ } | {
2486
+ providerOptions?: Record<string, Record<string, any>>;
2487
+ type: "custom";
1758
2488
  }>;
1759
2489
  };
1760
2490
  providerExecuted?: boolean;
@@ -1764,6 +2494,14 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1764
2494
  toolCallId: string;
1765
2495
  toolName: string;
1766
2496
  type: "tool-result";
2497
+ } | {
2498
+ approvalId: string;
2499
+ approved: boolean;
2500
+ providerExecuted?: boolean;
2501
+ providerMetadata?: Record<string, Record<string, any>>;
2502
+ providerOptions?: Record<string, Record<string, any>>;
2503
+ reason?: string;
2504
+ type: "tool-approval-response";
1767
2505
  }>;
1768
2506
  providerOptions?: Record<string, Record<string, any>>;
1769
2507
  role: "tool";
@@ -1794,13 +2532,15 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1794
2532
  type: "text";
1795
2533
  } | {
1796
2534
  image: string | ArrayBuffer;
2535
+ mediaType?: string;
1797
2536
  mimeType?: string;
1798
2537
  providerOptions?: Record<string, Record<string, any>>;
1799
2538
  type: "image";
1800
2539
  } | {
1801
2540
  data: string | ArrayBuffer;
1802
2541
  filename?: string;
1803
- mimeType: string;
2542
+ mediaType?: string;
2543
+ mimeType?: string;
1804
2544
  providerMetadata?: Record<string, Record<string, any>>;
1805
2545
  providerOptions?: Record<string, Record<string, any>>;
1806
2546
  type: "file";
@@ -1816,7 +2556,8 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1816
2556
  } | {
1817
2557
  data: string | ArrayBuffer;
1818
2558
  filename?: string;
1819
- mimeType: string;
2559
+ mediaType?: string;
2560
+ mimeType?: string;
1820
2561
  providerMetadata?: Record<string, Record<string, any>>;
1821
2562
  providerOptions?: Record<string, Record<string, any>>;
1822
2563
  type: "file";
@@ -1831,8 +2572,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1831
2572
  providerMetadata?: Record<string, Record<string, any>>;
1832
2573
  providerOptions?: Record<string, Record<string, any>>;
1833
2574
  type: "redacted-reasoning";
2575
+ } | {
2576
+ args?: any;
2577
+ input: any;
2578
+ providerExecuted?: boolean;
2579
+ providerMetadata?: Record<string, Record<string, any>>;
2580
+ providerOptions?: Record<string, Record<string, any>>;
2581
+ toolCallId: string;
2582
+ toolName: string;
2583
+ type: "tool-call";
1834
2584
  } | {
1835
2585
  args: any;
2586
+ input?: any;
1836
2587
  providerExecuted?: boolean;
1837
2588
  providerMetadata?: Record<string, Record<string, any>>;
1838
2589
  providerOptions?: Record<string, Record<string, any>>;
@@ -1851,26 +2602,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1851
2602
  }>;
1852
2603
  isError?: boolean;
1853
2604
  output?: {
2605
+ providerOptions?: Record<string, Record<string, any>>;
1854
2606
  type: "text";
1855
2607
  value: string;
1856
2608
  } | {
2609
+ providerOptions?: Record<string, Record<string, any>>;
1857
2610
  type: "json";
1858
2611
  value: any;
1859
2612
  } | {
2613
+ providerOptions?: Record<string, Record<string, any>>;
1860
2614
  type: "error-text";
1861
2615
  value: string;
1862
2616
  } | {
2617
+ providerOptions?: Record<string, Record<string, any>>;
1863
2618
  type: "error-json";
1864
2619
  value: any;
2620
+ } | {
2621
+ providerOptions?: Record<string, Record<string, any>>;
2622
+ reason?: string;
2623
+ type: "execution-denied";
1865
2624
  } | {
1866
2625
  type: "content";
1867
2626
  value: Array<{
2627
+ providerOptions?: Record<string, Record<string, any>>;
1868
2628
  text: string;
1869
2629
  type: "text";
1870
2630
  } | {
1871
2631
  data: string;
1872
2632
  mediaType: string;
1873
2633
  type: "media";
2634
+ } | {
2635
+ data: string;
2636
+ filename?: string;
2637
+ mediaType: string;
2638
+ providerOptions?: Record<string, Record<string, any>>;
2639
+ type: "file-data";
2640
+ } | {
2641
+ providerOptions?: Record<string, Record<string, any>>;
2642
+ type: "file-url";
2643
+ url: string;
2644
+ } | {
2645
+ fileId: string | Record<string, string>;
2646
+ providerOptions?: Record<string, Record<string, any>>;
2647
+ type: "file-id";
2648
+ } | {
2649
+ data: string;
2650
+ mediaType: string;
2651
+ providerOptions?: Record<string, Record<string, any>>;
2652
+ type: "image-data";
2653
+ } | {
2654
+ providerOptions?: Record<string, Record<string, any>>;
2655
+ type: "image-url";
2656
+ url: string;
2657
+ } | {
2658
+ fileId: string | Record<string, string>;
2659
+ providerOptions?: Record<string, Record<string, any>>;
2660
+ type: "image-file-id";
2661
+ } | {
2662
+ providerOptions?: Record<string, Record<string, any>>;
2663
+ type: "custom";
1874
2664
  }>;
1875
2665
  };
1876
2666
  providerExecuted?: boolean;
@@ -1897,6 +2687,12 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1897
2687
  sourceType: "document";
1898
2688
  title: string;
1899
2689
  type: "source";
2690
+ } | {
2691
+ approvalId: string;
2692
+ providerMetadata?: Record<string, Record<string, any>>;
2693
+ providerOptions?: Record<string, Record<string, any>>;
2694
+ toolCallId: string;
2695
+ type: "tool-approval-request";
1900
2696
  }>;
1901
2697
  providerOptions?: Record<string, Record<string, any>>;
1902
2698
  role: "assistant";
@@ -1913,26 +2709,65 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1913
2709
  }>;
1914
2710
  isError?: boolean;
1915
2711
  output?: {
2712
+ providerOptions?: Record<string, Record<string, any>>;
1916
2713
  type: "text";
1917
2714
  value: string;
1918
2715
  } | {
2716
+ providerOptions?: Record<string, Record<string, any>>;
1919
2717
  type: "json";
1920
2718
  value: any;
1921
2719
  } | {
2720
+ providerOptions?: Record<string, Record<string, any>>;
1922
2721
  type: "error-text";
1923
2722
  value: string;
1924
2723
  } | {
2724
+ providerOptions?: Record<string, Record<string, any>>;
1925
2725
  type: "error-json";
1926
2726
  value: any;
2727
+ } | {
2728
+ providerOptions?: Record<string, Record<string, any>>;
2729
+ reason?: string;
2730
+ type: "execution-denied";
1927
2731
  } | {
1928
2732
  type: "content";
1929
2733
  value: Array<{
2734
+ providerOptions?: Record<string, Record<string, any>>;
1930
2735
  text: string;
1931
2736
  type: "text";
1932
2737
  } | {
1933
2738
  data: string;
1934
2739
  mediaType: string;
1935
2740
  type: "media";
2741
+ } | {
2742
+ data: string;
2743
+ filename?: string;
2744
+ mediaType: string;
2745
+ providerOptions?: Record<string, Record<string, any>>;
2746
+ type: "file-data";
2747
+ } | {
2748
+ providerOptions?: Record<string, Record<string, any>>;
2749
+ type: "file-url";
2750
+ url: string;
2751
+ } | {
2752
+ fileId: string | Record<string, string>;
2753
+ providerOptions?: Record<string, Record<string, any>>;
2754
+ type: "file-id";
2755
+ } | {
2756
+ data: string;
2757
+ mediaType: string;
2758
+ providerOptions?: Record<string, Record<string, any>>;
2759
+ type: "image-data";
2760
+ } | {
2761
+ providerOptions?: Record<string, Record<string, any>>;
2762
+ type: "image-url";
2763
+ url: string;
2764
+ } | {
2765
+ fileId: string | Record<string, string>;
2766
+ providerOptions?: Record<string, Record<string, any>>;
2767
+ type: "image-file-id";
2768
+ } | {
2769
+ providerOptions?: Record<string, Record<string, any>>;
2770
+ type: "custom";
1936
2771
  }>;
1937
2772
  };
1938
2773
  providerExecuted?: boolean;
@@ -1942,6 +2777,14 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1942
2777
  toolCallId: string;
1943
2778
  toolName: string;
1944
2779
  type: "tool-result";
2780
+ } | {
2781
+ approvalId: string;
2782
+ approved: boolean;
2783
+ providerExecuted?: boolean;
2784
+ providerMetadata?: Record<string, Record<string, any>>;
2785
+ providerOptions?: Record<string, Record<string, any>>;
2786
+ reason?: string;
2787
+ type: "tool-approval-response";
1945
2788
  }>;
1946
2789
  providerOptions?: Record<string, Record<string, any>>;
1947
2790
  role: "tool";