@convex-dev/agent 0.6.4 → 0.7.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 (225) hide show
  1. package/MIGRATION.md +60 -116
  2. package/dist/client/messages.d.ts +1 -398
  3. package/dist/client/messages.d.ts.map +1 -1
  4. package/dist/client/messages.js +3 -47
  5. package/dist/client/messages.js.map +1 -1
  6. package/dist/client/types.d.ts +1 -455
  7. package/dist/client/types.d.ts.map +1 -1
  8. package/dist/component/_generated/component.d.ts +805 -45
  9. package/dist/component/_generated/component.d.ts.map +1 -1
  10. package/dist/component/messages.d.ts +1252 -201
  11. package/dist/component/messages.d.ts.map +1 -1
  12. package/dist/component/messages.js +49 -23
  13. package/dist/component/messages.js.map +1 -1
  14. package/dist/component/schema.d.ts +2593 -332
  15. package/dist/component/schema.d.ts.map +1 -1
  16. package/dist/component/streams.d.ts +7 -1
  17. package/dist/component/streams.d.ts.map +1 -1
  18. package/dist/component/streams.js +24 -30
  19. package/dist/component/streams.js.map +1 -1
  20. package/dist/component/threads.d.ts.map +1 -1
  21. package/dist/component/threads.js +1 -2
  22. package/dist/component/threads.js.map +1 -1
  23. package/dist/react/index.d.ts +5 -5
  24. package/dist/react/index.d.ts.map +1 -1
  25. package/dist/react/index.js +5 -5
  26. package/dist/react/index.js.map +1 -1
  27. package/dist/shared.d.ts +19 -7
  28. package/dist/shared.d.ts.map +1 -1
  29. package/dist/shared.js +4 -4
  30. package/dist/shared.js.map +1 -1
  31. package/dist/streaming/materializePersistedUIMessageChunks.d.ts +16 -0
  32. package/dist/streaming/materializePersistedUIMessageChunks.d.ts.map +1 -0
  33. package/dist/streaming/materializePersistedUIMessageChunks.js +302 -0
  34. package/dist/streaming/materializePersistedUIMessageChunks.js.map +1 -0
  35. package/dist/streaming/persistedUIMessageChunks.d.ts +106 -0
  36. package/dist/streaming/persistedUIMessageChunks.d.ts.map +1 -0
  37. package/dist/streaming/persistedUIMessageChunks.js +475 -0
  38. package/dist/streaming/persistedUIMessageChunks.js.map +1 -0
  39. package/dist/validators.d.ts +10026 -1055
  40. package/dist/validators.d.ts.map +1 -1
  41. package/dist/validators.js +71 -9
  42. package/dist/validators.js.map +1 -1
  43. package/dist/{UIMessages.d.ts → vercel/UIMessages.d.ts} +1 -1
  44. package/dist/vercel/UIMessages.d.ts.map +1 -0
  45. package/dist/{UIMessages.js → vercel/UIMessages.js} +63 -1
  46. package/dist/vercel/UIMessages.js.map +1 -0
  47. package/dist/{client → vercel/client}/createTool.d.ts +23 -16
  48. package/dist/vercel/client/createTool.d.ts.map +1 -0
  49. package/dist/{client → vercel/client}/createTool.js +2 -0
  50. package/dist/vercel/client/createTool.js.map +1 -0
  51. package/dist/{client → vercel/client}/definePlaygroundAPI.d.ts +533 -79
  52. package/dist/{client → vercel/client}/definePlaygroundAPI.d.ts.map +1 -1
  53. package/dist/{client → vercel/client}/definePlaygroundAPI.js +8 -7
  54. package/dist/vercel/client/definePlaygroundAPI.js.map +1 -0
  55. package/dist/{client → vercel/client}/files.d.ts +2 -2
  56. package/dist/vercel/client/files.d.ts.map +1 -0
  57. package/dist/vercel/client/files.js.map +1 -0
  58. package/dist/vercel/client/messages.d.ts +542 -0
  59. package/dist/vercel/client/messages.d.ts.map +1 -0
  60. package/dist/vercel/client/messages.js +66 -0
  61. package/dist/vercel/client/messages.js.map +1 -0
  62. package/dist/{client → vercel/client}/mockModel.d.ts +17 -17
  63. package/dist/vercel/client/mockModel.d.ts.map +1 -0
  64. package/dist/{client → vercel/client}/mockModel.js +12 -13
  65. package/dist/vercel/client/mockModel.js.map +1 -0
  66. package/dist/{client → vercel/client}/saveInputMessages.d.ts +2 -2
  67. package/dist/vercel/client/saveInputMessages.d.ts.map +1 -0
  68. package/dist/vercel/client/saveInputMessages.js.map +1 -0
  69. package/dist/{client → vercel/client}/search.d.ts +119 -22
  70. package/dist/vercel/client/search.d.ts.map +1 -0
  71. package/dist/{client → vercel/client}/search.js +2 -2
  72. package/dist/vercel/client/search.js.map +1 -0
  73. package/dist/{client → vercel/client}/start.d.ts +26 -11
  74. package/dist/vercel/client/start.d.ts.map +1 -0
  75. package/dist/{client → vercel/client}/start.js +64 -22
  76. package/dist/vercel/client/start.js.map +1 -0
  77. package/dist/{client → vercel/client}/streamText.d.ts +13 -12
  78. package/dist/vercel/client/streamText.d.ts.map +1 -0
  79. package/dist/{client → vercel/client}/streamText.js +43 -9
  80. package/dist/vercel/client/streamText.js.map +1 -0
  81. package/dist/{client → vercel/client}/streaming.d.ts +1410 -183
  82. package/dist/vercel/client/streaming.d.ts.map +1 -0
  83. package/dist/{client → vercel/client}/streaming.js +120 -52
  84. package/dist/vercel/client/streaming.js.map +1 -0
  85. package/dist/vercel/client/types.d.ts +456 -0
  86. package/dist/vercel/client/types.d.ts.map +1 -0
  87. package/dist/vercel/client/types.js +3 -0
  88. package/dist/vercel/client/types.js.map +1 -0
  89. package/dist/{client → vercel/client}/utils.d.ts +3 -2
  90. package/dist/vercel/client/utils.d.ts.map +1 -0
  91. package/dist/{client → vercel/client}/utils.js +2 -2
  92. package/dist/vercel/client/utils.js.map +1 -0
  93. package/dist/{deltas.d.ts → vercel/deltas.d.ts} +3 -4
  94. package/dist/vercel/deltas.d.ts.map +1 -0
  95. package/dist/{deltas.js → vercel/deltas.js} +195 -99
  96. package/dist/vercel/deltas.js.map +1 -0
  97. package/dist/{client → vercel}/index.d.ts +482 -106
  98. package/dist/vercel/index.d.ts.map +1 -0
  99. package/dist/{client → vercel}/index.js +64 -46
  100. package/dist/vercel/index.js.map +1 -0
  101. package/dist/{mapping.d.ts → vercel/mapping.d.ts} +5 -19
  102. package/dist/vercel/mapping.d.ts.map +1 -0
  103. package/dist/{mapping.js → vercel/mapping.js} +411 -114
  104. package/dist/vercel/mapping.js.map +1 -0
  105. package/dist/{react → vercel/react}/optimisticallySendMessage.d.ts +2 -2
  106. package/dist/vercel/react/optimisticallySendMessage.d.ts.map +1 -0
  107. package/dist/vercel/react/optimisticallySendMessage.js.map +1 -0
  108. package/dist/{react → vercel/react}/types.d.ts +1 -1
  109. package/dist/vercel/react/types.d.ts.map +1 -0
  110. package/dist/{react → vercel/react}/types.js.map +1 -1
  111. package/dist/{react → vercel/react}/useDeltaStreams.d.ts +1 -1
  112. package/dist/vercel/react/useDeltaStreams.d.ts.map +1 -0
  113. package/dist/{react → vercel/react}/useDeltaStreams.js +1 -1
  114. package/dist/vercel/react/useDeltaStreams.js.map +1 -0
  115. package/dist/{react → vercel/react}/useStreamingUIMessages.d.ts +1 -1
  116. package/dist/vercel/react/useStreamingUIMessages.d.ts.map +1 -0
  117. package/dist/{react → vercel/react}/useStreamingUIMessages.js +7 -3
  118. package/dist/vercel/react/useStreamingUIMessages.js.map +1 -0
  119. package/dist/{react → vercel/react}/useThreadMessages.d.ts +1 -1
  120. package/dist/vercel/react/useThreadMessages.d.ts.map +1 -0
  121. package/dist/{react → vercel/react}/useThreadMessages.js +1 -1
  122. package/dist/vercel/react/useThreadMessages.js.map +1 -0
  123. package/dist/{react → vercel/react}/useUIMessages.d.ts +1 -1
  124. package/dist/vercel/react/useUIMessages.d.ts.map +1 -0
  125. package/dist/{react → vercel/react}/useUIMessages.js +1 -1
  126. package/dist/vercel/react/useUIMessages.js.map +1 -0
  127. package/package.json +31 -24
  128. package/src/client/messages.ts +5 -107
  129. package/src/client/types.ts +0 -608
  130. package/src/component/_generated/component.ts +1089 -48
  131. package/src/component/messages.test.ts +273 -1
  132. package/src/component/messages.ts +62 -32
  133. package/src/component/streams.ts +47 -47
  134. package/src/component/threads.ts +5 -2
  135. package/src/eslintConfig.test.ts +44 -0
  136. package/src/react/index.ts +8 -5
  137. package/src/shared.ts +26 -36
  138. package/src/streaming/materializePersistedUIMessageChunks.test.ts +513 -0
  139. package/src/streaming/materializePersistedUIMessageChunks.ts +398 -0
  140. package/src/streaming/persistedUIMessageChunks.test.ts +205 -0
  141. package/src/streaming/persistedUIMessageChunks.ts +658 -0
  142. package/src/validators.test.ts +4 -1
  143. package/src/validators.ts +89 -8
  144. package/src/{UIMessages.combineUIMessages.test.ts → vercel/UIMessages.combineUIMessages.test.ts} +4 -1
  145. package/src/{UIMessages.ts → vercel/UIMessages.ts} +95 -3
  146. package/src/{client → vercel/client}/approval.test.ts +23 -13
  147. package/src/{client → vercel/client}/createTool.ts +62 -22
  148. package/src/{client → vercel/client}/definePlaygroundAPI.ts +15 -16
  149. package/src/{client → vercel/client}/files.ts +2 -2
  150. package/src/{client → vercel/client}/index.test.ts +99 -31
  151. package/src/vercel/client/messages.ts +182 -0
  152. package/src/{client → vercel/client}/mockModel.ts +38 -39
  153. package/src/{client → vercel/client}/saveInputMessages.test.ts +1 -1
  154. package/src/{client → vercel/client}/saveInputMessages.ts +3 -3
  155. package/src/{client → vercel/client}/search.test.ts +3 -3
  156. package/src/{client → vercel/client}/search.ts +4 -4
  157. package/src/{client → vercel/client}/setup.test.ts +6 -3
  158. package/src/vercel/client/start.test.ts +14 -0
  159. package/src/{client → vercel/client}/start.ts +147 -36
  160. package/src/vercel/client/streamText.test.ts +223 -0
  161. package/src/{client → vercel/client}/streamText.ts +102 -31
  162. package/src/{client → vercel/client}/streaming.integration.test.ts +6 -3
  163. package/src/{client → vercel/client}/streaming.test.ts +178 -4
  164. package/src/{client → vercel/client}/streaming.ts +114 -52
  165. package/src/vercel/client/types.test.ts +13 -0
  166. package/src/vercel/client/types.ts +679 -0
  167. package/src/{client → vercel/client}/utils.ts +13 -7
  168. package/src/{deltas.test.ts → vercel/deltas.test.ts} +384 -93
  169. package/src/{deltas.ts → vercel/deltas.ts} +218 -115
  170. package/src/{fromUIMessages.test.ts → vercel/fromUIMessages.test.ts} +17 -1
  171. package/src/{client → vercel}/index.ts +167 -84
  172. package/src/{mapping.test.ts → vercel/mapping.test.ts} +377 -92
  173. package/src/{mapping.ts → vercel/mapping.ts} +501 -137
  174. package/src/{react → vercel/react}/optimisticallySendMessage.ts +2 -2
  175. package/src/{react → vercel/react}/types.ts +1 -1
  176. package/src/{react → vercel/react}/useDeltaStreams.ts +6 -2
  177. package/src/{react → vercel/react}/useStreamingUIMessages.ts +7 -3
  178. package/src/{react → vercel/react}/useThreadMessages.ts +2 -2
  179. package/src/{react → vercel/react}/useUIMessages.ts +2 -2
  180. package/src/{toUIMessages.test.ts → vercel/toUIMessages.test.ts} +49 -2
  181. package/dist/UIMessages.d.ts.map +0 -1
  182. package/dist/UIMessages.js.map +0 -1
  183. package/dist/client/createTool.d.ts.map +0 -1
  184. package/dist/client/createTool.js.map +0 -1
  185. package/dist/client/definePlaygroundAPI.js.map +0 -1
  186. package/dist/client/files.d.ts.map +0 -1
  187. package/dist/client/files.js.map +0 -1
  188. package/dist/client/index.d.ts.map +0 -1
  189. package/dist/client/index.js.map +0 -1
  190. package/dist/client/mockModel.d.ts.map +0 -1
  191. package/dist/client/mockModel.js.map +0 -1
  192. package/dist/client/saveInputMessages.d.ts.map +0 -1
  193. package/dist/client/saveInputMessages.js.map +0 -1
  194. package/dist/client/search.d.ts.map +0 -1
  195. package/dist/client/search.js.map +0 -1
  196. package/dist/client/start.d.ts.map +0 -1
  197. package/dist/client/start.js.map +0 -1
  198. package/dist/client/streamText.d.ts.map +0 -1
  199. package/dist/client/streamText.js.map +0 -1
  200. package/dist/client/streaming.d.ts.map +0 -1
  201. package/dist/client/streaming.js.map +0 -1
  202. package/dist/client/utils.d.ts.map +0 -1
  203. package/dist/client/utils.js.map +0 -1
  204. package/dist/deltas.d.ts.map +0 -1
  205. package/dist/deltas.js.map +0 -1
  206. package/dist/mapping.d.ts.map +0 -1
  207. package/dist/mapping.js.map +0 -1
  208. package/dist/react/optimisticallySendMessage.d.ts.map +0 -1
  209. package/dist/react/optimisticallySendMessage.js.map +0 -1
  210. package/dist/react/types.d.ts.map +0 -1
  211. package/dist/react/useDeltaStreams.d.ts.map +0 -1
  212. package/dist/react/useDeltaStreams.js.map +0 -1
  213. package/dist/react/useStreamingUIMessages.d.ts.map +0 -1
  214. package/dist/react/useStreamingUIMessages.js.map +0 -1
  215. package/dist/react/useThreadMessages.d.ts.map +0 -1
  216. package/dist/react/useThreadMessages.js.map +0 -1
  217. package/dist/react/useUIMessages.d.ts.map +0 -1
  218. package/dist/react/useUIMessages.js.map +0 -1
  219. package/src/client/streamText.test.ts +0 -102
  220. /package/dist/{client → vercel/client}/files.js +0 -0
  221. /package/dist/{client → vercel/client}/saveInputMessages.js +0 -0
  222. /package/dist/{react → vercel/react}/optimisticallySendMessage.js +0 -0
  223. /package/dist/{react → vercel/react}/types.js +0 -0
  224. /package/src/{UIMessages.test.ts → vercel/UIMessages.test.ts} +0 -0
  225. /package/src/{react → vercel/react}/useUIMessages.test.ts +0 -0
