@mastra/server 0.0.0-separate-trace-data-from-component-20250501042644 → 0.0.0-share-agent-metadata-with-cloud-20250718110128
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.md +11 -42
- package/README.md +48 -135
- package/dist/_tsup-dts-rollup.d.cts +556 -103
- package/dist/_tsup-dts-rollup.d.ts +556 -103
- package/dist/{chunk-FV45V6WC.cjs → chunk-2KZFMI6P.cjs} +1 -7
- package/dist/{chunk-5YGDYMRB.cjs → chunk-2SLFAFTR.cjs} +14 -13
- package/dist/chunk-3CNDE7QY.cjs +308 -0
- package/dist/chunk-4D66QEKC.js +81 -0
- package/dist/{chunk-M3YJLWTU.js → chunk-5PQQ42EZ.js} +68 -57
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/{chunk-M56ECCHK.cjs → chunk-7TP2LX5L.cjs} +20 -19
- package/dist/chunk-B2PAS2IB.cjs +514 -0
- package/dist/{chunk-Y3SV5XK4.js → chunk-BK4XT6EG.js} +105 -16
- package/dist/{chunk-QN4KF3BH.cjs → chunk-CCGRCYWJ.cjs} +2 -2
- package/dist/{chunk-QJ3AHN64.js → chunk-CRCR3ZUK.js} +4 -3
- package/dist/{chunk-D3G23FP3.cjs → chunk-FRVBFMO2.cjs} +24 -22
- package/dist/{chunk-7IWQE76Z.cjs → chunk-G7KH752Y.cjs} +16 -10
- package/dist/chunk-GHC4YV6R.js +504 -0
- package/dist/chunk-H7DMHBKY.js +498 -0
- package/dist/chunk-JMLYCXMK.cjs +332 -0
- package/dist/{chunk-Q6SHQECN.js → chunk-KHZKYUNR.js} +34 -10
- package/dist/{chunk-RBQASTUP.js → chunk-KOHWJYJT.js} +120 -27
- package/dist/{chunk-TRDNDNGQ.js → chunk-LCM566I4.js} +2 -7
- package/dist/chunk-LF7P5PLR.js +14 -0
- package/dist/chunk-LI436ITD.cjs +2042 -0
- package/dist/{chunk-5JNVY6DU.js → chunk-LRCAAFUA.js} +7 -5
- package/dist/chunk-LZ3VJXSO.cjs +278 -0
- package/dist/chunk-MEGCYGBU.js +2039 -0
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/chunk-PZQDCRPV.cjs +16 -0
- package/dist/chunk-QGX47B5D.cjs +86 -0
- package/dist/{chunk-WTHDCRMY.js → chunk-RG473F6Y.js} +12 -6
- package/dist/chunk-RHSWAXKB.cjs +118 -0
- package/dist/{chunk-L7XE5QTW.js → chunk-RSEO4XPX.js} +1 -1
- package/dist/chunk-SDPGVWQJ.cjs +512 -0
- package/dist/{chunk-4JINXASC.js → chunk-WNVFNNWN.js} +5 -4
- package/dist/server/handlers/a2a.cjs +30 -0
- package/dist/server/handlers/a2a.d.cts +6 -0
- package/dist/server/handlers/a2a.d.ts +6 -0
- package/dist/server/handlers/a2a.js +1 -0
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/error.cjs +2 -2
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/legacyWorkflows.cjs +46 -0
- package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
- package/dist/server/handlers/legacyWorkflows.js +1 -0
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +17 -9
- package/dist/server/handlers/memory.d.cts +2 -0
- package/dist/server/handlers/memory.d.ts +2 -0
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/network.cjs +5 -5
- package/dist/server/handlers/network.js +1 -1
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +2 -2
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/vNextNetwork.cjs +218 -0
- package/dist/server/handlers/vNextNetwork.d.cts +6 -0
- package/dist/server/handlers/vNextNetwork.d.ts +6 -0
- package/dist/server/handlers/vNextNetwork.js +211 -0
- package/dist/server/handlers/vector.cjs +7 -7
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -4
- package/dist/server/handlers/voice.d.cts +1 -0
- package/dist/server/handlers/voice.d.ts +1 -0
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +29 -13
- package/dist/server/handlers/workflows.d.cts +6 -2
- package/dist/server/handlers/workflows.d.ts +6 -2
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +32 -27
- package/dist/server/handlers.d.cts +2 -1
- package/dist/server/handlers.d.ts +2 -1
- package/dist/server/handlers.js +11 -10
- package/package.json +15 -14
- package/dist/chunk-2FJURXCL.cjs +0 -213
- package/dist/chunk-3AHQ5RGN.js +0 -11
- package/dist/chunk-3EJZQ6TQ.js +0 -49
- package/dist/chunk-4BIX6GMY.cjs +0 -189
- package/dist/chunk-55HTWX4C.cjs +0 -93
- package/dist/chunk-5SWCVTNL.cjs +0 -5579
- package/dist/chunk-AELYAUEE.cjs +0 -316
- package/dist/chunk-EVCC233P.cjs +0 -321
- package/dist/chunk-JPB6RPGB.js +0 -304
- package/dist/chunk-OMN3UI6X.js +0 -5576
- package/dist/chunk-SKBVVI24.cjs +0 -54
- package/dist/chunk-ZLBRQFDD.cjs +0 -13
- package/dist/server/handlers/vNextWorkflows.cjs +0 -46
- package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
- package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
- package/dist/server/handlers/vNextWorkflows.js +0 -1
package/LICENSE.md
CHANGED
|
@@ -1,46 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Apache License 2.0
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025
|
|
3
|
+
Copyright (c) 2025 Kepler Software, Inc.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
17
|
-
|
|
18
|
-
**Patents**
|
|
19
|
-
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
20
|
-
|
|
21
|
-
**Notices**
|
|
22
|
-
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
23
|
-
|
|
24
|
-
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
25
|
-
|
|
26
|
-
**No Other Rights**
|
|
27
|
-
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
28
|
-
|
|
29
|
-
**Termination**
|
|
30
|
-
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
|
31
|
-
|
|
32
|
-
**No Liability**
|
|
33
|
-
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
|
|
34
|
-
|
|
35
|
-
**Definitions**
|
|
36
|
-
The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
|
|
37
|
-
|
|
38
|
-
_you_ refers to the individual or entity agreeing to these terms.
|
|
39
|
-
|
|
40
|
-
_your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
41
|
-
|
|
42
|
-
_your licenses_ are all the licenses granted to you for the software under these terms.
|
|
43
|
-
|
|
44
|
-
_use_ means anything you do with the software requiring one of your licenses.
|
|
45
|
-
|
|
46
|
-
_trademark_ means trademarks, service marks, and similar rights.
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,159 +1,72 @@
|
|
|
1
|
-
# @mastra/
|
|
1
|
+
# @mastra/server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Typed HTTP handlers and utilities for exposing a `Mastra` instance over HTTP.
|
|
4
|
+
This package powers `mastra dev` and can be added to your own server to provide
|
|
5
|
+
REST and streaming endpoints for agents, workflows, telemetry and more.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
|
-
npm install @mastra/
|
|
10
|
+
npm install @mastra/server
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
## Overview
|
|
12
|
-
|
|
13
|
-
The `@mastra/deployer` package provides the foundational deployment infrastructure for Mastra applications. It handles:
|
|
14
|
-
|
|
15
|
-
- Project building and bundling
|
|
16
|
-
- Dependency management
|
|
17
|
-
- Environment configuration
|
|
18
|
-
- Development and production deployments
|
|
19
|
-
|
|
20
13
|
## Usage
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
The handlers are framework agnostic functions which accept a `Mastra` instance
|
|
16
|
+
and a request context. They are typically mounted under a URL prefix within your
|
|
17
|
+
web framework of choice:
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
```typescript
|
|
20
|
+
import { Hono } from 'hono';
|
|
21
|
+
import { handlers } from '@mastra/server';
|
|
22
|
+
import { mastra } from './mastra-instance';
|
|
23
|
+
|
|
24
|
+
const app = new Hono();
|
|
25
|
+
|
|
26
|
+
app.get('/mastra/agents', ctx => handlers.agents.getAgentsHandler({ mastra, runtimeContext: ctx }));
|
|
27
|
+
app.post('/mastra/agents/:id/generate', async ctx => {
|
|
28
|
+
const body = await ctx.req.json();
|
|
29
|
+
return handlers.agents.generateHandler({
|
|
30
|
+
mastra,
|
|
31
|
+
runtimeContext: ctx,
|
|
32
|
+
agentId: ctx.req.param('id'),
|
|
33
|
+
body,
|
|
34
|
+
});
|
|
29
35
|
});
|
|
30
36
|
|
|
31
|
-
//
|
|
32
|
-
await deployer.install();
|
|
33
|
-
|
|
34
|
-
// Write package.json
|
|
35
|
-
await deployer.writePackageJson();
|
|
36
|
-
|
|
37
|
-
// Get Mastra instance
|
|
38
|
-
const { mastra } = await deployer.getMastra();
|
|
37
|
+
// Mount additional handlers as required
|
|
39
38
|
```
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### Required Parameters
|
|
44
|
-
|
|
45
|
-
- `dir`: Project directory path
|
|
46
|
-
- `type`: Deployment type ('Deploy' or 'Dev')
|
|
40
|
+
Running `mastra dev` starts a local development UI at
|
|
41
|
+
`http://localhost:3000` using these handlers.
|
|
47
42
|
|
|
48
|
-
##
|
|
43
|
+
## Available Handler Groups
|
|
49
44
|
|
|
50
|
-
|
|
45
|
+
- **Agents** - list defined agents, retrieve metadata, and run `generate`
|
|
46
|
+
or `stream`.
|
|
47
|
+
- **Workflows** - start and inspect workflow runs.
|
|
48
|
+
- **Tools** - discover tools available to the `Mastra` instance.
|
|
49
|
+
- **Memory** - interact with configured memory stores.
|
|
50
|
+
- **Logs** - query runtime logs when a supporting logger transport is used.
|
|
51
|
+
- **Telemetry** - expose metrics produced by the telemetry subsystem.
|
|
52
|
+
- **Networks** - interact with agent networks.
|
|
53
|
+
- **Vector / Voice** - endpoints related to vector stores and voice synthesis.
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
- Manages project dependencies
|
|
55
|
+
Handlers return JSON serialisable data and throw an `HTTPException` (subclass of
|
|
56
|
+
`Error`) when a failure should result in a non-2xx HTTP status.
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
## OpenAPI Spec Generation
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- Version management for @mastra packages
|
|
60
|
+
The local OpenAPI specification used by the CLI playground and similar tools can
|
|
61
|
+
be refreshed by running:
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- Support for multiple environment files:
|
|
65
|
-
- `.env`
|
|
66
|
-
- `.env.development`
|
|
67
|
-
- `.env.local`
|
|
68
|
-
- Environment variable validation and processing
|
|
69
|
-
|
|
70
|
-
### Build Process
|
|
71
|
-
|
|
72
|
-
- Project bundling
|
|
73
|
-
- Asset management
|
|
74
|
-
- Source code transformation
|
|
75
|
-
|
|
76
|
-
### Development Support
|
|
77
|
-
|
|
78
|
-
- Development server configuration
|
|
79
|
-
- Hot reloading capabilities
|
|
80
|
-
- Debug logging
|
|
81
|
-
|
|
82
|
-
## Project Structure
|
|
83
|
-
|
|
84
|
-
The deployer creates and manages the following structure:
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
your-project/
|
|
88
|
-
├── .mastra/
|
|
89
|
-
│ ├── package.json
|
|
90
|
-
│ ├── mastra.mjs
|
|
91
|
-
│ └── index.mjs
|
|
92
|
-
├── .env
|
|
93
|
-
├── .env.development
|
|
94
|
-
├── .env.local
|
|
95
|
-
└── package.json
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## Package.json Management
|
|
99
|
-
|
|
100
|
-
The deployer automatically manages dependencies in the `.mastra/package.json`:
|
|
101
|
-
|
|
102
|
-
```json
|
|
103
|
-
{
|
|
104
|
-
"name": "server",
|
|
105
|
-
"version": "1.0.0",
|
|
106
|
-
"type": "module",
|
|
107
|
-
"dependencies": {
|
|
108
|
-
"@mastra/loggers": "latest",
|
|
109
|
-
"hono": "4.6.17",
|
|
110
|
-
"@hono/node-server": "^1.13.7",
|
|
111
|
-
"superjson": "^2.2.2",
|
|
112
|
-
"zod-to-json-schema": "^3.24.1"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
63
|
+
```bash
|
|
64
|
+
pnpm run pull:openapispec
|
|
115
65
|
```
|
|
116
66
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
### `install()`
|
|
120
|
-
|
|
121
|
-
Installs and updates project dependencies.
|
|
122
|
-
|
|
123
|
-
### `writePackageJson()`
|
|
124
|
-
|
|
125
|
-
Generates or updates the package.json in the .mastra directory.
|
|
126
|
-
|
|
127
|
-
### `getMastra()`
|
|
128
|
-
|
|
129
|
-
Returns the Mastra instance for the project.
|
|
130
|
-
|
|
131
|
-
### `getMastraPath()`
|
|
132
|
-
|
|
133
|
-
Returns the path to the .mastra directory.
|
|
134
|
-
|
|
135
|
-
## Error Handling
|
|
136
|
-
|
|
137
|
-
The deployer includes comprehensive error handling for:
|
|
138
|
-
|
|
139
|
-
- Dependency installation failures
|
|
140
|
-
- File system operations
|
|
141
|
-
- Environment configuration issues
|
|
142
|
-
- Build process errors
|
|
143
|
-
|
|
144
|
-
## Logging
|
|
145
|
-
|
|
146
|
-
Built-in logging support through @mastra/core:
|
|
147
|
-
|
|
148
|
-
- Debug information
|
|
149
|
-
- Installation progress
|
|
150
|
-
- Build status
|
|
151
|
-
- Error reporting
|
|
67
|
+
within the `@mastra/server` directory.
|
|
152
68
|
|
|
153
|
-
##
|
|
69
|
+
## License
|
|
154
70
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
- Deployer implementations:
|
|
158
|
-
- `@mastra/deployer-cloudflare`
|
|
159
|
-
- Other platform-specific deployers
|
|
71
|
+
Released under the Elastic License 2.0. The full license text is available in
|
|
72
|
+
this repository.
|