@mastra/server 0.0.0-fix-memory-xxhash-20250409202110 → 0.0.0-generate-message-id-20250512171942

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 (75) hide show
  1. package/{LICENSE → LICENSE.md} +3 -1
  2. package/README.md +48 -135
  3. package/dist/_tsup-dts-rollup.d.cts +282 -34
  4. package/dist/_tsup-dts-rollup.d.ts +282 -34
  5. package/dist/{chunk-2FJURXCL.cjs → chunk-24EGIVT7.cjs} +34 -33
  6. package/dist/chunk-3HQNCTZ2.cjs +199 -0
  7. package/dist/{chunk-M56ECCHK.cjs → chunk-4YZ3U35L.cjs} +18 -17
  8. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  9. package/dist/chunk-5SN4U5AC.cjs +508 -0
  10. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  11. package/dist/chunk-75ZPJI57.cjs +9 -0
  12. package/dist/{chunk-2YONKUWB.js → chunk-C7564HUT.js} +58 -33
  13. package/dist/{chunk-ILW7XYNJ.js → chunk-EJO45KYT.js} +51 -27
  14. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  15. package/dist/{chunk-3RVHWGWO.js → chunk-HFWCEP5S.js} +6 -12
  16. package/dist/{chunk-2JQC6JWP.js → chunk-HWZVAG3H.js} +7 -4
  17. package/dist/{chunk-X37I6GZT.cjs → chunk-I2B73Y4I.cjs} +92 -68
  18. package/dist/{chunk-4JINXASC.js → chunk-IU5VO2I2.js} +3 -2
  19. package/dist/chunk-LIVAK2DM.js +2001 -0
  20. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  21. package/dist/{chunk-CWSDZEZG.cjs → chunk-MHKNLNAN.cjs} +15 -12
  22. package/dist/chunk-MIQYDLLM.js +329 -0
  23. package/dist/chunk-MLKGABMK.js +7 -0
  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-VB7KH62D.cjs → chunk-OGCNNUHF.cjs} +13 -10
  27. package/dist/{chunk-DVPP5S6I.js → chunk-OR3CIE2H.js} +9 -6
  28. package/dist/chunk-P6SCPDYW.js +500 -0
  29. package/dist/{chunk-BMA2ORRT.js → chunk-Q6KMBIAN.js} +76 -37
  30. package/dist/{chunk-YNSGUC2O.js → chunk-TJKLBTFB.js} +23 -7
  31. package/dist/chunk-UCTEMO2Q.cjs +341 -0
  32. package/dist/chunk-VPNDC2DI.cjs +148 -0
  33. package/dist/{chunk-RBQASTUP.js → chunk-X3ZDCS52.js} +4 -3
  34. package/dist/{chunk-A7DF4ETD.cjs → chunk-YBVOQN4M.cjs} +22 -28
  35. package/dist/chunk-YWLUOY3D.cjs +2004 -0
  36. package/dist/{chunk-4C3EPMMF.cjs → chunk-ZE5AAC4I.cjs} +40 -24
  37. package/dist/server/handlers/a2a.cjs +30 -0
  38. package/dist/server/handlers/a2a.d.cts +6 -0
  39. package/dist/server/handlers/a2a.d.ts +6 -0
  40. package/dist/server/handlers/a2a.js +1 -0
  41. package/dist/server/handlers/agents.cjs +7 -7
  42. package/dist/server/handlers/agents.js +1 -1
  43. package/dist/server/handlers/error.cjs +2 -2
  44. package/dist/server/handlers/error.js +1 -1
  45. package/dist/server/handlers/logs.cjs +4 -4
  46. package/dist/server/handlers/logs.js +1 -1
  47. package/dist/server/handlers/memory.cjs +9 -9
  48. package/dist/server/handlers/memory.js +1 -1
  49. package/dist/server/handlers/network.cjs +5 -5
  50. package/dist/server/handlers/network.js +1 -1
  51. package/dist/server/handlers/telemetry.cjs +3 -3
  52. package/dist/server/handlers/telemetry.js +1 -1
  53. package/dist/server/handlers/tools.cjs +5 -5
  54. package/dist/server/handlers/tools.js +1 -1
  55. package/dist/server/handlers/utils.cjs +2 -2
  56. package/dist/server/handlers/utils.js +1 -1
  57. package/dist/server/handlers/vNextWorkflows.cjs +46 -0
  58. package/dist/server/handlers/vNextWorkflows.d.cts +10 -0
  59. package/dist/server/handlers/vNextWorkflows.d.ts +10 -0
  60. package/dist/server/handlers/vNextWorkflows.js +1 -0
  61. package/dist/server/handlers/vector.cjs +7 -7
  62. package/dist/server/handlers/vector.js +1 -1
  63. package/dist/server/handlers/voice.cjs +4 -4
  64. package/dist/server/handlers/voice.js +1 -1
  65. package/dist/server/handlers/workflows.cjs +11 -11
  66. package/dist/server/handlers/workflows.js +1 -1
  67. package/dist/server/handlers.cjs +31 -21
  68. package/dist/server/handlers.d.cts +2 -0
  69. package/dist/server/handlers.d.ts +2 -0
  70. package/dist/server/handlers.js +11 -9
  71. package/package.json +9 -7
  72. package/dist/chunk-5JOF627H.cjs +0 -123
  73. package/dist/chunk-GV52BII2.cjs +0 -160
  74. package/dist/chunk-QH6XWSXP.cjs +0 -5579
  75. package/dist/chunk-VK6FX47H.js +0 -5576
