@mastra/server 0.0.0-message-ordering-20250415215612 → 0.0.0-remove-cloud-span-transform-20250425214156

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 (39) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +99 -24
  2. package/dist/_tsup-dts-rollup.d.ts +99 -24
  3. package/dist/{chunk-A7DF4ETD.cjs → chunk-55HTWX4C.cjs} +2 -9
  4. package/dist/{chunk-UV4WTEH4.js → chunk-5JNVY6DU.js} +5 -5
  5. package/dist/{chunk-QH6XWSXP.cjs → chunk-5SWCVTNL.cjs} +38 -38
  6. package/dist/{chunk-CWSDZEZG.cjs → chunk-7IWQE76Z.cjs} +2 -2
  7. package/dist/chunk-B66WVPGJ.js +297 -0
  8. package/dist/{chunk-PDC4ZBQW.cjs → chunk-D3G23FP3.cjs} +9 -9
  9. package/dist/{chunk-JLDXUWK7.cjs → chunk-FPIWDH5Y.cjs} +4 -4
  10. package/dist/{chunk-Z46X3YCB.cjs → chunk-HCOPJZ4A.cjs} +11 -11
  11. package/dist/{chunk-OPP7H5TW.js → chunk-LFOBHRFO.js} +10 -10
  12. package/dist/{chunk-VK6FX47H.js → chunk-OMN3UI6X.js} +38 -38
  13. package/dist/{chunk-3RVHWGWO.js → chunk-Q6SHQECN.js} +2 -9
  14. package/dist/{chunk-67WTHYAV.js → chunk-R4J7XQYU.js} +7 -7
  15. package/dist/{chunk-YANVFOYA.js → chunk-RE6YL32K.js} +4 -4
  16. package/dist/{chunk-B64YROKU.cjs → chunk-TZK63M5N.cjs} +16 -16
  17. package/dist/{chunk-DVPP5S6I.js → chunk-WTHDCRMY.js} +2 -2
  18. package/dist/chunk-ZHNKYTNS.cjs +309 -0
  19. package/dist/server/handlers/agents.cjs +7 -7
  20. package/dist/server/handlers/agents.js +1 -1
  21. package/dist/server/handlers/network.cjs +5 -5
  22. package/dist/server/handlers/network.js +1 -1
  23. package/dist/server/handlers/telemetry.cjs +3 -3
  24. package/dist/server/handlers/telemetry.js +1 -1
  25. package/dist/server/handlers/tools.cjs +5 -5
  26. package/dist/server/handlers/tools.js +1 -1
  27. package/dist/server/handlers/vNextWorkflows.cjs +46 -0
  28. package/dist/server/handlers/vNextWorkflows.d.cts +10 -0
  29. package/dist/server/handlers/vNextWorkflows.d.ts +10 -0
  30. package/dist/server/handlers/vNextWorkflows.js +1 -0
  31. package/dist/server/handlers/voice.cjs +4 -4
  32. package/dist/server/handlers/voice.js +1 -1
  33. package/dist/server/handlers/workflows.cjs +11 -11
  34. package/dist/server/handlers/workflows.js +1 -1
  35. package/dist/server/handlers.cjs +17 -12
  36. package/dist/server/handlers.d.cts +1 -0
  37. package/dist/server/handlers.d.ts +1 -0
  38. package/dist/server/handlers.js +7 -6
  39. package/package.json +3 -3
@@ -1,7 +1,6 @@
1
1
  import type { Agent } from '@mastra/core/agent';
2
2
  import type { AgentNetwork } from '@mastra/core/network';
3
3
  import type { BaseLogMessage } from '@mastra/core/logger';
4
- import type { Container } from '@mastra/core/di';
5
4
  import { CoreMessage } from 'ai';
6
5
  import { EvalRow } from '@mastra/core/storage';
7
6
  import { GenerateObjectResult } from 'ai';
