@mastra/server 0.0.0-bundle-dynamic-imports-20250424001248 → 0.0.0-cli-debug-2-20250611100354

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 (81) hide show
  1. package/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +331 -42
  3. package/dist/_tsup-dts-rollup.d.ts +331 -42
  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-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  7. package/dist/chunk-6F2H7Y45.js +255 -0
  8. package/dist/{chunk-2FJURXCL.cjs → chunk-6TJSHFCJ.cjs} +44 -36
  9. package/dist/chunk-75ZPJI57.cjs +9 -0
  10. package/dist/chunk-7IBZ4L35.js +344 -0
  11. package/dist/{chunk-7IWQE76Z.cjs → chunk-B4MQFJ7G.cjs} +16 -10
  12. package/dist/{chunk-WTHDCRMY.js → chunk-BFOA2QQY.js} +12 -6
  13. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  14. package/dist/{chunk-RE6YL32K.js → chunk-C7564HUT.js} +52 -30
  15. package/dist/{chunk-55HTWX4C.cjs → chunk-CMMOIUFC.cjs} +40 -19
  16. package/dist/{chunk-Q6SHQECN.js → chunk-CP55EVBK.js} +24 -4
  17. package/dist/chunk-GHC4YV6R.js +504 -0
  18. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  19. package/dist/{chunk-5JNVY6DU.js → chunk-HYP7B2TL.js} +7 -5
  20. package/dist/{chunk-RBQASTUP.js → chunk-I7KJZNX5.js} +14 -6
  21. package/dist/chunk-IMBY5XUG.cjs +86 -0
  22. package/dist/chunk-JEWNMAYQ.cjs +263 -0
  23. package/dist/chunk-JKF6PRPU.cjs +357 -0
  24. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  25. package/dist/chunk-MLKGABMK.js +7 -0
  26. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  27. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  28. package/dist/chunk-QLG2PFHE.js +81 -0
  29. package/dist/chunk-SDPGVWQJ.cjs +512 -0
  30. package/dist/{chunk-LFOBHRFO.js → chunk-TEZOEGR4.js} +69 -54
  31. package/dist/{chunk-D3G23FP3.cjs → chunk-TJO277H7.cjs} +24 -22
  32. package/dist/chunk-UZ7FJ66C.cjs +332 -0
  33. package/dist/{chunk-FPIWDH5Y.cjs → chunk-VPNDC2DI.cjs} +62 -40
  34. package/dist/chunk-WKWHYFX4.js +2001 -0
  35. package/dist/chunk-XUGQSVZ4.cjs +2004 -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 +17 -13
  67. package/dist/server/handlers/workflows.d.cts +3 -2
  68. package/dist/server/handlers/workflows.d.ts +3 -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 +12 -10
  75. package/dist/chunk-3EJZQ6TQ.js +0 -49
  76. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  77. package/dist/chunk-HCOPJZ4A.cjs +0 -164
  78. package/dist/chunk-OMN3UI6X.js +0 -5576
  79. package/dist/chunk-R4J7XQYU.js +0 -156
  80. package/dist/chunk-SKBVVI24.cjs +0 -54
  81. package/dist/chunk-TZK63M5N.cjs +0 -317
@@ -1,27 +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
6
  import { CoreMessage } from 'ai';
7
+ import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
5
8
  import { EvalRow } from '@mastra/core/storage';
6
9
  import { GenerateObjectResult } from 'ai';
7
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';
8
19
  import type { Mastra } from '@mastra/core/mastra';
9
20
  import type { MastraMemory } from '@mastra/core/memory';
10
- import { Message } from 'ai';
11
- import { MessageType } from '@mastra/core/memory';
21
+ import { MastraMessageV1 } from '@mastra/core/memory';
22
+ import type { Message } from '@mastra/core/a2a';
12
23
  import type { QueryResult } from '@mastra/core/vector';
