@mastra/server 2.0.0-alpha.6 → 2.0.0-alpha.8

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.
@@ -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';
@@ -12,6 +11,7 @@ import { Message } from 'ai';
12
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';
14
+ import type { RuntimeContext } from '@mastra/core/di';
15
15
  import { Step } from '@mastra/core/workflows';
16
16
  import { StepExecutionContext } from '@mastra/core/workflows';
17
17
  import { StepGraph } from '@mastra/core/workflows';
@@ -87,27 +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, container, }: 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
- container: Container;
93
+ runtimeContext: RuntimeContext;
94
94
  }): Promise<any>;
95
95
 
96
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, container, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
96
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
97
97
  data?: unknown;
98
- container: Container;
98
+ runtimeContext: RuntimeContext;
99
99
  }) => Promise<any>;
100
100
 
101
- export declare function generateHandler({ mastra, container, agentId, body, }: Context & {
102
- container: Container;
101
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
102
+ runtimeContext: RuntimeContext;
103
103
  agentId: string;
104
104
  body: GetBody<'generate'> & {
105
105
  resourceid?: string;
106
106
  };
107
107
  }): Promise<GenerateTextResult<any, any>>;
108
108
 
109
- export declare function generateHandler_alias_1({ mastra, container, networkId, body, }: NetworkContext & {
110
- container: Container;
109
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
110
+ runtimeContext: RuntimeContext;
111
111
  body: {
112
112
  messages?: Parameters<AgentNetwork['generate']>[0];
113
113
  } & Parameters<AgentNetwork['generate']>[1];
@@ -366,20 +366,20 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
366
366
 
367
367
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
368
368
 
369
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
369
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
370
370
  body: {
371
371
  stepId: string;
372
372
  context: any;
373
373
  };
374
- container: Container;
374
+ runtimeContext: RuntimeContext;
375
375
  }): 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
376
 
377
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
377
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
378
378
  body: {
379
379
  stepId: string;
380
380
  context: any;
381
381
  };
382
- container: Container;
382
+ runtimeContext: RuntimeContext;
383
383
  }): Promise<{
384
384
  message: string;
385
385
  }>;
@@ -392,14 +392,14 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
392
392
 
393
393
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
394
394
 
395
- export declare function startAsyncWorkflowHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
395
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
396
396
  triggerData?: unknown;
397
- container: Container;
397
+ runtimeContext: RuntimeContext;
398
398
  }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
399
399
 
400
- export declare function startWorkflowRunHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
400
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
401
401
  triggerData?: unknown;
402
- container: Container;
402
+ runtimeContext: RuntimeContext;
403
403
  }): Promise<{
404
404
  message: string;
405
405
  }>;
@@ -423,16 +423,16 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
423
423
  traceCount: number;
424
424
  }>;
425
425
 
426
- export declare function streamGenerateHandler({ mastra, container, agentId, body, }: Context & {
427
- container: Container;
426
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
427
+ runtimeContext: RuntimeContext;
428
428
  agentId: string;
429
429
  body: GetBody<'stream'> & {
430
430
  resourceid?: string;
431
431
  };
432
432
  }): Promise<Response | undefined>;
433
433
 
434
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, container, }: NetworkContext & {
435
- container: Container;
434
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
435
+ runtimeContext: RuntimeContext;
436
436
  body: {
437
437
  messages?: Parameters<AgentNetwork['stream']>[0];
438
438
  } & Parameters<AgentNetwork['stream']>[1];
@@ -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';
@@ -12,6 +11,7 @@ import { Message } from 'ai';
12
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';
14
+ import type { RuntimeContext } from '@mastra/core/di';
15
15
  import { Step } from '@mastra/core/workflows';
16
16
  import { StepExecutionContext } from '@mastra/core/workflows';
17
17
  import { StepGraph } from '@mastra/core/workflows';
@@ -87,27 +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, container, }: 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
- container: Container;
93
+ runtimeContext: RuntimeContext;
94
94
  }): Promise<any>;
95
95
 
96
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, container, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
96
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
97
97
  data?: unknown;
98
- container: Container;
98
+ runtimeContext: RuntimeContext;
99
99
  }) => Promise<any>;
100
100
 
101
- export declare function generateHandler({ mastra, container, agentId, body, }: Context & {
102
- container: Container;
101
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
102
+ runtimeContext: RuntimeContext;
103
103
  agentId: string;
104
104
  body: GetBody<'generate'> & {
105
105
  resourceid?: string;
106
106
  };
107
107
  }): Promise<GenerateTextResult<any, any>>;