@@ -10,18 +9,26 @@ import type { Mastra } from '@mastra/core/mastra';
10
9
  import type { MastraMemory } from '@mastra/core/memory';
11
10
  import { Message } from 'ai';
12
11
  import { MessageType } from '@mastra/core/memory';
12
+ import { NewStep } from '@mastra/core/workflows/vNext';
13
+ import type { NewWorkflow } from '@mastra/core/workflows/vNext';
13
14
  import type { QueryResult } from '@mastra/core/vector';
14
15
  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';
15
18
  import { Step } from '@mastra/core/workflows';
16
19
  import { StepExecutionContext } from '@mastra/core/workflows';
20
+ import { StepFlowEntry } from '@mastra/core/workflows/vNext';
17
21
  import { StepGraph } from '@mastra/core/workflows';
18
22
  import { StorageThreadType } from '@mastra/core/memory';
19
23
  import type { ToolAction } from '@mastra/core/tools';
20
24
  import type { VercelTool } from '@mastra/core/tools';
21
25
  import type { Workflow } from '@mastra/core/workflows';
22
26
  import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
27
+ import { WorkflowResult } from '@mastra/core/workflows/vNext';
23
28
  import { WorkflowRunResult } from '@mastra/core/workflows';
24
29
  import type { WorkflowRuns } from '@mastra/core/storage';
30
+ import { ZodType } from 'zod';
31
+ import { ZodTypeDef } from 'zod';
25
32
 
26
33
  export declare namespace agents {
27
34
  export {
@@ -67,6 +74,10 @@ export declare function createThreadHandler({ mastra, agentId, body, }: Pick<Mem
67
74
  };
68
75
  }): Promise<StorageThreadType>;
69
76
 
77
+ export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
78
+ runId: string;
79
+ }>;
80
+
70
81
  export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
71
82
  indexName?: string;
72
83
  }): Promise<{
@@ -87,27 +98,27 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
87
98
  metric: string | undefined;
88
99
  }>;
89
100
 
90
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, container, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
101
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
102
  agentId?: string;
92
103
  data: any;
93
- container: Container;
104
+ runtimeContext: RuntimeContext;
94
105
  }): Promise<any>;
95
106
 
96
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, container, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
107
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
97
108
  data?: unknown;
98
- container: Container;
109
+ runtimeContext: RuntimeContext;
99
110
  }) => Promise<any>;
100
111
 
101
- export declare function generateHandler({ mastra, container, agentId, body, }: Context & {
102
- container: Container;
112
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
113
+ runtimeContext: RuntimeContext;
103
114
  agentId: string;
104
115
  body: GetBody<'generate'> & {
105
116
  resourceid?: string;
106
117
  };
107
118
  }): Promise<GenerateTextResult<any, any>>;
108
119
 
109
- export declare function generateHandler_alias_1({ mastra, container, networkId, body, }: NetworkContext & {
110
- container: Container;
120
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
121
+ runtimeContext: RuntimeContext;
111
122
  body: {
112
123
  messages?: Parameters<AgentNetwork['generate']>[0];
113
124
  } & Parameters<AgentNetwork['generate']>[1];
@@ -121,9 +132,7 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
121
132
  text?: string;
122
133
  speakerId?: string;
123
134
  };
124
- }): Promise<{
125
- audioData: Buffer<ArrayBuffer>;
126
- }>;
135
+ }): Promise<NodeJS.ReadableStream>;
127
136
 
128
137
  export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
129
138
  agentId: string;
@@ -225,6 +234,20 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
225
234
 
226
235
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
227
236
 
237
+ export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
238
+ steps: any;
239
+ name: string | undefined;
240
+ stepGraph: StepFlowEntry[];
241
+ inputSchema: string | undefined;
242
+ outputSchema: string | undefined;
243
+ }>;
244
+
245
+ export declare function getVNextWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRun']>>;
246
+
247
+ export declare function getVNextWorkflowRunsHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<WorkflowRuns>;
248
+
249
+ export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
250
+
228
251
  export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
