@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
@@ -1,12 +1,150 @@
1
- import type { LanguageModelV2 } from "@ai-sdk/provider";
2
- import type { ModelMessage, DeepPartial, generateObject, GenerateObjectResult, generateText, GenerateTextResult, JSONValue, LanguageModelRequestMetadata, LanguageModelResponseMetadata, RepairTextFunction, streamObject, StreamObjectResult, streamText, StreamTextResult, TelemetrySettings, ToolChoice, ToolSet, Schema, LanguageModelUsage } from "ai";
3
- import type { Auth, Expand, FunctionReference, StorageActionWriter, StorageReader, WithoutSystemFields, FunctionArgs, FunctionReturnType, GenericActionCtx, GenericDataModel } from "convex/server";
4
- import type { GenericId } from "convex/values";
5
- import type { z } from "zod";
6
- import type { Mounts } from "../component/_generated/api.js";
7
- import type { ThreadDoc } from "../component/schema.js";
8
- import type { CallSettings, ProviderMetadata, ProviderOptions, StreamDelta, StreamMessage } from "../validators.js";
1
+ import type { FlexibleSchema, InferSchema, ModelMessage, ProviderOptions } from "@ai-sdk/provider-utils";
2
+ import type { JSONValue } from "@ai-sdk/provider";
3
+ import type { EmbeddingModel, GenerateObjectResult, generateText, GenerateTextResult, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LanguageModel, streamObject, streamText, StreamTextResult, ToolSet, CallSettings, generateObject } from "ai";
4
+ export interface Output<_T = any, _P = any, _E = any> {
5
+ name: string;
6
+ responseFormat: any;
7
+ parseCompleteOutput: any;
8
+ parsePartialOutput: any;
9
+ createElementStreamTransform: any;
10
+ }
11
+ import type { GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx, WithoutSystemFields } from "convex/server";
12
+ import type { MessageDoc, ProviderMetadata, StreamDelta, StreamMessage, ThreadDoc } from "../validators.js";
9
13
  import type { StreamingOptions } from "./streaming.js";
