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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/README.md +32 -27
  2. package/dist/UIMessages.d.ts +46 -0
  3. package/dist/UIMessages.d.ts.map +1 -0
  4. package/dist/UIMessages.js +546 -0
  5. package/dist/UIMessages.js.map +1 -0
  6. package/dist/client/createTool.d.ts +129 -27
  7. package/dist/client/createTool.d.ts.map +1 -1
  8. package/dist/client/createTool.js +66 -12
  9. package/dist/client/createTool.js.map +1 -1
  10. package/dist/client/defaultComponent.d.ts +11 -0
  11. package/dist/client/defaultComponent.d.ts.map +1 -0
  12. package/dist/client/defaultComponent.js +7 -0
  13. package/dist/client/defaultComponent.js.map +1 -0
  14. package/dist/client/definePlaygroundAPI.d.ts +1323 -192
  15. package/dist/client/definePlaygroundAPI.d.ts.map +1 -1
  16. package/dist/client/definePlaygroundAPI.js +52 -28
  17. package/dist/client/definePlaygroundAPI.js.map +1 -1
  18. package/dist/client/files.d.ts +20 -7
  19. package/dist/client/files.d.ts.map +1 -1
  20. package/dist/client/files.js +68 -11
  21. package/dist/client/files.js.map +1 -1
  22. package/dist/client/index.d.ts +1056 -965
  23. package/dist/client/index.d.ts.map +1 -1
  24. package/dist/client/index.js +242 -748
  25. package/dist/client/index.js.map +1 -1
  26. package/dist/client/messages.d.ts +461 -0
  27. package/dist/client/messages.d.ts.map +1 -0
  28. package/dist/client/messages.js +106 -0
  29. package/dist/client/messages.js.map +1 -0
  30. package/dist/client/mockModel.d.ts +42 -0
  31. package/dist/client/mockModel.d.ts.map +1 -0
  32. package/dist/client/mockModel.js +175 -0
  33. package/dist/client/mockModel.js.map +1 -0
  34. package/dist/client/saveInputMessages.d.ts +20 -0
  35. package/dist/client/saveInputMessages.d.ts.map +1 -0
  36. package/dist/client/saveInputMessages.js +58 -0
  37. package/dist/client/saveInputMessages.js.map +1 -0
  38. package/dist/client/search.d.ts +346 -35
  39. package/dist/client/search.d.ts.map +1 -1
  40. package/dist/client/search.js +350 -39
  41. package/dist/client/search.js.map +1 -1
  42. package/dist/client/start.d.ts +84 -0
  43. package/dist/client/start.d.ts.map +1 -0
  44. package/dist/client/start.js +171 -0
  45. package/dist/client/start.js.map +1 -0
  46. package/dist/client/streamText.d.ts +46 -0
  47. package/dist/client/streamText.d.ts.map +1 -0
  48. package/dist/client/streamText.js +93 -0
  49. package/dist/client/streamText.js.map +1 -0
  50. package/dist/client/streaming.d.ts +3705 -32
  51. package/dist/client/streaming.d.ts.map +1 -1
  52. package/dist/client/streaming.js +141 -59
  53. package/dist/client/streaming.js.map +1 -1
  54. package/dist/client/threads.d.ts +46 -0
  55. package/dist/client/threads.d.ts.map +1 -0
  56. package/dist/client/threads.js +49 -0
  57. package/dist/client/threads.js.map +1 -0
  58. package/dist/client/types.d.ts +265 -128
  59. package/dist/client/types.d.ts.map +1 -1
  60. package/dist/client/utils.d.ts +4 -0
  61. package/dist/client/utils.d.ts.map +1 -0
  62. package/dist/client/utils.js +21 -0
  63. package/dist/client/utils.js.map +1 -0
  64. package/dist/component/_generated/api.d.ts +24 -2178
  65. package/dist/component/_generated/api.d.ts.map +1 -1
  66. package/dist/component/_generated/api.js +10 -1
  67. package/dist/component/_generated/api.js.map +1 -1
  68. package/dist/component/_generated/component.d.ts +3119 -0
  69. package/dist/component/_generated/component.d.ts.map +1 -0
  70. package/dist/component/_generated/component.js +11 -0
  71. package/dist/component/_generated/component.js.map +1 -0
  72. package/dist/component/_generated/dataModel.d.ts +4 -18
  73. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  74. package/dist/component/_generated/dataModel.js +11 -0
  75. package/dist/component/_generated/dataModel.js.map +1 -0
  76. package/dist/component/_generated/server.d.ts +10 -38
  77. package/dist/component/_generated/server.d.ts.map +1 -1
  78. package/dist/component/_generated/server.js +9 -5
  79. package/dist/component/_generated/server.js.map +1 -1
  80. package/dist/component/files.d.ts +16 -10
  81. package/dist/component/files.d.ts.map +1 -1
  82. package/dist/component/files.js +10 -2
  83. package/dist/component/files.js.map +1 -1
  84. package/dist/component/messages.d.ts +2553 -342
  85. package/dist/component/messages.d.ts.map +1 -1
  86. package/dist/component/messages.js +387 -154
  87. package/dist/component/messages.js.map +1 -1
  88. package/dist/component/schema.d.ts +5697 -3584
  89. package/dist/component/schema.d.ts.map +1 -1
  90. package/dist/component/schema.js +18 -41
  91. package/dist/component/schema.js.map +1 -1
  92. package/dist/component/streams.d.ts +35 -335
  93. package/dist/component/streams.d.ts.map +1 -1
  94. package/dist/component/streams.js +114 -73
  95. package/dist/component/streams.js.map +1 -1
  96. package/dist/component/threads.d.ts +16 -16
  97. package/dist/component/users.d.ts +4 -4
  98. package/dist/component/vector/index.d.ts +1 -1
  99. package/dist/component/vector/index.d.ts.map +1 -1
  100. package/dist/component/vector/index.js +1 -3
  101. package/dist/component/vector/index.js.map +1 -1
  102. package/dist/deltas.d.ts +43 -0
  103. package/dist/deltas.d.ts.map +1 -0
  104. package/dist/deltas.js +447 -0
  105. package/dist/deltas.js.map +1 -0
  106. package/dist/mapping.d.ts +20 -20
  107. package/dist/mapping.d.ts.map +1 -1
  108. package/dist/mapping.js +313 -96
  109. package/dist/mapping.js.map +1 -1
  110. package/dist/react/SmoothText.d.ts +5 -0
  111. package/dist/react/SmoothText.d.ts.map +1 -0
  112. package/dist/react/SmoothText.js +6 -0
  113. package/dist/react/SmoothText.js.map +1 -0
  114. package/dist/react/index.d.ts +5 -77
  115. package/dist/react/index.d.ts.map +1 -1
  116. package/dist/react/index.js +6 -160
  117. package/dist/react/index.js.map +1 -1
  118. package/dist/react/optimisticallySendMessage.d.ts +36 -3
  119. package/dist/react/optimisticallySendMessage.d.ts.map +1 -1
  120. package/dist/react/optimisticallySendMessage.js +35 -9
  121. package/dist/react/optimisticallySendMessage.js.map +1 -1
  122. package/dist/react/types.d.ts +4 -18
  123. package/dist/react/types.d.ts.map +1 -1
  124. package/dist/react/useDeltaStreams.d.ts +10 -0
  125. package/dist/react/useDeltaStreams.d.ts.map +1 -0
  126. package/dist/react/useDeltaStreams.js +101 -0
  127. package/dist/react/useDeltaStreams.js.map +1 -0
  128. package/dist/react/useSmoothText.d.ts +13 -12
  129. package/dist/react/useSmoothText.d.ts.map +1 -1
  130. package/dist/react/useSmoothText.js +32 -15
  131. package/dist/react/useSmoothText.js.map +1 -1
  132. package/dist/react/useStreamingUIMessages.d.ts +22 -0
  133. package/dist/react/useStreamingUIMessages.d.ts.map +1 -0
  134. package/dist/react/useStreamingUIMessages.js +92 -0
  135. package/dist/react/useStreamingUIMessages.js.map +1 -0
  136. package/dist/react/useThreadMessages.d.ts +104 -0
  137. package/dist/react/useThreadMessages.d.ts.map +1 -0
  138. package/dist/react/useThreadMessages.js +148 -0
  139. package/dist/react/useThreadMessages.js.map +1 -0
  140. package/dist/react/useUIMessages.d.ts +96 -0
  141. package/dist/react/useUIMessages.d.ts.map +1 -0
  142. package/dist/react/useUIMessages.js +108 -0
  143. package/dist/react/useUIMessages.js.map +1 -0
  144. package/dist/shared.d.ts +20 -4
  145. package/dist/shared.d.ts.map +1 -1
  146. package/dist/shared.js +45 -8
  147. package/dist/shared.js.map +1 -1
  148. package/dist/validators.d.ts +22981 -5666
  149. package/dist/validators.d.ts.map +1 -1
  150. package/dist/validators.js +245 -137
  151. package/dist/validators.js.map +1 -1
  152. package/package.json +98 -50
  153. package/src/UIMessages.combineUIMessages.test.ts +239 -0
  154. package/src/UIMessages.test.ts +273 -0
  155. package/src/UIMessages.ts +739 -0
  156. package/src/client/createTool.ts +293 -76
  157. package/src/client/defaultComponent.ts +17 -0
  158. package/src/client/definePlaygroundAPI.ts +67 -31
  159. package/src/client/files.ts +100 -20
  160. package/src/client/index.test.ts +40 -85
  161. package/src/client/index.ts +520 -1290
  162. package/src/client/messages.ts +237 -0
  163. package/src/client/mockModel.ts +245 -0
  164. package/src/client/saveInputMessages.test.ts +583 -0
  165. package/src/client/saveInputMessages.ts +101 -0
  166. package/src/client/search.test.ts +1207 -0
  167. package/src/client/search.ts +577 -70
  168. package/src/client/start.ts +310 -0
  169. package/src/client/streamText.ts +163 -0
  170. package/src/client/streaming.test.ts +186 -0
  171. package/src/client/streaming.ts +219 -97
  172. package/src/client/threads.ts +83 -0
  173. package/src/client/types.ts +368 -219
  174. package/src/client/utils.ts +27 -0
  175. package/src/component/_generated/api.ts +64 -0
  176. package/src/component/_generated/component.ts +4913 -0
  177. package/src/component/_generated/{server.d.ts → server.ts} +33 -21
  178. package/src/component/files.ts +11 -2
  179. package/src/component/messages.test.ts +195 -51
  180. package/src/component/messages.ts +490 -201
  181. package/src/component/schema.ts +20 -46
  182. package/src/component/setup.test.ts +7 -0
  183. package/src/component/streams.ts +184 -83
  184. package/src/component/users.test.ts +0 -1
  185. package/src/component/vector/index.ts +1 -3
  186. package/src/deltas.test.ts +626 -0
  187. package/src/deltas.ts +570 -0
  188. package/src/fromUIMessages.test.ts +497 -0
  189. package/src/mapping.test.ts +103 -6
  190. package/src/mapping.ts +422 -161
  191. package/src/react/SmoothText.tsx +9 -0
  192. package/src/react/index.ts +10 -230
  193. package/src/react/optimisticallySendMessage.ts +55 -12
  194. package/src/react/types.ts +6 -39
  195. package/src/react/useDeltaStreams.ts +154 -0
  196. package/src/react/useSmoothText.ts +56 -36
  197. package/src/react/useStreamingUIMessages.ts +143 -0
  198. package/src/react/useThreadMessages.ts +262 -0
  199. package/src/react/useUIMessages.test.ts +255 -0
  200. package/src/react/useUIMessages.ts +195 -0
  201. package/src/shared.ts +88 -12
  202. package/src/test.ts +18 -0
  203. package/src/toUIMessages.test.ts +1269 -0
  204. package/src/validators.test.ts +18 -19
  205. package/src/validators.ts +325 -185
  206. package/dist/client/_generated/_ignore.d.ts +0 -1
  207. package/dist/client/_generated/_ignore.d.ts.map +0 -1
  208. package/dist/client/_generated/_ignore.js +0 -3
  209. package/dist/client/_generated/_ignore.js.map +0 -1
  210. package/dist/client/listMessages.d.ts +0 -22
  211. package/dist/client/listMessages.d.ts.map +0 -1
  212. package/dist/client/listMessages.js +0 -25
  213. package/dist/client/listMessages.js.map +0 -1
  214. package/dist/package.json +0 -3
  215. package/dist/react/deltas.d.ts +0 -26
  216. package/dist/react/deltas.d.ts.map +0 -1
  217. package/dist/react/deltas.js +0 -384
  218. package/dist/react/deltas.js.map +0 -1
  219. package/dist/react/toUIMessages.d.ts +0 -15
  220. package/dist/react/toUIMessages.d.ts.map +0 -1
  221. package/dist/react/toUIMessages.js +0 -211
  222. package/dist/react/toUIMessages.js.map +0 -1
  223. package/src/client/listMessages.ts +0 -38
  224. package/src/component/_generated/api.d.ts +0 -2202
  225. package/src/component/_generated/api.js +0 -23
  226. package/src/component/_generated/server.js +0 -90
  227. package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
  228. package/src/react/deltas.test.ts +0 -315
  229. package/src/react/deltas.ts +0 -478
  230. package/src/react/toUIMessages.test.ts +0 -420
  231. package/src/react/toUIMessages.ts +0 -253
  232. package/src/vitest.config.ts +0 -7
  233. /package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +0 -0
