@mastra/server 0.0.0-agui-20250501191909 → 0.0.0-ai-v5-20250625014956

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 (86) hide show
  1. package/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +303 -94
  3. package/dist/_tsup-dts-rollup.d.ts +303 -94
  4. package/dist/{chunk-5JNVY6DU.js → chunk-2HXKRRNS.js} +7 -5
  5. package/dist/{chunk-JPB6RPGB.js → chunk-3CSC35VL.js} +163 -46
  6. package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
  7. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  8. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  9. package/dist/chunk-75ZPJI57.cjs +9 -0
  10. package/dist/chunk-ASKESBJW.cjs +2004 -0
  11. package/dist/chunk-B36R2PHA.js +504 -0
  12. package/dist/{chunk-7IWQE76Z.cjs → chunk-B4MQFJ7G.cjs} +16 -10
  13. package/dist/{chunk-WTHDCRMY.js → chunk-BFOA2QQY.js} +12 -6
  14. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  15. package/dist/{chunk-M3YJLWTU.js → chunk-CLYX4KLH.js} +63 -52
  16. package/dist/{chunk-RBQASTUP.js → chunk-EKDOJJMG.js} +26 -6
  17. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  18. package/dist/chunk-IMBY5XUG.cjs +86 -0
  19. package/dist/chunk-LFA7KZS6.cjs +276 -0
  20. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  21. package/dist/chunk-MLKGABMK.js +7 -0
  22. package/dist/{chunk-2FJURXCL.cjs → chunk-NDAWJCUJ.cjs} +56 -36
  23. package/dist/{chunk-D3G23FP3.cjs → chunk-NGURCFEJ.cjs} +24 -22
  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-QLG2PFHE.js +81 -0
  27. package/dist/{chunk-5YGDYMRB.cjs → chunk-QOHBG2JI.cjs} +22 -19
  28. package/dist/{chunk-Q6SHQECN.js → chunk-R5VGYBV6.js} +34 -10
  29. package/dist/{chunk-QJ3AHN64.js → chunk-SAR3AYOK.js} +12 -9
  30. package/dist/chunk-T7WA465P.cjs +512 -0
  31. package/dist/chunk-TGJMNUYJ.js +2001 -0
  32. package/dist/{chunk-Y3SV5XK4.js → chunk-WC7U7A6Y.js} +104 -17
  33. package/dist/chunk-WE32JG64.cjs +332 -0
  34. package/dist/chunk-WJY57THV.cjs +118 -0
  35. package/dist/chunk-XUTX4CAB.cjs +435 -0
  36. package/dist/server/handlers/a2a.cjs +30 -0
  37. package/dist/server/handlers/a2a.d.cts +6 -0
  38. package/dist/server/handlers/a2a.d.ts +6 -0
  39. package/dist/server/handlers/a2a.js +1 -0
  40. package/dist/server/handlers/agents.cjs +7 -7
  41. package/dist/server/handlers/agents.js +1 -1
  42. package/dist/server/handlers/error.cjs +2 -2
  43. package/dist/server/handlers/error.js +1 -1
  44. package/dist/server/handlers/legacyWorkflows.cjs +46 -0
  45. package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
  46. package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
  47. package/dist/server/handlers/legacyWorkflows.js +1 -0
  48. package/dist/server/handlers/logs.cjs +4 -4
  49. package/dist/server/handlers/logs.js +1 -1
  50. package/dist/server/handlers/memory.cjs +9 -9
  51. package/dist/server/handlers/memory.js +1 -1
  52. package/dist/server/handlers/network.cjs +5 -5
  53. package/dist/server/handlers/network.js +1 -1
  54. package/dist/server/handlers/telemetry.cjs +3 -3
  55. package/dist/server/handlers/telemetry.js +1 -1
  56. package/dist/server/handlers/tools.cjs +5 -5
  57. package/dist/server/handlers/tools.js +1 -1
  58. package/dist/server/handlers/utils.cjs +2 -2
  59. package/dist/server/handlers/utils.js +1 -1
  60. package/dist/server/handlers/vector.cjs +7 -7
  61. package/dist/server/handlers/vector.js +1 -1
  62. package/dist/server/handlers/voice.cjs +8 -4
  63. package/dist/server/handlers/voice.d.cts +1 -0
  64. package/dist/server/handlers/voice.d.ts +1 -0
  65. package/dist/server/handlers/voice.js +1 -1
  66. package/dist/server/handlers/workflows.cjs +21 -13
  67. package/dist/server/handlers/workflows.d.cts +4 -2
  68. package/dist/server/handlers/workflows.d.ts +4 -2
  69. package/dist/server/handlers/workflows.js +1 -1
  70. package/dist/server/handlers.cjs +32 -27
  71. package/dist/server/handlers.d.cts +2 -1
  72. package/dist/server/handlers.d.ts +2 -1
  73. package/dist/server/handlers.js +11 -10
  74. package/package.json +13 -12
  75. package/dist/chunk-3EJZQ6TQ.js +0 -49
  76. package/dist/chunk-4BIX6GMY.cjs +0 -189
  77. package/dist/chunk-55HTWX4C.cjs +0 -93
  78. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  79. package/dist/chunk-AELYAUEE.cjs +0 -316
  80. package/dist/chunk-EVCC233P.cjs +0 -321
  81. package/dist/chunk-OMN3UI6X.js +0 -5576
  82. package/dist/chunk-SKBVVI24.cjs +0 -54
  83. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  84. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  85. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  86. package/dist/server/handlers/vNextWorkflows.js +0 -1
