@mastra/server 0.0.0-fix-message-embedding-20250506021742 → 0.0.0-inject-middleware-20250528213451

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