@@ -1,12 +1,149 @@
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
+ export type AgentPrompt = {
16
+ /**
17
+ * System message to include in the prompt. Overwrites Agent instructions.
18
+ */
19
+ system?: string;
20
+ /**
21
+ * A prompt. It can be either a text prompt or a list of messages.
22
+ * If used with `promptMessageId`, it will be used in place of that
23
+ * prompt message and no input messages will be saved.
24
+ * Otherwise, if used with the storageOptions "promptAndOutput" (default),
25
+ * it will be the only message saved.
26
+ * If a string is provided, it will be a user message.
27
+ */
28
+ prompt?: string | Array<ModelMessage> | undefined;
29
+ /**
30
+ * A list of messages to use as context before the prompt.
31
+ * If used with `prompt`, these will precede the prompt.
32
+ * If used with the storageOptions "promptAndOutput" (default),
33
+ * none of these messages will be saved.
34
+ */
35
+ messages?: Array<ModelMessage> | undefined;
36
+ /**
37
+ * If provided, it uses this existing message to anchor the prompt:
38
+ * - The specified message will be included, unless `prompt` is also
39
+ * provided, in which case that will be inserted in place of this
40
+ * specified message.
41
+ * - Recent and search messages will not include messages after this
42
+ * message's order.
43
+ * - If there are already responses on the same order,
44
+ * for example, tool calls and responses,
45
+ * those will be included automatically.
46
+ *
47
+ * Note: if this is provided, no input messages will be saved by default.
48
+ */
49
+ promptMessageId?: string | undefined;
50
+ /**
51
+ * The model to use for the LLM calls. This will override the languageModel
52
+ * specified in the Agent config.
53
+ */
54
+ model?: LanguageModel;
55
+ };
56
+ export type Config = {
57
+ /**
58
+ * The LLM model to use for generating / streaming text and objects.
59
+ * e.g.
60
+ * import { openai } from "@ai-sdk/openai"
61
+ * const myAgent = new Agent(components.agent, {
62
+ * languageModel: openai.chat("gpt-4o-mini"),
63
+ */
64
+ languageModel?: LanguageModel;
65
+ /**
66
+ * The model to use for text embeddings. Optional.
67
+ * If specified, it will use this for generating vector embeddings
68
+ * of chats, and can opt-in to doing vector search for automatic context
69
+ * on generateText, etc.
70
+ * e.g.
71
+ * import { openai } from "@ai-sdk/openai"
72
+ * const myAgent = new Agent(components.agent, {
73
+ * ...
74
+ * textEmbeddingModel: openai.embedding("text-embedding-3-small")
75
+ * @deprecated — Use embeddingModel instead.
76
+ */
77
+ textEmbeddingModel?: EmbeddingModel;
78
+ /**
79
+ * The model to use for text embeddings. Optional.
80
+ * If specified, it will use this for generating vector embeddings
81
+ * of chats, and can opt-in to doing vector search for automatic context
82
+ * on generateText, etc.
83
+ * e.g.
84
+ * import { openai } from "@ai-sdk/openai"
85
+ * const myAgent = new Agent(components.agent, {
86
+ * ...
87
+ * embeddingModel: openai.embedding("text-embedding-3-small")
88
+ */
89
+ embeddingModel?: EmbeddingModel;
90
+ /**
91
+ * Options to determine what messages are included as context in message
92
+ * generation. To disable any messages automatically being added, pass:
93
+ * { recentMessages: 0 }
94
+ */
95
+ contextOptions?: ContextOptions;
96
+ /**
97
+ * Determines whether messages are automatically stored when passed as
98
+ * arguments or generated.
99
+ */
100
+ storageOptions?: StorageOptions;
101
+ /**
102
+ * The usage handler to use for this agent.
103
+ */
104
+ usageHandler?: UsageHandler;
105
+ /**
106
+ * By default, messages are ordered with context in `fetchContextWithPrompt`,
107
+ * but you can override this by providing a context handler. Here you can
108
+ * filter, modify, or enrich the context messages. If provided, the default
109
+ * ordering will not apply. This excludes the system message / instructions.
110
+ */
111
+ contextHandler?: ContextHandler;
112
+ /**
113
+ * Called for each LLM request/response, so you can do things like
114
+ * log the raw request body or response headers to a table, or logs.
115
+ */
116
+ rawRequestResponseHandler?: RawRequestResponseHandler;
117
+ /**
118
+ * @deprecated Reach out if you use this. Otherwise will be removed soon.
119
+ * Default provider options to pass for the LLM calls.
120
+ * This can be overridden at each generate/stream callsite on a per-field
121
+ * basis. To clear a default setting, you'll need to pass `undefined`.
122
+ */
123
+ providerOptions?: ProviderOptions;
124
+ /**
125
+ * The default settings to use for the LLM calls.
126
+ * This can be overridden at each generate/stream callsite on a per-field
127
+ * basis. To clear a default setting, you'll need to pass `undefined`.
128
+ */
129
+ callSettings?: CallSettings;
130
+ /**
131
+ * The maximum number of steps to allow for a single generation.
132
+ *
133
+ * For example, if an agent wants to call a tool, that call and tool response
134
+ * will be one step. Generating a response based on the tool call & response
135
+ * will be a second step.
136
+ * If it runs out of steps, it will return the last step result, which may
137
+ * not be an assistant message.
138
+
139
+ * This becomes the default value when `stopWhen` is not specified in the
140
+ * Agent or generation callsite.
141
+ * AI SDK v5 removed the `maxSteps` argument, but this is kept here for
142
+ * convenience and backwards compatibility.
143
+ * Defaults to 1.
144
+ */
145
+ maxSteps?: number;
146
+ };
10
147
  /**
11
148
  * Options to configure what messages are fetched as context,
12
149
  * automatically with thread.generateText, or directly via search.
@@ -79,10 +216,28 @@ export type StorageOptions = {
79
216
  saveMessages?: "all" | "none" | "promptAndOutput";
80
217
  };
81
218
  export type GenerationOutputMetadata = {
82
- messageId?: string;
219
+ /**
220
+ * The ID of the prompt message for the generation.
221
+ */
222
+ promptMessageId?: string;
223
+ /**
224
+ * The order of the prompt message and responses for the generation.
225
+ * Each order starts with a user message, then followed by agent responses.
226
+ * If a promptMessageId is provided, that dictates the order.
227
+ */
83
228
  order?: number;