@@ -1,35 +1,63 @@
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';
6
+ import type { CoreMessage } from '@mastra/core/llm';
5
7
  import { EvalRow } from '@mastra/core/storage';
6
8
  import { GenerateObjectResult } from 'ai';
7
9
  import { GenerateTextResult } from 'ai';
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 { LogLevel } from '@mastra/core/logger';
8
18
  import type { Mastra } from '@mastra/core/mastra';
9
19
  import type { MastraMemory } from '@mastra/core/memory';
10
- import { Message } from 'ai';
11
- import { MessageType } from '@mastra/core/memory';
12
- import { NewStep } from '@mastra/core/workflows/vNext';
13
- import type { NewWorkflow } from '@mastra/core/workflows/vNext';
20
+ import { MastraMessageV1 } from '@mastra/core/memory';
21
+ import type { Message } from '@mastra/core/a2a';
22
+ import { ModelMessage } from 'ai';
14
23
  import type { QueryResult } from '@mastra/core/vector';
15
24
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
16
- import type { RuntimeContext } from '@mastra/core/runtime-context';
25
+ import { RuntimeContext } from '@mastra/core/runtime-context';
17
26
  import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
18
- import { SerializedStepFlowEntry } from '@mastra/core/workflows/vNext';
27
+ import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
19
28
  import { Step } from '@mastra/core/workflows';
20
- import { StepExecutionContext } from '@mastra/core/workflows';
21
- import { StepGraph } from '@mastra/core/workflows';
29
+ import { StepExecutionContext } from '@mastra/core/workflows/legacy';
30
+ import { StepGraph } from '@mastra/core/workflows/legacy';
22
31
  import { StorageThreadType } from '@mastra/core/memory';
32
+ import { StreamEvent } from '@mastra/core/workflows';
33
+ import { Task } from '@mastra/core/a2a';
34
+ import { TaskAndHistory } from '@mastra/core/a2a';
35
+ import type { TaskContext } from '@mastra/core/a2a';
36
+ import type { TaskIdParams } from '@mastra/core/a2a';
37
+ import type { TaskQueryParams } from '@mastra/core/a2a';
38
+ import type { TaskSendParams } from '@mastra/core/a2a';
39
+ import type { TaskStatus } from '@mastra/core/a2a';
23
40
  import type { ToolAction } from '@mastra/core/tools';