13
24
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
14
- import type { RuntimeContext } from '@mastra/core/runtime-context';
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';
21
43
  import type { Workflow } from '@mastra/core/workflows';
22
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
23
- import { WorkflowRunResult } from '@mastra/core/workflows';
44
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
45
+ import { WorkflowResult } from '@mastra/core/workflows';
24
46
  import type { WorkflowRuns } from '@mastra/core/storage';
47
+ import { ZodType } from 'zod';
48
+ import { ZodTypeDef } from 'zod';
49
+
50
+ export declare namespace a2a {
51
+ export {
52
+ getAgentCardByIdHandler,
53
+ handleTaskSend,
54
+ handleTaskGet,
55
+ handleTaskSendSubscribe,
56
+ handleTaskCancel,
57
+ getAgentExecutionHandler
58
+ }
59
+ }
25
60
 
26
61
  export declare namespace agents {
27
62
  export {
@@ -39,12 +74,18 @@ export declare interface ApiError extends Error {
39
74
  status?: number;
40
75
  }
41
76
 
77
+ export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
78
+
42
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;
43
80
 
44
81
  export declare interface Context {
45
82
  mastra: Mastra;
46
83
  }
47
84
 
85
+ export declare function convertToCoreMessage(message: Message): CoreMessage_2;
86
+
87
+ export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
88
+
48
89
  export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
49
90
  index: CreateIndexRequest;
50
91
  }): Promise<{
@@ -57,16 +98,29 @@ declare interface CreateIndexRequest {
57
98
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
58
99
  }
59
100
 
60
- 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<{
61
102
  runId: string;
62
103
  }>;
63
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
+
64
114
  export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
65
115
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
66
116
  resourceId?: string;
67
117
  };
68
118
  }): Promise<StorageThreadType>;
69
119
 
120
+ export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
121
+ runId: string;
122
+ }>;
123
+
70
124
  export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
71
125
  indexName?: string;
72
126
  }): Promise<{
@@ -90,12 +144,12 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
90
144
  export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
145
  agentId?: string;
92
146
  data: any;
93
- runtimeContext: RuntimeContext;
147
+ runtimeContext: RuntimeContext_2;
94
148
  }): Promise<any>;
95
149
 
96
150
  export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
97
151
  data?: unknown;
98
- runtimeContext: RuntimeContext;
152
+ runtimeContext: RuntimeContext_2;
99
153
  }) => Promise<any>;
100
154
 
101
155
  export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
@@ -103,6 +157,7 @@ export declare function generateHandler({ mastra, runtimeContext, agentId, body,
103
157
  agentId: string;
104
158
  body: GetBody<'generate'> & {
105
159
  resourceid?: string;
160
+ runtimeContext?: Record<string, unknown>;
106
161
  };
107
162
  }): Promise<GenerateTextResult<any, any>>;
108
163
 
@@ -123,17 +178,45 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
123
178
  };
124
179
  }): Promise<NodeJS.ReadableStream>;
125
180
 
126
- export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
181
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
182
+ isPlayground?: boolean;
183
+ runtimeContext: RuntimeContext;
127
184
  agentId: string;
128
185
  }): Promise<{
129
186
  name: any;
130
187
  instructions: string;
131
188
  tools: any;
189
+ workflows: {};
132
190
  provider: string;
133
191
  modelId: string;
192
+ defaultGenerateOptions: any;
193
+ defaultStreamOptions: any;
134
194
  }>;
135
195
 
136
- export declare function getAgentsHandler({ mastra }: Context): Promise<any>;
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
+
217
+ export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
218
+ runtimeContext: RuntimeContext;
219
+ }): Promise<any>;
137
220
 
138
221
  declare type GetBody<T extends keyof Agent & {
139
222
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -141,7 +224,8 @@ declare type GetBody<T extends keyof Agent & {
141
224
  messages: Parameters<Agent[T]>[0];
142
225
  } & Parameters<Agent[T]>[1];
143
226
 
144
- export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
227
+ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
228
+ runtimeContext: RuntimeContext;
145
229
  agentId: string;
146
230
  }): Promise<{
147
231
  id: string;
@@ -150,7 +234,37 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
150
234
  evals: EvalRow[];
151
235
  }>;
