@mastra/server 0.0.0-mcp-server-deploy-20250507160341 → 0.0.0-pass-headers-for-create-mastra-client-20250529190531

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 (90) hide show
  1. package/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +268 -186
  3. package/dist/_tsup-dts-rollup.d.ts +268 -186
  4. package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
  5. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  6. package/dist/chunk-5SN4U5AC.cjs +508 -0
  7. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  8. package/dist/chunk-75ZPJI57.cjs +9 -0
  9. package/dist/{chunk-4BIX6GMY.cjs → chunk-A3KDUGS7.cjs} +78 -28
  10. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  11. package/dist/{chunk-QJ3AHN64.js → chunk-C7564HUT.js} +4 -3
  12. package/dist/{chunk-RBQASTUP.js → chunk-DJJIUEL2.js} +13 -5
  13. package/dist/{chunk-3EJZQ6TQ.js → chunk-DQLE3DVM.js} +5 -5
  14. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  15. package/dist/{chunk-Q6SHQECN.js → chunk-HFWCEP5S.js} +4 -3
  16. package/dist/{chunk-Y3SV5XK4.js → chunk-J3PKLB3A.js} +60 -10
  17. package/dist/{chunk-IQTNZSFP.js → chunk-KUNQFY2W.js} +103 -50
  18. package/dist/chunk-LIVAK2DM.js +2001 -0
  19. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  20. package/dist/{chunk-AMVOS7YB.cjs → chunk-MHKNLNAN.cjs} +9 -8
  21. package/dist/chunk-MLKGABMK.js +7 -0
  22. package/dist/chunk-MMO2HDM6.cjs +378 -0
  23. package/dist/{chunk-SKBVVI24.cjs → chunk-NEOOQUKW.cjs} +11 -11
  24. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  25. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  26. package/dist/{chunk-BPL2CBLV.js → chunk-OR3CIE2H.js} +3 -2
  27. package/dist/chunk-P6SCPDYW.js +500 -0
  28. package/dist/{chunk-5JNVY6DU.js → chunk-TJKLBTFB.js} +20 -8
  29. package/dist/{chunk-5YGDYMRB.cjs → chunk-VPNDC2DI.cjs} +14 -13
  30. package/dist/{chunk-3XTEV33Q.js → chunk-W7VCKPAD.js} +53 -50
  31. package/dist/{chunk-2FJURXCL.cjs → chunk-Y7UWRW5X.cjs} +43 -35
  32. package/dist/{chunk-55HTWX4C.cjs → chunk-YBVOQN4M.cjs} +20 -19
  33. package/dist/chunk-YIOVBYZH.cjs +332 -0
  34. package/dist/chunk-YWLUOY3D.cjs +2004 -0
  35. package/dist/{chunk-D3G23FP3.cjs → chunk-ZE5AAC4I.cjs} +37 -25
  36. package/dist/index.cjs +0 -12
  37. package/dist/index.d.cts +1 -2
  38. package/dist/index.d.ts +1 -2
  39. package/dist/index.js +1 -1
  40. package/dist/server/handlers/a2a.cjs +30 -0
  41. package/dist/server/handlers/a2a.d.cts +6 -0
  42. package/dist/server/handlers/a2a.d.ts +6 -0
  43. package/dist/server/handlers/a2a.js +1 -0
  44. package/dist/server/handlers/agents.cjs +7 -7
  45. package/dist/server/handlers/agents.js +1 -1
  46. package/dist/server/handlers/error.cjs +2 -2
  47. package/dist/server/handlers/error.js +1 -1
  48. package/dist/server/handlers/legacyWorkflows.cjs +46 -0
  49. package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
  50. package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
  51. package/dist/server/handlers/legacyWorkflows.js +1 -0
  52. package/dist/server/handlers/logs.cjs +4 -4
  53. package/dist/server/handlers/logs.js +1 -1
  54. package/dist/server/handlers/memory.cjs +9 -9
  55. package/dist/server/handlers/memory.js +1 -1
  56. package/dist/server/handlers/network.cjs +5 -5
  57. package/dist/server/handlers/network.js +1 -1
  58. package/dist/server/handlers/telemetry.cjs +3 -3
  59. package/dist/server/handlers/telemetry.js +1 -1
  60. package/dist/server/handlers/tools.cjs +5 -5
  61. package/dist/server/handlers/tools.js +1 -1
  62. package/dist/server/handlers/utils.cjs +2 -2
  63. package/dist/server/handlers/utils.js +1 -1
  64. package/dist/server/handlers/vector.cjs +7 -7
  65. package/dist/server/handlers/vector.js +1 -1
  66. package/dist/server/handlers/voice.cjs +4 -4
  67. package/dist/server/handlers/voice.js +1 -1
  68. package/dist/server/handlers/workflows.cjs +17 -13
  69. package/dist/server/handlers/workflows.d.cts +3 -2
  70. package/dist/server/handlers/workflows.d.ts +3 -2
  71. package/dist/server/handlers/workflows.js +1 -1
  72. package/dist/server/handlers.cjs +31 -26
  73. package/dist/server/handlers.d.cts +2 -1
  74. package/dist/server/handlers.d.ts +2 -1
  75. package/dist/server/handlers.js +11 -10
  76. package/package.json +7 -5
  77. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  78. package/dist/chunk-74DLDQTQ.cjs +0 -36
  79. package/dist/chunk-CHFORQ7J.cjs +0 -329
  80. package/dist/chunk-FOXHTOQZ.cjs +0 -324
  81. package/dist/chunk-HAA5T7JL.js +0 -33
  82. package/dist/chunk-OMN3UI6X.js +0 -5576
  83. package/dist/server/handlers/mcp.cjs +0 -14
  84. package/dist/server/handlers/mcp.d.cts +0 -2
  85. package/dist/server/handlers/mcp.d.ts +0 -2
  86. package/dist/server/handlers/mcp.js +0 -1
  87. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  88. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  89. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  90. package/dist/server/handlers/vNextWorkflows.js +0 -1
