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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/package.json +1 -1
  2. package/src/UIMessages.ts +135 -0
  3. package/src/client/index.ts +56 -14
  4. package/src/client/search.test.ts +4 -5
  5. package/src/client/search.ts +45 -4
  6. package/src/client/streaming.integration.test.ts +1206 -0
  7. package/src/client/streaming.ts +9 -2
  8. package/src/mapping.test.ts +136 -71
  9. package/src/mapping.ts +81 -28
  10. package/dist/UIMessages.d.ts +0 -46
  11. package/dist/UIMessages.d.ts.map +0 -1
  12. package/dist/UIMessages.js +0 -546
  13. package/dist/UIMessages.js.map +0 -1
  14. package/dist/client/createTool.d.ts +0 -167
  15. package/dist/client/createTool.d.ts.map +0 -1
  16. package/dist/client/createTool.js +0 -116
  17. package/dist/client/createTool.js.map +0 -1
  18. package/dist/client/defaultComponent.d.ts +0 -11
  19. package/dist/client/defaultComponent.d.ts.map +0 -1
  20. package/dist/client/defaultComponent.js +0 -7
  21. package/dist/client/defaultComponent.js.map +0 -1
  22. package/dist/client/definePlaygroundAPI.d.ts +0 -1725
  23. package/dist/client/definePlaygroundAPI.d.ts.map +0 -1
  24. package/dist/client/definePlaygroundAPI.js +0 -271
  25. package/dist/client/definePlaygroundAPI.js.map +0 -1
  26. package/dist/client/files.d.ts +0 -69
  27. package/dist/client/files.d.ts.map +0 -1
  28. package/dist/client/files.js +0 -181
  29. package/dist/client/files.js.map +0 -1
  30. package/dist/client/index.d.ts +0 -2091
  31. package/dist/client/index.d.ts.map +0 -1
  32. package/dist/client/index.js +0 -895
  33. package/dist/client/index.js.map +0 -1
  34. package/dist/client/messages.d.ts +0 -461
  35. package/dist/client/messages.d.ts.map +0 -1
  36. package/dist/client/messages.js +0 -106
  37. package/dist/client/messages.js.map +0 -1
  38. package/dist/client/mockModel.d.ts +0 -42
  39. package/dist/client/mockModel.d.ts.map +0 -1
  40. package/dist/client/mockModel.js +0 -182
  41. package/dist/client/mockModel.js.map +0 -1
  42. package/dist/client/saveInputMessages.d.ts +0 -20
  43. package/dist/client/saveInputMessages.d.ts.map +0 -1
  44. package/dist/client/saveInputMessages.js +0 -58
  45. package/dist/client/saveInputMessages.js.map +0 -1
  46. package/dist/client/search.d.ts +0 -493
  47. package/dist/client/search.d.ts.map +0 -1
  48. package/dist/client/search.js +0 -425
  49. package/dist/client/search.js.map +0 -1
  50. package/dist/client/start.d.ts +0 -84
  51. package/dist/client/start.d.ts.map +0 -1
  52. package/dist/client/start.js +0 -185
  53. package/dist/client/start.js.map +0 -1
  54. package/dist/client/streamText.d.ts +0 -46
  55. package/dist/client/streamText.d.ts.map +0 -1
  56. package/dist/client/streamText.js +0 -117
  57. package/dist/client/streamText.js.map +0 -1
  58. package/dist/client/streaming.d.ts +0 -3778
  59. package/dist/client/streaming.d.ts.map +0 -1
  60. package/dist/client/streaming.js +0 -314
  61. package/dist/client/streaming.js.map +0 -1
  62. package/dist/client/threads.d.ts +0 -46
  63. package/dist/client/threads.d.ts.map +0 -1
  64. package/dist/client/threads.js +0 -49
  65. package/dist/client/threads.js.map +0 -1
  66. package/dist/client/types.d.ts +0 -461
  67. package/dist/client/types.d.ts.map +0 -1
  68. package/dist/client/types.js +0 -2
  69. package/dist/client/types.js.map +0 -1
  70. package/dist/client/utils.d.ts +0 -4
  71. package/dist/client/utils.d.ts.map +0 -1
  72. package/dist/client/utils.js +0 -21
  73. package/dist/client/utils.js.map +0 -1
  74. package/dist/component/_generated/api.d.ts +0 -48
  75. package/dist/component/_generated/api.d.ts.map +0 -1
  76. package/dist/component/_generated/api.js +0 -31
  77. package/dist/component/_generated/api.js.map +0 -1
  78. package/dist/component/_generated/component.d.ts +0 -3120
  79. package/dist/component/_generated/component.d.ts.map +0 -1
  80. package/dist/component/_generated/component.js +0 -11
  81. package/dist/component/_generated/component.js.map +0 -1
  82. package/dist/component/_generated/dataModel.d.ts +0 -46
  83. package/dist/component/_generated/dataModel.d.ts.map +0 -1
  84. package/dist/component/_generated/dataModel.js +0 -11
  85. package/dist/component/_generated/dataModel.js.map +0 -1
  86. package/dist/component/_generated/server.d.ts +0 -121
  87. package/dist/component/_generated/server.d.ts.map +0 -1
  88. package/dist/component/_generated/server.js +0 -78
  89. package/dist/component/_generated/server.js.map +0 -1
  90. package/dist/component/apiKeys.d.ts +0 -11
  91. package/dist/component/apiKeys.d.ts.map +0 -1
  92. package/dist/component/apiKeys.js +0 -69
  93. package/dist/component/apiKeys.js.map +0 -1
  94. package/dist/component/convex.config.d.ts +0 -3
  95. package/dist/component/convex.config.d.ts.map +0 -1
  96. package/dist/component/convex.config.js +0 -3
  97. package/dist/component/convex.config.js.map +0 -1
  98. package/dist/component/files.d.ts +0 -97
  99. package/dist/component/files.d.ts.map +0 -1
  100. package/dist/component/files.js +0 -190
  101. package/dist/component/files.js.map +0 -1
  102. package/dist/component/messages.d.ts +0 -3851
  103. package/dist/component/messages.d.ts.map +0 -1
  104. package/dist/component/messages.js +0 -757
  105. package/dist/component/messages.js.map +0 -1
  106. package/dist/component/schema.d.ts +0 -8026
  107. package/dist/component/schema.d.ts.map +0 -1
  108. package/dist/component/schema.js +0 -147
  109. package/dist/component/schema.js.map +0 -1
  110. package/dist/component/streams.d.ts +0 -128
  111. package/dist/component/streams.d.ts.map +0 -1
  112. package/dist/component/streams.js +0 -413
  113. package/dist/component/streams.js.map +0 -1
  114. package/dist/component/threads.d.ts +0 -115
  115. package/dist/component/threads.d.ts.map +0 -1
  116. package/dist/component/threads.js +0 -208
  117. package/dist/component/threads.js.map +0 -1
  118. package/dist/component/users.d.ts +0 -52
  119. package/dist/component/users.d.ts.map +0 -1
  120. package/dist/component/users.js +0 -229
  121. package/dist/component/users.js.map +0 -1
  122. package/dist/component/vector/index.d.ts +0 -61
  123. package/dist/component/vector/index.d.ts.map +0 -1
  124. package/dist/component/vector/index.js +0 -146
  125. package/dist/component/vector/index.js.map +0 -1
  126. package/dist/component/vector/tables.d.ts +0 -58
  127. package/dist/component/vector/tables.d.ts.map +0 -1
  128. package/dist/component/vector/tables.js +0 -56
  129. package/dist/component/vector/tables.js.map +0 -1
  130. package/dist/deltas.d.ts +0 -43
  131. package/dist/deltas.d.ts.map +0 -1
  132. package/dist/deltas.js +0 -446
  133. package/dist/deltas.js.map +0 -1
  134. package/dist/mapping.d.ts +0 -72
  135. package/dist/mapping.d.ts.map +0 -1
  136. package/dist/mapping.js +0 -677
  137. package/dist/mapping.js.map +0 -1
  138. package/dist/react/SmoothText.d.ts +0 -5
  139. package/dist/react/SmoothText.d.ts.map +0 -1
  140. package/dist/react/SmoothText.js +0 -6
  141. package/dist/react/SmoothText.js.map +0 -1
  142. package/dist/react/index.d.ts +0 -25
  143. package/dist/react/index.d.ts.map +0 -1
  144. package/dist/react/index.js +0 -70
  145. package/dist/react/index.js.map +0 -1
  146. package/dist/react/optimisticallySendMessage.d.ts +0 -42
  147. package/dist/react/optimisticallySendMessage.d.ts.map +0 -1
  148. package/dist/react/optimisticallySendMessage.js +0 -74
  149. package/dist/react/optimisticallySendMessage.js.map +0 -1
  150. package/dist/react/types.d.ts +0 -12
  151. package/dist/react/types.d.ts.map +0 -1
  152. package/dist/react/types.js +0 -2
  153. package/dist/react/types.js.map +0 -1
  154. package/dist/react/useDeltaStreams.d.ts +0 -10
  155. package/dist/react/useDeltaStreams.d.ts.map +0 -1
  156. package/dist/react/useDeltaStreams.js +0 -106
  157. package/dist/react/useDeltaStreams.js.map +0 -1
  158. package/dist/react/useSmoothText.d.ts +0 -27
  159. package/dist/react/useSmoothText.d.ts.map +0 -1
  160. package/dist/react/useSmoothText.js +0 -68
  161. package/dist/react/useSmoothText.js.map +0 -1
  162. package/dist/react/useStreamingUIMessages.d.ts +0 -22
  163. package/dist/react/useStreamingUIMessages.d.ts.map +0 -1
  164. package/dist/react/useStreamingUIMessages.js +0 -92
  165. package/dist/react/useStreamingUIMessages.js.map +0 -1
  166. package/dist/react/useThreadMessages.d.ts +0 -104
  167. package/dist/react/useThreadMessages.d.ts.map +0 -1
  168. package/dist/react/useThreadMessages.js +0 -148
  169. package/dist/react/useThreadMessages.js.map +0 -1
  170. package/dist/react/useUIMessages.d.ts +0 -96
  171. package/dist/react/useUIMessages.d.ts.map +0 -1
  172. package/dist/react/useUIMessages.js +0 -108
  173. package/dist/react/useUIMessages.js.map +0 -1
  174. package/dist/shared.d.ts +0 -26
  175. package/dist/shared.d.ts.map +0 -1
  176. package/dist/shared.js +0 -67
  177. package/dist/shared.js.map +0 -1
  178. package/dist/validators.d.ts +0 -24516
  179. package/dist/validators.d.ts.map +0 -1
  180. package/dist/validators.js +0 -475
  181. package/dist/validators.js.map +0 -1