@@ -1,27 +1,59 @@
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';
3
- import { BaseLogMessage } from '@mastra/core';
4
+ import type { Artifact } from '@mastra/core/a2a';
5
+ import type { BaseLogMessage } from '@mastra/core/logger';
4
6
  import { CoreMessage } from 'ai';
5
- import { EvalRow } from '@mastra/core';
7
+ import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
8
+ import { EvalRow } from '@mastra/core/storage';
6
9
  import { GenerateObjectResult } from 'ai';
7
10
  import { GenerateTextResult } from 'ai';
11
+ import type { JSONRPCError } from '@mastra/core/a2a';
12
+ import { JSONRPCResponse } from '@mastra/core/a2a';
13
+ import type { Logger } from '@mastra/core/logger';
8
14
  import type { Mastra } from '@mastra/core/mastra';
9
- import type { Mastra as Mastra_2 } from '@mastra/core';
10
15
  import type { MastraMemory } from '@mastra/core/memory';
11
16
  import { Message } from 'ai';
12
- import { MessageType } from '@mastra/core';
17
+ import type { Message as Message_2 } from '@mastra/core/a2a';
18
+ import { MessageType } from '@mastra/core/memory';
19
+ import { NewStep } from '@mastra/core/workflows/vNext';
20
+ import type { NewWorkflow } from '@mastra/core/workflows/vNext';
13
21
  import type { QueryResult } from '@mastra/core/vector';
