@o-zakstam/voltagent-convex 1.1.2 → 1.1.3
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/dist/client/{index.d.cts → defineVoltAgentAPI.d.ts} +59 -92
- package/dist/client/defineVoltAgentAPI.d.ts.map +1 -0
- package/dist/client/defineVoltAgentAPI.js +318 -0
- package/dist/client/defineVoltAgentAPI.js.map +1 -0
- package/dist/client/index.d.ts +6 -221
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +8 -285
- package/dist/client/index.js.map +1 -1
- package/dist/client/types.d.ts +13 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +8 -0
- package/dist/client/types.js.map +1 -0
- package/dist/component/_generated/api.d.ts +44 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +352 -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 +46 -0
- 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 +121 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +78 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/conversations.d.ts +108 -0
- package/dist/component/conversations.d.ts.map +1 -0
- package/dist/component/conversations.js +278 -0
- package/dist/component/conversations.js.map +1 -0
- package/dist/component/convex.config.d.ts +13 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +21 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/messages.d.ts +235 -0
- package/dist/component/messages.d.ts.map +1 -0
- package/dist/component/messages.js +186 -0
- package/dist/component/messages.js.map +1 -0
- package/dist/component/schema.d.ts +535 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +113 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/component/steps.d.ts +65 -0
- package/dist/component/steps.d.ts.map +1 -0
- package/dist/component/steps.js +120 -0
- package/dist/component/steps.js.map +1 -0
- package/dist/component/validators.d.ts +633 -0
- package/dist/component/validators.d.ts.map +1 -0
- package/dist/component/validators.js +124 -0
- package/dist/component/validators.js.map +1 -0
- package/dist/component/workflows.d.ts +234 -0
- package/dist/component/workflows.d.ts.map +1 -0
- package/dist/component/workflows.js +229 -0
- package/dist/component/workflows.js.map +1 -0
- package/dist/component/workingMemory.d.ts +30 -0
- package/dist/component/workingMemory.d.ts.map +1 -0
- package/dist/component/workingMemory.js +131 -0
- package/dist/component/workingMemory.js.map +1 -0
- package/dist/index.d.ts +7 -318
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -434
- package/dist/index.js.map +1 -1
- package/dist/memory-adapter.d.ts +153 -0
- package/dist/memory-adapter.d.ts.map +1 -0
- package/dist/memory-adapter.js +462 -0
- package/dist/memory-adapter.js.map +1 -0
- package/dist/types.d.ts +167 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +25 -26
- package/src/client/defineVoltAgentAPI.ts +365 -0
- package/src/client/index.ts +8 -0
- package/src/client/types.ts +14 -0
- package/src/component/_generated/api.ts +60 -0
- package/src/component/_generated/component.ts +466 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +156 -0
- package/src/index.ts +24 -0
- package/{dist/index.cjs → src/memory-adapter.ts} +345 -106
- package/src/types.ts +178 -0
- package/dist/client/index.cjs +0 -288
- package/dist/client/index.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -322
- /package/{convex → src/component}/conversations.ts +0 -0
- /package/{convex → src/component}/convex.config.ts +0 -0
- /package/{convex → src/component}/messages.ts +0 -0
- /package/{convex → src/component}/schema.ts +0 -0
- /package/{convex → src/component}/steps.ts +0 -0
- /package/{convex → src/component}/validators.ts +0 -0
- /package/{convex → src/component}/workflows.ts +0 -0
- /package/{convex → src/component}/workingMemory.ts +0 -0
package/package.json
CHANGED
|
@@ -1,46 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o-zakstam/voltagent-convex",
|
|
3
3
|
"description": "VoltAgent Convex - Convex storage adapter component for VoltAgent",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.3",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
"module": "dist/index.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
6
|
+
"types": "./dist/client/index.d.ts",
|
|
7
|
+
"module": "./dist/client/index.js",
|
|
9
8
|
"exports": {
|
|
9
|
+
"./package.json": "./package.json",
|
|
10
10
|
".": {
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"default": "./dist/index.js"
|
|
14
|
-
},
|
|
15
|
-
"require": {
|
|
16
|
-
"types": "./dist/index.d.cts",
|
|
17
|
-
"default": "./dist/index.cjs"
|
|
18
|
-
}
|
|
11
|
+
"types": "./dist/client/index.d.ts",
|
|
12
|
+
"default": "./dist/client/index.js"
|
|
19
13
|
},
|
|
20
14
|
"./api": {
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
"default": "./dist/client/index.js"
|
|
24
|
-
},
|
|
25
|
-
"require": {
|
|
26
|
-
"types": "./dist/client/index.d.cts",
|
|
27
|
-
"default": "./dist/client/index.cjs"
|
|
28
|
-
}
|
|
15
|
+
"types": "./dist/client/index.d.ts",
|
|
16
|
+
"default": "./dist/client/index.js"
|
|
29
17
|
},
|
|
30
|
-
"./
|
|
18
|
+
"./_generated/component.js": {
|
|
19
|
+
"types": "./dist/component/_generated/component.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./convex.config": {
|
|
22
|
+
"types": "./dist/component/convex.config.d.ts",
|
|
23
|
+
"default": "./dist/component/convex.config.js"
|
|
24
|
+
},
|
|
25
|
+
"./convex.config.js": {
|
|
26
|
+
"types": "./dist/component/convex.config.d.ts",
|
|
27
|
+
"default": "./dist/component/convex.config.js"
|
|
28
|
+
}
|
|
31
29
|
},
|
|
32
30
|
"files": [
|
|
33
31
|
"dist",
|
|
34
|
-
"
|
|
32
|
+
"src"
|
|
35
33
|
],
|
|
36
34
|
"scripts": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
35
|
+
"clean": "rm -rf dist *.tsbuildinfo",
|
|
36
|
+
"build": "tsc --project ./tsconfig.build.json",
|
|
37
|
+
"dev:build": "chokidar 'tsconfig*.json' 'src/**/*.ts' -i '**/*.test.ts' -c 'convex codegen --component-dir ./src/component && npm run build' --initial",
|
|
39
38
|
"lint": "biome check .",
|
|
40
39
|
"lint:fix": "biome check . --write",
|
|
41
40
|
"test": "vitest --reporter=hanging-process --reporter=default --typecheck",
|
|
42
41
|
"test:coverage": "vitest run --coverage --typecheck",
|
|
43
|
-
"
|
|
42
|
+
"prepare": "npm run build",
|
|
44
43
|
"release": "semantic-release"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
@@ -51,9 +50,9 @@
|
|
|
51
50
|
"@voltagent/core": "^2.0.2",
|
|
52
51
|
"@voltagent/logger": "^2.0.2",
|
|
53
52
|
"ai": "^6.0.0",
|
|
53
|
+
"chokidar-cli": "^3.0.0",
|
|
54
54
|
"convex": "^1.21.0",
|
|
55
55
|
"semantic-release": "^25.0.2",
|
|
56
|
-
"tsup": "^8.3.5",
|
|
57
56
|
"typescript": "^5.7.2",
|
|
58
57
|
"vitest": "^3.2.4"
|
|
59
58
|
},
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VoltAgent API Generator
|
|
3
|
+
*
|
|
4
|
+
* This function generates public Convex query/mutation functions that wrap
|
|
5
|
+
* the VoltAgent component's internal functions. This allows external HTTP
|
|
6
|
+
* clients to call the functions via ConvexHttpClient.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // convex/voltagent.ts
|
|
11
|
+
* import { components } from "./_generated/api";
|
|
12
|
+
* import { defineVoltAgentAPI } from "@voltagent/convex/api";
|
|
13
|
+
*
|
|
14
|
+
* export const {
|
|
15
|
+
* createConversation,
|
|
16
|
+
* getConversation,
|
|
17
|
+
* // ... other functions
|
|
18
|
+
* } = defineVoltAgentAPI(components.voltagent);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
import {
|
|
22
|
+
queryGeneric,
|
|
23
|
+
mutationGeneric,
|
|
24
|
+
type ApiFromModules,
|
|
25
|
+
} from "convex/server";
|
|
26
|
+
import { v } from "convex/values";
|
|
27
|
+
import type { VoltAgentComponent } from "./types.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Define the VoltAgent API functions.
|
|
31
|
+
*
|
|
32
|
+
* @param component - The VoltAgent component reference (components.voltagent)
|
|
33
|
+
* @returns An object containing all VoltAgent API functions
|
|
34
|
+
*/
|
|
35
|
+
export function defineVoltAgentAPI(component: VoltAgentComponent) {
|
|
36
|
+
// ============================================================================
|
|
37
|
+
// Conversation Functions
|
|
38
|
+
// ============================================================================
|
|
39
|
+
|
|
40
|
+
const createConversation = mutationGeneric({
|
|
41
|
+
args: {
|
|
42
|
+
id: v.string(),
|
|
43
|
+
resourceId: v.string(),
|
|
44
|
+
userId: v.string(),
|
|
45
|
+
title: v.string(),
|
|
46
|
+
metadata: v.any(),
|
|
47
|
+
},
|
|
48
|
+
handler: async (ctx, args) => {
|
|
49
|
+
return ctx.runMutation(component.conversations.create, args);
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const getConversation = queryGeneric({
|
|
54
|
+
args: { id: v.string() },
|
|
55
|
+
handler: async (ctx, args) => {
|
|
56
|
+
return ctx.runQuery(component.conversations.get, args);
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const getConversations = queryGeneric({
|
|
61
|
+
args: { resourceId: v.string() },
|
|
62
|
+
handler: async (ctx, args) => {
|
|
63
|
+
return ctx.runQuery(component.conversations.getByResourceId, args);
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const getConversationsByUserId = queryGeneric({
|
|
68
|
+
args: {
|
|
69
|
+
userId: v.string(),
|
|
70
|
+
limit: v.optional(v.number()),
|
|
71
|
+
offset: v.optional(v.number()),
|
|
72
|
+
orderBy: v.optional(v.string()),
|
|
73
|
+
orderDirection: v.optional(v.string()),
|
|
74
|
+
},
|
|
75
|
+
handler: async (ctx, args) => {
|
|
76
|
+
return ctx.runQuery(component.conversations.getByUserId, args);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const queryConversations = queryGeneric({
|
|
81
|
+
args: {
|
|
82
|
+
userId: v.optional(v.string()),
|
|
83
|
+
resourceId: v.optional(v.string()),
|
|
84
|
+
limit: v.optional(v.number()),
|
|
85
|
+
offset: v.optional(v.number()),
|
|
86
|
+
orderBy: v.optional(v.string()),
|
|
87
|
+
orderDirection: v.optional(v.string()),
|
|
88
|
+
},
|
|
89
|
+
handler: async (ctx, args) => {
|
|
90
|
+
return ctx.runQuery(component.conversations.queryConversations, args);
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const updateConversation = mutationGeneric({
|
|
95
|
+
args: {
|
|
96
|
+
id: v.string(),
|
|
97
|
+
title: v.optional(v.string()),
|
|
98
|
+
resourceId: v.optional(v.string()),
|
|
99
|
+
metadata: v.optional(v.any()),
|
|
100
|
+
},
|
|
101
|
+
handler: async (ctx, args) => {
|
|
102
|
+
return ctx.runMutation(component.conversations.update, args);
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const deleteConversation = mutationGeneric({
|
|
107
|
+
args: { id: v.string() },
|
|
108
|
+
handler: async (ctx, args) => {
|
|
109
|
+
return ctx.runMutation(component.conversations.remove, args);
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// ============================================================================
|
|
114
|
+
// Message Functions
|
|
115
|
+
// ============================================================================
|
|
116
|
+
|
|
117
|
+
const addMessage = mutationGeneric({
|
|
118
|
+
args: {
|
|
119
|
+
id: v.string(),
|
|
120
|
+
conversationId: v.string(),
|
|
121
|
+
userId: v.string(),
|
|
122
|
+
role: v.string(),
|
|
123
|
+
parts: v.any(),
|
|
124
|
+
metadata: v.optional(v.any()),
|
|
125
|
+
},
|
|
126
|
+
handler: async (ctx, args) => {
|
|
127
|
+
return ctx.runMutation(component.messages.add, args);
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const addMessages = mutationGeneric({
|
|
132
|
+
args: {
|
|
133
|
+
messages: v.array(
|
|
134
|
+
v.object({
|
|
135
|
+
id: v.string(),
|
|
136
|
+
conversationId: v.string(),
|
|
137
|
+
userId: v.string(),
|
|
138
|
+
role: v.string(),
|
|
139
|
+
parts: v.any(),
|
|
140
|
+
metadata: v.optional(v.any()),
|
|
141
|
+
}),
|
|
142
|
+
),
|
|
143
|
+
},
|
|
144
|
+
handler: async (ctx, args) => {
|
|
145
|
+
return ctx.runMutation(component.messages.addMany, args);
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const getMessages = queryGeneric({
|
|
150
|
+
args: {
|
|
151
|
+
userId: v.string(),
|
|
152
|
+
conversationId: v.string(),
|
|
153
|
+
limit: v.optional(v.number()),
|
|
154
|
+
before: v.optional(v.string()),
|
|
155
|
+
after: v.optional(v.string()),
|
|
156
|
+
roles: v.optional(v.array(v.string())),
|
|
157
|
+
},
|
|
158
|
+
handler: async (ctx, args) => {
|
|
159
|
+
return ctx.runQuery(component.messages.get, args);
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const clearMessages = mutationGeneric({
|
|
164
|
+
args: {
|
|
165
|
+
userId: v.string(),
|
|
166
|
+
conversationId: v.optional(v.string()),
|
|
167
|
+
},
|
|
168
|
+
handler: async (ctx, args) => {
|
|
169
|
+
return ctx.runMutation(component.messages.clear, args);
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// ============================================================================
|
|
174
|
+
// Conversation Steps Functions
|
|
175
|
+
// ============================================================================
|
|
176
|
+
|
|
177
|
+
const saveConversationSteps = mutationGeneric({
|
|
178
|
+
args: {
|
|
179
|
+
steps: v.array(
|
|
180
|
+
v.object({
|
|
181
|
+
id: v.string(),
|
|
182
|
+
conversationId: v.string(),
|
|
183
|
+
userId: v.string(),
|
|
184
|
+
agentId: v.string(),
|
|
185
|
+
agentName: v.optional(v.string()),
|
|
186
|
+
operationId: v.optional(v.string()),
|
|
187
|
+
stepIndex: v.number(),
|
|
188
|
+
type: v.string(),
|
|
189
|
+
role: v.string(),
|
|
190
|
+
content: v.optional(v.string()),
|
|
191
|
+
arguments: v.optional(v.any()),
|
|
192
|
+
result: v.optional(v.any()),
|
|
193
|
+
usage: v.optional(v.any()),
|
|
194
|
+
subAgentId: v.optional(v.string()),
|
|
195
|
+
subAgentName: v.optional(v.string()),
|
|
196
|
+
createdAt: v.optional(v.string()),
|
|
197
|
+
}),
|
|
198
|
+
),
|
|
199
|
+
},
|
|
200
|
+
handler: async (ctx, args) => {
|
|
201
|
+
return ctx.runMutation(component.steps.save, args);
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const getConversationSteps = queryGeneric({
|
|
206
|
+
args: {
|
|
207
|
+
userId: v.string(),
|
|
208
|
+
conversationId: v.string(),
|
|
209
|
+
limit: v.optional(v.number()),
|
|
210
|
+
operationId: v.optional(v.string()),
|
|
211
|
+
},
|
|
212
|
+
handler: async (ctx, args) => {
|
|
213
|
+
return ctx.runQuery(component.steps.get, args);
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// ============================================================================
|
|
218
|
+
// Working Memory Functions
|
|
219
|
+
// ============================================================================
|
|
220
|
+
|
|
221
|
+
const getWorkingMemory = queryGeneric({
|
|
222
|
+
args: {
|
|
223
|
+
conversationId: v.optional(v.string()),
|
|
224
|
+
userId: v.optional(v.string()),
|
|
225
|
+
scope: v.string(),
|
|
226
|
+
},
|
|
227
|
+
handler: async (ctx, args) => {
|
|
228
|
+
return ctx.runQuery(component.workingMemory.get, args);
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
const setWorkingMemory = mutationGeneric({
|
|
233
|
+
args: {
|
|
234
|
+
conversationId: v.optional(v.string()),
|
|
235
|
+
userId: v.optional(v.string()),
|
|
236
|
+
content: v.string(),
|
|
237
|
+
scope: v.string(),
|
|
238
|
+
},
|
|
239
|
+
handler: async (ctx, args) => {
|
|
240
|
+
return ctx.runMutation(component.workingMemory.set, args);
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
const deleteWorkingMemory = mutationGeneric({
|
|
245
|
+
args: {
|
|
246
|
+
conversationId: v.optional(v.string()),
|
|
247
|
+
userId: v.optional(v.string()),
|
|
248
|
+
scope: v.string(),
|
|
249
|
+
},
|
|
250
|
+
handler: async (ctx, args) => {
|
|
251
|
+
return ctx.runMutation(component.workingMemory.remove, args);
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// ============================================================================
|
|
256
|
+
// Workflow State Functions
|
|
257
|
+
// ============================================================================
|
|
258
|
+
|
|
259
|
+
const getWorkflowState = queryGeneric({
|
|
260
|
+
args: { executionId: v.string() },
|
|
261
|
+
handler: async (ctx, args) => {
|
|
262
|
+
return ctx.runQuery(component.workflows.get, args);
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
const queryWorkflowRuns = queryGeneric({
|
|
267
|
+
args: {
|
|
268
|
+
workflowId: v.optional(v.string()),
|
|
269
|
+
status: v.optional(v.string()),
|
|
270
|
+
from: v.optional(v.string()),
|
|
271
|
+
to: v.optional(v.string()),
|
|
272
|
+
limit: v.optional(v.number()),
|
|
273
|
+
offset: v.optional(v.number()),
|
|
274
|
+
},
|
|
275
|
+
handler: async (ctx, args) => {
|
|
276
|
+
return ctx.runQuery(component.workflows.queryRuns, args);
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
const setWorkflowState = mutationGeneric({
|
|
281
|
+
args: {
|
|
282
|
+
executionId: v.string(),
|
|
283
|
+
workflowId: v.string(),
|
|
284
|
+
workflowName: v.string(),
|
|
285
|
+
status: v.string(),
|
|
286
|
+
input: v.optional(v.any()),
|
|
287
|
+
context: v.optional(v.any()),
|
|
288
|
+
suspension: v.optional(v.any()),
|
|
289
|
+
events: v.optional(v.any()),
|
|
290
|
+
output: v.optional(v.any()),
|
|
291
|
+
cancellation: v.optional(v.any()),
|
|
292
|
+
userId: v.optional(v.string()),
|
|
293
|
+
conversationId: v.optional(v.string()),
|
|
294
|
+
metadata: v.optional(v.any()),
|
|
295
|
+
createdAt: v.string(),
|
|
296
|
+
updatedAt: v.string(),
|
|
297
|
+
},
|
|
298
|
+
handler: async (ctx, args) => {
|
|
299
|
+
return ctx.runMutation(component.workflows.set, args);
|
|
300
|
+
},
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
const updateWorkflowState = mutationGeneric({
|
|
304
|
+
args: {
|
|
305
|
+
executionId: v.string(),
|
|
306
|
+
status: v.optional(v.string()),
|
|
307
|
+
suspension: v.optional(v.any()),
|
|
308
|
+
events: v.optional(v.any()),
|
|
309
|
+
output: v.optional(v.any()),
|
|
310
|
+
cancellation: v.optional(v.any()),
|
|
311
|
+
metadata: v.optional(v.any()),
|
|
312
|
+
},
|
|
313
|
+
handler: async (ctx, args) => {
|
|
314
|
+
return ctx.runMutation(component.workflows.update, args);
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
const getSuspendedWorkflowStates = queryGeneric({
|
|
319
|
+
args: { workflowId: v.string() },
|
|
320
|
+
handler: async (ctx, args) => {
|
|
321
|
+
return ctx.runQuery(component.workflows.getSuspended, args);
|
|
322
|
+
},
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
return {
|
|
326
|
+
// Conversations
|
|
327
|
+
createConversation,
|
|
328
|
+
getConversation,
|
|
329
|
+
getConversations,
|
|
330
|
+
getConversationsByUserId,
|
|
331
|
+
queryConversations,
|
|
332
|
+
updateConversation,
|
|
333
|
+
deleteConversation,
|
|
334
|
+
// Messages
|
|
335
|
+
addMessage,
|
|
336
|
+
addMessages,
|
|
337
|
+
getMessages,
|
|
338
|
+
clearMessages,
|
|
339
|
+
// Conversation Steps
|
|
340
|
+
saveConversationSteps,
|
|
341
|
+
getConversationSteps,
|
|
342
|
+
// Working Memory
|
|
343
|
+
getWorkingMemory,
|
|
344
|
+
setWorkingMemory,
|
|
345
|
+
deleteWorkingMemory,
|
|
346
|
+
// Workflow State
|
|
347
|
+
getWorkflowState,
|
|
348
|
+
queryWorkflowRuns,
|
|
349
|
+
setWorkflowState,
|
|
350
|
+
updateWorkflowState,
|
|
351
|
+
getSuspendedWorkflowStates,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Type for the VoltAgent API when used with ApiFromModules.
|
|
357
|
+
*
|
|
358
|
+
* Usage:
|
|
359
|
+
* ```typescript
|
|
360
|
+
* import type { VoltAgentAPI } from "@voltagent/convex/api";
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
export type VoltAgentAPI = ApiFromModules<{
|
|
364
|
+
voltagent: ReturnType<typeof defineVoltAgentAPI>;
|
|
365
|
+
}>["voltagent"];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VoltAgent Convex Client API
|
|
3
|
+
*
|
|
4
|
+
* This module exports the defineVoltAgentAPI function and related types
|
|
5
|
+
* for creating public wrapper functions around the VoltAgent component.
|
|
6
|
+
*/
|
|
7
|
+
export { defineVoltAgentAPI, type VoltAgentAPI } from "./defineVoltAgentAPI.js";
|
|
8
|
+
export { type VoltAgentComponent } from "./types.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VoltAgent Convex Component API Types
|
|
3
|
+
*
|
|
4
|
+
* These types define the structure of the VoltAgent component's API,
|
|
5
|
+
* allowing type-safe access to component functions.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ComponentApi } from "../component/_generated/component.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The VoltAgent Component API type.
|
|
12
|
+
* This matches the structure of `components.voltagent` after installing the component.
|
|
13
|
+
*/
|
|
14
|
+
export type VoltAgentComponent = ComponentApi;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Generated `api` utility.
|
|
4
|
+
*
|
|
5
|
+
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
+
*
|
|
7
|
+
* To regenerate, run `npx convex dev`.
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type * as conversations from "../conversations.js";
|
|
12
|
+
import type * as messages from "../messages.js";
|
|
13
|
+
import type * as steps from "../steps.js";
|
|
14
|
+
import type * as validators from "../validators.js";
|
|
15
|
+
import type * as workflows from "../workflows.js";
|
|
16
|
+
import type * as workingMemory from "../workingMemory.js";
|
|
17
|
+
|
|
18
|
+
import type {
|
|
19
|
+
ApiFromModules,
|
|
20
|
+
FilterApi,
|
|
21
|
+
FunctionReference,
|
|
22
|
+
} from "convex/server";
|
|
23
|
+
import { anyApi, componentsGeneric } from "convex/server";
|
|
24
|
+
|
|
25
|
+
const fullApi: ApiFromModules<{
|
|
26
|
+
conversations: typeof conversations;
|
|
27
|
+
messages: typeof messages;
|
|
28
|
+
steps: typeof steps;
|
|
29
|
+
validators: typeof validators;
|
|
30
|
+
workflows: typeof workflows;
|
|
31
|
+
workingMemory: typeof workingMemory;
|
|
32
|
+
}> = anyApi as any;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A utility for referencing Convex functions in your app's public API.
|
|
36
|
+
*
|
|
37
|
+
* Usage:
|
|
38
|
+
* ```js
|
|
39
|
+
* const myFunctionReference = api.myModule.myFunction;
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export const api: FilterApi<
|
|
43
|
+
typeof fullApi,
|
|
44
|
+
FunctionReference<any, "public">
|
|
45
|
+
> = anyApi as any;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A utility for referencing Convex functions in your app's internal API.
|
|
49
|
+
*
|
|
50
|
+
* Usage:
|
|
51
|
+
* ```js
|
|
52
|
+
* const myFunctionReference = internal.myModule.myFunction;
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export const internal: FilterApi<
|
|
56
|
+
typeof fullApi,
|
|
57
|
+
FunctionReference<any, "internal">
|
|
58
|
+
> = anyApi as any;
|
|
59
|
+
|
|
60
|
+
export const components = componentsGeneric() as unknown as {};
|