229
+ /**
230
+ * The messages saved for the generation - both saved input and output.
231
+ * If you passed promptMessageId, it will not include that message.
232
+ */
233
+ savedMessages?: MessageDoc[];
234
+ /**
235
+ * @deprecated Use promptMessageId instead.
236
+ * The ID of the prompt message for the generation.
237
+ */
238
+ messageId?: string;
84
239
  };
85
- export type UsageHandler = (ctx: RunActionCtx, args: {
240
+ export type UsageHandler = (ctx: ActionCtx, args: {
86
241
  userId: string | undefined;
87
242
  threadId: string | undefined;
88
243
  agentName: string | undefined;
@@ -91,119 +246,105 @@ export type UsageHandler = (ctx: RunActionCtx, args: {
91
246
  model: string;
92
247
  provider: string;
93
248
  }) => 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"> & {
249
+ /**
250
+ * By default, messages are ordered with context in `fetchContextWithPrompt`,
251
+ * but you can override this by providing a context handler. Here you can filter
252
+ * out, add in, or reorder messages.
253
+ */
254
+ export type ContextHandler = (ctx: ActionCtx, args: {
103
255
  /**
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.
256
+ * All messages in the default order.
108
257
  */
109
- promptMessageId?: string;
258
+ allMessages: ModelMessage[];
110
259
  /**
111
- * The model to use for the LLM calls. This will override the model specified
112
- * in the Agent constructor.
260
+ * The messages fetched from search.
113
261
  */
114
- model?: LanguageModelV2;
262
+ search: ModelMessage[];
115
263
  /**
116
- * The tools to use for the tool calls. This will override tools specified
117
- * in the Agent constructor or createThread / continueThread.
264
+ * The recent messages already in the thread history,
265
+ * excluding any messages that came after promptMessageId.
118
266
  */
119
- tools?: TOOLS;
267
+ recent: ModelMessage[];
120
268
  /**
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"}
269
+ * The messages passed as the `messages` argument to e.g. generateText.
123
270
  */
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"> & {
271
+ inputMessages: ModelMessage[];
127
272
  /**
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.
273
+ * The message(s) passed as the `prompt` argument to e.g. generateText.
274
+ * Otherwise, if `promptMessageId` was provided, the message at that id.
275
+ * `prompt` will override the message at `promptMessageId`.
132
276
  */
133
- promptMessageId?: string;
277
+ inputPrompt: ModelMessage[];
134
278
  /**
135
- * The model to use for the tool calls. This will override the model specified
136
- * in the Agent constructor.
279
+ * Any messages on the same `order` as the promptMessageId message after the
280
+ * prompt message. These are presumably existing responses to the prompt
281
+ * message.
137
282
  */
138
- model?: LanguageModelV2;
283
+ existingResponses: ModelMessage[];
139
284
  /**
140
- * The tools to use for the tool calls. This will override tools specified
141
- * in the Agent constructor or createThread / continueThread.
285
+ * The user associated with the generation, if any.
142
286
  */
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.
154
- */
155
- model?: LanguageModelV2;
287
+ userId: string | undefined;
156
288
  /**
157
- * The system prompt to use for the object generation. This will override the
158
- * system prompt specified in the Agent constructor.
289
+ * The thread associated with the generation, if any.
159
290
  */
160
- system?: string;
291
+ threadId: string | undefined;
292
+ }) => ModelMessage[] | Promise<ModelMessage[]>;
293
+ export type RawRequestResponseHandler = (ctx: ActionCtx, args: {
294
+ userId: string | undefined;
295
+ threadId: string | undefined;
296
+ agentName: string | undefined;
297
+ request: LanguageModelRequestMetadata;
298
+ response: LanguageModelResponseMetadata;
299
+ }) => void | Promise<void>;
300
+ export type AgentComponent = ComponentApi;
301
+ 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
302
  /**
162
- * The prompt to the LLM to use for the object generation.
163
- * Specify this or messages, but not both.
303
+ * The tools to use for the tool calls. This will override tools specified
304
+ * in the Agent constructor or createThread / continueThread.
164
305
  */
165
- prompt?: string | Array<ModelMessage>;
306
+ tools?: TOOLS;
307
+ } & AgentPrompt;
308
+ 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
309
  /**
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.
310
+ * The tools to use for the tool calls. This will override tools specified
311
+ * in the Agent constructor or createThread / continueThread.
170
312
  */
171
- messages?: Array<ModelMessage>;
313
+ tools?: TOOLS;
314
+ } & AgentPrompt;
315
+ export type ObjectMode = "object" | "array" | "enum" | "no-schema";
316
+ 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"> & {
317
+ schema?: SCHEMA;
318
+ enum?: Array<RESULT>;
319
+ };
320
+ 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"> & {
321
+ schema?: SCHEMA;
322
+ enum?: Array<RESULT>;
323
+ };
324
+ export type MaybeCustomCtx<CustomCtx, DataModel extends GenericDataModel, AgentTools extends ToolSet> = CustomCtx extends Record<string, unknown> ? {
172
325
  /**
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.
326
+ * If you have a custom ctx that you use with the Agent
327
+ * (e.g. new Agent<{ orgId: string }>(...))
328
+ * you need to provide this function to add any extra fields.
329
+ * e.g.
330
+ * ```ts
331
+ * const myAgent = new Agent<{ orgId: string }>(...);
332
+ * const myAction = myAgent.asTextAction({
333
+ * customCtx: (ctx: ActionCtx, target, llmArgs) => {
334
+ * const orgId = await lookupOrgId(ctx, target.threadId);
335
+ * return { orgId };
336
+ * },
337
+ * });
338
+ * ```
339
+ * Then, in your tools, you can
177
340
  */
178
- promptMessageId?: string;
179
- experimental_repairText?: RepairTextFunction;
180
- experimental_telemetry?: TelemetrySettings;
181
- providerOptions?: ProviderOptions;
182
- experimental_providerMetadata?: ProviderMetadata;
341
+ customCtx: (ctx: GenericActionCtx<DataModel>, target: {
342
+ userId?: string | undefined;
343
+ threadId?: string | undefined;
344
+ }, llmArgs: TextArgs<AgentTools>) => CustomCtx;
345
+ } : {
346
+ customCtx?: never;
183
347
  };
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
348
  type ThreadOutputMetadata = Required<GenerationOutputMetadata>;
