@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.
- package/README.md +32 -27
- package/dist/UIMessages.d.ts +46 -0
- package/dist/UIMessages.d.ts.map +1 -0
- package/dist/UIMessages.js +546 -0
- package/dist/UIMessages.js.map +1 -0
- package/dist/client/createTool.d.ts +129 -27
- package/dist/client/createTool.d.ts.map +1 -1
- package/dist/client/createTool.js +66 -12
- package/dist/client/createTool.js.map +1 -1
- package/dist/client/defaultComponent.d.ts +11 -0
- package/dist/client/defaultComponent.d.ts.map +1 -0
- package/dist/client/defaultComponent.js +7 -0
- package/dist/client/defaultComponent.js.map +1 -0
- package/dist/client/definePlaygroundAPI.d.ts +1323 -192
- package/dist/client/definePlaygroundAPI.d.ts.map +1 -1
- package/dist/client/definePlaygroundAPI.js +52 -28
- package/dist/client/definePlaygroundAPI.js.map +1 -1
- package/dist/client/files.d.ts +20 -7
- package/dist/client/files.d.ts.map +1 -1
- package/dist/client/files.js +68 -11
- package/dist/client/files.js.map +1 -1
- package/dist/client/index.d.ts +1056 -965
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +242 -748
- package/dist/client/index.js.map +1 -1
- package/dist/client/messages.d.ts +461 -0
- package/dist/client/messages.d.ts.map +1 -0
- package/dist/client/messages.js +106 -0
- package/dist/client/messages.js.map +1 -0
- package/dist/client/mockModel.d.ts +42 -0
- package/dist/client/mockModel.d.ts.map +1 -0
- package/dist/client/mockModel.js +175 -0
- package/dist/client/mockModel.js.map +1 -0
- package/dist/client/saveInputMessages.d.ts +20 -0
- package/dist/client/saveInputMessages.d.ts.map +1 -0
- package/dist/client/saveInputMessages.js +58 -0
- package/dist/client/saveInputMessages.js.map +1 -0
- package/dist/client/search.d.ts +346 -35
- package/dist/client/search.d.ts.map +1 -1
- package/dist/client/search.js +350 -39
- package/dist/client/search.js.map +1 -1
- package/dist/client/start.d.ts +84 -0
- package/dist/client/start.d.ts.map +1 -0
- package/dist/client/start.js +171 -0
- package/dist/client/start.js.map +1 -0
- package/dist/client/streamText.d.ts +46 -0
- package/dist/client/streamText.d.ts.map +1 -0
- package/dist/client/streamText.js +93 -0
- package/dist/client/streamText.js.map +1 -0
- package/dist/client/streaming.d.ts +3705 -32
- package/dist/client/streaming.d.ts.map +1 -1
- package/dist/client/streaming.js +141 -59
- package/dist/client/streaming.js.map +1 -1
- package/dist/client/threads.d.ts +46 -0
- package/dist/client/threads.d.ts.map +1 -0
- package/dist/client/threads.js +49 -0
- package/dist/client/threads.js.map +1 -0
- package/dist/client/types.d.ts +265 -128
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/utils.d.ts +4 -0
- package/dist/client/utils.d.ts.map +1 -0
- package/dist/client/utils.js +21 -0
- package/dist/client/utils.js.map +1 -0
- package/dist/component/_generated/api.d.ts +24 -2178
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js +10 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +3119 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +4 -18
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +10 -38
- package/dist/component/_generated/server.d.ts.map +1 -1
- package/dist/component/_generated/server.js +9 -5
- package/dist/component/_generated/server.js.map +1 -1
- package/dist/component/files.d.ts +16 -10
- package/dist/component/files.d.ts.map +1 -1
- package/dist/component/files.js +10 -2
- package/dist/component/files.js.map +1 -1
- package/dist/component/messages.d.ts +2553 -342
- package/dist/component/messages.d.ts.map +1 -1
- package/dist/component/messages.js +387 -154
- package/dist/component/messages.js.map +1 -1
- package/dist/component/schema.d.ts +5697 -3584
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +18 -41
- package/dist/component/schema.js.map +1 -1
- package/dist/component/streams.d.ts +35 -335
- package/dist/component/streams.d.ts.map +1 -1
- package/dist/component/streams.js +114 -73
- package/dist/component/streams.js.map +1 -1
- package/dist/component/threads.d.ts +16 -16
- package/dist/component/users.d.ts +4 -4
- package/dist/component/vector/index.d.ts +1 -1
- package/dist/component/vector/index.d.ts.map +1 -1
- package/dist/component/vector/index.js +1 -3
- package/dist/component/vector/index.js.map +1 -1
- package/dist/deltas.d.ts +43 -0
- package/dist/deltas.d.ts.map +1 -0
- package/dist/deltas.js +447 -0
- package/dist/deltas.js.map +1 -0
- package/dist/mapping.d.ts +20 -20
- package/dist/mapping.d.ts.map +1 -1
- package/dist/mapping.js +313 -96
- package/dist/mapping.js.map +1 -1
- package/dist/react/SmoothText.d.ts +5 -0
- package/dist/react/SmoothText.d.ts.map +1 -0
- package/dist/react/SmoothText.js +6 -0
- package/dist/react/SmoothText.js.map +1 -0
- package/dist/react/index.d.ts +5 -77
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +6 -160
- package/dist/react/index.js.map +1 -1
- package/dist/react/optimisticallySendMessage.d.ts +36 -3
- package/dist/react/optimisticallySendMessage.d.ts.map +1 -1
- package/dist/react/optimisticallySendMessage.js +35 -9
- package/dist/react/optimisticallySendMessage.js.map +1 -1
- package/dist/react/types.d.ts +4 -18
- package/dist/react/types.d.ts.map +1 -1
- package/dist/react/useDeltaStreams.d.ts +10 -0
- package/dist/react/useDeltaStreams.d.ts.map +1 -0
- package/dist/react/useDeltaStreams.js +101 -0
- package/dist/react/useDeltaStreams.js.map +1 -0
- package/dist/react/useSmoothText.d.ts +13 -12
- package/dist/react/useSmoothText.d.ts.map +1 -1
- package/dist/react/useSmoothText.js +32 -15
- package/dist/react/useSmoothText.js.map +1 -1
- package/dist/react/useStreamingUIMessages.d.ts +22 -0
- package/dist/react/useStreamingUIMessages.d.ts.map +1 -0
- package/dist/react/useStreamingUIMessages.js +92 -0
- package/dist/react/useStreamingUIMessages.js.map +1 -0
- package/dist/react/useThreadMessages.d.ts +104 -0
- package/dist/react/useThreadMessages.d.ts.map +1 -0
- package/dist/react/useThreadMessages.js +148 -0
- package/dist/react/useThreadMessages.js.map +1 -0
- package/dist/react/useUIMessages.d.ts +96 -0
- package/dist/react/useUIMessages.d.ts.map +1 -0
- package/dist/react/useUIMessages.js +108 -0
- package/dist/react/useUIMessages.js.map +1 -0
- package/dist/shared.d.ts +20 -4
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +45 -8
- package/dist/shared.js.map +1 -1
- package/dist/validators.d.ts +22981 -5666
- package/dist/validators.d.ts.map +1 -1
- package/dist/validators.js +245 -137
- package/dist/validators.js.map +1 -1
- package/package.json +98 -50
- package/src/UIMessages.combineUIMessages.test.ts +239 -0
- package/src/UIMessages.test.ts +273 -0
- package/src/UIMessages.ts +739 -0
- package/src/client/createTool.ts +293 -76
- package/src/client/defaultComponent.ts +17 -0
- package/src/client/definePlaygroundAPI.ts +67 -31
- package/src/client/files.ts +100 -20
- package/src/client/index.test.ts +40 -85
- package/src/client/index.ts +520 -1290
- package/src/client/messages.ts +237 -0
- package/src/client/mockModel.ts +245 -0
- package/src/client/saveInputMessages.test.ts +583 -0
- package/src/client/saveInputMessages.ts +101 -0
- package/src/client/search.test.ts +1207 -0
- package/src/client/search.ts +577 -70
- package/src/client/start.ts +310 -0
- package/src/client/streamText.ts +163 -0
- package/src/client/streaming.test.ts +186 -0
- package/src/client/streaming.ts +219 -97
- package/src/client/threads.ts +83 -0
- package/src/client/types.ts +368 -219
- package/src/client/utils.ts +27 -0
- package/src/component/_generated/api.ts +64 -0
- package/src/component/_generated/component.ts +4913 -0
- package/src/component/_generated/{server.d.ts → server.ts} +33 -21
- package/src/component/files.ts +11 -2
- package/src/component/messages.test.ts +195 -51
- package/src/component/messages.ts +490 -201
- package/src/component/schema.ts +20 -46
- package/src/component/setup.test.ts +7 -0
- package/src/component/streams.ts +184 -83
- package/src/component/users.test.ts +0 -1
- package/src/component/vector/index.ts +1 -3
- package/src/deltas.test.ts +626 -0
- package/src/deltas.ts +570 -0
- package/src/fromUIMessages.test.ts +497 -0
- package/src/mapping.test.ts +103 -6
- package/src/mapping.ts +422 -161
- package/src/react/SmoothText.tsx +9 -0
- package/src/react/index.ts +10 -230
- package/src/react/optimisticallySendMessage.ts +55 -12
- package/src/react/types.ts +6 -39
- package/src/react/useDeltaStreams.ts +154 -0
- package/src/react/useSmoothText.ts +56 -36
- package/src/react/useStreamingUIMessages.ts +143 -0
- package/src/react/useThreadMessages.ts +262 -0
- package/src/react/useUIMessages.test.ts +255 -0
- package/src/react/useUIMessages.ts +195 -0
- package/src/shared.ts +88 -12
- package/src/test.ts +18 -0
- package/src/toUIMessages.test.ts +1269 -0
- package/src/validators.test.ts +18 -19
- package/src/validators.ts +325 -185
- package/dist/client/_generated/_ignore.d.ts +0 -1
- package/dist/client/_generated/_ignore.d.ts.map +0 -1
- package/dist/client/_generated/_ignore.js +0 -3
- package/dist/client/_generated/_ignore.js.map +0 -1
- package/dist/client/listMessages.d.ts +0 -22
- package/dist/client/listMessages.d.ts.map +0 -1
- package/dist/client/listMessages.js +0 -25
- package/dist/client/listMessages.js.map +0 -1
- package/dist/package.json +0 -3
- package/dist/react/deltas.d.ts +0 -26
- package/dist/react/deltas.d.ts.map +0 -1
- package/dist/react/deltas.js +0 -384
- package/dist/react/deltas.js.map +0 -1
- package/dist/react/toUIMessages.d.ts +0 -15
- package/dist/react/toUIMessages.d.ts.map +0 -1
- package/dist/react/toUIMessages.js +0 -211
- package/dist/react/toUIMessages.js.map +0 -1
- package/src/client/listMessages.ts +0 -38
- package/src/component/_generated/api.d.ts +0 -2202
- package/src/component/_generated/api.js +0 -23
- package/src/component/_generated/server.js +0 -90
- package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +0 -1
- package/src/react/deltas.test.ts +0 -315
- package/src/react/deltas.ts +0 -478
- package/src/react/toUIMessages.test.ts +0 -420
- package/src/react/toUIMessages.ts +0 -253
- package/src/vitest.config.ts +0 -7
- /package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +0 -0
package/src/client/types.ts
CHANGED
|
@@ -1,49 +1,184 @@
|
|
|
1
|
-
import type { LanguageModelV2 } from "@ai-sdk/provider";
|
|
2
1
|
import type {
|
|
2
|
+
FlexibleSchema,
|
|
3
|
+
InferSchema,
|
|
3
4
|
ModelMessage,
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
ProviderOptions,
|
|
6
|
+
} from "@ai-sdk/provider-utils";
|
|
7
|
+
import type { JSONValue } from "@ai-sdk/provider";
|
|
8
|
+
import type {
|
|
9
|
+
EmbeddingModel,
|
|
6
10
|
GenerateObjectResult,
|
|
7
11
|
generateText,
|
|
8
12
|
GenerateTextResult,
|
|
9
|
-
JSONValue,
|
|
10
13
|
LanguageModelRequestMetadata,
|
|
11
14
|
LanguageModelResponseMetadata,
|
|
12
|
-
|
|
15
|
+
LanguageModelUsage,
|
|
16
|
+
LanguageModel,
|
|
13
17
|
streamObject,
|
|
14
|
-
StreamObjectResult,
|
|
15
18
|
streamText,
|
|
16
19
|
StreamTextResult,
|
|
17
|
-
TelemetrySettings,
|
|
18
|
-
ToolChoice,
|
|
19
20
|
ToolSet,
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
CallSettings,
|
|
22
|
+
generateObject,
|
|
22
23
|
} from "ai";
|
|
24
|
+
|
|
25
|
+
export interface Output<_T = any, _P = any, _E = any> {
|
|
26
|
+
name: string;
|
|
27
|
+
responseFormat: any;
|
|
28
|
+
parseCompleteOutput: any;
|
|
29
|
+
parsePartialOutput: any;
|
|
30
|
+
createElementStreamTransform: any;
|
|
31
|
+
}
|
|
23
32
|
import type {
|
|
24
|
-
Auth,
|
|
25
|
-
Expand,
|
|
26
|
-
FunctionReference,
|
|
27
|
-
StorageActionWriter,
|
|
28
|
-
StorageReader,
|
|
29
|
-
WithoutSystemFields,
|
|
30
|
-
FunctionArgs,
|
|
31
|
-
FunctionReturnType,
|
|
32
33
|
GenericActionCtx,
|
|
33
34
|
GenericDataModel,
|
|
35
|
+
GenericMutationCtx,
|
|
36
|
+
GenericQueryCtx,
|
|
37
|
+
WithoutSystemFields,
|
|
34
38
|
} from "convex/server";
|
|
35
|
-
import type { GenericId } from "convex/values";
|
|
36
|
-
import type { z } from "zod";
|
|
37
|
-
import type { Mounts } from "../component/_generated/api.js";
|
|
38
|
-
import type { ThreadDoc } from "../component/schema.js";
|
|
39
39
|
import type {
|
|
40
|
-
|
|
40
|
+
MessageDoc,
|
|
41
41
|
ProviderMetadata,
|
|
42
|
-
ProviderOptions,
|
|
43
42
|
StreamDelta,
|
|
44
43
|
StreamMessage,
|
|
44
|
+
ThreadDoc,
|
|
45
45
|
} from "../validators.js";
|
|
46
46
|
import type { StreamingOptions } from "./streaming.js";
|
|
47
|
+
import type { ComponentApi } from "../component/_generated/component.js";
|
|
48
|
+
|
|
49
|
+
export type AgentPrompt = {
|
|
50
|
+
/**
|
|
51
|
+
* System message to include in the prompt. Overwrites Agent instructions.
|
|
52
|
+
*/
|
|
53
|
+
system?: string;
|
|
54
|
+
/**
|
|
55
|
+
* A prompt. It can be either a text prompt or a list of messages.
|
|
56
|
+
* If used with `promptMessageId`, it will be used in place of that
|
|
57
|
+
* prompt message and no input messages will be saved.
|
|
58
|
+
* Otherwise, if used with the storageOptions "promptAndOutput" (default),
|
|
59
|
+
* it will be the only message saved.
|
|
60
|
+
* If a string is provided, it will be a user message.
|
|
61
|
+
*/
|
|
62
|
+
prompt?: string | Array<ModelMessage> | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* A list of messages to use as context before the prompt.
|
|
65
|
+
* If used with `prompt`, these will precede the prompt.
|
|
66
|
+
* If used with the storageOptions "promptAndOutput" (default),
|
|
67
|
+
* none of these messages will be saved.
|
|
68
|
+
*/
|
|
69
|
+
messages?: Array<ModelMessage> | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* If provided, it uses this existing message to anchor the prompt:
|
|
72
|
+
* - The specified message will be included, unless `prompt` is also
|
|
73
|
+
* provided, in which case that will be inserted in place of this
|
|
74
|
+
* specified message.
|
|
75
|
+
* - Recent and search messages will not include messages after this
|
|
76
|
+
* message's order.
|
|
77
|
+
* - If there are already responses on the same order,
|
|
78
|
+
* for example, tool calls and responses,
|
|
79
|
+
* those will be included automatically.
|
|
80
|
+
*
|
|
81
|
+
* Note: if this is provided, no input messages will be saved by default.
|
|
82
|
+
*/
|
|
83
|
+
promptMessageId?: string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* The model to use for the LLM calls. This will override the languageModel
|
|
86
|
+
* specified in the Agent config.
|
|
87
|
+
*/
|
|
88
|
+
model?: LanguageModel;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export type Config = {
|
|
92
|
+
/**
|
|
93
|
+
* The LLM model to use for generating / streaming text and objects.
|
|
94
|
+
* e.g.
|
|
95
|
+
* import { openai } from "@ai-sdk/openai"
|
|
96
|
+
* const myAgent = new Agent(components.agent, {
|
|
97
|
+
* languageModel: openai.chat("gpt-4o-mini"),
|
|
98
|
+
*/
|
|
99
|
+
languageModel?: LanguageModel;
|
|
100
|
+
/**
|
|
101
|
+
* The model to use for text embeddings. Optional.
|
|
102
|
+
* If specified, it will use this for generating vector embeddings
|
|
103
|
+
* of chats, and can opt-in to doing vector search for automatic context
|
|
104
|
+
* on generateText, etc.
|
|
105
|
+
* e.g.
|
|
106
|
+
* import { openai } from "@ai-sdk/openai"
|
|
107
|
+
* const myAgent = new Agent(components.agent, {
|
|
108
|
+
* ...
|
|
109
|
+
* textEmbeddingModel: openai.embedding("text-embedding-3-small")
|
|
110
|
+
* @deprecated — Use embeddingModel instead.
|
|
111
|
+
*/
|
|
112
|
+
textEmbeddingModel?: EmbeddingModel;
|
|
113
|
+
/**
|
|
114
|
+
* The model to use for text embeddings. Optional.
|
|
115
|
+
* If specified, it will use this for generating vector embeddings
|
|
116
|
+
* of chats, and can opt-in to doing vector search for automatic context
|
|
117
|
+
* on generateText, etc.
|
|
118
|
+
* e.g.
|
|
119
|
+
* import { openai } from "@ai-sdk/openai"
|
|
120
|
+
* const myAgent = new Agent(components.agent, {
|
|
121
|
+
* ...
|
|
122
|
+
* embeddingModel: openai.embedding("text-embedding-3-small")
|
|
123
|
+
*/
|
|
124
|
+
embeddingModel?: EmbeddingModel;
|
|
125
|
+
/**
|
|
126
|
+
* Options to determine what messages are included as context in message
|
|
127
|
+
* generation. To disable any messages automatically being added, pass:
|
|
128
|
+
* { recentMessages: 0 }
|
|
129
|
+
*/
|
|
130
|
+
contextOptions?: ContextOptions;
|
|
131
|
+
/**
|
|
132
|
+
* Determines whether messages are automatically stored when passed as
|
|
133
|
+
* arguments or generated.
|
|
134
|
+
*/
|
|
135
|
+
storageOptions?: StorageOptions;
|
|
136
|
+
/**
|
|
137
|
+
* The usage handler to use for this agent.
|
|
138
|
+
*/
|
|
139
|
+
usageHandler?: UsageHandler;
|
|
140
|
+
/**
|
|
141
|
+
* By default, messages are ordered with context in `fetchContextWithPrompt`,
|
|
142
|
+
* but you can override this by providing a context handler. Here you can
|
|
143
|
+
* filter, modify, or enrich the context messages. If provided, the default
|
|
144
|
+
* ordering will not apply. This excludes the system message / instructions.
|
|
145
|
+
*/
|
|
146
|
+
contextHandler?: ContextHandler;
|
|
147
|
+
/**
|
|
148
|
+
* Called for each LLM request/response, so you can do things like
|
|
149
|
+
* log the raw request body or response headers to a table, or logs.
|
|
150
|
+
*/
|
|
151
|
+
rawRequestResponseHandler?: RawRequestResponseHandler;
|
|
152
|
+
/**
|
|
153
|
+
* @deprecated Reach out if you use this. Otherwise will be removed soon.
|
|
154
|
+
* Default provider options to pass for the LLM calls.
|
|
155
|
+
* This can be overridden at each generate/stream callsite on a per-field
|
|
156
|
+
* basis. To clear a default setting, you'll need to pass `undefined`.
|
|
157
|
+
*/
|
|
158
|
+
providerOptions?: ProviderOptions;
|
|
159
|
+
/**
|
|
160
|
+
* The default settings to use for the LLM calls.
|
|
161
|
+
* This can be overridden at each generate/stream callsite on a per-field
|
|
162
|
+
* basis. To clear a default setting, you'll need to pass `undefined`.
|
|
163
|
+
*/
|
|
164
|
+
callSettings?: CallSettings;
|
|
165
|
+
/**
|
|
166
|
+
* The maximum number of steps to allow for a single generation.
|
|
167
|
+
*
|
|
168
|
+
* For example, if an agent wants to call a tool, that call and tool response
|
|
169
|
+
* will be one step. Generating a response based on the tool call & response
|
|
170
|
+
* will be a second step.
|
|
171
|
+
* If it runs out of steps, it will return the last step result, which may
|
|
172
|
+
* not be an assistant message.
|
|
173
|
+
|
|
174
|
+
* This becomes the default value when `stopWhen` is not specified in the
|
|
175
|
+
* Agent or generation callsite.
|
|
176
|
+
* AI SDK v5 removed the `maxSteps` argument, but this is kept here for
|
|
177
|
+
* convenience and backwards compatibility.
|
|
178
|
+
* Defaults to 1.
|
|
179
|
+
*/
|
|
180
|
+
maxSteps?: number;
|
|
181
|
+
};
|
|
47
182
|
|
|
48
183
|
/**
|
|
49
184
|
* Options to configure what messages are fetched as context,
|
|
@@ -115,10 +250,31 @@ export type StorageOptions = {
|
|
|
115
250
|
saveMessages?: "all" | "none" | "promptAndOutput";
|
|
116
251
|
};
|
|
117
252
|
|
|
118
|
-
export type GenerationOutputMetadata = {
|
|
253
|
+
export type GenerationOutputMetadata = {
|
|
254
|
+
/**
|
|
255
|
+
* The ID of the prompt message for the generation.
|
|
256
|
+
*/
|
|
257
|
+
promptMessageId?: string;
|
|
258
|
+
/**
|
|
259
|
+
* The order of the prompt message and responses for the generation.
|
|
260
|
+
* Each order starts with a user message, then followed by agent responses.
|
|
261
|
+
* If a promptMessageId is provided, that dictates the order.
|
|
262
|
+
*/
|
|
263
|
+
order?: number;
|
|
264
|
+
/**
|
|
265
|
+
* The messages saved for the generation - both saved input and output.
|
|
266
|
+
* If you passed promptMessageId, it will not include that message.
|
|
267
|
+
*/
|
|
268
|
+
savedMessages?: MessageDoc[];
|
|
269
|
+
/**
|
|
270
|
+
* @deprecated Use promptMessageId instead.
|
|
271
|
+
* The ID of the prompt message for the generation.
|
|
272
|
+
*/
|
|
273
|
+
messageId?: string;
|
|
274
|
+
};
|
|
119
275
|
|
|
120
276
|
export type UsageHandler = (
|
|
121
|
-
ctx:
|
|
277
|
+
ctx: ActionCtx,
|
|
122
278
|
args: {
|
|
123
279
|
userId: string | undefined;
|
|
124
280
|
threadId: string | undefined;
|
|
@@ -131,6 +287,54 @@ export type UsageHandler = (
|
|
|
131
287
|
},
|
|
132
288
|
) => void | Promise<void>;
|
|
133
289
|
|
|
290
|
+
/**
|
|
291
|
+
* By default, messages are ordered with context in `fetchContextWithPrompt`,
|
|
292
|
+
* but you can override this by providing a context handler. Here you can filter
|
|
293
|
+
* out, add in, or reorder messages.
|
|
294
|
+
*/
|
|
295
|
+
export type ContextHandler = (
|
|
296
|
+
ctx: ActionCtx,
|
|
297
|
+
args: {
|
|
298
|
+
/**
|
|
299
|
+
* All messages in the default order.
|
|
300
|
+
*/
|
|
301
|
+
allMessages: ModelMessage[];
|
|
302
|
+
/**
|
|
303
|
+
* The messages fetched from search.
|
|
304
|
+
*/
|
|
305
|
+
search: ModelMessage[];
|
|
306
|
+
/**
|
|
307
|
+
* The recent messages already in the thread history,
|
|
308
|
+
* excluding any messages that came after promptMessageId.
|
|
309
|
+
*/
|
|
310
|
+
recent: ModelMessage[];
|
|
311
|
+
/**
|
|
312
|
+
* The messages passed as the `messages` argument to e.g. generateText.
|
|
313
|
+
*/
|
|
314
|
+
inputMessages: ModelMessage[];
|
|
315
|
+
/**
|
|
316
|
+
* The message(s) passed as the `prompt` argument to e.g. generateText.
|
|
317
|
+
* Otherwise, if `promptMessageId` was provided, the message at that id.
|
|
318
|
+
* `prompt` will override the message at `promptMessageId`.
|
|
319
|
+
*/
|
|
320
|
+
inputPrompt: ModelMessage[];
|
|
321
|
+
/**
|
|
322
|
+
* Any messages on the same `order` as the promptMessageId message after the
|
|
323
|
+
* prompt message. These are presumably existing responses to the prompt
|
|
324
|
+
* message.
|
|
325
|
+
*/
|
|
326
|
+
existingResponses: ModelMessage[];
|
|
327
|
+
/**
|
|
328
|
+
* The user associated with the generation, if any.
|
|
329
|
+
*/
|
|
330
|
+
userId: string | undefined;
|
|
331
|
+
/**
|
|
332
|
+
* The thread associated with the generation, if any.
|
|
333
|
+
*/
|
|
334
|
+
threadId: string | undefined;
|
|
335
|
+
},
|
|
336
|
+
) => ModelMessage[] | Promise<ModelMessage[]>;
|
|
337
|
+
|
|
134
338
|
export type RawRequestResponseHandler = (
|
|
135
339
|
ctx: ActionCtx,
|
|
136
340
|
args: {
|
|
@@ -142,157 +346,117 @@ export type RawRequestResponseHandler = (
|
|
|
142
346
|
},
|
|
143
347
|
) => void | Promise<void>;
|
|
144
348
|
|
|
145
|
-
export type AgentComponent =
|
|
349
|
+
export type AgentComponent = ComponentApi;
|
|
146
350
|
|
|
147
351
|
export type TextArgs<
|
|
148
352
|
AgentTools extends ToolSet,
|
|
149
353
|
TOOLS extends ToolSet | undefined = undefined,
|
|
150
|
-
OUTPUT = never,
|
|
151
|
-
OUTPUT_PARTIAL = never,
|
|
354
|
+
OUTPUT extends Output<any, any, any> = never,
|
|
152
355
|
> = Omit<
|
|
153
356
|
Parameters<
|
|
154
357
|
typeof generateText<
|
|
155
358
|
TOOLS extends undefined ? AgentTools : TOOLS,
|
|
156
|
-
OUTPUT
|
|
157
|
-
OUTPUT_PARTIAL
|
|
359
|
+
OUTPUT
|
|
158
360
|
>
|
|
159
361
|
>[0],
|
|
160
|
-
"
|
|
362
|
+
"model" | "prompt" | "messages"
|
|
161
363
|
> & {
|
|
162
|
-
/**
|
|
163
|
-
* If provided, this message will be used as the "prompt" for the LLM call,
|
|
164
|
-
* instead of the prompt or messages.
|
|
165
|
-
* This is useful if you want to first save a user message, then use it as
|
|
166
|
-
* the prompt for the LLM call in another call.
|
|
167
|
-
*/
|
|
168
|
-
promptMessageId?: string;
|
|
169
|
-
/**
|
|
170
|
-
* The model to use for the LLM calls. This will override the model specified
|
|
171
|
-
* in the Agent constructor.
|
|
172
|
-
*/
|
|
173
|
-
model?: LanguageModelV2;
|
|
174
364
|
/**
|
|
175
365
|
* The tools to use for the tool calls. This will override tools specified
|
|
176
366
|
* in the Agent constructor or createThread / continueThread.
|
|
177
367
|
*/
|
|
178
368
|
tools?: TOOLS;
|
|
179
|
-
|
|
180
|
-
* The tool choice to use for the tool calls. This must be one of the tools
|
|
181
|
-
* specified in the tools array. e.g. {toolName: "getWeather", type: "tool"}
|
|
182
|
-
*/
|
|
183
|
-
toolChoice?: ToolChoice<TOOLS extends undefined ? AgentTools : TOOLS>;
|
|
184
|
-
};
|
|
369
|
+
} & AgentPrompt;
|
|
185
370
|
|
|
186
371
|
export type StreamingTextArgs<
|
|
187
372
|
AgentTools extends ToolSet,
|
|
188
373
|
TOOLS extends ToolSet | undefined = undefined,
|
|
189
|
-
OUTPUT = never,
|
|
190
|
-
OUTPUT_PARTIAL = never,
|
|
374
|
+
OUTPUT extends Output<any, any, any> = never,
|
|
191
375
|
> = Omit<
|
|
192
376
|
Parameters<
|
|
193
377
|
typeof streamText<
|
|
194
378
|
TOOLS extends undefined ? AgentTools : TOOLS,
|
|
195
|
-
OUTPUT
|
|
196
|
-
OUTPUT_PARTIAL
|
|
379
|
+
OUTPUT
|
|
197
380
|
>
|
|
198
381
|
>[0],
|
|
199
|
-
"
|
|
382
|
+
"model" | "prompt" | "messages"
|
|
200
383
|
> & {
|
|
201
|
-
/**
|
|
202
|
-
* If provided, this message will be used as the "prompt" for the LLM call,
|
|
203
|
-
* instead of the prompt or messages.
|
|
204
|
-
* This is useful if you want to first save a user message, then use it as
|
|
205
|
-
* the prompt for the LLM call in another call.
|
|
206
|
-
*/
|
|
207
|
-
promptMessageId?: string;
|
|
208
|
-
/**
|
|
209
|
-
* The model to use for the tool calls. This will override the model specified
|
|
210
|
-
* in the Agent constructor.
|
|
211
|
-
*/
|
|
212
|
-
model?: LanguageModelV2;
|
|
213
384
|
/**
|
|
214
385
|
* The tools to use for the tool calls. This will override tools specified
|
|
215
386
|
* in the Agent constructor or createThread / continueThread.
|
|
216
387
|
*/
|
|
217
388
|
tools?: TOOLS;
|
|
218
|
-
|
|
219
|
-
* The tool choice to use for the tool calls. This must be one of the tools
|
|
220
|
-
* specified in the tools array. e.g. {toolName: "getWeather", type: "tool"}
|
|
221
|
-
*/
|
|
222
|
-
toolChoice?: ToolChoice<TOOLS extends undefined ? AgentTools : TOOLS>;
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
type BaseGenerateObjectOptions = CallSettings & {
|
|
226
|
-
/**
|
|
227
|
-
* The model to use for the object generation. This will override the model
|
|
228
|
-
* specified in the Agent constructor.
|
|
229
|
-
*/
|
|
230
|
-
model?: LanguageModelV2;
|
|
231
|
-
/**
|
|
232
|
-
* The system prompt to use for the object generation. This will override the
|
|
233
|
-
* system prompt specified in the Agent constructor.
|
|
234
|
-
*/
|
|
235
|
-
system?: string;
|
|
236
|
-
/**
|
|
237
|
-
* The prompt to the LLM to use for the object generation.
|
|
238
|
-
* Specify this or messages, but not both.
|
|
239
|
-
*/
|
|
240
|
-
prompt?: string | Array<ModelMessage>;
|
|
241
|
-
/**
|
|
242
|
-
* The messages to use for the object generation.
|
|
243
|
-
* Note: recent messages are automatically added based on the thread it's
|
|
244
|
-
* associated with and your contextOptions.
|
|
245
|
-
*/
|
|
246
|
-
messages?: Array<ModelMessage>;
|
|
247
|
-
/**
|
|
248
|
-
* The message to use as the "prompt" for the object generation.
|
|
249
|
-
* If this is provided, it will be used instead of the prompt or messages.
|
|
250
|
-
* This is useful if you want to first save a user message, then use it as
|
|
251
|
-
* the prompt for the object generation in another call.
|
|
252
|
-
*/
|
|
253
|
-
promptMessageId?: string;
|
|
254
|
-
experimental_repairText?: RepairTextFunction;
|
|
255
|
-
experimental_telemetry?: TelemetrySettings;
|
|
256
|
-
providerOptions?: ProviderOptions;
|
|
257
|
-
experimental_providerMetadata?: ProviderMetadata;
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
type StandardGenerateObjectOptions<T> = {
|
|
261
|
-
schema: z.Schema<T>;
|
|
262
|
-
schemaName?: string;
|
|
263
|
-
schemaDescription?: string;
|
|
264
|
-
output?: "object" | "array";
|
|
265
|
-
mode?: "auto" | "json" | "tool";
|
|
266
|
-
};
|
|
389
|
+
} & AgentPrompt;
|
|
267
390
|
|
|
268
|
-
|
|
269
|
-
// model and tool/toolChoice types
|
|
270
|
-
type GenerateObjectArgs<T> = BaseGenerateObjectOptions &
|
|
271
|
-
(
|
|
272
|
-
| StandardGenerateObjectOptions<T>
|
|
273
|
-
| { output: "enum"; enum: Array<T>; mode?: "auto" | "json" | "tool" }
|
|
274
|
-
| { output: "any"; schema: undefined; mode: "json" }
|
|
275
|
-
);
|
|
391
|
+
export type ObjectMode = "object" | "array" | "enum" | "no-schema";
|
|
276
392
|
|
|
277
|
-
type
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
393
|
+
export type GenerateObjectArgs<
|
|
394
|
+
SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue>,
|
|
395
|
+
OUTPUT extends ObjectMode = InferSchema<SCHEMA> extends string
|
|
396
|
+
? "enum"
|
|
397
|
+
: "object",
|
|
398
|
+
RESULT = OUTPUT extends "array"
|
|
399
|
+
? Array<InferSchema<SCHEMA>>
|
|
400
|
+
: InferSchema<SCHEMA>,
|
|
401
|
+
> = AgentPrompt &
|
|
402
|
+
Omit<
|
|
403
|
+
Parameters<typeof generateObject<SCHEMA, OUTPUT, RESULT>>[0],
|
|
404
|
+
"model" | "prompt" | "messages"
|
|
405
|
+
> & {
|
|
406
|
+
schema?: SCHEMA;
|
|
407
|
+
enum?: Array<RESULT>;
|
|
408
|
+
};
|
|
282
409
|
|
|
283
|
-
export type
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
410
|
+
export type StreamObjectArgs<
|
|
411
|
+
SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue>,
|
|
412
|
+
OUTPUT extends ObjectMode = InferSchema<SCHEMA> extends string
|
|
413
|
+
? "enum"
|
|
414
|
+
: "object",
|
|
415
|
+
RESULT = OUTPUT extends "array"
|
|
416
|
+
? Array<InferSchema<SCHEMA>>
|
|
417
|
+
: InferSchema<SCHEMA>,
|
|
418
|
+
> = AgentPrompt &
|
|
419
|
+
Omit<
|
|
420
|
+
Parameters<typeof streamObject<SCHEMA, OUTPUT, RESULT>>[0],
|
|
421
|
+
"model" | "prompt" | "messages"
|
|
422
|
+
> & {
|
|
423
|
+
schema?: SCHEMA;
|
|
424
|
+
enum?: Array<RESULT>;
|
|
425
|
+
};
|
|
289
426
|
|
|
290
|
-
export type
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
427
|
+
export type MaybeCustomCtx<
|
|
428
|
+
CustomCtx,
|
|
429
|
+
DataModel extends GenericDataModel,
|
|
430
|
+
AgentTools extends ToolSet,
|
|
431
|
+
> =
|
|
432
|
+
CustomCtx extends Record<string, unknown>
|
|
433
|
+
? {
|
|
434
|
+
/**
|
|
435
|
+
* If you have a custom ctx that you use with the Agent
|
|
436
|
+
* (e.g. new Agent<{ orgId: string }>(...))
|
|
437
|
+
* you need to provide this function to add any extra fields.
|
|
438
|
+
* e.g.
|
|
439
|
+
* ```ts
|
|
440
|
+
* const myAgent = new Agent<{ orgId: string }>(...);
|
|
441
|
+
* const myAction = myAgent.asTextAction({
|
|
442
|
+
* customCtx: (ctx: ActionCtx, target, llmArgs) => {
|
|
443
|
+
* const orgId = await lookupOrgId(ctx, target.threadId);
|
|
444
|
+
* return { orgId };
|
|
445
|
+
* },
|
|
446
|
+
* });
|
|
447
|
+
* ```
|
|
448
|
+
* Then, in your tools, you can
|
|
449
|
+
*/
|
|
450
|
+
customCtx: (
|
|
451
|
+
ctx: GenericActionCtx<DataModel>,
|
|
452
|
+
target: {
|
|
453
|
+
userId?: string | undefined;
|
|
454
|
+
threadId?: string | undefined;
|
|
455
|
+
},
|
|
456
|
+
llmArgs: TextArgs<AgentTools>,
|
|
457
|
+
) => CustomCtx;
|
|
458
|
+
}
|
|
459
|
+
: { customCtx?: never };
|
|
296
460
|
|
|
297
461
|
type ThreadOutputMetadata = Required<GenerationOutputMetadata>;
|
|
298
462
|
|
|
@@ -327,15 +491,14 @@ export interface Thread<DefaultTools extends ToolSet> {
|
|
|
327
491
|
*/
|
|
328
492
|
generateText<
|
|
329
493
|
TOOLS extends ToolSet | undefined = undefined,
|
|
330
|
-
OUTPUT = never,
|
|
331
|
-
OUTPUT_PARTIAL = never,
|
|
494
|
+
OUTPUT extends Output<any, any, any> = never,
|
|
332
495
|
>(
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
496
|
+
generateTextArgs: AgentPrompt &
|
|
497
|
+
TextArgs<
|
|
498
|
+
TOOLS extends undefined ? DefaultTools : TOOLS,
|
|
499
|
+
TOOLS,
|
|
500
|
+
OUTPUT
|
|
501
|
+
>,
|
|
339
502
|
options?: Options,
|
|
340
503
|
): Promise<
|
|
341
504
|
GenerateTextResult<TOOLS extends undefined ? DefaultTools : TOOLS, OUTPUT> &
|
|
@@ -354,15 +517,14 @@ export interface Thread<DefaultTools extends ToolSet> {
|
|
|
354
517
|
*/
|
|
355
518
|
streamText<
|
|
356
519
|
TOOLS extends ToolSet | undefined = undefined,
|
|
357
|
-
OUTPUT = never,
|
|
358
|
-
PARTIAL_OUTPUT = never,
|
|
520
|
+
OUTPUT extends Output<any, any, any> = never,
|
|
359
521
|
>(
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
522
|
+
streamTextArgs: AgentPrompt &
|
|
523
|
+
StreamingTextArgs<
|
|
524
|
+
TOOLS extends undefined ? DefaultTools : TOOLS,
|
|
525
|
+
TOOLS,
|
|
526
|
+
OUTPUT
|
|
527
|
+
>,
|
|
366
528
|
options?: Options & {
|
|
367
529
|
/**
|
|
368
530
|
* Whether to save incremental data (deltas) from streaming responses.
|
|
@@ -379,7 +541,7 @@ export interface Thread<DefaultTools extends ToolSet> {
|
|
|
379
541
|
): Promise<
|
|
380
542
|
StreamTextResult<
|
|
381
543
|
TOOLS extends undefined ? DefaultTools : TOOLS,
|
|
382
|
-
|
|
544
|
+
OUTPUT
|
|
383
545
|
> &
|
|
384
546
|
ThreadOutputMetadata
|
|
385
547
|
>;
|
|
@@ -393,10 +555,19 @@ export interface Thread<DefaultTools extends ToolSet> {
|
|
|
393
555
|
* for the {@link ContextOptions} and {@link StorageOptions}.
|
|
394
556
|
* @returns The result of the generateObject function.
|
|
395
557
|
*/
|
|
396
|
-
generateObject<
|
|
397
|
-
|
|
558
|
+
generateObject<
|
|
559
|
+
SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue>,
|
|
560
|
+
OUTPUT extends ObjectMode = InferSchema<SCHEMA> extends string
|
|
561
|
+
? "enum"
|
|
562
|
+
: "object",
|
|
563
|
+
RESULT = OUTPUT extends "array"
|
|
564
|
+
? Array<InferSchema<SCHEMA>>
|
|
565
|
+
: InferSchema<SCHEMA>,
|
|
566
|
+
>(
|
|
567
|
+
generateObjectArgs: AgentPrompt &
|
|
568
|
+
GenerateObjectArgs<SCHEMA, OUTPUT, RESULT>,
|
|
398
569
|
options?: Options,
|
|
399
|
-
): Promise<GenerateObjectResult<
|
|
570
|
+
): Promise<GenerateObjectResult<RESULT> & ThreadOutputMetadata>;
|
|
400
571
|
/**
|
|
401
572
|
* This behaves like {@link streamObject} from the "ai" package except that
|
|
402
573
|
* it add context based on the userId and threadId and saves the input and
|
|
@@ -407,11 +578,23 @@ export interface Thread<DefaultTools extends ToolSet> {
|
|
|
407
578
|
* for the {@link ContextOptions} and {@link StorageOptions}.
|
|
408
579
|
* @returns The result of the streamObject function.
|
|
409
580
|
*/
|
|
410
|
-
streamObject<
|
|
411
|
-
|
|
581
|
+
streamObject<
|
|
582
|
+
SCHEMA extends FlexibleSchema<unknown> = FlexibleSchema<JSONValue>,
|
|
583
|
+
OUTPUT extends ObjectMode = InferSchema<SCHEMA> extends string
|
|
584
|
+
? "enum"
|
|
585
|
+
: "object",
|
|
586
|
+
RESULT = OUTPUT extends "array"
|
|
587
|
+
? Array<InferSchema<SCHEMA>>
|
|
588
|
+
: InferSchema<SCHEMA>,
|
|
589
|
+
>(
|
|
590
|
+
/**
|
|
591
|
+
* The same arguments you'd pass to "ai" sdk {@link streamObject}.
|
|
592
|
+
*/
|
|
593
|
+
streamObjectArgs: AgentPrompt & StreamObjectArgs<SCHEMA, OUTPUT, RESULT>,
|
|
412
594
|
options?: Options,
|
|
413
595
|
): Promise<
|
|
414
|
-
|
|
596
|
+
ReturnType<typeof streamObject<SCHEMA, OUTPUT, RESULT>> &
|
|
597
|
+
ThreadOutputMetadata
|
|
415
598
|
>;
|
|
416
599
|
}
|
|
417
600
|
|
|
@@ -424,6 +607,18 @@ export type Options = {
|
|
|
424
607
|
* The storage options to use for saving the input and output messages to the thread.
|
|
425
608
|
*/
|
|
426
609
|
storageOptions?: StorageOptions;
|
|
610
|
+
/**
|
|
611
|
+
* The usage handler to use for this thread. Overrides any handler
|
|
612
|
+
* set in the agent constructor.
|
|
613
|
+
*/
|
|
614
|
+
usageHandler?: UsageHandler;
|
|
615
|
+
/**
|
|
616
|
+
* By default, messages are ordered with context in `fetchContextWithPrompt`,
|
|
617
|
+
* but you can override this by providing a context handler. Here you can
|
|
618
|
+
* filter, modify, or enrich the context messages. If provided, the default
|
|
619
|
+
* ordering will not apply. This excludes the system message / instructions.
|
|
620
|
+
*/
|
|
621
|
+
contextHandler?: ContextHandler;
|
|
427
622
|
};
|
|
428
623
|
|
|
429
624
|
export type SyncStreamsReturnValue =
|
|
@@ -432,58 +627,12 @@ export type SyncStreamsReturnValue =
|
|
|
432
627
|
| undefined;
|
|
433
628
|
|
|
434
629
|
/* Type utils follow */
|
|
435
|
-
export type
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
runMutation
|
|
443
|
-
|
|
444
|
-
args: FunctionArgs<Mutation>,
|
|
445
|
-
) => Promise<FunctionReturnType<Mutation>>;
|
|
446
|
-
};
|
|
447
|
-
export type RunActionCtx = RunMutationCtx & {
|
|
448
|
-
runAction<Action extends FunctionReference<"action", "internal">>(
|
|
449
|
-
action: Action,
|
|
450
|
-
args: FunctionArgs<Action>,
|
|
451
|
-
): Promise<FunctionReturnType<Action>>;
|
|
452
|
-
};
|
|
453
|
-
export type UserActionCtx = GenericActionCtx<GenericDataModel>;
|
|
454
|
-
export type ActionCtx = RunActionCtx & {
|
|
455
|
-
auth: Auth;
|
|
456
|
-
storage: StorageActionWriter;
|
|
457
|
-
};
|
|
458
|
-
export type QueryCtx = RunQueryCtx & {
|
|
459
|
-
storage: StorageReader;
|
|
460
|
-
};
|
|
461
|
-
|
|
462
|
-
export type OpaqueIds<T> =
|
|
463
|
-
T extends GenericId<infer _T>
|
|
464
|
-
? string
|
|
465
|
-
: T extends (infer U)[]
|
|
466
|
-
? OpaqueIds<U>[]
|
|
467
|
-
: T extends ArrayBuffer
|
|
468
|
-
? ArrayBuffer
|
|
469
|
-
: T extends object
|
|
470
|
-
? { [K in keyof T]: OpaqueIds<T[K]> }
|
|
471
|
-
: T;
|
|
472
|
-
|
|
473
|
-
export type UseApi<API> = Expand<{
|
|
474
|
-
[mod in keyof API]: API[mod] extends FunctionReference<
|
|
475
|
-
infer FType,
|
|
476
|
-
"public",
|
|
477
|
-
infer FArgs,
|
|
478
|
-
infer FReturnType,
|
|
479
|
-
infer FComponentPath
|
|
480
|
-
>
|
|
481
|
-
? FunctionReference<
|
|
482
|
-
FType,
|
|
483
|
-
"internal",
|
|
484
|
-
OpaqueIds<FArgs>,
|
|
485
|
-
OpaqueIds<FReturnType>,
|
|
486
|
-
FComponentPath
|
|
487
|
-
>
|
|
488
|
-
: UseApi<API[mod]>;
|
|
489
|
-
}>;
|
|
630
|
+
export type QueryCtx = Pick<GenericQueryCtx<GenericDataModel>, "runQuery">;
|
|
631
|
+
export type MutationCtx = Pick<
|
|
632
|
+
GenericMutationCtx<GenericDataModel>,
|
|
633
|
+
"runQuery" | "runMutation"
|
|
634
|
+
>;
|
|
635
|
+
export type ActionCtx = Pick<
|
|
636
|
+
GenericActionCtx<GenericDataModel>,
|
|
637
|
+
"runQuery" | "runMutation" | "runAction" | "storage" | "auth"
|
|
638
|
+
>;
|