@mastra/server 0.0.0-vnextWorkflows-20250422142014 → 0.0.0-workflow-deno-20250616130925

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 (83) hide show
  1. package/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +351 -60
  3. package/dist/_tsup-dts-rollup.d.ts +351 -60
  4. package/dist/{chunk-XISBMH56.js → chunk-2HXKRRNS.js} +11 -9
  5. package/dist/chunk-42IKSJNO.js +421 -0
  6. package/dist/chunk-42YJ2YVD.cjs +263 -0
  7. package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
  8. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  9. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  10. package/dist/{chunk-2FJURXCL.cjs → chunk-6TJSHFCJ.cjs} +44 -36
  11. package/dist/chunk-75ZPJI57.cjs +9 -0
  12. package/dist/chunk-ASKESBJW.cjs +2004 -0
  13. package/dist/{chunk-7IWQE76Z.cjs → chunk-B4MQFJ7G.cjs} +16 -10
  14. package/dist/{chunk-WTHDCRMY.js → chunk-BFOA2QQY.js} +12 -6
  15. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  16. package/dist/{chunk-YANVFOYA.js → chunk-C7564HUT.js} +56 -34
  17. package/dist/chunk-CK32I2VN.cjs +435 -0
  18. package/dist/{chunk-4B7OUZXW.js → chunk-CLYX4KLH.js} +78 -63
  19. package/dist/chunk-CMMOIUFC.cjs +114 -0
  20. package/dist/{chunk-3RVHWGWO.js → chunk-CP55EVBK.js} +26 -13
  21. package/dist/chunk-GHC4YV6R.js +504 -0
  22. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  23. package/dist/{chunk-RBQASTUP.js → chunk-I7KJZNX5.js} +14 -6
  24. package/dist/chunk-IMBY5XUG.cjs +86 -0
  25. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  26. package/dist/chunk-MLKGABMK.js +7 -0
  27. package/dist/{chunk-HABV7TZK.cjs → chunk-NGURCFEJ.cjs} +28 -26
  28. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  29. package/dist/chunk-O2YAAFY3.js +255 -0
  30. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  31. package/dist/chunk-QLG2PFHE.js +81 -0
  32. package/dist/chunk-SDPGVWQJ.cjs +512 -0
  33. package/dist/chunk-TGJMNUYJ.js +2001 -0
  34. package/dist/chunk-VPNDC2DI.cjs +148 -0
  35. package/dist/chunk-WE32JG64.cjs +332 -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 +33 -23
  71. package/dist/server/handlers.d.cts +2 -0
  72. package/dist/server/handlers.d.ts +2 -0
  73. package/dist/server/handlers.js +11 -9
  74. package/package.json +13 -12
  75. package/dist/chunk-3EJZQ6TQ.js +0 -49
  76. package/dist/chunk-4WJ5GHRG.cjs +0 -164
  77. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  78. package/dist/chunk-A7DF4ETD.cjs +0 -100
  79. package/dist/chunk-JLDXUWK7.cjs +0 -126
  80. package/dist/chunk-OMN3UI6X.js +0 -5576
  81. package/dist/chunk-RNU4JMLM.cjs +0 -317
  82. package/dist/chunk-SKBVVI24.cjs +0 -54
  83. package/dist/chunk-TFFNX7FI.js +0 -156
@@ -1,27 +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 type { Container } from '@mastra/core/di';
5
6
  import { CoreMessage } from 'ai';
7
+ import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
6
8
  import { EvalRow } from '@mastra/core/storage';
7
9
  import { GenerateObjectResult } from 'ai';
8
10
  import { GenerateTextResult } from 'ai';
11
+ import type { IMastraLogger } from '@mastra/core/logger';
12
+ import type { JSONRPCError } from '@mastra/core/a2a';
13
+ import { JSONRPCResponse } from '@mastra/core/a2a';
14
+ import { LegacyStep } from '@mastra/core/workflows/legacy';
15
+ import type { LegacyWorkflow } from '@mastra/core/workflows/legacy';
16
+ import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
17
+ import type { LegacyWorkflowRuns } from '@mastra/core/storage';
18
+ import type { LogLevel } from '@mastra/core/logger';
9
19
  import type { Mastra } from '@mastra/core/mastra';