14
22
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
15
- import { Step } from '@mastra/core';
16
- import { StepExecutionContext } from '@mastra/core';
17
- import { StepGraph } from '@mastra/core';
18
- import { StorageThreadType } from '@mastra/core';
23
+ import { RuntimeContext } from '@mastra/core/runtime-context';
24
+ import { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
25
+ import type { SerializedStepFlowEntry } from '@mastra/core/workflows/vNext';
26
+ import { Step } from '@mastra/core/workflows';
27
+ import { StepExecutionContext } from '@mastra/core/workflows';
28
+ import { StepGraph } from '@mastra/core/workflows';
29
+ import { StorageThreadType } from '@mastra/core/memory';
30
+ import { Task } from '@mastra/core/a2a';
31
+ import { TaskAndHistory } from '@mastra/core/a2a';
32
+ import type { TaskContext } from '@mastra/core/a2a';
33
+ import type { TaskIdParams } from '@mastra/core/a2a';
34
+ import type { TaskQueryParams } from '@mastra/core/a2a';
35
+ import type { TaskSendParams } from '@mastra/core/a2a';
36
+ import type { TaskStatus } from '@mastra/core/a2a';
19
37
  import type { ToolAction } from '@mastra/core/tools';
20
38
  import type { VercelTool } from '@mastra/core/tools';
21
39
  import type { Workflow } from '@mastra/core/workflows';
22
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core';
23
- import { WorkflowRunResult } from '@mastra/core';
24
- import { WorkflowRuns } from '@mastra/core';
40
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
41
+ import { WorkflowResult } from '@mastra/core/workflows/vNext';
42
+ import { WorkflowRunResult } from '@mastra/core/workflows';
43
+ import type { WorkflowRuns } from '@mastra/core/storage';
44
+ import { ZodType } from 'zod';
45
+ import { ZodTypeDef } from 'zod';
46
+
47
+ export declare namespace a2a {
48
+ export {
49
+ getAgentCardByIdHandler,
50
+ handleTaskSend,
51
+ handleTaskGet,
52
+ handleTaskSendSubscribe,
53
+ handleTaskCancel,
54
+ getAgentExecutionHandler
55
+ }
56
+ }
25
57
 
26
58
  export declare namespace agents {
27
59
  export {
@@ -39,12 +71,18 @@ export declare interface ApiError extends Error {
39
71
  status?: number;
40
72
  }
41
73
 
74
+ export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
75
+
42
76
  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
77
 
44
78
  export declare interface Context {
45
79
  mastra: Mastra;
46
80
  }
47
81
 
82
+ export declare function convertToCoreMessage(message: Message_2): CoreMessage_2;
83
+
84
+ export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
85
+
48
86
  export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
49
87
  index: CreateIndexRequest;
50
88
  }): Promise<{
@@ -61,12 +99,25 @@ export declare function createRunHandler({ mastra, workflowId, runId: prevRunId,
61
99
  runId: string;
62
100
  }>;
63
101
 
102
+ export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
103
+
104
+ export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
105
+ task: Task;
106
+ userMessage: Message_2;
107
+ history: Message_2[];
108
+ activeCancellations: Set<string>;
109
+ }): TaskContext;
110
+
64
111
  export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
65
112
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
66
113
  resourceId?: string;
67
114
  };
68
115
  }): Promise<StorageThreadType>;
69
116
 
117
+ export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
118
+ runId: string;
119
+ }>;
120
+
70
121
  export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
71
122
  indexName?: string;
72
123
  }): Promise<{
@@ -87,23 +138,30 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
87
138
  metric: string | undefined;
88
139
  }>;
89
140
 
90
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
141
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
142
  agentId?: string;
92
143
  data: any;
144
+ runtimeContext: RuntimeContext_2;
145
+ runtimeContextFromRequest: Record<string, unknown>;
93
146
  }): Promise<any>;
94
147
 
95
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
148
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
96
149
  data?: unknown;
150
+ runtimeContext: RuntimeContext_2;
151
+ runtimeContextFromRequest: Record<string, unknown>;
97
152
  }) => Promise<any>;
98
153
 
99
- export declare function generateHandler({ mastra, agentId, body, }: Context & {
154
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
155
+ runtimeContext: RuntimeContext;
100
156
  agentId: string;
101
157
  body: GetBody<'generate'> & {
102
158
  resourceid?: string;
159
+ runtimeContext?: Record<string, unknown>;
103
160
  };
104
161
  }): Promise<GenerateTextResult<any, any>>;
105
162
 
106
- export declare function generateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
163
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
164
+ runtimeContext: RuntimeContext;
107
165
  body: {
108
166
  messages?: Parameters<AgentNetwork['generate']>[0];
109
167
  } & Parameters<AgentNetwork['generate']>[1];
@@ -117,11 +175,10 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
117
175
  text?: string;
118
176
  speakerId?: string;
119
177
  };
120
- }): Promise<{
121
- audioData: Buffer<ArrayBuffer>;
122
- }>;
178
+ }): Promise<NodeJS.ReadableStream>;
123
179
 
