@mastra/server 0.0.0-fix-memory-xxhash-20250409202110 → 0.0.0-llamaindex-switch-core-20250424001624

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 (36) hide show
  1. package/{LICENSE → LICENSE.md} +3 -1
  2. package/dist/_tsup-dts-rollup.d.cts +34 -27
  3. package/dist/_tsup-dts-rollup.d.ts +34 -27
  4. package/dist/{chunk-2JQC6JWP.js → chunk-3EJZQ6TQ.js} +4 -1
  5. package/dist/{chunk-A7DF4ETD.cjs → chunk-55HTWX4C.cjs} +2 -9
  6. package/dist/{chunk-YNSGUC2O.js → chunk-5JNVY6DU.js} +8 -4
  7. package/dist/{chunk-QH6XWSXP.cjs → chunk-5SWCVTNL.cjs} +38 -38
  8. package/dist/{chunk-CWSDZEZG.cjs → chunk-7IWQE76Z.cjs} +2 -2
  9. package/dist/{chunk-4C3EPMMF.cjs → chunk-D3G23FP3.cjs} +12 -8
  10. package/dist/{chunk-5JOF627H.cjs → chunk-FPIWDH5Y.cjs} +6 -3
  11. package/dist/{chunk-GV52BII2.cjs → chunk-HCOPJZ4A.cjs} +13 -9
  12. package/dist/{chunk-ILW7XYNJ.js → chunk-LFOBHRFO.js} +17 -8
  13. package/dist/{chunk-VK6FX47H.js → chunk-OMN3UI6X.js} +38 -38
  14. package/dist/{chunk-3RVHWGWO.js → chunk-Q6SHQECN.js} +2 -9
  15. package/dist/{chunk-BMA2ORRT.js → chunk-R4J7XQYU.js} +9 -5
  16. package/dist/{chunk-2YONKUWB.js → chunk-RE6YL32K.js} +6 -3
  17. package/dist/{chunk-VB7KH62D.cjs → chunk-SKBVVI24.cjs} +4 -1
  18. package/dist/{chunk-X37I6GZT.cjs → chunk-TZK63M5N.cjs} +23 -14
  19. package/dist/{chunk-DVPP5S6I.js → chunk-WTHDCRMY.js} +2 -2
  20. package/dist/server/handlers/agents.cjs +7 -7
  21. package/dist/server/handlers/agents.js +1 -1
  22. package/dist/server/handlers/logs.cjs +4 -4
  23. package/dist/server/handlers/logs.js +1 -1
  24. package/dist/server/handlers/network.cjs +5 -5
  25. package/dist/server/handlers/network.js +1 -1
  26. package/dist/server/handlers/telemetry.cjs +3 -3
  27. package/dist/server/handlers/telemetry.js +1 -1
  28. package/dist/server/handlers/tools.cjs +5 -5
  29. package/dist/server/handlers/tools.js +1 -1
  30. package/dist/server/handlers/voice.cjs +4 -4
  31. package/dist/server/handlers/voice.js +1 -1
  32. package/dist/server/handlers/workflows.cjs +11 -11
  33. package/dist/server/handlers/workflows.js +1 -1
  34. package/dist/server/handlers.cjs +14 -14
  35. package/dist/server/handlers.js +7 -7
  36. package/package.json +5 -5
@@ -1,4 +1,6 @@
1
- Elastic License 2.0 (ELv2)
1
+ # Elastic License 2.0 (ELv2)
2
+
3
+ Copyright (c) 2025 Mastra AI, Inc.
2
4
 
3
5
  **Acceptance**
4
6
  By using the software, you agree to all of the terms and conditions below.
@@ -1,27 +1,27 @@
1
1
  import type { Agent } from '@mastra/core/agent';
2
2
  import type { AgentNetwork } from '@mastra/core/network';
3
- import { BaseLogMessage } from '@mastra/core';
3
+ import type { BaseLogMessage } from '@mastra/core/logger';
4
4
  import { CoreMessage } from 'ai';
5
- import { EvalRow } from '@mastra/core';
5
+ import { EvalRow } from '@mastra/core/storage';
6
6
  import { GenerateObjectResult } from 'ai';
7
7
  import { GenerateTextResult } from 'ai';
8
8
  import type { Mastra } from '@mastra/core/mastra';