152
236
 
153
- export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
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
+
266
+ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
267
+ runtimeContext: RuntimeContext;
154
268
  agentId: string;
155
269
  }): Promise<{
156
270
  id: string;
@@ -159,9 +273,21 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
159
273
  evals: EvalRow[];
160
274
  }>;
161
275
 
162
- 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
+ }>;
163
283
 
164
- 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
+ }>;
165
291
 
166
292
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
167
293
  transports: string[];
@@ -171,12 +297,14 @@ export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryC
171
297
  result: boolean;
172
298
  }>;
173
299
 
174
- export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
300
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
301
+ limit?: number;
302
+ }): Promise<{
175
303
  messages: CoreMessage[];
176
- uiMessages: Message[];
304
+ uiMessages: UIMessage[];
177
305
  }>;
178
306
 
179
- export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
307
+ export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
180
308
  id: string;
181
309
  name: string;
182
310
  instructions: string;
@@ -191,7 +319,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
191
319
  };
192
320
  }>;
193
321
 
194
- export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
322
+ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
195
323
  id: string;
196
324
  name: string;
197
325
  instructions: string;
@@ -223,24 +351,73 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
223
351
 
224
352
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
225
353
 
226
- export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
227
- stepGraph: StepGraph;
228
- stepSubscriberGraph: Record<string, StepGraph>;
229
- serializedStepGraph: StepGraph;
230
- serializedStepSubscriberGraph: Record<string, StepGraph>;
231
- name: string;
232
- triggerSchema: string | undefined;
233
- steps: any;
354
+ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
355
+ steps: SerializedStep[];
356
+ name: string | undefined;
357
+ description: string | undefined;
358
+ stepGraph: SerializedStepFlowEntry[];
359
+ inputSchema: string | undefined;
360
+ outputSchema: string | undefined;
234
361
  }>;
235
362
 
236
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
363
+ export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
237
364
 
238
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
365
+ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
366
+ fromDate?: Date;
367
+ toDate?: Date;
368
+ limit?: number;
369
+ offset?: number;
370
+ resourceId?: string;
371
+ }): Promise<WorkflowRuns>;
239
372
 
240
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
373
+ export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
241
374
 
242
375
  export declare function handleError(error: unknown, defaultMessage: string): never;
243
376
 
377
+ export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
378
+ requestId: string;
379
+ taskStore: InMemoryTaskStore;
380
+ agentId: string;
381
+ taskId: string;
382
+ logger?: IMastraLogger;
383
+ }): Promise<JSONRPCResponse<Task, unknown>>;
384
+
385
+ export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
386
+ requestId: string;
387
+ taskStore: InMemoryTaskStore;
388
+ agentId: string;
389
+ taskId: string;
390
+ }): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
391
+
392
+ export declare function handleTaskSend({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
393
+ requestId: string;
394
+ params: TaskSendParams;
395
+ taskStore: InMemoryTaskStore;
396
+ agent: Agent;
397
+ agentId: string;
398
+ logger?: IMastraLogger;
399
+ runtimeContext: RuntimeContext;
400
+ }): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
401
+
402
+ export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
403
+ requestId: string;
404
+ params: TaskSendParams;
405
+ taskStore: InMemoryTaskStore;
406
+ agent: Agent;
407
+ agentId: string;
408
+ logger?: IMastraLogger;
409
+ runtimeContext: RuntimeContext;
410
+ }): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
411
+ state: string;
412
+ message: {
413
+ role: string;
414
+ parts: {
415
+ type: string;
416
+ text: string;
417
+ }[];
418
+ };
419
+ }, unknown>, void, unknown>;
420
+
244
421
  /**
245
422
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
246
423
  *
@@ -302,8 +479,46 @@ declare type HTTPExceptionOptions = {
302
479
  */