208
349
  /**
209
350
  * The interface for a thread returned from {@link createThread} or {@link continueThread}.
@@ -232,7 +373,7 @@ export interface Thread<DefaultTools extends ToolSet> {
232
373
  * for the {@link ContextOptions} and {@link StorageOptions}.
233
374
  * @returns The result of the generateText function.
234
375
  */
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>;
376
+ 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
377
  /**
237
378
  * This behaves like {@link streamText} from the "ai" package except that
238
379
  * it add context based on the userId and threadId and saves the input and
@@ -243,7 +384,7 @@ export interface Thread<DefaultTools extends ToolSet> {
243
384
  * for the {@link ContextOptions} and {@link StorageOptions}.
244
385
  * @returns The result of the streamText function.
245
386
  */
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 & {
387
+ 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
388
  /**
248
389
  * Whether to save incremental data (deltas) from streaming responses.
249
390
  * Defaults to false.
@@ -255,7 +396,7 @@ export interface Thread<DefaultTools extends ToolSet> {
255
396
  * iterating over the text, streaming it over HTTP, etc.
256
397
  */
257
398
  saveStreamDeltas?: boolean | StreamingOptions;
258
- }): Promise<StreamTextResult<TOOLS extends undefined ? DefaultTools : TOOLS, PARTIAL_OUTPUT> & ThreadOutputMetadata>;
399
+ }): Promise<StreamTextResult<TOOLS extends undefined ? DefaultTools : TOOLS, OUTPUT> & ThreadOutputMetadata>;
259
400
  /**
260
401
  * This behaves like {@link generateObject} from the "ai" package except that
261
402
  * it add context based on the userId and threadId and saves the input and
@@ -266,7 +407,7 @@ export interface Thread<DefaultTools extends ToolSet> {
266
407
  * for the {@link ContextOptions} and {@link StorageOptions}.
267
408
  * @returns The result of the generateObject function.
268
409
  */