@@ -1,36 +1,62 @@
1
1
  import type { Agent } from '@mastra/core/agent';
2
+ import type { AgentCard } from '@mastra/core/a2a';
2
3
  import type { AgentNetwork } from '@mastra/core/network';
4
+ import type { Artifact } from '@mastra/core/a2a';
3
5
  import type { BaseLogMessage } from '@mastra/core/logger';
4
- import { CoreMessage } from 'ai';
5
- import { EvalRow } from '@mastra/core';
6
+ import type { CoreMessage } from '@mastra/core/llm';
7
+ import { EvalRow } from '@mastra/core/storage';
6
8
  import { GenerateObjectResult } from 'ai';
7
9
  import { GenerateTextResult } from 'ai';
8
- import type { Mastra } from '@mastra/core';
9
- import type { Mastra as Mastra_2 } from '@mastra/core/mastra';
10
+ import type { IMastraLogger } from '@mastra/core/logger';
11
+ import type { JSONRPCError } from '@mastra/core/a2a';
12
+ import { JSONRPCResponse } from '@mastra/core/a2a';
13
+ import { LegacyStep } from '@mastra/core/workflows/legacy';
14
+ import type { LegacyWorkflow } from '@mastra/core/workflows/legacy';
15
+ import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
16
+ import type { LegacyWorkflowRuns } from '@mastra/core/storage';
17
+ import type { Mastra } from '@mastra/core/mastra';
10
18
  import type { MastraMemory } from '@mastra/core/memory';
11
- import { Message } from 'ai';
12
- import { MessageType } from '@mastra/core';
13
- import { NewStep } from '@mastra/core/workflows/vNext';
14
- import type { NewWorkflow } from '@mastra/core/workflows/vNext';
19
+ import { MastraMessageV1 } from '@mastra/core/memory';
20
+ import { MastraMessageV2 } from '@mastra/core/agent';
21
+ import type { Message } from '@mastra/core/a2a';
15
22
  import type { QueryResult } from '@mastra/core/vector';
