@mastra/server 0.0.0-mcp-server-update-parse-20250421171139 → 0.0.0-mcp-server-deploy-20250507160341
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/dist/_tsup-dts-rollup.d.cts +217 -42
- package/dist/_tsup-dts-rollup.d.ts +217 -42
- package/dist/{chunk-4B7OUZXW.js → chunk-3XTEV33Q.js} +25 -13
- package/dist/{chunk-4WJ5GHRG.cjs → chunk-4BIX6GMY.cjs} +56 -31
- package/dist/{chunk-A7DF4ETD.cjs → chunk-55HTWX4C.cjs} +2 -9
- package/dist/{chunk-XISBMH56.js → chunk-5JNVY6DU.js} +4 -4
- package/dist/{chunk-JLDXUWK7.cjs → chunk-5YGDYMRB.cjs} +52 -31
- package/dist/chunk-74DLDQTQ.cjs +36 -0
- package/dist/{chunk-7IWQE76Z.cjs → chunk-AMVOS7YB.cjs} +4 -2
- package/dist/{chunk-WTHDCRMY.js → chunk-BPL2CBLV.js} +4 -2
- package/dist/{chunk-RNU4JMLM.cjs → chunk-CHFORQ7J.cjs} +25 -13
- package/dist/{chunk-HABV7TZK.cjs → chunk-D3G23FP3.cjs} +4 -4
- package/dist/chunk-FOXHTOQZ.cjs +324 -0
- package/dist/chunk-HAA5T7JL.js +33 -0
- package/dist/chunk-IQTNZSFP.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/{chunk-TFFNX7FI.js → chunk-Y3SV5XK4.js} +56 -31
- package/dist/index.cjs +12 -0
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/mcp.cjs +14 -0
- package/dist/server/handlers/mcp.d.cts +2 -0
- package/dist/server/handlers/mcp.d.ts +2 -0
- package/dist/server/handlers/mcp.js +1 -0
- 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 +20 -15
- 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 +5 -5
|
@@ -1,27 +1,35 @@
|
|
|
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
|
-
import { EvalRow } from '@mastra/core
|
|
5
|
+
import { EvalRow } from '@mastra/core';
|
|
7
6
|
import { GenerateObjectResult } from 'ai';
|
|
8
7
|
import { GenerateTextResult } from 'ai';
|
|
9
|
-
import type { Mastra } from '@mastra/core
|
|
8
|
+
import type { Mastra } from '@mastra/core';
|
|
9
|
+
import type { Mastra as Mastra_2 } from '@mastra/core/mastra';
|
|
10
10
|
import type { MastraMemory } from '@mastra/core/memory';
|
|
11
11
|
import { Message } from 'ai';
|
|
12
|
-
import { MessageType } from '@mastra/core
|
|
12
|
+
import { MessageType } from '@mastra/core';
|
|
13
|
+
import { NewStep } from '@mastra/core/workflows/vNext';
|
|
14
|
+
import type { NewWorkflow } from '@mastra/core/workflows/vNext';
|
|
13
15
|
import type { QueryResult } from '@mastra/core/vector';
|
|
14
16
|
import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
18
|
+
import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
|
|
19
|
+
import { SerializedStepFlowEntry } from '@mastra/core/workflows/vNext';
|
|
20
|
+
import { Step } from '@mastra/core';
|
|
21
|
+
import { StepExecutionContext } from '@mastra/core';
|
|
22
|
+
import { StepGraph } from '@mastra/core';
|
|
23
|
+
import { StorageThreadType } from '@mastra/core';
|
|
19
24
|
import type { ToolAction } from '@mastra/core/tools';
|
|
20
25
|
import type { VercelTool } from '@mastra/core/tools';
|
|
21
26
|
import type { Workflow } from '@mastra/core/workflows';
|
|
22
|
-
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core
|
|
23
|
-
import {
|
|
27
|
+
import { WorkflowContext as WorkflowContext_2 } from '@mastra/core';
|
|
28
|
+
import { WorkflowResult } from '@mastra/core/workflows/vNext';
|
|
29
|
+
import { WorkflowRunResult } from '@mastra/core';
|
|
24
30
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
31
|
+
import { ZodType } from 'zod';
|
|
32
|
+
import { ZodTypeDef } from 'zod';
|
|
25
33
|
|
|
26
34
|
export declare namespace agents {
|
|
27
35
|
export {
|
|
@@ -42,7 +50,7 @@ export declare interface ApiError extends Error {
|
|
|
42
50
|
declare type ClientErrorStatusCode = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451;
|
|
43
51
|
|
|
44
52
|
export declare interface Context {
|
|
45
|
-
mastra:
|
|
53
|
+
mastra: Mastra_2;
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
@@ -67,6 +75,10 @@ export declare function createThreadHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
67
75
|
};
|
|
68
76
|
}): Promise<StorageThreadType>;
|
|
69
77
|
|
|
78
|
+
export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
|
|
79
|
+
runId: string;
|
|
80
|
+
}>;
|
|
81
|
+
|
|
70
82
|
export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
|
|
71
83
|
indexName?: string;
|
|
72
84
|
}): Promise<{
|
|
@@ -87,27 +99,27 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
|
|
|
87
99
|
metric: string | undefined;
|
|
88
100
|
}>;
|
|
89
101
|
|
|
90
|
-
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data,
|
|
102
|
+
export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
|
|
91
103
|
agentId?: string;
|
|
92
104
|
data: any;
|
|
93
|
-
|
|
105
|
+
runtimeContext: RuntimeContext;
|
|
94
106
|
}): Promise<any>;
|
|
95
107
|
|
|
96
|
-
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data,
|
|
108
|
+
export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
|
|
97
109
|
data?: unknown;
|
|
98
|
-
|
|
110
|
+
runtimeContext: RuntimeContext;
|
|
99
111
|
}) => Promise<any>;
|
|
100
112
|
|
|
101
|
-
export declare function generateHandler({ mastra,
|
|
102
|
-
|
|
113
|
+
export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
114
|
+
runtimeContext: RuntimeContext;
|
|
103
115
|
agentId: string;
|
|
104
116
|
body: GetBody<'generate'> & {
|
|
105
117
|
resourceid?: string;
|
|
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;
|
|
@@ -169,6 +184,85 @@ export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>
|
|
|
169
184
|
transports: string[];
|
|
170
185
|
}>;
|
|
171
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Handler for GET /api/mcp/servers/:serverId
|
|
189
|
+
* Returns details about a specific MCP server
|
|
190
|
+
*/
|
|
191
|
+
declare const getMcpServerHandler: ({ mastra, serverId }: {
|
|
192
|
+
mastra: Mastra;
|
|
193
|
+
serverId: string;
|
|
194
|
+
}) => Promise<{
|
|
195
|
+
id: string;
|
|
196
|
+
name: string;
|
|
197
|
+
version: string;
|
|
198
|
+
tools: {
|
|
199
|
+
name: string;
|
|
200
|
+
description: any;
|
|
201
|
+
parameters: any;
|
|
202
|
+
}[];
|
|
203
|
+
}>;
|
|
204
|
+
export { getMcpServerHandler }
|
|
205
|
+
export { getMcpServerHandler as getMcpServerHandler_alias_2 }
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Handler for GET /api/mcp/servers/:serverId
|
|
209
|
+
* Returns details about a specific MCP server
|
|
210
|
+
*/
|
|
211
|
+
export declare const getMcpServerHandler_alias_1: ({ mastra, serverId }: {
|
|
212
|
+
mastra: Mastra;
|
|
213
|
+
serverId: string;
|
|
214
|
+
}) => Promise<{
|
|
215
|
+
error: string;
|
|
216
|
+
status: number;
|
|
217
|
+
id?: undefined;
|
|
218
|
+
name?: undefined;
|
|
219
|
+
version?: undefined;
|
|
220
|
+
tools?: undefined;
|
|
221
|
+
} | {
|
|
222
|
+
id: string;
|
|
223
|
+
name: string;
|
|
224
|
+
version: string;
|
|
225
|
+
tools: {
|
|
226
|
+
name: string;
|
|
227
|
+
description: string | undefined;
|
|
228
|
+
inputSchema: string | undefined;
|
|
229
|
+
}[];
|
|
230
|
+
error?: undefined;
|
|
231
|
+
status?: undefined;
|
|
232
|
+
}>;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Handler for GET /api/mcp/servers
|
|
236
|
+
* Lists all MCP servers registered on the Mastra instance
|
|
237
|
+
*/
|
|
238
|
+
declare const getMcpServersHandler: ({ mastra }: {
|
|
239
|
+
mastra: Mastra;
|
|
240
|
+
}) => Promise<{
|
|
241
|
+
servers: {
|
|
242
|
+
id: string;
|
|
243
|
+
name: string;
|
|
244
|
+
version: string;
|
|
245
|
+
tools: number;
|
|
246
|
+
}[];
|
|
247
|
+
}>;
|
|
248
|
+
export { getMcpServersHandler }
|
|
249
|
+
export { getMcpServersHandler as getMcpServersHandler_alias_2 }
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Handler for GET /api/mcp/servers
|
|
253
|
+
* Lists all MCP servers registered on the Mastra instance
|
|
254
|
+
*/
|
|
255
|
+
export declare const getMcpServersHandler_alias_1: ({ mastra }: {
|
|
256
|
+
mastra: Mastra;
|
|
257
|
+
}) => Promise<{
|
|
258
|
+
servers: {
|
|
259
|
+
id: string;
|
|
260
|
+
name: string;
|
|
261
|
+
version: string;
|
|
262
|
+
tools: number;
|
|
263
|
+
}[];
|
|
264
|
+
}>;
|
|
265
|
+
|
|
172
266
|
export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryContext, 'mastra' | 'agentId'>): Promise<{
|
|
173
267
|
result: boolean;
|
|
174
268
|
}>;
|
|
@@ -178,7 +272,7 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<
|
|
|
178
272
|
uiMessages: Message[];
|
|
179
273
|
}>;
|
|
180
274
|
|
|
181
|
-
export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
|
|
275
|
+
export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
|
|
182
276
|
id: string;
|
|
183
277
|
name: string;
|
|
184
278
|
instructions: string;
|
|
@@ -193,7 +287,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
|
|
|
193
287
|
};
|
|
194
288
|
}>;
|
|
195
289
|
|
|
196
|
-
export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
|
|
290
|
+
export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
|
|
197
291
|
id: string;
|
|
198
292
|
name: string;
|
|
199
293
|
instructions: string;
|
|
@@ -225,6 +319,26 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
|
|
|
225
319
|
|
|
226
320
|
export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
|
|
227
321
|
|
|
322
|
+
export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
|
|
323
|
+
steps: any;
|
|
324
|
+
name: string | undefined;
|
|
325
|
+
stepGraph: SerializedStepFlowEntry[];
|
|
326
|
+
inputSchema: string | undefined;
|
|
327
|
+
outputSchema: string | undefined;
|
|
328
|
+
}>;
|
|
329
|
+
|
|
330
|
+
export declare function getVNextWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRun']>>;
|
|
331
|
+
|
|
332
|
+
export declare function getVNextWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: VNextWorkflowContext & {
|
|
333
|
+
fromDate?: Date;
|
|
334
|
+
toDate?: Date;
|
|
335
|
+
limit?: number;
|
|
336
|
+
offset?: number;
|
|
337
|
+
resourceId?: string;
|
|
338
|
+
}): Promise<WorkflowRuns>;
|
|
339
|
+
|
|
340
|
+
export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
|
|
341
|
+
|
|
228
342
|
export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
|
|
229
343
|
stepGraph: StepGraph;
|
|
230
344
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
@@ -237,7 +351,13 @@ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowC
|
|
|
237
351
|
|
|
238
352
|
export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
|
|
239
353
|
|
|
240
|
-
export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext
|
|
354
|
+
export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
|
|
355
|
+
fromDate?: Date;
|
|
356
|
+
toDate?: Date;
|
|
357
|
+
limit?: number;
|
|
358
|
+
offset?: number;
|
|
359
|
+
resourceId?: string;
|
|
360
|
+
}): Promise<WorkflowRuns>;
|
|
241
361
|
|
|
242
362
|
export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
|
|
243
363
|
|
|
@@ -315,7 +435,7 @@ export declare namespace logs {
|
|
|
315
435
|
}
|
|
316
436
|
|
|
317
437
|
declare type LogsContext = {
|
|
318
|
-
mastra:
|
|
438
|
+
mastra: Mastra_2;
|
|
319
439
|
transportId?: string;
|
|
320
440
|
runId?: string;
|
|
321
441
|
};
|
|
@@ -350,6 +470,7 @@ export declare namespace network {
|
|
|
350
470
|
|
|
351
471
|
declare interface NetworkContext extends Context {
|
|
352
472
|
networkId?: string;
|
|
473
|
+
runtimeContext: RuntimeContext;
|
|
353
474
|
}
|
|
354
475
|
|
|
355
476
|
declare interface QueryRequest {
|
|
@@ -366,20 +487,38 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
|
|
|
366
487
|
|
|
367
488
|
declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
|
|
368
489
|
|
|
369
|
-
export declare function
|
|
490
|
+
export declare function resumeAsyncVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
|
|
491
|
+
body: {
|
|
492
|
+
step: string | string[];
|
|
493
|
+
resumeData?: unknown;
|
|
494
|
+
};
|
|
495
|
+
runtimeContext?: RuntimeContext_2;
|
|
496
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
|
|
497
|
+
|
|
498
|
+
export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
370
499
|
body: {
|
|
371
500
|
stepId: string;
|
|
372
501
|
context: any;
|
|
373
502
|
};
|
|
374
|
-
|
|
503
|
+
runtimeContext: RuntimeContext;
|
|
375
504
|
}): 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
505
|
|
|
377
|
-
export declare function
|
|
506
|
+
export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
|
|
507
|
+
body: {
|
|
508
|
+
step: string | string[];
|
|
509
|
+
resumeData?: unknown;
|
|
510
|
+
};
|
|
511
|
+
runtimeContext?: RuntimeContext_2;
|
|
512
|
+
}): Promise<{
|
|
513
|
+
message: string;
|
|
514
|
+
}>;
|
|
515
|
+
|
|
516
|
+
export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
|
|
378
517
|
body: {
|
|
379
518
|
stepId: string;
|
|
380
519
|
context: any;
|
|
381
520
|
};
|
|
382
|
-
|
|
521
|
+
runtimeContext: RuntimeContext;
|
|
383
522
|
}): Promise<{
|
|
384
523
|
message: string;
|
|
385
524
|
}>;
|
|
@@ -392,14 +531,26 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
|
|
|
392
531
|
|
|
393
532
|
declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
|
|
394
533
|
|
|
395
|
-
export declare function
|
|
534
|
+
export declare function startAsyncVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
535
|
+
inputData?: unknown;
|
|
536
|
+
runtimeContext?: RuntimeContext_2;
|
|
537
|
+
}): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
|
|
538
|
+
|
|
539
|
+
export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
396
540
|
triggerData?: unknown;
|
|
397
|
-
|
|
541
|
+
runtimeContext: RuntimeContext;
|
|
398
542
|
}): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
|
|
399
543
|
|
|
400
|
-
export declare function
|
|
544
|
+
export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
545
|
+
inputData?: unknown;
|
|
546
|
+
runtimeContext?: RuntimeContext_2;
|
|
547
|
+
}): Promise<{
|
|
548
|
+
message: string;
|
|
549
|
+
}>;
|
|
550
|
+
|
|
551
|
+
export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
|
|
401
552
|
triggerData?: unknown;
|
|
402
|
-
|
|
553
|
+
runtimeContext: RuntimeContext;
|
|
403
554
|
}): Promise<{
|
|
404
555
|
message: string;
|
|
405
556
|
}>;
|
|
@@ -423,16 +574,16 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
|
|
|
423
574
|
traceCount: number;
|
|
424
575
|
}>;
|
|
425
576
|
|
|
426
|
-
export declare function streamGenerateHandler({ mastra,
|
|
427
|
-
|
|
577
|
+
export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
|
|
578
|
+
runtimeContext: RuntimeContext;
|
|
428
579
|
agentId: string;
|
|
429
580
|
body: GetBody<'stream'> & {
|
|
430
581
|
resourceid?: string;
|
|
431
582
|
};
|
|
432
583
|
}): Promise<Response | undefined>;
|
|
433
584
|
|
|
434
|
-
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
|
|
435
|
-
|
|
585
|
+
export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
|
|
586
|
+
runtimeContext: RuntimeContext;
|
|
436
587
|
body: {
|
|
437
588
|
messages?: Parameters<AgentNetwork['stream']>[0];
|
|
438
589
|
} & Parameters<AgentNetwork['stream']>[1];
|
|
@@ -454,6 +605,8 @@ declare interface TelemetryContext extends Context {
|
|
|
454
605
|
page?: number;
|
|
455
606
|
perPage?: number;
|
|
456
607
|
attribute?: string | string[];
|
|
608
|
+
fromDate?: Date;
|
|
609
|
+
toDate?: Date;
|
|
457
610
|
};
|
|
458
611
|
}
|
|
459
612
|
|
|
@@ -536,6 +689,26 @@ declare interface VectorContext extends Context {
|
|
|
536
689
|
vectorName?: string;
|
|
537
690
|
}
|
|
538
691
|
|
|
692
|
+
declare interface VNextWorkflowContext extends Context {
|
|
693
|
+
workflowId?: string;
|
|
694
|
+
runId?: string;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
export declare namespace vNextWorkflows {
|
|
698
|
+
export {
|
|
699
|
+
getVNextWorkflowsHandler,
|
|
700
|
+
getVNextWorkflowByIdHandler,
|
|
701
|
+
getVNextWorkflowRunHandler,
|
|
702
|
+
createVNextWorkflowRunHandler,
|
|
703
|
+
startAsyncVNextWorkflowHandler,
|
|
704
|
+
startVNextWorkflowRunHandler,
|
|
705
|
+
watchVNextWorkflowHandler,
|
|
706
|
+
resumeAsyncVNextWorkflowHandler,
|
|
707
|
+
resumeVNextWorkflowHandler,
|
|
708
|
+
getVNextWorkflowRunsHandler
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
539
712
|
export declare namespace voice {
|
|
540
713
|
export {
|
|
541
714
|
getSpeakersHandler,
|
|
@@ -548,6 +721,8 @@ declare interface VoiceContext extends Context {
|
|
|
548
721
|
agentId?: string;
|
|
549
722
|
}
|
|
550
723
|
|
|
724
|
+
export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
725
|
+
|
|
551
726
|
export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
|
|
552
727
|
|
|
553
728
|
declare interface WorkflowContext extends Context {
|
|
@@ -32,7 +32,9 @@ async function getWorkflowsHandler({ mastra }) {
|
|
|
32
32
|
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
33
33
|
const _step = step;
|
|
34
34
|
acc2[key2] = {
|
|
35
|
-
|
|
35
|
+
id: _step.id,
|
|
36
|
+
description: _step.description,
|
|
37
|
+
workflowId: _step.workflowId,
|
|
36
38
|
inputSchema: _step.inputSchema ? stringify(esm_default(_step.inputSchema)) : void 0,
|
|
37
39
|
outputSchema: _step.outputSchema ? stringify(esm_default(_step.outputSchema)) : void 0
|
|
38
40
|
};
|
|
@@ -65,7 +67,9 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
65
67
|
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
66
68
|
const _step = step;
|
|
67
69
|
acc[key] = {
|
|
68
|
-
|
|
70
|
+
id: _step.id,
|
|
71
|
+
description: _step.description,
|
|
72
|
+
workflowId: _step.workflowId,
|
|
69
73
|
inputSchema: _step.inputSchema ? stringify(esm_default(_step.inputSchema)) : void 0,
|
|
70
74
|
outputSchema: _step.outputSchema ? stringify(esm_default(_step.outputSchema)) : void 0
|
|
71
75
|
};
|
|
@@ -78,7 +82,7 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
78
82
|
}
|
|
79
83
|
async function startAsyncWorkflowHandler({
|
|
80
84
|
mastra,
|
|
81
|
-
|
|
85
|
+
runtimeContext,
|
|
82
86
|
workflowId,
|
|
83
87
|
runId,
|
|
84
88
|
triggerData
|
|
@@ -95,7 +99,7 @@ async function startAsyncWorkflowHandler({
|
|
|
95
99
|
const { start } = workflow.createRun();
|
|
96
100
|
const result2 = await start({
|
|
97
101
|
triggerData,
|
|
98
|
-
|
|
102
|
+
runtimeContext
|
|
99
103
|
});
|
|
100
104
|
return result2;
|
|
101
105
|
}
|
|
@@ -105,7 +109,7 @@ async function startAsyncWorkflowHandler({
|
|
|
105
109
|
}
|
|
106
110
|
const result = await run.start({
|
|
107
111
|
triggerData,
|
|
108
|
-
|
|
112
|
+
runtimeContext
|
|
109
113
|
});
|
|
110
114
|
return result;
|
|
111
115
|
} catch (error) {
|
|
@@ -158,7 +162,7 @@ async function createRunHandler({
|
|
|
158
162
|
}
|
|
159
163
|
async function startWorkflowRunHandler({
|
|
160
164
|
mastra,
|
|
161
|
-
|
|
165
|
+
runtimeContext,
|
|
162
166
|
workflowId,
|
|
163
167
|
runId,
|
|
164
168
|
triggerData
|
|
@@ -177,7 +181,7 @@ async function startWorkflowRunHandler({
|
|
|
177
181
|
}
|
|
178
182
|
await run.start({
|
|
179
183
|
triggerData,
|
|
180
|
-
|
|
184
|
+
runtimeContext
|
|
181
185
|
});
|
|
182
186
|
return { message: "Workflow run started" };
|
|
183
187
|
} catch (e) {
|
|
@@ -233,7 +237,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
233
237
|
workflowId,
|
|
234
238
|
runId,
|
|
235
239
|
body,
|
|
236
|
-
|
|
240
|
+
runtimeContext
|
|
237
241
|
}) {
|
|
238
242
|
try {
|
|
239
243
|
if (!workflowId) {
|
|
@@ -250,7 +254,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
250
254
|
const result = await run.resume({
|
|
251
255
|
stepId: body.stepId,
|
|
252
256
|
context: body.context,
|
|
253
|
-
|
|
257
|
+
runtimeContext
|
|
254
258
|
});
|
|
255
259
|
return result;
|
|
256
260
|
} catch (error) {
|
|
@@ -262,7 +266,7 @@ async function resumeWorkflowHandler({
|
|
|
262
266
|
workflowId,
|
|
263
267
|
runId,
|
|
264
268
|
body,
|
|
265
|
-
|
|
269
|
+
runtimeContext
|
|
266
270
|
}) {
|
|
267
271
|
try {
|
|
268
272
|
if (!workflowId) {
|
|
@@ -279,20 +283,28 @@ async function resumeWorkflowHandler({
|
|
|
279
283
|
await run.resume({
|
|
280
284
|
stepId: body.stepId,
|
|
281
285
|
context: body.context,
|
|
282
|
-
|
|
286
|
+
runtimeContext
|
|
283
287
|
});
|
|
284
288
|
return { message: "Workflow run resumed" };
|
|
285
289
|
} catch (error) {
|
|
286
290
|
return handleError(error, "Error resuming workflow");
|
|
287
291
|
}
|
|
288
292
|
}
|
|
289
|
-
async function getWorkflowRunsHandler({
|
|
293
|
+
async function getWorkflowRunsHandler({
|
|
294
|
+
mastra,
|
|
295
|
+
workflowId,
|
|
296
|
+
fromDate,
|
|
297
|
+
toDate,
|
|
298
|
+
limit,
|
|
299
|
+
offset,
|
|
300
|
+
resourceId
|
|
301
|
+
}) {
|
|
290
302
|
try {
|
|
291
303
|
if (!workflowId) {
|
|
292
304
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
293
305
|
}
|
|
294
306
|
const workflow = mastra.getWorkflow(workflowId);
|
|
295
|
-
const workflowRuns = await workflow.getWorkflowRuns() || {
|
|
307
|
+
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
296
308
|
runs: [],
|
|
297
309
|
total: 0
|
|
298
310
|
};
|