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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/README.md +32 -27
  2. package/dist/UIMessages.d.ts +46 -0
  3. package/dist/UIMessages.d.ts.map +1 -0
  4. package/dist/UIMessages.js +546 -0
  5. package/dist/UIMessages.js.map +1 -0
  6. package/dist/client/createTool.d.ts +129 -27
  7. package/dist/client/createTool.d.ts.map +1 -1
  8. package/dist/client/createTool.js +66 -12
  9. package/dist/client/createTool.js.map +1 -1
  10. package/dist/client/defaultComponent.d.ts +11 -0
  11. package/dist/client/defaultComponent.d.ts.map +1 -0
  12. package/dist/client/defaultComponent.js +7 -0
  13. package/dist/client/defaultComponent.js.map +1 -0
  14. package/dist/client/definePlaygroundAPI.d.ts +1323 -192
  15. package/dist/client/definePlaygroundAPI.d.ts.map +1 -1
  16. package/dist/client/definePlaygroundAPI.js +52 -28
  17. package/dist/client/definePlaygroundAPI.js.map +1 -1
  18. package/dist/client/files.d.ts +20 -7
  19. package/dist/client/files.d.ts.map +1 -1
  20. package/dist/client/files.js +68 -11
  21. package/dist/client/files.js.map +1 -1
  22. package/dist/client/index.d.ts +1056 -965
  23. package/dist/client/index.d.ts.map +1 -1
  24. package/dist/client/index.js +242 -748
  25. package/dist/client/index.js.map +1 -1
  26. package/dist/client/messages.d.ts +461 -0
  27. package/dist/client/messages.d.ts.map +1 -0
  28. package/dist/client/messages.js +106 -0
  29. package/dist/client/messages.js.map +1 -0
  30. package/dist/client/mockModel.d.ts +42 -0
  31. package/dist/client/mockModel.d.ts.map +1 -0
  32. package/dist/client/mockModel.js +175 -0
  33. package/dist/client/mockModel.js.map +1 -0
  34. package/dist/client/saveInputMessages.d.ts +20 -0
  35. package/dist/client/saveInputMessages.d.ts.map +1 -0
  36. package/dist/client/saveInputMessages.js +58 -0
  37. package/dist/client/saveInputMessages.js.map +1 -0
  38. package/dist/client/search.d.ts +346 -35
  39. package/dist/client/search.d.ts.map +1 -1
  40. package/dist/client/search.js +350 -39
  41. package/dist/client/search.js.map +1 -1
  42. package/dist/client/start.d.ts +84 -0
  43. package/dist/client/start.d.ts.map +1 -0
  44. package/dist/client/start.js +171 -0
  45. package/dist/client/start.js.map +1 -0
  46. package/dist/client/streamText.d.ts +46 -0
  47. package/dist/client/streamText.d.ts.map +1 -0
  48. package/dist/client/streamText.js +93 -0
  49. package/dist/client/streamText.js.map +1 -0
  50. package/dist/client/streaming.d.ts +3705 -32
  51. package/dist/client/streaming.d.ts.map +1 -1
  52. package/dist/client/streaming.js +141 -59
  53. package/dist/client/streaming.js.map +1 -1
  54. package/dist/client/threads.d.ts +46 -0
  55. package/dist/client/threads.d.ts.map +1 -0
  56. package/dist/client/threads.js +49 -0
  57. package/dist/client/threads.js.map +1 -0
  58. package/dist/client/types.d.ts +265 -128
  59. package/dist/client/types.d.ts.map +1 -1
  60. package/dist/client/utils.d.ts +4 -0
  61. package/dist/client/utils.d.ts.map +1 -0
  62. package/dist/client/utils.js +21 -0
  63. package/dist/client/utils.js.map +1 -0
  64. package/dist/component/_generated/api.d.ts +24 -2178
  65. package/dist/component/_generated/api.d.ts.map +1 -1
  66. package/dist/component/_generated/api.js +10 -1
  67. package/dist/component/_generated/api.js.map +1 -1
  68. package/dist/component/_generated/component.d.ts +3119 -0
  69. package/dist/component/_generated/component.d.ts.map +1 -0
  70. package/dist/component/_generated/component.js +11 -0
  71. package/dist/component/_generated/component.js.map +1 -0
  72. package/dist/component/_generated/dataModel.d.ts +4 -18
  73. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  74. package/dist/component/_generated/dataModel.js +11 -0
  75. package/dist/component/_generated/dataModel.js.map +1 -0
  76. package/dist/component/_generated/server.d.ts +10 -38
  77. package/dist/component/_generated/server.d.ts.map +1 -1
  78. package/dist/component/_generated/server.js +9 -5
  79. package/dist/component/_generated/server.js.map +1 -1
  80. package/dist/component/files.d.ts +16 -10
  81. package/dist/component/files.d.ts.map +1 -1
  82. package/dist/component/files.js +10 -2
  83. package/dist/component/files.js.map +1 -1
  84. package/dist/component/messages.d.ts +2553 -342
  85. package/dist/component/messages.d.ts.map +1 -1
  86. package/dist/component/messages.js +387 -154
  87. package/dist/component/messages.js.map +1 -1
  88. package/dist/component/schema.d.ts +5697 -3584
  89. package/dist/component/schema.d.ts.map +1 -1
  90. package/dist/component/schema.js +18 -41
  91. package/dist/component/schema.js.map +1 -1
  92. package/dist/component/streams.d.ts +35 -335
  93. package/dist/component/streams.d.ts.map +1 -1
  94. package/dist/component/streams.js +114 -73
  95. package/dist/component/streams.js.map +1 -1
  96. package/dist/component/threads.d.ts +16 -16
  97. package/dist/component/users.d.ts +4 -4
  98. package/dist/component/vector/index.d.ts +1 -1
  99. package/dist/component/vector/index.d.ts.map +1 -1
  100. package/dist/component/vector/index.js +1 -3
  101. package/dist/component/vector/index.js.map +1 -1
  102. package/dist/deltas.d.ts +43 -0
  103. package/dist/deltas.d.ts.map +1 -0
  104. package/dist/deltas.js +447 -0
  105. package/dist/deltas.js.map +1 -0
  106. package/dist/mapping.d.ts +20 -20
  107. package/dist/mapping.d.ts.map +1 -1
  108. package/dist/mapping.js +313 -96
  109. package/dist/mapping.js.map +1 -1
  110. package/dist/react/SmoothText.d.ts +5 -0
  111. package/dist/react/SmoothText.d.ts.map +1 -0
  112. package/dist/react/SmoothText.js +6 -0
  113. package/dist/react/SmoothText.js.map +1 -0
  114. package/dist/react/index.d.ts +5 -77
  115. package/dist/react/index.d.ts.map +1 -1
  116. package/dist/react/index.js +6 -160
  117. package/dist/react/index.js.map +1 -1
  118. package/dist/react/optimisticallySendMessage.d.ts +36 -3
  119. package/dist/react/optimisticallySendMessage.d.ts.map +1 -1
  120. package/dist/react/optimisticallySendMessage.js +35 -9
  121. package/dist/react/optimisticallySendMessage.js.map +1 -1
  122. package/dist/react/types.d.ts +4 -18
  123. package/dist/react/types.d.ts.map +1 -1
  124. package/dist/react/useDeltaStreams.d.ts +10 -0
  125. package/dist/react/useDeltaStreams.d.ts.map +1 -0
  126. package/dist/react/useDeltaStreams.js +101 -0
  127. package/dist/react/useDeltaStreams.js.map +1 -0
  128. package/dist/react/useSmoothText.d.ts +13 -12
  129. package/dist/react/useSmoothText.d.ts.map +1 -1
  130. package/dist/react/useSmoothText.js +32 -15
  131. package/dist/react/useSmoothText.js.map +1 -1
  132. package/dist/react/useStreamingUIMessages.d.ts +22 -0
  133. package/dist/react/useStreamingUIMessages.d.ts.map +1 -0
  134. package/dist/react/useStreamingUIMessages.js +92 -0
  135. package/dist/react/useStreamingUIMessages.js.map +1 -0
  136. package/dist/react/useThreadMessages.d.ts +104 -0
  137. package/dist/react/useThreadMessages.d.ts.map +1 -0
  138. package/dist/react/useThreadMessages.js +148 -0
  139. package/dist/react/useThreadMessages.js.map +1 -0
  140. package/dist/react/useUIMessages.d.ts +96 -0
  141. package/dist/react/useUIMessages.d.ts.map +1 -0
  142. package/dist/react/useUIMessages.js +108 -0
  143. package/dist/react/useUIMessages.js.map +1 -0
  144. package/dist/shared.d.ts +20 -4
  145. package/dist/shared.d.ts.map +1 -1
  146. package/dist/shared.js +45 -8
  147. package/dist/shared.js.map +1 -1
  148. package/dist/validators.d.ts +22981 -5666
  149. package/dist/validators.d.ts.map +1 -1
  150. package/dist/validators.js +245 -137
  151. package/dist/validators.js.map +1 -1
  152. package/package.json +98 -50
  153. package/src/UIMessages.combineUIMessages.test.ts +239 -0
  154. package/src/UIMessages.test.ts +273 -0
  155. package/src/UIMessages.ts +739 -0
  156. package/src/client/createTool.ts +293 -76
  157. package/src/client/defaultComponent.ts +17 -0
  158. package/src/client/definePlaygroundAPI.ts +67 -31
  159. package/src/client/files.ts +100 -20
  160. package/src/client/index.test.ts +40 -85
  161. package/src/client/index.ts +520 -1290
  162. package/src/client/messages.ts +237 -0
  163. package/src/client/mockModel.ts +245 -0
  164. package/src/client/saveInputMessages.test.ts +583 -0
  165. package/src/client/saveInputMessages.ts +101 -0
  166. package/src/client/search.test.ts +1207 -0
  167. package/src/client/search.ts +577 -70
  168. package/src/client/start.ts +310 -0
  169. package/src/client/streamText.ts +163 -0
  170. package/src/client/streaming.test.ts +186 -0
  171. package/src/client/streaming.ts +219 -97
  172. package/src/client/threads.ts +83 -0
  173. package/src/client/types.ts +368 -219
  174. package/src/client/utils.ts +27 -0
  175. package/src/component/_generated/api.ts +64 -0
  176. package/src/component/_generated/component.ts +4913 -0
  177. package/src/component/_generated/{server.d.ts → server.ts} +33 -21
  178. package/src/component/files.ts +11 -2
  179. package/src/component/messages.test.ts +195 -51
  180. package/src/component/messages.ts +490 -201
  181. package/src/component/schema.ts +20 -46
  182. package/src/component/setup.test.ts +7 -0
  183. package/src/component/streams.ts +184 -83
  184. package/src/component/users.test.ts +0 -1
  185. package/src/component/vector/index.ts +1 -3
  186. package/src/deltas.test.ts +626 -0
  187. package/src/deltas.ts +570 -0
  188. package/src/fromUIMessages.test.ts +497 -0
  189. package/src/mapping.test.ts +103 -6
  190. package/src/mapping.ts +422 -161
  191. package/src/react/SmoothText.tsx +9 -0
  192. package/src/react/index.ts +10 -230
  193. package/src/react/optimisticallySendMessage.ts +55 -12
  194. package/src/react/types.ts +6 -39
  195. package/src/react/useDeltaStreams.ts +154 -0
  196. package/src/react/useSmoothText.ts +56 -36
  197. package/src/react/useStreamingUIMessages.ts +143 -0
  198. package/src/react/useThreadMessages.ts +262 -0
  199. package/src/react/useUIMessages.test.ts +255 -0
  200. package/src/react/useUIMessages.ts +195 -0
  201. package/src/shared.ts +88 -12
  202. package/src/test.ts +18 -0
  203. package/src/toUIMessages.test.ts +1269 -0
  204. package/src/validators.test.ts +18 -19
  205. package/src/validators.ts +325 -185
  206. package/dist/client/_generated/_ignore.d.ts +0 -1
  207. package/dist/client/_generated/_ignore.d.ts.map +0 -1
  208. package/dist/client/_generated/_ignore.js +0 -3
  209. package/dist/client/_generated/_ignore.js.map +0 -1
  210. package/dist/client/listMessages.d.ts +0 -22
  211. package/dist/client/listMessages.d.ts.map +0 -1
  212. package/dist/client/listMessages.js +0 -25
  213. package/dist/client/listMessages.js.map +0 -1
  214. package/dist/package.json +0 -3
  215. package/dist/react/deltas.d.ts +0 -26
  216. package/dist/react/deltas.d.ts.map +0 -1
  217. package/dist/react/deltas.js +0 -384
  218. package/dist/react/deltas.js.map +0 -1
  219. package/dist/react/toUIMessages.d.ts +0 -15
  220. package/dist/react/toUIMessages.d.ts.map +0 -1
  221. package/dist/react/toUIMessages.js +0 -211
  222. package/dist/react/toUIMessages.js.map +0 -1
  223. package/src/client/listMessages.ts +0 -38
  224. package/src/component/_generated/api.d.ts +0 -2202
  225. package/src/component/_generated/api.js +0 -23
  226. package/src/component/_generated/server.js +0 -90
  227. package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  228. package/src/react/deltas.test.ts +0 -315
  229. package/src/react/deltas.ts +0 -478
  230. package/src/react/toUIMessages.test.ts +0 -420
  231. package/src/react/toUIMessages.ts +0 -253
  232. package/src/vitest.config.ts +0 -7
  233. /package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +0 -0
