@mastra/core 0.9.0-alpha.7 → 0.9.0

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 (84) hide show
  1. package/dist/agent/index.cjs +2 -2
  2. package/dist/agent/index.d.cts +1 -1
  3. package/dist/agent/index.d.ts +1 -1
  4. package/dist/agent/index.js +1 -1
  5. package/dist/{base-BlGpZfLc.d.ts → base-Bk5V1doj.d.ts} +50 -30
  6. package/dist/{base-xpk2ifTz.d.cts → base-oP3DoUrm.d.cts} +50 -30
  7. package/dist/{chunk-KR6AYHNH.cjs → chunk-53P5ZBJE.cjs} +4 -3
  8. package/dist/{chunk-3XWBNOSO.cjs → chunk-7CSNWYGJ.cjs} +2 -2
  9. package/dist/{chunk-BBDXZGCM.cjs → chunk-ATXF6TIO.cjs} +72 -72
  10. package/dist/{chunk-YVPTMEI4.js → chunk-DGL5RCEO.js} +157 -122
  11. package/dist/{chunk-F4WOCJZQ.cjs → chunk-DIZZQ3E5.cjs} +2 -2
  12. package/dist/{chunk-M6MZXBG5.js → chunk-GEIPVIW4.js} +1 -1
  13. package/dist/{chunk-HHDP5KHS.js → chunk-GJWCFDFN.js} +1 -1
  14. package/dist/{chunk-BUNPX6LU.js → chunk-HARYMLZH.js} +58 -58
  15. package/dist/{chunk-63YK3N3V.cjs → chunk-KZWBYRXW.cjs} +4 -4
  16. package/dist/{chunk-3PBEAM6M.js → chunk-M472GIT6.js} +2 -2
  17. package/dist/{chunk-5OPUKM43.js → chunk-N2ONCUUS.js} +2 -2
  18. package/dist/{chunk-KAJSLFMA.js → chunk-NTHHPNOW.js} +4 -4
  19. package/dist/{chunk-LZQIMLJV.cjs → chunk-NZDXKMDP.cjs} +2 -2
  20. package/dist/{chunk-WXENXL7L.js → chunk-RASVJ3TR.js} +3 -3
  21. package/dist/{chunk-AAMFAGE5.cjs → chunk-TEEAQX2B.cjs} +157 -122
  22. package/dist/{chunk-D6OBOFCM.cjs → chunk-W5IA5OGL.cjs} +3 -3
  23. package/dist/di/index.cjs +3 -3
  24. package/dist/di/index.d.cts +2 -2
  25. package/dist/di/index.d.ts +2 -2
  26. package/dist/di/index.js +1 -1
  27. package/dist/eval/index.d.cts +1 -1
  28. package/dist/eval/index.d.ts +1 -1
  29. package/dist/index.cjs +55 -51
  30. package/dist/index.d.cts +3 -3
  31. package/dist/index.d.ts +3 -3
  32. package/dist/index.js +9 -9
  33. package/dist/integration/index.cjs +3 -3
  34. package/dist/integration/index.d.cts +1 -1
  35. package/dist/integration/index.d.ts +1 -1
  36. package/dist/integration/index.js +1 -1
  37. package/dist/llm/index.d.cts +1 -1
  38. package/dist/llm/index.d.ts +1 -1
  39. package/dist/mastra/index.cjs +2 -2
  40. package/dist/mastra/index.d.cts +1 -1
  41. package/dist/mastra/index.d.ts +1 -1
  42. package/dist/mastra/index.js +1 -1
  43. package/dist/memory/index.cjs +3 -3
  44. package/dist/memory/index.d.cts +1 -1
  45. package/dist/memory/index.d.ts +1 -1
  46. package/dist/memory/index.js +1 -1
  47. package/dist/network/index.cjs +8 -8
  48. package/dist/network/index.d.cts +1 -1
  49. package/dist/network/index.d.ts +1 -1
  50. package/dist/network/index.js +6 -6
  51. package/dist/relevance/index.cjs +4 -4
  52. package/dist/relevance/index.d.cts +1 -1
  53. package/dist/relevance/index.d.ts +1 -1
  54. package/dist/relevance/index.js +1 -1
  55. package/dist/runtime-context/index.cjs +71 -0
  56. package/dist/runtime-context/index.d.cts +52 -0
  57. package/dist/runtime-context/index.d.ts +52 -0
  58. package/dist/runtime-context/index.js +69 -0
  59. package/dist/server/index.d.cts +1 -1
  60. package/dist/server/index.d.ts +1 -1
  61. package/dist/storage/index.d.cts +1 -1
  62. package/dist/storage/index.d.ts +1 -1
  63. package/dist/storage/libsql/index.d.cts +1 -1
  64. package/dist/storage/libsql/index.d.ts +1 -1
  65. package/dist/telemetry/index.d.cts +1 -1
  66. package/dist/telemetry/index.d.ts +1 -1
  67. package/dist/tools/index.cjs +4 -4
  68. package/dist/tools/index.d.cts +1 -1
  69. package/dist/tools/index.d.ts +1 -1
  70. package/dist/tools/index.js +1 -1
  71. package/dist/utils.cjs +17 -13
  72. package/dist/utils.d.cts +10 -4
  73. package/dist/utils.d.ts +10 -4
  74. package/dist/utils.js +1 -1
  75. package/dist/vector/libsql/index.cjs +3 -3
  76. package/dist/vector/libsql/index.js +1 -1
  77. package/dist/voice/index.d.cts +2 -2
  78. package/dist/voice/index.d.ts +2 -2
  79. package/dist/workflows/index.cjs +23 -23
  80. package/dist/workflows/index.d.cts +2 -2
  81. package/dist/workflows/index.d.ts +2 -2
  82. package/dist/workflows/index.js +1 -1
  83. package/package.json +1 -1
  84. package/runtime-context.d.ts +1 -0
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkBBDXZGCM_cjs = require('../chunk-BBDXZGCM.cjs');
3
+ var chunkATXF6TIO_cjs = require('../chunk-ATXF6TIO.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Agent", {
8
8
  enumerable: true,
9
- get: function () { return chunkBBDXZGCM_cjs.Agent; }
9
+ get: function () { return chunkATXF6TIO_cjs.Agent; }
10
10
  });
