@convex-dev/agent 0.5.0-alpha.1 → 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 (233) hide show
  1. package/README.md +32 -27
  2. package/dist/UIMessages.d.ts +46 -0
  3. package/dist/UIMessages.d.ts.map +1 -0
  4. package/dist/UIMessages.js +546 -0
  5. package/dist/UIMessages.js.map +1 -0
  6. package/dist/client/createTool.d.ts +129 -27
  7. package/dist/client/createTool.d.ts.map +1 -1
  8. package/dist/client/createTool.js +66 -12
  9. package/dist/client/createTool.js.map +1 -1
  10. package/dist/client/defaultComponent.d.ts +11 -0
  11. package/dist/client/defaultComponent.d.ts.map +1 -0
  12. package/dist/client/defaultComponent.js +7 -0
  13. package/dist/client/defaultComponent.js.map +1 -0
  14. package/dist/client/definePlaygroundAPI.d.ts +1323 -192
  15. package/dist/client/definePlaygroundAPI.d.ts.map +1 -1
  16. package/dist/client/definePlaygroundAPI.js +52 -28
  17. package/dist/client/definePlaygroundAPI.js.map +1 -1
  18. package/dist/client/files.d.ts +20 -7
  19. package/dist/client/files.d.ts.map +1 -1
  20. package/dist/client/files.js +68 -11
  21. package/dist/client/files.js.map +1 -1
  22. package/dist/client/index.d.ts +1056 -965
  23. package/dist/client/index.d.ts.map +1 -1
  24. package/dist/client/index.js +242 -748
  25. package/dist/client/index.js.map +1 -1
  26. package/dist/client/messages.d.ts +461 -0
  27. package/dist/client/messages.d.ts.map +1 -0
  28. package/dist/client/messages.js +106 -0
  29. package/dist/client/messages.js.map +1 -0
  30. package/dist/client/mockModel.d.ts +42 -0
  31. package/dist/client/mockModel.d.ts.map +1 -0
  32. package/dist/client/mockModel.js +175 -0
  33. package/dist/client/mockModel.js.map +1 -0
  34. package/dist/client/saveInputMessages.d.ts +20 -0
  35. package/dist/client/saveInputMessages.d.ts.map +1 -0
  36. package/dist/client/saveInputMessages.js +58 -0
  37. package/dist/client/saveInputMessages.js.map +1 -0
  38. package/dist/client/search.d.ts +346 -35
  39. package/dist/client/search.d.ts.map +1 -1
  40. package/dist/client/search.js +350 -39
  41. package/dist/client/search.js.map +1 -1
  42. package/dist/client/start.d.ts +84 -0
  43. package/dist/client/start.d.ts.map +1 -0
  44. package/dist/client/start.js +171 -0
  45. package/dist/client/start.js.map +1 -0
  46. package/dist/client/streamText.d.ts +46 -0
  47. package/dist/client/streamText.d.ts.map +1 -0
  48. package/dist/client/streamText.js +93 -0
  49. package/dist/client/streamText.js.map +1 -0
  50. package/dist/client/streaming.d.ts +3705 -32
  51. package/dist/client/streaming.d.ts.map +1 -1
  52. package/dist/client/streaming.js +141 -59
  53. package/dist/client/streaming.js.map +1 -1
  54. package/dist/client/threads.d.ts +46 -0
  55. package/dist/client/threads.d.ts.map +1 -0
  56. package/dist/client/threads.js +49 -0
  57. package/dist/client/threads.js.map +1 -0
  58. package/dist/client/types.d.ts +265 -128
  59. package/dist/client/types.d.ts.map +1 -1
  60. package/dist/client/utils.d.ts +4 -0
  61. package/dist/client/utils.d.ts.map +1 -0
  62. package/dist/client/utils.js +21 -0
  63. package/dist/client/utils.js.map +1 -0
  64. package/dist/component/_generated/api.d.ts +24 -2178
  65. package/dist/component/_generated/api.d.ts.map +1 -1
  66. package/dist/component/_generated/api.js +10 -1
  67. package/dist/component/_generated/api.js.map +1 -1
  68. package/dist/component/_generated/component.d.ts +3119 -0
  69. package/dist/component/_generated/component.d.ts.map +1 -0
  70. package/dist/component/_generated/component.js +11 -0
  71. package/dist/component/_generated/component.js.map +1 -0
  72. package/dist/component/_generated/dataModel.d.ts +4 -18
  73. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  74. package/dist/component/_generated/dataModel.js +11 -0
  75. package/dist/component/_generated/dataModel.js.map +1 -0
  76. package/dist/component/_generated/server.d.ts +10 -38
  77. package/dist/component/_generated/server.d.ts.map +1 -1
  78. package/dist/component/_generated/server.js +9 -5
  79. package/dist/component/_generated/server.js.map +1 -1
  80. package/dist/component/files.d.ts +16 -10
  81. package/dist/component/files.d.ts.map +1 -1
  82. package/dist/component/files.js +10 -2
  83. package/dist/component/files.js.map +1 -1
  84. package/dist/component/messages.d.ts +2553 -342
  85. package/dist/component/messages.d.ts.map +1 -1
  86. package/dist/component/messages.js +387 -154
  87. package/dist/component/messages.js.map +1 -1
  88. package/dist/component/schema.d.ts +5697 -3584
  89. package/dist/component/schema.d.ts.map +1 -1
  90. package/dist/component/schema.js +18 -41
  91. package/dist/component/schema.js.map +1 -1
  92. package/dist/component/streams.d.ts +35 -335
  93. package/dist/component/streams.d.ts.map +1 -1
  94. package/dist/component/streams.js +114 -73
  95. package/dist/component/streams.js.map +1 -1
  96. package/dist/component/threads.d.ts +16 -16
  97. package/dist/component/users.d.ts +4 -4
  98. package/dist/component/vector/index.d.ts +1 -1
  99. package/dist/component/vector/index.d.ts.map +1 -1
  100. package/dist/component/vector/index.js +1 -3
  101. package/dist/component/vector/index.js.map +1 -1
  102. package/dist/deltas.d.ts +43 -0
  103. package/dist/deltas.d.ts.map +1 -0
  104. package/dist/deltas.js +447 -0
  105. package/dist/deltas.js.map +1 -0
  106. package/dist/mapping.d.ts +20 -20
  107. package/dist/mapping.d.ts.map +1 -1
  108. package/dist/mapping.js +313 -96
  109. package/dist/mapping.js.map +1 -1
  110. package/dist/react/SmoothText.d.ts +5 -0
  111. package/dist/react/SmoothText.d.ts.map +1 -0
  112. package/dist/react/SmoothText.js +6 -0
  113. package/dist/react/SmoothText.js.map +1 -0
  114. package/dist/react/index.d.ts +5 -77
  115. package/dist/react/index.d.ts.map +1 -1
  116. package/dist/react/index.js +6 -160
  117. package/dist/react/index.js.map +1 -1
  118. package/dist/react/optimisticallySendMessage.d.ts +36 -3
  119. package/dist/react/optimisticallySendMessage.d.ts.map +1 -1
  120. package/dist/react/optimisticallySendMessage.js +35 -9
  121. package/dist/react/optimisticallySendMessage.js.map +1 -1
  122. package/dist/react/types.d.ts +4 -18
  123. package/dist/react/types.d.ts.map +1 -1
  124. package/dist/react/useDeltaStreams.d.ts +10 -0
  125. package/dist/react/useDeltaStreams.d.ts.map +1 -0
  126. package/dist/react/useDeltaStreams.js +101 -0
  127. package/dist/react/useDeltaStreams.js.map +1 -0
  128. package/dist/react/useSmoothText.d.ts +13 -12
  129. package/dist/react/useSmoothText.d.ts.map +1 -1
  130. package/dist/react/useSmoothText.js +32 -15
  131. package/dist/react/useSmoothText.js.map +1 -1
  132. package/dist/react/useStreamingUIMessages.d.ts +22 -0
  133. package/dist/react/useStreamingUIMessages.d.ts.map +1 -0
  134. package/dist/react/useStreamingUIMessages.js +92 -0
  135. package/dist/react/useStreamingUIMessages.js.map +1 -0
  136. package/dist/react/useThreadMessages.d.ts +104 -0
  137. package/dist/react/useThreadMessages.d.ts.map +1 -0
  138. package/dist/react/useThreadMessages.js +148 -0
  139. package/dist/react/useThreadMessages.js.map +1 -0
  140. package/dist/react/useUIMessages.d.ts +96 -0
  141. package/dist/react/useUIMessages.d.ts.map +1 -0
  142. package/dist/react/useUIMessages.js +108 -0
  143. package/dist/react/useUIMessages.js.map +1 -0
  144. package/dist/shared.d.ts +20 -4
  145. package/dist/shared.d.ts.map +1 -1
  146. package/dist/shared.js +45 -8
  147. package/dist/shared.js.map +1 -1
  148. package/dist/validators.d.ts +22981 -5666
  149. package/dist/validators.d.ts.map +1 -1
  150. package/dist/validators.js +245 -137
  151. package/dist/validators.js.map +1 -1
  152. package/package.json +98 -50
  153. package/src/UIMessages.combineUIMessages.test.ts +239 -0
  154. package/src/UIMessages.test.ts +273 -0
  155. package/src/UIMessages.ts +739 -0
  156. package/src/client/createTool.ts +293 -76
  157. package/src/client/defaultComponent.ts +17 -0
  158. package/src/client/definePlaygroundAPI.ts +67 -31
  159. package/src/client/files.ts +100 -20
  160. package/src/client/index.test.ts +40 -85
  161. package/src/client/index.ts +520 -1290
  162. package/src/client/messages.ts +237 -0
  163. package/src/client/mockModel.ts +245 -0
  164. package/src/client/saveInputMessages.test.ts +583 -0
  165. package/src/client/saveInputMessages.ts +101 -0
  166. package/src/client/search.test.ts +1207 -0
  167. package/src/client/search.ts +577 -70
  168. package/src/client/start.ts +310 -0
  169. package/src/client/streamText.ts +163 -0
  170. package/src/client/streaming.test.ts +186 -0
  171. package/src/client/streaming.ts +219 -97
  172. package/src/client/threads.ts +83 -0
  173. package/src/client/types.ts +368 -219
  174. package/src/client/utils.ts +27 -0
  175. package/src/component/_generated/api.ts +64 -0
  176. package/src/component/_generated/component.ts +4913 -0
  177. package/src/component/_generated/{server.d.ts → server.ts} +33 -21
  178. package/src/component/files.ts +11 -2
  179. package/src/component/messages.test.ts +195 -51
  180. package/src/component/messages.ts +490 -201
  181. package/src/component/schema.ts +20 -46
  182. package/src/component/setup.test.ts +7 -0
  183. package/src/component/streams.ts +184 -83
  184. package/src/component/users.test.ts +0 -1
  185. package/src/component/vector/index.ts +1 -3
  186. package/src/deltas.test.ts +626 -0
  187. package/src/deltas.ts +570 -0
  188. package/src/fromUIMessages.test.ts +497 -0
  189. package/src/mapping.test.ts +103 -6
  190. package/src/mapping.ts +422 -161
  191. package/src/react/SmoothText.tsx +9 -0
  192. package/src/react/index.ts +10 -230
  193. package/src/react/optimisticallySendMessage.ts +55 -12
  194. package/src/react/types.ts +6 -39
  195. package/src/react/useDeltaStreams.ts +154 -0
  196. package/src/react/useSmoothText.ts +56 -36
  197. package/src/react/useStreamingUIMessages.ts +143 -0
  198. package/src/react/useThreadMessages.ts +262 -0
  199. package/src/react/useUIMessages.test.ts +255 -0
  200. package/src/react/useUIMessages.ts +195 -0
  201. package/src/shared.ts +88 -12
  202. package/src/test.ts +18 -0
  203. package/src/toUIMessages.test.ts +1269 -0
  204. package/src/validators.test.ts +18 -19
  205. package/src/validators.ts +325 -185
  206. package/dist/client/_generated/_ignore.d.ts +0 -1
  207. package/dist/client/_generated/_ignore.d.ts.map +0 -1
  208. package/dist/client/_generated/_ignore.js +0 -3
  209. package/dist/client/_generated/_ignore.js.map +0 -1
  210. package/dist/client/listMessages.d.ts +0 -22
  211. package/dist/client/listMessages.d.ts.map +0 -1
  212. package/dist/client/listMessages.js +0 -25
  213. package/dist/client/listMessages.js.map +0 -1
  214. package/dist/package.json +0 -3
  215. package/dist/react/deltas.d.ts +0 -26
  216. package/dist/react/deltas.d.ts.map +0 -1
  217. package/dist/react/deltas.js +0 -384
  218. package/dist/react/deltas.js.map +0 -1
  219. package/dist/react/toUIMessages.d.ts +0 -15
  220. package/dist/react/toUIMessages.d.ts.map +0 -1
  221. package/dist/react/toUIMessages.js +0 -211
  222. package/dist/react/toUIMessages.js.map +0 -1
  223. package/src/client/listMessages.ts +0 -38
  224. package/src/component/_generated/api.d.ts +0 -2202
  225. package/src/component/_generated/api.js +0 -23
  226. package/src/component/_generated/server.js +0 -90
  227. package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  228. package/src/react/deltas.test.ts +0 -315
  229. package/src/react/deltas.ts +0 -478
  230. package/src/react/toUIMessages.test.ts +0 -420
  231. package/src/react/toUIMessages.ts +0 -253
  232. package/src/vitest.config.ts +0 -7
  233. /package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +0 -0
