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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/MIGRATION.md +153 -0
  2. package/README.md +32 -27
  3. package/dist/UIMessages.d.ts +46 -0
  4. package/dist/UIMessages.d.ts.map +1 -0
  5. package/dist/UIMessages.js +546 -0
  6. package/dist/UIMessages.js.map +1 -0
  7. package/dist/client/createTool.d.ts +126 -27
  8. package/dist/client/createTool.d.ts.map +1 -1
  9. package/dist/client/createTool.js +67 -12
  10. package/dist/client/createTool.js.map +1 -1
  11. package/dist/client/defaultComponent.d.ts +11 -0
  12. package/dist/client/defaultComponent.d.ts.map +1 -0
  13. package/dist/client/defaultComponent.js +7 -0
  14. package/dist/client/defaultComponent.js.map +1 -0
  15. package/dist/client/definePlaygroundAPI.d.ts +1335 -204
  16. package/dist/client/definePlaygroundAPI.d.ts.map +1 -1
  17. package/dist/client/definePlaygroundAPI.js +52 -28
  18. package/dist/client/definePlaygroundAPI.js.map +1 -1
  19. package/dist/client/files.d.ts +20 -7
  20. package/dist/client/files.d.ts.map +1 -1
  21. package/dist/client/files.js +68 -11
  22. package/dist/client/files.js.map +1 -1
  23. package/dist/client/index.d.ts +1116 -978
  24. package/dist/client/index.d.ts.map +1 -1
  25. package/dist/client/index.js +332 -747
  26. package/dist/client/index.js.map +1 -1
  27. package/dist/client/messages.d.ts +461 -0
  28. package/dist/client/messages.d.ts.map +1 -0
  29. package/dist/client/messages.js +106 -0
  30. package/dist/client/messages.js.map +1 -0
  31. package/dist/client/mockModel.d.ts +42 -0
  32. package/dist/client/mockModel.d.ts.map +1 -0
  33. package/dist/client/mockModel.js +182 -0
  34. package/dist/client/mockModel.js.map +1 -0
  35. package/dist/client/saveInputMessages.d.ts +20 -0
  36. package/dist/client/saveInputMessages.d.ts.map +1 -0
  37. package/dist/client/saveInputMessages.js +58 -0
  38. package/dist/client/saveInputMessages.js.map +1 -0
  39. package/dist/client/search.d.ts +350 -39
  40. package/dist/client/search.d.ts.map +1 -1
  41. package/dist/client/search.js +350 -39
  42. package/dist/client/search.js.map +1 -1
  43. package/dist/client/start.d.ts +84 -0
  44. package/dist/client/start.d.ts.map +1 -0
  45. package/dist/client/start.js +185 -0
  46. package/dist/client/start.js.map +1 -0
  47. package/dist/client/streamText.d.ts +46 -0
  48. package/dist/client/streamText.d.ts.map +1 -0
  49. package/dist/client/streamText.js +117 -0
  50. package/dist/client/streamText.js.map +1 -0
  51. package/dist/client/streaming.d.ts +3716 -32
  52. package/dist/client/streaming.d.ts.map +1 -1
  53. package/dist/client/streaming.js +161 -59
  54. package/dist/client/streaming.js.map +1 -1
  55. package/dist/client/threads.d.ts +46 -0
  56. package/dist/client/threads.d.ts.map +1 -0
  57. package/dist/client/threads.js +49 -0
  58. package/dist/client/threads.js.map +1 -0
  59. package/dist/client/types.d.ts +266 -128
  60. package/dist/client/types.d.ts.map +1 -1
  61. package/dist/client/utils.d.ts +4 -0
  62. package/dist/client/utils.d.ts.map +1 -0
  63. package/dist/client/utils.js +21 -0
  64. package/dist/client/utils.js.map +1 -0
  65. package/dist/component/_generated/api.d.ts +24 -2178
  66. package/dist/component/_generated/api.d.ts.map +1 -1
  67. package/dist/component/_generated/api.js +10 -1
  68. package/dist/component/_generated/api.js.map +1 -1
  69. package/dist/component/_generated/component.d.ts +3120 -0
  70. package/dist/component/_generated/component.d.ts.map +1 -0
  71. package/dist/component/_generated/component.js +11 -0
  72. package/dist/component/_generated/component.js.map +1 -0
  73. package/dist/component/_generated/dataModel.d.ts +4 -18
  74. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  75. package/dist/component/_generated/dataModel.js +11 -0
  76. package/dist/component/_generated/dataModel.js.map +1 -0
  77. package/dist/component/_generated/server.d.ts +10 -38
  78. package/dist/component/_generated/server.d.ts.map +1 -1
  79. package/dist/component/_generated/server.js +9 -5
  80. package/dist/component/_generated/server.js.map +1 -1
  81. package/dist/component/files.d.ts +16 -10
  82. package/dist/component/files.d.ts.map +1 -1
  83. package/dist/component/files.js +10 -2
  84. package/dist/component/files.js.map +1 -1
  85. package/dist/component/messages.d.ts +2578 -366
  86. package/dist/component/messages.d.ts.map +1 -1
  87. package/dist/component/messages.js +397 -154
  88. package/dist/component/messages.js.map +1 -1
  89. package/dist/component/schema.d.ts +5697 -3584
  90. package/dist/component/schema.d.ts.map +1 -1
  91. package/dist/component/schema.js +18 -41
  92. package/dist/component/schema.js.map +1 -1
  93. package/dist/component/streams.d.ts +39 -339
  94. package/dist/component/streams.d.ts.map +1 -1
  95. package/dist/component/streams.js +114 -73
  96. package/dist/component/streams.js.map +1 -1
  97. package/dist/component/threads.d.ts +13 -13
  98. package/dist/component/users.d.ts +7 -7
  99. package/dist/component/vector/index.d.ts +1 -1
  100. package/dist/component/vector/index.d.ts.map +1 -1
  101. package/dist/component/vector/index.js +1 -3
  102. package/dist/component/vector/index.js.map +1 -1
  103. package/dist/deltas.d.ts +43 -0
  104. package/dist/deltas.d.ts.map +1 -0
  105. package/dist/deltas.js +446 -0
  106. package/dist/deltas.js.map +1 -0
  107. package/dist/mapping.d.ts +38 -20
  108. package/dist/mapping.d.ts.map +1 -1
  109. package/dist/mapping.js +365 -97
  110. package/dist/mapping.js.map +1 -1
  111. package/dist/react/SmoothText.d.ts +5 -0
  112. package/dist/react/SmoothText.d.ts.map +1 -0
  113. package/dist/react/SmoothText.js +6 -0
  114. package/dist/react/SmoothText.js.map +1 -0
  115. package/dist/react/index.d.ts +5 -77
  116. package/dist/react/index.d.ts.map +1 -1
  117. package/dist/react/index.js +6 -160
  118. package/dist/react/index.js.map +1 -1
  119. package/dist/react/optimisticallySendMessage.d.ts +36 -3
  120. package/dist/react/optimisticallySendMessage.d.ts.map +1 -1
  121. package/dist/react/optimisticallySendMessage.js +35 -9
  122. package/dist/react/optimisticallySendMessage.js.map +1 -1
  123. package/dist/react/types.d.ts +4 -18
  124. package/dist/react/types.d.ts.map +1 -1
  125. package/dist/react/useDeltaStreams.d.ts +10 -0
  126. package/dist/react/useDeltaStreams.d.ts.map +1 -0
  127. package/dist/react/useDeltaStreams.js +106 -0
  128. package/dist/react/useDeltaStreams.js.map +1 -0
  129. package/dist/react/useSmoothText.d.ts +13 -12
  130. package/dist/react/useSmoothText.d.ts.map +1 -1
  131. package/dist/react/useSmoothText.js +32 -15
  132. package/dist/react/useSmoothText.js.map +1 -1
  133. package/dist/react/useStreamingUIMessages.d.ts +22 -0
  134. package/dist/react/useStreamingUIMessages.d.ts.map +1 -0
  135. package/dist/react/useStreamingUIMessages.js +92 -0
  136. package/dist/react/useStreamingUIMessages.js.map +1 -0
  137. package/dist/react/useThreadMessages.d.ts +104 -0
  138. package/dist/react/useThreadMessages.d.ts.map +1 -0
  139. package/dist/react/useThreadMessages.js +148 -0
  140. package/dist/react/useThreadMessages.js.map +1 -0
  141. package/dist/react/useUIMessages.d.ts +96 -0
  142. package/dist/react/useUIMessages.d.ts.map +1 -0
  143. package/dist/react/useUIMessages.js +108 -0
  144. package/dist/react/useUIMessages.js.map +1 -0
  145. package/dist/shared.d.ts +20 -4
  146. package/dist/shared.d.ts.map +1 -1
  147. package/dist/shared.js +45 -8
  148. package/dist/shared.js.map +1 -1
  149. package/dist/validators.d.ts +22981 -5666
  150. package/dist/validators.d.ts.map +1 -1
  151. package/dist/validators.js +245 -137
  152. package/dist/validators.js.map +1 -1
  153. package/package.json +101 -51
  154. package/src/UIMessages.combineUIMessages.test.ts +239 -0
  155. package/src/UIMessages.test.ts +273 -0
  156. package/src/UIMessages.ts +739 -0
  157. package/src/client/approval.test.ts +350 -0
  158. package/src/client/createTool.ts +291 -76
  159. package/src/client/defaultComponent.ts +17 -0
  160. package/src/client/definePlaygroundAPI.ts +67 -31
  161. package/src/client/files.ts +100 -20
  162. package/src/client/index.test.ts +40 -85
  163. package/src/client/index.ts +638 -1289
  164. package/src/client/messages.ts +237 -0
  165. package/src/client/mockModel.ts +252 -0
  166. package/src/client/saveInputMessages.test.ts +583 -0
  167. package/src/client/saveInputMessages.ts +101 -0
  168. package/src/client/search.test.ts +1207 -0
  169. package/src/client/search.ts +581 -70
  170. package/src/client/start.ts +327 -0
  171. package/src/client/streamText.ts +187 -0
  172. package/src/client/streaming.test.ts +186 -0
  173. package/src/client/streaming.ts +241 -97
  174. package/src/client/threads.ts +83 -0
  175. package/src/client/types.ts +370 -219
  176. package/src/client/utils.ts +27 -0
  177. package/src/component/_generated/api.ts +64 -0
  178. package/src/component/_generated/component.ts +4902 -0
  179. package/src/component/_generated/{server.d.ts → server.ts} +33 -21
  180. package/src/component/files.ts +11 -2
  181. package/src/component/messages.test.ts +195 -51
  182. package/src/component/messages.ts +500 -201
  183. package/src/component/schema.ts +20 -46
  184. package/src/component/setup.test.ts +7 -0
  185. package/src/component/streams.ts +184 -83
  186. package/src/component/users.test.ts +0 -1
  187. package/src/component/vector/index.ts +1 -3
  188. package/src/deltas.test.ts +626 -0
  189. package/src/deltas.ts +569 -0
  190. package/src/fromUIMessages.test.ts +497 -0
  191. package/src/mapping.test.ts +180 -6
  192. package/src/mapping.ts +479 -162
  193. package/src/react/SmoothText.tsx +9 -0
  194. package/src/react/index.ts +10 -230
  195. package/src/react/optimisticallySendMessage.ts +55 -12
  196. package/src/react/types.ts +6 -39
  197. package/src/react/useDeltaStreams.ts +160 -0
  198. package/src/react/useSmoothText.ts +56 -36
  199. package/src/react/useStreamingUIMessages.ts +143 -0
  200. package/src/react/useThreadMessages.ts +262 -0
  201. package/src/react/useUIMessages.test.ts +255 -0
  202. package/src/react/useUIMessages.ts +195 -0
  203. package/src/shared.ts +88 -12
  204. package/src/test.ts +18 -0
  205. package/src/toUIMessages.test.ts +1269 -0
  206. package/src/validators.test.ts +18 -19
  207. package/src/validators.ts +325 -185
  208. package/dist/client/_generated/_ignore.d.ts +0 -1
  209. package/dist/client/_generated/_ignore.d.ts.map +0 -1
  210. package/dist/client/_generated/_ignore.js +0 -3
  211. package/dist/client/_generated/_ignore.js.map +0 -1
  212. package/dist/client/listMessages.d.ts +0 -22
  213. package/dist/client/listMessages.d.ts.map +0 -1
  214. package/dist/client/listMessages.js +0 -25
  215. package/dist/client/listMessages.js.map +0 -1
  216. package/dist/package.json +0 -3
  217. package/dist/react/deltas.d.ts +0 -26
  218. package/dist/react/deltas.d.ts.map +0 -1
  219. package/dist/react/deltas.js +0 -384
  220. package/dist/react/deltas.js.map +0 -1
  221. package/dist/react/toUIMessages.d.ts +0 -15
  222. package/dist/react/toUIMessages.d.ts.map +0 -1
  223. package/dist/react/toUIMessages.js +0 -211
  224. package/dist/react/toUIMessages.js.map +0 -1
  225. package/src/client/listMessages.ts +0 -38
  226. package/src/component/_generated/api.d.ts +0 -2202
  227. package/src/component/_generated/api.js +0 -23
  228. package/src/component/_generated/server.js +0 -90
  229. package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  230. package/src/react/deltas.test.ts +0 -315
  231. package/src/react/deltas.ts +0 -478
  232. package/src/react/toUIMessages.test.ts +0 -420
  233. package/src/react/toUIMessages.ts +0 -253
  234. package/src/vitest.config.ts +0 -7
  235. /package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +0 -0