108
108
 
109
- export declare function generateHandler_alias_1({ mastra, container, networkId, body, }: NetworkContext & {
110
- container: Container;
109
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
110
+ runtimeContext: RuntimeContext;
111
111
  body: {
112
112
  messages?: Parameters<AgentNetwork['generate']>[0];
113
113
  } & Parameters<AgentNetwork['generate']>[1];
@@ -366,20 +366,20 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
366
366
 
367
367
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
368
368
 
369
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
369
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
370
370
  body: {
371
371
  stepId: string;
372
372
  context: any;
373
373
  };
374
- container: Container;
374
+ runtimeContext: RuntimeContext;
375
375
  }): 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
376
 
377
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
377
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
378
378
  body: {
379
379
  stepId: string;
380
380
  context: any;
381
381
  };
382
- container: Container;
382
+ runtimeContext: RuntimeContext;
383
383
  }): Promise<{
384
384
  message: string;
385
385
  }>;
@@ -392,14 +392,14 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
392
392
 
393
393
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
394
394
 
395
- export declare function startAsyncWorkflowHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
395
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
396
396
  triggerData?: unknown;
397
- container: Container;
397
+ runtimeContext: RuntimeContext;
398
398
  }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
399
399
 
400
- export declare function startWorkflowRunHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
400
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
401
401
  triggerData?: unknown;
402
- container: Container;
402
+ runtimeContext: RuntimeContext;
403
403
  }): Promise<{
404
404
  message: string;
405
405
  }>;
@@ -423,16 +423,16 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
423
423
  traceCount: number;
424
424
  }>;
425
425
 
426
- export declare function streamGenerateHandler({ mastra, container, agentId, body, }: Context & {
427
- container: Container;
426
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
427
+ runtimeContext: RuntimeContext;
428
428
  agentId: string;
429
429
  body: GetBody<'stream'> & {
430
430
  resourceid?: string;
431
431
  };
432
432
  }): Promise<Response | undefined>;
433
433
 
434
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, container, }: NetworkContext & {
435
- container: Container;
434
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
435
+ runtimeContext: RuntimeContext;
436
436
  body: {
437
437
  messages?: Parameters<AgentNetwork['stream']>[0];
438
438
  } & Parameters<AgentNetwork['stream']>[1];
@@ -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
  });