@@ -1,7 +1,7 @@
1
1
  export { Message as AiMessageType } from 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { j as Agent, k as AgentConfig, aM as AgentGenerateOptions, aN as AgentStreamOptions, aG as MastraLanguageModel, aH as ToolsInput, aL as ToolsetsInput } from '../base-xpk2ifTz.cjs';
4
+ export { j as Agent, k as AgentConfig, aM as AgentGenerateOptions, aN as AgentStreamOptions, aG as MastraLanguageModel, aH as ToolsInput, aL as ToolsetsInput } from '../base-oP3DoUrm.cjs';
5
5
  import '../base-BihKcqDY.cjs';
6
6
  import '../di/index.cjs';
7
7
  import '../types-BtMyV38I.cjs';
@@ -1,7 +1,7 @@
1
1
  export { Message as AiMessageType } from 'ai';
2
2
  import 'json-schema';
3
3
  import 'zod';
4
- export { j as Agent, k as AgentConfig, aM as AgentGenerateOptions, aN as AgentStreamOptions, aG as MastraLanguageModel, aH as ToolsInput, aL as ToolsetsInput } from '../base-BlGpZfLc.js';
4
+ export { j as Agent, k as AgentConfig, aM as AgentGenerateOptions, aN as AgentStreamOptions, aG as MastraLanguageModel, aH as ToolsInput, aL as ToolsetsInput } from '../base-Bk5V1doj.js';
5
5
  import '../base-DT2poiVK.js';
6
6
  import '../di/index.js';
7
7
  import '../types-BtMyV38I.js';
@@ -1 +1 @@
1
- export { Agent } from '../chunk-BUNPX6LU.js';
1
+ export { Agent } from '../chunk-HARYMLZH.js';
@@ -5,7 +5,7 @@ import { a as Metric, M as MetricResult, T as TestInfo } from './types-BtMyV38I.
5
5
  import { Query } from 'sift';
6
6
  import { z, ZodSchema } from 'zod';
7
7
  import { JSONSchema7 } from 'json-schema';
8
- import { Container } from './di/index.js';
8
+ import { RuntimeContext } from './di/index.js';
9
9
  import { B as BaseLogMessage, R as RegisteredLogger, L as Logger, d as Run } from './index-CquI0inB.js';
10
10
  import { Span } from '@opentelemetry/api';
11
11
  import * as xstate from 'xstate';
@@ -34,7 +34,7 @@ type CoreTool = {
34
34
  });
35
35
  interface ToolExecutionContext<TSchemaIn extends z.ZodSchema | undefined = undefined> extends IExecutionContext<TSchemaIn> {
36
36
  mastra?: MastraUnion;
37
- container: Container;
37
+ runtimeContext: RuntimeContext;
38
38
  }