@@ -15,15 +15,15 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
15
15
  apiKey: string;
16
16
  }, Promise<boolean>>;
17
17
  listUsers: import("convex/server").RegisteredQuery<"public", {
18
- apiKey: string;
19
18
  paginationOpts: {
20
- id?: number | undefined;
21
- endCursor?: string | null | undefined;
22
- maximumRowsRead?: number | undefined;
23
- maximumBytesRead?: number | undefined;
19
+ id?: number;
20
+ endCursor?: string | null;
21
+ maximumRowsRead?: number;
22
+ maximumBytesRead?: number;
24
23
  numItems: number;
25
24
  cursor: string | null;
26
25
  };
26
+ apiKey: string;
27
27
  }, Promise<{
28
28
  page: {
29
29
  _id: string;
@@ -31,20 +31,20 @@ 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
- apiKey: string;
40
39
  paginationOpts: {
41
- id?: number | undefined;
42
- endCursor?: string | null | undefined;
43
- maximumRowsRead?: number | undefined;
44
- maximumBytesRead?: number | undefined;
40
+ id?: number;
41
+ endCursor?: string | null;
42
+ maximumRowsRead?: number;
43
+ maximumBytesRead?: number;
45
44
  numItems: number;
46
45
  cursor: string | null;
47
46
  };
47
+ apiKey: string;
48
48
  }, Promise<{
49
49
  page: {
50
50
  lastAgentName: string | undefined;
@@ -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
- apiKey: string;
68
77
  paginationOpts: {
69
- id?: number | undefined;
70
- endCursor?: string | null | undefined;
71
- maximumRowsRead?: number | undefined;
72
- maximumBytesRead?: number | undefined;
78
+ id?: number;
79
+ endCursor?: string | null;
80
+ maximumRowsRead?: number;
81
+ maximumBytesRead?: number;
73
82
  numItems: number;
74
83
  cursor: string | null;
75
84
  };
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?: {
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;
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
+ 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
+ })[];
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
+ 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";
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
+ 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;
118
403
  } | {
404
+ type: "other";
405
+ message: string;
406
+ })[] | undefined;
407
+ finishReason?: "length" | "error" | "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
+ _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
+ }>>;
223
435
  listAgents: import("convex/server").RegisteredQuery<"public", {
224
436
  userId?: string | undefined;
225
437
  threadId?: string | undefined;
@@ -233,9 +445,9 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
233
445
  tools: string[];
234
446
  }[]>>;