24
41
  import type { VercelTool } from '@mastra/core/tools';
42
+ import type { WatchEvent } from '@mastra/core/workflows';
25
43
  import type { Workflow } from '@mastra/core/workflows';
26
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
27
- import { WorkflowResult } from '@mastra/core/workflows/vNext';
28
- import { WorkflowRunResult } from '@mastra/core/workflows';
44
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
45
+ import { WorkflowResult } from '@mastra/core/workflows';
29
46
  import type { WorkflowRuns } from '@mastra/core/storage';
30
47
  import { ZodType } from 'zod';
31
48
  import { ZodTypeDef } from 'zod';
32
49
 
50
+ export declare namespace a2a {
51
+ export {
52
+ getAgentCardByIdHandler,
53
+ handleTaskSend,
54
+ handleTaskGet,
55
+ handleTaskSendSubscribe,
56
+ handleTaskCancel,
57
+ getAgentExecutionHandler
58
+ }
59
+ }
60
+
33
61
  export declare namespace agents {
34
62
  export {
35
63
  getAgentsHandler,
@@ -46,12 +74,18 @@ export declare interface ApiError extends Error {
46
74
  status?: number;
47
75
  }
48
76
 
77
+ export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
78
+
49
79
  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;
50
80
 
51
81
  export declare interface Context {
52
82
  mastra: Mastra;
53
83
  }
54
84
 
85
+ export declare function convertToCoreMessage(message: Message): CoreMessage;
86
+
87
+ export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
88
+
55
89
  export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
56
90
  index: CreateIndexRequest;
57
91
  }): Promise<{
@@ -64,17 +98,26 @@ declare interface CreateIndexRequest {
64
98
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
65
99
  }
66
100
 
67
- export declare function createRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
101
+ export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
68
102
  runId: string;
69
103
  }>;
70
104
 
105
+ export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
106
+
107
+ export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
108
+ task: Task;
109
+ userMessage: Message;
110
+ history: Message[];
111
+ activeCancellations: Set<string>;
112
+ }): TaskContext;
113
+
71
114
  export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
72
115
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
73
116
  resourceId?: string;
74
117
  };
75
118
  }): Promise<StorageThreadType>;
76
119
 
77
- export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
120
+ export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
78
121
  runId: string;
79
122
  }>;
80
123
 
@@ -101,12 +144,12 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
101
144
  export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
102
145
  agentId?: string;
103
146
  data: any;
104
- runtimeContext: RuntimeContext;
147
+ runtimeContext: RuntimeContext_2;
105
148
  }): Promise<any>;
106
149
 
107
150
  export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
108
151
  data?: unknown;
109
- runtimeContext: RuntimeContext;
152
+ runtimeContext: RuntimeContext_2;
110
153
  }) => Promise<any>;
111
154
 
112
155
  export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
@@ -114,8 +157,9 @@ export declare function generateHandler({ mastra, runtimeContext, agentId, body,
114
157
  agentId: string;
115
158
  body: GetBody<'generate'> & {
116
159
  resourceid?: string;
160
+ runtimeContext?: Record<string, unknown>;
117
161
  };
118
- }): Promise<GenerateTextResult<any, any>>;
162
+ }): Promise<GenerateTextResult<any, unknown>>;
119
163
 
120
164
  export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
121
165
  runtimeContext: RuntimeContext;
@@ -134,17 +178,42 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
134
178
  };
135
179
  }): Promise<NodeJS.ReadableStream>;
136
180
 
137
- export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
181
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
182
+ isPlayground?: boolean;
138
183
  runtimeContext: RuntimeContext;
139
184
  agentId: string;