124
- export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
180
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
181
+ runtimeContext: RuntimeContext;
125
182
  agentId: string;
126
183
  }): Promise<{
127
184
  name: any;
@@ -131,7 +188,30 @@ export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
131
188
  modelId: string;
132
189
  }>;
133
190
 
134
- export declare function getAgentsHandler({ mastra }: Context): Promise<any>;
191
+ export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
192
+ runtimeContext: RuntimeContext;
193
+ agentId: keyof ReturnType<typeof mastra.getAgents>;
194
+ executionUrl?: string;
195
+ version?: string;
196
+ provider?: {
197
+ organization: string;
198
+ url: string;
199
+ };
200
+ }): Promise<AgentCard>;
201
+
202
+ export declare function getAgentExecutionHandler({ requestId, mastra, agentId, runtimeContext, method, params, taskStore, logger, }: Context & {
203
+ requestId: string;
204
+ runtimeContext: RuntimeContext;
205
+ agentId: string;
206
+ method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
207
+ params: TaskSendParams | TaskQueryParams | TaskIdParams;
208
+ taskStore?: InMemoryTaskStore;
209
+ logger?: Logger;
210
+ }): Promise<any>;
211
+
212
+ export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
213
+ runtimeContext: RuntimeContext;
214
+ }): Promise<any>;
135
215
 
136
216
  declare type GetBody<T extends keyof Agent & {
137
217
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -139,7 +219,8 @@ declare type GetBody<T extends keyof Agent & {
139
219
  messages: Parameters<Agent[T]>[0];
140
220
  } & Parameters<Agent[T]>[1];
141
221
 
142
- export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
222
+ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
223
+ runtimeContext: RuntimeContext;
143
224
  agentId: string;
144
225
  }): Promise<{
145
226
  id: string;
@@ -148,7 +229,8 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
148
229
  evals: EvalRow[];
149
230
  }>;
150
231
 
151
- export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
232
+ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
233
+ runtimeContext: RuntimeContext;
152
234
  agentId: string;
153
235
  }): Promise<{
154
236
  id: string;
@@ -159,7 +241,7 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
159
241
 
160
242
  export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
161
243
 
162
- export declare function getLogsHandler({ mastra, transportId }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
244
+ export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
163
245
 
164
246
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
165
247
  transports: string[];
@@ -174,7 +256,7 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<
174
256
  uiMessages: Message[];
175
257
  }>;
176
258
 
177
- export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
259
+ export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
178
260
  id: string;
179
261
  name: string;
180
262
  instructions: string;
@@ -189,7 +271,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
189
271
  };
190
272
  }>;
191
273
 
192
- export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
274
+ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
193
275
  id: string;
194
276
  name: string;
195
277
  instructions: string;
@@ -221,6 +303,26 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
221
303
 
222
304
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
223
305
 
306
+ export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
307
+ steps: SerializedStep[];
308
+ name: string | undefined;
309
+ stepGraph: SerializedStepFlowEntry[];
310
+ inputSchema: string | undefined;
311
+ outputSchema: string | undefined;
312
+ }>;
313
+
314
+ export declare function getVNextWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRunById']>>;
315
+
316
+ export declare function getVNextWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: VNextWorkflowContext & {
317
+ fromDate?: Date;
318
+ toDate?: Date;
319
+ limit?: number;
320
+ offset?: number;
321
+ resourceId?: string;
322
+ }): Promise<WorkflowRuns>;
323
+
324
+ export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
325
+
224
326
  export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
225
327
  stepGraph: StepGraph;
226
328
  stepSubscriberGraph: Record<string, StepGraph>;
@@ -233,12 +335,60 @@ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowC
233
335
 
234
336
  export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
235
337
 
236
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
338
+ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
339
+ fromDate?: Date;
340
+ toDate?: Date;
341
+ limit?: number;
342
+ offset?: number;
343
+ resourceId?: string;
344
+ }): Promise<WorkflowRuns>;
237
345
 
238
346
  export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
239
347
 
