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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/MIGRATION.md +153 -0
  2. package/package.json +4 -2
  3. package/src/UIMessages.ts +135 -0
  4. package/src/client/approval.test.ts +350 -0
  5. package/src/client/createTool.ts +50 -52
  6. package/src/client/index.ts +162 -1
  7. package/src/client/mockModel.ts +9 -2
  8. package/src/client/search.test.ts +4 -5
  9. package/src/client/search.ts +47 -2
  10. package/src/client/start.ts +41 -24
  11. package/src/client/streamText.ts +27 -3
  12. package/src/client/streaming.integration.test.ts +1206 -0
  13. package/src/client/streaming.ts +41 -12
  14. package/src/client/types.ts +14 -12
  15. package/src/component/_generated/component.ts +53 -64
  16. package/src/component/messages.ts +12 -2
  17. package/src/deltas.ts +0 -1
  18. package/src/mapping.test.ts +143 -1
  19. package/src/mapping.ts +115 -6
  20. package/src/react/useDeltaStreams.ts +6 -0
  21. package/dist/UIMessages.d.ts +0 -46
  22. package/dist/UIMessages.d.ts.map +0 -1
  23. package/dist/UIMessages.js +0 -546
  24. package/dist/UIMessages.js.map +0 -1
  25. package/dist/client/createTool.d.ts +0 -170
  26. package/dist/client/createTool.d.ts.map +0 -1
  27. package/dist/client/createTool.js +0 -115
  28. package/dist/client/createTool.js.map +0 -1
  29. package/dist/client/defaultComponent.d.ts +0 -11
  30. package/dist/client/defaultComponent.d.ts.map +0 -1
  31. package/dist/client/defaultComponent.js +0 -7
  32. package/dist/client/defaultComponent.js.map +0 -1
  33. package/dist/client/definePlaygroundAPI.d.ts +0 -1725
  34. package/dist/client/definePlaygroundAPI.d.ts.map +0 -1
  35. package/dist/client/definePlaygroundAPI.js +0 -271
  36. package/dist/client/definePlaygroundAPI.js.map +0 -1
  37. package/dist/client/files.d.ts +0 -69
  38. package/dist/client/files.d.ts.map +0 -1
  39. package/dist/client/files.js +0 -181
  40. package/dist/client/files.js.map +0 -1
  41. package/dist/client/index.d.ts +0 -2044
  42. package/dist/client/index.d.ts.map +0 -1
  43. package/dist/client/index.js +0 -804
  44. package/dist/client/index.js.map +0 -1
  45. package/dist/client/messages.d.ts +0 -461
  46. package/dist/client/messages.d.ts.map +0 -1
  47. package/dist/client/messages.js +0 -106
  48. package/dist/client/messages.js.map +0 -1
  49. package/dist/client/mockModel.d.ts +0 -42
  50. package/dist/client/mockModel.d.ts.map +0 -1
  51. package/dist/client/mockModel.js +0 -175
  52. package/dist/client/mockModel.js.map +0 -1
  53. package/dist/client/saveInputMessages.d.ts +0 -20
  54. package/dist/client/saveInputMessages.d.ts.map +0 -1
  55. package/dist/client/saveInputMessages.js +0 -58
  56. package/dist/client/saveInputMessages.js.map +0 -1
  57. package/dist/client/search.d.ts +0 -493
  58. package/dist/client/search.d.ts.map +0 -1
  59. package/dist/client/search.js +0 -425
  60. package/dist/client/search.js.map +0 -1
  61. package/dist/client/start.d.ts +0 -84
  62. package/dist/client/start.d.ts.map +0 -1
  63. package/dist/client/start.js +0 -171
  64. package/dist/client/start.js.map +0 -1
  65. package/dist/client/streamText.d.ts +0 -46
  66. package/dist/client/streamText.d.ts.map +0 -1
  67. package/dist/client/streamText.js +0 -93
  68. package/dist/client/streamText.js.map +0 -1
  69. package/dist/client/streaming.d.ts +0 -3767
  70. package/dist/client/streaming.d.ts.map +0 -1
  71. package/dist/client/streaming.js +0 -294
  72. package/dist/client/streaming.js.map +0 -1
  73. package/dist/client/threads.d.ts +0 -46
  74. package/dist/client/threads.d.ts.map +0 -1
  75. package/dist/client/threads.js +0 -49
  76. package/dist/client/threads.js.map +0 -1
  77. package/dist/client/types.d.ts +0 -460
  78. package/dist/client/types.d.ts.map +0 -1
  79. package/dist/client/types.js +0 -2
  80. package/dist/client/types.js.map +0 -1
  81. package/dist/client/utils.d.ts +0 -4
  82. package/dist/client/utils.d.ts.map +0 -1
  83. package/dist/client/utils.js +0 -21
  84. package/dist/client/utils.js.map +0 -1
  85. package/dist/component/_generated/api.d.ts +0 -48
  86. package/dist/component/_generated/api.d.ts.map +0 -1
  87. package/dist/component/_generated/api.js +0 -31
  88. package/dist/component/_generated/api.js.map +0 -1
  89. package/dist/component/_generated/component.d.ts +0 -3119
  90. package/dist/component/_generated/component.d.ts.map +0 -1
  91. package/dist/component/_generated/component.js +0 -11
  92. package/dist/component/_generated/component.js.map +0 -1
  93. package/dist/component/_generated/dataModel.d.ts +0 -46
  94. package/dist/component/_generated/dataModel.d.ts.map +0 -1
  95. package/dist/component/_generated/dataModel.js +0 -11
  96. package/dist/component/_generated/dataModel.js.map +0 -1
  97. package/dist/component/_generated/server.d.ts +0 -121
  98. package/dist/component/_generated/server.d.ts.map +0 -1
  99. package/dist/component/_generated/server.js +0 -78
  100. package/dist/component/_generated/server.js.map +0 -1
  101. package/dist/component/apiKeys.d.ts +0 -11
  102. package/dist/component/apiKeys.d.ts.map +0 -1
  103. package/dist/component/apiKeys.js +0 -69
  104. package/dist/component/apiKeys.js.map +0 -1
  105. package/dist/component/convex.config.d.ts +0 -3
  106. package/dist/component/convex.config.d.ts.map +0 -1
  107. package/dist/component/convex.config.js +0 -3
  108. package/dist/component/convex.config.js.map +0 -1
  109. package/dist/component/files.d.ts +0 -97
  110. package/dist/component/files.d.ts.map +0 -1
  111. package/dist/component/files.js +0 -190
  112. package/dist/component/files.js.map +0 -1
  113. package/dist/component/messages.d.ts +0 -3850
  114. package/dist/component/messages.d.ts.map +0 -1
  115. package/dist/component/messages.js +0 -747
  116. package/dist/component/messages.js.map +0 -1
  117. package/dist/component/schema.d.ts +0 -8026
  118. package/dist/component/schema.d.ts.map +0 -1
  119. package/dist/component/schema.js +0 -147
  120. package/dist/component/schema.js.map +0 -1
  121. package/dist/component/streams.d.ts +0 -128
  122. package/dist/component/streams.d.ts.map +0 -1
  123. package/dist/component/streams.js +0 -413
  124. package/dist/component/streams.js.map +0 -1
  125. package/dist/component/threads.d.ts +0 -115
  126. package/dist/component/threads.d.ts.map +0 -1
  127. package/dist/component/threads.js +0 -208
  128. package/dist/component/threads.js.map +0 -1
  129. package/dist/component/users.d.ts +0 -52
  130. package/dist/component/users.d.ts.map +0 -1
  131. package/dist/component/users.js +0 -229
  132. package/dist/component/users.js.map +0 -1
  133. package/dist/component/vector/index.d.ts +0 -61
  134. package/dist/component/vector/index.d.ts.map +0 -1
  135. package/dist/component/vector/index.js +0 -146
  136. package/dist/component/vector/index.js.map +0 -1
  137. package/dist/component/vector/tables.d.ts +0 -58
  138. package/dist/component/vector/tables.d.ts.map +0 -1
  139. package/dist/component/vector/tables.js +0 -56
  140. package/dist/component/vector/tables.js.map +0 -1
  141. package/dist/deltas.d.ts +0 -43
  142. package/dist/deltas.d.ts.map +0 -1
  143. package/dist/deltas.js +0 -447
  144. package/dist/deltas.js.map +0 -1
  145. package/dist/mapping.d.ts +0 -54
  146. package/dist/mapping.d.ts.map +0 -1
  147. package/dist/mapping.js +0 -626
  148. package/dist/mapping.js.map +0 -1
  149. package/dist/react/SmoothText.d.ts +0 -5
  150. package/dist/react/SmoothText.d.ts.map +0 -1
  151. package/dist/react/SmoothText.js +0 -6
  152. package/dist/react/SmoothText.js.map +0 -1
  153. package/dist/react/index.d.ts +0 -25
  154. package/dist/react/index.d.ts.map +0 -1
  155. package/dist/react/index.js +0 -70
  156. package/dist/react/index.js.map +0 -1
  157. package/dist/react/optimisticallySendMessage.d.ts +0 -42
  158. package/dist/react/optimisticallySendMessage.d.ts.map +0 -1
  159. package/dist/react/optimisticallySendMessage.js +0 -74
  160. package/dist/react/optimisticallySendMessage.js.map +0 -1
  161. package/dist/react/types.d.ts +0 -12
  162. package/dist/react/types.d.ts.map +0 -1
  163. package/dist/react/types.js +0 -2
  164. package/dist/react/types.js.map +0 -1
  165. package/dist/react/useDeltaStreams.d.ts +0 -10
  166. package/dist/react/useDeltaStreams.d.ts.map +0 -1
  167. package/dist/react/useDeltaStreams.js +0 -101
  168. package/dist/react/useDeltaStreams.js.map +0 -1
  169. package/dist/react/useSmoothText.d.ts +0 -27
  170. package/dist/react/useSmoothText.d.ts.map +0 -1
  171. package/dist/react/useSmoothText.js +0 -68
  172. package/dist/react/useSmoothText.js.map +0 -1
  173. package/dist/react/useStreamingUIMessages.d.ts +0 -22
  174. package/dist/react/useStreamingUIMessages.d.ts.map +0 -1
  175. package/dist/react/useStreamingUIMessages.js +0 -92
  176. package/dist/react/useStreamingUIMessages.js.map +0 -1
  177. package/dist/react/useThreadMessages.d.ts +0 -104
  178. package/dist/react/useThreadMessages.d.ts.map +0 -1
  179. package/dist/react/useThreadMessages.js +0 -148
  180. package/dist/react/useThreadMessages.js.map +0 -1
  181. package/dist/react/useUIMessages.d.ts +0 -96
  182. package/dist/react/useUIMessages.d.ts.map +0 -1
  183. package/dist/react/useUIMessages.js +0 -108
  184. package/dist/react/useUIMessages.js.map +0 -1
  185. package/dist/shared.d.ts +0 -26
  186. package/dist/shared.d.ts.map +0 -1
  187. package/dist/shared.js +0 -67
  188. package/dist/shared.js.map +0 -1
  189. package/dist/validators.d.ts +0 -24516
  190. package/dist/validators.d.ts.map +0 -1
  191. package/dist/validators.js +0 -475
  192. package/dist/validators.js.map +0 -1
