@convex-dev/agent 0.5.0-alpha.1 → 0.6.0-alpha.1

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