16
23
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
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';
24
+ import { RuntimeContext } from '@mastra/core/runtime-context';
25
+ import { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
26
+ import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
27
+ import { Step } from '@mastra/core/workflows';
28
+ import { StepExecutionContext } from '@mastra/core/workflows/legacy';
29
+ import { StepGraph } from '@mastra/core/workflows/legacy';
30
+ import { StorageThreadType } from '@mastra/core/memory';
31
+ import { Task } from '@mastra/core/a2a';
32
+ import { TaskAndHistory } from '@mastra/core/a2a';
33
+ import type { TaskContext } from '@mastra/core/a2a';
34
+ import type { TaskIdParams } from '@mastra/core/a2a';
35
+ import type { TaskQueryParams } from '@mastra/core/a2a';
36
+ import type { TaskSendParams } from '@mastra/core/a2a';
37
+ import type { TaskStatus } from '@mastra/core/a2a';
24
38
  import type { ToolAction } from '@mastra/core/tools';
39
+ import { UIMessage } from 'ai';
25
40
  import type { VercelTool } from '@mastra/core/tools';
41
+ import { WatchEvent } from '@mastra/core/workflows';
26
42
  import type { Workflow } from '@mastra/core/workflows';
27
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core';
28
- import { WorkflowResult } from '@mastra/core/workflows/vNext';
29
- import { WorkflowRunResult } from '@mastra/core';
43
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
44
+ import { WorkflowResult } from '@mastra/core/workflows';
30
45
  import type { WorkflowRuns } from '@mastra/core/storage';
31
46
  import { ZodType } from 'zod';
32
47
  import { ZodTypeDef } from 'zod';
33
48
 
49
+ export declare namespace a2a {
50
+ export {
51
+ getAgentCardByIdHandler,
52
+ handleTaskSend,
53
+ handleTaskGet,
54
+ handleTaskSendSubscribe,
55
+ handleTaskCancel,
56
+ getAgentExecutionHandler
57
+ }
58
+ }
59
+
34
60
  export declare namespace agents {
35
61
  export {
36
62
  getAgentsHandler,
@@ -47,12 +73,18 @@ export declare interface ApiError extends Error {
47
73
  status?: number;
48
74
  }
49
75
 
76
+ export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
77
+
50
78
  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;
51
79
 
52
80
  export declare interface Context {
53
- mastra: Mastra_2;
81
+ mastra: Mastra;
54
82
  }
55
83
 
84
+ export declare function convertToCoreMessage(message: Message): CoreMessage;
85
+
86
+ export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
87
+
56
88
  export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
57
89
  index: CreateIndexRequest;
58
90
  }): Promise<{
@@ -65,17 +97,26 @@ declare interface CreateIndexRequest {
65
97
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
66
98
  }
67
99
 
68
- export declare function createRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
100
+ export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
69
101
  runId: string;
70
102
  }>;
71
103
 
104
+ export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
105
+
106
+ export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
107
+ task: Task;
108
+ userMessage: Message;
109
+ history: Message[];
110
+ activeCancellations: Set<string>;
111
+ }): TaskContext;
112
+
72
113
  export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
73
114
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
74
115
  resourceId?: string;
75
116
  };
76
117
  }): Promise<StorageThreadType>;
77
118
 
78
- export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
119
+ export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
79
120
  runId: string;
80
121
  }>;
81
122
 
@@ -99,15 +140,17 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
99
140
  metric: string | undefined;
100
141
  }>;
101
142
 
102
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
143
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
103
144
  agentId?: string;
104
145
  data: any;
105
- runtimeContext: RuntimeContext;
146
+ runtimeContext: RuntimeContext_2;
147
+ runtimeContextFromRequest: Record<string, unknown>;
106
148
  }): Promise<any>;
107
149
 
108
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
150
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
109
151
  data?: unknown;
110
- runtimeContext: RuntimeContext;
152
+ runtimeContext: RuntimeContext_2;
153
+ runtimeContextFromRequest: Record<string, unknown>;
111
154
  }) => Promise<any>;
112
155
 
113
156
  export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
@@ -115,6 +158,7 @@ export declare function generateHandler({ mastra, runtimeContext, agentId, body,
115
158
  agentId: string;
116
159
  body: GetBody<'generate'> & {
117
160
  resourceid?: string;
161
+ runtimeContext?: Record<string, unknown>;
118
162
  };
119
163
  }): Promise<GenerateTextResult<any, any>>;
120
164
 
@@ -142,10 +186,34 @@ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }
142
186
  name: any;
143
187
  instructions: string;
144
188
  tools: any;
189
+ workflows: {};
145
190
  provider: string;
146
191
  modelId: string;
192
+ defaultGenerateOptions: any;
193
+ defaultStreamOptions: any;
147
194
  }>;
148
195
 
