@mastra/server 0.0.0-message-ordering-20250415215612 → 0.0.0-redis-cloud-transporter-20250508191651

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 (40) hide show
  1. package/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +128 -31
  3. package/dist/_tsup-dts-rollup.d.ts +128 -31
  4. package/dist/{chunk-OPP7H5TW.js → chunk-3XTEV33Q.js} +26 -14
  5. package/dist/{chunk-A7DF4ETD.cjs → chunk-55HTWX4C.cjs} +2 -9
  6. package/dist/{chunk-UV4WTEH4.js → chunk-5JNVY6DU.js} +5 -5
  7. package/dist/{chunk-QH6XWSXP.cjs → chunk-5SWCVTNL.cjs} +38 -38
  8. package/dist/{chunk-JLDXUWK7.cjs → chunk-5YGDYMRB.cjs} +52 -31
  9. package/dist/{chunk-Z46X3YCB.cjs → chunk-6Q7UXAYJ.cjs} +72 -38
  10. package/dist/{chunk-CWSDZEZG.cjs → chunk-AMVOS7YB.cjs} +6 -4
  11. package/dist/{chunk-DVPP5S6I.js → chunk-BPL2CBLV.js} +6 -4
  12. package/dist/{chunk-B64YROKU.cjs → chunk-CHFORQ7J.cjs} +32 -20
  13. package/dist/{chunk-PDC4ZBQW.cjs → chunk-D3G23FP3.cjs} +9 -9
  14. package/dist/{chunk-67WTHYAV.js → chunk-GVBJ5I2S.js} +70 -36
  15. package/dist/chunk-M2RXDCPV.cjs +324 -0
  16. package/dist/{chunk-VK6FX47H.js → chunk-OMN3UI6X.js} +38 -38
  17. package/dist/chunk-OWNA6I2H.js +312 -0
  18. package/dist/{chunk-3RVHWGWO.js → chunk-Q6SHQECN.js} +2 -9
  19. package/dist/{chunk-YANVFOYA.js → chunk-QJ3AHN64.js} +52 -31
  20. package/dist/server/handlers/agents.cjs +7 -7
  21. package/dist/server/handlers/agents.js +1 -1
  22. package/dist/server/handlers/network.cjs +5 -5
  23. package/dist/server/handlers/network.js +1 -1
  24. package/dist/server/handlers/telemetry.cjs +3 -3
  25. package/dist/server/handlers/telemetry.js +1 -1
  26. package/dist/server/handlers/tools.cjs +5 -5
  27. package/dist/server/handlers/tools.js +1 -1
  28. package/dist/server/handlers/vNextWorkflows.cjs +46 -0
  29. package/dist/server/handlers/vNextWorkflows.d.cts +10 -0
  30. package/dist/server/handlers/vNextWorkflows.d.ts +10 -0
  31. package/dist/server/handlers/vNextWorkflows.js +1 -0
  32. package/dist/server/handlers/voice.cjs +4 -4
  33. package/dist/server/handlers/voice.js +1 -1
  34. package/dist/server/handlers/workflows.cjs +11 -11
  35. package/dist/server/handlers/workflows.js +1 -1
  36. package/dist/server/handlers.cjs +17 -12
  37. package/dist/server/handlers.d.cts +1 -0
  38. package/dist/server/handlers.d.ts +1 -0
  39. package/dist/server/handlers.js +7 -6
  40. package/package.json +6 -6
@@ -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,8 +9,13 @@ 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 { 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';
15
19
  import { Step } from '@mastra/core/workflows';
16
20
  import { StepExecutionContext } from '@mastra/core/workflows';
17
21
  import { StepGraph } from '@mastra/core/workflows';
@@ -20,8 +24,11 @@ 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,28 @@ 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;
117
+ runtimeContext?: Record<string, unknown>;
106
118
  };
107
119
  }): Promise<GenerateTextResult<any, any>>;
108
120
 
109
- export declare function generateHandler_alias_1({ mastra, container, networkId, body, }: NetworkContext & {
110
- container: Container;
121
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
122
+ runtimeContext: RuntimeContext;
111
123
  body: {
112
124
  messages?: Parameters<AgentNetwork['generate']>[0];
113
125
  } & Parameters<AgentNetwork['generate']>[1];
@@ -121,11 +133,10 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
121
133
  text?: string;
122
134
  speakerId?: string;
123
135
  };
124
- }): Promise<{
125
- audioData: Buffer<ArrayBuffer>;
126
- }>;
136
+ }): Promise<NodeJS.ReadableStream>;
127
137
 
128
- export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
138
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
139
+ runtimeContext: RuntimeContext;
129
140
  agentId: string;
130
141
  }): Promise<{
131
142
  name: any;
@@ -135,7 +146,9 @@ export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
135
146
  modelId: string;
136
147
  }>;
137
148
 
138
- export declare function getAgentsHandler({ mastra }: Context): Promise<any>;
149
+ export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
150
+ runtimeContext: RuntimeContext;
151
+ }): Promise<any>;
139
152
 