9
- import type { Mastra as Mastra_2 } from '@mastra/core';
10
9
  import type { MastraMemory } from '@mastra/core/memory';
11
10
  import { Message } from 'ai';
12
- import { MessageType } from '@mastra/core';
11
+ import { MessageType } from '@mastra/core/memory';
13
12
  import type { QueryResult } from '@mastra/core/vector';
14
13
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
15
- import { Step } from '@mastra/core';
16
- import { StepExecutionContext } from '@mastra/core';
17
- import { StepGraph } from '@mastra/core';
18
- import { StorageThreadType } from '@mastra/core';
14
+ import type { RuntimeContext } from '@mastra/core/runtime-context';
15
+ import { Step } from '@mastra/core/workflows';
16
+ import { StepExecutionContext } from '@mastra/core/workflows';
17
+ import { StepGraph } from '@mastra/core/workflows';
18
+ import { StorageThreadType } from '@mastra/core/memory';
19
19
  import type { ToolAction } from '@mastra/core/tools';
20
20
  import type { VercelTool } from '@mastra/core/tools';
21
21
  import type { Workflow } from '@mastra/core/workflows';
22
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core';
23
- import { WorkflowRunResult } from '@mastra/core';
24
- import { WorkflowRuns } from '@mastra/core';
22
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
23
+ import { WorkflowRunResult } from '@mastra/core/workflows';
24
+ import type { WorkflowRuns } from '@mastra/core/storage';
25
25
 
26
26
  export declare namespace agents {
27
27
  export {
@@ -87,23 +87,27 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
87
87
  metric: string | undefined;
88
88
  }>;
89
89
 
90
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
90
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
91
  agentId?: string;
92
92
  data: any;
93
+ runtimeContext: RuntimeContext;
93
94
  }): Promise<any>;
94
95
 
95
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
96
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
96
97
  data?: unknown;
98
+ runtimeContext: RuntimeContext;
97
99
  }) => Promise<any>;
98
100
 
99
- export declare function generateHandler({ mastra, agentId, body, }: Context & {
101
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
102
+ runtimeContext: RuntimeContext;
100
103
  agentId: string;
101
104
  body: GetBody<'generate'> & {
102
105
  resourceid?: string;
103
106
  };
104
107
  }): Promise<GenerateTextResult<any, any>>;
105
108
 
106
- export declare function generateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
109
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
110
+ runtimeContext: RuntimeContext;
107
111
  body: {
108
112
  messages?: Parameters<AgentNetwork['generate']>[0];
109
113
  } & Parameters<AgentNetwork['generate']>[1];
@@ -117,9 +121,7 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
117
121
  text?: string;
118
122
  speakerId?: string;
119
123
  };
120
- }): Promise<{
121
- audioData: Buffer<ArrayBuffer>;
122
- }>;
124
+ }): Promise<NodeJS.ReadableStream>;
123
125
 
124
126
  export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
125
127
  agentId: string;
@@ -159,7 +161,7 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
159
161
 
160
162
  export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
161
163
 
162
- export declare function getLogsHandler({ mastra, transportId }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
164
+ export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
163
165
 
164
166
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
165
167
  transports: string[];
@@ -362,18 +364,20 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
362
364
 
363
365
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
364
366
 
365
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, }: WorkflowContext & {
367
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
366
368
  body: {
367
369
  stepId: string;
368
370
  context: any;
369
371
  };
372
+ runtimeContext: RuntimeContext;
370
373
  }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
371
374
 
372
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, }: WorkflowContext & {
375
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
373
376
  body: {
374
377
  stepId: string;
375
378
  context: any;
376
379
  };
380
+ runtimeContext: RuntimeContext;
377
381
  }): Promise<{
378
382
  message: string;
379
383
  }>;
@@ -386,12 +390,14 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
386
390
 
387
391
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
388
392
 
389
- export declare function startAsyncWorkflowHandler({ mastra, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
393
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
390
394
  triggerData?: unknown;
395
+ runtimeContext: RuntimeContext;
391
396
  }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
392
397
 
393
- export declare function startWorkflowRunHandler({ mastra, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
398
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
394
399
  triggerData?: unknown;
400
+ runtimeContext: RuntimeContext;
395
401
  }): Promise<{
396
402
  message: string;
397
403
  }>;
@@ -415,14 +421,16 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
415
421
  traceCount: number;
416
422
  }>;