@@ -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) {
@@ -58,7 +58,7 @@ function executeToolHandler(tools$1) {
58
58
  runId,
59
59
  toolId,
60
60
  data,
61
- container
61
+ runtimeContext
62
62
  }) => {
63
63
  try {
64
64
  if (!toolId) {
@@ -80,7 +80,7 @@ function executeToolHandler(tools$1) {
80
80
  context: data,
81
81
  mastra,
82
82
  runId,
83
- container
83
+ runtimeContext
84
84
  });
85
85
  return result;
86
86
  } catch (error) {
@@ -93,7 +93,7 @@ async function executeAgentToolHandler({
93
93
  agentId,
94
94
  toolId,
95
95
  data,
96
- container
96
+ runtimeContext
97
97
  }) {
98
98
  try {
99
99
  const agent = agentId ? mastra.getAgent(agentId) : null;
@@ -109,7 +109,7 @@ async function executeAgentToolHandler({
109
109
  }
110
110
  const result = await tool.execute({
111
111
  context: data,
112
- container,
112
+ runtimeContext,
113
113
  mastra,
114
114
  runId: agentId
115
115
  });
@@ -71,7 +71,7 @@ async function getNetworkByIdHandler({ mastra, networkId }) {
71
71
  }
72
72
  async function generateHandler({
73
73
  mastra,
74
- container,
74
+ runtimeContext,
75
75
  networkId,
76
76
  body
77
77
  }) {
@@ -82,7 +82,7 @@ async function generateHandler({
82
82
  }
83
83
  chunkQN4KF3BH_cjs.validateBody({ messages: body.messages });
84
84
  const { messages, ...rest } = body;
85
- const result = await network.generate(messages, { ...rest, container });
85
+ const result = await network.generate(messages, { ...rest, runtimeContext });
86
86
  return result;
87
87
  } catch (error) {
88
88
  return chunkZLBRQFDD_cjs.handleError(error, "Error generating from network");
@@ -92,7 +92,7 @@ async function streamGenerateHandler({
92
92
  mastra,
93
93
  networkId,
94
94
  body,
95
- container
95
+ runtimeContext
96
96
  }) {
97
97
  try {
98
98
  const network = mastra.getNetwork(networkId);
@@ -104,7 +104,7 @@ async function streamGenerateHandler({
104
104
  const streamResult = await network.stream(messages, {
105
105
  output,
106
106
  ...rest,
107
- container
107
+ runtimeContext
108
108
  });
109
109
  const streamResponse = output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
110
110
  sendUsage: true,
@@ -99,7 +99,7 @@ async function getLiveEvalsByAgentIdHandler({ mastra, agentId }) {
99
99
  }
100
100
  async function generateHandler({
101
101
  mastra,
102
- container,
102
+ runtimeContext,
103
103
  agentId,
104
104
  body
105
105
  }) {
@@ -115,7 +115,7 @@ async function generateHandler({
115
115
  ...rest,
116
116
  // @ts-expect-error TODO fix types
117
117
  resourceId: finalResourceId,
118
- container
118
+ runtimeContext
119
119
  });
120
120
  return result;
121
121
  } catch (error) {
@@ -124,7 +124,7 @@ async function generateHandler({
124
124
  }
125
125
  async function streamGenerateHandler({
126
126
  mastra,
127
- container,
127
+ runtimeContext,
128
128
  agentId,
129
129
  body
130
130
  }) {
@@ -140,7 +140,7 @@ async function streamGenerateHandler({
140
140
  ...rest,
141
141
  // @ts-expect-error TODO fix types
142
142
  resourceId: finalResourceId,
143
- container
143
+ runtimeContext
144
144
  });
145
145
  const streamResponse = rest.output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
146
146
  sendUsage: true,
@@ -78,7 +78,7 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
78
78
  }
79
79
  async function startAsyncWorkflowHandler({
80
80
  mastra,
81
- container,
81
+ runtimeContext,
82
82
  workflowId,
83
83
  runId,
84
84
  triggerData
@@ -95,7 +95,7 @@ async function startAsyncWorkflowHandler({
95
95
  const { start } = workflow.createRun();
96
96
  const result2 = await start({
97
97
  triggerData,
98
- container
98
+ runtimeContext
99
99
  });
100
100
  return result2;
101
101
  }
@@ -105,7 +105,7 @@ async function startAsyncWorkflowHandler({
105
105
  }
106
106
  const result = await run.start({
107
107
  triggerData,
108
- container
108
+ runtimeContext
109
109
  });
110
110
  return result;
111
111
  } catch (error) {
@@ -158,7 +158,7 @@ async function createRunHandler({
158
158
  }
159
159
  async function startWorkflowRunHandler({
160
160
  mastra,
161
- container,
161
+ runtimeContext,
162
162
  workflowId,
163
163
  runId,
164
164
  triggerData
@@ -177,7 +177,7 @@ async function startWorkflowRunHandler({
177
177
  }
178
178
  await run.start({
179
179
  triggerData,
180
- container
180
+ runtimeContext
181
181
  });
182
182
  return { message: "Workflow run started" };
183
183
  } catch (e) {
@@ -233,7 +233,7 @@ async function resumeAsyncWorkflowHandler({
233
233
  workflowId,
234
234
  runId,
235
235
  body,
236
- container
236
+ runtimeContext
237
237
  }) {
238
238
  try {
239
239
  if (!workflowId) {
@@ -250,7 +250,7 @@ async function resumeAsyncWorkflowHandler({
250
250
  const result = await run.resume({
251
251
  stepId: body.stepId,
252
252
  context: body.context,
253
- container
253
+ runtimeContext
254
254
  });
255
255
  return result;
256
256
  } catch (error) {
@@ -262,7 +262,7 @@ async function resumeWorkflowHandler({
262
262
  workflowId,
263
263
  runId,
264
264
  body,
265
- container
265
+ runtimeContext
266
266
  }) {
267
267
  try {
268
268
  if (!workflowId) {
@@ -279,7 +279,7 @@ async function resumeWorkflowHandler({
279
279
  await run.resume({
280
280
  stepId: body.stepId,
281
281
  context: body.context,
282
- container
282
+ runtimeContext
283
283
  });
284
284
  return { message: "Workflow run resumed" };
285
285
  } catch (error) {
@@ -97,7 +97,7 @@ async function getLiveEvalsByAgentIdHandler({ mastra, agentId }) {
97
97
  }
98
98
  async function generateHandler({
99
99
  mastra,
100
- container,
100
+ runtimeContext,
101
101
  agentId,
102
102
  body
103
103
  }) {
@@ -113,7 +113,7 @@ async function generateHandler({
113
113
  ...rest,
114
114
  // @ts-expect-error TODO fix types
115
115
  resourceId: finalResourceId,
116
- container
116
+ runtimeContext
117
117
  });
118
118
  return result;
119
119
  } catch (error) {
@@ -122,7 +122,7 @@ async function generateHandler({
122
122
  }
123
123
  async function streamGenerateHandler({
124
124
  mastra,
125
- container,
125
+ runtimeContext,
126
126
  agentId,
127
127
  body
128
128
  }) {
@@ -138,7 +138,7 @@ async function streamGenerateHandler({
138
138
  ...rest,
139
139
  // @ts-expect-error TODO fix types
140
140
  resourceId: finalResourceId,
141
- container
141
+ runtimeContext
142
142
  });
143
143
  const streamResponse = rest.output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
144
144
  sendUsage: true,
@@ -69,7 +69,7 @@ async function getNetworkByIdHandler({ mastra, networkId }) {
69
69
  }
70
70
  async function generateHandler({
71
71
  mastra,
72
- container,
72
+ runtimeContext,
73
73
  networkId,
74
74
  body
75
75
  }) {
@@ -80,7 +80,7 @@ async function generateHandler({
80
80
  }
81
81
  validateBody({ messages: body.messages });
82
82
  const { messages, ...rest } = body;
83
- const result = await network.generate(messages, { ...rest, container });
83
+ const result = await network.generate(messages, { ...rest, runtimeContext });
84
84
  return result;
85
85
  } catch (error) {
86
86
  return handleError(error, "Error generating from network");
@@ -90,7 +90,7 @@ async function streamGenerateHandler({
90
90
  mastra,
91
91
  networkId,
92
92
  body,
93
- container
93
+ runtimeContext
94
94
  }) {
95
95
  try {
96
96
  const network = mastra.getNetwork(networkId);
@@ -102,7 +102,7 @@ async function streamGenerateHandler({
102
102
  const streamResult = await network.stream(messages, {
103
103
  output,
104
104
  ...rest,
105
- container
105
+ runtimeContext
106
106
  });
107
107
  const streamResponse = output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
108
108
  sendUsage: true,
@@ -80,7 +80,7 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
80
80
  }
81
81
  async function startAsyncWorkflowHandler({
82
82
  mastra,
83
- container,
83
+ runtimeContext,
84
84
  workflowId,
85
85
  runId,
86
86
  triggerData
@@ -97,7 +97,7 @@ async function startAsyncWorkflowHandler({
97
97
  const { start } = workflow.createRun();
98
98
  const result2 = await start({
99
99
  triggerData,
100
- container
100
+ runtimeContext
101
101
  });
102
102
  return result2;
103
103
  }
@@ -107,7 +107,7 @@ async function startAsyncWorkflowHandler({
107
107
  }
108
108
  const result = await run.start({
109
109
  triggerData,
110
- container
110
+ runtimeContext
111
111
  });
112
112
  return result;
113
113
  } catch (error) {
@@ -160,7 +160,7 @@ async function createRunHandler({
160
160
  }
161
161
  async function startWorkflowRunHandler({
162
162
  mastra,
163
- container,
163
+ runtimeContext,
164
164
  workflowId,
165
165
  runId,
166
166
  triggerData
@@ -179,7 +179,7 @@ async function startWorkflowRunHandler({
179
179
  }
180
180
  await run.start({
181
181
  triggerData,
182
- container
182
+ runtimeContext
183
183
  });
184
184
  return { message: "Workflow run started" };
185
185
  } catch (e) {
@@ -235,7 +235,7 @@ async function resumeAsyncWorkflowHandler({
235
235
  workflowId,
236
236
  runId,
237
237
  body,
238
- container
238
+ runtimeContext
239
239
  }) {
240
240
  try {
241
241
  if (!workflowId) {
@@ -252,7 +252,7 @@ async function resumeAsyncWorkflowHandler({
252
252
  const result = await run.resume({
253
253
  stepId: body.stepId,
254
254
  context: body.context,
255
- container
255
+ runtimeContext
256
256
  });
257
257
  return result;
258
258
  } catch (error) {
@@ -264,7 +264,7 @@ async function resumeWorkflowHandler({
264
264
  workflowId,
265
265
  runId,
266
266
  body,
267
- container
267
+ runtimeContext
268
268
  }) {
269
269
  try {
270
270
  if (!workflowId) {
@@ -281,7 +281,7 @@ async function resumeWorkflowHandler({
281
281
  await run.resume({
282
282
  stepId: body.stepId,
283
283
  context: body.context,
284
- container
284
+ runtimeContext
285
285
  });
286
286
  return { message: "Workflow run resumed" };
287
287
  } catch (error) {
@@ -38,9 +38,7 @@ async function generateSpeechHandler({
38
38
  throw new HTTPException(400, { message: "Agent ID is required" });
39
39
  }
40
40
  validateBody({
41
- text: void 0,
42
- speakerId: void 0,
43
- ...body
41
+ text: body?.text
44
42
  });
45
43
  const agent = mastra.getAgent(agentId);
46
44
  if (!agent) {
@@ -1,30 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunk4WJ5GHRG_cjs = require('../../chunk-4WJ5GHRG.cjs');
3
+ var chunkHCOPJZ4A_cjs = require('../../chunk-HCOPJZ4A.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "generateHandler", {
8
8
  enumerable: true,
9
- get: function () { return chunk4WJ5GHRG_cjs.generateHandler; }
9
+ get: function () { return chunkHCOPJZ4A_cjs.generateHandler; }
10
10
  });
11
11
  Object.defineProperty(exports, "getAgentByIdHandler", {
12
12
  enumerable: true,
13
- get: function () { return chunk4WJ5GHRG_cjs.getAgentByIdHandler; }
13
+ get: function () { return chunkHCOPJZ4A_cjs.getAgentByIdHandler; }
14
14
  });
15
15
  Object.defineProperty(exports, "getAgentsHandler", {
16
16
  enumerable: true,
17
- get: function () { return chunk4WJ5GHRG_cjs.getAgentsHandler; }
17
+ get: function () { return chunkHCOPJZ4A_cjs.getAgentsHandler; }
18
18
  });
19
19
  Object.defineProperty(exports, "getEvalsByAgentIdHandler", {
20
20
  enumerable: true,
21
- get: function () { return chunk4WJ5GHRG_cjs.getEvalsByAgentIdHandler; }
21
+ get: function () { return chunkHCOPJZ4A_cjs.getEvalsByAgentIdHandler; }
22
22
  });
23
23
  Object.defineProperty(exports, "getLiveEvalsByAgentIdHandler", {
24
24
  enumerable: true,
25
- get: function () { return chunk4WJ5GHRG_cjs.getLiveEvalsByAgentIdHandler; }
25
+ get: function () { return chunkHCOPJZ4A_cjs.getLiveEvalsByAgentIdHandler; }
26
26
  });
27
27
  Object.defineProperty(exports, "streamGenerateHandler", {
28
28
  enumerable: true,
29
- get: function () { return chunk4WJ5GHRG_cjs.streamGenerateHandler; }
29
+ get: function () { return chunkHCOPJZ4A_cjs.streamGenerateHandler; }
30
30
  });
@@ -1 +1 @@
1
- export { generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler } from '../../chunk-TFFNX7FI.js';
1
+ export { generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler } from '../../chunk-R4J7XQYU.js';
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var chunkJLDXUWK7_cjs = require('../../chunk-JLDXUWK7.cjs');
3
+ var chunkFPIWDH5Y_cjs = require('../../chunk-FPIWDH5Y.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "generateHandler", {
8
8
  enumerable: true,
9
- get: function () { return chunkJLDXUWK7_cjs.generateHandler; }
9
+ get: function () { return chunkFPIWDH5Y_cjs.generateHandler; }
10
10
  });
11
11
  Object.defineProperty(exports, "getNetworkByIdHandler", {
12
12
  enumerable: true,
13
- get: function () { return chunkJLDXUWK7_cjs.getNetworkByIdHandler; }
13
+ get: function () { return chunkFPIWDH5Y_cjs.getNetworkByIdHandler; }
14
14
  });
15
15
  Object.defineProperty(exports, "getNetworksHandler", {
16
16
  enumerable: true,
17
- get: function () { return chunkJLDXUWK7_cjs.getNetworksHandler; }
17
+ get: function () { return chunkFPIWDH5Y_cjs.getNetworksHandler; }
18
18
  });
19
19
  Object.defineProperty(exports, "streamGenerateHandler", {
20
20
  enumerable: true,
21
- get: function () { return chunkJLDXUWK7_cjs.streamGenerateHandler; }
21
+ get: function () { return chunkFPIWDH5Y_cjs.streamGenerateHandler; }
22
22
  });
@@ -1 +1 @@
1
- export { generateHandler, getNetworkByIdHandler, getNetworksHandler, streamGenerateHandler } from '../../chunk-YANVFOYA.js';
1
+ export { generateHandler, getNetworkByIdHandler, getNetworksHandler, streamGenerateHandler } from '../../chunk-RE6YL32K.js';
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var chunkHABV7TZK_cjs = require('../../chunk-HABV7TZK.cjs');
3
+ var chunkD3G23FP3_cjs = require('../../chunk-D3G23FP3.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "executeAgentToolHandler", {
8
8
  enumerable: true,
9
- get: function () { return chunkHABV7TZK_cjs.executeAgentToolHandler; }
9
+ get: function () { return chunkD3G23FP3_cjs.executeAgentToolHandler; }
10
10
  });
11
11
  Object.defineProperty(exports, "executeToolHandler", {
12
12
  enumerable: true,
13
- get: function () { return chunkHABV7TZK_cjs.executeToolHandler; }
13
+ get: function () { return chunkD3G23FP3_cjs.executeToolHandler; }
14
14
  });
15
15
  Object.defineProperty(exports, "getToolByIdHandler", {
16
16
  enumerable: true,
17
- get: function () { return chunkHABV7TZK_cjs.getToolByIdHandler; }
17
+ get: function () { return chunkD3G23FP3_cjs.getToolByIdHandler; }
18
18
  });
19
19
  Object.defineProperty(exports, "getToolsHandler", {
20
20
  enumerable: true,
21
- get: function () { return chunkHABV7TZK_cjs.getToolsHandler; }
21
+ get: function () { return chunkD3G23FP3_cjs.getToolsHandler; }
22
22
  });
@@ -1 +1 @@
1
- export { executeAgentToolHandler, executeToolHandler, getToolByIdHandler, getToolsHandler } from '../../chunk-XISBMH56.js';
1
+ export { executeAgentToolHandler, executeToolHandler, getToolByIdHandler, getToolsHandler } from '../../chunk-5JNVY6DU.js';
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var chunkA7DF4ETD_cjs = require('../../chunk-A7DF4ETD.cjs');
3
+ var chunkCWUJ6DED_cjs = require('../../chunk-CWUJ6DED.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "generateSpeechHandler", {
8
8
  enumerable: true,
9
- get: function () { return chunkA7DF4ETD_cjs.generateSpeechHandler; }
9
+ get: function () { return chunkCWUJ6DED_cjs.generateSpeechHandler; }
10
10
  });
11
11
  Object.defineProperty(exports, "getSpeakersHandler", {
12
12
  enumerable: true,
13
- get: function () { return chunkA7DF4ETD_cjs.getSpeakersHandler; }
13
+ get: function () { return chunkCWUJ6DED_cjs.getSpeakersHandler; }
14
14
  });
15
15
  Object.defineProperty(exports, "transcribeSpeechHandler", {
16
16
  enumerable: true,
17
- get: function () { return chunkA7DF4ETD_cjs.transcribeSpeechHandler; }
17
+ get: function () { return chunkCWUJ6DED_cjs.transcribeSpeechHandler; }
18
18
  });
@@ -1 +1 @@
1
- export { generateSpeechHandler, getSpeakersHandler, transcribeSpeechHandler } from '../../chunk-3RVHWGWO.js';
1
+ export { generateSpeechHandler, getSpeakersHandler, transcribeSpeechHandler } from '../../chunk-YE2P6K2L.js';
@@ -1,46 +1,46 @@
1
1
  'use strict';
2
2
 
3
- var chunkRNU4JMLM_cjs = require('../../chunk-RNU4JMLM.cjs');
3
+ var chunkTZK63M5N_cjs = require('../../chunk-TZK63M5N.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "createRunHandler", {
8
8
  enumerable: true,
9
- get: function () { return chunkRNU4JMLM_cjs.createRunHandler; }
9
+ get: function () { return chunkTZK63M5N_cjs.createRunHandler; }
10
10
  });
11
11
  Object.defineProperty(exports, "getWorkflowByIdHandler", {
12
12
  enumerable: true,
13
- get: function () { return chunkRNU4JMLM_cjs.getWorkflowByIdHandler; }
13
+ get: function () { return chunkTZK63M5N_cjs.getWorkflowByIdHandler; }
14
14
  });
15
15
  Object.defineProperty(exports, "getWorkflowRunHandler", {
16
16
  enumerable: true,
17
- get: function () { return chunkRNU4JMLM_cjs.getWorkflowRunHandler; }
17
+ get: function () { return chunkTZK63M5N_cjs.getWorkflowRunHandler; }
18
18
  });
19
19
  Object.defineProperty(exports, "getWorkflowRunsHandler", {
20
20
  enumerable: true,
21
- get: function () { return chunkRNU4JMLM_cjs.getWorkflowRunsHandler; }
21
+ get: function () { return chunkTZK63M5N_cjs.getWorkflowRunsHandler; }
22
22
  });
23
23
  Object.defineProperty(exports, "getWorkflowsHandler", {
24
24
  enumerable: true,
25
- get: function () { return chunkRNU4JMLM_cjs.getWorkflowsHandler; }
25
+ get: function () { return chunkTZK63M5N_cjs.getWorkflowsHandler; }
26
26
  });
27
27
  Object.defineProperty(exports, "resumeAsyncWorkflowHandler", {
28
28
  enumerable: true,
29
- get: function () { return chunkRNU4JMLM_cjs.resumeAsyncWorkflowHandler; }
29
+ get: function () { return chunkTZK63M5N_cjs.resumeAsyncWorkflowHandler; }
30
30
  });
31
31
  Object.defineProperty(exports, "resumeWorkflowHandler", {
32
32
  enumerable: true,
33
- get: function () { return chunkRNU4JMLM_cjs.resumeWorkflowHandler; }
33
+ get: function () { return chunkTZK63M5N_cjs.resumeWorkflowHandler; }
34
34
  });
35
35
  Object.defineProperty(exports, "startAsyncWorkflowHandler", {
36
36
  enumerable: true,
37
- get: function () { return chunkRNU4JMLM_cjs.startAsyncWorkflowHandler; }
37
+ get: function () { return chunkTZK63M5N_cjs.startAsyncWorkflowHandler; }
38
38
  });
39
39
  Object.defineProperty(exports, "startWorkflowRunHandler", {
40
40
  enumerable: true,
41
- get: function () { return chunkRNU4JMLM_cjs.startWorkflowRunHandler; }
41
+ get: function () { return chunkTZK63M5N_cjs.startWorkflowRunHandler; }
42
42
  });
43
43
  Object.defineProperty(exports, "watchWorkflowHandler", {
44
44
  enumerable: true,
45
- get: function () { return chunkRNU4JMLM_cjs.watchWorkflowHandler; }
45
+ get: function () { return chunkTZK63M5N_cjs.watchWorkflowHandler; }
46
46
  });
@@ -1 +1 @@
1
- export { createRunHandler, getWorkflowByIdHandler, getWorkflowRunHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, watchWorkflowHandler } from '../../chunk-4B7OUZXW.js';
1
+ export { createRunHandler, getWorkflowByIdHandler, getWorkflowRunHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, watchWorkflowHandler } from '../../chunk-LFOBHRFO.js';
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var chunkHABV7TZK_cjs = require('../chunk-HABV7TZK.cjs');
3
+ var chunkD3G23FP3_cjs = require('../chunk-D3G23FP3.cjs');
4
4
  var chunkM56ECCHK_cjs = require('../chunk-M56ECCHK.cjs');
5
- var chunkA7DF4ETD_cjs = require('../chunk-A7DF4ETD.cjs');
6
- var chunkRNU4JMLM_cjs = require('../chunk-RNU4JMLM.cjs');
7
- var chunk4WJ5GHRG_cjs = require('../chunk-4WJ5GHRG.cjs');
5
+ var chunkCWUJ6DED_cjs = require('../chunk-CWUJ6DED.cjs');
6
+ var chunkTZK63M5N_cjs = require('../chunk-TZK63M5N.cjs');
7
+ var chunkHCOPJZ4A_cjs = require('../chunk-HCOPJZ4A.cjs');
8
8
  var chunkSKBVVI24_cjs = require('../chunk-SKBVVI24.cjs');
9
9
  var chunk2FJURXCL_cjs = require('../chunk-2FJURXCL.cjs');
10
- var chunkJLDXUWK7_cjs = require('../chunk-JLDXUWK7.cjs');
10
+ var chunkFPIWDH5Y_cjs = require('../chunk-FPIWDH5Y.cjs');
11
11
  var chunk7IWQE76Z_cjs = require('../chunk-7IWQE76Z.cjs');
12
12
 
13
13
 
14
14
 
15
15
  Object.defineProperty(exports, "tools", {
16
16
  enumerable: true,
17
- get: function () { return chunkHABV7TZK_cjs.tools_exports; }
17
+ get: function () { return chunkD3G23FP3_cjs.tools_exports; }
18
18
  });
19
19
  Object.defineProperty(exports, "vector", {
20
20
  enumerable: true,
@@ -22,15 +22,15 @@ Object.defineProperty(exports, "vector", {
22
22
  });
23
23
  Object.defineProperty(exports, "voice", {
24
24
  enumerable: true,
25
- get: function () { return chunkA7DF4ETD_cjs.voice_exports; }
25
+ get: function () { return chunkCWUJ6DED_cjs.voice_exports; }
26
26
  });
27
27
  Object.defineProperty(exports, "workflows", {
28
28
  enumerable: true,
29
- get: function () { return chunkRNU4JMLM_cjs.workflows_exports; }
29
+ get: function () { return chunkTZK63M5N_cjs.workflows_exports; }
30
30
  });
31
31
  Object.defineProperty(exports, "agents", {
32
32
  enumerable: true,
33
- get: function () { return chunk4WJ5GHRG_cjs.agents_exports; }
33
+ get: function () { return chunkHCOPJZ4A_cjs.agents_exports; }
34
34
  });
35
35
  Object.defineProperty(exports, "logs", {
36
36
  enumerable: true,
@@ -42,7 +42,7 @@ Object.defineProperty(exports, "memory", {
42
42
  });
43
43
  Object.defineProperty(exports, "network", {
44
44
  enumerable: true,
45
- get: function () { return chunkJLDXUWK7_cjs.network_exports; }
45
+ get: function () { return chunkFPIWDH5Y_cjs.network_exports; }
46
46
  });
47
47
  Object.defineProperty(exports, "telemetry", {
48
48
  enumerable: true,
@@ -1,9 +1,9 @@
1
- export { tools_exports as tools } from '../chunk-XISBMH56.js';
1
+ export { tools_exports as tools } from '../chunk-5JNVY6DU.js';
2
2
  export { vector_exports as vector } from '../chunk-4JINXASC.js';
3
- export { voice_exports as voice } from '../chunk-3RVHWGWO.js';
4
- export { workflows_exports as workflows } from '../chunk-4B7OUZXW.js';
5
- export { agents_exports as agents } from '../chunk-TFFNX7FI.js';
3
+ export { voice_exports as voice } from '../chunk-YE2P6K2L.js';
4
+ export { workflows_exports as workflows } from '../chunk-LFOBHRFO.js';
5
+ export { agents_exports as agents } from '../chunk-R4J7XQYU.js';
6
6
  export { logs_exports as logs } from '../chunk-3EJZQ6TQ.js';
7
7
  export { memory_exports as memory } from '../chunk-RBQASTUP.js';
8
- export { network_exports as network } from '../chunk-YANVFOYA.js';
8
+ export { network_exports as network } from '../chunk-RE6YL32K.js';
9
9
  export { telemetry_exports as telemetry } from '../chunk-WTHDCRMY.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/server",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.0-alpha.8",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -46,7 +46,7 @@
46
46
  "license": "Elastic-2.0",
47
47
  "dependencies": {},
48
48
  "peerDependencies": {
49
- "@mastra/core": "^0.9.0-alpha.6"
49
+ "@mastra/core": "^0.9.0-alpha.8"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@ai-sdk/openai": "^1.3.2",
@@ -59,7 +59,7 @@
59
59
  "vitest": "^2.1.9",
60
60
  "zod-to-json-schema": "^3.24.3",
61
61
  "@internal/lint": "0.0.2",
62
- "@mastra/core": "0.9.0-alpha.6"
62
+ "@mastra/core": "0.9.0-alpha.8"
63
63
  },
64
64
  "scripts": {
65
65
  "build": "tsup src/index.ts src/server/handlers.ts src/server/handlers/*.ts !src/server/handlers/*.test.ts --format esm,cjs --clean --experimental-dts --treeshake=smallest --splitting",