10
20
  import type { MastraMemory } from '@mastra/core/memory';
11
- import { Message } from 'ai';
12
- import { MessageType } from '@mastra/core/memory';
21
+ import { MastraMessageV1 } from '@mastra/core/memory';
22
+ import type { Message } from '@mastra/core/a2a';
13
23
  import type { QueryResult } from '@mastra/core/vector';
14
24
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
25
+ import { RuntimeContext } from '@mastra/core/runtime-context';
26
+ import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
27
+ import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
15
28
  import { Step } from '@mastra/core/workflows';
16
- import { StepExecutionContext } from '@mastra/core/workflows';
17
- import { StepGraph } from '@mastra/core/workflows';
29
+ import { StepExecutionContext } from '@mastra/core/workflows/legacy';
30
+ import { StepGraph } from '@mastra/core/workflows/legacy';
18
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';
19
40
  import type { ToolAction } from '@mastra/core/tools';
41
+ import { UIMessage } from 'ai';
20
42
  import type { VercelTool } from '@mastra/core/tools';
43
+ import type { WatchEvent } from '@mastra/core/workflows';
21
44
  import type { Workflow } from '@mastra/core/workflows';
22
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
23
- import { WorkflowRunResult } from '@mastra/core/workflows';
45
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
46
+ import { WorkflowResult } from '@mastra/core/workflows';
24
47
  import type { WorkflowRuns } from '@mastra/core/storage';
48
+ import { ZodType } from 'zod';
49
+ import { ZodTypeDef } from 'zod';
50
+
51
+ export declare namespace a2a {
52
+ export {
53
+ getAgentCardByIdHandler,
54
+ handleTaskSend,
55
+ handleTaskGet,
56
+ handleTaskSendSubscribe,
57
+ handleTaskCancel,
58
+ getAgentExecutionHandler
59
+ }
60
+ }
25
61
 
26
62
  export declare namespace agents {
27
63
  export {
@@ -39,12 +75,18 @@ export declare interface ApiError extends Error {
39
75
  status?: number;
40
76
  }
41
77
 
78
+ export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
79
+
42
80
  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
81
 
44
82
  export declare interface Context {
45
83
  mastra: Mastra;
46
84
  }
47
85
 
86
+ export declare function convertToCoreMessage(message: Message): CoreMessage_2;
87
+
88
+ export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
89
+
48
90
  export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
49
91
  index: CreateIndexRequest;
50
92
  }): Promise<{
@@ -57,16 +99,29 @@ declare interface CreateIndexRequest {
57
99
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
58
100
  }
59
101
 
60
- export declare function createRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
102
+ export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
61
103
  runId: string;
62
104
  }>;
63
105
 
106
+ export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
107
+
108
+ export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
109
+ task: Task;
110
+ userMessage: Message;
111
+ history: Message[];
112
+ activeCancellations: Set<string>;
113
+ }): TaskContext;
114
+
64
115
  export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
65
116
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
66
117
  resourceId?: string;
67
118
  };
68
119
  }): Promise<StorageThreadType>;
69
120
 
121
+ export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
122
+ runId: string;
123
+ }>;
124
+
70
125
  export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
71
126
  indexName?: string;
72
127
  }): Promise<{
@@ -87,27 +142,28 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
87
142
  metric: string | undefined;
88
143
  }>;
89
144
 
90
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, container, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
145
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
146
  agentId?: string;
92
147
  data: any;
93
- container: Container;
148
+ runtimeContext: RuntimeContext_2;
94
149
  }): Promise<any>;
95
150
 
96
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, container, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
151
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
97
152
  data?: unknown;
98
- container: Container;
153
+ runtimeContext: RuntimeContext_2;
99
154
  }) => Promise<any>;
100
155
 
101
- export declare function generateHandler({ mastra, container, agentId, body, }: Context & {
102
- container: Container;
156
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
157
+ runtimeContext: RuntimeContext;
103
158
  agentId: string;
104
159
  body: GetBody<'generate'> & {
105
160
  resourceid?: string;
161
+ runtimeContext?: Record<string, unknown>;
106
162
  };
107
- }): Promise<GenerateTextResult<any, any>>;
163
+ }): Promise<GenerateTextResult<any, unknown>>;
108
164
 
