@convex-dev/agent 0.6.0 → 0.6.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 (184) hide show
  1. package/dist/UIMessages.d.ts +46 -0
  2. package/dist/UIMessages.d.ts.map +1 -0
  3. package/dist/UIMessages.js +634 -0
  4. package/dist/UIMessages.js.map +1 -0
  5. package/dist/client/createTool.d.ts +167 -0
  6. package/dist/client/createTool.d.ts.map +1 -0
  7. package/dist/client/createTool.js +116 -0
  8. package/dist/client/createTool.js.map +1 -0
  9. package/dist/client/defaultComponent.d.ts +11 -0
  10. package/dist/client/defaultComponent.d.ts.map +1 -0
  11. package/dist/client/defaultComponent.js +7 -0
  12. package/dist/client/defaultComponent.js.map +1 -0
  13. package/dist/client/definePlaygroundAPI.d.ts +1725 -0
  14. package/dist/client/definePlaygroundAPI.d.ts.map +1 -0
  15. package/dist/client/definePlaygroundAPI.js +271 -0
  16. package/dist/client/definePlaygroundAPI.js.map +1 -0
  17. package/dist/client/files.d.ts +69 -0
  18. package/dist/client/files.d.ts.map +1 -0
  19. package/dist/client/files.js +181 -0
  20. package/dist/client/files.js.map +1 -0
  21. package/dist/client/index.d.ts +2091 -0
  22. package/dist/client/index.d.ts.map +1 -0
  23. package/dist/client/index.js +929 -0
  24. package/dist/client/index.js.map +1 -0
  25. package/dist/client/messages.d.ts +461 -0
  26. package/dist/client/messages.d.ts.map +1 -0
  27. package/dist/client/messages.js +106 -0
  28. package/dist/client/messages.js.map +1 -0
  29. package/dist/client/mockModel.d.ts +42 -0
  30. package/dist/client/mockModel.d.ts.map +1 -0
  31. package/dist/client/mockModel.js +182 -0
  32. package/dist/client/mockModel.js.map +1 -0
  33. package/dist/client/saveInputMessages.d.ts +20 -0
  34. package/dist/client/saveInputMessages.d.ts.map +1 -0
  35. package/dist/client/saveInputMessages.js +58 -0
  36. package/dist/client/saveInputMessages.js.map +1 -0
  37. package/dist/client/search.d.ts +493 -0
  38. package/dist/client/search.d.ts.map +1 -0
  39. package/dist/client/search.js +435 -0
  40. package/dist/client/search.js.map +1 -0
  41. package/dist/client/start.d.ts +84 -0
  42. package/dist/client/start.d.ts.map +1 -0
  43. package/dist/client/start.js +185 -0
  44. package/dist/client/start.js.map +1 -0
  45. package/dist/client/streamText.d.ts +46 -0
  46. package/dist/client/streamText.d.ts.map +1 -0
  47. package/dist/client/streamText.js +127 -0
  48. package/dist/client/streamText.js.map +1 -0
  49. package/dist/client/streaming.d.ts +3778 -0
  50. package/dist/client/streaming.d.ts.map +1 -0
  51. package/dist/client/streaming.js +330 -0
  52. package/dist/client/streaming.js.map +1 -0
  53. package/dist/client/threads.d.ts +46 -0
  54. package/dist/client/threads.d.ts.map +1 -0
  55. package/dist/client/threads.js +49 -0
  56. package/dist/client/threads.js.map +1 -0
  57. package/dist/client/types.d.ts +461 -0
  58. package/dist/client/types.d.ts.map +1 -0
  59. package/dist/client/types.js +2 -0
  60. package/dist/client/types.js.map +1 -0
  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 +48 -0
  66. package/dist/component/_generated/api.d.ts.map +1 -0
  67. package/dist/component/_generated/api.js +31 -0
  68. package/dist/component/_generated/api.js.map +1 -0
  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 +46 -0
  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 +121 -0
  78. package/dist/component/_generated/server.d.ts.map +1 -0
  79. package/dist/component/_generated/server.js +78 -0
  80. package/dist/component/_generated/server.js.map +1 -0
  81. package/dist/component/apiKeys.d.ts +11 -0
  82. package/dist/component/apiKeys.d.ts.map +1 -0
  83. package/dist/component/apiKeys.js +69 -0
  84. package/dist/component/apiKeys.js.map +1 -0
  85. package/dist/component/convex.config.d.ts +3 -0
  86. package/dist/component/convex.config.d.ts.map +1 -0
  87. package/dist/component/convex.config.js +3 -0
  88. package/dist/component/convex.config.js.map +1 -0
  89. package/dist/component/files.d.ts +97 -0
  90. package/dist/component/files.d.ts.map +1 -0
  91. package/dist/component/files.js +190 -0
  92. package/dist/component/files.js.map +1 -0
  93. package/dist/component/messages.d.ts +3851 -0
  94. package/dist/component/messages.d.ts.map +1 -0
  95. package/dist/component/messages.js +757 -0
  96. package/dist/component/messages.js.map +1 -0
  97. package/dist/component/schema.d.ts +8029 -0
  98. package/dist/component/schema.d.ts.map +1 -0
  99. package/dist/component/schema.js +147 -0
  100. package/dist/component/schema.js.map +1 -0
  101. package/dist/component/streams.d.ts +128 -0
  102. package/dist/component/streams.d.ts.map +1 -0
  103. package/dist/component/streams.js +413 -0
  104. package/dist/component/streams.js.map +1 -0
  105. package/dist/component/threads.d.ts +115 -0
  106. package/dist/component/threads.d.ts.map +1 -0
  107. package/dist/component/threads.js +208 -0
  108. package/dist/component/threads.js.map +1 -0
  109. package/dist/component/users.d.ts +52 -0
  110. package/dist/component/users.d.ts.map +1 -0
  111. package/dist/component/users.js +229 -0
  112. package/dist/component/users.js.map +1 -0
  113. package/dist/component/vector/index.d.ts +61 -0
  114. package/dist/component/vector/index.d.ts.map +1 -0
  115. package/dist/component/vector/index.js +146 -0
  116. package/dist/component/vector/index.js.map +1 -0
  117. package/dist/component/vector/tables.d.ts +58 -0
  118. package/dist/component/vector/tables.d.ts.map +1 -0
  119. package/dist/component/vector/tables.js +56 -0
  120. package/dist/component/vector/tables.js.map +1 -0
  121. package/dist/deltas.d.ts +43 -0
  122. package/dist/deltas.d.ts.map +1 -0
  123. package/dist/deltas.js +446 -0
  124. package/dist/deltas.js.map +1 -0
  125. package/dist/mapping.d.ts +76 -0
  126. package/dist/mapping.d.ts.map +1 -0
  127. package/dist/mapping.js +720 -0
  128. package/dist/mapping.js.map +1 -0
  129. package/dist/react/SmoothText.d.ts +5 -0
  130. package/dist/react/SmoothText.d.ts.map +1 -0
  131. package/dist/react/SmoothText.js +6 -0
  132. package/dist/react/SmoothText.js.map +1 -0
  133. package/dist/react/index.d.ts +25 -0
  134. package/dist/react/index.d.ts.map +1 -0
  135. package/dist/react/index.js +70 -0
  136. package/dist/react/index.js.map +1 -0
  137. package/dist/react/optimisticallySendMessage.d.ts +42 -0
  138. package/dist/react/optimisticallySendMessage.d.ts.map +1 -0
  139. package/dist/react/optimisticallySendMessage.js +74 -0
  140. package/dist/react/optimisticallySendMessage.js.map +1 -0
  141. package/dist/react/types.d.ts +12 -0
  142. package/dist/react/types.d.ts.map +1 -0
  143. package/dist/react/types.js +2 -0
  144. package/dist/react/types.js.map +1 -0
  145. package/dist/react/useDeltaStreams.d.ts +10 -0
  146. package/dist/react/useDeltaStreams.d.ts.map +1 -0
  147. package/dist/react/useDeltaStreams.js +106 -0
  148. package/dist/react/useDeltaStreams.js.map +1 -0
  149. package/dist/react/useSmoothText.d.ts +27 -0
  150. package/dist/react/useSmoothText.d.ts.map +1 -0
  151. package/dist/react/useSmoothText.js +68 -0
  152. package/dist/react/useSmoothText.js.map +1 -0
  153. package/dist/react/useStreamingUIMessages.d.ts +22 -0
  154. package/dist/react/useStreamingUIMessages.d.ts.map +1 -0
  155. package/dist/react/useStreamingUIMessages.js +92 -0
  156. package/dist/react/useStreamingUIMessages.js.map +1 -0
  157. package/dist/react/useThreadMessages.d.ts +104 -0
  158. package/dist/react/useThreadMessages.d.ts.map +1 -0
  159. package/dist/react/useThreadMessages.js +148 -0
  160. package/dist/react/useThreadMessages.js.map +1 -0
  161. package/dist/react/useUIMessages.d.ts +96 -0
  162. package/dist/react/useUIMessages.d.ts.map +1 -0
  163. package/dist/react/useUIMessages.js +108 -0
  164. package/dist/react/useUIMessages.js.map +1 -0
  165. package/dist/shared.d.ts +26 -0
  166. package/dist/shared.d.ts.map +1 -0
  167. package/dist/shared.js +67 -0
  168. package/dist/shared.js.map +1 -0
  169. package/dist/validators.d.ts +24516 -0
  170. package/dist/validators.d.ts.map +1 -0
  171. package/dist/validators.js +475 -0
  172. package/dist/validators.js.map +1 -0
  173. package/package.json +39 -39
  174. package/src/UIMessages.ts +0 -9
  175. package/src/client/approval.test.ts +144 -0
  176. package/src/client/index.ts +17 -9
  177. package/src/client/search.ts +0 -29
  178. package/src/client/start.ts +2 -2
  179. package/src/client/streamText.ts +9 -0
  180. package/src/client/streaming.ts +30 -23
  181. package/src/component/_generated/dataModel.ts +1 -1
  182. package/src/component/_generated/server.ts +0 -5
  183. package/src/mapping.ts +38 -22
  184. package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