196
+ export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
197
+ runtimeContext: RuntimeContext;
198
+ agentId: keyof ReturnType<typeof mastra.getAgents>;
199
+ executionUrl?: string;
200
+ version?: string;
201
+ provider?: {
202
+ organization: string;
203
+ url: string;
204
+ };
205
+ }): Promise<AgentCard>;
206
+
207
+ export declare function getAgentExecutionHandler({ requestId, mastra, agentId, runtimeContext, method, params, taskStore, logger, }: Context & {
208
+ requestId: string;
209
+ runtimeContext: RuntimeContext;
210
+ agentId: string;
211
+ method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
212
+ params: TaskSendParams | TaskQueryParams | TaskIdParams;
213
+ taskStore?: InMemoryTaskStore;
214
+ logger?: IMastraLogger;
215
+ }): Promise<any>;
216
+
149
217
  export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
150
218
  runtimeContext: RuntimeContext;
151
219
  }): Promise<any>;
@@ -166,6 +234,28 @@ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agent
166
234
  evals: EvalRow[];
167
235
  }>;
168
236
 
237
+ export declare function getLegacyWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
238
+ stepGraph: StepGraph;
239
+ stepSubscriberGraph: Record<string, StepGraph>;
240
+ serializedStepGraph: StepGraph;
241
+ serializedStepSubscriberGraph: Record<string, StepGraph>;
242
+ name: string;
243
+ triggerSchema: string | undefined;
244
+ steps: any;
245
+ }>;
246
+
247
+ export declare function getLegacyWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<LegacyWorkflow['getRun']>>;
248
+
249
+ export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
250
+ fromDate?: Date;
251
+ toDate?: Date;
252
+ limit?: number;
253
+ offset?: number;
254
+ resourceId?: string;
255
+ }): Promise<LegacyWorkflowRuns>;
256
+
257
+ export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
258
+
169
259
  export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
170
260
  runtimeContext: RuntimeContext;
171
261
  agentId: string;
@@ -176,7 +266,7 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, a
176
266
  evals: EvalRow[];
177
267
  }>;
178
268
 
179
- export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
269
+ export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<any[]>;
180
270
 
181
271
  export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
182
272
 
@@ -184,92 +274,15 @@ export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>
184
274
  transports: string[];
185
275
  }>;
186
276
 
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
-
266
277
  export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryContext, 'mastra' | 'agentId'>): Promise<{
267
278
  result: boolean;
268
279
  }>;
269
280
 
270
- export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
271
- messages: CoreMessage[];
272
- uiMessages: Message[];
281
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
282
+ limit?: number;
283
+ }): Promise<{
284
+ messages: MastraMessageV1[];
285
+ uiMessages: UIMessage[];
273
286
  }>;
274
287
 
275
288
  export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
@@ -319,17 +332,18 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
319
332
 
320
333
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
321
334
 
322
- export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
323
- steps: any;
335
+ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
336
+ steps: SerializedStep[];
324
337
  name: string | undefined;
338
+ description: string | undefined;
325
339
  stepGraph: SerializedStepFlowEntry[];
326
340
  inputSchema: string | undefined;
327
341
  outputSchema: string | undefined;
328
342
  }>;
329
343
 
330
- export declare function getVNextWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRun']>>;
344
+ export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
331
345
 
332
- export declare function getVNextWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: VNextWorkflowContext & {
346
+ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
333
347
  fromDate?: Date;
334
348
  toDate?: Date;
335
349
  limit?: number;
@@ -337,31 +351,51 @@ export declare function getVNextWorkflowRunsHandler({ mastra, workflowId, fromDa
337
351
  resourceId?: string;
338
352
  }): Promise<WorkflowRuns>;
339
353
 
340
- export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
341
-
342
- export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
343
- stepGraph: StepGraph;
344
- stepSubscriberGraph: Record<string, StepGraph>;
345
- serializedStepGraph: StepGraph;
346
- serializedStepSubscriberGraph: Record<string, StepGraph>;
347
- name: string;
348
- triggerSchema: string | undefined;
349
- steps: any;
350
- }>;
351
-
352
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
354
+ export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
353
355
 
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>;
356
+ export declare function handleError(error: unknown, defaultMessage: string): never;
361
357
 
