@mastra/server 0.0.0-message-ordering-20250415215612 → 0.0.0-redis-cloud-transporter-20250508191651
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 +48 -135
- package/dist/_tsup-dts-rollup.d.cts +128 -31
- package/dist/_tsup-dts-rollup.d.ts +128 -31
- package/dist/{chunk-OPP7H5TW.js → chunk-3XTEV33Q.js} +26 -14
- package/dist/{chunk-A7DF4ETD.cjs → chunk-55HTWX4C.cjs} +2 -9
- package/dist/{chunk-UV4WTEH4.js → chunk-5JNVY6DU.js} +5 -5
- package/dist/{chunk-QH6XWSXP.cjs → chunk-5SWCVTNL.cjs} +38 -38
- package/dist/{chunk-JLDXUWK7.cjs → chunk-5YGDYMRB.cjs} +52 -31
- package/dist/{chunk-Z46X3YCB.cjs → chunk-6Q7UXAYJ.cjs} +72 -38
- package/dist/{chunk-CWSDZEZG.cjs → chunk-AMVOS7YB.cjs} +6 -4
- package/dist/{chunk-DVPP5S6I.js → chunk-BPL2CBLV.js} +6 -4
- package/dist/{chunk-B64YROKU.cjs → chunk-CHFORQ7J.cjs} +32 -20
- package/dist/{chunk-PDC4ZBQW.cjs → chunk-D3G23FP3.cjs} +9 -9
- package/dist/{chunk-67WTHYAV.js → chunk-GVBJ5I2S.js} +70 -36
- package/dist/chunk-M2RXDCPV.cjs +324 -0
- package/dist/{chunk-VK6FX47H.js → chunk-OMN3UI6X.js} +38 -38
- package/dist/chunk-OWNA6I2H.js +312 -0
- package/dist/{chunk-3RVHWGWO.js → chunk-Q6SHQECN.js} +2 -9
- package/dist/{chunk-YANVFOYA.js → chunk-QJ3AHN64.js} +52 -31
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.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/vNextWorkflows.cjs +46 -0
- package/dist/server/handlers/vNextWorkflows.d.cts +10 -0
- package/dist/server/handlers/vNextWorkflows.d.ts +10 -0
- package/dist/server/handlers/vNextWorkflows.js +1 -0
- package/dist/server/handlers/voice.cjs +4 -4
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +11 -11
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +17 -12
- package/dist/server/handlers.d.cts +1 -0
- package/dist/server/handlers.d.ts +1 -0
- package/dist/server/handlers.js +7 -6
- package/package.json +6 -6
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.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Agent } from '@mastra/core/agent';
|
|
2
2
|
import type { AgentNetwork } from '@mastra/core/network';
|
|
3
3
|
import type { BaseLogMessage } from '@mastra/core/logger';
|
|
4
|
-
import type { Container } from '@mastra/core/di';
|
|
5
4
|
import { CoreMessage } from 'ai';
|
|
6
5
|
import { EvalRow } from '@mastra/core/storage';
|
|
7
6
|
import { GenerateObjectResult } from 'ai';
|
|
@@ -10,8 +9,13 @@ import type { Mastra } from '@mastra/core/mastra';
|
|
|
10
9
|
import type { MastraMemory } from '@mastra/core/memory';
|
|
11
10
|
import { Message } from 'ai';
|
|
12
11
|
import { MessageType } from '@mastra/core/memory';
|
|
12
|
+
import { NewStep } from '@mastra/core/workflows/vNext';
|
|
13
|
+
import type { NewWorkflow } from '@mastra/core/workflows/vNext';
|
|
13
14
|
import type { QueryResult } from '@mastra/core/vector';
|
|
14
15
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
16
|
+
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
17
|
+
import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
18
|
+
import { SerializedStepFlowEntry } from '@mastra/core/workflows/vNext';
|
|
15
19
|
import { Step } from '@mastra/core/workflows';
|
|
16
20
|
import { StepExecutionContext } from '@mastra/core/workflows';
|
|
17
21
|
import { StepGraph } from '@mastra/core/workflows';
|
|
@@ -20,8 +24,11 @@ import type { ToolAction } from '@mastra/core/tools';
|
|
|
20
24
|
import type { VercelTool } from '@mastra/core/tools';
|
|
21
25
|
import type { Workflow } from '@mastra/core/workflows';
|
|
22
26
|
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
|
|
27
|
+
import { WorkflowResult } from '@mastra/core/workflows/vNext';
|
|
23
28
|
import { WorkflowRunResult } from '@mastra/core/workflows';
|
|
24
29
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
30
|
+
import { ZodType } from 'zod';
|
|
31
|
+
import { ZodTypeDef } from 'zod';
|
|
25
32
|
|
|
26
33
|
export declare namespace agents {
|
|
27
34
|
export {
|
|
@@ -67,6 +74,10 @@ export declare function createThreadHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
67
74
|
};
|
|
68
75
|
}): Promise<StorageThreadType>;
|
|
69
76
|
|
|
77
|
+
export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
78
|
+
runId: string;
|
|
79
|
+
}>;
|
|
80
|
+
|
|
70
81
|
export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
71
82
|
indexName?: string;
|
|
72
83
|
}): Promise<{
|
|
@@ -87,27 +98,28 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
|
|
|
87
98
|
metric: string | undefined;
|
|
88
99
|
}>;
|
|
89
100
|
|
|
90
|
-
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data,
|
|
101
|
+
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
|
|
91
102
|
agentId?: string;
|
|
92
103
|
data: any;
|
|
93
|
-
|
|
104
|
+
runtimeContext: RuntimeContext;
|
|
94
105
|
}): Promise<any>;
|
|
95
106
|
|
|
96
|
-
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data,
|
|
107
|
+
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
|
|
97
108
|
data?: unknown;
|
|
98
|
-
|
|
109
|
+
runtimeContext: RuntimeContext;
|
|
99
110
|
}) => Promise<any>;
|
|
100
111
|
|
|
101
|
-
export declare function generateHandler({ mastra,
|
|
102
|
-
|
|
112
|
+
export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
113
|
+
runtimeContext: RuntimeContext;
|
|
103
114
|
agentId: string;
|
|
104
115
|
body: GetBody<'generate'> & {
|
|
105
116
|
resourceid?: string;
|
|
117
|
+
runtimeContext?: Record<string, unknown>;
|
|
106
118
|
};
|
|
107
119
|
}): Promise<GenerateTextResult<any, any>>;
|
|
108
120
|
|
|
109
|
-
export declare function generateHandler_alias_1({ mastra,
|
|
110
|
-
|
|
121
|
+
export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
|
|
122
|
+
runtimeContext: RuntimeContext;
|
|
111
123
|
body: {
|
|
112
124
|
messages?: Parameters<AgentNetwork['generate']>[0];
|
|
113
125
|
} & Parameters<AgentNetwork['generate']>[1];
|
|
@@ -121,11 +133,10 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
|
|
|
121
133
|
text?: string;
|
|
122
134
|
speakerId?: string;
|
|
123
135
|
};
|
|
124
|
-
}): Promise<
|
|
125
|
-
audioData: Buffer<ArrayBuffer>;
|
|
126
|
-
}>;
|
|
136
|
+
}): Promise<NodeJS.ReadableStream>;
|
|
127
137
|
|
|
128
|
-
export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
|
|
138
|
+
export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
139
|
+
runtimeContext: RuntimeContext;
|
|
129
140
|
agentId: string;
|
|
130
141
|
}): Promise<{
|
|
131
142
|
name: any;
|
|
@@ -135,7 +146,9 @@ export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
|
|
|
135
146
|
modelId: string;
|
|
136
147
|
}>;
|
|
137
148
|
|
|
138
|
-
export declare function getAgentsHandler({ mastra }: Context
|
|
149
|
+
export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
|
|
150
|
+
runtimeContext: RuntimeContext;
|
|
151
|
+
}): Promise<any>;
|
|
139
152
|
|
|
140
153
|
declare type GetBody<T extends keyof Agent & {
|
|
141
154
|
[K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
|
|
@@ -143,7 +156,8 @@ declare type GetBody<T extends keyof Agent & {
|
|
|
143
156
|
messages: Parameters<Agent[T]>[0];
|
|
144
157
|
} & Parameters<Agent[T]>[1];
|
|
145
158
|
|
|
146
|
-
export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
|
|
159
|
+
export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
160
|
+
runtimeContext: RuntimeContext;
|
|
147
161
|
agentId: string;
|
|
148
162
|
}): Promise<{
|
|
149
163
|
id: string;
|
|
@@ -152,7 +166,8 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
|
|
|
152
166
|
evals: EvalRow[];
|
|
153
167
|
}>;
|
|
154
168
|
|
|
155
|
-
export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
|
|
169
|
+
export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
|
|
170
|
+
runtimeContext: RuntimeContext;
|
|
156
171
|
agentId: string;
|
|
157
172
|
}): Promise<{
|
|
158
173
|
id: string;
|
|
@@ -178,7 +193,7 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<
|
|
|
178
193
|
uiMessages: Message[];
|
|
179
194
|
}>;
|
|
180
195
|
|
|
181
|
-
export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
|
|
196
|
+
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
182
197
|
id: string;
|
|
183
198
|
name: string;
|
|
184
199
|
instructions: string;
|
|
@@ -193,7 +208,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
|
|
|
193
208
|
};
|
|
194
209
|
}>;
|
|
195
210
|
|
|
196
|
-
export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
|
|
211
|
+
export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
|
|
197
212
|
id: string;
|
|
198
213
|
name: string;
|
|
199
214
|
instructions: string;
|
|
@@ -225,6 +240,26 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
|
|
|
225
240
|
|
|
226
241
|
export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
|
|
227
242
|
|
|
243
|
+
export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
|
|
244
|
+
steps: any;
|
|
245
|
+
name: string | undefined;
|
|
246
|
+
stepGraph: SerializedStepFlowEntry[];
|
|
247
|
+
inputSchema: string | undefined;
|
|
248
|
+
outputSchema: string | undefined;
|
|
249
|
+
}>;
|
|
250
|
+
|
|
251
|
+
export declare function getVNextWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRunById']>>;
|
|
252
|
+
|
|
253
|
+
export declare function getVNextWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: VNextWorkflowContext & {
|
|
254
|
+
fromDate?: Date;
|
|
255
|
+
toDate?: Date;
|
|
256
|
+
limit?: number;
|
|
257
|
+
offset?: number;
|
|
258
|
+
resourceId?: string;
|
|
259
|
+
}): Promise<WorkflowRuns>;
|
|
260
|
+
|
|
261
|
+
export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
|
|
262
|
+
|
|
228
263
|
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
|
|
229
264
|
stepGraph: StepGraph;
|
|
230
265
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
@@ -237,7 +272,13 @@ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowC
|
|
|
237
272
|
|
|
238
273
|
export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
|
|
239
274
|
|
|
240
|
-
export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext
|
|
275
|
+
export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
|
|
276
|
+
fromDate?: Date;
|
|
277
|
+
toDate?: Date;
|
|
278
|
+
limit?: number;
|
|
279
|
+
offset?: number;
|
|
280
|
+
resourceId?: string;
|
|
281
|
+
}): Promise<WorkflowRuns>;
|
|
241
282
|
|
|
242
283
|
export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
|
|
243
284
|
|
|
@@ -350,6 +391,7 @@ export declare namespace network {
|
|
|
350
391
|
|
|
351
392
|
declare interface NetworkContext extends Context {
|
|
352
393
|
networkId?: string;
|
|
394
|
+
runtimeContext: RuntimeContext;
|
|
353
395
|
}
|
|
354
396
|
|
|
355
397
|
declare interface QueryRequest {
|
|
@@ -366,20 +408,38 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
|
|
|
366
408
|
|
|
367
409
|
declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
|
|
368
410
|
|
|
369
|
-
export declare function
|
|
411
|
+
export declare function resumeAsyncVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
|
|
412
|
+
body: {
|
|
413
|
+
step: string | string[];
|
|
414
|
+
resumeData?: unknown;
|
|
415
|
+
};
|
|
416
|
+
runtimeContext?: RuntimeContext_2;
|
|
417
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
|
|
418
|
+
|
|
419
|
+
export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
370
420
|
body: {
|
|
371
421
|
stepId: string;
|
|
372
422
|
context: any;
|
|
373
423
|
};
|
|
374
|
-
|
|
424
|
+
runtimeContext: RuntimeContext;
|
|
375
425
|
}): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
|
|
376
426
|
|
|
377
|
-
export declare function
|
|
427
|
+
export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
|
|
428
|
+
body: {
|
|
429
|
+
step: string | string[];
|
|
430
|
+
resumeData?: unknown;
|
|
431
|
+
};
|
|
432
|
+
runtimeContext?: RuntimeContext_2;
|
|
433
|
+
}): Promise<{
|
|
434
|
+
message: string;
|
|
435
|
+
}>;
|
|
436
|
+
|
|
437
|
+
export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
378
438
|
body: {
|
|
379
439
|
stepId: string;
|
|
380
440
|
context: any;
|
|
381
441
|
};
|
|
382
|
-
|
|
442
|
+
runtimeContext: RuntimeContext;
|
|
383
443
|
}): Promise<{
|
|
384
444
|
message: string;
|
|
385
445
|
}>;
|
|
@@ -392,14 +452,26 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
392
452
|
|
|
393
453
|
declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
394
454
|
|
|
395
|
-
export declare function
|
|
455
|
+
export declare function startAsyncVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
456
|
+
inputData?: unknown;
|
|
457
|
+
runtimeContext?: RuntimeContext_2;
|
|
458
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
|
|
459
|
+
|
|
460
|
+
export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
396
461
|
triggerData?: unknown;
|
|
397
|
-
|
|
462
|
+
runtimeContext: RuntimeContext;
|
|
398
463
|
}): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
|
|
399
464
|
|
|
400
|
-
export declare function
|
|
465
|
+
export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
466
|
+
inputData?: unknown;
|
|
467
|
+
runtimeContext?: RuntimeContext_2;
|
|
468
|
+
}): Promise<{
|
|
469
|
+
message: string;
|
|
470
|
+
}>;
|
|
471
|
+
|
|
472
|
+
export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
401
473
|
triggerData?: unknown;
|
|
402
|
-
|
|
474
|
+
runtimeContext: RuntimeContext;
|
|
403
475
|
}): Promise<{
|
|
404
476
|
message: string;
|
|
405
477
|
}>;
|
|
@@ -423,16 +495,17 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
|
|
|
423
495
|
traceCount: number;
|
|
424
496
|
}>;
|
|
425
497
|
|
|
426
|
-
export declare function streamGenerateHandler({ mastra,
|
|
427
|
-
|
|
498
|
+
export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
499
|
+
runtimeContext: RuntimeContext;
|
|
428
500
|
agentId: string;
|
|
429
501
|
body: GetBody<'stream'> & {
|
|
430
502
|
resourceid?: string;
|
|
503
|
+
runtimeContext?: string;
|
|
431
504
|
};
|
|
432
505
|
}): Promise<Response | undefined>;
|
|
433
506
|
|
|
434
|
-
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
|
|
435
|
-
|
|
507
|
+
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
|
|
508
|
+
runtimeContext: RuntimeContext;
|
|
436
509
|
body: {
|
|
437
510
|
messages?: Parameters<AgentNetwork['stream']>[0];
|
|
438
511
|
} & Parameters<AgentNetwork['stream']>[1];
|
|
@@ -454,6 +527,8 @@ declare interface TelemetryContext extends Context {
|
|
|
454
527
|
page?: number;
|
|
455
528
|
perPage?: number;
|
|
456
529
|
attribute?: string | string[];
|
|
530
|
+
fromDate?: Date;
|
|
531
|
+
toDate?: Date;
|
|
457
532
|
};
|
|
458
533
|
}
|
|
459
534
|
|
|
@@ -536,6 +611,26 @@ declare interface VectorContext extends Context {
|
|
|
536
611
|
vectorName?: string;
|
|
537
612
|
}
|
|
538
613
|
|
|
614
|
+
declare interface VNextWorkflowContext extends Context {
|
|
615
|
+
workflowId?: string;
|
|
616
|
+
runId?: string;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
export declare namespace vNextWorkflows {
|
|
620
|
+
export {
|
|
621
|
+
getVNextWorkflowsHandler,
|
|
622
|
+
getVNextWorkflowByIdHandler,
|
|
623
|
+
getVNextWorkflowRunByIdHandler,
|
|
624
|
+
createVNextWorkflowRunHandler,
|
|
625
|
+
startAsyncVNextWorkflowHandler,
|
|
626
|
+
startVNextWorkflowRunHandler,
|
|
627
|
+
watchVNextWorkflowHandler,
|
|
628
|
+
resumeAsyncVNextWorkflowHandler,
|
|
629
|
+
resumeVNextWorkflowHandler,
|
|
630
|
+
getVNextWorkflowRunsHandler
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
539
634
|
export declare namespace voice {
|
|
540
635
|
export {
|
|
541
636
|
getSpeakersHandler,
|
|
@@ -548,6 +643,8 @@ declare interface VoiceContext extends Context {
|
|
|
548
643
|
agentId?: string;
|
|
549
644
|
}
|
|
550
645
|
|
|
646
|
+
export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
647
|
+
|
|
551
648
|
export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
552
649
|
|
|
553
650
|
declare interface WorkflowContext extends Context {
|