@@ -116,13 +116,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
116
116
  text: string;
117
117
  type: "text";
118
118
  } | {
119
- image: string | ArrayBuffer;
119
+ image: string | ArrayBuffer | {
120
+ reference: Record<string, string>;
121
+ type: "reference";
122
+ };
120
123
  mediaType?: string;
121
124
  mimeType?: string;
122
125
  providerOptions?: Record<string, Record<string, any>>;
123
126
  type: "image";
124
127
  } | {
125
- data: string | ArrayBuffer;
128
+ data: string | ArrayBuffer | {
129
+ reference: Record<string, string>;
130
+ type: "reference";
131
+ };
126
132
  filename?: string;
127
133
  mediaType?: string;
128
134
  mimeType?: string;
@@ -139,7 +145,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
139
145
  text: string;
140
146
  type: "text";
141
147
  } | {
142
- data: string | ArrayBuffer;
148
+ data: string | ArrayBuffer | {
149
+ reference: Record<string, string>;
150
+ type: "reference";
151
+ };
143
152
  filename?: string;
144
153
  mediaType?: string;
145
154
  mimeType?: string;
@@ -152,6 +161,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
152
161
  signature?: string;
153
162
  text: string;
154
163
  type: "reasoning";
164
+ } | {
165
+ data?: string | ArrayBuffer;
166
+ mediaType: string;
167
+ providerMetadata?: Record<string, Record<string, any>>;
168
+ providerOptions?: Record<string, Record<string, any>>;
169
+ type: "reasoning-file";
170
+ url?: string;
171
+ } | {
172
+ kind: string;
173
+ providerMetadata?: Record<string, Record<string, any>>;
174
+ providerOptions?: Record<string, Record<string, any>>;
175
+ type: "custom";
155
176
  } | {
156
177
  data: string;
157
178
  providerMetadata?: Record<string, Record<string, any>>;
@@ -163,7 +184,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
163
184
  providerExecuted?: boolean;
164
185
  providerMetadata?: Record<string, Record<string, any>>;
165
186
  providerOptions?: Record<string, Record<string, any>>;
187
+ title?: string;
166
188
  toolCallId: string;
189
+ toolMetadata?: Record<string, any>;
167
190
  toolName: string;
168
191
  type: "tool-call";
169
192
  } | {
@@ -172,7 +195,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
172
195
  providerExecuted?: boolean;
173
196
  providerMetadata?: Record<string, Record<string, any>>;
174
197
  providerOptions?: Record<string, Record<string, any>>;
198
+ title?: string;
175
199
  toolCallId: string;
200
+ toolMetadata?: Record<string, any>;
176
201
  toolName: string;
177
202
  type: "tool-call";
178
203
  } | {
@@ -212,6 +237,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
212
237
  providerOptions?: Record<string, Record<string, any>>;
213
238
  text: string;
214
239
  type: "text";
240
+ } | {
241
+ data: {
242
+ type: "url";
243
+ url: string;
244
+ } | {
245
+ reference: Record<string, string>;
246
+ type: "reference";
247
+ } | {
248
+ data: string | ArrayBuffer;
249
+ type: "data";
250
+ } | {
251
+ text: string;
252
+ type: "text";
253
+ };
254
+ filename?: string;
255
+ mediaType: string;
256
+ providerOptions?: Record<string, Record<string, any>>;
257
+ type: "file";
215
258
  } | {
216
259
  data: string;
217
260
  mediaType: string;
@@ -223,6 +266,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
223
266
  providerOptions?: Record<string, Record<string, any>>;
224
267
  type: "file-data";
225
268
  } | {
269
+ mediaType?: string;
226
270
  providerOptions?: Record<string, Record<string, any>>;
227
271
  type: "file-url";
228
272
  url: string;
@@ -230,11 +274,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
230
274
  fileId: string | Record<string, string>;
231
275
  providerOptions?: Record<string, Record<string, any>>;
232
276
  type: "file-id";
277
+ } | {
278
+ providerOptions?: Record<string, Record<string, any>>;
279
+ providerReference: Record<string, string>;
280
+ type: "file-reference";
233
281
  } | {
234
282
  data: string;
235
283
  mediaType: string;
236
284
  providerOptions?: Record<string, Record<string, any>>;
237
285
  type: "image-data";
286
+ } | {
287
+ providerOptions?: Record<string, Record<string, any>>;
288
+ providerReference: Record<string, string>;
289
+ type: "image-file-reference";
238
290
  } | {
239
291
  providerOptions?: Record<string, Record<string, any>>;
240
292
  type: "image-url";
@@ -274,8 +326,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
274
326
  type: "source";
275
327
  } | {
276
328
  approvalId: string;
329
+ isAutomatic?: boolean;
277
330
  providerMetadata?: Record<string, Record<string, any>>;
278
331
  providerOptions?: Record<string, Record<string, any>>;
332
+ signature?: string;
279
333
  toolCallId: string;
280
334
  type: "tool-approval-request";
281
335
  }>;