362
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
358
+ export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
359
+ requestId: string;
360
+ taskStore: InMemoryTaskStore;
361
+ agentId: string;
362
+ taskId: string;
363
+ logger?: IMastraLogger;
364
+ }): Promise<JSONRPCResponse<Task, unknown>>;
363
365
 
364
- export declare function handleError(error: unknown, defaultMessage: string): never;
366
+ export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
367
+ requestId: string;
368
+ taskStore: InMemoryTaskStore;
369
+ agentId: string;
370
+ taskId: string;
371
+ }): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
372
+
373
+ export declare function handleTaskSend({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
374
+ requestId: string;
375
+ params: TaskSendParams;
376
+ taskStore: InMemoryTaskStore;
377
+ agent: Agent;
378
+ logger?: IMastraLogger;
379
+ runtimeContext: RuntimeContext;
380
+ }): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
381
+
382
+ export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
383
+ requestId: string;
384
+ params: TaskSendParams;
385
+ taskStore: InMemoryTaskStore;
386
+ agent: Agent;
387
+ logger?: IMastraLogger;
388
+ runtimeContext: RuntimeContext;
389
+ }): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
390
+ state: string;
391
+ message: {
392
+ role: string;
393
+ parts: {
394
+ type: string;
395
+ text: string;
396
+ }[];
397
+ };
398
+ }, unknown>, void, unknown>;
365
399
 
366
400
  /**
367
401
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
@@ -424,8 +458,46 @@ declare type HTTPExceptionOptions = {
424
458
  */
425
459
  declare type InfoStatusCode = 100 | 101 | 102 | 103;
426
460
 
461
+ export declare class InMemoryTaskStore {
462
+ private store;
463
+ activeCancellations: Set<string>;
464
+ load({ agentId, taskId }: {
465
+ agentId: string;
466
+ taskId: string;
467
+ }): Promise<TaskAndHistory | null>;
468
+ save({ agentId, data }: {
469
+ agentId: string;
470
+ data: TaskAndHistory;
471
+ }): Promise<void>;
472
+ }
473
+
474
+ export declare namespace legacyWorkflows {
475
+ export {
476
+ getLegacyWorkflowsHandler,
477
+ getLegacyWorkflowByIdHandler,
478
+ startAsyncLegacyWorkflowHandler,
479
+ getLegacyWorkflowRunHandler,
480
+ createLegacyWorkflowRunHandler,
481
+ startLegacyWorkflowRunHandler,
482
+ watchLegacyWorkflowHandler,
483
+ resumeAsyncLegacyWorkflowHandler,
484
+ resumeLegacyWorkflowHandler,
485
+ getLegacyWorkflowRunsHandler
486
+ }
487
+ }
488
+
427
489
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
428
490
 
491
+ export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
492
+ agentId: string;
493
+ taskId: string;
494
+ taskStore: InMemoryTaskStore;
495
+ message: Message;
496
+ sessionId?: string | null;
497
+ metadata?: Record<string, unknown> | null;
498
+ logger?: IMastraLogger;
499
+ }): Promise<TaskAndHistory>;
500
+
429
501
  export declare namespace logs {
430
502
  export {
431
503
  getLogsHandler,
@@ -435,7 +507,7 @@ export declare namespace logs {
435
507
  }
436
508
 
437
509
  declare type LogsContext = {
438
- mastra: Mastra_2;
510
+ mastra: Mastra;
439
511
  transportId?: string;
440
512
  runId?: string;
441
513
  };
@@ -473,6 +545,8 @@ declare interface NetworkContext extends Context {
473
545
  runtimeContext: RuntimeContext;
474
546
  }
475
547
 
548
+ export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
549
+
476
550
  declare interface QueryRequest {
477
551
  indexName: string;
478
552
  queryVector: number[];
@@ -487,33 +561,24 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
487
561
 
488
562
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
489
563
 
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 & {
564
+ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
499
565
  body: {
500
566
  stepId: string;
501
567
  context: any;
502
568
  };
503
569
  runtimeContext: RuntimeContext;
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>;
570
+ }): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
505
571
 
506
- export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
572
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, runtimeContextFromRequest, }: WorkflowContext_3 & {
507
573
  body: {
508
574
  step: string | string[];
509
575
  resumeData?: unknown;
510
576
  };
511
577
  runtimeContext?: RuntimeContext_2;
512
- }): Promise<{
513
- message: string;
514
- }>;
578
+ runtimeContextFromRequest?: Record<string, unknown>;
579
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
515
580
 