109
- export declare function generateHandler_alias_1({ mastra, container, networkId, body, }: NetworkContext & {
110
- container: Container;
165
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
166
+ runtimeContext: RuntimeContext;
111
167
  body: {
112
168
  messages?: Parameters<AgentNetwork['generate']>[0];
113
169
  } & Parameters<AgentNetwork['generate']>[1];
@@ -121,21 +177,47 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
121
177
  text?: string;
122
178
  speakerId?: string;
123
179
  };
124
- }): Promise<{
125
- audioData: Buffer<ArrayBuffer>;
126
- }>;
180
+ }): Promise<NodeJS.ReadableStream>;
127
181
 
128
- export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
182
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
183
+ isPlayground?: boolean;
184
+ runtimeContext: RuntimeContext;
129
185
  agentId: string;
130
186
  }): Promise<{
131
187
  name: any;
132
188
  instructions: string;
133
189
  tools: any;
190
+ workflows: {};
134
191
  provider: string;
135
192
  modelId: string;
193
+ defaultGenerateOptions: any;
194
+ defaultStreamOptions: any;
136
195
  }>;
137
196
 
138
- export declare function getAgentsHandler({ mastra }: Context): Promise<any>;
197
+ export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
198
+ runtimeContext: RuntimeContext;
199
+ agentId: keyof ReturnType<typeof mastra.getAgents>;
200
+ executionUrl?: string;
201
+ version?: string;
202
+ provider?: {
203
+ organization: string;
204
+ url: string;
205
+ };
206
+ }): Promise<AgentCard>;
207
+
208
+ export declare function getAgentExecutionHandler({ requestId, mastra, agentId, runtimeContext, method, params, taskStore, logger, }: Context & {
209
+ requestId: string;
210
+ runtimeContext: RuntimeContext;
211
+ agentId: string;
212
+ method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
213
+ params: TaskSendParams | TaskQueryParams | TaskIdParams;
214
+ taskStore?: InMemoryTaskStore;
215
+ logger?: IMastraLogger;
216
+ }): Promise<any>;
217
+
218
+ export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
219
+ runtimeContext: RuntimeContext;
220
+ }): Promise<any>;
139
221
 
140
222
  declare type GetBody<T extends keyof Agent & {
141
223
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -143,7 +225,8 @@ declare type GetBody<T extends keyof Agent & {
143
225
  messages: Parameters<Agent[T]>[0];
144
226
  } & Parameters<Agent[T]>[1];
145
227
 
146
- export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
228
+ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
229
+ runtimeContext: RuntimeContext;
147
230
  agentId: string;
148
231
  }): Promise<{
149
232
  id: string;
@@ -152,7 +235,37 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
152
235
  evals: EvalRow[];
153
236
  }>;
154
237
 
155
- export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
238
+ export declare function getLegacyWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
239
+ stepGraph: StepGraph;
240
+ stepSubscriberGraph: Record<string, StepGraph>;
241
+ serializedStepGraph: StepGraph;
242
+ serializedStepSubscriberGraph: Record<string, StepGraph>;
243
+ name: string;
244
+ triggerSchema: string | undefined;
245
+ steps: any;
246
+ }>;
247
+
248
+ export declare function getLegacyWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<LegacyWorkflow['getRun']>>;
249
+
250
+ export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
251
+ fromDate?: Date;
252
+ toDate?: Date;
253
+ limit?: number;
254
+ offset?: number;
255
+ resourceId?: string;
256
+ }): Promise<LegacyWorkflowRuns>;
257
+
258
+ export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
259
+
260
+ /**
261
+ * Get available listeners for an agent
262
+ */
263
+ export declare function getListenerHandler({ mastra, agentId }: VoiceContext): Promise<{
264
+ enabled: boolean;
265
+ }>;
266
+
267
+ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
268
+ runtimeContext: RuntimeContext;
156
269
  agentId: string;
157
270
  }): Promise<{
158
271
  id: string;
@@ -161,9 +274,21 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
161
274
  evals: EvalRow[];
162
275
  }>;
163
276
 