417
423
 
418
- export declare function streamGenerateHandler({ mastra, agentId, body, }: Context & {
424
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
425
+ runtimeContext: RuntimeContext;
419
426
  agentId: string;
420
427
  body: GetBody<'stream'> & {
421
428
  resourceid?: string;
422
429
  };
423
430
  }): Promise<Response | undefined>;
424
431
 
425
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
432
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
433
+ runtimeContext: RuntimeContext;
426
434
  body: {
427
435
  messages?: Parameters<AgentNetwork['stream']>[0];
428
436
  } & Parameters<AgentNetwork['stream']>[1];
@@ -540,8 +548,7 @@ declare interface VoiceContext extends Context {
540
548
 
541
549
  export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
542
550
 
543
- declare interface WorkflowContext {
544
- mastra: Mastra_2;
551
+ declare interface WorkflowContext extends Context {
545
552
  workflowId?: string;
546
553
  runId?: string;
547
554
  }
@@ -1,27 +1,27 @@
1
1
  import type { Agent } from '@mastra/core/agent';
2
2
  import type { AgentNetwork } from '@mastra/core/network';
3
- import { BaseLogMessage } from '@mastra/core';
3
+ import type { BaseLogMessage } from '@mastra/core/logger';
4
4
  import { CoreMessage } from 'ai';
5
- import { EvalRow } from '@mastra/core';
5
+ import { EvalRow } from '@mastra/core/storage';
6
6
  import { GenerateObjectResult } from 'ai';
7
7
  import { GenerateTextResult } from 'ai';
8
8
  import type { Mastra } from '@mastra/core/mastra';
9
- import type { Mastra as Mastra_2 } from '@mastra/core';
10
9
  import type { MastraMemory } from '@mastra/core/memory';
11
10
  import { Message } from 'ai';
12
- import { MessageType } from '@mastra/core';
11
+ import { MessageType } from '@mastra/core/memory';
13
12
  import type { QueryResult } from '@mastra/core/vector';
14
13
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
15
- import { Step } from '@mastra/core';
16
- import { StepExecutionContext } from '@mastra/core';
17
- import { StepGraph } from '@mastra/core';
18
- import { StorageThreadType } from '@mastra/core';
14
+ import type { RuntimeContext } from '@mastra/core/runtime-context';
15
+ import { Step } from '@mastra/core/workflows';
16
+ import { StepExecutionContext } from '@mastra/core/workflows';
17
+ import { StepGraph } from '@mastra/core/workflows';
18
+ import { StorageThreadType } from '@mastra/core/memory';
19
19
  import type { ToolAction } from '@mastra/core/tools';
20
20
  import type { VercelTool } from '@mastra/core/tools';
21
21
  import type { Workflow } from '@mastra/core/workflows';
22
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core';
23
- import { WorkflowRunResult } from '@mastra/core';
24
- import { WorkflowRuns } from '@mastra/core';
22
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
23
+ import { WorkflowRunResult } from '@mastra/core/workflows';
24
+ import type { WorkflowRuns } from '@mastra/core/storage';
25
25
 
26
26
  export declare namespace agents {
27
27
  export {
@@ -87,23 +87,27 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
87
87
  metric: string | undefined;
88
88
  }>;
89
89
 
90
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
90
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
91
  agentId?: string;
92
92
  data: any;
93
+ runtimeContext: RuntimeContext;
93
94
  }): Promise<any>;
94
95
 
95
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
96
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
96
97
  data?: unknown;
98
+ runtimeContext: RuntimeContext;
97
99
  }) => Promise<any>;
98
100
 
99
- export declare function generateHandler({ mastra, agentId, body, }: Context & {
101
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
102
+ runtimeContext: RuntimeContext;
100
103
  agentId: string;
101
104
  body: GetBody<'generate'> & {
102
105
  resourceid?: string;
103
106
  };
104
107
  }): Promise<GenerateTextResult<any, any>>;
105
108
 
106
- export declare function generateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
109
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
110
+ runtimeContext: RuntimeContext;
107
111
  body: {
108
112
  messages?: Parameters<AgentNetwork['generate']>[0];
109
113
  } & Parameters<AgentNetwork['generate']>[1];
@@ -117,9 +121,7 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
117
121
  text?: string;
118
122
  speakerId?: string;
119
123
  };
