@lakitu/sdk 0.1.0 → 0.1.2
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/LICENSE +21 -0
- package/README.md +295 -97
- package/convex/cloud/workflows/sandboxConvex.ts +4 -2
- package/package.json +2 -2
- package/convex/_generated/api.d.ts +0 -45
- package/convex/_generated/api.js +0 -23
- package/convex/_generated/dataModel.d.ts +0 -58
- package/convex/_generated/server.d.ts +0 -143
- package/convex/_generated/server.js +0 -93
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lakitu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,14 +2,75 @@
|
|
|
2
2
|
<img src="assets/laki2-banner.jpeg" alt="Lakitu Banner" width="100%">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# @lakitu/sdk
|
|
6
6
|
|
|
7
|
-
> AI agent
|
|
7
|
+
> Self-hosted AI agent framework for [Convex](https://convex.dev) + [E2B](https://e2b.dev) with **code execution**.
|
|
8
8
|
|
|
9
|
-
Lakitu
|
|
9
|
+
Lakitu runs AI agents in secure E2B sandboxes where they write and execute TypeScript code. Instead of JSON tool calls, agents import from **KSAs** (Knowledge, Skills, and Abilities) — plain TypeScript modules.
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# In your Convex project
|
|
15
|
+
npx @lakitu/sdk init
|
|
16
|
+
|
|
17
|
+
# Build your E2B sandbox template
|
|
18
|
+
npx @lakitu/sdk build
|
|
19
|
+
|
|
20
|
+
# Publish template to E2B
|
|
21
|
+
npx @lakitu/sdk publish
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @lakitu/sdk
|
|
28
|
+
# or
|
|
29
|
+
bun add @lakitu/sdk
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## CLI Commands
|
|
33
|
+
|
|
34
|
+
### `npx @lakitu/sdk init`
|
|
35
|
+
|
|
36
|
+
Initialize Lakitu in your Convex project:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx @lakitu/sdk init
|
|
40
|
+
npx @lakitu/sdk init --dir ./convex # Custom convex directory
|
|
41
|
+
npx @lakitu/sdk init --skip-install # Skip npm install
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This creates:
|
|
45
|
+
```
|
|
46
|
+
convex/
|
|
47
|
+
└── lakitu/
|
|
48
|
+
├── config.ts # Lakitu configuration
|
|
49
|
+
└── example.ts # Example KSA to get started
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### `npx @lakitu/sdk build`
|
|
53
|
+
|
|
54
|
+
Build your E2B sandbox template with pre-deployed Convex functions:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx @lakitu/sdk build # Build both base + custom templates
|
|
58
|
+
npx @lakitu/sdk build --base # Build base template only
|
|
59
|
+
npx @lakitu/sdk build --custom # Build custom template only
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### `npx @lakitu/sdk publish`
|
|
63
|
+
|
|
64
|
+
Manage your E2B templates:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx @lakitu/sdk publish
|
|
68
|
+
```
|
|
10
69
|
|
|
11
70
|
## The Code Execution Model
|
|
12
71
|
|
|
72
|
+
Traditional agents use JSON tool calls. Lakitu agents write code:
|
|
73
|
+
|
|
13
74
|
```
|
|
14
75
|
Traditional Agent: Lakitu Agent:
|
|
15
76
|
┌─────────────────┐ ┌─────────────────┐
|
|
@@ -28,52 +89,176 @@ Traditional Agent: Lakitu Agent:
|
|
|
28
89
|
└─────────┘ └───────────────┘
|
|
29
90
|
```
|
|
30
91
|
|
|
31
|
-
**Why
|
|
92
|
+
**Why code execution?**
|
|
93
|
+
- **Token efficient** — No tool schemas sent every request
|
|
94
|
+
- **Composable** — Chain operations naturally in code
|
|
95
|
+
- **Debuggable** — See exactly what code ran
|
|
96
|
+
- **Model agnostic** — Any LLM that generates code works
|
|
32
97
|
|
|
33
|
-
|
|
98
|
+
---
|
|
34
99
|
|
|
35
|
-
|
|
36
|
-
- **Knowledge**: JSDoc documentation
|
|
37
|
-
- **Skills**: Executable functions
|
|
38
|
-
- **Abilities**: What the agent can accomplish
|
|
100
|
+
## KSA SDK
|
|
39
101
|
|
|
40
|
-
|
|
102
|
+
KSAs (Knowledge, Skills, and Abilities) are capability modules that agents use via code execution. The SDK provides a type-safe builder API for defining KSAs.
|
|
41
103
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
104
|
+
### Defining a KSA
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { defineKSA, fn, service, primitive } from "@lakitu/sdk";
|
|
108
|
+
|
|
109
|
+
export const myKSA = defineKSA("myKsa")
|
|
110
|
+
.description("Description of what this KSA does")
|
|
111
|
+
.category("skills") // "core" | "skills" | "deliverables"
|
|
112
|
+
.group("research") // Optional subcategory
|
|
113
|
+
.icon("mdi-search") // Optional MDI icon
|
|
114
|
+
|
|
115
|
+
// Add functions
|
|
116
|
+
.fn("search", fn()
|
|
117
|
+
.description("Search for something")
|
|
118
|
+
.param("query", { type: "string", required: true })
|
|
119
|
+
.param("limit", { type: "number", default: 10 })
|
|
120
|
+
.returns<SearchResult[]>()
|
|
121
|
+
.impl(service("services.Search.internal.query")
|
|
122
|
+
.mapArgs(({ query, limit }) => ({ q: query, max: limit }))
|
|
123
|
+
.mapResult(r => r.results)
|
|
124
|
+
)
|
|
125
|
+
)
|
|
53
126
|
|
|
54
|
-
|
|
127
|
+
.fn("readFile", fn()
|
|
128
|
+
.description("Read a local file")
|
|
129
|
+
.param("path", { type: "string", required: true })
|
|
130
|
+
.impl(primitive("file.read"))
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
.build();
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### SDK Exports
|
|
55
137
|
|
|
56
138
|
```typescript
|
|
57
|
-
import {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
139
|
+
import {
|
|
140
|
+
// Builders
|
|
141
|
+
defineKSA, // Create a KSA definition
|
|
142
|
+
fn, // Create a function definition
|
|
143
|
+
service, // Service implementation (calls cloud Convex)
|
|
144
|
+
primitive, // Primitive implementation (local sandbox ops)
|
|
145
|
+
composite, // Composite implementation (chain operations)
|
|
146
|
+
|
|
147
|
+
// Registry utilities
|
|
148
|
+
createRegistry,
|
|
149
|
+
getFunction,
|
|
150
|
+
|
|
151
|
+
// Types
|
|
152
|
+
type KSADef,
|
|
153
|
+
type FunctionDef,
|
|
154
|
+
type ParamDef,
|
|
155
|
+
type Implementation,
|
|
156
|
+
} from "@lakitu/sdk";
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Implementation Types
|
|
160
|
+
|
|
161
|
+
#### Service Implementation
|
|
162
|
+
Calls a Convex function via the cloud gateway:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
.impl(service("services.MyService.internal.action")
|
|
166
|
+
.mapArgs(({ input }) => ({ data: input })) // Transform args
|
|
167
|
+
.mapResult(r => r.value) // Transform result
|
|
168
|
+
)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
#### Primitive Implementation
|
|
172
|
+
Uses local sandbox capabilities (file, shell, browser):
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
.impl(primitive("file.read"))
|
|
176
|
+
.impl(primitive("shell.exec"))
|
|
177
|
+
.impl(primitive("browser.screenshot"))
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Available primitives:
|
|
181
|
+
- `file.read`, `file.write`, `file.edit`, `file.glob`, `file.grep`, `file.ls`, `file.exists`, `file.stat`
|
|
182
|
+
- `shell.exec`
|
|
183
|
+
- `browser.open`, `browser.screenshot`, `browser.click`, `browser.type`, `browser.getHtml`, `browser.getText`, `browser.close`
|
|
184
|
+
|
|
185
|
+
#### Composite Implementation
|
|
186
|
+
Chain multiple operations:
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
.impl(composite()
|
|
190
|
+
.call("file.read", { filePath: "./config.json" }, "config")
|
|
191
|
+
.call("myKsa.process", ctx => ({ data: ctx.vars.config }), "result")
|
|
192
|
+
.return(ctx => ctx.vars.result)
|
|
193
|
+
)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Parameter Types
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
.param("name", { type: "string", required: true })
|
|
200
|
+
.param("count", { type: "number", default: 10 })
|
|
201
|
+
.param("enabled", { type: "boolean", default: false })
|
|
202
|
+
.param("tags", { type: "array" })
|
|
203
|
+
.param("options", { type: "object" })
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Configuration
|
|
209
|
+
|
|
210
|
+
After running `init`, configure Lakitu in `convex/lakitu/config.ts`:
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
import { Lakitu } from "@lakitu/sdk";
|
|
214
|
+
|
|
215
|
+
export default Lakitu.configure({
|
|
216
|
+
// E2B template name (build with: npx lakitu build)
|
|
217
|
+
template: "lakitu",
|
|
218
|
+
|
|
219
|
+
// Default model for agent
|
|
220
|
+
model: "anthropic/claude-sonnet-4-20250514",
|
|
221
|
+
|
|
222
|
+
// KSA modules to enable
|
|
223
|
+
ksas: [
|
|
224
|
+
// Built-in KSAs
|
|
225
|
+
"file",
|
|
226
|
+
"shell",
|
|
227
|
+
"browser",
|
|
228
|
+
"beads",
|
|
229
|
+
|
|
230
|
+
// Custom KSAs
|
|
231
|
+
"./myCustomKsa",
|
|
232
|
+
],
|
|
233
|
+
|
|
234
|
+
// Sandbox pool settings
|
|
235
|
+
pool: {
|
|
236
|
+
min: 0,
|
|
237
|
+
max: 5,
|
|
238
|
+
idleTimeout: 300_000,
|
|
239
|
+
},
|
|
74
240
|
});
|
|
75
241
|
```
|
|
76
242
|
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Built-in KSAs
|
|
246
|
+
|
|
247
|
+
| Category | KSA | Functions |
|
|
248
|
+
|----------|-----|-----------|
|
|
249
|
+
| **Core** | `file` | `read`, `write`, `edit`, `glob`, `grep`, `ls` |
|
|
250
|
+
| | `shell` | `exec` |
|
|
251
|
+
| | `browser` | `open`, `screenshot`, `click`, `type`, `getText` |
|
|
252
|
+
| | `beads` | `create`, `update`, `close`, `list`, `getReady` |
|
|
253
|
+
| **Skills** | `web` | `search`, `scrape` |
|
|
254
|
+
| | `news` | `trending`, `search`, `analyze` |
|
|
255
|
+
| | `social` | `tiktok`, `instagram`, `twitter`, `search` |
|
|
256
|
+
| | `companies` | `enrich`, `search`, `techStack` |
|
|
257
|
+
| **Deliverables** | `pdf` | `generate` |
|
|
258
|
+
| | `email` | `send`, `sendBulk` |
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
77
262
|
## Architecture
|
|
78
263
|
|
|
79
264
|
```
|
|
@@ -92,7 +277,7 @@ await send({
|
|
|
92
277
|
│ ▼ │
|
|
93
278
|
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
|
94
279
|
│ │ CLOUD GATEWAY │ │
|
|
95
|
-
│ │ HTTP → Convex Services (OpenRouter,
|
|
280
|
+
│ │ HTTP → Convex Services (OpenRouter, external APIs) │ │
|
|
96
281
|
│ └─────────────────────────────────────────────────────────────────┘ │
|
|
97
282
|
│ │
|
|
98
283
|
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
|
@@ -102,65 +287,78 @@ await send({
|
|
|
102
287
|
└─────────────────────────────────────────────────────────────────────────┘
|
|
103
288
|
```
|
|
104
289
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Example: Custom KSA
|
|
293
|
+
|
|
294
|
+
Create `convex/lakitu/weather.ts`:
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
import { defineKSA, fn, service } from "@lakitu/sdk";
|
|
298
|
+
|
|
299
|
+
export const weatherKSA = defineKSA("weather")
|
|
300
|
+
.description("Weather data and forecasts")
|
|
301
|
+
.category("skills")
|
|
302
|
+
.group("data")
|
|
303
|
+
|
|
304
|
+
.fn("current", fn()
|
|
305
|
+
.description("Get current weather for a location")
|
|
306
|
+
.param("location", { type: "string", required: true, description: "City name or coordinates" })
|
|
307
|
+
.impl(service("services.Weather.internal.getCurrent"))
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
.fn("forecast", fn()
|
|
311
|
+
.description("Get weather forecast")
|
|
312
|
+
.param("location", { type: "string", required: true })
|
|
313
|
+
.param("days", { type: "number", default: 7 })
|
|
314
|
+
.impl(service("services.Weather.internal.getForecast"))
|
|
315
|
+
)
|
|
316
|
+
|
|
317
|
+
.build();
|
|
318
|
+
|
|
319
|
+
export default weatherKSA;
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
The agent can then use it:
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
import { current, forecast } from './ksa/weather';
|
|
326
|
+
|
|
327
|
+
const weather = await current("San Francisco");
|
|
328
|
+
console.log(`Current: ${weather.temp}°F, ${weather.condition}`);
|
|
329
|
+
|
|
330
|
+
const nextWeek = await forecast("San Francisco", 7);
|
|
331
|
+
for (const day of nextWeek) {
|
|
332
|
+
console.log(`${day.date}: ${day.high}°F / ${day.low}°F`);
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Environment Variables
|
|
339
|
+
|
|
340
|
+
For `build` command:
|
|
341
|
+
- `E2B_API_KEY` — Your E2B API key (or run `e2b auth login`)
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Requirements
|
|
346
|
+
|
|
347
|
+
- [Convex](https://convex.dev) project
|
|
348
|
+
- [E2B](https://e2b.dev) account (for sandbox hosting)
|
|
349
|
+
- Node.js 18+ or Bun
|
|
350
|
+
|
|
351
|
+
---
|
|
162
352
|
|
|
163
353
|
## Links
|
|
164
354
|
|
|
355
|
+
- [npm package](https://www.npmjs.com/package/@lakitu/sdk)
|
|
356
|
+
- [GitHub](https://github.com/shinyobjectz/lakitu)
|
|
165
357
|
- [E2B Documentation](https://e2b.dev/docs)
|
|
166
358
|
- [Convex Documentation](https://docs.convex.dev)
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## License
|
|
363
|
+
|
|
364
|
+
MIT
|
|
@@ -626,7 +626,9 @@ export const runConvexSandbox = internalAction({
|
|
|
626
626
|
maxTokens: configObj.maxTokens,
|
|
627
627
|
temperature: configObj.temperature,
|
|
628
628
|
gatewayConfig: {
|
|
629
|
-
|
|
629
|
+
// IMPORTANT: Use GATEWAY_URL (.convex.site) not CLOUD_CONVEX_URL (.convex.cloud)
|
|
630
|
+
// HTTP actions are served from .convex.site, not .convex.cloud
|
|
631
|
+
convexUrl: GATEWAY_URL,
|
|
630
632
|
jwt: sandboxJwt,
|
|
631
633
|
},
|
|
632
634
|
};
|
|
@@ -652,7 +654,7 @@ export const runConvexSandbox = internalAction({
|
|
|
652
654
|
}
|
|
653
655
|
|
|
654
656
|
console.log(
|
|
655
|
-
`[sandboxConvex] Calling agent with gatewayConfig.convexUrl=${
|
|
657
|
+
`[sandboxConvex] Calling agent with gatewayConfig.convexUrl=${GATEWAY_URL}, jwt length=${sandboxJwt.length}`,
|
|
656
658
|
);
|
|
657
659
|
|
|
658
660
|
// Call the sandbox Convex to start the agent using Convex client
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lakitu/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Self-hosted AI agent framework for Convex + E2B with code execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/sdk/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
],
|
|
60
60
|
"repository": {
|
|
61
61
|
"type": "git",
|
|
62
|
-
"url": "https://github.com/
|
|
62
|
+
"url": "https://github.com/shinyobjectz/lakitu"
|
|
63
63
|
},
|
|
64
64
|
"license": "MIT",
|
|
65
65
|
"dependencies": {
|
|
@@ -1,45 +0,0 @@
|
|
|
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 {
|
|
12
|
-
ApiFromModules,
|
|
13
|
-
FilterApi,
|
|
14
|
-
FunctionReference,
|
|
15
|
-
} from "convex/server";
|
|
16
|
-
|
|
17
|
-
declare const fullApi: ApiFromModules<{}>;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* A utility for referencing Convex functions in your app's public API.
|
|
21
|
-
*
|
|
22
|
-
* Usage:
|
|
23
|
-
* ```js
|
|
24
|
-
* const myFunctionReference = api.myModule.myFunction;
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare const api: FilterApi<
|
|
28
|
-
typeof fullApi,
|
|
29
|
-
FunctionReference<any, "public">
|
|
30
|
-
>;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* A utility for referencing Convex functions in your app's internal API.
|
|
34
|
-
*
|
|
35
|
-
* Usage:
|
|
36
|
-
* ```js
|
|
37
|
-
* const myFunctionReference = internal.myModule.myFunction;
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export declare const internal: FilterApi<
|
|
41
|
-
typeof fullApi,
|
|
42
|
-
FunctionReference<any, "internal">
|
|
43
|
-
>;
|
|
44
|
-
|
|
45
|
-
export declare const components: {};
|
package/convex/_generated/api.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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 { anyApi, componentsGeneric } from "convex/server";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* A utility for referencing Convex functions in your app's API.
|
|
15
|
-
*
|
|
16
|
-
* Usage:
|
|
17
|
-
* ```js
|
|
18
|
-
* const myFunctionReference = api.myModule.myFunction;
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export const api = anyApi;
|
|
22
|
-
export const internal = anyApi;
|
|
23
|
-
export const components = componentsGeneric();
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/**
|
|
3
|
-
* Generated data model types.
|
|
4
|
-
*
|
|
5
|
-
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
-
*
|
|
7
|
-
* To regenerate, run `npx convex dev`.
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { AnyDataModel } from "convex/server";
|
|
12
|
-
import type { GenericId } from "convex/values";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* No `schema.ts` file found!
|
|
16
|
-
*
|
|
17
|
-
* This generated code has permissive types like `Doc = any` because
|
|
18
|
-
* Convex doesn't know your schema. If you'd like more type safety, see
|
|
19
|
-
* https://docs.convex.dev/using/schemas for instructions on how to add a
|
|
20
|
-
* schema file.
|
|
21
|
-
*
|
|
22
|
-
* After you change a schema, rerun codegen with `npx convex dev`.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The names of all of your Convex tables.
|
|
27
|
-
*/
|
|
28
|
-
export type TableNames = string;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* The type of a document stored in Convex.
|
|
32
|
-
*/
|
|
33
|
-
export type Doc = any;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* An identifier for a document in Convex.
|
|
37
|
-
*
|
|
38
|
-
* Convex documents are uniquely identified by their `Id`, which is accessible
|
|
39
|
-
* on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
|
|
40
|
-
*
|
|
41
|
-
* Documents can be loaded using `db.get(tableName, id)` in query and mutation functions.
|
|
42
|
-
*
|
|
43
|
-
* IDs are just strings at runtime, but this type can be used to distinguish them from other
|
|
44
|
-
* strings when type checking.
|
|
45
|
-
*/
|
|
46
|
-
export type Id<TableName extends TableNames = TableNames> =
|
|
47
|
-
GenericId<TableName>;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* A type describing your Convex data model.
|
|
51
|
-
*
|
|
52
|
-
* This type includes information about what tables you have, the type of
|
|
53
|
-
* documents stored in those tables, and the indexes defined on them.
|
|
54
|
-
*
|
|
55
|
-
* This type is used to parameterize methods like `queryGeneric` and
|
|
56
|
-
* `mutationGeneric` to make them type-safe.
|
|
57
|
-
*/
|
|
58
|
-
export type DataModel = AnyDataModel;
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/**
|
|
3
|
-
* Generated utilities for implementing server-side Convex query and mutation functions.
|
|
4
|
-
*
|
|
5
|
-
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
-
*
|
|
7
|
-
* To regenerate, run `npx convex dev`.
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
ActionBuilder,
|
|
13
|
-
HttpActionBuilder,
|
|
14
|
-
MutationBuilder,
|
|
15
|
-
QueryBuilder,
|
|
16
|
-
GenericActionCtx,
|
|
17
|
-
GenericMutationCtx,
|
|
18
|
-
GenericQueryCtx,
|
|
19
|
-
GenericDatabaseReader,
|
|
20
|
-
GenericDatabaseWriter,
|
|
21
|
-
} from "convex/server";
|
|
22
|
-
import type { DataModel } from "./dataModel.js";
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Define a query in this Convex app's public API.
|
|
26
|
-
*
|
|
27
|
-
* This function will be allowed to read your Convex database and will be accessible from the client.
|
|
28
|
-
*
|
|
29
|
-
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
30
|
-
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
31
|
-
*/
|
|
32
|
-
export declare const query: QueryBuilder<DataModel, "public">;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Define a query that is only accessible from other Convex functions (but not from the client).
|
|
36
|
-
*
|
|
37
|
-
* This function will be allowed to read from your Convex database. It will not be accessible from the client.
|
|
38
|
-
*
|
|
39
|
-
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
40
|
-
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
41
|
-
*/
|
|
42
|
-
export declare const internalQuery: QueryBuilder<DataModel, "internal">;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Define a mutation in this Convex app's public API.
|
|
46
|
-
*
|
|
47
|
-
* This function will be allowed to modify your Convex database and will be accessible from the client.
|
|
48
|
-
*
|
|
49
|
-
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
50
|
-
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
51
|
-
*/
|
|
52
|
-
export declare const mutation: MutationBuilder<DataModel, "public">;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Define a mutation that is only accessible from other Convex functions (but not from the client).
|
|
56
|
-
*
|
|
57
|
-
* This function will be allowed to modify your Convex database. It will not be accessible from the client.
|
|
58
|
-
*
|
|
59
|
-
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
60
|
-
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
61
|
-
*/
|
|
62
|
-
export declare const internalMutation: MutationBuilder<DataModel, "internal">;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Define an action in this Convex app's public API.
|
|
66
|
-
*
|
|
67
|
-
* An action is a function which can execute any JavaScript code, including non-deterministic
|
|
68
|
-
* code and code with side-effects, like calling third-party services.
|
|
69
|
-
* They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
|
|
70
|
-
* They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
|
|
71
|
-
*
|
|
72
|
-
* @param func - The action. It receives an {@link ActionCtx} as its first argument.
|
|
73
|
-
* @returns The wrapped action. Include this as an `export` to name it and make it accessible.
|
|
74
|
-
*/
|
|
75
|
-
export declare const action: ActionBuilder<DataModel, "public">;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Define an action that is only accessible from other Convex functions (but not from the client).
|
|
79
|
-
*
|
|
80
|
-
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
|
|
81
|
-
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
|
|
82
|
-
*/
|
|
83
|
-
export declare const internalAction: ActionBuilder<DataModel, "internal">;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Define an HTTP action.
|
|
87
|
-
*
|
|
88
|
-
* The wrapped function will be used to respond to HTTP requests received
|
|
89
|
-
* by a Convex deployment if the requests matches the path and method where
|
|
90
|
-
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
|
|
91
|
-
*
|
|
92
|
-
* @param func - The function. It receives an {@link ActionCtx} as its first argument
|
|
93
|
-
* and a Fetch API `Request` object as its second.
|
|
94
|
-
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
95
|
-
*/
|
|
96
|
-
export declare const httpAction: HttpActionBuilder;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* A set of services for use within Convex query functions.
|
|
100
|
-
*
|
|
101
|
-
* The query context is passed as the first argument to any Convex query
|
|
102
|
-
* function run on the server.
|
|
103
|
-
*
|
|
104
|
-
* This differs from the {@link MutationCtx} because all of the services are
|
|
105
|
-
* read-only.
|
|
106
|
-
*/
|
|
107
|
-
export type QueryCtx = GenericQueryCtx<DataModel>;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* A set of services for use within Convex mutation functions.
|
|
111
|
-
*
|
|
112
|
-
* The mutation context is passed as the first argument to any Convex mutation
|
|
113
|
-
* function run on the server.
|
|
114
|
-
*/
|
|
115
|
-
export type MutationCtx = GenericMutationCtx<DataModel>;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* A set of services for use within Convex action functions.
|
|
119
|
-
*
|
|
120
|
-
* The action context is passed as the first argument to any Convex action
|
|
121
|
-
* function run on the server.
|
|
122
|
-
*/
|
|
123
|
-
export type ActionCtx = GenericActionCtx<DataModel>;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* An interface to read from the database within Convex query functions.
|
|
127
|
-
*
|
|
128
|
-
* The two entry points are {@link DatabaseReader.get}, which fetches a single
|
|
129
|
-
* document by its {@link Id}, or {@link DatabaseReader.query}, which starts
|
|
130
|
-
* building a query.
|
|
131
|
-
*/
|
|
132
|
-
export type DatabaseReader = GenericDatabaseReader<DataModel>;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* An interface to read from and write to the database within Convex mutation
|
|
136
|
-
* functions.
|
|
137
|
-
*
|
|
138
|
-
* Convex guarantees that all writes within a single mutation are
|
|
139
|
-
* executed atomically, so you never have to worry about partial writes leaving
|
|
140
|
-
* your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)
|
|
141
|
-
* for the guarantees Convex provides your functions.
|
|
142
|
-
*/
|
|
143
|
-
export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/**
|
|
3
|
-
* Generated utilities for implementing server-side Convex query and mutation functions.
|
|
4
|
-
*
|
|
5
|
-
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
-
*
|
|
7
|
-
* To regenerate, run `npx convex dev`.
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
actionGeneric,
|
|
13
|
-
httpActionGeneric,
|
|
14
|
-
queryGeneric,
|
|
15
|
-
mutationGeneric,
|
|
16
|
-
internalActionGeneric,
|
|
17
|
-
internalMutationGeneric,
|
|
18
|
-
internalQueryGeneric,
|
|
19
|
-
} from "convex/server";
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Define a query in this Convex app's public API.
|
|
23
|
-
*
|
|
24
|
-
* This function will be allowed to read your Convex database and will be accessible from the client.
|
|
25
|
-
*
|
|
26
|
-
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
27
|
-
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
28
|
-
*/
|
|
29
|
-
export const query = queryGeneric;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Define a query that is only accessible from other Convex functions (but not from the client).
|
|
33
|
-
*
|
|
34
|
-
* This function will be allowed to read from your Convex database. It will not be accessible from the client.
|
|
35
|
-
*
|
|
36
|
-
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
37
|
-
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
38
|
-
*/
|
|
39
|
-
export const internalQuery = internalQueryGeneric;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Define a mutation in this Convex app's public API.
|
|
43
|
-
*
|
|
44
|
-
* This function will be allowed to modify your Convex database and will be accessible from the client.
|
|
45
|
-
*
|
|
46
|
-
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
47
|
-
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
48
|
-
*/
|
|
49
|
-
export const mutation = mutationGeneric;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Define a mutation that is only accessible from other Convex functions (but not from the client).
|
|
53
|
-
*
|
|
54
|
-
* This function will be allowed to modify your Convex database. It will not be accessible from the client.
|
|
55
|
-
*
|
|
56
|
-
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
57
|
-
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
58
|
-
*/
|
|
59
|
-
export const internalMutation = internalMutationGeneric;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Define an action in this Convex app's public API.
|
|
63
|
-
*
|
|
64
|
-
* An action is a function which can execute any JavaScript code, including non-deterministic
|
|
65
|
-
* code and code with side-effects, like calling third-party services.
|
|
66
|
-
* They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
|
|
67
|
-
* They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
|
|
68
|
-
*
|
|
69
|
-
* @param func - The action. It receives an {@link ActionCtx} as its first argument.
|
|
70
|
-
* @returns The wrapped action. Include this as an `export` to name it and make it accessible.
|
|
71
|
-
*/
|
|
72
|
-
export const action = actionGeneric;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Define an action that is only accessible from other Convex functions (but not from the client).
|
|
76
|
-
*
|
|
77
|
-
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
|
|
78
|
-
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
|
|
79
|
-
*/
|
|
80
|
-
export const internalAction = internalActionGeneric;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Define an HTTP action.
|
|
84
|
-
*
|
|
85
|
-
* The wrapped function will be used to respond to HTTP requests received
|
|
86
|
-
* by a Convex deployment if the requests matches the path and method where
|
|
87
|
-
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
|
|
88
|
-
*
|
|
89
|
-
* @param func - The function. It receives an {@link ActionCtx} as its first argument
|
|
90
|
-
* and a Fetch API `Request` object as its second.
|
|
91
|
-
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
|
|
92
|
-
*/
|
|
93
|
-
export const httpAction = httpActionGeneric;
|