240
348
  export declare function handleError(error: unknown, defaultMessage: string): never;
241
349
 
350
+ export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
351
+ requestId: string;
352
+ taskStore: InMemoryTaskStore;
353
+ agentId: string;
354
+ taskId: string;
355
+ logger?: Logger;
356
+ }): Promise<JSONRPCResponse<Task, unknown>>;
357
+
358
+ export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
359
+ requestId: string;
360
+ taskStore: InMemoryTaskStore;
361
+ agentId: string;
362
+ taskId: string;
363
+ }): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
364
+
365
+ export declare function handleTaskSend({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
366
+ requestId: string;
367
+ params: TaskSendParams;
368
+ taskStore: InMemoryTaskStore;
369
+ agent: Agent;
370
+ logger?: Logger;
371
+ runtimeContext: RuntimeContext;
372
+ }): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
373
+
374
+ export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
375
+ requestId: string;
376
+ params: TaskSendParams;
377
+ taskStore: InMemoryTaskStore;
378
+ agent: Agent;
379
+ logger?: Logger;
380
+ runtimeContext: RuntimeContext;
381
+ }): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
382
+ state: string;
383
+ message: {
384
+ role: string;
385
+ parts: {
386
+ type: string;
387
+ text: string;
388
+ }[];
389
+ };
390
+ }, unknown>, void, unknown>;
391
+
242
392
  /**
243
393
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
244
394
  *
@@ -300,8 +450,31 @@ declare type HTTPExceptionOptions = {
300
450
  */
301
451
  declare type InfoStatusCode = 100 | 101 | 102 | 103;
302
452
 
453
+ export declare class InMemoryTaskStore {
454
+ private store;
455
+ activeCancellations: Set<string>;
456
+ load({ agentId, taskId }: {
457
+ agentId: string;
458
+ taskId: string;
459
+ }): Promise<TaskAndHistory | null>;
460
+ save({ agentId, data }: {
461
+ agentId: string;
462
+ data: TaskAndHistory;
463
+ }): Promise<void>;
464
+ }
465
+
303
466
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
304
467
 
468
+ export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
469
+ agentId: string;
470
+ taskId: string;
471
+ taskStore: InMemoryTaskStore;
472
+ message: Message_2;
473
+ sessionId?: string | null;
474
+ metadata?: Record<string, unknown> | null;
475
+ logger?: Logger;
476
+ }): Promise<TaskAndHistory>;
477
+
305
478
  export declare namespace logs {
306
479
  export {
307
480
  getLogsHandler,
@@ -346,8 +519,11 @@ export declare namespace network {
346
519
 
347
520
  declare interface NetworkContext extends Context {
348
521
  networkId?: string;
522
+ runtimeContext: RuntimeContext;
349
523
  }
350
524
 
525
+ export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: Logger): JSONRPCResponse<null, unknown>;
526
+
351
527
  declare interface QueryRequest {
352
528
  indexName: string;
353
529
  queryVector: number[];
@@ -362,18 +538,39 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
362
538
 
363
539
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
364
540
 
365
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, }: WorkflowContext & {
541
+ export declare function resumeAsyncVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, runtimeContextFromRequest, }: VNextWorkflowContext & {
542
+ body: {
543
+ step: string | string[];
544
+ resumeData?: unknown;
545
+ };
546
+ runtimeContext?: RuntimeContext_2;
547
+ runtimeContextFromRequest?: Record<string, unknown>;
548
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
549
+
550
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
366
551
  body: {
367
552
  stepId: string;
368
553
  context: any;
369
554
  };
555
+ runtimeContext: RuntimeContext;
370
556
  }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
371
557
 
372
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, }: WorkflowContext & {
558
+ export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
559
+ body: {
560
+ step: string | string[];
561
+ resumeData?: unknown;
562
+ };
563
+ runtimeContext?: RuntimeContext_2;
564
+ }): Promise<{
565
+ message: string;
566
+ }>;
567
+
568
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
373
569
  body: {
374
570
  stepId: string;
375
571
  context: any;
376
572
  };