120
- }): Promise<{
121
- audioData: Buffer<ArrayBuffer>;
122
- }>;
124
+ }): Promise<NodeJS.ReadableStream>;
123
125
 
124
126
  export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
125
127
  agentId: string;
@@ -159,7 +161,7 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
159
161
 
160
162
  export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
161
163
 
162
- export declare function getLogsHandler({ mastra, transportId }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
164
+ export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
163
165
 
164
166
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
165
167
  transports: string[];
@@ -362,18 +364,20 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
362
364
 
363
365
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
364
366
 
365
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, }: WorkflowContext & {
367
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
366
368
  body: {
367
369
  stepId: string;
368
370
  context: any;
369
371
  };
372
+ runtimeContext: RuntimeContext;
370
373
  }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
371
374
 
372
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, }: WorkflowContext & {
375
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
373
376
  body: {
374
377
  stepId: string;
375
378
  context: any;
376
379
  };
380
+ runtimeContext: RuntimeContext;
377
381
  }): Promise<{
378
382
  message: string;
379
383
  }>;
@@ -386,12 +390,14 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
386
390
 
387
391
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
388
392
 
389
- export declare function startAsyncWorkflowHandler({ mastra, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
393
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
390
394
  triggerData?: unknown;
395
+ runtimeContext: RuntimeContext;
391
396
  }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
392
397
 
393
- export declare function startWorkflowRunHandler({ mastra, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
398
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
394
399
  triggerData?: unknown;
400
+ runtimeContext: RuntimeContext;
395
401
  }): Promise<{
396
402
  message: string;
397
403
  }>;
@@ -415,14 +421,16 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
415
421
  traceCount: number;
416
422
  }>;
417
423
 
418
- export declare function streamGenerateHandler({ mastra, agentId, body, }: Context & {
424
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
425
+ runtimeContext: RuntimeContext;
419
426
  agentId: string;
420
427
  body: GetBody<'stream'> & {
421
428
  resourceid?: string;
422
429
  };
423
430
  }): Promise<Response | undefined>;
424
431
 
425
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
432
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
433
+ runtimeContext: RuntimeContext;
426
434
  body: {
427
435
  messages?: Parameters<AgentNetwork['stream']>[0];
428
436
  } & Parameters<AgentNetwork['stream']>[1];
@@ -540,8 +548,7 @@ declare interface VoiceContext extends Context {
540
548
 
541
549
  export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
542
550
 
543
- declare interface WorkflowContext {
544
- mastra: Mastra_2;
551
+ declare interface WorkflowContext extends Context {
545
552
  workflowId?: string;
546
553
  runId?: string;
547
554
  }
@@ -9,7 +9,10 @@ __export(logs_exports, {
9
9
  getLogsByRunIdHandler: () => getLogsByRunIdHandler,
10
10
  getLogsHandler: () => getLogsHandler
11
11
  });
12
- async function getLogsHandler({ mastra, transportId }) {
12
+ async function getLogsHandler({
13
+ mastra,
14
+ transportId
15
+ }) {
13
16
  try {
14
17
  validateBody({ transportId });
15
18
  const logs = await mastra.getLogs(transportId);
@@ -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';
@@ -55,7 +55,8 @@ function executeToolHandler(tools) {
55
55
  mastra,
56
56
  runId,
57
57
  toolId,
58
- data
58
+ data,
59
+ runtimeContext
59
60
  }) => {
60
61
  try {
61
62
  if (!toolId) {
@@ -76,7 +77,8 @@ function executeToolHandler(tools) {
76
77
  const result = await tool.execute({
77
78
  context: data,
78
79
  mastra,
79
- runId
80
+ runId,
81
+ runtimeContext
80
82
  });
81
83
  return result;
82
84
  } catch (error) {
@@ -88,7 +90,8 @@ async function executeAgentToolHandler({
88
90
  mastra,
89
91
  agentId,
90
92
  toolId,
91
- data
93
+ data,
94
+ runtimeContext
92
95
  }) {
93
96
  try {
94
97
  const agent = agentId ? mastra.getAgent(agentId) : null;
@@ -104,6 +107,7 @@ async function executeAgentToolHandler({
104
107
  }
105
108
  const result = await tool.execute({
106
109
  context: data,
110
+ runtimeContext,
107
111
  mastra,
108
112
  runId: agentId
109
113
  });