229
252
  stepGraph: StepGraph;
230
253
  stepSubscriberGraph: Record<string, StepGraph>;
@@ -366,20 +389,38 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
366
389
 
367
390
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
368
391
 
369
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
392
+ export declare function resumeAsyncVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
393
+ body: {
394
+ step: string | string[];
395
+ resumeData?: unknown;
396
+ };
397
+ runtimeContext?: RuntimeContext_2;
398
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, ZodType<any, ZodTypeDef, any>, ZodType<any, ZodTypeDef, any>>[]>>;
399
+
400
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
370
401
  body: {
371
402
  stepId: string;
372
403
  context: any;
373
404
  };
374
- container: Container;
405
+ runtimeContext: RuntimeContext;
375
406
  }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
376
407
 
377
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
408
+ export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
409
+ body: {
410
+ step: string | string[];
411
+ resumeData?: unknown;
412
+ };
413
+ runtimeContext?: RuntimeContext_2;
414
+ }): Promise<{
415
+ message: string;
416
+ }>;
417
+
418
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
378
419
  body: {
379
420
  stepId: string;
380
421
  context: any;
381
422
  };
382
- container: Container;
423
+ runtimeContext: RuntimeContext;
383
424
  }): Promise<{
384
425
  message: string;
385
426
  }>;
@@ -392,14 +433,26 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
392
433
 
393
434
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
394
435
 
395
- export declare function startAsyncWorkflowHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
436
+ export declare function startAsyncVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
437
+ inputData?: unknown;
438
+ runtimeContext?: RuntimeContext_2;
439
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, ZodType<any, ZodTypeDef, any>, ZodType<any, ZodTypeDef, any>>[]>>;
440
+
441
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
396
442
  triggerData?: unknown;
397
- container: Container;
443
+ runtimeContext: RuntimeContext;
398
444
  }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
399
445
 
400
- export declare function startWorkflowRunHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
446
+ export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
447
+ inputData?: unknown;
448
+ runtimeContext?: RuntimeContext_2;
449
+ }): Promise<{
450
+ message: string;
451
+ }>;
452
+
453
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
401
454
  triggerData?: unknown;
402
- container: Container;
455
+ runtimeContext: RuntimeContext;
403
456
  }): Promise<{
404
457
  message: string;
405
458
  }>;
@@ -423,16 +476,16 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
423
476
  traceCount: number;
424
477
  }>;
425
478
 
426
- export declare function streamGenerateHandler({ mastra, container, agentId, body, }: Context & {
427
- container: Container;
479
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
480
+ runtimeContext: RuntimeContext;
428
481
  agentId: string;
429
482
  body: GetBody<'stream'> & {
430
483
  resourceid?: string;
431
484
  };
432
485
  }): Promise<Response | undefined>;
433
486
 