140
185
  }): Promise<{
141
186
  name: any;
142
187
  instructions: string;
143
188
  tools: any;
189
+ workflows: {};
144
190
  provider: string;
145
191
  modelId: string;
192
+ defaultGenerateOptions: any;
193
+ defaultStreamOptions: any;
146
194
  }>;
147
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
+
148
217
  export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
149
218
  runtimeContext: RuntimeContext;
150
219
  }): Promise<any>;
@@ -165,6 +234,35 @@ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agent
165
234
  evals: EvalRow[];
166
235
  }>;
167
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
+
259
+ /**
260
+ * Get available listeners for an agent
261
+ */
262
+ export declare function getListenerHandler({ mastra, agentId }: VoiceContext): Promise<{
263
+ enabled: boolean;
264
+ }>;
265
+
168
266
  export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
169
267
  runtimeContext: RuntimeContext;
170
268
  agentId: string;
@@ -175,9 +273,21 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, a
175
273
  evals: EvalRow[];
176
274
  }>;
177
275
 
178
- export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
276
+ export declare function getLogsByRunIdHandler({ mastra, runId, transportId, params, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId' | 'params'>): Promise<{
277
+ logs: BaseLogMessage[];
278
+ total: number;
279
+ page: number;
280
+ perPage: number;
281
+ hasMore: boolean;
282
+ }>;
179
283
 
180
- export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
284
+ export declare function getLogsHandler({ mastra, transportId, params, }: Pick<LogsContext, 'mastra' | 'transportId' | 'params'>): Promise<{
285
+ logs: BaseLogMessage[];
286
+ total: number;
287
+ page: number;
288
+ perPage: number;
289
+ hasMore: boolean;
290
+ }>;
181
291
 
182
292
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
183
293
  transports: string[];
@@ -187,9 +297,12 @@ export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryC
187
297
  result: boolean;
188
298
  }>;
189
299
 
190
- export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
191
- messages: CoreMessage[];
192
- uiMessages: Message[];
300
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, format, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
301
+ limit?: number;
302
+ format?: 'aiv4' | 'aiv5';
303
+ }): Promise<{
304
+ messages: ModelMessage[];
305
+ uiMessages: any[];
193
306
  }>;
194
307
 
195
308
  export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
@@ -239,37 +352,74 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
239
352
 
240
353
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
241
354
 
242
- export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
243
- steps: any;
355
+ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
356
+ steps: SerializedStep[];
244
357
  name: string | undefined;
358
+ description: string | undefined;
245
359
  stepGraph: SerializedStepFlowEntry[];
246
360
  inputSchema: string | undefined;
247
361
  outputSchema: string | undefined;
248
362
  }>;
249
363
 
250
- export declare function getVNextWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRun']>>;
364
+ export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
251
365
 
252
- export declare function getVNextWorkflowRunsHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<WorkflowRuns>;
366
+ export declare function getWorkflowRunExecutionResultHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<WatchEvent['payload']['workflowState']>;
253
367
 
254
- export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
368
+ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
369
+ fromDate?: Date;
370
+ toDate?: Date;
371
+ limit?: number;
372
+ offset?: number;
373
+ resourceId?: string;
374
+ }): Promise<WorkflowRuns>;
255
375
 
256
- export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
257
- stepGraph: StepGraph;
258
- stepSubscriberGraph: Record<string, StepGraph>;
259
- serializedStepGraph: StepGraph;
260
- serializedStepSubscriberGraph: Record<string, StepGraph>;
261
- name: string;
262
- triggerSchema: string | undefined;
263
- steps: any;
264
- }>;
376
+ export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
265
377
 
266
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
378
+ export declare function handleError(error: unknown, defaultMessage: string): never;
267
379
 
268
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
380
+ export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
381
+ requestId: string;
382
+ taskStore: InMemoryTaskStore;
383
+ agentId: string;
384
+ taskId: string;
385
+ logger?: IMastraLogger;
386
+ }): Promise<JSONRPCResponse<Task, unknown>>;
269
387
 