@@ -1,1725 +0,0 @@
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
- paginationOpts: {
19
- id?: number;
20
- endCursor?: string | null;
21
- maximumRowsRead?: number;
22
- maximumBytesRead?: number;
23
- numItems: number;
24
- cursor: string | null;
25
- };
26
- apiKey: string;
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
- paginationOpts: {
40
- id?: number;
41
- endCursor?: string | null;
42
- maximumRowsRead?: number;
43
- maximumBytesRead?: number;
44
- numItems: number;
45
- cursor: string | null;
46
- };
47
- apiKey: string;
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
- paginationOpts: {
78
- id?: number;
79
- endCursor?: string | null;
80
- maximumRowsRead?: number;
81
- maximumBytesRead?: number;
82
- numItems: number;
83
- cursor: string | null;
84
- };
85
- apiKey: string;
86
- }, Promise<{
87
- streams: import("./types.js").SyncStreamsReturnValue;
88
- page: {
89
- userId?: string | undefined;
90
- id?: 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
- providerOptions?: Record<string, Record<string, any>> | undefined;
248
- providerMetadata?: Record<string, Record<string, any>> | undefined;
249
- title?: string | undefined;
250
- type: "source";
251
- id: string;
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
- type: "source";
259
- id: string;
260
- mediaType: string;
261
- sourceType: "document";
262
- title: string;
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
- type?: "source" | undefined;
379
- providerOptions?: Record<string, Record<string, any>> | undefined;
380
- providerMetadata?: Record<string, Record<string, any>> | undefined;
381
- title?: string | 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
- type: "source";
390
- id: string;
391
- mediaType: string;
392
- sourceType: "document";
393
- title: string;
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?: "length" | "error" | "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
- _id: string;
423
- _creationTime: number;
424
- threadId: string;
425
- order: number;
426
- stepOrder: number;
427
- status: "pending" | "success" | "failed";
428
- tool: boolean;
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
- agentName?: string | undefined;
449
- title?: string | undefined;
450
- summary?: 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
- prompt?: string | undefined;
459
- messages?: ({
460
- providerOptions?: Record<string, Record<string, any>> | undefined;
461
- role: "user";
462
- content: string | ({
463
- providerOptions?: Record<string, Record<string, any>> | undefined;
464
- providerMetadata?: Record<string, Record<string, any>> | undefined;
465
- type: "text";
466
- text: string;
467
- } | {
468
- providerOptions?: Record<string, Record<string, any>> | undefined;
469
- mediaType?: string | undefined;
470
- mimeType?: string | undefined;
471
- type: "image";
472
- image: string | ArrayBuffer;
473
- } | {
474
- providerOptions?: Record<string, Record<string, any>> | undefined;
475
- providerMetadata?: Record<string, Record<string, any>> | undefined;
476
- mediaType?: string | undefined;
477
- mimeType?: string | undefined;
478
- filename?: string | undefined;
479
- type: "file";
480
- data: string | ArrayBuffer;
481
- })[];
482
- } | {
483
- providerOptions?: Record<string, Record<string, any>> | undefined;
484
- role: "assistant";
485
- content: string | ({
486
- providerOptions?: Record<string, Record<string, any>> | undefined;
487
- providerMetadata?: Record<string, Record<string, any>> | undefined;
488
- type: "text";
489
- text: string;
490
- } | {
491
- providerOptions?: Record<string, Record<string, any>> | undefined;
492
- providerMetadata?: Record<string, Record<string, any>> | undefined;
493
- mediaType?: string | undefined;
494
- mimeType?: string | undefined;
495
- filename?: string | undefined;
496
- type: "file";
497
- data: string | ArrayBuffer;
498
- } | {
499
- providerOptions?: Record<string, Record<string, any>> | undefined;
500
- providerMetadata?: Record<string, Record<string, any>> | undefined;
501
- signature?: string | undefined;
502
- type: "reasoning";
503
- text: string;
504
- } | {
505
- providerOptions?: Record<string, Record<string, any>> | undefined;
506
- providerMetadata?: Record<string, Record<string, any>> | undefined;
507
- type: "redacted-reasoning";
508
- data: string;
509
- } | {
510
- providerOptions?: Record<string, Record<string, any>> | undefined;
511
- providerMetadata?: Record<string, Record<string, any>> | undefined;
512
- args?: any;
513
- providerExecuted?: boolean | undefined;
514
- type: "tool-call";
515
- toolCallId: string;
516
- toolName: string;
517
- input: any;
518
- } | {
519
- providerOptions?: Record<string, Record<string, any>> | undefined;
520
- providerMetadata?: Record<string, Record<string, any>> | undefined;
521
- input?: any;
522
- providerExecuted?: boolean | undefined;
523
- type: "tool-call";
524
- toolCallId: string;
525
- toolName: string;
526
- args: any;
527
- } | {
528
- providerOptions?: Record<string, Record<string, any>> | undefined;
529
- providerMetadata?: Record<string, Record<string, any>> | undefined;
530
- args?: any;
531
- providerExecuted?: boolean | undefined;
532
- output?: {
533
- providerOptions?: Record<string, Record<string, any>> | undefined;
534
- type: "text";
535
- value: string;
536
- } | {
537
- providerOptions?: Record<string, Record<string, any>> | undefined;
538
- type: "json";
539
- value: any;
540
- } | {
541
- providerOptions?: Record<string, Record<string, any>> | undefined;
542
- type: "error-text";
543
- value: string;
544
- } | {
545
- providerOptions?: Record<string, Record<string, any>> | undefined;
546
- type: "error-json";
547
- value: any;
548
- } | {
549
- providerOptions?: Record<string, Record<string, any>> | undefined;
550
- reason?: string | undefined;
551
- type: "execution-denied";
552
- } | {
553
- type: "content";
554
- value: ({
555
- providerOptions?: Record<string, Record<string, any>> | undefined;
556
- type: "text";
557
- text: string;
558
- } | {
559
- type: "media";
560
- mediaType: string;
561
- data: string;
562
- } | {
563
- providerOptions?: Record<string, Record<string, any>> | undefined;
564
- filename?: string | undefined;
565
- type: "file-data";
566
- mediaType: string;
567
- data: string;
568
- } | {
569
- providerOptions?: Record<string, Record<string, any>> | undefined;
570
- type: "file-url";
571
- url: string;
572
- } | {
573
- providerOptions?: Record<string, Record<string, any>> | undefined;
574
- type: "file-id";
575
- fileId: string | Record<string, string>;
576
- } | {
577
- providerOptions?: Record<string, Record<string, any>> | undefined;
578
- type: "image-data";
579
- mediaType: string;
580
- data: string;
581
- } | {
582
- providerOptions?: Record<string, Record<string, any>> | undefined;
583
- type: "image-url";
584
- url: string;
585
- } | {
586
- providerOptions?: Record<string, Record<string, any>> | undefined;
587
- type: "image-file-id";
588
- fileId: string | Record<string, string>;
589
- } | {
590
- providerOptions?: Record<string, Record<string, any>> | undefined;
591
- type: "custom";
592
- })[];
593
- } | undefined;
594
- result?: any;
595
- isError?: boolean | undefined;
596
- experimental_content?: ({
597
- type: "text";
598
- text: string;
599
- } | {
600
- mimeType?: string | undefined;
601
- type: "image";
602
- data: string;
603
- })[] | undefined;
604
- type: "tool-result";
605
- toolCallId: string;
606
- toolName: string;
607
- } | {
608
- providerOptions?: Record<string, Record<string, any>> | undefined;
609
- providerMetadata?: Record<string, Record<string, any>> | undefined;
610
- title?: string | undefined;
611
- type: "source";
612
- id: string;
613
- url: string;
614
- sourceType: "url";
615
- } | {
616
- providerOptions?: Record<string, Record<string, any>> | undefined;
617
- providerMetadata?: Record<string, Record<string, any>> | undefined;
618
- filename?: string | undefined;
619
- type: "source";
620
- id: string;
621
- mediaType: string;
622
- sourceType: "document";
623
- title: string;
624
- } | {
625
- providerOptions?: Record<string, Record<string, any>> | undefined;
626
- providerMetadata?: Record<string, Record<string, any>> | undefined;
627
- type: "tool-approval-request";
628
- toolCallId: string;
629
- approvalId: string;
630
- })[];
631
- } | {
632
- providerOptions?: Record<string, Record<string, any>> | undefined;
633
- role: "tool";
634
- content: ({
635
- providerOptions?: Record<string, Record<string, any>> | undefined;
636
- providerMetadata?: Record<string, Record<string, any>> | undefined;
637
- args?: any;
638
- providerExecuted?: boolean | undefined;
639
- output?: {
640
- providerOptions?: Record<string, Record<string, any>> | undefined;
641
- type: "text";
642
- value: string;
643
- } | {
644
- providerOptions?: Record<string, Record<string, any>> | undefined;
645
- type: "json";
646
- value: any;
647
- } | {
648
- providerOptions?: Record<string, Record<string, any>> | undefined;
649
- type: "error-text";
650
- value: string;
651
- } | {
652
- providerOptions?: Record<string, Record<string, any>> | undefined;
653
- type: "error-json";
654
- value: any;
655
- } | {
656
- providerOptions?: Record<string, Record<string, any>> | undefined;
657
- reason?: string | undefined;
658
- type: "execution-denied";
659
- } | {
660
- type: "content";
661
- value: ({
662
- providerOptions?: Record<string, Record<string, any>> | undefined;
663
- type: "text";
664
- text: string;
665
- } | {
666
- type: "media";
667
- mediaType: string;
668
- data: string;
669
- } | {
670
- providerOptions?: Record<string, Record<string, any>> | undefined;
671
- filename?: string | undefined;
672
- type: "file-data";
673
- mediaType: string;
674
- data: string;
675
- } | {
676
- providerOptions?: Record<string, Record<string, any>> | undefined;
677
- type: "file-url";
678
- url: string;
679
- } | {
680
- providerOptions?: Record<string, Record<string, any>> | undefined;
681
- type: "file-id";
682
- fileId: string | Record<string, string>;
683
- } | {
684
- providerOptions?: Record<string, Record<string, any>> | undefined;
685
- type: "image-data";
686
- mediaType: string;
687
- data: string;
688
- } | {
689
- providerOptions?: Record<string, Record<string, any>> | undefined;
690
- type: "image-url";
691
- url: string;
692
- } | {
693
- providerOptions?: Record<string, Record<string, any>> | undefined;
694
- type: "image-file-id";
695
- fileId: string | Record<string, string>;
696
- } | {
697
- providerOptions?: Record<string, Record<string, any>> | undefined;
698
- type: "custom";
699
- })[];
700
- } | undefined;
701
- result?: any;
702
- isError?: boolean | undefined;
703
- experimental_content?: ({
704
- type: "text";
705
- text: string;
706
- } | {
707
- mimeType?: string | undefined;
708
- type: "image";
709
- data: string;
710
- })[] | undefined;
711
- type: "tool-result";
712
- toolCallId: string;
713
- toolName: string;
714
- } | {
715
- providerOptions?: Record<string, Record<string, any>> | undefined;
716
- providerMetadata?: Record<string, Record<string, any>> | undefined;
717
- providerExecuted?: boolean | undefined;
718
- reason?: string | undefined;
719
- type: "tool-approval-response";
720
- approvalId: string;
721
- approved: boolean;
722
- })[];
723
- } | {
724
- providerOptions?: Record<string, Record<string, any>> | undefined;
725
- role: "system";
726
- content: string;
727
- })[] | undefined;
728
- contextOptions?: {
729
- excludeToolMessages?: boolean | undefined;
730
- recentMessages?: number | undefined;
731
- searchOptions?: {
732
- vectorSearch?: boolean | undefined;
733
- textSearch?: 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
- type?: "source" | undefined;
776
- providerOptions?: Record<string, Record<string, any>> | undefined;
777
- providerMetadata?: Record<string, Record<string, any>> | undefined;
778
- title?: string | 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
- type: "source";
787
- id: string;
788
- mediaType: string;
789
- sourceType: "document";
790
- title: string;
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?: "length" | "error" | "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
- providerOptions?: Record<string, Record<string, any>> | undefined;
969
- providerMetadata?: Record<string, Record<string, any>> | undefined;
970
- title?: string | undefined;
971
- type: "source";
972
- id: string;
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
- type: "source";
980
- id: string;
981
- mediaType: string;
982
- sourceType: "document";
983
- title: string;
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
- providerOptions?: Record<string, Record<string, any>> | undefined;
1243
- providerMetadata?: Record<string, Record<string, any>> | undefined;
1244
- title?: string | undefined;
1245
- type: "source";
1246
- id: string;
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
- type: "source";
1254
- id: string;
1255
- mediaType: string;
1256
- sourceType: "document";
1257
- title: string;
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
- apiKey: string;
1367
- contextOptions: {
1368
- excludeToolMessages?: boolean | undefined;
1369
- recentMessages?: number | undefined;
1370
- searchOptions?: {
1371
- vectorSearch?: boolean | undefined;
1372
- textSearch?: boolean | undefined;
1373
- vectorScoreThreshold?: number | undefined;
1374
- messageRange?: {
1375
- before: number;
1376
- after: number;
1377
- } | undefined;
1378
- limit: number;
1379
- } | undefined;
1380
- searchOtherThreads?: boolean | undefined;
1381
- };
1382
- }, Promise<{
1383
- userId?: string | undefined;
1384
- id?: 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
- providerOptions?: Record<string, Record<string, any>> | undefined;
1542
- providerMetadata?: Record<string, Record<string, any>> | undefined;
1543
- title?: string | undefined;
1544
- type: "source";
1545
- id: string;
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
- type: "source";
1553
- id: string;
1554
- mediaType: string;
1555
- sourceType: "document";
1556
- title: string;
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
- type?: "source" | undefined;
1673
- providerOptions?: Record<string, Record<string, any>> | undefined;
1674
- providerMetadata?: Record<string, Record<string, any>> | undefined;
1675
- title?: string | 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
- type: "source";
1684
- id: string;
1685
- mediaType: string;
1686
- sourceType: "document";
1687
- title: string;
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?: "length" | "error" | "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
- _id: string;
1717
- _creationTime: number;
1718
- threadId: string;
1719
- order: number;
1720
- stepOrder: number;
1721
- status: "pending" | "success" | "failed";
1722
- tool: boolean;
1723
- }[]>>;
1724
- };
1725
- //# sourceMappingURL=definePlaygroundAPI.d.ts.map