@@ -17,10 +17,10 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
17
17
  listUsers: import("convex/server").RegisteredQuery<"public", {
18
18
  apiKey: string;
19
19
  paginationOpts: {
20
- id?: number | undefined;
21
- endCursor?: string | null | undefined;
22
- maximumRowsRead?: number | undefined;
23
- maximumBytesRead?: number | undefined;
20
+ id?: number;
21
+ endCursor?: string | null;
22
+ maximumRowsRead?: number;
23
+ maximumBytesRead?: number;
24
24
  numItems: number;
25
25
  cursor: string | null;
26
26
  };
@@ -31,17 +31,17 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
31
31
  }[];
32
32
  continueCursor: string;
33
33
  isDone: boolean;
34
- pageStatus?: "SplitRecommended" | "SplitRequired" | null | undefined;
35
- splitCursor?: string | null | undefined;
34
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
35
+ splitCursor?: string | null;
36
36
  }>>;
37
37
  listThreads: import("convex/server").RegisteredQuery<"public", {
38
38
  userId?: string | undefined;
39
39
  apiKey: string;
40
40
  paginationOpts: {
41
- id?: number | undefined;
42
- endCursor?: string | null | undefined;
43
- maximumRowsRead?: number | undefined;
44
- maximumBytesRead?: number | undefined;
41
+ id?: number;
42
+ endCursor?: string | null;
43
+ maximumRowsRead?: number;
44
+ maximumBytesRead?: number;
45
45
  numItems: number;
46
46
  cursor: string | null;
47
47
  };
@@ -53,173 +53,385 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
53
53
  _creationTime: number;
54
54
  _id: string;
55
55
  status: "active" | "archived";
56
- summary?: string | undefined;
57
- title?: string | undefined;
58
- userId?: string | undefined;
56
+ summary?: string;
57
+ title?: string;
58
+ userId?: string;
59
59
  }[];