270
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
388
+ export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
389
+ requestId: string;
390
+ taskStore: InMemoryTaskStore;
391
+ agentId: string;
392
+ taskId: string;
393
+ }): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
394
+
395
+ export declare function handleTaskSend({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
396
+ requestId: string;
397
+ params: TaskSendParams;
398
+ taskStore: InMemoryTaskStore;
399
+ agent: Agent;
400
+ agentId: string;
401
+ logger?: IMastraLogger;
402
+ runtimeContext: RuntimeContext;
403
+ }): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
271
404
 
272
- export declare function handleError(error: unknown, defaultMessage: string): never;
405
+ export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
406
+ requestId: string;
407
+ params: TaskSendParams;
408
+ taskStore: InMemoryTaskStore;
409
+ agent: Agent;
410
+ agentId: string;
411
+ logger?: IMastraLogger;
412
+ runtimeContext: RuntimeContext;
413
+ }): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
414
+ state: string;
415
+ message: {
416
+ role: string;
417
+ parts: {
418
+ type: string;
419
+ text: string;
420
+ }[];
421
+ };
422
+ }, unknown>, void, unknown>;
273
423
 
274
424
  /**
275
425
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
@@ -332,8 +482,46 @@ declare type HTTPExceptionOptions = {
332
482
  */
333
483
  declare type InfoStatusCode = 100 | 101 | 102 | 103;
334
484
 
485
+ export declare class InMemoryTaskStore {
486
+ private store;
487
+ activeCancellations: Set<string>;
488
+ load({ agentId, taskId }: {
489
+ agentId: string;
490
+ taskId: string;
491
+ }): Promise<TaskAndHistory | null>;
492
+ save({ agentId, data }: {
493
+ agentId: string;
494
+ data: TaskAndHistory;
495
+ }): Promise<void>;
496
+ }
497
+
498
+ export declare namespace legacyWorkflows {
499
+ export {
500
+ getLegacyWorkflowsHandler,
501
+ getLegacyWorkflowByIdHandler,
502
+ startAsyncLegacyWorkflowHandler,
503
+ getLegacyWorkflowRunHandler,
504
+ createLegacyWorkflowRunHandler,
505
+ startLegacyWorkflowRunHandler,
506
+ watchLegacyWorkflowHandler,
507
+ resumeAsyncLegacyWorkflowHandler,
508
+ resumeLegacyWorkflowHandler,
509
+ getLegacyWorkflowRunsHandler
510
+ }
511
+ }
512
+
335
513
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
336
514
 
515
+ export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
516
+ agentId: string;
517
+ taskId: string;
518
+ taskStore: InMemoryTaskStore;
519
+ message: Message;
520
+ sessionId?: string | null;
521
+ metadata?: Record<string, unknown> | null;
522
+ logger?: IMastraLogger;
523
+ }): Promise<TaskAndHistory>;
524
+
337
525
  export declare namespace logs {
338
526
  export {
339
527
  getLogsHandler,
@@ -346,6 +534,14 @@ declare type LogsContext = {
346
534
  mastra: Mastra;
347
535
  transportId?: string;
348
536
  runId?: string;
537
+ params?: {
538
+ fromDate?: Date;
539
+ toDate?: Date;
540
+ logLevel?: LogLevel;
541
+ filters?: string | string[];
542
+ page?: number;
543
+ perPage?: number;
544
+ };
349
545
  };
350
546
 
351
547
  export declare namespace memory {
@@ -381,6 +577,8 @@ declare interface NetworkContext extends Context {
381
577
  runtimeContext: RuntimeContext;
382
578
  }
383
579
 
580
+ export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
581
+
384
582
  declare interface QueryRequest {
385
583
  indexName: string;
386
584
  queryVector: number[];
@@ -395,33 +593,23 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
395
593
 
396
594
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
397
595
 
398
- export declare function resumeAsyncVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
399
- body: {
400
- step: string | string[];
401
- resumeData?: unknown;
402
- };
403
- runtimeContext?: RuntimeContext_2;
404
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
405
-
406
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
596
+ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
407
597
  body: {
408
598
  stepId: string;
409
599
  context: any;
410
600
  };
411
601
  runtimeContext: RuntimeContext;
412
- }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
602
+ }): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
413
603
 
414
- export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
604
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
415
605
  body: {
416
606
  step: string | string[];
417
607
  resumeData?: unknown;
418
608
  };
419
609
  runtimeContext?: RuntimeContext_2;
420
- }): Promise<{
421
- message: string;
422
- }>;
610
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
423
611
 