@@ -319,6 +373,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
319
373
  providerOptions?: Record<string, Record<string, any>>;
320
374
  text: string;
321
375
  type: "text";
376
+ } | {
377
+ data: {
378
+ type: "url";
379
+ url: string;
380
+ } | {
381
+ reference: Record<string, string>;
382
+ type: "reference";
383
+ } | {
384
+ data: string | ArrayBuffer;
385
+ type: "data";
386
+ } | {
387
+ text: string;
388
+ type: "text";
389
+ };
390
+ filename?: string;
391
+ mediaType: string;
392
+ providerOptions?: Record<string, Record<string, any>>;
393
+ type: "file";
322
394
  } | {
323
395
  data: string;
324
396
  mediaType: string;
@@ -330,6 +402,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
330
402
  providerOptions?: Record<string, Record<string, any>>;
331
403
  type: "file-data";
332
404
  } | {
405
+ mediaType?: string;
333
406
  providerOptions?: Record<string, Record<string, any>>;
334
407
  type: "file-url";
335
408
  url: string;
@@ -337,11 +410,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
337
410
  fileId: string | Record<string, string>;
338
411
  providerOptions?: Record<string, Record<string, any>>;
339
412
  type: "file-id";
413
+ } | {
414
+ providerOptions?: Record<string, Record<string, any>>;
415
+ providerReference: Record<string, string>;
416
+ type: "file-reference";
340
417
  } | {
341
418
  data: string;
342
419
  mediaType: string;
343
420
  providerOptions?: Record<string, Record<string, any>>;
344
421
  type: "image-data";
422
+ } | {
423
+ providerOptions?: Record<string, Record<string, any>>;
424
+ providerReference: Record<string, string>;
425
+ type: "image-file-reference";
345
426
  } | {
346
427
  providerOptions?: Record<string, Record<string, any>>;
347
428
  type: "image-url";
@@ -417,13 +498,29 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
417
498
  status?: "pending" | "success" | "failed";
418
499
  text?: string;
419
500
  usage?: {
501
+ cacheWriteInputTokens?: number;
420
502
  cachedInputTokens?: number;
421
- completionTokens: number;
422
- promptTokens: number;
503
+ completionTokens?: number;
504
+ nonCachedInputTokens?: number;
505
+ promptTokens?: number;
506
+ raw?: Record<string, any>;
423
507
  reasoningTokens?: number;
424
- totalTokens: number;
508
+ textOutputTokens?: number;
509
+ totalTokens?: number;
425
510
  };
426
511
  warnings?: Array<{
512
+ details?: string;
513
+ feature: string;
514
+ type: "unsupported";
515
+ } | {
516
+ details?: string;
517
+ feature: string;
518
+ type: "compatibility";
519
+ } | {
520
+ message: string;
521
+ setting: string;
522
+ type: "deprecated";
523
+ } | {
427
524
  details?: string;
428
525
  setting: string;
429
526
  type: "unsupported-setting";
@@ -457,13 +554,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
457
554
  text: string;
458
555
  type: "text";
459
556
  } | {
460
- image: string | ArrayBuffer;
557
+ image: string | ArrayBuffer | {
558
+ reference: Record<string, string>;
559
+ type: "reference";
560
+ };
461
561
  mediaType?: string;
462
562
  mimeType?: string;
463
563
  providerOptions?: Record<string, Record<string, any>>;
464
564
  type: "image";
465
565
  } | {
466
- data: string | ArrayBuffer;
566
+ data: string | ArrayBuffer | {
567
+ reference: Record<string, string>;
568
+ type: "reference";
569
+ };
467
570
  filename?: string;
468
571
  mediaType?: string;
469
572
  mimeType?: string;
@@ -480,7 +583,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
480
583
  text: string;
481
584
  type: "text";
482
585
  } | {
483
- data: string | ArrayBuffer;
586
+ data: string | ArrayBuffer | {
587
+ reference: Record<string, string>;
588
+ type: "reference";
589
+ };
484
590
  filename?: string;
485
591
  mediaType?: string;
486
592
  mimeType?: string;
@@ -493,6 +599,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
493
599
  signature?: string;
494
600
  text: string;
495
601
  type: "reasoning";
602
+ } | {
603
+ data?: string | ArrayBuffer;
604
+ mediaType: string;
605
+ providerMetadata?: Record<string, Record<string, any>>;
606
+ providerOptions?: Record<string, Record<string, any>>;
607
+ type: "reasoning-file";
608
+ url?: string;
609
+ } | {
610
+ kind: string;
611
+ providerMetadata?: Record<string, Record<string, any>>;
612
+ providerOptions?: Record<string, Record<string, any>>;
613
+ type: "custom";
496
614
  } | {
497
615
  data: string;
498
616
  providerMetadata?: Record<string, Record<string, any>>;
@@ -504,7 +622,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
504
622
  providerExecuted?: boolean;
505
623
  providerMetadata?: Record<string, Record<string, any>>;
506
624
  providerOptions?: Record<string, Record<string, any>>;
625
+ title?: string;
507
626
  toolCallId: string;
627
+ toolMetadata?: Record<string, any>;
508
628
  toolName: string;
509
629
  type: "tool-call";
510
630
  } | {
@@ -513,7 +633,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
513
633
  providerExecuted?: boolean;
514
634
  providerMetadata?: Record<string, Record<string, any>>;
515
635
  providerOptions?: Record<string, Record<string, any>>;
636
+ title?: string;
516
637
  toolCallId: string;
638
+ toolMetadata?: Record<string, any>;
517
639
  toolName: string;
518
640
  type: "tool-call";
519
641
  } | {
@@ -553,6 +675,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
553
675
  providerOptions?: Record<string, Record<string, any>>;
554
676
  text: string;
555
677
  type: "text";
678
+ } | {
679
+ data: {
680
+ type: "url";
681
+ url: string;
682
+ } | {
683
+ reference: Record<string, string>;
684
+ type: "reference";
685
+ } | {
686
+ data: string | ArrayBuffer;
687
+ type: "data";
688
+ } | {
689
+ text: string;
690
+ type: "text";
691
+ };
692
+ filename?: string;
693
+ mediaType: string;
694
+ providerOptions?: Record<string, Record<string, any>>;
695
+ type: "file";
556
696
  } | {
557
697
  data: string;
558
698
  mediaType: string;
@@ -564,6 +704,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
564
704
  providerOptions?: Record<string, Record<string, any>>;
565
705
  type: "file-data";
566
706
  } | {
707
+ mediaType?: string;
567
708
  providerOptions?: Record<string, Record<string, any>>;
568
709
  type: "file-url";
569
710
  url: string;
@@ -571,11 +712,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
571
712
  fileId: string | Record<string, string>;
572
713
  providerOptions?: Record<string, Record<string, any>>;
573
714
  type: "file-id";
715
+ } | {
716
+ providerOptions?: Record<string, Record<string, any>>;
717
+ providerReference: Record<string, string>;
718
+ type: "file-reference";
574
719
  } | {
575
720
  data: string;
576
721
  mediaType: string;
577
722
  providerOptions?: Record<string, Record<string, any>>;
578
723
  type: "image-data";
724
+ } | {
725
+ providerOptions?: Record<string, Record<string, any>>;
726
+ providerReference: Record<string, string>;
727
+ type: "image-file-reference";
579
728
  } | {
580
729
  providerOptions?: Record<string, Record<string, any>>;
581
730
  type: "image-url";
@@ -615,8 +764,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
615
764
  type: "source";
616
765
  } | {
617
766
  approvalId: string;
767
+ isAutomatic?: boolean;
618
768
  providerMetadata?: Record<string, Record<string, any>>;
619
769
  providerOptions?: Record<string, Record<string, any>>;
770
+ signature?: string;
620
771
  toolCallId: string;
621
772
  type: "tool-approval-request";
622
773
  }>;
@@ -660,6 +811,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
660
811
  providerOptions?: Record<string, Record<string, any>>;
661
812
  text: string;
662
813
  type: "text";
814
+ } | {
815
+ data: {
816
+ type: "url";
817
+ url: string;
818
+ } | {
819
+ reference: Record<string, string>;
820
+ type: "reference";
821
+ } | {
822
+ data: string | ArrayBuffer;
823
+ type: "data";
824
+ } | {
825
+ text: string;
826
+ type: "text";
827
+ };
828
+ filename?: string;
829
+ mediaType: string;
830
+ providerOptions?: Record<string, Record<string, any>>;
831
+ type: "file";
663
832
  } | {
664
833
  data: string;
665
834
  mediaType: string;
@@ -671,6 +840,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
671
840
  providerOptions?: Record<string, Record<string, any>>;
672
841
  type: "file-data";
673
842
  } | {
843
+ mediaType?: string;
674
844
  providerOptions?: Record<string, Record<string, any>>;
675
845
  type: "file-url";
676
846
  url: string;
@@ -678,11 +848,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
678
848
  fileId: string | Record<string, string>;
679
849
  providerOptions?: Record<string, Record<string, any>>;
680
850
  type: "file-id";
851
+ } | {
852
+ providerOptions?: Record<string, Record<string, any>>;
853
+ providerReference: Record<string, string>;
854
+ type: "file-reference";
681
855
  } | {
682
856
  data: string;
683
857
  mediaType: string;
684
858
  providerOptions?: Record<string, Record<string, any>>;
685
859
  type: "image-data";
860
+ } | {
861
+ providerOptions?: Record<string, Record<string, any>>;
862
+ providerReference: Record<string, string>;
863
+ type: "image-file-reference";
686
864
  } | {
687
865
  providerOptions?: Record<string, Record<string, any>>;
688
866
  type: "image-url";
@@ -763,14 +941,30 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
763
941
  threadId: string;
764
942
  tool: boolean;
765
943
  usage?: {
944
+ cacheWriteInputTokens?: number;
766
945
  cachedInputTokens?: number;
767
- completionTokens: number;
768
- promptTokens: number;
946
+ completionTokens?: number;
947
+ nonCachedInputTokens?: number;
948
+ promptTokens?: number;
949
+ raw?: Record<string, any>;
769
950
  reasoningTokens?: number;
770
- totalTokens: number;
951
+ textOutputTokens?: number;
952
+ totalTokens?: number;
771
953
  };
772
954
  userId?: string;
773
955
  warnings?: Array<{
956
+ details?: string;
957
+ feature: string;
958
+ type: "unsupported";
959
+ } | {
960
+ details?: string;
961
+ feature: string;
962
+ type: "compatibility";
963
+ } | {
964
+ message: string;
965
+ setting: string;
966
+ type: "deprecated";
967
+ } | {
774
968
  details?: string;
775
969
  setting: string;
776
970
  type: "unsupported-setting";
@@ -836,13 +1030,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
836
1030
  text: string;
837
1031
  type: "text";
838
1032
  } | {
839
- image: string | ArrayBuffer;
1033
+ image: string | ArrayBuffer | {
1034
+ reference: Record<string, string>;
1035
+ type: "reference";
1036
+ };
840
1037
  mediaType?: string;
841
1038
  mimeType?: string;
842
1039
  providerOptions?: Record<string, Record<string, any>>;
843
1040
  type: "image";
844
1041
  } | {
845
- data: string | ArrayBuffer;
1042
+ data: string | ArrayBuffer | {
1043
+ reference: Record<string, string>;
1044
+ type: "reference";
1045
+ };
846
1046
  filename?: string;
847
1047
  mediaType?: string;
848
1048
  mimeType?: string;
@@ -859,7 +1059,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
859
1059
  text: string;
860
1060
  type: "text";
861
1061
  } | {
862
- data: string | ArrayBuffer;
1062
+ data: string | ArrayBuffer | {
1063
+ reference: Record<string, string>;
1064
+ type: "reference";
1065
+ };
863
1066
  filename?: string;
864
1067
  mediaType?: string;
865
1068
  mimeType?: string;
@@ -872,6 +1075,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
872
1075
  signature?: string;
873
1076
  text: string;
874
1077
  type: "reasoning";
1078
+ } | {
1079
+ data?: string | ArrayBuffer;
1080
+ mediaType: string;
1081
+ providerMetadata?: Record<string, Record<string, any>>;
1082
+ providerOptions?: Record<string, Record<string, any>>;
1083
+ type: "reasoning-file";
1084
+ url?: string;
1085
+ } | {
1086
+ kind: string;
1087
+ providerMetadata?: Record<string, Record<string, any>>;
1088
+ providerOptions?: Record<string, Record<string, any>>;
1089
+ type: "custom";
875
1090
  } | {
876
1091
  data: string;
877
1092
  providerMetadata?: Record<string, Record<string, any>>;
@@ -883,7 +1098,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
883
1098
  providerExecuted?: boolean;
884
1099
  providerMetadata?: Record<string, Record<string, any>>;
885
1100
  providerOptions?: Record<string, Record<string, any>>;
1101
+ title?: string;
886
1102
  toolCallId: string;
1103
+ toolMetadata?: Record<string, any>;
887
1104
  toolName: string;
888
1105
  type: "tool-call";
889
1106
  } | {
@@ -892,7 +1109,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
892
1109
  providerExecuted?: boolean;
893
1110
  providerMetadata?: Record<string, Record<string, any>>;
894
1111
  providerOptions?: Record<string, Record<string, any>>;
1112
+ title?: string;
895
1113
  toolCallId: string;
1114
+ toolMetadata?: Record<string, any>;
896
1115
  toolName: string;
897
1116
  type: "tool-call";
898
1117
  } | {
@@ -932,6 +1151,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
932
1151
  providerOptions?: Record<string, Record<string, any>>;
933
1152
  text: string;
934
1153
  type: "text";
1154
+ } | {
1155
+ data: {
1156
+ type: "url";
1157
+ url: string;
1158
+ } | {
1159
+ reference: Record<string, string>;
1160
+ type: "reference";
1161
+ } | {
1162
+ data: string | ArrayBuffer;
1163
+ type: "data";
1164
+ } | {
1165
+ text: string;
1166
+ type: "text";
1167
+ };
1168
+ filename?: string;
1169
+ mediaType: string;
1170
+ providerOptions?: Record<string, Record<string, any>>;
1171
+ type: "file";
935
1172
  } | {
936
1173
  data: string;
937
1174
  mediaType: string;
@@ -943,6 +1180,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
943
1180
  providerOptions?: Record<string, Record<string, any>>;
944
1181
  type: "file-data";
945
1182
  } | {
1183
+ mediaType?: string;
946
1184
  providerOptions?: Record<string, Record<string, any>>;
947
1185
  type: "file-url";
948
1186
  url: string;
@@ -950,11 +1188,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
950
1188
  fileId: string | Record<string, string>;
951
1189
  providerOptions?: Record<string, Record<string, any>>;
952
1190
  type: "file-id";
1191
+ } | {
1192
+ providerOptions?: Record<string, Record<string, any>>;
1193
+ providerReference: Record<string, string>;
1194
+ type: "file-reference";
953
1195
  } | {
954
1196
  data: string;
955
1197
  mediaType: string;
956
1198
  providerOptions?: Record<string, Record<string, any>>;
957
1199
  type: "image-data";
1200
+ } | {
1201
+ providerOptions?: Record<string, Record<string, any>>;
1202
+ providerReference: Record<string, string>;
1203
+ type: "image-file-reference";
958
1204
  } | {
959
1205
  providerOptions?: Record<string, Record<string, any>>;
960
1206
  type: "image-url";
@@ -994,8 +1240,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
994
1240
  type: "source";
995
1241
  } | {
996
1242
  approvalId: string;
1243
+ isAutomatic?: boolean;
997
1244
  providerMetadata?: Record<string, Record<string, any>>;
998
1245
  providerOptions?: Record<string, Record<string, any>>;
1246
+ signature?: string;
999
1247
  toolCallId: string;
1000
1248
  type: "tool-approval-request";
1001
1249
  }>;
@@ -1039,6 +1287,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1039
1287
  providerOptions?: Record<string, Record<string, any>>;
1040
1288
  text: string;
1041
1289
  type: "text";
1290
+ } | {
1291
+ data: {
1292
+ type: "url";
1293
+ url: string;
1294
+ } | {
1295
+ reference: Record<string, string>;
1296
+ type: "reference";
1297
+ } | {
1298
+ data: string | ArrayBuffer;
1299
+ type: "data";
1300
+ } | {
1301
+ text: string;
1302
+ type: "text";
1303
+ };
1304
+ filename?: string;
1305
+ mediaType: string;
1306
+ providerOptions?: Record<string, Record<string, any>>;
1307
+ type: "file";
1042
1308
  } | {
1043
1309
  data: string;
1044
1310
  mediaType: string;
@@ -1050,6 +1316,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1050
1316
  providerOptions?: Record<string, Record<string, any>>;
1051
1317
  type: "file-data";
1052
1318
  } | {
1319
+ mediaType?: string;
1053
1320
  providerOptions?: Record<string, Record<string, any>>;
1054
1321
  type: "file-url";
1055
1322
  url: string;
@@ -1057,11 +1324,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1057
1324
  fileId: string | Record<string, string>;
1058
1325
  providerOptions?: Record<string, Record<string, any>>;
1059
1326
  type: "file-id";
1327
+ } | {
1328
+ providerOptions?: Record<string, Record<string, any>>;
1329
+ providerReference: Record<string, string>;
1330
+ type: "file-reference";
1060
1331
  } | {
1061
1332
  data: string;
1062
1333
  mediaType: string;
1063
1334
  providerOptions?: Record<string, Record<string, any>>;
1064
1335
  type: "image-data";
1336
+ } | {
1337
+ providerOptions?: Record<string, Record<string, any>>;
1338
+ providerReference: Record<string, string>;
1339
+ type: "image-file-reference";
1065
1340
  } | {
1066
1341
  providerOptions?: Record<string, Record<string, any>>;
1067
1342
  type: "image-url";
@@ -1142,14 +1417,30 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1142
1417
  threadId: string;
1143
1418
  tool: boolean;
1144
1419
  usage?: {
1420
+ cacheWriteInputTokens?: number;
1145
1421
  cachedInputTokens?: number;
1146
- completionTokens: number;
1147
- promptTokens: number;
1422
+ completionTokens?: number;
1423
+ nonCachedInputTokens?: number;
1424
+ promptTokens?: number;
1425
+ raw?: Record<string, any>;
1148
1426
  reasoningTokens?: number;
1149
- totalTokens: number;
1427
+ textOutputTokens?: number;
1428
+ totalTokens?: number;
1150
1429
  };
1151
1430
  userId?: string;
1152
1431
  warnings?: Array<{
1432
+ details?: string;
1433
+ feature: string;
1434
+ type: "unsupported";
1435
+ } | {
1436
+ details?: string;
1437
+ feature: string;
1438
+ type: "compatibility";
1439
+ } | {
1440
+ message: string;
1441
+ setting: string;
1442
+ type: "deprecated";
1443
+ } | {
1153
1444
  details?: string;
1154
1445
  setting: string;
1155
1446
  type: "unsupported-setting";
@@ -1202,13 +1493,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1202
1493
  text: string;
1203
1494
  type: "text";
1204
1495
  } | {
1205
- image: string | ArrayBuffer;
1496
+ image: string | ArrayBuffer | {
1497
+ reference: Record<string, string>;
1498
+ type: "reference";
1499
+ };
1206
1500
  mediaType?: string;
1207
1501
  mimeType?: string;
1208
1502
  providerOptions?: Record<string, Record<string, any>>;
1209
1503
  type: "image";
1210
1504
  } | {
1211
- data: string | ArrayBuffer;
1505
+ data: string | ArrayBuffer | {
1506
+ reference: Record<string, string>;
1507
+ type: "reference";
1508
+ };
1212
1509
  filename?: string;
1213
1510
  mediaType?: string;
1214
1511
  mimeType?: string;
@@ -1225,7 +1522,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1225
1522
  text: string;
1226
1523
  type: "text";
1227
1524
  } | {
1228
- data: string | ArrayBuffer;
1525
+ data: string | ArrayBuffer | {
1526
+ reference: Record<string, string>;
1527
+ type: "reference";
1528
+ };
1229
1529
  filename?: string;
1230
1530
  mediaType?: string;
1231
1531
  mimeType?: string;
@@ -1238,6 +1538,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1238
1538
  signature?: string;
1239
1539
  text: string;
1240
1540
  type: "reasoning";
1541
+ } | {
1542
+ data?: string | ArrayBuffer;
1543
+ mediaType: string;
1544
+ providerMetadata?: Record<string, Record<string, any>>;
1545
+ providerOptions?: Record<string, Record<string, any>>;
1546
+ type: "reasoning-file";
1547
+ url?: string;
1548
+ } | {
1549
+ kind: string;
1550
+ providerMetadata?: Record<string, Record<string, any>>;
1551
+ providerOptions?: Record<string, Record<string, any>>;
1552
+ type: "custom";
1241
1553
  } | {
1242
1554
  data: string;
1243
1555
  providerMetadata?: Record<string, Record<string, any>>;
@@ -1249,7 +1561,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1249
1561
  providerExecuted?: boolean;
1250
1562
  providerMetadata?: Record<string, Record<string, any>>;
1251
1563
  providerOptions?: Record<string, Record<string, any>>;
1564
+ title?: string;
1252
1565
  toolCallId: string;
1566
+ toolMetadata?: Record<string, any>;
1253
1567
  toolName: string;
1254
1568
  type: "tool-call";
1255
1569
  } | {
@@ -1258,7 +1572,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1258
1572
  providerExecuted?: boolean;
1259
1573
  providerMetadata?: Record<string, Record<string, any>>;
1260
1574
  providerOptions?: Record<string, Record<string, any>>;
1575
+ title?: string;
1261
1576
  toolCallId: string;
1577
+ toolMetadata?: Record<string, any>;
1262
1578
  toolName: string;
1263
1579
  type: "tool-call";
1264
1580
  } | {
@@ -1298,6 +1614,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1298
1614
  providerOptions?: Record<string, Record<string, any>>;
1299
1615
  text: string;
1300
1616
  type: "text";
1617
+ } | {
1618
+ data: {
1619
+ type: "url";
1620
+ url: string;
1621
+ } | {
1622
+ reference: Record<string, string>;
1623
+ type: "reference";
1624
+ } | {
1625
+ data: string | ArrayBuffer;
1626
+ type: "data";
1627
+ } | {
1628
+ text: string;
1629
+ type: "text";
1630
+ };
1631
+ filename?: string;
1632
+ mediaType: string;
1633
+ providerOptions?: Record<string, Record<string, any>>;
1634
+ type: "file";
1301
1635
  } | {
1302
1636
  data: string;
1303
1637
  mediaType: string;
@@ -1309,6 +1643,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1309
1643
  providerOptions?: Record<string, Record<string, any>>;
1310
1644
  type: "file-data";
1311
1645
  } | {
1646
+ mediaType?: string;
1312
1647
  providerOptions?: Record<string, Record<string, any>>;
1313
1648
  type: "file-url";
1314
1649
  url: string;
@@ -1316,11 +1651,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1316
1651
  fileId: string | Record<string, string>;
1317
1652
  providerOptions?: Record<string, Record<string, any>>;
1318
1653
  type: "file-id";
1654
+ } | {
1655
+ providerOptions?: Record<string, Record<string, any>>;
1656
+ providerReference: Record<string, string>;
1657
+ type: "file-reference";
1319
1658
  } | {
1320
1659
  data: string;
1321
1660
  mediaType: string;
1322
1661
  providerOptions?: Record<string, Record<string, any>>;
1323
1662
  type: "image-data";
1663
+ } | {
1664
+ providerOptions?: Record<string, Record<string, any>>;
1665
+ providerReference: Record<string, string>;
1666
+ type: "image-file-reference";
1324
1667
  } | {
1325
1668
  providerOptions?: Record<string, Record<string, any>>;
1326
1669
  type: "image-url";
@@ -1360,8 +1703,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1360
1703
  type: "source";
1361
1704
  } | {
1362
1705
  approvalId: string;
1706
+ isAutomatic?: boolean;
1363
1707
  providerMetadata?: Record<string, Record<string, any>>;
1364
1708
  providerOptions?: Record<string, Record<string, any>>;
1709
+ signature?: string;
1365
1710
  toolCallId: string;
1366
1711
  type: "tool-approval-request";
1367
1712
  }>;
@@ -1405,6 +1750,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1405
1750
  providerOptions?: Record<string, Record<string, any>>;
1406
1751
  text: string;
1407
1752
  type: "text";
1753
+ } | {
1754
+ data: {
1755
+ type: "url";
1756
+ url: string;
1757
+ } | {
1758
+ reference: Record<string, string>;
1759
+ type: "reference";
1760
+ } | {
1761
+ data: string | ArrayBuffer;
1762
+ type: "data";
1763
+ } | {
1764
+ text: string;
1765
+ type: "text";
1766
+ };
1767
+ filename?: string;
1768
+ mediaType: string;
1769
+ providerOptions?: Record<string, Record<string, any>>;
1770
+ type: "file";
1408
1771
  } | {
1409
1772
  data: string;
1410
1773
  mediaType: string;
@@ -1416,6 +1779,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1416
1779
  providerOptions?: Record<string, Record<string, any>>;
1417
1780
  type: "file-data";
1418
1781
  } | {
1782
+ mediaType?: string;
1419
1783
  providerOptions?: Record<string, Record<string, any>>;
1420
1784
  type: "file-url";
1421
1785
  url: string;
@@ -1423,11 +1787,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1423
1787
  fileId: string | Record<string, string>;
1424
1788
  providerOptions?: Record<string, Record<string, any>>;
1425
1789
  type: "file-id";
1790
+ } | {
1791
+ providerOptions?: Record<string, Record<string, any>>;
1792
+ providerReference: Record<string, string>;
1793
+ type: "file-reference";
1426
1794
  } | {
1427
1795
  data: string;
1428
1796
  mediaType: string;
1429
1797
  providerOptions?: Record<string, Record<string, any>>;
1430
1798
  type: "image-data";
1799
+ } | {
1800
+ providerOptions?: Record<string, Record<string, any>>;
1801
+ providerReference: Record<string, string>;
1802
+ type: "image-file-reference";
1431
1803
  } | {
1432
1804
  providerOptions?: Record<string, Record<string, any>>;
1433
1805
  type: "image-url";
@@ -1508,14 +1880,30 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1508
1880
  threadId: string;
1509
1881
  tool: boolean;
1510
1882
  usage?: {
1883
+ cacheWriteInputTokens?: number;
1511
1884
  cachedInputTokens?: number;
1512
- completionTokens: number;
1513
- promptTokens: number;
1885
+ completionTokens?: number;
1886
+ nonCachedInputTokens?: number;
1887
+ promptTokens?: number;
1888
+ raw?: Record<string, any>;
1514
1889
  reasoningTokens?: number;
1515
- totalTokens: number;
1890
+ textOutputTokens?: number;
1891
+ totalTokens?: number;
1516
1892
  };
1517
1893
  userId?: string;
1518
1894
  warnings?: Array<{
1895
+ details?: string;
1896
+ feature: string;
1897
+ type: "unsupported";
1898
+ } | {
1899
+ details?: string;
1900
+ feature: string;
1901
+ type: "compatibility";
1902
+ } | {
1903
+ message: string;
1904
+ setting: string;
1905
+ type: "deprecated";
1906
+ } | {
1519
1907
  details?: string;
1520
1908
  setting: string;
1521
1909
  type: "unsupported-setting";
@@ -1562,13 +1950,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1562
1950
  text: string;
1563
1951
  type: "text";
1564
1952
  } | {
1565
- image: string | ArrayBuffer;
1953
+ image: string | ArrayBuffer | {
1954
+ reference: Record<string, string>;
1955
+ type: "reference";
1956
+ };
1566
1957
  mediaType?: string;
1567
1958
  mimeType?: string;
1568
1959
  providerOptions?: Record<string, Record<string, any>>;
1569
1960
  type: "image";
1570
1961
  } | {
1571
- data: string | ArrayBuffer;
1962
+ data: string | ArrayBuffer | {
1963
+ reference: Record<string, string>;
1964
+ type: "reference";
1965
+ };
1572
1966
  filename?: string;
1573
1967
  mediaType?: string;
1574
1968
  mimeType?: string;
@@ -1585,7 +1979,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1585
1979
  text: string;
1586
1980
  type: "text";
1587
1981
  } | {
1588
- data: string | ArrayBuffer;
1982
+ data: string | ArrayBuffer | {
1983
+ reference: Record<string, string>;
1984
+ type: "reference";
1985
+ };
1589
1986
  filename?: string;
1590
1987
  mediaType?: string;
1591
1988
  mimeType?: string;
@@ -1598,6 +1995,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1598
1995
  signature?: string;
1599
1996
  text: string;
1600
1997
  type: "reasoning";
1998
+ } | {
1999
+ data?: string | ArrayBuffer;
2000
+ mediaType: string;
2001
+ providerMetadata?: Record<string, Record<string, any>>;
2002
+ providerOptions?: Record<string, Record<string, any>>;
2003
+ type: "reasoning-file";
2004
+ url?: string;
2005
+ } | {
2006
+ kind: string;
2007
+ providerMetadata?: Record<string, Record<string, any>>;
2008
+ providerOptions?: Record<string, Record<string, any>>;
2009
+ type: "custom";
1601
2010
  } | {
1602
2011
  data: string;
1603
2012
  providerMetadata?: Record<string, Record<string, any>>;
@@ -1609,7 +2018,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1609
2018
  providerExecuted?: boolean;
1610
2019
  providerMetadata?: Record<string, Record<string, any>>;
1611
2020
  providerOptions?: Record<string, Record<string, any>>;
2021
+ title?: string;
1612
2022
  toolCallId: string;
2023
+ toolMetadata?: Record<string, any>;
1613
2024
  toolName: string;
1614
2025
  type: "tool-call";
1615
2026
  } | {
@@ -1618,7 +2029,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1618
2029
  providerExecuted?: boolean;
1619
2030
  providerMetadata?: Record<string, Record<string, any>>;
1620
2031
  providerOptions?: Record<string, Record<string, any>>;
2032
+ title?: string;
1621
2033
  toolCallId: string;
2034
+ toolMetadata?: Record<string, any>;
1622
2035
  toolName: string;
1623
2036
  type: "tool-call";
1624
2037
  } | {
@@ -1658,6 +2071,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1658
2071
  providerOptions?: Record<string, Record<string, any>>;
1659
2072
  text: string;
1660
2073
  type: "text";
2074
+ } | {
2075
+ data: {
2076
+ type: "url";
2077
+ url: string;
2078
+ } | {
2079
+ reference: Record<string, string>;
2080
+ type: "reference";
2081
+ } | {
2082
+ data: string | ArrayBuffer;
2083
+ type: "data";
2084
+ } | {
2085
+ text: string;
2086
+ type: "text";
2087
+ };
2088
+ filename?: string;
2089
+ mediaType: string;
2090
+ providerOptions?: Record<string, Record<string, any>>;
2091
+ type: "file";
1661
2092
  } | {
1662
2093
  data: string;
1663
2094
  mediaType: string;
@@ -1669,6 +2100,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1669
2100
  providerOptions?: Record<string, Record<string, any>>;
1670
2101
  type: "file-data";
1671
2102
  } | {
2103
+ mediaType?: string;
1672
2104
  providerOptions?: Record<string, Record<string, any>>;
1673
2105
  type: "file-url";
1674
2106
  url: string;
@@ -1676,11 +2108,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1676
2108
  fileId: string | Record<string, string>;
1677
2109
  providerOptions?: Record<string, Record<string, any>>;
1678
2110
  type: "file-id";
2111
+ } | {
2112
+ providerOptions?: Record<string, Record<string, any>>;
2113
+ providerReference: Record<string, string>;
2114
+ type: "file-reference";
1679
2115
  } | {
1680
2116
  data: string;
1681
2117
  mediaType: string;
1682
2118
  providerOptions?: Record<string, Record<string, any>>;
1683
2119
  type: "image-data";
2120
+ } | {
2121
+ providerOptions?: Record<string, Record<string, any>>;
2122
+ providerReference: Record<string, string>;
2123
+ type: "image-file-reference";
1684
2124
  } | {
1685
2125
  providerOptions?: Record<string, Record<string, any>>;
1686
2126
  type: "image-url";
@@ -1720,8 +2160,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1720
2160
  type: "source";
1721
2161
  } | {
1722
2162
  approvalId: string;
2163
+ isAutomatic?: boolean;
1723
2164
  providerMetadata?: Record<string, Record<string, any>>;
1724
2165
  providerOptions?: Record<string, Record<string, any>>;
2166
+ signature?: string;
1725
2167
  toolCallId: string;
1726
2168
  type: "tool-approval-request";
1727
2169
  }>;
@@ -1765,6 +2207,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1765
2207
  providerOptions?: Record<string, Record<string, any>>;
1766
2208
  text: string;
1767
2209
  type: "text";
2210
+ } | {
2211
+ data: {
2212
+ type: "url";
2213
+ url: string;
2214
+ } | {
2215
+ reference: Record<string, string>;
2216
+ type: "reference";
2217
+ } | {
2218
+ data: string | ArrayBuffer;
2219
+ type: "data";
2220
+ } | {
2221
+ text: string;
2222
+ type: "text";
2223
+ };
2224
+ filename?: string;
2225
+ mediaType: string;
2226
+ providerOptions?: Record<string, Record<string, any>>;
2227
+ type: "file";
1768
2228
  } | {
1769
2229
  data: string;
1770
2230
  mediaType: string;
@@ -1776,6 +2236,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1776
2236
  providerOptions?: Record<string, Record<string, any>>;
1777
2237
  type: "file-data";
1778
2238
  } | {
2239
+ mediaType?: string;
1779
2240
  providerOptions?: Record<string, Record<string, any>>;
1780
2241
  type: "file-url";
1781
2242
  url: string;
@@ -1783,11 +2244,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1783
2244
  fileId: string | Record<string, string>;
1784
2245
  providerOptions?: Record<string, Record<string, any>>;
1785
2246
  type: "file-id";
2247
+ } | {
2248
+ providerOptions?: Record<string, Record<string, any>>;
2249
+ providerReference: Record<string, string>;
2250
+ type: "file-reference";
1786
2251
  } | {
1787
2252
  data: string;
1788
2253
  mediaType: string;
1789
2254
  providerOptions?: Record<string, Record<string, any>>;
1790
2255
  type: "image-data";
2256
+ } | {
2257
+ providerOptions?: Record<string, Record<string, any>>;
2258
+ providerReference: Record<string, string>;
2259
+ type: "image-file-reference";
1791
2260
  } | {
1792
2261
  providerOptions?: Record<string, Record<string, any>>;
1793
2262
  type: "image-url";
@@ -1868,14 +2337,30 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1868
2337
  threadId: string;
1869
2338
  tool: boolean;
1870
2339
  usage?: {
2340
+ cacheWriteInputTokens?: number;
1871
2341
  cachedInputTokens?: number;
1872
- completionTokens: number;
1873
- promptTokens: number;
2342
+ completionTokens?: number;
2343
+ nonCachedInputTokens?: number;
2344
+ promptTokens?: number;
2345
+ raw?: Record<string, any>;
1874
2346
  reasoningTokens?: number;
1875
- totalTokens: number;
2347
+ textOutputTokens?: number;
2348
+ totalTokens?: number;
1876
2349
  };
1877
2350
  userId?: string;
1878
2351
  warnings?: Array<{
2352
+ details?: string;
2353
+ feature: string;
2354
+ type: "unsupported";
2355
+ } | {
2356
+ details?: string;
2357
+ feature: string;
2358
+ type: "compatibility";
2359
+ } | {
2360
+ message: string;
2361
+ setting: string;
2362
+ type: "deprecated";
2363
+ } | {
1879
2364
  details?: string;
1880
2365
  setting: string;
1881
2366
  type: "unsupported-setting";
@@ -1910,13 +2395,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1910
2395
  text: string;
1911
2396
  type: "text";
1912
2397
  } | {
1913
- image: string | ArrayBuffer;
2398
+ image: string | ArrayBuffer | {
2399
+ reference: Record<string, string>;
2400
+ type: "reference";
2401
+ };
1914
2402
  mediaType?: string;
1915
2403
  mimeType?: string;
1916
2404
  providerOptions?: Record<string, Record<string, any>>;
1917
2405
  type: "image";
1918
2406
  } | {
1919
- data: string | ArrayBuffer;
2407
+ data: string | ArrayBuffer | {
2408
+ reference: Record<string, string>;
2409
+ type: "reference";
2410
+ };
1920
2411
  filename?: string;
1921
2412
  mediaType?: string;
1922
2413
  mimeType?: string;
@@ -1933,7 +2424,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1933
2424
  text: string;
1934
2425
  type: "text";
1935
2426
  } | {
1936
- data: string | ArrayBuffer;
2427
+ data: string | ArrayBuffer | {
2428
+ reference: Record<string, string>;
2429
+ type: "reference";
2430
+ };
1937
2431
  filename?: string;
1938
2432
  mediaType?: string;
1939
2433
  mimeType?: string;
@@ -1946,6 +2440,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1946
2440
  signature?: string;
1947
2441
  text: string;
1948
2442
  type: "reasoning";
2443
+ } | {
2444
+ data?: string | ArrayBuffer;
2445
+ mediaType: string;
2446
+ providerMetadata?: Record<string, Record<string, any>>;
2447
+ providerOptions?: Record<string, Record<string, any>>;
2448
+ type: "reasoning-file";
2449
+ url?: string;
2450
+ } | {
2451
+ kind: string;
2452
+ providerMetadata?: Record<string, Record<string, any>>;
2453
+ providerOptions?: Record<string, Record<string, any>>;
2454
+ type: "custom";
1949
2455
  } | {
1950
2456
  data: string;
1951
2457
  providerMetadata?: Record<string, Record<string, any>>;
@@ -1957,7 +2463,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1957
2463
  providerExecuted?: boolean;
1958
2464
  providerMetadata?: Record<string, Record<string, any>>;
1959
2465
  providerOptions?: Record<string, Record<string, any>>;
2466
+ title?: string;
1960
2467
  toolCallId: string;
2468
+ toolMetadata?: Record<string, any>;
1961
2469
  toolName: string;
1962
2470
  type: "tool-call";
1963
2471
  } | {
@@ -1966,7 +2474,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
1966
2474
  providerExecuted?: boolean;
1967
2475
  providerMetadata?: Record<string, Record<string, any>>;
1968
2476
  providerOptions?: Record<string, Record<string, any>>;
2477
+ title?: string;
1969
2478
  toolCallId: string;
2479
+ toolMetadata?: Record<string, any>;
1970
2480
  toolName: string;
1971
2481
  type: "tool-call";
1972
2482
  } | {
@@ -2006,6 +2516,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2006
2516
  providerOptions?: Record<string, Record<string, any>>;
2007
2517
  text: string;
2008
2518
  type: "text";
2519
+ } | {
2520
+ data: {
2521
+ type: "url";
2522
+ url: string;
2523
+ } | {
2524
+ reference: Record<string, string>;
2525
+ type: "reference";
2526
+ } | {
2527
+ data: string | ArrayBuffer;
2528
+ type: "data";
2529
+ } | {
2530
+ text: string;
2531
+ type: "text";
2532
+ };
2533
+ filename?: string;
2534
+ mediaType: string;
2535
+ providerOptions?: Record<string, Record<string, any>>;
2536
+ type: "file";
2009
2537
  } | {
2010
2538
  data: string;
2011
2539
  mediaType: string;
@@ -2017,6 +2545,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2017
2545
  providerOptions?: Record<string, Record<string, any>>;
2018
2546
  type: "file-data";
2019
2547
  } | {
2548
+ mediaType?: string;
2020
2549
  providerOptions?: Record<string, Record<string, any>>;
2021
2550
  type: "file-url";
2022
2551
  url: string;
@@ -2024,11 +2553,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2024
2553
  fileId: string | Record<string, string>;
2025
2554
  providerOptions?: Record<string, Record<string, any>>;
2026
2555
  type: "file-id";
2556
+ } | {
2557
+ providerOptions?: Record<string, Record<string, any>>;
2558
+ providerReference: Record<string, string>;
2559
+ type: "file-reference";
2027
2560
  } | {
2028
2561
  data: string;
2029
2562
  mediaType: string;
2030
2563
  providerOptions?: Record<string, Record<string, any>>;
2031
2564
  type: "image-data";
2565
+ } | {
2566
+ providerOptions?: Record<string, Record<string, any>>;
2567
+ providerReference: Record<string, string>;
2568
+ type: "image-file-reference";
2032
2569
  } | {
2033
2570
  providerOptions?: Record<string, Record<string, any>>;
2034
2571
  type: "image-url";
@@ -2068,8 +2605,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2068
2605
  type: "source";
2069
2606
  } | {
2070
2607
  approvalId: string;
2608
+ isAutomatic?: boolean;
2071
2609
  providerMetadata?: Record<string, Record<string, any>>;
2072
2610
  providerOptions?: Record<string, Record<string, any>>;
2611
+ signature?: string;
2073
2612
  toolCallId: string;
2074
2613
  type: "tool-approval-request";
2075
2614
  }>;
@@ -2113,6 +2652,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2113
2652
  providerOptions?: Record<string, Record<string, any>>;
2114
2653
  text: string;
2115
2654
  type: "text";
2655
+ } | {
2656
+ data: {
2657
+ type: "url";
2658
+ url: string;
2659
+ } | {
2660
+ reference: Record<string, string>;
2661
+ type: "reference";
2662
+ } | {
2663
+ data: string | ArrayBuffer;
2664
+ type: "data";
2665
+ } | {
2666
+ text: string;
2667
+ type: "text";
2668
+ };
2669
+ filename?: string;
2670
+ mediaType: string;
2671
+ providerOptions?: Record<string, Record<string, any>>;
2672
+ type: "file";
2116
2673
  } | {
2117
2674
  data: string;
2118
2675
  mediaType: string;
@@ -2124,6 +2681,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2124
2681
  providerOptions?: Record<string, Record<string, any>>;
2125
2682
  type: "file-data";
2126
2683
  } | {
2684
+ mediaType?: string;
2127
2685
  providerOptions?: Record<string, Record<string, any>>;
2128
2686
  type: "file-url";
2129
2687
  url: string;
@@ -2131,11 +2689,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2131
2689
  fileId: string | Record<string, string>;
2132
2690
  providerOptions?: Record<string, Record<string, any>>;
2133
2691
  type: "file-id";
2692
+ } | {
2693
+ providerOptions?: Record<string, Record<string, any>>;
2694
+ providerReference: Record<string, string>;
2695
+ type: "file-reference";
2134
2696
  } | {
2135
2697
  data: string;
2136
2698
  mediaType: string;
2137
2699
  providerOptions?: Record<string, Record<string, any>>;
2138
2700
  type: "image-data";
2701
+ } | {
2702
+ providerOptions?: Record<string, Record<string, any>>;
2703
+ providerReference: Record<string, string>;
2704
+ type: "image-file-reference";
2139
2705
  } | {
2140
2706
  providerOptions?: Record<string, Record<string, any>>;
2141
2707
  type: "image-url";
@@ -2216,14 +2782,30 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2216
2782
  threadId: string;
2217
2783
  tool: boolean;
2218
2784
  usage?: {
2785
+ cacheWriteInputTokens?: number;
2219
2786
  cachedInputTokens?: number;
2220
- completionTokens: number;
2221
- promptTokens: number;
2787
+ completionTokens?: number;
2788
+ nonCachedInputTokens?: number;
2789
+ promptTokens?: number;
2790
+ raw?: Record<string, any>;
2222
2791
  reasoningTokens?: number;
2223
- totalTokens: number;
2792
+ textOutputTokens?: number;
2793
+ totalTokens?: number;
2224
2794
  };
2225
2795
  userId?: string;
2226
2796
  warnings?: Array<{
2797
+ details?: string;
2798
+ feature: string;
2799
+ type: "unsupported";
2800
+ } | {
2801
+ details?: string;
2802
+ feature: string;
2803
+ type: "compatibility";
2804
+ } | {
2805
+ message: string;
2806
+ setting: string;
2807
+ type: "deprecated";
2808
+ } | {
2227
2809
  details?: string;
2228
2810
  setting: string;
2229
2811
  type: "unsupported-setting";
@@ -2249,13 +2831,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2249
2831
  text: string;
2250
2832
  type: "text";
2251
2833
  } | {
2252
- image: string | ArrayBuffer;
2834
+ image: string | ArrayBuffer | {
2835
+ reference: Record<string, string>;
2836
+ type: "reference";
2837
+ };
2253
2838
  mediaType?: string;
2254
2839
  mimeType?: string;
2255
2840
  providerOptions?: Record<string, Record<string, any>>;
2256
2841
  type: "image";
2257
2842
  } | {
2258
- data: string | ArrayBuffer;
2843
+ data: string | ArrayBuffer | {
2844
+ reference: Record<string, string>;
2845
+ type: "reference";
2846
+ };
2259
2847
  filename?: string;
2260
2848
  mediaType?: string;
2261
2849
  mimeType?: string;
@@ -2272,7 +2860,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2272
2860
  text: string;
2273
2861
  type: "text";
2274
2862
  } | {
2275
- data: string | ArrayBuffer;
2863
+ data: string | ArrayBuffer | {
2864
+ reference: Record<string, string>;
2865
+ type: "reference";
2866
+ };
2276
2867
  filename?: string;
2277
2868
  mediaType?: string;
2278
2869
  mimeType?: string;
@@ -2285,6 +2876,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2285
2876
  signature?: string;
2286
2877
  text: string;
2287
2878
  type: "reasoning";
2879
+ } | {
2880
+ data?: string | ArrayBuffer;
2881
+ mediaType: string;
2882
+ providerMetadata?: Record<string, Record<string, any>>;
2883
+ providerOptions?: Record<string, Record<string, any>>;
2884
+ type: "reasoning-file";
2885
+ url?: string;
2886
+ } | {
2887
+ kind: string;
2888
+ providerMetadata?: Record<string, Record<string, any>>;
2889
+ providerOptions?: Record<string, Record<string, any>>;
2890
+ type: "custom";
2288
2891
  } | {
2289
2892
  data: string;
2290
2893
  providerMetadata?: Record<string, Record<string, any>>;
@@ -2296,7 +2899,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2296
2899
  providerExecuted?: boolean;
2297
2900
  providerMetadata?: Record<string, Record<string, any>>;
2298
2901
  providerOptions?: Record<string, Record<string, any>>;
2902
+ title?: string;
2299
2903
  toolCallId: string;
2904
+ toolMetadata?: Record<string, any>;
2300
2905
  toolName: string;
2301
2906
  type: "tool-call";
2302
2907
  } | {
@@ -2305,7 +2910,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2305
2910
  providerExecuted?: boolean;
2306
2911
  providerMetadata?: Record<string, Record<string, any>>;
2307
2912
  providerOptions?: Record<string, Record<string, any>>;
2913
+ title?: string;
2308
2914
  toolCallId: string;
2915
+ toolMetadata?: Record<string, any>;
2309
2916
  toolName: string;
2310
2917
  type: "tool-call";
2311
2918
  } | {
@@ -2345,6 +2952,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2345
2952
  providerOptions?: Record<string, Record<string, any>>;
2346
2953
  text: string;
2347
2954
  type: "text";
2955
+ } | {
2956
+ data: {
2957
+ type: "url";
2958
+ url: string;
2959
+ } | {
2960
+ reference: Record<string, string>;
2961
+ type: "reference";
2962
+ } | {
2963
+ data: string | ArrayBuffer;
2964
+ type: "data";
2965
+ } | {
2966
+ text: string;
2967
+ type: "text";
2968
+ };
2969
+ filename?: string;
2970
+ mediaType: string;
2971
+ providerOptions?: Record<string, Record<string, any>>;
2972
+ type: "file";
2348
2973
  } | {
2349
2974
  data: string;
2350
2975
  mediaType: string;
@@ -2356,6 +2981,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2356
2981
  providerOptions?: Record<string, Record<string, any>>;
2357
2982
  type: "file-data";
2358
2983
  } | {
2984
+ mediaType?: string;
2359
2985
  providerOptions?: Record<string, Record<string, any>>;
2360
2986
  type: "file-url";
2361
2987
  url: string;
@@ -2363,11 +2989,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2363
2989
  fileId: string | Record<string, string>;
2364
2990
  providerOptions?: Record<string, Record<string, any>>;
2365
2991
  type: "file-id";
2992
+ } | {
2993
+ providerOptions?: Record<string, Record<string, any>>;
2994
+ providerReference: Record<string, string>;
2995
+ type: "file-reference";
2366
2996
  } | {
2367
2997
  data: string;
2368
2998
  mediaType: string;
2369
2999
  providerOptions?: Record<string, Record<string, any>>;
2370
3000
  type: "image-data";
3001
+ } | {
3002
+ providerOptions?: Record<string, Record<string, any>>;
3003
+ providerReference: Record<string, string>;
3004
+ type: "image-file-reference";
2371
3005
  } | {
2372
3006
  providerOptions?: Record<string, Record<string, any>>;
2373
3007
  type: "image-url";
@@ -2407,8 +3041,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2407
3041
  type: "source";
2408
3042
  } | {
2409
3043
  approvalId: string;
3044
+ isAutomatic?: boolean;
2410
3045
  providerMetadata?: Record<string, Record<string, any>>;
2411
3046
  providerOptions?: Record<string, Record<string, any>>;
3047
+ signature?: string;
2412
3048
  toolCallId: string;
2413
3049
  type: "tool-approval-request";
2414
3050
  }>;
@@ -2452,6 +3088,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2452
3088
  providerOptions?: Record<string, Record<string, any>>;
2453
3089
  text: string;
2454
3090
  type: "text";
3091
+ } | {
3092
+ data: {
3093
+ type: "url";
3094
+ url: string;
3095
+ } | {
3096
+ reference: Record<string, string>;
3097
+ type: "reference";
3098
+ } | {
3099
+ data: string | ArrayBuffer;
3100
+ type: "data";
3101
+ } | {
3102
+ text: string;
3103
+ type: "text";
3104
+ };
3105
+ filename?: string;
3106
+ mediaType: string;
3107
+ providerOptions?: Record<string, Record<string, any>>;
3108
+ type: "file";
2455
3109
  } | {
2456
3110
  data: string;
2457
3111
  mediaType: string;
@@ -2463,6 +3117,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2463
3117
  providerOptions?: Record<string, Record<string, any>>;
2464
3118
  type: "file-data";
2465
3119
  } | {
3120
+ mediaType?: string;
2466
3121
  providerOptions?: Record<string, Record<string, any>>;
2467
3122
  type: "file-url";
2468
3123
  url: string;
@@ -2470,11 +3125,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2470
3125
  fileId: string | Record<string, string>;
2471
3126
  providerOptions?: Record<string, Record<string, any>>;
2472
3127
  type: "file-id";
3128
+ } | {
3129
+ providerOptions?: Record<string, Record<string, any>>;
3130
+ providerReference: Record<string, string>;
3131
+ type: "file-reference";
2473
3132
  } | {
2474
3133
  data: string;
2475
3134
  mediaType: string;
2476
3135
  providerOptions?: Record<string, Record<string, any>>;
2477
3136
  type: "image-data";
3137
+ } | {
3138
+ providerOptions?: Record<string, Record<string, any>>;
3139
+ providerReference: Record<string, string>;
3140
+ type: "image-file-reference";
2478
3141
  } | {
2479
3142
  providerOptions?: Record<string, Record<string, any>>;
2480
3143
  type: "image-url";
@@ -2532,13 +3195,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2532
3195
  text: string;
2533
3196
  type: "text";
2534
3197
  } | {
2535
- image: string | ArrayBuffer;
3198
+ image: string | ArrayBuffer | {
3199
+ reference: Record<string, string>;
3200
+ type: "reference";
3201
+ };
2536
3202
  mediaType?: string;
2537
3203
  mimeType?: string;
2538
3204
  providerOptions?: Record<string, Record<string, any>>;
2539
3205
  type: "image";
2540
3206
  } | {
2541
- data: string | ArrayBuffer;
3207
+ data: string | ArrayBuffer | {
3208
+ reference: Record<string, string>;
3209
+ type: "reference";
3210
+ };
2542
3211
  filename?: string;
2543
3212
  mediaType?: string;
2544
3213
  mimeType?: string;
@@ -2555,7 +3224,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2555
3224
  text: string;
2556
3225
  type: "text";
2557
3226
  } | {
2558
- data: string | ArrayBuffer;
3227
+ data: string | ArrayBuffer | {
3228
+ reference: Record<string, string>;
3229
+ type: "reference";
3230
+ };
2559
3231
  filename?: string;
2560
3232
  mediaType?: string;
2561
3233
  mimeType?: string;
@@ -2568,6 +3240,18 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2568
3240
  signature?: string;
2569
3241
  text: string;
2570
3242
  type: "reasoning";
3243
+ } | {
3244
+ data?: string | ArrayBuffer;
3245
+ mediaType: string;
3246
+ providerMetadata?: Record<string, Record<string, any>>;
3247
+ providerOptions?: Record<string, Record<string, any>>;
3248
+ type: "reasoning-file";
3249
+ url?: string;
3250
+ } | {
3251
+ kind: string;
3252
+ providerMetadata?: Record<string, Record<string, any>>;
3253
+ providerOptions?: Record<string, Record<string, any>>;
3254
+ type: "custom";
2571
3255
  } | {
2572
3256
  data: string;
2573
3257
  providerMetadata?: Record<string, Record<string, any>>;
@@ -2579,7 +3263,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2579
3263
  providerExecuted?: boolean;
2580
3264
  providerMetadata?: Record<string, Record<string, any>>;
2581
3265
  providerOptions?: Record<string, Record<string, any>>;
3266
+ title?: string;
2582
3267
  toolCallId: string;
3268
+ toolMetadata?: Record<string, any>;
2583
3269
  toolName: string;
2584
3270
  type: "tool-call";
2585
3271
  } | {
@@ -2588,7 +3274,9 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2588
3274
  providerExecuted?: boolean;
2589
3275
  providerMetadata?: Record<string, Record<string, any>>;
2590
3276
  providerOptions?: Record<string, Record<string, any>>;
3277
+ title?: string;
2591
3278
  toolCallId: string;
3279
+ toolMetadata?: Record<string, any>;
2592
3280
  toolName: string;
2593
3281
  type: "tool-call";
2594
3282
  } | {
@@ -2628,6 +3316,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2628
3316
  providerOptions?: Record<string, Record<string, any>>;
2629
3317
  text: string;
2630
3318
  type: "text";
3319
+ } | {
3320
+ data: {
3321
+ type: "url";
3322
+ url: string;
3323
+ } | {
3324
+ reference: Record<string, string>;
3325
+ type: "reference";
3326
+ } | {
3327
+ data: string | ArrayBuffer;
3328
+ type: "data";
3329
+ } | {
3330
+ text: string;
3331
+ type: "text";
3332
+ };
3333
+ filename?: string;
3334
+ mediaType: string;
3335
+ providerOptions?: Record<string, Record<string, any>>;
3336
+ type: "file";
2631
3337
  } | {
2632
3338
  data: string;
2633
3339
  mediaType: string;
@@ -2639,6 +3345,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2639
3345
  providerOptions?: Record<string, Record<string, any>>;
2640
3346
  type: "file-data";
2641
3347
  } | {
3348
+ mediaType?: string;
2642
3349
  providerOptions?: Record<string, Record<string, any>>;
2643
3350
  type: "file-url";
2644
3351
  url: string;
@@ -2646,11 +3353,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2646
3353
  fileId: string | Record<string, string>;
2647
3354
  providerOptions?: Record<string, Record<string, any>>;
2648
3355
  type: "file-id";
3356
+ } | {
3357
+ providerOptions?: Record<string, Record<string, any>>;
3358
+ providerReference: Record<string, string>;
3359
+ type: "file-reference";
2649
3360
  } | {
2650
3361
  data: string;
2651
3362
  mediaType: string;
2652
3363
  providerOptions?: Record<string, Record<string, any>>;
2653
3364
  type: "image-data";
3365
+ } | {
3366
+ providerOptions?: Record<string, Record<string, any>>;
3367
+ providerReference: Record<string, string>;
3368
+ type: "image-file-reference";
2654
3369
  } | {
2655
3370
  providerOptions?: Record<string, Record<string, any>>;
2656
3371
  type: "image-url";
@@ -2690,8 +3405,10 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2690
3405
  type: "source";
2691
3406
  } | {
2692
3407
  approvalId: string;
3408
+ isAutomatic?: boolean;
2693
3409
  providerMetadata?: Record<string, Record<string, any>>;
2694
3410
  providerOptions?: Record<string, Record<string, any>>;
3411
+ signature?: string;
2695
3412
  toolCallId: string;
2696
3413
  type: "tool-approval-request";
2697
3414
  }>;