516
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
581
+ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
517
582
  body: {
518
583
  stepId: string;
519
584
  context: any;
@@ -523,34 +588,55 @@ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body,
523
588
  message: string;
524
589
  }>;
525
590
 
591
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
592
+ body: {
593
+ step: string | string[];
594
+ resumeData?: unknown;
595
+ };
596
+ runtimeContext?: RuntimeContext_2;
597
+ }): Promise<{
598
+ message: string;
599
+ }>;
600
+
526
601
  export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
527
602
  body: {
528
603
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
529
604
  };
530
- }): Promise<MessageType[]>;
605
+ }): Promise<MastraMessageV2[]>;
531
606
 
532
- declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
607
+ declare type SerializedStep = {
608
+ id: string;
609
+ description: string;
610
+ inputSchema: string | undefined;
611
+ outputSchema: string | undefined;
612
+ resumeSchema: string | undefined;
613
+ suspendSchema: string | undefined;
614
+ };
533
615
 
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>[]>>;
616
+ declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
538
617
 
539
- export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
618
+ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
540
619
  triggerData?: unknown;
541
620
  runtimeContext: RuntimeContext;
542
- }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
621
+ }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
543
622
 
544
- export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
623
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
545
624
  inputData?: unknown;
546
625
  runtimeContext?: RuntimeContext_2;
626
+ runtimeContextFromRequest?: Record<string, unknown>;
627
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
628
+
629
+ export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
630
+ triggerData?: unknown;
631
+ runtimeContext: RuntimeContext;
547
632
  }): Promise<{
548
633
  message: string;
549
634
  }>;
550
635
 
551
- export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
552
- triggerData?: unknown;
553
- runtimeContext: RuntimeContext;
636
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
637
+ inputData?: unknown;
638
+ runtimeContext?: RuntimeContext_2;
639
+ runtimeContextFromRequest?: Record<string, unknown>;
554
640
  }): Promise<{
555
641
  message: string;
556
642
  }>;
@@ -579,6 +665,7 @@ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId,
579
665
  agentId: string;
580
666
  body: GetBody<'stream'> & {
581
667
  resourceid?: string;
668
+ runtimeContext?: string;
582
669
  };
583
670
  }): Promise<Response | undefined>;
584
671
 
@@ -589,6 +676,15 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
589
676
  } & Parameters<AgentNetwork['stream']>[1];
590
677
  }): Promise<Response>;
591
678
 
679
+ export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
680
+ inputData?: unknown;
681
+ runtimeContext?: RuntimeContext_2;
682
+ runtimeContextFromRequest?: Record<string, unknown>;
683
+ }): {
684
+ stream: globalThis.ReadableStream<WatchEvent>;
685
+ getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
686
+ };
687
+
592
688
  declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
593
689
 
594
690
  export declare namespace telemetry {
@@ -689,26 +785,6 @@ declare interface VectorContext extends Context {
689
785
  vectorName?: string;
690
786
  }
691
787
 
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
-
712
788
  export declare namespace voice {
713
789
  export {
714
790
  getSpeakersHandler,
@@ -721,24 +797,30 @@ declare interface VoiceContext extends Context {
721
797
  agentId?: string;
722
798
  }
723
799
 
724
- export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
800
+ export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
725
801
 
726
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
802
+ export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
727
803
 
728
804
  declare interface WorkflowContext extends Context {
729
805
  workflowId?: string;
730
806
  runId?: string;
731
807
  }
732
808
 
809
+ declare interface WorkflowContext_3 extends Context {
810
+ workflowId?: string;
811
+ runId?: string;
812
+ }
813
+
733
814
  export declare namespace workflows {
734
815
  export {
735
816
  getWorkflowsHandler,
736
817
  getWorkflowByIdHandler,
818
+ getWorkflowRunByIdHandler,
819
+ createWorkflowRunHandler,
737
820
  startAsyncWorkflowHandler,
738
- getWorkflowRunHandler,
739
- createRunHandler,
740
821
  startWorkflowRunHandler,
741
822
  watchWorkflowHandler,
823
+ streamWorkflowHandler,
742
824
  resumeAsyncWorkflowHandler,
743
825
  resumeWorkflowHandler,
744
826
  getWorkflowRunsHandler