140
153
  declare type GetBody<T extends keyof Agent & {
141
154
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -143,7 +156,8 @@ declare type GetBody<T extends keyof Agent & {
143
156
  messages: Parameters<Agent[T]>[0];
144
157
  } & Parameters<Agent[T]>[1];
145
158
 
146
- export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
159
+ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
160
+ runtimeContext: RuntimeContext;
147
161
  agentId: string;
148
162
  }): Promise<{
149
163
  id: string;
@@ -152,7 +166,8 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
152
166
  evals: EvalRow[];
153
167
  }>;
154
168
 
155
- export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
169
+ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
170
+ runtimeContext: RuntimeContext;
156
171
  agentId: string;
157
172
  }): Promise<{
158
173
  id: string;
@@ -178,7 +193,7 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<
178
193
  uiMessages: Message[];
179
194
  }>;
180
195
 
181
- export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
196
+ export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
182
197
  id: string;
183
198
  name: string;
184
199
  instructions: string;
@@ -193,7 +208,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
193
208
  };
194
209
  }>;
195
210
 
196
- export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
211
+ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
197
212
  id: string;
198
213
  name: string;
199
214
  instructions: string;
@@ -225,6 +240,26 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
225
240
 
226
241
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
227
242
 
243
+ export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
244
+ steps: any;
245
+ name: string | undefined;
246
+ stepGraph: SerializedStepFlowEntry[];
247
+ inputSchema: string | undefined;
248
+ outputSchema: string | undefined;
249
+ }>;
250
+
251
+ export declare function getVNextWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRunById']>>;
252
+
253
+ export declare function getVNextWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: VNextWorkflowContext & {
254
+ fromDate?: Date;
255
+ toDate?: Date;
256
+ limit?: number;
257
+ offset?: number;
258
+ resourceId?: string;
259
+ }): Promise<WorkflowRuns>;
260
+
261
+ export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
262
+
228
263
  export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
229
264
  stepGraph: StepGraph;
230
265
  stepSubscriberGraph: Record<string, StepGraph>;
@@ -237,7 +272,13 @@ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowC
237
272
 
238
273
  export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
239
274
 
240
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
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>;
241
282
 
242
283
  export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
243
284
 
@@ -350,6 +391,7 @@ export declare namespace network {
350
391
 
351
392
  declare interface NetworkContext extends Context {
352
393
  networkId?: string;
394
+ runtimeContext: RuntimeContext;
353
395
  }
354
396
 
355
397
  declare interface QueryRequest {
@@ -366,20 +408,38 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
366
408
 
367
409
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
368
410
 
369
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
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 & {
370
420
  body: {
371
421
  stepId: string;
372
422
  context: any;
373
423
  };
374
- container: Container;
424
+ runtimeContext: RuntimeContext;
375
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>;
376
426
 
377
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
427
+ export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
428
+ body: {
429
+ step: string | string[];
430
+ resumeData?: unknown;
431
+ };
432
+ runtimeContext?: RuntimeContext_2;
433
+ }): Promise<{
434
+ message: string;
435
+ }>;
436
+
437
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
378
438
  body: {
379
439
  stepId: string;
380
440
  context: any;
381
441
  };
382
- container: Container;
442
+ runtimeContext: RuntimeContext;
383
443
  }): Promise<{
384
444
  message: string;
385
445
  }>;
@@ -392,14 +452,26 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
392
452
 
393
453
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
394
454
 
395
- export declare function startAsyncWorkflowHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
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>[]>>;
459
+
460
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
396
461
  triggerData?: unknown;
397
- container: Container;
462
+ runtimeContext: RuntimeContext;
398
463
  }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
399
464
 
400
- export declare function startWorkflowRunHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
465
+ export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
466
+ inputData?: unknown;
467
+ runtimeContext?: RuntimeContext_2;
468
+ }): Promise<{
469
+ message: string;
470
+ }>;
471
+
472
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
401
473
  triggerData?: unknown;
402
- container: Container;
474
+ runtimeContext: RuntimeContext;
403
475
  }): Promise<{
404
476
  message: string;
405
477
  }>;
@@ -423,16 +495,17 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
423
495
  traceCount: number;
424
496
  }>;
425
497
 
426
- export declare function streamGenerateHandler({ mastra, container, agentId, body, }: Context & {
427
- container: Container;
498
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
499
+ runtimeContext: RuntimeContext;
428
500
  agentId: string;
429
501
  body: GetBody<'stream'> & {
430
502
  resourceid?: string;
503
+ runtimeContext?: string;
431
504
  };
432
505
  }): Promise<Response | undefined>;
433
506
 
434
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, container, }: NetworkContext & {
435
- container: Container;
507
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
508
+ runtimeContext: RuntimeContext;
436
509
  body: {
437
510
  messages?: Parameters<AgentNetwork['stream']>[0];
438
511
  } & Parameters<AgentNetwork['stream']>[1];
@@ -454,6 +527,8 @@ declare interface TelemetryContext extends Context {
454
527
  page?: number;
455
528
  perPage?: number;
456
529
  attribute?: string | string[];
530
+ fromDate?: Date;
531
+ toDate?: Date;
457
532
  };
458
533
  }
459
534
 