164
- export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
277
+ export declare function getLogsByRunIdHandler({ mastra, runId, transportId, params, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId' | 'params'>): Promise<{
278
+ logs: BaseLogMessage[];
279
+ total: number;
280
+ page: number;
281
+ perPage: number;
282
+ hasMore: boolean;
283
+ }>;
165
284
 
166
- export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
285
+ export declare function getLogsHandler({ mastra, transportId, params, }: Pick<LogsContext, 'mastra' | 'transportId' | 'params'>): Promise<{
286
+ logs: BaseLogMessage[];
287
+ total: number;
288
+ page: number;
289
+ perPage: number;
290
+ hasMore: boolean;
291
+ }>;
167
292
 
168
293
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
169
294
  transports: string[];
@@ -173,12 +298,14 @@ export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryC
173
298
  result: boolean;
174
299
  }>;
175
300
 
176
- export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
301
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
302
+ limit?: number;
303
+ }): Promise<{
177
304
  messages: CoreMessage[];
178
- uiMessages: Message[];
305
+ uiMessages: UIMessage[];
179
306
  }>;
180
307
 
181
- export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
308
+ export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
182
309
  id: string;
183
310
  name: string;
184
311
  instructions: string;
@@ -193,7 +320,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
193
320
  };
194
321
  }>;
195
322
 
196
- export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
323
+ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
197
324
  id: string;
198
325
  name: string;
199
326
  instructions: string;
@@ -225,24 +352,75 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
225
352
 
226
353
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
227
354
 
228
- export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
229
- stepGraph: StepGraph;
230
- stepSubscriberGraph: Record<string, StepGraph>;
231
- serializedStepGraph: StepGraph;
232
- serializedStepSubscriberGraph: Record<string, StepGraph>;
233
- name: string;
234
- triggerSchema: string | undefined;
235
- steps: any;
355
+ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
356
+ steps: SerializedStep[];
357
+ name: string | undefined;
358
+ description: string | undefined;
359
+ stepGraph: SerializedStepFlowEntry[];
360
+ inputSchema: string | undefined;
361
+ outputSchema: string | undefined;
236
362
  }>;
237
363
 
238
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
364
+ export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
365
+
366
+ export declare function getWorkflowRunExecutionResultHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<WatchEvent['payload']['workflowState']>;
239
367
 
240
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
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>;
241
375
 
242
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
376
+ export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
243
377
 
244
378
  export declare function handleError(error: unknown, defaultMessage: string): never;
245
379
 
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>>;
387
+
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>>;
404
+
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>;
423
+
246
424
  /**
247
425
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
248
426
  *
@@ -304,8 +482,46 @@ declare type HTTPExceptionOptions = {
304
482
  */
305
483
  declare type InfoStatusCode = 100 | 101 | 102 | 103;
306
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
+
307
513
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
308
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
+
309
525
  export declare namespace logs {
310
526
  export {
311
527
  getLogsHandler,
@@ -318,6 +534,14 @@ declare type LogsContext = {
318
534
  mastra: Mastra;
319
535
  transportId?: string;
320
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
+ };
321
545
  };
322
546
 
323
547
  export declare namespace memory {
@@ -350,8 +574,11 @@ export declare namespace network {
350
574
 
351
575
  declare interface NetworkContext extends Context {
352
576
  networkId?: string;
577
+ runtimeContext: RuntimeContext;
353
578
  }
354
579
 
580
+ export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
581
+
355
582
  declare interface QueryRequest {
356
583
  indexName: string;
357
584
  queryVector: number[];
@@ -366,20 +593,38 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
366
593
 
367
594
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
368
595
 
369
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
596
+ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
370
597
  body: {
371
598
  stepId: string;
372
599
  context: any;
373
600
  };
374
- container: Container;
375
- }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
601
+ runtimeContext: RuntimeContext;
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>;
603
+
604
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
605
+ body: {
606
+ step: string | string[];
607
+ resumeData?: unknown;
608
+ };
609
+ runtimeContext?: RuntimeContext_2;
610
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
376
611
 
377
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
612
+ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
378
613
  body: {
379
614
  stepId: string;
380
615
  context: any;
381
616
  };
382
- container: Container;
617
+ runtimeContext: RuntimeContext;
618
+ }): Promise<{
619
+ message: string;
620
+ }>;
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;
383
628
  }): Promise<{
384
629
  message: string;
385
630
  }>;
@@ -388,18 +633,39 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
388
633
  body: {
389
634
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
390
635
  };