434
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, container, }: NetworkContext & {
435
- container: Container;
487
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
488
+ runtimeContext: RuntimeContext;
436
489
  body: {
437
490
  messages?: Parameters<AgentNetwork['stream']>[0];
438
491
  } & Parameters<AgentNetwork['stream']>[1];
@@ -536,6 +589,26 @@ declare interface VectorContext extends Context {
536
589
  vectorName?: string;
537
590
  }
538
591
 
592
+ declare interface VNextWorkflowContext extends Context {
593
+ workflowId?: string;
594
+ runId?: string;
595
+ }
596
+
597
+ export declare namespace vNextWorkflows {
598
+ export {
599
+ getVNextWorkflowsHandler,
600
+ getVNextWorkflowByIdHandler,
601
+ getVNextWorkflowRunHandler,
602
+ createVNextWorkflowRunHandler,
603
+ startAsyncVNextWorkflowHandler,
604
+ startVNextWorkflowRunHandler,
605
+ watchVNextWorkflowHandler,
606
+ resumeAsyncVNextWorkflowHandler,
607
+ resumeVNextWorkflowHandler,
608
+ getVNextWorkflowRunsHandler
609
+ }
610
+ }
611
+
539
612
  export declare namespace voice {
540
613
  export {
541
614
  getSpeakersHandler,
@@ -548,6 +621,8 @@ declare interface VoiceContext extends Context {
548
621
  agentId?: string;
549
622
  }
550
623
 
624
+ export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
625
+
551
626
  export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
552
627
 
553
628
  declare interface WorkflowContext extends Context {
@@ -1,7 +1,6 @@
1
1
  import type { Agent } from '@mastra/core/agent';
2
2
  import type { AgentNetwork } from '@mastra/core/network';
3
3
  import type { BaseLogMessage } from '@mastra/core/logger';
4
- import type { Container } from '@mastra/core/di';
5
4
  import { CoreMessage } from 'ai';
6
5
  import { EvalRow } from '@mastra/core/storage';
7
6
  import { GenerateObjectResult } from 'ai';
@@ -10,18 +9,26 @@ import type { Mastra } from '@mastra/core/mastra';
10
9
  import type { MastraMemory } from '@mastra/core/memory';
11
10
  import { Message } from 'ai';
12
11
  import { MessageType } from '@mastra/core/memory';
12
+ import { NewStep } from '@mastra/core/workflows/vNext';
13
+ import type { NewWorkflow } from '@mastra/core/workflows/vNext';
13
14
  import type { QueryResult } from '@mastra/core/vector';
14
15
  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';
15
18
  import { Step } from '@mastra/core/workflows';
16
19
  import { StepExecutionContext } from '@mastra/core/workflows';
20
+ import { StepFlowEntry } from '@mastra/core/workflows/vNext';
17
21
  import { StepGraph } from '@mastra/core/workflows';
18
22
  import { StorageThreadType } from '@mastra/core/memory';
19
23
  import type { ToolAction } from '@mastra/core/tools';
20
24
  import type { VercelTool } from '@mastra/core/tools';
21
25
  import type { Workflow } from '@mastra/core/workflows';
22
26
  import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
27
+ import { WorkflowResult } from '@mastra/core/workflows/vNext';
23
28
  import { WorkflowRunResult } from '@mastra/core/workflows';
24
29
  import type { WorkflowRuns } from '@mastra/core/storage';
30
+ import { ZodType } from 'zod';
31
+ import { ZodTypeDef } from 'zod';
25
32
 
26
33
  export declare namespace agents {
27
34
  export {
@@ -67,6 +74,10 @@ export declare function createThreadHandler({ mastra, agentId, body, }: Pick<Mem
67
74
  };
68
75
  }): Promise<StorageThreadType>;
69
76
 
77
+ export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
78
+ runId: string;
79
+ }>;
80
+
70
81
  export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
71
82
  indexName?: string;
72
83
  }): Promise<{
@@ -87,27 +98,27 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
87
98
  metric: string | undefined;
88
99
  }>;
89
100
 
90
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, container, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
101
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
102
  agentId?: string;
92
103
  data: any;
93
- container: Container;
104
+ runtimeContext: RuntimeContext;
94
105
  }): Promise<any>;
95
106
 
96
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, container, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
107
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
97
108
  data?: unknown;
98
- container: Container;
109
+ runtimeContext: RuntimeContext;
99
110
  }) => Promise<any>;
100
111
 
101
- export declare function generateHandler({ mastra, container, agentId, body, }: Context & {
102
- container: Container;
112
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
113
+ runtimeContext: RuntimeContext;
103
114
  agentId: string;
104
115
  body: GetBody<'generate'> & {
105
116
  resourceid?: string;
106
117
  };
107
118
  }): Promise<GenerateTextResult<any, any>>;
108
119
 