@@ -536,6 +611,26 @@ declare interface VectorContext extends Context {
536
611
  vectorName?: string;
537
612
  }
538
613
 
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
+
539
634
  export declare namespace voice {
540
635
  export {
541
636
  getSpeakersHandler,
@@ -548,6 +643,8 @@ declare interface VoiceContext extends Context {
548
643
  agentId?: string;
549
644
  }
550
645
 
646
+ export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
647
+
551
648
  export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
552
649
 
553
650
  declare interface WorkflowContext extends Context {
@@ -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 { handleError } from './chunk-3AHQ5RGN.js';
3
3
  import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
4
4
  import { ReadableStream } from 'node:stream/web';
@@ -32,7 +32,9 @@ async function getWorkflowsHandler({ mastra }) {
32
32
  steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
33
33
  const _step = step;
34
34
  acc2[key2] = {
35
- ..._step,
35
+ id: _step.id,
36
+ description: _step.description,
37
+ workflowId: _step.workflowId,
36
38
  inputSchema: _step.inputSchema ? stringify(esm_default(_step.inputSchema)) : void 0,
37
39
  outputSchema: _step.outputSchema ? stringify(esm_default(_step.outputSchema)) : void 0
38
40
  };
@@ -65,7 +67,9 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
65
67
  steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
66
68
  const _step = step;
67
69
  acc[key] = {
68
- ..._step,
70
+ id: _step.id,
71
+ description: _step.description,
72
+ workflowId: _step.workflowId,
69
73
  inputSchema: _step.inputSchema ? stringify(esm_default(_step.inputSchema)) : void 0,
70
74
  outputSchema: _step.outputSchema ? stringify(esm_default(_step.outputSchema)) : void 0
71
75
  };
@@ -78,7 +82,7 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
78
82
  }
79
83
  async function startAsyncWorkflowHandler({
80
84
  mastra,
81
- container,
85
+ runtimeContext,
82
86
  workflowId,
83
87
  runId,
84
88
  triggerData
@@ -95,7 +99,7 @@ async function startAsyncWorkflowHandler({
95
99
  const { start } = workflow.createRun();
96
100
  const result2 = await start({
97
101
  triggerData,
98
- container
102
+ runtimeContext
99
103
  });
100
104
  return result2;
101
105
  }
@@ -105,7 +109,7 @@ async function startAsyncWorkflowHandler({
105
109
  }
106
110
  const result = await run.start({
107
111
  triggerData,
108
- container
112
+ runtimeContext
109
113
  });
110
114
  return result;
111
115
  } catch (error) {
@@ -158,7 +162,7 @@ async function createRunHandler({
158
162
  }
159
163
  async function startWorkflowRunHandler({
160
164
  mastra,
161
- container,
165
+ runtimeContext,
162
166
  workflowId,
163
167
  runId,
164
168
  triggerData
@@ -177,7 +181,7 @@ async function startWorkflowRunHandler({
177
181
  }
178
182
  await run.start({
179
183
  triggerData,
180
- container
184
+ runtimeContext
181
185
  });
182
186
  return { message: "Workflow run started" };
183
187
  } catch (e) {
@@ -233,7 +237,7 @@ async function resumeAsyncWorkflowHandler({
233
237
  workflowId,
234
238
  runId,
235
239
  body,
236
- container
240
+ runtimeContext
237
241
  }) {
238
242
  try {
239
243
  if (!workflowId) {
@@ -250,7 +254,7 @@ async function resumeAsyncWorkflowHandler({
250
254
  const result = await run.resume({
251
255
  stepId: body.stepId,
252
256
  context: body.context,
253
- container
257
+ runtimeContext
254
258
  });
255
259
  return result;
256
260
  } catch (error) {
@@ -262,7 +266,7 @@ async function resumeWorkflowHandler({
262
266
  workflowId,
263
267
  runId,
264
268
  body,
265
- container
269
+ runtimeContext
266
270
  }) {
267
271
  try {
268
272
  if (!workflowId) {
@@ -279,20 +283,28 @@ async function resumeWorkflowHandler({
279
283
  await run.resume({
280
284
  stepId: body.stepId,
281
285
  context: body.context,
282
- container
286
+ runtimeContext
283
287
  });
284
288
  return { message: "Workflow run resumed" };
285
289
  } catch (error) {
286
290
  return handleError(error, "Error resuming workflow");
287
291
  }
288
292
  }
289
- async function getWorkflowRunsHandler({ mastra, workflowId }) {
293
+ async function getWorkflowRunsHandler({
294
+ mastra,
295
+ workflowId,
296
+ fromDate,
297
+ toDate,
298
+ limit,
299
+ offset,
300
+ resourceId
301
+ }) {
290
302
  try {
291
303
  if (!workflowId) {
292
304
  throw new HTTPException(400, { message: "Workflow ID is required" });
293
305
  }
294
306
  const workflow = mastra.getWorkflow(workflowId);
295
- const workflowRuns = await workflow.getWorkflowRuns() || {
307
+ const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
296
308
  runs: [],
297
309
  total: 0
298
310
  };
@@ -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
  });