391
- }): Promise<MessageType[]>;
636
+ }): Promise<MastraMessageV1[]>;
637
+
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
+ };
392
646
 
393
647
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
394
648
 
395
- export declare function startAsyncWorkflowHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
649
+ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
396
650
  triggerData?: unknown;
397
- container: Container;
398
- }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
651
+ runtimeContext: RuntimeContext;
652
+ }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
653
+
654
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
655
+ inputData?: unknown;
656
+ runtimeContext?: RuntimeContext_2;
657
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
399
658
 
400
- export declare function startWorkflowRunHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
659
+ export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
401
660
  triggerData?: unknown;
402
- container: Container;
661
+ runtimeContext: RuntimeContext;
662
+ }): Promise<{
663
+ message: string;
664
+ }>;
665
+
666
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
667
+ inputData?: unknown;
668
+ runtimeContext?: RuntimeContext_2;
403
669
  }): Promise<{
404
670
  message: string;
405
671
  }>;
@@ -417,27 +683,40 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
417
683
  status: string;
418
684
  message: string;
419
685
  error: any;
686
+ } | {
687
+ status: string;
688
+ message: string;
689
+ traceCount?: undefined;
420
690
  } | {
421
691
  status: string;
422
692
  message: string;
423
693
  traceCount: number;
424
694
  }>;
425
695
 
426
- export declare function streamGenerateHandler({ mastra, container, agentId, body, }: Context & {
427
- container: Container;
696
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
697
+ runtimeContext: RuntimeContext;
428
698
  agentId: string;
429
699
  body: GetBody<'stream'> & {
430
700
  resourceid?: string;
701
+ runtimeContext?: string;
431
702
  };
432
703
  }): Promise<Response | undefined>;
433
704
 
434
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, container, }: NetworkContext & {
435
- container: Container;
705
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
706
+ runtimeContext: RuntimeContext;
436
707
  body: {
437
708
  messages?: Parameters<AgentNetwork['stream']>[0];
438
709
  } & Parameters<AgentNetwork['stream']>[1];
439
710
  }): Promise<Response>;
440
711
 
712
+ export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
713
+ inputData?: unknown;
714
+ runtimeContext?: RuntimeContext_2;
715
+ }): Promise<{
716
+ stream: globalThis.ReadableStream<StreamEvent>;
717
+ getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
718
+ }>;
719
+
441
720
  declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
442
721
 
443
722
  export declare namespace telemetry {
@@ -454,6 +733,8 @@ declare interface TelemetryContext extends Context {
454
733
  page?: number;
455
734
  perPage?: number;
456
735
  attribute?: string | string[];
736
+ fromDate?: Date;
737
+ toDate?: Date;
457
738
  };
458
739
  }
459
740
 
@@ -540,7 +821,8 @@ export declare namespace voice {
540
821
  export {
541
822
  getSpeakersHandler,
542
823
  generateSpeechHandler,
543
- transcribeSpeechHandler
824
+ transcribeSpeechHandler,
825
+ getListenerHandler
544
826
  }
545
827
  }
546
828
 
@@ -548,22 +830,31 @@ declare interface VoiceContext extends Context {
548
830
  agentId?: string;
549
831
  }
550
832
 
551
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
833
+ export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
834
+
835
+ export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
552
836
 
553
837
  declare interface WorkflowContext extends Context {
554
838
  workflowId?: string;
555
839
  runId?: string;
556
840
  }
557
841
 
842
+ declare interface WorkflowContext_3 extends Context {
843
+ workflowId?: string;
844
+ runId?: string;
845
+ }
846
+
558
847
  export declare namespace workflows {
559
848
  export {
560
849
  getWorkflowsHandler,
561
850
  getWorkflowByIdHandler,
851
+ getWorkflowRunByIdHandler,
852
+ getWorkflowRunExecutionResultHandler,
853
+ createWorkflowRunHandler,
562
854
  startAsyncWorkflowHandler,
563
- getWorkflowRunHandler,
564
- createRunHandler,
565
855
  startWorkflowRunHandler,
566
856
  watchWorkflowHandler,
857
+ streamWorkflowHandler,
567
858
  resumeAsyncWorkflowHandler,
568
859
  resumeWorkflowHandler,
569
860
  getWorkflowRunsHandler