109
- export declare function generateHandler_alias_1({ mastra, container, networkId, body, }: NetworkContext & {
110
- container: Container;
120
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
121
+ runtimeContext: RuntimeContext;
111
122
  body: {
112
123
  messages?: Parameters<AgentNetwork['generate']>[0];
113
124
  } & Parameters<AgentNetwork['generate']>[1];
@@ -121,9 +132,7 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
121
132
  text?: string;
122
133
  speakerId?: string;
123
134
  };
124
- }): Promise<{
125
- audioData: Buffer<ArrayBuffer>;
126
- }>;
135
+ }): Promise<NodeJS.ReadableStream>;
127
136
 
128
137
  export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
129
138
  agentId: string;
@@ -225,6 +234,20 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
225
234
 
226
235
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
227
236
 
237
+ export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
238
+ steps: any;
239
+ name: string | undefined;
240
+ stepGraph: StepFlowEntry[];
241
+ inputSchema: string | undefined;
242
+ outputSchema: string | undefined;
243
+ }>;
244
+
245
+ export declare function getVNextWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRun']>>;
246
+
247
+ export declare function getVNextWorkflowRunsHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<WorkflowRuns>;
248
+
249
+ export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
250
+
228
251
  export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
229
252
  stepGraph: StepGraph;
230
253
  stepSubscriberGraph: Record<string, StepGraph>;
@@ -366,20 +389,38 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
366
389
 
367
390
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
368
391
 
369
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
392
+ export declare function resumeAsyncVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
393
+ body: {
394
+ step: string | string[];
395
+ resumeData?: unknown;
396
+ };
397
+ runtimeContext?: RuntimeContext_2;
398
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, ZodType<any, ZodTypeDef, any>, ZodType<any, ZodTypeDef, any>>[]>>;
399
+
400
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
370
401
  body: {
371
402
  stepId: string;
372
403
  context: any;
373
404
  };
374
- container: Container;
405
+ runtimeContext: RuntimeContext;
375
406
  }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
376
407
 
377
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
408
+ export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
409
+ body: {
410
+ step: string | string[];
411
+ resumeData?: unknown;
412
+ };
413
+ runtimeContext?: RuntimeContext_2;
414
+ }): Promise<{
415
+ message: string;
416
+ }>;
417
+
418
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
378
419
  body: {
379
420
  stepId: string;
380
421
  context: any;
381
422
  };
382
- container: Container;
423
+ runtimeContext: RuntimeContext;
383
424
  }): Promise<{
384
425
  message: string;
385
426
  }>;
@@ -392,14 +433,26 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
392
433
 
393
434
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
394
435
 
395
- export declare function startAsyncWorkflowHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
436
+ export declare function startAsyncVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
437
+ inputData?: unknown;
438
+ runtimeContext?: RuntimeContext_2;
439
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, ZodType<any, ZodTypeDef, any>, ZodType<any, ZodTypeDef, any>>[]>>;
440
+
441
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
396
442
  triggerData?: unknown;
397
- container: Container;
443
+ runtimeContext: RuntimeContext;
398
444
  }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
399
445
 
400
- export declare function startWorkflowRunHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
446
+ export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
447
+ inputData?: unknown;
448
+ runtimeContext?: RuntimeContext_2;
449
+ }): Promise<{
450
+ message: string;
451
+ }>;
452
+
453
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
401
454
  triggerData?: unknown;
402
- container: Container;
455
+ runtimeContext: RuntimeContext;
403
456
  }): Promise<{
404
457
  message: string;
405
458
  }>;
@@ -423,16 +476,16 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
423
476
  traceCount: number;
424
477
  }>;
425
478
 
426
- export declare function streamGenerateHandler({ mastra, container, agentId, body, }: Context & {
427
- container: Container;
479
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
480
+ runtimeContext: RuntimeContext;
428
481
  agentId: string;
429
482
  body: GetBody<'stream'> & {
430
483
  resourceid?: string;
431
484
  };
432
485
  }): Promise<Response | undefined>;
433
486
 