39
39
  interface ToolAction<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends ToolExecutionContext<TSchemaIn> = ToolExecutionContext<TSchemaIn>> extends IAction<string, TSchemaIn, TSchemaOut, TContext, ToolExecutionOptions> {
40
40
  description: string;
@@ -140,7 +140,7 @@ declare class AgentNetwork extends MastraBase {
140
140
  * @returns A formatted string with all agent interactions in chronological order
141
141
  */
142
142
  getAgentInteractionSummary(): string;
143
- executeAgent(agentId: string, input: CoreMessage$1[], includeHistory?: boolean, container?: Container): Promise<string>;
143
+ executeAgent(agentId: string, input: CoreMessage$1[], includeHistory?: boolean, runtimeContext?: RuntimeContext): Promise<string>;
144
144
  getInstructions(): string;
145
145
  getRoutingAgent(): Agent<string, ToolsInput, Record<string, Metric>>;
146
146
  getAgents(): Agent<string, ToolsInput, Record<string, Metric>>[];
@@ -193,7 +193,7 @@ interface StepExecutionContext<TSchemaIn extends z.ZodSchema | undefined = undef
193
193
  runId: string;
194
194
  emit: (event: string, data: any) => void;
195
195
  mastra?: MastraUnion;
196
- container: Container;
196
+ runtimeContext: RuntimeContext;
197
197
  }
198
198
  interface StepAction<TId extends string, TSchemaIn extends z.ZodSchema | undefined, TSchemaOut extends z.ZodSchema | undefined, TContext extends StepExecutionContext<TSchemaIn>> extends IAction<TId, TSchemaIn, TSchemaOut, TContext> {
199
199
  mastra?: Mastra;
@@ -568,10 +568,10 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
568
568
  #private;
569
569
  logger: Logger;
570
570
  name: string;
571
- constructor({ logger, mastra, container, workflowInstance, executionSpan, name, runId, steps, stepGraph, retryConfig, startStepId, }: {
571
+ constructor({ logger, mastra, runtimeContext, workflowInstance, executionSpan, name, runId, steps, stepGraph, retryConfig, startStepId, }: {
572
572
  logger: Logger;
573
573
  mastra?: Mastra;
574
- container: Container;
574
+ runtimeContext: RuntimeContext;
575
575
  workflowInstance: WorkflowInstance;
576
576
  executionSpan?: Span;
577
577
  name: string;
@@ -943,15 +943,15 @@ interface WorkflowResultReturn<TResult extends z.ZodObject<any>, T extends z.Zod
943
943
  runId: string;
944
944
  start: (props?: {
945
945
  triggerData?: z.infer<T>;
946
- container?: Container;
946
+ runtimeContext?: RuntimeContext;
947
947
  } | undefined) => Promise<WorkflowRunResult<T, TSteps, TResult>>;
948
948
  watch: (onTransition: (state: Pick<WorkflowRunResult<T, TSteps, TResult>, 'results' | 'activePaths' | 'runId'>) => void) => () => void;
949
949
  resume: (props: {
950
950
  stepId: string;
951
951
  context?: Record<string, any>;
952
- container?: Container;
952
+ runtimeContext?: RuntimeContext;
953
953
  }) => Promise<Omit<WorkflowRunResult<T, TSteps, TResult>, 'runId'> | undefined>;
954
- resumeWithEvent: (eventName: string, data: any, container?: Container) => Promise<Omit<WorkflowRunResult<T, TSteps, TResult>, 'runId'> | undefined>;
954
+ resumeWithEvent: (eventName: string, data: any, runtimeContext?: RuntimeContext) => Promise<Omit<WorkflowRunResult<T, TSteps, TResult>, 'runId'> | undefined>;
955
955
  }
956
956
  declare class WorkflowInstance<TSteps extends Step<any, any, any, any>[] = Step<any, any, any, any>[], TTriggerSchema extends z.ZodObject<any> = any, TResult extends z.ZodObject<any> = any> implements WorkflowResultReturn<TResult, TTriggerSchema, TSteps> {
957
957
  #private;
@@ -983,9 +983,9 @@ declare class WorkflowInstance<TSteps extends Step<any, any, any, any>[] = Step<
983
983
  get runId(): string;
984
984
  get executionSpan(): Span | undefined;
985
985
  watch(onTransition: (state: Pick<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, 'results' | 'activePaths' | 'runId' | 'timestamp'>) => void): () => void;
986
- start({ triggerData, container }?: {
986
+ start({ triggerData, runtimeContext, }?: {
987
987
  triggerData?: z.infer<TTriggerSchema>;
988
- container?: Container;
988
+ runtimeContext?: RuntimeContext;
989
989
  }): Promise<{
990
990
  runId: string;
991
991
  timestamp: number;
@@ -999,31 +999,31 @@ declare class WorkflowInstance<TSteps extends Step<any, any, any, any>[] = Step<
999
999
  }>;
1000
1000
  }>;
1001
1001
  private isCompoundDependencyMet;
1002
- execute({ triggerData, snapshot, stepId, resumeData, container, }?: {
1002
+ execute({ triggerData, snapshot, stepId, resumeData, runtimeContext, }?: {
1003
1003
  stepId?: string;
1004
1004
  triggerData?: z.infer<TTriggerSchema>;
1005
1005
  snapshot?: Snapshot<any>;
1006
1006
  resumeData?: any;
1007
- container: Container;
1007
+ runtimeContext: RuntimeContext;
1008
1008
  }): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, 'runId'>>;
1009
1009
  hasSubscribers(stepId: string): boolean;
1010
- runMachine(parentStepId: string, input: any, container?: Container): Promise<(Pick<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId" | "timestamp" | "results" | "activePaths"> | undefined)[]>;
1010
+ runMachine(parentStepId: string, input: any, runtimeContext?: RuntimeContext): Promise<(Pick<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId" | "timestamp" | "results" | "activePaths"> | undefined)[]>;
1011
1011
  suspend(stepId: string, machine: Machine<TSteps, TTriggerSchema>): Promise<void>;
1012
1012
  /**
1013
1013
  * Persists the workflow state to the database
1014
1014
  */
1015
1015
  persistWorkflowSnapshot(): Promise<void>;
1016
1016
  getState(): Promise<WorkflowRunState | null>;
1017
- resumeWithEvent(eventName: string, data: any, container?: Container): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId"> | undefined>;
1018
- resume({ stepId, context: resumeContext, container, }: {
1017
+ resumeWithEvent(eventName: string, data: any, runtimeContext?: RuntimeContext): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId"> | undefined>;
1018
+ resume({ stepId, context: resumeContext, runtimeContext, }: {
1019
1019
  stepId: string;
1020
1020
  context?: Record<string, any>;
1021
- container?: Container;
1021
+ runtimeContext?: RuntimeContext;
1022
1022
  }): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId"> | undefined>;
1023
- _resume({ stepId, context: resumeContext, container, }: {
1023
+ _resume({ stepId, context: resumeContext, runtimeContext, }: {
1024
1024
  stepId: string;
1025
1025
  context?: Record<string, any>;
1026
- container: Container;
1026
+ runtimeContext: RuntimeContext;
1027
1027
  }): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId"> | undefined>;
1028
1028
  }
1029
1029
 
@@ -1092,11 +1092,11 @@ declare class Workflow<TSteps extends Step<string, any, any>[] = Step<string, an
1092
1092
  getWorkflowRuns(): Promise<WorkflowRuns>;
1093
1093
  getExecutionSpan(runId: string): Span | undefined;
1094
1094
  getState(runId: string): Promise<WorkflowRunState | null>;
1095
- resume({ runId, stepId, context: resumeContext, container, }: {
1095
+ resume({ runId, stepId, context: resumeContext, runtimeContext, }: {
1096
1096
  runId: string;
1097
1097
  stepId: string;
1098
1098
  context?: Record<string, any>;
1099
- container: Container;
1099
+ runtimeContext: RuntimeContext;
1100
1100
  }): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, any>, "runId"> | undefined>;
1101
1101
  watch(onTransition: (state: Pick<WorkflowRunResult<TTriggerSchema, TSteps, TResultSchema>, 'results' | 'activePaths' | 'runId' | 'timestamp'>) => void): () => void;
1102
1102
  resumeWithEvent(runId: string, eventName: string, data: any): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, any>, "runId"> | undefined>;
@@ -1320,7 +1320,7 @@ type MastraCustomLLMOptions<Z extends ZodSchema | JSONSchema7 | undefined = unde
1320
1320
  telemetry?: TelemetrySettings;
1321
1321
  threadId?: string;
1322
1322
  resourceId?: string;
1323
- container: Container;
1323
+ runtimeContext: RuntimeContext;
1324
1324
  } & Run;
1325
1325
  type LLMTextOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
1326
1326
  messages: CoreMessage[];
@@ -1581,8 +1581,8 @@ type AgentGenerateOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefi
1581
1581
  };
1582
1582
  /** Telemetry settings */
1583
1583
  telemetry?: TelemetrySettings;
1584
- /** Container for dependency injection */
1585
- container?: Container;
1584
+ /** RuntimeContext for dependency injection */
1585
+ runtimeContext?: RuntimeContext;
1586
1586
  } & ({
1587
1587
  resourceId?: undefined;
1588
1588
  threadId?: undefined;
@@ -1625,8 +1625,8 @@ type AgentStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefine
1625
1625
  experimental_output?: Z;
1626
1626
  /** Telemetry settings */
1627
1627
  telemetry?: TelemetrySettings;
1628
- /** Container for dependency injection */
1629
- container?: Container;
1628
+ /** RuntimeContext for dependency injection */
1629
+ runtimeContext?: RuntimeContext;
1630
1630
  } & ({
1631
1631
  resourceId?: undefined;
1632
1632
  threadId?: undefined;
@@ -1657,6 +1657,26 @@ type ServerConfig = {
1657
1657
  * @default { origin: '*', allowMethods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], allowHeaders: ['Content-Type', 'Authorization', 'x-mastra-client-type'], exposeHeaders: ['Content-Length', 'X-Requested-With'], credentials: false }
1658
1658
  */
1659
1659
  cors?: Parameters<typeof cors>[0] | false;
1660
+ /**
1661
+ * Build configuration for the server
1662
+ */
1663
+ build?: {
1664
+ /**
1665
+ * Enable Swagger UI
1666
+ * @default false
1667
+ */
1668
+ swaggerUI?: boolean;
1669
+ /**
1670
+ * Enable API request logging
1671
+ * @default false
1672
+ */
1673
+ apiReqLogs?: boolean;
1674
+ /**
1675
+ * Enable OpenAPI documentation
1676
+ * @default false
1677
+ */
1678
+ openAPIDocs?: boolean;
1679
+ };
1660
1680
  };
1661
1681
 
1662
1682
  interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>> {
@@ -1825,13 +1845,13 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
1825
1845
  }>;
1826
1846
  private getResponseMessages;
1827
1847
  sanitizeResponseMessages(messages: Array<CoreMessage$1>): Array<CoreMessage$1>;
1828
- convertTools({ toolsets, clientTools, threadId, resourceId, runId, container, }: {
1848
+ convertTools({ toolsets, clientTools, threadId, resourceId, runId, runtimeContext, }: {
1829
1849
  toolsets?: ToolsetsInput;
1830
1850
  clientTools?: ToolsInput;
1831
1851
  threadId?: string;
1832
1852
  resourceId?: string;
1833
1853
  runId?: string;
1834
- container: Container;
1854
+ runtimeContext: RuntimeContext;
1835
1855
  }): Record<string, CoreTool>;
1836
1856
  preExecute({ resourceId, runId, threadId, thread, memoryConfig, messages, systemMessage, }: {
1837
1857
  runId?: string;
@@ -1845,7 +1865,7 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
1845
1865
  coreMessages: CoreMessage$1[];
1846
1866
  threadIdToUse: string;
1847
1867
  }>;
1848
- __primitive({ instructions, messages, context, threadId, memoryConfig, resourceId, runId, toolsets, clientTools, container, }: {
1868
+ __primitive({ instructions, messages, context, threadId, memoryConfig, resourceId, runId, toolsets, clientTools, runtimeContext, }: {
1849
1869
  instructions?: string;
1850
1870
  toolsets?: ToolsetsInput;
1851
1871
  clientTools?: ToolsInput;
@@ -1855,7 +1875,7 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
1855
1875
  context?: CoreMessage$1[];
1856
1876
  runId?: string;
1857
1877
  messages: CoreMessage$1[];
1858
- container: Container;
1878
+ runtimeContext: RuntimeContext;
1859
1879
  }): {
1860
1880
  before: () => Promise<{
1861
1881
  messageObjects: CoreMessage$1[];
@@ -5,7 +5,7 @@ import { a as Metric, M as MetricResult, T as TestInfo } from './types-BtMyV38I.
5
5
  import { Query } from 'sift';
6
6
  import { z, ZodSchema } from 'zod';
7
7
  import { JSONSchema7 } from 'json-schema';
8
- import { Container } from './di/index.cjs';
8
+ import { RuntimeContext } from './di/index.cjs';
9
9
  import { B as BaseLogMessage, R as RegisteredLogger, L as Logger, d as Run } from './index-CquI0inB.cjs';
10
10
  import { Span } from '@opentelemetry/api';
11
11
  import * as xstate from 'xstate';
@@ -34,7 +34,7 @@ type CoreTool = {
34
34
  });
35
35
  interface ToolExecutionContext<TSchemaIn extends z.ZodSchema | undefined = undefined> extends IExecutionContext<TSchemaIn> {
36
36
  mastra?: MastraUnion;
37
- container: Container;
37
+ runtimeContext: RuntimeContext;
38
38
  }
39
39
  interface ToolAction<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends ToolExecutionContext<TSchemaIn> = ToolExecutionContext<TSchemaIn>> extends IAction<string, TSchemaIn, TSchemaOut, TContext, ToolExecutionOptions> {
40
40
  description: string;
@@ -140,7 +140,7 @@ declare class AgentNetwork extends MastraBase {
140
140
  * @returns A formatted string with all agent interactions in chronological order
141
141
  */
142
142
  getAgentInteractionSummary(): string;
143
- executeAgent(agentId: string, input: CoreMessage$1[], includeHistory?: boolean, container?: Container): Promise<string>;
143
+ executeAgent(agentId: string, input: CoreMessage$1[], includeHistory?: boolean, runtimeContext?: RuntimeContext): Promise<string>;
144
144
  getInstructions(): string;
145
145
  getRoutingAgent(): Agent<string, ToolsInput, Record<string, Metric>>;
146
146
  getAgents(): Agent<string, ToolsInput, Record<string, Metric>>[];
@@ -193,7 +193,7 @@ interface StepExecutionContext<TSchemaIn extends z.ZodSchema | undefined = undef
193
193
  runId: string;
194
194
  emit: (event: string, data: any) => void;
195
195
  mastra?: MastraUnion;
196
- container: Container;
196
+ runtimeContext: RuntimeContext;
197
197
  }
198
198
  interface StepAction<TId extends string, TSchemaIn extends z.ZodSchema | undefined, TSchemaOut extends z.ZodSchema | undefined, TContext extends StepExecutionContext<TSchemaIn>> extends IAction<TId, TSchemaIn, TSchemaOut, TContext> {
199
199
  mastra?: Mastra;
@@ -568,10 +568,10 @@ declare class Machine<TSteps extends Step<any, any, any, any>[] = Step<any, any,
568
568
  #private;
569
569
  logger: Logger;
570
570
  name: string;
571
- constructor({ logger, mastra, container, workflowInstance, executionSpan, name, runId, steps, stepGraph, retryConfig, startStepId, }: {
571
+ constructor({ logger, mastra, runtimeContext, workflowInstance, executionSpan, name, runId, steps, stepGraph, retryConfig, startStepId, }: {
572
572
  logger: Logger;
573
573
  mastra?: Mastra;
574
- container: Container;
574
+ runtimeContext: RuntimeContext;
575
575
  workflowInstance: WorkflowInstance;
576
576
  executionSpan?: Span;
577
577
  name: string;
@@ -943,15 +943,15 @@ interface WorkflowResultReturn<TResult extends z.ZodObject<any>, T extends z.Zod
943
943
  runId: string;
944
944
  start: (props?: {
945
945
  triggerData?: z.infer<T>;
946
- container?: Container;
946
+ runtimeContext?: RuntimeContext;
947
947
  } | undefined) => Promise<WorkflowRunResult<T, TSteps, TResult>>;
948
948
  watch: (onTransition: (state: Pick<WorkflowRunResult<T, TSteps, TResult>, 'results' | 'activePaths' | 'runId'>) => void) => () => void;
949
949
  resume: (props: {
950
950
  stepId: string;
951
951
  context?: Record<string, any>;
952
- container?: Container;
952
+ runtimeContext?: RuntimeContext;
953
953
  }) => Promise<Omit<WorkflowRunResult<T, TSteps, TResult>, 'runId'> | undefined>;
954
- resumeWithEvent: (eventName: string, data: any, container?: Container) => Promise<Omit<WorkflowRunResult<T, TSteps, TResult>, 'runId'> | undefined>;
954
+ resumeWithEvent: (eventName: string, data: any, runtimeContext?: RuntimeContext) => Promise<Omit<WorkflowRunResult<T, TSteps, TResult>, 'runId'> | undefined>;
955
955
  }
956
956
  declare class WorkflowInstance<TSteps extends Step<any, any, any, any>[] = Step<any, any, any, any>[], TTriggerSchema extends z.ZodObject<any> = any, TResult extends z.ZodObject<any> = any> implements WorkflowResultReturn<TResult, TTriggerSchema, TSteps> {
957
957
  #private;
@@ -983,9 +983,9 @@ declare class WorkflowInstance<TSteps extends Step<any, any, any, any>[] = Step<
983
983
  get runId(): string;
984
984
  get executionSpan(): Span | undefined;
985
985
  watch(onTransition: (state: Pick<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, 'results' | 'activePaths' | 'runId' | 'timestamp'>) => void): () => void;
986
- start({ triggerData, container }?: {
986
+ start({ triggerData, runtimeContext, }?: {
987
987
  triggerData?: z.infer<TTriggerSchema>;
988
- container?: Container;
988
+ runtimeContext?: RuntimeContext;
989
989
  }): Promise<{
990
990
  runId: string;
991
991
  timestamp: number;
@@ -999,31 +999,31 @@ declare class WorkflowInstance<TSteps extends Step<any, any, any, any>[] = Step<
999
999
  }>;
1000
1000
  }>;
1001
1001
  private isCompoundDependencyMet;
1002
- execute({ triggerData, snapshot, stepId, resumeData, container, }?: {
1002
+ execute({ triggerData, snapshot, stepId, resumeData, runtimeContext, }?: {
1003
1003
  stepId?: string;
1004
1004
  triggerData?: z.infer<TTriggerSchema>;
1005
1005
  snapshot?: Snapshot<any>;
1006
1006
  resumeData?: any;
1007
- container: Container;
1007
+ runtimeContext: RuntimeContext;
1008
1008
  }): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, 'runId'>>;
1009
1009
  hasSubscribers(stepId: string): boolean;
1010
- runMachine(parentStepId: string, input: any, container?: Container): Promise<(Pick<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId" | "timestamp" | "results" | "activePaths"> | undefined)[]>;
1010
+ runMachine(parentStepId: string, input: any, runtimeContext?: RuntimeContext): Promise<(Pick<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId" | "timestamp" | "results" | "activePaths"> | undefined)[]>;
1011
1011
  suspend(stepId: string, machine: Machine<TSteps, TTriggerSchema>): Promise<void>;
1012
1012
  /**
1013
1013
  * Persists the workflow state to the database
1014
1014
  */
1015
1015
  persistWorkflowSnapshot(): Promise<void>;
1016
1016
  getState(): Promise<WorkflowRunState | null>;
1017
- resumeWithEvent(eventName: string, data: any, container?: Container): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId"> | undefined>;
1018
- resume({ stepId, context: resumeContext, container, }: {
1017
+ resumeWithEvent(eventName: string, data: any, runtimeContext?: RuntimeContext): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId"> | undefined>;
1018
+ resume({ stepId, context: resumeContext, runtimeContext, }: {
1019
1019
  stepId: string;
1020
1020
  context?: Record<string, any>;
1021
- container?: Container;
1021
+ runtimeContext?: RuntimeContext;
1022
1022
  }): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId"> | undefined>;
1023
- _resume({ stepId, context: resumeContext, container, }: {
1023
+ _resume({ stepId, context: resumeContext, runtimeContext, }: {
1024
1024
  stepId: string;
1025
1025
  context?: Record<string, any>;
1026
- container: Container;
1026
+ runtimeContext: RuntimeContext;
1027
1027
  }): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, TResult>, "runId"> | undefined>;
1028
1028
  }
1029
1029
 
@@ -1092,11 +1092,11 @@ declare class Workflow<TSteps extends Step<string, any, any>[] = Step<string, an
1092
1092
  getWorkflowRuns(): Promise<WorkflowRuns>;
1093
1093
  getExecutionSpan(runId: string): Span | undefined;
1094
1094
  getState(runId: string): Promise<WorkflowRunState | null>;
1095
- resume({ runId, stepId, context: resumeContext, container, }: {
1095
+ resume({ runId, stepId, context: resumeContext, runtimeContext, }: {
1096
1096
  runId: string;
1097
1097
  stepId: string;
1098
1098
  context?: Record<string, any>;
1099
- container: Container;
1099
+ runtimeContext: RuntimeContext;
1100
1100
  }): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, any>, "runId"> | undefined>;
1101
1101
  watch(onTransition: (state: Pick<WorkflowRunResult<TTriggerSchema, TSteps, TResultSchema>, 'results' | 'activePaths' | 'runId' | 'timestamp'>) => void): () => void;
1102
1102
  resumeWithEvent(runId: string, eventName: string, data: any): Promise<Omit<WorkflowRunResult<TTriggerSchema, TSteps, any>, "runId"> | undefined>;
@@ -1320,7 +1320,7 @@ type MastraCustomLLMOptions<Z extends ZodSchema | JSONSchema7 | undefined = unde
1320
1320
  telemetry?: TelemetrySettings;
1321
1321
  threadId?: string;
1322
1322
  resourceId?: string;
1323
- container: Container;
1323
+ runtimeContext: RuntimeContext;
1324
1324
  } & Run;
1325
1325
  type LLMTextOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefined> = {
1326
1326
  messages: CoreMessage[];
@@ -1581,8 +1581,8 @@ type AgentGenerateOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefi
1581
1581
  };
1582
1582
  /** Telemetry settings */
1583
1583
  telemetry?: TelemetrySettings;
1584
- /** Container for dependency injection */
1585
- container?: Container;
1584
+ /** RuntimeContext for dependency injection */
1585
+ runtimeContext?: RuntimeContext;
1586
1586
  } & ({
1587
1587
  resourceId?: undefined;
1588
1588
  threadId?: undefined;
@@ -1625,8 +1625,8 @@ type AgentStreamOptions<Z extends ZodSchema | JSONSchema7 | undefined = undefine
1625
1625
  experimental_output?: Z;
1626
1626
  /** Telemetry settings */
1627
1627
  telemetry?: TelemetrySettings;
1628
- /** Container for dependency injection */
1629
- container?: Container;
1628
+ /** RuntimeContext for dependency injection */
1629
+ runtimeContext?: RuntimeContext;
1630
1630
  } & ({
1631
1631
  resourceId?: undefined;
1632
1632
  threadId?: undefined;
@@ -1657,6 +1657,26 @@ type ServerConfig = {
1657
1657
  * @default { origin: '*', allowMethods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], allowHeaders: ['Content-Type', 'Authorization', 'x-mastra-client-type'], exposeHeaders: ['Content-Length', 'X-Requested-With'], credentials: false }
1658
1658
  */
1659
1659
  cors?: Parameters<typeof cors>[0] | false;
1660
+ /**
1661
+ * Build configuration for the server
1662
+ */
1663
+ build?: {
1664
+ /**
1665
+ * Enable Swagger UI
1666
+ * @default false
1667
+ */
1668
+ swaggerUI?: boolean;
1669
+ /**
1670
+ * Enable API request logging
1671
+ * @default false
1672
+ */
1673
+ apiReqLogs?: boolean;
1674
+ /**
1675
+ * Enable OpenAPI documentation
1676
+ * @default false
1677
+ */
1678
+ openAPIDocs?: boolean;
1679
+ };
1660
1680
  };
1661
1681
 
1662
1682
  interface Config<TAgents extends Record<string, Agent<any>> = Record<string, Agent<any>>, TWorkflows extends Record<string, Workflow> = Record<string, Workflow>, TVectors extends Record<string, MastraVector> = Record<string, MastraVector>, TTTS extends Record<string, MastraTTS> = Record<string, MastraTTS>, TLogger extends Logger = Logger, TNetworks extends Record<string, AgentNetwork> = Record<string, AgentNetwork>> {
@@ -1825,13 +1845,13 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
1825
1845
  }>;
1826
1846
  private getResponseMessages;
1827
1847
  sanitizeResponseMessages(messages: Array<CoreMessage$1>): Array<CoreMessage$1>;
1828
- convertTools({ toolsets, clientTools, threadId, resourceId, runId, container, }: {
1848
+ convertTools({ toolsets, clientTools, threadId, resourceId, runId, runtimeContext, }: {
1829
1849
  toolsets?: ToolsetsInput;
1830
1850
  clientTools?: ToolsInput;
1831
1851
  threadId?: string;
1832
1852
  resourceId?: string;
1833
1853
  runId?: string;
1834
- container: Container;
1854
+ runtimeContext: RuntimeContext;
1835
1855
  }): Record<string, CoreTool>;
1836
1856
  preExecute({ resourceId, runId, threadId, thread, memoryConfig, messages, systemMessage, }: {
1837
1857
  runId?: string;
@@ -1845,7 +1865,7 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
1845
1865
  coreMessages: CoreMessage$1[];
1846
1866
  threadIdToUse: string;
1847
1867
  }>;
1848
- __primitive({ instructions, messages, context, threadId, memoryConfig, resourceId, runId, toolsets, clientTools, container, }: {
1868
+ __primitive({ instructions, messages, context, threadId, memoryConfig, resourceId, runId, toolsets, clientTools, runtimeContext, }: {
1849
1869
  instructions?: string;
1850
1870
  toolsets?: ToolsetsInput;
1851
1871
  clientTools?: ToolsInput;
@@ -1855,7 +1875,7 @@ declare class Agent<TAgentId extends string = string, TTools extends ToolsInput
1855
1875
  context?: CoreMessage$1[];
1856
1876
  runId?: string;
1857
1877
  messages: CoreMessage$1[];
1858
- container: Container;
1878
+ runtimeContext: RuntimeContext;
1859
1879
  }): {
1860
1880
  before: () => Promise<{
1861
1881
  messageObjects: CoreMessage$1[];
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkLZQIMLJV_cjs = require('./chunk-LZQIMLJV.cjs');
3
+ var chunkNZDXKMDP_cjs = require('./chunk-NZDXKMDP.cjs');
4
4
  var crypto = require('crypto');
5
5
  var ai = require('ai');
6
6
  var jsonSchemaToZod = require('json-schema-to-zod');
@@ -227,7 +227,7 @@ function createLogMessageOptions({ agentName, toolName, type }) {
227
227
  };
228
228
  }
229
229
  function createExecute(tool, options, logType) {
230
- const { logger, mastra: _mastra, memory: _memory, container, ...rest } = options;
230
+ const { logger, mastra: _mastra, memory: _memory, runtimeContext, ...rest } = options;
231
231
  const { start, error } = createLogMessageOptions({
232
232
  agentName: options.agentName,
233
233
  toolName: options.name,
@@ -245,7 +245,7 @@ function createExecute(tool, options, logType) {
245
245
  mastra: options.mastra,
246
246
  memory: options.memory,
247
247
  runId: options.runId,
248
- container: container ?? new chunkLZQIMLJV_cjs.Container()
248
+ runtimeContext: runtimeContext ?? new chunkNZDXKMDP_cjs.RuntimeContext()
249
249
  },
250
250
  execOptions
251
251
  ) ?? void 0;
@@ -442,6 +442,7 @@ exports.delay = delay;
442
442
  exports.ensureAllMessagesAreCoreMessages = ensureAllMessagesAreCoreMessages;
443
443
  exports.ensureToolProperties = ensureToolProperties;
444
444
  exports.isVercelTool = isVercelTool;
445
+ exports.isZodType = isZodType;
445
446
  exports.jsonSchemaPropertiesToTSTypes = jsonSchemaPropertiesToTSTypes;
446
447
  exports.jsonSchemaToModel = jsonSchemaToModel;
447
448
  exports.makeCoreTool = makeCoreTool;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkKR6AYHNH_cjs = require('./chunk-KR6AYHNH.cjs');
3
+ var chunk53P5ZBJE_cjs = require('./chunk-53P5ZBJE.cjs');
4
4
  var zod = require('zod');
5
5
 
6
6
  // src/integration/integration.ts
@@ -68,7 +68,7 @@ var OpenAPIToolset = class {
68
68
  const tools = Object.keys(clientMethods).reduce((acc, key) => {
69
69
  const comment = documentations[key]?.comment;
70
70
  const fallbackComment = `Execute ${key}`;
71
- const tool = chunkKR6AYHNH_cjs.createTool({
71
+ const tool = chunk53P5ZBJE_cjs.createTool({
72
72
  id: key,
73
73
  inputSchema: schemas[key] || zod.z.object({}),
74
74
  description: comment || fallbackComment,