@@ -2735,6 +3452,24 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2735
3452
  providerOptions?: Record<string, Record<string, any>>;
2736
3453
  text: string;
2737
3454
  type: "text";
3455
+ } | {
3456
+ data: {
3457
+ type: "url";
3458
+ url: string;
3459
+ } | {
3460
+ reference: Record<string, string>;
3461
+ type: "reference";
3462
+ } | {
3463
+ data: string | ArrayBuffer;
3464
+ type: "data";
3465
+ } | {
3466
+ text: string;
3467
+ type: "text";
3468
+ };
3469
+ filename?: string;
3470
+ mediaType: string;
3471
+ providerOptions?: Record<string, Record<string, any>>;
3472
+ type: "file";
2738
3473
  } | {
2739
3474
  data: string;
2740
3475
  mediaType: string;
@@ -2746,6 +3481,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2746
3481
  providerOptions?: Record<string, Record<string, any>>;
2747
3482
  type: "file-data";
2748
3483
  } | {
3484
+ mediaType?: string;
2749
3485
  providerOptions?: Record<string, Record<string, any>>;
2750
3486
  type: "file-url";
2751
3487
  url: string;
@@ -2753,11 +3489,19 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2753
3489
  fileId: string | Record<string, string>;
2754
3490
  providerOptions?: Record<string, Record<string, any>>;
2755
3491
  type: "file-id";
3492
+ } | {
3493
+ providerOptions?: Record<string, Record<string, any>>;
3494
+ providerReference: Record<string, string>;
3495
+ type: "file-reference";
2756
3496
  } | {
2757
3497
  data: string;
2758
3498
  mediaType: string;
2759
3499
  providerOptions?: Record<string, Record<string, any>>;
2760
3500
  type: "image-data";
3501
+ } | {
3502
+ providerOptions?: Record<string, Record<string, any>>;
3503
+ providerReference: Record<string, string>;
3504
+ type: "image-file-reference";
2761
3505
  } | {
2762
3506
  providerOptions?: Record<string, Record<string, any>>;
2763
3507
  type: "image-url";
@@ -2838,14 +3582,30 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2838
3582
  threadId: string;
2839
3583
  tool: boolean;
2840
3584
  usage?: {
3585
+ cacheWriteInputTokens?: number;
2841
3586
  cachedInputTokens?: number;
2842
- completionTokens: number;
2843
- promptTokens: number;
3587
+ completionTokens?: number;
3588
+ nonCachedInputTokens?: number;
3589
+ promptTokens?: number;
3590
+ raw?: Record<string, any>;
2844
3591
  reasoningTokens?: number;
2845
- totalTokens: number;
3592
+ textOutputTokens?: number;
3593
+ totalTokens?: number;
2846
3594
  };
2847
3595
  userId?: string;
2848
3596
  warnings?: Array<{
3597
+ details?: string;
3598
+ feature: string;
3599
+ type: "unsupported";
3600
+ } | {
3601
+ details?: string;
3602
+ feature: string;
3603
+ type: "compatibility";
3604
+ } | {
3605
+ message: string;
3606
+ setting: string;
3607
+ type: "deprecated";
3608
+ } | {
2849
3609
  details?: string;
2850
3610
  setting: string;
2851
3611
  type: "unsupported-setting";