303
480
  declare type InfoStatusCode = 100 | 101 | 102 | 103;
304
481
 
482
+ export declare class InMemoryTaskStore {
483
+ private store;
484
+ activeCancellations: Set<string>;
485
+ load({ agentId, taskId }: {
486
+ agentId: string;
487
+ taskId: string;
488
+ }): Promise<TaskAndHistory | null>;
489
+ save({ agentId, data }: {
490
+ agentId: string;
491
+ data: TaskAndHistory;
492
+ }): Promise<void>;
493
+ }
494
+
495
+ export declare namespace legacyWorkflows {
496
+ export {
497
+ getLegacyWorkflowsHandler,
498
+ getLegacyWorkflowByIdHandler,
499
+ startAsyncLegacyWorkflowHandler,
500
+ getLegacyWorkflowRunHandler,
501
+ createLegacyWorkflowRunHandler,
502
+ startLegacyWorkflowRunHandler,
503
+ watchLegacyWorkflowHandler,
504
+ resumeAsyncLegacyWorkflowHandler,
505
+ resumeLegacyWorkflowHandler,
506
+ getLegacyWorkflowRunsHandler
507
+ }
508
+ }
509
+
305
510
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
306
511
 
512
+ export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
513
+ agentId: string;
514
+ taskId: string;
515
+ taskStore: InMemoryTaskStore;
516
+ message: Message;
517
+ sessionId?: string | null;
518
+ metadata?: Record<string, unknown> | null;
519
+ logger?: IMastraLogger;
520
+ }): Promise<TaskAndHistory>;
521
+
307
522
  export declare namespace logs {
308
523
  export {
309
524
  getLogsHandler,
@@ -316,6 +531,14 @@ declare type LogsContext = {
316
531
  mastra: Mastra;
317
532
  transportId?: string;
318
533
  runId?: string;
534
+ params?: {
535
+ fromDate?: Date;
536
+ toDate?: Date;
537
+ logLevel?: LogLevel;
538
+ filters?: string | string[];
539
+ page?: number;
540
+ perPage?: number;
541
+ };
319
542
  };
320
543
 
321
544
  export declare namespace memory {
@@ -348,8 +571,11 @@ export declare namespace network {
348
571
 
349
572
  declare interface NetworkContext extends Context {
350
573
  networkId?: string;
574
+ runtimeContext: RuntimeContext;
351
575
  }
352
576
 
577
+ export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
578
+
353
579
  declare interface QueryRequest {
354
580
  indexName: string;
355
581
  queryVector: number[];
@@ -364,15 +590,23 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
364
590
 
365
591
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
366
592
 
367
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
593
+ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
368
594
  body: {
369
595
  stepId: string;
370
596
  context: any;
371
597
  };
372
598
  runtimeContext: RuntimeContext;
373
- }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
599
+ }): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
600
+
601
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
602
+ body: {
603
+ step: string | string[];
604
+ resumeData?: unknown;
605
+ };
606
+ runtimeContext?: RuntimeContext_2;
607
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
374
608
 
375
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
609
+ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
376
610
  body: {
377
611
  stepId: string;
378
612
  context: any;
@@ -382,26 +616,57 @@ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body,
382
616
  message: string;
383
617
  }>;
384
618
 
619
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
620
+ body: {
621
+ step: string | string[];
622
+ resumeData?: unknown;
623
+ };
624
+ runtimeContext?: RuntimeContext_2;
625
+ }): Promise<{
626
+ message: string;
627
+ }>;
628
+
385
629
  export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
386
630
  body: {
387
631
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
388
632
  };
