@lakitu/sdk 0.1.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 +166 -0
- package/convex/_generated/api.d.ts +45 -0
- package/convex/_generated/api.js +23 -0
- package/convex/_generated/dataModel.d.ts +58 -0
- package/convex/_generated/server.d.ts +143 -0
- package/convex/_generated/server.js +93 -0
- package/convex/cloud/CLAUDE.md +238 -0
- package/convex/cloud/_generated/api.ts +84 -0
- package/convex/cloud/_generated/component.ts +861 -0
- package/convex/cloud/_generated/dataModel.ts +60 -0
- package/convex/cloud/_generated/server.ts +156 -0
- package/convex/cloud/convex.config.ts +16 -0
- package/convex/cloud/index.ts +29 -0
- package/convex/cloud/intentSchema/generate.ts +447 -0
- package/convex/cloud/intentSchema/index.ts +16 -0
- package/convex/cloud/intentSchema/types.ts +418 -0
- package/convex/cloud/ksaPolicy.ts +554 -0
- package/convex/cloud/mail.ts +92 -0
- package/convex/cloud/schema.ts +322 -0
- package/convex/cloud/utils/kanbanContext.ts +229 -0
- package/convex/cloud/workflows/agentBoard.ts +451 -0
- package/convex/cloud/workflows/agentPrompt.ts +272 -0
- package/convex/cloud/workflows/agentThread.ts +374 -0
- package/convex/cloud/workflows/compileSandbox.ts +146 -0
- package/convex/cloud/workflows/crudBoard.ts +217 -0
- package/convex/cloud/workflows/crudKSAs.ts +262 -0
- package/convex/cloud/workflows/crudLorobeads.ts +371 -0
- package/convex/cloud/workflows/crudSkills.ts +205 -0
- package/convex/cloud/workflows/crudThreads.ts +708 -0
- package/convex/cloud/workflows/lifecycleSandbox.ts +1396 -0
- package/convex/cloud/workflows/sandboxConvex.ts +1046 -0
- package/convex/sandbox/README.md +90 -0
- package/convex/sandbox/_generated/api.d.ts +2934 -0
- package/convex/sandbox/_generated/api.js +23 -0
- package/convex/sandbox/_generated/dataModel.d.ts +60 -0
- package/convex/sandbox/_generated/server.d.ts +143 -0
- package/convex/sandbox/_generated/server.js +93 -0
- package/convex/sandbox/actions/bash.ts +130 -0
- package/convex/sandbox/actions/browser.ts +282 -0
- package/convex/sandbox/actions/file.ts +336 -0
- package/convex/sandbox/actions/lsp.ts +325 -0
- package/convex/sandbox/actions/pdf.ts +119 -0
- package/convex/sandbox/agent/codeExecLoop.ts +535 -0
- package/convex/sandbox/agent/decisions.ts +284 -0
- package/convex/sandbox/agent/index.ts +515 -0
- package/convex/sandbox/agent/subagents.ts +651 -0
- package/convex/sandbox/brandResearch/index.ts +417 -0
- package/convex/sandbox/context/index.ts +7 -0
- package/convex/sandbox/context/session.ts +402 -0
- package/convex/sandbox/convex.config.ts +17 -0
- package/convex/sandbox/index.ts +51 -0
- package/convex/sandbox/nodeActions/codeExec.ts +130 -0
- package/convex/sandbox/planning/beads.ts +187 -0
- package/convex/sandbox/planning/index.ts +8 -0
- package/convex/sandbox/planning/sync.ts +194 -0
- package/convex/sandbox/prompts/codeExec.ts +852 -0
- package/convex/sandbox/prompts/modes.ts +231 -0
- package/convex/sandbox/prompts/system.ts +142 -0
- package/convex/sandbox/schema.ts +510 -0
- package/convex/sandbox/state/artifacts.ts +99 -0
- package/convex/sandbox/state/checkpoints.ts +341 -0
- package/convex/sandbox/state/files.ts +383 -0
- package/convex/sandbox/state/index.ts +10 -0
- package/convex/sandbox/state/verification.actions.ts +268 -0
- package/convex/sandbox/state/verification.ts +101 -0
- package/convex/sandbox/tsconfig.json +25 -0
- package/convex/sandbox/utils/codeExecHelpers.ts +52 -0
- package/dist/cli/commands/build.d.ts +19 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +223 -0
- package/dist/cli/commands/init.d.ts +16 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +148 -0
- package/dist/cli/commands/publish.d.ts +12 -0
- package/dist/cli/commands/publish.d.ts.map +1 -0
- package/dist/cli/commands/publish.js +33 -0
- package/dist/cli/index.d.ts +14 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +40 -0
- package/dist/sdk/builders.d.ts +104 -0
- package/dist/sdk/builders.d.ts.map +1 -0
- package/dist/sdk/builders.js +214 -0
- package/dist/sdk/index.d.ts +29 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +38 -0
- package/dist/sdk/types.d.ts +107 -0
- package/dist/sdk/types.d.ts.map +1 -0
- package/dist/sdk/types.js +6 -0
- package/ksa/README.md +263 -0
- package/ksa/_generated/REFERENCE.md +2954 -0
- package/ksa/_generated/registry.ts +257 -0
- package/ksa/_shared/configReader.ts +302 -0
- package/ksa/_shared/configSchemas.ts +649 -0
- package/ksa/_shared/gateway.ts +175 -0
- package/ksa/_shared/ksaBehaviors.ts +411 -0
- package/ksa/_shared/ksaProxy.ts +248 -0
- package/ksa/_shared/localDb.ts +302 -0
- package/ksa/index.ts +134 -0
- package/package.json +93 -0
- package/runtime/browser/agent-browser.ts +330 -0
- package/runtime/entrypoint.ts +194 -0
- package/runtime/lsp/manager.ts +366 -0
- package/runtime/pdf/pdf-generator.ts +50 -0
- package/runtime/pdf/renderer.ts +357 -0
- package/runtime/pdf/schema.ts +97 -0
- package/runtime/services/file-watcher.ts +191 -0
- package/template/build.ts +307 -0
- package/template/e2b/Dockerfile +69 -0
- package/template/e2b/e2b.toml +13 -0
- package/template/e2b/prebuild.sh +68 -0
- package/template/e2b/start.sh +14 -0
package/README.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/laki2-banner.jpeg" alt="Lakitu Banner" width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# Lakitu
|
|
6
|
+
|
|
7
|
+
> AI agent runtime using **code execution**, not JSON tool calls.
|
|
8
|
+
|
|
9
|
+
Lakitu is an autonomous development environment that runs in an [E2B](https://e2b.dev) sandbox. The agent writes TypeScript code that imports from **KSAs** (Knowledge, Skills, and Abilities), which gets executed in the sandbox.
|
|
10
|
+
|
|
11
|
+
## The Code Execution Model
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
Traditional Agent: Lakitu Agent:
|
|
15
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
16
|
+
│ LLM Response │ │ LLM Response │
|
|
17
|
+
│ { │ │ ```typescript │
|
|
18
|
+
│ "tool": "x", │ vs │ import { x } │
|
|
19
|
+
│ "args": {} │ │ await x(...) │
|
|
20
|
+
│ } │ │ ``` │
|
|
21
|
+
└────────┬────────┘ └────────┬────────┘
|
|
22
|
+
│ │
|
|
23
|
+
Parse JSON Execute TypeScript
|
|
24
|
+
Route to tool (E2B sandbox)
|
|
25
|
+
│ │
|
|
26
|
+
┌────▼────┐ ┌───────▼───────┐
|
|
27
|
+
│ Executor │ │ KSA Modules │
|
|
28
|
+
└─────────┘ └───────────────┘
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Why?** Token efficiency (no tool schemas), composability (chain operations in code), debuggability (read exactly what ran).
|
|
32
|
+
|
|
33
|
+
## KSAs (Knowledge, Skills, and Abilities)
|
|
34
|
+
|
|
35
|
+
KSAs are TypeScript modules the agent imports. They combine:
|
|
36
|
+
- **Knowledge**: JSDoc documentation
|
|
37
|
+
- **Skills**: Executable functions
|
|
38
|
+
- **Abilities**: What the agent can accomplish
|
|
39
|
+
|
|
40
|
+
### Available KSAs
|
|
41
|
+
|
|
42
|
+
| Category | KSA | Functions |
|
|
43
|
+
|----------|-----|-----------|
|
|
44
|
+
| **System** | `file` | `read`, `write`, `edit`, `glob`, `grep`, `ls` |
|
|
45
|
+
| | `browser` | `open`, `screenshot`, `click`, `type`, `getText` |
|
|
46
|
+
| | `beads` | `create`, `update`, `close`, `list`, `getReady` |
|
|
47
|
+
| | `pdf` | `generate` |
|
|
48
|
+
| **Research** | `web` | `search`, `scrape`, `news` |
|
|
49
|
+
| | `news` | `trending`, `monitorBrand`, `analyzeSentiment` |
|
|
50
|
+
| | `social` | `tiktokProfile`, `instagramPosts`, `twitterPosts`, `searchSocial` |
|
|
51
|
+
| **Data** | `companies` | `enrichDomain`, `searchCompanies`, `getTechStack` |
|
|
52
|
+
| **Create** | `email` | `send`, `sendText`, `sendWithAttachment` |
|
|
53
|
+
|
|
54
|
+
### Example Agent Code
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { search, scrape } from './ksa/web';
|
|
58
|
+
import { enrichDomain } from './ksa/companies';
|
|
59
|
+
import { send } from './ksa/email';
|
|
60
|
+
|
|
61
|
+
// Research a company
|
|
62
|
+
const results = await search('Stripe payments company');
|
|
63
|
+
const content = await scrape(results[0].url);
|
|
64
|
+
|
|
65
|
+
// Enrich with company data
|
|
66
|
+
const company = await enrichDomain('stripe.com');
|
|
67
|
+
console.log(`${company.name}: ${company.industry}, ${company.employeeRange} employees`);
|
|
68
|
+
|
|
69
|
+
// Send findings
|
|
70
|
+
await send({
|
|
71
|
+
to: 'user@example.com',
|
|
72
|
+
subject: 'Company Research: Stripe',
|
|
73
|
+
text: `Industry: ${company.industry}\nEmployees: ${company.employeeRange}`
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Architecture
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
┌─────────────────────────────────────────────────────────────────────────┐
|
|
81
|
+
│ E2B SANDBOX │
|
|
82
|
+
│ │
|
|
83
|
+
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
|
84
|
+
│ │ KSA MODULES │ │
|
|
85
|
+
│ │ /home/user/ksa/ │ │
|
|
86
|
+
│ │ ┌──────┐ ┌──────┐ ┌───────┐ ┌─────────┐ ┌───────┐ ┌─────────┐ │ │
|
|
87
|
+
│ │ │ file │ │ web │ │ news │ │ social │ │ email │ │companies│ │ │
|
|
88
|
+
│ │ └──────┘ └──────┘ └───────┘ └─────────┘ └───────┘ └─────────┘ │ │
|
|
89
|
+
│ └─────────────────────────────────────────────────────────────────┘ │
|
|
90
|
+
│ │ │
|
|
91
|
+
│ Local ops │ Gateway calls │
|
|
92
|
+
│ ▼ │
|
|
93
|
+
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
|
94
|
+
│ │ CLOUD GATEWAY │ │
|
|
95
|
+
│ │ HTTP → Convex Services (OpenRouter, APITube, ScrapeCreators) │ │
|
|
96
|
+
│ └─────────────────────────────────────────────────────────────────┘ │
|
|
97
|
+
│ │
|
|
98
|
+
│ ┌─────────────────────────────────────────────────────────────────┐ │
|
|
99
|
+
│ │ /home/user/workspace/ Working files │ │
|
|
100
|
+
│ │ /home/user/artifacts/ Persistent outputs (PDFs, screenshots) │ │
|
|
101
|
+
│ └─────────────────────────────────────────────────────────────────┘ │
|
|
102
|
+
└─────────────────────────────────────────────────────────────────────────┘
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Directory Structure
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
lakitu/
|
|
109
|
+
├── ksa/ # KSA modules (agent imports these)
|
|
110
|
+
│ ├── _shared/ # Shared utilities
|
|
111
|
+
│ │ └── gateway.ts # Cloud gateway client
|
|
112
|
+
│ ├── _templates/ # Templates for new KSAs
|
|
113
|
+
│ ├── web.ts # Web search & scraping
|
|
114
|
+
│ ├── news.ts # News research & monitoring
|
|
115
|
+
│ ├── social.ts # Social media scraping
|
|
116
|
+
│ ├── companies.ts # Company data enrichment
|
|
117
|
+
│ ├── email.ts # Email sending
|
|
118
|
+
│ ├── file.ts # File operations
|
|
119
|
+
│ ├── browser.ts # Browser automation
|
|
120
|
+
│ ├── beads.ts # Task tracking
|
|
121
|
+
│ ├── pdf.ts # PDF generation
|
|
122
|
+
│ └── index.ts # Discovery & exports
|
|
123
|
+
│
|
|
124
|
+
├── convex/ # Convex backend
|
|
125
|
+
│ ├── agent/ # Agent loop implementation
|
|
126
|
+
│ │ └── codeExecLoop.ts # Code execution loop (no tool schemas)
|
|
127
|
+
│ ├── actions/ # Convex actions
|
|
128
|
+
│ │ └── codeExec.ts # Code execution runtime
|
|
129
|
+
│ ├── prompts/ # System prompts
|
|
130
|
+
│ │ └── codeExec.ts # KSA documentation for agent
|
|
131
|
+
│ └── tools/ # LEGACY: Being removed
|
|
132
|
+
│
|
|
133
|
+
├── shared/ # Shared types
|
|
134
|
+
│ └── chain-of-thought.ts # Execution tracing
|
|
135
|
+
│
|
|
136
|
+
└── runtime/ # CLI commands for bash
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Adding New KSAs
|
|
140
|
+
|
|
141
|
+
See `ksa/README.md` for detailed instructions. Quick steps:
|
|
142
|
+
|
|
143
|
+
1. Copy template from `ksa/_templates/`
|
|
144
|
+
2. Implement functions (use `callGateway()` for external services)
|
|
145
|
+
3. Add to `ksa/index.ts` registry
|
|
146
|
+
4. Document in system prompt (`convex/prompts/codeExec.ts`)
|
|
147
|
+
|
|
148
|
+
## Scripts
|
|
149
|
+
|
|
150
|
+
| Command | Description |
|
|
151
|
+
|---------|-------------|
|
|
152
|
+
| `bun dev` | Start local Convex dev server |
|
|
153
|
+
| `bun deploy` | Deploy to Convex cloud |
|
|
154
|
+
| `bun test` | Run unit tests |
|
|
155
|
+
| `bun typecheck` | TypeScript type check |
|
|
156
|
+
|
|
157
|
+
## Related Documentation
|
|
158
|
+
|
|
159
|
+
- `CLAUDE.md` - Instructions for AI agents working on this codebase
|
|
160
|
+
- `ksa/README.md` - KSA documentation and extension guide
|
|
161
|
+
- `convex/prompts/codeExec.ts` - System prompt with KSA examples
|
|
162
|
+
|
|
163
|
+
## Links
|
|
164
|
+
|
|
165
|
+
- [E2B Documentation](https://e2b.dev/docs)
|
|
166
|
+
- [Convex Documentation](https://docs.convex.dev)
|
|
@@ -0,0 +1,45 @@
|
|
|
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: {};
|
|
@@ -0,0 +1,23 @@
|
|
|
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();
|
|
@@ -0,0 +1,58 @@
|
|
|
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;
|
|
@@ -0,0 +1,143 @@
|
|
|
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>;
|
|
@@ -0,0 +1,93 @@
|
|
|
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;
|