269
- generateObject<T = JSONValue>(args: OurObjectArgs<T>, options?: Options): Promise<GenerateObjectResult<T> & ThreadOutputMetadata>;
410
+ 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
411
  /**
271
412
  * This behaves like {@link streamObject} from the "ai" package except that
272
413
  * it add context based on the userId and threadId and saves the input and
@@ -277,7 +418,11 @@ export interface Thread<DefaultTools extends ToolSet> {
277
418
  * for the {@link ContextOptions} and {@link StorageOptions}.
278
419
  * @returns The result of the streamObject function.
279
420
  */
280
- streamObject<T extends z.Schema | Schema>(args: OurStreamObjectArgs<T>, options?: Options): Promise<StreamObjectResult<DeepPartial<T>, T, never> & ThreadOutputMetadata>;
421
+ 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>>(
422
+ /**
423
+ * The same arguments you'd pass to "ai" sdk {@link streamObject}.
424
+ */
425
+ streamObjectArgs: AgentPrompt & StreamObjectArgs<SCHEMA, OUTPUT, RESULT>, options?: Options): Promise<ReturnType<typeof streamObject<SCHEMA, OUTPUT, RESULT>> & ThreadOutputMetadata>;
281
426
  }
282
427
  export type Options = {
283
428
  /**
@@ -288,6 +433,18 @@ export type Options = {
288
433
  * The storage options to use for saving the input and output messages to the thread.
289
434
  */
290
435
  storageOptions?: StorageOptions;
436
+ /**
437
+ * The usage handler to use for this thread. Overrides any handler
438
+ * set in the agent constructor.
439
+ */
440
+ usageHandler?: UsageHandler;
441
+ /**
442
+ * By default, messages are ordered with context in `fetchContextWithPrompt`,
443
+ * but you can override this by providing a context handler. Here you can
444
+ * filter, modify, or enrich the context messages. If provided, the default
445
+ * ordering will not apply. This excludes the system message / instructions.
446
+ */
447
+ contextHandler?: ContextHandler;
291
448
  };