573
+ runtimeContext: RuntimeContext;
377
574
  }): Promise<{
378
575
  message: string;
379
576
  }>;
@@ -384,14 +581,39 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
384
581
  };
385
582
  }): Promise<MessageType[]>;
386
583
 
584
+ declare type SerializedStep = {
585
+ id: string;
586
+ description: string;
587
+ inputSchema: string | undefined;
588
+ outputSchema: string | undefined;
589
+ resumeSchema: string | undefined;
590
+ suspendSchema: string | undefined;
591
+ };
592
+
387
593
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
388
594
 
389
- export declare function startAsyncWorkflowHandler({ mastra, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
595
+ export declare function startAsyncVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
596
+ inputData?: unknown;
597
+ runtimeContext?: RuntimeContext_2;
598
+ runtimeContextFromRequest?: Record<string, unknown>;
599
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
600
+
601
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
390
602
  triggerData?: unknown;
603
+ runtimeContext: RuntimeContext;
391
604
  }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
392
605
 
393
- export declare function startWorkflowRunHandler({ mastra, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
606
+ export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
607
+ inputData?: unknown;
608
+ runtimeContext?: RuntimeContext_2;
609
+ runtimeContextFromRequest?: Record<string, unknown>;
610
+ }): Promise<{
611
+ message: string;
612
+ }>;
613
+
614
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
394
615
  triggerData?: unknown;
616
+ runtimeContext: RuntimeContext;
395
617
  }): Promise<{
396
618
  message: string;
397
619
  }>;
@@ -415,14 +637,17 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
415
637
  traceCount: number;
416
638
  }>;
417
639
 
418
- export declare function streamGenerateHandler({ mastra, agentId, body, }: Context & {
640
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
641
+ runtimeContext: RuntimeContext;
419
642
  agentId: string;
420
643
  body: GetBody<'stream'> & {
421
644
  resourceid?: string;
645
+ runtimeContext?: string;
422
646
  };
423
647
  }): Promise<Response | undefined>;
424
648
 
425
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
649
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
650
+ runtimeContext: RuntimeContext;
426
651
  body: {
427
652
  messages?: Parameters<AgentNetwork['stream']>[0];
428
653
  } & Parameters<AgentNetwork['stream']>[1];
@@ -444,6 +669,8 @@ declare interface TelemetryContext extends Context {
444
669
  page?: number;
445
670
  perPage?: number;
446
671
  attribute?: string | string[];
672
+ fromDate?: Date;
673
+ toDate?: Date;
447
674
  };
448
675
  }
449
676
 
@@ -526,6 +753,26 @@ declare interface VectorContext extends Context {
526
753
  vectorName?: string;
527
754
  }
528
755
 
756
+ declare interface VNextWorkflowContext extends Context {
757
+ workflowId?: string;
758
+ runId?: string;
759
+ }
760
+
761
+ export declare namespace vNextWorkflows {
762
+ export {
763
+ getVNextWorkflowsHandler,
764
+ getVNextWorkflowByIdHandler,
765
+ getVNextWorkflowRunByIdHandler,
766
+ createVNextWorkflowRunHandler,
767
+ startAsyncVNextWorkflowHandler,
768
+ startVNextWorkflowRunHandler,
769
+ watchVNextWorkflowHandler,
770
+ resumeAsyncVNextWorkflowHandler,
771
+ resumeVNextWorkflowHandler,
772
+ getVNextWorkflowRunsHandler
773
+ }
774
+ }
775
+
529
776
  export declare namespace voice {
530
777
  export {
531
778
  getSpeakersHandler,
@@ -538,10 +785,11 @@ declare interface VoiceContext extends Context {
538
785
  agentId?: string;
539
786
  }
540
787
 
788
+ export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
789
+
541
790
  export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
542
791
 
543
- declare interface WorkflowContext {
544
- mastra: Mastra_2;
792
+ declare interface WorkflowContext extends Context {
545
793
  workflowId?: string;
546
794
  runId?: string;
547
795
  }