@mastra/server 0.0.0-vnext-inngest-20250508131921 → 0.0.0-vnextAgentNetwork-20250527102918

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