@@ -0,0 +1,4913 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `ComponentApi` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+
11
+ import type { FunctionReference } from "convex/server";
12
+
13
+ /**
14
+ * A utility for referencing a Convex component's exposed API.
15
+ *
16
+ * Useful when expecting a parameter like `components.myComponent`.
17
+ * Usage:
18
+ * ```ts
19
+ * async function myFunction(ctx: QueryCtx, component: ComponentApi) {
20
+ * return ctx.runQuery(component.someFile.someQuery, { ...args });
21
+ * }
22
+ * ```
23
+ */
24
+ export type ComponentApi<Name extends string | undefined = string | undefined> =
25
+ {
26
+ apiKeys: {
27
+ destroy: FunctionReference<
28
+ "mutation",
29
+ "internal",
30
+ { apiKey?: string; name?: string },
31
+ | "missing"
32
+ | "deleted"
33
+ | "name mismatch"
34
+ | "must provide either apiKey or name",
35
+ Name
36
+ >;
37
+ issue: FunctionReference<
38
+ "mutation",
39
+ "internal",
40
+ { name?: string },
41
+ string,
42
+ Name
43
+ >;
44
+ validate: FunctionReference<
45
+ "query",
46
+ "internal",
47
+ { apiKey: string },
48
+ boolean,
49
+ Name
50
+ >;
51
+ };
52
+ files: {
53
+ addFile: FunctionReference<
54
+ "mutation",
55
+ "internal",
56
+ {
57
+ filename?: string;
58
+ hash: string;
59
+ mediaType?: string;
60
+ mimeType?: string;
61
+ storageId: string;
62
+ },
63
+ { fileId: string; storageId: string },
64
+ Name
65
+ >;
66
+ copyFile: FunctionReference<
67
+ "mutation",
68
+ "internal",
69
+ { fileId: string },
70
+ null,
71
+ Name
72
+ >;
73
+ deleteFiles: FunctionReference<
74
+ "mutation",
75
+ "internal",
76
+ { fileIds: Array<string>; force?: boolean },
77
+ Array<string>,
78
+ Name
79
+ >;
80
+ get: FunctionReference<
81
+ "query",
82
+ "internal",
83
+ { fileId: string },
84
+ null | {
85
+ _creationTime: number;
86
+ _id: string;
87
+ filename?: string;
88
+ hash: string;
89
+ lastTouchedAt: number;
90
+ mediaType?: string;
91
+ mimeType?: string;
92
+ refcount: number;
93
+ storageId: string;
94
+ },
95
+ Name
96
+ >;
97
+ getFilesToDelete: FunctionReference<
98
+ "query",
99
+ "internal",
100
+ {
101
+ paginationOpts: {
102
+ cursor: string | null;
103
+ endCursor?: string | null;
104
+ id?: number;
105
+ maximumBytesRead?: number;
106
+ maximumRowsRead?: number;
107
+ numItems: number;
108
+ };
109
+ },
110
+ {
111
+ continueCursor: string;
112
+ isDone: boolean;
113
+ page: Array<{
114
+ _creationTime: number;
115
+ _id: string;
116
+ filename?: string;
117
+ hash: string;
118
+ lastTouchedAt: number;
119
+ mediaType?: string;
120
+ mimeType?: string;
121
+ refcount: number;
122
+ storageId: string;
123
+ }>;
124
+ },
125
+ Name
126
+ >;
127
+ useExistingFile: FunctionReference<
128
+ "mutation",
129
+ "internal",
130
+ { filename?: string; hash: string },
131
+ null | { fileId: string; storageId: string },
132
+ Name
133
+ >;
134
+ };
135
+ messages: {
136
+ addMessages: FunctionReference<
137
+ "mutation",
138
+ "internal",
139
+ {
140
+ agentName?: string;
141
+ embeddings?: {
142
+ dimension:
143
+ | 128
144
+ | 256
145
+ | 512
146
+ | 768
147
+ | 1024
148
+ | 1408
149
+ | 1536
150
+ | 2048
151
+ | 3072
152
+ | 4096;
153
+ model: string;
154
+ vectors: Array<Array<number> | null>;
155
+ };
156
+ failPendingSteps?: boolean;
157
+ hideFromUserIdSearch?: boolean;
158
+ messages: Array<{
159
+ error?: string;
160
+ fileIds?: Array<string>;
161
+ finishReason?:
162
+ | "stop"
163
+ | "length"
164
+ | "content-filter"
165
+ | "tool-calls"
166
+ | "error"
167
+ | "other"
168
+ | "unknown";
169
+ message:
170
+ | {
171
+ content:
172
+ | string
173
+ | Array<
174
+ | {
175
+ providerMetadata?: Record<
176
+ string,
177
+ Record<string, any>
178
+ >;
179
+ providerOptions?: Record<
180
+ string,
181
+ Record<string, any>
182
+ >;
183
+ text: string;
184
+ type: "text";
185
+ }
186
+ | {
187
+ image: string | ArrayBuffer;
188
+ mediaType?: string;
189
+ mimeType?: string;
190
+ providerOptions?: Record<
191
+ string,
192
+ Record<string, any>
193
+ >;
194
+ type: "image";
195
+ }
196
+ | {
197
+ data: string | ArrayBuffer;
198
+ filename?: string;
199
+ mediaType?: string;
200
+ mimeType?: string;
201
+ providerMetadata?: Record<
202
+ string,
203
+ Record<string, any>
204
+ >;
205
+ providerOptions?: Record<
206
+ string,
207
+ Record<string, any>
208
+ >;
209
+ type: "file";
210
+ }
211
+ >;
212
+ providerOptions?: Record<string, Record<string, any>>;
213
+ role: "user";
214
+ }
215
+ | {
216
+ content:
217
+ | string
218
+ | Array<
219
+ | {
220
+ providerMetadata?: Record<
221
+ string,
222
+ Record<string, any>
223
+ >;
224
+ providerOptions?: Record<
225
+ string,
226
+ Record<string, any>
227
+ >;
228
+ text: string;
229
+ type: "text";
230
+ }
231
+ | {
232
+ data: string | ArrayBuffer;
233
+ filename?: string;
234
+ mediaType?: string;
235
+ mimeType?: string;
236
+ providerMetadata?: Record<
237
+ string,
238
+ Record<string, any>
239
+ >;
240
+ providerOptions?: Record<
241
+ string,
242
+ Record<string, any>
243
+ >;
244
+ type: "file";
245
+ }
246
+ | {
247
+ providerMetadata?: Record<
248
+ string,
249
+ Record<string, any>
250
+ >;
251
+ providerOptions?: Record<
252
+ string,
253
+ Record<string, any>
254
+ >;
255
+ signature?: string;
256
+ text: string;
257
+ type: "reasoning";
258
+ }
259
+ | {
260
+ data: string;
261
+ providerMetadata?: Record<
262
+ string,
263
+ Record<string, any>
264
+ >;
265
+ providerOptions?: Record<
266
+ string,
267
+ Record<string, any>
268
+ >;
269
+ type: "redacted-reasoning";
270
+ }
271
+ | {
272
+ args?: any;
273
+ input: any;
274
+ providerExecuted?: boolean;
275
+ providerMetadata?: Record<
276
+ string,
277
+ Record<string, any>
278
+ >;
279
+ providerOptions?: Record<
280
+ string,
281
+ Record<string, any>
282
+ >;
283
+ toolCallId: string;
284
+ toolName: string;
285
+ type: "tool-call";
286
+ }
287
+ | {
288
+ args: any;
289
+ input?: any;
290
+ providerExecuted?: boolean;
291
+ providerMetadata?: Record<
292
+ string,
293
+ Record<string, any>
294
+ >;
295
+ providerOptions?: Record<
296
+ string,
297
+ Record<string, any>
298
+ >;
299
+ toolCallId: string;
300
+ toolName: string;
301
+ type: "tool-call";
302
+ }
303
+ | {
304
+ args?: any;
305
+ experimental_content?: Array<
306
+ | { text: string; type: "text" }
307
+ | {
308
+ data: string;
309
+ mimeType?: string;
310
+ type: "image";
311
+ }
312
+ >;
313
+ isError?: boolean;
314
+ output?:
315
+ | {
316
+ providerOptions?: Record<
317
+ string,
318
+ Record<string, any>
319
+ >;
320
+ type: "text";
321
+ value: string;
322
+ }
323
+ | {
324
+ providerOptions?: Record<
325
+ string,
326
+ Record<string, any>
327
+ >;
328
+ type: "json";
329
+ value: any;
330
+ }
331
+ | {
332
+ providerOptions?: Record<
333
+ string,
334
+ Record<string, any>
335
+ >;
336
+ type: "error-text";
337
+ value: string;
338
+ }
339
+ | {
340
+ providerOptions?: Record<
341
+ string,
342
+ Record<string, any>
343
+ >;
344
+ type: "error-json";
345
+ value: any;
346
+ }
347
+ | {
348
+ providerOptions?: Record<
349
+ string,
350
+ Record<string, any>
351
+ >;
352
+ reason?: string;
353
+ type: "execution-denied";
354
+ }
355
+ | {
356
+ type: "content";
357
+ value: Array<
358
+ | {
359
+ providerOptions?: Record<
360
+ string,
361
+ Record<string, any>
362
+ >;
363
+ text: string;
364
+ type: "text";
365
+ }
366
+ | {
367
+ data: string;
368
+ mediaType: string;
369
+ type: "media";
370
+ }
371
+ | {
372
+ data: string;
373
+ filename?: string;
374
+ mediaType: string;
375
+ providerOptions?: Record<
376
+ string,
377
+ Record<string, any>
378
+ >;
379
+ type: "file-data";
380
+ }
381
+ | {
382
+ providerOptions?: Record<
383
+ string,
384
+ Record<string, any>
385
+ >;
386
+ type: "file-url";
387
+ url: string;
388
+ }
389
+ | {
390
+ fileId: string | Record<string, string>;
391
+ providerOptions?: Record<
392
+ string,
393
+ Record<string, any>
394
+ >;
395
+ type: "file-id";
396
+ }
397
+ | {
398
+ data: string;
399
+ mediaType: string;
400
+ providerOptions?: Record<
401
+ string,
402
+ Record<string, any>
403
+ >;
404
+ type: "image-data";
405
+ }
406
+ | {
407
+ providerOptions?: Record<
408
+ string,
409
+ Record<string, any>
410
+ >;
411
+ type: "image-url";
412
+ url: string;
413
+ }
414
+ | {
415
+ fileId: string | Record<string, string>;
416
+ providerOptions?: Record<
417
+ string,
418
+ Record<string, any>
419
+ >;
420
+ type: "image-file-id";
421
+ }
422
+ | {
423
+ providerOptions?: Record<
424
+ string,
425
+ Record<string, any>
426
+ >;
427
+ type: "custom";
428
+ }
429
+ >;
430
+ };
431
+ providerExecuted?: boolean;
432
+ providerMetadata?: Record<
433
+ string,
434
+ Record<string, any>
435
+ >;
436
+ providerOptions?: Record<
437
+ string,
438
+ Record<string, any>
439
+ >;
440
+ result?: any;
441
+ toolCallId: string;
442
+ toolName: string;
443
+ type: "tool-result";
444
+ }
445
+ | {
446
+ id: string;
447
+ providerMetadata?: Record<
448
+ string,
449
+ Record<string, any>
450
+ >;
451
+ providerOptions?: Record<
452
+ string,
453
+ Record<string, any>
454
+ >;
455
+ sourceType: "url";
456
+ title?: string;
457
+ type: "source";
458
+ url: string;
459
+ }
460
+ | {
461
+ filename?: string;
462
+ id: string;
463
+ mediaType: string;
464
+ providerMetadata?: Record<
465
+ string,
466
+ Record<string, any>
467
+ >;
468
+ providerOptions?: Record<
469
+ string,
470
+ Record<string, any>
471
+ >;
472
+ sourceType: "document";
473
+ title: string;
474
+ type: "source";
475
+ }
476
+ | {
477
+ approvalId: string;
478
+ providerMetadata?: Record<
479
+ string,
480
+ Record<string, any>
481
+ >;
482
+ providerOptions?: Record<
483
+ string,
484
+ Record<string, any>
485
+ >;
486
+ toolCallId: string;
487
+ type: "tool-approval-request";
488
+ }
489
+ >;
490
+ providerOptions?: Record<string, Record<string, any>>;
491
+ role: "assistant";
492
+ }
493
+ | {
494
+ content: Array<
495
+ | {
496
+ args?: any;
497
+ experimental_content?: Array<
498
+ | { text: string; type: "text" }
499
+ | { data: string; mimeType?: string; type: "image" }
500
+ >;
501
+ isError?: boolean;
502
+ output?:
503
+ | {
504
+ providerOptions?: Record<
505
+ string,
506
+ Record<string, any>
507
+ >;
508
+ type: "text";
509
+ value: string;
510
+ }
511
+ | {
512
+ providerOptions?: Record<
513
+ string,
514
+ Record<string, any>
515
+ >;
516
+ type: "json";
517
+ value: any;
518
+ }
519
+ | {
520
+ providerOptions?: Record<
521
+ string,
522
+ Record<string, any>
523
+ >;
524
+ type: "error-text";
525
+ value: string;
526
+ }
527
+ | {
528
+ providerOptions?: Record<
529
+ string,
530
+ Record<string, any>
531
+ >;
532
+ type: "error-json";
533
+ value: any;
534
+ }
535
+ | {
536
+ providerOptions?: Record<
537
+ string,
538
+ Record<string, any>
539
+ >;
540
+ reason?: string;
541
+ type: "execution-denied";
542
+ }
543
+ | {
544
+ type: "content";
545
+ value: Array<
546
+ | {
547
+ providerOptions?: Record<
548
+ string,
549
+ Record<string, any>
550
+ >;
551
+ text: string;
552
+ type: "text";
553
+ }
554
+ | {
555
+ data: string;
556
+ mediaType: string;
557
+ type: "media";
558
+ }
559
+ | {
560
+ data: string;
561
+ filename?: string;
562
+ mediaType: string;
563
+ providerOptions?: Record<
564
+ string,
565
+ Record<string, any>
566
+ >;
567
+ type: "file-data";
568
+ }
569
+ | {
570
+ providerOptions?: Record<
571
+ string,
572
+ Record<string, any>
573
+ >;
574
+ type: "file-url";
575
+ url: string;
576
+ }
577
+ | {
578
+ fileId: string | Record<string, string>;
579
+ providerOptions?: Record<
580
+ string,
581
+ Record<string, any>
582
+ >;
583
+ type: "file-id";
584
+ }
585
+ | {
586
+ data: string;
587
+ mediaType: string;
588
+ providerOptions?: Record<
589
+ string,
590
+ Record<string, any>
591
+ >;
592
+ type: "image-data";
593
+ }
594
+ | {
595
+ providerOptions?: Record<
596
+ string,
597
+ Record<string, any>
598
+ >;
599
+ type: "image-url";
600
+ url: string;
601
+ }
602
+ | {
603
+ fileId: string | Record<string, string>;
604
+ providerOptions?: Record<
605
+ string,
606
+ Record<string, any>
607
+ >;
608
+ type: "image-file-id";
609
+ }
610
+ | {
611
+ providerOptions?: Record<
612
+ string,
613
+ Record<string, any>
614
+ >;
615
+ type: "custom";
616
+ }
617
+ >;
618
+ };
619
+ providerExecuted?: boolean;
620
+ providerMetadata?: Record<string, Record<string, any>>;
621
+ providerOptions?: Record<string, Record<string, any>>;
622
+ result?: any;
623
+ toolCallId: string;
624
+ toolName: string;
625
+ type: "tool-result";
626
+ }
627
+ | {
628
+ approvalId: string;
629
+ approved: boolean;
630
+ providerExecuted?: boolean;
631
+ providerMetadata?: Record<string, Record<string, any>>;
632
+ providerOptions?: Record<string, Record<string, any>>;
633
+ reason?: string;
634
+ type: "tool-approval-response";
635
+ }
636
+ >;
637
+ providerOptions?: Record<string, Record<string, any>>;
638
+ role: "tool";
639
+ }
640
+ | {
641
+ content: string;
642
+ providerOptions?: Record<string, Record<string, any>>;
643
+ role: "system";
644
+ };
645
+ model?: string;
646
+ provider?: string;
647
+ providerMetadata?: Record<string, Record<string, any>>;
648
+ reasoning?: string;
649
+ reasoningDetails?: Array<
650
+ | {
651
+ providerMetadata?: Record<string, Record<string, any>>;
652
+ providerOptions?: Record<string, Record<string, any>>;
653
+ signature?: string;
654
+ text: string;
655
+ type: "reasoning";
656
+ }
657
+ | { signature?: string; text: string; type: "text" }
658
+ | { data: string; type: "redacted" }
659
+ >;
660
+ sources?: Array<
661
+ | {
662
+ id: string;
663
+ providerMetadata?: Record<string, Record<string, any>>;
664
+ providerOptions?: Record<string, Record<string, any>>;
665
+ sourceType: "url";
666
+ title?: string;
667
+ type?: "source";
668
+ url: string;
669
+ }
670
+ | {
671
+ filename?: string;
672
+ id: string;
673
+ mediaType: string;
674
+ providerMetadata?: Record<string, Record<string, any>>;
675
+ providerOptions?: Record<string, Record<string, any>>;
676
+ sourceType: "document";
677
+ title: string;
678
+ type: "source";
679
+ }
680
+ >;
681
+ status?: "pending" | "success" | "failed";
682
+ text?: string;
683
+ usage?: {
684
+ cachedInputTokens?: number;
685
+ completionTokens: number;
686
+ promptTokens: number;
687
+ reasoningTokens?: number;
688
+ totalTokens: number;
689
+ };
690
+ warnings?: Array<
691
+ | {
692
+ details?: string;
693
+ setting: string;
694
+ type: "unsupported-setting";
695
+ }
696
+ | { details?: string; tool: any; type: "unsupported-tool" }
697
+ | { message: string; type: "other" }
698
+ >;
699
+ }>;
700
+ pendingMessageId?: string;
701
+ promptMessageId?: string;
702
+ threadId: string;
703
+ userId?: string;
704
+ },
705
+ {
706
+ messages: Array<{
707
+ _creationTime: number;
708
+ _id: string;
709
+ agentName?: string;
710
+ embeddingId?: string;
711
+ error?: string;
712
+ fileIds?: Array<string>;
713
+ finishReason?:
714
+ | "stop"
715
+ | "length"
716
+ | "content-filter"
717
+ | "tool-calls"
718
+ | "error"
719
+ | "other"
720
+ | "unknown";
721
+ id?: string;
722
+ message?:
723
+ | {
724
+ content:
725
+ | string
726
+ | Array<
727
+ | {
728
+ providerMetadata?: Record<
729
+ string,
730
+ Record<string, any>
731
+ >;
732
+ providerOptions?: Record<
733
+ string,
734
+ Record<string, any>
735
+ >;
736
+ text: string;
737
+ type: "text";
738
+ }
739
+ | {
740
+ image: string | ArrayBuffer;
741
+ mediaType?: string;
742
+ mimeType?: string;
743
+ providerOptions?: Record<
744
+ string,
745
+ Record<string, any>
746
+ >;
747
+ type: "image";
748
+ }
749
+ | {
750
+ data: string | ArrayBuffer;
751
+ filename?: string;
752
+ mediaType?: string;
753
+ mimeType?: string;
754
+ providerMetadata?: Record<
755
+ string,
756
+ Record<string, any>
757
+ >;
758
+ providerOptions?: Record<
759
+ string,
760
+ Record<string, any>
761
+ >;
762
+ type: "file";
763
+ }
764
+ >;
765
+ providerOptions?: Record<string, Record<string, any>>;
766
+ role: "user";
767
+ }
768
+ | {
769
+ content:
770
+ | string
771
+ | Array<
772
+ | {
773
+ providerMetadata?: Record<
774
+ string,
775
+ Record<string, any>
776
+ >;
777
+ providerOptions?: Record<
778
+ string,
779
+ Record<string, any>
780
+ >;
781
+ text: string;
782
+ type: "text";
783
+ }
784
+ | {
785
+ data: string | ArrayBuffer;
786
+ filename?: string;
787
+ mediaType?: string;
788
+ mimeType?: string;
789
+ providerMetadata?: Record<
790
+ string,
791
+ Record<string, any>
792
+ >;
793
+ providerOptions?: Record<
794
+ string,
795
+ Record<string, any>
796
+ >;
797
+ type: "file";
798
+ }
799
+ | {
800
+ providerMetadata?: Record<
801
+ string,
802
+ Record<string, any>
803
+ >;
804
+ providerOptions?: Record<
805
+ string,
806
+ Record<string, any>
807
+ >;
808
+ signature?: string;
809
+ text: string;
810
+ type: "reasoning";
811
+ }
812
+ | {
813
+ data: string;
814
+ providerMetadata?: Record<
815
+ string,
816
+ Record<string, any>
817
+ >;
818
+ providerOptions?: Record<
819
+ string,
820
+ Record<string, any>
821
+ >;
822
+ type: "redacted-reasoning";
823
+ }
824
+ | {
825
+ args?: any;
826
+ input: any;
827
+ providerExecuted?: boolean;
828
+ providerMetadata?: Record<
829
+ string,
830
+ Record<string, any>
831
+ >;
832
+ providerOptions?: Record<
833
+ string,
834
+ Record<string, any>
835
+ >;
836
+ toolCallId: string;
837
+ toolName: string;
838
+ type: "tool-call";
839
+ }
840
+ | {
841
+ args: any;
842
+ input?: any;
843
+ providerExecuted?: boolean;
844
+ providerMetadata?: Record<
845
+ string,
846
+ Record<string, any>
847
+ >;
848
+ providerOptions?: Record<
849
+ string,
850
+ Record<string, any>
851
+ >;
852
+ toolCallId: string;
853
+ toolName: string;
854
+ type: "tool-call";
855
+ }
856
+ | {
857
+ args?: any;
858
+ experimental_content?: Array<
859
+ | { text: string; type: "text" }
860
+ | {
861
+ data: string;
862
+ mimeType?: string;
863
+ type: "image";
864
+ }
865
+ >;
866
+ isError?: boolean;
867
+ output?:
868
+ | {
869
+ providerOptions?: Record<
870
+ string,
871
+ Record<string, any>
872
+ >;
873
+ type: "text";
874
+ value: string;
875
+ }
876
+ | {
877
+ providerOptions?: Record<
878
+ string,
879
+ Record<string, any>
880
+ >;
881
+ type: "json";
882
+ value: any;
883
+ }
884
+ | {
885
+ providerOptions?: Record<
886
+ string,
887
+ Record<string, any>
888
+ >;
889
+ type: "error-text";
890
+ value: string;
891
+ }
892
+ | {
893
+ providerOptions?: Record<
894
+ string,
895
+ Record<string, any>
896
+ >;
897
+ type: "error-json";
898
+ value: any;
899
+ }
900
+ | {
901
+ providerOptions?: Record<
902
+ string,
903
+ Record<string, any>
904
+ >;
905
+ reason?: string;
906
+ type: "execution-denied";
907
+ }
908
+ | {
909
+ type: "content";
910
+ value: Array<
911
+ | {
912
+ providerOptions?: Record<
913
+ string,
914
+ Record<string, any>
915
+ >;
916
+ text: string;
917
+ type: "text";
918
+ }
919
+ | {
920
+ data: string;
921
+ mediaType: string;
922
+ type: "media";
923
+ }
924
+ | {
925
+ data: string;
926
+ filename?: string;
927
+ mediaType: string;
928
+ providerOptions?: Record<
929
+ string,
930
+ Record<string, any>
931
+ >;
932
+ type: "file-data";
933
+ }
934
+ | {
935
+ providerOptions?: Record<
936
+ string,
937
+ Record<string, any>
938
+ >;
939
+ type: "file-url";
940
+ url: string;
941
+ }
942
+ | {
943
+ fileId: string | Record<string, string>;
944
+ providerOptions?: Record<
945
+ string,
946
+ Record<string, any>
947
+ >;
948
+ type: "file-id";
949
+ }
950
+ | {
951
+ data: string;
952
+ mediaType: string;
953
+ providerOptions?: Record<
954
+ string,
955
+ Record<string, any>
956
+ >;
957
+ type: "image-data";
958
+ }
959
+ | {
960
+ providerOptions?: Record<
961
+ string,
962
+ Record<string, any>
963
+ >;
964
+ type: "image-url";
965
+ url: string;
966
+ }
967
+ | {
968
+ fileId: string | Record<string, string>;
969
+ providerOptions?: Record<
970
+ string,
971
+ Record<string, any>
972
+ >;
973
+ type: "image-file-id";
974
+ }
975
+ | {
976
+ providerOptions?: Record<
977
+ string,
978
+ Record<string, any>
979
+ >;
980
+ type: "custom";
981
+ }
982
+ >;
983
+ };
984
+ providerExecuted?: boolean;
985
+ providerMetadata?: Record<
986
+ string,
987
+ Record<string, any>
988
+ >;
989
+ providerOptions?: Record<
990
+ string,
991
+ Record<string, any>
992
+ >;
993
+ result?: any;
994
+ toolCallId: string;
995
+ toolName: string;
996
+ type: "tool-result";
997
+ }
998
+ | {
999
+ id: string;
1000
+ providerMetadata?: Record<
1001
+ string,
1002
+ Record<string, any>
1003
+ >;
1004
+ providerOptions?: Record<
1005
+ string,
1006
+ Record<string, any>
1007
+ >;
1008
+ sourceType: "url";
1009
+ title?: string;
1010
+ type: "source";
1011
+ url: string;
1012
+ }
1013
+ | {
1014
+ filename?: string;
1015
+ id: string;
1016
+ mediaType: string;
1017
+ providerMetadata?: Record<
1018
+ string,
1019
+ Record<string, any>
1020
+ >;
1021
+ providerOptions?: Record<
1022
+ string,
1023
+ Record<string, any>
1024
+ >;
1025
+ sourceType: "document";
1026
+ title: string;
1027
+ type: "source";
1028
+ }
1029
+ | {
1030
+ approvalId: string;
1031
+ providerMetadata?: Record<
1032
+ string,
1033
+ Record<string, any>
1034
+ >;
1035
+ providerOptions?: Record<
1036
+ string,
1037
+ Record<string, any>
1038
+ >;
1039
+ toolCallId: string;
1040
+ type: "tool-approval-request";
1041
+ }
1042
+ >;
1043
+ providerOptions?: Record<string, Record<string, any>>;
1044
+ role: "assistant";
1045
+ }
1046
+ | {
1047
+ content: Array<
1048
+ | {
1049
+ args?: any;
1050
+ experimental_content?: Array<
1051
+ | { text: string; type: "text" }
1052
+ | { data: string; mimeType?: string; type: "image" }
1053
+ >;
1054
+ isError?: boolean;
1055
+ output?:
1056
+ | {
1057
+ providerOptions?: Record<
1058
+ string,
1059
+ Record<string, any>
1060
+ >;
1061
+ type: "text";
1062
+ value: string;
1063
+ }
1064
+ | {
1065
+ providerOptions?: Record<
1066
+ string,
1067
+ Record<string, any>
1068
+ >;
1069
+ type: "json";
1070
+ value: any;
1071
+ }
1072
+ | {
1073
+ providerOptions?: Record<
1074
+ string,
1075
+ Record<string, any>
1076
+ >;
1077
+ type: "error-text";
1078
+ value: string;
1079
+ }
1080
+ | {
1081
+ providerOptions?: Record<
1082
+ string,
1083
+ Record<string, any>
1084
+ >;
1085
+ type: "error-json";
1086
+ value: any;
1087
+ }
1088
+ | {
1089
+ providerOptions?: Record<
1090
+ string,
1091
+ Record<string, any>
1092
+ >;
1093
+ reason?: string;
1094
+ type: "execution-denied";
1095
+ }
1096
+ | {
1097
+ type: "content";
1098
+ value: Array<
1099
+ | {
1100
+ providerOptions?: Record<
1101
+ string,
1102
+ Record<string, any>
1103
+ >;
1104
+ text: string;
1105
+ type: "text";
1106
+ }
1107
+ | {
1108
+ data: string;
1109
+ mediaType: string;
1110
+ type: "media";
1111
+ }
1112
+ | {
1113
+ data: string;
1114
+ filename?: string;
1115
+ mediaType: string;
1116
+ providerOptions?: Record<
1117
+ string,
1118
+ Record<string, any>
1119
+ >;
1120
+ type: "file-data";
1121
+ }
1122
+ | {
1123
+ providerOptions?: Record<
1124
+ string,
1125
+ Record<string, any>
1126
+ >;
1127
+ type: "file-url";
1128
+ url: string;
1129
+ }
1130
+ | {
1131
+ fileId: string | Record<string, string>;
1132
+ providerOptions?: Record<
1133
+ string,
1134
+ Record<string, any>
1135
+ >;
1136
+ type: "file-id";
1137
+ }
1138
+ | {
1139
+ data: string;
1140
+ mediaType: string;
1141
+ providerOptions?: Record<
1142
+ string,
1143
+ Record<string, any>
1144
+ >;
1145
+ type: "image-data";
1146
+ }
1147
+ | {
1148
+ providerOptions?: Record<
1149
+ string,
1150
+ Record<string, any>
1151
+ >;
1152
+ type: "image-url";
1153
+ url: string;
1154
+ }
1155
+ | {
1156
+ fileId: string | Record<string, string>;
1157
+ providerOptions?: Record<
1158
+ string,
1159
+ Record<string, any>
1160
+ >;
1161
+ type: "image-file-id";
1162
+ }
1163
+ | {
1164
+ providerOptions?: Record<
1165
+ string,
1166
+ Record<string, any>
1167
+ >;
1168
+ type: "custom";
1169
+ }
1170
+ >;
1171
+ };
1172
+ providerExecuted?: boolean;
1173
+ providerMetadata?: Record<string, Record<string, any>>;
1174
+ providerOptions?: Record<string, Record<string, any>>;
1175
+ result?: any;
1176
+ toolCallId: string;
1177
+ toolName: string;
1178
+ type: "tool-result";
1179
+ }
1180
+ | {
1181
+ approvalId: string;
1182
+ approved: boolean;
1183
+ providerExecuted?: boolean;
1184
+ providerMetadata?: Record<string, Record<string, any>>;
1185
+ providerOptions?: Record<string, Record<string, any>>;
1186
+ reason?: string;
1187
+ type: "tool-approval-response";
1188
+ }
1189
+ >;
1190
+ providerOptions?: Record<string, Record<string, any>>;
1191
+ role: "tool";
1192
+ }
1193
+ | {
1194
+ content: string;
1195
+ providerOptions?: Record<string, Record<string, any>>;
1196
+ role: "system";
1197
+ };
1198
+ model?: string;
1199
+ order: number;
1200
+ provider?: string;
1201
+ providerMetadata?: Record<string, Record<string, any>>;
1202
+ providerOptions?: Record<string, Record<string, any>>;
1203
+ reasoning?: string;
1204
+ reasoningDetails?: Array<
1205
+ | {
1206
+ providerMetadata?: Record<string, Record<string, any>>;
1207
+ providerOptions?: Record<string, Record<string, any>>;
1208
+ signature?: string;
1209
+ text: string;
1210
+ type: "reasoning";
1211
+ }
1212
+ | { signature?: string; text: string; type: "text" }
1213
+ | { data: string; type: "redacted" }
1214
+ >;
1215
+ sources?: Array<
1216
+ | {
1217
+ id: string;
1218
+ providerMetadata?: Record<string, Record<string, any>>;
1219
+ providerOptions?: Record<string, Record<string, any>>;
1220
+ sourceType: "url";
1221
+ title?: string;
1222
+ type?: "source";
1223
+ url: string;
1224
+ }
1225
+ | {
1226
+ filename?: string;
1227
+ id: string;
1228
+ mediaType: string;
1229
+ providerMetadata?: Record<string, Record<string, any>>;
1230
+ providerOptions?: Record<string, Record<string, any>>;
1231
+ sourceType: "document";
1232
+ title: string;
1233
+ type: "source";
1234
+ }
1235
+ >;
1236
+ status: "pending" | "success" | "failed";
1237
+ stepOrder: number;
1238
+ text?: string;
1239
+ threadId: string;
1240
+ tool: boolean;
1241
+ usage?: {
1242
+ cachedInputTokens?: number;
1243
+ completionTokens: number;
1244
+ promptTokens: number;
1245
+ reasoningTokens?: number;
1246
+ totalTokens: number;
1247
+ };
1248
+ userId?: string;
1249
+ warnings?: Array<
1250
+ | {
1251
+ details?: string;
1252
+ setting: string;
1253
+ type: "unsupported-setting";
1254
+ }
1255
+ | { details?: string; tool: any; type: "unsupported-tool" }
1256
+ | { message: string; type: "other" }
1257
+ >;
1258
+ }>;
1259
+ },
1260
+ Name
1261
+ >;
1262
+ cloneThread: FunctionReference<
1263
+ "action",
1264
+ "internal",
1265
+ {
1266
+ batchSize?: number;
1267
+ copyUserIdForVectorSearch?: boolean;
1268
+ excludeToolMessages?: boolean;
1269
+ insertAtOrder?: number;
1270
+ limit?: number;
1271
+ sourceThreadId: string;
1272
+ statuses?: Array<"pending" | "success" | "failed">;
1273
+ targetThreadId: string;
1274
+ upToAndIncludingMessageId?: string;
1275
+ },
1276
+ number,
1277
+ Name
1278
+ >;
1279
+ deleteByIds: FunctionReference<
1280
+ "mutation",
1281
+ "internal",
1282
+ { messageIds: Array<string> },
1283
+ Array<string>,
1284
+ Name
1285
+ >;
1286
+ deleteByOrder: FunctionReference<
1287
+ "mutation",
1288
+ "internal",
1289
+ {
1290
+ endOrder: number;
1291
+ endStepOrder?: number;
1292
+ startOrder: number;
1293
+ startStepOrder?: number;
1294
+ threadId: string;
1295
+ },
1296
+ { isDone: boolean; lastOrder?: number; lastStepOrder?: number },
1297
+ Name
1298
+ >;
1299
+ finalizeMessage: FunctionReference<
1300
+ "mutation",
1301
+ "internal",
1302
+ {
1303
+ messageId: string;
1304
+ result: { status: "success" } | { error: string; status: "failed" };
1305
+ },
1306
+ null,
1307
+ Name
1308
+ >;
1309
+ getMessagesByIds: FunctionReference<
1310
+ "query",
1311
+ "internal",
1312
+ { messageIds: Array<string> },
1313
+ Array<null | {
1314
+ _creationTime: number;
1315
+ _id: string;
1316
+ agentName?: string;
1317
+ embeddingId?: string;
1318
+ error?: string;
1319
+ fileIds?: Array<string>;
1320
+ finishReason?:
1321
+ | "stop"
1322
+ | "length"
1323
+ | "content-filter"
1324
+ | "tool-calls"
1325
+ | "error"
1326
+ | "other"
1327
+ | "unknown";
1328
+ id?: string;
1329
+ message?:
1330
+ | {
1331
+ content:
1332
+ | string
1333
+ | Array<
1334
+ | {
1335
+ providerMetadata?: Record<
1336
+ string,
1337
+ Record<string, any>
1338
+ >;
1339
+ providerOptions?: Record<string, Record<string, any>>;
1340
+ text: string;
1341
+ type: "text";
1342
+ }
1343
+ | {
1344
+ image: string | ArrayBuffer;
1345
+ mediaType?: string;
1346
+ mimeType?: string;
1347
+ providerOptions?: Record<string, Record<string, any>>;
1348
+ type: "image";
1349
+ }
1350
+ | {
1351
+ data: string | ArrayBuffer;
1352
+ filename?: string;
1353
+ mediaType?: string;
1354
+ mimeType?: string;
1355
+ providerMetadata?: Record<
1356
+ string,
1357
+ Record<string, any>
1358
+ >;
1359
+ providerOptions?: Record<string, Record<string, any>>;
1360
+ type: "file";
1361
+ }
1362
+ >;
1363
+ providerOptions?: Record<string, Record<string, any>>;
1364
+ role: "user";
1365
+ }
1366
+ | {
1367
+ content:
1368
+ | string
1369
+ | Array<
1370
+ | {
1371
+ providerMetadata?: Record<
1372
+ string,
1373
+ Record<string, any>
1374
+ >;
1375
+ providerOptions?: Record<string, Record<string, any>>;
1376
+ text: string;
1377
+ type: "text";
1378
+ }
1379
+ | {
1380
+ data: string | ArrayBuffer;
1381
+ filename?: string;
1382
+ mediaType?: string;
1383
+ mimeType?: string;
1384
+ providerMetadata?: Record<
1385
+ string,
1386
+ Record<string, any>
1387
+ >;
1388
+ providerOptions?: Record<string, Record<string, any>>;
1389
+ type: "file";
1390
+ }
1391
+ | {
1392
+ providerMetadata?: Record<
1393
+ string,
1394
+ Record<string, any>
1395
+ >;
1396
+ providerOptions?: Record<string, Record<string, any>>;
1397
+ signature?: string;
1398
+ text: string;
1399
+ type: "reasoning";
1400
+ }
1401
+ | {
1402
+ data: string;
1403
+ providerMetadata?: Record<
1404
+ string,
1405
+ Record<string, any>
1406
+ >;
1407
+ providerOptions?: Record<string, Record<string, any>>;
1408
+ type: "redacted-reasoning";
1409
+ }
1410
+ | {
1411
+ args?: any;
1412
+ input: any;
1413
+ providerExecuted?: boolean;
1414
+ providerMetadata?: Record<
1415
+ string,
1416
+ Record<string, any>
1417
+ >;
1418
+ providerOptions?: Record<string, Record<string, any>>;
1419
+ toolCallId: string;
1420
+ toolName: string;
1421
+ type: "tool-call";
1422
+ }
1423
+ | {
1424
+ args: any;
1425
+ input?: any;
1426
+ providerExecuted?: boolean;
1427
+ providerMetadata?: Record<
1428
+ string,
1429
+ Record<string, any>
1430
+ >;
1431
+ providerOptions?: Record<
1432
+ string,
1433
+ Record<string, any>
1434
+ >;
1435
+ toolCallId: string;
1436
+ toolName: string;
1437
+ type: "tool-call";
1438
+ }
1439
+ | {
1440
+ args?: any;
1441
+ experimental_content?: Array<
1442
+ | { text: string; type: "text" }
1443
+ | { data: string; mimeType?: string; type: "image" }
1444
+ >;
1445
+ isError?: boolean;
1446
+ output?:
1447
+ | {
1448
+ providerOptions?: Record<
1449
+ string,
1450
+ Record<string, any>
1451
+ >;
1452
+ type: "text";
1453
+ value: string;
1454
+ }
1455
+ | {
1456
+ providerOptions?: Record<
1457
+ string,
1458
+ Record<string, any>
1459
+ >;
1460
+ type: "json";
1461
+ value: any;
1462
+ }
1463
+ | {
1464
+ providerOptions?: Record<
1465
+ string,
1466
+ Record<string, any>
1467
+ >;
1468
+ type: "error-text";
1469
+ value: string;
1470
+ }
1471
+ | {
1472
+ providerOptions?: Record<
1473
+ string,
1474
+ Record<string, any>
1475
+ >;
1476
+ type: "error-json";
1477
+ value: any;
1478
+ }
1479
+ | {
1480
+ providerOptions?: Record<
1481
+ string,
1482
+ Record<string, any>
1483
+ >;
1484
+ reason?: string;
1485
+ type: "execution-denied";
1486
+ }
1487
+ | {
1488
+ type: "content";
1489
+ value: Array<
1490
+ | {
1491
+ providerOptions?: Record<
1492
+ string,
1493
+ Record<string, any>
1494
+ >;
1495
+ text: string;
1496
+ type: "text";
1497
+ }
1498
+ | {
1499
+ data: string;
1500
+ mediaType: string;
1501
+ type: "media";
1502
+ }
1503
+ | {
1504
+ data: string;
1505
+ filename?: string;
1506
+ mediaType: string;
1507
+ providerOptions?: Record<
1508
+ string,
1509
+ Record<string, any>
1510
+ >;
1511
+ type: "file-data";
1512
+ }
1513
+ | {
1514
+ providerOptions?: Record<
1515
+ string,
1516
+ Record<string, any>
1517
+ >;
1518
+ type: "file-url";
1519
+ url: string;
1520
+ }
1521
+ | {
1522
+ fileId: string | Record<string, string>;
1523
+ providerOptions?: Record<
1524
+ string,
1525
+ Record<string, any>
1526
+ >;
1527
+ type: "file-id";
1528
+ }
1529
+ | {
1530
+ data: string;
1531
+ mediaType: string;
1532
+ providerOptions?: Record<
1533
+ string,
1534
+ Record<string, any>
1535
+ >;
1536
+ type: "image-data";
1537
+ }
1538
+ | {
1539
+ providerOptions?: Record<
1540
+ string,
1541
+ Record<string, any>
1542
+ >;
1543
+ type: "image-url";
1544
+ url: string;
1545
+ }
1546
+ | {
1547
+ fileId: string | Record<string, string>;
1548
+ providerOptions?: Record<
1549
+ string,
1550
+ Record<string, any>
1551
+ >;
1552
+ type: "image-file-id";
1553
+ }
1554
+ | {
1555
+ providerOptions?: Record<
1556
+ string,
1557
+ Record<string, any>
1558
+ >;
1559
+ type: "custom";
1560
+ }
1561
+ >;
1562
+ };
1563
+ providerExecuted?: boolean;
1564
+ providerMetadata?: Record<
1565
+ string,
1566
+ Record<string, any>
1567
+ >;
1568
+ providerOptions?: Record<string, Record<string, any>>;
1569
+ result?: any;
1570
+ toolCallId: string;
1571
+ toolName: string;
1572
+ type: "tool-result";
1573
+ }
1574
+ | {
1575
+ id: string;
1576
+ providerMetadata?: Record<
1577
+ string,
1578
+ Record<string, any>
1579
+ >;
1580
+ providerOptions?: Record<string, Record<string, any>>;
1581
+ sourceType: "url";
1582
+ title?: string;
1583
+ type: "source";
1584
+ url: string;
1585
+ }
1586
+ | {
1587
+ filename?: string;
1588
+ id: string;
1589
+ mediaType: string;
1590
+ providerMetadata?: Record<
1591
+ string,
1592
+ Record<string, any>
1593
+ >;
1594
+ providerOptions?: Record<string, Record<string, any>>;
1595
+ sourceType: "document";
1596
+ title: string;
1597
+ type: "source";
1598
+ }
1599
+ | {
1600
+ approvalId: string;
1601
+ providerMetadata?: Record<
1602
+ string,
1603
+ Record<string, any>
1604
+ >;
1605
+ providerOptions?: Record<string, Record<string, any>>;
1606
+ toolCallId: string;
1607
+ type: "tool-approval-request";
1608
+ }
1609
+ >;
1610
+ providerOptions?: Record<string, Record<string, any>>;
1611
+ role: "assistant";
1612
+ }
1613
+ | {
1614
+ content: Array<
1615
+ | {
1616
+ args?: any;
1617
+ experimental_content?: Array<
1618
+ | { text: string; type: "text" }
1619
+ | { data: string; mimeType?: string; type: "image" }
1620
+ >;
1621
+ isError?: boolean;
1622
+ output?:
1623
+ | {
1624
+ providerOptions?: Record<
1625
+ string,
1626
+ Record<string, any>
1627
+ >;
1628
+ type: "text";
1629
+ value: string;
1630
+ }
1631
+ | {
1632
+ providerOptions?: Record<
1633
+ string,
1634
+ Record<string, any>
1635
+ >;
1636
+ type: "json";
1637
+ value: any;
1638
+ }
1639
+ | {
1640
+ providerOptions?: Record<
1641
+ string,
1642
+ Record<string, any>
1643
+ >;
1644
+ type: "error-text";
1645
+ value: string;
1646
+ }
1647
+ | {
1648
+ providerOptions?: Record<
1649
+ string,
1650
+ Record<string, any>
1651
+ >;
1652
+ type: "error-json";
1653
+ value: any;
1654
+ }
1655
+ | {
1656
+ providerOptions?: Record<
1657
+ string,
1658
+ Record<string, any>
1659
+ >;
1660
+ reason?: string;
1661
+ type: "execution-denied";
1662
+ }
1663
+ | {
1664
+ type: "content";
1665
+ value: Array<
1666
+ | {
1667
+ providerOptions?: Record<
1668
+ string,
1669
+ Record<string, any>
1670
+ >;
1671
+ text: string;
1672
+ type: "text";
1673
+ }
1674
+ | {
1675
+ data: string;
1676
+ mediaType: string;
1677
+ type: "media";
1678
+ }
1679
+ | {
1680
+ data: string;
1681
+ filename?: string;
1682
+ mediaType: string;
1683
+ providerOptions?: Record<
1684
+ string,
1685
+ Record<string, any>
1686
+ >;
1687
+ type: "file-data";
1688
+ }
1689
+ | {
1690
+ providerOptions?: Record<
1691
+ string,
1692
+ Record<string, any>
1693
+ >;
1694
+ type: "file-url";
1695
+ url: string;
1696
+ }
1697
+ | {
1698
+ fileId: string | Record<string, string>;
1699
+ providerOptions?: Record<
1700
+ string,
1701
+ Record<string, any>
1702
+ >;
1703
+ type: "file-id";
1704
+ }
1705
+ | {
1706
+ data: string;
1707
+ mediaType: string;
1708
+ providerOptions?: Record<
1709
+ string,
1710
+ Record<string, any>
1711
+ >;
1712
+ type: "image-data";
1713
+ }
1714
+ | {
1715
+ providerOptions?: Record<
1716
+ string,
1717
+ Record<string, any>
1718
+ >;
1719
+ type: "image-url";
1720
+ url: string;
1721
+ }
1722
+ | {
1723
+ fileId: string | Record<string, string>;
1724
+ providerOptions?: Record<
1725
+ string,
1726
+ Record<string, any>
1727
+ >;
1728
+ type: "image-file-id";
1729
+ }
1730
+ | {
1731
+ providerOptions?: Record<
1732
+ string,
1733
+ Record<string, any>
1734
+ >;
1735
+ type: "custom";
1736
+ }
1737
+ >;
1738
+ };
1739
+ providerExecuted?: boolean;
1740
+ providerMetadata?: Record<string, Record<string, any>>;
1741
+ providerOptions?: Record<string, Record<string, any>>;
1742
+ result?: any;
1743
+ toolCallId: string;
1744
+ toolName: string;
1745
+ type: "tool-result";
1746
+ }
1747
+ | {
1748
+ approvalId: string;
1749
+ approved: boolean;
1750
+ providerExecuted?: boolean;
1751
+ providerMetadata?: Record<string, Record<string, any>>;
1752
+ providerOptions?: Record<string, Record<string, any>>;
1753
+ reason?: string;
1754
+ type: "tool-approval-response";
1755
+ }
1756
+ >;
1757
+ providerOptions?: Record<string, Record<string, any>>;
1758
+ role: "tool";
1759
+ }
1760
+ | {
1761
+ content: string;
1762
+ providerOptions?: Record<string, Record<string, any>>;
1763
+ role: "system";
1764
+ };
1765
+ model?: string;
1766
+ order: number;
1767
+ provider?: string;
1768
+ providerMetadata?: Record<string, Record<string, any>>;
1769
+ providerOptions?: Record<string, Record<string, any>>;
1770
+ reasoning?: string;
1771
+ reasoningDetails?: Array<
1772
+ | {
1773
+ providerMetadata?: Record<string, Record<string, any>>;
1774
+ providerOptions?: Record<string, Record<string, any>>;
1775
+ signature?: string;
1776
+ text: string;
1777
+ type: "reasoning";
1778
+ }
1779
+ | { signature?: string; text: string; type: "text" }
1780
+ | { data: string; type: "redacted" }
1781
+ >;
1782
+ sources?: Array<
1783
+ | {
1784
+ id: string;
1785
+ providerMetadata?: Record<string, Record<string, any>>;
1786
+ providerOptions?: Record<string, Record<string, any>>;
1787
+ sourceType: "url";
1788
+ title?: string;
1789
+ type?: "source";
1790
+ url: string;
1791
+ }
1792
+ | {
1793
+ filename?: string;
1794
+ id: string;
1795
+ mediaType: string;
1796
+ providerMetadata?: Record<string, Record<string, any>>;
1797
+ providerOptions?: Record<string, Record<string, any>>;
1798
+ sourceType: "document";
1799
+ title: string;
1800
+ type: "source";
1801
+ }
1802
+ >;
1803
+ status: "pending" | "success" | "failed";
1804
+ stepOrder: number;
1805
+ text?: string;
1806
+ threadId: string;
1807
+ tool: boolean;
1808
+ usage?: {
1809
+ cachedInputTokens?: number;
1810
+ completionTokens: number;
1811
+ promptTokens: number;
1812
+ reasoningTokens?: number;
1813
+ totalTokens: number;
1814
+ };
1815
+ userId?: string;
1816
+ warnings?: Array<
1817
+ | { details?: string; setting: string; type: "unsupported-setting" }
1818
+ | { details?: string; tool: any; type: "unsupported-tool" }
1819
+ | { message: string; type: "other" }
1820
+ >;
1821
+ }>,
1822
+ Name
1823
+ >;
1824
+ getMessageSearchFields: FunctionReference<
1825
+ "query",
1826
+ "internal",
1827
+ { messageId: string },
1828
+ { embedding?: Array<number>; embeddingModel?: string; text?: string },
1829
+ Name
1830
+ >;
1831
+ listMessagesByThreadId: FunctionReference<
1832
+ "query",
1833
+ "internal",
1834
+ {
1835
+ excludeToolMessages?: boolean;
1836
+ order: "asc" | "desc";
1837
+ paginationOpts?: {
1838
+ cursor: string | null;
1839
+ endCursor?: string | null;
1840
+ id?: number;
1841
+ maximumBytesRead?: number;
1842
+ maximumRowsRead?: number;
1843
+ numItems: number;
1844
+ };
1845
+ statuses?: Array<"pending" | "success" | "failed">;
1846
+ threadId: string;
1847
+ upToAndIncludingMessageId?: string;
1848
+ },
1849
+ {
1850
+ continueCursor: string;
1851
+ isDone: boolean;
1852
+ page: Array<{
1853
+ _creationTime: number;
1854
+ _id: string;
1855
+ agentName?: string;
1856
+ embeddingId?: string;
1857
+ error?: string;
1858
+ fileIds?: Array<string>;
1859
+ finishReason?:
1860
+ | "stop"
1861
+ | "length"
1862
+ | "content-filter"
1863
+ | "tool-calls"
1864
+ | "error"
1865
+ | "other"
1866
+ | "unknown";
1867
+ id?: string;
1868
+ message?:
1869
+ | {
1870
+ content:
1871
+ | string
1872
+ | Array<
1873
+ | {
1874
+ providerMetadata?: Record<
1875
+ string,
1876
+ Record<string, any>
1877
+ >;
1878
+ providerOptions?: Record<
1879
+ string,
1880
+ Record<string, any>
1881
+ >;
1882
+ text: string;
1883
+ type: "text";
1884
+ }
1885
+ | {
1886
+ image: string | ArrayBuffer;
1887
+ mediaType?: string;
1888
+ mimeType?: string;
1889
+ providerOptions?: Record<
1890
+ string,
1891
+ Record<string, any>
1892
+ >;
1893
+ type: "image";
1894
+ }
1895
+ | {
1896
+ data: string | ArrayBuffer;
1897
+ filename?: string;
1898
+ mediaType?: string;
1899
+ mimeType?: string;
1900
+ providerMetadata?: Record<
1901
+ string,
1902
+ Record<string, any>
1903
+ >;
1904
+ providerOptions?: Record<
1905
+ string,
1906
+ Record<string, any>
1907
+ >;
1908
+ type: "file";
1909
+ }
1910
+ >;
1911
+ providerOptions?: Record<string, Record<string, any>>;
1912
+ role: "user";
1913
+ }
1914
+ | {
1915
+ content:
1916
+ | string
1917
+ | Array<
1918
+ | {
1919
+ providerMetadata?: Record<
1920
+ string,
1921
+ Record<string, any>
1922
+ >;
1923
+ providerOptions?: Record<
1924
+ string,
1925
+ Record<string, any>
1926
+ >;
1927
+ text: string;
1928
+ type: "text";
1929
+ }
1930
+ | {
1931
+ data: string | ArrayBuffer;
1932
+ filename?: string;
1933
+ mediaType?: string;
1934
+ mimeType?: string;
1935
+ providerMetadata?: Record<
1936
+ string,
1937
+ Record<string, any>
1938
+ >;
1939
+ providerOptions?: Record<
1940
+ string,
1941
+ Record<string, any>
1942
+ >;
1943
+ type: "file";
1944
+ }
1945
+ | {
1946
+ providerMetadata?: Record<
1947
+ string,
1948
+ Record<string, any>
1949
+ >;
1950
+ providerOptions?: Record<
1951
+ string,
1952
+ Record<string, any>
1953
+ >;
1954
+ signature?: string;
1955
+ text: string;
1956
+ type: "reasoning";
1957
+ }
1958
+ | {
1959
+ data: string;
1960
+ providerMetadata?: Record<
1961
+ string,
1962
+ Record<string, any>
1963
+ >;
1964
+ providerOptions?: Record<
1965
+ string,
1966
+ Record<string, any>
1967
+ >;
1968
+ type: "redacted-reasoning";
1969
+ }
1970
+ | {
1971
+ args?: any;
1972
+ input: any;
1973
+ providerExecuted?: boolean;
1974
+ providerMetadata?: Record<
1975
+ string,
1976
+ Record<string, any>
1977
+ >;
1978
+ providerOptions?: Record<
1979
+ string,
1980
+ Record<string, any>
1981
+ >;
1982
+ toolCallId: string;
1983
+ toolName: string;
1984
+ type: "tool-call";
1985
+ }
1986
+ | {
1987
+ args: any;
1988
+ input?: any;
1989
+ providerExecuted?: boolean;
1990
+ providerMetadata?: Record<
1991
+ string,
1992
+ Record<string, any>
1993
+ >;
1994
+ providerOptions?: Record<
1995
+ string,
1996
+ Record<string, any>
1997
+ >;
1998
+ toolCallId: string;
1999
+ toolName: string;
2000
+ type: "tool-call";
2001
+ }
2002
+ | {
2003
+ args?: any;
2004
+ experimental_content?: Array<
2005
+ | { text: string; type: "text" }
2006
+ | {
2007
+ data: string;
2008
+ mimeType?: string;
2009
+ type: "image";
2010
+ }
2011
+ >;
2012
+ isError?: boolean;
2013
+ output?:
2014
+ | {
2015
+ providerOptions?: Record<
2016
+ string,
2017
+ Record<string, any>
2018
+ >;
2019
+ type: "text";
2020
+ value: string;
2021
+ }
2022
+ | {
2023
+ providerOptions?: Record<
2024
+ string,
2025
+ Record<string, any>
2026
+ >;
2027
+ type: "json";
2028
+ value: any;
2029
+ }
2030
+ | {
2031
+ providerOptions?: Record<
2032
+ string,
2033
+ Record<string, any>
2034
+ >;
2035
+ type: "error-text";
2036
+ value: string;
2037
+ }
2038
+ | {
2039
+ providerOptions?: Record<
2040
+ string,
2041
+ Record<string, any>
2042
+ >;
2043
+ type: "error-json";
2044
+ value: any;
2045
+ }
2046
+ | {
2047
+ providerOptions?: Record<
2048
+ string,
2049
+ Record<string, any>
2050
+ >;
2051
+ reason?: string;
2052
+ type: "execution-denied";
2053
+ }
2054
+ | {
2055
+ type: "content";
2056
+ value: Array<
2057
+ | {
2058
+ providerOptions?: Record<
2059
+ string,
2060
+ Record<string, any>
2061
+ >;
2062
+ text: string;
2063
+ type: "text";
2064
+ }
2065
+ | {
2066
+ data: string;
2067
+ mediaType: string;
2068
+ type: "media";
2069
+ }
2070
+ | {
2071
+ data: string;
2072
+ filename?: string;
2073
+ mediaType: string;
2074
+ providerOptions?: Record<
2075
+ string,
2076
+ Record<string, any>
2077
+ >;
2078
+ type: "file-data";
2079
+ }
2080
+ | {
2081
+ providerOptions?: Record<
2082
+ string,
2083
+ Record<string, any>
2084
+ >;
2085
+ type: "file-url";
2086
+ url: string;
2087
+ }
2088
+ | {
2089
+ fileId: string | Record<string, string>;
2090
+ providerOptions?: Record<
2091
+ string,
2092
+ Record<string, any>
2093
+ >;
2094
+ type: "file-id";
2095
+ }
2096
+ | {
2097
+ data: string;
2098
+ mediaType: string;
2099
+ providerOptions?: Record<
2100
+ string,
2101
+ Record<string, any>
2102
+ >;
2103
+ type: "image-data";
2104
+ }
2105
+ | {
2106
+ providerOptions?: Record<
2107
+ string,
2108
+ Record<string, any>
2109
+ >;
2110
+ type: "image-url";
2111
+ url: string;
2112
+ }
2113
+ | {
2114
+ fileId: string | Record<string, string>;
2115
+ providerOptions?: Record<
2116
+ string,
2117
+ Record<string, any>
2118
+ >;
2119
+ type: "image-file-id";
2120
+ }
2121
+ | {
2122
+ providerOptions?: Record<
2123
+ string,
2124
+ Record<string, any>
2125
+ >;
2126
+ type: "custom";
2127
+ }
2128
+ >;
2129
+ };
2130
+ providerExecuted?: boolean;
2131
+ providerMetadata?: Record<
2132
+ string,
2133
+ Record<string, any>
2134
+ >;
2135
+ providerOptions?: Record<
2136
+ string,
2137
+ Record<string, any>
2138
+ >;
2139
+ result?: any;
2140
+ toolCallId: string;
2141
+ toolName: string;
2142
+ type: "tool-result";
2143
+ }
2144
+ | {
2145
+ id: string;
2146
+ providerMetadata?: Record<
2147
+ string,
2148
+ Record<string, any>
2149
+ >;
2150
+ providerOptions?: Record<
2151
+ string,
2152
+ Record<string, any>
2153
+ >;
2154
+ sourceType: "url";
2155
+ title?: string;
2156
+ type: "source";
2157
+ url: string;
2158
+ }
2159
+ | {
2160
+ filename?: string;
2161
+ id: string;
2162
+ mediaType: string;
2163
+ providerMetadata?: Record<
2164
+ string,
2165
+ Record<string, any>
2166
+ >;
2167
+ providerOptions?: Record<
2168
+ string,
2169
+ Record<string, any>
2170
+ >;
2171
+ sourceType: "document";
2172
+ title: string;
2173
+ type: "source";
2174
+ }
2175
+ | {
2176
+ approvalId: string;
2177
+ providerMetadata?: Record<
2178
+ string,
2179
+ Record<string, any>
2180
+ >;
2181
+ providerOptions?: Record<
2182
+ string,
2183
+ Record<string, any>
2184
+ >;
2185
+ toolCallId: string;
2186
+ type: "tool-approval-request";
2187
+ }
2188
+ >;
2189
+ providerOptions?: Record<string, Record<string, any>>;
2190
+ role: "assistant";
2191
+ }
2192
+ | {
2193
+ content: Array<
2194
+ | {
2195
+ args?: any;
2196
+ experimental_content?: Array<
2197
+ | { text: string; type: "text" }
2198
+ | { data: string; mimeType?: string; type: "image" }
2199
+ >;
2200
+ isError?: boolean;
2201
+ output?:
2202
+ | {
2203
+ providerOptions?: Record<
2204
+ string,
2205
+ Record<string, any>
2206
+ >;
2207
+ type: "text";
2208
+ value: string;
2209
+ }
2210
+ | {
2211
+ providerOptions?: Record<
2212
+ string,
2213
+ Record<string, any>
2214
+ >;
2215
+ type: "json";
2216
+ value: any;
2217
+ }
2218
+ | {
2219
+ providerOptions?: Record<
2220
+ string,
2221
+ Record<string, any>
2222
+ >;
2223
+ type: "error-text";
2224
+ value: string;
2225
+ }
2226
+ | {
2227
+ providerOptions?: Record<
2228
+ string,
2229
+ Record<string, any>
2230
+ >;
2231
+ type: "error-json";
2232
+ value: any;
2233
+ }
2234
+ | {
2235
+ providerOptions?: Record<
2236
+ string,
2237
+ Record<string, any>
2238
+ >;
2239
+ reason?: string;
2240
+ type: "execution-denied";
2241
+ }
2242
+ | {
2243
+ type: "content";
2244
+ value: Array<
2245
+ | {
2246
+ providerOptions?: Record<
2247
+ string,
2248
+ Record<string, any>
2249
+ >;
2250
+ text: string;
2251
+ type: "text";
2252
+ }
2253
+ | {
2254
+ data: string;
2255
+ mediaType: string;
2256
+ type: "media";
2257
+ }
2258
+ | {
2259
+ data: string;
2260
+ filename?: string;
2261
+ mediaType: string;
2262
+ providerOptions?: Record<
2263
+ string,
2264
+ Record<string, any>
2265
+ >;
2266
+ type: "file-data";
2267
+ }
2268
+ | {
2269
+ providerOptions?: Record<
2270
+ string,
2271
+ Record<string, any>
2272
+ >;
2273
+ type: "file-url";
2274
+ url: string;
2275
+ }
2276
+ | {
2277
+ fileId: string | Record<string, string>;
2278
+ providerOptions?: Record<
2279
+ string,
2280
+ Record<string, any>
2281
+ >;
2282
+ type: "file-id";
2283
+ }
2284
+ | {
2285
+ data: string;
2286
+ mediaType: string;
2287
+ providerOptions?: Record<
2288
+ string,
2289
+ Record<string, any>
2290
+ >;
2291
+ type: "image-data";
2292
+ }
2293
+ | {
2294
+ providerOptions?: Record<
2295
+ string,
2296
+ Record<string, any>
2297
+ >;
2298
+ type: "image-url";
2299
+ url: string;
2300
+ }
2301
+ | {
2302
+ fileId: string | Record<string, string>;
2303
+ providerOptions?: Record<
2304
+ string,
2305
+ Record<string, any>
2306
+ >;
2307
+ type: "image-file-id";
2308
+ }
2309
+ | {
2310
+ providerOptions?: Record<
2311
+ string,
2312
+ Record<string, any>
2313
+ >;
2314
+ type: "custom";
2315
+ }
2316
+ >;
2317
+ };
2318
+ providerExecuted?: boolean;
2319
+ providerMetadata?: Record<string, Record<string, any>>;
2320
+ providerOptions?: Record<string, Record<string, any>>;
2321
+ result?: any;
2322
+ toolCallId: string;
2323
+ toolName: string;
2324
+ type: "tool-result";
2325
+ }
2326
+ | {
2327
+ approvalId: string;
2328
+ approved: boolean;
2329
+ providerExecuted?: boolean;
2330
+ providerMetadata?: Record<string, Record<string, any>>;
2331
+ providerOptions?: Record<string, Record<string, any>>;
2332
+ reason?: string;
2333
+ type: "tool-approval-response";
2334
+ }
2335
+ >;
2336
+ providerOptions?: Record<string, Record<string, any>>;
2337
+ role: "tool";
2338
+ }
2339
+ | {
2340
+ content: string;
2341
+ providerOptions?: Record<string, Record<string, any>>;
2342
+ role: "system";
2343
+ };
2344
+ model?: string;
2345
+ order: number;
2346
+ provider?: string;
2347
+ providerMetadata?: Record<string, Record<string, any>>;
2348
+ providerOptions?: Record<string, Record<string, any>>;
2349
+ reasoning?: string;
2350
+ reasoningDetails?: Array<
2351
+ | {
2352
+ providerMetadata?: Record<string, Record<string, any>>;
2353
+ providerOptions?: Record<string, Record<string, any>>;
2354
+ signature?: string;
2355
+ text: string;
2356
+ type: "reasoning";
2357
+ }
2358
+ | { signature?: string; text: string; type: "text" }
2359
+ | { data: string; type: "redacted" }
2360
+ >;
2361
+ sources?: Array<
2362
+ | {
2363
+ id: string;
2364
+ providerMetadata?: Record<string, Record<string, any>>;
2365
+ providerOptions?: Record<string, Record<string, any>>;
2366
+ sourceType: "url";
2367
+ title?: string;
2368
+ type?: "source";
2369
+ url: string;
2370
+ }
2371
+ | {
2372
+ filename?: string;
2373
+ id: string;
2374
+ mediaType: string;
2375
+ providerMetadata?: Record<string, Record<string, any>>;
2376
+ providerOptions?: Record<string, Record<string, any>>;
2377
+ sourceType: "document";
2378
+ title: string;
2379
+ type: "source";
2380
+ }
2381
+ >;
2382
+ status: "pending" | "success" | "failed";
2383
+ stepOrder: number;
2384
+ text?: string;
2385
+ threadId: string;
2386
+ tool: boolean;
2387
+ usage?: {
2388
+ cachedInputTokens?: number;
2389
+ completionTokens: number;
2390
+ promptTokens: number;
2391
+ reasoningTokens?: number;
2392
+ totalTokens: number;
2393
+ };
2394
+ userId?: string;
2395
+ warnings?: Array<
2396
+ | {
2397
+ details?: string;
2398
+ setting: string;
2399
+ type: "unsupported-setting";
2400
+ }
2401
+ | { details?: string; tool: any; type: "unsupported-tool" }
2402
+ | { message: string; type: "other" }
2403
+ >;
2404
+ }>;
2405
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
2406
+ splitCursor?: string | null;
2407
+ },
2408
+ Name
2409
+ >;
2410
+ searchMessages: FunctionReference<
2411
+ "action",
2412
+ "internal",
2413
+ {
2414
+ embedding?: Array<number>;
2415
+ embeddingModel?: string;
2416
+ limit: number;
2417
+ messageRange?: { after: number; before: number };
2418
+ searchAllMessagesForUserId?: string;
2419
+ targetMessageId?: string;
2420
+ text?: string;
2421
+ textSearch?: boolean;
2422
+ threadId?: string;
2423
+ vectorScoreThreshold?: number;
2424
+ vectorSearch?: boolean;
2425
+ },
2426
+ Array<{
2427
+ _creationTime: number;
2428
+ _id: string;
2429
+ agentName?: string;
2430
+ embeddingId?: string;
2431
+ error?: string;
2432
+ fileIds?: Array<string>;
2433
+ finishReason?:
2434
+ | "stop"
2435
+ | "length"
2436
+ | "content-filter"
2437
+ | "tool-calls"
2438
+ | "error"
2439
+ | "other"
2440
+ | "unknown";
2441
+ id?: string;
2442
+ message?:
2443
+ | {
2444
+ content:
2445
+ | string
2446
+ | Array<
2447
+ | {
2448
+ providerMetadata?: Record<
2449
+ string,
2450
+ Record<string, any>
2451
+ >;
2452
+ providerOptions?: Record<string, Record<string, any>>;
2453
+ text: string;
2454
+ type: "text";
2455
+ }
2456
+ | {
2457
+ image: string | ArrayBuffer;
2458
+ mediaType?: string;
2459
+ mimeType?: string;
2460
+ providerOptions?: Record<string, Record<string, any>>;
2461
+ type: "image";
2462
+ }
2463
+ | {
2464
+ data: string | ArrayBuffer;
2465
+ filename?: string;
2466
+ mediaType?: string;
2467
+ mimeType?: string;
2468
+ providerMetadata?: Record<
2469
+ string,
2470
+ Record<string, any>
2471
+ >;
2472
+ providerOptions?: Record<string, Record<string, any>>;
2473
+ type: "file";
2474
+ }
2475
+ >;
2476
+ providerOptions?: Record<string, Record<string, any>>;
2477
+ role: "user";
2478
+ }
2479
+ | {
2480
+ content:
2481
+ | string
2482
+ | Array<
2483
+ | {
2484
+ providerMetadata?: Record<
2485
+ string,
2486
+ Record<string, any>
2487
+ >;
2488
+ providerOptions?: Record<string, Record<string, any>>;
2489
+ text: string;
2490
+ type: "text";
2491
+ }
2492
+ | {
2493
+ data: string | ArrayBuffer;
2494
+ filename?: string;
2495
+ mediaType?: string;
2496
+ mimeType?: string;
2497
+ providerMetadata?: Record<
2498
+ string,
2499
+ Record<string, any>
2500
+ >;
2501
+ providerOptions?: Record<string, Record<string, any>>;
2502
+ type: "file";
2503
+ }
2504
+ | {
2505
+ providerMetadata?: Record<
2506
+ string,
2507
+ Record<string, any>
2508
+ >;
2509
+ providerOptions?: Record<string, Record<string, any>>;
2510
+ signature?: string;
2511
+ text: string;
2512
+ type: "reasoning";
2513
+ }
2514
+ | {
2515
+ data: string;
2516
+ providerMetadata?: Record<
2517
+ string,
2518
+ Record<string, any>
2519
+ >;
2520
+ providerOptions?: Record<string, Record<string, any>>;
2521
+ type: "redacted-reasoning";
2522
+ }
2523
+ | {
2524
+ args?: any;
2525
+ input: any;
2526
+ providerExecuted?: boolean;
2527
+ providerMetadata?: Record<
2528
+ string,
2529
+ Record<string, any>
2530
+ >;
2531
+ providerOptions?: Record<string, Record<string, any>>;
2532
+ toolCallId: string;
2533
+ toolName: string;
2534
+ type: "tool-call";
2535
+ }
2536
+ | {
2537
+ args: any;
2538
+ input?: any;
2539
+ providerExecuted?: boolean;
2540
+ providerMetadata?: Record<
2541
+ string,
2542
+ Record<string, any>
2543
+ >;
2544
+ providerOptions?: Record<
2545
+ string,
2546
+ Record<string, any>
2547
+ >;
2548
+ toolCallId: string;
2549
+ toolName: string;
2550
+ type: "tool-call";
2551
+ }
2552
+ | {
2553
+ args?: any;
2554
+ experimental_content?: Array<
2555
+ | { text: string; type: "text" }
2556
+ | { data: string; mimeType?: string; type: "image" }
2557
+ >;
2558
+ isError?: boolean;
2559
+ output?:
2560
+ | {
2561
+ providerOptions?: Record<
2562
+ string,
2563
+ Record<string, any>
2564
+ >;
2565
+ type: "text";
2566
+ value: string;
2567
+ }
2568
+ | {
2569
+ providerOptions?: Record<
2570
+ string,
2571
+ Record<string, any>
2572
+ >;
2573
+ type: "json";
2574
+ value: any;
2575
+ }
2576
+ | {
2577
+ providerOptions?: Record<
2578
+ string,
2579
+ Record<string, any>
2580
+ >;
2581
+ type: "error-text";
2582
+ value: string;
2583
+ }
2584
+ | {
2585
+ providerOptions?: Record<
2586
+ string,
2587
+ Record<string, any>
2588
+ >;
2589
+ type: "error-json";
2590
+ value: any;
2591
+ }
2592
+ | {
2593
+ providerOptions?: Record<
2594
+ string,
2595
+ Record<string, any>
2596
+ >;
2597
+ reason?: string;
2598
+ type: "execution-denied";
2599
+ }
2600
+ | {
2601
+ type: "content";
2602
+ value: Array<
2603
+ | {
2604
+ providerOptions?: Record<
2605
+ string,
2606
+ Record<string, any>
2607
+ >;
2608
+ text: string;
2609
+ type: "text";
2610
+ }
2611
+ | {
2612
+ data: string;
2613
+ mediaType: string;
2614
+ type: "media";
2615
+ }
2616
+ | {
2617
+ data: string;
2618
+ filename?: string;
2619
+ mediaType: string;
2620
+ providerOptions?: Record<
2621
+ string,
2622
+ Record<string, any>
2623
+ >;
2624
+ type: "file-data";
2625
+ }
2626
+ | {
2627
+ providerOptions?: Record<
2628
+ string,
2629
+ Record<string, any>
2630
+ >;
2631
+ type: "file-url";
2632
+ url: string;
2633
+ }
2634
+ | {
2635
+ fileId: string | Record<string, string>;
2636
+ providerOptions?: Record<
2637
+ string,
2638
+ Record<string, any>
2639
+ >;
2640
+ type: "file-id";
2641
+ }
2642
+ | {
2643
+ data: string;
2644
+ mediaType: string;
2645
+ providerOptions?: Record<
2646
+ string,
2647
+ Record<string, any>
2648
+ >;
2649
+ type: "image-data";
2650
+ }
2651
+ | {
2652
+ providerOptions?: Record<
2653
+ string,
2654
+ Record<string, any>
2655
+ >;
2656
+ type: "image-url";
2657
+ url: string;
2658
+ }
2659
+ | {
2660
+ fileId: string | Record<string, string>;
2661
+ providerOptions?: Record<
2662
+ string,
2663
+ Record<string, any>
2664
+ >;
2665
+ type: "image-file-id";
2666
+ }
2667
+ | {
2668
+ providerOptions?: Record<
2669
+ string,
2670
+ Record<string, any>
2671
+ >;
2672
+ type: "custom";
2673
+ }
2674
+ >;
2675
+ };
2676
+ providerExecuted?: boolean;
2677
+ providerMetadata?: Record<
2678
+ string,
2679
+ Record<string, any>
2680
+ >;
2681
+ providerOptions?: Record<string, Record<string, any>>;
2682
+ result?: any;
2683
+ toolCallId: string;
2684
+ toolName: string;
2685
+ type: "tool-result";
2686
+ }
2687
+ | {
2688
+ id: string;
2689
+ providerMetadata?: Record<
2690
+ string,
2691
+ Record<string, any>
2692
+ >;
2693
+ providerOptions?: Record<string, Record<string, any>>;
2694
+ sourceType: "url";
2695
+ title?: string;
2696
+ type: "source";
2697
+ url: string;
2698
+ }
2699
+ | {
2700
+ filename?: string;
2701
+ id: string;
2702
+ mediaType: string;
2703
+ providerMetadata?: Record<
2704
+ string,
2705
+ Record<string, any>
2706
+ >;
2707
+ providerOptions?: Record<string, Record<string, any>>;
2708
+ sourceType: "document";
2709
+ title: string;
2710
+ type: "source";
2711
+ }
2712
+ | {
2713
+ approvalId: string;
2714
+ providerMetadata?: Record<
2715
+ string,
2716
+ Record<string, any>
2717
+ >;
2718
+ providerOptions?: Record<string, Record<string, any>>;
2719
+ toolCallId: string;
2720
+ type: "tool-approval-request";
2721
+ }
2722
+ >;
2723
+ providerOptions?: Record<string, Record<string, any>>;
2724
+ role: "assistant";
2725
+ }
2726
+ | {
2727
+ content: Array<
2728
+ | {
2729
+ args?: any;
2730
+ experimental_content?: Array<
2731
+ | { text: string; type: "text" }
2732
+ | { data: string; mimeType?: string; type: "image" }
2733
+ >;
2734
+ isError?: boolean;
2735
+ output?:
2736
+ | {
2737
+ providerOptions?: Record<
2738
+ string,
2739
+ Record<string, any>
2740
+ >;
2741
+ type: "text";
2742
+ value: string;
2743
+ }
2744
+ | {
2745
+ providerOptions?: Record<
2746
+ string,
2747
+ Record<string, any>
2748
+ >;
2749
+ type: "json";
2750
+ value: any;
2751
+ }
2752
+ | {
2753
+ providerOptions?: Record<
2754
+ string,
2755
+ Record<string, any>
2756
+ >;
2757
+ type: "error-text";
2758
+ value: string;
2759
+ }
2760
+ | {
2761
+ providerOptions?: Record<
2762
+ string,
2763
+ Record<string, any>
2764
+ >;
2765
+ type: "error-json";
2766
+ value: any;
2767
+ }
2768
+ | {
2769
+ providerOptions?: Record<
2770
+ string,
2771
+ Record<string, any>
2772
+ >;
2773
+ reason?: string;
2774
+ type: "execution-denied";
2775
+ }
2776
+ | {
2777
+ type: "content";
2778
+ value: Array<
2779
+ | {
2780
+ providerOptions?: Record<
2781
+ string,
2782
+ Record<string, any>
2783
+ >;
2784
+ text: string;
2785
+ type: "text";
2786
+ }
2787
+ | {
2788
+ data: string;
2789
+ mediaType: string;
2790
+ type: "media";
2791
+ }
2792
+ | {
2793
+ data: string;
2794
+ filename?: string;
2795
+ mediaType: string;
2796
+ providerOptions?: Record<
2797
+ string,
2798
+ Record<string, any>
2799
+ >;
2800
+ type: "file-data";
2801
+ }
2802
+ | {
2803
+ providerOptions?: Record<
2804
+ string,
2805
+ Record<string, any>
2806
+ >;
2807
+ type: "file-url";
2808
+ url: string;
2809
+ }
2810
+ | {
2811
+ fileId: string | Record<string, string>;
2812
+ providerOptions?: Record<
2813
+ string,
2814
+ Record<string, any>
2815
+ >;
2816
+ type: "file-id";
2817
+ }
2818
+ | {
2819
+ data: string;
2820
+ mediaType: string;
2821
+ providerOptions?: Record<
2822
+ string,
2823
+ Record<string, any>
2824
+ >;
2825
+ type: "image-data";
2826
+ }
2827
+ | {
2828
+ providerOptions?: Record<
2829
+ string,
2830
+ Record<string, any>
2831
+ >;
2832
+ type: "image-url";
2833
+ url: string;
2834
+ }
2835
+ | {
2836
+ fileId: string | Record<string, string>;
2837
+ providerOptions?: Record<
2838
+ string,
2839
+ Record<string, any>
2840
+ >;
2841
+ type: "image-file-id";
2842
+ }
2843
+ | {
2844
+ providerOptions?: Record<
2845
+ string,
2846
+ Record<string, any>
2847
+ >;
2848
+ type: "custom";
2849
+ }
2850
+ >;
2851
+ };
2852
+ providerExecuted?: boolean;
2853
+ providerMetadata?: Record<string, Record<string, any>>;
2854
+ providerOptions?: Record<string, Record<string, any>>;
2855
+ result?: any;
2856
+ toolCallId: string;
2857
+ toolName: string;
2858
+ type: "tool-result";
2859
+ }
2860
+ | {
2861
+ approvalId: string;
2862
+ approved: boolean;
2863
+ providerExecuted?: boolean;
2864
+ providerMetadata?: Record<string, Record<string, any>>;
2865
+ providerOptions?: Record<string, Record<string, any>>;
2866
+ reason?: string;
2867
+ type: "tool-approval-response";
2868
+ }
2869
+ >;
2870
+ providerOptions?: Record<string, Record<string, any>>;
2871
+ role: "tool";
2872
+ }
2873
+ | {
2874
+ content: string;
2875
+ providerOptions?: Record<string, Record<string, any>>;
2876
+ role: "system";
2877
+ };
2878
+ model?: string;
2879
+ order: number;
2880
+ provider?: string;
2881
+ providerMetadata?: Record<string, Record<string, any>>;
2882
+ providerOptions?: Record<string, Record<string, any>>;
2883
+ reasoning?: string;
2884
+ reasoningDetails?: Array<
2885
+ | {
2886
+ providerMetadata?: Record<string, Record<string, any>>;
2887
+ providerOptions?: Record<string, Record<string, any>>;
2888
+ signature?: string;
2889
+ text: string;
2890
+ type: "reasoning";
2891
+ }
2892
+ | { signature?: string; text: string; type: "text" }
2893
+ | { data: string; type: "redacted" }
2894
+ >;
2895
+ sources?: Array<
2896
+ | {
2897
+ id: string;
2898
+ providerMetadata?: Record<string, Record<string, any>>;
2899
+ providerOptions?: Record<string, Record<string, any>>;
2900
+ sourceType: "url";
2901
+ title?: string;
2902
+ type?: "source";
2903
+ url: string;
2904
+ }
2905
+ | {
2906
+ filename?: string;
2907
+ id: string;
2908
+ mediaType: string;
2909
+ providerMetadata?: Record<string, Record<string, any>>;
2910
+ providerOptions?: Record<string, Record<string, any>>;
2911
+ sourceType: "document";
2912
+ title: string;
2913
+ type: "source";
2914
+ }
2915
+ >;
2916
+ status: "pending" | "success" | "failed";
2917
+ stepOrder: number;
2918
+ text?: string;
2919
+ threadId: string;
2920
+ tool: boolean;
2921
+ usage?: {
2922
+ cachedInputTokens?: number;
2923
+ completionTokens: number;
2924
+ promptTokens: number;
2925
+ reasoningTokens?: number;
2926
+ totalTokens: number;
2927
+ };
2928
+ userId?: string;
2929
+ warnings?: Array<
2930
+ | { details?: string; setting: string; type: "unsupported-setting" }
2931
+ | { details?: string; tool: any; type: "unsupported-tool" }
2932
+ | { message: string; type: "other" }
2933
+ >;
2934
+ }>,
2935
+ Name
2936
+ >;
2937
+ textSearch: FunctionReference<
2938
+ "query",
2939
+ "internal",
2940
+ {
2941
+ limit: number;
2942
+ searchAllMessagesForUserId?: string;
2943
+ targetMessageId?: string;
2944
+ text?: string;
2945
+ threadId?: string;
2946
+ },
2947
+ Array<{
2948
+ _creationTime: number;
2949
+ _id: string;
2950
+ agentName?: string;
2951
+ embeddingId?: string;
2952
+ error?: string;
2953
+ fileIds?: Array<string>;
2954
+ finishReason?:
2955
+ | "stop"
2956
+ | "length"
2957
+ | "content-filter"
2958
+ | "tool-calls"
2959
+ | "error"
2960
+ | "other"
2961
+ | "unknown";
2962
+ id?: string;
2963
+ message?:
2964
+ | {
2965
+ content:
2966
+ | string
2967
+ | Array<
2968
+ | {
2969
+ providerMetadata?: Record<
2970
+ string,
2971
+ Record<string, any>
2972
+ >;
2973
+ providerOptions?: Record<string, Record<string, any>>;
2974
+ text: string;
2975
+ type: "text";
2976
+ }
2977
+ | {
2978
+ image: string | ArrayBuffer;
2979
+ mediaType?: string;
2980
+ mimeType?: string;
2981
+ providerOptions?: Record<string, Record<string, any>>;
2982
+ type: "image";
2983
+ }
2984
+ | {
2985
+ data: string | ArrayBuffer;
2986
+ filename?: string;
2987
+ mediaType?: string;
2988
+ mimeType?: string;
2989
+ providerMetadata?: Record<
2990
+ string,
2991
+ Record<string, any>
2992
+ >;
2993
+ providerOptions?: Record<string, Record<string, any>>;
2994
+ type: "file";
2995
+ }
2996
+ >;
2997
+ providerOptions?: Record<string, Record<string, any>>;
2998
+ role: "user";
2999
+ }
3000
+ | {
3001
+ content:
3002
+ | string
3003
+ | Array<
3004
+ | {
3005
+ providerMetadata?: Record<
3006
+ string,
3007
+ Record<string, any>
3008
+ >;
3009
+ providerOptions?: Record<string, Record<string, any>>;
3010
+ text: string;
3011
+ type: "text";
3012
+ }
3013
+ | {
3014
+ data: string | ArrayBuffer;
3015
+ filename?: string;
3016
+ mediaType?: string;
3017
+ mimeType?: string;
3018
+ providerMetadata?: Record<
3019
+ string,
3020
+ Record<string, any>
3021
+ >;
3022
+ providerOptions?: Record<string, Record<string, any>>;
3023
+ type: "file";
3024
+ }
3025
+ | {
3026
+ providerMetadata?: Record<
3027
+ string,
3028
+ Record<string, any>
3029
+ >;
3030
+ providerOptions?: Record<string, Record<string, any>>;
3031
+ signature?: string;
3032
+ text: string;
3033
+ type: "reasoning";
3034
+ }
3035
+ | {
3036
+ data: string;
3037
+ providerMetadata?: Record<
3038
+ string,
3039
+ Record<string, any>
3040
+ >;
3041
+ providerOptions?: Record<string, Record<string, any>>;
3042
+ type: "redacted-reasoning";
3043
+ }
3044
+ | {
3045
+ args?: any;
3046
+ input: any;
3047
+ providerExecuted?: boolean;
3048
+ providerMetadata?: Record<
3049
+ string,
3050
+ Record<string, any>
3051
+ >;
3052
+ providerOptions?: Record<string, Record<string, any>>;
3053
+ toolCallId: string;
3054
+ toolName: string;
3055
+ type: "tool-call";
3056
+ }
3057
+ | {
3058
+ args: any;
3059
+ input?: any;
3060
+ providerExecuted?: boolean;
3061
+ providerMetadata?: Record<
3062
+ string,
3063
+ Record<string, any>
3064
+ >;
3065
+ providerOptions?: Record<
3066
+ string,
3067
+ Record<string, any>
3068
+ >;
3069
+ toolCallId: string;
3070
+ toolName: string;
3071
+ type: "tool-call";
3072
+ }
3073
+ | {
3074
+ args?: any;
3075
+ experimental_content?: Array<
3076
+ | { text: string; type: "text" }
3077
+ | { data: string; mimeType?: string; type: "image" }
3078
+ >;
3079
+ isError?: boolean;
3080
+ output?:
3081
+ | {
3082
+ providerOptions?: Record<
3083
+ string,
3084
+ Record<string, any>
3085
+ >;
3086
+ type: "text";
3087
+ value: string;
3088
+ }
3089
+ | {
3090
+ providerOptions?: Record<
3091
+ string,
3092
+ Record<string, any>
3093
+ >;
3094
+ type: "json";
3095
+ value: any;
3096
+ }
3097
+ | {
3098
+ providerOptions?: Record<
3099
+ string,
3100
+ Record<string, any>
3101
+ >;
3102
+ type: "error-text";
3103
+ value: string;
3104
+ }
3105
+ | {
3106
+ providerOptions?: Record<
3107
+ string,
3108
+ Record<string, any>
3109
+ >;
3110
+ type: "error-json";
3111
+ value: any;
3112
+ }
3113
+ | {
3114
+ providerOptions?: Record<
3115
+ string,
3116
+ Record<string, any>
3117
+ >;
3118
+ reason?: string;
3119
+ type: "execution-denied";
3120
+ }
3121
+ | {
3122
+ type: "content";
3123
+ value: Array<
3124
+ | {
3125
+ providerOptions?: Record<
3126
+ string,
3127
+ Record<string, any>
3128
+ >;
3129
+ text: string;
3130
+ type: "text";
3131
+ }
3132
+ | {
3133
+ data: string;
3134
+ mediaType: string;
3135
+ type: "media";
3136
+ }
3137
+ | {
3138
+ data: string;
3139
+ filename?: string;
3140
+ mediaType: string;
3141
+ providerOptions?: Record<
3142
+ string,
3143
+ Record<string, any>
3144
+ >;
3145
+ type: "file-data";
3146
+ }
3147
+ | {
3148
+ providerOptions?: Record<
3149
+ string,
3150
+ Record<string, any>
3151
+ >;
3152
+ type: "file-url";
3153
+ url: string;
3154
+ }
3155
+ | {
3156
+ fileId: string | Record<string, string>;
3157
+ providerOptions?: Record<
3158
+ string,
3159
+ Record<string, any>
3160
+ >;
3161
+ type: "file-id";
3162
+ }
3163
+ | {
3164
+ data: string;
3165
+ mediaType: string;
3166
+ providerOptions?: Record<
3167
+ string,
3168
+ Record<string, any>
3169
+ >;
3170
+ type: "image-data";
3171
+ }
3172
+ | {
3173
+ providerOptions?: Record<
3174
+ string,
3175
+ Record<string, any>
3176
+ >;
3177
+ type: "image-url";
3178
+ url: string;
3179
+ }
3180
+ | {
3181
+ fileId: string | Record<string, string>;
3182
+ providerOptions?: Record<
3183
+ string,
3184
+ Record<string, any>
3185
+ >;
3186
+ type: "image-file-id";
3187
+ }
3188
+ | {
3189
+ providerOptions?: Record<
3190
+ string,
3191
+ Record<string, any>
3192
+ >;
3193
+ type: "custom";
3194
+ }
3195
+ >;
3196
+ };
3197
+ providerExecuted?: boolean;
3198
+ providerMetadata?: Record<
3199
+ string,
3200
+ Record<string, any>
3201
+ >;
3202
+ providerOptions?: Record<string, Record<string, any>>;
3203
+ result?: any;
3204
+ toolCallId: string;
3205
+ toolName: string;
3206
+ type: "tool-result";
3207
+ }
3208
+ | {
3209
+ id: string;
3210
+ providerMetadata?: Record<
3211
+ string,
3212
+ Record<string, any>
3213
+ >;
3214
+ providerOptions?: Record<string, Record<string, any>>;
3215
+ sourceType: "url";
3216
+ title?: string;
3217
+ type: "source";
3218
+ url: string;
3219
+ }
3220
+ | {
3221
+ filename?: string;
3222
+ id: string;
3223
+ mediaType: string;
3224
+ providerMetadata?: Record<
3225
+ string,
3226
+ Record<string, any>
3227
+ >;
3228
+ providerOptions?: Record<string, Record<string, any>>;
3229
+ sourceType: "document";
3230
+ title: string;
3231
+ type: "source";
3232
+ }
3233
+ | {
3234
+ approvalId: string;
3235
+ providerMetadata?: Record<
3236
+ string,
3237
+ Record<string, any>
3238
+ >;
3239
+ providerOptions?: Record<string, Record<string, any>>;
3240
+ toolCallId: string;
3241
+ type: "tool-approval-request";
3242
+ }
3243
+ >;
3244
+ providerOptions?: Record<string, Record<string, any>>;
3245
+ role: "assistant";
3246
+ }
3247
+ | {
3248
+ content: Array<
3249
+ | {
3250
+ args?: any;
3251
+ experimental_content?: Array<
3252
+ | { text: string; type: "text" }
3253
+ | { data: string; mimeType?: string; type: "image" }
3254
+ >;
3255
+ isError?: boolean;
3256
+ output?:
3257
+ | {
3258
+ providerOptions?: Record<
3259
+ string,
3260
+ Record<string, any>
3261
+ >;
3262
+ type: "text";
3263
+ value: string;
3264
+ }
3265
+ | {
3266
+ providerOptions?: Record<
3267
+ string,
3268
+ Record<string, any>
3269
+ >;
3270
+ type: "json";
3271
+ value: any;
3272
+ }
3273
+ | {
3274
+ providerOptions?: Record<
3275
+ string,
3276
+ Record<string, any>
3277
+ >;
3278
+ type: "error-text";
3279
+ value: string;
3280
+ }
3281
+ | {
3282
+ providerOptions?: Record<
3283
+ string,
3284
+ Record<string, any>
3285
+ >;
3286
+ type: "error-json";
3287
+ value: any;
3288
+ }
3289
+ | {
3290
+ providerOptions?: Record<
3291
+ string,
3292
+ Record<string, any>
3293
+ >;
3294
+ reason?: string;
3295
+ type: "execution-denied";
3296
+ }
3297
+ | {
3298
+ type: "content";
3299
+ value: Array<
3300
+ | {
3301
+ providerOptions?: Record<
3302
+ string,
3303
+ Record<string, any>
3304
+ >;
3305
+ text: string;
3306
+ type: "text";
3307
+ }
3308
+ | {
3309
+ data: string;
3310
+ mediaType: string;
3311
+ type: "media";
3312
+ }
3313
+ | {
3314
+ data: string;
3315
+ filename?: string;
3316
+ mediaType: string;
3317
+ providerOptions?: Record<
3318
+ string,
3319
+ Record<string, any>
3320
+ >;
3321
+ type: "file-data";
3322
+ }
3323
+ | {
3324
+ providerOptions?: Record<
3325
+ string,
3326
+ Record<string, any>
3327
+ >;
3328
+ type: "file-url";
3329
+ url: string;
3330
+ }
3331
+ | {
3332
+ fileId: string | Record<string, string>;
3333
+ providerOptions?: Record<
3334
+ string,
3335
+ Record<string, any>
3336
+ >;
3337
+ type: "file-id";
3338
+ }
3339
+ | {
3340
+ data: string;
3341
+ mediaType: string;
3342
+ providerOptions?: Record<
3343
+ string,
3344
+ Record<string, any>
3345
+ >;
3346
+ type: "image-data";
3347
+ }
3348
+ | {
3349
+ providerOptions?: Record<
3350
+ string,
3351
+ Record<string, any>
3352
+ >;
3353
+ type: "image-url";
3354
+ url: string;
3355
+ }
3356
+ | {
3357
+ fileId: string | Record<string, string>;
3358
+ providerOptions?: Record<
3359
+ string,
3360
+ Record<string, any>
3361
+ >;
3362
+ type: "image-file-id";
3363
+ }
3364
+ | {
3365
+ providerOptions?: Record<
3366
+ string,
3367
+ Record<string, any>
3368
+ >;
3369
+ type: "custom";
3370
+ }
3371
+ >;
3372
+ };
3373
+ providerExecuted?: boolean;
3374
+ providerMetadata?: Record<string, Record<string, any>>;
3375
+ providerOptions?: Record<string, Record<string, any>>;
3376
+ result?: any;
3377
+ toolCallId: string;
3378
+ toolName: string;
3379
+ type: "tool-result";
3380
+ }
3381
+ | {
3382
+ approvalId: string;
3383
+ approved: boolean;
3384
+ providerExecuted?: boolean;
3385
+ providerMetadata?: Record<string, Record<string, any>>;
3386
+ providerOptions?: Record<string, Record<string, any>>;
3387
+ reason?: string;
3388
+ type: "tool-approval-response";
3389
+ }
3390
+ >;
3391
+ providerOptions?: Record<string, Record<string, any>>;
3392
+ role: "tool";
3393
+ }
3394
+ | {
3395
+ content: string;
3396
+ providerOptions?: Record<string, Record<string, any>>;
3397
+ role: "system";
3398
+ };
3399
+ model?: string;
3400
+ order: number;
3401
+ provider?: string;
3402
+ providerMetadata?: Record<string, Record<string, any>>;
3403
+ providerOptions?: Record<string, Record<string, any>>;
3404
+ reasoning?: string;
3405
+ reasoningDetails?: Array<
3406
+ | {
3407
+ providerMetadata?: Record<string, Record<string, any>>;
3408
+ providerOptions?: Record<string, Record<string, any>>;
3409
+ signature?: string;
3410
+ text: string;
3411
+ type: "reasoning";
3412
+ }
3413
+ | { signature?: string; text: string; type: "text" }
3414
+ | { data: string; type: "redacted" }
3415
+ >;
3416
+ sources?: Array<
3417
+ | {
3418
+ id: string;
3419
+ providerMetadata?: Record<string, Record<string, any>>;
3420
+ providerOptions?: Record<string, Record<string, any>>;
3421
+ sourceType: "url";
3422
+ title?: string;
3423
+ type?: "source";
3424
+ url: string;
3425
+ }
3426
+ | {
3427
+ filename?: string;
3428
+ id: string;
3429
+ mediaType: string;
3430
+ providerMetadata?: Record<string, Record<string, any>>;
3431
+ providerOptions?: Record<string, Record<string, any>>;
3432
+ sourceType: "document";
3433
+ title: string;
3434
+ type: "source";
3435
+ }
3436
+ >;
3437
+ status: "pending" | "success" | "failed";
3438
+ stepOrder: number;
3439
+ text?: string;
3440
+ threadId: string;
3441
+ tool: boolean;
3442
+ usage?: {
3443
+ cachedInputTokens?: number;
3444
+ completionTokens: number;
3445
+ promptTokens: number;
3446
+ reasoningTokens?: number;
3447
+ totalTokens: number;
3448
+ };
3449
+ userId?: string;
3450
+ warnings?: Array<
3451
+ | { details?: string; setting: string; type: "unsupported-setting" }
3452
+ | { details?: string; tool: any; type: "unsupported-tool" }
3453
+ | { message: string; type: "other" }
3454
+ >;
3455
+ }>,
3456
+ Name
3457
+ >;
3458
+ updateMessage: FunctionReference<
3459
+ "mutation",
3460
+ "internal",
3461
+ {
3462
+ messageId: string;
3463
+ patch: {
3464
+ error?: string;
3465
+ fileIds?: Array<string>;
3466
+ finishReason?:
3467
+ | "stop"
3468
+ | "length"
3469
+ | "content-filter"
3470
+ | "tool-calls"
3471
+ | "error"
3472
+ | "other"
3473
+ | "unknown";
3474
+ message?:
3475
+ | {
3476
+ content:
3477
+ | string
3478
+ | Array<
3479
+ | {
3480
+ providerMetadata?: Record<
3481
+ string,
3482
+ Record<string, any>
3483
+ >;
3484
+ providerOptions?: Record<
3485
+ string,
3486
+ Record<string, any>
3487
+ >;
3488
+ text: string;
3489
+ type: "text";
3490
+ }
3491
+ | {
3492
+ image: string | ArrayBuffer;
3493
+ mediaType?: string;
3494
+ mimeType?: string;
3495
+ providerOptions?: Record<
3496
+ string,
3497
+ Record<string, any>
3498
+ >;
3499
+ type: "image";
3500
+ }
3501
+ | {
3502
+ data: string | ArrayBuffer;
3503
+ filename?: string;
3504
+ mediaType?: string;
3505
+ mimeType?: string;
3506
+ providerMetadata?: Record<
3507
+ string,
3508
+ Record<string, any>
3509
+ >;
3510
+ providerOptions?: Record<
3511
+ string,
3512
+ Record<string, any>
3513
+ >;
3514
+ type: "file";
3515
+ }
3516
+ >;
3517
+ providerOptions?: Record<string, Record<string, any>>;
3518
+ role: "user";
3519
+ }
3520
+ | {
3521
+ content:
3522
+ | string
3523
+ | Array<
3524
+ | {
3525
+ providerMetadata?: Record<
3526
+ string,
3527
+ Record<string, any>
3528
+ >;
3529
+ providerOptions?: Record<
3530
+ string,
3531
+ Record<string, any>
3532
+ >;
3533
+ text: string;
3534
+ type: "text";
3535
+ }
3536
+ | {
3537
+ data: string | ArrayBuffer;
3538
+ filename?: string;
3539
+ mediaType?: string;
3540
+ mimeType?: string;
3541
+ providerMetadata?: Record<
3542
+ string,
3543
+ Record<string, any>
3544
+ >;
3545
+ providerOptions?: Record<
3546
+ string,
3547
+ Record<string, any>
3548
+ >;
3549
+ type: "file";
3550
+ }
3551
+ | {
3552
+ providerMetadata?: Record<
3553
+ string,
3554
+ Record<string, any>
3555
+ >;
3556
+ providerOptions?: Record<
3557
+ string,
3558
+ Record<string, any>
3559
+ >;
3560
+ signature?: string;
3561
+ text: string;
3562
+ type: "reasoning";
3563
+ }
3564
+ | {
3565
+ data: string;
3566
+ providerMetadata?: Record<
3567
+ string,
3568
+ Record<string, any>
3569
+ >;
3570
+ providerOptions?: Record<
3571
+ string,
3572
+ Record<string, any>
3573
+ >;
3574
+ type: "redacted-reasoning";
3575
+ }
3576
+ | {
3577
+ args?: any;
3578
+ input: any;
3579
+ providerExecuted?: boolean;
3580
+ providerMetadata?: Record<
3581
+ string,
3582
+ Record<string, any>
3583
+ >;
3584
+ providerOptions?: Record<
3585
+ string,
3586
+ Record<string, any>
3587
+ >;
3588
+ toolCallId: string;
3589
+ toolName: string;
3590
+ type: "tool-call";
3591
+ }
3592
+ | {
3593
+ args: any;
3594
+ input?: any;
3595
+ providerExecuted?: boolean;
3596
+ providerMetadata?: Record<
3597
+ string,
3598
+ Record<string, any>
3599
+ >;
3600
+ providerOptions?: Record<
3601
+ string,
3602
+ Record<string, any>
3603
+ >;
3604
+ toolCallId: string;
3605
+ toolName: string;
3606
+ type: "tool-call";
3607
+ }
3608
+ | {
3609
+ args?: any;
3610
+ experimental_content?: Array<
3611
+ | { text: string; type: "text" }
3612
+ | {
3613
+ data: string;
3614
+ mimeType?: string;
3615
+ type: "image";
3616
+ }
3617
+ >;
3618
+ isError?: boolean;
3619
+ output?:
3620
+ | {
3621
+ providerOptions?: Record<
3622
+ string,
3623
+ Record<string, any>
3624
+ >;
3625
+ type: "text";
3626
+ value: string;
3627
+ }
3628
+ | {
3629
+ providerOptions?: Record<
3630
+ string,
3631
+ Record<string, any>
3632
+ >;
3633
+ type: "json";
3634
+ value: any;
3635
+ }
3636
+ | {
3637
+ providerOptions?: Record<
3638
+ string,
3639
+ Record<string, any>
3640
+ >;
3641
+ type: "error-text";
3642
+ value: string;
3643
+ }
3644
+ | {
3645
+ providerOptions?: Record<
3646
+ string,
3647
+ Record<string, any>
3648
+ >;
3649
+ type: "error-json";
3650
+ value: any;
3651
+ }
3652
+ | {
3653
+ providerOptions?: Record<
3654
+ string,
3655
+ Record<string, any>
3656
+ >;
3657
+ reason?: string;
3658
+ type: "execution-denied";
3659
+ }
3660
+ | {
3661
+ type: "content";
3662
+ value: Array<
3663
+ | {
3664
+ providerOptions?: Record<
3665
+ string,
3666
+ Record<string, any>
3667
+ >;
3668
+ text: string;
3669
+ type: "text";
3670
+ }
3671
+ | {
3672
+ data: string;
3673
+ mediaType: string;
3674
+ type: "media";
3675
+ }
3676
+ | {
3677
+ data: string;
3678
+ filename?: string;
3679
+ mediaType: string;
3680
+ providerOptions?: Record<
3681
+ string,
3682
+ Record<string, any>
3683
+ >;
3684
+ type: "file-data";
3685
+ }
3686
+ | {
3687
+ providerOptions?: Record<
3688
+ string,
3689
+ Record<string, any>
3690
+ >;
3691
+ type: "file-url";
3692
+ url: string;
3693
+ }
3694
+ | {
3695
+ fileId: string | Record<string, string>;
3696
+ providerOptions?: Record<
3697
+ string,
3698
+ Record<string, any>
3699
+ >;
3700
+ type: "file-id";
3701
+ }
3702
+ | {
3703
+ data: string;
3704
+ mediaType: string;
3705
+ providerOptions?: Record<
3706
+ string,
3707
+ Record<string, any>
3708
+ >;
3709
+ type: "image-data";
3710
+ }
3711
+ | {
3712
+ providerOptions?: Record<
3713
+ string,
3714
+ Record<string, any>
3715
+ >;
3716
+ type: "image-url";
3717
+ url: string;
3718
+ }
3719
+ | {
3720
+ fileId: string | Record<string, string>;
3721
+ providerOptions?: Record<
3722
+ string,
3723
+ Record<string, any>
3724
+ >;
3725
+ type: "image-file-id";
3726
+ }
3727
+ | {
3728
+ providerOptions?: Record<
3729
+ string,
3730
+ Record<string, any>
3731
+ >;
3732
+ type: "custom";
3733
+ }
3734
+ >;
3735
+ };
3736
+ providerExecuted?: boolean;
3737
+ providerMetadata?: Record<
3738
+ string,
3739
+ Record<string, any>
3740
+ >;
3741
+ providerOptions?: Record<
3742
+ string,
3743
+ Record<string, any>
3744
+ >;
3745
+ result?: any;
3746
+ toolCallId: string;
3747
+ toolName: string;
3748
+ type: "tool-result";
3749
+ }
3750
+ | {
3751
+ id: string;
3752
+ providerMetadata?: Record<
3753
+ string,
3754
+ Record<string, any>
3755
+ >;
3756
+ providerOptions?: Record<
3757
+ string,
3758
+ Record<string, any>
3759
+ >;
3760
+ sourceType: "url";
3761
+ title?: string;
3762
+ type: "source";
3763
+ url: string;
3764
+ }
3765
+ | {
3766
+ filename?: string;
3767
+ id: string;
3768
+ mediaType: string;
3769
+ providerMetadata?: Record<
3770
+ string,
3771
+ Record<string, any>
3772
+ >;
3773
+ providerOptions?: Record<
3774
+ string,
3775
+ Record<string, any>
3776
+ >;
3777
+ sourceType: "document";
3778
+ title: string;
3779
+ type: "source";
3780
+ }
3781
+ | {
3782
+ approvalId: string;
3783
+ providerMetadata?: Record<
3784
+ string,
3785
+ Record<string, any>
3786
+ >;
3787
+ providerOptions?: Record<
3788
+ string,
3789
+ Record<string, any>
3790
+ >;
3791
+ toolCallId: string;
3792
+ type: "tool-approval-request";
3793
+ }
3794
+ >;
3795
+ providerOptions?: Record<string, Record<string, any>>;
3796
+ role: "assistant";
3797
+ }
3798
+ | {
3799
+ content: Array<
3800
+ | {
3801
+ args?: any;
3802
+ experimental_content?: Array<
3803
+ | { text: string; type: "text" }
3804
+ | { data: string; mimeType?: string; type: "image" }
3805
+ >;
3806
+ isError?: boolean;
3807
+ output?:
3808
+ | {
3809
+ providerOptions?: Record<
3810
+ string,
3811
+ Record<string, any>
3812
+ >;
3813
+ type: "text";
3814
+ value: string;
3815
+ }
3816
+ | {
3817
+ providerOptions?: Record<
3818
+ string,
3819
+ Record<string, any>
3820
+ >;
3821
+ type: "json";
3822
+ value: any;
3823
+ }
3824
+ | {
3825
+ providerOptions?: Record<
3826
+ string,
3827
+ Record<string, any>
3828
+ >;
3829
+ type: "error-text";
3830
+ value: string;
3831
+ }
3832
+ | {
3833
+ providerOptions?: Record<
3834
+ string,
3835
+ Record<string, any>
3836
+ >;
3837
+ type: "error-json";
3838
+ value: any;
3839
+ }
3840
+ | {
3841
+ providerOptions?: Record<
3842
+ string,
3843
+ Record<string, any>
3844
+ >;
3845
+ reason?: string;
3846
+ type: "execution-denied";
3847
+ }
3848
+ | {
3849
+ type: "content";
3850
+ value: Array<
3851
+ | {
3852
+ providerOptions?: Record<
3853
+ string,
3854
+ Record<string, any>
3855
+ >;
3856
+ text: string;
3857
+ type: "text";
3858
+ }
3859
+ | {
3860
+ data: string;
3861
+ mediaType: string;
3862
+ type: "media";
3863
+ }
3864
+ | {
3865
+ data: string;
3866
+ filename?: string;
3867
+ mediaType: string;
3868
+ providerOptions?: Record<
3869
+ string,
3870
+ Record<string, any>
3871
+ >;
3872
+ type: "file-data";
3873
+ }
3874
+ | {
3875
+ providerOptions?: Record<
3876
+ string,
3877
+ Record<string, any>
3878
+ >;
3879
+ type: "file-url";
3880
+ url: string;
3881
+ }
3882
+ | {
3883
+ fileId: string | Record<string, string>;
3884
+ providerOptions?: Record<
3885
+ string,
3886
+ Record<string, any>
3887
+ >;
3888
+ type: "file-id";
3889
+ }
3890
+ | {
3891
+ data: string;
3892
+ mediaType: string;
3893
+ providerOptions?: Record<
3894
+ string,
3895
+ Record<string, any>
3896
+ >;
3897
+ type: "image-data";
3898
+ }
3899
+ | {
3900
+ providerOptions?: Record<
3901
+ string,
3902
+ Record<string, any>
3903
+ >;
3904
+ type: "image-url";
3905
+ url: string;
3906
+ }
3907
+ | {
3908
+ fileId: string | Record<string, string>;
3909
+ providerOptions?: Record<
3910
+ string,
3911
+ Record<string, any>
3912
+ >;
3913
+ type: "image-file-id";
3914
+ }
3915
+ | {
3916
+ providerOptions?: Record<
3917
+ string,
3918
+ Record<string, any>
3919
+ >;
3920
+ type: "custom";
3921
+ }
3922
+ >;
3923
+ };
3924
+ providerExecuted?: boolean;
3925
+ providerMetadata?: Record<string, Record<string, any>>;
3926
+ providerOptions?: Record<string, Record<string, any>>;
3927
+ result?: any;
3928
+ toolCallId: string;
3929
+ toolName: string;
3930
+ type: "tool-result";
3931
+ }
3932
+ | {
3933
+ approvalId: string;
3934
+ approved: boolean;
3935
+ providerExecuted?: boolean;
3936
+ providerMetadata?: Record<string, Record<string, any>>;
3937
+ providerOptions?: Record<string, Record<string, any>>;
3938
+ reason?: string;
3939
+ type: "tool-approval-response";
3940
+ }
3941
+ >;
3942
+ providerOptions?: Record<string, Record<string, any>>;
3943
+ role: "tool";
3944
+ }
3945
+ | {
3946
+ content: string;
3947
+ providerOptions?: Record<string, Record<string, any>>;
3948
+ role: "system";
3949
+ };
3950
+ model?: string;
3951
+ provider?: string;
3952
+ providerOptions?: Record<string, Record<string, any>>;
3953
+ status?: "pending" | "success" | "failed";
3954
+ };
3955
+ },
3956
+ {
3957
+ _creationTime: number;
3958
+ _id: string;
3959
+ agentName?: string;
3960
+ embeddingId?: string;
3961
+ error?: string;
3962
+ fileIds?: Array<string>;
3963
+ finishReason?:
3964
+ | "stop"
3965
+ | "length"
3966
+ | "content-filter"
3967
+ | "tool-calls"
3968
+ | "error"
3969
+ | "other"
3970
+ | "unknown";
3971
+ id?: string;
3972
+ message?:
3973
+ | {
3974
+ content:
3975
+ | string
3976
+ | Array<
3977
+ | {
3978
+ providerMetadata?: Record<
3979
+ string,
3980
+ Record<string, any>
3981
+ >;
3982
+ providerOptions?: Record<string, Record<string, any>>;
3983
+ text: string;
3984
+ type: "text";
3985
+ }
3986
+ | {
3987
+ image: string | ArrayBuffer;
3988
+ mediaType?: string;
3989
+ mimeType?: string;
3990
+ providerOptions?: Record<string, Record<string, any>>;
3991
+ type: "image";
3992
+ }
3993
+ | {
3994
+ data: string | ArrayBuffer;
3995
+ filename?: string;
3996
+ mediaType?: string;
3997
+ mimeType?: string;
3998
+ providerMetadata?: Record<
3999
+ string,
4000
+ Record<string, any>
4001
+ >;
4002
+ providerOptions?: Record<string, Record<string, any>>;
4003
+ type: "file";
4004
+ }
4005
+ >;
4006
+ providerOptions?: Record<string, Record<string, any>>;
4007
+ role: "user";
4008
+ }
4009
+ | {
4010
+ content:
4011
+ | string
4012
+ | Array<
4013
+ | {
4014
+ providerMetadata?: Record<
4015
+ string,
4016
+ Record<string, any>
4017
+ >;
4018
+ providerOptions?: Record<string, Record<string, any>>;
4019
+ text: string;
4020
+ type: "text";
4021
+ }
4022
+ | {
4023
+ data: string | ArrayBuffer;
4024
+ filename?: string;
4025
+ mediaType?: string;
4026
+ mimeType?: string;
4027
+ providerMetadata?: Record<
4028
+ string,
4029
+ Record<string, any>
4030
+ >;
4031
+ providerOptions?: Record<string, Record<string, any>>;
4032
+ type: "file";
4033
+ }
4034
+ | {
4035
+ providerMetadata?: Record<
4036
+ string,
4037
+ Record<string, any>
4038
+ >;
4039
+ providerOptions?: Record<string, Record<string, any>>;
4040
+ signature?: string;
4041
+ text: string;
4042
+ type: "reasoning";
4043
+ }
4044
+ | {
4045
+ data: string;
4046
+ providerMetadata?: Record<
4047
+ string,
4048
+ Record<string, any>
4049
+ >;
4050
+ providerOptions?: Record<string, Record<string, any>>;
4051
+ type: "redacted-reasoning";
4052
+ }
4053
+ | {
4054
+ args?: any;
4055
+ input: any;
4056
+ providerExecuted?: boolean;
4057
+ providerMetadata?: Record<
4058
+ string,
4059
+ Record<string, any>
4060
+ >;
4061
+ providerOptions?: Record<string, Record<string, any>>;
4062
+ toolCallId: string;
4063
+ toolName: string;
4064
+ type: "tool-call";
4065
+ }
4066
+ | {
4067
+ args: any;
4068
+ input?: any;
4069
+ providerExecuted?: boolean;
4070
+ providerMetadata?: Record<
4071
+ string,
4072
+ Record<string, any>
4073
+ >;
4074
+ providerOptions?: Record<
4075
+ string,
4076
+ Record<string, any>
4077
+ >;
4078
+ toolCallId: string;
4079
+ toolName: string;
4080
+ type: "tool-call";
4081
+ }
4082
+ | {
4083
+ args?: any;
4084
+ experimental_content?: Array<
4085
+ | { text: string; type: "text" }
4086
+ | { data: string; mimeType?: string; type: "image" }
4087
+ >;
4088
+ isError?: boolean;
4089
+ output?:
4090
+ | {
4091
+ providerOptions?: Record<
4092
+ string,
4093
+ Record<string, any>
4094
+ >;
4095
+ type: "text";
4096
+ value: string;
4097
+ }
4098
+ | {
4099
+ providerOptions?: Record<
4100
+ string,
4101
+ Record<string, any>
4102
+ >;
4103
+ type: "json";
4104
+ value: any;
4105
+ }
4106
+ | {
4107
+ providerOptions?: Record<
4108
+ string,
4109
+ Record<string, any>
4110
+ >;
4111
+ type: "error-text";
4112
+ value: string;
4113
+ }
4114
+ | {
4115
+ providerOptions?: Record<
4116
+ string,
4117
+ Record<string, any>
4118
+ >;
4119
+ type: "error-json";
4120
+ value: any;
4121
+ }
4122
+ | {
4123
+ providerOptions?: Record<
4124
+ string,
4125
+ Record<string, any>
4126
+ >;
4127
+ reason?: string;
4128
+ type: "execution-denied";
4129
+ }
4130
+ | {
4131
+ type: "content";
4132
+ value: Array<
4133
+ | {
4134
+ providerOptions?: Record<
4135
+ string,
4136
+ Record<string, any>
4137
+ >;
4138
+ text: string;
4139
+ type: "text";
4140
+ }
4141
+ | {
4142
+ data: string;
4143
+ mediaType: string;
4144
+ type: "media";
4145
+ }
4146
+ | {
4147
+ data: string;
4148
+ filename?: string;
4149
+ mediaType: string;
4150
+ providerOptions?: Record<
4151
+ string,
4152
+ Record<string, any>
4153
+ >;
4154
+ type: "file-data";
4155
+ }
4156
+ | {
4157
+ providerOptions?: Record<
4158
+ string,
4159
+ Record<string, any>
4160
+ >;
4161
+ type: "file-url";
4162
+ url: string;
4163
+ }
4164
+ | {
4165
+ fileId: string | Record<string, string>;
4166
+ providerOptions?: Record<
4167
+ string,
4168
+ Record<string, any>
4169
+ >;
4170
+ type: "file-id";
4171
+ }
4172
+ | {
4173
+ data: string;
4174
+ mediaType: string;
4175
+ providerOptions?: Record<
4176
+ string,
4177
+ Record<string, any>
4178
+ >;
4179
+ type: "image-data";
4180
+ }
4181
+ | {
4182
+ providerOptions?: Record<
4183
+ string,
4184
+ Record<string, any>
4185
+ >;
4186
+ type: "image-url";
4187
+ url: string;
4188
+ }
4189
+ | {
4190
+ fileId: string | Record<string, string>;
4191
+ providerOptions?: Record<
4192
+ string,
4193
+ Record<string, any>
4194
+ >;
4195
+ type: "image-file-id";
4196
+ }
4197
+ | {
4198
+ providerOptions?: Record<
4199
+ string,
4200
+ Record<string, any>
4201
+ >;
4202
+ type: "custom";
4203
+ }
4204
+ >;
4205
+ };
4206
+ providerExecuted?: boolean;
4207
+ providerMetadata?: Record<
4208
+ string,
4209
+ Record<string, any>
4210
+ >;
4211
+ providerOptions?: Record<string, Record<string, any>>;
4212
+ result?: any;
4213
+ toolCallId: string;
4214
+ toolName: string;
4215
+ type: "tool-result";
4216
+ }
4217
+ | {
4218
+ id: string;
4219
+ providerMetadata?: Record<
4220
+ string,
4221
+ Record<string, any>
4222
+ >;
4223
+ providerOptions?: Record<string, Record<string, any>>;
4224
+ sourceType: "url";
4225
+ title?: string;
4226
+ type: "source";
4227
+ url: string;
4228
+ }
4229
+ | {
4230
+ filename?: string;
4231
+ id: string;
4232
+ mediaType: string;
4233
+ providerMetadata?: Record<
4234
+ string,
4235
+ Record<string, any>
4236
+ >;
4237
+ providerOptions?: Record<string, Record<string, any>>;
4238
+ sourceType: "document";
4239
+ title: string;
4240
+ type: "source";
4241
+ }
4242
+ | {
4243
+ approvalId: string;
4244
+ providerMetadata?: Record<
4245
+ string,
4246
+ Record<string, any>
4247
+ >;
4248
+ providerOptions?: Record<string, Record<string, any>>;
4249
+ toolCallId: string;
4250
+ type: "tool-approval-request";
4251
+ }
4252
+ >;
4253
+ providerOptions?: Record<string, Record<string, any>>;
4254
+ role: "assistant";
4255
+ }
4256
+ | {
4257
+ content: Array<
4258
+ | {
4259
+ args?: any;
4260
+ experimental_content?: Array<
4261
+ | { text: string; type: "text" }
4262
+ | { data: string; mimeType?: string; type: "image" }
4263
+ >;
4264
+ isError?: boolean;
4265
+ output?:
4266
+ | {
4267
+ providerOptions?: Record<
4268
+ string,
4269
+ Record<string, any>
4270
+ >;
4271
+ type: "text";
4272
+ value: string;
4273
+ }
4274
+ | {
4275
+ providerOptions?: Record<
4276
+ string,
4277
+ Record<string, any>
4278
+ >;
4279
+ type: "json";
4280
+ value: any;
4281
+ }
4282
+ | {
4283
+ providerOptions?: Record<
4284
+ string,
4285
+ Record<string, any>
4286
+ >;
4287
+ type: "error-text";
4288
+ value: string;
4289
+ }
4290
+ | {
4291
+ providerOptions?: Record<
4292
+ string,
4293
+ Record<string, any>
4294
+ >;
4295
+ type: "error-json";
4296
+ value: any;
4297
+ }
4298
+ | {
4299
+ providerOptions?: Record<
4300
+ string,
4301
+ Record<string, any>
4302
+ >;
4303
+ reason?: string;
4304
+ type: "execution-denied";
4305
+ }
4306
+ | {
4307
+ type: "content";
4308
+ value: Array<
4309
+ | {
4310
+ providerOptions?: Record<
4311
+ string,
4312
+ Record<string, any>
4313
+ >;
4314
+ text: string;
4315
+ type: "text";
4316
+ }
4317
+ | {
4318
+ data: string;
4319
+ mediaType: string;
4320
+ type: "media";
4321
+ }
4322
+ | {
4323
+ data: string;
4324
+ filename?: string;
4325
+ mediaType: string;
4326
+ providerOptions?: Record<
4327
+ string,
4328
+ Record<string, any>
4329
+ >;
4330
+ type: "file-data";
4331
+ }
4332
+ | {
4333
+ providerOptions?: Record<
4334
+ string,
4335
+ Record<string, any>
4336
+ >;
4337
+ type: "file-url";
4338
+ url: string;
4339
+ }
4340
+ | {
4341
+ fileId: string | Record<string, string>;
4342
+ providerOptions?: Record<
4343
+ string,
4344
+ Record<string, any>
4345
+ >;
4346
+ type: "file-id";
4347
+ }
4348
+ | {
4349
+ data: string;
4350
+ mediaType: string;
4351
+ providerOptions?: Record<
4352
+ string,
4353
+ Record<string, any>
4354
+ >;
4355
+ type: "image-data";
4356
+ }
4357
+ | {
4358
+ providerOptions?: Record<
4359
+ string,
4360
+ Record<string, any>
4361
+ >;
4362
+ type: "image-url";
4363
+ url: string;
4364
+ }
4365
+ | {
4366
+ fileId: string | Record<string, string>;
4367
+ providerOptions?: Record<
4368
+ string,
4369
+ Record<string, any>
4370
+ >;
4371
+ type: "image-file-id";
4372
+ }
4373
+ | {
4374
+ providerOptions?: Record<
4375
+ string,
4376
+ Record<string, any>
4377
+ >;
4378
+ type: "custom";
4379
+ }
4380
+ >;
4381
+ };
4382
+ providerExecuted?: boolean;
4383
+ providerMetadata?: Record<string, Record<string, any>>;
4384
+ providerOptions?: Record<string, Record<string, any>>;
4385
+ result?: any;
4386
+ toolCallId: string;
4387
+ toolName: string;
4388
+ type: "tool-result";
4389
+ }
4390
+ | {
4391
+ approvalId: string;
4392
+ approved: boolean;
4393
+ providerExecuted?: boolean;
4394
+ providerMetadata?: Record<string, Record<string, any>>;
4395
+ providerOptions?: Record<string, Record<string, any>>;
4396
+ reason?: string;
4397
+ type: "tool-approval-response";
4398
+ }
4399
+ >;
4400
+ providerOptions?: Record<string, Record<string, any>>;
4401
+ role: "tool";
4402
+ }
4403
+ | {
4404
+ content: string;
4405
+ providerOptions?: Record<string, Record<string, any>>;
4406
+ role: "system";
4407
+ };
4408
+ model?: string;
4409
+ order: number;
4410
+ provider?: string;
4411
+ providerMetadata?: Record<string, Record<string, any>>;
4412
+ providerOptions?: Record<string, Record<string, any>>;
4413
+ reasoning?: string;
4414
+ reasoningDetails?: Array<
4415
+ | {
4416
+ providerMetadata?: Record<string, Record<string, any>>;
4417
+ providerOptions?: Record<string, Record<string, any>>;
4418
+ signature?: string;
4419
+ text: string;
4420
+ type: "reasoning";
4421
+ }
4422
+ | { signature?: string; text: string; type: "text" }
4423
+ | { data: string; type: "redacted" }
4424
+ >;
4425
+ sources?: Array<
4426
+ | {
4427
+ id: string;
4428
+ providerMetadata?: Record<string, Record<string, any>>;
4429
+ providerOptions?: Record<string, Record<string, any>>;
4430
+ sourceType: "url";
4431
+ title?: string;
4432
+ type?: "source";
4433
+ url: string;
4434
+ }
4435
+ | {
4436
+ filename?: string;
4437
+ id: string;
4438
+ mediaType: string;
4439
+ providerMetadata?: Record<string, Record<string, any>>;
4440
+ providerOptions?: Record<string, Record<string, any>>;
4441
+ sourceType: "document";
4442
+ title: string;
4443
+ type: "source";
4444
+ }
4445
+ >;
4446
+ status: "pending" | "success" | "failed";
4447
+ stepOrder: number;
4448
+ text?: string;
4449
+ threadId: string;
4450
+ tool: boolean;
4451
+ usage?: {
4452
+ cachedInputTokens?: number;
4453
+ completionTokens: number;
4454
+ promptTokens: number;
4455
+ reasoningTokens?: number;
4456
+ totalTokens: number;
4457
+ };
4458
+ userId?: string;
4459
+ warnings?: Array<
4460
+ | { details?: string; setting: string; type: "unsupported-setting" }
4461
+ | { details?: string; tool: any; type: "unsupported-tool" }
4462
+ | { message: string; type: "other" }
4463
+ >;
4464
+ },
4465
+ Name
4466
+ >;
4467
+ };
4468
+ streams: {
4469
+ abort: FunctionReference<
4470
+ "mutation",
4471
+ "internal",
4472
+ {
4473
+ finalDelta?: {
4474
+ end: number;
4475
+ parts: Array<any>;
4476
+ start: number;
4477
+ streamId: string;
4478
+ };
4479
+ reason: string;
4480
+ streamId: string;
4481
+ },
4482
+ boolean,
4483
+ Name
4484
+ >;
4485
+ abortByOrder: FunctionReference<
4486
+ "mutation",
4487
+ "internal",
4488
+ { order: number; reason: string; threadId: string },
4489
+ boolean,
4490
+ Name
4491
+ >;
4492
+ addDelta: FunctionReference<
4493
+ "mutation",
4494
+ "internal",
4495
+ { end: number; parts: Array<any>; start: number; streamId: string },
4496
+ boolean,
4497
+ Name
4498
+ >;
4499
+ create: FunctionReference<
4500
+ "mutation",
4501
+ "internal",
4502
+ {
4503
+ agentName?: string;
4504
+ format?: "UIMessageChunk" | "TextStreamPart";
4505
+ model?: string;
4506
+ order: number;
4507
+ provider?: string;
4508
+ providerOptions?: Record<string, Record<string, any>>;
4509
+ stepOrder: number;
4510
+ threadId: string;
4511
+ userId?: string;
4512
+ },
4513
+ string,
4514
+ Name
4515
+ >;
4516
+ deleteAllStreamsForThreadIdAsync: FunctionReference<
4517
+ "mutation",
4518
+ "internal",
4519
+ { deltaCursor?: string; streamOrder?: number; threadId: string },
4520
+ { deltaCursor?: string; isDone: boolean; streamOrder?: number },
4521
+ Name
4522
+ >;
4523
+ deleteAllStreamsForThreadIdSync: FunctionReference<
4524
+ "action",
4525
+ "internal",
4526
+ { threadId: string },
4527
+ null,
4528
+ Name
4529
+ >;
4530
+ deleteStreamAsync: FunctionReference<
4531
+ "mutation",
4532
+ "internal",
4533
+ { cursor?: string; streamId: string },
4534
+ null,
4535
+ Name
4536
+ >;
4537
+ deleteStreamSync: FunctionReference<
4538
+ "mutation",
4539
+ "internal",
4540
+ { streamId: string },
4541
+ null,
4542
+ Name
4543
+ >;
4544
+ finish: FunctionReference<
4545
+ "mutation",
4546
+ "internal",
4547
+ {
4548
+ finalDelta?: {
4549
+ end: number;
4550
+ parts: Array<any>;
4551
+ start: number;
4552
+ streamId: string;
4553
+ };
4554
+ streamId: string;
4555
+ },
4556
+ null,
4557
+ Name
4558
+ >;
4559
+ heartbeat: FunctionReference<
4560
+ "mutation",
4561
+ "internal",
4562
+ { streamId: string },
4563
+ null,
4564
+ Name
4565
+ >;
4566
+ list: FunctionReference<
4567
+ "query",
4568
+ "internal",
4569
+ {
4570
+ startOrder?: number;
4571
+ statuses?: Array<"streaming" | "finished" | "aborted">;
4572
+ threadId: string;
4573
+ },
4574
+ Array<{
4575
+ agentName?: string;
4576
+ format?: "UIMessageChunk" | "TextStreamPart";
4577
+ model?: string;
4578
+ order: number;
4579
+ provider?: string;
4580
+ providerOptions?: Record<string, Record<string, any>>;
4581
+ status: "streaming" | "finished" | "aborted";
4582
+ stepOrder: number;
4583
+ streamId: string;
4584
+ userId?: string;
4585
+ }>,
4586
+ Name
4587
+ >;
4588
+ listDeltas: FunctionReference<
4589
+ "query",
4590
+ "internal",
4591
+ {
4592
+ cursors: Array<{ cursor: number; streamId: string }>;
4593
+ threadId: string;
4594
+ },
4595
+ Array<{
4596
+ end: number;
4597
+ parts: Array<any>;
4598
+ start: number;
4599
+ streamId: string;
4600
+ }>,
4601
+ Name
4602
+ >;
4603
+ };
4604
+ threads: {
4605
+ createThread: FunctionReference<
4606
+ "mutation",
4607
+ "internal",
4608
+ {
4609
+ defaultSystemPrompt?: string;
4610
+ parentThreadIds?: Array<string>;
4611
+ summary?: string;
4612
+ title?: string;
4613
+ userId?: string;
4614
+ },
4615
+ {
4616
+ _creationTime: number;
4617
+ _id: string;
4618
+ status: "active" | "archived";
4619
+ summary?: string;
4620
+ title?: string;
4621
+ userId?: string;
4622
+ },
4623
+ Name
4624
+ >;
4625
+ deleteAllForThreadIdAsync: FunctionReference<
4626
+ "mutation",
4627
+ "internal",
4628
+ {
4629
+ cursor?: string;
4630
+ deltaCursor?: string;
4631
+ limit?: number;
4632
+ messagesDone?: boolean;
4633
+ streamOrder?: number;
4634
+ streamsDone?: boolean;
4635
+ threadId: string;
4636
+ },
4637
+ { isDone: boolean },
4638
+ Name
4639
+ >;
4640
+ deleteAllForThreadIdSync: FunctionReference<
4641
+ "action",
4642
+ "internal",
4643
+ { limit?: number; threadId: string },
4644
+ null,
4645
+ Name
4646
+ >;
4647
+ getThread: FunctionReference<
4648
+ "query",
4649
+ "internal",
4650
+ { threadId: string },
4651
+ {
4652
+ _creationTime: number;
4653
+ _id: string;
4654
+ status: "active" | "archived";
4655
+ summary?: string;
4656
+ title?: string;
4657
+ userId?: string;
4658
+ } | null,
4659
+ Name
4660
+ >;
4661
+ listThreadsByUserId: FunctionReference<
4662
+ "query",
4663
+ "internal",
4664
+ {
4665
+ order?: "asc" | "desc";
4666
+ paginationOpts?: {
4667
+ cursor: string | null;
4668
+ endCursor?: string | null;
4669
+ id?: number;
4670
+ maximumBytesRead?: number;
4671
+ maximumRowsRead?: number;
4672
+ numItems: number;
4673
+ };
4674
+ userId?: string;
4675
+ },
4676
+ {
4677
+ continueCursor: string;
4678
+ isDone: boolean;
4679
+ page: Array<{
4680
+ _creationTime: number;
4681
+ _id: string;
4682
+ status: "active" | "archived";
4683
+ summary?: string;
4684
+ title?: string;
4685
+ userId?: string;
4686
+ }>;
4687
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
4688
+ splitCursor?: string | null;
4689
+ },
4690
+ Name
4691
+ >;
4692
+ searchThreadTitles: FunctionReference<
4693
+ "query",
4694
+ "internal",
4695
+ { limit: number; query: string; userId?: string | null },
4696
+ Array<{
4697
+ _creationTime: number;
4698
+ _id: string;
4699
+ status: "active" | "archived";
4700
+ summary?: string;
4701
+ title?: string;
4702
+ userId?: string;
4703
+ }>,
4704
+ Name
4705
+ >;
4706
+ updateThread: FunctionReference<
4707
+ "mutation",
4708
+ "internal",
4709
+ {
4710
+ patch: {
4711
+ status?: "active" | "archived";
4712
+ summary?: string;
4713
+ title?: string;
4714
+ userId?: string;
4715
+ };
4716
+ threadId: string;
4717
+ },
4718
+ {
4719
+ _creationTime: number;
4720
+ _id: string;
4721
+ status: "active" | "archived";
4722
+ summary?: string;
4723
+ title?: string;
4724
+ userId?: string;
4725
+ },
4726
+ Name
4727
+ >;
4728
+ };
4729
+ users: {
4730
+ deleteAllForUserId: FunctionReference<
4731
+ "action",
4732
+ "internal",
4733
+ { userId: string },
4734
+ null,
4735
+ Name
4736
+ >;
4737
+ deleteAllForUserIdAsync: FunctionReference<
4738
+ "mutation",
4739
+ "internal",
4740
+ { userId: string },
4741
+ boolean,
4742
+ Name
4743
+ >;
4744
+ listUsersWithThreads: FunctionReference<
4745
+ "query",
4746
+ "internal",
4747
+ {
4748
+ paginationOpts: {
4749
+ cursor: string | null;
4750
+ endCursor?: string | null;
4751
+ id?: number;
4752
+ maximumBytesRead?: number;
4753
+ maximumRowsRead?: number;
4754
+ numItems: number;
4755
+ };
4756
+ },
4757
+ {
4758
+ continueCursor: string;
4759
+ isDone: boolean;
4760
+ page: Array<string>;
4761
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
4762
+ splitCursor?: string | null;
4763
+ },
4764
+ Name
4765
+ >;
4766
+ };
4767
+ vector: {
4768
+ index: {
4769
+ deleteBatch: FunctionReference<
4770
+ "mutation",
4771
+ "internal",
4772
+ {
4773
+ ids: Array<
4774
+ | string
4775
+ | string
4776
+ | string
4777
+ | string
4778
+ | string
4779
+ | string
4780
+ | string
4781
+ | string
4782
+ | string
4783
+ | string
4784
+ >;
4785
+ },
4786
+ null,
4787
+ Name
4788
+ >;
4789
+ deleteBatchForThread: FunctionReference<
4790
+ "mutation",
4791
+ "internal",
4792
+ {
4793
+ cursor?: string;
4794
+ limit: number;
4795
+ model: string;
4796
+ threadId: string;
4797
+ vectorDimension:
4798
+ | 128
4799
+ | 256
4800
+ | 512
4801
+ | 768
4802
+ | 1024
4803
+ | 1408
4804
+ | 1536
4805
+ | 2048
4806
+ | 3072
4807
+ | 4096;
4808
+ },
4809
+ { continueCursor: string; isDone: boolean },
4810
+ Name
4811
+ >;
4812
+ insertBatch: FunctionReference<
4813
+ "mutation",
4814
+ "internal",
4815
+ {
4816
+ vectorDimension:
4817
+ | 128
4818
+ | 256
4819
+ | 512
4820
+ | 768
4821
+ | 1024
4822
+ | 1408
4823
+ | 1536
4824
+ | 2048
4825
+ | 3072
4826
+ | 4096;
4827
+ vectors: Array<{
4828
+ messageId?: string;
4829
+ model: string;
4830
+ table: string;
4831
+ threadId?: string;
4832
+ userId?: string;
4833
+ vector: Array<number>;
4834
+ }>;
4835
+ },
4836
+ Array<
4837
+ | string
4838
+ | string
4839
+ | string
4840
+ | string
4841
+ | string
4842
+ | string
4843
+ | string
4844
+ | string
4845
+ | string
4846
+ | string
4847
+ >,
4848
+ Name
4849
+ >;
4850
+ paginate: FunctionReference<
4851
+ "query",
4852
+ "internal",
4853
+ {
4854
+ cursor?: string;
4855
+ limit: number;
4856
+ table?: string;
4857
+ targetModel: string;
4858
+ vectorDimension:
4859
+ | 128
4860
+ | 256
4861
+ | 512
4862
+ | 768
4863
+ | 1024
4864
+ | 1408
4865
+ | 1536
4866
+ | 2048
4867
+ | 3072
4868
+ | 4096;
4869
+ },
4870
+ {
4871
+ continueCursor: string;
4872
+ ids: Array<
4873
+ | string
4874
+ | string
4875
+ | string
4876
+ | string
4877
+ | string
4878
+ | string
4879
+ | string
4880
+ | string
4881
+ | string
4882
+ | string
4883
+ >;
4884
+ isDone: boolean;
4885
+ },
4886
+ Name
4887
+ >;
4888
+ updateBatch: FunctionReference<
4889
+ "mutation",
4890
+ "internal",
4891
+ {
4892
+ vectors: Array<{
4893
+ id:
4894
+ | string
4895
+ | string
4896
+ | string
4897
+ | string
4898
+ | string
4899
+ | string
4900
+ | string
4901
+ | string
4902
+ | string
4903
+ | string;
4904
+ model: string;
4905
+ vector: Array<number>;
4906
+ }>;
4907
+ },
4908
+ null,
4909
+ Name
4910
+ >;
4911
+ };
4912
+ };
4913
+ };