292
449
  export type SyncStreamsReturnValue = {
293
450
  kind: "list";
@@ -296,28 +453,8 @@ export type SyncStreamsReturnValue = {
296
453
  kind: "deltas";
297
454
  deltas: StreamDelta[];
298
455
  } | 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
- }>;
456
+ export type QueryCtx = Pick<GenericQueryCtx<GenericDataModel>, "runQuery">;
457
+ export type MutationCtx = Pick<GenericMutationCtx<GenericDataModel>, "runQuery" | "runMutation">;
458
+ export type ActionCtx = Pick<GenericActionCtx<GenericDataModel>, "runQuery" | "runMutation" | "runAction" | "storage" | "auth">;
322
459
  export {};
323
460
  //# 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,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE;QACd;;WAEG;QACH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AAE,MAAM,EAAE,MAAM,CAAC,EACxE,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CACR,UAAU,CAAC,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,GACrD,oBAAoB,CACvB,CAAC;CACH;AAED,MAAM,MAAM,OAAO,GAAG;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;OAGG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAC9B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,aAAa,EAAE,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE,GACzC,SAAS,CAAC;AAGd,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC,CAAC;AAC3E,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B,kBAAkB,CAAC,gBAAgB,CAAC,EACpC,UAAU,GAAG,aAAa,CAC3B,CAAC;AACF,MAAM,MAAM,SAAS,GAAG,IAAI,CAC1B,gBAAgB,CAAC,gBAAgB,CAAC,EAClC,UAAU,GAAG,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"}