424
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
612
+ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
425
613
  body: {
426
614
  stepId: string;
427
615
  context: any;
@@ -431,34 +619,53 @@ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body,
431
619
  message: string;
432
620
  }>;
433
621
 
622
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
623
+ body: {
624
+ step: string | string[];
625
+ resumeData?: unknown;
626
+ };
627
+ runtimeContext?: RuntimeContext_2;
628
+ }): Promise<{
629
+ message: string;
630
+ }>;
631
+
434
632
  export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
435
633
  body: {
436
634
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
437
635
  };
438
- }): Promise<MessageType[]>;
636
+ }): Promise<MastraMessageV1[]>;
439
637
 
440
- declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
638
+ declare type SerializedStep = {
639
+ id: string;
640
+ description: string;
641
+ inputSchema: string | undefined;
642
+ outputSchema: string | undefined;
643
+ resumeSchema: string | undefined;
644
+ suspendSchema: string | undefined;
645
+ };
441
646
 
442
- export declare function startAsyncVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
443
- inputData?: unknown;
444
- runtimeContext?: RuntimeContext_2;
445
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
647
+ declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
446
648
 
447
- export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
649
+ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
448
650
  triggerData?: unknown;
449
651
  runtimeContext: RuntimeContext;
450
- }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
652
+ }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
451
653
 
452
- export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
654
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
453
655
  inputData?: unknown;
454
656
  runtimeContext?: RuntimeContext_2;
657
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
658
+
659
+ export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
660
+ triggerData?: unknown;
661
+ runtimeContext: RuntimeContext;
455
662
  }): Promise<{
456
663
  message: string;
457
664
  }>;
458
665
 
459
- export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
460
- triggerData?: unknown;
461
- runtimeContext: RuntimeContext;
666
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
667
+ inputData?: unknown;
668
+ runtimeContext?: RuntimeContext_2;
462
669
  }): Promise<{
463
670
  message: string;
464
671
  }>;
@@ -476,6 +683,10 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
476
683
  status: string;
477
684
  message: string;
478
685
  error: any;
686
+ } | {
687
+ status: string;
688
+ message: string;
689
+ traceCount?: undefined;
479
690
  } | {
480
691
  status: string;
481
692
  message: string;
@@ -486,7 +697,7 @@ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId,
486
697
  runtimeContext: RuntimeContext;
487
698
  agentId: string;
488
699
  body: GetBody<'stream'> & {
489
- resourceid?: string;
700
+ runtimeContext?: string;
490
701
  };
491
702
  }): Promise<Response | undefined>;
492
703
 
@@ -497,6 +708,14 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
497
708
  } & Parameters<AgentNetwork['stream']>[1];
498
709
  }): Promise<Response>;
499
710
 
711
+ export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
712
+ inputData?: unknown;
713
+ runtimeContext?: RuntimeContext_2;
714
+ }): Promise<{
715
+ stream: globalThis.ReadableStream<StreamEvent>;
716
+ getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
717
+ }>;
718
+
500
719
  declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
501
720
 
502
721
  export declare namespace telemetry {
@@ -513,6 +732,8 @@ declare interface TelemetryContext extends Context {
513
732
  page?: number;
514
733
  perPage?: number;
515
734
  attribute?: string | string[];
735
+ fromDate?: Date;
736
+ toDate?: Date;
516
737
  };
517
738
  }