60
60
  continueCursor: string;
61
61
  isDone: boolean;
62
- pageStatus?: "SplitRecommended" | "SplitRequired" | null | undefined;
63
- splitCursor?: string | null | undefined;
62
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
63
+ splitCursor?: string | null;
64
64
  }>>;
65
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;
66
76
  threadId: string;
67
77
  apiKey: string;
68
78
  paginationOpts: {
69
- id?: number | undefined;
70
- endCursor?: string | null | undefined;
71
- maximumRowsRead?: number | undefined;
72
- maximumBytesRead?: number | undefined;
79
+ id?: number;
80
+ endCursor?: string | null;
81
+ maximumRowsRead?: number;
82
+ maximumBytesRead?: number;
73
83
  numItems: number;
74
84
  cursor: string | null;
75
85
  };
76
- }, Promise<import("convex/server").PaginationResult<{
77
- id?: string | undefined;
78
- userId?: string | undefined;
79
- embeddingId?: string | undefined;
80
- fileIds?: string[] | undefined;
81
- error?: string | undefined;
82
- agentName?: string | undefined;
83
- model?: string | undefined;
84
- provider?: string | undefined;
85
- providerOptions?: Record<string, Record<string, any>> | undefined;
86
- message?: {
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;
87
97
  providerOptions?: Record<string, Record<string, any>> | undefined;
88
- role: "user";
89
- content: string | ({
98
+ message?: {
90
99
  providerOptions?: Record<string, Record<string, any>> | undefined;
91
- type: "text";
92
- text: string;
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
+ })[];
93
121
  } | {
94
122
  providerOptions?: Record<string, Record<string, any>> | undefined;
95
- mimeType?: string | undefined;
96
- type: "image";
97
- image: string | ArrayBuffer;
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
+ })[];
98
270
  } | {
99
271
  providerOptions?: Record<string, Record<string, any>> | undefined;
100
- filename?: string | undefined;
101
- type: "file";
102
- mimeType: string;
103
- data: string | ArrayBuffer;
104
- })[];
105
- } | {
106
- providerOptions?: Record<string, Record<string, any>> | undefined;
107
- role: "assistant";
108
- content: string | ({
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
+ } | {
109
363
  providerOptions?: Record<string, Record<string, any>> | undefined;
110
- type: "text";
111
- text: string;
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";
112
385
  } | {
113
386
  providerOptions?: Record<string, Record<string, any>> | undefined;
387
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
114
388
  filename?: string | undefined;
115
- type: "file";
116
- mimeType: string;
117
- data: string | ArrayBuffer;
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;
118
403
  } | {
404
+ type: "other";
405
+ message: string;
406
+ })[] | undefined;
407
+ finishReason?: "error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
408
+ reasoningDetails?: ({
119
409
  providerOptions?: Record<string, Record<string, any>> | undefined;
410
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
120
411
  signature?: string | undefined;
121
- state?: "streaming" | "done" | undefined;
122
412
  type: "reasoning";
123
413
  text: string;
124
414
  } | {
125
- providerOptions?: Record<string, Record<string, any>> | undefined;
126
- type: "redacted-reasoning";
127
- data: string;
415
+ signature?: string | undefined;
416
+ type: "text";
417
+ text: string;
128
418
  } | {
129
- providerOptions?: Record<string, Record<string, any>> | undefined;
130
- providerExecuted?: boolean | undefined;
131
- type: "tool-call";
132
- toolCallId: string;
133
- toolName: string;
134
- args: any;
135
- })[];
136
- } | {
137
- providerOptions?: Record<string, Record<string, any>> | undefined;
138
- role: "tool";
139
- content: {
140
- providerOptions?: Record<string, Record<string, any>> | undefined;
141
- args?: any;
142
- providerExecuted?: boolean | undefined;
143
- isError?: boolean | undefined;
144
- experimental_content?: ({
145
- type: "text";
146
- text: string;
147
- } | {
148
- mimeType?: string | undefined;
149
- type: "image";
150
- data: string;
151
- })[] | undefined;
152
- type: "tool-result";
153
- toolCallId: string;
154
- toolName: string;
155
- result: any;
156
- }[];
157
- } | {
158
- providerOptions?: Record<string, Record<string, any>> | undefined;
159
- role: "system";
160
- content: string;
161
- } | undefined;
162
- text?: string | undefined;
163
- reasoning?: string | undefined;
164
- usage?: {
165
- reasoningTokens?: number | undefined;
166
- cachedInputTokens?: number | undefined;
167
- promptTokens: number;
168
- completionTokens: number;
169
- totalTokens: number;
170
- } | undefined;
171
- providerMetadata?: Record<string, Record<string, any>> | undefined;
172
- sources?: ({
173
- title?: string | undefined;
174
- type?: "source" | undefined;
175
- providerOptions?: Record<string, Record<string, any>> | undefined;
176
- url?: string | undefined;
177
- id: string;
178
- sourceType: "url";
179
- } | {
180
- filename?: string | undefined;
181
- providerMetadata?: Record<string, Record<string, any>> | undefined;
182
- id: string;
183
- title: string;
184
- type: "source";
185
- sourceType: "document";
186
- mediaType: string;
187
- })[] | undefined;
188
- reasoningDetails?: ({
189
- providerOptions?: Record<string, Record<string, any>> | undefined;
190
- signature?: string | undefined;
191
- state?: "streaming" | "done" | undefined;
192
- type: "reasoning";
193
- text: string;
194
- } | {
195
- signature?: string | undefined;
196
- type: "text";
197
- text: string;
198
- } | {
199
- type: "redacted";
200
- data: string;
201
- })[] | undefined;
202
- warnings?: ({
203
- details?: string | undefined;
204
- type: "unsupported-setting";
205
- setting: string;
206
- } | {
207
- details?: string | undefined;
208
- type: "unsupported-tool";
209
- tool: any;
210
- } | {
211
- type: "other";
212
- message: string;
213
- })[] | undefined;
214
- finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
215
- _id: string;
216
- _creationTime: number;
217
- status: "pending" | "success" | "failed";
218
- order: number;
219
- threadId: string;
220
- stepOrder: number;
221
- tool: boolean;
222
- }>>>;
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
+ }>>;
223
435
  listAgents: import("convex/server").RegisteredQuery<"public", {
224
436
  userId?: string | undefined;
225
437
  threadId?: string | undefined;
@@ -248,18 +460,22 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
248
460
  role: "user";
249
461
  content: string | ({
250
462
  providerOptions?: Record<string, Record<string, any>> | undefined;
463
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
251
464
  type: "text";
252
465
  text: string;
253
466
  } | {
254
467
  providerOptions?: Record<string, Record<string, any>> | undefined;
468
+ mediaType?: string | undefined;
255
469
  mimeType?: string | undefined;
256
470
  type: "image";
257
471
  image: string | ArrayBuffer;
258
472
  } | {
259
473
  providerOptions?: Record<string, Record<string, any>> | undefined;
474
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
475
+ mediaType?: string | undefined;
476
+ mimeType?: string | undefined;
260
477
  filename?: string | undefined;
261
478
  type: "file";
262
- mimeType: string;
263
479
  data: string | ArrayBuffer;
264
480
  })[];
265
481
  } | {
@@ -267,39 +483,221 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
267
483
  role: "assistant";
268
484
  content: string | ({
269
485
  providerOptions?: Record<string, Record<string, any>> | undefined;
486
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
270
487
  type: "text";
271
488
  text: string;
272
489
  } | {
273
490
  providerOptions?: Record<string, Record<string, any>> | undefined;
491
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
492
+ mediaType?: string | undefined;
493
+ mimeType?: string | undefined;
274
494
  filename?: string | undefined;
275
495
  type: "file";
276
- mimeType: string;
277
496
  data: string | ArrayBuffer;
278
497
  } | {
279
498
  providerOptions?: Record<string, Record<string, any>> | undefined;
499
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
280
500
  signature?: string | undefined;
281
- state?: "streaming" | "done" | undefined;
282
501
  type: "reasoning";
283
502
  text: string;
284
503
  } | {
285
504
  providerOptions?: Record<string, Record<string, any>> | undefined;
505
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
286
506
  type: "redacted-reasoning";
287
507
  data: string;
288
508
  } | {
289
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;
290
521
  providerExecuted?: boolean | undefined;
291
522
  type: "tool-call";
292
523
  toolCallId: string;
293
524
  toolName: string;
294
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;
295
629
  })[];
296
630
  } | {
297
631
  providerOptions?: Record<string, Record<string, any>> | undefined;
298
632
  role: "tool";
299
- content: {
633
+ content: ({
300
634
  providerOptions?: Record<string, Record<string, any>> | undefined;
635
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
301
636
  args?: any;
302
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;
303
701
  isError?: boolean | undefined;
304
702
  experimental_content?: ({
305
703
  type: "text";
@@ -312,8 +710,15 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
312
710
  type: "tool-result";
313
711
  toolCallId: string;
314
712
  toolName: string;
315
- result: any;
316
- }[];
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
+ })[];
317
722
  } | {
318
723
  providerOptions?: Record<string, Record<string, any>> | undefined;
319
724
  role: "system";
@@ -343,31 +748,369 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
343
748
  agentName: string;
344
749
  apiKey: string;
345
750
  }, Promise<{
346
- messageId: string | undefined;
347
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
+ }[];
348
1089
  }>>;
349
1090
  fetchPromptContext: import("convex/server").RegisteredAction<"public", {
350
1091
  userId?: string | undefined;
351
1092
  threadId?: string | undefined;
352
- beforeMessageId?: string | undefined;
353
- agentName: string;
354
- messages: ({
1093
+ messages?: ({
355
1094
  providerOptions?: Record<string, Record<string, any>> | undefined;
356
1095
  role: "user";
357
1096
  content: string | ({
358
1097
  providerOptions?: Record<string, Record<string, any>> | undefined;
1098
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
359
1099
  type: "text";
360
1100
  text: string;
361
1101
  } | {
362
1102
  providerOptions?: Record<string, Record<string, any>> | undefined;
1103
+ mediaType?: string | undefined;
363
1104
  mimeType?: string | undefined;
364
1105
  type: "image";
365
1106
  image: string | ArrayBuffer;
366
1107
  } | {
367
1108
  providerOptions?: Record<string, Record<string, any>> | undefined;
1109
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1110
+ mediaType?: string | undefined;
1111
+ mimeType?: string | undefined;
368
1112
  filename?: string | undefined;
369
1113
  type: "file";
370
- mimeType: string;
371
1114
  data: string | ArrayBuffer;
372
1115
  })[];
373
1116
  } | {
@@ -375,39 +1118,221 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
375
1118
  role: "assistant";
376
1119
  content: string | ({
377
1120
  providerOptions?: Record<string, Record<string, any>> | undefined;
1121
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
378
1122
  type: "text";
379
1123
  text: string;
380
1124
  } | {
381
1125
  providerOptions?: Record<string, Record<string, any>> | undefined;
1126
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1127
+ mediaType?: string | undefined;
1128
+ mimeType?: string | undefined;
382
1129
  filename?: string | undefined;
383
1130
  type: "file";
384
- mimeType: string;
385
1131
  data: string | ArrayBuffer;
386
1132
  } | {
387
1133
  providerOptions?: Record<string, Record<string, any>> | undefined;
1134
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
388
1135
  signature?: string | undefined;
389
- state?: "streaming" | "done" | undefined;
390
1136
  type: "reasoning";
391
1137
  text: string;
392
1138
  } | {
393
1139
  providerOptions?: Record<string, Record<string, any>> | undefined;
1140
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
394
1141
  type: "redacted-reasoning";
395
1142
  data: string;
396
1143
  } | {
397
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;
398
1156
  providerExecuted?: boolean | undefined;
399
1157
  type: "tool-call";
400
1158
  toolCallId: string;
401
1159
  toolName: string;
402
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;
403
1264
  })[];
404
1265
  } | {
405
1266
  providerOptions?: Record<string, Record<string, any>> | undefined;
406
1267
  role: "tool";
407
- content: {
1268
+ content: ({
408
1269
  providerOptions?: Record<string, Record<string, any>> | undefined;
1270
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
409
1271
  args?: any;
410
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;
411
1336
  isError?: boolean | undefined;
412
1337
  experimental_content?: ({
413
1338
  type: "text";
@@ -420,13 +1345,24 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
420
1345
  type: "tool-result";
421
1346
  toolCallId: string;
422
1347
  toolName: string;
423
- result: any;
424
- }[];
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
+ })[];
425
1357
  } | {
426
1358
  providerOptions?: Record<string, Record<string, any>> | undefined;
427
1359
  role: "system";
428
1360
  content: string;
429
- })[];
1361
+ })[] | undefined;
1362
+ targetMessageId?: string | undefined;
1363
+ beforeMessageId?: string | undefined;
1364
+ searchText?: string | undefined;
1365
+ agentName: string;
430
1366
  contextOptions: {
431
1367
  excludeToolMessages?: boolean | undefined;
432
1368
  recentMessages?: number | undefined;
@@ -458,18 +1394,22 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
458
1394
  role: "user";
459
1395
  content: string | ({
460
1396
  providerOptions?: Record<string, Record<string, any>> | undefined;
1397
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
461
1398
  type: "text";
462
1399
  text: string;
463
1400
  } | {
464
1401
  providerOptions?: Record<string, Record<string, any>> | undefined;
1402
+ mediaType?: string | undefined;
465
1403
  mimeType?: string | undefined;
466
1404
  type: "image";
467
1405
  image: string | ArrayBuffer;
468
1406
  } | {
469
1407
  providerOptions?: Record<string, Record<string, any>> | undefined;
1408
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1409
+ mediaType?: string | undefined;
1410
+ mimeType?: string | undefined;
470
1411
  filename?: string | undefined;
471
1412
  type: "file";
472
- mimeType: string;
473
1413
  data: string | ArrayBuffer;
474
1414
  })[];
475
1415
  } | {
@@ -477,39 +1417,221 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
477
1417
  role: "assistant";
478
1418
  content: string | ({
479
1419
  providerOptions?: Record<string, Record<string, any>> | undefined;
1420
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
480
1421
  type: "text";
481
1422
  text: string;
482
1423
  } | {
483
1424
  providerOptions?: Record<string, Record<string, any>> | undefined;
1425
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1426
+ mediaType?: string | undefined;
1427
+ mimeType?: string | undefined;
484
1428
  filename?: string | undefined;
485
1429
  type: "file";
486
- mimeType: string;
487
1430
  data: string | ArrayBuffer;
488
1431
  } | {
489
1432
  providerOptions?: Record<string, Record<string, any>> | undefined;
1433
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
490
1434
  signature?: string | undefined;
491
- state?: "streaming" | "done" | undefined;
492
1435
  type: "reasoning";
493
1436
  text: string;
494
1437
  } | {
495
1438
  providerOptions?: Record<string, Record<string, any>> | undefined;
1439
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
496
1440
  type: "redacted-reasoning";
497
1441
  data: string;
498
1442
  } | {
499
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;
500
1455
  providerExecuted?: boolean | undefined;
501
1456
  type: "tool-call";
502
1457
  toolCallId: string;
503
1458
  toolName: string;
504
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;
505
1563
  })[];
506
1564
  } | {
507
1565
  providerOptions?: Record<string, Record<string, any>> | undefined;
508
1566
  role: "tool";
509
- content: {
1567
+ content: ({
510
1568
  providerOptions?: Record<string, Record<string, any>> | undefined;
1569
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
511
1570
  args?: any;
512
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;
513
1635
  isError?: boolean | undefined;
514
1636
  experimental_content?: ({
515
1637
  type: "text";
@@ -522,14 +1644,22 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
522
1644
  type: "tool-result";
523
1645
  toolCallId: string;
524
1646
  toolName: string;
525
- result: any;
526
- }[];
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
+ })[];
527
1656
  } | {
528
1657
  providerOptions?: Record<string, Record<string, any>> | undefined;
529
1658
  role: "system";
530
1659
  content: string;
531
1660
  } | undefined;
532
1661
  text?: string | undefined;
1662
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
533
1663
  reasoning?: string | undefined;
534
1664
  usage?: {
535
1665
  reasoningTokens?: number | undefined;
@@ -538,27 +1668,41 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
538
1668
  completionTokens: number;
539
1669
  totalTokens: number;
540
1670
  } | undefined;
541
- providerMetadata?: Record<string, Record<string, any>> | undefined;
542
1671
  sources?: ({
543
1672
  title?: string | undefined;
544
1673
  type?: "source" | undefined;
545
1674
  providerOptions?: Record<string, Record<string, any>> | undefined;
546
- url?: string | undefined;
1675
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
547
1676
  id: string;
1677
+ url: string;
548
1678
  sourceType: "url";
549
1679
  } | {
550
- filename?: string | undefined;
1680
+ providerOptions?: Record<string, Record<string, any>> | undefined;
551
1681
  providerMetadata?: Record<string, Record<string, any>> | undefined;
1682
+ filename?: string | undefined;
552
1683
  id: string;
553
1684
  title: string;
554
1685
  type: "source";
555
- sourceType: "document";
556
1686
  mediaType: string;
1687
+ sourceType: "document";
557
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;
558
1702
  reasoningDetails?: ({
559
1703
  providerOptions?: Record<string, Record<string, any>> | undefined;
1704
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
560
1705
  signature?: string | undefined;
561
- state?: "streaming" | "done" | undefined;
562
1706
  type: "reasoning";
563
1707
  text: string;
564
1708
  } | {
@@ -569,26 +1713,13 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
569
1713
  type: "redacted";
570
1714
  data: string;
571
1715
  })[] | undefined;
572
- warnings?: ({
573
- details?: string | undefined;
574
- type: "unsupported-setting";
575
- setting: string;
576
- } | {
577
- details?: string | undefined;
578
- type: "unsupported-tool";
579
- tool: any;
580
- } | {
581
- type: "other";
582
- message: string;
583
- })[] | undefined;
584
- finishReason?: "length" | "error" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
585
- _id: string;
586
- _creationTime: number;
587
1716
  status: "pending" | "success" | "failed";
588
1717
  order: number;
1718
+ _creationTime: number;
589
1719
  threadId: string;
590
1720
  stepOrder: number;
591
1721
  tool: boolean;
1722
+ _id: string;
592
1723
  }[]>>;
593
1724
  };
594
1725
  //# sourceMappingURL=definePlaygroundAPI.d.ts.map