@@ -1,493 +0,0 @@
1
- import { type EmbeddingModel, type ModelMessage } from "ai";
2
- import type { MessageDoc } from "../validators.js";
3
- import { type VectorDimension } from "../component/vector/tables.js";
4
- import type { Message } from "../validators.js";
5
- import type { AgentComponent, Config, ContextOptions, Options, QueryCtx, MutationCtx, ActionCtx } from "./types.js";
6
- export type GetEmbedding = (text: string) => Promise<{
7
- embedding: number[];
8
- /** @deprecated Use embeddingModel instead. */
9
- textEmbeddingModel: string | EmbeddingModel;
10
- embeddingModel?: string | EmbeddingModel;
11
- } | {
12
- embedding: number[];
13
- /** @deprecated Use embeddingModel instead. */
14
- textEmbeddingModel?: string | EmbeddingModel;
15
- embeddingModel: string | EmbeddingModel;
16
- }>;
17
- /**
18
- * Fetch the context messages for a thread.
19
- * @param ctx Either a query, mutation, or action ctx.
20
- * If it is not an action context, you can't do text or
21
- * vector search.
22
- * @param args The associated thread, user, message
23
- * @returns
24
- */
25
- export declare function fetchContextMessages(ctx: QueryCtx | MutationCtx | ActionCtx, component: AgentComponent, args: {
26
- userId: string | undefined;
27
- threadId: string | undefined;
28
- /**
29
- * If targetMessageId is not provided, this text will be used
30
- * for text and vector search
31
- */
32
- searchText?: string;
33
- /**
34
- * If provided, it will use this message for text/vector search (if enabled)
35
- * and will only fetch messages up to (and including) this message's "order"
36
- */
37
- targetMessageId?: string;
38
- /**
39
- * @deprecated use searchText and targetMessageId instead
40
- */
41
- messages?: (ModelMessage | Message)[];
42
- /**
43
- * @deprecated use targetMessageId instead
44
- */
45
- upToAndIncludingMessageId?: string;
46
- contextOptions: ContextOptions;
47
- getEmbedding?: GetEmbedding;
48
- }): Promise<MessageDoc[]>;
49
- export declare function fetchRecentAndSearchMessages(ctx: QueryCtx | MutationCtx | ActionCtx, component: AgentComponent, args: {
50
- userId: string | undefined;
51
- threadId: string | undefined;
52
- /**
53
- * If targetMessageId is not provided, this text will be used
54
- * for text and vector search
55
- */
56
- searchText?: string;
57
- /**
58
- * If provided, it will use this message for text/vector search (if enabled)
59
- * and will only fetch messages up to (and including) this message's "order"
60
- */
61
- targetMessageId?: string;
62
- /**
63
- * @deprecated use searchText and targetMessageId instead
64
- */
65
- messages?: (ModelMessage | Message)[];
66
- /**
67
- * @deprecated use targetMessageId instead
68
- */
69
- upToAndIncludingMessageId?: string;
70
- contextOptions: ContextOptions;
71
- getEmbedding?: GetEmbedding;
72
- }): Promise<{
73
- recentMessages: MessageDoc[];
74
- searchMessages: MessageDoc[];
75
- }>;
76
- /**
77
- * Filter out tool messages that don't have both a tool call and response.
78
- * For the approval workflow, tool calls with approval responses (but no tool-results yet)
79
- * should also be kept.
80
- * @param docs The messages to filter.
81
- * @returns The filtered messages.
82
- */
83
- export declare function filterOutOrphanedToolMessages(docs: MessageDoc[]): {
84
- id?: string | undefined;
85
- userId?: string | undefined;
86
- embeddingId?: string | undefined;
87
- fileIds?: string[] | undefined;
88
- error?: string | undefined;
89
- agentName?: string | undefined;
90
- model?: string | undefined;
91
- provider?: string | undefined;
92
- providerOptions?: Record<string, Record<string, any>> | undefined;
93
- message?: {
94
- providerOptions?: Record<string, Record<string, any>> | undefined;
95
- role: "user";
96
- content: string | ({
97
- providerOptions?: Record<string, Record<string, any>> | undefined;
98
- providerMetadata?: Record<string, Record<string, any>> | undefined;
99
- type: "text";
100
- text: string;
101
- } | {
102
- providerOptions?: Record<string, Record<string, any>> | undefined;
103
- mediaType?: string | undefined;
104
- mimeType?: string | undefined;
105
- type: "image";
106
- image: string | ArrayBuffer;
107
- } | {
108
- providerOptions?: Record<string, Record<string, any>> | undefined;
109
- providerMetadata?: Record<string, Record<string, any>> | undefined;
110
- mediaType?: string | undefined;
111
- mimeType?: string | undefined;
112
- filename?: string | undefined;
113
- type: "file";
114
- data: string | ArrayBuffer;
115
- })[];
116
- } | {
117
- providerOptions?: Record<string, Record<string, any>> | undefined;
118
- role: "assistant";
119
- content: string | ({
120
- providerOptions?: Record<string, Record<string, any>> | undefined;
121
- providerMetadata?: Record<string, Record<string, any>> | undefined;
122
- type: "text";
123
- text: string;
124
- } | {
125
- providerOptions?: Record<string, Record<string, any>> | undefined;
126
- providerMetadata?: Record<string, Record<string, any>> | undefined;
127
- mediaType?: string | undefined;
128
- mimeType?: string | undefined;
129
- filename?: string | undefined;
130
- type: "file";
131
- data: string | ArrayBuffer;
132
- } | {
133
- providerOptions?: Record<string, Record<string, any>> | undefined;
134
- providerMetadata?: Record<string, Record<string, any>> | undefined;
135
- signature?: string | undefined;
136
- type: "reasoning";
137
- text: string;
138
- } | {
139
- providerOptions?: Record<string, Record<string, any>> | undefined;
140
- providerMetadata?: Record<string, Record<string, any>> | undefined;
141
- type: "redacted-reasoning";
142
- data: string;
143
- } | {
144
- providerOptions?: Record<string, Record<string, any>> | undefined;
145
- providerMetadata?: Record<string, Record<string, any>> | undefined;
146
- args?: any;
147
- providerExecuted?: boolean | undefined;
148
- type: "tool-call";
149
- toolCallId: string;
150
- toolName: string;
151
- input: any;
152
- } | {
153
- providerOptions?: Record<string, Record<string, any>> | undefined;
154
- providerMetadata?: Record<string, Record<string, any>> | undefined;
155
- input?: any;
156
- providerExecuted?: boolean | undefined;
157
- type: "tool-call";
158
- toolCallId: string;
159
- toolName: string;
160
- args: any;
161
- } | {
162
- providerOptions?: Record<string, Record<string, any>> | undefined;
163
- providerMetadata?: Record<string, Record<string, any>> | undefined;
164
- args?: any;
165
- providerExecuted?: boolean | undefined;
166
- output?: {
167
- providerOptions?: Record<string, Record<string, any>> | undefined;
168
- type: "text";
169
- value: string;
170
- } | {
171
- providerOptions?: Record<string, Record<string, any>> | undefined;
172
- type: "json";
173
- value: any;
174
- } | {
175
- providerOptions?: Record<string, Record<string, any>> | undefined;
176
- type: "error-text";
177
- value: string;
178
- } | {
179
- providerOptions?: Record<string, Record<string, any>> | undefined;
180
- type: "error-json";
181
- value: any;
182
- } | {
183
- providerOptions?: Record<string, Record<string, any>> | undefined;
184
- reason?: string | undefined;
185
- type: "execution-denied";
186
- } | {
187
- type: "content";
188
- value: ({
189
- providerOptions?: Record<string, Record<string, any>> | undefined;
190
- type: "text";
191
- text: string;
192
- } | {
193
- type: "media";
194
- mediaType: string;
195
- data: string;
196
- } | {
197
- providerOptions?: Record<string, Record<string, any>> | undefined;
198
- filename?: string | undefined;
199
- type: "file-data";
200
- mediaType: string;
201
- data: string;
202
- } | {
203
- providerOptions?: Record<string, Record<string, any>> | undefined;
204
- type: "file-url";
205
- url: string;
206
- } | {
207
- providerOptions?: Record<string, Record<string, any>> | undefined;
208
- type: "file-id";
209
- fileId: string | Record<string, string>;
210
- } | {
211
- providerOptions?: Record<string, Record<string, any>> | undefined;
212
- type: "image-data";
213
- mediaType: string;
214
- data: string;
215
- } | {
216
- providerOptions?: Record<string, Record<string, any>> | undefined;
217
- type: "image-url";
218
- url: string;
219
- } | {
220
- providerOptions?: Record<string, Record<string, any>> | undefined;
221
- type: "image-file-id";
222
- fileId: string | Record<string, string>;
223
- } | {
224
- providerOptions?: Record<string, Record<string, any>> | undefined;
225
- type: "custom";
226
- })[];
227
- } | undefined;
228
- result?: any;
229
- isError?: boolean | undefined;
230
- experimental_content?: ({
231
- type: "text";
232
- text: string;
233
- } | {
234
- mimeType?: string | undefined;
235
- type: "image";
236
- data: string;
237
- })[] | undefined;
238
- type: "tool-result";
239
- toolCallId: string;
240
- toolName: string;
241
- } | {
242
- title?: string | undefined;
243
- providerOptions?: Record<string, Record<string, any>> | undefined;
244
- providerMetadata?: Record<string, Record<string, any>> | undefined;
245
- id: string;
246
- type: "source";
247
- url: string;
248
- sourceType: "url";
249
- } | {
250
- providerOptions?: Record<string, Record<string, any>> | undefined;
251
- providerMetadata?: Record<string, Record<string, any>> | undefined;
252
- filename?: string | undefined;
253
- id: string;
254
- title: string;
255
- type: "source";
256
- mediaType: string;
257
- sourceType: "document";
258
- } | {
259
- providerOptions?: Record<string, Record<string, any>> | undefined;
260
- providerMetadata?: Record<string, Record<string, any>> | undefined;
261
- type: "tool-approval-request";
262
- toolCallId: string;
263
- approvalId: string;
264
- })[];
265
- } | {
266
- providerOptions?: Record<string, Record<string, any>> | undefined;
267
- role: "tool";
268
- content: ({
269
- providerOptions?: Record<string, Record<string, any>> | undefined;
270
- providerMetadata?: Record<string, Record<string, any>> | undefined;
271
- args?: any;
272
- providerExecuted?: boolean | undefined;
273
- output?: {
274
- providerOptions?: Record<string, Record<string, any>> | undefined;
275
- type: "text";
276
- value: string;
277
- } | {
278
- providerOptions?: Record<string, Record<string, any>> | undefined;
279
- type: "json";
280
- value: any;
281
- } | {
282
- providerOptions?: Record<string, Record<string, any>> | undefined;
283
- type: "error-text";
284
- value: string;
285
- } | {
286
- providerOptions?: Record<string, Record<string, any>> | undefined;
287
- type: "error-json";
288
- value: any;
289
- } | {
290
- providerOptions?: Record<string, Record<string, any>> | undefined;
291
- reason?: string | undefined;
292
- type: "execution-denied";
293
- } | {
294
- type: "content";
295
- value: ({
296
- providerOptions?: Record<string, Record<string, any>> | undefined;
297
- type: "text";
298
- text: string;
299
- } | {
300
- type: "media";
301
- mediaType: string;
302
- data: string;
303
- } | {
304
- providerOptions?: Record<string, Record<string, any>> | undefined;
305
- filename?: string | undefined;
306
- type: "file-data";
307
- mediaType: string;
308
- data: string;
309
- } | {
310
- providerOptions?: Record<string, Record<string, any>> | undefined;
311
- type: "file-url";
312
- url: string;
313
- } | {
314
- providerOptions?: Record<string, Record<string, any>> | undefined;
315
- type: "file-id";
316
- fileId: string | Record<string, string>;
317
- } | {
318
- providerOptions?: Record<string, Record<string, any>> | undefined;
319
- type: "image-data";
320
- mediaType: string;
321
- data: string;
322
- } | {
323
- providerOptions?: Record<string, Record<string, any>> | undefined;
324
- type: "image-url";
325
- url: string;
326
- } | {
327
- providerOptions?: Record<string, Record<string, any>> | undefined;
328
- type: "image-file-id";
329
- fileId: string | Record<string, string>;
330
- } | {
331
- providerOptions?: Record<string, Record<string, any>> | undefined;
332
- type: "custom";
333
- })[];
334
- } | undefined;
335
- result?: any;
336
- isError?: boolean | undefined;
337
- experimental_content?: ({
338
- type: "text";
339
- text: string;
340
- } | {
341
- mimeType?: string | undefined;
342
- type: "image";
343
- data: string;
344
- })[] | undefined;
345
- type: "tool-result";
346
- toolCallId: string;
347
- toolName: string;
348
- } | {
349
- providerOptions?: Record<string, Record<string, any>> | undefined;
350
- providerMetadata?: Record<string, Record<string, any>> | undefined;
351
- providerExecuted?: boolean | undefined;
352
- reason?: string | undefined;
353
- type: "tool-approval-response";
354
- approvalId: string;
355
- approved: boolean;
356
- })[];
357
- } | {
358
- providerOptions?: Record<string, Record<string, any>> | undefined;
359
- role: "system";
360
- content: string;
361
- } | undefined;
362
- text?: string | undefined;
363
- providerMetadata?: Record<string, Record<string, any>> | undefined;
364
- reasoning?: string | undefined;
365
- usage?: {
366
- reasoningTokens?: number | undefined;
367
- cachedInputTokens?: number | undefined;
368
- promptTokens: number;
369
- completionTokens: number;
370
- totalTokens: number;
371
- } | undefined;
372
- sources?: ({
373
- title?: string | undefined;
374
- type?: "source" | undefined;
375
- providerOptions?: Record<string, Record<string, any>> | undefined;
376
- providerMetadata?: Record<string, Record<string, any>> | undefined;
377
- id: string;
378
- url: string;
379
- sourceType: "url";
380
- } | {
381
- providerOptions?: Record<string, Record<string, any>> | undefined;
382
- providerMetadata?: Record<string, Record<string, any>> | undefined;
383
- filename?: string | undefined;
384
- id: string;
385
- title: string;
386
- type: "source";
387
- mediaType: string;
388
- sourceType: "document";
389
- })[] | undefined;
390
- warnings?: ({
391
- details?: string | undefined;
392
- type: "unsupported-setting";
393
- setting: string;
394
- } | {
395
- details?: string | undefined;
396
- type: "unsupported-tool";
397
- tool: any;
398
- } | {
399
- type: "other";
400
- message: string;
401
- })[] | undefined;
402
- finishReason?: "error" | "length" | "other" | "stop" | "content-filter" | "tool-calls" | "unknown" | undefined;
403
- reasoningDetails?: ({
404
- providerOptions?: Record<string, Record<string, any>> | undefined;
405
- providerMetadata?: Record<string, Record<string, any>> | undefined;
406
- signature?: string | undefined;
407
- type: "reasoning";
408
- text: string;
409
- } | {
410
- signature?: string | undefined;
411
- type: "text";
412
- text: string;
413
- } | {
414
- type: "redacted";
415
- data: string;
416
- })[] | undefined;
417
- status: "pending" | "success" | "failed";
418
- order: number;
419
- _creationTime: number;
420
- threadId: string;
421
- stepOrder: number;
422
- tool: boolean;
423
- _id: string;
424
- }[];
425
- /**
426
- * Embed a list of messages, including calling any usage handler.
427
- * This will not save the embeddings to the database.
428
- */
429
- export declare function embedMessages(ctx: ActionCtx, { userId, threadId, ...options }: {
430
- userId: string | undefined;
431
- threadId: string | undefined;
432
- agentName?: string;
433
- } & Pick<Config, "usageHandler" | "textEmbeddingModel" | "embeddingModel" | "callSettings">, messages: (ModelMessage | Message)[]): Promise<{
434
- vectors: (number[] | null)[];
435
- dimension: VectorDimension;
436
- model: string;
437
- } | undefined>;
438
- /**
439
- * Embeds many strings, calling any usage handler.
440
- * @param ctx The ctx parameter to an action.
441
- * @param args Arguments to AI SDK's embedMany, and context for the embedding,
442
- * passed to the usage handler.
443
- * @returns The embeddings for the strings, matching the order of the values.
444
- */
445
- export declare function embedMany(ctx: ActionCtx, args: {
446
- userId: string | undefined;
447
- threadId: string | undefined;
448
- values: string[];
449
- abortSignal?: AbortSignal;
450
- headers?: Record<string, string>;
451
- agentName?: string;
452
- } & Pick<Config, "usageHandler" | "textEmbeddingModel" | "embeddingModel" | "callSettings">): Promise<{
453
- embeddings: number[][];
454
- }>;
455
- /**
456
- * Embed a list of messages, and save the embeddings to the database.
457
- * @param ctx The ctx parameter to an action.
458
- * @param component The agent component, usually components.agent.
459
- * @param args The context for the embedding, passed to the usage handler.
460
- * @param messages The messages to embed, in the Agent MessageDoc format.
461
- */
462
- export declare function generateAndSaveEmbeddings(ctx: ActionCtx, component: AgentComponent, args: {
463
- threadId: string | undefined;
464
- userId: string | undefined;
465
- agentName?: string;
466
- /**
467
- * @deprecated Use embeddingModel instead.
468
- */
469
- textEmbeddingModel?: EmbeddingModel;
470
- embeddingModel?: EmbeddingModel;
471
- } & Pick<Config, "usageHandler" | "callSettings">, messages: MessageDoc[]): Promise<void>;
472
- /**
473
- * Similar to fetchContextMessages, but also combines the input messages,
474
- * with search context, recent messages, input messages, then prompt messages.
475
- * If there is a promptMessageId and prompt message(s) provided, it will splice
476
- * the prompt messages into the history to replace the promptMessageId message,
477
- * but still be followed by any existing messages that were in response to the
478
- * promptMessageId message.
479
- */
480
- export declare function fetchContextWithPrompt(ctx: ActionCtx, component: AgentComponent, args: {
481
- prompt: string | (ModelMessage | Message)[] | undefined;
482
- messages: (ModelMessage | Message)[] | undefined;
483
- promptMessageId: string | undefined;
484
- userId: string | undefined;
485
- threadId: string | undefined;
486
- agentName?: string;
487
- } & Options & Config): Promise<{
488
- messages: ModelMessage[];
489
- order: number | undefined;
490
- stepOrder: number | undefined;
491
- }>;
492
- export declare function getPromptArray(prompt: string | (ModelMessage | Message)[] | undefined): (ModelMessage | Message)[];
493
- //# sourceMappingURL=search.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/client/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,IAAI,CAAC;AAEZ,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AAUvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EACV,cAAc,EACd,MAAM,EACN,cAAc,EACd,OAAO,EACP,QAAQ,EACR,WAAW,EACX,SAAS,EACV,MAAM,YAAY,CAAC;AASpB,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAChD;IACE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,8CAA8C;IAC9C,kBAAkB,EAAE,MAAM,GAAG,cAAc,CAAC;IAC5C,cAAc,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;CAC1C,GACD;IACE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,8CAA8C;IAC9C,kBAAkB,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;IAC7C,cAAc,EAAE,MAAM,GAAG,cAAc,CAAC;CACzC,CACJ,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,QAAQ,GAAG,WAAW,GAAG,SAAS,EACvC,SAAS,EAAE,cAAc,EACzB,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,YA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