518
739
 
@@ -595,31 +816,12 @@ declare interface VectorContext extends Context {
595
816
  vectorName?: string;
596
817
  }
597
818
 
598
- declare interface VNextWorkflowContext extends Context {
599
- workflowId?: string;
600
- runId?: string;
601
- }
602
-
603
- export declare namespace vNextWorkflows {
604
- export {
605
- getVNextWorkflowsHandler,
606
- getVNextWorkflowByIdHandler,
607
- getVNextWorkflowRunHandler,
608
- createVNextWorkflowRunHandler,
609
- startAsyncVNextWorkflowHandler,
610
- startVNextWorkflowRunHandler,
611
- watchVNextWorkflowHandler,
612
- resumeAsyncVNextWorkflowHandler,
613
- resumeVNextWorkflowHandler,
614
- getVNextWorkflowRunsHandler
615
- }
616
- }
617
-
618
819
  export declare namespace voice {
619
820
  export {
620
821
  getSpeakersHandler,
621
822
  generateSpeechHandler,
622
- transcribeSpeechHandler
823
+ transcribeSpeechHandler,
824
+ getListenerHandler
623
825
  }
624
826
  }
625
827
 
@@ -627,24 +829,31 @@ declare interface VoiceContext extends Context {
627
829
  agentId?: string;
628
830
  }
629
831
 
630
- export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
832
+ export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
631
833
 
632
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
834
+ export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
633
835
 
634
836
  declare interface WorkflowContext extends Context {
635
837
  workflowId?: string;
636
838
  runId?: string;
637
839
  }
638
840
 
841
+ declare interface WorkflowContext_3 extends Context {
842
+ workflowId?: string;
843
+ runId?: string;
844
+ }
845
+
639
846
  export declare namespace workflows {
640
847
  export {
641
848
  getWorkflowsHandler,
642
849
  getWorkflowByIdHandler,
850
+ getWorkflowRunByIdHandler,
851
+ getWorkflowRunExecutionResultHandler,
852
+ createWorkflowRunHandler,
643
853
  startAsyncWorkflowHandler,
644
- getWorkflowRunHandler,
645
- createRunHandler,
646
854
  startWorkflowRunHandler,
647
855
  watchWorkflowHandler,
856
+ streamWorkflowHandler,
648
857
  resumeAsyncWorkflowHandler,
649
858
  resumeWorkflowHandler,
650
859
  getWorkflowRunsHandler
@@ -1,7 +1,8 @@
1
- import { stringify, esm_default } from './chunk-OMN3UI6X.js';
2
- import { validateBody } from './chunk-L7XE5QTW.js';
3
- import { handleError } from './chunk-3AHQ5RGN.js';
4
- import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
1
+ import { stringify, esm_default } from './chunk-TGJMNUYJ.js';
2
+ import { validateBody } from './chunk-H5PTF3Y4.js';
3
+ import { handleError } from './chunk-M5ABIP7D.js';
4
+ import { HTTPException } from './chunk-NYN7KFXL.js';
5
+ import { __export } from './chunk-MLKGABMK.js';
5
6
  import { isVercelTool } from '@mastra/core/tools';
6
7
 
7
8
  // src/server/handlers/tools.ts
@@ -98,7 +99,8 @@ async function executeAgentToolHandler({
98
99
  if (!agent) {
99
100
  throw new HTTPException(404, { message: "Tool not found" });
100
101
  }
101
- const tool = Object.values(agent?.tools || {}).find((tool2) => tool2.id === toolId);
102
+ const agentTools = await agent.getTools({ runtimeContext });
103
+ const tool = Object.values(agentTools || {}).find((tool2) => tool2.id === toolId);
102
104
  if (!tool) {
103
105
  throw new HTTPException(404, { message: "Tool not found" });
104
106
  }