@mastra/koa 1.7.8-alpha.6 → 1.7.8-alpha.7
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 +7 -42
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Koa server adapter for Mastra, enabling you to run Mastra with the [Koa](https:/
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @mastra/koa
|
|
8
|
+
npm install @mastra/koa
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
@@ -28,49 +28,14 @@ app.listen(3000, () => {
|
|
|
28
28
|
});
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## Documentation
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
- [Koa adapter reference](https://mastra.ai/reference/server/koa-adapter)
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
// Routes added after init() have access to Mastra context via ctx.state
|
|
37
|
-
app.use(async ctx => {
|
|
38
|
-
if (ctx.path === '/health' && ctx.method === 'GET') {
|
|
39
|
-
const mastraInstance = ctx.state.mastra;
|
|
40
|
-
const agents = Object.keys(mastraInstance.listAgents());
|
|
41
|
-
ctx.body = { status: 'ok', agents };
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Configuration Options
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
const server = new MastraServer({
|
|
50
|
-
app,
|
|
51
|
-
mastra,
|
|
52
|
-
prefix: '/api/v2', // Route prefix
|
|
53
|
-
openapiPath: '/openapi.json', // OpenAPI spec endpoint
|
|
54
|
-
bodyLimitOptions: {
|
|
55
|
-
maxSize: 10 * 1024 * 1024, // 10MB
|
|
56
|
-
onError: err => ({ error: 'Payload too large' }),
|
|
57
|
-
},
|
|
58
|
-
streamOptions: { redact: true }, // Redact sensitive data from streams
|
|
59
|
-
});
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Context Variables
|
|
63
|
-
|
|
64
|
-
Access these in route handlers via `ctx.state`:
|
|
35
|
+
## Changelog
|
|
65
36
|
|
|
66
|
-
|
|
67
|
-
| ---------------- | --------------------------- |
|
|
68
|
-
| `mastra` | Mastra instance |
|
|
69
|
-
| `requestContext` | Request context map |
|
|
70
|
-
| `abortSignal` | Request cancellation signal |
|
|
71
|
-
| `tools` | Available tools |
|
|
37
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/server-adapters/koa/CHANGELOG.md) for version history and release notes.
|
|
72
38
|
|
|
73
|
-
##
|
|
39
|
+
## Support
|
|
74
40
|
|
|
75
|
-
|
|
76
|
-
- [Koa Documentation](https://koajs.com)
|
|
41
|
+
We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/koa",
|
|
3
|
-
"version": "1.7.8-alpha.
|
|
3
|
+
"version": "1.7.8-alpha.7",
|
|
4
4
|
"description": "Mastra Koa adapter for the server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@fastify/busboy": "^3.2.0",
|
|
24
|
-
"@mastra/server": "1.64.0-alpha.
|
|
24
|
+
"@mastra/server": "1.64.0-alpha.7"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@ai-sdk/openai": "^2.0.115",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"typescript": "^7.0.2",
|
|
36
36
|
"vitest": "4.1.10",
|
|
37
37
|
"zod": "^4.4.3",
|
|
38
|
-
"@internal/lint": "0.0.129",
|
|
39
|
-
"@internal/server-adapter-test-utils": "0.0.29",
|
|
40
38
|
"@internal/storage-test-utils": "0.0.125",
|
|
39
|
+
"@internal/lint": "0.0.129",
|
|
41
40
|
"@internal/types-builder": "0.0.104",
|
|
42
|
-
"@mastra/
|
|
43
|
-
"@mastra/
|
|
44
|
-
"@mastra/
|
|
45
|
-
"@
|
|
46
|
-
"@mastra/
|
|
41
|
+
"@mastra/core": "1.64.0-alpha.7",
|
|
42
|
+
"@mastra/evals": "1.10.0-alpha.1",
|
|
43
|
+
"@mastra/libsql": "1.22.3-alpha.3",
|
|
44
|
+
"@internal/server-adapter-test-utils": "0.0.29",
|
|
45
|
+
"@mastra/memory": "1.28.2-alpha.2",
|
|
46
|
+
"@mastra/observability": "1.17.5-alpha.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@mastra/core": ">=1.50.0-0 <2.0.0-0",
|