@@ -0,0 +1,1725 @@
1
+ import { type ApiFromModules, type GenericActionCtx, type GenericDataModel, type GenericQueryCtx } from "convex/server";
2
+ import { type Agent, type AgentComponent } from "./index.js";
3
+ export type PlaygroundAPI = ApiFromModules<{
4
+ playground: ReturnType<typeof definePlaygroundAPI>;
5
+ }>["playground"];
6
+ export type AgentsFn<DataModel extends GenericDataModel> = (ctx: GenericActionCtx<DataModel> | GenericQueryCtx<DataModel>, args: {
7
+ userId: string | undefined;
8
+ threadId: string | undefined;
9
+ }) => Agent[] | Promise<Agent[]>;
10
+ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(component: AgentComponent, { agents: agentsOrFn, userNameLookup, }: {
11
+ agents: Agent[] | AgentsFn<DataModel>;
12
+ userNameLookup?: (ctx: GenericQueryCtx<DataModel>, userId: string) => string | Promise<string>;
13
+ }): {
14
+ isApiKeyValid: import("convex/server").RegisteredQuery<"public", {
15
+ apiKey: string;
16
+ }, Promise<boolean>>;
17
+ listUsers: import("convex/server").RegisteredQuery<"public", {
18
+ apiKey: string;
19
+ paginationOpts: {
20
+ id?: number;
21
+ endCursor?: string | null;
22
+ maximumRowsRead?: number;
23
+ maximumBytesRead?: number;
24
+ numItems: number;
25
+ cursor: string | null;
26
+ };
27
+ }, Promise<{
28
+ page: {
29
+ _id: string;
30
+ name: string;
31
+ }[];
32
+ continueCursor: string;
33
+ isDone: boolean;
34
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
35
+ splitCursor?: string | null;
36
+ }>>;
37
+ listThreads: import("convex/server").RegisteredQuery<"public", {
38
+ userId?: string | undefined;
39
+ apiKey: string;
40
+ paginationOpts: {
41
+ id?: number;
42
+ endCursor?: string | null;
43
+ maximumRowsRead?: number;
44
+ maximumBytesRead?: number;
45
+ numItems: number;
46
+ cursor: string | null;
47
+ };
48
+ }, Promise<{
49
+ page: {
50
+ lastAgentName: string | undefined;
51
+ latestMessage: string | undefined;
52
+ lastMessageAt: number;
53
+ _creationTime: number;
54
+ _id: string;
55
+ status: "active" | "archived";
56
+ summary?: string;
57
+ title?: string;
58
+ userId?: string;
59
+ }[];
60
+ continueCursor: string;
61
+ isDone: boolean;
62
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
63
+ splitCursor?: string | null;
64
+ }>>;
65
+ listMessages: import("convex/server").RegisteredQuery<"public", {
66
+ streamArgs?: {
67
+ startOrder?: number | undefined;
68
+ kind: "list";
69
+ } | {
70
+ kind: "deltas";
71
+ cursors: {
72
+ streamId: string;
73
+ cursor: number;
74
+ }[];
75
+ } | undefined;
76
+ threadId: string;
77
+ apiKey: string;
78
+ paginationOpts: {
79
+ id?: number;
80
+ endCursor?: string | null;
81
+ maximumRowsRead?: number;
82
+ maximumBytesRead?: number;
83
+ numItems: number;
84
+ cursor: string | null;
85
+ };
86
+ }, Promise<{
87
+ streams: import("./types.js").SyncStreamsReturnValue;
88
+ page: {
89
+ id?: string | undefined;
90
+ userId?: string | undefined;
91
+ embeddingId?: string | undefined;
92
+ fileIds?: string[] | undefined;
93
+ error?: string | undefined;
94
+ agentName?: string | undefined;
95
+ model?: string | undefined;
96
+ provider?: string | undefined;
97
+ providerOptions?: Record<string, Record<string, any>> | undefined;
98
+ message?: {
99
+ providerOptions?: Record<string, Record<string, any>> | undefined;
100
+ role: "user";
101
+ content: string | ({
102
+ providerOptions?: Record<string, Record<string, any>> | undefined;
103
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
104
+ type: "text";
105
+ text: string;
106
+ } | {
107
+ providerOptions?: Record<string, Record<string, any>> | undefined;
108
+ mediaType?: string | undefined;
109
+ mimeType?: string | undefined;
110
+ type: "image";
111
+ image: string | ArrayBuffer;
112
+ } | {
113
+ providerOptions?: Record<string, Record<string, any>> | undefined;
114
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
115
+ mediaType?: string | undefined;
116
+ mimeType?: string | undefined;
117
+ filename?: string | undefined;
118
+ type: "file";
119
+ data: string | ArrayBuffer;
120
+ })[];
121
+ } | {
122
+ providerOptions?: Record<string, Record<string, any>> | undefined;
123
+ role: "assistant";
124
+ content: string | ({
125
+ providerOptions?: Record<string, Record<string, any>> | undefined;
126
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
127
+ type: "text";
128
+ text: string;
129
+ } | {
130
+ providerOptions?: Record<string, Record<string, any>> | undefined;
131
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
132
+ mediaType?: string | undefined;
133
+ mimeType?: string | undefined;
134
+ filename?: string | undefined;
135
+ type: "file";
136
+ data: string | ArrayBuffer;
137
+ } | {
138
+ providerOptions?: Record<string, Record<string, any>> | undefined;
139
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
140
+ signature?: string | undefined;
141
+ type: "reasoning";
142
+ text: string;
143
+ } | {
144
+ providerOptions?: Record<string, Record<string, any>> | undefined;
145
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
146
+ type: "redacted-reasoning";
147
+ data: string;
148
+ } | {
149
+ providerOptions?: Record<string, Record<string, any>> | undefined;
150
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
151
+ args?: any;
152
+ providerExecuted?: boolean | undefined;
153
+ type: "tool-call";
154
+ toolCallId: string;
155
+ toolName: string;
156
+ input: any;
157
+ } | {
158
+ providerOptions?: Record<string, Record<string, any>> | undefined;
159
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
160
+ input?: any;
161
+ providerExecuted?: boolean | undefined;
162
+ type: "tool-call";
163
+ toolCallId: string;
164
+ toolName: string;
165
+ args: any;
166
+ } | {
167
+ providerOptions?: Record<string, Record<string, any>> | undefined;
168
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
169
+ args?: any;
170
+ providerExecuted?: boolean | undefined;
171
+ output?: {
172
+ providerOptions?: Record<string, Record<string, any>> | undefined;
173
+ type: "text";
174
+ value: string;
175
+ } | {
176
+ providerOptions?: Record<string, Record<string, any>> | undefined;
177
+ type: "json";
178
+ value: any;
179
+ } | {
180
+ providerOptions?: Record<string, Record<string, any>> | undefined;
181
+ type: "error-text";
182
+ value: string;
183
+ } | {
184
+ providerOptions?: Record<string, Record<string, any>> | undefined;
185
+ type: "error-json";
186
+ value: any;
187
+ } | {
188
+ providerOptions?: Record<string, Record<string, any>> | undefined;
189
+ reason?: string | undefined;
190
+ type: "execution-denied";
191
+ } | {
192
+ type: "content";
193
+ value: ({
194
+ providerOptions?: Record<string, Record<string, any>> | undefined;
195
+ type: "text";
196
+ text: string;
197
+ } | {
198
+ type: "media";
199
+ mediaType: string;
200
+ data: string;
201
+ } | {
202
+ providerOptions?: Record<string, Record<string, any>> | undefined;
203
+ filename?: string | undefined;
204
+ type: "file-data";
205
+ mediaType: string;
206
+ data: string;
207
+ } | {
208
+ providerOptions?: Record<string, Record<string, any>> | undefined;
209
+ type: "file-url";
210
+ url: string;
211
+ } | {
212
+ providerOptions?: Record<string, Record<string, any>> | undefined;
213
+ type: "file-id";
214
+ fileId: string | Record<string, string>;
215
+ } | {
216
+ providerOptions?: Record<string, Record<string, any>> | undefined;
217
+ type: "image-data";
218
+ mediaType: string;
219
+ data: string;
220
+ } | {
221
+ providerOptions?: Record<string, Record<string, any>> | undefined;
222
+ type: "image-url";
223
+ url: string;
224
+ } | {
225
+ providerOptions?: Record<string, Record<string, any>> | undefined;
226
+ type: "image-file-id";
227
+ fileId: string | Record<string, string>;
228
+ } | {
229
+ providerOptions?: Record<string, Record<string, any>> | undefined;
230
+ type: "custom";
231
+ })[];
232
+ } | undefined;
233
+ result?: any;
234
+ isError?: boolean | undefined;
235
+ experimental_content?: ({
236
+ type: "text";
237
+ text: string;
238
+ } | {
239
+ mimeType?: string | undefined;
240
+ type: "image";
241
+ data: string;
242
+ })[] | undefined;
243
+ type: "tool-result";
244
+ toolCallId: string;
245
+ toolName: string;
246
+ } | {
247
+ title?: string | undefined;
248
+ providerOptions?: Record<string, Record<string, any>> | undefined;
249
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
250
+ id: string;
251
+ type: "source";
252
+ url: string;
253
+ sourceType: "url";
254
+ } | {
255
+ providerOptions?: Record<string, Record<string, any>> | undefined;
256
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
257
+ filename?: string | undefined;
258
+ id: string;
259
+ title: string;
260
+ type: "source";
261
+ mediaType: string;
262
+ sourceType: "document";
263
+ } | {
264
+ providerOptions?: Record<string, Record<string, any>> | undefined;
265
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
266
+ type: "tool-approval-request";
267
+ toolCallId: string;
268
+ approvalId: string;
269
+ })[];
270
+ } | {
271
+ providerOptions?: Record<string, Record<string, any>> | undefined;
272
+ role: "tool";
273
+ content: ({
274
+ providerOptions?: Record<string, Record<string, any>> | undefined;
275
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
276
+ args?: any;
277
+ providerExecuted?: boolean | undefined;
278
+ output?: {
279
+ providerOptions?: Record<string, Record<string, any>> | undefined;
280
+ type: "text";
281
+ value: string;
282
+ } | {
283
+ providerOptions?: Record<string, Record<string, any>> | undefined;
284
+ type: "json";
285
+ value: any;
286
+ } | {
287
+ providerOptions?: Record<string, Record<string, any>> | undefined;
288
+ type: "error-text";
289
+ value: string;
290
+ } | {
291
+ providerOptions?: Record<string, Record<string, any>> | undefined;
292
+ type: "error-json";
293
+ value: any;
294
+ } | {
295
+ providerOptions?: Record<string, Record<string, any>> | undefined;
296
+ reason?: string | undefined;
297
+ type: "execution-denied";
298
+ } | {
299
+ type: "content";
300
+ value: ({
301
+ providerOptions?: Record<string, Record<string, any>> | undefined;
302
+ type: "text";
303
+ text: string;
304
+ } | {
305
+ type: "media";
306
+ mediaType: string;
307
+ data: string;
308
+ } | {
309
+ providerOptions?: Record<string, Record<string, any>> | undefined;
310
+ filename?: string | undefined;
311
+ type: "file-data";
312
+ mediaType: string;
313
+ data: string;
314
+ } | {
315
+ providerOptions?: Record<string, Record<string, any>> | undefined;
316
+ type: "file-url";
317
+ url: string;
318
+ } | {
319
+ providerOptions?: Record<string, Record<string, any>> | undefined;
320
+ type: "file-id";
321
+ fileId: string | Record<string, string>;
322
+ } | {
323
+ providerOptions?: Record<string, Record<string, any>> | undefined;
324
+ type: "image-data";
325
+ mediaType: string;
326
+ data: string;
327
+ } | {
328
+ providerOptions?: Record<string, Record<string, any>> | undefined;
329
+ type: "image-url";
330
+ url: string;
331
+ } | {
332
+ providerOptions?: Record<string, Record<string, any>> | undefined;
333
+ type: "image-file-id";
334
+ fileId: string | Record<string, string>;
335
+ } | {
336
+ providerOptions?: Record<string, Record<string, any>> | undefined;
337
+ type: "custom";
338
+ })[];
339
+ } | undefined;
340
+ result?: any;
341
+ isError?: boolean | undefined;
342
+ experimental_content?: ({
343
+ type: "text";
344
+ text: string;
345
+ } | {
346
+ mimeType?: string | undefined;
347
+ type: "image";
348
+ data: string;
349
+ })[] | undefined;
350
+ type: "tool-result";
351
+ toolCallId: string;
352
+ toolName: string;
353
+ } | {
354
+ providerOptions?: Record<string, Record<string, any>> | undefined;
355
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
356
+ providerExecuted?: boolean | undefined;
357
+ reason?: string | undefined;
358
+ type: "tool-approval-response";
359
+ approvalId: string;
360
+ approved: boolean;
361
+ })[];
362
+ } | {
363
+ providerOptions?: Record<string, Record<string, any>> | undefined;
364
+ role: "system";
365
+ content: string;
366
+ } | undefined;
367
+ text?: string | undefined;
368
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
369
+ reasoning?: string | undefined;
370
+ usage?: {
371
+ reasoningTokens?: number | undefined;
372
+ cachedInputTokens?: number | undefined;
373
+ promptTokens: number;
374
+ completionTokens: number;
375
+ totalTokens: number;
376
+ } | undefined;
377
+ sources?: ({
378
+ title?: string | undefined;
379
+ type?: "source" | undefined;
380
+ providerOptions?: Record<string, Record<string, any>> | undefined;
381
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
382
+ id: string;
383
+ url: string;
384
+ sourceType: "url";
385
+ } | {
386
+ providerOptions?: Record<string, Record<string, any>> | undefined;
387
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
388
+ filename?: string | undefined;
389
+ id: string;
390
+ title: string;
391
+ type: "source";
392
+ mediaType: string;
393
+ sourceType: "document";
394
+ })[] | undefined;
395
+ warnings?: ({
396
+ details?: string | undefined;
397
+ type: "unsupported-setting";
398
+ setting: string;
399
+ } | {
400
+ details?: string | undefined;
401
+ type: "unsupported-tool";
402
+ tool: any;
403
+ } | {
404
+ type: "other";
405
+ message: string;
406
+ })[] | undefined;
407
+ finishReason?: "error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
408
+ reasoningDetails?: ({
409
+ providerOptions?: Record<string, Record<string, any>> | undefined;
410
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
411
+ signature?: string | undefined;
412
+ type: "reasoning";
413
+ text: string;
414
+ } | {
415
+ signature?: string | undefined;
416
+ type: "text";
417
+ text: string;
418
+ } | {
419
+ type: "redacted";
420
+ data: string;
421
+ })[] | undefined;
422
+ status: "pending" | "success" | "failed";
423
+ order: number;
424
+ _creationTime: number;
425
+ threadId: string;
426
+ stepOrder: number;
427
+ tool: boolean;
428
+ _id: string;
429
+ }[];
430
+ isDone: boolean;
431
+ continueCursor: import("convex/server").Cursor;
432
+ splitCursor?: import("convex/server").Cursor | null;
433
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
434
+ }>>;
435
+ listAgents: import("convex/server").RegisteredQuery<"public", {
436
+ userId?: string | undefined;
437
+ threadId?: string | undefined;
438
+ apiKey: string;
439
+ }, Promise<{
440
+ name: string;
441
+ instructions: string | undefined;
442
+ contextOptions: import("./types.js").ContextOptions | undefined;
443
+ storageOptions: import("./types.js").StorageOptions | undefined;
444
+ maxRetries: number | undefined;
445
+ tools: string[];
446
+ }[]>>;
447
+ createThread: import("convex/server").RegisteredMutation<"public", {
448
+ title?: string | undefined;
449
+ summary?: string | undefined;
450
+ agentName?: string | undefined;
451
+ userId: string;
452
+ apiKey: string;
453
+ }, Promise<{
454
+ threadId: string;
455
+ }>>;
456
+ generateText: import("convex/server").RegisteredAction<"public", {
457
+ system?: string | undefined;
458
+ messages?: ({
459
+ providerOptions?: Record<string, Record<string, any>> | undefined;
460
+ role: "user";
461
+ content: string | ({
462
+ providerOptions?: Record<string, Record<string, any>> | undefined;
463
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
464
+ type: "text";
465
+ text: string;
466
+ } | {
467
+ providerOptions?: Record<string, Record<string, any>> | undefined;
468
+ mediaType?: string | undefined;
469
+ mimeType?: string | undefined;
470
+ type: "image";
471
+ image: string | ArrayBuffer;
472
+ } | {
473
+ providerOptions?: Record<string, Record<string, any>> | undefined;
474
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
475
+ mediaType?: string | undefined;
476
+ mimeType?: string | undefined;
477
+ filename?: string | undefined;
478
+ type: "file";
479
+ data: string | ArrayBuffer;
480
+ })[];
481
+ } | {
482
+ providerOptions?: Record<string, Record<string, any>> | undefined;
483
+ role: "assistant";
484
+ content: string | ({
485
+ providerOptions?: Record<string, Record<string, any>> | undefined;
486
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
487
+ type: "text";
488
+ text: string;
489
+ } | {
490
+ providerOptions?: Record<string, Record<string, any>> | undefined;
491
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
492
+ mediaType?: string | undefined;
493
+ mimeType?: string | undefined;
494
+ filename?: string | undefined;
495
+ type: "file";
496
+ data: string | ArrayBuffer;
497
+ } | {
498
+ providerOptions?: Record<string, Record<string, any>> | undefined;
499
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
500
+ signature?: string | undefined;
501
+ type: "reasoning";
502
+ text: string;
503
+ } | {
504
+ providerOptions?: Record<string, Record<string, any>> | undefined;
505
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
506
+ type: "redacted-reasoning";
507
+ data: string;
508
+ } | {
509
+ providerOptions?: Record<string, Record<string, any>> | undefined;
510
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
511
+ args?: any;
512
+ providerExecuted?: boolean | undefined;
513
+ type: "tool-call";
514
+ toolCallId: string;
515
+ toolName: string;
516
+ input: any;
517
+ } | {
518
+ providerOptions?: Record<string, Record<string, any>> | undefined;
519
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
520
+ input?: any;
521
+ providerExecuted?: boolean | undefined;
522
+ type: "tool-call";
523
+ toolCallId: string;
524
+ toolName: string;
525
+ args: any;
526
+ } | {
527
+ providerOptions?: Record<string, Record<string, any>> | undefined;
528
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
529
+ args?: any;
530
+ providerExecuted?: boolean | undefined;
531
+ output?: {
532
+ providerOptions?: Record<string, Record<string, any>> | undefined;
533
+ type: "text";
534
+ value: string;
535
+ } | {
536
+ providerOptions?: Record<string, Record<string, any>> | undefined;
537
+ type: "json";
538
+ value: any;
539
+ } | {
540
+ providerOptions?: Record<string, Record<string, any>> | undefined;
541
+ type: "error-text";
542
+ value: string;
543
+ } | {
544
+ providerOptions?: Record<string, Record<string, any>> | undefined;
545
+ type: "error-json";
546
+ value: any;
547
+ } | {
548
+ providerOptions?: Record<string, Record<string, any>> | undefined;
549
+ reason?: string | undefined;
550
+ type: "execution-denied";
551
+ } | {
552
+ type: "content";
553
+ value: ({
554
+ providerOptions?: Record<string, Record<string, any>> | undefined;
555
+ type: "text";
556
+ text: string;
557
+ } | {
558
+ type: "media";
559
+ mediaType: string;
560
+ data: string;
561
+ } | {
562
+ providerOptions?: Record<string, Record<string, any>> | undefined;
563
+ filename?: string | undefined;
564
+ type: "file-data";
565
+ mediaType: string;
566
+ data: string;
567
+ } | {
568
+ providerOptions?: Record<string, Record<string, any>> | undefined;
569
+ type: "file-url";
570
+ url: string;
571
+ } | {
572
+ providerOptions?: Record<string, Record<string, any>> | undefined;
573
+ type: "file-id";
574
+ fileId: string | Record<string, string>;
575
+ } | {
576
+ providerOptions?: Record<string, Record<string, any>> | undefined;
577
+ type: "image-data";
578
+ mediaType: string;
579
+ data: string;
580
+ } | {
581
+ providerOptions?: Record<string, Record<string, any>> | undefined;
582
+ type: "image-url";
583
+ url: string;
584
+ } | {
585
+ providerOptions?: Record<string, Record<string, any>> | undefined;
586
+ type: "image-file-id";
587
+ fileId: string | Record<string, string>;
588
+ } | {
589
+ providerOptions?: Record<string, Record<string, any>> | undefined;
590
+ type: "custom";
591
+ })[];
592
+ } | undefined;
593
+ result?: any;
594
+ isError?: boolean | undefined;
595
+ experimental_content?: ({
596
+ type: "text";
597
+ text: string;
598
+ } | {
599
+ mimeType?: string | undefined;
600
+ type: "image";
601
+ data: string;
602
+ })[] | undefined;
603
+ type: "tool-result";
604
+ toolCallId: string;
605
+ toolName: string;
606
+ } | {
607
+ title?: string | undefined;
608
+ providerOptions?: Record<string, Record<string, any>> | undefined;
609
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
610
+ id: string;
611
+ type: "source";
612
+ url: string;
613
+ sourceType: "url";
614
+ } | {
615
+ providerOptions?: Record<string, Record<string, any>> | undefined;
616
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
617
+ filename?: string | undefined;
618
+ id: string;
619
+ title: string;
620
+ type: "source";
621
+ mediaType: string;
622
+ sourceType: "document";
623
+ } | {
624
+ providerOptions?: Record<string, Record<string, any>> | undefined;
625
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
626
+ type: "tool-approval-request";
627
+ toolCallId: string;
628
+ approvalId: string;
629
+ })[];
630
+ } | {
631
+ providerOptions?: Record<string, Record<string, any>> | undefined;
632
+ role: "tool";
633
+ content: ({
634
+ providerOptions?: Record<string, Record<string, any>> | undefined;
635
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
636
+ args?: any;
637
+ providerExecuted?: boolean | undefined;
638
+ output?: {
639
+ providerOptions?: Record<string, Record<string, any>> | undefined;
640
+ type: "text";
641
+ value: string;
642
+ } | {
643
+ providerOptions?: Record<string, Record<string, any>> | undefined;
644
+ type: "json";
645
+ value: any;
646
+ } | {
647
+ providerOptions?: Record<string, Record<string, any>> | undefined;
648
+ type: "error-text";
649
+ value: string;
650
+ } | {
651
+ providerOptions?: Record<string, Record<string, any>> | undefined;
652
+ type: "error-json";
653
+ value: any;
654
+ } | {
655
+ providerOptions?: Record<string, Record<string, any>> | undefined;
656
+ reason?: string | undefined;
657
+ type: "execution-denied";
658
+ } | {
659
+ type: "content";
660
+ value: ({
661
+ providerOptions?: Record<string, Record<string, any>> | undefined;
662
+ type: "text";
663
+ text: string;
664
+ } | {
665
+ type: "media";
666
+ mediaType: string;
667
+ data: string;
668
+ } | {
669
+ providerOptions?: Record<string, Record<string, any>> | undefined;
670
+ filename?: string | undefined;
671
+ type: "file-data";
672
+ mediaType: string;
673
+ data: string;
674
+ } | {
675
+ providerOptions?: Record<string, Record<string, any>> | undefined;
676
+ type: "file-url";
677
+ url: string;
678
+ } | {
679
+ providerOptions?: Record<string, Record<string, any>> | undefined;
680
+ type: "file-id";
681
+ fileId: string | Record<string, string>;
682
+ } | {
683
+ providerOptions?: Record<string, Record<string, any>> | undefined;
684
+ type: "image-data";
685
+ mediaType: string;
686
+ data: string;
687
+ } | {
688
+ providerOptions?: Record<string, Record<string, any>> | undefined;
689
+ type: "image-url";
690
+ url: string;
691
+ } | {
692
+ providerOptions?: Record<string, Record<string, any>> | undefined;
693
+ type: "image-file-id";
694
+ fileId: string | Record<string, string>;
695
+ } | {
696
+ providerOptions?: Record<string, Record<string, any>> | undefined;
697
+ type: "custom";
698
+ })[];
699
+ } | undefined;
700
+ result?: any;
701
+ isError?: boolean | undefined;
702
+ experimental_content?: ({
703
+ type: "text";
704
+ text: string;
705
+ } | {
706
+ mimeType?: string | undefined;
707
+ type: "image";
708
+ data: string;
709
+ })[] | undefined;
710
+ type: "tool-result";
711
+ toolCallId: string;
712
+ toolName: string;
713
+ } | {
714
+ providerOptions?: Record<string, Record<string, any>> | undefined;
715
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
716
+ providerExecuted?: boolean | undefined;
717
+ reason?: string | undefined;
718
+ type: "tool-approval-response";
719
+ approvalId: string;
720
+ approved: boolean;
721
+ })[];
722
+ } | {
723
+ providerOptions?: Record<string, Record<string, any>> | undefined;
724
+ role: "system";
725
+ content: string;
726
+ })[] | undefined;
727
+ prompt?: string | undefined;
728
+ contextOptions?: {
729
+ excludeToolMessages?: boolean | undefined;
730
+ recentMessages?: number | undefined;
731
+ searchOptions?: {
732
+ textSearch?: boolean | undefined;
733
+ vectorSearch?: boolean | undefined;
734
+ vectorScoreThreshold?: number | undefined;
735
+ messageRange?: {
736
+ before: number;
737
+ after: number;
738
+ } | undefined;
739
+ limit: number;
740
+ } | undefined;
741
+ searchOtherThreads?: boolean | undefined;
742
+ } | undefined;
743
+ storageOptions?: {
744
+ saveMessages?: "all" | "none" | "promptAndOutput" | undefined;
745
+ } | undefined;
746
+ userId: string;
747
+ threadId: string;
748
+ agentName: string;
749
+ apiKey: string;
750
+ }, Promise<{
751
+ text: string;
752
+ messages: {
753
+ tool: boolean;
754
+ text: string | undefined;
755
+ status: "success";
756
+ providerMetadata: {};
757
+ threadId: string;
758
+ _id: `${string}-${string}-${string}-${string}-${string}`;
759
+ _creationTime: number;
760
+ order: number;
761
+ stepOrder: number;
762
+ fileIds?: string[] | undefined;
763
+ error?: string | undefined;
764
+ model?: string | undefined;
765
+ provider?: string | undefined;
766
+ reasoning?: string | undefined;
767
+ usage?: {
768
+ reasoningTokens?: number | undefined;
769
+ cachedInputTokens?: number | undefined;
770
+ promptTokens: number;
771
+ completionTokens: number;
772
+ totalTokens: number;
773
+ } | undefined;
774
+ sources?: ({
775
+ title?: string | undefined;
776
+ type?: "source" | undefined;
777
+ providerOptions?: Record<string, Record<string, any>> | undefined;
778
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
779
+ id: string;
780
+ url: string;
781
+ sourceType: "url";
782
+ } | {
783
+ providerOptions?: Record<string, Record<string, any>> | undefined;
784
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
785
+ filename?: string | undefined;
786
+ id: string;
787
+ title: string;
788
+ type: "source";
789
+ mediaType: string;
790
+ sourceType: "document";
791
+ })[] | undefined;
792
+ warnings?: ({
793
+ details?: string | undefined;
794
+ type: "unsupported-setting";
795
+ setting: string;
796
+ } | {
797
+ details?: string | undefined;
798
+ type: "unsupported-tool";
799
+ tool: any;
800
+ } | {
801
+ type: "other";
802
+ message: string;
803
+ })[] | undefined;
804
+ finishReason?: "error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
805
+ reasoningDetails?: ({
806
+ providerOptions?: Record<string, Record<string, any>> | undefined;
807
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
808
+ signature?: string | undefined;
809
+ type: "reasoning";
810
+ text: string;
811
+ } | {
812
+ signature?: string | undefined;
813
+ type: "text";
814
+ text: string;
815
+ } | {
816
+ type: "redacted";
817
+ data: string;
818
+ })[] | undefined;
819
+ message: {
820
+ providerOptions?: Record<string, Record<string, any>> | undefined;
821
+ role: "user";
822
+ content: string | ({
823
+ providerOptions?: Record<string, Record<string, any>> | undefined;
824
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
825
+ type: "text";
826
+ text: string;
827
+ } | {
828
+ providerOptions?: Record<string, Record<string, any>> | undefined;
829
+ mediaType?: string | undefined;
830
+ mimeType?: string | undefined;
831
+ type: "image";
832
+ image: string | ArrayBuffer;
833
+ } | {
834
+ providerOptions?: Record<string, Record<string, any>> | undefined;
835
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
836
+ mediaType?: string | undefined;
837
+ mimeType?: string | undefined;
838
+ filename?: string | undefined;
839
+ type: "file";
840
+ data: string | ArrayBuffer;
841
+ })[];
842
+ } | {
843
+ providerOptions?: Record<string, Record<string, any>> | undefined;
844
+ role: "assistant";
845
+ content: string | ({
846
+ providerOptions?: Record<string, Record<string, any>> | undefined;
847
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
848
+ type: "text";
849
+ text: string;
850
+ } | {
851
+ providerOptions?: Record<string, Record<string, any>> | undefined;
852
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
853
+ mediaType?: string | undefined;
854
+ mimeType?: string | undefined;
855
+ filename?: string | undefined;
856
+ type: "file";
857
+ data: string | ArrayBuffer;
858
+ } | {
859
+ providerOptions?: Record<string, Record<string, any>> | undefined;
860
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
861
+ signature?: string | undefined;
862
+ type: "reasoning";
863
+ text: string;
864
+ } | {
865
+ providerOptions?: Record<string, Record<string, any>> | undefined;
866
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
867
+ type: "redacted-reasoning";
868
+ data: string;
869
+ } | {
870
+ providerOptions?: Record<string, Record<string, any>> | undefined;
871
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
872
+ args?: any;
873
+ providerExecuted?: boolean | undefined;
874
+ type: "tool-call";
875
+ toolCallId: string;
876
+ toolName: string;
877
+ input: any;
878
+ } | {
879
+ providerOptions?: Record<string, Record<string, any>> | undefined;
880
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
881
+ input?: any;
882
+ providerExecuted?: boolean | undefined;
883
+ type: "tool-call";
884
+ toolCallId: string;
885
+ toolName: string;
886
+ args: any;
887
+ } | {
888
+ providerOptions?: Record<string, Record<string, any>> | undefined;
889
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
890
+ args?: any;
891
+ providerExecuted?: boolean | undefined;
892
+ output?: {
893
+ providerOptions?: Record<string, Record<string, any>> | undefined;
894
+ type: "text";
895
+ value: string;
896
+ } | {
897
+ providerOptions?: Record<string, Record<string, any>> | undefined;
898
+ type: "json";
899
+ value: any;
900
+ } | {
901
+ providerOptions?: Record<string, Record<string, any>> | undefined;
902
+ type: "error-text";
903
+ value: string;
904
+ } | {
905
+ providerOptions?: Record<string, Record<string, any>> | undefined;
906
+ type: "error-json";
907
+ value: any;
908
+ } | {
909
+ providerOptions?: Record<string, Record<string, any>> | undefined;
910
+ reason?: string | undefined;
911
+ type: "execution-denied";
912
+ } | {
913
+ type: "content";
914
+ value: ({
915
+ providerOptions?: Record<string, Record<string, any>> | undefined;
916
+ type: "text";
917
+ text: string;
918
+ } | {
919
+ type: "media";
920
+ mediaType: string;
921
+ data: string;
922
+ } | {
923
+ providerOptions?: Record<string, Record<string, any>> | undefined;
924
+ filename?: string | undefined;
925
+ type: "file-data";
926
+ mediaType: string;
927
+ data: string;
928
+ } | {
929
+ providerOptions?: Record<string, Record<string, any>> | undefined;
930
+ type: "file-url";
931
+ url: string;
932
+ } | {
933
+ providerOptions?: Record<string, Record<string, any>> | undefined;
934
+ type: "file-id";
935
+ fileId: string | Record<string, string>;
936
+ } | {
937
+ providerOptions?: Record<string, Record<string, any>> | undefined;
938
+ type: "image-data";
939
+ mediaType: string;
940
+ data: string;
941
+ } | {
942
+ providerOptions?: Record<string, Record<string, any>> | undefined;
943
+ type: "image-url";
944
+ url: string;
945
+ } | {
946
+ providerOptions?: Record<string, Record<string, any>> | undefined;
947
+ type: "image-file-id";
948
+ fileId: string | Record<string, string>;
949
+ } | {
950
+ providerOptions?: Record<string, Record<string, any>> | undefined;
951
+ type: "custom";
952
+ })[];
953
+ } | undefined;
954
+ result?: any;
955
+ isError?: boolean | undefined;
956
+ experimental_content?: ({
957
+ type: "text";
958
+ text: string;
959
+ } | {
960
+ mimeType?: string | undefined;
961
+ type: "image";
962
+ data: string;
963
+ })[] | undefined;
964
+ type: "tool-result";
965
+ toolCallId: string;
966
+ toolName: string;
967
+ } | {
968
+ title?: string | undefined;
969
+ providerOptions?: Record<string, Record<string, any>> | undefined;
970
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
971
+ id: string;
972
+ type: "source";
973
+ url: string;
974
+ sourceType: "url";
975
+ } | {
976
+ providerOptions?: Record<string, Record<string, any>> | undefined;
977
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
978
+ filename?: string | undefined;
979
+ id: string;
980
+ title: string;
981
+ type: "source";
982
+ mediaType: string;
983
+ sourceType: "document";
984
+ } | {
985
+ providerOptions?: Record<string, Record<string, any>> | undefined;
986
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
987
+ type: "tool-approval-request";
988
+ toolCallId: string;
989
+ approvalId: string;
990
+ })[];
991
+ } | {
992
+ providerOptions?: Record<string, Record<string, any>> | undefined;
993
+ role: "tool";
994
+ content: ({
995
+ providerOptions?: Record<string, Record<string, any>> | undefined;
996
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
997
+ args?: any;
998
+ providerExecuted?: boolean | undefined;
999
+ output?: {
1000
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1001
+ type: "text";
1002
+ value: string;
1003
+ } | {
1004
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1005
+ type: "json";
1006
+ value: any;
1007
+ } | {
1008
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1009
+ type: "error-text";
1010
+ value: string;
1011
+ } | {
1012
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1013
+ type: "error-json";
1014
+ value: any;
1015
+ } | {
1016
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1017
+ reason?: string | undefined;
1018
+ type: "execution-denied";
1019
+ } | {
1020
+ type: "content";
1021
+ value: ({
1022
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1023
+ type: "text";
1024
+ text: string;
1025
+ } | {
1026
+ type: "media";
1027
+ mediaType: string;
1028
+ data: string;
1029
+ } | {
1030
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1031
+ filename?: string | undefined;
1032
+ type: "file-data";
1033
+ mediaType: string;
1034
+ data: string;
1035
+ } | {
1036
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1037
+ type: "file-url";
1038
+ url: string;
1039
+ } | {
1040
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1041
+ type: "file-id";
1042
+ fileId: string | Record<string, string>;
1043
+ } | {
1044
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1045
+ type: "image-data";
1046
+ mediaType: string;
1047
+ data: string;
1048
+ } | {
1049
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1050
+ type: "image-url";
1051
+ url: string;
1052
+ } | {
1053
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1054
+ type: "image-file-id";
1055
+ fileId: string | Record<string, string>;
1056
+ } | {
1057
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1058
+ type: "custom";
1059
+ })[];
1060
+ } | undefined;
1061
+ result?: any;
1062
+ isError?: boolean | undefined;
1063
+ experimental_content?: ({
1064
+ type: "text";
1065
+ text: string;
1066
+ } | {
1067
+ mimeType?: string | undefined;
1068
+ type: "image";
1069
+ data: string;
1070
+ })[] | undefined;
1071
+ type: "tool-result";
1072
+ toolCallId: string;
1073
+ toolName: string;
1074
+ } | {
1075
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1076
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1077
+ providerExecuted?: boolean | undefined;
1078
+ reason?: string | undefined;
1079
+ type: "tool-approval-response";
1080
+ approvalId: string;
1081
+ approved: boolean;
1082
+ })[];
1083
+ } | {
1084
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1085
+ role: "system";
1086
+ content: string;
1087
+ };
1088
+ }[];
1089
+ }>>;
1090
+ fetchPromptContext: import("convex/server").RegisteredAction<"public", {
1091
+ userId?: string | undefined;
1092
+ threadId?: string | undefined;
1093
+ messages?: ({
1094
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1095
+ role: "user";
1096
+ content: string | ({
1097
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1098
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1099
+ type: "text";
1100
+ text: string;
1101
+ } | {
1102
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1103
+ mediaType?: string | undefined;
1104
+ mimeType?: string | undefined;
1105
+ type: "image";
1106
+ image: string | ArrayBuffer;
1107
+ } | {
1108
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1109
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1110
+ mediaType?: string | undefined;
1111
+ mimeType?: string | undefined;
1112
+ filename?: string | undefined;
1113
+ type: "file";
1114
+ data: string | ArrayBuffer;
1115
+ })[];
1116
+ } | {
1117
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1118
+ role: "assistant";
1119
+ content: string | ({
1120
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1121
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1122
+ type: "text";
1123
+ text: string;
1124
+ } | {
1125
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1126
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1127
+ mediaType?: string | undefined;
1128
+ mimeType?: string | undefined;
1129
+ filename?: string | undefined;
1130
+ type: "file";
1131
+ data: string | ArrayBuffer;
1132
+ } | {
1133
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1134
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1135
+ signature?: string | undefined;
1136
+ type: "reasoning";
1137
+ text: string;
1138
+ } | {
1139
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1140
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1141
+ type: "redacted-reasoning";
1142
+ data: string;
1143
+ } | {
1144
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1145
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1146
+ args?: any;
1147
+ providerExecuted?: boolean | undefined;
1148
+ type: "tool-call";
1149
+ toolCallId: string;
1150
+ toolName: string;
1151
+ input: any;
1152
+ } | {
1153
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1154
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1155
+ input?: any;
1156
+ providerExecuted?: boolean | undefined;
1157
+ type: "tool-call";
1158
+ toolCallId: string;
1159
+ toolName: string;
1160
+ args: any;
1161
+ } | {
1162
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1163
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1164
+ args?: any;
1165
+ providerExecuted?: boolean | undefined;
1166
+ output?: {
1167
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1168
+ type: "text";
1169
+ value: string;
1170
+ } | {
1171
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1172
+ type: "json";
1173
+ value: any;
1174
+ } | {
1175
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1176
+ type: "error-text";
1177
+ value: string;
1178
+ } | {
1179
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1180
+ type: "error-json";
1181
+ value: any;
1182
+ } | {
1183
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1184
+ reason?: string | undefined;
1185
+ type: "execution-denied";
1186
+ } | {
1187
+ type: "content";
1188
+ value: ({
1189
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1190
+ type: "text";
1191
+ text: string;
1192
+ } | {
1193
+ type: "media";
1194
+ mediaType: string;
1195
+ data: string;
1196
+ } | {
1197
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1198
+ filename?: string | undefined;
1199
+ type: "file-data";
1200
+ mediaType: string;
1201
+ data: string;
1202
+ } | {
1203
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1204
+ type: "file-url";
1205
+ url: string;
1206
+ } | {
1207
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1208
+ type: "file-id";
1209
+ fileId: string | Record<string, string>;
1210
+ } | {
1211
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1212
+ type: "image-data";
1213
+ mediaType: string;
1214
+ data: string;
1215
+ } | {
1216
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1217
+ type: "image-url";
1218
+ url: string;
1219
+ } | {
1220
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1221
+ type: "image-file-id";
1222
+ fileId: string | Record<string, string>;
1223
+ } | {
1224
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1225
+ type: "custom";
1226
+ })[];
1227
+ } | undefined;
1228
+ result?: any;
1229
+ isError?: boolean | undefined;
1230
+ experimental_content?: ({
1231
+ type: "text";
1232
+ text: string;
1233
+ } | {
1234
+ mimeType?: string | undefined;
1235
+ type: "image";
1236
+ data: string;
1237
+ })[] | undefined;
1238
+ type: "tool-result";
1239
+ toolCallId: string;
1240
+ toolName: string;
1241
+ } | {
1242
+ title?: string | undefined;
1243
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1244
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1245
+ id: string;
1246
+ type: "source";
1247
+ url: string;
1248
+ sourceType: "url";
1249
+ } | {
1250
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1251
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1252
+ filename?: string | undefined;
1253
+ id: string;
1254
+ title: string;
1255
+ type: "source";
1256
+ mediaType: string;
1257
+ sourceType: "document";
1258
+ } | {
1259
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1260
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1261
+ type: "tool-approval-request";
1262
+ toolCallId: string;
1263
+ approvalId: string;
1264
+ })[];
1265
+ } | {
1266
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1267
+ role: "tool";
1268
+ content: ({
1269
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1270
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1271
+ args?: any;
1272
+ providerExecuted?: boolean | undefined;
1273
+ output?: {
1274
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1275
+ type: "text";
1276
+ value: string;
1277
+ } | {
1278
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1279
+ type: "json";
1280
+ value: any;
1281
+ } | {
1282
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1283
+ type: "error-text";
1284
+ value: string;
1285
+ } | {
1286
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1287
+ type: "error-json";
1288
+ value: any;
1289
+ } | {
1290
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1291
+ reason?: string | undefined;
1292
+ type: "execution-denied";
1293
+ } | {
1294
+ type: "content";
1295
+ value: ({
1296
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1297
+ type: "text";
1298
+ text: string;
1299
+ } | {
1300
+ type: "media";
1301
+ mediaType: string;
1302
+ data: string;
1303
+ } | {
1304
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1305
+ filename?: string | undefined;
1306
+ type: "file-data";
1307
+ mediaType: string;
1308
+ data: string;
1309
+ } | {
1310
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1311
+ type: "file-url";
1312
+ url: string;
1313
+ } | {
1314
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1315
+ type: "file-id";
1316
+ fileId: string | Record<string, string>;
1317
+ } | {
1318
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1319
+ type: "image-data";
1320
+ mediaType: string;
1321
+ data: string;
1322
+ } | {
1323
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1324
+ type: "image-url";
1325
+ url: string;
1326
+ } | {
1327
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1328
+ type: "image-file-id";
1329
+ fileId: string | Record<string, string>;
1330
+ } | {
1331
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1332
+ type: "custom";
1333
+ })[];
1334
+ } | undefined;
1335
+ result?: any;
1336
+ isError?: boolean | undefined;
1337
+ experimental_content?: ({
1338
+ type: "text";
1339
+ text: string;
1340
+ } | {
1341
+ mimeType?: string | undefined;
1342
+ type: "image";
1343
+ data: string;
1344
+ })[] | undefined;
1345
+ type: "tool-result";
1346
+ toolCallId: string;
1347
+ toolName: string;
1348
+ } | {
1349
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1350
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1351
+ providerExecuted?: boolean | undefined;
1352
+ reason?: string | undefined;
1353
+ type: "tool-approval-response";
1354
+ approvalId: string;
1355
+ approved: boolean;
1356
+ })[];
1357
+ } | {
1358
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1359
+ role: "system";
1360
+ content: string;
1361
+ })[] | undefined;
1362
+ targetMessageId?: string | undefined;
1363
+ beforeMessageId?: string | undefined;
1364
+ searchText?: string | undefined;
1365
+ agentName: string;
1366
+ contextOptions: {
1367
+ excludeToolMessages?: boolean | undefined;
1368
+ recentMessages?: number | undefined;
1369
+ searchOptions?: {
1370
+ textSearch?: boolean | undefined;
1371
+ vectorSearch?: boolean | undefined;
1372
+ vectorScoreThreshold?: number | undefined;
1373
+ messageRange?: {
1374
+ before: number;
1375
+ after: number;
1376
+ } | undefined;
1377
+ limit: number;
1378
+ } | undefined;
1379
+ searchOtherThreads?: boolean | undefined;
1380
+ };
1381
+ apiKey: string;
1382
+ }, Promise<{
1383
+ id?: string | undefined;
1384
+ userId?: string | undefined;
1385
+ embeddingId?: string | undefined;
1386
+ fileIds?: string[] | undefined;
1387
+ error?: string | undefined;
1388
+ agentName?: string | undefined;
1389
+ model?: string | undefined;
1390
+ provider?: string | undefined;
1391
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1392
+ message?: {
1393
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1394
+ role: "user";
1395
+ content: string | ({
1396
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1397
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1398
+ type: "text";
1399
+ text: string;
1400
+ } | {
1401
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1402
+ mediaType?: string | undefined;
1403
+ mimeType?: string | undefined;
1404
+ type: "image";
1405
+ image: string | ArrayBuffer;
1406
+ } | {
1407
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1408
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1409
+ mediaType?: string | undefined;
1410
+ mimeType?: string | undefined;
1411
+ filename?: string | undefined;
1412
+ type: "file";
1413
+ data: string | ArrayBuffer;
1414
+ })[];
1415
+ } | {
1416
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1417
+ role: "assistant";
1418
+ content: string | ({
1419
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1420
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1421
+ type: "text";
1422
+ text: string;
1423
+ } | {
1424
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1425
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1426
+ mediaType?: string | undefined;
1427
+ mimeType?: string | undefined;
1428
+ filename?: string | undefined;
1429
+ type: "file";
1430
+ data: string | ArrayBuffer;
1431
+ } | {
1432
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1433
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1434
+ signature?: string | undefined;
1435
+ type: "reasoning";
1436
+ text: string;
1437
+ } | {
1438
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1439
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1440
+ type: "redacted-reasoning";
1441
+ data: string;
1442
+ } | {
1443
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1444
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1445
+ args?: any;
1446
+ providerExecuted?: boolean | undefined;
1447
+ type: "tool-call";
1448
+ toolCallId: string;
1449
+ toolName: string;
1450
+ input: any;
1451
+ } | {
1452
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1453
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1454
+ input?: any;
1455
+ providerExecuted?: boolean | undefined;
1456
+ type: "tool-call";
1457
+ toolCallId: string;
1458
+ toolName: string;
1459
+ args: any;
1460
+ } | {
1461
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1462
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1463
+ args?: any;
1464
+ providerExecuted?: boolean | undefined;
1465
+ output?: {
1466
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1467
+ type: "text";
1468
+ value: string;
1469
+ } | {
1470
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1471
+ type: "json";
1472
+ value: any;
1473
+ } | {
1474
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1475
+ type: "error-text";
1476
+ value: string;
1477
+ } | {
1478
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1479
+ type: "error-json";
1480
+ value: any;
1481
+ } | {
1482
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1483
+ reason?: string | undefined;
1484
+ type: "execution-denied";
1485
+ } | {
1486
+ type: "content";
1487
+ value: ({
1488
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1489
+ type: "text";
1490
+ text: string;
1491
+ } | {
1492
+ type: "media";
1493
+ mediaType: string;
1494
+ data: string;
1495
+ } | {
1496
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1497
+ filename?: string | undefined;
1498
+ type: "file-data";
1499
+ mediaType: string;
1500
+ data: string;
1501
+ } | {
1502
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1503
+ type: "file-url";
1504
+ url: string;
1505
+ } | {
1506
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1507
+ type: "file-id";
1508
+ fileId: string | Record<string, string>;
1509
+ } | {
1510
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1511
+ type: "image-data";
1512
+ mediaType: string;
1513
+ data: string;
1514
+ } | {
1515
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1516
+ type: "image-url";
1517
+ url: string;
1518
+ } | {
1519
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1520
+ type: "image-file-id";
1521
+ fileId: string | Record<string, string>;
1522
+ } | {
1523
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1524
+ type: "custom";
1525
+ })[];
1526
+ } | undefined;
1527
+ result?: any;
1528
+ isError?: boolean | undefined;
1529
+ experimental_content?: ({
1530
+ type: "text";
1531
+ text: string;
1532
+ } | {
1533
+ mimeType?: string | undefined;
1534
+ type: "image";
1535
+ data: string;
1536
+ })[] | undefined;
1537
+ type: "tool-result";
1538
+ toolCallId: string;
1539
+ toolName: string;
1540
+ } | {
1541
+ title?: string | undefined;
1542
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1543
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1544
+ id: string;
1545
+ type: "source";
1546
+ url: string;
1547
+ sourceType: "url";
1548
+ } | {
1549
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1550
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1551
+ filename?: string | undefined;
1552
+ id: string;
1553
+ title: string;
1554
+ type: "source";
1555
+ mediaType: string;
1556
+ sourceType: "document";
1557
+ } | {
1558
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1559
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1560
+ type: "tool-approval-request";
1561
+ toolCallId: string;
1562
+ approvalId: string;
1563
+ })[];
1564
+ } | {
1565
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1566
+ role: "tool";
1567
+ content: ({
1568
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1569
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1570
+ args?: any;
1571
+ providerExecuted?: boolean | undefined;
1572
+ output?: {
1573
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1574
+ type: "text";
1575
+ value: string;
1576
+ } | {
1577
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1578
+ type: "json";
1579
+ value: any;
1580
+ } | {
1581
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1582
+ type: "error-text";
1583
+ value: string;
1584
+ } | {
1585
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1586
+ type: "error-json";
1587
+ value: any;
1588
+ } | {
1589
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1590
+ reason?: string | undefined;
1591
+ type: "execution-denied";
1592
+ } | {
1593
+ type: "content";
1594
+ value: ({
1595
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1596
+ type: "text";
1597
+ text: string;
1598
+ } | {
1599
+ type: "media";
1600
+ mediaType: string;
1601
+ data: string;
1602
+ } | {
1603
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1604
+ filename?: string | undefined;
1605
+ type: "file-data";
1606
+ mediaType: string;
1607
+ data: string;
1608
+ } | {
1609
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1610
+ type: "file-url";
1611
+ url: string;
1612
+ } | {
1613
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1614
+ type: "file-id";
1615
+ fileId: string | Record<string, string>;
1616
+ } | {
1617
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1618
+ type: "image-data";
1619
+ mediaType: string;
1620
+ data: string;
1621
+ } | {
1622
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1623
+ type: "image-url";
1624
+ url: string;
1625
+ } | {
1626
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1627
+ type: "image-file-id";
1628
+ fileId: string | Record<string, string>;
1629
+ } | {
1630
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1631
+ type: "custom";
1632
+ })[];
1633
+ } | undefined;
1634
+ result?: any;
1635
+ isError?: boolean | undefined;
1636
+ experimental_content?: ({
1637
+ type: "text";
1638
+ text: string;
1639
+ } | {
1640
+ mimeType?: string | undefined;
1641
+ type: "image";
1642
+ data: string;
1643
+ })[] | undefined;
1644
+ type: "tool-result";
1645
+ toolCallId: string;
1646
+ toolName: string;
1647
+ } | {
1648
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1649
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1650
+ providerExecuted?: boolean | undefined;
1651
+ reason?: string | undefined;
1652
+ type: "tool-approval-response";
1653
+ approvalId: string;
1654
+ approved: boolean;
1655
+ })[];
1656
+ } | {
1657
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1658
+ role: "system";
1659
+ content: string;
1660
+ } | undefined;
1661
+ text?: string | undefined;
1662
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1663
+ reasoning?: string | undefined;
1664
+ usage?: {
1665
+ reasoningTokens?: number | undefined;
1666
+ cachedInputTokens?: number | undefined;
1667
+ promptTokens: number;
1668
+ completionTokens: number;
1669
+ totalTokens: number;
1670
+ } | undefined;
1671
+ sources?: ({
1672
+ title?: string | undefined;
1673
+ type?: "source" | undefined;
1674
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1675
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1676
+ id: string;
1677
+ url: string;
1678
+ sourceType: "url";
1679
+ } | {
1680
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1681
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1682
+ filename?: string | undefined;
1683
+ id: string;
1684
+ title: string;
1685
+ type: "source";
1686
+ mediaType: string;
1687
+ sourceType: "document";
1688
+ })[] | undefined;
1689
+ warnings?: ({
1690
+ details?: string | undefined;
1691
+ type: "unsupported-setting";
1692
+ setting: string;
1693
+ } | {
1694
+ details?: string | undefined;
1695
+ type: "unsupported-tool";
1696
+ tool: any;
1697
+ } | {
1698
+ type: "other";
1699
+ message: string;
1700
+ })[] | undefined;
1701
+ finishReason?: "error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
1702
+ reasoningDetails?: ({
1703
+ providerOptions?: Record<string, Record<string, any>> | undefined;
1704
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1705
+ signature?: string | undefined;
1706
+ type: "reasoning";
1707
+ text: string;
1708
+ } | {
1709
+ signature?: string | undefined;
1710
+ type: "text";
1711
+ text: string;
1712
+ } | {
1713
+ type: "redacted";
1714
+ data: string;
1715
+ })[] | undefined;
1716
+ status: "pending" | "success" | "failed";
1717
+ order: number;
1718
+ _creationTime: number;
1719
+ threadId: string;
1720
+ stepOrder: number;
1721
+ tool: boolean;
1722
+ _id: string;
1723
+ }[]>>;
1724
+ };
1725
+ //# sourceMappingURL=definePlaygroundAPI.d.ts.map