@mastra/server 0.0.1-alpha.6 → 0.10.1-alpha.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.
Files changed (79) hide show
  1. package/{LICENSE → LICENSE.md} +3 -1
  2. package/README.md +48 -135
  3. package/dist/_tsup-dts-rollup.d.cts +316 -52
  4. package/dist/_tsup-dts-rollup.d.ts +316 -52
  5. package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
  6. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  7. package/dist/chunk-5SN4U5AC.cjs +508 -0
  8. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  9. package/dist/chunk-75ZPJI57.cjs +9 -0
  10. package/dist/{chunk-VB7KH62D.cjs → chunk-7DLZLWJV.cjs} +16 -12
  11. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  12. package/dist/{chunk-2YONKUWB.js → chunk-C7564HUT.js} +58 -33
  13. package/dist/chunk-D4IRYCUI.cjs +235 -0
  14. package/dist/{chunk-RBQASTUP.js → chunk-DJJIUEL2.js} +13 -5
  15. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  16. package/dist/{chunk-3RVHWGWO.js → chunk-HFWCEP5S.js} +6 -12
  17. package/dist/chunk-KUNQFY2W.js +365 -0
  18. package/dist/chunk-LIVAK2DM.js +2001 -0
  19. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  20. package/dist/{chunk-CWSDZEZG.cjs → chunk-MHKNLNAN.cjs} +15 -12
  21. package/dist/chunk-MLKGABMK.js +7 -0
  22. package/dist/chunk-MMO2HDM6.cjs +378 -0
  23. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  24. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  25. package/dist/{chunk-DVPP5S6I.js → chunk-OR3CIE2H.js} +9 -6
  26. package/dist/chunk-P6SCPDYW.js +500 -0
  27. package/dist/{chunk-YNSGUC2O.js → chunk-TJKLBTFB.js} +23 -7
  28. package/dist/chunk-VPNDC2DI.cjs +148 -0
  29. package/dist/{chunk-ILW7XYNJ.js → chunk-W7VCKPAD.js} +84 -60
  30. package/dist/{chunk-2JQC6JWP.js → chunk-WFBJJNCK.js} +10 -6
  31. package/dist/chunk-WUC6LSTW.js +227 -0
  32. package/dist/{chunk-2FJURXCL.cjs → chunk-Y7UWRW5X.cjs} +43 -35
  33. package/dist/{chunk-A7DF4ETD.cjs → chunk-YBVOQN4M.cjs} +22 -28
  34. package/dist/chunk-YIOVBYZH.cjs +332 -0
  35. package/dist/chunk-YWLUOY3D.cjs +2004 -0
  36. package/dist/{chunk-4C3EPMMF.cjs → chunk-ZE5AAC4I.cjs} +40 -24
  37. package/dist/server/handlers/a2a.cjs +30 -0
  38. package/dist/server/handlers/a2a.d.cts +6 -0
  39. package/dist/server/handlers/a2a.d.ts +6 -0
  40. package/dist/server/handlers/a2a.js +1 -0
  41. package/dist/server/handlers/agents.cjs +7 -7
  42. package/dist/server/handlers/agents.js +1 -1
  43. package/dist/server/handlers/error.cjs +2 -2
  44. package/dist/server/handlers/error.js +1 -1
  45. package/dist/server/handlers/legacyWorkflows.cjs +46 -0
  46. package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
  47. package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
  48. package/dist/server/handlers/legacyWorkflows.js +1 -0
  49. package/dist/server/handlers/logs.cjs +4 -4
  50. package/dist/server/handlers/logs.js +1 -1
  51. package/dist/server/handlers/memory.cjs +9 -9
  52. package/dist/server/handlers/memory.js +1 -1
  53. package/dist/server/handlers/network.cjs +5 -5
  54. package/dist/server/handlers/network.js +1 -1
  55. package/dist/server/handlers/telemetry.cjs +3 -3
  56. package/dist/server/handlers/telemetry.js +1 -1
  57. package/dist/server/handlers/tools.cjs +5 -5
  58. package/dist/server/handlers/tools.js +1 -1
  59. package/dist/server/handlers/utils.cjs +2 -2
  60. package/dist/server/handlers/utils.js +1 -1
  61. package/dist/server/handlers/vector.cjs +7 -7
  62. package/dist/server/handlers/vector.js +1 -1
  63. package/dist/server/handlers/voice.cjs +4 -4
  64. package/dist/server/handlers/voice.js +1 -1
  65. package/dist/server/handlers/workflows.cjs +17 -13
  66. package/dist/server/handlers/workflows.d.cts +3 -2
  67. package/dist/server/handlers/workflows.d.ts +3 -2
  68. package/dist/server/handlers/workflows.js +1 -1
  69. package/dist/server/handlers.cjs +33 -23
  70. package/dist/server/handlers.d.cts +2 -0
  71. package/dist/server/handlers.d.ts +2 -0
  72. package/dist/server/handlers.js +11 -9
  73. package/package.json +9 -7
  74. package/dist/chunk-5JOF627H.cjs +0 -123
  75. package/dist/chunk-BMA2ORRT.js +0 -152
  76. package/dist/chunk-GV52BII2.cjs +0 -160
  77. package/dist/chunk-QH6XWSXP.cjs +0 -5579
  78. package/dist/chunk-VK6FX47H.js +0 -5576
  79. package/dist/chunk-X37I6GZT.cjs +0 -308
@@ -1,4 +1,6 @@
1
- Elastic License 2.0 (ELv2)
1
+ # Elastic License 2.0 (ELv2)
2
+
3
+ Copyright (c) 2025 Mastra AI, Inc.
2
4
 
3
5
  **Acceptance**
4
6
  By using the software, you agree to all of the terms and conditions below.
package/README.md CHANGED
@@ -1,159 +1,72 @@
1
- # @mastra/deployer
1
+ # @mastra/server
2
2
 
3
- Core deployment infrastructure for Mastra applications, handling build, packaging, and deployment processes.
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/deployer
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
- ```typescript
23
- import { Deployer } from '@mastra/deployer';
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
- // Create a deployer instance
26
- const deployer = new Deployer({
27
- dir: '/path/to/project',
28
- type: 'Deploy', // or 'Dev' for development mode
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
- // Install dependencies
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
- ## Configuration
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
- ## Features
43
+ ## Available Handler Groups
49
44
 
50
- ### Project Structure Management
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
- - Creates and manages `.mastra` directory
53
- - Handles package.json generation and updates
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
- ### Dependency Management
58
+ ## OpenAPI Spec Generation
57
59
 
58
- - Automatic dependency installation
59
- - Workspace dependency resolution
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
- ### Environment Handling
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
- ## Methods
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
- ## Related Packages
69
+ ## License
154
70
 
155
- - `@mastra/core`: Core Mastra functionality
156
- - `@mastra/loggers`: Logging infrastructure
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.