235
447
  createThread: import("convex/server").RegisteredMutation<"public", {
448
+ agentName?: string | undefined;
236
449
  title?: string | undefined;
237
450
  summary?: string | undefined;
238
- agentName?: string | undefined;
239
451
  userId: string;
240
452
  apiKey: string;
241
453
  }, Promise<{
@@ -243,23 +455,28 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
243
455
  }>>;
244
456
  generateText: import("convex/server").RegisteredAction<"public", {
245
457
  system?: string | undefined;
458
+ prompt?: string | undefined;
246
459
  messages?: ({
247
460
  providerOptions?: Record<string, Record<string, any>> | undefined;
248
461
  role: "user";
249
462
  content: string | ({
250
463
  providerOptions?: Record<string, Record<string, any>> | undefined;
464
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
251
465
  type: "text";
252
466
  text: string;
253
467
  } | {
254
468
  providerOptions?: Record<string, Record<string, any>> | undefined;
469
+ mediaType?: string | undefined;
255
470
  mimeType?: string | undefined;
256
471
  type: "image";
257
472
  image: string | ArrayBuffer;
258
473
  } | {
259
474
  providerOptions?: Record<string, Record<string, any>> | undefined;
475
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
476
+ mediaType?: string | undefined;
477
+ mimeType?: string | undefined;
260
478
  filename?: string | undefined;
261
479
  type: "file";
262
- mimeType: string;
263
480
  data: string | ArrayBuffer;
264
481
  })[];
265
482
  } | {
@@ -267,39 +484,221 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
267
484
  role: "assistant";
268
485
  content: string | ({
269
486
  providerOptions?: Record<string, Record<string, any>> | undefined;
487
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
270
488
  type: "text";
271
489
  text: string;
272
490
  } | {
273
491
  providerOptions?: Record<string, Record<string, any>> | undefined;
492
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
493
+ mediaType?: string | undefined;
494
+ mimeType?: string | undefined;
274
495
  filename?: string | undefined;
275
496
  type: "file";
276
- mimeType: string;
277
497
  data: string | ArrayBuffer;
278
498
  } | {
279
499
  providerOptions?: Record<string, Record<string, any>> | undefined;
500
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
280
501
  signature?: string | undefined;
281
- state?: "streaming" | "done" | undefined;
282
502
  type: "reasoning";
283
503
  text: string;
284
504
  } | {
285
505
  providerOptions?: Record<string, Record<string, any>> | undefined;
506
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
286
507
  type: "redacted-reasoning";
287
508
  data: string;
288
509
  } | {
289
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;
290
522
  providerExecuted?: boolean | undefined;
291
523
  type: "tool-call";
292
524
  toolCallId: string;
293
525
  toolName: string;
294
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;
295
630
  })[];
296
631
  } | {
297
632
  providerOptions?: Record<string, Record<string, any>> | undefined;
298
633
  role: "tool";
299
- content: {
634
+ content: ({
300
635
  providerOptions?: Record<string, Record<string, any>> | undefined;
636
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
301
637
  args?: any;
302
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;
303
702
  isError?: boolean | undefined;
304
703
  experimental_content?: ({
305
704
  type: "text";
@@ -312,20 +711,26 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
312
711
  type: "tool-result";
313
712
  toolCallId: string;
314
713
  toolName: string;
315
- result: any;
316
- }[];
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
+ })[];
317
723
  } | {
318
724
  providerOptions?: Record<string, Record<string, any>> | undefined;
319
725
  role: "system";
320
726
  content: string;
321
727
  })[] | undefined;
322
- prompt?: string | undefined;
323
728
  contextOptions?: {
324
729
  excludeToolMessages?: boolean | undefined;
325
730
  recentMessages?: number | undefined;
326
731
  searchOptions?: {
327
- textSearch?: boolean | undefined;
328
732
  vectorSearch?: boolean | undefined;
733
+ textSearch?: boolean | undefined;
329
734
  vectorScoreThreshold?: number | undefined;
330
735
  messageRange?: {
331
736
  before: number;
@@ -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
+ 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
+ }[];
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
+ 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;
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,19 +1345,31 @@ 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;
1366
+ apiKey: string;
430
1367
  contextOptions: {
431
1368
  excludeToolMessages?: boolean | undefined;
432
1369
  recentMessages?: number | undefined;
433
1370
  searchOptions?: {
434
- textSearch?: boolean | undefined;
435
1371
  vectorSearch?: boolean | undefined;
1372
+ textSearch?: boolean | undefined;
436
1373
  vectorScoreThreshold?: number | undefined;
437
1374
  messageRange?: {
438
1375
  before: number;
@@ -442,10 +1379,9 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
442
1379
  } | undefined;
443
1380
  searchOtherThreads?: boolean | undefined;
444
1381
  };
445
- apiKey: string;
446
1382
  }, Promise<{
447
- id?: string | undefined;
448
1383
  userId?: string | undefined;
1384
+ id?: string | undefined;
449
1385
  embeddingId?: string | undefined;
450
1386
  fileIds?: string[] | undefined;
451
1387
  error?: string | 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
+ 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;
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,36 +1668,23 @@ 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
- title?: string | undefined;
544
1672
  type?: "source" | undefined;
545
1673
  providerOptions?: Record<string, Record<string, any>> | undefined;
546
- url?: string | undefined;
1674
+ providerMetadata?: Record<string, Record<string, any>> | undefined;
1675
+ title?: string | 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;
552
- id: string;
553
- title: string;
1682
+ filename?: string | undefined;
554
1683
  type: "source";
555
- sourceType: "document";
1684
+ id: string;
556
1685
  mediaType: string;
557
- })[] | undefined;
558
- reasoningDetails?: ({
559
- providerOptions?: Record<string, Record<string, any>> | undefined;
560
- signature?: string | undefined;
561
- state?: "streaming" | "done" | undefined;
562
- type: "reasoning";
563
- text: string;
564
- } | {
565
- signature?: string | undefined;
566
- type: "text";
567
- text: string;
568
- } | {
569
- type: "redacted";
570
- data: string;
1686
+ sourceType: "document";
1687
+ title: string;
571
1688
  })[] | undefined;
572
1689
  warnings?: ({
573
1690
  details?: string | undefined;
@@ -582,12 +1699,26 @@ export declare function definePlaygroundAPI<DataModel extends GenericDataModel>(
582
1699
  message: string;
583
1700
  })[] | undefined;
584
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;
585
1716
  _id: string;
586
1717
  _creationTime: number;
587
- status: "pending" | "success" | "failed";
588
- order: number;
589
1718
  threadId: string;
1719
+ order: number;
590
1720
  stepOrder: number;
1721
+ status: "pending" | "success" | "failed";
591
1722
  tool: boolean;
592
1723
  }[]>>;
593
1724
  };