389
- }): Promise<MessageType[]>;
633
+ }): Promise<MastraMessageV1[]>;
634
+
635
+ declare type SerializedStep = {
636
+ id: string;
637
+ description: string;
638
+ inputSchema: string | undefined;
639
+ outputSchema: string | undefined;
640
+ resumeSchema: string | undefined;
641
+ suspendSchema: string | undefined;
642
+ };
390
643
 
391
644
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
392
645
 
393
- export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
646
+ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
394
647
  triggerData?: unknown;
395
648
  runtimeContext: RuntimeContext;
396
- }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
649
+ }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
650
+
651
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
652
+ inputData?: unknown;
653
+ runtimeContext?: RuntimeContext_2;
654
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
397
655
 
398
- export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
656
+ export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
399
657
  triggerData?: unknown;
400
658
  runtimeContext: RuntimeContext;
401
659
  }): Promise<{
402
660
  message: string;
403
661
  }>;
404
662
 
663
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
664
+ inputData?: unknown;
665
+ runtimeContext?: RuntimeContext_2;
666
+ }): Promise<{
667
+ message: string;
668
+ }>;
669
+
405
670
  /**
406
671
  * If you want to use an unofficial status, use `UnofficialStatusCode`.
407
672
  */
@@ -415,6 +680,10 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
415
680
  status: string;
416
681
  message: string;
417
682
  error: any;
683
+ } | {
684
+ status: string;
685
+ message: string;
686
+ traceCount?: undefined;
418
687
  } | {
419
688
  status: string;
420
689
  message: string;
@@ -426,6 +695,7 @@ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId,
426
695
  agentId: string;
427
696
  body: GetBody<'stream'> & {
428
697
  resourceid?: string;
698
+ runtimeContext?: string;
429
699
  };
430
700
  }): Promise<Response | undefined>;
431
701
 
@@ -436,6 +706,14 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
436
706
  } & Parameters<AgentNetwork['stream']>[1];
437
707
  }): Promise<Response>;
438
708
 
709
+ export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
710
+ inputData?: unknown;
711
+ runtimeContext?: RuntimeContext_2;
712
+ }): {
713
+ stream: globalThis.ReadableStream<StreamEvent>;
714
+ getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
715
+ };
716
+
439
717
  declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
440
718
 
441
719
  export declare namespace telemetry {
@@ -452,6 +730,8 @@ declare interface TelemetryContext extends Context {
452
730
  page?: number;
453
731
  perPage?: number;
454
732
  attribute?: string | string[];
733
+ fromDate?: Date;
734
+ toDate?: Date;
455
735
  };
456
736
  }
457
737
 
@@ -538,7 +818,8 @@ export declare namespace voice {
538
818
  export {
539
819
  getSpeakersHandler,
540
820
  generateSpeechHandler,
541
- transcribeSpeechHandler
821
+ transcribeSpeechHandler,
822
+ getListenerHandler
542
823
  }
543
824
  }
544
825
 
@@ -546,22 +827,30 @@ declare interface VoiceContext extends Context {
546
827
  agentId?: string;
547
828
  }
548
829
 
549
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
830
+ export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
831
+
832
+ export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
550
833
 
551
834
  declare interface WorkflowContext extends Context {
552
835
  workflowId?: string;
553
836
  runId?: string;
554
837
  }
555
838
 
839
+ declare interface WorkflowContext_3 extends Context {
840
+ workflowId?: string;
841
+ runId?: string;
842
+ }
843
+
556
844
  export declare namespace workflows {
557
845
  export {
558
846
  getWorkflowsHandler,
559
847
  getWorkflowByIdHandler,
848
+ getWorkflowRunByIdHandler,
849
+ createWorkflowRunHandler,
560
850
  startAsyncWorkflowHandler,
561
- getWorkflowRunHandler,
562
- createRunHandler,
563
851
  startWorkflowRunHandler,
564
852
  watchWorkflowHandler,
853
+ streamWorkflowHandler,
565
854
  resumeAsyncWorkflowHandler,
566
855
  resumeWorkflowHandler,
567
856
  getWorkflowRunsHandler