14
+ import type { ComponentApi } from "../component/_generated/component.js";
15
+ /**
16
+ * Type-level check that ensures models are from AI SDK v6.
17
+ * If a v5 model (LanguageModelV2) is passed, TypeScript will show the error message string.
18
+ */
19
+ type AssertAISDKv6<T> = T extends {
20
+ specificationVersion: "v3";
21
+ } ? T : "⚠️ @convex-dev/agent v0.6.0 requires AI SDK v6. Update your dependencies: npm install ai@^6.0.35 @ai-sdk/openai@^3.0.10 (or other provider). See: node_modules/@convex-dev/agent/MIGRATION.md";
22
+ export type AgentPrompt = {
23
+ /**
24
+ * System message to include in the prompt. Overwrites Agent instructions.
25
+ */
26
+ system?: string;
27
+ /**
28
+ * A prompt. It can be either a text prompt or a list of messages.
29
+ * If used with `promptMessageId`, it will be used in place of that
30
+ * prompt message and no input messages will be saved.
31
+ * Otherwise, if used with the storageOptions "promptAndOutput" (default),
32
+ * it will be the only message saved.
33
+ * If a string is provided, it will be a user message.
34
+ */
35
+ prompt?: string | Array<ModelMessage> | undefined;
36
+ /**
37
+ * A list of messages to use as context before the prompt.
38
+ * If used with `prompt`, these will precede the prompt.
39
+ * If used with the storageOptions "promptAndOutput" (default),
40
+ * none of these messages will be saved.
41
+ */
42
+ messages?: Array<ModelMessage> | undefined;
43
+ /**
44
+ * If provided, it uses this existing message to anchor the prompt:
45
+ * - The specified message will be included, unless `prompt` is also
46
+ * provided, in which case that will be inserted in place of this
47
+ * specified message.
48
+ * - Recent and search messages will not include messages after this
49
+ * message's order.
50
+ * - If there are already responses on the same order,
51
+ * for example, tool calls and responses,
52
+ * those will be included automatically.
53
+ *
54
+ * Note: if this is provided, no input messages will be saved by default.
55
+ */
56
+ promptMessageId?: string | undefined;
57
+ /**
58
+ * The model to use for the LLM calls. This will override the languageModel
59
+ * specified in the Agent config.
60
+ */
61
+ model?: LanguageModel;
62
+ };
63
+ export type Config = {
64
+ /**
65
+ * The LLM model to use for generating / streaming text and objects.
66
+ * Requires AI SDK v6 (@ai-sdk/* packages v3.x).
67
+ *
68
+ * @example
69
+ * import { openai } from "@ai-sdk/openai"
70
+ * const myAgent = new Agent(components.agent, {
71
+ * languageModel: openai.chat("gpt-4o-mini"),
72
+ * })
73
+ */
74
+ languageModel?: AssertAISDKv6<LanguageModel>;
75
+ /**
76
+ * @deprecated Use `embeddingModel` instead.
77
+ */
78
+ textEmbeddingModel?: EmbeddingModel;
79
+ /**
80
+ * The model to use for text embeddings. Optional.
81
+ * If specified, it will use this for generating vector embeddings
82
+ * of chats, and can opt-in to doing vector search for automatic context
83
+ * on generateText, etc.
84
+ * e.g.
85
+ * import { openai } from "@ai-sdk/openai"
86
+ * const myAgent = new Agent(components.agent, {
87
+ * ...
88
+ * embeddingModel: openai.embedding("text-embedding-3-small")
89
+ */
90
+ embeddingModel?: EmbeddingModel;
91
+ /**
92
+ * Options to determine what messages are included as context in message
93
+ * generation. To disable any messages automatically being added, pass:
94
+ * { recentMessages: 0 }
95
+ */
96
+ contextOptions?: ContextOptions;
97
+ /**
98
+ * Determines whether messages are automatically stored when passed as
99
+ * arguments or generated.
100
+ */
101
+ storageOptions?: StorageOptions;
102
+ /**
103
+ * The usage handler to use for this agent.
104
+ */
105
+ usageHandler?: UsageHandler;
106
+ /**
107
+ * By default, messages are ordered with context in `fetchContextWithPrompt`,
108
+ * but you can override this by providing a context handler. Here you can
109
+ * filter, modify, or enrich the context messages. If provided, the default
110
+ * ordering will not apply. This excludes the system message / instructions.
111
+ */
112
+ contextHandler?: ContextHandler;
113
+ /**
114
+ * Called for each LLM request/response, so you can do things like
115
+ * log the raw request body or response headers to a table, or logs.
116
+ */
117
+ rawRequestResponseHandler?: RawRequestResponseHandler;
118
+ /**
119
+ * @deprecated Reach out if you use this. Otherwise will be removed soon.
120
+ * Default provider options to pass for the LLM calls.
121
+ * This can be overridden at each generate/stream callsite on a per-field
122
+ * basis. To clear a default setting, you'll need to pass `undefined`.
123
+ */
124
+ providerOptions?: ProviderOptions;
125
+ /**
126
+ * The default settings to use for the LLM calls.
127
+ * This can be overridden at each generate/stream callsite on a per-field
128
+ * basis. To clear a default setting, you'll need to pass `undefined`.
129
+ */
130
+ callSettings?: CallSettings;
131
+ /**
132
+ * The maximum number of steps to allow for a single generation.
133
+ *
134
+ * For example, if an agent wants to call a tool, that call and tool response
135
+ * will be one step. Generating a response based on the tool call & response
136
+ * will be a second step.
137
+ * If it runs out of steps, it will return the last step result, which may
138
+ * not be an assistant message.
139
+
140
+ * This becomes the default value when `stopWhen` is not specified in the
141
+ * Agent or generation callsite.
142
+ * AI SDK v5 removed the `maxSteps` argument, but this is kept here for
143
+ * convenience and backwards compatibility.
144
+ * Defaults to 1.
145
+ */
146
+ maxSteps?: number;
147
+ };
10
148
  /**
11
149
  * Options to configure what messages are fetched as context,
12
150
  * automatically with thread.generateText, or directly via search.
@@ -79,10 +217,28 @@ export type StorageOptions = {
79
217
  saveMessages?: "all" | "none" | "promptAndOutput";
80
218
  };
81
219
  export type GenerationOutputMetadata = {
82
- messageId?: string;
220
+ /**
221
+ * The ID of the prompt message for the generation.
222
+ */
223
+ promptMessageId?: string;
224
+ /**
225
+ * The order of the prompt message and responses for the generation.
226
+ * Each order starts with a user message, then followed by agent responses.
227
+ * If a promptMessageId is provided, that dictates the order.
228
+ */
83
229
  order?: number;