434
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, container, }: NetworkContext & {
435
- container: Container;
487
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
488
+ runtimeContext: RuntimeContext;
436
489
  body: {
437
490
  messages?: Parameters<AgentNetwork['stream']>[0];
438
491
  } & Parameters<AgentNetwork['stream']>[1];
@@ -536,6 +589,26 @@ declare interface VectorContext extends Context {
536
589
  vectorName?: string;
537
590
  }
538
591
 
592
+ declare interface VNextWorkflowContext extends Context {
593
+ workflowId?: string;
594
+ runId?: string;
595
+ }
596
+
597
+ export declare namespace vNextWorkflows {
598
+ export {
599
+ getVNextWorkflowsHandler,
600
+ getVNextWorkflowByIdHandler,
601
+ getVNextWorkflowRunHandler,
602
+ createVNextWorkflowRunHandler,
603
+ startAsyncVNextWorkflowHandler,
604
+ startVNextWorkflowRunHandler,
605
+ watchVNextWorkflowHandler,
606
+ resumeAsyncVNextWorkflowHandler,
607
+ resumeVNextWorkflowHandler,
608
+ getVNextWorkflowRunsHandler
609
+ }
610
+ }
611
+
539
612
  export declare namespace voice {
540
613
  export {
541
614
  getSpeakersHandler,
@@ -548,6 +621,8 @@ declare interface VoiceContext extends Context {
548
621
  agentId?: string;
549
622
  }
550
623
 
624
+ export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
625
+
551
626
  export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
552
627
 
553
628
  declare interface WorkflowContext extends Context {
@@ -40,9 +40,7 @@ async function generateSpeechHandler({
40
40
  throw new chunkFV45V6WC_cjs.HTTPException(400, { message: "Agent ID is required" });
41
41
  }
42
42
  chunkQN4KF3BH_cjs.validateBody({
43
- text: void 0,
44
- speakerId: void 0,
45
- ...body
43
+ text: body?.text
46
44
  });
47
45
  const agent = mastra.getAgent(agentId);
48
46
  if (!agent) {
@@ -55,12 +53,7 @@ async function generateSpeechHandler({
55
53
  if (!audioStream) {
56
54
  throw new chunkFV45V6WC_cjs.HTTPException(500, { message: "Failed to generate speech" });
57
55
  }
58
- const chunks = [];
59
- for await (const chunk of audioStream) {
60
- chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
61
- }
62
- const audioData = Buffer.concat(chunks);
63
- return { audioData };
56
+ return audioStream;
64
57
  } catch (error) {
65
58
  return chunkZLBRQFDD_cjs.handleError(error, "Error generating speech");
66
59
  }
@@ -1,4 +1,4 @@
1
- import { stringify, esm_default } from './chunk-VK6FX47H.js';
1
+ import { stringify, esm_default } from './chunk-OMN3UI6X.js';
2
2
  import { validateBody } from './chunk-L7XE5QTW.js';
3
3
  import { handleError } from './chunk-3AHQ5RGN.js';
4
4
  import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
@@ -56,7 +56,7 @@ function executeToolHandler(tools) {
56
56
  runId,
57
57
  toolId,
58
58
  data,
59
- container
59
+ runtimeContext
60
60
  }) => {
61
61
  try {
62
62
  if (!toolId) {
@@ -78,7 +78,7 @@ function executeToolHandler(tools) {
78
78
  context: data,
79
79
  mastra,
80
80
  runId,
81
- container
81
+ runtimeContext
82
82
  });
83
83
  return result;
84
84
  } catch (error) {
@@ -91,7 +91,7 @@ async function executeAgentToolHandler({
91
91
  agentId,
92
92
  toolId,
93
93
  data,
94
- container
94
+ runtimeContext
95
95
  }) {
96
96
  try {
97
97
  const agent = agentId ? mastra.getAgent(agentId) : null;
@@ -107,7 +107,7 @@ async function executeAgentToolHandler({
107
107
  }
108
108
  const result = await tool.execute({
109
109
  context: data,
110
- container,
110
+ runtimeContext,
111
111
  mastra,
112
112
  runId: agentId
113
113
  });