230
+ /**
231
+ * The messages saved for the generation - both saved input and output.
232
+ * If you passed promptMessageId, it will not include that message.
233
+ */
234
+ savedMessages?: MessageDoc[];
235
+ /**
236
+ * @deprecated Use promptMessageId instead.
237
+ * The ID of the prompt message for the generation.
238
+ */
239
+ messageId?: string;
84
240
  };
85
- export type UsageHandler = (ctx: RunActionCtx, args: {
241
+ export type UsageHandler = (ctx: ActionCtx, args: {
86
242
  userId: string | undefined;
87
243
  threadId: string | undefined;
88
244
  agentName: string | undefined;
@@ -91,119 +247,105 @@ export type UsageHandler = (ctx: RunActionCtx, args: {
91
247
  model: string;
92
248
  provider: string;
93
249
  }) => void | Promise<void>;
94
- export type RawRequestResponseHandler = (ctx: ActionCtx, args: {
95
- userId: string | undefined;
96
- threadId: string | undefined;
97
- agentName: string | undefined;
98
- request: LanguageModelRequestMetadata;
99
- response: LanguageModelResponseMetadata;
100
- }) => void | Promise<void>;
101
- export type AgentComponent = UseApi<Mounts>;
102
- export type TextArgs<AgentTools extends ToolSet, TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, OUTPUT_PARTIAL = never> = Omit<Parameters<typeof generateText<TOOLS extends undefined ? AgentTools : TOOLS, OUTPUT, OUTPUT_PARTIAL>>[0], "toolChoice" | "tools" | "model"> & {
250
+ /**
251
+ * By default, messages are ordered with context in `fetchContextWithPrompt`,
252
+ * but you can override this by providing a context handler. Here you can filter
253
+ * out, add in, or reorder messages.
254
+ */
255
+ export type ContextHandler = (ctx: ActionCtx, args: {
103
256
  /**
104
- * If provided, this message will be used as the "prompt" for the LLM call,
105
- * instead of the prompt or messages.
106
- * This is useful if you want to first save a user message, then use it as
107
- * the prompt for the LLM call in another call.
257
+ * All messages in the default order.
108
258
  */
109
- promptMessageId?: string;
259
+ allMessages: ModelMessage[];
110
260
  /**
111
- * The model to use for the LLM calls. This will override the model specified
112
- * in the Agent constructor.
261
+ * The messages fetched from search.
113
262
  */
114
- model?: LanguageModelV2;
263
+ search: ModelMessage[];
115
264
  /**
116
- * The tools to use for the tool calls. This will override tools specified
117
- * in the Agent constructor or createThread / continueThread.
265
+ * The recent messages already in the thread history,
266
+ * excluding any messages that came after promptMessageId.
118
267
  */
119
- tools?: TOOLS;
268
+ recent: ModelMessage[];
120
269
  /**
121
- * The tool choice to use for the tool calls. This must be one of the tools
122
- * specified in the tools array. e.g. {toolName: "getWeather", type: "tool"}
270
+ * The messages passed as the `messages` argument to e.g. generateText.
123
271
  */
124
- toolChoice?: ToolChoice<TOOLS extends undefined ? AgentTools : TOOLS>;
125
- };
126
- export type StreamingTextArgs<AgentTools extends ToolSet, TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, OUTPUT_PARTIAL = never> = Omit<Parameters<typeof streamText<TOOLS extends undefined ? AgentTools : TOOLS, OUTPUT, OUTPUT_PARTIAL>>[0], "toolChoice" | "tools" | "model"> & {
272
+ inputMessages: ModelMessage[];
127
273
  /**
128
- * If provided, this message will be used as the "prompt" for the LLM call,
129
- * instead of the prompt or messages.
130
- * This is useful if you want to first save a user message, then use it as
131
- * the prompt for the LLM call in another call.
274
+ * The message(s) passed as the `prompt` argument to e.g. generateText.
275
+ * Otherwise, if `promptMessageId` was provided, the message at that id.
276
+ * `prompt` will override the message at `promptMessageId`.
132
277
  */
133
- promptMessageId?: string;
278
+ inputPrompt: ModelMessage[];
134
279
  /**
135
- * The model to use for the tool calls. This will override the model specified
136
- * in the Agent constructor.
280
+ * Any messages on the same `order` as the promptMessageId message after the
281
+ * prompt message. These are presumably existing responses to the prompt
282
+ * message.
137
283
  */
138
- model?: LanguageModelV2;
284
+ existingResponses: ModelMessage[];
139
285
  /**
140
- * The tools to use for the tool calls. This will override tools specified
141
- * in the Agent constructor or createThread / continueThread.
142
- */
143
- tools?: TOOLS;
144
- /**
145
- * The tool choice to use for the tool calls. This must be one of the tools
146
- * specified in the tools array. e.g. {toolName: "getWeather", type: "tool"}
147
- */
148
- toolChoice?: ToolChoice<TOOLS extends undefined ? AgentTools : TOOLS>;
149
- };
150
- type BaseGenerateObjectOptions = CallSettings & {
151
- /**
152
- * The model to use for the object generation. This will override the model
153
- * specified in the Agent constructor.
286
+ * The user associated with the generation, if any.
154
287
  */
155
- model?: LanguageModelV2;
288
+ userId: string | undefined;
156
289
  /**
157
- * The system prompt to use for the object generation. This will override the
158
- * system prompt specified in the Agent constructor.
290
+ * The thread associated with the generation, if any.
159
291
  */
160
- system?: string;
292
+ threadId: string | undefined;
293
+ }) => ModelMessage[] | Promise<ModelMessage[]>;
294
+ export type RawRequestResponseHandler = (ctx: ActionCtx, args: {
295
+ userId: string | undefined;
296
+ threadId: string | undefined;
297
+ agentName: string | undefined;
298
+ request: LanguageModelRequestMetadata;
299
+ response: LanguageModelResponseMetadata;
300
+ }) => void | Promise<void>;
301
+ export type AgentComponent = ComponentApi;
302
+ export type TextArgs<AgentTools extends ToolSet, TOOLS extends ToolSet | undefined = undefined, OUTPUT extends Output<any, any, any> = never> = Omit<Parameters<typeof generateText<TOOLS extends undefined ? AgentTools : TOOLS, OUTPUT>>[0], "model" | "prompt" | "messages"> & {
161
303
  /**
162
- * The prompt to the LLM to use for the object generation.
163
- * Specify this or messages, but not both.
304
+ * The tools to use for the tool calls. This will override tools specified
305
+ * in the Agent constructor or createThread / continueThread.
164
306
  */
165
- prompt?: string | Array<ModelMessage>;
307
+ tools?: TOOLS;
308
+ } & AgentPrompt;
309
+ export type StreamingTextArgs<AgentTools extends ToolSet, TOOLS extends ToolSet | undefined = undefined, OUTPUT extends Output<any, any, any> = never> = Omit<Parameters<typeof streamText<TOOLS extends undefined ? AgentTools : TOOLS, OUTPUT>>[0], "model" | "prompt" | "messages"> & {
166
310
  /**
167
- * The messages to use for the object generation.
168
- * Note: recent messages are automatically added based on the thread it's
169
- * associated with and your contextOptions.
311
+ * The tools to use for the tool calls. This will override tools specified
312
+ * in the Agent constructor or createThread / continueThread.
170
313
  */
171
- messages?: Array<ModelMessage>;
314
+ tools?: TOOLS;
315
+ } & AgentPrompt;
316
+ export type ObjectMode = "object" | "array" | "enum" | "no-schema";
317
+ export type GenerateObjectArgs<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue>, OUTPUT extends ObjectMode = InferSchema<SCHEMA> extends string ? "enum" : "object", RESULT = OUTPUT extends "array" ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>> = AgentPrompt & Omit<Parameters<typeof generateObject<SCHEMA, OUTPUT, RESULT>>[0], "model" | "prompt" | "messages"> & {
318
+ schema?: SCHEMA;
319
+ enum?: Array<RESULT>;
320
+ };
321
+ export type StreamObjectArgs<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue>, OUTPUT extends ObjectMode = InferSchema<SCHEMA> extends string ? "enum" : "object", RESULT = OUTPUT extends "array" ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>> = AgentPrompt & Omit<Parameters<typeof streamObject<SCHEMA, OUTPUT, RESULT>>[0], "model" | "prompt" | "messages"> & {
322
+ schema?: SCHEMA;
323
+ enum?: Array<RESULT>;
324
+ };
325
+ export type MaybeCustomCtx<CustomCtx, DataModel extends GenericDataModel, AgentTools extends ToolSet> = CustomCtx extends Record<string, unknown> ? {
172
326
  /**
173
- * The message to use as the "prompt" for the object generation.
174
- * If this is provided, it will be used instead of the prompt or messages.
175
- * This is useful if you want to first save a user message, then use it as
176
- * the prompt for the object generation in another call.
327
+ * If you have a custom ctx that you use with the Agent
328
+ * (e.g. new Agent<{ orgId: string }>(...))
329
+ * you need to provide this function to add any extra fields.
330
+ * e.g.
331
+ * ```ts
332
+ * const myAgent = new Agent<{ orgId: string }>(...);
333
+ * const myAction = myAgent.asTextAction({
334
+ * customCtx: (ctx: ActionCtx, target, llmArgs) => {
335
+ * const orgId = await lookupOrgId(ctx, target.threadId);
336
+ * return { orgId };
337
+ * },
338
+ * });
339
+ * ```
340
+ * Then, in your tools, you can
177
341
  */
178
- promptMessageId?: string;
179
- experimental_repairText?: RepairTextFunction;
180
- experimental_telemetry?: TelemetrySettings;
181
- providerOptions?: ProviderOptions;
182
- experimental_providerMetadata?: ProviderMetadata;
342
+ customCtx: (ctx: GenericActionCtx<DataModel>, target: {
343
+ userId?: string | undefined;
344
+ threadId?: string | undefined;
345
+ }, llmArgs: TextArgs<AgentTools>) => CustomCtx;
346
+ } : {
347
+ customCtx?: never;
183
348
  };
184
- type StandardGenerateObjectOptions<T> = {
185
- schema: z.Schema<T>;
186
- schemaName?: string;
187
- schemaDescription?: string;
188
- output?: "object" | "array";
189
- mode?: "auto" | "json" | "tool";
190
- };
191
- type GenerateObjectArgs<T> = BaseGenerateObjectOptions & (StandardGenerateObjectOptions<T> | {
192
- output: "enum";
193
- enum: Array<T>;
194
- mode?: "auto" | "json" | "tool";
195
- } | {
196
- output: "any";
197
- schema: undefined;
198
- mode: "json";
199
- });
200
- type StreamObjectArgs<T> = BaseGenerateObjectOptions & (StandardGenerateObjectOptions<T> | {
201
- output: "any";
202
- schema: undefined;
203
- mode: "json";
204
- });
205
- export type OurObjectArgs<T> = GenerateObjectArgs<T> & Pick<Parameters<typeof generateObject<any>>[0], "experimental_repairText" | "abortSignal">;
206
- export type OurStreamObjectArgs<T extends Schema | z.Schema> = StreamObjectArgs<T> & Pick<Parameters<typeof streamObject<T>>[0], "onError" | "onFinish" | "abortSignal">;
207
349
  type ThreadOutputMetadata = Required<GenerationOutputMetadata>;
208
350
  /**
209
351
  * The interface for a thread returned from {@link createThread} or {@link continueThread}.
@@ -232,7 +374,7 @@ export interface Thread<DefaultTools extends ToolSet> {
232
374
  * for the {@link ContextOptions} and {@link StorageOptions}.
233
375
  * @returns The result of the generateText function.
234
376
  */
235
- generateText<TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, OUTPUT_PARTIAL = never>(args: TextArgs<TOOLS extends undefined ? DefaultTools : TOOLS, TOOLS, OUTPUT, OUTPUT_PARTIAL>, options?: Options): Promise<GenerateTextResult<TOOLS extends undefined ? DefaultTools : TOOLS, OUTPUT> & ThreadOutputMetadata>;
377
+ generateText<TOOLS extends ToolSet | undefined = undefined, OUTPUT extends Output<any, any, any> = never>(generateTextArgs: AgentPrompt & TextArgs<TOOLS extends undefined ? DefaultTools : TOOLS, TOOLS, OUTPUT>, options?: Options): Promise<GenerateTextResult<TOOLS extends undefined ? DefaultTools : TOOLS, OUTPUT> & ThreadOutputMetadata>;
236
378
  /**
237
379
  * This behaves like {@link streamText} from the "ai" package except that
238
380
  * it add context based on the userId and threadId and saves the input and
@@ -243,7 +385,7 @@ export interface Thread<DefaultTools extends ToolSet> {
243
385
  * for the {@link ContextOptions} and {@link StorageOptions}.
244
386
  * @returns The result of the streamText function.
245
387
  */
246
- streamText<TOOLS extends ToolSet | undefined = undefined, OUTPUT = never, PARTIAL_OUTPUT = never>(args: StreamingTextArgs<TOOLS extends undefined ? DefaultTools : TOOLS, TOOLS, OUTPUT, PARTIAL_OUTPUT>, options?: Options & {
388
+ streamText<TOOLS extends ToolSet | undefined = undefined, OUTPUT extends Output<any, any, any> = never>(streamTextArgs: AgentPrompt & StreamingTextArgs<TOOLS extends undefined ? DefaultTools : TOOLS, TOOLS, OUTPUT>, options?: Options & {
247
389
  /**
248
390
  * Whether to save incremental data (deltas) from streaming responses.
249
391
  * Defaults to false.
@@ -255,7 +397,7 @@ export interface Thread<DefaultTools extends ToolSet> {
255
397
  * iterating over the text, streaming it over HTTP, etc.
256
398
  */
257
399
  saveStreamDeltas?: boolean | StreamingOptions;
258
- }): Promise<StreamTextResult<TOOLS extends undefined ? DefaultTools : TOOLS, PARTIAL_OUTPUT> & ThreadOutputMetadata>;
400
+ }): Promise<StreamTextResult<TOOLS extends undefined ? DefaultTools : TOOLS, OUTPUT> & ThreadOutputMetadata>;
259
401
  /**
260
402
  * This behaves like {@link generateObject} from the "ai" package except that
261
403
  * it add context based on the userId and threadId and saves the input and
@@ -266,7 +408,7 @@ export interface Thread<DefaultTools extends ToolSet> {
266
408
  * for the {@link ContextOptions} and {@link StorageOptions}.
267
409
  * @returns The result of the generateObject function.
268
410
  */
269
- generateObject<T = JSONValue>(args: OurObjectArgs<T>, options?: Options): Promise<GenerateObjectResult<T> & ThreadOutputMetadata>;
411
+ generateObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue>, OUTPUT extends ObjectMode = InferSchema<SCHEMA> extends string ? "enum" : "object", RESULT = OUTPUT extends "array" ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(generateObjectArgs: AgentPrompt & GenerateObjectArgs<SCHEMA, OUTPUT, RESULT>, options?: Options): Promise<GenerateObjectResult<RESULT> & ThreadOutputMetadata>;
270
412
  /**
271
413
  * This behaves like {@link streamObject} from the "ai" package except that
272
414
  * it add context based on the userId and threadId and saves the input and
@@ -277,7 +419,11 @@ export interface Thread<DefaultTools extends ToolSet> {
277
419
  * for the {@link ContextOptions} and {@link StorageOptions}.
278
420
  * @returns The result of the streamObject function.
279
421
  */
280
- streamObject<T extends z.Schema | Schema>(args: OurStreamObjectArgs<T>, options?: Options): Promise<StreamObjectResult<DeepPartial<T>, T, never> & ThreadOutputMetadata>;
422
+ streamObject<SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue>, OUTPUT extends ObjectMode = InferSchema<SCHEMA> extends string ? "enum" : "object", RESULT = OUTPUT extends "array" ? Array<InferSchema<SCHEMA>> : InferSchema<SCHEMA>>(
423
+ /**
424
+ * The same arguments you'd pass to "ai" sdk {@link streamObject}.
425
+ */
426
+ streamObjectArgs: AgentPrompt & StreamObjectArgs<SCHEMA, OUTPUT, RESULT>, options?: Options): Promise<ReturnType<typeof streamObject<SCHEMA, OUTPUT, RESULT>> & ThreadOutputMetadata>;
281
427
  }
282
428
  export type Options = {
283
429
  /**
@@ -288,6 +434,18 @@ export type Options = {
288
434
  * The storage options to use for saving the input and output messages to the thread.
289
435
  */
290
436
  storageOptions?: StorageOptions;
437
+ /**
438
+ * The usage handler to use for this thread. Overrides any handler
439
+ * set in the agent constructor.
440
+ */
441
+ usageHandler?: UsageHandler;
442
+ /**
443
+ * By default, messages are ordered with context in `fetchContextWithPrompt`,
444
+ * but you can override this by providing a context handler. Here you can
445
+ * filter, modify, or enrich the context messages. If provided, the default
446
+ * ordering will not apply. This excludes the system message / instructions.
447
+ */
448
+ contextHandler?: ContextHandler;
291
449
  };
292
450
  export type SyncStreamsReturnValue = {
293
451
  kind: "list";
@@ -296,28 +454,8 @@ export type SyncStreamsReturnValue = {
296
454
  kind: "deltas";
297
455
  deltas: StreamDelta[];
298
456
  } | undefined;
299
- export type RunQueryCtx = {
300
- runQuery: <Query extends FunctionReference<"query", "internal">>(query: Query, args: FunctionArgs<Query>) => Promise<FunctionReturnType<Query>>;
301
- };
302
- export type RunMutationCtx = RunQueryCtx & {
303
- runMutation: <Mutation extends FunctionReference<"mutation", "internal">>(mutation: Mutation, args: FunctionArgs<Mutation>) => Promise<FunctionReturnType<Mutation>>;
304
- };
305
- export type RunActionCtx = RunMutationCtx & {
306
- runAction<Action extends FunctionReference<"action", "internal">>(action: Action, args: FunctionArgs<Action>): Promise<FunctionReturnType<Action>>;
307
- };
308
- export type UserActionCtx = GenericActionCtx<GenericDataModel>;
309
- export type ActionCtx = RunActionCtx & {
310
- auth: Auth;
311
- storage: StorageActionWriter;
312
- };
313
- export type QueryCtx = RunQueryCtx & {
314
- storage: StorageReader;
315
- };
316
- export type OpaqueIds<T> = T extends GenericId<infer _T> ? string : T extends (infer U)[] ? OpaqueIds<U>[] : T extends ArrayBuffer ? ArrayBuffer : T extends object ? {
317
- [K in keyof T]: OpaqueIds<T[K]>;
318
- } : T;
319
- export type UseApi<API> = Expand<{
320
- [mod in keyof API]: API[mod] extends FunctionReference<infer FType, "public", infer FArgs, infer FReturnType, infer FComponentPath> ? FunctionReference<FType, "internal", OpaqueIds<FArgs>, OpaqueIds<FReturnType>, FComponentPath> : UseApi<API[mod]>;
321
- }>;
457
+ export type QueryCtx = Pick<GenericQueryCtx<GenericDataModel>, "runQuery">;
458
+ export type MutationCtx = Pick<GenericMutationCtx<GenericDataModel>, "runQuery" | "runMutation">;
459
+ export type ActionCtx = Pick<GenericActionCtx<GenericDataModel>, "runQuery" | "runMutation" | "runAction" | "storage" | "auth">;
322
460
  export {};
323
461
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,4BAA4B,EAC5B,6BAA6B,EAC7B,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,OAAO,EACP,MAAM,EACN,kBAAkB,EACnB,MAAM,IAAI,CAAC;AACZ,OAAO,KAAK,EACV,IAAI,EACJ,MAAM,EACN,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,aAAa,EACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;GAGG;AACH,MAAM,M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G,aAAa,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,CAC9D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { StepResult, StopCondition } from "ai";
2
+ export declare function willContinue(steps: StepResult<any>[], stopWhen: StopCondition<any> | Array<StopCondition<any>> | undefined): Promise<boolean>;
3
+ export declare function errorToString(error: unknown): string;
4
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/client/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAEpD,wBAAsB,YAAY,CAChC,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,EAExB,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,GACnE,OAAO,CAAC,OAAO,CAAC,CAalB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKpD"}
@@ -0,0 +1,21 @@
1
+ export async function willContinue(steps, stopWhen) {
2
+ const step = steps.at(-1);
3
+ // we aren't doing another round after a tool result
4
+ // TODO: whether to handle continuing after too much context used..
5
+ if (step.finishReason !== "tool-calls")
6
+ return false;
7
+ // we don't have a tool result, so we'll wait for more
8
+ if (step.toolCalls.length > step.toolResults.length)
9
+ return false;
10
+ if (Array.isArray(stopWhen)) {
11
+ return (await Promise.all(stopWhen.map(async (s) => s({ steps })))).every((stop) => !stop);
12
+ }
13
+ return !!stopWhen && !(await stopWhen({ steps }));
14
+ }
15
+ export function errorToString(error) {
16
+ if (error instanceof Error) {
17
+ return error.message;
18
+ }
19
+ return String(error);
20
+ }
21
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/client/utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAwB,EAExB,QAAoE;IAEpE,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC;IAC3B,oDAAoD;IACpD,mEAAmE;IACnE,IAAI,IAAI,CAAC,YAAY,KAAK,YAAY;QAAE,OAAO,KAAK,CAAC;IACrD,sDAAsD;IACtD,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAClE,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CACvE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAChB,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,MAAM,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}